solorice/vscodium/extensions/ms-python.vscode-pylance-2022.4.2/dist/pyright.bundle.js
2022-04-28 21:17:01 +03:00

2 lines
1.2 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"use strict";exports.id=885,exports.ids=[885],exports.modules={82048:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveAliasDeclaration=void 0,t.resolveAliasDeclaration=function e(t,n,s,i){let r=n;const a=[];let o,l,c=!1,p=!1;for(;;){if(6!==r.type||!r.symbolName)return{declaration:r,isPrivate:c,privatePyTypedImported:o,privatePyTypedImporter:l};if(!s&&r.usesLocalName)return{declaration:r,isPrivate:c,privatePyTypedImported:o,privatePyTypedImporter:l};let d;r.path&&r.loadSymbolsFromPath&&(d=t(r.path));const u=d?d.symbolTable.get(r.symbolName):void 0;if(!u)return r.submoduleFallback?e(t,r.submoduleFallback,s,i):r.isNativeLib?{declaration:void 0,isPrivate:c}:void 0;if(u.isPrivateMember()&&(c=!0),u.isExternallyHidden()&&!i)return;let m=u.getTypedDeclarations();if(m=m.filter((e=>!e.isInExceptSuite)),0===m.length&&(m=u.getDeclarations(),m=m.filter((e=>!e.isInExceptSuite))),0===m.length&&(m=u.getDeclarations()),0===m.length)return;const y=m.filter((e=>!a.includes(e)));if(r=y.length>0?y[y.length-1]:m[m.length-1],p&&(o=null!=o?o:null==r?void 0:r.moduleName),u.isPrivatePyTypedImport()&&(p=!0),p&&(l=null!=l?l:null==r?void 0:r.moduleName),a.find((e=>e===r)))return r.path===n.path&&6===r.type&&r.submoduleFallback?e(t,r.submoduleFallback,s,i):{declaration:n,isPrivate:c,privatePyTypedImported:o,privatePyTypedImporter:l};a.push(r)}}},20166:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.analyzeProgram=t.nullCallback=void 0;const a=n(38213),o=r(n(20823)),l=n(76962);t.nullCallback=e=>{},t.analyzeProgram=function(e,n,s,i,r,c){let p=!1;i=null!=i?i:t.nullCallback;try{(0,a.throwIfCancellationRequested)(c);const t=new l.Duration;p=e.analyze(n,c);const r=e.getFilesToAnalyzeCount(),o=e.getDiagnostics(s),d=o.length,u=t.getDurationInSeconds();(d>0||!p)&&i({diagnostics:o,filesInProgram:e.getFileCount(),filesRequiringAnalysis:r,checkingOnlyOpenFiles:e.isCheckingOnlyOpenFiles(),fatalErrorOccurred:!1,configParseErrorOccurred:!1,elapsedTime:u})}catch(e){if(a.OperationCanceledException.is(e))return!1;const t=o.getErrorString(e);r.error("Error performing analysis: "+t),i({diagnostics:[],filesInProgram:0,filesRequiringAnalysis:0,checkingOnlyOpenFiles:!0,fatalErrorOccurred:!0,configParseErrorOccurred:!1,elapsedTime:0,error:o.getSerializableError(e)})}return p}},48306:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isAnnotationEvaluationPostponed=void 0;const s=n(57485);t.isAnnotationEvaluationPostponed=function(e){return void 0!==e.futureImports.get("annotations")||e.executionEnvironment.pythonVersion>=s.PythonVersion.V3_11||e.isStubFile}},35696:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isCodeUnreachable=t.setDunderAllInfo=t.getDunderAllInfo=t.setCodeFlowComplexity=t.getCodeFlowComplexity=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 s=n(66124);function i(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,delete t.codeFlowExpressions,delete t.codeFlowComplexity,delete t.dunderAllInfo},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=i,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){for(;36!==e.nodeType;)e=e.parent;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.getCodeFlowComplexity=function(e){var t;return null!==(t=e.codeFlowComplexity)&&void 0!==t?t:0},t.setCodeFlowComplexity=function(e,t){e.codeFlowComplexity=t},t.getDunderAllInfo=function(e){return e.dunderAllInfo},t.setDunderAllInfo=function(e,t){e.dunderAllInfo=t},t.isCodeUnreachable=function(e){let t=e;for(;t;){const e=i(t);if(e)return!!(e.flags&s.FlowFlags.Unreachable);t=t.parent}return!1}},47041:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundAnalysisProgram=void 0;const s=n(20166),i=n(73054);t.BackgroundAnalysisProgram=class{constructor(e,t,n,s,r,a,o){this._console=e,this._configOptions=t,this._importResolver=n,this._backgroundAnalysis=r,this._maxAnalysisTime=a,this._disableChecker=o,this._program=new i.Program(this._importResolver,this._configOptions,this._console,s,void 0,this._disableChecker)}get configOptions(){return this._configOptions}get importResolver(){return this._importResolver}get program(){return this._program}get host(){return this._importResolver.host}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){var t;this._importResolver=e,null===(t=this._backgroundAnalysis)||void 0===t||t.setImportResolver(e),this._program.setImportResolver(e),this._configOptions.getExecutionEnvironments().forEach((e=>this._ensurePartialStubPackages(e)))}setTrackedFiles(e){var t;null===(t=this._backgroundAnalysis)||void 0===t||t.setTrackedFiles(e);const n=this._program.setTrackedFiles(e);this._reportDiagnosticsForRemovedFiles(n)}setAllowedThirdPartyImports(e){var t;null===(t=this._backgroundAnalysis)||void 0===t||t.setAllowedThirdPartyImports(e),this._program.setAllowedThirdPartyImports(e)}setFileOpened(e,t,n,s){var i;null===(i=this._backgroundAnalysis)||void 0===i||i.setFileOpened(e,t,[{text:n}],s),this._program.setFileOpened(e,t,[{text:n}],s)}updateOpenFileContents(e,t,n,s){var i;null===(i=this._backgroundAnalysis)||void 0===i||i.setFileOpened(e,t,n,s),this._program.setFileOpened(e,t,n,s),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,t=!0){var n;null===(n=this._backgroundAnalysis)||void 0===n||n.markAllFilesDirty(e,t),this._program.markAllFilesDirty(e,t)}markFilesDirty(e,t,n=!0){var s;null===(s=this._backgroundAnalysis)||void 0===s||s.markFilesDirty(e,t,n),this._program.markFilesDirty(e,t,n)}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):(0,s.analyzeProgram)(this._program,this._maxAnalysisTime,this._configOptions,this._onAnalysisCompletion,this._console,e)}test_setIndexing(e,t){const n=this._getIndices();for(const[t,s]of e)n.setWorkspaceIndex(t,s);for(const[e,s]of t)for(const[t,i]of s)n.setIndex(e,t,i)}startIndexing(e){var t;null===(t=this._backgroundAnalysis)||void 0===t||t.startIndexing(e,this._configOptions,this.importResolver,this.host.kind,this._getIndices())}refreshIndexing(){var e;null===(e=this._backgroundAnalysis)||void 0===e||e.refreshIndexing(this._configOptions,this.importResolver,this.host.kind,this._indices)}cancelIndexing(){var e;null===(e=this._backgroundAnalysis)||void 0===e||e.cancelIndexing(this._configOptions)}getIndexing(e){var t;return null===(t=this._indices)||void 0===t?void 0:t.getIndex(this._configOptions.findExecEnvironment(e).root)}async getDiagnosticsForRange(e,t,n){return this._backgroundAnalysis?this._backgroundAnalysis.getDiagnosticsForRange(e,t,n):this._program.getDiagnosticsForRange(e,t)}async writeTypeStub(e,t,n,i){return this._backgroundAnalysis?this._backgroundAnalysis.writeTypeStub(e,t,n,i):((0,s.analyzeProgram)(this._program,void 0,this._configOptions,this._onAnalysisCompletion,this._console,i),this._program.writeTypeStub(e,t,n,i))}invalidateAndForceReanalysis(e,t){var n;t&&this.refreshIndexing(),null===(n=this._backgroundAnalysis)||void 0===n||n.invalidateAndForceReanalysis(e),this._importResolver.invalidateCache(),this._program.markAllFilesDirty(!0,e)}restart(){var e;null===(e=this._backgroundAnalysis)||void 0===e||e.restart()}_ensurePartialStubPackages(e){var t;return null===(t=this._backgroundAnalysis)||void 0===t||t.ensurePartialStubPackages(e.root),this._importResolver.ensurePartialStubPackages(e)}_getIndices(){if(!this._indices){const e=this._program,t=new Map;this._indices={setWorkspaceIndex(t,n){var s;null===(s=e.getSourceFile(t))||void 0===s||s.cacheIndexResults(n)},getIndex:e=>t.get(e),setIndex(e,n,s){let i=t.get(e);i||(i=new Map,t.set(e,i)),i.set(n,s)},reset(){t.clear()}}}return this._indices}_reportDiagnosticsForRemovedFiles(e){e.length>0&&!this._backgroundAnalysis&&this._onAnalysisCompletion&&this._onAnalysisCompletion({diagnostics:e,filesInProgram:this._program.getFileCount(),filesRequiringAnalysis:this._program.getFilesToAnalyzeCount(),checkingOnlyOpenFiles:this._program.isCheckingOnlyOpenFiles(),fatalErrorOccurred:!1,configParseErrorOccurred:!1,elapsedTime:0})}}},91242:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ReturnFinder=t.YieldFinder=t.Binder=void 0;const a=n(9133),o=n(20823),l=n(15741),c=n(94647),p=n(28348),d=n(80957),u=n(80957),m=n(74426),y=n(48306),h=r(n(35696)),g=n(66124),f=r(n(23241)),T=n(22339),_=n(17640),v=r(n(67737)),b=n(97882),I=n(91197);class C extends T.ParseTreeWalker{constructor(e,t=!1){super(),this._moduleSymbolOnly=t,this._deferredBindingTasks=[],this._currentExceptTargets=[],this._finallyTargets=[],this._typingImportAliases=[],this._sysImportAliases=[],this._dataclassesImportAliases=[],this._typingSymbolAliases=new Map,this._dataclassesSymbolAliases=new Map,this._dunderAllStringNodes=[],this._usesUnsupportedDunderAllForm=!1,this._isInExceptSuite=!1,this._potentialHiddenSymbols=new Map,this._potentialPrivateSymbols=new Map,this._codeFlowComplexity=0,this._fileInfo=e}bindModule(e){var t;const n=void 0===this._fileInfo.builtinsScope;this._createNewScope(n?4:3,this._fileInfo.builtinsScope,(()=>{h.setScope(e,this._currentScope),h.setFlowNode(e,this._currentFlowNode),this._addImplicitSymbolToCurrentScope("__doc__",e,"str | None"),this._addImplicitSymbolToCurrentScope("__name__",e,"str"),this._addImplicitSymbolToCurrentScope("__qualname__",e,"str"),this._addImplicitSymbolToCurrentScope("__loader__",e,"Any"),this._addImplicitSymbolToCurrentScope("__package__",e,"str"),this._addImplicitSymbolToCurrentScope("__spec__",e,"Any"),this._addImplicitSymbolToCurrentScope("__path__",e,"Iterable[str]"),this._addImplicitSymbolToCurrentScope("__file__",e,"str"),this._addImplicitSymbolToCurrentScope("__cached__",e,"str"),this._addImplicitSymbolToCurrentScope("__dict__",e,"Dict[str, Any]"),this._addImplicitSymbolToCurrentScope("__annotations__",e,"Dict[str, Any]"),this._addImplicitSymbolToCurrentScope("__builtins__",e,"Any"),this._currentFlowNode=this._createStartFlowNode(),this._walkStatementsAndReportUnreachable(e.statements),h.setAfterFlowNode(e,this._currentFlowNode),h.setCodeFlowExpressions(e,this._currentScopeCodeFlowExpressions),h.setCodeFlowComplexity(e,this._codeFlowComplexity)})),this._bindDeferred(),this._potentialHiddenSymbols.forEach(((e,t)=>{var n;(null===(n=this._dunderAllNames)||void 0===n?void 0:n.some((e=>e===t)))||(this._fileInfo.isStubFile?e.setIsExternallyHidden():e.setPrivatePyTypedImport())})),this._potentialPrivateSymbols.forEach(((e,t)=>{var n;(null===(n=this._dunderAllNames)||void 0===n?void 0:n.some((e=>e===t)))||e.setIsPrivateMember()})),this._dunderAllNames?h.setDunderAllInfo(e,{names:this._dunderAllNames,stringNodes:this._dunderAllStringNodes,usesUnsupportedDunderAllForm:this._usesUnsupportedDunderAllForm}):h.setDunderAllInfo(e,void 0);const s=h.getScope(e);if(s&&this._dunderAllNames)for(const e of this._dunderAllNames)null===(t=s.symbolTable.get(e))||void 0===t||t.setIsInDunderAll()}visitModule(e){return(0,o.fail)("We should never get here"),!1}visitSuite(e){return this._walkStatementsAndReportUnreachable(e.statements),!1}visitModuleName(e){const t=h.getImportInfo(e);if((0,o.assert)(void 0!==t),t.isNativeLib)return!0;if(!t.isImportFound)return this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingImports,l.DiagnosticRule.reportMissingImports,m.Localizer.Diagnostic.importResolveFailure().format({importName:t.importName}),e),!0;if(!t.isStubFile&&1===t.importType&&!t.pyTypedInfo){const n=this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingTypeStubs,l.DiagnosticRule.reportMissingTypeStubs,m.Localizer.Diagnostic.stubFileMissing().format({importName:t.importName}),e);if(n){const e={action:"pyright.createtypestub",moduleName:t.importName};n.addAction(e)}}return!0}visitClass(e){this.walkMultiple(e.decorators);const t={type:4,node:e,path:this._fileInfo.filePath,range:(0,p.convertOffsetsToRange)(e.name.start,u.TextRange.getEnd(e.name),this._fileInfo.lines),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite},n=this._bindNameToScope(this._currentScope,e.name.value);n&&n.addDeclaration(t),h.setDeclaration(e,t),this.walkMultiple(e.arguments);let s=this._currentScope;for(;2===s.type;)s=s.parent;return this._createNewScope(2,s,(()=>{h.setScope(e,this._currentScope),this._addImplicitSymbolToCurrentScope("__doc__",e,"str | None"),this._addImplicitSymbolToCurrentScope("__module__",e,"str"),this._moduleSymbolOnly||this.walk(e.suite)})),this._createAssignmentTargetFlowNodes(e.name,!1,!1),!1}visitFunction(e){h.setFlowNode(e,this._currentFlowNode);const t=this._bindNameToScope(this._currentScope,e.name.value),n=f.getEnclosingClass(e,!0),s={type:3,node:e,isMethod:!!n,isGenerator:!1,path:this._fileInfo.filePath,range:(0,p.convertOffsetsToRange)(e.name.start,u.TextRange.getEnd(e.name),this._fileInfo.lines),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite};return t&&t.addDeclaration(s),h.setDeclaration(e,s),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),this._createNewScope(1,this._getNonClassParentScope(),(()=>{h.setScope(e,this._currentScope);f.getEnclosingClass(e)&&this._addImplicitSymbolToCurrentScope("__class__",e,"class"),this._deferBinding((()=>{this._currentFlowNode=this._createStartFlowNode(),this._codeFlowComplexity=0,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:(0,p.convertOffsetsToRange)(e.start,u.TextRange.getEnd(e),this._fileInfo.lines),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite};t.addDeclaration(n),h.setDeclaration(e.name,n)}this._createFlowAssignment(e.name)}})),this._targetFunctionDeclaration=s,this._currentReturnTarget=this._createBranchLabel(),this.walk(e.suite),h.setAfterFlowNode(e.suite,this._currentFlowNode),this._addAntecedent(this._currentReturnTarget,this._currentFlowNode);const t=this._finishFlowLabel(this._currentReturnTarget);h.setAfterFlowNode(e,t),h.setCodeFlowExpressions(e,this._currentScopeCodeFlowExpressions),h.setCodeFlowComplexity(e,this._codeFlowComplexity)}))})),this._createAssignmentTargetFlowNodes(e.name,!1,!1),!1}visitLambda(e){return h.setFlowNode(e,this._currentFlowNode),e.parameters.forEach((e=>{e.defaultValue&&this.walk(e.defaultValue)})),this._createNewScope(1,this._getNonClassParentScope(),(()=>{h.setScope(e,this._currentScope),this._deferBinding((()=>{this._currentFlowNode=this._createStartFlowNode(),e.parameters.forEach((e=>{if(e.name){const t=this._bindNameToScope(this._currentScope,e.name.value);if(t){const n={type:2,node:e,path:this._fileInfo.filePath,range:(0,p.convertOffsetsToRange)(e.start,u.TextRange.getEnd(e),this._fileInfo.lines),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite};t.addDeclaration(n),h.setDeclaration(e.name,n)}this._createFlowAssignment(e.name),this.walk(e.name)}})),this.walk(e.expression),h.setCodeFlowExpressions(e,this._currentScopeCodeFlowExpressions)}))})),!1}visitCall(e){var t,n;if(this._disableTrueFalseTargets((()=>{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 s=!0;if("extend"===e.leftExpression.memberName.value&&1===e.arguments.length){const t=e.arguments[0].valueExpression;if(31===t.nodeType)t.entries.forEach((e=>{var t,n;48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType&&(null===(t=this._dunderAllNames)||void 0===t||t.push(e.strings[0].value),null===(n=this._dunderAllStringNodes)||void 0===n||n.push(e.strings[0]),s=!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)})),s=!1)}}else if("remove"===e.leftExpression.memberName.value&&1===e.arguments.length){const t=e.arguments[0].valueExpression;48===t.nodeType&&1===t.strings.length&&49===t.strings[0].nodeType&&this._dunderAllNames&&(this._dunderAllNames=this._dunderAllNames.filter((e=>e!==t.strings[0].value)),this._dunderAllStringNodes=this._dunderAllStringNodes.filter((e=>e.value!==t.strings[0].value)),s=!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),null===(n=this._dunderAllStringNodes)||void 0===n||n.push(i.strings[0]),s=!1)}s&&(this._usesUnsupportedDunderAllForm=!0,this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll,l.DiagnosticRule.reportUnsupportedDunderAll,m.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));let t=!1;54!==e.leftExpression.nodeType||(0,y.isAnnotationEvaluationPostponed)(this._fileInfo)||(this._createAssignmentTargetFlowNodes(e.leftExpression,!0,!1),t=!0),this.walk(e.rightExpression);let n=!0;if((f.getEnclosingFunction(e)||9===e.rightExpression.nodeType&&this._fileInfo.isTypingStubFile||f.isWithinLoop(e))&&(n=!1),this._addInferredTypeAssignmentForVariable(e.leftExpression,e.rightExpression,n),t||this._createAssignmentTargetFlowNodes(e.leftExpression,!0,!1),3===this._currentScope.type&&(38===e.leftExpression.nodeType&&"__all__"===e.leftExpression.value||54===e.leftExpression.nodeType&&38===e.leftExpression.valueExpression.nodeType&&"__all__"===e.leftExpression.valueExpression.value)){const t=e.rightExpression;this._dunderAllNames=[];let n=!1;31===t.nodeType?t.entries.forEach((e=>{48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType?(this._dunderAllNames.push(e.strings[0].value),this._dunderAllStringNodes.push(e.strings[0])):n=!0})):52===t.nodeType?t.expressions.forEach((e=>{48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType?(this._dunderAllNames.push(e.strings[0].value),this._dunderAllStringNodes.push(e.strings[0])):n=!0})):n=!0,n&&(this._usesUnsupportedDunderAllForm=!0,this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll,l.DiagnosticRule.reportUnsupportedDunderAll,m.Localizer.Diagnostic.unsupportedDunderAllOperation(),e))}if(2===this._currentScope.type&&(38===e.leftExpression.nodeType&&"__slots__"===e.leftExpression.value||54===e.leftExpression.nodeType&&38===e.leftExpression.valueExpression.nodeType&&"__slots__"===e.leftExpression.valueExpression.value)){const t=e.rightExpression,n=[];let s=!0;48===t.nodeType?n.push(t):31===t.nodeType?t.entries.forEach((e=>{48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType?n.push(e):s=!1})):52===t.nodeType?t.expressions.forEach((e=>{48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType?n.push(e):s=!1})):s=!1,s&&this._addSlotsToCurrentScope(n)}return!1}visitAssignmentExpression(e){this._disableTrueFalseTargets((()=>{this.walk(e.rightExpression)}));const t=f.getEvaluationNodeForAssignmentExpression(e);if(t){const n=h.getScope(t);let s=this._currentScope;for(;s&&s!==n;){if(s.lookUpSymbol(e.name.value)){this._addError(m.Localizer.Diagnostic.assignmentExprComprehension().format({name:e.name.value}),e.name);break}s=s.parent}this._bindNameToScope(n,e.name.value),this._addInferredTypeAssignmentForVariable(e.name,e.rightExpression),this._createAssignmentTargetFlowNodes(e.name,!0,!1)}else this._addError(m.Localizer.Diagnostic.assignmentExprContext(),e),this.walk(e.name);return!1}visitAugmentedAssignment(e){if(this.walk(e.leftExpression),this.walk(e.rightExpression),this._bindPossibleTupleNamedTarget(e.destExpression),this._createAssignmentTargetFlowNodes(e.destExpression,!1,!1),1===e.operator&&3===this._currentScope.type&&38===e.leftExpression.nodeType&&"__all__"===e.leftExpression.value){const t=e.rightExpression;let n=!0;if(31===t.nodeType)t.entries.forEach((e=>{var t;48===e.nodeType&&1===e.strings.length&&49===e.strings[0].nodeType&&(null===(t=this._dunderAllNames)||void 0===t||t.push(e.strings[0].value),this._dunderAllStringNodes.push(e.strings[0]))})),n=!1;else if(35===t.nodeType&&38===t.leftExpression.nodeType&&"__all__"===t.memberName.value){const e=this._getDunderAllNamesFromImport(t.leftExpression.value);e&&(e.forEach((e=>{var t;null===(t=this._dunderAllNames)||void 0===t||t.push(e)})),n=!1)}n&&(this._usesUnsupportedDunderAllForm=!0,this._addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll,l.DiagnosticRule.reportUnsupportedDunderAll,m.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=(0,g.createKeyForReference)(e);this._currentScopeCodeFlowExpressions.add(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(),s=this._createBranchLabel();if(this._addAntecedent(t,this._currentFlowNode),this._currentFlowNode=t,this._addAntecedent(n,this._currentFlowNode),this._createAssignmentTargetFlowNodes(e.targetExpression,!0,!1),this._bindLoopStatement(t,s,(()=>{this.walk(e.forSuite),this._addAntecedent(t,this._currentFlowNode)})),this._currentFlowNode=this._finishFlowLabel(n),e.elseSuite&&this.walk(e.elseSuite),this._addAntecedent(s,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(s),e.asyncToken){const t=f.getEnclosingFunction(e);t&&t.isAsync||this._addError(m.Localizer.Diagnostic.asyncNotInAsyncFunction(),e.asyncToken)}return!1}visitContinue(e){return this._currentContinueTarget&&this._addAntecedent(this._currentContinueTarget,this._currentFlowNode),this._currentFlowNode=C._unreachableFlowNode,!1}visitBreak(e){return this._currentBreakTarget&&this._addAntecedent(this._currentBreakTarget,this._currentFlowNode),this._currentFlowNode=C._unreachableFlowNode,!1}visitReturn(e){return this._targetFunctionDeclaration&&(this._targetFunctionDeclaration.returnStatements||(this._targetFunctionDeclaration.returnStatements=[]),this._targetFunctionDeclaration.returnStatements.push(e)),e.returnExpression&&this.walk(e.returnExpression),h.setFlowNode(e,this._currentFlowNode),this._currentReturnTarget&&this._addAntecedent(this._currentReturnTarget,this._currentFlowNode),this._finallyTargets.forEach((e=>{this._addAntecedent(e,this._currentFlowNode)})),this._currentFlowNode=C._unreachableFlowNode,!1}visitYield(e){return this._isInListComprehension(e,!0)&&this._addError(m.Localizer.Diagnostic.yieldWithinListCompr(),e),this._bindYield(e),!1}visitYieldFrom(e){return this._isInListComprehension(e,!0)&&this._addError(m.Localizer.Diagnostic.yieldWithinListCompr(),e),this._bindYield(e),!1}visitMemberAccess(e){return h.setFlowNode(e,this._currentFlowNode),!0}visitName(e){return h.setFlowNode(e,this._currentFlowNode),!1}visitIndex(e){return h.setFlowNode(e,this._currentFlowNode),!0}visitIf(e){const t=this._currentFlowNode,n=this._createBranchLabel(),s=this._createBranchLabel(),i=this._createBranchLabel(t);return i.affectedExpressions=this._trackCodeFlowExpressions((()=>{const t=v.evaluateStaticBoolLikeExpression(e.testExpression,this._fileInfo.executionEnvironment,this._typingImportAliases,this._sysImportAliases);this._bindConditional(e.testExpression,n,s),this._currentFlowNode=!1===t?C._unreachableFlowNode:this._finishFlowLabel(n),this.walk(e.ifSuite),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=!0===t?C._unreachableFlowNode:this._finishFlowLabel(s),e.elseSuite?this.walk(e.elseSuite):this._bindNeverCondition(e.testExpression,i,!1),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(i)})),!1}visitWhile(e){const t=this._createBranchLabel(),n=this._createBranchLabel(),s=this._createBranchLabel(),i=v.evaluateStaticBoolLikeExpression(e.testExpression,this._fileInfo.executionEnvironment,this._typingImportAliases,this._sysImportAliases),r=this._createLoopLabel();return this._addAntecedent(r,this._currentFlowNode),this._currentFlowNode=r,this._bindConditional(e.testExpression,t,n),this._currentFlowNode=!1===i?C._unreachableFlowNode:this._finishFlowLabel(t),this._bindLoopStatement(r,s,(()=>{this.walk(e.whileSuite)})),this._addAntecedent(r,this._currentFlowNode),this._currentFlowNode=!0===i?C._unreachableFlowNode:this._finishFlowLabel(n),e.elseSuite&&this.walk(e.elseSuite),this._addAntecedent(s,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(s),!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:(0,I.isConstantName)(e.name.value),inferredTypeSource:e,path:this._fileInfo.filePath,range:(0,p.convertOffsetsToRange)(e.name.start,u.TextRange.getEnd(e.name),this._fileInfo.lines),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite};t.addDeclaration(n)}}const t=this._isInExceptSuite;return this._isInExceptSuite=!0,this.walk(e.exceptSuite),this._isInExceptSuite=t,e.name&&this._createFlowAssignment(e.name,!0),!1}visitRaise(e){return this._targetFunctionDeclaration&&(this._targetFunctionDeclaration.raiseStatements||(this._targetFunctionDeclaration.raiseStatements=[]),this._targetFunctionDeclaration.raiseStatements.push(e)),e.typeExpression&&this.walk(e.typeExpression),e.valueExpression&&this.walk(e.valueExpression),e.tracebackExpression&&this.walk(e.tracebackExpression),this._finallyTargets.forEach((e=>{this._addAntecedent(e,this._currentFlowNode)})),this._currentFlowNode=C._unreachableFlowNode,!1}visitTry(e){const t=this._currentFlowNode,n=e.exceptClauses.map((()=>this._createBranchLabel())),s=this._createBranchLabel(t);let i=!1;const r=this._createBranchLabel(t),a={flags:g.FlowFlags.PreFinallyGate,id:(0,g.getUniqueFlowNodeId)(),antecedent:r,isGateClosed:!1};if(s.affectedExpressions=this._trackCodeFlowExpressions((()=>{e.finallySuite&&this._addAntecedent(s,a);e.exceptClauses.some((e=>!e.typeExpression))||n.push(r),n.forEach((e=>{this._addAntecedent(e,this._currentFlowNode)})),e.finallySuite&&this._finallyTargets.push(r),this._useExceptTargets(n,(()=>{this.walk(e.trySuite)})),e.elseSuite&&this.walk(e.elseSuite),this._addAntecedent(s,this._currentFlowNode),this._isCodeUnreachable()||(i=!0),e.exceptClauses.forEach(((e,t)=>{this._currentFlowNode=this._finishFlowLabel(n[t]),this.walk(e),this._addAntecedent(s,this._currentFlowNode),this._isCodeUnreachable()||(i=!0)})),e.finallySuite&&this._finallyTargets.pop(),this._currentFlowNode=this._finishFlowLabel(s)})),e.finallySuite){this.walk(e.finallySuite);const t={flags:g.FlowFlags.PostFinally,id:(0,g.getUniqueFlowNodeId)(),finallyNode:e.finallySuite,antecedent:this._currentFlowNode,preFinallyGate:a};this._currentFlowNode=i?t:C._unreachableFlowNode}return!1}visitAwait(e){var t;const n=f.getEnclosingFunction(e);if(void 0===n||!n.isAsync){if(this._fileInfo.isIPythonMode&&void 0===n)return!0;32!==(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&this._addError(m.Localizer.Diagnostic.awaitNotInAsync(),e)}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(m.Localizer.Diagnostic.nonLocalRedefinition().format({name:n}),e);const s=this._currentScope.lookUpSymbolRecursive(n);s&&s.scope===this._currentScope&&this._addError(m.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(m.Localizer.Diagnostic.nonLocalInModule(),e):e.nameList.forEach((e=>{const n=e.value;1===this._currentScope.getBindingType(n)&&this._addError(m.Localizer.Diagnostic.globalRedefinition().format({name:n}),e);const s=this._currentScope.lookUpSymbolRecursive(n);s&&s.scope===this._currentScope?this._addError(m.Localizer.Diagnostic.nonLocalReassignment().format({name:n}),e):s&&s.scope!==t||this._addError(m.Localizer.Diagnostic.nonLocalNoBinding().format({name:n}),e),s&&this._currentScope.setBindingType(n,0)})),!0}visitImportAs(e){var t,n,s,i,r,a;if(e.module.nameParts.length>0){const l=e.module.nameParts[0].value;let c;c=e.alias?e.alias.value:l;const p=this._bindNameToScope(this._currentScope,c);!p||3!==this._currentScope.type&&4!==this._currentScope.type||e.alias&&1===e.module.nameParts.length&&e.module.nameParts[0].value===e.alias.value||(this._fileInfo.isStubFile||this._fileInfo.isInPyTypedPackage)&&this._potentialHiddenSymbols.set(c,p);const d=h.getImportInfo(e.module);(0,o.assert)(void 0!==d),p&&this._createAliasDeclarationForMultipartImportName(e,e.alias,d,p),this._createFlowAssignment(e.alias?e.alias:e.module.nameParts[0]),1===e.module.nameParts.length&&("typing"===l||"typing_extensions"===l?this._typingImportAliases.push(null!==(n=null===(t=e.alias)||void 0===t?void 0:t.value)&&void 0!==n?n:l):"sys"===l?this._sysImportAliases.push(null!==(i=null===(s=e.alias)||void 0===s?void 0:s.value)&&void 0!==i?i:l):"dataclasses"===l&&this._dataclassesImportAliases.push(null!==(a=null===(r=e.alias)||void 0===r?void 0:r.value)&&void 0!==a?a:l))}return!0}visitImportFrom(e){const t=["Final","TypeAlias","ClassVar","Required","NotRequired","Annotated"],n=["InitVar"],s=h.getImportInfo(e.module);let i="";s&&s.isImportFound&&!s.isNativeLib&&(i=s.resolvedPaths[s.resolvedPaths.length-1]);const r=(0,c.stripFileExtension)((0,c.getFileName)(this._fileInfo.filePath)),a="__init__"===r&&1===e.module.leadingDots&&1===e.module.nameParts.length;let o=!1,l=!1;if(1===e.module.nameParts.length){const t=e.module.nameParts[0].value;"typing"!==t&&"typing_extensions"!==t||(o=!0),"dataclasses"===t&&(l=!0)}if(e.isWildcardImport){if((f.getEnclosingClass(e)||f.getEnclosingFunction(e))&&this._addError(m.Localizer.Diagnostic.wildcardInFunction(),e),s){const r=[],c=this._fileInfo.importLookup(i);if(c){const t=this._getWildcardImportNames(c);if(a){t.some((t=>t===e.module.nameParts[0].value))||this._addImplicitFromImport(e,s)}t.forEach((t=>{const n=this._bindNameToScope(this._currentScope,t);if(n){if(c.symbolTable.get(t)){const s={type:6,node:e,path:i,loadSymbolsFromPath:!0,range:(0,d.getEmptyRange)(),usesLocalName:!1,symbolName:t,moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite};n.addDeclaration(s),r.push(t)}else if(s&&s.filteredImplicitImports){const r=s.filteredImplicitImports.find((e=>e.name===t));if(r){const s={type:6,node:e,path:r.path,loadSymbolsFromPath:!0,range:(0,d.getEmptyRange)(),usesLocalName:!1,moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite},a={type:6,node:e,path:i,loadSymbolsFromPath:!0,usesLocalName:!1,symbolName:t,submoduleFallback:s,range:(0,d.getEmptyRange)(),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite};n.addDeclaration(a)}}}}))}this._createFlowWildcardImport(e,r),o&&t.forEach((e=>{this._typingSymbolAliases.set(e,e)})),l&&n.forEach((e=>{this._dataclassesSymbolAliases.set(e,e)}))}}else a&&this._addImplicitFromImport(e,s),e.imports.forEach((a=>{const c=a.name.value,p=a.alias||a.name,u=this._bindNameToScope(this._currentScope,p.value);if(u){let m,y;e.module.nameParts.length>0&&(3!==this._currentScope.type&&4!==this._currentScope.type||a.alias&&a.alias.value===a.name.value||(this._fileInfo.isStubFile||this._fileInfo.isInPyTypedPackage)&&this._potentialHiddenSymbols.set(p.value,u)),s&&s.filteredImplicitImports&&(m=s.filteredImplicitImports.find((e=>e.name===c)));let h=!0;m&&(y={type:6,node:a,path:m.path,loadSymbolsFromPath:!0,range:(0,d.getEmptyRange)(),usesLocalName:!1,moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite},"__init__"===r&&1===e.module.leadingDots&&0===e.module.nameParts.length&&(h=!1));const g={type:6,node:a,path:i,loadSymbolsFromPath:h,usesLocalName:!!a.alias,symbolName:c,submoduleFallback:y,range:(0,d.getEmptyRange)(),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite,isNativeLib:null==s?void 0:s.isNativeLib};u.addDeclaration(g),this._createFlowAssignment(a.alias||a.name),o&&t.some((e=>e===a.name.value))&&this._typingSymbolAliases.set(p.value,a.name.value),l&&n.some((e=>e===a.name.value))&&this._dataclassesSymbolAliases.set(p.value,a.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,!1);this._addAntecedent(t,this._currentFlowNode);const n=this._createContextManagerLabel(e.withItems.map((e=>e.expression)),!!e.isAsync,!0);this._currentExceptTargets.forEach((e=>{this._addAntecedent(e,n)}));const s=this._currentFlowNode,i=this._createBranchLabel(s);return this._addAntecedent(i,t),i.affectedExpressions=this._trackCodeFlowExpressions((()=>{if(this._useExceptTargets([t,n],(()=>{this.walk(e.suite)})),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=i,this._isCodeUnreachable()||this._addExceptTargets(this._currentFlowNode),e.asyncToken){const t=f.getEnclosingFunction(e);t&&t.isAsync||this._addError(m.Localizer.Diagnostic.asyncNotInAsyncFunction(),e.asyncToken)}})),!1}visitTernary(e){const t=this._currentFlowNode,n=this._createBranchLabel(),s=this._createBranchLabel(),i=this._createBranchLabel(t);return i.affectedExpressions=this._trackCodeFlowExpressions((()=>{this._bindConditional(e.testExpression,n,s),this._currentFlowNode=this._finishFlowLabel(n),this.walk(e.ifExpression),this._addAntecedent(i,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(s),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,s=this._currentFalseTarget;n&&s||(t=this._createBranchLabel(),n=s=t);const i=this._createBranchLabel();36===e.operator?this._bindConditional(e.leftExpression,i,s):this._bindConditional(e.leftExpression,n,i),this._currentFlowNode=this._finishFlowLabel(i),this._bindConditional(e.rightExpression,n,s),t&&(this._currentFlowNode=this._finishFlowLabel(t))}else this._disableTrueFalseTargets((()=>{this.walk(e.leftExpression),this.walk(e.rightExpression)}));return!1}visitListComprehension(e){const t=f.getEnclosingFunction(e);return this._createNewScope(0,this._getNonClassParentScope(),(()=>{var n;h.setScope(e,this._currentScope);const s=this._createBranchLabel();for(let s=0;s<e.forIfNodes.length;s++){const i=e.forIfNodes[s],r=new Map;33===i.nodeType&&(this._bindPossibleTupleNamedTarget(i.targetExpression,r),this._addInferredTypeAssignmentForVariable(i.targetExpression,i),i.asyncToken&&(t&&t.isAsync||31===(null===(n=e.parent)||void 0===n?void 0:n.nodeType)&&this._addError(m.Localizer.Diagnostic.asyncNotInAsyncFunction(),i.asyncToken)))}for(let t=0;t<e.forIfNodes.length;t++){const n=e.forIfNodes[t];if(33===n.nodeType)this.walk(n.iterableExpression),this._createAssignmentTargetFlowNodes(n.targetExpression,!0,!1);else{const e=this._createBranchLabel();this._bindConditional(n.testExpression,e,s),this._currentFlowNode=this._finishFlowLabel(e)}}this.walk(e.expression),this._addAntecedent(s,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(s)})),!1}visitMatch(e){this.walk(e.subjectExpression);const t=[],n=this._isNarrowingExpression(e.subjectExpression,t);n&&t.forEach((e=>{const t=(0,g.createKeyForReference)(e);this._currentScopeCodeFlowExpressions.add(t)}));const s=this._createBranchLabel();let i=!1;return e.cases.forEach((t=>{const r=this._createBranchLabel(),a=this._createBranchLabel(),o=this._createBranchLabel();this._addAntecedent(a,this._currentFlowNode),t.isIrrefutable?t.guardExpression||(i=!0):this._addAntecedent(r,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(a),this.walk(t.pattern),n&&this._createFlowNarrowForPattern(e.subjectExpression,t),t.guardExpression?this._bindConditional(t.guardExpression,o,r):this._addAntecedent(o,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(o),this.walk(t.suite),this._addAntecedent(s,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(r)})),n&&this._createFlowNarrowForPattern(e.subjectExpression,e),i||this._createFlowExhaustedMatch(e),this._addAntecedent(s,this._currentFlowNode),this._currentFlowNode=this._finishFlowLabel(s),!1}visitPatternAs(e){const t=this._createBranchLabel();if(e.orPatterns.forEach((e=>{this.walk(e),this._addAntecedent(t,this._currentFlowNode)})),this._currentFlowNode=this._finishFlowLabel(t),e.target){this.walk(e.target);const t=this._bindNameToScope(this._currentScope,e.target.value);if(this._createAssignmentTargetFlowNodes(e.target,!1,!1),t){const n={type:1,node:e.target,isConstant:(0,I.isConstantName)(e.target.value),inferredTypeSource:e,path:this._fileInfo.filePath,range:(0,p.convertOffsetsToRange)(e.target.start,u.TextRange.getEnd(e.target),this._fileInfo.lines),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite};t.addDeclaration(n)}}return!1}visitPatternCapture(e){return e.isWildcard||this._addPatternCaptureTarget(e.target),!0}visitPatternMappingExpandEntry(e){return"_"!==e.target.value&&this._addPatternCaptureTarget(e.target),!0}_getNonClassParentScope(){let e=this._currentScope;for(;2===e.type;)e=e.parent;return e}_addSlotsToCurrentScope(e){(0,o.assert)(2===this._currentScope.type);let t=!1;for(const n of e){const e=n.strings[0].value;if("__dict__"===e){t=!0;continue}let s=this._currentScope.lookUpSymbol(e);if(!s){s=this._currentScope.addSymbol(e,9);const t="none"!==this._fileInfo.diagnosticRuleSet.reportPrivateUsage;(0,I.isPrivateOrProtectedName)(e)&&t&&s.setIsPrivateMember()}const i={type:1,node:n,isConstant:(0,I.isConstantName)(e),isDefinedBySlots:!0,path:this._fileInfo.filePath,range:(0,p.convertOffsetsToRange)(n.start,n.start+n.length,this._fileInfo.lines),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite};s.addDeclaration(i)}t||this._currentScope.setSlotsNames(e.map((e=>e.strings[0].value)))}_isInListComprehension(e,t=!1){let n,s,i=e;for(;i;){if(32===i.nodeType){if(t&&i.forIfNodes.length>0){const e=i.forIfNodes[0];if(n===e&&33===e.nodeType&&s===e.iterableExpression)return!1}return!0}s=n,n=i,i=i.parent}return!1}_addPatternCaptureTarget(e){const t=this._bindNameToScope(this._currentScope,e.value);if(this._createAssignmentTargetFlowNodes(e,!1,!1),t){const n={type:1,node:e,isConstant:(0,I.isConstantName)(e.value),inferredTypeSource:e.parent,path:this._fileInfo.filePath,range:(0,p.convertOffsetsToRange)(e.start,u.TextRange.getEnd(e),this._fileInfo.lines),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite};t.addDeclaration(n)}}_useExceptTargets(e,t){const n=this._currentExceptTargets;this._currentExceptTargets=e,t(),this._currentExceptTargets=n}_getDunderAllNamesFromImport(e){var t;const n=this._currentScope.lookUpSymbol(e);if(!n)return;const s=n.getDeclarations().find((e=>6===e.type)),i=(null==s?void 0:s.path)&&s.loadSymbolsFromPath?s.path:(null===(t=null==s?void 0:s.submoduleFallback)||void 0===t?void 0:t.path)&&s.submoduleFallback.loadSymbolsFromPath?s.submoduleFallback.path:void 0;if(!i)return;const r=this._fileInfo.importLookup(i);return r?r.dunderAllNames:void 0}_addImplicitFromImport(e,t){const n=e.module.nameParts[0].value,s=this._bindNameToScope(this._currentScope,n);s&&this._createAliasDeclarationForMultipartImportName(e,void 0,t,s),this._createFlowAssignment(e.module.nameParts[0])}_createAliasDeclarationForMultipartImportName(e,t,n,s){var i;const r=e.module.nameParts[0].value,a=s.getDeclarations().find((e=>6===e.type&&e.firstNamePart===r));let o,l;l=n&&n.isImportFound&&!n.isNativeLib&&n.resolvedPaths.length>0?n.resolvedPaths[n.resolvedPaths.length-1]:"*** unresolved ***";const c=n&&n.isImportFound&&!n.isNativeLib&&n.resolvedPaths.length>0;if(o=a||(c?{type:6,node:e,path:l,loadSymbolsFromPath:!1,range:(0,d.getEmptyRange)(),usesLocalName:!!t,moduleName:n.importName,firstNamePart:r,isInExceptSuite:this._isInExceptSuite}:{type:6,node:e,path:l,loadSymbolsFromPath:!0,range:(0,d.getEmptyRange)(),usesLocalName:!!t,moduleName:null!==(i=null==n?void 0:n.importName)&&void 0!==i?i:"",firstNamePart:r,isUnresolved:!0,isInExceptSuite:this._isInExceptSuite}),t||1===e.module.nameParts.length)o.path=l,o.loadSymbolsFromPath=!0,o.isUnresolved=!1,n&&this._addImplicitImportsToLoaderActions(n,o);else{let t=o;for(let s=1;s<e.module.nameParts.length;s++){const i=e.module.nameParts[s].value;let r=t.implicitImports?t.implicitImports.get(i):void 0;if(!r){r={path:n&&s<n.resolvedPaths.length?n.resolvedPaths[s]:"*** unresolved ***",loadSymbolsFromPath:!1,implicitImports:new Map,isUnresolved:!c},t.implicitImports||(t.implicitImports=new Map),t.implicitImports.set(i,r)}s===e.module.nameParts.length-1&&n&&s<n.resolvedPaths.length&&(r.path=n.resolvedPaths[s],r.loadSymbolsFromPath=!0,this._addImplicitImportsToLoaderActions(n,r)),t=r}}a||s.addDeclaration(o)}_getWildcardImportNames(e){const t=[];if(e.dunderAllNames){if(!e.usesUnsupportedDunderAllForm)return e.dunderAllNames;(0,a.appendArray)(t,e.dunderAllNames)}return e.symbolTable.forEach(((e,n)=>{e.isExternallyHidden()||(0,I.isPrivateOrProtectedName)(n)||t.push(n)})),t}_walkStatementsAndReportUnreachable(e){let t=!1;for(const n of e)if(h.setFlowNode(n,this._currentFlowNode),t||(t=this._isCodeUnreachable()),t){if(this._targetFunctionDeclaration&&!this._targetFunctionDeclaration.isGenerator){(new S).checkContainsYield(n)&&(this._targetFunctionDeclaration.isGenerator=!0)}}else this.walk(n);return!1}_createStartFlowNode(){return{flags:g.FlowFlags.Start,id:(0,g.getUniqueFlowNodeId)()}}_createBranchLabel(e){return{flags:g.FlowFlags.BranchLabel,id:(0,g.getUniqueFlowNodeId)(),antecedents:[],preBranchAntecedent:e,affectedExpressions:void 0}}_createFlowNarrowForPattern(e,t){const n={flags:g.FlowFlags.NarrowForPattern,id:(0,g.getUniqueFlowNodeId)(),subjectExpression:e,statement:t,antecedent:this._currentFlowNode};this._currentFlowNode=n}_createContextManagerLabel(e,t,n){return{flags:g.FlowFlags.PostContextManager|g.FlowFlags.BranchLabel,id:(0,g.getUniqueFlowNodeId)(),antecedents:[],expressions:e,affectedExpressions:void 0,isAsync:t,blockIfSwallowsExceptions:n}}_createLoopLabel(){return{flags:g.FlowFlags.LoopLabel,id:(0,g.getUniqueFlowNodeId)(),antecedents:[],affectedExpressions:void 0}}_finishFlowLabel(e){return 0===e.antecedents.length?C._unreachableFlowNode:1===e.antecedents.length&&e.flags===g.FlowFlags.BranchLabel?e.antecedents[0]:(this._codeFlowComplexity+=e.antecedents.length-1,e)}_bindNeverCondition(e,t,n){const s=[];if(55===e.nodeType&&38===e.operator)this._bindNeverCondition(e.expression,t,!n);else if(7!==e.nodeType||36!==e.operator&&37!==e.operator){if(this._isNarrowingExpression(e,s,!0)){s.filter((e=>38===e.nodeType)).length>0&&(this._currentFlowNode=this._createFlowConditional(n?g.FlowFlags.TrueNeverCondition:g.FlowFlags.FalseNeverCondition,this._currentFlowNode,e))}this._addAntecedent(t,this._currentFlowNode)}else{let s=36===e.operator;if(n&&(s=!s),s){const s=this._currentFlowNode;this._bindNeverCondition(e.leftExpression,t,n),this._currentFlowNode=s,this._bindNeverCondition(e.rightExpression,t,n)}else{const s=this._currentFlowNode,i=this._createBranchLabel();if(this._bindNeverCondition(e.leftExpression,i,n),s!==this._currentFlowNode){this._currentFlowNode=this._finishFlowLabel(i);const r=this._currentFlowNode;this._bindNeverCondition(e.rightExpression,t,n),r===this._currentFlowNode&&(this._currentFlowNode=s)}}}}_bindConditional(e,t,n){this._setTrueFalseTargets(t,n,(()=>{this.walk(e)})),this._isLogicalExpression(e)||(this._addAntecedent(t,this._createFlowConditional(g.FlowFlags.TrueCondition,this._currentFlowNode,e)),this._addAntecedent(n,this._createFlowConditional(g.FlowFlags.FalseCondition,this._currentFlowNode,e)))}_disableTrueFalseTargets(e){this._setTrueFalseTargets(void 0,void 0,e)}_setTrueFalseTargets(e,t,n){const s=this._currentTrueTarget,i=this._currentFalseTarget;this._currentTrueTarget=e,this._currentFalseTarget=t,n(),this._currentTrueTarget=s,this._currentFalseTarget=i}_createFlowConditional(e,t,n){if(t.flags&g.FlowFlags.Unreachable)return t;const s=v.evaluateStaticBoolLikeExpression(n,this._fileInfo.executionEnvironment,this._typingImportAliases,this._sysImportAliases);if(!0===s&&e&g.FlowFlags.FalseCondition||!1===s&&e&g.FlowFlags.TrueCondition)return C._unreachableFlowNode;const i=[];if(!this._isNarrowingExpression(n,i))return t;i.forEach((e=>{const t=(0,g.createKeyForReference)(e);this._currentScopeCodeFlowExpressions.add(t)}));const r=i.filter((e=>38===e.nodeType)),a={flags:e,id:(0,g.getUniqueFlowNodeId)(),reference:r.length>0?r[0]:void 0,expression:n,antecedent:t};return this._addExceptTargets(a),a}_isLogicalExpression(e){switch(e.nodeType){case 55:return 38===e.operator;case 7:return 36===e.operator||37===e.operator}return!1}_isNarrowingExpression(e,t,n=!1,s=!1){switch(e.nodeType){case 38:case 35:case 24:if(n){if(38!==e.nodeType)return!1;if(!s)return!1}return!!(0,g.isCodeFlowSupportedForReference)(e)&&(t.push(e),!0);case 4:return t.push(e.name),this._isNarrowingExpression(e.rightExpression,t,n,!0),!0;case 7:{const s=39===e.operator||40===e.operator,i=12===e.operator||28===e.operator;if(s||i){if(11===e.rightExpression.nodeType&&26===e.rightExpression.constType)return this._isNarrowingExpression(e.leftExpression,t,n,!0);if(s&&9===e.leftExpression.nodeType&&38===e.leftExpression.leftExpression.nodeType&&"type"===e.leftExpression.leftExpression.value&&1===e.leftExpression.arguments.length&&0===e.leftExpression.arguments[0].argumentCategory)return this._isNarrowingExpression(e.leftExpression.arguments[0].valueExpression,t,n,!0);const r=this._isNarrowingExpression(e.leftExpression,t,n,!0);if(s)return r;if(i){const s=this._isNarrowingExpression(e.rightExpression,t,n,!0);return r||s}}return!(41!==e.operator&&42!==e.operator||48!==e.leftExpression.nodeType||!this._isNarrowingExpression(e.rightExpression,t,n,!0))||41===e.operator&&this._isNarrowingExpression(e.leftExpression,t,n,!0)}case 55:return 38===e.operator&&this._isNarrowingExpression(e.expression,t,n,!1);case 5:return this._isNarrowingExpression(e.rightExpression,t,n,!0);case 9:if(38===e.leftExpression.nodeType&&("isinstance"===e.leftExpression.value||"issubclass"===e.leftExpression.value)&&2===e.arguments.length)return this._isNarrowingExpression(e.arguments[0].valueExpression,t,n,!0);if(38===e.leftExpression.nodeType&&"callable"===e.leftExpression.value&&1===e.arguments.length)return this._isNarrowingExpression(e.arguments[0].valueExpression,t,n,!0);if(e.arguments.length>=1)return!n&&this._isNarrowingExpression(e.arguments[0].valueExpression,t,n,!0)}return!1}_createAssignmentTargetFlowNodes(e,t,n){switch(e.nodeType){case 38:case 35:case 24:this._createFlowAssignment(e,n),t&&this.walk(e);break;case 52:e.expressions.forEach((e=>{this._createAssignmentTargetFlowNodes(e,t,n)}));break;case 54:this._createAssignmentTargetFlowNodes(e.valueExpression,!1,n),t&&this.walk(e);break;case 56:this._createAssignmentTargetFlowNodes(e.expression,!1,n),t&&this.walk(e);break;case 31:e.entries.forEach((e=>{this._createAssignmentTargetFlowNodes(e,t,n)}));break;default:t&&this.walk(e)}}_createCallFlowNode(e){if(!this._isCodeUnreachable()){const t={flags:g.FlowFlags.Call,id:(0,g.getUniqueFlowNodeId)(),node:e,antecedent:this._currentFlowNode};this._currentFlowNode=t}h.setFlowNode(e,this._currentFlowNode),this._isCodeUnreachable()||this._addExceptTargets(this._currentFlowNode)}_createVariableAnnotationFlowNode(){if(!this._isCodeUnreachable()){const e={flags:g.FlowFlags.VariableAnnotation,id:(0,g.getUniqueFlowNodeId)(),antecedent:this._currentFlowNode};this._currentFlowNode=e}}_createFlowAssignment(e,t=!1){let n=b.indeterminateSymbolId;if(38===e.nodeType){const t=this._currentScope.lookUpSymbolRecursive(e.value);(0,o.assert)(void 0!==t),n=t.symbol.id}const s=this._currentFlowNode;if(!this._isCodeUnreachable()&&(0,g.isCodeFlowSupportedForReference)(e)){const s={flags:g.FlowFlags.Assignment,id:(0,g.getUniqueFlowNodeId)(),node:e,antecedent:this._currentFlowNode,targetSymbolId:n},i=(0,g.createKeyForReference)(e);this._currentScopeCodeFlowExpressions.add(i),t&&(s.flags|=g.FlowFlags.Unbind),35===e.nodeType&&this._addExceptTargets(s),this._currentFlowNode=s}t&&void 0!==h.getFlowNode(e)||h.setFlowNode(e,t?s:this._currentFlowNode)}_createFlowWildcardImport(e,t){if(!this._isCodeUnreachable()){const n={flags:g.FlowFlags.WildcardImport,id:(0,g.getUniqueFlowNodeId)(),node:e,names:t,antecedent:this._currentFlowNode};this._addExceptTargets(n),this._currentFlowNode=n}h.setFlowNode(e,this._currentFlowNode)}_createFlowExhaustedMatch(e){if(!this._isCodeUnreachable()){const t={flags:g.FlowFlags.ExhaustedMatch,id:(0,g.getUniqueFlowNodeId)(),node:e,antecedent:this._currentFlowNode};this._currentFlowNode=t}h.setAfterFlowNode(e,this._currentFlowNode)}_isCodeUnreachable(){return!!(this._currentFlowNode.flags&g.FlowFlags.Unreachable)}_addExceptTargets(e){this._currentExceptTargets&&this._currentExceptTargets.forEach((t=>{this._addAntecedent(t,e)}))}_trackCodeFlowExpressions(e){const t=this._currentScopeCodeFlowExpressions;this._currentScopeCodeFlowExpressions=new Set,e();const n=this._currentScopeCodeFlowExpressions;return t&&this._currentScopeCodeFlowExpressions.forEach((e=>{t.add(e)})),this._currentScopeCodeFlowExpressions=t,n}_bindLoopStatement(e,t,n){const s=this._currentContinueTarget,i=this._currentBreakTarget;this._currentContinueTarget=e,this._currentBreakTarget=t,e.affectedExpressions=this._trackCodeFlowExpressions(n),this._currentContinueTarget=s,this._currentBreakTarget=i}_addAntecedent(e,t){this._currentFlowNode.flags&g.FlowFlags.Unreachable||e.antecedents.some((e=>e.id===t.id))||e.antecedents.push(t)}_bindNameToScope(e,t,n){const s=this._currentScope.getBindingType(t);if(void 0===s){let s=e.lookUpSymbol(t);return s||(s=e.addSymbol(t,5),3!==this._currentScope.type&&4!==this._currentScope.type||(0,I.isPrivateOrProtectedName)(t)&&((0,I.isPrivateName)(t)?s.setIsExternallyHidden():this._fileInfo.isStubFile||this._fileInfo.isInPyTypedPackage?4===this._currentScope.type?s.setIsExternallyHidden():this._potentialPrivateSymbols.set(t,s):s.setIsPrivateMember()),n&&n.set(t,s)),s}{const e=(0===s?this._currentScope.parent:this._currentScope.getGlobalScope()).lookUpSymbolRecursive(t);if(e)return e.symbol}}_bindPossibleTupleNamedTarget(e,t){switch(e.nodeType){case 38:this._bindNameToScope(this._currentScope,e.value,t);break;case 52:e.expressions.forEach((e=>{this._bindPossibleTupleNamedTarget(e,t)}));break;case 31:e.entries.forEach((e=>{this._bindPossibleTupleNamedTarget(e,t)}));break;case 54:this._bindPossibleTupleNamedTarget(e.valueExpression,t);break;case 56:this._bindPossibleTupleNamedTarget(e.expression,t)}}_addImplicitSymbolToCurrentScope(e,t,n){const s=this._addSymbolToCurrentScope(e,!1);s&&(s.addDeclaration({type:0,node:t,intrinsicType:n,path:this._fileInfo.filePath,range:(0,d.getEmptyRange)(),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite}),s.setIsIgnoredForProtocolMatch())}_addSymbolToCurrentScope(e,t){let n=this._currentScope.lookUpSymbol(e);if(!n){let s=0;t&&(s|=1),2===this._currentScope.type&&(s|=4),this._fileInfo.isStubFile&&(0,I.isPrivateOrProtectedName)(e)&&(s|=2),n=this._currentScope.addSymbol(e,s)}return n}_createNewScope(e,t,n){const s=this._currentScope,i=new _.Scope(e,t);this._currentScope=i;const r=4===e||3===e||1===e,a=this._currentScopeCodeFlowExpressions;return r&&(this._currentScopeCodeFlowExpressions=new Set),n(),this._currentScopeCodeFlowExpressions=a,this._currentScope=s,i}_addInferredTypeAssignmentForVariable(e,t,n=!1){switch(e.nodeType){case 38:{const s=e,i=this._currentScope.lookUpSymbolRecursive(s.value);if(i&&i.symbol){const r={type:1,node:e,isConstant:(0,I.isConstantName)(e.value),inferredTypeSource:t,isInferenceAllowedInPyTyped:this._isInferenceAllowedInPyTyped(s.value),typeAliasName:n?e:void 0,path:this._fileInfo.filePath,range:(0,p.convertOffsetsToRange)(s.start,u.TextRange.getEnd(s),this._fileInfo.lines),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite,docString:this._getVariableDocString(e)};i.symbol.addDeclaration(r)}break}case 35:{const n=this._getMemberAccessInfo(e);if(n){const s=e.memberName;let i=n.classScope.lookUpSymbol(s.value);if(!i){i=n.classScope.addSymbol(s.value,1);const e="none"!==this._fileInfo.diagnosticRuleSet.reportPrivateUsage;(0,I.isPrivateOrProtectedName)(s.value)&&e&&i.setIsPrivateMember()}n.isInstanceMember?i.isClassMember()&&i.getDeclarations().some((e=>3===e.type&&e.isMethod))||i.setIsInstanceMember():i.setIsClassMember();const r={type:1,node:e.memberName,isConstant:(0,I.isConstantName)(s.value),inferredTypeSource:t,isDefinedByMemberAccess:!0,path:this._fileInfo.filePath,range:(0,p.convertOffsetsToRange)(e.memberName.start,e.memberName.start+e.memberName.length,this._fileInfo.lines),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite,docString:this._getVariableDocString(e)};i.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)}))}}_isInferenceAllowedInPyTyped(e){return["__match_args__","__slots__","__all__"].some((t=>t===e))}_addTypeDeclarationForVariable(e,t){var n,s,i;let r=!1;switch(e.nodeType){case 38:{const a=e,o=this._currentScope.lookUpSymbolRecursive(a.value);if(o&&o.symbol){const r=this._isAnnotationFinal(t),l=this._isAnnotationTypeAlias(t);let c=t,d=t;l?(c=void 0,d=void 0,2!==this._currentScope.type&&3!==this._currentScope.type&&4!==this._currentScope.type&&this._addError(m.Localizer.Diagnostic.typeAliasNotInModuleOrClass(),t)):r.isFinal&&(d=r.finalTypeNode,r.finalTypeNode||(c=void 0));let y=this._isAnnotationClassVar(t);if(y.isClassVar&&(d=y.classVarTypeNode,y.classVarTypeNode||(c=void 0)),r.isFinal){const t=f.getEnclosingClassOrFunction(e);t&&10===t.nodeType&&(3!==(null===(n=e.parent)||void 0===n?void 0:n.nodeType)&&3!==(null===(i=null===(s=e.parent)||void 0===s?void 0:s.parent)||void 0===i?void 0:i.nodeType)||(y={isClassVar:!0,classVarTypeNode:void 0}))}const h={type:1,node:e,isConstant:(0,I.isConstantName)(a.value),isFinal:r.isFinal,isClassVar:y.isClassVar,isRequired:this._isRequiredAnnotation(d),isNotRequired:this._isNotRequiredAnnotation(d),typeAliasAnnotation:l?t:void 0,typeAliasName:l?e:void 0,path:this._fileInfo.filePath,typeAnnotationNode:c,range:(0,p.convertOffsetsToRange)(a.start,u.TextRange.getEnd(a),this._fileInfo.lines),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite,docString:this._getVariableDocString(e)};if(o.symbol.addDeclaration(h),y.isClassVar?o.symbol.setIsClassVar():o.symbol.setIsInstanceMember(),24===t.nodeType)if(this._isDataclassesAnnotation(t.baseExpression,"InitVar"))o.symbol.setIsInitVar();else if(this._isTypingAnnotation(t.baseExpression,"Annotated")&&t.items.length>0){const e=t.items[0].valueExpression;24===e.nodeType&&this._isDataclassesAnnotation(e.baseExpression,"InitVar")&&o.symbol.setIsInitVar()}}r=!0;break}case 35:{const n=this._getMemberAccessInfo(e);if(n){const s=e.memberName;let i=n.classScope.lookUpSymbol(s.value);if(!i){i=n.classScope.addSymbol(s.value,1);const e="none"!==this._fileInfo.diagnosticRuleSet.reportPrivateUsage;(0,I.isPrivateOrProtectedName)(s.value)&&e&&i.setIsPrivateMember()}n.isInstanceMember?i.setIsInstanceMember():i.setIsClassMember();const a=this._isAnnotationFinal(t),o={type:1,node:e.memberName,isConstant:(0,I.isConstantName)(s.value),isDefinedByMemberAccess:!0,isFinal:a.isFinal,path:this._fileInfo.filePath,typeAnnotationNode:a.isFinal&&!a.finalTypeNode?void 0:t,range:(0,p.convertOffsetsToRange)(e.memberName.start,e.memberName.start+e.memberName.length,this._fileInfo.lines),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite,docString:this._getVariableDocString(e)};i.addDeclaration(o),r=!0}break}}r||this._addError(m.Localizer.Diagnostic.annotationNotSupported(),t)}_isTypingAnnotation(e,t){return this._isKnownAnnotation(e,t,this._typingImportAliases,this._typingSymbolAliases)}_isDataclassesAnnotation(e,t){return this._isKnownAnnotation(e,t,this._dataclassesImportAliases,this._dataclassesSymbolAliases)}_isKnownAnnotation(e,t,n,s){if(38===e.nodeType){if(s.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 n.some((e=>e===t))}return!1}_getVariableDocString(e){var t,n,s,i;let r,a=e;for(;a&&3!==a.nodeType;)54!==a.nodeType||r||(r=a),a=a.parent;if(3!==(null==a?void 0:a.nodeType)){if(!r)return;a=r}const o=a.parent;if(47!==(null==o?void 0:o.nodeType))return;const l=o.parent;if(!l||36!==l.nodeType&&50!==l.nodeType)return;const c=l.statements.findIndex((e=>e===o));if(c<0||c===l.statements.length-1)return;const p=l.statements[c+1];if(47!==p.nodeType||!f.isDocString(p))return;let d=!1;if(36===(null===(t=null==o?void 0:o.parent)||void 0===t?void 0:t.nodeType))d=!0;else if(50===(null===(n=null==o?void 0:o.parent)||void 0===n?void 0:n.nodeType)&&10===(null===(i=null===(s=null==o?void 0:o.parent)||void 0===s?void 0:s.parent)||void 0===i?void 0:i.nodeType))d=!0;else{const e=f.getEnclosingFunction(o);e&&"__init__"===e.name.value&&f.getEnclosingClass(e,!0)&&(d=!0)}if(!d)return;const u=p.statements[0].strings;return 1===u.length?u[0].value:u.map((e=>e.value)).join("")}_isAnnotationFinal(e){let t,n=!1;if(e)if(this._isTypingAnnotation(e,"Final"))n=!0;else if(24===e.nodeType&&1===e.items.length){!this._isAnnotationFinal(e.baseExpression).isFinal||0!==e.items[0].argumentCategory||e.items[0].name||e.trailingComma||(n=!0,t=e.items[0].valueExpression)}return{isFinal:n,finalTypeNode:t}}_isAnnotationClassVar(e){let t,n=!1;for(;e;){if(!(24===e.nodeType&&e.items.length>0&&this._isTypingAnnotation(e.baseExpression,"Annotated"))){if(this._isTypingAnnotation(e,"ClassVar")){n=!0;break}if(24===e.nodeType&&1===e.items.length){!this._isAnnotationClassVar(e.baseExpression).isClassVar||0!==e.items[0].argumentCategory||e.items[0].name||e.trailingComma||(n=!0,t=e.items[0].valueExpression);break}break}e=e.items[0].valueExpression}return{isClassVar:n,classVarTypeNode:t}}_isRequiredAnnotation(e){return!(!e||24!==e.nodeType||1!==e.items.length||!this._isTypingAnnotation(e.baseExpression,"Required"))}_isNotRequiredAnnotation(e){return!(!e||24!==e.nodeType||1!==e.items.length||!this._isTypingAnnotation(e.baseExpression,"NotRequired"))}_isAnnotationTypeAlias(e){return!!e&&this._isTypingAnnotation(e,"TypeAlias")}_getMemberAccessInfo(e){if(38!==e.leftExpression.nodeType)return;const t=e.leftExpression.value,n=f.getEnclosingFunction(e);if(!n)return;const s=f.getEnclosingClass(n,!0);if(!s)return;let i=!1;if(n.parameters.length<1||!n.parameters[0].name)return;const r=s.name.value,a=n.parameters[0].name.value;if(t===r)i=!1;else{if(t!==a)return;if("__new__"===n.name.value)i=!1;else{i=!0;for(const e of n.decorators)if(38===e.expression.nodeType){const t=e.expression.value;if("staticmethod"===t)return;if("classmethod"===t){i=!1;break}}}}const l=h.getScope(s);return(0,o.assert)(void 0!==l),{classNode:s,methodNode:n,classScope:l,isInstanceMember:i}}_addImplicitImportsToLoaderActions(e,t){e.filteredImplicitImports.forEach((e=>{const n=t.implicitImports?t.implicitImports.get(e.name):void 0;n?(n.path=e.path,n.loadSymbolsFromPath=!0):(t.implicitImports||(t.implicitImports=new Map),t.implicitImports.set(e.name,{path:e.path,loadSymbolsFromPath:!0,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,s=new Map([["Tuple",!0],["Generic",!0],["Protocol",!0],["Callable",!0],["Type",!0],["ClassVar",!0],["Final",!0],["Literal",!0],["TypedDict",!0],["Union",!0],["Optional",!0],["Annotated",!0],["TypeAlias",!0],["OrderedDict",!0],["Concatenate",!0],["TypeGuard",!0],["StrictTypeGuard",!0],["Unpack",!0],["Self",!0],["NoReturn",!0],["Never",!0],["LiteralString",!0]]),i=n.value;if(!s.has(i))return!1;const r=this._bindNameToScope(this._currentScope,i);return r&&r.addDeclaration({type:5,node:t,path:this._fileInfo.filePath,range:(0,p.convertOffsetsToRange)(t.start,u.TextRange.getEnd(t),this._fileInfo.lines),moduleName:this._fileInfo.moduleName,isInExceptSuite:this._isInExceptSuite}),!0}_deferBinding(e){this._moduleSymbolOnly||this._deferredBindingTasks.push({scope:this._currentScope,codeFlowExpressions:this._currentScopeCodeFlowExpressions,callback:e})}_bindDeferred(){for(;this._deferredBindingTasks.length>0;){const e=this._deferredBindingTasks.shift();this._currentScope=e.scope,this._currentScopeCodeFlowExpressions=e.codeFlowExpressions,e.callback()}}_bindYield(e){const t=f.getEnclosingFunction(e);t?t.isAsync&&61===e.nodeType&&this._addError(m.Localizer.Diagnostic.yieldFromOutsideAsync(),e):f.getEnclosingLambda(e)||this._addError(m.Localizer.Diagnostic.yieldOutsideFunction(),e),this._targetFunctionDeclaration&&(this._targetFunctionDeclaration.yieldStatements||(this._targetFunctionDeclaration.yieldStatements=[]),this._targetFunctionDeclaration.yieldStatements.push(e),this._targetFunctionDeclaration.isGenerator=!0),e.expression&&this.walk(e.expression),h.setFlowNode(e,this._currentFlowNode)}_addDiagnostic(e,t,n,s){let i;switch(e){case"error":i=this._addError(n,s);break;case"warning":i=this._addWarning(n,s);break;case"information":i=this._addInformation(n,s);break;case"none":break;default:return(0,o.assertNever)(e,`${e} is not expected`)}return i&&i.setRule(t),i}_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=C,C._unreachableFlowNode={flags:g.FlowFlags.Unreachable,id:(0,g.getUniqueFlowNodeId)()};class S extends T.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=S;class F extends T.ParseTreeWalker{constructor(){super(...arguments),this._containsReturn=!1}checkContainsReturn(e){return this.walk(e),this._containsReturn}visitReturn(e){return this._containsReturn=!0,!1}}t.ReturnFinder=F},51153:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Checker=void 0;const a=n(20823),o=n(24319),l=n(15741),c=n(94647),p=n(57485),d=n(80957),u=n(74426),m=n(55390),y=n(78722),h=r(n(35696)),g=n(16800),f=n(88023),T=n(67145),_=n(45214),v=r(n(23241)),b=n(22339),I=n(97374),C=n(57203),S=n(93989),F=n(67737),x=r(n(91197)),D=n(15020),P=n(59195),A=n(10425),E=n(58922),k=new Map([["Tuple",{version:p.PythonVersion.V3_9,fullName:"builtins.tuple",replacementText:"tuple"}],["List",{version:p.PythonVersion.V3_9,fullName:"builtins.list",replacementText:"list"}],["Dict",{version:p.PythonVersion.V3_9,fullName:"builtins.dict",replacementText:"dict"}],["Set",{version:p.PythonVersion.V3_9,fullName:"builtins.set",replacementText:"set"}],["FrozenSet",{version:p.PythonVersion.V3_9,fullName:"builtins.frozenset",replacementText:"frozenset"}],["Type",{version:p.PythonVersion.V3_9,fullName:"builtins.type",replacementText:"type"}],["Deque",{version:p.PythonVersion.V3_9,fullName:"collections.deque",replacementText:"collections.deque"}],["DefaultDict",{version:p.PythonVersion.V3_9,fullName:"collections.defaultdict",replacementText:"collections.defaultdict"}],["OrderedDict",{version:p.PythonVersion.V3_9,fullName:"collections.OrderedDict",replacementText:"collections.OrderedDict"}],["Counter",{version:p.PythonVersion.V3_9,fullName:"collections.Counter",replacementText:"collections.Counter"}],["ChainMap",{version:p.PythonVersion.V3_9,fullName:"collections.ChainMap",replacementText:"collections.ChainMap"}]]),w=new Map([["Optional",{version:p.PythonVersion.V3_10,fullName:"typing.Optional",replacementText:"| None"}],["Union",{version:p.PythonVersion.V3_10,fullName:"typing.Union",replacementText:"|"}]]);class N extends b.ParseTreeWalker{constructor(e,t,n){super(),this._importResolver=e,this._evaluator=t,this._moduleNode=n,this._isUnboundCheckSuppressed=!1,this._scopedNodes=[],this._fileInfo=h.getFileInfo(n)}check(){this._scopedNodes.push(this._moduleNode),this._walkStatementsAndReportUnreachable(this._moduleNode.statements);const e=h.getDunderAllInfo(this._moduleNode);e&&(this._evaluator.markNamesAccessed(this._moduleNode,e.names),this._reportUnusedDunderAllSymbols(e.stringNodes)),this._validateSymbolTables(),this._reportDuplicateImports(),M.report(this._importResolver,this._evaluator,this._fileInfo,this._moduleNode)}walk(e){h.isCodeUnreachable(e)?this._evaluator.suppressDiagnostics(e,(()=>{super.walk(e)})):super.walk(e)}visitSuite(e){return this._walkStatementsAndReportUnreachable(e.statements),!1}visitStatementList(e){return e.statements.forEach((e=>{(0,m.isExpressionNode)(e)&&(this._evaluator.getType(e),this._reportUnusedExpression(e))})),!0}visitClass(e){const t=this._evaluator.getTypeOfClass(e);return this.walk(e.suite),this.walkMultiple(e.decorators),this.walkMultiple(e.arguments),t&&(P.ClassType.isProtocolClass(t.classType)&&(e.arguments.forEach((e=>{if(!e.name){const n=this._evaluator.getType(e.valueExpression);n&&(0,P.isInstantiableClass)(n)&&!P.ClassType.isBuiltIn(n,"Protocol")&&!P.ClassType.isBuiltIn(n,"Generic")&&(P.ClassType.isProtocolClass(n)||this._evaluator.addError(u.Localizer.Diagnostic.protocolBaseClass().format({classType:this._evaluator.printType(t.classType,!1),baseType:this._evaluator.printType(n,!1)}),e.valueExpression))}})),this._validateProtocolTypeParamVariance(e,t.classType)),this._fileInfo.isStubFile||(this._validateBaseClassOverrides(t.classType),this._validateSlotsClassVarConflict(t.classType)),this._validateMultipleInheritanceCompatibility(t.classType,e.name),this._validateConstructorConsistency(t.classType),this._validateFinalMemberOverrides(t.classType),this._validateInstanceVariableInitialization(t.classType),this._validateFinalClassNotAbstract(t.classType,e),this._validateDataClassPostInit(t.classType,e),this._validateProtocolCompatibility(t.classType,e),this._reportDuplicateEnumMembers(t.classType),P.ClassType.isTypedDictClass(t.classType)&&this._validateTypedDictClassSuite(e.suite),P.ClassType.isEnumClass(t.classType)&&this._validateEnumClassOverride(e,t.classType)),this._scopedNodes.push(e),!1}visitFunction(e){var t;const n=this._evaluator.getTypeOfFunction(e),s=v.getEnclosingClass(e,!0);if(n){let i=!1;e.parameters.forEach(((e,t)=>{if(e.name)if(1===e.category){const t=e.typeAnnotation||e.typeAnnotationComment;if(t&&35===t.nodeType&&"args"===t.memberName.value){const e=this._evaluator.getType(t.leftExpression);e&&(0,P.isTypeVar)(e)&&e.details.isParamSpec&&(i=!0)}}else 2===e.category&&(i=!1);if(e.name&&0===e.category&&i&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.namedParamAfterParamSpecArgs().format({name:e.name.value}),e.name),e.name&&"_"!==e.name.value){const t=n.functionType.details.parameters.find((t=>{var n;return t.name===(null===(n=e.name)||void 0===n?void 0:n.value)}));if(t){const n=t.type;if((0,P.isUnknown)(n)||(0,P.isTypeVar)(n)&&n.details.isSynthesized&&!n.details.isSynthesizedSelf)this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,u.Localizer.Diagnostic.paramTypeUnknown().format({paramName:e.name.value}),e.name);else if((0,A.isPartlyUnknown)(n)){const t=new o.DiagnosticAddendum;t.addMessage(u.Localizer.DiagnosticAddendum.paramType().format({paramType:this._evaluator.printType(n,!0)})),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,u.Localizer.Diagnostic.paramTypePartiallyUnknown().format({paramName:e.name.value})+t.getString(),e.name)}let s=!1;(t.typeAnnotation||(0,P.isTypeVar)(n)&&n.details.isSynthesizedSelf)&&(s=!0),s||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingParameterType,l.DiagnosticRule.reportMissingParameterType,u.Localizer.Diagnostic.paramAnnotationMissing().format({name:e.name.value}),e.name)}}if(e.defaultValue&&this._fileInfo.isStubFile){const t=this._evaluator.getType(e.defaultValue);t&&(0,A.isEllipsisType)(t)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidStubStatement,l.DiagnosticRule.reportInvalidStubStatement,u.Localizer.Diagnostic.defaultValueNotEllipsis(),e.defaultValue)}}));const r=n.functionType.details.parameters.filter((e=>!!(e.typeAnnotation&&(0,P.isTypeVar)(e.type)&&(0,P.isParamSpec)(e.type)&&0!==e.category&&e.name&&e.type.paramSpecAccess)));if(1===r.length&&r[0].typeAnnotation&&this._evaluator.addError(u.Localizer.Diagnostic.paramSpecArgsKwargsUsage(),r[0].typeAnnotation),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,u.Localizer.Diagnostic.returnTypeUnknown(),e.name)}s&&this._validateMethod(e,n.functionType,s)}if(e.parameters.forEach(((e,t)=>{if(e.defaultValue&&this.walk(e.defaultValue),e.typeAnnotation&&this.walk(e.typeAnnotation),e.typeAnnotationComment&&this.walk(e.typeAnnotationComment),n){const s=e.typeAnnotation||e.typeAnnotationComment;if(s&&t<n.functionType.details.parameters.length){const e=n.functionType.details.parameters[t].type;(0,P.isTypeVar)(e)&&1===e.details.variance&&!e.details.isSynthesized&&"__init__"!==n.functionType.details.name&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.paramTypeCovariant(),s)}}})),e.returnTypeAnnotation&&this.walk(e.returnTypeAnnotation),e.functionAnnotationComment&&this.walk(e.functionAnnotationComment),this.walkMultiple(e.decorators),e.parameters.forEach((e=>{e.name&&this.walk(e.name)})),this.walk(e.suite),n&&(this._validateFunctionReturn(e,n.functionType),this._validateDunderSignatures(e,n.functionType,void 0!==s),this._validateStrictTypeGuardFunction(e,n.functionType,void 0!==s)),this._fileInfo.isStubFile&&"__getattr__"===e.name.value){const t=(0,C.getScopeForNode)(e);3===(null==t?void 0:t.type)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompleteStub,l.DiagnosticRule.reportIncompleteStub,u.Localizer.Diagnostic.stubUsesGetAttr(),e.name)}if(this._scopedNodes.push(e),this._validateFunctionTypeVarUsage(e),n&&(0,P.isOverloadedFunction)(n.decoratedType)){const t=n.decoratedType.overloads;if(t.length>1){const n=100;t.length<n&&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&&((0,P.isUnknown)(t)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,u.Localizer.Diagnostic.paramTypeUnknown().format({paramName:e.name.value}),e.name):(0,A.isPartlyUnknown)(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,u.Localizer.Diagnostic.paramTypePartiallyUnknown().format({paramName:e.name.value}),e.name))}}));const t=this._evaluator.getType(e.expression);return t&&((0,P.isUnknown)(t)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,u.Localizer.Diagnostic.lambdaReturnTypeUnknown(),e.expression):(0,A.isPartlyUnknown)(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownLambdaType,l.DiagnosticRule.reportUnknownLambdaType,u.Localizer.Diagnostic.lambdaReturnTypePartiallyUnknown().format({returnType:this._evaluator.printType(t,!0)}),e.expression)),this._scopedNodes.push(e),!1}visitCall(e){var t;if(this._validateIsInstanceCall(e),this._validateIllegalDefaultParamInitializer(e),("none"!==this._fileInfo.diagnosticRuleSet.reportUnusedCallResult||"none"!==this._fileInfo.diagnosticRuleSet.reportUnusedCoroutine)&&47===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)){const t=38===e.leftExpression.nodeType&&"reveal_type"===e.leftExpression.value,n=this._evaluator.getType(e);!t&&n&&this._isTypeValidForUnusedValueTest(n)&&(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnusedCallResult,l.DiagnosticRule.reportUnusedCallResult,u.Localizer.Diagnostic.unusedCallResult().format({type:this._evaluator.printType(n,!1)}),e),(0,P.isClassInstance)(n)&&P.ClassType.isBuiltIn(n,"Coroutine")&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnusedCoroutine,l.DiagnosticRule.reportUnusedCoroutine,u.Localizer.Diagnostic.unusedCoroutine(),e))}return!0}visitAwait(e){var t;if("none"!==this._fileInfo.diagnosticRuleSet.reportUnusedCallResult&&47===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&9===e.expression.nodeType){const t=this._evaluator.getType(e);t&&this._isTypeValidForUnusedValueTest(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnusedCallResult,l.DiagnosticRule.reportUnusedCallResult,u.Localizer.Diagnostic.unusedCallResult().format({type:this._evaluator.printType(t,!1)}),e)}return!0}visitFor(e){return this._evaluator.evaluateTypesForStatement(e),!0}visitList(e){return this._validateIllegalDefaultParamInitializer(e),!0}visitSet(e){return this._validateIllegalDefaultParamInitializer(e),!0}visitDictionary(e){return this._validateIllegalDefaultParamInitializer(e),!0}visitListComprehension(e){return this._scopedNodes.push(e),!0}visitListComprehensionIf(e){return this._reportUnnecessaryConditionExpression(e.testExpression),!0}visitIf(e){return this._evaluator.getType(e.testExpression),this._reportUnnecessaryConditionExpression(e.testExpression),!0}visitWhile(e){return this._evaluator.getType(e.testExpression),this._reportUnnecessaryConditionExpression(e.testExpression),!0}visitWith(e){return e.withItems.forEach((e=>{this._evaluator.evaluateTypesForStatement(e)})),!0}visitReturn(e){let t;const n=v.getEnclosingFunction(e),s=n?this._evaluator.getFunctionDeclaredReturnType(n):void 0;if(t=e.returnExpression?this._evaluator.getType(e.returnExpression)||P.UnknownType.create():P.NoneType.createInstance(),this._evaluator.isNodeReachable(e,void 0)&&n){if(s)if((0,P.isNever)(s))this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.noReturnContainsReturn(),e);else{const n=new o.DiagnosticAddendum;let i=!1;if(this._evaluator.canAssignType(s,t,n,new E.TypeVarContext,64))i=!0;else{const r=(0,A.getTypeVarArgumentsRecursive)(s);if(r&&r.some((e=>e.details.constraints.length>0))){const a=new E.TypeVarContext;for(const t of r)if(t.details.constraints.length>0){const n=this._evaluator.narrowConstrainedTypeVar(e,t);n&&(a.setTypeVarType(t,n),a.addSolveForScope((0,A.getTypeVarScopeId)(t)))}if(!a.isEmpty()){const e=(0,A.applySolvedTypeVars)(s,a);this._evaluator.canAssignType(e,t,n,void 0,64)&&(i=!0)}}}i||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.returnTypeMismatch().format({exprType:this._evaluator.printType(t,!1),returnType:this._evaluator.printType(s,!1)})+n.getString(),e.returnExpression?e.returnExpression:e)}(0,P.isUnknown)(t)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownVariableType,l.DiagnosticRule.reportUnknownVariableType,u.Localizer.Diagnostic.returnTypeUnknown(),e.returnExpression):(0,A.isPartlyUnknown)(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownVariableType,l.DiagnosticRule.reportUnknownVariableType,u.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):P.NoneType.createInstance();return this._validateYieldType(e,t||P.UnknownType.create()),!0}visitYieldFrom(e){const t=this._evaluator.getType(e.expression)||P.UnknownType.create();let n;if((0,P.isClassInstance)(t)&&P.ClassType.isBuiltIn(t,"Coroutine"))n=P.UnknownType.create();else{n=this._evaluator.getTypeOfIterable(t,!1,e)||P.UnknownType.create();const s=(0,A.getGeneratorTypeArgs)(n);n=s?s.length>=1?s[0]:P.UnknownType.create():this._evaluator.getTypeOfIterator(t,!1,e)||P.UnknownType.create()}return this._validateYieldType(e,n),!0}visitRaise(e){if(this._evaluator.verifyRaiseExceptionType(e),e.valueExpression){const t=this._evaluator.getBuiltInType(e,"BaseException"),n=this._evaluator.getType(e.valueExpression);if(n&&t&&(0,P.isInstantiableClass)(t)){const s=new o.DiagnosticAddendum;(0,A.doForEachSubtype)(n,(e=>{e=this._evaluator.makeTopLevelTypeVarsConcrete(e),(0,P.isAnyOrUnknown)(e)||(0,P.isNoneInstance)(e)||(0,P.isClass)(e)&&(0,A.derivesFromClassRecursive)(e,t,!1)||s.addMessage(u.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)}))})),s.isEmpty()||this._evaluator.addError(u.Localizer.Diagnostic.expectedExceptionObj()+s.getString(),e.valueExpression)}}return!0}visitExcept(e){if(e.typeExpression){this._evaluator.evaluateTypesForStatement(e);const t=this._evaluator.getType(e.typeExpression);t&&this._validateExceptionType(t,e.typeExpression)}return!0}visitAssert(e){e.exceptionExpression&&this._evaluator.getType(e.exceptionExpression);const t=this._evaluator.getType(e.testExpression);return t&&(0,P.isClassInstance)(t)&&(0,A.isTupleClass)(t)&&t.tupleTypeArguments&&t.tupleTypeArguments.length>0&&((0,A.isUnboundedTupleClass)(t)||this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportAssertAlwaysTrue,l.DiagnosticRule.reportAssertAlwaysTrue,u.Localizer.Diagnostic.assertAlwaysTrue(),e.testExpression)),!0}visitAssignment(e){return this._evaluator.evaluateTypesForStatement(e),e.typeAnnotationComment&&this._evaluator.getType(e.typeAnnotationComment),!0}visitAssignmentExpression(e){return this._evaluator.getType(e),!0}visitAugmentedAssignment(e){return this._evaluator.evaluateTypesForStatement(e),!0}visitIndex(e){this._evaluator.getType(e);const t=this._evaluator.getType(e.baseExpression);return t&&(0,A.doForEachSubtype)(t,(t=>{if((0,P.isClassInstance)(t)&&t.tupleTypeArguments&&!(0,A.isUnboundedTupleClass)(t)){const n=t.tupleTypeArguments.length;if(1===e.items.length&&!e.trailingComma&&0===e.items[0].argumentCategory&&!e.items[0].name){const s=this._evaluator.getType(e.items[0].valueExpression);s&&(0,P.isClassInstance)(s)&&P.ClassType.isBuiltIn(s,"int")&&(0,A.isLiteralType)(s)&&"number"==typeof s.literalValue&&(s.literalValue>=0&&s.literalValue>=n||s.literalValue<0&&s.literalValue+n<0)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.tupleIndexOutOfRange().format({index:s.literalValue,type:this._evaluator.printType(t)}),e)}}})),!0}visitBinaryOperation(e){return 12!==e.operator&&28!==e.operator||v.isWithinAssertExpression(e)||this._validateComparisonTypes(e),this._evaluator.getType(e),!0}visitSlice(e){return this._evaluator.getType(e),!0}visitUnpack(e){return this._evaluator.getType(e),!0}visitTuple(e){return this._evaluator.getType(e),!0}visitUnaryOperation(e){return this._evaluator.getType(e),!0}visitTernary(e){return this._evaluator.getType(e),this._reportUnnecessaryConditionExpression(e.testExpression),!0}visitStringList(e){for(const t of e.strings)if(t.hasUnescapeErrors){(0,y.getUnescapedString)(t.token).unescapeErrors.forEach((e=>{const n={start:t.token.start+t.token.prefixLength+t.token.quoteMarkLength+e.offset,length:e.length};0===e.errorType?this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportInvalidStringEscapeSequence,l.DiagnosticRule.reportInvalidStringEscapeSequence,u.Localizer.Diagnostic.stringUnsupportedEscape(),n):1===e.errorType?this._evaluator.addDiagnosticForTextRange(this._fileInfo,"error","",u.Localizer.Diagnostic.formatStringEscape(),n):2===e.errorType?this._evaluator.addDiagnosticForTextRange(this._fileInfo,"error","",u.Localizer.Diagnostic.formatStringBrace(),n):3===e.errorType&&this._evaluator.addDiagnosticForTextRange(this._fileInfo,"error","",u.Localizer.Diagnostic.formatStringUnterminated(),n)}))}return e.typeAnnotation&&this._evaluator.getType(e),e.strings.length>1&&!e.isParenthesized&&this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportImplicitStringConcatenation,l.DiagnosticRule.reportImplicitStringConcatenation,u.Localizer.Diagnostic.implicitStringConcat(),e),!0}visitFormatString(e){return e.expressions.forEach((e=>{this._evaluator.getType(e)})),!0}visitGlobal(e){return this._suppressUnboundCheck((()=>{e.nameList.forEach((e=>{this._evaluator.getType(e),this.walk(e)}))})),!1}visitNonlocal(e){return this._suppressUnboundCheck((()=>{e.nameList.forEach((e=>{this._evaluator.getType(e),this.walk(e)}))})),!1}visitName(e){return this._conditionallyReportPrivateUsage(e),this._isUnboundCheckSuppressed||this._reportUnboundName(e),!0}visitDel(e){return this._suppressUnboundCheck((()=>{e.expressions.forEach((e=>{this._evaluator.verifyDeleteExpression(e),this.walk(e)}))})),!1}visitMemberAccess(e){return this._evaluator.getType(e),this._conditionallyReportPrivateUsage(e.memberName),this.walk(e.leftExpression),!1}visitImportAs(e){return this._evaluator.evaluateTypesForStatement(e),!1}visitImportFrom(e){if(e.isWildcardImport){const t=h.getImportInfo(e.module);t&&t.isImportFound&&2!==t.importType&&!this._fileInfo.isStubFile&&this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportWildcardImportFromLibrary,l.DiagnosticRule.reportWildcardImportFromLibrary,u.Localizer.Diagnostic.wildcardLibraryImport(),e.wildcardToken||e)}else e.imports.forEach((e=>{this._evaluator.evaluateTypesForStatement(e)}));return!1}visitTypeAnnotation(e){return this._evaluator.getType(e.typeAnnotation),!0}visitMatch(e){return this._evaluator.getType(e.subjectExpression),this._validateExhaustiveMatch(e),!0}visitCase(e){return e.guardExpression&&this._evaluator.getType(e.guardExpression),this._evaluator.evaluateTypesForStatement(e.pattern),!0}visitPatternClass(e){return(0,I.validateClassPattern)(this._evaluator,e),!0}visitTry(e){return this._reportUnusedExceptStatements(e),!0}visitError(e){return e.child&&this._evaluator.getType(e.child),!1}_reportUnnecessaryConditionExpression(e){if(7===e.nodeType)return void(36!==e.operator&&37!==e.operator||(this._reportUnnecessaryConditionExpression(e.leftExpression),this._reportUnnecessaryConditionExpression(e.rightExpression)));if(55===e.nodeType)return void(38===e.operator&&this._reportUnnecessaryConditionExpression(e.expression));const t=this._evaluator.getTypeOfExpression(e);let n=!0;(0,A.doForEachSubtype)(t.type,(e=>{e=this._evaluator.makeTopLevelTypeVarsConcrete(e),(0,P.isFunction)(e)||(0,P.isOverloadedFunction)(e)||(n=!1)})),n&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnnecessaryComparison,l.DiagnosticRule.reportUnnecessaryComparison,u.Localizer.Diagnostic.functionInConditionalExpression(),e)}_reportUnusedExpression(e){if("none"===this._fileInfo.diagnosticRuleSet.reportUnusedExpression)return;[55,7,40,11,38].some((t=>t===e.nodeType))&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnusedExpression,l.DiagnosticRule.reportUnusedExpression,u.Localizer.Diagnostic.unusedExpression(),e)}_validateExhaustiveMatch(e){if("none"===this._fileInfo.diagnosticRuleSet.reportMatchNotExhaustive)return;const t=this._evaluator.evaluateTypeForSubnode(e,(()=>{this._evaluator.evaluateTypesForMatchStatement(e)}));if(t&&!(0,P.isNever)(t.type)){const n=new o.DiagnosticAddendum;n.addMessage(u.Localizer.DiagnosticAddendum.matchIsNotExhaustiveType().format({type:this._evaluator.printType(t.type)})),n.addMessage(u.Localizer.DiagnosticAddendum.matchIsNotExhaustiveHint()),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMatchNotExhaustive,l.DiagnosticRule.reportMatchNotExhaustive,u.Localizer.Diagnostic.matchIsNotExhaustive()+n.getString(),e.subjectExpression)}}_suppressUnboundCheck(e){const t=this._isUnboundCheckSuppressed;this._isUnboundCheckSuppressed=!0;try{e()}finally{this._isUnboundCheckSuppressed=t}}_validateIllegalDefaultParamInitializer(e){"none"!==this._fileInfo.diagnosticRuleSet.reportCallInDefaultInitializer&&v.isWithinDefaultParamInitializer(e)&&!this._fileInfo.isStubFile&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportCallInDefaultInitializer,l.DiagnosticRule.reportCallInDefaultInitializer,u.Localizer.Diagnostic.defaultValueContainsCall(),e)}_validateComparisonTypes(e){const t=this._evaluator.getType(e.leftExpression),n=this._evaluator.getType(e.rightExpression);if(t&&n)if((0,A.isLiteralTypeOrUnion)(n)&&(0,A.isLiteralTypeOrUnion)(t)){if(void 0===(0,F.evaluateStaticBoolExpression)(e,this._fileInfo.executionEnvironment)){let s=!1;(0,A.doForEachSubtype)(t,(e=>{this._evaluator.canAssignType(n,e)&&(s=!0)})),s||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnnecessaryComparison,l.DiagnosticRule.reportUnnecessaryComparison,u.Localizer.Diagnostic.comparisonAlwaysFalse().format({leftType:this._evaluator.printType(t,!0),rightType:this._evaluator.printType(n,!0)}),e)}}else{let s=!1;if((0,A.doForEachSubtype)(t,(e=>{s||(e=this._evaluator.makeTopLevelTypeVarsConcrete(e),(0,A.doForEachSubtype)(n,(t=>{s||(t=this._evaluator.makeTopLevelTypeVarsConcrete(t),this._isTypeComparable(e,t)&&(s=!0))})))})),!s){const s=this._evaluator.printType(t,!0),i=this._evaluator.printType(n,!0),r=12===e.operator?u.Localizer.Diagnostic.comparisonAlwaysFalse():u.Localizer.Diagnostic.comparisonAlwaysTrue();this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnnecessaryComparison,l.DiagnosticRule.reportUnnecessaryComparison,r.format({leftType:s,rightType:i}),e)}}}_isTypeComparable(e,t){if((0,P.isAnyOrUnknown)(e)||(0,P.isAnyOrUnknown)(t))return!0;if((0,P.isNever)(e)||(0,P.isNever)(t))return!1;if((0,P.isModule)(e)||(0,P.isModule)(t))return(0,P.isTypeSame)(e,t);if((0,P.isNoneInstance)(e)||(0,P.isNoneInstance)(t))return(0,P.isTypeSame)(e,t);if(((0,P.isFunction)(e)||(0,P.isOverloadedFunction)(e))!==((0,P.isFunction)(t)||(0,P.isOverloadedFunction)(t)))return!1;if((0,P.isInstantiableClass)(e)||(0,P.isClassInstance)(e)&&P.ClassType.isBuiltIn(e,"type")){if((0,P.isInstantiableClass)(t)||(0,P.isClassInstance)(t)&&P.ClassType.isBuiltIn(t,"type")){const n=P.ClassType.cloneForSpecialization(e,void 0,!1),s=P.ClassType.cloneForSpecialization(t,void 0,!1);if(this._evaluator.canAssignType(n,s)||this._evaluator.canAssignType(s,n))return!0}const n=e.details.effectiveMetaclass;return!!(n&&(0,P.isClass)(n)&&(0,A.lookUpClassMember)(n,"__eq__",4))}if((0,P.isClassInstance)(e)){if((0,P.isClassInstance)(t)){const n=P.ClassType.cloneForSpecialization(e,void 0,!1),s=P.ClassType.cloneForSpecialization(t,void 0,!1);if(this._evaluator.canAssignType(n,s)||this._evaluator.canAssignType(s,n))return!0;if(P.ClassType.isBuiltIn(e)&&P.ClassType.isBuiltIn(t))return!1}return!!(0,A.lookUpClassMember)(P.ClassType.cloneAsInstantiable(e),"__eq__",4)}return!0}_isTypeValidForUnusedValueTest(e){return!(0,P.isNoneInstance)(e)&&!(0,P.isNever)(e)&&!(0,P.isAnyOrUnknown)(e)}_validateFunctionTypeVarUsage(e){if("none"===this._fileInfo.diagnosticRuleSet.reportInvalidTypeVarUse)return;const t=new Map;let n=!0;const s=new v.NameNodeWalker(((s,i,r)=>{const a=this._evaluator.getType(s);if(a&&(0,P.isTypeVar)(a)&&a.scopeId===this._evaluator.getScopeIdForNode(e)){let e=a.details.constraints.length>0||n&&void 0!==a.details.boundType&&void 0!==i||(0,P.isParamSpec)(a);if(!e&&r&&void 0!==i){const t=this._evaluator.getType(r);(null==t?void 0:t.typeAliasInfo)&&t.typeAliasInfo.typeParameters&&i<t.typeAliasInfo.typeParameters.length&&(e=!0)}t.has(a.details.name)?t.get(a.details.name).nodes.push(s):t.set(a.details.name,{nodes:[s],isExempt:e})}}));e.parameters.forEach((e=>{const t=e.typeAnnotation||e.typeAnnotationComment;t&&s.walk(t)})),e.returnTypeAnnotation&&(n=!1,s.walk(e.returnTypeAnnotation)),t.forEach((e=>{1!==e.nodes.length||e.isExempt||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidTypeVarUse,l.DiagnosticRule.reportInvalidTypeVarUse,u.Localizer.Diagnostic.typeVarUsedOnlyOnce().format({name:e.nodes[0].value}),e.nodes[0])}))}_validateOverloadConsistency(e,t,n){for(let s=0;s<n.length;s++){const i=n[s];if(P.FunctionType.isOverloaded(t)&&P.FunctionType.isOverloaded(i)&&this._isOverlappingOverload(t,i)){this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportOverlappingOverload,l.DiagnosticRule.reportOverlappingOverload,u.Localizer.Diagnostic.overlappingOverload().format({name:e.name.value,obscured:n.length+1,obscuredBy:s+1}),e.name);break}}for(let s=0;s<n.length;s++){const i=n[s];if(P.FunctionType.isOverloaded(t)&&P.FunctionType.isOverloaded(i)&&this._isOverlappingOverload(i,t)){const r=P.FunctionType.getSpecializedReturnType(i),a=P.FunctionType.getSpecializedReturnType(t);if(r&&a&&!this._evaluator.canAssignType(a,r,void 0,new E.TypeVarContext,8)){const t=this._findNodeForOverload(e,i);this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportOverlappingOverload,l.DiagnosticRule.reportOverlappingOverload,u.Localizer.Diagnostic.overloadReturnTypeMismatch().format({name:e.name.value,newIndex:n.length+1,prevIndex:s+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(!P.FunctionType.isInstanceMethod(e)||"__get__"!==e.details.name)&&this._evaluator.canAssignType(e,t,void 0,new E.TypeVarContext((0,A.getTypeVarScopeId)(e)),56)}_isLegalOverloadImplementation(e,t,n){var s;const i=new E.TypeVarContext((0,A.getTypeVarScopeId)(t));let r=this._evaluator.canAssignType(e,t,n,i,290);const a=null!==(s=e.details.declaredReturnType)&&void 0!==s?s:this._evaluator.getFunctionInferredReturnType(e),l=(0,A.applySolvedTypeVars)(t.details.declaredReturnType||this._evaluator.getFunctionInferredReturnType(t),i),c=new o.DiagnosticAddendum;return(0,P.isNever)(a)||this._evaluator.canAssignType(l,a,c.createAddendum(),i,8)||(c.addMessage(u.Localizer.DiagnosticAddendum.functionReturnTypeMismatch().format({sourceType:this._evaluator.printType(a,!1),destType:this._evaluator.printType(l,!1)})),n&&n.addAddendum(c),r=!1),r}_walkStatementsAndReportUnreachable(e){let t,n=!1;for(const s of e){if(!n&&!this._evaluator.isNodeReachable(s,t)){const t=s.start,i=e[e.length-1],r=d.TextRange.getEnd(i);this._evaluator.addUnusedCode(s,{start:t,length:r-t}),n=!0}!n&&this._fileInfo.isStubFile&&this._validateStubStatement(s),this.walk(s),t=s}}_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,u.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,u.Localizer.Diagnostic.invalidStubStatement(),t)}}}_validateExceptionType(e,t){const n=this._evaluator.getBuiltInType(t,"BaseException"),s=e=>!n||!(0,P.isInstantiableClass)(n)||(0,A.derivesFromClassRecursive)(e,n,!1),i=new o.DiagnosticAddendum;let r;if((0,P.isAnyOrUnknown)(e))r=e;else if((0,P.isInstantiableClass)(e))s(e)||i.addMessage(u.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)})),r=P.ClassType.cloneAsInstance(e);else if((0,P.isClassInstance)(e)){const n=this._evaluator.getTypeOfIterator(e,!1,t)||P.UnknownType.create();r=(0,A.mapSubtypes)(n,(t=>(0,P.isAnyOrUnknown)(t)?t:(0,P.isInstantiableClass)(t)?(s(t)||i.addMessage(u.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)})),P.ClassType.cloneAsInstance(t)):(i.addMessage(u.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:this._evaluator.printType(e,!1)})),P.UnknownType.create())))}return i.isEmpty()||this._evaluator.addError(u.Localizer.Diagnostic.exceptionTypeNotClass().format({type:this._evaluator.printType(e,!1)}),t),r||P.UnknownType.create()}_reportUnusedDunderAllSymbols(e){if("none"===this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll)return;const t=h.getScope(this._moduleNode);t&&e.forEach((e=>{t.symbolTable.has(e.value)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnsupportedDunderAll,l.DiagnosticRule.reportUnsupportedDunderAll,u.Localizer.Diagnostic.dunderAllSymbolNotPresent().format({name:e.value}),e)}))}_validateSymbolTables(){for(const e of this._scopedNodes){const t=h.getScope(e);t&&t.symbolTable.forEach(((e,n)=>{this._conditionallyReportUnusedSymbol(n,e,t.type),this._reportIncompatibleDeclarations(n,e),this._reportMultipleFinalDeclarations(n,e,t.type),this._reportMultipleTypeAliasDeclarations(n,e),this._reportInvalidOverload(n,e)}))}}_reportInvalidOverload(e,t){const n=t.getTypedDeclarations();if(n.length>=1){const s=n[0];if(3===s.type){const n=this._evaluator.getEffectiveTypeOfSymbol(t),i=((0,P.isOverloadedFunction)(n)?n.overloads:(0,P.isFunction)(n)?[n]:[]).filter((e=>P.FunctionType.isOverloaded(e)));if(1===i.length&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.singleOverload().format({name:e}),s.node.name),i.forEach((t=>{if(t.details.declaration&&!v.isFunctionSuiteEmpty(t.details.declaration.node)){const n=new o.DiagnosticAddendum;n.addMessage(u.Localizer.DiagnosticAddendum.overloadWithImplementation()),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.overloadWithImplementation().format({name:e})+n.getString(),t.details.declaration.node.name)}})),!this._fileInfo.isStubFile&&i.length>0){let t;if((0,P.isOverloadedFunction)(n)&&!P.FunctionType.isOverloaded(n.overloads[n.overloads.length-1])?t=n.overloads[n.overloads.length-1]:(0,P.isFunction)(n)&&!P.FunctionType.isOverloaded(n)&&(t=n),t)(0,P.isOverloadedFunction)(n)&&n.overloads.forEach(((n,i)=>{var r,a,c,p;if(n===t||!P.FunctionType.isOverloaded(n))return;const d=new o.DiagnosticAddendum;if(!this._isLegalOverloadImplementation(n,t,d)&&t.details.declaration){const o=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.overloadImplementationMismatch().format({name:e,index:i+1})+d.getString(),t.details.declaration.node.name);o&&n.details.declaration&&o.addRelatedInfo(u.Localizer.DiagnosticAddendum.overloadSignature(),null!==(a=null===(r=n.details.declaration)||void 0===r?void 0:r.path)&&void 0!==a?a:s.path,null!==(p=null===(c=n.details.declaration)||void 0===c?void 0:c.range)&&void 0!==p?p:s.range)}}));else{let e=!1;const t=v.getEnclosingClassOrFunction(s.node);if(t&&10===t.nodeType){const n=this._evaluator.getTypeOfClass(t);n&&P.ClassType.isProtocolClass(n.classType)&&(e=!0)}e||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.overloadWithoutImplementation().format({name:s.node.name.value}),s.node.name)}}}}}_reportMultipleFinalDeclarations(e,t,n){if(!(0,D.isFinalVariable)(t))return;const s=t.getDeclarations();let i=!1,r=!1;if(s.forEach((t=>{(0,f.isFinalVariableDeclaration)(t)&&(i&&this._evaluator.addError(u.Localizer.Diagnostic.finalRedeclaration().format({name:e}),t.node),i=!0),1===t.type&&t.inferredTypeSource&&(r&&2!==n&&this._evaluator.addError(u.Localizer.Diagnostic.finalReassigned().format({name:e}),t.node),r=!0)})),!r&&!this._fileInfo.isStubFile){const n=s.find((e=>1===e.type&&e.isFinal));if(n){let s=!1;if(t.isClassMember()&&!t.isClassVar()){const e=v.getEnclosingClass(n.node,!0);if(e){const t=this._evaluator.getTypeOfClass(e);t&&(0,P.isClass)(t.decoratedType)&&P.ClassType.isDataClass(t.decoratedType)&&(s=!0)}}s||this._evaluator.addError(u.Localizer.Diagnostic.finalUnassigned().format({name:e}),n.node)}}}_reportMultipleTypeAliasDeclarations(e,t){const n=t.getDeclarations(),s=n.find((e=>(0,f.isExplicitTypeAliasDeclaration)(e)));s&&n.length>1&&n.forEach((t=>{t!==s&&this._evaluator.addError(u.Localizer.Diagnostic.typeAliasRedeclared().format({name:e}),t.node)}))}_reportIncompatibleDeclarations(e,t){const n=(0,D.getLastTypedDeclaredForSymbol)(t);if(!n)return;if("_"===e)return;let s,i=t.getDeclarations().filter((e=>e!==n));if(3===n.type){const e=this._evaluator.getTypeOfFunction(n.node);i=i.filter((t=>{if(3!==t.type)return!0;const n=this._evaluator.getTypeOfFunction(t.node);if(!n)return!0;const s=e?this._evaluator.makeTopLevelTypeVarsConcrete(e.decoratedType):void 0;return s&&(0,P.isClassInstance)(s)&&P.ClassType.isPropertyClass(s)&&(0,P.isClassInstance)(n.decoratedType)&&P.ClassType.isPropertyClass(n.decoratedType)?n.decoratedType.details.typeSourceId!==s.details.typeSourceId:!P.FunctionType.isOverloaded(n.functionType)}))}if(0===i.length)return;s=3===n.type?n.isMethod?u.Localizer.DiagnosticAddendum.seeMethodDeclaration():u.Localizer.DiagnosticAddendum.seeFunctionDeclaration():4===n.type?u.Localizer.DiagnosticAddendum.seeClassDeclaration():2===n.type?u.Localizer.DiagnosticAddendum.seeParameterDeclaration():1===n.type?u.Localizer.DiagnosticAddendum.seeVariableDeclaration():u.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(s,n.path,n.range)}};for(const t of i)if(4===t.type){r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.obscuredClassDeclaration().format({name:e}),t.node.name))}else if(3===t.type){const s=this._evaluator.getTypeForDeclaration(n);s&&(0,P.isFunction)(s)&&this._evaluator.getFunctionInferredReturnType(s);let i=!1;const a=this._evaluator.getTypeForDeclaration(t),o=v.getEnclosingSuite(n.node)===v.getEnclosingSuite(t.node);if(a&&(0,P.isFunction)(a)&&this._evaluator.getFunctionInferredReturnType(a),s&&a&&(0,P.isTypeSame)(s,a)&&(i=!0),!i||o){r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,t.isMethod?u.Localizer.Diagnostic.obscuredMethodDeclaration().format({name:e}):u.Localizer.Diagnostic.obscuredFunctionDeclaration().format({name:e}),t.node.name))}}else if(2===t.type){if(t.node.name){r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.obscuredParameterDeclaration().format({name:e}),t.node.name))}}else if(1===t.type){const s=this._evaluator.getTypeForDeclaration(n);if(t.typeAnnotationNode){if(38===t.node.nodeType){let n=!1;const i=this._evaluator.getTypeForDeclaration(t);if(s&&i&&(0,P.isTypeSame)(s,i)&&(n=!0),!n){r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.obscuredVariableDeclaration().format({name:e}),t.node))}}}else if(s&&!(0,A.isProperty)(s)&&(3===n.type||4===n.type)){r(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.obscuredVariableDeclaration().format({name:e}),t.node))}}}_conditionallyReportUnusedSymbol(e,t,n){const s=this._fileInfo.accessedSymbolMap;if(t.isIgnoredForProtocolMatch()||s.has(t.id))return;if("_"===e)return;if(x.isDunderName(e))return;t.getDeclarations().forEach((t=>{this._conditionallyReportUnusedDeclaration(t,this._isSymbolPrivate(e,n))}))}_conditionallyReportUnusedDeclaration(e,t){let n,s,i,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||(s=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 d.TextRange.extend(n,t[t.length-1]),this._fileInfo.diagnosticSink.addUnusedCodeWithTextRange(u.Localizer.Diagnostic.unaccessedSymbol().format({name:e}),n,{action:"pyright.unusedImport"}),void this._evaluator.addDiagnosticForTextRange(this._fileInfo,this._fileInfo.diagnosticRuleSet.reportUnusedImport,l.DiagnosticRule.reportUnusedImport,u.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,i=1===t.module.nameParts.length&&"__future__"===t.module.nameParts[0].value;n||i||(s=e.node.alias||e.node.name)}s&&(i=u.Localizer.Diagnostic.unaccessedImport().format({name:s.value}));break;case 1:case 2:if(!t)return;if(this._fileInfo.isStubFile)return;n=this._fileInfo.diagnosticRuleSet.reportUnusedVariable,38===e.node.nodeType?(s=e.node,s.value.startsWith("_")&&(n="none")):41===e.node.nodeType&&(s=e.node.name,n="none"),s&&(r=l.DiagnosticRule.reportUnusedVariable,i=u.Localizer.Diagnostic.unaccessedVariable().format({name:s.value}));break;case 4:if(!t)return;if(this._fileInfo.isStubFile)return;n=this._fileInfo.diagnosticRuleSet.reportUnusedClass,s=e.node.name,r=l.DiagnosticRule.reportUnusedClass,i=u.Localizer.Diagnostic.unaccessedClass().format({name:s.value});break;case 3:if(!t)return;if(this._fileInfo.isStubFile)return;n=this._fileInfo.diagnosticRuleSet.reportUnusedFunction,s=e.node.name,r=l.DiagnosticRule.reportUnusedFunction,i=u.Localizer.Diagnostic.unaccessedFunction().format({name:s.value});break;default:return}if(s&&void 0!==r&&i){const e=r===l.DiagnosticRule.reportUnusedImport?{action:"pyright.unusedImport"}:void 0;this._fileInfo.diagnosticSink.addUnusedCodeWithTextRange(u.Localizer.Diagnostic.unaccessedSymbol().format({name:s.value}),s,e),this._evaluator.addDiagnostic(n,r,i,s)}}_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 s=this._evaluator.getType(e.arguments[0].valueExpression);if(!s)return;s=(0,A.mapSubtypes)(s,(e=>(0,A.transformPossibleRecursiveTypeAlias)(e)));const i=this._evaluator.getType(e.arguments[1].valueExpression);if(!i)return;let r=!0;if((0,A.doForEachSubtype)(i,(e=>{(0,P.isClassInstance)(e)&&P.ClassType.isTupleClass(e)&&e.tupleTypeArguments?e.tupleTypeArguments.some((e=>!this._isTypeSupportedTypeForIsInstance(e.type,n)))&&(r=!1):this._isTypeSupportedTypeForIsInstance(e,n)||(r=!1)})),!r){const t=new o.DiagnosticAddendum;t.addMessage(u.Localizer.DiagnosticAddendum.typeVarNotAllowed()),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,n?u.Localizer.Diagnostic.isInstanceInvalidType().format({type:this._evaluator.printType(i,!1)})+t.getString():u.Localizer.Diagnostic.isSubclassInvalidType().format({type:this._evaluator.printType(i,!1)})+t.getString(),e.arguments[1])}let a=e;for(;a;){if(2===a.nodeType)return;a=a.parent}const c=["FunctionType","LambdaType","BuiltinFunctionType","BuiltinMethodType","type","Type"],p=[];let d=!1;if((0,A.doForEachSubtype)(i,(e=>{(0,P.isClass)(e)?P.TypeBase.isInstantiable(e)?void 0===e.literalValue&&(p.push(e),P.ClassType.isBuiltIn(e)&&c.some((t=>t===e.details.name))&&(r=!1),e.includeSubclasses&&(d=!0)):((0,A.isTupleClass)(e)?e.tupleTypeArguments&&e.tupleTypeArguments.forEach((e=>{(0,P.isInstantiableClass)(e.type)?(p.push(e.type),e.type.includeSubclasses&&(d=!0)):r=!1})):e.includeSubclasses&&(d=!0),P.ClassType.isBuiltIn(e)&&c.some((t=>t===e.details.name))&&(r=!1)):r=!1})),!r)return;if(p.some((e=>P.ClassType.isProtocolClass(e)&&!P.ClassType.isRuntimeCheckable(e)))&&this._evaluator.addError(u.Localizer.Diagnostic.protocolUsedInCall().format({name:t}),e.arguments[1].valueExpression),(0,A.derivesFromAnyOrUnknown)(s))return;const m=e=>(0,P.combineTypes)(e),y=e=>{const t=[];for(const s of p){const i=P.ClassType.isDerivedFrom(e,s)||n&&P.ClassType.isProtocolClass(s)&&this._evaluator.canAssignType(s,e)||P.ClassType.isBuiltIn(s,"dict")&&P.ClassType.isTypedDictClass(e),r=P.ClassType.isDerivedFrom(s,e)||n&&P.ClassType.isProtocolClass(e)&&this._evaluator.canAssignType(e,s);r&&r&&!P.ClassType.isSameGenericClass(e,s)?t.push(P.UnknownType.create()):i?t.push(e):r&&t.push(s)}return n?t.map((e=>(0,P.isInstantiableClass)(e)?P.ClassType.cloneAsInstance(e):e)):t};let h;if(n&&(0,P.isClassInstance)(s)){h=m(y(P.ClassType.cloneAsInstantiable(s)))}else if(!n&&(0,P.isInstantiableClass)(s)){h=m(y(s))}else{if(!(0,P.isUnion)(s))return;{let e=[],t=!1;if((0,A.doForEachSubtype)(s,(s=>{(0,P.isAnyOrUnknown)(s)&&(t=!0),n&&(0,P.isClassInstance)(s)?e=e.concat(y(P.ClassType.cloneAsInstantiable(s))):!n&&(0,P.isInstantiableClass)(s)&&(e=e.concat(y(s)))})),h=m(e),t)return}}const g=()=>{const e=p.map((e=>P.ClassType.cloneAsInstance(e)));return(0,P.combineTypes)(e)};!d&&(0,P.isTypeSame)(h,s,!0)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnnecessaryIsInstance,l.DiagnosticRule.reportUnnecessaryIsInstance,n?u.Localizer.Diagnostic.unnecessaryIsInstanceAlways().format({testType:this._evaluator.printType(s,!1),classType:this._evaluator.printType(g(),!1)}):u.Localizer.Diagnostic.unnecessaryIsSubclassAlways().format({testType:this._evaluator.printType(s,!1),classType:this._evaluator.printType(g(),!1)}),e)}_isTypeSupportedTypeForIsInstance(e,t){let n=!0;return(0,A.doForEachSubtype)(e,(e=>{switch((e=this._evaluator.makeTopLevelTypeVarsConcrete(e)).category){case 2:case 1:case 0:break;case 7:e.isTypeArgumentExplicit&&!e.includeSubclasses&&(n=!1);break;case 3:n=!!t&&P.TypeBase.isInstantiable(e);break;case 5:n=P.TypeBase.isInstantiable(e);break;case 9:n=this._isTypeSupportedTypeForIsInstance(e,t);break;default:n=!1}})),n}_isSymbolPrivate(e,t){if(1===t||0===t)return!0;if(x.isPrivateName(e))return!0;if(x.isProtectedName(e)){return!(2===t)}return!1}_reportDeprecatedUse(e){var t;const n=null!==(t=k.get(e.value))&&void 0!==t?t:w.get(e.value);if(!n)return;const s=this._evaluator.getType(e);s&&(0,P.isInstantiableClass)(s)&&s.details.fullName===n.fullName&&this._fileInfo.executionEnvironment.pythonVersion>=n.version&&this._evaluator.addDeprecated(u.Localizer.Diagnostic.deprecatedType().format({version:(0,p.versionToString)(n.version),replacement:n.replacementText}),e)}_reportUnboundName(e){if("none"!==this._fileInfo.diagnosticRuleSet.reportUnboundVariable&&!h.isCodeUnreachable(e)){const t=this._evaluator.getType(e);t&&((0,P.isUnbound)(t)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnboundVariable,l.DiagnosticRule.reportUnboundVariable,u.Localizer.Diagnostic.symbolIsUnbound().format({name:e.value}),e):(0,P.isPossiblyUnbound)(t)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnboundVariable,l.DiagnosticRule.reportUnboundVariable,u.Localizer.Diagnostic.symbolIsPossiblyUnbound().format({name:e.value}),e))}}_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,s=x.isPrivateName(n),i=x.isProtectedName(n);if(!s&&!i)return;const r=this._evaluator.getDeclarationsForNameNode(e);let a,o=r&&r.length>0?r[r.length-1]:void 0;if(!o||o.node===e)return;if(6===o.type){if(o.usesLocalName)return;const e=this._evaluator.resolveAliasDeclarationWithInfo(o,!0);if(!e)return;if(o=e.declaration,!e.isPrivate)return}if(!o||o.node===e)return;o.node&&(a=v.getEnclosingClass(o.node)),o.node&&o.node.parent&&o.node.parent===a&&(a=v.getEnclosingClass(a));let c=!1;if(a&&i){const t=this._evaluator.getTypeOfClass(a);if(t&&(0,P.isInstantiableClass)(t.decoratedType)){if(P.ClassType.isDefinedInStub(t.decoratedType))return;c=!0;const n=v.getEnclosingClass(e);if(n){const e=this._evaluator.getTypeOfClass(n);if(e&&(0,P.isInstantiableClass)(e.decoratedType)&&(0,A.derivesFromClassRecursive)(e.decoratedType,t.decoratedType,!0))return}}}a&&!v.isNodeContainedWithin(e,a)&&(c?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportPrivateUsage,l.DiagnosticRule.reportPrivateUsage,u.Localizer.Diagnostic.protectedUsedOutsideOfClass().format({name:n}),e):this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportPrivateUsage,l.DiagnosticRule.reportPrivateUsage,u.Localizer.Diagnostic.privateUsedOutsideOfClass().format({name:n}),e))}_validateEnumClassOverride(e,t){t.details.baseClasses.forEach(((t,n)=>{if((0,P.isClass)(t)&&P.ClassType.isEnumClass(t)){let s=!1;t.details.fields.forEach((e=>{const n=this._evaluator.getEffectiveTypeOfSymbol(e);(0,P.isClassInstance)(n)&&P.ClassType.isSameGenericClass(n,t)&&(s=!0)})),s&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.enumClassOverride().format({name:t.details.name}),e.arguments[n])}}))}_validateTypedDictClassSuite(e){const t=e=>{this._evaluator.addError(u.Localizer.Diagnostic.typedDictBadVar(),e)};e.statements.forEach((e=>{if(!h.isCodeUnreachable(e))if(47===e.nodeType)for(const n of e.statements)54!==n.nodeType&&18!==n.nodeType&&48!==n.nodeType&&42!==n.nodeType&&t(n);else t(e)}))}_validateStrictTypeGuardFunction(e,t,n){var s;if(!t.details.declaredReturnType)return;if(!(0,P.isClassInstance)(t.details.declaredReturnType)||!P.ClassType.isBuiltIn(t.details.declaredReturnType,"StrictTypeGuard")||!t.details.declaredReturnType.typeArguments||t.details.declaredReturnType.typeArguments.length<1)return;const i=t.details.declaredReturnType.typeArguments[0],r=n&&!P.FunctionType.isStaticMethod(t)?1:0;if(r>=t.details.parameters.length)return;const a=P.FunctionType.getEffectiveParameterType(t,r);if(!this._evaluator.canAssignType(a,i)){const t=e.returnTypeAnnotation||(null===(s=e.functionAnnotationComment)||void 0===s?void 0:s.returnTypeAnnotation);t&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.strictTypeGuardReturnType().format({type:this._evaluator.printType(a),returnType:this._evaluator.printType(i)}),t)}}_validateDunderSignatures(e,t,n){var s;const i=t.details.name;if(n&&"__init__"===i){const n=e.returnTypeAnnotation||(null===(s=e.functionAnnotationComment)||void 0===s?void 0:s.returnTypeAnnotation),i=t.details.declaredReturnType;if(n&&i)(0,P.isNoneInstance)(i)||(0,P.isNever)(i)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.initMustReturnNone(),n);else{const n=this._evaluator.getFunctionInferredReturnType(t);(0,P.isNever)(n)||(0,P.isNoneInstance)(n)||(0,P.isAnyOrUnknown)(n)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.initMustReturnNone(),e.name)}}}_validateFunctionReturn(e,t){var n;if(this._fileInfo.isStubFile)return;const s=e.returnTypeAnnotation||(null===(n=e.functionAnnotationComment)||void 0===n?void 0:n.returnTypeAnnotation);if(s){const n=!this._evaluator.isAfterNodeReachable(e),i=this._evaluator.isAfterNodeReachable(e.suite);let r=t.details.declaredReturnType;if(r){(0,P.isUnknown)(r)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownVariableType,l.DiagnosticRule.reportUnknownVariableType,u.Localizer.Diagnostic.declaredReturnTypeUnknown(),s):(0,A.isPartlyUnknown)(r)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownVariableType,l.DiagnosticRule.reportUnknownVariableType,u.Localizer.Diagnostic.declaredReturnTypePartiallyUnknown().format({returnType:this._evaluator.printType(r,!0)}),s);const e=new o.DiagnosticAddendum;(0,P.isTypeVar)(r)&&2===r.details.variance&&(e.addMessage(u.Localizer.DiagnosticAddendum.typeVarIsContravariant().format({name:P.TypeVarType.getReadableName(r)})),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.returnTypeContravariant()+e.getString(),s))}if(P.FunctionType.isGenerator(t)&&(r=(0,A.getDeclaredGeneratorReturnType)(t)),r&&!n&&i)if((0,P.isNever)(r))v.isSuiteEmpty(e.suite)||P.FunctionType.isOverloaded(t)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.noReturnReturnsNone(),s);else if(!P.FunctionType.isAbstractMethod(t)){const n=new o.DiagnosticAddendum;this._evaluator.canAssignType(r,P.NoneType.createInstance(),n)||v.isSuiteEmpty(e.suite)||P.FunctionType.isOverloaded(t)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.returnMissing().format({returnType:this._evaluator.printType(r,!1)})+n.getString(),s)}}else{const n=this._evaluator.getFunctionInferredReturnType(t);(0,P.isUnknown)(n)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,u.Localizer.Diagnostic.returnTypeUnknown(),e.name):(0,A.isPartlyUnknown)(n)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUnknownParameterType,l.DiagnosticRule.reportUnknownParameterType,u.Localizer.Diagnostic.returnTypePartiallyUnknown().format({returnType:this._evaluator.printType(n,!0)}),e.name)}}_validateFinalMemberOverrides(e){e.details.fields.forEach(((t,n)=>{const s=(0,A.lookUpClassMember)(e,n,1);if(s&&(0,P.isInstantiableClass)(s.classType)&&(0,D.isFinalVariable)(s.symbol)&&!x.isPrivateName(n)){const e=t.getDeclarations()[0];this._evaluator.addError(u.Localizer.Diagnostic.finalRedeclarationBySubclass().format({name:n,className:s.classType.details.name}),e.node)}}))}_reportDuplicateEnumMembers(e){P.ClassType.isEnumClass(e)&&!P.ClassType.isBuiltIn(e)&&e.details.fields.forEach(((t,n)=>{if(t.getTypedDeclarations().length>0)return;const s=t.getDeclarations();if(s.length>=2&&1===s[0].type){const i=this._evaluator.getEffectiveTypeOfSymbol(t);(0,P.isClassInstance)(i)&&P.ClassType.isSameGenericClass(i,e)&&void 0!==i.literalValue&&this._evaluator.addError(u.Localizer.Diagnostic.duplicateEnumMember().format({name:n}),s[1].node)}}))}_validateProtocolCompatibility(e,t){if(P.ClassType.isProtocolClass(e))return;const n=new o.DiagnosticAddendum,s=t=>e.details.mro.some((e=>(0,P.isClass)(e)&&!P.ClassType.isProtocolClass(e)&&e.details.fields.has(t)));e.details.baseClasses.forEach((e=>{if(!(0,P.isClass)(e)||!P.ClassType.isProtocolClass(e))return;(0,A.getProtocolSymbols)(e).forEach(((e,t)=>{const i=e.symbol.getDeclarations();0!==i.length&&(0,P.isClass)(e.classType)&&(1===i[0].type?i.some((e=>1===e.type&&!!e.inferredTypeSource))||s(t)||n.addMessage(u.Localizer.DiagnosticAddendum.missingProtocolMember().format({name:t,classType:e.classType.details.name})):3===i[0].type&&v.isSuiteEmpty(i[0].node.suite)&&i[0]&&".pyi"!==(0,c.getFileExtension)(i[0].path).toLowerCase()&&(s(t)||n.addMessage(u.Localizer.DiagnosticAddendum.missingProtocolMember().format({name:t,classType:e.classType.details.name}))))}))})),n.isEmpty()||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.missingProtocolMembers()+n.getString(),t.name)}_validateDataClassPostInit(e,t){if(!P.ClassType.isDataClass(e))return;const n=(0,A.lookUpClassMember)(e,"__post_init__",18);if(!n)return;if(P.ClassType.derivesFromAnyOrUnknown(e))return;const s=new Map;for(let t=e.details.mro.length-1;t>=0;t--){const n=e.details.mro[t];(0,P.isClass)(n)&&P.ClassType.isDataClass(n)&&n.details.fields.forEach(((e,t)=>{e.isInitVar()&&s.set(t,e)}))}const i=this._evaluator.getTypeOfMember(n);if(!(0,P.isFunction)(i)||!P.FunctionType.isInstanceMethod(i)||!i.details.declaration)return;const r=(0,A.getParameterListDetails)(i);if(void 0!==r.argsIndex||void 0!==r.kwargsIndex||void 0!==r.firstKeywordOnlyIndex)return;const a=r.params.filter((e=>!e.param.hasDefault)),c=s.size+1;(c<a.length||c>r.params.length)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.dataClassPostInitParamCount().format({expected:s.size}),i.details.declaration.node.name);let p=1;s.forEach(((e,t)=>{if(p>=r.params.length)return;const n=r.params[p].param;if(n.hasDeclaredType&&n.typeAnnotation){const s=this._evaluator.getDeclaredTypeOfSymbol(e),a=P.FunctionType.getEffectiveParameterType(i,r.params[p].index),c=new o.DiagnosticAddendum;if(s&&!this._evaluator.canAssignType(a,s,c)){const s=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.dataClassPostInitType().format({fieldName:t})+c.getString(),n.typeAnnotation);if(s){const t=e.getTypedDeclarations();t.length>0&&s.addRelatedInfo(u.Localizer.DiagnosticAddendum.dataClassFieldLocation(),t[0].path,t[0].range)}}}p++}))}_validateFinalClassNotAbstract(e,t){if(!P.ClassType.isFinal(e))return;if(!P.ClassType.supportsAbstractMethods(e))return;const n=this._evaluator.getAbstractMethods(e);if(0===n.length)return;const s=new o.DiagnosticAddendum;n.forEach(((e,t)=>{if(2===t)s.addMessage(u.Localizer.DiagnosticAddendum.memberIsAbstractMore().format({count:n.length-2}));else if(t<2&&(0,P.isInstantiableClass)(e.classType)){const t=e.classType.details.name;s.addMessage(u.Localizer.DiagnosticAddendum.memberIsAbstract().format({type:t,name:e.symbolName}))}})),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.finalClassIsAbstract().format({type:e.details.name})+s.getString(),t.name)}_validateInstanceVariableInitialization(e){"none"!==this._fileInfo.diagnosticRuleSet.reportUninitializedInstanceVariable&&e.details.fields.forEach(((t,n)=>{if(!t.isInstanceMember())return;const s=t.getDeclarations();if(s.find((e=>{const t=v.getEnclosingClassOrFunction(e.node);return!t||10===t.nodeType||"__init__"===t.name.value})))return;(0,A.lookUpClassMember)(e,n,1)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportUninitializedInstanceVariable,l.DiagnosticRule.reportUninitializedInstanceVariable,u.Localizer.Diagnostic.uninitializedInstanceVariable().format({name:n}),s[0].node)}))}_validateProtocolTypeParamVariance(e,t){const n=t.details.typeParameters.filter((e=>!(0,P.isParamSpec)(e)));if(0===n.length)return;const s=this._evaluator.getBuiltInType(e,"object");if(!(0,P.isInstantiableClass)(s))return;const i=n.map((e=>(0,P.isVariadicTypeVar)(e)?e:P.TypeVarType.cloneAsInvariant(e))),r=P.ClassType.cloneWithNewTypeParameters(t,i),a=P.ClassType.cloneAsInstance(s),o=P.ClassType.createInstantiable("__protocolVarianceDummy","","","",0,0,void 0,void 0);i.forEach(((s,c)=>{if(s.details.isVariadic)return;const p=i.map(((e,t)=>e.details.isVariadic?e:t===c?a:o)),d=i.map(((e,t)=>t===c||e.details.isVariadic?e:o)),m=P.ClassType.cloneForSpecialization(r,p,!0),y=P.ClassType.cloneForSpecialization(r,d,!0);let h;if(this._evaluator.canAssignProtocolClassToSelf(m,y))h=1;else{h=this._evaluator.canAssignProtocolClassToSelf(y,m)?2:0}if(h!==n[c].details.variance){let n;n=1===h?u.Localizer.Diagnostic.protocolVarianceCovariant().format({variable:s.details.name,class:t.details.name}):2===h?u.Localizer.Diagnostic.protocolVarianceContravariant().format({variable:s.details.name,class:t.details.name}):u.Localizer.Diagnostic.protocolVarianceInvariant().format({variable:s.details.name,class:t.details.name}),this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInvalidTypeVarUse,l.DiagnosticRule.reportInvalidTypeVarUse,n,e.name)}}))}_validateSlotsClassVarConflict(e){e.details.localSlotsNames&&e.details.fields.forEach(((e,t)=>{const n=e.getDeclarations();n.some((e=>1===e.type&&e.isDefinedBySlots))&&n.forEach((e=>{1!==e.type||e.isDefinedBySlots||e.isDefinedByMemberAccess||38===e.node.nodeType&&v.isWriteAccess(e.node)&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.slotsClassVarConflict().format({name:t}),e.node)}))}))}_validateConstructorConsistency(e){const t=(0,A.lookUpClassMember)(e,"__init__",12),n=(0,A.lookUpClassMember)(e,"__new__",12);if(!(t&&n&&(0,P.isClass)(t.classType)&&(0,P.isClass)(n.classType)))return;if(!P.ClassType.isSameGenericClass(n.classType,e)&&!P.ClassType.isSameGenericClass(t.classType,e))return;const s=n.classType.details.effectiveMetaclass;if(s&&(0,P.isClass)(s)&&!P.ClassType.isBuiltIn(s,"type")){if((0,A.lookUpClassMember)(s,"__call__",40))return}let i=this._evaluator.getTypeOfMember(n);if(!(0,P.isFunction)(i)&&!(0,P.isOverloadedFunction)(i))return;if(i=this._evaluator.bindFunctionToClassOrObject(e,i,void 0,void 0,void 0,!0),!i)return;if((0,P.isOverloadedFunction)(i)&&(i=i.overloads.find((e=>!P.FunctionType.isOverloaded(e))),!i))return;let r=this._evaluator.getTypeOfMember(t);if(((0,P.isFunction)(r)||(0,P.isOverloadedFunction)(r))&&(r=this._evaluator.bindFunctionToClassOrObject(P.ClassType.cloneAsInstance(e),r),r&&(!(0,P.isOverloadedFunction)(r)||(r=r.overloads.find((e=>!P.FunctionType.isOverloaded(e))),r))&&(0,P.isFunction)(r)&&(0,P.isFunction)(i)&&!(P.FunctionType.hasDefaultParameters(r)||P.FunctionType.hasDefaultParameters(i)||(r=P.FunctionType.cloneWithNewFlags(r,98304|r.details.flags),i=P.FunctionType.cloneWithNewFlags(i,98304|r.details.flags),this._evaluator.canAssignType(i,r,void 0,void 0,32)&&this._evaluator.canAssignType(r,i,void 0,void 0,32))))){const s=P.ClassType.isSameGenericClass(t.classType,e),a=(0,D.getLastTypedDeclaredForSymbol)(t.symbol),c=(0,D.getLastTypedDeclaredForSymbol)(n.symbol);if(a&&c){const e=s?a:c,p=28===e.node.nodeType?e.node.name:e.node,d=new o.DiagnosticAddendum,m=this._evaluator.printType(r),y=this._evaluator.printType(i);d.addMessage(u.Localizer.DiagnosticAddendum.initMethodSignature().format({type:m})),d.addMessage(u.Localizer.DiagnosticAddendum.newMethodSignature().format({type:y}));const h=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportInconsistentConstructor,l.DiagnosticRule.reportInconsistentConstructor,u.Localizer.Diagnostic.constructorParametersMismatch().format({classType:this._evaluator.printType(P.ClassType.cloneAsInstance(s?t.classType:n.classType))})+d.getString(),p);if(h){const e=s?c:a;h.addRelatedInfo((s?u.Localizer.DiagnosticAddendum.newMethodLocation():u.Localizer.DiagnosticAddendum.initMethodLocation()).format({type:this._evaluator.printType(P.ClassType.cloneAsInstance(s?n.classType:t.classType))}),e.path,e.range)}}}}_validateMultipleInheritanceCompatibility(e,t){if("none"===this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride&&"none"===this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride)return;const n=[];if(e.details.baseClasses.forEach((e=>{!(0,P.isClass)(e)||P.ClassType.isBuiltIn(e,"Generic")||P.ClassType.isBuiltIn(e,"Protocol")||n.push(e)})),n.length<2)return;const s=n.map((t=>{const n=e.details.mro.find((e=>(0,P.isClass)(e)&&P.ClassType.isSameGenericClass(e,t)));return n&&(0,P.isClass)(n)?(0,A.getClassFieldsRecursive)(n):new Map}));for(let i=1;i<s.length;i++){const r=s[i];for(const[a,o]of r){if(x.isDunderName(a)||x.isPrivateName(a))continue;const r=o.classType;if((0,P.isClass)(r))for(let r=0;r<i;r++){const l=s[r].get(a);l&&this._validateMultipleInheritanceOverride(o,l,e,a,n[i],n[r],t)}}}}_validateMultipleInheritanceOverride(e,t,n,s,i,r,a){if(!(0,P.isClass)(e.classType)||!(0,P.isClass)(t.classType))return;let c=this._evaluator.getEffectiveTypeOfSymbol(e.symbol);c=(0,A.partiallySpecializeType)(c,e.classType);const p=t.symbol;let d,m=this._evaluator.getEffectiveTypeOfSymbol(p);m=(0,A.partiallySpecializeType)(m,t.classType);const y=(0,D.getLastTypedDeclaredForSymbol)(t.symbol),h=(0,D.getLastTypedDeclaredForSymbol)(e.symbol);if((0,P.isFunction)(c)||(0,P.isOverloadedFunction)(c)){const e=new o.DiagnosticAddendum;let t;if((0,P.isFunction)(m))t=m;else if((0,P.isOverloadedFunction)(m)&&(t=m.overloads[m.overloads.length-1],P.FunctionType.isOverloaded(t)))return;if(t&&!this._evaluator.canOverrideMethod(c,t,e,!0)){const i=t.details.declaration;i&&3===i.type&&(d=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,u.Localizer.Diagnostic.baseClassMethodTypeIncompatible().format({classType:n.details.name,name:s})+e.getString(),a))}}else if((0,A.isProperty)(c)){if(!(0,A.isProperty)(m)&&!(0,P.isAnyOrUnknown)(m)){p.getDeclarations().length>0&&(d=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride,l.DiagnosticRule.reportIncompatibleVariableOverride,u.Localizer.Diagnostic.baseClassVariableTypeIncompatible().format({classType:n.details.name,name:s}),a))}}else"none"!==this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride&&((0,P.isAnyOrUnknown)(c)||(0,P.isAnyOrUnknown)(m)||(0,P.isTypeSame)(c,m)||(d=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride,l.DiagnosticRule.reportIncompatibleVariableOverride,u.Localizer.Diagnostic.baseClassVariableTypeIncompatible().format({classType:n.details.name,name:s}),a)));d&&y&&h&&(d.addRelatedInfo(u.Localizer.DiagnosticAddendum.baseClassProvidesType().format({baseClass:this._evaluator.printType((0,A.convertToInstance)(i)),type:this._evaluator.printType(m)}),y.path,y.range),d.addRelatedInfo(u.Localizer.DiagnosticAddendum.baseClassProvidesType().format({baseClass:this._evaluator.printType((0,A.convertToInstance)(r)),type:this._evaluator.printType(c)}),h.path,h.range))}_validateBaseClassOverrides(e){e.details.fields.forEach(((t,n)=>{if(x.isPrivateName(n))return;if(!t.hasTypedDeclarations())return;const s=this._evaluator.getEffectiveTypeOfSymbol(t);if(!(0,P.isAnyOrUnknown)(s))for(const i of e.details.baseClasses){if(!(0,P.isClass)(i))continue;const r=e.details.mro.find((e=>(0,P.isClass)(e)&&P.ClassType.isSameGenericClass(e,i)));if(!r)continue;const a=(0,A.lookUpClassMember)(r,n,0);a&&this._validateBaseClassOverride(a,t,s,e,n)}}))}_validateBaseClassOverride(e,t,n,s,i){var r;if(!(0,P.isInstantiableClass)(e.classType))return;if(!e.symbol.hasTypedDeclarations())return;const a=(0,A.partiallySpecializeType)(this._evaluator.getEffectiveTypeOfSymbol(e.symbol),e.classType);if((0,P.isFunction)(a)||(0,P.isOverloadedFunction)(a)){const s=new o.DiagnosticAddendum;let c;if((0,P.isFunction)(n)?c=n:(0,P.isOverloadedFunction)(n)&&(c=n.overloads[n.overloads.length-1]),c){const n=["__init__","__new__","__init_subclass__"],o=!x.isDunderName(i);if(!n.some((e=>e===i))&&!x.isPrivateName(i)&&!this._evaluator.canOverrideMethod(a,c,s,o)){const n=null!==(r=c.details.declaration)&&void 0!==r?r:(0,D.getLastTypedDeclaredForSymbol)(t);if(n){const t=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,u.Localizer.Diagnostic.incompatibleMethodOverride().format({name:i,className:e.classType.details.name})+s.getString(),3===n.type?n.node.name:n.node),r=(0,D.getLastTypedDeclaredForSymbol)(e.symbol);t&&r&&t.addRelatedInfo(u.Localizer.DiagnosticAddendum.overriddenMethod(),r.path,r.range)}}if((0,P.isFunction)(a)&&!x.isPrivateName(i)&&P.FunctionType.isFinal(a)){const n=(0,D.getLastTypedDeclaredForSymbol)(t);if(n&&3===n.type){const t=this._evaluator.addError(u.Localizer.Diagnostic.finalMethodOverride().format({name:i,className:e.classType.details.name}),n.node.name),s=(0,D.getLastTypedDeclaredForSymbol)(e.symbol);t&&s&&t.addRelatedInfo(u.Localizer.DiagnosticAddendum.finalMethod(),s.path,s.range)}}}else if(!(0,P.isAnyOrUnknown)(n)&&!P.ClassType.isBuiltIn(e.classType,"_TypedDict")){const s=t.getDeclarations();if(s.length>0){const t=s[s.length-1],r=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,u.Localizer.Diagnostic.methodOverridden().format({name:i,className:e.classType.details.name,type:this._evaluator.printType(n,!1)}),t.node),a=(0,D.getLastTypedDeclaredForSymbol)(e.symbol);r&&a&&r.addRelatedInfo(u.Localizer.DiagnosticAddendum.overriddenMethod(),a.path,a.range)}}}else if((0,A.isProperty)(a))if((0,A.isProperty)(n)){const r=a.details.fields,c=n.details.fields,p=e.classType;["fget","fset","fdel"].forEach((e=>{const n=new o.DiagnosticAddendum,a=r.get(e),d=c.get(e);if(a){const r=(0,A.partiallySpecializeType)(this._evaluator.getEffectiveTypeOfSymbol(a),p);if((0,P.isFunction)(r))if(d){const t=(0,A.partiallySpecializeType)(this._evaluator.getEffectiveTypeOfSymbol(d),s);if((0,P.isFunction)(t)&&!this._evaluator.canOverrideMethod(r,t,n.createAddendum())){n.addMessage(u.Localizer.DiagnosticAddendum.propertyMethodIncompatible().format({name:e}));const s=t.details.declaration;if(s&&3===s.type){const e=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,u.Localizer.Diagnostic.propertyOverridden().format({name:i,className:p.details.name})+n.getString(),s.node.name),t=r.details.declaration;e&&t&&e.addRelatedInfo(u.Localizer.DiagnosticAddendum.overriddenMethod(),t.path,t.range)}}}else{n.addMessage(u.Localizer.DiagnosticAddendum.propertyMethodMissing().format({name:e}));const s=t.getDeclarations();if(s.length>0){const e=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,u.Localizer.Diagnostic.propertyOverridden().format({name:i,className:p.details.name})+n.getString(),s[s.length-1].node),t=r.details.declaration;e&&t&&e.addRelatedInfo(u.Localizer.DiagnosticAddendum.overriddenMethod(),t.path,t.range)}}}}))}else{const n=t.getDeclarations();n.length>0&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleMethodOverride,l.DiagnosticRule.reportIncompatibleMethodOverride,u.Localizer.Diagnostic.propertyOverridden().format({name:i,className:e.classType.details.name}),n[n.length-1].node)}else if("none"!==this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride){const s=t.getDeclarations();if(s.length>0){const r=s[s.length-1],c=new o.DiagnosticAddendum;if(!this._evaluator.canAssignType(a,n,c)){const t=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride,l.DiagnosticRule.reportIncompatibleVariableOverride,u.Localizer.Diagnostic.symbolOverridden().format({name:i,className:e.classType.details.name})+c.getString(),r.node),n=(0,D.getLastTypedDeclaredForSymbol)(e.symbol);t&&n&&t.addRelatedInfo(u.Localizer.DiagnosticAddendum.overriddenSymbol(),n.path,n.range)}const p=e.symbol.isClassVar();let d=t.isClassVar();if(p&&!d&&(t.hasTypedDeclarations()||(d=!0),t.getTypedDeclarations().every((e=>4===e.type))&&(d=!0)),p!==d){const n=t.isClassVar()?u.Localizer.Diagnostic.classVarOverridesInstanceVar():u.Localizer.Diagnostic.instanceVarOverridesClassVar(),s=this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportIncompatibleVariableOverride,l.DiagnosticRule.reportIncompatibleVariableOverride,n.format({name:i,className:e.classType.details.name}),r.node),a=(0,D.getLastTypedDeclaredForSymbol)(e.symbol);s&&a&&s.addRelatedInfo(u.Localizer.DiagnosticAddendum.overriddenSymbol(),a.path,a.range)}}}}_validateMethod(e,t,n){const s=this._evaluator.getTypeOfClass(n),i=null==s?void 0:s.classType;if(e.name&&i){["__init__","__init_subclass__","__enter__","__exit__"].some((t=>t===e.name.value))&&(P.FunctionType.isAbstractMethod(t)||P.FunctionType.isOverloaded(t)||this._fileInfo.isStubFile||this._validateSuperCallForMethod(e,t,i))}if(e.name&&"__new__"===e.name.value)0!==e.parameters.length&&e.parameters[0].name&&["cls","_cls","__cls","__mcls"].some((t=>e.parameters[0].name.value===t))||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,u.Localizer.Diagnostic.newClsParam(),e.parameters.length>0?e.parameters[0]:e.name),i&&this._validateClsSelfParameterType(t,i,!0);else if(e.name&&"__init_subclass__"===e.name.value)0!==e.parameters.length&&e.parameters[0].name&&"cls"===e.parameters[0].name.value||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,u.Localizer.Diagnostic.initSubclassClsParam(),e.parameters.length>0?e.parameters[0]:e.name),i&&this._validateClsSelfParameterType(t,i,!0);else if(e.name&&"__class_getitem__"===e.name.value)0!==e.parameters.length&&e.parameters[0].name&&"cls"===e.parameters[0].name.value||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,u.Localizer.Diagnostic.classGetItemClsParam(),e.parameters.length>0?e.parameters[0]:e.name),i&&this._validateClsSelfParameterType(t,i,!0);else if(P.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,u.Localizer.Diagnostic.staticClsSelfParam(),e.parameters[0].name)}}else if(P.FunctionType.isClassMethod(t)){let n="";e.parameters.length>0&&e.parameters[0].name&&(n=e.parameters[0].name.value),"cls"!==n&&(this._fileInfo.isStubFile&&(n.startsWith("_")||"metacls"===n)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,u.Localizer.Diagnostic.classMethodClsParam(),e.parameters.length>0?e.parameters[0]:e.name)),i&&this._validateClsSelfParameterType(t,i,!0)}else{if(0===e.decorators.length){let t="",s=!0;if(e.parameters.length>0&&(e.parameters[0].name&&(t=e.parameters[0].name.value),0!==e.parameters[0].category&&(s=!1)),s&&"self"!==t){let s=!1;if("cls"===t){const e=this._evaluator.getTypeOfClass(n),t=this._evaluator.getBuiltInType(n,"type");t&&(0,P.isInstantiableClass)(t)&&e&&(0,P.isInstantiableClass)(e.classType)&&(0,A.derivesFromClassRecursive)(e.classType,t,!0)&&(s=!0)}const i=x.isPrivateOrProtectedName(t);s||i||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportSelfClsParameterName,l.DiagnosticRule.reportSelfClsParameterName,u.Localizer.Diagnostic.instanceMethodSelfParam(),e.parameters.length>0?e.parameters[0]:e.name)}}i&&this._validateClsSelfParameterType(t,i,!1)}}_validateSuperCallForMethod(e,t,n){if("none"===this._fileInfo.diagnosticRuleSet.reportMissingSuperCall)return;let s=9;P.ClassType.isFinal(n)&&(s|=4);if(!(0,A.lookUpClassMember)(n,t.details.name,s))return;let i=!1;const r=new v.CallNodeWalker((e=>{if(35===e.leftExpression.nodeType&&e.leftExpression.memberName.value===t.details.name){const t=e.leftExpression.leftExpression;if(9===t.nodeType&&38===t.leftExpression.nodeType&&"super"===t.leftExpression.value)i=!0;else{const e=this._evaluator.getType(t);e&&(0,P.isInstantiableClass)(e)&&(i=!0)}}}));r.walk(e.suite),i||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingSuperCall,l.DiagnosticRule.reportMissingSuperCall,u.Localizer.Diagnostic.missingSuperCall().format({methodName:t.details.name}),e.name)}_validateClsSelfParameterType(e,t,n){if(e.details.parameters.length<1)return;const s=e.details.parameters[0];if(!s.typeAnnotation||!s.name)return;if(P.ClassType.isProtocolClass(t))return;const i=this._evaluator.makeTopLevelTypeVarsConcrete(s.type),r=n?t:(0,A.convertToInstance)(t);(0,P.isInstantiableClass)(i)&&P.ClassType.isProtocolClass(i)||(0,P.isClassInstance)(i)&&P.ClassType.isProtocolClass(i)||P.FunctionType.isOverloaded(e)||this._evaluator.canAssignType(i,r)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.clsSelfParamTypeMismatch().format({name:s.name,classType:this._evaluator.printType(r,!1)}),s.typeAnnotation)}_validateYieldType(e,t){let n,s;const i=v.getEnclosingFunction(e);if(i){const e=this._evaluator.getTypeOfFunction(i);e&&((0,a.assert)((0,P.isFunction)(e.functionType)),n=P.FunctionType.getSpecializedReturnType(e.functionType),n&&(s=(0,A.getGeneratorYieldType)(n,!!i.isAsync)),n&&!s&&i.returnTypeAnnotation&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,i.isAsync?u.Localizer.Diagnostic.generatorAsyncReturnType():u.Localizer.Diagnostic.generatorSyncReturnType(),i.returnTypeAnnotation))}if(this._evaluator.isNodeReachable(e,void 0))if(n&&(0,P.isNever)(n))this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.noReturnContainsYield(),e);else if(s){const n=new o.DiagnosticAddendum;this._evaluator.canAssignType(s,t,n)||this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.yieldTypeMismatch().format({exprType:this._evaluator.printType(t,!1),yieldType:this._evaluator.printType(s,!1)})+n.getString(),e.expression||e)}}_reportUnusedExceptStatements(e){let t=!1;const n=[];e.exceptClauses.forEach((e=>{if(t||e.isExceptGroup||!e.typeExpression)return;const s=this._evaluator.getType(e.typeExpression);if(!s||(0,P.isAnyOrUnknown)(s))return void(t=!0);const i=[];if((0,P.isInstantiableClass)(s))s.includeSubclasses&&(t=!0),i.push(s);else if((0,P.isClassInstance)(s)){const e=this._evaluator.getTypeOfIterator(s,!1,void 0)||P.UnknownType.create();(0,A.doForEachSubtype)(e,(e=>{(0,P.isAnyOrUnknown)(e)&&(t=!0),(0,P.isInstantiableClass)(e)&&(e.includeSubclasses&&(t=!0),i.push(e))}))}else t=!0;if(n.length>0&&!t){const t=new o.DiagnosticAddendum;let s=0;i.forEach((e=>{const i=n.find((t=>(0,A.derivesFromClassRecursive)(e,t,!0)));i&&(t.addMessage(u.Localizer.DiagnosticAddendum.unreachableExcept().format({exceptionType:this._evaluator.printType((0,A.convertToInstance)(e)),parentType:this._evaluator.printType((0,A.convertToInstance)(i))})),s++)})),i.length===s&&(this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportGeneralTypeIssues,l.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.unreachableExcept()+t.getString(),e.typeExpression),this._evaluator.addUnusedCode(e,e.exceptSuite))}n.push(...i)}))}_reportDuplicateImports(){const e=(0,_.getTopLevelImports)(this._moduleNode),t=new Map;e.orderedImports.forEach((e=>{if(22===e.node.nodeType){const t=new Map;e.node.imports.forEach((e=>{if(!e.alias){t.get(e.name.value)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportDuplicateImport,l.DiagnosticRule.reportDuplicateImport,u.Localizer.Diagnostic.duplicateImport().format({importName:e.name.value}),e.name):t.set(e.name.value,e)}}))}else if(e.subnode&&!e.subnode.alias){t.get(e.moduleName)?this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportDuplicateImport,l.DiagnosticRule.reportDuplicateImport,u.Localizer.Diagnostic.duplicateImport().format({importName:e.moduleName}),e.subnode):t.set(e.moduleName,e.subnode)}}))}}t.Checker=N;class M extends b.ParseTreeWalker{constructor(e,t,n){super(),this._importResolver=e,this._evaluator=t,this._fileInfo=n}static report(e,t,n,s){n.isStubFile||new M(e,t,n).walk(s)}visitNode(e){return(0,m.isExpressionNode)(e)?[]:super.visitNode(e)}visitModuleName(e){const t=h.getImportInfo(e);return(0,a.assert)(void 0!==t),this._addMissingModuleSourceDiagnosticIfNeeded(t,e),!1}visitImportFromAs(e){const t=this._evaluator.getDeclarationsForNameNode(e.name);if(!t)return!1;for(const n of t){if(!(0,g.isAliasDeclaration)(n)||!n.submoduleFallback||n.node!==e)continue;const t=this._evaluator.resolveAliasDeclaration(n,!0);if(!(null==t?void 0:t.path)||!(0,S.isStubFile)(t.path))continue;const s=this._getImportResult(e,t.path);if(s){this._addMissingModuleSourceDiagnosticIfNeeded(s,e.name);break}}return!1}_getImportResult(e,t){const n=this._importResolver.getConfigOption().findExecEnvironment(t),s=0===e.parent.module.leadingDots?this._importResolver.getModuleNameForImport(t,n).moduleName:(0,_.getRelativeModuleName)(this._importResolver.fileSystem,this._fileInfo.filePath,t);if(s)return this._importResolver.resolveImport(this._fileInfo.filePath,n,(0,T.createImportedModuleDescriptor)(s))}_addMissingModuleSourceDiagnosticIfNeeded(e,t){!e.isNativeLib&&e.isStubFile&&0!==e.importType&&e.nonStubImportResult&&!e.nonStubImportResult.isImportFound&&this._evaluator.addDiagnostic(this._fileInfo.diagnosticRuleSet.reportMissingModuleSource,l.DiagnosticRule.reportMissingModuleSource,u.Localizer.Diagnostic.importSourceResolveFailure().format({importName:e.importName}),t)}}},41563:(e,t)=>{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}}},98514:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getCodeFlowEngine=void 0;const s=n(20823),i=(n(28348),n(35696)),r=n(66124),a=(n(43485),n(23241)),o=n(57065),l=n(89806),c=n(59195),p=n(10425);t.getCodeFlowEngine=function(e,t){const n=new Map,d=new Map,u=new Map;let m=1;function y(e,t){const i=new Set;if(n.has(e.id))return!0;n.set(e.id,!0);try{return function e(t,n,a=0){if(a>64)return!0;a++;let o=t;for(;;){if(i.has(o.id))return!1;if(i.add(o.id),o.flags&r.FlowFlags.Unreachable)return!1;if(o===n)return!0;if(o.flags&(r.FlowFlags.VariableAnnotation|r.FlowFlags.Assignment|r.FlowFlags.TrueCondition|r.FlowFlags.FalseCondition|r.FlowFlags.WildcardImport|r.FlowFlags.TrueNeverCondition|r.FlowFlags.FalseNeverCondition|r.FlowFlags.NarrowForPattern|r.FlowFlags.ExhaustedMatch))o=o.antecedent;else if(o.flags&r.FlowFlags.Call){const e=o;if(g(e))return!1;o=e.antecedent}else{if(o.flags&(r.FlowFlags.BranchLabel|r.FlowFlags.LoopLabel)){if(o.flags&r.FlowFlags.PostContextManager){const e=o;if(!e.expressions.some((t=>f(t,e.isAsync))))return!1}const t=o;for(const s of t.antecedents)if(e(s,n,a))return!0;return!1}if(o.flags&r.FlowFlags.Start)return!n;if(!(o.flags&r.FlowFlags.PreFinallyGate)){if(o.flags&r.FlowFlags.PostFinally){const t=o,s=t.preFinallyGate.isGateClosed;try{return t.preFinallyGate.isGateClosed=!0,e(t.antecedent,n,a)}finally{t.preFinallyGate.isGateClosed=s}}return(0,s.fail)("Unexpected flow node flags"),!1}{const e=o;if(e.isGateClosed)return!1;o=e.antecedent}}}}(e,t)}finally{n.delete(e.id)}}function h(e,t){let n=!0;return(0,p.doForEachSubtype)(e,(e=>{(0,c.isTypeVar)(e)?(0,c.isTypeSame)(e,t)||(n=!1):e.condition&&e.condition.some((e=>e.isConstrainedTypeVar&&e.typeVarName===t.nameWithScope))||(n=!1)})),n}function g(t){const n=t.node;if(d.has(n.id)){const e=d.get(n.id);return e}d.set(n.id,!1);let s=0,i=0;const r=v(n.leftExpression);r&&(0,p.doForEachSubtype)(r,(t=>{var r;let a;if(i++,(0,c.isInstantiableClass)(t)){if(t.details.effectiveMetaclass&&(0,c.isClass)(t.details.effectiveMetaclass)&&!c.ClassType.isBuiltIn(t.details.effectiveMetaclass,"type")){if((0,p.lookUpClassMember)(t.details.effectiveMetaclass,"__call__",12))return}let n=(0,p.lookUpClassMember)(t,"__init__",12);if(void 0===n&&(n=(0,p.lookUpClassMember)(t,"__new__",12)),n){const s=e.getTypeOfMember(n);if(s&&((0,c.isFunction)(s)||(0,c.isOverloadedFunction)(s))){const n=e.bindFunctionToClassOrObject(void 0,s);n&&(t=n)}}}else if((0,c.isClassInstance)(t)){const n=(0,p.lookUpClassMember)(t,"__call__",8);if(n){const s=e.getTypeOfMember(n);if(s&&((0,c.isFunction)(s)||(0,c.isOverloadedFunction)(s))){const n=e.bindFunctionToClassOrObject(void 0,s);n&&(t=n)}}}if((0,c.isFunction)(t))a=t;else if((0,c.isOverloadedFunction)(t)){const e=t;a=e.overloads[e.overloads.length-1]}if(a){const t=a.details.declaredReturnType;if(c.FunctionType.isAsync(a))t&&(0,c.isClassInstance)(t)&&c.ClassType.isBuiltIn(t,"Coroutine")&&t.typeArguments&&t.typeArguments.length>=3&&(0,c.isNever)(t.typeArguments[2])&&6===(null===(r=n.parent)||void 0===r?void 0:r.nodeType)&&s++;else if(t)(0,c.isNever)(t)&&s++;else if(a.details.declaration&&!(a.details.declaration.yieldStatements||c.FunctionType.isAbstractMethod(a)||c.FunctionType.isStubDefinition(a)||c.FunctionType.isPyTypedDefinition(a))){const t=a.details.declaration.node.suite.statements;let n=!1;for(const e of t){if(47!==e.nodeType||1!==e.statements.length)break;const t=e.statements[0];if(48!==t.nodeType){if(43===t.nodeType&&t.typeExpression){const e=e=>38===(null==e?void 0:e.nodeType)&&"NotImplementedError"===e.value;(e(t.typeExpression)||9===t.typeExpression.nodeType&&e(t.typeExpression.leftExpression))&&(n=!0)}break}}n||function(e,t){if(!t.details.declaration)return!0;return e.isAfterNodeReachable(t.details.declaration.node)}(e,a)||s++}}}));const a=i>0&&s===i;return d.set(n.id,a),a}function f(t,n){var s;if(u.has(t.id))return u.get(t.id);u.set(t.id,!1);let i,r=!1;if(9===t.nodeType){const e=v(t.leftExpression);if(e)if((0,c.isInstantiableClass)(e))i=(0,p.convertToInstance)(e);else if((0,c.isFunction)(e))i=e.details.declaredReturnType;else if((0,c.isOverloadedFunction)(e)){const t=e.overloads.find((e=>c.FunctionType.isOverloaded(e)));t&&(i=t.details.declaredReturnType)}}else 38===t.nodeType&&(i=e.getDeclaredTypeForExpression(t));if(i&&(0,c.isClassInstance)(i)){const a=n?"__aexit__":"__exit__",o=null===(s=e.getTypeOfObjectMember(t,i,a))||void 0===s?void 0:s.type;if(o&&(0,c.isFunction)(o)&&o.details.declaredReturnType){const e=o.details.declaredReturnType;r=(0,c.isClassInstance)(e)&&c.ClassType.isBuiltIn(e,"bool")}}return u.set(t.id,r),r}function T(t,n){const r=(0,i.getImportInfo)(t.node.module);(0,s.assert)(void 0!==r&&r.isImportFound),(0,s.assert)(t.node.isWildcardImport);const a=e.lookUpSymbolRecursive(t.node,n,!1);(0,s.assert)(void 0!==a);const o=a.symbol.getDeclarations().find((e=>e.node===t.node));return o&&e.getInferredTypeOfDeclaration(a.symbol,o)||c.UnknownType.create()}function _(t,n){var s;const i=e.getDeclaredTypeOfSymbol(t);if(i)return i;const r=t.getDeclarations().filter((e=>!e.isInExceptSuite));if(0===r.length)return;const a=r[r.length-1];return 2===a.type?null===(s=e.evaluateTypeForSubnode(a.node.name,(()=>{e.evaluateTypeOfParameter(a.node)})))||void 0===s?void 0:s.type:6===a.type||n?e.getInferredTypeOfDeclaration(t,a):void 0}function v(t){if(38===t.nodeType){const n=e.lookUpSymbolRecursive(t,t.value,!1);if(!n)return;return _(n.symbol,n.isBeyondExecutionScope)}if(35===t.nodeType){const n=t.memberName.value;let s=v(t.leftExpression);if(!s)return;s=e.makeTopLevelTypeVarsConcrete(s);const i=(0,p.mapSubtypes)(s,(e=>{var t;let s;if((0,c.isModule)(e))s=c.ModuleType.getField(e,n);else if((0,c.isClass)(e)){const t=(0,p.lookUpClassMember)(e,n);s=t?t.symbol:void 0}return s&&null!==(t=_(s,!1))&&void 0!==t?t:c.UnknownType.create()}));if(!(0,c.isNever)(i))return i}if(9===t.nodeType){const e=v(t.leftExpression);if(!e)return;if(e&&(0,c.isInstantiableClass)(e)){return(0,p.convertToInstance)(e)}if((0,c.isFunction)(e))return e.details.declaredReturnType}}return{createCodeFlowAnalyzer:function(){const n=new Map;return{getTypeFromCodeFlow:function(i,d,u,h,_){const v=void 0!==d?(0,r.createKeyForReference)(d):void 0;let b;const I=void 0!==v&&void 0!==u?v+`.${u.toString()}`:".";let C=n.get(I);function S(e,n,s){if(s){const t=C.get(e.id);if(void 0===t)m++;else if(n&&t.isIncompleteType){const e=t;e.type&&!(0,c.isTypeSame)(e.type,n)&&m++}}else m++;const i=s?{isIncompleteType:!0,type:n,incompleteSubtypes:[],generationCount:m}:n;return C.set(e.id,i),t.trackEntry(C,e.id),{type:n,isIncomplete:s,generationCount:m,incompleteSubtypes:s?[]:void 0}}function F(e,t,n,i,r,a){const l=C.get(e.id);void 0!==l&&(0,o.isIncompleteType)(l)||(0,s.fail)("setIncompleteSubtype can be called only on a valid incomplete cache entry");const p=l.incompleteSubtypes;if(t<p.length){const e=p[t];e.isIncomplete===i&&void 0!==e.type&&void 0!==n&&(0,c.isTypeSame)(e.type,n)?e.isPending!==r&&(p[t]={type:n,isIncomplete:i,isPending:r,evaluationCount:a}):(p[t]={type:n,isIncomplete:i,isPending:r,evaluationCount:a},m++)}else(0,s.assert)(p.length===t),p.push({type:n,isIncomplete:i,isPending:r,evaluationCount:a}),m++;return x(e)}function x(e){if(!C.has(e.id))return;const t=C.get(e.id);if(void 0===t)return{type:t,isIncomplete:!1};if(!(0,o.isIncompleteType)(t))return{type:t,isIncomplete:!1};let n=t.type;if(t.incompleteSubtypes.length>0){const e=[];t.incompleteSubtypes.forEach((t=>{t.type&&e.push(t.type)})),n=e.length>0?(0,c.combineTypes)(e):void 0}return{type:n,isIncomplete:!0,incompleteSubtypes:t.incompleteSubtypes,generationCount:t.generationCount}}function D(e){C.delete(e.id)}function P(t){let n=t.node;const s=t.node.parent;return s&&(28!==s.nodeType&&10!==s.nodeType||(n=s)),e.evaluateTypeForSubnode(n,(()=>{e.evaluateTypesForStatement(t.node)}))}function A(t){let n=t;for(e.checkForCancellation();;){const t=x(n);if(t){if(!t.isIncomplete)return t;if(t.generationCount===m)return{type:t.type,isIncomplete:!0}}if(n.flags&r.FlowFlags.Unreachable)return S(n,void 0,!1);if(n.flags&r.FlowFlags.VariableAnnotation){n=n.antecedent}else if(n.flags&r.FlowFlags.Call){const e=n;if(g(e))return S(n,void 0,!1);n=e.antecedent}else if(n.flags&r.FlowFlags.Assignment){const s=n;if(d){if(u===s.targetSymbolId&&(0,a.isMatchingExpression)(d,s.node)){if(n.flags&r.FlowFlags.Unbind)return S(n,c.UnboundType.create(),!1);if(t&&void 0===t.type)return{type:void 0,isIncomplete:!0};S(n,d?void 0:h,!0);let i=P(s);return i&&((0,p.isTypeAliasPlaceholder)(i.type)||35===d.nodeType&&e.isAsymmetricDescriptorAssignment(s.node))&&(i=void 0),S(n,null==i?void 0:i.type,!!(null==i?void 0:i.isIncomplete))}if((0,a.isPartialMatchingExpression)(d,s.node))return{type:h,isIncomplete:_}}n=s.antecedent}else{if(n.flags&r.FlowFlags.BranchLabel){const e=n;if(n.flags&r.FlowFlags.PostContextManager){const e=n;if(e.expressions.some((t=>f(t,e.isAsync)))===e.blockIfSwallowsExceptions)return S(n,void 0,!1)}if(d&&e.preBranchAntecedent&&e.affectedExpressions&&(b||(b=(0,r.createKeysForReferenceSubexpressions)(d)),!b.some((t=>e.affectedExpressions.has(t)))&&y(n,e.preBranchAntecedent))){n=e.preBranchAntecedent;continue}return E(n)}if(n.flags&r.FlowFlags.LoopLabel){const e=n;if(d&&(b||(b=(0,r.createKeysForReferenceSubexpressions)(d)),!b.some((t=>e.affectedExpressions.has(t))))){n=e.antecedents[0];continue}return k(e)}if(n.flags&(r.FlowFlags.TrueCondition|r.FlowFlags.FalseCondition)){const s=n;if(d){if(t&&void 0===t.type)return t;S(n,void 0,!0);try{const t=(0,l.getTypeNarrowingCallback)(e,d,s.expression,!!(s.flags&(r.FlowFlags.TrueCondition|r.FlowFlags.TrueNeverCondition)));if(t){const e=A(s.antecedent);let i=e.type;return i&&(i=t(i)),S(n,i,e.isIncomplete)}D(n)}catch(e){throw D(n),e}}n=s.antecedent}else if(n.flags&(r.FlowFlags.TrueNeverCondition|r.FlowFlags.FalseNeverCondition)){const t=n;if(t.reference&&(0,r.createKeyForReference)(t.reference)!==v){const s=e.lookUpSymbolRecursive(t.reference,t.reference.value,!1);if(s&&s.symbol.getTypedDeclarations().length>0){S(n,d?void 0:h,!0);try{const s=(0,l.getTypeNarrowingCallback)(e,t.reference,t.expression,!!(t.flags&(r.FlowFlags.TrueCondition|r.FlowFlags.TrueNeverCondition)));if(s){const i=e.getTypeOfExpression(t.reference),r=s(i.type)||i.type;if((0,c.isNever)(r))return S(n,void 0,!!i.isIncomplete)}D(n)}catch(e){throw D(n),e}}}n=t.antecedent}else if(n.flags&r.FlowFlags.ExhaustedMatch){const t=n,s=e.evaluateTypeForSubnode(t.node,(()=>{e.evaluateTypesForMatchStatement(t.node)}));if(s&&(0,c.isNever)(s.type))return S(n,void 0,!!s.isIncomplete);n=t.antecedent}else if(n.flags&r.FlowFlags.NarrowForPattern){const t=n;if(!d||(0,a.isMatchingExpression)(d,t.subjectExpression)){const s=e.evaluateTypeForSubnode(t.statement,(()=>{64===t.statement.nodeType?e.evaluateTypesForCaseStatement(t.statement):e.evaluateTypesForMatchStatement(t.statement)}));if(s){if(d)return S(n,s.type,!!s.isIncomplete);if((0,c.isNever)(s.type))return S(n,void 0,!!s.isIncomplete)}}n=t.antecedent}else{if(n.flags&r.FlowFlags.PreFinallyGate)return w(n);if(n.flags&r.FlowFlags.PostFinally)return N(n);if(n.flags&r.FlowFlags.Start)return S(n,h,_);if(!(n.flags&r.FlowFlags.WildcardImport))return(0,s.fail)("Unexpected flow node flags"),S(n,void 0,!1);{const e=n;if(d&&38===d.nodeType){const t=d.value;if(e.names.some((e=>e===t))){S(n,void 0,!0);try{return S(n,T(e,t),!1)}catch(e){throw D(n),e}}}n=e.antecedent}}}}}function E(e){const t=[];let n=!1,s=!1;if(S(e,d?void 0:h,!0),e.antecedents.forEach((e=>{if(void 0===d&&s)return;const i=A(e);i.isIncomplete&&(n=!0),void 0===d&&void 0!==i.type&&(s=!0),i.type&&t.push(i.type)})),s)return S(e,h,!1);return S(e,d||t.length>0?(0,c.combineTypes)(t):void 0,n)}function k(e){var t,n;let s=x(e);const i=e.antecedents.length;if(void 0===s)s=S(e,d?void 0:h,!0);else if(null===(t=s.incompleteSubtypes)||void 0===t?void 0:t.some((e=>e.isPending))){const t=s.incompleteSubtypes.length<e.antecedents.length||s.incompleteSubtypes.some((e=>e.isPending&&e.evaluationCount<i));return{type:s.type,isIncomplete:t}}let r=0;for(;;){let t=!1,a=void 0===d&&(null===(n=s.incompleteSubtypes)||void 0===n?void 0:n.some((e=>void 0!==e.type)));if(e.antecedents.forEach(((n,i)=>{var r;if(void 0===d&&a)return;s=x(e);const o=void 0!==s.incompleteSubtypes&&i<s.incompleteSubtypes.length?s.incompleteSubtypes[i]:void 0;if(void 0===o||!(null==o?void 0:o.isPending)&&(null==o?void 0:o.isIncomplete)){const a=void 0===o?0:o.evaluationCount;s=F(e,i,null!==(r=null==o?void 0:o.type)&&void 0!==r?r:d?void 0:h,!0,!0,a);try{const r=A(n);r.isIncomplete&&(t=!0),s=F(e,i,r.type,r.isIncomplete,!1,a+1)}catch(t){throw F(e,i,void 0,!0,!1,a+1),t}}void 0===d&&void 0!==(null==s?void 0:s.type)&&(a=!0)})),a)return S(e,h,!1);let o=s.type;if(t&&o){const e=(0,c.removeIncompleteUnknownFromUnion)(o);(0,c.isNever)(e)||(o=e)}if(!t||r>=i)return S(e,o,!1);r++}}function w(e){if(e.isGateClosed)return{type:void 0,isIncomplete:!1};S(e,d?void 0:h,!0);try{const t=A(e.antecedent);return D(e),{type:t.type,isIncomplete:t.isIncomplete}}catch(t){throw D(e),t}}function N(t){const n=t.preFinallyGate.isGateClosed;try{let s;return t.preFinallyGate.isGateClosed=!0,e.useSpeculativeMode(t.finallyNode,(()=>{s=A(t.antecedent)})),s.isIncomplete?s:S(t,s.type,!1)}finally{t.preFinallyGate.isGateClosed=n}}return C||(C=new Map,n.set(I,C)),i?A(i):{type:h,isIncomplete:_}}}},isFlowNodeReachable:y,narrowConstrainedTypeVar:function(t,n){(0,s.assert)(!n.details.isParamSpec),(0,s.assert)(!n.details.isVariadic),(0,s.assert)(!n.details.boundType),(0,s.assert)(n.details.constraints.length>0);const i=new Set,a=[];for(const e of n.details.constraints){if(!(0,c.isClassInstance)(e))return;a.push(e)}const o=function t(n,o){let l=n;for(;;){if(i.has(l.id))return a;if(l.flags&(r.FlowFlags.Unreachable|r.FlowFlags.Start))return a;if(l.flags&(r.FlowFlags.VariableAnnotation|r.FlowFlags.Assignment|r.FlowFlags.WildcardImport|r.FlowFlags.TrueNeverCondition|r.FlowFlags.FalseNeverCondition|r.FlowFlags.NarrowForPattern|r.FlowFlags.ExhaustedMatch|r.FlowFlags.PostFinally|r.FlowFlags.PreFinallyGate|r.FlowFlags.Call)){l=l.antecedent}else{if(!(l.flags&(r.FlowFlags.TrueCondition|r.FlowFlags.FalseCondition))){if(l.flags&(r.FlowFlags.BranchLabel|r.FlowFlags.LoopLabel)){const e=l,n=[];i.add(l.id);for(const s of e.antecedents){const e=t(s,o);for(const t of e)n.some((e=>(0,c.isTypeSame)(e,t)))||n.push(t)}return i.delete(l.id),n}return(0,s.fail)("Unexpected flow node flags"),a}{const n=l,s=n.expression,a=0!=(l.flags&r.FlowFlags.TrueCondition);if(9===s.nodeType&&38===s.leftExpression.nodeType&&"isinstance"===s.leftExpression.value&&2===s.arguments.length){const r=s.arguments[0].valueExpression;if(h(e.getTypeOfExpression(r).type,o)){i.add(l.id);const r=t(n.antecedent,o);i.delete(l.id);const p=s.arguments[1].valueExpression,d=e.getTypeOfExpression(p,168).type;if((0,c.isInstantiableClass)(d))return r.filter((e=>c.ClassType.isSameGenericClass(e,d)?a:!a))}}l=n.antecedent}}}}(t,n);return 1===o.length?o[0]:void 0}}}},66124:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createKeysForReferenceSubexpressions=t.createKeyForReference=t.isCodeFlowSupportedForReference=t.getUniqueFlowNodeId=t.FlowFlags=void 0;const s=n(20823);!function(e){e[e.Unreachable=1]="Unreachable",e[e.Start=2]="Start",e[e.BranchLabel=4]="BranchLabel",e[e.LoopLabel=8]="LoopLabel",e[e.Assignment=16]="Assignment",e[e.Unbind=32]="Unbind",e[e.WildcardImport=64]="WildcardImport",e[e.TrueCondition=128]="TrueCondition",e[e.FalseCondition=512]="FalseCondition",e[e.Call=1024]="Call",e[e.PreFinallyGate=2048]="PreFinallyGate",e[e.PostFinally=4096]="PostFinally",e[e.VariableAnnotation=16384]="VariableAnnotation",e[e.PostContextManager=32768]="PostContextManager",e[e.TrueNeverCondition=65536]="TrueNeverCondition",e[e.FalseNeverCondition=131072]="FalseNeverCondition",e[e.NarrowForPattern=262144]="NarrowForPattern",e[e.ExhaustedMatch=524288]="ExhaustedMatch"}(t.FlowFlags||(t.FlowFlags={}));let i=1;function r(e){let t;if(38===e.nodeType)t=e.value;else if(35===e.nodeType){t=`${r(e.leftExpression)}.${e.memberName.value}`}else if(24===e.nodeType){const n=r(e.baseExpression);(0,s.assert)(1===e.items.length);const i=e.items[0].valueExpression;if(40===i.nodeType)t=`${n}[${i.value.toString()}]`;else if(48===i.nodeType){const e=i;(0,s.assert)(1===e.strings.length&&49===e.strings[0].nodeType),t=`${n}["${e.strings[0].value}"]`}else 55===i.nodeType&&33===i.operator&&40===i.expression.nodeType?t=`${n}[-${i.expression.value.toString()}]`:(0,s.fail)("createKeyForReference received unexpected index type")}else(0,s.fail)("createKeyForReference received unexpected expression type");return t}t.getUniqueFlowNodeId=function(){return i++},t.isCodeFlowSupportedForReference=function e(t){if(38===t.nodeType)return!0;if(35===t.nodeType)return e(t.leftExpression);if(24===t.nodeType){if(1!==t.items.length||t.trailingComma||void 0!==t.items[0].name||0!==t.items[0].argumentCategory)return!1;const n=t.items[0].valueExpression,s=40===n.nodeType&&!n.isImaginary&&n.isInteger,i=55===n.nodeType&&33===n.operator&&40===n.expression.nodeType&&!n.expression.isImaginary&&n.expression.isInteger,r=48===n.nodeType&&1===n.strings.length&&49===n.strings[0].nodeType;return!!(s||i||r)&&e(t.baseExpression)}return!1},t.createKeyForReference=r,t.createKeysForReferenceSubexpressions=function e(t){return 38===t.nodeType?[r(t)]:35===t.nodeType?[...e(t.leftExpression),r(t)]:24===t.nodeType?[...e(t.baseExpression),r(t)]:void(0,s.fail)("createKeyForReference received unexpected expression type")}},43485:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.formatControlFlowGraph=void 0;const s=n(28348),i=n(35696),r=n(66124);t.formatControlFlowGraph=function(e){const t=Object.create(null),n=[],a=[],o=u(e,new Set);for(const e of n)e.text=g(e.flowNode,e.circular),y(e);const l=function e(t){let n=0;for(const s of p(t))n=Math.max(n,e(s));return n+1}(o),c=function(e){const t=T(Array(e),0);for(const e of n)t[e.level]=Math.max(t[e.level],e.text.length);return t}(l);return function e(t,n){if(-1===t.lane){t.lane=n,t.endLane=n;const s=p(t);for(let i=0;i<s.length;i++){i>0&&n++;const r=s[i];e(r,n),r.endLane>t.endLane&&(n=r.endLane)}t.endLane=n}}(o,0),function(){const e=c.length,t=n.reduce(((e,t)=>Math.max(e,t.lane)),0)+1,s=T(Array(t),""),i=c.map((()=>Array(t))),r=c.map((()=>T(Array(t),0)));for(const e of n){i[e.level][e.lane]=e;const t=p(e);for(let n=0;n<t.length;n++){const s=t[n];let i=8;s.lane===e.lane&&(i|=4),n>0&&(i|=1),n<t.length-1&&(i|=2),r[e.level][s.lane]|=i}0===t.length&&(r[e.level][e.lane]|=16);const n=d(e);for(let t=0;t<n.length;t++){const s=n[t];let i=4;t>0&&(i|=1),t<n.length-1&&(i|=2),r[e.level-1][s.lane]|=i}}for(let n=0;n<e;n++)for(let e=0;e<t;e++){const t=n>0?r[n-1][e]:0,s=e>0?r[n][e-1]:0;let i=r[n][e];i||(8&t&&(i|=12),2&s&&(i|=3),r[n][e]=i)}for(let t=0;t<e;t++)for(let n=0;n<s.length;n++){const s=r[t][n],o=4&s?"─":" ",l=i[t][n];l?(a(n,l.text),t<e-1&&(a(n," "),a(n,_(o,c[t]-l.text.length)))):t<e-1&&a(n,_(o,c[t]+1)),a(n,f(s)),a(n,8&s&&t<e-1&&!i[t+1][n]?"─":" ")}return`${s.join("\n")}\n`;function a(e,t){s[e]+=t}}();function p(e){const t=[];for(const n of e.edges)n.source===e&&t.push(n.target);return t}function d(e){const t=[];for(const n of e.edges)n.target===e&&t.push(n.source);return t}function u(e,s){const i=e.id;let a=t[i];if(a&&s.has(e))return a={id:-1,flowNode:e,edges:[],text:"",lane:-1,endLane:-1,level:-1,circular:!0},n.push(a),a;if(s.add(e),!a){t[i]=a={id:i,flowNode:e,edges:[],text:"",lane:-1,endLane:-1,level:-1,circular:!1},n.push(a);const o=function(e){if(e.flags&(r.FlowFlags.LoopLabel|r.FlowFlags.BranchLabel))return e.antecedents;if(e.flags&(r.FlowFlags.Assignment|r.FlowFlags.VariableAnnotation|r.FlowFlags.WildcardImport|r.FlowFlags.TrueCondition|r.FlowFlags.FalseCondition|r.FlowFlags.NarrowForPattern|r.FlowFlags.ExhaustedMatch|r.FlowFlags.Call|r.FlowFlags.PreFinallyGate|r.FlowFlags.PostFinally))return[e.antecedent];return[]}(e);for(const e of o)m(a,e,s)}return s.delete(e),a}function m(e,t,n){const s=u(t,n),i={source:e,target:s};a.push(i),e.edges.push(i),s.edges.push(i)}function y(e){if(-1!==e.level)return e.level;let t=0;for(const n of d(e))t=Math.max(t,y(n)+1);return e.level=t}function h(e){const t=function(e){return e.flags&r.FlowFlags.Assignment||e.flags&r.FlowFlags.WildcardImport?e.node:e.flags&(r.FlowFlags.TrueCondition|r.FlowFlags.FalseCondition)?e.expression:e.flags&r.FlowFlags.NarrowForPattern?e.statement:e.flags&r.FlowFlags.Call?e.node:void 0}(e);if(!t)return;const n=(0,i.getFileInfo)(t),a=(0,s.convertOffsetToPosition)(t.start,n.lines);return`[${a.line+1}:${a.character+1}]`}function g(e,t){const n=`${function(e){if(e&r.FlowFlags.Start)return"Start";if(e&r.FlowFlags.BranchLabel)return"Branch";if(e&r.FlowFlags.LoopLabel)return"Loop";if(e&r.FlowFlags.Unbind)return"Unbind";if(e&r.FlowFlags.Assignment)return"Assign";if(e&r.FlowFlags.TrueCondition)return"True";if(e&r.FlowFlags.FalseCondition)return"False";if(e&r.FlowFlags.Call)return"Call";if(e&r.FlowFlags.Unreachable)return"Unreachable";if(e&r.FlowFlags.WildcardImport)return"Wildcard";if(e&r.FlowFlags.PreFinallyGate)return"PreFinal";if(e&r.FlowFlags.PostFinally)return"PostFinal";if(e&r.FlowFlags.VariableAnnotation)return"Annotate";if(e&r.FlowFlags.TrueNeverCondition)return"TrueNever";if(e&r.FlowFlags.FalseNeverCondition)return"FalseNever";if(e&r.FlowFlags.NarrowForPattern)return"Pattern";if(e&r.FlowFlags.ExhaustedMatch)return"Exhaust";throw new Error}(e.flags)}@${e.id}${h(e)||""}`;return t?`Circular(${n})`:n}function f(e){switch(e){case 3:return"│";case 12:return"─";case 5:return"╯";case 9:return"╰";case 6:return"╮";case 10:return"╭";case 7:return"┤";case 11:return"├";case 13:return"┴";case 14:return"┬";case 15:return"╫"}return" "}function T(e,t){if(e.fill)e.fill(t);else for(let n=0;n<e.length;n++)e[n]=t;return e}function _(e,t){if(e.repeat)return t>0?e.repeat(t):"";let n="";for(;n.length<t;)n+=e;return n}}},81044:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getFileLevelDirectives=void 0;const s=n(14943);function i(e){r(e,(0,s.getStrictDiagnosticRuleSet)(),(0,s.getStrictModeNotOverriddenRules)())}function r(e,t,n){const i=(0,s.getBooleanDiagnosticRules)(),r=(0,s.getDiagLevelDiagnosticRules)();for(const s of i)n.find((e=>e===s))||t[s]&&(e[s]=!0);for(const s of r){if(n.find((e=>e===s)))continue;const i=t[s],r=e[s];("error"===i||"warning"===i&&"error"!==r||"information"===i&&"error"!==r&&"warning"!==r)&&(e[s]=i)}}function a(e,t){const n=["pyright:","mspython:"].find((t=>e.startsWith(t)));if(n){const a=e.substr(n.length).trim().split(",").map((e=>e.trim()));a.some((e=>"strict"===e))?i(t):a.some((e=>"basic"===e))&&function(e){r(e,(0,s.getBasicDiagnosticRuleSet)(),[])}(t);for(const e of a)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 i=n[0],r=(0,s.getBooleanDiagnosticRules)();if((0,s.getDiagLevelDiagnosticRules)().find((e=>e===i))){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[i]=e)}else if(r.find((e=>e===i))){const e=function(e){if("false"===e)return!1;if("true"===e)return!0;return}(n[1]);void 0!==e&&(t[i]=e)}return t}t.getFileLevelDirectives=function(e,t,n){let r=(0,s.cloneDiagnosticRuleSet)(t);n&&i(r);for(let t=0;t<e.count;t++){const n=e.getItemAt(t);if(n.comments)for(const e of n.comments){r=a(e.value.trim(),r)}}return r}},54311:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.applyConstructorTransform=void 0;const s=n(24319),i=n(15741),r=n(74426),a=n(35696),o=n(97882),l=n(59195),c=n(10425),p=n(58922);t.applyConstructorTransform=function(e,t,n,d,u){return"functools.partial"===d.details.fullName?function(e,t,n,d){if(!(0,l.isClassInstance)(d.returnType)||"functools.partial"!==d.returnType.details.fullName)return d;const u=(0,c.lookUpObjectMember)(d.returnType,"__call__");if(!u||!(0,l.isTypeSame)((0,c.convertToInstance)(u.classType),d.returnType))return d;const m=e.getTypeOfMember(u);if(!(0,l.isFunction)(m)||m.details.parameters.length<1)return d;if(n.length<1)return d;const y=e.getTypeOfArgument(n[0]).type;if(e.inferReturnTypeIfNecessary(y),!(0,l.isFunction)(y))return d;if(n.some((e=>0!==e.argumentCategory)))return d;const h=new Map,g=(0,c.getParameterListDetails)(y);let f=!1,T=!1;const _=new p.TypeVarContext((0,c.getTypeVarScopeId)(y));n.slice(1).forEach(((n,o)=>{var p,d,u,m,v,b,I,C;const S=e.getTypeOfArgument(n);if(n.name){const o=g.params.find((e=>{var t;return e.param.name===(null===(t=n.name)||void 0===t?void 0:t.value)&&e.source!==c.ParameterSource.PositionOnly}));if(o){const c=o.param.name,p=l.FunctionType.getEffectiveParameterType(y,o.index);if(h.has(c))e.addDiagnostic((0,a.getFileInfo)(t).diagnosticRuleSet.reportGeneralTypeIssues,i.DiagnosticRule.reportGeneralTypeIssues,r.Localizer.Diagnostic.paramAlreadyAssigned().format({name:n.name.value}),n.name),f=!0;else{const o=new s.DiagnosticAddendum;e.canAssignType(p,S.type,o,_)||(e.addDiagnostic((0,a.getFileInfo)(t).diagnosticRuleSet.reportGeneralTypeIssues,i.DiagnosticRule.reportGeneralTypeIssues,r.Localizer.Diagnostic.argAssignmentParamFunction().format({argType:e.printType(S.type),paramType:e.printType(p),functionName:y.details.name,paramName:c}),null!==(C=n.valueExpression)&&void 0!==C?C:t),f=!0),h.set(c,!0)}}else if(void 0===g.kwargsIndex)e.addDiagnostic((0,a.getFileInfo)(t).diagnosticRuleSet.reportGeneralTypeIssues,i.DiagnosticRule.reportGeneralTypeIssues,r.Localizer.Diagnostic.paramNameMissing().format({name:n.name.value}),n.name),f=!0;else{const o=l.FunctionType.getEffectiveParameterType(y,g.params[g.kwargsIndex].index),c=new s.DiagnosticAddendum;e.canAssignType(o,S.type,c,_)||(e.addDiagnostic((0,a.getFileInfo)(t).diagnosticRuleSet.reportGeneralTypeIssues,i.DiagnosticRule.reportGeneralTypeIssues,r.Localizer.Diagnostic.argAssignmentParamFunction().format({argType:e.printType(S.type),paramType:e.printType(o),functionName:y.details.name,paramName:null!==(b=g.params[g.kwargsIndex].param.name)&&void 0!==b?b:""}),null!==(I=n.valueExpression)&&void 0!==I?I:t),f=!0)}}else if(o>=g.params.length||g.params[o].source===c.ParameterSource.KeywordOnly)if(void 0!==g.argsIndex){const o=l.FunctionType.getEffectiveParameterType(y,g.params[g.argsIndex].index),c=new s.DiagnosticAddendum;e.canAssignType(o,S.type,c,_)||(e.addDiagnostic((0,a.getFileInfo)(t).diagnosticRuleSet.reportGeneralTypeIssues,i.DiagnosticRule.reportGeneralTypeIssues,r.Localizer.Diagnostic.argAssignmentParamFunction().format({argType:e.printType(S.type),paramType:e.printType(o),functionName:y.details.name,paramName:null!==(p=g.params[g.argsIndex].param.name)&&void 0!==p?p:""}),null!==(d=n.valueExpression)&&void 0!==d?d:t),f=!0)}else T||e.addDiagnostic((0,a.getFileInfo)(t).diagnosticRuleSet.reportGeneralTypeIssues,i.DiagnosticRule.reportGeneralTypeIssues,1===g.positionParamCount?r.Localizer.Diagnostic.argPositionalExpectedOne():r.Localizer.Diagnostic.argPositionalExpectedCount().format({expected:g.positionParamCount}),null!==(u=n.valueExpression)&&void 0!==u?u:t),T=!0,f=!0;else{const c=l.FunctionType.getEffectiveParameterType(y,o),p=new s.DiagnosticAddendum,d=null!==(m=g.params[o].param.name)&&void 0!==m?m:"";e.canAssignType(c,S.type,p,_)||(e.addDiagnostic((0,a.getFileInfo)(t).diagnosticRuleSet.reportGeneralTypeIssues,i.DiagnosticRule.reportGeneralTypeIssues,r.Localizer.Diagnostic.argAssignmentParamFunction().format({argType:e.printType(S.type),paramType:e.printType(c),functionName:y.details.name,paramName:d}),null!==(v=n.valueExpression)&&void 0!==v?v:t),f=!0),h.set(d,!1)}}));const v=(0,c.applySolvedTypeVars)(y,_);if(!(0,l.isFunction)(v))return d;const b=v.details.parameters.map(((e,t)=>{const n={...e};return n.type=l.FunctionType.getEffectiveParameterType(v,t),e.name&&h.get(e.name)&&(n.hasDefault=!0),n})),I=b.filter((e=>2!==e.category&&(1===e.category||(!e.name||!h.has(e.name))))),C=b.filter((e=>e.name&&h.get(e.name))),S=b.filter((e=>2===e.category)),F=[...I,...C,...S],x=l.FunctionType.createInstance(m.details.name,m.details.fullName,m.details.moduleName,m.details.flags,v.details.docString);m.details.parameters.length>0&&l.FunctionType.addParameter(x,m.details.parameters[0]);F.forEach((e=>{l.FunctionType.addParameter(x,e)})),x.details.declaredReturnType=v.details.declaredReturnType?l.FunctionType.getSpecializedReturnType(v):v.inferredReturnType,x.details.declaration=m.details.declaration,x.details.typeVarScopeId=v.details.typeVarScopeId;const D=l.ClassType.cloneForSymbolTableUpdate(d.returnType);return D.details.fields.set("__call__",o.Symbol.createWithType(4,x)),{returnType:D,isTypeIncomplete:!1,argumentErrors:f}}(e,t,n,u):u}},32408:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.applyDataClassDecorator=t.applyDataClassDefaultBehaviors=t.applyDataClassClassBehaviorOverrides=t.getDataclassDecoratorBehaviors=t.validateDataClassTransformDecorator=t.synthesizeDataClassMethods=void 0;const a=n(20823),o=n(15741),l=n(74426),c=r(n(35696)),p=n(71595),d=n(67737),u=n(97882),m=n(59195),y=n(10425),h=n(58922);function g(e,t,n){n.forEach((n=>{n.valueExpression&&n.name&&function(e,t,n,s,i){const r=c.getFileInfo(t),a=(0,d.evaluateStaticBoolExpression)(i,r.executionEnvironment);switch(s){case"order":!0===a?n.details.flags|=64:!1===a&&(n.details.flags&=-65);break;case"kw_only":!1===a?n.details.flags&=-2097153:!0===a&&(n.details.flags|=2097152);break;case"frozen":{let s=!1,i=!1;n.details.baseClasses.forEach((e=>{(0,m.isInstantiableClass)(e)&&m.ClassType.isDataClass(e)&&(m.ClassType.isFrozenDataClass(e)?i=!0:e.details.classDataClassTransform||e.details.declaredMetaclass&&(0,m.isInstantiableClass)(e.details.declaredMetaclass)&&e.details.declaredMetaclass.details.classDataClassTransform||(s=!0))})),(!0===a||i)&&(n.details.flags|=8,s&&e.addDiagnostic(r.diagnosticRuleSet.reportGeneralTypeIssues,o.DiagnosticRule.reportGeneralTypeIssues,l.Localizer.Diagnostic.dataClassBaseClassNotFrozen(),t));break}case"init":!1===a?n.details.flags|=16:!0===a&&(n.details.flags&=-17);break;case"eq":!1===a?n.details.flags|=32:!0===a&&(n.details.flags&=-33);break;case"slots":!0===a?(n.details.flags|=33554432,n.details.localSlotsNames&&e.addDiagnostic(r.diagnosticRuleSet.reportGeneralTypeIssues,o.DiagnosticRule.reportGeneralTypeIssues,l.Localizer.Diagnostic.dataClassSlotsOverwrite(),t)):!1===a&&(n.details.flags&=-33554433);break;case"hash":case"unsafe_hash":!0===a&&(n.details.flags|=67108864)}}(e,n.name,t,n.name.value,n.valueExpression)}))}function f(e,t){e.details.dataClassBehaviors=t,e.details.flags|=4,t.keywordOnlyParams&&(e.details.flags|=2097152),t.generateEq||(e.details.flags|=32),t.generateOrder&&(e.details.flags|=64)}t.synthesizeDataClassMethods=function(e,t,n,s,i,r){(0,a.assert)(m.ClassType.isDataClass(n));const o=(0,y.synthesizeTypeVarForSelfCls)(n,!0),g=m.FunctionType.createSynthesizedInstance("__new__",1),f=m.FunctionType.createSynthesizedInstance("__init__");m.FunctionType.addParameter(g,{category:0,name:"cls",type:o,hasDeclaredType:!0}),m.FunctionType.addDefaultParameters(g),g.details.declaredReturnType=(0,y.convertToInstance)(o);const T={category:0,name:"self",type:(0,y.synthesizeTypeVarForSelfCls)(n,!1),hasDeclaredType:!0};m.FunctionType.addParameter(f,T),f.details.declaredReturnType=m.NoneType.createInstance();const _=[],v=[],b=function(e,t){let n=!0;for(let s=e.details.mro.length-1;s>=0;s--){const i=e.details.mro[s];if((0,m.isInstantiableClass)(i)){const e=(0,y.buildTypeVarContextFromSpecializedClass)(i,!1);m.ClassType.getDataClassEntries(i).forEach((n=>{const s=t.findIndex((e=>e.name===n.name)),i={...n};i.type=(0,y.applySolvedTypeVars)(i.type,e),n.isClassVar?s>=0&&t.splice(s,1):s>=0?t[s]=i:t.push(i)}))}else n=!1}return n}(n,v);b||m.FunctionType.addDefaultParameters(f);const I=[];let C=!1;t.suite.statements.forEach((i=>{47===i.nodeType&&i.statements.forEach((i=>{var r;let a,o,p,u,h=!1,g=m.ClassType.isDataClassKeywordOnlyParams(n)||C,f=!0;if(3===i.nodeType){if(54===i.leftExpression.nodeType&&38===i.leftExpression.valueExpression.nodeType&&(a=i.leftExpression.valueExpression,p=()=>e.getTypeOfAnnotation(i.leftExpression.typeAnnotation,{isVariableAnnotation:!0,allowFinal:!0,allowClassVar:!0})),h=!0,u=i.rightExpression,9===i.rightExpression.nodeType){const s=e.getTypeOfExpression(i.rightExpression.leftExpression,2).type;if(function(e,t){let n;(0,m.isFunction)(e)?n=e.details.fullName:(0,m.isOverloadedFunction)(e)?n=e.overloads[0].details.fullName:(0,m.isInstantiableClass)(e)&&(n=e.details.fullName);if(!n)return!1;return t.some((e=>e===n))}(s,(null===(r=n.details.dataClassBehaviors)||void 0===r?void 0:r.fieldDescriptorNames)||[])){const n=i.rightExpression.arguments.find((e=>{var t;return"init"===(null===(t=e.name)||void 0===t?void 0:t.value)}));if(n&&n.valueExpression){!1===(0,d.evaluateStaticBoolExpression)(n.valueExpression,c.getFileInfo(t).executionEnvironment)&&(f=!1)}else{let t;if((0,m.isFunction)(s))t=s;else if((0,m.isOverloadedFunction)(s))t=e.getBestOverloadForArguments(i.rightExpression,s,i.rightExpression.arguments);else if((0,m.isInstantiableClass)(s)){const n=e.getBoundMethod(s,"__init__");n&&((0,m.isFunction)(n)?t=n:(0,m.isOverloadedFunction)(n)&&(t=e.getBestOverloadForArguments(i.rightExpression,n,i.rightExpression.arguments)))}if(t){const e=t.details.parameters.find((e=>"init"===e.name));e&&e.defaultValueExpression&&e.hasDeclaredType&&(0,m.isClass)(e.type)&&m.ClassType.isBuiltIn(e.type,"bool")&&(0,y.isLiteralType)(e.type)&&!1===e.type.literalValue&&(f=!1)}}const r=i.rightExpression.arguments.find((e=>{var t;return"kw_only"===(null===(t=e.name)||void 0===t?void 0:t.value)}));if(r&&r.valueExpression){const e=(0,d.evaluateStaticBoolExpression)(r.valueExpression,c.getFileInfo(t).executionEnvironment);!1===e?g=!1:!0===e&&(g=!0)}const a=i.rightExpression.arguments.find((e=>{var t,n,s;return"default"===(null===(t=e.name)||void 0===t?void 0:t.value)||"default_factory"===(null===(n=e.name)||void 0===n?void 0:n.value)||"factory"===(null===(s=e.name)||void 0===s?void 0:s.value)}));h=!!a,(null==a?void 0:a.valueExpression)&&(u=a.valueExpression);const l=i.rightExpression.arguments.find((e=>{var t;return"alias"===(null===(t=e.name)||void 0===t?void 0:t.value)}));if(l){const t=e.getTypeOfExpression(l.valueExpression).type;(0,m.isClassInstance)(t)&&m.ClassType.isBuiltIn(t,"str")&&(0,y.isLiteralType)(t)&&(o=t.literalValue)}}}}else if(54===i.nodeType&&38===i.valueExpression.nodeType&&(a=i.valueExpression,p=()=>e.getTypeOfAnnotation(i.typeAnnotation,{isVariableAnnotation:!0,allowFinal:!0,allowClassVar:!0}),"_"===i.valueExpression.value)){const e=p();(0,m.isClassInstance)(e)&&m.ClassType.isBuiltIn(e,"KW_ONLY")&&(C=!0,a=void 0,p=void 0)}if(a&&p){const t=a.value,i=n.details.fields.get(t),r=null==i?void 0:i.getDeclarations().some((e=>1===e.type&&e.isFinal));if((null==i?void 0:i.isClassVar())&&!r){const e=v.findIndex((e=>e.name===t));e>=0&&v.splice(e,1);const s={name:t,classType:n,alias:o,isKeywordOnly:!1,hasDefault:h,defaultValueExpression:u,includeInInit:f,type:m.UnknownType.create(),isClassVar:!0};_.push(s)}else{const i={name:t,classType:n,alias:o,isKeywordOnly:g,hasDefault:h,defaultValueExpression:u,includeInInit:f,type:m.UnknownType.create(),isClassVar:!1};I.push({entry:i,evaluator:p});let r=_.findIndex((e=>e.name===t));if(r>=0?_[r]=i:_.push(i),r=v.findIndex((e=>e.name===t)),r>=0){const e=v[r];!i.hasDefault&&e.hasDefault&&(i.hasDefault=!0,i.defaultValueExpression=e.defaultValueExpression,h=!0),v[r]=i}else v.push(i),r=v.length-1;if(!g&&f&&!s&&!h){const t=v.findIndex((e=>e.hasDefault&&e.includeInInit&&!e.isKeywordOnly));t>=0&&t<r&&e.addError(l.Localizer.Diagnostic.dataClassFieldWithDefault(),a)}}}}))})),n.details.dataClassEntries=_,I.forEach((e=>{e.entry.type=e.evaluator()}));const S=n.details.fields,F=[];s||i||!b||(v.forEach((t=>{if(t.includeInInit){let s=t.type;if(t.classType!==n&&(0,y.requiresSpecialization)(s)){const e=new h.TypeVarContext((0,y.getTypeVarScopeId)(t.classType));(0,y.populateTypeVarContextForSelfType)(e,t.classType,n),s=(0,y.applySolvedTypeVars)(s,e)}s=function(e,t){if(!(0,m.isClassInstance)(t))return t;const n=(0,y.lookUpObjectMember)(t,"__set__");if(!n)return t;const s=e.getTypeOfMember(n);if(!(0,m.isFunction)(s))return t;const i=e.bindFunctionToClassOrObject(t,s);if(!i||!(0,m.isFunction)(i)||i.details.parameters.length<2)return t;return m.FunctionType.getEffectiveParameterType(i,1)}(e,s);const i={category:0,name:t.alias||t.name,hasDefault:t.hasDefault,defaultValueExpression:t.defaultValueExpression,type:s,hasDeclaredType:!0};t.isKeywordOnly?F.push(i):m.FunctionType.addParameter(f,i)}})),F.length>0&&(m.FunctionType.addParameter(f,{category:1,type:m.AnyType.create()}),F.forEach((e=>{m.FunctionType.addParameter(f,e)}))),S.set("__init__",u.Symbol.createWithType(4,f)),S.set("__new__",u.Symbol.createWithType(4,g)));const x=e.getBuiltInType(t,"str"),D=e.getBuiltInType(t,"tuple");if(D&&(0,m.isInstantiableClass)(D)&&x&&(0,m.isInstantiableClass)(x)&&!S.has("__match_args__")){const e=[];v.forEach((t=>{t.includeInInit&&!t.isKeywordOnly&&e.push(t.name)}));const t=e.map((e=>({type:m.ClassType.cloneAsInstance(m.ClassType.cloneWithLiteral(x,e)),isUnbounded:!1}))),n=m.ClassType.cloneAsInstance((0,y.specializeTupleClass)(D,t));S.set("__match_args__",u.Symbol.createWithType(4,n))}const P=(n,s)=>{const i=m.FunctionType.createSynthesizedInstance(n);m.FunctionType.addParameter(i,T),m.FunctionType.addParameter(i,{category:0,name:"other",type:s,hasDeclaredType:!0}),i.details.declaredReturnType=e.getBuiltInObject(t,"bool"),S.set(n,u.Symbol.createWithType(4,i))};if(m.ClassType.isSkipSynthesizedDataClassEq(n)||P("__eq__",e.getBuiltInObject(t,"object")),m.ClassType.isSynthesizedDataclassOrder(n)){const e=m.ClassType.cloneAsInstance(n);["__lt__","__le__","__gt__","__ge__"].forEach((t=>{P(t,e)}))}let A=!m.ClassType.isSkipSynthesizedDataClassEq(n)&&m.ClassType.isFrozenDataClass(n);const E=!m.ClassType.isSkipSynthesizedDataClassEq(n)&&!m.ClassType.isFrozenDataClass(n);if(r&&(A=!1),m.ClassType.isSynthesizeDataClassUnsafeHash(n)&&(A=!0),A){const n=m.FunctionType.createSynthesizedInstance("__hash__");m.FunctionType.addParameter(n,T),n.details.declaredReturnType=e.getBuiltInObject(t,"int"),S.set("__hash__",u.Symbol.createWithType(4,n))}else E&&!r&&S.set("__hash__",u.Symbol.createWithType(4,m.NoneType.createInstance()));let k=e.getBuiltInType(t,"dict");(0,m.isInstantiableClass)(k)&&(k=m.ClassType.cloneAsInstance(m.ClassType.cloneForSpecialization(k,[e.getBuiltInObject(t,"str"),m.AnyType.create()],!0))),S.set("__dataclass_fields__",u.Symbol.createWithType(4,k)),m.ClassType.isGeneratedDataClassSlots(n)&&void 0===n.details.localSlotsNames&&(n.details.localSlotsNames=_.map((e=>e.name))),(0,p.updateNamedTupleBaseClass)(n,v.map((e=>e.type)),!0)},t.validateDataClassTransformDecorator=function(e,t){const n={keywordOnlyParams:!1,generateEq:!0,generateOrder:!1,fieldDescriptorNames:[]},s=c.getFileInfo(t);return t.arguments.forEach((t=>{if(t.name&&0===t.argumentCategory)switch(t.name.value){case"kw_only_default":{const i=(0,d.evaluateStaticBoolExpression)(t.valueExpression,s.executionEnvironment);if(void 0===i)return void e.addError(l.Localizer.Diagnostic.dataClassTransformExpectedBoolLiteral(),t.valueExpression);n.keywordOnlyParams=i;break}case"eq_default":{const i=(0,d.evaluateStaticBoolExpression)(t.valueExpression,s.executionEnvironment);if(void 0===i)return void e.addError(l.Localizer.Diagnostic.dataClassTransformExpectedBoolLiteral(),t.valueExpression);n.generateEq=i;break}case"order_default":{const i=(0,d.evaluateStaticBoolExpression)(t.valueExpression,s.executionEnvironment);if(void 0===i)return void e.addError(l.Localizer.Diagnostic.dataClassTransformExpectedBoolLiteral(),t.valueExpression);n.generateOrder=i;break}case"field_descriptors":{const s=e.getTypeOfExpression(t.valueExpression).type;if(!(0,m.isClassInstance)(s)||!m.ClassType.isBuiltIn(s,"tuple")||!s.tupleTypeArguments||s.tupleTypeArguments.some((e=>!(0,m.isInstantiableClass)(e.type)&&!(0,m.isFunction)(e.type)&&!(0,m.isOverloadedFunction)(e.type))))return void e.addError(l.Localizer.Diagnostic.dataClassTransformFieldDescriptor().format({type:e.printType(s)}),t.valueExpression);n.fieldDescriptorNames||(n.fieldDescriptorNames=[]),s.tupleTypeArguments.forEach((e=>{(0,m.isInstantiableClass)(e.type)||(0,m.isFunction)(e.type)?n.fieldDescriptorNames.push(e.type.details.fullName):(0,m.isOverloadedFunction)(e.type)&&n.fieldDescriptorNames.push(e.type.overloads[0].details.fullName)}));break}default:e.addError(l.Localizer.Diagnostic.dataClassTransformUnknownArgument().format({name:t.name.value}),t.valueExpression)}else e.addError(l.Localizer.Diagnostic.dataClassTransformPositionalParam(),t)})),n},t.getDataclassDecoratorBehaviors=function(e){var t;let n;if((0,m.isFunction)(e)?n=e:(0,m.isOverloadedFunction)(e)&&(n=null!==(t=e.overloads.find((e=>{e.details.decoratorDataClassBehaviors})))&&void 0!==t?t:e.overloads[0]),n)return n.details.decoratorDataClassBehaviors?n.details.decoratorDataClassBehaviors:"dataclasses.dataclass"===n.details.fullName?{keywordOnlyParams:!1,generateEq:!0,generateOrder:!1,fieldDescriptorNames:["dataclasses.field","dataclasses.Field"]}:void 0},t.applyDataClassClassBehaviorOverrides=g,t.applyDataClassDefaultBehaviors=f,t.applyDataClassDecorator=function(e,t,n,s){f(t,n),(null==s?void 0:s.arguments)&&g(e,t,s.arguments)}},16800:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isIntrinsicDeclaration=t.isSpecialBuiltInClassDeclaration=t.isAliasDeclaration=t.isVariableDeclaration=t.isParameterDeclaration=t.isClassDeclaration=t.isFunctionDeclaration=void 0,t.isFunctionDeclaration=function(e){return 3===e.type},t.isClassDeclaration=function(e){return 4===e.type},t.isParameterDeclaration=function(e){return 2===e.type},t.isVariableDeclaration=function(e){return 1===e.type},t.isAliasDeclaration=function(e){return 6===e.type},t.isSpecialBuiltInClassDeclaration=function(e){return 5===e.type},t.isIntrinsicDeclaration=function(e){return 0===e.type}},88023:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createSynthesizedAliasDeclaration=t.getDeclarationsWithUsesLocalNameRemoved=t.isDefinedInFile=t.getNameFromDeclaration=t.isPossibleTypeAliasDeclaration=t.isExplicitTypeAliasDeclaration=t.isFinalVariableDeclaration=t.areDeclarationsSame=t.hasTypeForDeclaration=void 0;const s=n(80957),i=n(16800),r=n(23241);t.hasTypeForDeclaration=function(e){switch(e.type){case 0:case 4:case 5:case 3:return!0;case 2:{if(e.node.typeAnnotation||e.node.typeAnnotationComment)return!0;const t=e.node.parent;if(28===(null==t?void 0:t.nodeType)&&t.functionAnnotationComment&&!t.functionAnnotationComment.isParamListEllipsis){const n=t.functionAnnotationComment.paramTypeAnnotations;return!(t.parameters.length>n.length&&e.node===t.parameters[0])}return!1}case 1:return!!e.typeAnnotationNode;case 6:return!1}},t.areDeclarationsSame=function(e,t,n=!1){if(e.type!==t.type)return!1;if(e.path!==t.path)return!1;if(e.range.start.line!==t.range.start.line||e.range.start.character!==t.range.start.character)return!1;if(6===e.type&&6===t.type){if(e.symbolName!==t.symbolName||e.usesLocalName!==t.usesLocalName)return!1;if(n)return!0;if(e.firstNamePart!==t.firstNamePart)return!1}return!0},t.isFinalVariableDeclaration=function(e){return 1===e.type&&!!e.isFinal},t.isExplicitTypeAliasDeclaration=function(e){return 1===e.type&&!!e.typeAliasAnnotation},t.isPossibleTypeAliasDeclaration=function(e){var t;if(1!==e.type||!e.typeAliasName||e.typeAnnotationNode)return!1;if(3!==(null===(t=e.node.parent)||void 0===t?void 0:t.nodeType))return!1;switch(e.node.parent.rightExpression.nodeType){case 0:case 55:case 4:case 54:case 6:case 51:case 56:case 52:case 9:case 32:case 46:case 60:case 61:case 30:case 40:case 15:case 31:case 45:return!1}return!0},t.getNameFromDeclaration=function(e){var t;switch(e.type){case 6:return e.symbolName;case 4:case 3:return e.node.name.value;case 2:return null===(t=e.node.name)||void 0===t?void 0:t.value;case 1:return 38===e.node.nodeType?e.node.value:void 0;case 0:case 5:return}throw new Error("Shouldn't reach here")},t.isDefinedInFile=function(e,t){var n;return(0,i.isAliasDeclaration)(e)?(null===(n=(0,r.getFileInfoFromNode)(e.node))||void 0===n?void 0:n.filePath)===t:e.path===t},t.getDeclarationsWithUsesLocalNameRemoved=function(e){return e.map((e=>{if(6!==e.type)return e;const t={...e};return t.usesLocalName=!1,t}))},t.createSynthesizedAliasDeclaration=function(e){return{type:6,node:void 0,path:e,loadSymbolsFromPath:!1,range:(0,s.getEmptyRange)(),implicitImports:new Map,usesLocalName:!1,moduleName:"",isInExceptSuite:!1}}},21736:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertDocStringToPlainText=t.convertDocStringToMarkdown=void 0;const s=n(20822);t.convertDocStringToMarkdown=function(e){return new E(e).convert()},t.convertDocStringToPlainText=function(e){const t=(0,s.cleanAndSplitDocString)(e),n=[];for(const e of t){const t=n.length>0?n[n.length-1]:void 0;w(e)&&w(t)||n.push(e)}return n.join("\n").trimEnd()};const i=/\S|$/,r=/\S/,a=/^\s*~~~+$/,o=/^\s*\+\+\++$/,l=/^\s*===+\s+===+$/,c=/^\s*---+\s+---+$/,p=/^(\s*)-\s/,d=/^(\s*)\*\s/,u=/^(\s*)\d+\.\s/,m=/^(\s+\* )(.*)$/,y=/^\s*\.\. /,h=/^\s*\.\.\s+(\w+)::\s*(.*)$/,g=/ *>>> /,f=/^\s*:(param|arg|type|return|rtype|raise|except|var|ivar|cvar|copyright|license)/,T=/^[.\s\t]+(@\w+)/,_=/^(\.\s{3})|^(\.)/,v=[{exp:/^\s*=+(\s+=+)+$/,replacement:"="},{exp:/^\s*-+(\s+-+)+$/,replacement:"-"},{exp:/^\s*~+(\s+-+)+$/,replacement:"~"},{exp:/^\s*\++(\s+\++)+$/,replacement:"+"}],b=/\s/g,I=/``/g,C=/~/g,S=/\+/g,F=/(?<!\\)([_*~[\]])/g,x=/(\[.*\]\(.*\))/g,D=[{exp:/</g,replacement:"&lt;"},{exp:/>/g,replacement:"&gt;"}],P=/^\s*::$/,A=[{exp:/\s+::$/g,replacement:""},{exp:/(\S)\s*::$/g,replacement:"$1:"},{exp:/:[\w_\-+:.]+:`/g,replacement:"`"},{exp:/`:[\w_\-+:.]+:/g,replacement:"`"}];class E{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=(0,s.cleanAndSplitDocString)(e)}convert(){for(this._lines.some((e=>T.exec(e)))&&(this._lines=this._lines.map((e=>e.replace(_,""))));void 0!==this._currentLineOrUndefined();){const e=this._state,t=this._lineNum;if(this._state(),this._state===e&&this._lineNum===t)break}return this._state===this._parseBacktickBlock||this._state===this._parseDocTest||this._state===this._parseLiteralBlock?this._trimOutputAndAppendLine("```"):this._insideInlineCode&&this._trimOutputAndAppendLine("`",!0),this._builder.trim()}_eatLine(){this._lineNum++}_currentLineOrUndefined(){return this._lineNum<this._lines.length?this._lines[this._lineNum]:void 0}_currentLine(){return this._currentLineOrUndefined()||""}_currentIndent(){return k(this._currentLine())}_prevIndent(){var e;return k(null!==(e=this._lineAt(this._lineNum-1))&&void 0!==e?e:"")}_lineAt(e){return e<this._lines.length?this._lines[e]:void 0}_nextBlockIndent(){return k(this._lines.slice(this._lineNum+1).find((e=>!w(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(){if(w(this._currentLineOrUndefined()))return void(this._state=this._parseEmpty);if(this._beginBacktickBlock())return;if(this._beginLiteralBlock())return;if(this._beginDocTest())return;if(this._beginDirective())return;if(this._beginList())return;if(this._beginFieldList())return;if(this._beginTableBlock())return;const e=this._formatPlainTextIndent(this._currentLine());this._appendTextLine(e),this._eatLine()}_formatPlainTextIndent(e){const t=this._lineAt(this._lineNum-1),n=this._prevIndent(),s=this._currentIndent();return!(s>n)||w(t)||this._builder.endsWith("\\\n")||this._builder.endsWith("\n\n")||N(t)||(this._builder=this._builder.slice(0,-1)+"\\\n"),n>s&&!w(t)&&!this._builder.endsWith("\\\n")&&!this._builder.endsWith("\n\n")&&(this._builder=this._builder.slice(0,-1)+"\\\n"),e=0===n||this._builder.endsWith("\\\n")||this._builder.endsWith("\n\n")?this._convertIndent(e):e.trimStart()}_convertIndent(e){return e=e.replace(/^([ \t]+)(.+)$/g,((e,t,n)=>"&nbsp;".repeat(t.length)+n))}_escapeHtml(e){return D.forEach((t=>{e=e.replace(t.exp,t.replacement)})),e}_appendTextLine(e){const t=(e=this._preprocessTextLine(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);continue}if(n=this._escapeHtml(n),0===e){if(1===t.length){for(const e of v)if(e.exp.test(n)){n=n.replace(b,e.replacement);break}if(a.test(n)){this._append(n.replace(C,"-"));continue}if(o.test(n)){this._append(n.replace(S,"-"));continue}}const e=m.exec(n);null!==e&&3===e.length&&(this._append(e[1]),n=e[2])}n.split(x).forEach((e=>{x.test(e)?this._append(e):this._append(e.replace(F,"\\$1"))}))}this._builder+="\n"}_preprocessTextLine(e){return P.test(e)?"":(A.forEach((t=>e=e.replace(t.exp,t.replacement))),e=e.replace(I,"`"))}_parseEmpty(){if(w(this._currentLineOrUndefined()))return this._appendLine(),void this._eatLine();this._state=this._parseText}_beginMinIndentCodeBlock(e){this._appendLine("```"),this._pushAndSetState(e),this._blockIndent=this._currentIndent()}_beginBacktickBlock(){return!!this._currentLine().startsWith("```")&&(this._appendLine(this._currentLine()),this._pushAndSetState(this._parseBacktickBlock),this._eatLine(),!0)}_parseBacktickBlock(){this._currentLine().startsWith("```")?(this._appendLine("```"),this._appendLine(),this._popState()):this._appendLine(this._currentLine()),this._eatLine()}_beginDocTest(){return!!g.test(this._currentLine())&&(this._beginMinIndentCodeBlock(this._parseDocTest),this._appendLine(this._currentLineWithinBlock()),this._eatLine(),!0)}_parseDocTest(){if(this._currentLineIsOutsideBlock()||w(this._currentLine()))return this._trimOutputAndAppendLine("```"),this._appendLine(),void this._popState();this._appendLine(this._currentLineWithinBlock()),this._eatLine()}_beginLiteralBlock(){const e=this._lineAt(this._lineNum-1);if(void 0===e)return!1;if(!w(e))return!1;let t=this._lineNum-2;for(;t>=0;t--){const e=this._lineAt(t);if(!w(e)){if(e.endsWith("::"))break;return!1}}return!(t<0)&&(0===this._currentIndent()?(this._appendLine("```"),this._pushAndSetState(this._parseLiteralBlockSingleLine),!0):(this._beginMinIndentCodeBlock(this._parseLiteralBlock),!0))}_parseLiteralBlock(){return w(this._currentLineOrUndefined())?(this._appendLine(),void this._eatLine()):this._currentLineIsOutsideBlock()?(this._trimOutputAndAppendLine("```"),this._appendLine(),void this._popState()):(this._appendLine(this._currentLineWithinBlock()),void this._eatLine())}_parseLiteralBlockSingleLine(){this._appendLine(this._currentLine()),this._appendLine("```"),this._appendLine(),this._popState(),this._eatLine()}_beginDirective(){return!!y.test(this._currentLine())&&(this._pushAndSetState(this._parseDirective),this._blockIndent=this._nextBlockIndent(),this._appendDirectiveBlock=!1,!0)}_beginFieldList(){var e,t;if(this._insideInlineCode)return!1;let n=this._currentLine();if(n.startsWith("@"))return this._appendLine(),this._appendTextLine(n),this._eatLine(),!0;const s=!(null==n?void 0:n.endsWith(":"))&&!(null==n?void 0:n.endsWith("::"))&&(null!==(t=null===(e=n.match(/:/g))||void 0===e?void 0:e.length)&&void 0!==t?t:0)%2==1,i=f.test(n);if(s||i){const e=this._lineAt(this._lineNum-1);return this._builder.endsWith("\\\n")||this._builder.endsWith("\n\n")||N(e)||(this._builder=this._builder.slice(0,-1)+"\\\n"),n=this._convertIndent(n),this._appendTextLine(n),this._eatLine(),!0}return!1}_beginTableBlock(){if(this._insideInlineCode)return!1;const e=this._currentLine();return!!l.test(e)&&(this._tableState={header:e.trimStart(),inHeader:!0},this._eatLine(),this._pushAndSetState(this._parseTableBlock),!0)}_parseTableBlock(){if(w(this._currentLineOrUndefined())||!this._tableState)return this._tableState=void 0,void this._popState();let e=this._currentLine();if(l.test(e))return this._eatLine(),this._appendLine("\n<br/>\n"),this._popState(),void(this._tableState=void 0);{let t="|";const n=this._tableState.header.split(" "),s=[];if(this._tableState.inHeader){do{let t=0;for(let i=0;i<n.length;i++){const r=n[i].length+1,a=e.slice(t,t+r);void 0===s[i]?s[i]=`${a} `:s[i]=s[i].concat(`<br>${a} `),t+=r}this._eatLine(),e=this._currentLine()}while(!w(this._currentLineOrUndefined())&&!c.test(e)&&!l.test(e));this._tableState.inHeader=!1,s.forEach((e=>{t+=`${e}|`})),this._appendLine(t);const i=e.trimStart().replace(/=/g,"-").replace(" ","|");this._appendLine(`|${i}|`),this._eatLine()}else{let s=0;n.forEach((n=>{const i=n.length+1,r=e.slice(s,s+i);t+=`${r}|`,s+=i})),this._appendLine(t),this._eatLine()}}}_beginList(){if(this._insideInlineCode)return!1;let e=this._currentLine();const t=p.exec(e);if(2===(null==t?void 0:t.length))return t[1].length>=4&&(e=" ".repeat(t[1].length/2)+e.trimLeft()),this._appendTextLine(e),this._eatLine(),this._state!==this._parseList&&this._pushAndSetState(this._parseList),!0;const n=d.exec(e);if(2===(null==n?void 0:n.length))return 0===n[1].length?e=e=" "+e:n[1].length>=4&&(e=" ".repeat(n[1].length/2)+e.trimLeft()),this._appendTextLine(e),this._eatLine(),this._state!==this._parseList&&this._pushAndSetState(this._parseList),!0;const s=u.exec(e);return 2===(null==s?void 0:s.length)&&(this._appendTextLine(e),this._eatLine(),!0)}_parseList(){if(w(this._currentLineOrUndefined())||this._currentLineIsOutsideBlock())return void this._popState();if(!this._beginList()){const e=this._currentLine().trimStart();this._appendTextLine(e),this._eatLine()}}_parseDirective(){const e=h.exec(this._currentLine());if(null!==e&&3===e.length){const t=e[1],n=e[2];"class"===t&&(this._appendDirectiveBlock=!0,this._appendLine(),this._appendLine("```"),this._appendLine(n),this._appendLine("```"),this._appendLine())}0===this._blockIndent?this._popState():this._state=this._parseDirectiveBlock,this._eatLine()}_parseDirectiveBlock(){w(this._currentLineOrUndefined())||!this._currentLineIsOutsideBlock()?(this._appendDirectiveBlock&&this._appendTextLine(this._currentLine().trimLeft()),this._eatLine()):this._popState()}_appendLine(e){w(e)?this._skipAppendEmptyLine||(this._builder+="\n",this._skipAppendEmptyLine=!0):(this._builder+=e+"\n",this._skipAppendEmptyLine=!1)}_append(e){this._builder+=e,this._skipAppendEmptyLine=!1}_trimOutputAndAppendLine(e,t=!1){this._builder=this._builder.trimRight(),this._skipAppendEmptyLine=!1,t||this._appendLine(),this._appendLine(e)}}function k(e){return e.search(i)}function w(e){return void 0===e||!r.test(e)}function N(e){var t,n;return void 0!==e&&(null!==(n=null===(t=e.match(/^\s*[#`~=-]{3,}/))||void 0===t?void 0:t.length)&&void 0!==n?n:0)>0}},20822:(e,t)=>{function n(e){const t=e.replace(/\r/g,"").replace(/\t/g," ").split("\n");let n=Number.MAX_VALUE;t.forEach(((e,s)=>{if(t.length<=1||s>0){const t=e.trimLeft();t&&(n=Math.min(n,e.length-t.length))}})),n>=Number.MAX_VALUE&&(n=0);const s=[];for(t.forEach(((e,t)=>{0===t?s.push(e.trim()):s.push(e.substr(n).trimRight())}));s.length>0&&0===s[0].length;)s.shift();for(;s.length>0&&0===s[s.length-1].length;)s.pop();return s}Object.defineProperty(t,"__esModule",{value:!0}),t.extractParameterDocumentation=t.cleanAndSplitDocString=t.cleanDocString=void 0,t.cleanDocString=function(e){return n(e).join("\n")},t.cleanAndSplitDocString=n,t.extractParameterDocumentation=function(e,t){if(!e||!t)return;const s=n(e);for(const e of s){const n=e.trim();let s=n.indexOf("@param "+t);if(s>=0)return n.substr(s+7);if(s=n.indexOf(":param "+t),s>=0)return n.substr(s+7);if(s=n.indexOf(t+": "),s>=0)return n.substr(s);if(s=n.indexOf(t+" ("),s>=0)return n.substr(s)}}},25235:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.applyFunctionTransform=void 0;const s=n(15741),i=n(74426),r=n(35696),a=n(97882),o=n(59195),l=n(10425);t.applyFunctionTransform=function(e,t,n,c,p){return(0,o.isFunction)(c)&&"functools.total_ordering"===c.details.fullName?function(e,t,n,c){if(1!==n.length)return c;const p=n[0].type;if(!p||!(0,o.isInstantiableClass)(p)||p.includeSubclasses)return c;const d=["__lt__","__le__","__gt__","__ge__"],u=o.ClassType.cloneAsInstance(p),m=d.filter((e=>!(0,l.lookUpObjectMember)(u,e,8)));if(m.length===d.length)return e.addDiagnostic((0,r.getFileInfo)(t).diagnosticRuleSet.reportGeneralTypeIssues,s.DiagnosticRule.reportGeneralTypeIssues,i.Localizer.Diagnostic.totalOrderingMissingMethod(),t),c;const y=e.getBuiltInObject(t,"object");if(!y||!(0,o.isClassInstance)(y))return c;const h=e.getBuiltInObject(t,"bool");if(!h||!(0,o.isClassInstance)(h))return c;const g={category:0,name:"self",type:(0,l.synthesizeTypeVarForSelfCls)(p,!1),hasDeclaredType:!0},f={category:0,name:"__value",type:y,hasDeclaredType:!0};return m.forEach((e=>{const t=o.FunctionType.createSynthesizedInstance(e);o.FunctionType.addParameter(t,g),o.FunctionType.addParameter(t,f),t.details.declaredReturnType=h,p.details.fields.set(e,a.Symbol.createWithType(4,t))})),c}(e,t,n,p):p}},67145:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ImportResolver=t.supportedFileExtensions=t.createImportedModuleDescriptor=void 0;const a=n(9133),o=n(97956),l=n(94647),c=n(57485),p=n(14551),d=r(n(14551)),u=n(49900),m=n(37633),y=n(45214),h=n(88855),g=r(n(96453)),f=n(26477),T=n(91197);t.createImportedModuleDescriptor=function(e){if(0===e.length)return{leadingDots:0,nameParts:[],importedSymbols:[]};let t=0,n=0;for(;t<e.length&&"."===e[t];t++)n++;return{leadingDots:n,nameParts:e.slice(t).split("."),importedSymbols:[]}};const _=[".pyd",".so",".dylib"];t.supportedFileExtensions=[".py",".pyi",..._];t.ImportResolver=class{constructor(e,t,n){this.fileSystem=e,this._configOptions=t,this.host=n,this._cachedImportResults=new Map,this._cachedModuleNameResults=new Map,this._cachedEntriesForPath=new Map,this.cachedParentImportResults=new h.ParentDirectoryCache((()=>this.getPythonSearchPaths([])))}invalidateCache(){this._cachedImportResults=new Map,this._cachedModuleNameResults=new Map,this.cachedParentImportResults.reset(),this._invalidateFileSystemCache(),this.fileSystem instanceof m.PyrightFileSystem&&this.fileSystem.clearPartialStubs()}resolveImport(e,t,n){return this._resolveImport(e,t,n)}_resolveImport(e,t,n){const s=this.formatImportName(n),i=this._resolveImportStrict(s,e,t,n,[]);if(i.isImportFound||n.leadingDots>0)return i;e=(0,l.normalizePathCase)(this.fileSystem,(0,l.normalizePath)(e));const r=(0,l.ensureTrailingDirectorySeparator)((0,l.getDirectoryPath)(e)),a=this.cachedParentImportResults.getImportResult(r,s,i);if(a)return this.filterImplicitImports(a,n.importedSymbols);const o=this.getParentImportResolutionRoot(e,t.root);if(!this.cachedParentImportResults.checkValidPath(this.fileSystem,e,o))return i;const c={importPath:void 0};let p=r;for(;this._shouldWalkUp(p,o,t);){const e=this.resolveAbsoluteImport(p,t,n,s,[],void 0,void 0,!1,!0);if(this.cachedParentImportResults.checked(p,s,c),e.isImportFound)return c.importPath=p,this.cachedParentImportResults.add({importResult:e,path:p,importName:s}),this.filterImplicitImports(e,n.importedSymbols);let i;if([i,p]=this._tryWalkUp(p),!i)break}return this.cachedParentImportResults.checked(p,s,c),i}_resolveImportStrict(e,t,n,s,i){const r={importName:e,isRelative:!1,isImportFound:!1,isPartlyResolved:!1,isNamespacePackage:!1,isStubPackage:!1,importFailureInfo:i,resolvedPaths:[],importType:2,isStubFile:!1,isNativeLib:!1,implicitImports:[],filteredImplicitImports:[],nonStubImportResult:void 0};if(this.ensurePartialStubPackages(n),s.leadingDots>0){const r=this._resolveRelativeImport(t,n,s,e,i);if(r)return r.isRelative=!0,r}else{const i=this._lookUpResultsInCache(n,e,s.importedSymbols);if(i){if(!(i.isImportFound&&i.isNamespacePackage&&!this._isNamespacePackageResolved(s,i.implicitImports)))return i}const a=this._resolveBestAbsoluteImport(t,n,s,!0);if(a)return a.isStubFile&&(a.nonStubImportResult=this._resolveBestAbsoluteImport(t,n,s,!1)||r),this.addResultsToCache(n,e,a,s.importedSymbols)}return this.addResultsToCache(n,e,r,void 0)}getCompletionSuggestions(e,t,n){const s=this._getCompletionSuggestionsStrict(e,t,n);if(n.leadingDots>0)return s;const i=this.getParentImportResolutionRoot(e,t.root);let r=(0,l.ensureTrailingDirectorySeparator)((0,l.getDirectoryPath)((0,l.normalizePathCase)(this.fileSystem,(0,l.normalizePath)(e))));for(;this._shouldWalkUp(r,i,t);){let i;if(this._getCompletionSuggestionsAbsolute(e,t,r,n,s,!1),[i,r]=this._tryWalkUp(r),!i)break}return s}getConfigOption(){return this._configOptions}_getCompletionSuggestionsStrict(e,t,n){const s=[],i=new Set;if(n.leadingDots>0)this._getCompletionSuggestionsRelative(e,t,n,i);else{n.nameParts.length>0&&this._getCompletionSuggestionsTypeshedPath(e,t,n,!0,i),t.root&&this._getCompletionSuggestionsAbsolute(e,t,t.root,n,i);for(const s of t.extraPaths)this._getCompletionSuggestionsAbsolute(e,t,s,n,i);this._configOptions.stubPath&&this._getCompletionSuggestionsAbsolute(e,t,this._configOptions.stubPath,n,i),this._getCompletionSuggestionsTypeshedPath(e,t,n,!1,i);const r=this.getPythonSearchPaths(s);for(const s of r)this._getCompletionSuggestionsAbsolute(e,t,s,n,i)}return i}getSourceFilesFromStub(e,t,n){const s=[];if(this._cachedImportResults.forEach((t=>{t.forEach((t=>{if(t.isStubFile&&t.isImportFound&&t.nonStubImportResult&&t.resolvedPaths[t.resolvedPaths.length-1]===e&&t.nonStubImportResult.isImportFound){const e=t.nonStubImportResult.resolvedPaths[t.nonStubImportResult.resolvedPaths.length-1];(e.endsWith(".py")||e.endsWith(".pyi"))&&s.push(e)}}))})),0===s.length){const t=(0,l.changeAnyExtension)(e,".py");this.dirExistsCached(t)&&s.push(t)}if(0===s.length){const n=this.getImportRoots(t),i=[];for(const t of n)if((0,l.containsPath)(t,e,!0)){const n=(0,l.getRelativePathComponentsFromDirectory)(t,e,!0);if(n.length>1){n[1].endsWith(o.stubsSuffix)&&(n[1]=n[1].substr(0,n[1].length-o.stubsSuffix.length));const e=(0,l.combinePathComponents)(n);e&&i.push(e)}}for(const e of i)for(const t of n){const n=(0,l.resolvePaths)(t,e);let i=(0,l.changeAnyExtension)(n,".py");if(this.fileExistsCached(i))s.push(i);else{const e=(0,l.stripFileExtension)(i);e.endsWith("__init__")?(i=e.substr(0,e.length-9)+".py",this.fileExistsCached(i)&&s.push(i)):(i=(0,l.combinePaths)(e,"__init__.py"),this.fileExistsCached(i)&&s.push(i))}}}return s}getModuleNameForImport(e,t){const n=(0,a.getOrAdd)(this._cachedModuleNameResults,t.root,(()=>new Map));return(0,a.getOrAdd)(n,e,(()=>this._getModuleNameForImport(e,t)))}_getModuleNameForImport(e,t){let n,s=0,i=!1;const r=[],a=this._getStdlibTypeshedPath(t,r);if(a&&(n=this.getModuleNameFromPath(a,e),n)){const e={leadingDots:0,nameParts:n.split("."),importedSymbols:void 0};if(this._isStdlibTypeshedStubValidForVersion(e,t,[]))return{moduleName:n,importType:s,isLocalTypingsFile:i}}t.root&&(n=this.getModuleNameFromPath(t.root,e),s=2);for(const i of t.extraPaths){const t=this.getModuleNameFromPath(i,e);(!n||t&&t.length<n.length)&&(n=t,s=2)}if(this._configOptions.stubPath){const t=this.getModuleNameFromPath(this._configOptions.stubPath,e);(!n||t&&t.length<n.length)&&(n=t,s=2,i=!0)}const o=this._getThirdPartyTypeshedPath(t,r);if(o){const t=this.getModuleNameFromPath(o,e,!0);(!n||t&&t.length<n.length)&&(n=t,s=1)}const l=this.getTypeshedPathEx(t,r);if(l){const t=this.getModuleNameFromPath(l,e);(!n||t&&t.length<n.length)&&(n=t,s=1)}const c=this.getPythonSearchPaths(r);for(const t of c){const i=this.getModuleNameFromPath(t,e);(!n||i&&i.length<n.length)&&(n=i,s=1)}return n?{moduleName:n,importType:s,isLocalTypingsFile:i}:{moduleName:"",importType:2,isLocalTypingsFile:i}}getTypeshedStdLibPath(e){return this._getStdlibTypeshedPath(e,[])}getImportRoots(e,t=!1){const n=[],s=[],i=this._getStdlibTypeshedPath(e,n);if(i&&s.push(i),e.root&&s.push(e.root),(0,a.appendArray)(s,e.extraPaths),this._configOptions.stubPath&&s.push(this._configOptions.stubPath),t){const t=this._getThirdPartyTypeshedPath(e,n);t&&s.push((0,l.combinePaths)(t,"..."))}else{const t=this._getThirdPartyTypeshedPackageRoots(e,n);(0,a.appendArray)(s,t)}const r=this.getTypeshedPathEx(e,n);r&&s.push(r);const o=this.getPythonSearchPaths(n);return o.length>0&&(0,a.appendArray)(s,o),s}readdirEntriesCached(e){const t=this._cachedEntriesForPath.get(e);if(t)return t;let n;try{n=this.fileSystem.readdirEntriesSync(e)}catch{n=[]}return this._cachedEntriesForPath.set(e,n),n}fileExistsCached(e){var t,n;const s=this._splitPath(e);if(!s[0]||!s[1])return!!this.fileSystem.existsSync(e)&&(null!==(n=null===(t=(0,l.tryStat)(this.fileSystem,e))||void 0===t?void 0:t.isFile())&&void 0!==n&&n);const i=this.readdirEntriesCached(s[0]).find((e=>e.name===s[1]));if(null==i?void 0:i.isFile())return!0;if(null==i?void 0:i.isSymbolicLink()){const t=(0,l.tryRealpath)(this.fileSystem,e);if(t&&this.fileSystem.existsSync(t)&&(0,l.isFile)(this.fileSystem,t))return!0}return!1}dirExistsCached(e){var t,n;const s=this._splitPath(e);if(!s[0]||!s[1])return!!this.fileSystem.existsSync(e)&&(null!==(n=null===(t=(0,l.tryStat)(this.fileSystem,e))||void 0===t?void 0:t.isDirectory())&&void 0!==n&&n);const i=this.readdirEntriesCached(s[0]).find((e=>e.name===s[1]));if(null==i?void 0:i.isDirectory())return!0;if(null==i?void 0:i.isSymbolicLink()){const t=(0,l.tryRealpath)(this.fileSystem,e);if(t&&this.fileSystem.existsSync(t)&&(0,l.isDirectory)(this.fileSystem,t))return!0}return!1}ensurePartialStubPackages(e){if(!(this.fileSystem instanceof m.PyrightFileSystem))return!1;if(this.fileSystem.isPartialStubPackagesScanned(e))return!1;const t=this.fileSystem,n=[],s=[];return i(this._configOptions.stubPath),i(e.root),e.extraPaths.forEach((e=>i(e))),i(this.getTypeshedPathEx(e,n)),this.getPythonSearchPaths(n).forEach((e=>i(e))),this.fileSystem.processPartialStubPackages(s,this.getImportRoots(e)),this._invalidateFileSystemCache(),!0;function i(e){e&&!t.isPathScanned(e)&&s.push(e)}}addResultsToCache(e,t,n,s){return(0,a.getOrAdd)(this._cachedImportResults,e.root,(()=>new Map)).set(t,n),this.filterImplicitImports(n,s)}resolveAbsoluteImport(e,t,n,s,i,r=!1,a=!1,o=!1,l=!0,c=!1){if(l&&o){const a=this._resolveAbsoluteImport(e,t,n,s,i,r,!1,!0,!0,!0);if(a.packageDirectory&&(!a.isNamespacePackage||a.isImportFound))return a}return this._resolveAbsoluteImport(e,t,n,s,i,r,a,!1,l,c)}_invalidateFileSystemCache(){this._cachedEntriesForPath.clear()}_splitPath(e){const t=(0,l.getPathComponents)(e);if(t.length<=1)return[e,""];return[(0,l.combinePathComponents)(t.slice(0,-1)),t[t.length-1]]}_resolveAbsoluteImport(e,t,n,s,i,r,a,c,p,d){c?i.push(`Attempting to resolve stub package using root path '${e}'`):i.push(`Attempting to resolve using root path '${e}'`);const u=[];let m,y,h,g=e,T=!1,_=!1,v=!1,b=!1,I=[];if(0===n.nameParts.length){const e="__init__",t=(0,l.combinePaths)(g,e+".py"),n=(0,l.combinePaths)(g,e+".pyi");p&&this.fileExistsCached(n)?(i.push(`Resolved import with file '${n}'`),u.push(n),v=!0):this.fileExistsCached(t)?(i.push(`Resolved import with file '${t}'`),u.push(t)):(i.push(`Partially resolved import with directory '${g}'`),u.push(""),T=!0),I=this._findImplicitImports(s,g,[t,n])}else for(let e=0;e<n.nameParts.length;e++){const r=0===e,h=e===n.nameParts.length-1;g=(0,l.combinePaths)(g,n.nameParts[e]),c&&r&&(g+=o.stubsSuffix,_=!0);const C=this.dirExistsCached(g);if(C){r&&(m=g);const e="__init__",t=(0,l.combinePaths)(g,e+".py"),s=(0,l.combinePaths)(g,e+".pyi");let a=!1;if(p&&this.fileExistsCached(s)?(i.push(`Resolved import with file '${s}'`),u.push(s),h&&(v=!0),a=!0):this.fileExistsCached(t)&&(i.push(`Resolved import with file '${t}'`),u.push(t),a=!0),!y&&d&&this.fileExistsCached((0,l.combinePaths)(g,"py.typed"))&&(y=(0,f.getPyTypedInfo)(this.fileSystem,g)),!h){a||(u.push(""),T=!0,y=void 0);continue}if(a){I=this._findImplicitImports(n.nameParts.join("."),g,[t,s]);break}}let S=(0,l.stripTrailingDirectorySeparator)(g);const F=(0,l.getFileName)(S);S=(0,l.getDirectoryPath)(S);const x=(0,l.combinePaths)(S,F+".py"),D=(0,l.combinePaths)(S,F+".pyi");if(p&&this.fileExistsCached(D))i.push(`Resolved import with file '${D}'`),u.push(D),h&&(v=!0);else if(this.fileExistsCached(x))i.push(`Resolved import with file '${x}'`),u.push(x);else{if(a&&this.dirExistsCached(S)){const e=this._getFilesInDirectory(S).find((e=>this._isNativeModuleFileName(F,e)));if(e){const r=(0,l.combinePaths)(S,e);b=this._resolveNativeModuleStub(r,t,s,n,i,u)}}!b&&C?(i.push(`Partially resolved import with directory '${g}'`),u.push(""),h&&(I=this._findImplicitImports(s,g,[x,D]),T=!0)):b&&i.push(`Did not find file '${D}' or '${x}'`)}break}const C=u.length>0&&u.length<n.nameParts.length;return h=r?u.length>0:u.length>=n.nameParts.length,{importName:s,isRelative:!1,isNamespacePackage:T,isStubPackage:_,isImportFound:h,isPartlyResolved:C,importFailureInfo:i,importType:2,resolvedPaths:u,searchPath:e,isStubFile:v,isNativeLib:b,implicitImports:I,pyTypedInfo:y,filteredImplicitImports:I,packageDirectory:m}}getTypeshedPathEx(e,t){}resolveImportEx(e,t,n,s,i=[],r=!0){}resolveNativeImportEx(e,t,n=[]){}getNativeModuleName(e){const t=(0,l.getFileExtension)(e,!1).toLowerCase();if(this._isNativeModuleFileExtension(t))return(0,l.stripFileExtension)((0,l.stripFileExtension)(e))}_lookUpResultsInCache(e,t,n){const s=this._cachedImportResults.get(e.root);if(!s)return;const i=s.get(t);return i?this.filterImplicitImports(i,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=(0,l.ensureTrailingDirectorySeparator)(e);let s=(0,l.stripFileExtension)(t);if(this._isNativeModuleFileExtension((0,l.getFileExtension)(t))&&(s=(0,l.stripFileExtension)(s)),!s.startsWith(e))return;s.endsWith("__init__")&&(s=s.substr(0,s.length-9));const i=s.substr(e.length),r=(0,l.getPathComponents)(i);if(r.shift(),n){if(0===r.length)return;r.shift()}return 0===r.length||(r[0].endsWith(o.stubsSuffix)&&(r[0]=r[0].substr(0,r[0].length-o.stubsSuffix.length)),r.some((e=>!this._isIdentifier(e))))?void 0:r.join(".")}_resolveBestAbsoluteImport(e,t,n,s){const i=this.formatImportName(n),r=[];if(s&&this._configOptions.stubPath){r.push(`Looking in stubPath '${this._configOptions.stubPath}'`);const e=this.resolveAbsoluteImport(this._configOptions.stubPath,t,n,i,r,void 0,!1,!0,s,!1);if(e.isImportFound){if(e.importType=2,e.isLocalTypingsFile=!0,!e.isNamespacePackage||e.resolvedPaths[e.resolvedPaths.length-1])return e;if(this._isNamespacePackageResolved(n,e.implicitImports))return e}}let a,o;t.root&&(r.push(`Looking in root directory of execution environment '${t.root}'`),o=this.resolveAbsoluteImport(t.root,t,n,i,r,void 0,!0,!0,s,!1),a=o);for(const e of t.extraPaths)r.push(`Looking in extraPath '${e}'`),o=this.resolveAbsoluteImport(e,t,n,i,r,void 0,!0,!0,s,!1),a=this._pickBestImport(a,o,n);const l=this.getPythonSearchPaths(r);if(l.length>0)for(const e of l){r.push(`Looking in python search path '${e}'`);const o=this.resolveAbsoluteImport(e,t,n,i,r,false,!0,!0,s,!0);if(o){if(o.importType=1,o.isImportFound&&o.isStubFile)return o;a=this._pickBestImport(a,o,n)}}else r.push("No python interpreter search path");if(t.root!==this._getTypeshedRoot(t,r)&&(null==a?void 0:a.pyTypedInfo)&&!a.isPartlyResolved)return a;const c=this.resolveImportEx(e,t,n,i,r,s);if(c)return c;if(s&&n.nameParts.length>0){r.push("Looking for typeshed stdlib path");const e=this._findTypeshedPath(t,n,i,!0,r);if(e)return e.isTypeshedFile=!0,e;r.push("Looking for typeshed third-party path");const s=this._findTypeshedPath(t,n,i,!1,r);s&&(s.isTypeshedFile=!0,a=this._pickBestImport(a,s,n))}return a}_pickBestImport(e,t,n){if(!e)return t;if(!t)return e;if(t.isImportFound){if(!e.isImportFound)return t;if(e.isNamespacePackage&&!t.isNamespacePackage)return t;if(2===e.importType&&!e.isNamespacePackage)return e;if(e.isNamespacePackage&&t.isNamespacePackage&&n.importedSymbols&&!this._isNamespacePackageResolved(n,e.implicitImports)&&this._isNamespacePackageResolved(n,t.implicitImports))return t;if(e.pyTypedInfo&&!t.pyTypedInfo)return e;if(!e.pyTypedInfo&&t.pyTypedInfo)return t;if(e.isStubFile&&!t.isStubFile)return e;if(!e.isStubFile&&t.isStubFile)return t;if(e.resolvedPaths.length>t.resolvedPaths.length)return t}else if(t.isPartlyResolved&&e.isNamespacePackage&&!t.isNamespacePackage)return t;return e}_isIdentifier(e){for(let t=0;t<e.length;t++)if(0===t?!(0,u.isIdentifierStartChar)(e.charCodeAt(t)):!(0,u.isIdentifierChar)(e.charCodeAt(t)))return!1;return!0}getPythonSearchPaths(e){if(!this._cachedPythonSearchPaths){const t=(g.findPythonSearchPaths(this.fileSystem,this._configOptions,this.host,e)||[]).map((e=>this.fileSystem.realCasePath(e)));this._cachedPythonSearchPaths=[...new Set(t)]}return this._cachedPythonSearchPaths}_findTypeshedPath(e,t,n,s,i){let r;if(i.push(`Looking for typeshed ${s?g.stdLibFolderName:g.thirdPartyFolderName} path`),s){const n=this._getStdlibTypeshedPath(e,i,t);n&&(r=[n])}else r=this._getThirdPartyTypeshedPackagePaths(t,e,i);if(r)for(const a of r)if(this.dirExistsCached(a)){const r=this.resolveAbsoluteImport(a,e,t,n,i);if(r.isImportFound)return r.importType=s?0:1,r}i.push("Typeshed path not found")}_buildTypeshedThirdPartyPackageMap(e){this._cachedTypeshedThirdPartyPackagePaths=new Map,e&&this.readdirEntriesCached(e).forEach((t=>{if(t.isDirectory()){const n=(0,l.combinePaths)(e,t.name);this.readdirEntriesCached(n).forEach((e=>{if("@python2"!==e.name)if(e.isDirectory()){const t=this._cachedTypeshedThirdPartyPackagePaths.get(e.name);t?t.push(n):this._cachedTypeshedThirdPartyPackagePaths.set(e.name,[n])}else if(e.isFile()&&e.name.endsWith(".pyi")){const t=(0,l.stripFileExtension)(e.name),s=this._cachedTypeshedThirdPartyPackagePaths.get(t);s?s.push(n):this._cachedTypeshedThirdPartyPackagePaths.set(t,[n])}}))}}));const t=[...this._cachedTypeshedThirdPartyPackagePaths.values()].flatMap((e=>e));this._cachedTypeshedThirdPartyPackageRoots=[...new Set(t)].sort()}_getCompletionSuggestionsTypeshedPath(e,t,n,s,i){const r=[];let a;if(s){const e=this._getStdlibTypeshedPath(t,r,n);e&&(a=[e])}else{a=this._getThirdPartyTypeshedPackagePaths(n,t,r,!1);const e=this.getTypeshedPathEx(t,r);e&&(a=null!=a?a:[],a.push(e))}a&&a.forEach((s=>{this.dirExistsCached(s)&&this._getCompletionSuggestionsAbsolute(e,t,s,n,i)}))}_getStdlibTypeshedPath(e,t,n){const s=this._getTypeshedSubdirectory(!0,e,t);if(!s||!n||this._isStdlibTypeshedStubValidForVersion(n,e,t))return s}_getThirdPartyTypeshedPath(e,t){return this._getTypeshedSubdirectory(!1,e,t)}_isStdlibTypeshedStubValidForVersion(e,t,n){this._cachedTypeshedStdLibModuleVersions||(this._cachedTypeshedStdLibModuleVersions=this._readTypeshedStdLibVersions(t,n));for(let n=1;n<=e.nameParts.length;n++){const s=e.nameParts.slice(0,n),i=this._cachedTypeshedStdLibModuleVersions.get(s.join("."));if(i){if(t.pythonVersion<i.min)return!1;if(void 0!==i.max&&t.pythonVersion>i.max)return!1}}return!0}_readTypeshedStdLibVersions(e,t){const n=new Map,s=this._getTypeshedSubdirectory(!0,e,t);if(s){const e=(0,l.combinePaths)(s,"VERSIONS");try{const s=this.fileSystem.statSync(e);if(s.size>0&&s.size<262144){this.fileSystem.readFileSync(e,"utf8").split(/\r?\n/).forEach((e=>{const t=e.split("#")[0].split(":");if(2!==t.length)return;const s=t[1].split("-");if(s.length>2)return;const i=t[0].trim();if(!i)return;let r=s[0].trim();r.endsWith("+")&&(r=r.substr(0,r.length-1));let a,o=(0,c.versionFromString)(r);o||(o=c.PythonVersion.V3_0),s.length>1&&(a=(0,c.versionFromString)(s[1].trim())),n.set(i,{min:o,max:a})}))}else t.push("Typeshed stdlib VERSIONS file is unexpectedly large")}catch(e){t.push(`Could not read typeshed stdlib VERSIONS file: '${JSON.stringify(e)}'`)}}return n}_getThirdPartyTypeshedPackagePaths(e,t,n,s=!0){const i=this._getThirdPartyTypeshedPath(t,n);this._cachedTypeshedThirdPartyPackagePaths||this._buildTypeshedThirdPartyPackageMap(i);const r=e.nameParts.length>0?e.nameParts[0]:"";return s?this._cachedTypeshedThirdPartyPackagePaths.get(r):r?(0,a.flatten)((0,a.getMapValues)(this._cachedTypeshedThirdPartyPackagePaths,(e=>e.startsWith(r)))):[]}_getThirdPartyTypeshedPackageRoots(e,t){const n=this._getThirdPartyTypeshedPath(e,t);return this._cachedTypeshedThirdPartyPackagePaths||this._buildTypeshedThirdPartyPackageMap(n),this._cachedTypeshedThirdPartyPackageRoots}_getTypeshedRoot(e,t){if(void 0!==this._cachedTypeshedRoot)return this._cachedTypeshedRoot;let n="";if(this._configOptions.typeshedPath){const e=this._configOptions.typeshedPath;this.dirExistsCached(e)&&(n=e)}else{const e=this.getPythonSearchPaths(t);for(const t of e){const e=(0,l.combinePaths)(t,"typeshed");if(this.dirExistsCached(e)){n=e;break}}}return n||(n=g.getTypeShedFallbackPath(this.fileSystem)||""),this._cachedTypeshedRoot=n,n}_getTypeshedSubdirectory(e,t,n){if(e){if(void 0!==this._cachedTypeshedStdLibPath)return this._cachedTypeshedStdLibPath}else if(void 0!==this._cachedTypeshedThirdPartyPath)return this._cachedTypeshedThirdPartyPath;let s=this._getTypeshedRoot(t,n);if(s=g.getTypeshedSubdirectory(s,e),this.dirExistsCached(s))return e?this._cachedTypeshedStdLibPath=s:this._cachedTypeshedThirdPartyPath=s,s}_resolveRelativeImport(e,t,n,s,i){i.push("Attempting to resolve relative import");const r=(0,y.getDirectoryLeadingDotsPointsTo)((0,l.getDirectoryPath)(e),n.leadingDots);if(!r)return void i.push(`Invalid relative path '${s}'`);const a=this.resolveAbsoluteImport(r,t,n,s,i,!1,!0);return a&&a.isStubFile&&(a.nonStubImportResult=this.resolveAbsoluteImport(r,t,n,s,i,!1,!0,!1,!1)||{importName:s,isRelative:!0,isImportFound:!1,isPartlyResolved:!1,isNamespacePackage:!1,isStubPackage:!1,importFailureInfo:i,resolvedPaths:[],importType:2,isStubFile:!1,isNativeLib:!1,implicitImports:[],filteredImplicitImports:[],nonStubImportResult:void 0}),this.filterImplicitImports(a,n.importedSymbols)}_getCompletionSuggestionsRelative(e,t,n,s){const i=(0,y.getDirectoryLeadingDotsPointsTo)((0,l.getDirectoryPath)(e),n.leadingDots);i&&this._getCompletionSuggestionsAbsolute(e,t,i,n,s)}_getFilesInDirectory(e){const t=this.readdirEntriesCached(e),n=t.filter((e=>e.isFile())).map((e=>e.name));return t.forEach((t=>{var s;const i=(0,l.combinePaths)(e,t.name);t.isSymbolicLink()&&(null===(s=(0,l.tryStat)(this.fileSystem,i))||void 0===s?void 0:s.isFile())&&n.push(t.name)})),n}_getCompletionSuggestionsAbsolute(e,t,n,s,i,r=!0){let a=n;const o=s.nameParts.map((e=>e));s.hasTrailingDot&&o.push("");const c=s.leadingDots,p=o.slice(0,-1);if(0===o.length)this._addFilteredSuggestionsAbsolute(e,t,a,"",i,c,p,r);else for(let n=0;n<o.length&&(n===o.length-1&&this._addFilteredSuggestionsAbsolute(e,t,a,o[n],i,c,p,r),a=(0,l.combinePaths)(a,o[n]),this.dirExistsCached(a));n++);}_addFilteredSuggestionsAbsolute(e,n,s,i,r,a,o,c){const p=(0,l.getFileSystemEntriesFromDirEntries)(this.readdirEntriesCached(s),this.fileSystem,s);p.files.forEach((s=>{const p=(0,l.getFileExtension)(s,!1).toLowerCase(),u=(0,l.stripFileExtension)(s,!0);if(t.supportedFileExtensions.some((e=>e===p))){if("__init__"===u)return;if(i&&!d.isPatternInSymbol(i,u))return;if(!this._isUniqueValidSuggestion(u,r)||!this._isResolvableSuggestion(u,a,o,e,n,c))return;r.add(u)}})),p.directories.forEach((t=>{i&&!t.startsWith(i)||this._isUniqueValidSuggestion(t,r)&&this._isResolvableSuggestion(t,a,o,e,n,c)&&r.add(t)}))}_isResolvableSuggestion(e,t,n,s,i,r){const a={leadingDots:t,nameParts:[...n,e],importedSymbols:[]};if(r){const e=this.formatImportName(a),t=[];return this._resolveImportStrict(e,s,i,a,t).isImportFound}return this._resolveImport(s,i,a).isImportFound}_isUniqueValidSuggestion(e,t){return!t.has(e)&&(!/[.-]/.test(e)&&(!(0,T.isDunderName)(e)||"__future__"===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 s=Object.assign({},e);return s.filteredImplicitImports=n,s}_findImplicitImports(e,t,n){const s=new Map,i=(0,l.getFileSystemEntriesFromDirEntries)(this.readdirEntriesCached(t),this.fileSystem,t);for(const r of i.files){const i=(0,l.getFileExtension)(r);let a,o=!1;if(".py"===i||".pyi"===i)a=(0,l.stripFileExtension)(r);else{if(!this._isNativeModuleFileExtension(i)||this.fileExistsCached(`${r}.py`)||this.fileExistsCached(`${r}.pyi`))continue;a=r.substr(0,r.indexOf(".")),o=!0}const c=(0,l.combinePaths)(t,r);if(!n.find((e=>e===c))){const n={isStubFile:r.endsWith(".pyi"),isNativeLib:o,name:a,path:c},i=s.get(n.name);if(!i||!i.isStubFile){if(o){const s=(0,l.combinePaths)(t,r),i=this.resolveNativeImportEx(s,`${e}.${a}`,[]);i&&(n.path=i,n.isNativeLib=!1)}s.set(n.name,n)}}}for(const e of i.directories){const i=(0,l.combinePaths)(t,e,"__init__.py"),r=i+"i";let a=!1,o="";if(this.fileExistsCached(r)?(a=!0,o=r):this.fileExistsCached(i)&&(o=i),o&&!n.find((e=>e===o))){const t={isStubFile:a,isNativeLib:!1,name:e,path:o};s.set(t.name,t)}}return[...s.values()]}formatImportName(e){return".".repeat(e.leadingDots)+e.nameParts.join(".")}_resolveNativeModuleStub(e,t,n,s,i,r){let a=n;if(s.leadingDots>0){const n=this.getModuleNameForImport(e,t);a=n.moduleName.length>0?n.moduleName:a}const o=this.resolveNativeImportEx(e,a,i);return o?(i.push(`Resolved native import ${n} with stub '${o}'`),r.push(o),!1):(i.push(`Resolved import with file '${e}'`),r.push(e),!0)}_isNativeModuleFileName(e,t){const n=(0,l.getFileExtension)(t,!1).toLowerCase(),s=(0,l.stripFileExtension)(t,!0);return this._isNativeModuleFileExtension(n)&&(0,p.equateStringsCaseInsensitive)(e,s)}_isNativeModuleFileExtension(e){return _.some((t=>t===e))}_tryWalkUp(e){return(0,l.isDiskPathRoot)(e)?[!1,""]:[!0,(0,l.ensureTrailingDirectorySeparator)((0,l.normalizePathCase)(this.fileSystem,(0,l.normalizePath)((0,l.combinePaths)(e,".."))))]}_shouldWalkUp(e,t,n){return e.length>t.length||e===t&&!n.root}getParentImportResolutionRoot(e,t){return t?(0,l.ensureTrailingDirectorySeparator)((0,l.normalizePathCase)(this.fileSystem,(0,l.normalizePath)(t))):(0,l.ensureTrailingDirectorySeparator)((0,l.getDirectoryPath)(e))}}},45214:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getDirectoryLeadingDotsPointsTo=t.getRelativeModuleName=t.getTextRangeForImportNameDeletion=t.getImportGroupFromModuleNameAndType=t.getAllImportNames=t.getContainingImportStatement=t.getTextEditsForAutoImportInsertion=t.getTextEditsForAutoImportInsertions=t.getTextEditsForAutoImportSymbolAddition=t.getTopLevelImports=t.compareImportStatements=t.getImportGroup=void 0;const a=n(38213),o=n(9133),l=n(94647),c=n(28348),p=n(14551),d=n(80957),u=r(n(35696)),m=r(n(91197));function y(e){return e.importResult?0===e.importResult.importType?0:1===e.importResult.importType||e.importResult.isLocalTypingsFile?1:e.importResult.isRelative?3:2:2}function h(e){return m.isConstantName(e)?0:m.isTypeAliasName(e)?1:2}function g(e,t){const n=h(e)-h(t);if(0!==n)return n;const s=e.replace(/_/g,"="),i=t.replace(/_/g,"=");return(0,p.compareStringsCaseSensitive)(s,i)}function f(e,t,n,s){let i;for(const t of n.imports){if(g(t.name.value,e)>0)break;i=t}let r=!1,a="";if(n.imports.length>0){const e=(0,c.convertOffsetToPosition)(n.start,s.tokenizerOutput.lines),t=(0,c.convertOffsetToPosition)(n.imports[0].start,s.tokenizerOutput.lines),i=n.imports.length>1?(0,c.convertOffsetToPosition)(n.imports[1].start,s.tokenizerOutput.lines):void 0;if(t.line>e.line&&(void 0===i||i.line>t.line)){const e=s.tokenizerOutput.lines.getItemAt(t.line);a=s.text.substr(e.start,t.character),/^\s*$/.test(a)&&(r=!0)}}const o=i?d.TextRange.getEnd(i):n.imports.length>0?n.imports[0].start:n.start+n.length,l=(0,c.convertOffsetToPosition)(o,s.tokenizerOutput.lines),p=t?`${e} as ${t}`:`${e}`;let u;if(r){const e=s.tokenizerOutput.predominantEndOfLineSequence;u=i?`,${e}${a}${p}`:`${p},${e}${a}`}else u=i?`, ${p}`:`${p}, `;return{range:{start:l,end:l},importName:e,replacementText:u}}function T(e,t){if(t.length<2)return t.map((e=>i(e)));const n=[...(0,o.createMapFromItems)(t,(e=>`${e.importGroup} ${d.Range.print(e.range)}`))].sort(((e,t)=>(0,p.compareStringsCaseSensitive)(e[0],t[0]))).map((e=>e[1])),s=[];for(const t of n)1===t.length?s.push(i(t[0])):s.push({range:t[0].range,replacementText:t[0].preChange+t.map((e=>e.importStatement)).sort(((e,t)=>r(e,t))).join(e.tokenizerOutput.predominantEndOfLineSequence)+t[0].postChange});return s;function i(e){return{range:e.range,replacementText:e.preChange+e.importStatement+e.postChange}}function r(e,t){const n=e.startsWith("import");return n===t.startsWith("import")?e<t?-1:1:n?-1:1}}function _(e,t,n,s,i,r){const a=[];0===(e=Array.isArray(e)?e:[e]).length&&e.push({});const l=(0,o.createMapFromItems)(e,(e=>e.name?"from":"import")),p=l.get("import");p&&h(p,(e=>`import ${e.join(", ")}`));const u=l.get("from");return u&&h(u,(e=>`from ${n} import ${e.join(", ")}`)),a;function h(e,l){const p=e.map((e=>function(e,t){const n=e.name?e.name:t;return{sortText:n,text:e.alias?`${n} as ${e.alias}`:n}}(e,n))).sort(((e,t)=>g(e.sortText,t.sortText))).reduce(((e,t)=>(0,o.addIfUnique)(e,t.text)),[]);a.push(function(e,t,n,s,i,r){let a,o="",l="";const p=(0,c.convertPositionToOffset)(r,i.tokenizerOutput.lines);if(t.orderedImports.length>0&&p>t.orderedImports[0].node.start){let e=!0,r=t.orderedImports[0],p=0;for(const a of t.orderedImports){const l=a.importResult?y(a):p;if(s<l){!e&&p<s&&(o=i.tokenizerOutput.predominantEndOfLineSequence+o);break}if(s===l&&a.moduleName>n)break;if(a.followsNonImportStatement){s>p&&(o=i.tokenizerOutput.predominantEndOfLineSequence+o);break}a===t.orderedImports[t.orderedImports.length-1]&&s>l&&(o=i.tokenizerOutput.predominantEndOfLineSequence+o),e=!e&&s<p&&s===l,p=l,r=a}r?(e?l+=i.tokenizerOutput.predominantEndOfLineSequence:o=i.tokenizerOutput.predominantEndOfLineSequence+o,a=(0,c.convertOffsetToPosition)(e?r.node.start:d.TextRange.getEnd(r.node),i.tokenizerOutput.lines)):a={line:0,character:0}}else{a={line:0,character:0};let e=!1;for(const t of i.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&&m.isDunderName(e.leftExpression.value))&&(n=!1)}if(n){a=(0,c.convertOffsetToPosition)(t.start,i.tokenizerOutput.lines),e=!1;break}a=(0,c.convertOffsetToPosition)(t.start+t.length,i.tokenizerOutput.lines),e=!0}l=l+i.tokenizerOutput.predominantEndOfLineSequence+i.tokenizerOutput.predominantEndOfLineSequence,e?o=i.tokenizerOutput.predominantEndOfLineSequence+o:l+=i.tokenizerOutput.predominantEndOfLineSequence}return{range:{start:a,end:a},preChange:o,importStatement:e,postChange:l,importGroup:s}}(l(p),t,n,s,i,r))}}function v(e){let t="";for(let n=0;n<e.leadingDots;n++)t+=".";return t+=e.nameParts.map((e=>e.value)).join("."),t}function b(e){let t=2;return e.isLocalTypingsFile||1===e.importType?t=1:0===e.importType&&(t=0),t}t.getImportGroup=y,t.compareImportStatements=function(e,t){const n=y(e),s=y(t);return n<s?-1:n>s?1:e.moduleName<t.moduleName?-1:1},t.getTopLevelImports=function(e,t=!1){const n={orderedImports:[],mapByFilePath:new Map};let s=!1,i=!1;return e.statements.forEach((e=>{47===e.nodeType?e.statements.forEach((e=>{20===e.nodeType?(i=!0,function(e,t,n){e.list.forEach((s=>{const i=u.getImportInfo(s.module);let r;i&&i.isImportFound&&(r=i.resolvedPaths[i.resolvedPaths.length-1]);const a={node:e,subnode:s,importResult:i,resolvedPath:r,moduleName:v(s.module),followsNonImportStatement:n};t.orderedImports.push(a),r&&(t.mapByFilePath.has(r)||t.mapByFilePath.set(r,a))}))}(e,n,s),s=!1):22===e.nodeType?(i=!0,function(e,t,n,s){var i;const r=u.getImportInfo(e.module);let a;r&&r.isImportFound&&(a=r.resolvedPaths[r.resolvedPaths.length-1]);if(s&&r){t.implicitImports=null!==(i=t.implicitImports)&&void 0!==i?i:new Map;for(const n of r.implicitImports){const s=e.imports.find((e=>e.name.value===n.name));s&&t.implicitImports.set(n.path,s)}}const o={node:e,importResult:r,resolvedPath:a,moduleName:v(e.module),followsNonImportStatement:n};if(t.orderedImports.push(o),a){const e=t.mapByFilePath.get(a);(!e||20===e.node.nodeType||e.moduleName.length>o.moduleName.length)&&t.mapByFilePath.set(a,o)}}(e,n,s,t),s=!1):s=i})):s=i})),n},t.getTextEditsForAutoImportSymbolAddition=function(e,t,n){const s=[];if(!t.node||22!==t.node.nodeType||t.node.isWildcardImport)return s;const i=t.node;if(0===(e=(Array.isArray(e)?e:[e]).filter((e=>!!e.name&&!i.imports.some((t=>t.name.value===e.name&&t.alias===e.alias))))).length)return s;for(const i of e)s.push(f(i.name,i.alias,t.node,n));const r=(0,o.createMapFromItems)(s,(e=>d.Range.print(e.range))),a=[];for(const e of r.values())1===e.length?a.push(e[0]):a.push({range:e[0].range,replacementText:e.sort(((e,t)=>g(e.importName,t.importName))).map((e=>e.replacementText)).join("")});return a},t.getTextEditsForAutoImportInsertions=function(e,t,n,s){const i=[];if(0===(e=Array.isArray(e)?e:[e]).length)return[];const r=(0,o.createMapFromItems)(e,(e=>e.module.moduleName));for(const e of r.values())i.push(..._(e,t,e[0].module.moduleName,b(e[0].module),n,s));return T(n,i)},t.getTextEditsForAutoImportInsertion=function(e,t,n,s,i,r){return T(i,_(e,t,n,s,i,r))},t.getContainingImportStatement=function(e,t){for(;e&&((0,a.throwIfCancellationRequested)(t),20!==e.nodeType&&22!==e.nodeType);)e=e.parent;return e},t.getAllImportNames=function(e){if(20===e.nodeType){return e.list}return e.imports},t.getImportGroupFromModuleNameAndType=b,t.getTextRangeForImportNameDeletion=function(e,t){let n;if(1===e.length&&0===t)n=e[0];else if(t===e.length-1){const s=d.TextRange.getEnd(e[t-1]);n={start:s,length:d.TextRange.getEnd(e[t])-s}}else{const s=e[t].start;n={start:s,length:e[t+1].start-s}}return n},t.getRelativeModuleName=function(e,t,n,s=!1,i){let r,a=t;(i=void 0!==i?i:(0,l.isFile)(e,t))&&(a=(0,l.getDirectoryPath)(t));let o=n;if(i){o=(0,l.getDirectoryPath)(n);const e=(0,l.stripFileExtension)((0,l.getFileName)(n));"__init__"!==e?r=e:s&&(r=(0,l.getFileName)(o),o=(0,l.getDirectoryPath)(o))}const c=(0,l.getRelativePathComponentsFromDirectory)(a,o,(t=>e.realCasePath(t)));let p=".";for(let e=1;e<c.length;e++){const t=c[e];p+=".."===t?".":t,".."!==t&&e!==c.length-1&&(p+=".")}return r&&(p="."===p[p.length-1]?p+r:p+"."+r),p},t.getDirectoryLeadingDotsPointsTo=function(e,t){let n=e;for(let e=1;e<t;e++){if(""===n)return;n=(0,l.getDirectoryPath)(n)}return n}},71595:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.updateNamedTupleBaseClass=t.createNamedTupleType=void 0;const a=n(28348),o=n(80957),l=n(74426),c=n(35696),p=r(n(23241)),d=n(97882),u=n(59195),m=n(10425);function y(e,t,n){const s=e.details.mro.findIndex((e=>(0,u.isInstantiableClass)(e)&&u.ClassType.isBuiltIn(e,"NamedTuple")));if(s<0||e.details.mro.length<s+2)return;const i=e.details.mro[s],r=e.details.mro[s+1];if(!(0,u.isInstantiableClass)(r)||!(0,m.isTupleClass)(r))return;const a=[];n?t.forEach((e=>{a.push({type:e,isUnbounded:!1})})):a.push({type:t.length>0?(0,u.combineTypes)(t):u.UnknownType.create(),isUnbounded:!0});const o=(0,m.specializeTupleClass)(r,a,n),l=u.ClassType.cloneForSpecialization(i,[],n);l.details={...l.details},l.details.mro=[...l.details.mro],l.details.mro[1]=o.details.mro[0],l.details.baseClasses=l.details.baseClasses.map((e=>(0,u.isInstantiableClass)(e)&&(0,m.isTupleClass)(e)?o:e)),e.details.mro[s]=l,e.details.mro[s+1]=o,e.details.baseClasses=e.details.baseClasses.map((e=>(0,u.isInstantiableClass)(e)&&u.ClassType.isBuiltIn(e,"NamedTuple")?l:e))}t.createNamedTupleType=function(e,t,n,s){var i,r,h;const g=(0,c.getFileInfo)(t);let f="namedtuple";if(0===n.length)e.addError(l.Localizer.Diagnostic.namedTupleFirstArg(),t);else{const s=n[0];0!==s.argumentCategory?e.addError(l.Localizer.Diagnostic.namedTupleFirstArg(),n[0].valueExpression||t):s.valueExpression&&48===s.valueExpression.nodeType&&(f=s.valueExpression.strings.map((e=>e.value)).join(""))}const T=n.find((e=>{var t;return"defaults"===(null===(t=e.name)||void 0===t?void 0:t.value)}));let _=0;if(T&&T.valueExpression){const t=e.getTypeOfExpression(T.valueExpression).type;_=(0,u.isClassInstance)(t)&&(0,m.isTupleClass)(t)&&!(0,m.isUnboundedTupleClass)(t)&&t.tupleTypeArguments?t.tupleTypeArguments.length:void 0}const v=e.getTypingType(t,"NamedTuple")||u.UnknownType.create(),b=u.ClassType.createInstantiable(f,p.getClassFullName(t,g.moduleName,f),g.moduleName,g.filePath,16777216,p.getTypeSourceId(t),void 0,(0,u.isInstantiableClass)(v)?v.details.effectiveMetaclass:u.UnknownType.create());b.details.baseClasses.push(v),b.details.typeVarScopeId=e.getScopeIdForNode(t);const I=b.details.fields;I.set("__class__",d.Symbol.createWithType(68,b));const C=(0,m.synthesizeTypeVarForSelfCls)(b,!0),S=u.FunctionType.createSynthesizedInstance("__new__",1);S.details.declaredReturnType=(0,m.convertToInstance)(C),p.isAssignmentToDefaultsFollowingNamedTuple(t)&&(S.details.flags|=32),u.FunctionType.addParameter(S,{category:0,name:"cls",type:C,hasDeclaredType:!0});const F=[],x={category:0,name:"self",type:(0,m.synthesizeTypeVarForSelfCls)(b,!1),hasDeclaredType:!0};let D=!1;const P=[];if(n.length<2)e.addError(l.Localizer.Diagnostic.namedTupleSecondArg(),t),D=!0;else{const t=n[1];if(0!==t.argumentCategory)D=!0;else if(!s&&t.valueExpression&&48===t.valueExpression.nodeType){const e=t.valueExpression.strings.map((e=>e.value)).join("").split(/[,\s]+/),n=void 0===_?0:Math.max(0,e.length-_);e.forEach(((e,i)=>{if(e=e.trim()){const r=u.UnknownType.create(),l={category:0,name:e,type:r,hasDeclaredType:s,hasDefault:i>=n};u.FunctionType.addParameter(S,l);const c=d.Symbol.createWithType(8,r);F.push(e);const p=t.valueExpression,m={type:1,node:p,isRuntimeTypeExpression:!0,path:g.filePath,range:(0,a.convertOffsetsToRange)(p.start,o.TextRange.getEnd(p),g.lines),moduleName:g.moduleName,isInExceptSuite:!1};c.addDeclaration(m),I.set(e,c),P.push(r)}}))}else if(31===(null===(i=t.valueExpression)||void 0===i?void 0:i.nodeType)||52===(null===(r=t.valueExpression)||void 0===r?void 0:r.nodeType)){const n=t.valueExpression,i=new Map,r=31===(null===(h=t.valueExpression)||void 0===h?void 0:h.nodeType)?t.valueExpression.entries:t.valueExpression.expressions,c=void 0===_?0:Math.max(0,r.length-_);r.forEach(((t,n)=>{let r,p,y,h="";s?52===t.nodeType&&2===t.expressions.length?(y=t.expressions[0],r=t.expressions[1],p=(0,m.convertToInstance)(e.getTypeOfExpressionExpectingType(r,!1).type)):e.addError(l.Localizer.Diagnostic.namedTupleNameType(),t):(y=t,p=u.UnknownType.create()),y&&48===y.nodeType?(h=y.strings.map((e=>e.value)).join(""),h||e.addError(l.Localizer.Diagnostic.namedTupleEmptyName(),y)):D=!0,h||(h=`_${n.toString()}`),i.has(h)&&e.addError(l.Localizer.Diagnostic.namedTupleNameUnique(),y||t),i.set(h,h),p||(p=u.UnknownType.create());const f={category:0,name:h,type:p,hasDeclaredType:s,hasDefault:n>=c};u.FunctionType.addParameter(S,f),P.push(p),F.push(h);const T=d.Symbol.createWithType(8,p);if(y&&48===y.nodeType){const e={type:1,node:y,path:g.filePath,typeAnnotationNode:r,range:(0,a.convertOffsetsToRange)(y.start,o.TextRange.getEnd(y),g.lines),moduleName:g.moduleName,isInExceptSuite:!1};T.addDeclaration(e)}I.set(h,T)})),e.setTypeForNode(n)}else D=!0}D&&(S.details.parameters=[],u.FunctionType.addDefaultParameters(S),P.push(u.AnyType.create(!1)),P.push(u.AnyType.create(!0)));const A=u.FunctionType.createSynthesizedInstance("__init__",128);u.FunctionType.addParameter(A,x),u.FunctionType.addDefaultParameters(A),A.details.declaredReturnType=u.NoneType.createInstance(),I.set("__new__",d.Symbol.createWithType(4,S)),I.set("__init__",d.Symbol.createWithType(4,A));const E=u.FunctionType.createSynthesizedInstance("keys"),k=u.FunctionType.createSynthesizedInstance("items");E.details.declaredReturnType=e.getBuiltInObject(t,"list",[e.getBuiltInObject(t,"str")]),k.details.declaredReturnType=E.details.declaredReturnType,I.set("keys",d.Symbol.createWithType(8,E)),I.set("items",d.Symbol.createWithType(8,k));const w=u.FunctionType.createSynthesizedInstance("__len__");if(w.details.declaredReturnType=e.getBuiltInObject(t,"int"),u.FunctionType.addParameter(w,x),I.set("__len__",d.Symbol.createWithType(4,w)),D){const n=u.FunctionType.createSynthesizedInstance("__getattribute__");n.details.declaredReturnType=u.AnyType.create(),u.FunctionType.addParameter(n,x),u.FunctionType.addParameter(n,{category:0,name:"name",type:e.getBuiltInObject(t,"str")}),I.set("__getattribute__",d.Symbol.createWithType(4,n))}const N=e.getBuiltInType(t,"tuple"),M=e.getBuiltInType(t,"str");if(!D&&M&&(0,u.isInstantiableClass)(M)&&N&&(0,u.isInstantiableClass)(N)){const e=F.map((e=>({type:u.ClassType.cloneAsInstance(u.ClassType.cloneWithLiteral(M,e)),isUnbounded:!1}))),t=u.ClassType.cloneAsInstance((0,m.specializeTupleClass)(N,e));I.set("__match_args__",d.Symbol.createWithType(4,t))}return(0,m.computeMroLinearization)(b),y(b,P,!D),b},t.updateNamedTupleBaseClass=y},88855:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParentDirectoryCache=void 0;const s=n(9133),i=n(94647);t.ParentDirectoryCache=class{constructor(e){this._importRootGetter=e,this._importChecked=new Map,this._cachedResults=new Map,this._libPathCache=void 0}getImportResult(e,t,n){var s,i,r,a;const o=null===(s=this._cachedResults.get(t))||void 0===s?void 0:s.get(e);if(o)return null!=o?o:n;const l=null===(i=this._importChecked.get(t))||void 0===i?void 0:i.get(e);return l?l.importPath&&null!==(a=null===(r=this._cachedResults.get(t))||void 0===r?void 0:r.get(l.importPath))&&void 0!==a?a:n:void 0}checkValidPath(e,t,n){var s;return!!t.startsWith(n)&&(this._libPathCache=null!==(s=this._libPathCache)&&void 0!==s?s:this._importRootGetter().map((t=>(0,i.ensureTrailingDirectorySeparator)((0,i.normalizePathCase)(e,(0,i.normalizePath)(t))))).filter((e=>e!==n)).filter((e=>e.startsWith(n))),!this._libPathCache.some((e=>t.startsWith(e))))}checked(e,t,n){(0,s.getOrAdd)(this._importChecked,t,(()=>new Map)).set(e,n)}add(e){(0,s.getOrAdd)(this._cachedResults,e.importName,(()=>new Map)).set(e.path,e.importResult)}reset(){this._importChecked.clear(),this._cachedResults.clear(),this._libPathCache=void 0}}},15297:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ParseTreeCleanerWalker=void 0;const a=r(n(35696)),o=n(22339);class l extends o.ParseTreeWalker{constructor(e){super(),this._parseTree=e}clean(){this.walk(this._parseTree)}visitNode(e){return a.cleanNodeAnalysisInfo(e),super.visitNode(e)}}t.ParseTreeCleanerWalker=l},23241:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getTypeAnnotationForParameter=t.isFunctionSuiteEmpty=t.getFileInfoFromNode=t.getModuleNode=t.isWriteAccess=t.printParseNodeType=t.getTokenOverlapping=t.getTokenAt=t.getCallNodeAndActiveParameterIndex=t.getEnclosingParameter=t.CallNodeWalker=t.NameNodeWalker=t.isAssignmentToDefaultsFollowingNamedTuple=t.isDocString=t.getDocString=t.isWithinAssertExpression=t.isWithinTryBlock=t.isWithinLoop=t.isWithinAnnotationComment=t.isWithinTypeAnnotation=t.isWithinDefaultParamInitializer=t.isPartialMatchingExpression=t.isMatchingExpression=t.isSuiteEmpty=t.isNodeContainedWithinNodeType=t.getParentNodeOfType=t.isNodeContainedWithin=t.isClassVarAllowedForAssignmentTarget=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.getEnclosingSuite=t.printOperator=t.printExpression=t.printArgument=t.getTypeSourceId=t.getClassFullName=t.findNodeByOffset=t.findNodeByPosition=t.getNodeDepth=void 0,t.isUnannotatedFunction=t.getFullStatementRange=t.getStringValueRange=t.getStringNodeValueRange=t.isLastNameOfDottedName=t.isFirstNameOfDottedName=t.getFirstNameOfDottedName=t.getDottedName=t.getDottedNameWithGivenNodeAsLastName=t.getFirstAncestorOrSelf=t.getFirstAncestorOrSelfOfKind=t.isLastNameOfModuleName=t.isFromImportAlias=t.isFromImportName=t.isFromImportModuleName=t.isImportAlias=t.isImportModuleName=void 0;const a=r(n(35696)),o=n(20823),l=n(28348),c=n(80957),p=n(55390),d=n(35696),u=n(22339);function m(e,t){if(t<e.start||t>c.TextRange.getEnd(e))return;const n=(new u.ParseTreeWalker).visitNode(e);for(const s of n)if(s){const n=m(s,t);if(n)return 5===e.nodeType&&n===e.leftExpression?e.destExpression:n}return e}function y(e,t){let n="";return 1===e.argumentCategory?n="*":2===e.argumentCategory&&(n="**"),e.name&&(n+=e.name.value+"="),n+=h(e.valueExpression,t),n}function h(e,t=0){switch(e.nodeType){case 38:return e.value;case 35:return h(e.leftExpression,t)+"."+e.memberName.value;case 9:return h(e.leftExpression,t)+"("+e.arguments.map((e=>y(e,t))).join(", ")+")";case 24:return h(e.baseExpression,t)+"["+e.items.map((e=>y(e,t))).join(", ")+"]"+(e.trailingComma?",":"");case 55:return g(e.operator)+h(e.expression,t);case 7:{const n=h(e.leftExpression,t)+" "+g(e.operator)+" "+h(e.rightExpression,t);return e.parenthesized?`(${n})`:n}case 40:{let t=e.value.toString();return t.endsWith("n")&&(t=t.substring(0,t.length-1)),e.isImaginary&&(t+="j"),t}case 48:return 1&t&&e.typeAnnotation?h(e.typeAnnotation,t):e.strings.map((e=>h(e,t))).join(" ");case 49:{let t="";8&e.token.flags&&(t+="r"),16&e.token.flags&&(t+="u"),32&e.token.flags&&(t+="b"),64&e.token.flags&&(t+="f");const n=32;return 4&e.token.flags?1&e.token.flags?t+=`'''${e.token.escapedValue.substring(0,n)}'''`:t+=`"""${e.token.escapedValue.substring(0,n)}"""`:1&e.token.flags?t+=`'${e.token.escapedValue.substring(0,n)}'`:t+=`"${e.token.escapedValue.substring(0,n)}"`,t}case 3:return h(e.leftExpression,t)+" = "+h(e.rightExpression,t);case 4:return h(e.name,t)+" := "+h(e.rightExpression,t);case 54:return h(e.valueExpression,t)+": "+h(e.typeAnnotation,t);case 5:return h(e.leftExpression,t)+" "+g(e.operator)+" "+h(e.rightExpression,t);case 6:return"await "+h(e.expression,t);case 51:return h(e.ifExpression,t)+" if "+h(e.testExpression,t)+" else "+h(e.elseExpression,t);case 31:return`[${e.entries.map((e=>h(e,t))).join(", ")}]`;case 56:return"*"+h(e.expression,t);case 52:{const n=e.expressions.map((e=>h(e,t)));return 1===n.length?`(${n[0]}, )`:`(${n.join(", ")})`}case 60:return e.expression?"yield "+h(e.expression,t):"yield";case 61:return"yield from "+h(e.expression,t);case 18:return"...";case 32:{let n="<ListExpression>";if((0,p.isExpressionNode)(e.expression))n=h(e.expression,t);else if(17===e.expression.nodeType){n=`${h(e.expression.keyExpression,t)}: ${h(e.expression.valueExpression,t)}`}return n=n+" "+e.forIfNodes.map((e=>33===e.nodeType?(e.isAsync?"async ":"")+"for "+h(e.targetExpression,t)+` in ${h(e.iterableExpression,t)}`:`if ${h(e.testExpression,t)}`)).join(" "),e.isParenthesized?`(${n}})`:n}case 46:{let n="";return e.startValue&&(n+=h(e.startValue,t)),e.endValue&&(n+=": "+h(e.endValue,t)),e.stepValue&&(n+=": "+h(e.stepValue,t)),n}case 30:return"lambda "+e.parameters.map((e=>{let n="";return 1===e.category?n+="*":2===e.category&&(n+="**"),e.name&&(n+=e.name.value),e.defaultValue&&(n+=" = "+h(e.defaultValue,t)),n})).join(", ")+": "+h(e.expression,t);case 11:if(33===e.constType)return"True";if(15===e.constType)return"False";if(9===e.constType)return"__debug__";if(26===e.constType)return"None";break;case 15:{const n=`${e.entries.map((e=>17===e.nodeType?`${h(e.keyExpression,t)}: ${h(e.valueExpression,t)}`:16===e.nodeType?`**${h(e.expandExpression,t)}`:h(e,t)))}`;return n?`{ ${n} }`:"{}"}case 45:return e.entries.map((e=>h(e,t))).join(", ")}return"<Expression>"}function g(e){const t={0:"+",1:"+=",2:"=",3:"&",4:"&=",5:"~",6:"|",7:"|=",8:"^",9:"^=",10:"/",11:"/=",12:"==",13:"//",14:"//=",15:">",16:">=",17:"<<",18:"<<=",19:"<>",20:"<",21:"<=",22:"@",23:"@=",24:"%",25:"%=",26:"*",27:"*=",28:"!=",29:"**",30:"**=",31:">>",32:">>=",33:"-",34:"-=",36:"and",37:"or",38:"not",39:"is",40:"is not",41:"in",42:"not in"};return t[e]?t[e]:"unknown"}function f(e,t=!1){let n=e.parent;for(;n;){if(10===n.nodeType)return n;if(36===n.nodeType)return;if(28===n.nodeType&&t)return;n=n.parent}}function T(e){let t,n=e.parent;for(;n;){if(28===n.nodeType&&!n.decorators.some((e=>e===t)))return n;if(10===n.nodeType)return;t=n,n=n.parent}}function _(e){let t,n,s=e,i=!1;for(;s;){switch(41===s.nodeType&&t===s.name&&(i=!0),s.nodeType){case 28:if(s.parameters.some((e=>e===t))){if(i&&void 0!==(0,d.getScope)(s))return s}else if(t===s.suite&&void 0!==(0,d.getScope)(s))return s;break;case 30:if(s.parameters.some((e=>e===t))){if(i&&void 0!==(0,d.getScope)(s))return s}else if((!t||t===s.expression)&&void 0!==(0,d.getScope)(s))return s;break;case 10:if(t===s.suite&&void 0!==(0,d.getScope)(s))return s;break;case 32:if(void 0!==(0,d.getScope)(s)){if(!(t===s.forIfNodes[0]&&33===s.forIfNodes[0].nodeType&&s.forIfNodes[0].iterableExpression===n))return s}break;case 36:if(void 0!==(0,d.getScope)(s))return s}n=t,t=s,s=s.parent}(0,o.fail)("Did not find evaluation scope")}function v(e,t){let n=e;for(;n;){if(n.nodeType===t)return n;n=n.parent}}function b(e,t){if(38===e.nodeType)return 38===t.nodeType?e.value===t.value:4===t.nodeType&&e.value===t.name.value;if(35===e.nodeType&&35===t.nodeType)return b(e.leftExpression,t.leftExpression)&&e.memberName.value===t.memberName.value;if(24===e.nodeType&&24===t.nodeType){if(!b(e.baseExpression,t.baseExpression))return!1;if(1!==t.items.length||t.trailingComma||t.items[0].name||0!==t.items[0].argumentCategory)return!1;const n=e.items[0].valueExpression;if(40===n.nodeType){const e=t.items[0].valueExpression;return!(40!==e.nodeType||e.isImaginary||!e.isInteger)&&n.value===e.value}if(55===n.nodeType&&33===n.operator&&40===n.expression.nodeType){const e=t.items[0].valueExpression;return!(55!==e.nodeType||33!==e.operator||40!==e.expression.nodeType||e.expression.isImaginary||!e.expression.isInteger)&&n.expression.value===e.expression.value}if(48===n.nodeType){const e=n,s=t.items[0].valueExpression;if(1===e.strings.length&&49===e.strings[0].nodeType&&48===s.nodeType&&1===s.strings.length&&49===s.strings[0].nodeType)return e.strings[0].value===s.strings[0].value}return!1}return!1}function I(e){if(0===e.statements.length||48!==e.statements[0].nodeType)return!1;const t=e.statements[0].strings;return 0!==t.length&&!t.some((e=>0!=(64&e.token.flags)))}t.getNodeDepth=function(e){let t=0,n=e;for(;n;)t++,n=n.parent;return t},t.findNodeByPosition=function(e,t,n){const s=(0,l.convertPositionToOffset)(t,n);if(void 0!==s)return m(e,s)},t.findNodeByOffset=m,t.getClassFullName=function(e,t,n){const s=[n];let i=e;for(;i;)i=f(i),i&&s.push(i.name.value);return s.push(t),s.reverse().join(".")},t.getTypeSourceId=function(e){return e.start},t.printArgument=y,t.printExpression=h,t.printOperator=g,t.getEnclosingSuite=function(e){let t=e.parent;for(;t;){if(50===t.nodeType)return t;t=t.parent}},t.getEnclosingClass=f,t.getEnclosingModule=function(e){let t=e.parent;for(;t;){if(36===t.nodeType)return t;t=t.parent}(0,o.fail)("Module node not found")},t.getEnclosingClassOrModule=function(e,t=!1){let n=e.parent;for(;n;){if(10===n.nodeType)return n;if(36===n.nodeType)return n;if(28===n.nodeType&&t)return;n=n.parent}},t.getEnclosingFunction=T,t.getEnclosingLambda=function(e){let t=e.parent;for(;t;){if(30===t.nodeType)return t;if(50===t.nodeType)return;t=t.parent}},t.getEnclosingClassOrFunction=function(e){let t=e.parent;for(;t;){if(28===t.nodeType)return t;if(10===t.nodeType)return t;t=t.parent}},t.getEnclosingSuiteOrModule=function(e,t=!1,n=!0){let s=e.parent;for(;s;){if(50===s.nodeType)return s;if(36===s.nodeType)return s;if(30===s.nodeType&&n)return;if(28===s.nodeType&&t)return;s=s.parent}},t.getEvaluationNodeForAssignmentExpression=function(e){let t=!1,n=_(e);for(;void 0!==n;)switch(n.nodeType){case 28:case 30:case 36:return n;case 10:return t?void 0:n;case 32:t=!0,n=_(n.parent);break;default:return}},t.getEvaluationScopeNode=_,t.getTypeVarScopeNode=function(e,t=!1){let n,s=e;for(;s;){switch(s.nodeType){case 28:if((n===s.suite||t)&&!s.decorators.some((e=>e===n)))return s;break;case 10:if(n===s.suite&&!s.decorators.some((e=>e===n)))return s}n=s,s=s.parent}},t.getExecutionScopeNode=function(e){let t=_(e);for(;10===t.nodeType||32===t.nodeType;)t=_(t.parent);return t},t.getTypeAnnotationNode=function(e){let t=e,n=e.parent;for(;n;){if(54===n.nodeType){if(n.typeAnnotation===t)return n;break}t=n,n=n.parent}},t.isFinalAllowedForAssignmentTarget=function(e){if(38===e.nodeType)return!0;if(35===e.nodeType){if(38!==e.leftExpression.nodeType)return!1;if(!f(e))return!1;const t=T(e);return!!t&&"__init__"===t.name.value}return!1},t.isClassVarAllowedForAssignmentTarget=function(e){return!!f(e,!0)},t.isNodeContainedWithin=function(e,t){let n=e;for(;n;){if(n===t)return!0;n=n.parent}return!1},t.getParentNodeOfType=v,t.isNodeContainedWithinNodeType=function(e,t){return void 0!==v(e,t)},t.isSuiteEmpty=function(e){let t=!1;for(const n of e.statements){if(47!==n.nodeType)return!1;for(const e of n.statements)if(18===e.nodeType)t=!0;else if(48!==e.nodeType)return!1}return t},t.isMatchingExpression=b,t.isPartialMatchingExpression=function e(t,n){return 35===t.nodeType?b(t.leftExpression,n)||e(t.leftExpression,n):24===t.nodeType&&(b(t.baseExpression,n)||e(t.baseExpression,n))},t.isWithinDefaultParamInitializer=function(e){let t,n=e;for(;n;){if(41===n.nodeType&&t===n.defaultValue)return!0;if(30===n.nodeType||28===n.nodeType||10===n.nodeType||36===n.nodeType)return!1;t=n,n=n.parent}return!1},t.isWithinTypeAnnotation=function(e,t){let n,s=e,i=!1;for(;s;){if(41===s.nodeType&&(n===s.typeAnnotation||n===s.typeAnnotationComment))return i||!t;if(28===s.nodeType&&n===s.returnTypeAnnotation)return i||!t;if(28===s.nodeType&&n===s.functionAnnotationComment)return!0;if(54===s.nodeType&&n===s.typeAnnotation)return i||!t;if(3===s.nodeType&&n===s.typeAnnotationComment)return!0;if(48===s.nodeType&&n===s.typeAnnotation&&(i=!0),30===s.nodeType||28===s.nodeType||10===s.nodeType||36===s.nodeType)return!1;n=s,s=s.parent}return!1},t.isWithinAnnotationComment=function(e){let t,n=e;for(;n;){if(28===n.nodeType&&t===n.functionAnnotationComment)return!0;if(3===n.nodeType&&t===n.typeAnnotationComment)return!0;if(30===n.nodeType||28===n.nodeType||10===n.nodeType||36===n.nodeType)return!1;t=n,n=n.parent}return!1},t.isWithinLoop=function(e){let t=e;for(;t;){switch(t.nodeType){case 26:case 57:return!0}t=t.parent}return!1},t.isWithinTryBlock=function(e,t=!1){let n,s=e;for(;s;){switch(s.nodeType){case 53:return s.trySuite===n;case 58:if(t&&s.suite===n)return!0;break;case 28:case 36:case 10:return!1}n=s,s=s.parent}return!1},t.isWithinAssertExpression=function(e){let t,n=e;for(;n;){if(2===n.nodeType)return n.testExpression===t;t=n,n=n.parent}return!1},t.getDocString=function(e){if(0===e.length)return;if(47!==e[0].nodeType)return;if(!I(e[0]))return;const t=e[0].statements[0].strings;return 1===t.length?t[0].value:t.map((e=>e.value)).join("")},t.isDocString=I,t.isAssignmentToDefaultsFollowingNamedTuple=function(e){var t,n;if(9!==e.nodeType||!e.parent||3!==e.parent.nodeType||38!==e.parent.leftExpression.nodeType||!e.parent.parent||47!==e.parent.parent.nodeType)return!1;const s=e.parent.leftExpression.value,i=e.parent.parent;if(i.statements[0]!==e.parent||!i.parent||36!==i.parent.nodeType&&50!==i.parent.nodeType)return!1;const r=i.parent;let a=r.statements.findIndex((e=>e===i));if(a<0)return!1;for(a++;a<r.statements.length;){const e=r.statements[a];if(47!==e.nodeType)break;if(48!==(null===(t=e.statements[0])||void 0===t?void 0:t.nodeType)){if(3===(null===(n=e.statements[0])||void 0===n?void 0:n.nodeType)){const t=e.statements[0];if(35===t.leftExpression.nodeType&&"__defaults__"===t.leftExpression.memberName.value){const e=t.leftExpression.leftExpression;if(35===e.nodeType&&"__new__"===e.memberName.value&&38===e.leftExpression.nodeType&&e.leftExpression.value===s)return!0}}break}a++}return!1};class C extends u.ParseTreeWalker{constructor(e){super(),this._callback=e}visitName(e){return this._callback(e,this._subscriptIndex,this._baseExpression),!0}visitIndex(e){this.walk(e.baseExpression);const t=this._subscriptIndex,n=this._baseExpression;return this._baseExpression=e.baseExpression,e.items.forEach(((e,t)=>{this._subscriptIndex=t,this.walk(e)})),this._subscriptIndex=t,this._baseExpression=n,!1}}t.NameNodeWalker=C;class S extends u.ParseTreeWalker{constructor(e){super(),this._callback=e}visitCall(e){return this._callback(e),!0}}function F(e,t){const n=e.getItemAtPosition(t);if(!(n<0))return e.getItemAt(n)}function x(e){let t=e;for(;t&&36!==t.nodeType;)t=t.parent;return t}function D(e,t){return P(e,(e=>e.nodeType===t))}function P(e,t){for(const n of function*(e){for(;void 0!==e;)yield e,e=e.parent}(e))if(t(n))return n}function A(e){const t=e.quoteMarkLength,n=!(65536&e.flags);return c.TextRange.create(e.start+t,e.length-t-(n?t:0))}t.CallNodeWalker=S,t.getEnclosingParameter=function(e){let t=e;for(;t;){if(41===t.nodeType)return t;t=t.parent}},t.getCallNodeAndActiveParameterIndex=function(e,t,n){let s,i=e;for(;void 0!==i;){if(9===i.nodeType&&d(i,t)){s=i;break}i=i.parent}if(!s||!s.arguments)return;const r=c.TextRange.getEnd(s);if(t>r)return;const a=F(n,r-1);if(t===r&&14===(null==a?void 0:a.type))return;let o=!1,l=-1,p=!1;return s.arguments.forEach(((e,s)=>{if(o)return;let i=e.start;const r=n.getItemAtPosition(i);r>=0&&(i=c.TextRange.getEnd(n.getItemAt(r-1)));let a=c.TextRange.getEnd(e);const d=n.getItemAtPosition(a);if(d>=0)for(let e=d;e<n.count;e++){const t=n.getItemAt(e);switch(t.type){case 12:case 14:break;default:continue}a=c.TextRange.getEnd(t);break}t<a&&(l=s,p=t>=i,o=!0)})),o||(l=s.arguments.length+1),{callNode:s,activeIndex:l,activeOrFake:p};function d(e,s){let i=!0;const r=e.leftExpression.length>0?c.TextRange.getEnd(e.leftExpression)-1:e.leftExpression.start,a=n.getItemAtPosition(r);if(a>=0&&a+1<n.count){const e=n.getItemAt(a+1);13===e.type&&t<c.TextRange.getEnd(e)&&(i=!1)}return i}},t.getTokenAt=F,t.getTokenOverlapping=function(e,t){const n=e.getItemAtPosition(t);if(n<0)return;const s=e.getItemAt(n);return c.TextRange.overlaps(s,t)?s:void 0},t.printParseNodeType=function(e){switch(e){case 0:return"Error";case 1:return"Argument";case 2:return"Assert";case 3:return"Assignment";case 4:return"AssignmentExpression";case 5:return"AugmentedAssignment";case 6:return"Await";case 7:return"BinaryOperation";case 8:return"Break";case 9:return"Call";case 10:return"Class";case 11:return"Constant";case 12:return"Continue";case 13:return"Decorator";case 14:return"Del";case 15:return"Dictionary";case 16:return"DictionaryExpandEntry";case 17:return"DictionaryKeyEntry";case 18:return"Ellipsis";case 19:return"If";case 20:return"Import";case 21:return"ImportAs";case 22:return"ImportFrom";case 23:return"ImportFromAs";case 24:return"Index";case 25:return"Except";case 26:return"For";case 27:return"FormatString";case 28:return"Function";case 29:return"Global";case 30:return"Lambda";case 31:return"List";case 32:return"ListComprehension";case 33:return"ListComprehensionFor";case 34:return"ListComprehensionIf";case 35:return"MemberAccess";case 36:return"Module";case 37:return"ModuleName";case 38:return"Name";case 39:return"Nonlocal";case 40:return"Number";case 41:return"Parameter";case 42:return"Pass";case 43:return"Raise";case 44:return"Return";case 45:return"Set";case 46:return"Slice";case 47:return"StatementList";case 48:return"StringList";case 49:return"String";case 50:return"Suite";case 51:return"Ternary";case 52:return"Tuple";case 53:return"Try";case 54:return"TypeAnnotation";case 55:return"UnaryOperation";case 56:return"Unpack";case 57:return"While";case 58:return"With";case 59:return"WithItem";case 60:return"Yield";case 61:return"YieldFrom";case 62:return"FunctionAnnotation";case 63:return"Match";case 64:return"Case";case 65:return"PatternSequence";case 66:return"PatternAs";case 67:return"PatternLiteral";case 68:return"PatternClass";case 69:return"PatternCapture";case 70:return"PatternMapping";case 71:return"PatternMappingKeyEntry";case 72:return"PatternMappingExpandEntry";case 73:return"PatternValue";case 74:return"PatternClassArgument"}(0,o.assertNever)(e)},t.isWriteAccess=function(e){let t=e,n=t.parent;for(;n;){switch(n.nodeType){case 3:case 5:return t===n.leftExpression;case 4:case 25:return t===n.name;case 14:return!0;case 26:case 33: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 58:return n.withItems.some((e=>e===t));case 54:if(t===n.typeAnnotation)return!1;break;case 28:case 10:case 36:return!1}t=n,n=n.parent}return!1},t.getModuleNode=x,t.getFileInfoFromNode=function(e){const t=x(e);return t?a.getFileInfo(t):void 0},t.isFunctionSuiteEmpty=function(e){let t=!0;return e.suite.statements.forEach((e=>{0!==e.nodeType&&(47===e.nodeType?e.statements.forEach((e=>{18!==e.nodeType&&48!==e.nodeType&&42!==e.nodeType&&(t=!1)})):t=!1)})),t},t.getTypeAnnotationForParameter=function(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 s=0;const i=e.functionAnnotationComment.paramTypeAnnotations;i.length<e.parameters.length&&(s=1);const r=t-s;return r<0||r>=i.length?void 0:i[r]},t.isImportModuleName=function(e){var t,n;return 21===(null===(n=null===(t=D(e,37))||void 0===t?void 0:t.parent)||void 0===n?void 0:n.nodeType)},t.isImportAlias=function(e){var t;return 21===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&e.parent.alias===e},t.isFromImportModuleName=function(e){var t,n;return 22===(null===(n=null===(t=D(e,37))||void 0===t?void 0:t.parent)||void 0===n?void 0:n.nodeType)},t.isFromImportName=function(e){var t;return 23===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&e.parent.name===e},t.isFromImportAlias=function(e){var t;return 23===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&e.parent.alias===e},t.isLastNameOfModuleName=function(e){var t;if(37!==(null===(t=e.parent)||void 0===t?void 0:t.nodeType))return!1;const n=e.parent;return 0!==n.nameParts.length&&n.nameParts[n.nameParts.length-1]===e},t.getFirstAncestorOrSelfOfKind=D,t.getFirstAncestorOrSelf=P,t.getDottedNameWithGivenNodeAsLastName=function(e){var t;return 35!==(null===(t=e.parent)||void 0===t?void 0:t.nodeType)||e.parent.leftExpression===e?e:e.parent},t.getDottedName=function(e){if(38===e.nodeType)return[e];const t=[];return function e(t,n){if(38===t.nodeType)return n.push(t),!0;if(n.push(t.memberName),38===t.leftExpression.nodeType||35===t.leftExpression.nodeType)return e(t.leftExpression,n);return!1}(e,t)?t.reverse():void 0},t.getFirstNameOfDottedName=function e(t){return 38===t.nodeType?t:38===t.leftExpression.nodeType||35===t.leftExpression.nodeType?e(t.leftExpression):void 0},t.isFirstNameOfDottedName=function(e){var t;return 35!==(null===(t=e.parent)||void 0===t?void 0:t.nodeType)||e.parent.leftExpression===e},t.isLastNameOfDottedName=function(e){var t,n;return 35!==(null===(t=e.parent)||void 0===t?void 0:t.nodeType)||(38===e.parent.leftExpression.nodeType||35===e.parent.leftExpression.nodeType)&&(e.parent.leftExpression!==e&&35!==(null===(n=e.parent.parent)||void 0===n?void 0:n.nodeType))},t.getStringNodeValueRange=function(e){return A(e.token)},t.getStringValueRange=A,t.getFullStatementRange=function(e,t){const n=(0,l.convertTextRangeToRange)(e,t.lines),s=function(e,t,n){const s=n.tokens.getItemAtPosition(t);if(s<0)return;let i=s;for(;i<n.tokens.count;i++){const t=n.tokens.getItemAt(i),s=(0,l.convertTextRangeToRange)(t,n.lines);if(e.end.line!==s.start.line)break}for(let e=s;e<i;e++){const t=n.tokens.getItemAt(e);if(11===t.type||2===t.type)continue;return(0,l.convertTextRangeToRange)(t,n.lines).start}return}(n,c.TextRange.getEnd(e),t);return s?{start:n.start,end:s}:n.end.line===t.lines.count-1?n:{start:n.start,end:{line:n.end.line+1,character:0}}},t.isUnannotatedFunction=function(e){return void 0===e.returnTypeAnnotation&&e.parameters.every((e=>void 0===e.typeAnnotation&&void 0===e.typeAnnotationComment))}},22339:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ParseTreeWalker=void 0;t.ParseTreeWalker=class{walk(e){const t=this.visitNode(e);t.length>0&&this.walkMultiple(t)}walkMultiple(e){e.forEach((e=>{e&&this.walk(e)}))}visitNode(e){var t;switch(e.nodeType){case 0:return this.visitError(e)?[e.child,...null!==(t=e.decorators)&&void 0!==t?t:[]]:[];case 1:return this.visitArgument(e)?[e.name,e.valueExpression]:[];case 2:return this.visitAssert(e)?[e.testExpression,e.exceptionExpression]:[];case 4:return this.visitAssignmentExpression(e)?[e.name,e.rightExpression]:[];case 3:return this.visitAssignment(e)?[e.leftExpression,e.rightExpression,e.typeAnnotationComment]:[];case 5:return this.visitAugmentedAssignment(e)?[e.leftExpression,e.rightExpression]:[];case 6:return this.visitAwait(e)?[e.expression]:[];case 7:return this.visitBinaryOperation(e)?[e.leftExpression,e.rightExpression]:[];case 8:return this.visitBreak(e),[];case 9:return this.visitCall(e)?[e.leftExpression,...e.arguments]:[];case 64:return this.visitCase(e)?[e.pattern,e.guardExpression,e.suite]:[];case 10:return this.visitClass(e)?[...e.decorators,e.name,...e.arguments,e.suite]:[];case 11:return this.visitConstant(e),[];case 12:return this.visitContinue(e),[];case 13:return this.visitDecorator(e)?[e.expression]:[];case 14:return this.visitDel(e)?e.expressions:[];case 15:return this.visitDictionary(e)?e.entries:[];case 16:return this.visitDictionaryExpandEntry(e)?[e.expandExpression]:[];case 17:return this.visitDictionaryKeyEntry(e)?[e.keyExpression,e.valueExpression]:[];case 18:return this.visitEllipsis(e),[];case 19:return this.visitIf(e)?[e.testExpression,e.ifSuite,e.elseSuite]:[];case 20:return this.visitImport(e)?e.list:[];case 21:return this.visitImportAs(e)?[e.module,e.alias]:[];case 22:return this.visitImportFrom(e)?[e.module,...e.imports]:[];case 23:return this.visitImportFromAs(e)?[e.name,e.alias]:[];case 24:return this.visitIndex(e)?[e.baseExpression,...e.items]:[];case 25:return this.visitExcept(e)?[e.typeExpression,e.name,e.exceptSuite]:[];case 26:return this.visitFor(e)?[e.targetExpression,e.iterableExpression,e.forSuite,e.elseSuite]:[];case 27:return this.visitFormatString(e)?e.expressions:[];case 28:return this.visitFunction(e)?[...e.decorators,e.name,...e.parameters,e.returnTypeAnnotation,e.functionAnnotationComment,e.suite]:[];case 62:return this.visitFunctionAnnotation(e)?[...e.paramTypeAnnotations,e.returnTypeAnnotation]:[];case 29:return this.visitGlobal(e)?e.nameList:[];case 30:return this.visitLambda(e)?[...e.parameters,e.expression]:[];case 31:return this.visitList(e)?e.entries:[];case 32:return this.visitListComprehension(e)?[e.expression,...e.forIfNodes]:[];case 33:return this.visitListComprehensionFor(e)?[e.targetExpression,e.iterableExpression]:[];case 34:return this.visitListComprehensionIf(e)?[e.testExpression]:[];case 63:return this.visitMatch(e)?[e.subjectExpression,...e.cases]:[];case 35:return this.visitMemberAccess(e)?[e.leftExpression,e.memberName]:[];case 37:return this.visitModuleName(e)?e.nameParts:[];case 36:return this.visitModule(e)?[...e.statements]:[];case 38:return this.visitName(e),[];case 39:return this.visitNonlocal(e)?e.nameList:[];case 40:return this.visitNumber(e),[];case 41:return this.visitParameter(e)?[e.name,e.typeAnnotation,e.typeAnnotationComment,e.defaultValue]:[];case 42:return this.visitPass(e),[];case 66:return this.visitPatternAs(e)?[...e.orPatterns,e.target]:[];case 68:return this.visitPatternClass(e)?[e.className,...e.arguments]:[];case 74:return this.visitPatternClassArgument(e)?[e.name,e.pattern]:[];case 69:return this.visitPatternCapture(e)?[e.target]:[];case 67:return this.visitPatternLiteral(e)?[e.expression]:[];case 72:return this.visitPatternMappingExpandEntry(e)?[e.target]:[];case 71:return this.visitPatternMappingKeyEntry(e)?[e.keyPattern,e.valuePattern]:[];case 70:return this.visitPatternMapping(e)?[...e.entries]:[];case 65:return this.visitPatternSequence(e)?[...e.entries]:[];case 73:return this.visitPatternValue(e)?[e.expression]:[];case 43:return this.visitRaise(e)?[e.typeExpression,e.valueExpression,e.tracebackExpression]:[];case 44:return this.visitReturn(e)?[e.returnExpression]:[];case 45:return this.visitSet(e)?e.entries:[];case 46:return this.visitSlice(e)?[e.startValue,e.endValue,e.stepValue]:[];case 47:return this.visitStatementList(e)?e.statements:[];case 48:return this.visitStringList(e)?[e.typeAnnotation,...e.strings]:[];case 49:return this.visitString(e),[];case 50:return this.visitSuite(e)?[...e.statements]:[];case 51:return this.visitTernary(e)?[e.ifExpression,e.testExpression,e.elseExpression]:[];case 52:return this.visitTuple(e)?e.expressions:[];case 53:return this.visitTry(e)?[e.trySuite,...e.exceptClauses,e.elseSuite,e.finallySuite]:[];case 54:return this.visitTypeAnnotation(e)?[e.valueExpression,e.typeAnnotation]:[];case 55:return this.visitUnaryOperation(e)?[e.expression]:[];case 56:return this.visitUnpack(e)?[e.expression]:[];case 57:return this.visitWhile(e)?[e.testExpression,e.whileSuite,e.elseSuite]:[];case 58:return this.visitWith(e)?[...e.withItems,e.suite]:[];case 59:return this.visitWithItem(e)?[e.expression,e.target]:[];case 60:return this.visitYield(e)?[e.expression]:[];case 61:return this.visitYieldFrom(e)?[e.expression]:[]}}visitArgument(e){return!0}visitAssert(e){return!0}visitAssignment(e){return!0}visitAssignmentExpression(e){return!0}visitAugmentedAssignment(e){return!0}visitAwait(e){return!0}visitBinaryOperation(e){return!0}visitBreak(e){return!0}visitCall(e){return!0}visitCase(e){return!0}visitClass(e){return!0}visitTernary(e){return!0}visitContinue(e){return!0}visitConstant(e){return!0}visitDecorator(e){return!0}visitDel(e){return!0}visitDictionary(e){return!0}visitDictionaryKeyEntry(e){return!0}visitDictionaryExpandEntry(e){return!0}visitError(e){return!0}visitEllipsis(e){return!0}visitIf(e){return!0}visitImport(e){return!0}visitImportAs(e){return!0}visitImportFrom(e){return!0}visitImportFromAs(e){return!0}visitIndex(e){return!0}visitExcept(e){return!0}visitFor(e){return!0}visitFormatString(e){return!0}visitFunction(e){return!0}visitFunctionAnnotation(e){return!0}visitGlobal(e){return!0}visitLambda(e){return!0}visitList(e){return!0}visitListComprehension(e){return!0}visitListComprehensionFor(e){return!0}visitListComprehensionIf(e){return!0}visitMatch(e){return!0}visitMemberAccess(e){return!0}visitModule(e){return!0}visitModuleName(e){return!0}visitName(e){return!0}visitNonlocal(e){return!0}visitNumber(e){return!0}visitParameter(e){return!0}visitPass(e){return!0}visitPatternCapture(e){return!0}visitPatternClass(e){return!0}visitPatternClassArgument(e){return!0}visitPatternAs(e){return!0}visitPatternLiteral(e){return!0}visitPatternMappingExpandEntry(e){return!0}visitPatternSequence(e){return!0}visitPatternValue(e){return!0}visitPatternMappingKeyEntry(e){return!0}visitPatternMapping(e){return!0}visitRaise(e){return!0}visitReturn(e){return!0}visitSet(e){return!0}visitSlice(e){return!0}visitStatementList(e){return!0}visitString(e){return!0}visitStringList(e){return!0}visitSuite(e){return!0}visitTuple(e){return!0}visitTry(e){return!0}visitTypeAnnotation(e){return!0}visitUnaryOperation(e){return!0}visitUnpack(e){return!0}visitWhile(e){return!0}visitWith(e){return!0}visitWithItem(e){return!0}visitYield(e){return!0}visitYieldFrom(e){return!0}}},97374:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateClassPattern=t.assignTypeToPatternTargets=t.narrowTypeBasedOnPattern=void 0;const s=n(9133),i=n(20823),r=n(15741),a=n(74426),o=n(35696),l=n(22387),c=n(89806),p=n(59195),d=n(10425),u=n(58922),m=["builtins.bool","builtins.bytearray","builtins.bytes","builtins.dict","builtins.float","builtins.frozenset","builtins.int","builtins.list","builtins.set","builtins.str","builtins.tuple"];function y(e,t,n,i){switch(n.nodeType){case 65:return function(e,t,n,i){let r=T(e,t,n.entries.length,n.starEntryIndex);return r=r.filter((t=>{if(t.definiteNoMatch)return!i;let r=!0,a=!0;const o=[];let l=t.isTuple;if(t.isIndeterminateLength&&(1===n.entries.length&&0===n.starEntryIndex||(a=!1)),n.entries.forEach(((c,u)=>{const m=_(e,n,t,u,n.entries.length,n.starEntryIndex,!0,!1),h=y(e,m,c,i);i?u===n.starEntryIndex?(0,p.isClassInstance)(h)&&h.tupleTypeArguments&&!(0,d.isUnboundedTupleClass)(h)&&h.tupleTypeArguments?(0,s.appendArray)(o,h.tupleTypeArguments.map((e=>e.type))):(o.push(h),l=!1):(o.push(h),(0,p.isNever)(h)&&(r=!1)):(0,p.isNever)(h)&&!(0,p.isAnyOrUnknown)(m)||(a=!1)})),!i)return!a;if(r){if(l){const s=e.getBuiltInType(n,"tuple");s&&(0,p.isInstantiableClass)(s)&&(t.subtype=p.ClassType.cloneAsInstance((0,d.specializeTupleClass)(s,o.map((e=>({type:e,isUnbounded:!1}))))))}if(t.isObject){const s=e.getTypingType(n,"Sequence");s&&(0,p.isInstantiableClass)(s)&&(t.subtype=p.ClassType.cloneAsInstance(p.ClassType.cloneForSpecialization(s,[(0,d.stripLiteralValue)((0,p.combineTypes)(o))],!0)))}}return r})),(0,p.combineTypes)(r.map((e=>e.subtype)))}(e,t,n,i);case 67:return function(e,t,n,s){const i=e.getTypeOfExpression(n.expression).type;if(!s)return(0,d.mapSubtypes)(t,(t=>{if(!((0,p.isClassInstance)(i)&&(0,d.isLiteralType)(i)&&(0,p.isClassInstance)(t)&&(0,d.isLiteralType)(t)&&e.canAssignType(i,t)||(0,p.isNoneInstance)(t)&&(0,p.isNoneInstance)(i)))return(0,p.isClassInstance)(t)&&p.ClassType.isBuiltIn(t,"bool")&&void 0===t.literalValue&&(0,p.isClassInstance)(i)&&p.ClassType.isBuiltIn(i,"bool")&&void 0!==i.literalValue?p.ClassType.cloneWithLiteral(i,!i.literalValue):t}));return(0,d.mapSubtypes)(t,(t=>{if(e.canAssignType(t,i))return i}))}(e,t,n,i);case 68:return function(e,t,n,s){let i=e.getTypeOfExpression(n.className,2).type;(0,p.isClass)(i)&&!i.typeAliasInfo&&(i=(0,d.specializeClassType)(i));if(!s){if(!(0,p.isInstantiableClass)(i))return t;let r=i;r.details.typeParameters.length>0&&(r=p.ClassType.cloneForSpecialization(r,void 0,!1));const a=(0,d.convertToInstance)(r);return e.mapSubtypesExpandTypeVars(t,void 0,((t,i)=>{if(!(0,p.isClassInstance)(t))return i;if(!e.canAssignType(a,t))return t;if(0===n.arguments.length)return;if(!e.canAssignType(t,a)&&!p.ClassType.isFinal(t))return t;let r=[];n.arguments.some((e=>!e.name))&&(0,p.isClass)(t)&&(r=h(e,t));for(let a=0;a<n.arguments.length;a++){const o=g(e,n.arguments[a],a,r,t,s);if(!(0,p.isNever)(o))return i}}))}if(!p.TypeBase.isInstantiable(i))return e.addDiagnostic((0,o.getFileInfo)(n).diagnosticRuleSet.reportGeneralTypeIssues,r.DiagnosticRule.reportGeneralTypeIssues,a.Localizer.DiagnosticAddendum.typeNotClass().format({type:e.printType(i)}),n.className),p.NeverType.createNever();return e.mapSubtypesExpandTypeVars(i,void 0,((i,r)=>(0,p.isAnyOrUnknown)(i)?r:(0,p.isInstantiableClass)(i)?e.mapSubtypesExpandTypeVars(t,void 0,(t=>{if((0,p.isAnyOrUnknown)(t))return(0,d.convertToInstance)(r);if((0,p.isClassInstance)(t)){let a;if(e.canAssignType(i,p.ClassType.cloneAsInstantiable(t)))a=t;else{if(!e.canAssignType(p.ClassType.cloneAsInstantiable(t),i))return;if(a=(0,d.addConditionToType)((0,d.convertToInstance)(r),(0,d.getTypeCondition)(t)),(0,p.isInstantiableClass)(r)&&(0,p.isClassInstance)(t)&&(p.ClassType.isSpecialBuiltIn(r)||r.details.typeParameters.length>0)){const n=new u.TypeVarContext((0,d.getTypeVarScopeId)(r)),s=p.ClassType.cloneForSpecialization(r,void 0,!1),i=p.ClassType.cloneAsInstance(s);e.populateTypeVarContextBasedOnExpectedType(i,t,n,[])&&(a=(0,d.applySolvedTypeVars)(i,n,!0))}}let o=[];n.arguments.some((e=>!e.name))&&(o=h(e,i));let l=!0;if(n.arguments.forEach(((t,n)=>{const i=g(e,t,n,o,a,s);(0,p.isNever)(i)&&(l=!1)})),l)return a}})):void 0))}(e,t,n,i);case 66:return function(e,t,n,s){let i=t;if(!s)return n.orPatterns.forEach((t=>{i=y(e,i,t,!1)})),i;const r=n.orPatterns.map((t=>{const n=y(e,i,t,!0);return i=y(e,i,t,!1),n}));return(0,p.combineTypes)(r)}(e,t,n,i);case 70:return function(e,t,n,s){if(!s)return t;let i=f(e,t);return i=i.filter((t=>{let i=!0;return n.entries.forEach((r=>{if(t.typedDict){if(71===r.nodeType){const a=y(e,e.getBuiltInObject(n,"str"),r.keyPattern,s);(0,p.isNever)(a)&&(i=!1);const o=(0,d.mapSubtypes)(a,(n=>{if((0,p.isAnyOrUnknown)(n))return n;if((0,p.isClassInstance)(n)&&p.ClassType.isBuiltIn(n,"str")){if(!(0,d.isLiteralType)(n))return p.UnknownType.create();const s=(0,l.getTypedDictMembersForClass)(e,t.typedDict).get(n.literalValue);if(s){const t=y(e,s.valueType,r.valuePattern,!0);if(!(0,p.isNever)(t))return t}}}));(0,p.isNever)(o)&&(i=!1)}}else if(t.dictTypeArgs&&71===r.nodeType){const n=y(e,t.dictTypeArgs.key,r.keyPattern,s),a=y(e,t.dictTypeArgs.value,r.valuePattern,s);((0,p.isNever)(n)||(0,p.isNever)(a))&&(i=!1)}})),i})),(0,p.combineTypes)(i.map((e=>e.subtype)))}(e,t,n,i);case 73:return function(e,t,n,s){const i=e.getTypeOfExpression(n.expression).type,r=[];return e.mapSubtypesExpandTypeVars(i,void 0,((i,a)=>{r.push(e.mapSubtypesExpandTypeVars(t,(0,d.getTypeCondition)(i),(t=>{if(!s){if((0,p.isClassInstance)(t)&&p.ClassType.isEnumClass(t)&&!(0,d.isLiteralType)(t)&&(0,p.isClassInstance)(i)&&(0,p.isSameWithoutLiteralValue)(t,i)&&(0,d.isLiteralType)(i)){const n=(0,c.enumerateLiteralsForType)(e,t);if(n)return(0,p.combineTypes)(n.filter((e=>!p.ClassType.isLiteralValueSame(i,e))))}else if((0,p.isClassInstance)(t)&&(0,p.isClassInstance)(i)&&p.ClassType.isLiteralValueSame(i,t))return;return t}if((0,p.isNever)(i)||(0,p.isNever)(t))return p.NeverType.createNever();if((0,p.isAnyOrUnknown)(i)||(0,p.isAnyOrUnknown)(t))return(0,p.isUnknown)(i)||(0,p.isUnknown)(t)?p.UnknownType.create():p.AnyType.create();return e.useSpeculativeMode(n.expression,(()=>e.getTypeOfMagicMethodReturn(i,[t],"__eq__",n.expression,void 0)))?a:void 0})))})),(0,p.combineTypes)(r)}(e,t,n,i);case 69:return i?t:p.NeverType.createNever();case 0:return t}}function h(e,t){const n=(0,d.lookUpClassMember)(t,"__match_args__");if(n){const t=e.getTypeOfMember(n);if((0,p.isClassInstance)(t)&&(0,d.isTupleClass)(t)&&!(0,d.isUnboundedTupleClass)(t)&&t.tupleTypeArguments){const e=t.tupleTypeArguments;if(e.every((e=>(0,p.isClassInstance)(e.type)&&p.ClassType.isBuiltIn(e.type,"str")&&(0,d.isLiteralType)(e.type))))return e.map((e=>e.type.literalValue))}}return[]}function g(e,t,n,s,i,r){var a;let o;if(t.name?o=t.name.value:n<s.length&&(o=s[n]),(0,p.isAnyOrUnknown)(i))return i;if(!(0,p.isClass)(i))return p.UnknownType.create();let l;if((0,p.isClass)(i)&&m.some((e=>i.details.fullName===e))&&0===n&&!t.name)l=p.ClassType.cloneAsInstance(i);else if(o&&(l=null===(a=e.useSpeculativeMode(t,(()=>e.getTypeOfObjectMember(t,p.ClassType.cloneAsInstance(i),o))))||void 0===a?void 0:a.type),!l){if(!r)return i;if(p.ClassType.isFinal(i))return p.NeverType.createNever();l=p.UnknownType.create()}return y(e,l,t.pattern,r)}function f(e,t){const n=[];return(0,d.doForEachSubtype)(t,(t=>{const s=e.makeTopLevelTypeVarsConcrete(t);if((0,p.isAnyOrUnknown)(s))n.push({subtype:t,dictTypeArgs:{key:s,value:s}});else if((0,p.isClassInstance)(s))if(p.ClassType.isTypedDictClass(s))n.push({subtype:t,typedDict:s});else{let e;for(const t of s.details.mro)if((0,p.isInstantiableClass)(t)&&p.ClassType.isBuiltIn(t,"Mapping")){e=t;break}if(e){const i=(0,d.partiallySpecializeType)(e,s);i.typeArguments&&i.typeArguments.length>=2&&n.push({subtype:t,dictTypeArgs:{key:i.typeArguments[0],value:i.typeArguments[1]}})}}})),n}function T(e,t,n,s){const i=[],r=void 0===s?n:n-1;return(0,d.doForEachSubtype)(t,(t=>{const n=e.makeTopLevelTypeVarsConcrete(t);let a,o=!1;if((0,p.isAnyOrUnknown)(n))i.push({subtype:t,entryTypes:[n],isIndeterminateLength:!0,definiteNoMatch:!1});else{if((0,p.isClassInstance)(n)){if(p.ClassType.isBuiltIn(n,"object"))return void i.push({subtype:t,entryTypes:[(0,d.convertToInstance)(n)],isIndeterminateLength:!0,isObject:!0,definiteNoMatch:!1});for(const e of n.details.mro){if(!(0,p.isInstantiableClass)(e))break;if(p.ClassType.isBuiltIn(e,"str")||p.ClassType.isBuiltIn(e,"bytes")||p.ClassType.isBuiltIn(e,"bytearray"))break;if(p.ClassType.isBuiltIn(e,"Sequence")){a=e;break}if((0,d.isTupleClass)(e)){a=e;break}}if(a){const e=(0,d.partiallySpecializeType)(a,n);(0,d.isTupleClass)(e)?e.tupleTypeArguments&&((0,d.isUnboundedTupleClass)(e)?(i.push({subtype:t,entryTypes:[(0,p.combineTypes)(e.tupleTypeArguments.map((e=>e.type)))],isIndeterminateLength:!0,isTuple:!0,definiteNoMatch:!1}),o=!0):e.tupleTypeArguments.length>=r&&(void 0!==s||e.tupleTypeArguments.length===r)&&(i.push({subtype:t,entryTypes:e.tupleTypeArguments.map((e=>e.type)),isIndeterminateLength:!1,isTuple:!0,definiteNoMatch:!1}),o=!0)):(i.push({subtype:t,entryTypes:[e.typeArguments&&e.typeArguments.length>0?e.typeArguments[0]:p.UnknownType.create()],isIndeterminateLength:!0,definiteNoMatch:!1}),o=!0)}}o||i.push({subtype:t,entryTypes:[],isIndeterminateLength:!0,definiteNoMatch:!0})}})),i}function _(e,t,n,s,r,a,o,l){if(n.isIndeterminateLength){let i=n.entryTypes[0];if(l){const n=e.getBuiltInObject(t,"object");n&&(0,p.isClassInstance)(n)&&(i=n)}return o||s!==a||(0,p.isNever)(i)||(i=v(e,t,i)),i}if(void 0===a||s<a)return n.entryTypes[s];if(s===a){const s=n.entryTypes.slice(a,a+n.entryTypes.length-r+1).map((e=>(0,d.stripLiteralValue)(e)));let i=(0,p.combineTypes)(s);return o||(i=v(e,t,i)),i}const c=n.entryTypes.length-(r-s);return(0,i.assert)(c>=0&&c<n.entryTypes.length),n.entryTypes[c]}function v(e,t,n){if((0,p.isNever)(n))return n;const s=(0,d.convertToInstance)(e.getBuiltInObject(t,"list"));return s&&(0,p.isClassInstance)(s)?p.ClassType.cloneForSpecialization(s,[n],!0):p.UnknownType.create()}t.narrowTypeBasedOnPattern=y,t.assignTypeToPatternTargets=function e(t,n,s,i,r){switch(n=y(t,n,r,!0),r.nodeType){case 65:{const a=T(t,n,r.entries.length,r.starEntryIndex).filter((e=>!e.definiteNoMatch));r.entries.forEach(((n,o)=>{const l=(0,p.combineTypes)(a.map((e=>_(t,r,e,o,r.entries.length,r.starEntryIndex,!1,i))));e(t,l,s,!1,n)}));break}case 66:r.target&&t.assignTypeToExpression(r.target,n,s,r.target),r.orPatterns.forEach((r=>{e(t,n,s,i,r),n=y(t,n,r,!1)}));break;case 69:t.assignTypeToExpression(r.target,r.isWildcard?p.AnyType.create():n,s,r.target);break;case 70:{const i=f(t,n);r.entries.forEach((n=>{const a=[],o=[];i.forEach((e=>{if(e.typedDict)if(71===n.nodeType){const s=y(t,t.getBuiltInObject(r,"str"),n.keyPattern,!0);a.push(s),(0,d.doForEachSubtype)(s,(n=>{if((0,p.isClassInstance)(n)&&p.ClassType.isBuiltIn(n,"str")&&(0,d.isLiteralType)(n)){const s=(0,l.getTypedDictMembersForClass)(t,e.typedDict).get(n.literalValue);o.push(s?s.valueType:p.UnknownType.create())}else o.push(p.UnknownType.create())}))}else 72===n.nodeType&&(a.push(t.getBuiltInObject(r,"str")),o.push(p.UnknownType.create()));else if(e.dictTypeArgs)if(71===n.nodeType){const s=y(t,e.dictTypeArgs.key,n.keyPattern,!0);a.push(s),o.push(y(t,e.dictTypeArgs.value,n.valuePattern,!0))}else 72===n.nodeType&&(a.push(e.dictTypeArgs.key),o.push(e.dictTypeArgs.value))}));const c=(0,p.combineTypes)(a),u=(0,p.combineTypes)(o);if(71===n.nodeType)e(t,c,s,!1,n.keyPattern),e(t,u,s,!1,n.valuePattern);else if(72===n.nodeType){const e=t.getBuiltInType(r,"dict"),i=t.getBuiltInObject(r,"str"),a=e&&(0,p.isInstantiableClass)(e)&&(0,p.isClassInstance)(i)?p.ClassType.cloneAsInstance(p.ClassType.cloneForSpecialization(e,[c,u],!0)):p.UnknownType.create();t.assignTypeToExpression(n.target,a,s,n.target)}}));break}case 68:{const i=r.arguments.map((e=>[]));t.mapSubtypesExpandTypeVars(n,void 0,(e=>{(0,p.isClassInstance)(e)?(0,d.doForEachSubtype)(n,(n=>{const s=t.makeTopLevelTypeVarsConcrete(n);if((0,p.isAnyOrUnknown)(s))r.arguments.forEach(((e,t)=>{i[t].push(s)}));else if((0,p.isClassInstance)(s)){let n=[];r.arguments.some((e=>!e.name))&&(n=h(t,p.ClassType.cloneAsInstantiable(e))),r.arguments.forEach(((s,r)=>{const a=g(t,s,r,n,p.ClassType.cloneAsInstantiable(e),!0);i[r].push(a)}))}})):r.arguments.forEach(((e,t)=>{i[t].push(p.UnknownType.create())}))})),r.arguments.forEach(((n,r)=>{e(t,(0,p.combineTypes)(i[r]),s,!1,n.pattern)}));break}}},t.validateClassPattern=function(e,t){const n=e.getTypeOfExpression(t.className,2).type;if(!(0,p.isAnyOrUnknown)(n))if(n.typeAliasInfo&&(0,p.isInstantiableClass)(n)&&n.typeArguments&&n.isTypeArgumentExplicit)e.addDiagnostic((0,o.getFileInfo)(t).diagnosticRuleSet.reportGeneralTypeIssues,r.DiagnosticRule.reportGeneralTypeIssues,a.Localizer.Diagnostic.classPatternTypeAlias().format({type:e.printType(n)}),t.className);else if(!(0,p.isInstantiableClass)(n)||n.includeSubclasses)e.addDiagnostic((0,o.getFileInfo)(t).diagnosticRuleSet.reportGeneralTypeIssues,r.DiagnosticRule.reportGeneralTypeIssues,a.Localizer.DiagnosticAddendum.typeNotClass().format({type:e.printType(n)}),t.className);else{m.some((e=>n.details.fullName===e))&&(t.arguments.length>1?e.addDiagnostic((0,o.getFileInfo)(t).diagnosticRuleSet.reportGeneralTypeIssues,r.DiagnosticRule.reportGeneralTypeIssues,a.Localizer.Diagnostic.classPatternBuiltInArgCount(),t.arguments[1]):1===t.arguments.length&&t.arguments[0].name&&e.addDiagnostic((0,o.getFileInfo)(t).diagnosticRuleSet.reportGeneralTypeIssues,r.DiagnosticRule.reportGeneralTypeIssues,a.Localizer.Diagnostic.classPatternBuiltInArgPositional(),t.arguments[0].name))}}},73054:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Program=t.MaxWorkspaceIndexFileCount=void 0;const a=n(84655),o=n(29335),l=n(30922),c=n(38213),p=n(9133),d=n(11043),u=n(20823),m=n(77134),y=n(94647),h=n(28348),g=n(14551),f=n(80957),T=n(76962),_=n(82615),v=n(30424),b=n(80088),I=n(9272),C=n(5165),S=n(67906),F=r(n(35696)),x=n(41563),D=n(23241),P=n(57203),A=n(54549),E=n(93989),k=n(91197),w=n(25997),N=n(96938),M=n(96786);t.MaxWorkspaceIndexFileCount=2e3;class R{constructor(e,t,n,s,i,r){this._extension=s,this._disableChecker=r,this._sourceFileList=[],this._sourceFileMap=new Map,this._parsedFileCount=0,this._lookUpImport=e=>{var t;let n;if("string"==typeof e)n=this._getSourceFileInfoFromPath(e);else{const t=this._importResolver.resolveImport(e.importingFilePath,this._configOptions.findExecEnvironment(e.importingFilePath),{leadingDots:0,nameParts:e.nameParts,importedSymbols:void 0});if(t.isImportFound&&!t.isNativeLib&&t.resolvedPaths.length>0){let e=t.resolvedPaths[t.resolvedPaths.length-1];e&&(n=this._getSourceFileInfoFromPath(e),n||(e=(0,y.normalizePathCase)(this._fs,e),this.addTrackedFile(e),n=this._getSourceFileInfoFromPath(e)))}}if(!n)return;n.sourceFile.isBindingRequired()&&T.timingStats.typeCheckerTime.subtractFromTime((()=>{this._bindFile(n)}));const s=n.sourceFile.getModuleSymbolTable();if(!s)return;const i=n.sourceFile.getParseResults(),r=i.parseTree,a=F.getDunderAllInfo(i.parseTree);return{symbolTable:s,dunderAllNames:null==a?void 0:a.names,usesUnsupportedDunderAllForm:null!==(t=null==a?void 0:a.usesUnsupportedDunderAllForm)&&void 0!==t&&t,get docString(){return(0,D.getDocString)(r.statements)}}},this._console=n||new d.StandardConsole,this._logTracker=null!=i?i:new m.LogTracker(n,"FG"),this._importResolver=e,this._configOptions=t,this._createNewEvaluator()}get evaluator(){return this._evaluator}setConfigOptions(e){this._configOptions=e,this._createNewEvaluator()}setImportResolver(e){this._importResolver=e,this._createNewEvaluator()}setTrackedFiles(e){if(this._sourceFileList.length>0){const t=new Map;e.forEach((e=>{t.set((0,y.normalizePathCase)(this._fs,e),e)})),this._sourceFileList.forEach((e=>{const n=(0,y.normalizePathCase)(this._fs,e.sourceFile.getFilePath());t.has(n)||(e.isTracked=!1)}))}return this.addTrackedFiles(e),this._removeUnneededFiles()}setPreCheckCallback(e){this._preCheckCallback=e}setAllowedThirdPartyImports(e){this._allowedThirdPartyImports=e}addTrackedFiles(e,t=!1,n=!1){e.forEach((e=>{this.addTrackedFile(e,t,n)}))}addTrackedFile(e,t=!1,n=!1){let s=this._getSourceFileInfoFromPath(e);if(s)return s.isTracked=!0,s.sourceFile;const i=this._getImportNameForFile(e),r=new A.SourceFile(this._fs,e,i,t,n,this._console,this._logTracker);return s={sourceFile:r,isTracked:!0,isOpenByClient:!1,isTypeshedFile:!1,isThirdPartyImport:t,isThirdPartyPyTypedPresent:n,diagnosticsVersion:void 0,imports:[],importedBy:[],shadows:[],shadowedBy:[]},this._addToSourceFileListAndMap(s),r}setFileOpened(e,t,n,s){var i,r;let a=this._getSourceFileInfoFromPath(e);if(a)a.isOpenByClient=!0,a.diagnosticsVersion=0;else{const t=this._getImportNameForFile(e),n=new A.SourceFile(this._fs,e,t,!1,!1,this._console,this._logTracker,null!==(i=null==s?void 0:s.ipythonMode)&&void 0!==i&&i),o=null==s?void 0:s.chainedFilePath;a={sourceFile:n,isTracked:null!==(r=null==s?void 0:s.isTracked)&&void 0!==r&&r,chainedSourceFile:o?this._getSourceFileInfoFromPath(o):void 0,isOpenByClient:!0,isTypeshedFile:!1,isThirdPartyImport:!1,isThirdPartyPyTypedPresent:!1,diagnosticsVersion:void 0,imports:[],importedBy:[],shadows:[],shadowedBy:[]},this._addToSourceFileListAndMap(a)}a.sourceFile.setClientVersion(t,n)}setFileClosed(e){const t=this._getSourceFileInfoFromPath(e);return t&&(t.isOpenByClient=!1,t.sourceFile.setClientVersion(null,[]),t.sourceFile.didContentsChangeOnDisk()&&(t.sourceFile.markDirty(),this._markFileDirtyRecursive(t,new Map))),this._removeUnneededFiles()}markAllFilesDirty(e,t=!0){const n=new Map;this._sourceFileList.forEach((s=>{e?s.sourceFile.markDirty(t):s.sourceFile.didContentsChangeOnDisk()&&(s.sourceFile.markDirty(t),this._markFileDirtyRecursive(s,n))})),n.size>0&&this._createNewEvaluator()}markFilesDirty(e,t,n=!0){const s=new Map;e.forEach((e=>{const i=this._getSourceFileInfoFromPath(e);if(i){const r=(0,y.getFileName)(e);if("builtins.pyi"===r||"__builtins__.pyi"===r)return void this.markAllFilesDirty(t,n);(t||!i.isOpenByClient&&i.sourceFile.didContentsChangeOnDisk())&&(i.sourceFile.markDirty(n),this._markFileDirtyRecursive(i,s))}})),s.size>0&&this._createNewEvaluator()}getFileCount(){return this._sourceFileList.length}getTracked(){return this._sourceFileList.filter((e=>e.isTracked))}getOpened(){return this._sourceFileList.filter((e=>e.isOpenByClient))}getFilesToAnalyzeCount(){let e=0;return this._disableChecker||this._sourceFileList.forEach((t=>{t.sourceFile.isCheckingRequired()&&this._shouldCheckFile(t)&&e++})),e}isCheckingOnlyOpenFiles(){return this._configOptions.checkOnlyOpenFiles||!1}containsSourceFileIn(e){const t=(0,y.normalizePathCase)(this._fs,e);return this._sourceFileList.some((e=>e.sourceFile.getFilePath().startsWith(t)))}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=o.CancellationToken.None){return this._runEvaluatorWithCancellationToken(t,(()=>{const t=new T.Duration,n=this._sourceFileList.filter((e=>e.isOpenByClient&&e.sourceFile.isCheckingRequired()));if(n.length>0){const s=e?e.openFilesTimeInMs:Number.MAX_VALUE;for(const e of n)if(this._checkTypes(e)&&t.getDurationInMilliseconds()>s)return!0;if(void 0!==e)return!0}if(!this._configOptions.checkOnlyOpenFiles){const n=e?e.noOpenFilesTimeInMs:Number.MAX_VALUE;for(const e of this._sourceFileList)if(this._isUserCode(e)&&this._checkTypes(e)&&t.getDurationInMilliseconds()>n)return!0}return!1}))}indexWorkspace(e,n){return this._configOptions.indexing?this._runEvaluatorWithCancellationToken(n,(()=>{const i=new Set;for(const e of this._sourceFileList)e.sourceFile.isParseRequired()||i.add(e);let r=0;for(const a of this._sourceFileList){if(!this._isUserCode(a)||!a.sourceFile.isIndexingRequired())continue;this._bindFile(a);const o=a.sourceFile.index({indexingForAutoImportMode:!1},n);if(o){if(++r>t.MaxWorkspaceIndexFileCount)return this._console.warn("Workspace indexing has hit its upper limit: 2000 files"),s(this._sourceFileList,i),r;e(a.sourceFile.getFilePath(),o)}this._handleMemoryHighUsage()}return s(this._sourceFileList,i),r})):0;function s(e,t){for(const n of e)n.sourceFile.isParseRequired()||t.has(n)||n.sourceFile.dropParseAndBindInfo()}}printDependencies(e,t){const n=this._sourceFileList.filter((e=>!e.isTypeshedFile)).sort(((e,t)=>e.sourceFile.getFilePath()<t.sourceFile.getFilePath()?1:-1)),s=[];n.forEach((n=>{this._console.info("");let i=n.sourceFile.getFilePath();const r=(0,y.getRelativePath)(i,e);r&&(i=r),this._console.info(`${i}`),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&&s.push(n.sourceFile)})),s.length>0&&(this._console.info(""),this._console.info(`${s.length} file${1===s.length?"":"s"} not explicitly imported`),s.forEach((e=>{this._console.info(` ${e.getFilePath()}`)})))}writeTypeStub(e,t,n,s){for(const i of this._sourceFileList){(0,c.throwIfCancellationRequested)(s);const r=i.sourceFile.getFilePath(),a=(0,y.getRelativePath)(r,e);if(void 0!==a){let e=(0,y.normalizePath)((0,y.combinePaths)(n,a));e=t?(0,y.combinePaths)((0,y.getDirectoryPath)(e),"__init__.pyi"):(0,y.stripFileExtension)(e)+".pyi";const r=(0,y.getDirectoryPath)(e);try{(0,y.makeDirectories)(this._fs,r,n)}catch(e){throw new Error(`Could not create directory for '${r}'`)}this._bindFile(i),this._runEvaluatorWithCancellationToken(s,(()=>{new M.TypeStubWriter(e,i.sourceFile,this._evaluator).write()})),this._handleMemoryHighUsage()}}}getTypeOfSymbol(e){this._handleMemoryHighUsage();return(this._evaluator||this._createNewEvaluator()).getEffectiveTypeOfSymbol(e)}printType(e,t){this._handleMemoryHighUsage();return(this._evaluator||this._createNewEvaluator()).printType(e,t)}static _getPrintTypeFlags(e){let t=0;return e.diagnosticRuleSet.printUnknownAsAny&&(t|=1),e.diagnosticRuleSet.omitConditionalConstraint&&(t|=64),e.diagnosticRuleSet.omitTypeArgsIfAny&&(t|=2),e.diagnosticRuleSet.omitUnannotatedParamType&&(t|=4),e.diagnosticRuleSet.pep604Printing&&(t|=8),t}get _fs(){return this._importResolver.fileSystem}_getImportNameForFile(e){return this._importResolver.getModuleNameForImport(e,this._configOptions.getDefaultExecEnvironment()).moduleName}_addShadowedFile(e,t){let n=this._getSourceFileInfoFromPath(t);if(!n){const e=this._getImportNameForFile(t);n={sourceFile:new A.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&&this._evaluator.disposeEvaluator(),this._evaluator=(0,N.createTypeEvaluatorWithTracker)(this._lookUpImport,{printTypeFlags:R._getPrintTypeFlags(this._configOptions),logCalls:this._configOptions.logTypeEvaluationTime,minimumLoggingThreshold:this._configOptions.typeEvaluationTimeThreshold,analyzeUnannotatedFunctions:this._configOptions.analyzeUnannotatedFunctions,evaluateUnknownImportsAsAny:!!this._configOptions.evaluateUnknownImportsAsAny,verifyTypeCacheEvaluatorFlags:!!this._configOptions.internalTestMode},this._logTracker,this._configOptions.logTypeEvaluationTime?(0,w.createTracePrinter)(this._importResolver.getImportRoots(this._configOptions.findExecEnvironment(this._configOptions.projectRoot))):void 0),this._evaluator}_parseFile(e,t){if(this._isFileNeeded(e)&&e.sourceFile.isParseRequired()&&(e.sourceFile.parse(this._configOptions,this._importResolver,t)&&(this._parsedFileCount++,this._updateSourceFileImports(e,this._configOptions)),e.sourceFile.isFileDeleted())){e.isTracked=!1;const t=new Map;this._markFileDirtyRecursive(e,t),this._importResolver.invalidateCache()}}_bindFile(e,t){var n,s;if(!this._isFileNeeded(e)||!e.sourceFile.isBindingRequired())return;this._parseFile(e,t);const i=t=>{if(!t||t===e)return;if(this._bindFile(t),t.sourceFile.isFileDeleted())return;const n=t.sourceFile.getParseResults();if(!n)return;const s=F.getScope(n.parseTree);return(0,u.assert)(void 0!==s),s};let r;e.builtinsImport&&e.builtinsImport!==e&&(r=null!==(s=null!==(n=i(e.chainedSourceFile))&&void 0!==n?n:i(e.ipythonDisplayImport))&&void 0!==s?s:i(e.builtinsImport)),e.sourceFile.bind(this._configOptions,this._lookUpImport,r)}_buildModuleSymbolsMap(e,t,n,s){return(0,_.buildModuleSymbolsMap)(this._sourceFileList.filter((n=>n!==e&&(!t||this._isUserCode(n)))),n,s)}_shouldCheckFile(e){return!!e.isOpenByClient||!(this._configOptions.checkOnlyOpenFiles||!e.isTracked)}_checkTypes(e){return this._logTracker.log(`analyzing: ${e.sourceFile.getFilePath()}`,(t=>{if(!this._isFileNeeded(e))return t.suppress(),!1;if(!e.sourceFile.isCheckingRequired())return t.suppress(),!1;if(!this._shouldCheckFile(e))return t.suppress(),!1;if(this._bindFile(e),this._preCheckCallback){const t=e.sourceFile.getParseResults();t&&this._preCheckCallback(t,this._evaluator)}if(this._disableChecker||e.sourceFile.check(this._importResolver,this._evaluator),this._handleMemoryHighUsage(),"none"!==this._configOptions.diagnosticRuleSet.reportImportCycles&&!this._allowedThirdPartyImports){const t=new Map;this._getImportsRecursive(e,t,0),t.forEach((e=>{T.timingStats.cycleDetectionTime.timeOperation((()=>{this._detectAndReportImportCycles(e)}))}))}return!0}))}_getImportsRecursive(e,t,n){const s=(0,y.normalizePathCase)(this._fs,e.sourceFile.getFilePath());if(!t.has(s))if(n>256)e.sourceFile.setHitMaxImportDepth(256);else{t.set(s,e);for(const s of e.imports)this._getImportsRecursive(s,t,n+1)}}_detectAndReportImportCycles(e,t=[],n=new Map){if(e.sourceFile.isStubFile()||e.isThirdPartyImport)return;const s=(0,y.normalizePathCase)(this._fs,e.sourceFile.getFilePath());if(n.has(s))t.length>1&&e===t[0]&&this._logImportCycle(t);else{if(n.has(s))return;n.set(s,!0),t.push(e);for(const s of e.imports)this._detectAndReportImportCycles(s,t,n);n.set(s,!1),t.pop()}}_logImportCycle(e){const t=new x.CircularDependency;e.forEach((e=>{t.appendPath(e.sourceFile.getFilePath())})),t.normalizeOrder();const n=t.getPaths()[0],s=this._getSourceFileInfoFromPath(n);(0,u.assert)(void 0!==s),s.sourceFile.addCircularDependency(t)}_markFileDirtyRecursive(e,t,n=!1){const s=(0,y.normalizePathCase)(this._fs,e.sourceFile.getFilePath());t.has(s)||(e.sourceFile.markReanalysisRequired(n),t.set(s,!0),e.importedBy.forEach((n=>{const s=n.chainedSourceFile===e;this._markFileDirtyRecursive(n,t,s)})))}getTextOnRange(e,t,n){const s=this._getSourceFileInfoFromPath(e);if(!s)return;const i=s.sourceFile,r=i.getOpenFileContents();return void 0!==r?this._runEvaluatorWithCancellationToken(n,(()=>{this._parseFile(s);const e=i.getParseResults(),n=(0,h.convertRangeToTextRange)(t,e.tokenizerOutput.lines);if(n)return r.substr(n.start,n.length)})):void 0}getAutoImports(e,t,n,s,i,r,a,o){const l=this._getSourceFileInfoFromPath(e);if(!l)return[];const c=l.sourceFile,d=c.getOpenFileContents();return void 0===d?[]:this._runEvaluatorWithCancellationToken(o,(()=>{this._bindFile(l);const u=c.getParseResults(),m=(0,h.convertRangeToTextRange)(t,u.tokenizerOutput.lines);if(!m)return[];const y=(0,D.findNodeByOffset)(u.parseTree,m.start);if(!y)return[];const f=d.substr(m.start,m.length),T=this._buildModuleSymbolsMap(l,!!i,!0,o),v=new _.AutoImporter(this._configOptions.findExecEnvironment(e),this._importResolver,u,t.start,new b.CompletionMap,T,{lazyEdit:r,allowVariableInAll:a,libraryMap:i,patternMatcher:(e,t)=>(0,g.computeCompletionSimilarity)(e,t)>n}),I=[],C=(0,P.getScopeForNode)(y);if(C){const e=null==s?void 0:s.get(f);e&&(0,p.appendArray)(I,v.getAutoImportCandidatesForAbbr(f,e,o)),I.push(...v.getAutoImportCandidates(f,n,void 0,o).filter((e=>!C.lookUpSymbolRecursive(e.name))))}return I}))}getDiagnostics(e){const t=this._removeUnneededFiles();return this._sourceFileList.forEach((n=>{if(this._shouldCheckFile(n)){const s=n.sourceFile.getDiagnostics(e,n.diagnosticsVersion);void 0!==s&&(t.push({filePath:n.sourceFile.getFilePath(),version:n.sourceFile.getClientVersion(),diagnostics:s}),n.diagnosticsVersion=n.sourceFile.getDiagnosticVersion())}else!n.isOpenByClient&&e.checkOnlyOpenFiles&&void 0!==n.diagnosticsVersion&&(t.push({filePath:n.sourceFile.getFilePath(),version:n.sourceFile.getClientVersion(),diagnostics:[]}),n.diagnosticsVersion=void 0)})),t}getDiagnosticsForRange(e,t){const n=this.getSourceFile(e);if(!n)return[];const s=n.getDiagnostics(this._configOptions);return s?s.filter((e=>(0,f.doRangesIntersect)(e.range,t))):[]}getDefinitionsForPosition(e,t,n,s){return this._runEvaluatorWithCancellationToken(s,(()=>{const i=this._getSourceFileInfoFromPath(e);if(!i)return;this._bindFile(i);const r=this._configOptions.findExecEnvironment(e);return i.sourceFile.getDefinitionsForPosition(this._createSourceMapper(r),t,n,this._evaluator,s)}))}getTypeDefinitionsForPosition(e,t,n){return this._runEvaluatorWithCancellationToken(n,(()=>{const s=this._getSourceFileInfoFromPath(e);if(!s)return;this._bindFile(s);const i=this._configOptions.findExecEnvironment(e);return s.sourceFile.getTypeDefinitionsForPosition(this._createSourceMapper(i,!1,!0),t,this._evaluator,e,n)}))}reportReferencesForPosition(e,t,n,s,i){this._runEvaluatorWithCancellationToken(i,(()=>{const r=this._getSourceFileInfoFromPath(e);if(!r)return;const a=this._isUserCode(r);this._bindFile(r);const o=this._configOptions.findExecEnvironment(e),l=r.sourceFile.getDeclarationForPosition(this._createSourceMapper(o),t,this._evaluator,s,i);if(l)if(l.requiresGlobalSearch){for(const e of this._sourceFileList)if((0,c.throwIfCancellationRequested)(i),e.isOpenByClient||!a||this._isUserCode(e)){const t=e.sourceFile.getFileContent();(!t||t.search(l.symbolName)>=0)&&(this._bindFile(e),e.sourceFile.addReferences(l,n,this._evaluator,i)),this._handleMemoryHighUsage()}if(n)for(const e of l.declarations){if((0,c.throwIfCancellationRequested)(i),l.locations.some((t=>t.path===e.path)))continue;const t=this._getSourceFileInfoFromPath(e.path);if(!t)continue;const s=new C.ReferencesResult(l.requiresGlobalSearch,l.nodeAtOffset,l.symbolName,l.declarations);t.sourceFile.addReferences(s,n,this._evaluator,i);for(const t of s.locations)t.path===e.path&&(0,f.doesRangeContain)(e.range,t.range)&&l.addLocations(t)}}else r.sourceFile.addReferences(l,n,this._evaluator,i)}))}getFileIndex(e,t,n){if(t.indexingForAutoImportMode){const t=(0,y.stripFileExtension)((0,y.getFileName)(e));if((0,k.isPrivateOrProtectedName)(t))return}return this._handleMemoryHighUsage(),this._runEvaluatorWithCancellationToken(n,(()=>{var s;const i=this._getSourceFileInfoFromPath(e);if(!i)return;const r=null!==(s=i.sourceFile.getFileContent())&&void 0!==s?s:"";return t.indexingForAutoImportMode&&!t.forceIndexing&&!i.sourceFile.isStubFile()&&!i.sourceFile.isThirdPartyPyTypedPresent()&&r.indexOf("__all__")<0?void 0:(this._bindFile(i,r),i.sourceFile.index(t,n))}))}addSymbolsForDocument(e,t,n){return this._runEvaluatorWithCancellationToken(n,(()=>{const s=this._getSourceFileInfoFromPath(e);s&&(s.sourceFile.getCachedIndexResults()||this._bindFile(s),s.sourceFile.addHierarchicalSymbolsForDocument(t,n))}))}reportSymbolsForWorkspace(e,t,n){this._runEvaluatorWithCancellationToken(n,(()=>{if(e)for(const s of this._sourceFileList){if(!this._isUserCode(s))continue;s.sourceFile.getCachedIndexResults()||this._bindFile(s);const i=s.sourceFile.getSymbolsForDocument(e,n);i.length>0&&t(i),this._handleMemoryHighUsage()}}))}getHoverForPosition(e,t,n,s){return this._runEvaluatorWithCancellationToken(s,(()=>{const i=this._getSourceFileInfoFromPath(e);if(!i)return;this._bindFile(i);const r=this._configOptions.findExecEnvironment(e);return i.sourceFile.getHoverForPosition(this._createSourceMapper(r,!0),t,n,this._evaluator,s)}))}getDocumentHighlight(e,t,n){return this._runEvaluatorWithCancellationToken(n,(()=>{const s=this._getSourceFileInfoFromPath(e);if(!s)return;this._bindFile(s);const i=this._configOptions.findExecEnvironment(e);return s.sourceFile.getDocumentHighlight(this._createSourceMapper(i),t,this._evaluator,n)}))}getSignatureHelpForPosition(e,t,n,s){return this._runEvaluatorWithCancellationToken(s,(()=>{const i=this._getSourceFileInfoFromPath(e);if(!i)return;this._bindFile(i);const r=this._configOptions.findExecEnvironment(e);return i.sourceFile.getSignatureHelpForPosition(t,this._createSourceMapper(r,!0),this._evaluator,n,s)}))}async getCompletionsForPosition(e,t,n,s,i,r,a){var o,c;const p=this._getSourceFileInfoFromPath(e);if(!p)return;const d=this._logTracker.log(`completion at ${e}:${t.line}:${t.character}`,(o=>{var l,c;const d=this._runEvaluatorWithCancellationToken(a,(()=>{this._bindFile(p);const o=this._configOptions.findExecEnvironment(e);return p.sourceFile.getCompletionsForPosition(t,n,this._configOptions,this._importResolver,this._lookUpImport,this._evaluator,s,this._createSourceMapper(o,!0),i,r,(()=>this._buildModuleSymbolsMap(p,!!r,!1,a)),a)}));return o.add(`found ${null!==(c=null===(l=null==d?void 0:d.completionMap)||void 0===l?void 0:l.size)&&void 0!==c?c:"null"} items`),d})),u={completionList:l.CompletionList.create(null===(o=null==d?void 0:d.completionMap)||void 0===o?void 0:o.toArray()),memberAccessInfo:null==d?void 0:d.memberAccessInfo,autoImportInfo:null==d?void 0:d.autoImportInfo,extensionInfo:null==d?void 0:d.extensionInfo};if(!(null==d?void 0:d.completionMap)||!(null===(c=this._extension)||void 0===c?void 0:c.completionListExtension))return u;const m=p.sourceFile.getParseResults();if((null==m?void 0:m.parseTree)&&(null==m?void 0:m.text)){const e=(0,h.convertPositionToOffset)(t,m.tokenizerOutput.lines);void 0!==e&&await this._extension.completionListExtension.updateCompletionResults(u,m,e,a)}return u}resolveCompletionItem(e,t,n,s,i,r){return this._runEvaluatorWithCancellationToken(r,(()=>{const a=this._getSourceFileInfoFromPath(e);if(!a)return;this._bindFile(a);const o=this._configOptions.findExecEnvironment(e);a.sourceFile.resolveCompletionItem(this._configOptions,this._importResolver,this._lookUpImport,this._evaluator,n,this._createSourceMapper(o,!0),s,i,(()=>this._buildModuleSymbolsMap(a,!!i,!1,r)),t,r)}))}renameModule(e,t,n){return this._runEvaluatorWithCancellationToken(n,(()=>{if((0,y.isFile)(this._fs,e)){if(!this._getSourceFileInfoFromPath(e))return}const s=S.RenameModuleProvider.createForModule(this._importResolver,this._configOptions,this._evaluator,e,t,n);if(s)return this._processModuleReferences(s,s.lastModuleName,e),{edits:s.getEdits(),fileOperations:[]}}))}moveSymbolAtPosition(e,t,n,s){return this._runEvaluatorWithCancellationToken(s,(()=>{const i=this._getSourceFileInfoFromPath(e);if(!i)return;this._bindFile(i);const r=i.sourceFile.getParseResults();if(!r)return;const a=(0,h.convertPositionToOffset)(n,r.tokenizerOutput.lines);if(void 0===a)return;const o=(0,D.findNodeByOffset)(r.parseTree,a);if(void 0===o)return;if(38!==o.nodeType)return;const l=this._configOptions.findExecEnvironment(e),c=I.DocumentSymbolCollector.getDeclarationsForNode(o,this._evaluator,!1,s,this._createSourceMapper(l)),p=S.RenameModuleProvider.createForSymbol(this._importResolver,this._configOptions,this._evaluator,e,t,c,s);return p?(this._processModuleReferences(p,o.value,e),{edits:p.getEdits(),fileOperations:[]}):void 0}))}canRenameSymbolAtPosition(e,t,n,s,i){return this._runEvaluatorWithCancellationToken(i,(()=>{const r=this._getSourceFileInfoFromPath(e);if(!r)return;this._bindFile(r);const a=this._getReferenceResult(r,e,t,s,i);if(!a)return;if(a.containsOnlyImportDecls&&!this._supportRenameModule(a.declarations,n))return;if("none"===this._getRenameSymbolMode(r,a,n))return;const o=r.sourceFile.getParseResults();return(0,h.convertTextRangeToRange)(a.nodeAtOffset,o.tokenizerOutput.lines)}))}renameSymbolAtPosition(e,t,n,s,i,r){return this._runEvaluatorWithCancellationToken(r,(()=>{var a;const o=this._getSourceFileInfoFromPath(e);if(!o)return;this._bindFile(o);const l=this._getReferenceResult(o,e,t,i,r);if(!l)return;if(l.containsOnlyImportDecls){if(!this._supportRenameModule(l.declarations,s))return;const t=S.RenameModuleProvider.getRenameModulePathInfo(S.RenameModuleProvider.getRenameModulePath(l.declarations),n);if(!t)return;const i=this.renameModule(t.filePath,t.newFilePath,r);if(null==i||i.fileOperations.push({kind:"rename",oldFilePath:t.filePath,newFilePath:t.newFilePath}),(0,E.isStubFile)(t.filePath)){const s=this._importResolver.getSourceFilesFromStub(t.filePath,this._configOptions.findExecEnvironment(e),!1);for(const e of s){const t=S.RenameModuleProvider.getRenameModulePathInfo(e,n);t&&(null==i||i.fileOperations.push({kind:"rename",oldFilePath:t.filePath,newFilePath:t.newFilePath}))}}return i}const c=this._getRenameSymbolMode(o,l,s);switch(c){case"singleFileMode":o.sourceFile.addReferences(l,!0,this._evaluator,r);break;case"multiFileMode":for(const e of this._sourceFileList){if(this._isUserCode(e)){const t=null!==(a=e.sourceFile.getFileContent())&&void 0!==a?a:"";if(t.indexOf(l.symbolName)<0)continue;this._bindFile(e,t),e.sourceFile.addReferences(l,!0,this._evaluator,r)}this._handleMemoryHighUsage()}break;case"none":return;default:(0,u.assertNever)(c)}const p=[];return l.locations.forEach((e=>{p.push({filePath:e.path,range:e.range,replacementText:n})})),{edits:p,fileOperations:[]}}))}getCallForPosition(e,t,n){const s=this._getSourceFileInfoFromPath(e);if(!s)return;this._bindFile(s);const i=this._configOptions.findExecEnvironment(e),r=s.sourceFile.getDeclarationForPosition(this._createSourceMapper(i),t,this._evaluator,void 0,n);if(!r||0===r.declarations.length)return;const a=v.CallHierarchyProvider.getTargetDeclaration(r.declarations,r.nodeAtOffset);return v.CallHierarchyProvider.getCallForDeclaration(r.symbolName,a,this._evaluator,n)}getIncomingCallsForPosition(e,t,n){const s=this._getSourceFileInfoFromPath(e);if(!s)return;this._bindFile(s);const i=this._configOptions.findExecEnvironment(e),r=s.sourceFile.getDeclarationForPosition(this._createSourceMapper(i),t,this._evaluator,void 0,n);if(!r||0===r.declarations.length)return;const a=v.CallHierarchyProvider.getTargetDeclaration(r.declarations,r.nodeAtOffset);let o=[];for(const e of this._sourceFileList)if(this._isUserCode(e)||e.isOpenByClient){this._bindFile(e);const t=v.CallHierarchyProvider.getIncomingCallsForDeclaration(e.sourceFile.getFilePath(),r.symbolName,a,e.sourceFile.getParseResults(),this._evaluator,n);t&&(o=o.concat(...t)),this._handleMemoryHighUsage()}return o}getOutgoingCallsForPosition(e,t,n){const s=this._getSourceFileInfoFromPath(e);if(!s)return;this._bindFile(s);const i=this._configOptions.findExecEnvironment(e),r=s.sourceFile.getDeclarationForPosition(this._createSourceMapper(i),t,this._evaluator,void 0,n);if(!r||0===r.declarations.length)return;const a=v.CallHierarchyProvider.getTargetDeclaration(r.declarations,r.nodeAtOffset);return v.CallHierarchyProvider.getOutgoingCallsForDeclaration(a,s.sourceFile.getParseResults(),this._evaluator,n)}performQuickAction(e,t,n,s){const i=this._getSourceFileInfoFromPath(e);if(i)return this._bindFile(i),i.sourceFile.performQuickAction(t,n,s)}test_createSourceMapper(e){return this._createSourceMapper(e,!1)}_getRenameSymbolMode(e,t,n){const s=this._isUserCode(e);return n||s&&!t.requiresGlobalSearch||!s&&e.isOpenByClient&&t.declarations.every((t=>this._getSourceFileInfoFromPath(t.path)===e))?"singleFileMode":t.declarations.every((e=>this._isUserCode(this._getSourceFileInfoFromPath(e.path))))?"multiFileMode":"none"}_supportRenameModule(e,t){return!t&&e.every((e=>this._isUserCode(this._getSourceFileInfoFromPath(e.path))))}_getReferenceResult(e,t,n,s,i){const r=this._configOptions.findExecEnvironment(t),a=e.sourceFile.getDeclarationForPosition(this._createSourceMapper(r),n,this._evaluator,void 0,i);if(a){if(s&&a.containsOnlyImportDecls)return a;if(0!==a.nonImportDeclarations.length)return new C.ReferencesResult(a.requiresGlobalSearch,a.nodeAtOffset,a.symbolName,a.nonImportDeclarations)}}_processModuleReferences(e,t,n){var s;for(const i of this._sourceFileList){if(!this._isUserCode(i))continue;const r=i.sourceFile.getFilePath(),a=null!==(s=i.sourceFile.getFileContent())&&void 0!==s?s:"";if(r!==n&&a.indexOf(t)<0)continue;this._bindFile(i,a);const o=i.sourceFile.getParseResults();o&&(e.renameReferences(r,o),this._handleMemoryHighUsage())}}_handleMemoryHighUsage(){const e=e=>`${Math.round(e/1048576)}MB`;if(this._evaluator.getTypeCacheSize()>75e4||this._parsedFileCount>1e3){const t=(0,a.getHeapStatistics)();this._configOptions.verboseOutput&&this._console.info(`Heap stats: total_heap_size=${e(t.total_heap_size)}, used_heap_size=${e(t.used_heap_size)}, total_physical_size=${e(t.total_physical_size)}, total_available_size=${e(t.total_available_size)}, heap_size_limit=${e(t.heap_size_limit)}`),t.used_heap_size>.9*t.heap_size_limit&&(this._console.info(`Emptying type cache to avoid heap overflow. Used ${e(t.used_heap_size)} out of ${e(t.heap_size_limit)}`),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?this._evaluator.runWithCancellationToken(e,t):t()}catch(e){throw e instanceof c.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(),version:n.sourceFile.getClientVersion(),diagnostics:[]}),n.diagnosticsVersion=void 0),t++):(e.push({filePath:n.sourceFile.getFilePath(),version:n.sourceFile.getClientVersion(),diagnostics:[]}),n.sourceFile.prepareForClose(),this._removeSourceFileFromListAndMap(n.sourceFile.getFilePath(),t),n.imports.forEach((s=>{const i=s.importedBy.findIndex((e=>e===n));if(!(i<0||(s.importedBy.splice(i,1),this._isFileNeeded(s)))){const n=this._sourceFileList.findIndex((e=>e===s));n>=0&&n<t&&(e.push({filePath:s.sourceFile.getFilePath(),version:s.sourceFile.getClientVersion(),diagnostics:[]}),s.sourceFile.prepareForClose(),this._removeSourceFileFromListAndMap(s.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=(0,y.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,n){return new E.SourceMapper(this._importResolver,e,this._evaluator,((e,t)=>{const n=this._getSourceFileInfoFromPath(e);if(n)return this._addShadowedFile(n,t),this.getBoundSourceFile(t)}),(e=>this.getBoundSourceFile(e)),null!=t&&t,null!=n&&n)}_isImportAllowed(e,t,n){if(t.isNativeLib)return!1;let s=this._configOptions.useLibraryCodeForTypes||1===t.importType&&!!t.pyTypedInfo||2===t.importType&&e.isThirdPartyPyTypedPresent;return!((1===t.importType||e.isThirdPartyImport&&2===t.importType)&&(this._allowedThirdPartyImports&&(t.isRelative||this._allowedThirdPartyImports.some((e=>t.importName===e||!!t.importName.startsWith(e+"."))))&&(s=!0),!n))||s}_updateSourceFileImports(e,t){const n=[],s=e.sourceFile.getImports(),i=t=>{let n=!1,s=!1;return 1===t.importType?(n=!0,t.pyTypedInfo&&(s=!0)):e.isThirdPartyImport&&2===t.importType&&(n=!0,e.isThirdPartyPyTypedPresent&&(s=!0)),{isThirdPartyImport:n,isPyTypedPresent:s}},r=new Map;if(e.chainedSourceFile)if(e.chainedSourceFile.sourceFile.isFileDeleted())e.chainedSourceFile=void 0;else{const t=e.chainedSourceFile.sourceFile.getFilePath();r.set((0,y.normalizePathCase)(this._fs,t),{path:t,isTypeshedFile:!1,isThirdPartyImport:!1,isPyTypedPresent:!1})}s.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=i(n);r.set((0,y.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=i(n);r.set((0,y.normalizePathCase)(this._fs,t.path),{path:t.path,isTypeshedFile:!!n.isTypeshedFile,isThirdPartyImport:e.isThirdPartyImport,isPyTypedPresent:e.isPyTypedPresent})}}))}else t.verboseOutput&&(this._console.info(`Could not import '${n.importName}' in file '${e.sourceFile.getFilePath()}'`),n.importFailureInfo&&n.importFailureInfo.forEach((e=>{this._console.info(` ${e}`)})))}));const a=new Map;e.imports.forEach((t=>{const n=(0,y.normalizePathCase)(this._fs,t.sourceFile.getFilePath());r.has(n)?a.set(n,t):t.importedBy=t.importedBy.filter((t=>(0,y.normalizePathCase)(this._fs,t.sourceFile.getFilePath())!==(0,y.normalizePathCase)(this._fs,e.sourceFile.getFilePath())))})),r.forEach(((t,s)=>{if(!a.has(s)){let i;if(this._getSourceFileInfoFromPath(t.path))i=this._getSourceFileInfoFromPath(t.path);else{const e=this._getImportNameForFile(t.path);i={sourceFile:new A.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(i),n.push(i)}i.importedBy.push(e),a.set(s,i)}})),e.imports=[],r.forEach(((t,n)=>{this._getSourceFileInfoFromPath(n)&&e.imports.push(this._getSourceFileInfoFromPath(n))})),e.builtinsImport=void 0;const o=e.sourceFile.getBuiltinsImport();if(o&&o.isImportFound){const t=o.resolvedPaths[o.resolvedPaths.length-1];e.builtinsImport=this._getSourceFileInfoFromPath(t)}e.ipythonDisplayImport=void 0;const l=e.sourceFile.getIPythonDisplayImport();if(l&&l.isImportFound){const t=l.resolvedPaths[l.resolvedPaths.length-1];e.ipythonDisplayImport=this._getSourceFileInfoFromPath(t)}return n}_getSourceFileInfoFromPath(e){return this._sourceFileMap.get((0,y.normalizePathCase)(this._fs,e))}_removeSourceFileFromListAndMap(e,t){this._sourceFileMap.delete((0,y.normalizePathCase)(this._fs,e)),this._sourceFileList.splice(t,1)}_addToSourceFileListAndMap(e){const t=(0,y.normalizePathCase)(this._fs,e.sourceFile.getFilePath());(0,u.assert)(!this._sourceFileMap.has(t)),this._sourceFileList.push(e),this._sourceFileMap.set(t,e)}}t.Program=R},49031:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.canAssignProperty=t.clonePropertyWithDeleter=t.clonePropertyWithSetter=t.createProperty=t.validatePropertyMethod=void 0;const s=n(24319),i=n(15741),r=n(74426),a=n(35696),o=n(23241),l=n(97882),c=n(59195),p=n(10425);function d(e,t){const n=e.details.fields,s=c.FunctionType.createSynthesizedInstance("__get__",256);c.FunctionType.addParameter(s,{category:0,name:"self",type:c.AnyType.create(),hasDeclaredType:!0}),c.FunctionType.addParameter(s,{category:0,name:"obj",type:c.NoneType.createInstance(),hasDeclaredType:!0}),c.FunctionType.addParameter(s,{category:0,name:"objtype",type:c.AnyType.create(),hasDeclaredType:!0,hasDefault:!0,defaultType:c.AnyType.create()}),s.details.declaredReturnType=c.FunctionType.isClassMethod(t)?c.FunctionType.getSpecializedReturnType(t):e,s.details.declaration=t.details.declaration;const i=c.FunctionType.createSynthesizedInstance("__get__",256);c.FunctionType.addParameter(i,{category:0,name:"self",type:c.AnyType.create(),hasDeclaredType:!0});const r=t.details.parameters.length>0?t.details.parameters[0].type:c.AnyType.create();c.FunctionType.addParameter(i,{category:0,name:"obj",type:r,hasDeclaredType:!0}),c.FunctionType.addParameter(i,{category:0,name:"objtype",type:c.AnyType.create(),hasDeclaredType:!0,hasDefault:!0,defaultType:c.AnyType.create()}),i.details.declaredReturnType=c.FunctionType.getSpecializedReturnType(t),i.details.declaration=t.details.declaration,i.details.typeVarScopeId=(0,p.getTypeVarScopeId)(t);const a=c.OverloadedFunctionType.create([s,i]),o=l.Symbol.createWithType(4,a);n.set("__get__",o)}function u(e,t,n){const s=e.details.fields,i=c.FunctionType.createSynthesizedInstance("__set__");c.FunctionType.addParameter(i,{category:0,name:"self",type:c.AnyType.create(),hasDeclaredType:!0});let r=t.details.parameters.length>0?t.details.parameters[0].type:c.AnyType.create();(0,c.isTypeVar)(r)&&r.details.isSynthesizedSelf&&(r=n.makeTopLevelTypeVarsConcrete(r)),c.FunctionType.addParameter(i,{category:0,name:"obj",type:(0,c.combineTypes)([r,c.NoneType.createInstance()]),hasDeclaredType:!0}),i.details.declaredReturnType=c.NoneType.createInstance();let a=c.UnknownType.create();t.details.parameters.length>=2&&0===t.details.parameters[1].category&&t.details.parameters[1].name&&(a=t.details.parameters[1].type),c.FunctionType.addParameter(i,{category:0,name:"value",type:a,hasDeclaredType:!0});const o=l.Symbol.createWithType(4,i);s.set("__set__",o)}function m(e,t,n){const s=e.details.fields,i=c.FunctionType.createSynthesizedInstance("__delete__");c.FunctionType.addParameter(i,{category:0,name:"self",type:c.AnyType.create(),hasDeclaredType:!0});let r=t.details.parameters.length>0?t.details.parameters[0].type:c.AnyType.create();(0,c.isTypeVar)(r)&&r.details.isSynthesizedSelf&&(r=n.makeTopLevelTypeVarsConcrete(r)),c.FunctionType.addParameter(i,{category:0,name:"obj",type:(0,c.combineTypes)([r,c.NoneType.createInstance()]),hasDeclaredType:!0}),i.details.declaredReturnType=c.NoneType.createInstance();const a=l.Symbol.createWithType(4,i);s.set("__delete__",a)}function y(e,t){const n=e.details.fields,s=n.get("fget"),i=null==s?void 0:s.getSynthesizedType();i&&(0,c.isFunction)(i)&&d(e,i);const r=n.get("fset"),a=null==r?void 0:r.getSynthesizedType();a&&(0,c.isFunction)(a)&&u(e,a,t);const o=n.get("fdel"),l=null==o?void 0:o.getSynthesizedType();l&&(0,c.isFunction)(l)&&m(e,l,t)}function h(e){const t=e.details.fields;["getter","setter","deleter"].forEach((n=>{const s=c.FunctionType.createSynthesizedInstance(n);c.FunctionType.addParameter(s,{category:0,name:"self",type:c.AnyType.create(),hasDeclaredType:!0}),c.FunctionType.addParameter(s,{category:0,name:"accessor",type:c.AnyType.create(),hasDeclaredType:!0}),s.details.declaredReturnType=e;const i=l.Symbol.createWithType(4,s);t.set(n,i)}))}t.validatePropertyMethod=function(e,t,n){c.FunctionType.isStaticMethod(t)&&e.addDiagnostic((0,a.getFileInfo)(n).diagnosticRuleSet.reportGeneralTypeIssues,i.DiagnosticRule.reportGeneralTypeIssues,r.Localizer.Diagnostic.propertyStaticMethod(),n)},t.createProperty=function(e,t,n,s){const i=(0,a.getFileInfo)(t),r=e.getBuiltInType(t,"type"),u=c.ClassType.isBuiltIn(n,"property")?(0,o.getTypeSourceId)(t):n.details.typeSourceId,m=c.ClassType.createInstantiable(n.details.name,(0,o.getClassFullName)(t,i.moduleName,`__property_${s.details.name}`),i.moduleName,i.filePath,2048,u,void 0,(0,c.isInstantiableClass)(r)?r:c.UnknownType.create());m.details.typeVarScopeId=n.details.typeVarScopeId;const g=e.getBuiltInType(t,"object");m.details.baseClasses.push((0,c.isInstantiableClass)(g)?g:c.UnknownType.create()),(0,p.computeMroLinearization)(m);const f=m.details.fields;n.details.fields.forEach(((e,t)=>{const n=["__get__","__set__","__delete__","fget","fset","fdel"];e.isIgnoredForProtocolMatch()||n.some((e=>e===t))||f.set(t,e)}));const T=c.ClassType.cloneAsInstance(m);m.isAsymmetricDescriptor=!1,y(T,e);const _=l.Symbol.createWithType(4,c.FunctionType.cloneWithNewFlags(s,4|s.details.flags));return f.set("fget",_),c.FunctionType.isClassMethod(s)&&(m.details.flags|=4194304),d(T,s),h(T),T},t.clonePropertyWithSetter=function(e,t,n,d){if(!(0,p.isProperty)(t))return t;const m=t,g=m.details.flags;let f=!!m.isAsymmetricDescriptor;const T=(0,a.getFileInfo)(d);if(d.parameters.length>=2){const t=(0,o.getTypeAnnotationForParameter)(d,1);if(t){const n=e.getGetterTypeFromProperty(m,!1);if(n&&!(0,c.isAnyOrUnknown)(n)){const a=e.getTypeOfAnnotation(t,{associateTypeVarsWithScope:!0,disallowRecursiveTypeAlias:!0});if("none"!==T.diagnosticRuleSet.reportPropertyTypeMismatch){const o=new s.DiagnosticAddendum;e.canAssignType(n,a,o)||e.addDiagnostic(T.diagnosticRuleSet.reportPropertyTypeMismatch,i.DiagnosticRule.reportPropertyTypeMismatch,r.Localizer.Diagnostic.setterGetterTypeMismatch()+o.getString(),t)}(0,c.isTypeSame)(n,a)||(f=!0)}}}const _=c.ClassType.createInstantiable(m.details.name,m.details.fullName,m.details.moduleName,(0,a.getFileInfo)(d).filePath,g,m.details.typeSourceId,m.details.declaredMetaclass,m.details.effectiveMetaclass);_.details.typeVarScopeId=m.details.typeVarScopeId;const v=e.getBuiltInType(d,"object");_.details.baseClasses.push((0,c.isInstantiableClass)(v)?v:c.UnknownType.create()),(0,p.computeMroLinearization)(_);const b=c.ClassType.cloneAsInstance(_);_.isAsymmetricDescriptor=f;const I=_.details.fields;m.details.fields.forEach(((e,t)=>{e.isIgnoredForProtocolMatch()||I.set(t,e)})),y(b,e);const C=l.Symbol.createWithType(4,c.FunctionType.cloneWithNewFlags(n,4|n.details.flags));return I.set("fset",C),u(b,n,e),h(b),b},t.clonePropertyWithDeleter=function(e,t,n,s){var i;if(!(0,p.isProperty)(t))return t;const r=t,o=c.ClassType.createInstantiable(r.details.name,r.details.fullName,r.details.moduleName,(0,a.getFileInfo)(s).filePath,r.details.flags,r.details.typeSourceId,r.details.declaredMetaclass,r.details.effectiveMetaclass);o.details.typeVarScopeId=r.details.typeVarScopeId;const d=e.getBuiltInType(s,"object");o.details.baseClasses.push((0,c.isInstantiableClass)(d)?d:c.UnknownType.create()),(0,p.computeMroLinearization)(o);const u=c.ClassType.cloneAsInstance(o);o.isAsymmetricDescriptor=null!==(i=r.isAsymmetricDescriptor)&&void 0!==i&&i;const g=o.details.fields;r.details.fields.forEach(((e,t)=>{e.isIgnoredForProtocolMatch()||g.set(t,e)})),y(u,e);const f=l.Symbol.createWithType(4,c.FunctionType.cloneWithNewFlags(n,4|n.details.flags));return g.set("fdel",f),m(u,n,e),h(u),u},t.canAssignProperty=function(e,t,n,s,i,a,o,l=0){const d=c.ClassType.cloneAsInstance(i);let u=!0;return[{name:"fget",missingDiagMsg:r.Localizer.DiagnosticAddendum.missingGetter,incompatibleDiagMsg:r.Localizer.DiagnosticAddendum.incompatibleGetter},{name:"fset",missingDiagMsg:r.Localizer.DiagnosticAddendum.missingSetter,incompatibleDiagMsg:r.Localizer.DiagnosticAddendum.incompatibleSetter},{name:"fdel",missingDiagMsg:r.Localizer.DiagnosticAddendum.missingDeleter,incompatibleDiagMsg:r.Localizer.DiagnosticAddendum.incompatibleDeleter}].forEach((r=>{const m=t.details.fields.get(r.name);let y=m?e.getDeclaredTypeOfSymbol(m):void 0;if(y&&(0,c.isFunction)(y)){const t=n.details.fields.get(r.name);let m=t?e.getDeclaredTypeOfSymbol(t):void 0;if(!m||!(0,c.isFunction)(m))return a&&a.addMessage(r.missingDiagMsg()),void(u=!1);m=(0,p.partiallySpecializeType)(m,i),y=(0,p.partiallySpecializeType)(y,s);const h=e.bindFunctionToClassOrObject(d,y,void 0,void 0,l),g=e.bindFunctionToClassOrObject(d,m,void 0,void 0,l);h&&g&&e.canAssignType(h,g,a,o,0,l)||(u=!1)}})),u}},26477:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getPyTypedInfo=void 0;const s=n(94647);t.getPyTypedInfo=function(e,t){if(!e.existsSync(t)||!(0,s.isDirectory)(e,t))return;let n=!1;const i=(0,s.combinePaths)(t,"py.typed");if(!e.existsSync(t)||!(0,s.isFile)(e,i))return;const r=e.statSync(i);if(r.size>0&&r.size<65536){const t=e.readFileSync(i,"utf8");(t.match(/partial\n/)||t.match(/partial\r\n/))&&(n=!0)}return{pyTypedPath:i,isPartiallyTyped:n}}},96453:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getPathsFromPthFiles=t.isPythonBinary=t.findPythonSearchPaths=t.getTypeshedSubdirectory=t.getTypeShedFallbackPath=t.thirdPartyFolderName=t.stdLibFolderName=void 0;const a=n(98173),o=r(n(97956)),l=n(94647);function c(e,t){const n=[];return e.readdirEntriesSync(t).filter((e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(".pth"))).sort(((e,t)=>(0,a.compareComparableValues)(e.name,t.name))).forEach((s=>{const i=(0,l.combinePaths)(t,s.name),r=(0,l.tryStat)(e,i);if((null==r?void 0:r.isFile())&&r.size>0&&r.size<65536){e.readFileSync(i,"utf8").split(/\r?\n/).forEach((s=>{const i=s.trim();if(i.length>0&&!i.startsWith("#")&&!i.match(/^import\s/)){const s=(0,l.combinePaths)(t,i);e.existsSync(s)&&(0,l.isDirectory)(e,s)&&n.push(s)}}))}})),n}function p(e,t){return!e.some((e=>e===t))&&(e.push(t),!0)}t.stdLibFolderName="stdlib",t.thirdPartyFolderName="stubs",t.getTypeShedFallbackPath=function(e){let t=e.getModulePath();if(!t)return;t=(0,l.getDirectoryPath)((0,l.ensureTrailingDirectorySeparator)((0,l.normalizePath)(t)));const n=(0,l.combinePaths)(t,o.typeshedFallback);if(e.existsSync(n))return n;const s=(0,l.combinePaths)((0,l.getDirectoryPath)(t),o.typeshedFallback);return e.existsSync(s)?s:void 0},t.getTypeshedSubdirectory=function(e,n){return(0,l.combinePaths)(e,n?t.stdLibFolderName:t.thirdPartyFolderName)},t.findPythonSearchPaths=function(e,t,n,s,i,r){if(s.push("Finding python search paths"),void 0!==t.venvPath&&t.venv){const n=t.venv,i=(0,l.combinePaths)(t.venvPath,n),r=[],a=[];if([o.lib,o.lib64,o.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 ${o.sitePackages}`);const s=(0,l.combinePaths)(t,o.sitePackages);if(e.existsSync(s))return n.push(`Found path '${s}'`),s;n.push(`Did not find '${s}', so looking for python subdirectory`);const i=(0,l.getFileSystemEntries)(e,t);for(let s=0;s<i.directories.length;s++){const r=i.directories[s];if(r.startsWith("python")){const s=(0,l.combinePaths)(t,r,o.sitePackages);if(e.existsSync(s))return n.push(`Found path '${s}'`),s;n.push(`Path '${s}' is not a valid directory`)}}return}(e,(0,l.combinePaths)(i,t),s);n&&(p(r,n),a.push(n))})),a.forEach((t=>{c(e,t).forEach((e=>{p(r,e)}))})),r.length>0)return s.push(`Found the following '${o.sitePackages}' dirs`),r.forEach((e=>{s.push(` ${e}`)})),r;s.push(`Did not find any '${o.sitePackages}' dirs. Falling back on python interpreter.`)}const a=n.getPythonSearchPaths(t.pythonPath,s);if(i&&r){return a.paths.filter((e=>!(0,l.containsPath)(r,e,!0)||(0,l.containsPath)(a.prefix,e,!0)))}return a.paths},t.isPythonBinary=function(e){return"python"===(e=e.trim())||"python3"===e},t.getPathsFromPthFiles=c},17640:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Scope=void 0;const s=n(20823),i=n(97882);t.Scope=class{constructor(e,t){this.symbolTable=new Map,this.notLocalBindings=new Map,this.type=e,this.parent=t}getGlobalScope(){let e=this;for(;e;){if(3===e.type||4===e.type)return e;e=e.parent}return(0,s.fail)("failed to find scope"),this}isIndependentlyExecutable(){return 3===this.type||1===this.type}lookUpSymbol(e){return this.symbolTable.get(e)}lookUpSymbolRecursive(e,t=!1,n=!1){const s=this.symbolTable.get(e);if(s){if(t&&s.isExternallyHidden())return;const e=s.getDeclarations();if(0===e.length||e.some((e=>1!==e.type||!e.isDefinedByMemberAccess)))return{symbol:s,isOutsideCallerModule:t,isBeyondExecutionScope:n,scope:this}}let i;if(i=1===this.notLocalBindings.get(e)?this.getGlobalScope():this.parent,i)return i.lookUpSymbolRecursive(e,t||3===this.type,n||this.isIndependentlyExecutable())}addSymbol(e,t){const n=new i.Symbol(t);return this.symbolTable.set(e,n),n}getBindingType(e){return this.notLocalBindings.get(e)}setBindingType(e,t){return this.notLocalBindings.set(e,t)}setSlotsNames(e){this.slotsNames=e}getSlotsNames(){return this.slotsNames}}},57203:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.findTopNodeInScope=t.getScopeHierarchy=t.getScopeForNode=t.getBuiltInScope=void 0;const s=n(35696),i=n(23241);function r(e){const t=(0,i.getEvaluationScopeNode)(e);return(0,s.getScope)(t)}t.getBuiltInScope=function(e){let t=e;for(;4!==t.type;)t=t.parent;return t},t.getScopeForNode=r,t.getScopeHierarchy=function(e,t){const n=[];let s=e;for(;s;){const e=r(s);if(!e)return;if(0!==n.length&&n[n.length-1]===e||n.push(e),e===t)return n;s=s.parent}return t?void 0:n},t.findTopNodeInScope=function(e,t){let n,i=e,r=!1;for(;i;){if((0,s.getScope)(i)===t)r=!0;else if(r)return n;n=i,i=i.parent}}},44314:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.AnalyzerService=t.pyprojectTomlName=t.configFileNames=void 0;const a=r(n(11128)),o=r(n(83352)),l=n(38213),c=n(14943),p=n(11043),d=n(6021),u=n(60964),m=n(94647),y=n(76962),h=n(47041),g=n(67145),f=n(96453);t.configFileNames=["pyrightconfig.json"],t.pyprojectTomlName="pyproject.toml";const T=(0,m.normalizeSlashes)("/.git/"),_=/\.pyi?$/;class v{constructor(e,t,n,s,i,r,a,o,d,m,y){this._typeStubTargetIsSingleFile=!1,this._requireTrackedFileUpdate=!0,this._lastUserInteractionTime=Date.now(),this._disposed=!1,this._instanceName=e,this._console=n||new p.StandardConsole,this._executionRootPath="",this._extension=a,this._importResolverFactory=i||v.createImportResolver,this._maxAnalysisTimeInForeground=d,this._backgroundAnalysisProgramFactory=m,this._cancellationProvider=null!=y?y:new l.DefaultCancellationProvider,this._hostFactory=null!=s?s:()=>new u.NoAccessHost,r=null!=r?r:new c.ConfigOptions(process.cwd());const g=this._importResolverFactory(t,r,this._hostFactory());this._backgroundAnalysisProgram=void 0!==m?m(this._console,r,g,this._extension,o,this._maxAnalysisTimeInForeground):new h.BackgroundAnalysisProgram(this._console,r,g,this._extension,o,this._maxAnalysisTimeInForeground)}clone(e,t,n){const s=new v(e,null!=n?n:this._fs,this._console,this._hostFactory,this._importResolverFactory,this._backgroundAnalysisProgram.configOptions,this._extension,t,this._maxAnalysisTimeInForeground,this._backgroundAnalysisProgramFactory,this._cancellationProvider);for(const e of this.backgroundAnalysisProgram.program.getOpened()){const t=e.sourceFile.getClientVersion();void 0!==t&&s.setFileOpened(e.sourceFile.getFilePath(),t,e.sourceFile.getOpenFileContents())}return s}dispose(){this._disposed=!0,this._removeSourceFileWatchers(),this._removeConfigFileWatcher(),this._removeLibraryFileWatcher(),this._clearReloadConfigTimer(),this._clearReanalysisTimer(),this._clearLibraryReanalysisTimer()}get librarySearchPathsToWatch(){return this._librarySearchPathsToWatch}get backgroundAnalysisProgram(){return this._backgroundAnalysisProgram}static createImportResolver(e,t,n){return new g.ImportResolver(e,t,n)}setCompletionCallback(e){this._onCompletionCallback=e,this._backgroundAnalysisProgram.setCompletionCallback(e)}setOptions(e){this._commandLineOptions=e;const t=this._hostFactory(),n=this._getConfigOptions(t,e);n.pythonPath&&n.ensureDefaultPythonVersion(t,this._console),n.ensureDefaultPythonPlatform(t,this._console),this._backgroundAnalysisProgram.setConfigOptions(n),this._executionRootPath=(0,m.normalizePath)((0,m.combinePaths)(e.executionRoot,n.projectRoot)),this._applyConfigOptions(t)}isTracked(e){for(const t of this._configOptions.include)if(this._matchIncludeFileSpec(t.regExp,this._configOptions.exclude,e))return!0;return!1}setFileOpened(e,t,n,s=!1,i){this._backgroundAnalysisProgram.setFileOpened(e,t,n,{isTracked:this.isTracked(e),ipythonMode:s,chainedFilePath:i}),this._scheduleReanalysis(!1)}updateOpenFileContents(e,t,n,s=!1,i){this._backgroundAnalysisProgram.updateOpenFileContents(e,t,n,{isTracked:this.isTracked(e),ipythonMode:s,chainedFilePath:i}),this._scheduleReanalysis(!1)}test_setIndexing(e,t){this._backgroundAnalysisProgram.test_setIndexing(e,t)}startIndexing(e){this._backgroundAnalysisProgram.startIndexing(e)}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,s,i,r,a){return this._program.getAutoImports(e,t,n,s,this._backgroundAnalysisProgram.getIndexing(e),i,r,a)}getDefinitionForPosition(e,t,n,s){return this._program.getDefinitionsForPosition(e,t,n,s)}getTypeDefinitionForPosition(e,t,n){return this._program.getTypeDefinitionsForPosition(e,t,n)}reportReferencesForPosition(e,t,n,s,i){this._program.reportReferencesForPosition(e,t,n,s,i)}addSymbolsForDocument(e,t,n){this._program.addSymbolsForDocument(e,t,n)}reportSymbolsForWorkspace(e,t,n){this._program.reportSymbolsForWorkspace(e,t,n)}getHoverForPosition(e,t,n,s){return this._program.getHoverForPosition(e,t,n,s)}getDocumentHighlight(e,t,n){return this._program.getDocumentHighlight(e,t,n)}getSignatureHelpForPosition(e,t,n,s){return this._program.getSignatureHelpForPosition(e,t,n,s)}getCompletionsForPosition(e,t,n,s,i,r){return this._program.getCompletionsForPosition(e,t,n,s,i,this._backgroundAnalysisProgram.getIndexing(e),r)}getEvaluator(){return this._program.evaluator}resolveCompletionItem(e,t,n,s,i){this._program.resolveCompletionItem(e,t,n,s,this._backgroundAnalysisProgram.getIndexing(e),i)}performQuickAction(e,t,n,s){return this._program.performQuickAction(e,t,n,s)}renameModule(e,t,n){return this._program.renameModule(e,t,n)}canRenameSymbolAtPosition(e,t,n,s,i){return this._program.canRenameSymbolAtPosition(e,t,n,s,i)}renameSymbolAtPosition(e,t,n,s,i,r){return this._program.renameSymbolAtPosition(e,t,n,s,i,r)}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(this._backgroundAnalysisProgram.host,e)}test_getFileNamesFromFileSpecs(){return this._getFileNamesFromFileSpecs()}_getConfigOptions(e,t){var n,s,i;let r,a,o=t.executionRoot;t.configFilePath?(r=(0,m.combinePaths)(t.executionRoot,(0,m.normalizePath)(t.configFilePath)),this._fs.existsSync(r)?r.toLowerCase().endsWith(".json")?o=(0,m.getDirectoryPath)(r):(o=r,r=this._findConfigFile(r),r||this._console.info(`Configuration file not found at ${o}.`)):(this._console.info(`Configuration file not found at ${r}.`),r=t.executionRoot)):o&&(r=this._findConfigFile(o),r||t.fromVsCodeExtension||(r=this._findConfigFileHereOrUp(o)),r?o=(0,m.getDirectoryPath)(r):(this._console.info("No configuration file found."),r=void 0)),r||(a=this._findPyprojectTomlFile(o),a||t.fromVsCodeExtension||(a=this._findPyprojectTomlFileHereOrUp(o)),a?(o=(0,m.getDirectoryPath)(a),this._console.info(`pyproject.toml file found at ${o}.`)):this._console.info("No pyproject.toml file found."));const l=new c.ConfigOptions(o,this._typeCheckingMode),p=["**/node_modules","**/__pycache__","**/.*"];let d;if(t.pythonPath&&(this._console.info(`Setting pythonPath for service "${this._instanceName}": "${t.pythonPath}"`),l.pythonPath=t.pythonPath),l.defaultPythonPlatform=t.pythonPlatform,l.defaultPythonVersion=t.pythonVersion,l.ensureDefaultExtraPaths(this._fs,t.autoSearchPaths||!1,t.extraPaths),t.fileSpecs.length>0?t.fileSpecs.forEach((e=>{l.include.push((0,m.getFileSpec)(this._fs,o,e))})):r||t.executionRoot&&(l.include.push((0,m.getFileSpec)(this._fs,t.executionRoot,".")),p.forEach((e=>{l.exclude.push((0,m.getFileSpec)(this._fs,t.executionRoot,e))}))),this._configFilePath=r||a,r?(this._console.info(`Loading configuration file at ${r}`),d=this._parseJsonConfigFile(r)):a&&(this._console.info(`Loading pyproject.toml file at ${a}`),d=this._parsePyprojectTomlFile(a)),d){l.initializeFromJson(d,this._typeCheckingMode,this._console,this._fs,e,t.diagnosticSeverityOverrides,t.fileSpecs.length>0);const n=(0,m.getDirectoryPath)(this._configFilePath);0===l.include.length&&(this._console.info(`No include entries specified; assuming ${n}`),l.include.push((0,m.getFileSpec)(this._fs,n,"."))),0===l.exclude.length&&(p.forEach((e=>{this._console.info(`Auto-excluding ${e}`),l.exclude.push((0,m.getFileSpec)(this._fs,n,e))})),void 0===l.autoExcludeVenv&&(l.autoExcludeVenv=!0))}else l.autoExcludeVenv=!0,l.applyDiagnosticOverrides(t.diagnosticSeverityOverrides);l.analyzeUnannotatedFunctions=null===(n=t.analyzeUnannotatedFunctions)||void 0===n||n;const u=(e,n)=>{const s=t.fromVsCodeExtension?"the client settings":"a command-line option";this._console.warn(`The ${e} has been specified in both the config file and ${s}. The value in the config file (${n}) will take precedence`)};if(t.venvPath&&(l.venvPath?u("venvPath",l.venvPath):l.venvPath=t.venvPath),t.typeshedPath&&(l.typeshedPath?u("typeshedPath",l.typeshedPath):l.typeshedPath=t.typeshedPath),l.verboseOutput=null!==(s=t.verboseOutput)&&void 0!==s?s:l.verboseOutput,l.checkOnlyOpenFiles=!!t.checkOnlyOpenFiles,l.autoImportCompletions=!!t.autoImportCompletions,l.indexing=!!t.indexing,l.logTypeEvaluationTime=!!t.logTypeEvaluationTime,l.typeEvaluationTimeThreshold=t.typeEvaluationTimeThreshold,void 0===l.useLibraryCodeForTypes?l.useLibraryCodeForTypes=!!t.useLibraryCodeForTypes:void 0!==t.useLibraryCodeForTypes&&u("useLibraryCodeForTypes",l.useLibraryCodeForTypes),t.stubPath?l.stubPath?u("stubPath",l.stubPath):l.stubPath=t.stubPath:l.stubPath||(l.stubPath=(0,m.normalizePath)((0,m.combinePaths)(l.projectRoot,"typings"))),l.venvPath&&(this._fs.existsSync(l.venvPath)&&(0,m.isDirectory)(this._fs,l.venvPath)||this._console.error(`venvPath ${l.venvPath} is not a valid directory.`),l.venv=null!==(i=l.venv)&&void 0!==i?i:this._configOptions.venv,l.venv)){const t=(0,m.combinePaths)(l.venvPath,l.venv);if(this._fs.existsSync(t)&&(0,m.isDirectory)(this._fs,t)){const t=[];void 0===(0,f.findPythonSearchPaths)(this._fs,l,e,t)&&(this._console.error(`site-packages directory cannot be located for venvPath ${l.venvPath} and venv ${l.venv}.`),l.verboseOutput&&t.forEach((e=>{this._console.error(` ${e}`)})))}else this._console.error(`venv ${l.venv} subdirectory not found in venv path ${l.venvPath}.`)}return l.venv&&(l.venvPath||this._console.warn("venvPath not specified, so venv settings will be ignored.")),l.typeshedPath&&(this._fs.existsSync(l.typeshedPath)&&(0,m.isDirectory)(this._fs,l.typeshedPath)||this._console.error(`typeshedPath ${l.typeshedPath} is not a valid directory.`)),l.stubPath&&(this._fs.existsSync(l.stubPath)&&(0,m.isDirectory)(this._fs,l.stubPath)||this._console.warn(`stubPath ${l.stubPath} is not a valid directory.`)),l}writeTypeStub(e){var t;const n=this._getTypeStubFolder();this._program.writeTypeStub(null!==(t=this._typeStubTargetPath)&&void 0!==t?t:"",this._typeStubTargetIsSingleFile,n,e)}writeTypeStubInBackground(e){var t;const n=this._getTypeStubFolder();return this._backgroundAnalysisProgram.writeTypeStub(null!==(t=this._typeStubTargetPath)&&void 0!==t?t:"",this._typeStubTargetIsSingleFile,n,e)}invalidateAndForceReanalysis(e=!0,t=!0,n=!1){n&&this._updateTrackedFileList(!1),this._backgroundAnalysisProgram.invalidateAndForceReanalysis(e,t)}restart(){this._applyConfigOptions(this._hostFactory()),this._backgroundAnalysisProgram.restart()}get _fs(){return this._backgroundAnalysisProgram.importResolver.fileSystem}get _program(){return this._backgroundAnalysisProgram.program}get _configOptions(){return this._backgroundAnalysisProgram.configOptions}get _watchForSourceChanges(){var e;return!!(null===(e=this._commandLineOptions)||void 0===e?void 0:e.watchForSourceChanges)}get _watchForLibraryChanges(){var e;return!!(null===(e=this._commandLineOptions)||void 0===e?void 0:e.watchForLibraryChanges)}get _watchForConfigChanges(){var e;return!!(null===(e=this._commandLineOptions)||void 0===e?void 0:e.watchForConfigChanges)}get _typeCheckingMode(){var e;return null===(e=this._commandLineOptions)||void 0===e?void 0:e.typeCheckingMode}get _verboseOutput(){return!!this._configOptions.verboseOutput}get _typeStubTargetImportName(){var e;return null===(e=this._commandLineOptions)||void 0===e?void 0:e.typeStubTargetImportName}_getTypeStubFolder(){const e=this._configOptions.stubPath;if(!this._typeStubTargetPath||!this._typeStubTargetImportName){const e=`Import '${this._typeStubTargetImportName}' could not be resolved`;throw this._console.error(e),new Error(e)}if(!e){const e="No typings path was specified";throw this._console.info(e),new Error(e)}const t=this._typeStubTargetImportName.split(".");if(0===t[0].length){const e=`Import '${this._typeStubTargetImportName}' could not be resolved`;throw this._console.error(e),new Error(e)}try{this._fs.existsSync(e)||this._fs.mkdirSync(e)}catch(t){const n=`Could not create typings directory '${e}'`;throw this._console.error(n),new Error(n)}const n=(0,m.combinePaths)(e,t[0]),s=(0,m.combinePaths)(e,...t);try{this._fs.existsSync(s)||(0,m.makeDirectories)(this._fs,s,e)}catch(e){const t=`Could not create typings subdirectory '${s}'`;throw this._console.error(t),new Error(t)}return n}_findConfigFileHereOrUp(e){return(0,m.forEachAncestorDirectory)(e,(e=>this._findConfigFile(e)))}_findConfigFile(e){for(const n of t.configFileNames){const t=(0,m.combinePaths)(e,n);if(this._fs.existsSync(t))return t}}_findPyprojectTomlFileHereOrUp(e){return(0,m.forEachAncestorDirectory)(e,(e=>this._findPyprojectTomlFile(e)))}_findPyprojectTomlFile(e){const n=(0,m.combinePaths)(e,t.pyprojectTomlName);if(this._fs.existsSync(n))return n}_parseJsonConfigFile(e){return this._attemptParseFile(e,(e=>o.parse(e)))}_parsePyprojectTomlFile(e){return this._attemptParseFile(e,((t,n)=>{try{const e=a.parse(t);if(e&&e.tool&&e.tool.pyright)return e.tool.pyright}catch(e){throw this._console.error(`Pyproject file parse attempt ${n} error: ${JSON.stringify(e)}`),e}this._console.error(`Pyproject file "${e}" is missing "[tool.pyright]" section.`)}))}_attemptParseFile(e,t){let n="",s=0;for(;;){try{n=this._fs.readFileSync(e,"utf8")}catch{return this._console.error(`Config file "${e}" could not be read.`),void this._reportConfigParseError()}let i=!1;try{return t(n,s+1)}catch(e){i=!0}if(!i)break;if(s++>=5)return this._console.error(`Config file "${e}" could not be parsed. Verify that format is correct.`),void this._reportConfigParseError()}}_getFileNamesFromFileSpecs(){const e=new Map;return y.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=(0,g.createImportedModuleDescriptor)(this._typeStubTargetImportName),n=this._backgroundAnalysisProgram.importResolver.resolveImport("",e,t);if(n.isImportFound){const e=[],t=n.resolvedPaths[n.resolvedPaths.length-1],s=(0,m.isFile)(this._fs,t),i=s&&"__init__"===(0,m.stripFileExtension)((0,m.getFileName)(t));let r=t;s&&(r=(0,m.getDirectoryPath)(r));for(let e=n.resolvedPaths.length-2;e>=0;e--)r=n.resolvedPaths[e]?n.resolvedPaths[e]:(0,m.getDirectoryPath)(r);(0,m.isDirectory)(this._fs,r)?this._typeStubTargetPath=r:(0,m.isFile)(this._fs,r)&&(this._typeStubTargetPath=(0,m.getDirectoryPath)(r)),t?(e.push(t),this._typeStubTargetIsSingleFile=1===n.resolvedPaths.length&&!i):this._typeStubTargetIsSingleFile=!1,n.filteredImplicitImports.forEach((t=>{e.push(t.path)})),this._backgroundAnalysisProgram.setAllowedThirdPartyImports([this._typeStubTargetImportName]),this._backgroundAnalysisProgram.setTrackedFiles(e)}else this._console.error(`Import '${this._typeStubTargetImportName}' not found`)}else{let t=[];this._console.info("Searching for source files"),t=this._getFileNamesFromFileSpecs(),this._backgroundAnalysisProgram.setTrackedFiles(t),this._backgroundAnalysisProgram.markAllFilesDirty(e),0===t.length?this._console.info("No source files found."):this._console.info(`Found ${t.length} source `+(1===t.length?"file":"files"))}this._requireTrackedFileUpdate=!1}_matchFiles(e,t){const n=[["bin","activate"],["Scripts","activate"],["pyvenv.cfg"]],s=[],i=Date.now();let r=!1;const a=(e,a)=>{if(!r){.001*(Date.now()-i)>=10&&(this._console.error('Enumeration of workspace source files is taking longer than 10 seconds.\nThis may be because:\n* You have opened your home directory or entire hard drive as a workspace\n* Your workspace contains a very large number of directories and files\n* Your workspace contains a symlink to a directory with many files\n* Your workspace is remote, and file enumeration is slow\nTo reduce this time, open a workspace directory with fewer files or add a pyrightconfig.json configuration file with an "exclude" section to exclude subdirectories from your workspace. For more details, refer to https://github.com/microsoft/pyright/blob/main/docs/configuration.md.'),r=!0)}if(this._configOptions.autoExcludeVenv&&n.some((t=>this._fs.existsSync((0,m.combinePaths)(e,...t)))))return void this._console.info(`Auto-excluding ${e}`);const{files:o,directories:c}=(0,m.getFileSystemEntries)(this._fs,e);for(const n of o){const i=(0,m.combinePaths)(e,n);this._matchIncludeFileSpec(a,t,i)&&s.push(i)}for(const n of c){const s=(0,m.combinePaths)(e,n);a.test(s)&&(this._isInExcludePath(s,t)||l(s,a))}},o=new Set,l=(e,t)=>{const n=(0,m.tryRealpath)(this._fs,e);if(n)if(o.has(n))this._console.warn(`Skipping recursive symlink "${e}" -> "${n}"`);else{o.add(n);try{a(e,t)}finally{o.delete(n)}}else this._console.warn(`Skipping broken link "${e}"`)};return e.forEach((e=>{if(!this._isInExcludePath(e.wildcardRoot,t)){let t=!1;const n=(0,m.tryStat)(this._fs,e.wildcardRoot);(null==n?void 0:n.isFile())?this._shouldIncludeFile(e.wildcardRoot)&&(s.push(e.wildcardRoot),t=!0):(null==n?void 0:n.isDirectory())&&(l(e.wildcardRoot,e.regExp),t=!0),t||this._console.error(`File or directory "${e.wildcardRoot}" does not exist.`)}})),s}_removeSourceFileWatchers(){this._sourceFileWatcher&&(this._sourceFileWatcher.close(),this._sourceFileWatcher=void 0)}_updateSourceFileWatchers(){if(this._removeSourceFileWatchers(),this._watchForSourceChanges&&this._configOptions.include.length>0){const e=this._configOptions.include.map((e=>(0,m.combinePaths)(this._executionRootPath,e.wildcardRoot)));try{this._verboseOutput&&this._console.info(`Adding fs watcher for directories:\n ${e.join("\n")}`);const t=(0,d.ignoredWatchEventFunction)(e);this._sourceFileWatcher=this._fs.createFileSystemWatcher(e,((e,n)=>{if(!n)return;if(this._verboseOutput&&this._console.info(`SourceFile: Received fs event '${e}' for path '${n}'`),t(n))return;if(n.endsWith(".tmp")||n.endsWith(".git")||n.includes(T))return;const s=function(e,t,n,s,i){const r=(0,m.tryStat)(e,i);if("add"===s){if(!r)return;return{event:s,isFile:r.isFile()}}if("change"===s){if(!r){const e=!!n.getSourceFile(i);if(!e&&!n.containsSourceFileIn(i))return;return{event:"unlink",isFile:e}}return{event:s,isFile:r.isFile()}}return void t.warn(`Received unknown file change event: '${s}' for '${i}'`)}(this._fs,this._console,this._program,e,n);s&&(!s.isFile||(0,m.hasPythonExtension)(n)&&!function(e){const t=(0,m.getFileName)(e).split(".");if(4===t.length&&t[3]===t[1]&&32===t[2].length)return!0;return!1}(n)&&this.isTracked(n))&&(!s.isFile||"change"!==s.event&&"unlink"!==s.event?(this.invalidateAndForceReanalysis(!1,!1),this._scheduleReanalysis(!0)):(this._backgroundAnalysisProgram.markFilesDirty([n],!1),this._scheduleReanalysis(!1)))}))}catch{this._console.error(`Exception caught when installing fs watcher for:\n ${e.join("\n")}`)}}}_removeLibraryFileWatcher(){this._libraryFileWatcher&&(this._libraryFileWatcher.close(),this._libraryFileWatcher=void 0)}_updateLibraryFileWatcher(){if(this._removeLibraryFileWatcher(),!this._watchForLibraryChanges)return;this._librarySearchPathsToWatch=(0,f.findPythonSearchPaths)(this._fs,this._backgroundAnalysisProgram.configOptions,this._backgroundAnalysisProgram.host,[],!0,this._executionRootPath);const e=this._librarySearchPathsToWatch;if(e&&e.length>0)try{this._verboseOutput&&this._console.info(`Adding fs watcher for library directories:\n ${e.join("\n")}`);const t=(0,d.ignoredWatchEventFunction)(e);this._libraryFileWatcher=this._fs.createFileSystemWatcher(e,((e,n)=>{n&&(this._verboseOutput&&this._console.info(`LibraryFile: Received fs event '${e}' for path '${n}'`),t(n)||this._scheduleLibraryAnalysis())}))}catch{this._console.error(`Exception caught when installing fs watcher for:\n ${e.join("\n")}`)}}_clearLibraryReanalysisTimer(){var e;this._libraryReanalysisTimer&&(clearTimeout(this._libraryReanalysisTimer),this._libraryReanalysisTimer=void 0,null===(e=this._backgroundAnalysisProgram)||void 0===e||e.cancelIndexing())}_scheduleLibraryAnalysis(){this._disposed||(this._clearLibraryReanalysisTimer(),this._libraryReanalysisTimer=setTimeout((()=>{this._clearLibraryReanalysisTimer(),this.invalidateAndForceReanalysis(!1),this._scheduleReanalysis(!1)}),6e5))}_removeConfigFileWatcher(){this._configFileWatcher&&(this._configFileWatcher.close(),this._configFileWatcher=void 0)}_updateConfigFileWatcher(){this._removeConfigFileWatcher(),this._watchForConfigChanges&&(this._configFilePath?this._configFileWatcher=this._fs.createFileSystemWatcher([this._configFilePath],(e=>{this._verboseOutput&&this._console.info(`Received fs event '${e}' for config file`),this._scheduleReloadConfigFile()})):this._executionRootPath&&(this._configFileWatcher=this._fs.createFileSystemWatcher([this._executionRootPath],((e,n)=>{if(n&&("add"===e||"change"===e)){const s=(0,m.getFileName)(n);s&&t.configFileNames.some((e=>e===s))&&(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._backgroundAnalysisProgram.host,t=this._getConfigOptions(e,this._commandLineOptions);this._backgroundAnalysisProgram.setConfigOptions(t),this._applyConfigOptions(e)}}_applyConfigOptions(e){var t;const n=this._importResolverFactory(this._fs,this._backgroundAnalysisProgram.configOptions,e);if(this._backgroundAnalysisProgram.setImportResolver(n),(null===(t=this._commandLineOptions)||void 0===t?void 0:t.fromVsCodeExtension)||this._configOptions.verboseOutput){const e=this._configOptions.verboseOutput?p.LogLevel.Info:p.LogLevel.Log;for(const t of this._configOptions.getExecutionEnvironments()){(0,p.log)(this._console,e,`Search paths for ${t.root||"<default>"}`);n.getImportRoots(t,!0).forEach((t=>{(0,p.log)(this._console,e,` ${t}`)}))}}this._updateLibraryFileWatcher(),this._updateConfigFileWatcher(),this._updateSourceFileWatchers(),this._updateTrackedFileList(!0),this._scheduleReanalysis(!1)}_clearReanalysisTimer(){this._analyzeTimer&&(clearTimeout(this._analyzeTimer),this._analyzeTimer=void 0)}_scheduleReanalysis(e){var t,n;if(this._disposed||!(null===(t=this._commandLineOptions)||void 0===t?void 0:t.enableAmbientAnalysis))return;e&&(this._requireTrackedFileUpdate=!0),null===(n=this._backgroundAnalysisCancellationSource)||void 0===n||n.cancel(),this._clearReanalysisTimer();const s=Date.now()-this._lastUserInteractionTime,i=Math.max(250-s,20);this._analyzeTimer=setTimeout((()=>{this._analyzeTimer=void 0,this._requireTrackedFileUpdate&&this._updateTrackedFileList(!1),this._backgroundAnalysisCancellationSource=this._cancellationProvider.createCancellationTokenSource();this._backgroundAnalysisProgram.startAnalysis(this._backgroundAnalysisCancellationSource.token)&&this._scheduleReanalysis(!1)}),i)}_reportConfigParseError(){this._onCompletionCallback&&this._onCompletionCallback({diagnostics:[],filesInProgram:0,filesRequiringAnalysis:0,checkingOnlyOpenFiles:!0,fatalErrorOccurred:!1,configParseErrorOccurred:!0,elapsedTime:0})}_shouldIncludeFile(e){return _.test(e)}_isInExcludePath(e,t){return!!t.find((t=>t.regExp.test(e)))}_matchIncludeFileSpec(e,t,n){return!(!e.test(n)||this._isInExcludePath(n,t)||!this._shouldIncludeFile(n))}}t.AnalyzerService=v},54549:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.SourceFile=void 0;const a=n(80327),o=n(71267),l=r(n(91197)),c=n(38213),p=n(14943),d=n(11043),u=n(20823),m=n(24319),y=n(85036),h=n(77134),g=n(13727),f=n(94647),T=n(28348),_=r(n(14551)),v=n(80957),b=n(979),I=n(76962),C=n(80088),S=n(27888),F=n(70234),x=n(54989),D=n(8871),P=n(47458),A=n(5165),E=n(75659),k=n(74426),w=n(55390),N=n(14014),M=r(n(35696)),R=n(91242),O=n(51153),L=r(n(81044)),V=n(15297),U=n(51660),z=52428800;t.SourceFile=class{constructor(e,t,n,s,i,r,a,l=!1){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._typeIgnoreLines=new Map,this._pyrightIgnoreLines=new Map,this._diagnosticRuleSet=(0,p.getBasicDiagnosticRuleSet)(),this._circularDependencies=[],this._isBindingNeeded=!0,this._isCheckingNeeded=!0,this._indexingNeeded=!0,this._ipythonMode=!1,this.fileSystem=e,this._console=r||new d.StandardConsole,this._filePath=t,this._moduleName=n,this._isStubFile=t.endsWith(".pyi"),this._isThirdPartyImport=s,this._isThirdPartyPyTypedPresent=i;const c=(0,f.getFileName)(t);this._isTypingStubFile=this._isStubFile&&(this._filePath.endsWith((0,f.normalizeSlashes)("stdlib/typing.pyi"))||"typing_extensions.pyi"===c),this._isTypingExtensionsStubFile=this._isStubFile&&"typing_extensions.pyi"===c,this._isBuiltInStubFile=!1,this._isStubFile&&(this._filePath.endsWith((0,f.normalizeSlashes)("stdlib/collections/__init__.pyi"))||this._filePath.endsWith((0,f.normalizeSlashes)("stdlib/asyncio/futures.pyi"))||this._filePath.endsWith((0,f.normalizeSlashes)("stdlib/asyncio/tasks.pyi"))||this._filePath.endsWith((0,f.normalizeSlashes)("stdlib/builtins.pyi"))||this._filePath.endsWith((0,f.normalizeSlashes)("stdlib/_importlib_modulespec.pyi"))||this._filePath.endsWith((0,f.normalizeSlashes)("stdlib/dataclasses.pyi"))||this._filePath.endsWith((0,f.normalizeSlashes)("stdlib/abc.pyi"))||this._filePath.endsWith((0,f.normalizeSlashes)("stdlib/enum.pyi"))||this._filePath.endsWith((0,f.normalizeSlashes)("stdlib/queue.pyi"))||this._filePath.endsWith((0,f.normalizeSlashes)("stdlib/types.pyi")))&&(this._isBuiltInStubFile=!0),this._logTracker=null!=a?a:new h.LogTracker(r,o.isMainThread?"FG":"BG"),this._ipythonMode=l}getFilePath(){return this._filePath}getDiagnosticVersion(){return this._diagnosticVersion}isStubFile(){return this._isStubFile}isThirdPartyPyTypedPresent(){return this._isThirdPartyPyTypedPresent}getDiagnostics(e,t){if(this._diagnosticVersion===t)return;let n=!0;this._isThirdPartyImport&&(n=!1);let s=[...this._parseDiagnostics,...this._bindDiagnostics,...this._checkerDiagnostics];const i=s,r=new Map(this._typeIgnoreLines),a=new Map(this._pyrightIgnoreLines);this._diagnosticRuleSet.enableTypeIgnoreComments&&this._typeIgnoreLines.size>0&&(s=s.filter((e=>{if(3!==e.category&&4!==e.category)for(let t=e.range.start.line;t<=e.range.end.line;t++)if(this._typeIgnoreLines.has(t))return r.delete(t),!1;return!0}))),this._pyrightIgnoreLines.size>0&&(s=s.filter((e=>{if(3!==e.category&&4!==e.category)for(let t=e.range.start.line;t<=e.range.end.line;t++){const n=this._pyrightIgnoreLines.get(t);if(n){if(!n.rulesList)return a.delete(t),!1;const s=e.getRule();if(!s)return!0;if(n.rulesList.find((e=>e.text===s))){const e=a.get(t);if(null==e?void 0:e.rulesList){const n=e.rulesList.filter((e=>e.text!==s));0===n.length?a.delete(t):a.set(t,{range:e.range,rulesList:n})}return!1}return!0}}return!0})));const o=[];if("none"!==this._diagnosticRuleSet.reportUnnecessaryTypeIgnoreComment){const e=(0,m.convertLevelToCategory)(this._diagnosticRuleSet.reportUnnecessaryTypeIgnoreComment);0===i.filter((e=>0===e.category||1===e.category||2===e.category)).length&&void 0!==this._typeIgnoreAll&&o.push(new m.Diagnostic(e,k.Localizer.Diagnostic.unnecessaryTypeIgnore(),(0,T.convertOffsetsToRange)(this._typeIgnoreAll.range.start,this._typeIgnoreAll.range.start+this._typeIgnoreAll.range.length,this._parseResults.tokenizerOutput.lines))),r.forEach((t=>{var n;(null===(n=this._parseResults)||void 0===n?void 0:n.tokenizerOutput.lines)&&o.push(new m.Diagnostic(e,k.Localizer.Diagnostic.unnecessaryTypeIgnore(),(0,T.convertOffsetsToRange)(t.range.start,t.range.start+t.range.length,this._parseResults.tokenizerOutput.lines)))})),a.forEach((t=>{var n;(null===(n=this._parseResults)||void 0===n?void 0:n.tokenizerOutput.lines)&&(t.rulesList?t.rulesList.forEach((t=>{o.push(new m.Diagnostic(e,k.Localizer.Diagnostic.unnecessaryPyrightIgnoreRule().format({name:t.text}),(0,T.convertOffsetsToRange)(t.range.start,t.range.start+t.range.length,this._parseResults.tokenizerOutput.lines)))})):o.push(new m.Diagnostic(e,k.Localizer.Diagnostic.unnecessaryPyrightIgnore(),(0,T.convertOffsetsToRange)(t.range.start,t.range.start+t.range.length,this._parseResults.tokenizerOutput.lines))))}))}if("none"!==this._diagnosticRuleSet.reportImportCycles&&this._circularDependencies.length>0){const e=(0,m.convertLevelToCategory)(this._diagnosticRuleSet.reportImportCycles);this._circularDependencies.forEach((t=>{s.push(new m.Diagnostic(e,k.Localizer.Diagnostic.importCycleDetected()+"\n"+t.getPaths().map((e=>" "+e)).join("\n"),(0,v.getEmptyRange)()))}))}return void 0!==this._hitMaxImportDepth&&s.push(new m.Diagnostic(0,k.Localizer.Diagnostic.importDepthExceeded().format({depth:this._hitMaxImportDepth}),(0,v.getEmptyRange)())),e.ignore.find((e=>e.regExp.test(this._filePath)))&&(s=[]),this._diagnosticRuleSet.enableTypeIgnoreComments&&void 0!==this._typeIgnoreAll&&(s=s.filter((e=>0!==e.category&&1!==e.category&&2!==e.category))),s=s.concat(o),n||(s=s.filter((e=>3===e.category||4===e.category))),s}getImports(){return this._imports||[]}getBuiltinsImport(){return this._builtinsImport}getIPythonDisplayImport(){return this._ipythonDisplayImport}getModuleSymbolTable(){return this._moduleSymbolTable}didContentsChangeOnDisk(){if(this._clientDocument)return!1;if(void 0===this._lastFileContentLength)return!1;try{const e=this.fileSystem.readFileSync(this._filePath,"utf8");if(e.length!==this._lastFileContentLength)return!0;if(_.hashString(e)!==this._lastFileContentHash)return!0}catch(e){return!0}return!1}dropParseAndBindInfo(){this._parseResults=void 0,this._moduleSymbolTable=void 0,this._isBindingNeeded=!0}markDirty(e=!0){this._fileContentsVersion++,this._isCheckingNeeded=!0,this._isBindingNeeded=!0,this._indexingNeeded=e,this._moduleSymbolTable=void 0,this._cachedIndexResults=void 0}markReanalysisRequired(e){this._isCheckingNeeded=!0,this._parseResults&&(this._parseResults.containsWildcardImport||void 0!==M.getDunderAllInfo(this._parseResults.parseTree)||e)&&(this._parseTreeNeedsCleaning=!0,this._isBindingNeeded=!0,this._moduleSymbolTable=void 0)}getClientVersion(){var e;return null===(e=this._clientDocument)||void 0===e?void 0:e.version}getOpenFileContents(){var e;return null===(e=this._clientDocument)||void 0===e?void 0:e.getText()}getFileContent(){const e=this.getOpenFileContents();if(e)return e;try{const e=this.fileSystem.statSync(this._filePath);if(e.size>z)throw this._console.error(`File length of "${this._filePath}" is ${e.size} which exceeds the maximum supported file size of 52428800`),new Error("File larger than max");return this.fileSystem.readFileSync(this._filePath,"utf8")}catch(e){return}}setClientVersion(e,t){if(null===e)this._clientDocument=void 0;else{this._clientDocument||(this._clientDocument=a.TextDocument.create(this._filePath,"python",e,"")),this._clientDocument=a.TextDocument.update(this._clientDocument,t,e);const n=this._clientDocument.getText(),s=_.hashString(n);n.length===this._lastFileContentLength&&s===this._lastFileContentHash||this.markDirty(),this._lastFileContentLength=n.length,this._lastFileContentHash=s,this._isFileDeleted=!1}}prepareForClose(){}isFileDeleted(){return this._isFileDeleted}isParseRequired(){return!this._parseResults||this._analyzedFileContentsVersion!==this._fileContentsVersion}isBindingRequired(){return!this._isBindingInProgress&&(!!this.isParseRequired()||this._isBindingNeeded)}isIndexingRequired(){return this._indexingNeeded}isCheckingRequired(){return this._isCheckingNeeded}getParseResults(){if(!this.isParseRequired())return this._parseResults}getCachedIndexResults(){return this._cachedIndexResults}cacheIndexResults(e){this._cachedIndexResults=e}addCircularDependency(e){let t=!1;this._circularDependencies.length<4&&(this._circularDependencies.some((t=>t.isEqual(e)))||(this._circularDependencies.push(e),t=!0)),t&&this._diagnosticVersion++}setHitMaxImportDepth(e){this._hitMaxImportDepth=e}parse(e,t,n){return this._logTracker.log(`parsing: ${this._getPathForLogging(this._filePath)}`,(s=>{var i;if(!this.isParseRequired())return s.suppress(),!1;const r=new y.DiagnosticSink;let a=this.getOpenFileContents();if(void 0===a)try{const e=I.timingStats.readFileTime.totalTime;I.timingStats.readFileTime.timeOperation((()=>{if(a=null!=n?n:this.getFileContent(),void 0===a)throw new Error("Can't get file content");this._lastFileContentLength=a.length,this._lastFileContentHash=_.hashString(a)})),s.add(`fs read ${I.timingStats.readFileTime.totalTime-e}ms`)}catch(e){r.addError("Source file could not be read",(0,v.getEmptyRange)()),a="",this.fileSystem.existsSync(this._filePath)||(this._isFileDeleted=!0)}const o=e.findExecEnvironment(this._filePath),l=new N.ParseOptions;l.ipythonMode=this._ipythonMode,this._filePath.endsWith("pyi")&&(l.isStubFile=!0),l.pythonVersion=o.pythonVersion,l.skipFunctionAndClassBody=null!==(i=e.indexGenerationMode)&&void 0!==i&&i;try{const n=(new N.Parser).parseSourceFile(a,l,r);(0,u.assert)(void 0!==n&&void 0!==n.tokenizerOutput),this._parseResults=n,this._typeIgnoreLines=this._parseResults.tokenizerOutput.typeIgnoreLines,this._typeIgnoreAll=this._parseResults.tokenizerOutput.typeIgnoreAll,this._pyrightIgnoreLines=this._parseResults.tokenizerOutput.pyrightIgnoreLines,I.timingStats.resolveImportsTime.timeOperation((()=>{const e=this._resolveImports(t,n.importedModules,o);this._imports=e.imports,this._builtinsImport=e.builtinsImportResult,this._ipythonDisplayImport=e.ipythonDisplayImportResult,this._parseDiagnostics=r.fetchAndClear()}));const s=void 0!==e.strict.find((e=>e.regExp.test(this._filePath)));this._diagnosticRuleSet=L.getFileLevelDirectives(this._parseResults.tokenizerOutput.tokens,e.diagnosticRuleSet,s)}catch(e){const t=(e.stack?e.stack.toString():void 0)||("string"==typeof e.message?e.message:void 0)||JSON.stringify(e);this._console.error(k.Localizer.Diagnostic.internalParseError().format({file:this.getFilePath(),message:t})),this._parseResults={text:"",parseTree:w.ModuleNode.create({start:0,length:0}),importedModules:[],futureImports:new Map,tokenizerOutput:{tokens:new b.TextRangeCollection([]),lines:new b.TextRangeCollection([]),typeIgnoreAll:void 0,typeIgnoreLines:new Map,pyrightIgnoreLines:new Map,predominantEndOfLineSequence:"\n",predominantTabSequence:" ",predominantSingleQuoteCharacter:"'"},containsWildcardImport:!1,typingSymbolAliases:new Map},this._imports=void 0,this._builtinsImport=void 0,this._ipythonDisplayImport=void 0;const n=new y.DiagnosticSink;n.addError(k.Localizer.Diagnostic.internalParseError().format({file:this.getFilePath(),message:t}),(0,v.getEmptyRange)()),this._parseDiagnostics=n.fetchAndClear()}return this._analyzedFileContentsVersion=this._fileContentsVersion,this._indexingNeeded=!0,this._isBindingNeeded=!0,this._isCheckingNeeded=!0,this._parseTreeNeedsCleaning=!1,this._hitMaxImportDepth=void 0,this._diagnosticVersion++,!0}))}index(e,t){return this._logTracker.log(`indexing: ${this._getPathForLogging(this._filePath)}`,(n=>{if(!this._parseResults||!this.isIndexingRequired())return void n.suppress();this._indexingNeeded=!1;const s=x.DocumentSymbolProvider.indexSymbols(M.getFileInfo(this._parseResults.parseTree),this._parseResults,e,t);n.add(`found ${s.length}`);const i=(0,f.stripFileExtension)((0,f.getFileName)(this._filePath));return{privateOrProtected:l.isPrivateOrProtectedName(i),symbols:s}}))}getDefinitionsForPosition(e,t,n,s,i){if(this._parseResults)return S.DefinitionProvider.getDefinitionsForPosition(e,this._parseResults,t,n,s,i)}getTypeDefinitionsForPosition(e,t,n,s,i){if(this._parseResults)return S.DefinitionProvider.getTypeDefinitionsForPosition(e,this._parseResults,t,n,s,i)}getDeclarationForNode(e,t,n,s,i){if(this._parseResults)return A.ReferencesProvider.getDeclarationForNode(e,this._filePath,t,n,s,i)}getDeclarationForPosition(e,t,n,s,i){if(this._parseResults)return A.ReferencesProvider.getDeclarationForPosition(e,this._parseResults,this._filePath,t,n,s,i)}addReferences(e,t,n,s){this._parseResults&&A.ReferencesProvider.addReferences(this._parseResults,this._filePath,e,t,n,s)}addHierarchicalSymbolsForDocument(e,t){(this._parseResults||this._cachedIndexResults)&&x.DocumentSymbolProvider.addHierarchicalSymbolsForDocument(this._parseResults?M.getFileInfo(this._parseResults.parseTree):void 0,this.getCachedIndexResults(),this._parseResults,e,t)}getSymbolsForDocument(e,t){return this._parseResults||this._cachedIndexResults?x.DocumentSymbolProvider.getSymbolsForDocument(this._parseResults?M.getFileInfo(this._parseResults.parseTree):void 0,this.getCachedIndexResults(),this._parseResults,this._filePath,e,t):[]}getHoverForPosition(e,t,n,s,i){if(!this._isBindingNeeded&&this._parseResults)return D.HoverProvider.getHoverForPosition(e,this._parseResults,t,n,s,i)}getDocumentHighlight(e,t,n,s){if(!this._isBindingNeeded&&this._parseResults)return F.DocumentHighlightProvider.getDocumentHighlight(this._parseResults,t,n,s)}getSignatureHelpForPosition(e,t,n,s,i){if(this._parseResults)return E.SignatureHelpProvider.getSignatureHelpForPosition(this._parseResults,e,t,n,s,i)}getCompletionsForPosition(e,t,n,s,i,r,a,o,l,c,p,d){if(!this._parseResults)return;const u=this.getOpenFileContents();if(void 0===u)return;return new C.CompletionProvider(t,this._parseResults,u,s,e,this._filePath,n,i,r,a,o,{nameMap:l,libraryMap:c,getModuleSymbolsMap:p},d).getCompletionsForPosition()}resolveCompletionItem(e,t,n,s,i,r,a,o,l,c,p){const d=this.getOpenFileContents();if(!this._parseResults||void 0===d)return;const u=(0,g.fromLSPAny)(c.data);new C.CompletionProvider(u.workspacePath,this._parseResults,d,t,u.position,this._filePath,e,n,s,i,r,{nameMap:a,libraryMap:o,getModuleSymbolsMap:l},p).resolveCompletionItem(c)}performQuickAction(e,t,n){if(this._parseResults&&void 0!==this.getClientVersion())return(0,P.performQuickAction)(e,t,this._parseResults,n)}bind(e,t,n){return(0,u.assert)(!this.isParseRequired(),"Bind called before parsing"),(0,u.assert)(this.isBindingRequired(),"Bind called unnecessarily"),(0,u.assert)(!this._isBindingInProgress,"Bind called while binding in progress"),(0,u.assert)(void 0!==this._parseResults,"Parse results not available"),this._logTracker.log(`binding: ${this._getPathForLogging(this._filePath)}`,(()=>{try{I.timingStats.bindTime.timeOperation((()=>{this._cleanParseTreeIfRequired();const s=this._buildFileInfo(e,this._parseResults.text,t,n);M.setFileInfo(this._parseResults.parseTree,s);const i=new R.Binder(s,e.indexGenerationMode);if(this._isBindingInProgress=!0,i.bindModule(this._parseResults.parseTree),e.internalTestMode){(new U.TestWalker).walk(this._parseResults.parseTree)}this._bindDiagnostics=s.diagnosticSink.fetchAndClear();const r=M.getScope(this._parseResults.parseTree);(0,u.assert)(void 0!==r,"Module scope not returned by binder"),this._moduleSymbolTable=r.symbolTable}))}catch(e){const t=(e.stack?e.stack.toString():void 0)||("string"==typeof e.message?e.message:void 0)||JSON.stringify(e);this._console.error(k.Localizer.Diagnostic.internalBindError().format({file:this.getFilePath(),message:t}));const n=new y.DiagnosticSink;n.addError(k.Localizer.Diagnostic.internalBindError().format({file:this.getFilePath(),message:t}),(0,v.getEmptyRange)()),this._bindDiagnostics=n.fetchAndClear()}finally{this._isBindingInProgress=!1}this._diagnosticVersion++,this._isCheckingNeeded=!0,this._indexingNeeded=!0,this._isBindingNeeded=!1}))}check(e,t){return(0,u.assert)(!this.isParseRequired(),"Check called before parsing"),(0,u.assert)(!this.isBindingRequired(),"Check called before binding"),(0,u.assert)(!this._isBindingInProgress,"Check called while binding in progress"),(0,u.assert)(this.isCheckingRequired(),"Check called unnecessarily"),(0,u.assert)(void 0!==this._parseResults,"Parse results not available"),this._logTracker.log(`checking: ${this._getPathForLogging(this._filePath)}`,(()=>{try{I.timingStats.typeCheckerTime.timeOperation((()=>{new O.Checker(e,t,this._parseResults.parseTree).check(),this._isCheckingNeeded=!1;const n=M.getFileInfo(this._parseResults.parseTree);this._checkerDiagnostics=n.diagnosticSink.fetchAndClear()}))}catch(e){if(!c.OperationCanceledException.is(e)){const t=(e.stack?e.stack.toString():void 0)||("string"==typeof e.message?e.message:void 0)||JSON.stringify(e);this._console.error(k.Localizer.Diagnostic.internalTypeCheckingError().format({file:this.getFilePath(),message:t}));const n=new y.DiagnosticSink;n.addError(k.Localizer.Diagnostic.internalTypeCheckingError().format({file:this.getFilePath(),message:t}),(0,v.getEmptyRange)()),this._checkerDiagnostics=n.fetchAndClear(),this._isCheckingNeeded=!1}throw e}finally{this._circularDependencies=[],this._diagnosticVersion++}}))}test_enableIPythonMode(e){this._ipythonMode=e}_buildFileInfo(e,t,n,s){(0,u.assert)(void 0!==this._parseResults,"Parse results not available");const i=new y.TextRangeDiagnosticSink(this._parseResults.tokenizerOutput.lines);return{importLookup:n,futureImports:this._parseResults.futureImports,builtinsScope:s,diagnosticSink:i,executionEnvironment:e.findExecEnvironment(this._filePath),diagnosticRuleSet:this._diagnosticRuleSet,fileContents:t,lines:this._parseResults.tokenizerOutput.lines,typingSymbolAliases:this._parseResults.typingSymbolAliases,filePath:this._filePath,moduleName:this._moduleName,isStubFile:this._isStubFile,isTypingStubFile:this._isTypingStubFile,isTypingExtensionsStubFile:this._isTypingExtensionsStubFile,isBuiltInStubFile:this._isBuiltInStubFile,isInPyTypedPackage:this._isThirdPartyPyTypedPresent,isIPythonMode:this._ipythonMode,accessedSymbolMap:new Map}}_cleanParseTreeIfRequired(){if(this._parseResults&&this._parseTreeNeedsCleaning){new V.ParseTreeCleanerWalker(this._parseResults.parseTree).clean(),this._parseTreeNeedsCleaning=!1}}_resolveImports(e,t,n){const s=[],i=(t,i=!1)=>{const r=e.resolveImport(this._filePath,n,{leadingDots:0,nameParts:t,importedSymbols:void 0});if(!i||r.isImportFound)return 0===r.resolvedPaths.length||r.resolvedPaths[0]!==this._filePath?(s.push(r),r):void 0};let r;this._isThirdPartyImport||this._isStubFile||(r=i(["__builtins__"],!0)),r||(r=i(["builtins"]));const a=this._ipythonMode?i(["IPython","display"]):void 0;for(const i of t){const t=e.resolveImport(this._filePath,n,{leadingDots:i.leadingDots,nameParts:i.nameParts,importedSymbols:i.importedSymbols});s.push(t),M.setImportInfo(i.nameNode,t)}return{imports:s,builtinsImportResult:r,ipythonDisplayImportResult:a}}_getPathForLogging(e){return this.fileSystem.isMappedFilePath(e)?"[virtual] "+e:e}}},93989:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.isStubFile=t.SourceMapper=void 0;const a=r(n(35696)),o=r(n(23241)),l=n(9133),c=n(98173),p=n(20823),d=n(94647),u=n(16800),m=n(59195),y=n(10425);function h(e){return".pyi"===(0,d.getAnyExtensionFromPath)(e,[".pyi"],!1)}t.SourceMapper=class{constructor(e,t,n,s,i,r,a){this._importResolver=e,this._execEnv=t,this._evaluator=n,this._fileBinder=s,this._boundSourceGetter=i,this._mapCompiled=r,this._preferStubs=a}findModules(e){return this._getBoundSourceFilesFromStubFile(e).map((e=>{var t;return null===(t=e.getParseResults())||void 0===t?void 0:t.parseTree})).filter(c.isDefined)}findDeclarations(e){return(0,u.isClassDeclaration)(e)?this._findClassOrTypeAliasDeclarations(e):(0,u.isFunctionDeclaration)(e)?this._findFunctionOrTypeAliasDeclarations(e):(0,u.isVariableDeclaration)(e)?this._findVariableDeclarations(e):(0,u.isParameterDeclaration)(e)?this._findParameterDeclarations(e):(0,u.isSpecialBuiltInClassDeclaration)(e)?this._findSpecialBuiltInClassDeclarations(e):[]}findClassDeclarations(e){return this._findClassOrTypeAliasDeclarations(e).filter((e=>(0,u.isClassDeclaration)(e))).map((e=>e))}findClassDeclarationsByType(e,t){const n=[];return this._addClassTypeDeclarations(e,t,n,new Set),n.filter((e=>(0,u.isClassDeclaration)(e))).map((e=>e))}findFunctionDeclarations(e){return this._findFunctionOrTypeAliasDeclarations(e).filter((e=>(0,u.isFunctionDeclaration)(e))).map((e=>e))}_findSpecialBuiltInClassDeclarations(e,t=new Set){if(38===e.node.valueExpression.nodeType){const n=e.node.valueExpression.value;return this._getBoundSourceFilesFromStubFile(e.path).flatMap((e=>this._findClassDeclarationsByName(e,n,t)))}return[]}_findClassOrTypeAliasDeclarations(e,t=new Set){const n=this._getFullClassName(e.node);return this._getBoundSourceFilesFromStubFile(e.path).flatMap((e=>this._findClassDeclarationsByName(e,n,t)))}_findFunctionOrTypeAliasDeclarations(e,t=new Set){const n=e.node.name.value,s=this._getBoundSourceFilesFromStubFile(e.path);if(e.isMethod){const i=o.getEnclosingClass(e.node);if(void 0===i)return[];const r=this._getFullClassName(i);return s.flatMap((e=>this._findMethodDeclarationsByName(e,r,n,t)))}return s.flatMap((e=>this._findFunctionDeclarationsByName(e,n,t)))}_findVariableDeclarations(e,t=new Set){if(38!==e.node.nodeType)return[];const n=e.node.value,s=this._getBoundSourceFilesFromStubFile(e.path),i=o.getEnclosingClass(e.node);if(i){const e=this._getFullClassName(i);return s.flatMap((s=>this._findFieldDeclarationsByName(s,e,n,t)))}return s.flatMap((e=>this._findVariableDeclarationsByName(e,n,t)))}_findParameterDeclarations(e){const t=[];if(!e.node.name)return t;const n=o.getEnclosingFunction(e.node);if(!n)return t;const s=this._evaluator.getDeclarationsForNameNode(n.name);if(!s)return t;const i=new Set;for(const n of s)for(const s of this._findFunctionOrTypeAliasDeclarations(n,i))t.push(...this._lookUpSymbolDeclarations(s.node,e.node.name.value).filter((e=>(0,u.isParameterDeclaration)(e))).map((e=>e)));return t}_findMemberDeclarationsByName(e,t,n,s,i){const r=[],a=this._findClassDeclarationsByName(e,t,i);for(const e of a.filter((e=>(0,u.isClassDeclaration)(e))).map((e=>e))){const t=this._evaluator.getTypeOfClass(e.node);if(!t)continue;const a=(0,y.lookUpClassMember)(t.classType,n);if(a)for(const e of a.symbol.getDeclarations())s(e,i,r)}return r}_findFieldDeclarationsByName(e,t,n,s){let i=[];const r=`@${e.getFilePath()}/c/${t}/v/${n}`;return s.has(r)||(s.add(r),i=this._findMemberDeclarationsByName(e,t,n,((e,t,n)=>{if((0,u.isVariableDeclaration)(e))if(this._isStubThatShouldBeMappedToImplementation(e.path))for(const s of this._findVariableDeclarations(e,t))(0,u.isVariableDeclaration)(s)&&n.push(s);else n.push(e)}),s),s.delete(r)),i}_findMethodDeclarationsByName(e,t,n,s){let i=[];const r=`@${e.getFilePath()}/c/${t}/f/${n}`;return s.has(r)||(s.add(r),i=this._findMemberDeclarationsByName(e,t,n,((e,t,n)=>{(0,u.isFunctionDeclaration)(e)&&(this._isStubThatShouldBeMappedToImplementation(e.path)?(0,l.appendArray)(n,this._findFunctionOrTypeAliasDeclarations(e,t)):n.push(e))}),s),s.delete(r)),i}_findVariableDeclarationsByName(e,t,n){var s;const i=[],r=`@${e.getFilePath()}/v/${t}`;if(n.has(r))return i;n.add(r);const a=null===(s=e.getParseResults())||void 0===s?void 0:s.parseTree;if(!a)return i;const o=this._lookUpSymbolDeclarations(a,t);if(0===o.length)this._addDeclarationsFollowingWildcardImports(a,t,i,n);else for(const e of o)this._addVariableDeclarations(e,i,n);return n.delete(r),i}_findFunctionDeclarationsByName(e,t,n){var s;const i=[],r=`@${e.getFilePath()}/f/${t}`;if(n.has(r))return i;n.add(r);const a=null===(s=e.getParseResults())||void 0===s?void 0:s.parseTree;if(!a)return i;const o=this._lookUpSymbolDeclarations(a,t);if(0===o.length)this._addDeclarationsFollowingWildcardImports(a,t,i,n);else for(const e of o)this._addClassOrFunctionDeclarations(e,i,n);return n.delete(r),i}_findClassDeclarationsByName(e,t,n){var s;let i=[];const r=null===(s=e.getParseResults())||void 0===s?void 0:s.parseTree;if(r){let s=t.split(".");s.length>0&&(i=this._findClassDeclarations(e,s[0],r,n),s=s.slice(1));for(const t of s)i=i.flatMap((s=>this._findClassDeclarations(e,t,s.node,n)))}return i}_findClassDeclarations(e,t,n,s){const i=[],r=`@${e.getFilePath()}[${n.start}]${t}`;if(s.has(r))return i;s.add(r);const a=this._lookUpSymbolDeclarations(n,t);if(0===a.length&&36===n.nodeType)this._addDeclarationsFollowingWildcardImports(n,t,i,s);else for(const e of a)this._addClassOrFunctionDeclarations(e,i,s);return s.delete(r),i}_addVariableDeclarations(e,t,n){if((0,u.isVariableDeclaration)(e))this._isStubThatShouldBeMappedToImplementation(e.path)?(0,l.appendArray)(t,this._findVariableDeclarations(e,n)):t.push(e);else if((0,u.isAliasDeclaration)(e)){const s=this._evaluator.resolveAliasDeclaration(e,!0);s&&((0,u.isVariableDeclaration)(s)?this._addVariableDeclarations(s,t,n):((0,u.isClassDeclaration)(s)||(0,u.isFunctionDeclaration)(s))&&this._addClassOrFunctionDeclarations(s,t,n))}}_addClassOrFunctionDeclarations(e,t,n){var s;if((0,u.isClassDeclaration)(e))this._isStubThatShouldBeMappedToImplementation(e.path)?(0,l.appendArray)(t,this._findClassOrTypeAliasDeclarations(e,n)):t.push(e);else if((0,u.isFunctionDeclaration)(e))this._isStubThatShouldBeMappedToImplementation(e.path)?(0,l.appendArray)(t,this._findFunctionOrTypeAliasDeclarations(e,n)):t.push(e);else if((0,u.isAliasDeclaration)(e)){const s=this._handleSpecialBuiltInModule(e),i=this._evaluator.resolveAliasDeclaration(s,!0);i&&!(0,u.isAliasDeclaration)(i)&&this._addClassOrFunctionDeclarations(i,t,n)}else if((0,u.isVariableDeclaration)(e)){this._addVariableDeclarations(e,t,n);const i=null!==(s=e.typeAliasName)&&void 0!==s?s:e.node,r=this._evaluator.getType(i);if(!r)return;if((0,m.isFunction)(r)&&r.details.declaration)this._addClassOrFunctionDeclarations(r.details.declaration,t,n);else if((0,m.isOverloadedFunction)(r))for(const e of r.overloads.map((e=>e.details.declaration)).filter(c.isDefined))this._addClassOrFunctionDeclarations(e,t,n);else(0,m.isInstantiableClass)(r)&&this._addClassTypeDeclarations(e.path,r,t,n)}}_handleSpecialBuiltInModule(e){if(e.path||!e.node)return e;if("io"!==e.moduleName&&"collections"!==e.moduleName)return e;const t=this._importResolver.getTypeshedStdLibPath(this._execEnv);if(!t)return e;const n=o.getFileInfoFromNode(e.node);if(!n)return e;const s=(0,d.combinePaths)(t,function(){switch(e.node.nodeType){case 21:case 22:return e.node.module;case 23:return e.node.parent.module;default:return(0,p.assertNever)(e.node)}}().nameParts.map((e=>e.value)).join(".")+".pyi"),i=this._getSourceFiles(s,n.filePath);if(0===i.length)return e;const r={...e};return r.path=i[0].getFilePath(),r}_addClassTypeDeclarations(e,t,n,s){const i=t.details.filePath,r=this._getSourceFiles(i),a=t.details.fullName.substring(t.details.moduleName.length+1);for(const e of r)(0,l.appendArray)(n,this._findClassDeclarationsByName(e,a,s))}_getSourceFiles(e,t){const n=[];if(this._isStubThatShouldBeMappedToImplementation(e))(0,l.appendArray)(n,this._getBoundSourceFilesFromStubFile(e,t));else{const t=this._boundSourceGetter(e);t&&n.push(t)}return n}_addDeclarationsFollowingWildcardImports(e,t,n,s){var i,r;const o=null===(i=a.getScope(e))||void 0===i?void 0:i.symbolTable;if(o)for(const e of o.values())for(const i of e.getDeclarations()){if(!(0,u.isAliasDeclaration)(i)||!i.path||22!==i.node.nodeType||!i.node.isWildcardImport)continue;const e=`@${i.path}/l/${t}`;if(s.has(e))continue;s.add(e);const a=this._getSourceFiles(i.path);for(const e of a){const i=null===(r=e.getParseResults())||void 0===r?void 0:r.parseTree;if(!i)continue;const a=this._lookUpSymbolDeclarations(i,t);if(0===a.length)this._addDeclarationsFollowingWildcardImports(i,t,n,s);else for(const e of a){const t=this._evaluator.resolveAliasDeclaration(e,!0);t&&((0,u.isFunctionDeclaration)(t)||(0,u.isClassDeclaration)(t)?this._addClassOrFunctionDeclarations(t,n,s):(0,u.isVariableDeclaration)(t)&&this._addVariableDeclarations(t,n,s))}}}}_lookUpSymbolDeclarations(e,t){if(void 0===e)return[];const n=a.getScope(e),s=null==n?void 0:n.lookUpSymbol(t),i=null==s?void 0:s.getDeclarations();return null!=i?i:[]}_getFullClassName(e){const t=[];let n=e;for(;void 0!==n;)t.push(n.name.value),n=o.getEnclosingClass(n);return t.reverse().join(".")}_getBoundSourceFilesFromStubFile(e,t){return this._importResolver.getSourceFilesFromStub(e,this._execEnv,this._mapCompiled).map((n=>this._fileBinder(null!=t?t:e,n))).filter(c.isDefined)}_isStubThatShouldBeMappedToImplementation(e){if(this._preferStubs)return!1;return!!h(e)&&this._importResolver.getSourceFilesFromStub(e,this._execEnv,this._mapCompiled).every((t=>t!==e))}},t.isStubFile=h},67737:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.evaluateStaticBoolLikeExpression=t.evaluateStaticBoolExpression=void 0;const s=n(14943);function i(e,t,n,c){if(4===e.nodeType)return i(e.rightExpression,t,n,c);if(55===e.nodeType){if(37===e.operator||36===e.operator){const s=r(e.expression,t,n,c);if(void 0!==s)return!s}}else if(7===e.nodeType){if(37===e.operator||36===e.operator){const s=i(e.leftExpression,t,n,c),r=i(e.rightExpression,t,n,c);if(void 0===s||void 0===r)return;return 37===e.operator?s||r:s&&r}if(l(e.leftExpression,c)&&52===e.rightExpression.nodeType){const n=function(e){let t;if(e.expressions.length>=2){if(40===e.expressions[0].nodeType&&!e.expressions[0].isImaginary&&40===e.expressions[1].nodeType&&!e.expressions[1].isImaginary){const n=e.expressions[0],s=e.expressions[1];"number"==typeof n.value&&"number"==typeof s.value&&(t=256*n.value+s.value)}}else if(1===e.expressions.length){const n=e.expressions[0];"number"==typeof n.value&&(t=256*n.value)}return t}(e.rightExpression);return a(e.operator,t.pythonVersion,n)}if(24===e.leftExpression.nodeType&&l(e.leftExpression.baseExpression,c)&&1===e.leftExpression.items.length&&!e.leftExpression.trailingComma&&!e.leftExpression.items[0].name&&0===e.leftExpression.items[0].argumentCategory&&40===e.leftExpression.items[0].valueExpression.nodeType&&!e.leftExpression.items[0].valueExpression.isImaginary&&0===e.leftExpression.items[0].valueExpression.value&&40===e.rightExpression.nodeType)return a(e.operator,Math.floor(t.pythonVersion/256),e.rightExpression.value);if(function(e,t=["sys"]){if(35===e.nodeType&&38===e.leftExpression.nodeType&&"platform"===e.memberName.value&&t.some((t=>t===e.leftExpression.value)))return!0;return!1}(e.leftExpression,c)&&48===e.rightExpression.nodeType){const n=e.rightExpression.strings.map((e=>e.value)).join(""),i=function(e){if(e.pythonPlatform===s.PythonPlatform.Darwin)return"darwin";if(e.pythonPlatform===s.PythonPlatform.Windows)return"win32";if(e.pythonPlatform===s.PythonPlatform.Linux)return"linux";return}(t);return o(e.operator,i,n)}if(function(e){if(35===e.nodeType&&38===e.leftExpression.nodeType&&"os"===e.leftExpression.value&&"name"===e.memberName.value)return!0;return!1}(e.leftExpression)&&48===e.rightExpression.nodeType){const n=e.rightExpression.strings.map((e=>e.value)).join(""),i=function(e){if(e.pythonPlatform===s.PythonPlatform.Darwin)return"posix";if(e.pythonPlatform===s.PythonPlatform.Windows)return"nt";if(e.pythonPlatform===s.PythonPlatform.Linux)return"posix";return}(t);if(void 0!==i)return o(e.operator,i,n)}}else if(11===e.nodeType){if(33===e.constType)return!0;if(15===e.constType)return!1}else if(38===e.nodeType){if("TYPE_CHECKING"===e.value)return!0}else if(n&&35===e.nodeType&&"TYPE_CHECKING"===e.memberName.value&&38===e.leftExpression.nodeType&&n.some((t=>t===e.leftExpression.value)))return!0}function r(e,t,n,s){return(11!==e.nodeType||26!==e.constType)&&i(e,t,n,s)}function a(e,t,n){if(void 0!==t&&void 0!==n){if(t=BigInt(t),n=BigInt(n),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 o(e,t,n){if(void 0!==t&&void 0!==n){if(12===e)return t===n;if(28===e)return t!==n}}function l(e,t=["sys"]){return!(35!==e.nodeType||38!==e.leftExpression.nodeType||"version_info"!==e.memberName.value||!t.some((t=>t===e.leftExpression.value)))}t.evaluateStaticBoolExpression=i,t.evaluateStaticBoolLikeExpression=r},97882:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Symbol=t.indeterminateSymbolId=void 0;const s=n(88023);let i=1;t.indeterminateSymbolId=0;class r{constructor(e=4){this.id=i++,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)}setIsInitVar(){this._flags|=1024}isInitVar(){return!!(1024&this._flags)}setIsInDunderAll(){this._flags|=256}isInDunderAll(){return!!(256&this._flags)}setIsPrivateMember(){this._flags|=32}isPrivateMember(){return!!(32&this._flags)}setPrivatePyTypedImport(){this._flags|=512}isPrivatePyTypedImport(){return!!(512&this._flags)}addDeclaration(e){if(this._declarations){const t=this._declarations.findIndex((t=>(0,s.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];(0,s.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.typeAliasName=e.typeAliasName),!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=>(0,s.hasTypeForDeclaration)(e)))}getTypedDeclarations(){return this.getDeclarations().filter((e=>(0,s.hasTypeForDeclaration)(e)))}getSynthesizedType(){return this._synthesizedType}}t.Symbol=r},91197:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isPublicConstantOrTypeAlias=t.isTypeAliasName=t.isConstantName=t.isSingleDunderName=t.isDunderName=t.isPrivateOrProtectedName=t.isProtectedName=t.isPrivateName=void 0;const n=/^[A-Z0-9_]+$/,s=/^[_]+$/,i=/^_{0,2}[A-Z][A-Za-z0-9_]+$/;function r(e){return e.length>2&&e.startsWith("__")&&!e.endsWith("__")}function a(e){return e.length>1&&e.startsWith("_")&&!e.startsWith("__")}function o(e){return r(e)||a(e)}function l(e){return!!e.match(n)&&!e.match(s)}function c(e){return!!e.match(i)}t.isPrivateName=r,t.isProtectedName=a,t.isPrivateOrProtectedName=o,t.isDunderName=function(e){return e.length>4&&e.startsWith("__")&&e.endsWith("__")},t.isSingleDunderName=function(e){return e.length>2&&e.startsWith("_")&&e.endsWith("_")},t.isConstantName=l,t.isTypeAliasName=c,t.isPublicConstantOrTypeAlias=function(e){return!o(e)&&(l(e)||c(e))}},15020:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isNotRequiredTypedDictVariable=t.isRequiredTypedDictVariable=t.isFinalVariable=t.isTypedDictMemberAccessedThroughIndex=t.getLastTypedDeclaredForSymbol=void 0;const s=n(88023);t.getLastTypedDeclaredForSymbol=function(e){const t=e.getTypedDeclarations();if(t.length>0)return t[t.length-1]},t.isTypedDictMemberAccessedThroughIndex=function(e){const t=e.getTypedDeclarations();if(t.length>0){if(1===t[t.length-1].type)return!0}return!1},t.isFinalVariable=function(e){return e.getDeclarations().some((e=>(0,s.isFinalVariableDeclaration)(e)))},t.isRequiredTypedDictVariable=function(e){return e.getDeclarations().some((e=>1===e.type&&!!e.isRequired))},t.isNotRequiredTypedDictVariable=function(e){return e.getDeclarations().some((e=>1===e.type&&!!e.isNotRequired))}},51660:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NameTypeWalker=t.TestWalker=void 0;const s=n(22339),i=n(20823),r=n(80957);class a extends s.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&&(0,i.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 s=!1;3===e.nodeType&&t===e.typeAnnotationComment&&(s=!0),48===e.nodeType&&t===e.typeAnnotation&&(s=!0),s||((t.start<e.start||r.TextRange.getEnd(t)>r.TextRange.getEnd(e))&&(0,i.fail)(`Child node ${t.nodeType} is not contained within its parent ${e.nodeType}`),n&&t.start<r.TextRange.getEnd(n)&&62!==n.nodeType&&(0,i.fail)("Child node is not after previous child node"),n=t)}}))}}t.TestWalker=a;class o extends s.ParseTreeWalker{constructor(e){super(),this._evaluator=e}visitName(e){var t,n;return 23!==(null===(t=e.parent)||void 0===t?void 0:t.nodeType)&&21!==(null===(n=e.parent)||void 0===n?void 0:n.nodeType)&&this._evaluator.isNodeReachable(e,void 0)&&this._evaluator.getType(e),!0}}t.NameTypeWalker=o},25997:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.createTracePrinter=void 0;const a=n(98173),o=n(20823),l=n(94647),c=n(55390),p=r(n(35696)),d=r(n(23241)),u=n(97882),m=n(59195);t.createTracePrinter=function(e){function t(e,t="'"){return e?`${t}${e}${t}`:""}e=e.map((e=>(0,l.ensureTrailingDirectorySeparator)(e))).sort(((e,t)=>e.localeCompare(t))).reverse();const n=/[\\/]/g;function s(t){if(t){if("string"==typeof t){for(const s of e)if(t.startsWith(s)){const e=t.substring(s.length);return(0,l.stripFileExtension)(e).replace(n,".")}return t}return t.nameParts.join(".")}return""}function i(e){var n,s,r,a,l,c;if(e)switch(e.category){case 2:return`Any ${t(null===(n=e.typeAliasInfo)||void 0===n?void 0:n.fullName)}`;case 7:return m.TypeBase.isInstantiable(e)?`Class '${e.details.name}' (${e.details.moduleName})`:`Object '${e.details.name}' (${e.details.moduleName})`;case 5:return`Function '${e.details.name}' (${e.details.moduleName})`;case 8:return`Module '${e.moduleName}' (${e.moduleName})`;case 4:return`Never ${t(null===(s=e.typeAliasInfo)||void 0===s?void 0:s.fullName)}`;case 3:return`None ${t(null===(r=e.typeAliasInfo)||void 0===r?void 0:r.fullName)}`;case 6:return`OverloadedFunction [${e.overloads.map((e=>t(i(e),'"'))).join(",")}]`;case 10:return`TypeVar '${e.details.name}' ${t(null===(a=e.typeAliasInfo)||void 0===a?void 0:a.fullName)}`;case 0:return`Unbound ${t(null===(l=e.typeAliasInfo)||void 0===l?void 0:l.fullName)}`;case 9:return`Union [${e.subtypes.map((e=>t(i(e),'"'))).join(",")}]`;case 1:return`Unknown ${t(null===(c=e.typeAliasInfo)||void 0===c?void 0:c.fullName)}`;default:(0,o.assertNever)(e)}return""}function r(e){if(e)switch(e.type){case 6:return`Alias, ${y(e.node)} (${s(e.path)})`;case 4:return`Class, ${y(e.node)} (${s(e.path)})`;case 3:return`Function, ${y(e.node)} (${s(e.path)})`;case 0:return`Intrinsic, ${y(e.node)} ${e.intrinsicType} (${s(e.path)})`;case 2:return`Parameter, ${y(e.node)} (${s(e.path)})`;case 5:return`SpecialBuiltInClass, ${y(e.node)} (${s(e.path)})`;case 1:return`Variable, ${y(e.node)} (${s(e.path)})`;default:(0,o.assertNever)(e)}return""}function y(e,n=!1){var i;if(!e)return"";const r=n?`(${s(null===(i=function(e){for(;36!==e.nodeType&&e.parent;)e=e.parent;return 36===e.nodeType?p.getFileInfo(e):void 0}(e))||void 0===i?void 0:i.filePath)})`:"";if((0,c.isExpressionNode)(e))return t(function(e,t=30){return e.length<t?e:e.substring(0,t)+" <shortened> "}(d.printExpression(e)),'"')+` ${r}`;switch(e.nodeType){case 21:return`importAs '${y(e.module)}' ${t(e.alias?y(e.alias):"")} ${r}`;case 22:return`importFrom [${e.imports.map((e=>t(y(e),'"'))).join(",")}]`;case 23:return`ImportFromAs '${y(e.name)}' ${t(e.alias?y(e.alias):"")} ${r}`;case 36:return`module ${r}`;case 10:return`class '${y(e.name)}' ${r}`;case 28:return`function '${y(e.name)}' ${r}`;case 37:return`moduleName '${e.nameParts.map((e=>y(e))).join(".")}' ${r}`;case 1:return`argument '${e.name?y(e.name):"N/A"}' ${r}`;case 41:return`parameter '${e.name?y(e.name):"N/A"}' ${r}`;default:return`${d.printParseNodeType(e.nodeType)} ${r}`}}return{print:function(e){return e?function(e){const t=e;return t&&(0,a.isNumber)(t.nodeType)}(e)?y(e,!0):function(e){const t=e;return t&&(0,a.isNumber)(t.type)&&(0,a.isString)(t.path)&&(0,a.isString)(t.moduleName)}(e)?r(e):e instanceof u.Symbol?(t=e)?t.hasDeclarations()?`symbol ${r(t.getDeclarations()[0])}`:"<symbol>":"":function(e){const t=e;return t&&(0,a.isNumber)(t.category)&&(0,a.isNumber)(t.flags)}(e)?i(e):void(0,o.assertNever)(e):"";var t},printFileOrModuleName:s}}},57065:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.SpeculativeTypeTracker=t.isIncompleteType=void 0;const a=n(20823),o=r(n(23241)),l=n(59195);t.isIncompleteType=function(e){return!!e.isIncompleteType};t.SpeculativeTypeTracker=class{constructor(){this._speculativeContextStack=[],this._speculativeTypeCache=new Map}enterSpeculativeContext(e,t){this._speculativeContextStack.push({speculativeRootNode:e,entriesToUndo:[],allowCacheRetention:t})}leaveSpeculativeContext(){(0,a.assert)(this._speculativeContextStack.length>0);this._speculativeContextStack.pop().entriesToUndo.forEach((e=>{e.cache.delete(e.id)}))}isSpeculative(e){if(0===this._speculativeContextStack.length)return!1;if(!e)return!0;for(let t=this._speculativeContextStack.length-1;t>=0;t--)if(o.isNodeContainedWithin(e,this._speculativeContextStack[t].speculativeRootNode))return!0;return!1}trackEntry(e,t){const n=this._speculativeContextStack.length;n>0&&this._speculativeContextStack[n-1].entriesToUndo.push({cache:e,id:t})}disableSpeculativeMode(){const e=this._speculativeContextStack;return this._speculativeContextStack=[],e}enableSpeculativeMode(e){(0,a.assert)(0===this._speculativeContextStack.length),this._speculativeContextStack=e}addSpeculativeType(e,t,n){if((0,a.assert)(this._speculativeContextStack.length>0),this._speculativeContextStack.some((e=>!e.allowCacheRetention)))return;let s=this._speculativeTypeCache.get(e.id);s||(s=[],this._speculativeTypeCache.set(e.id,s)),s.push({type:t,expectedType:n})}getSpeculativeType(e,t){if(this._speculativeContextStack.some((t=>o.isNodeContainedWithin(e,t.speculativeRootNode)))){const n=this._speculativeTypeCache.get(e.id);if(n)for(const e of n)if(t){if(e.expectedType&&(0,l.isTypeSame)(t,e.expectedType))return e.type}else if(!e.expectedType)return e.type}}}},58333:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getVariableDocString=t.getFunctionOrClassDeclDocString=t.getClassDocString=t.getModuleDocString=t.getVariableInStubFileDocStrings=t.getPropertyDocStringInherited=t.getOverloadedFunctionDocStringsInherited=t.getFunctionDocStringInherited=void 0;const a=n(16800),o=r(n(23241)),l=n(93989),c=n(59195),p=n(10425);function d(e,t){if(6===e.category){if(0===e.overloads.length)return!1;e=e.overloads[0]}return"builtins"===e.details.moduleName&&!!t&&!!e.boundToType&&!c.ClassType.isSameGenericClass(t,e.boundToType)}function u(e,t){const n=[];if(!(0,l.isStubFile)(e.path))return n;for(const s of t.findDeclarations(e))if((0,a.isVariableDeclaration)(s)&&s.docString)n.push(s.docString);else if((0,a.isClassDeclaration)(s)||(0,a.isFunctionDeclaration)(s)){const e=m(s);e&&n.push(e)}return n}function m(e){var t,n,s;return o.getDocString(null!==(s=null===(n=null===(t=e.node)||void 0===t?void 0:t.suite)||void 0===n?void 0:n.statements)&&void 0!==s?s:[])}function y(e,t,n){if(!(0,c.isOverloadedFunction)(e))return;const s=[];if(e.overloads.some((e=>e.details.docString)))e.overloads.forEach((e=>{e.details.docString&&s.push(e.details.docString)}));else if(t&&(0,l.isStubFile)(t.path)&&(0,a.isFunctionDeclaration)(t)){const e=g(n.findFunctionDeclarations(t));e&&s.push(e)}return s}function h(e,t){let n=g([e]);if(!n&&(0,l.isStubFile)(e.path)){n=g(t.findFunctionDeclarations(e))}return n}function g(e){for(const t of e){const e=m(t);if(e)return e}}t.getFunctionDocStringInherited=function(e,t,n,s){let i;if(!d(e,s)&&t&&(0,a.isFunctionDeclaration)(t)&&(i=function(e,t,n){if(!(0,c.isFunction)(e))return;let s=e.details.docString;!s&&t&&(s=h(t,n));!s&&e.details.declaration&&(s=h(e.details.declaration,n));return s}(e,t,n)),!i&&s){const t=e.details.name,r=(0,p.getClassMemberIterator)(s,t,29);for(const e of r){if(e.symbol.getDeclarations().length>0){const t=e.symbol.getDeclarations().slice(-1)[0];if((0,a.isFunctionDeclaration)(t)&&(i=h(t,n),i))break}}}return i||e.details.docString},t.getOverloadedFunctionDocStringsInherited=function(e,t,n,s,i){let r;if(!d(e,i))for(const s of t)if(r=y(e,s,n),r&&r.length>0)return r;if(i&&e.overloads.length>0){const t=e.overloads[0].details.name,a=(0,p.getClassMemberIterator)(i,t,29);for(const e of a){const t=e.symbol.getDeclarations().slice(-1)[0],i=s.getTypeForDeclaration(t);if(i&&(r=y(i,t,n),r&&r.length>0))break}}return null!=r?r:[]},t.getPropertyDocStringInherited=function(e,t,n){const s=o.getEnclosingClass(e.node.name,!1),i=s?n.getTypeOfClass(s):void 0;if(i)return function(e,t,n,s){if(!e||!(0,a.isFunctionDeclaration)(e))return;const i=n.getTypeForDeclaration(e);if(!i||!(0,p.isMaybeDescriptorInstance)(i))return;const r=28===e.node.nodeType?e.node.name.value:void 0;if(!r)return;const o=(0,p.getClassIterator)(s,0);for(const[e]of o){if(!(0,c.isInstantiableClass)(e))continue;const s=e.details.fields.get(r),i=null==s?void 0:s.getDeclarations();if(i)for(const e of i)if((0,a.isFunctionDeclaration)(e)){const s=n.getTypeForDeclaration(e);if(s&&(0,p.isMaybeDescriptorInstance)(s)){const n=h(e,t);if(n)return n}}}return}(e,t,n,i.classType)},t.getVariableInStubFileDocStrings=u,t.getModuleDocString=function(e,t,n){let s=e.docString;if(!s&&t&&(0,l.isStubFile)(t.path)){s=function(e){for(const t of e)if(t.statements){const e=o.getDocString(t.statements);if(e)return e}return}(n.findModules(t.path))}return s},t.getClassDocString=function(e,t,n){let s=e.details.docString;if(!s&&t&&(0,a.isClassDeclaration)(t)&&(s=g([t]),!s&&t&&(0,l.isStubFile)(t.path)&&4===t.type)){s=g(n.findClassDeclarations(t))}if(!s&&t){const i=n.findClassDeclarationsByType(t.path,e);if(i){s=g(i.filter((e=>(0,a.isClassDeclaration)(e))).map((e=>e)))}}return s},t.getFunctionOrClassDeclDocString=m,t.getVariableDocString=function(e,t){if(e)return void 0!==e.docString?e.docString:u(e,t).find((e=>e))}},68755:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.createTypeEvaluator=void 0;const a=n(38213),o=n(9133),l=n(20823),c=n(24319),p=n(15741),d=n(28348),u=n(57485),m=n(80957),y=n(74426),h=n(55390),g=n(14014),f=r(n(82048)),T=n(48306),_=r(n(35696)),v=n(98514),b=n(66124),I=n(54311),C=n(32408),S=n(88023),F=n(25235),x=n(71595),D=r(n(23241)),P=n(97374),A=n(49031),E=r(n(57203)),k=n(67737),w=n(97882),N=n(91197),M=n(15020),R=n(57065),O=n(22387),L=r(n(22105)),V=n(59195),U=n(10425),z=n(58922),B={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__","__ge__",!0],21:["__le__","__gt__",!0],15:["__gt__","__le__",!0],16:["__ge__","__lt__",!0]},W={36:!1,37:!1,39:!0,40:!0,41:!0,42:!0},j=new Map([["asyncio.futures.Future",u.PythonVersion.V3_9],["asyncio.tasks.Task",u.PythonVersion.V3_9],["builtins.dict",u.PythonVersion.V3_9],["builtins.frozenset",u.PythonVersion.V3_9],["builtins.list",u.PythonVersion.V3_9],["builtins._PathLike",u.PythonVersion.V3_9],["builtins.set",u.PythonVersion.V3_9],["builtins.tuple",u.PythonVersion.V3_9],["collections.ChainMap",u.PythonVersion.V3_9],["collections.Counter",u.PythonVersion.V3_9],["collections.defaultdict",u.PythonVersion.V3_9],["collections.DefaultDict",u.PythonVersion.V3_9],["collections.deque",u.PythonVersion.V3_9],["collections.OrderedDict",u.PythonVersion.V3_9],["queue.Queue",u.PythonVersion.V3_9]]),G=new Map([["builtins.float",["builtins.int"]],["builtins.complex",["builtins.float","builtins.int"]],["builtins.bytes",["builtins.bytearray","builtins.memoryview"]]]),$=64;t.createTypeEvaluator=function(e,t){const n=[],s=new Map,i=new Set,r=new R.SpeculativeTypeTracker,q=[],K=[];let H,Y,Z,Q,J,X,ee,te,ne,se,ie,re,ae=new Map,oe=new Map,le=new Map,ce=new Map,pe=new Map,de=!1;const ue=[];let me;function ye(){H&&(0,a.throwIfCancellationRequested)(H)}function he(e){let t;return t=me&&ve(e)?me.get(e.id):le.get(e.id),void 0!==t}function ge(e,n){let i;if(i=me&&ve(e)?me.get(e.id):le.get(e.id),void 0!==i){if(t.verifyTypeCacheEvaluatorFlags&&void 0!==n){const t=s.get(e.id);void 0!==t&&n!==t&&(0,l.fail)(`Type cache flag mismatch for node type ${e.nodeType}: cached flags = ${t}, access flags = ${n}`)}return(0,l.assert)(!(0,R.isIncompleteType)(i)),i}}function fe(e,n,i,a,o,l=!1){if(a)return void(re&&re.set(e.id,n));const c=me&&ve(e)?me:le;c.set(e.id,n),t.verifyTypeCacheEvaluatorFlags&&c===le&&void 0!==i&&s.set(e.id,i),r.isSpeculative(e)&&(r.trackEntry(c,e.id),l&&r.addSpeculativeType(e,n,o))}function Te(e){(me&&ve(e)?me:le).delete(e.id)}function _e(e,t=V.UnknownType.create(),n=0){fe(e,t,n,!1)}function ve(e){const t=ue.length;if(0===t)return!1;const n=ue[t-1];let s=e;for(;s;){if(s===n.functionNode)return!0;s=s.parent}return!1}function be(e,t){return n.findIndex((n=>n.symbolId===e.id&&n.declaration===t))}function Ie(e,t){const s=be(e,t);if(s>=0){for(let e=s+1;e<n.length;e++)n[e].isResultValid=!1;return!1}return n.push({symbolId:e.id,declaration:t,isResultValid:!0}),!0}function Ce(e){const t=n.pop();return(0,l.assert)(t.symbolId===e.id),t.isResultValid}function Se(e,t,s){const i=be(e,t);i>=0&&(n[i].partialType=s)}function Fe(e,t){const s=be(e,t);if(s>=0)return n[s].partialType}function xe(e){var t;return null===(t=Vn(e,(()=>{Rn(e)})))||void 0===t?void 0:t.type}function De(e){Rn(e);let t=e;for(;void 0!==t;){const e=pe.get(t.id);if(e)return{type:e,node:t};t=t.parent}}function Pe(e){de||(de=!0,Q=qn(e,"object"),J=$n(e,"type"),X=qn(e,"function"),$e(e,"Collection"),Y=qe(e,"NoneType")||V.AnyType.create(),ee=$n(e,"tuple"),te=$n(e,"bool"),ne=$n(e,"str"),se=$n(e,"dict"),ie=$e(e,"_TypedDict"))}function Ae(e,n=0,s){var i;const a=ge(e,n);if(a)return{type:a,node:e};{const t=r.getSpeculativeType(e,s);if(t)return{type:t,node:e}}let o;ye(),s=(0,U.transformPossibleRecursiveTypeAlias)(s),Pe(e);let d=0!=(64&n);switch(e.nodeType){case 38:o=function(e,n){var s;const i=_.getFileInfo(e),r=e.value;let a,o=!1;const l=0!=(4&n)||i.isStubFile;if(!t.analyzeUnannotatedFunctions){const t=D.getEnclosingFunction(e);if(t&&D.isUnannotatedFunction(t))return{node:e,type:V.AnyType.create(),isIncomplete:!1}}const c=Kn(e,r,!l,l&&0!=(1024&n));if(c){let t=!l;4===c.scope.type&&(t=!1);const s=c.symbol,d=ns(s,t?e:void 0);let u=(0,U.transformPossibleRecursiveTypeAlias)(d.type);d.isIncomplete&&((0,V.isUnbound)(u)&&(u=V.UnknownType.create(!0)),o=!0),d.isRecursiveDefinition&&Ye(e)&&nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.recursiveDefinition().format({name:r}),e);const m=!!u&&(0,V.isInstantiableClass)(u)&&V.ClassType.isSpecialBuiltIn(u);if(a=u,t&&!m){const t=c.isBeyondExecutionScope||!s.isInitiallyUnbound()?u:V.UnboundType.create(),n=zn(e,s.id,t,!1);if(n.type&&(a=n.type),n.isIncomplete&&(o=!0),!n.type&&c.isBeyondExecutionScope){const t=function(e,t,n){if(!t.symbol.getDeclarations().every((e=>1===e.type||2===e.type)))return;const s=E.getScopeHierarchy(e,t.scope);if(s&&s.length>=2&&s.every((e=>1===e.type||3===e.type))){const i=E.findTopNodeInScope(e,s[s.length-2]);if(i&&(28===i.nodeType||30===i.nodeType)){const s=_.getFlowNode(i);if(s&&t.symbol.getDeclarations().every((e=>{if(2===e.type)return!0;const t=_.getFlowNode(e.node);return!!t&&(t===s||!Es.isFlowNodeReachable(t,s))})))return zn(e,t.symbol.id,n,!1,i)}}return}(e,c,u);(null==t?void 0:t.type)&&(a=t.type),(null==t?void 0:t.isIncomplete)&&(o=!0)}}a=ht(e,a,n),ut(i,s,e),0!=(1024&n)&&d.includesVariableDecl&&!a.typeAliasInfo&&((0,U.isTypeAliasPlaceholder)(a)||(0,V.isTypeVar)(a)||(0,V.isUnknown)(a)||i.isTypingStubFile||V.TypeBase.isInstantiable(a)&&0==(2&n)||(nt(i.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeAnnotationVariable(),e),a=V.UnknownType.create()))}else"reveal_type"!==r&&"reveal_locals"!==r&&nt(i.diagnosticRuleSet.reportUndefinedVariable,p.DiagnosticRule.reportUndefinedVariable,y.Localizer.Diagnostic.symbolIsUndefined().format({name:r}),e),a=V.UnknownType.create();(0,V.isParamSpec)(a)&&32&n&&(Xe(y.Localizer.Diagnostic.paramSpecContext(),e),a=V.UnknownType.create());if((0,V.isTypeVar)(a)&&0==(64&n)&&a.details.name===r){if(!(7===(null===(s=e.parent)||void 0===s?void 0:s.nodeType)&&6===e.parent.operator)){const t=a.details.isVariadic?$e(e,"TypeVarTuple"):$e(e,"TypeVar");a=t&&(0,V.isInstantiableClass)(t)?V.ClassType.cloneAsInstance(t):V.UnknownType.create()}}0!=(64&n)&&0==(512&n)&&(0,V.isInstantiableClass)(a)&&V.ClassType.isBuiltIn(a,"Generic")&&nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.genericNotAllowed(),e);(0,V.isTypeVar)(a)&&!a.details.isSynthesized&&(a=yt(e,a,n));return{type:a,node:e,isIncomplete:o}}(e,n);break;case 35:o=function(e,t){const n=2|572484&t,s=Ae(e.leftExpression,n);if((0,U.isTypeAliasPlaceholder)(s.type))return{node:e,type:V.UnknownType.create(!0),isIncomplete:!0};const i=Tt(e,s,{method:"get"},2|t);if((0,b.isCodeFlowSupportedForReference)(e)){fe(e,i.type,t,!0),fe(e.memberName,i.type,t,!0);let n=i.type,r=!!i.isIncomplete;if((0,V.isUnbound)(n)){const t=lt(s.type);let i;(0,V.isInstantiableClass)(t)?i=(0,U.lookUpClassMember)(t,e.memberName.value,1):(0,V.isClassInstance)(t)&&(i=(0,U.lookUpObjectMember)(t,e.memberName.value,1)),i&&(n=ls(i),r=!1)}const a=zn(e,w.indeterminateSymbolId,n,r);a.type&&(i.type=a.type),a.isIncomplete&&(i.isIncomplete=!0),i.type=ht(e,i.type,t),Te(e),Te(e.memberName)}s.isIncomplete&&(i.isIncomplete=!0);return fe(e.memberName,i.type,t,!!i.isIncomplete),i}(e,n);break;case 24:o=function(e,t=0){const n=Ae(e.baseExpression,2|t);if(64&t&&48===e.baseExpression.nodeType){const t=_.getFileInfo(e);!t.isStubFile&&t.executionEnvironment.pythonVersion<u.PythonVersion.V3_10&&Xe(y.Localizer.Diagnostic.stringNotSubscriptable(),e.baseExpression)}if(0==(4&t)){let s=0!=(32768&t);if(s){const t=D.getExecutionScopeNode(e);36===(null==t?void 0:t.nodeType)&&(s=!1)}if(!s){const t=_.getFileInfo(e);if((0,V.isInstantiableClass)(n.type)&&V.ClassType.isBuiltIn(n.type)&&!n.type.aliasName){const s=j.get(n.type.details.fullName);void 0!==s&&t.executionEnvironment.pythonVersion<s&&!t.isStubFile&&Xe(y.Localizer.Diagnostic.classNotRuntimeSubscriptable().format({name:n.type.aliasName||n.type.details.name}),e.baseExpression)}}}const s=It(e,n,{method:"get"},t);if((0,b.isCodeFlowSupportedForReference)(e)){let i=!0;if(ct(n.type,void 0,(e=>{(0,V.isClassInstance)(e)&&(V.ClassType.isBuiltIn(e)||V.ClassType.isTypedDictClass(e))||(i=!1)})),i){fe(e,s.type,t,!1);const i=zn(e,w.indeterminateSymbolId,s.type,!!n.isIncomplete||!!s.isIncomplete);i.type&&(s.type=i.type),i.isIncomplete&&(s.isIncomplete=!0),Te(e)}}n.isIncomplete&&(s.isIncomplete=!0);0!=(1048576&t)&&(0,V.isInstantiableClass)(n.type)&&(V.ClassType.isBuiltIn(n.type,"Required")?s.isRequired=!0:V.ClassType.isBuiltIn(n.type,"NotRequired")&&(s.isNotRequired=!0));return s}(e,n);break;case 9:o=function(e,t,n){var s;const i=Ae(e.leftExpression,2),a=e.arguments.map((e=>({valueExpression:e.valueExpression,argumentCategory:e.argumentCategory,node:e,name:e.name})));let o={node:e,type:V.UnknownType.create()};if((0,U.isTypeAliasPlaceholder)(i.type))o.isIncomplete=!0;else{if(38===e.leftExpression.nodeType&&"super"===e.leftExpression.value)o=function(e){e.arguments.length>2&&Xe(y.Localizer.Diagnostic.superCallArgCount(),e.arguments[2]);let t,n;if(e.arguments.length>0){t=Ae(e.arguments[0].valueExpression).type;const n=lt(t);(0,V.isAnyOrUnknown)(n)||(0,V.isInstantiableClass)(n)||nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.superCallFirstArg().format({type:Ps(t)}),e.arguments[0].valueExpression)}else{const n=D.getEnclosingClass(e);if(n){const e=fn(n);t=e?e.classType:V.UnknownType.create()}else Xe(y.Localizer.Diagnostic.superCallZeroArgForm(),e.leftExpression),t=V.UnknownType.create()}if(e.arguments.length>1){const s=lt(Ae(e.arguments[1].valueExpression).type);let i=!1;if((0,V.isAnyOrUnknown)(s)||((0,V.isClassInstance)(s)?((0,V.isInstantiableClass)(t)&&((0,U.derivesFromClassRecursive)(V.ClassType.cloneAsInstantiable(s),t,!0)||(i=!0)),n=s):(0,V.isInstantiableClass)(s)?((0,V.isInstantiableClass)(t)&&((0,U.derivesFromClassRecursive)(s,t,!0)||(i=!0)),n=s):i=!0),i){nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.superCallSecondArg().format({type:Ps(t)}),e.arguments[1].valueExpression)}}else{const s=D.getEnclosingFunction(e);let i;if(s){const e=_n(s);if(e){const t=e.functionType;V.FunctionType.isClassMethod(t)?t.details.parameters.length>0&&t.details.parameters[0].hasDeclaredType&&(i=lt(t.details.parameters[0].type)):V.FunctionType.isInstanceMethod(t)&&t.details.parameters.length>0&&t.details.parameters[0].hasDeclaredType&&(i=lt((0,U.convertToInstantiable)(t.details.parameters[0].type)))}}i&&(0,V.isInstantiableClass)(i)?n=i:(0,V.isInstantiableClass)(t)&&(n=t)}let s=!0;if(e.arguments.length<=1){const t=D.getEnclosingFunction(e);if(t){const e=_n(t);e&&(V.FunctionType.isStaticMethod(e.functionType)||V.FunctionType.isConstructorMethod(e.functionType)||V.FunctionType.isClassMethod(e.functionType))&&(s=!1)}}const i=e.parent;if(35===i.nodeType){const r=i.memberName.value,a=(0,U.lookUpClassMember)(t,r,1);if(a&&(0,V.isInstantiableClass)(a.classType))return{type:s?V.ClassType.cloneAsInstance(a.classType):a.classType,node:e,bindToType:s&&n&&(0,V.isInstantiableClass)(n)?V.ClassType.cloneAsInstance(n):n,isSuperCall:!0}}if((0,V.isInstantiableClass)(t)){if(t.details.mro.some((e=>(0,V.isAnyOrUnknown)(e))))return{type:V.UnknownType.create(),isSuperCall:!0,node:e};const n=t.details.baseClasses;if(n.length>0){const t=n[0];if((0,V.isInstantiableClass)(t))return{type:s?V.ClassType.cloneAsInstance(t):t,isSuperCall:!0,node:e}}}return{type:V.UnknownType.create(),isSuperCall:!0,node:e}}(e);else if((0,V.isAnyOrUnknown)(i.type)&&38===e.leftExpression.nodeType&&"reveal_type"===e.leftExpression.value)o=At(e,t);else if((0,V.isFunction)(i.type)&&"reveal_type"===i.type.details.builtInName)o=At(e,t);else if((0,V.isFunction)(i.type)&&"assert_type"===i.type.details.builtInName)o=function(e,t){if(2!==e.arguments.length||0!==e.arguments[0].argumentCategory||void 0!==e.arguments[0].name||0!==e.arguments[0].argumentCategory||void 0!==e.arguments[1].name)return Xe(y.Localizer.Diagnostic.assertTypeArgs(),e),{node:e,type:V.UnknownType.create()};const n=Ae(e.arguments[0].valueExpression,void 0,t);if(n.isIncomplete)return{node:e,type:V.UnknownType.create(!0),isIncomplete:!0};const s=(0,U.convertToInstance)(jn(e.arguments[1]).type);(0,V.isTypeSame)(s,n.type)||Xe(y.Localizer.Diagnostic.assertTypeTypeMismatch().format({expected:Ps(s),received:Ps(n.type)}),e.arguments[0].valueExpression);return{node:e,type:n.type}}(e,t);else if((0,V.isAnyOrUnknown)(i.type)&&38===e.leftExpression.nodeType&&"reveal_locals"===e.leftExpression.value)0===e.arguments.length?o.type=function(e){let t,n=e;for(;n&&(t=E.getScopeForNode(n),!t||0===t.type);)n=n.parent;const s=[];t&&t.symbolTable.forEach(((e,t)=>{if(!e.isIgnoredForProtocolMatch()){const n=ts(e);s.push(y.Localizer.DiagnosticAddendum.typeOfSymbol().format({name:t,type:Ps(n,!0)}))}}));s.length>0?Je(s.join("\n"),e):Je(y.Localizer.Diagnostic.revealLocalsNone(),e);return V.NoneType.createInstance()}(e):Xe(y.Localizer.Diagnostic.revealLocalsArgs(),e);else{const n=Vt(e,a,i,void 0,!1,t);o.type=null!==(s=n.returnType)&&void 0!==s?s:V.UnknownType.create(),n.argumentErrors&&(o.typeErrors=!0),n.isTypeIncomplete&&(o.isIncomplete=!0)}i.isIncomplete&&(o.isIncomplete=!0)}if(!r.isSpeculative(e)&&!i.isIncomplete){(0,V.isInstantiableClass)(i.type)&&V.ClassType.isBuiltIn(i.type,"TypeVar")&&_.getFileInfo(e).isTypingStubFile||a.forEach((e=>{e.valueExpression&&48!==e.valueExpression.nodeType&&!he(e.valueExpression)&&Ae(e.valueExpression)}))}0!=(1024&n)&&(nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeAnnotationCall(),e),o={node:e,type:V.UnknownType.create()});return o}(e,s,n);break;case 52:o=function(e,t,n){if(0!=(64&n)&&0===e.expressions.length&&!t)return{type:Ct([]),node:e,isEmptyTupleShorthand:!0};let s=t,i=t&&(0,V.isAny)(t);if(t&&(0,V.isUnion)(t)){let n;(0,U.doForEachSubtype)(t,(t=>{if((0,V.isAny)(t)&&(i=!0),!n){const s=Yn(e,(()=>Dt(e,t)));s&&gs(t,s.type)&&(n=t)}})),s=n}if(s){const t=Dt(e,s);if(t)return t}const r=function(e){const t=e.expressions.map((e=>Ae(e))),n=t.some((e=>e.isIncomplete));if(!ee||!(0,V.isInstantiableClass)(ee))return{type:V.UnknownType.create(),node:e};return{type:(0,U.convertToInstance)((0,U.specializeTupleClass)(ee,Pt(t))),node:e,isIncomplete:n}}(e);i&&(r.type=V.AnyType.create());return r}(e,s,n);break;case 11:o=function(e,t){let n;26===e.constType?n=0!=(64&t)?V.NoneType.createType():V.NoneType.createInstance():33!==e.constType&&15!==e.constType&&9!==e.constType||(n=qn(e,"bool"),n&&(0,V.isClassInstance)(n)&&(33===e.constType?n=V.ClassType.cloneWithLiteral(n,!0):15===e.constType&&(n=V.ClassType.cloneWithLiteral(n,!1))));if(!n)return;return{type:n,node:e}}(e,n);break;case 48:{const t=0!=(8&n)&&!function(e){if(e.parent&&24===e.parent.nodeType){const t=Ae(e.parent.baseExpression).type;if(t&&(0,V.isInstantiableClass)(t)&&V.ClassType.isSpecialBuiltIn(t,"Literal"))return!0}return!1}(e);t&&(d=!1),o=function(e,t,n){let s;if(n){let n=68|t;if(0==(4194304&t)&&(n|=524288),e.typeAnnotation)s=Ae(e.typeAnnotation,n);else if(!e.typeAnnotation&&1===e.strings.length){const t=function(e){const t=_.getFileInfo(e),n=new g.Parser,s=e.strings[0].value,i=e.strings[0].start+e.strings[0].token.prefixLength+e.strings[0].token.quoteMarkLength,r=new g.ParseOptions;r.isStubFile=t.isStubFile,r.pythonVersion=t.executionEnvironment.pythonVersion;const a=n.parseTextExpression(t.fileContents,i,s.length,r,void 0,void 0,t.typingSymbolAliases);if(a.parseTree&&62!==a.parseTree.nodeType)return a.diagnostics.forEach((t=>{Xe(t.message,e)})),a.parseTree.parent=e,a.parseTree;return}(e);t&&(s=Ae(t,n))}if(!s){nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.expectedTypeNotString(),e),s={node:e,type:V.UnknownType.create()}}}else{e.strings.forEach((e=>{27===e.nodeType&&e.expressions.forEach((e=>{Ae(e)}))}));const t=0!=(32&e.strings[0].token.flags);s=e.strings.some((e=>27===e.nodeType))?{node:e,type:qn(e,t?"bytes":"str")}:{node:e,type:cn(e,t?"bytes":"str",e.strings.map((e=>e.value)).join(""))}}return s}(e,n,t);break}case 40:o=function(e,t){t=e.isImaginary?{node:e,type:qn(e,"complex")}:e.isInteger?{node:e,type:cn(e,"int",e.value)}:{node:e,type:qn(e,"float")};return t}(e,o);break;case 18:o=function(e,t,n){if(0!=(1&e))t={type:V.AnyType.create(!0),node:n};else if(0!=(256&e))t={type:V.UnknownType.create(),node:n};else{t={type:qn(n,"ellipsis")||V.AnyType.create(),node:n}}return t}(n,o,e);break;case 55:o=function(e,t){const n=Ae(e.expression);let s=lt(n.type);const i=n.isIncomplete;if((0,V.isNever)(s))return{node:e,type:V.NeverType.createNever(),isIncomplete:i};const r={0:"__pos__",33:"__neg__",5:"__invert__"};let a;38!==e.operator&&(0,U.isOptionalType)(s)&&(nt(_.getFileInfo(e).diagnosticRuleSet.reportOptionalOperand,p.DiagnosticRule.reportOptionalOperand,y.Localizer.Diagnostic.noneOperator().format({operator:D.printOperator(e.operator)}),e.expression),s=(0,V.removeNoneFromUnion)(s));if(!n.isIncomplete){const t=(0,U.getLiteralTypeClassName)(s);"int"===t?0===e.operator?a=s:33===e.operator&&(a=(0,U.mapSubtypes)(s,(e=>{const t=e;return V.ClassType.cloneWithLiteral(t,-t.literalValue)}))):"bool"===t&&38===e.operator&&(a=(0,U.mapSubtypes)(s,(e=>{const t=e;return V.ClassType.cloneWithLiteral(t,!t.literalValue)})))}if(!a)if(38===e.operator)a=qn(e,"bool"),a||(a=V.UnknownType.create());else{if((0,V.isAnyOrUnknown)(s))a=s;else{a=Qt(s,[],r[e.operator],e,t)}if(!a){const n=_.getFileInfo(e);nt(n.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,t?y.Localizer.Diagnostic.typeNotSupportUnaryOperatorBidirectional().format({operator:D.printOperator(e.operator),type:Ps(s),expectedType:Ps(t)}):y.Localizer.Diagnostic.typeNotSupportUnaryOperator().format({operator:D.printOperator(e.operator),type:Ps(s)}),e),a=V.UnknownType.create()}}return{type:a,node:e,isIncomplete:i}}(e,s);break;case 7:o=Kt(e,s,n);break;case 5:o=Yt(e,s);break;case 31:case 45:o=function(e,t){let n=t;if(t&&(0,V.isUnion)(t)){let s;(0,U.doForEachSubtype)(t,(t=>{if(!s){const n=Yn(e,(()=>nn(e,t)));n&&gs(t,n.type)&&(s=t)}})),n=s}if(n){const t=nn(e,n);if(t)return t}return function(e,t){const n=31===e.nodeType?"list":"set";let s=!1,i=!1,r=[];e.entries.forEach(((e,n)=>{let s;s=32===e.nodeType?on(e):Ae(e,void 0,t?V.NeverType.createNever():void 0),s.isIncomplete&&(i=!0),n<$&&r.push(s.type)})),r=r.map((e=>(0,U.stripLiteralValue)(e)));let a=t?V.AnyType.create():V.UnknownType.create();if(r.length>0){const s=_.getFileInfo(e);a="list"===n&&s.diagnosticRuleSet.strictListInference||"set"===n&&s.diagnosticRuleSet.strictSetInference||t?(0,V.combineTypes)(r,64):(0,U.areTypesSame)(r,!0)?r[0]:a}else s=!0;const o=$n(e,n);return{type:(0,V.isInstantiableClass)(o)?V.ClassType.cloneAsInstance(V.ClassType.cloneForSpecialization(o,[a],!0,void 0,void 0,s)):V.UnknownType.create(),node:e,isIncomplete:i}}(e,void 0!==t)}(e,s);break;case 46:o=function(e){e.startValue&&Ae(e.startValue);e.endValue&&Ae(e.endValue);e.stepValue&&Ae(e.stepValue);return{type:qn(e,"slice"),node:e}}(e);break;case 6:o=function(e,t,n){const s=n?Fn(e,n,!1):void 0,i=Ae(e.expression,t,s),r={type:We(i.type,e.expression),node:e};i.isIncomplete&&(r.isIncomplete=!0);return r}(e,n,s);break;case 51:o=function(e,t,n){Ae(e.testExpression);const s=[];let i=!1;if(Ye(e.ifExpression)){const r=Ae(e.ifExpression,t,n);s.push(r.type),r.isIncomplete&&(i=!0)}if(Ye(e.elseExpression)){const r=Ae(e.elseExpression,t,n);s.push(r.type),r.isIncomplete&&(i=!0)}return{type:(0,V.combineTypes)(s),node:e,isIncomplete:i}}(e,n,s);break;case 32:o=function(e,t){let n=!1;const s=on(e);s.isIncomplete&&(n=!0);const i=s.type;let r=e.forIfNodes.some((e=>33===e.nodeType&&e.isAsync||34===e.nodeType&&6===e.testExpression.nodeType)),a=V.UnknownType.create();6===e.expression.nodeType&&(r=!0);!r&&t&&(0,V.isClassInstance)(t)&&V.ClassType.isBuiltIn(t,"AsyncGenerator")&&(r=!0);const o=$e(e,r?"AsyncGenerator":"Generator");o&&(0,V.isInstantiableClass)(o)&&(a=V.ClassType.cloneAsInstance(V.ClassType.cloneForSpecialization(o,r?[i,V.NoneType.createInstance()]:[i,V.NoneType.createInstance(),V.NoneType.createInstance()],!0)));return{type:a,node:e,isIncomplete:n}}(e,s);break;case 15:o=function(e,t){let n=t;if(t&&(0,V.isUnion)(t)){let s;(0,U.doForEachSubtype)(t,(t=>{if(!s){const n=Yn(e,(()=>Xt(e,t)));n&&gs(t,n.type)&&(s=t)}})),n=s}let s;if(n){s=new c.DiagnosticAddendum;const t=Xt(e,n,s);if(t)return t}return{...en(e,!!t),expectedTypeDiagAddendum:s}}(e,s);break;case 30:o=function(e,t){const n=V.FunctionType.createInstance("","","",0);n.details.typeVarScopeId=gt(e),fe(e,n,0,!1);let s=[];if(t){(0,U.mapSubtypes)(t,(e=>{if((0,V.isFunction)(e)&&s.push(e),(0,V.isClassInstance)(e)){const t=(0,U.lookUpObjectMember)(e,"__call__");if(t){const n=ls(t);if((0,V.isFunction)(n)){const t=Fs(e,n);t&&s.push(t)}}}}));const n=e.parameters.filter((e=>0===e.category&&void 0===e.defaultValue)).length,i=e.parameters.filter((e=>0===e.category)).length;s=s.filter((e=>{const t=e.details.parameters.filter((e=>!!e.name&&!e.hasDefault)).length;return e.details.parameters.some((e=>!!e.name&&0!==e.category))||t>=n&&t<=i}))}const i=s.length>0?s[0]:void 0;let a=!0;e.parameters.forEach(((t,s)=>{let r=V.UnknownType.create();if(i&&s<i.details.parameters.length&&(r=V.FunctionType.getEffectiveParameterType(i,s)),t.name&&fe(t.name,In(e,t.category,r),0,!1),t.defaultValue&&Ae(t.defaultValue,1),s>=0){let e=!1;0===t.category&&t.name?(0,N.isPrivateName)(t.name.value)&&(e=!0):a=!1,a&&!e&&n.details.parameters.length>0&&V.FunctionType.addParameter(n,{category:0,type:V.UnknownType.create()}),e||(a=!1)}const o={category:t.category,name:t.name?t.name.value:void 0,hasDefault:!!t.defaultValue,defaultValueExpression:t.defaultValue,hasDeclaredType:!0,type:r};V.FunctionType.addParameter(n,o)})),a&&n.details.parameters.length>0&&V.FunctionType.addParameter(n,{category:0,type:V.UnknownType.create()});const o=i?rs(i):void 0;r.isSpeculative(e)?Yn(e.expression,(()=>{n.inferredReturnType=Ae(e.expression,void 0,o).type}),!1):n.inferredReturnType=Ae(e.expression,void 0,o).type;return{type:n,node:e}}(e,s);break;case 3:o=Ae(e.rightExpression),pt(e.leftExpression,o.type,!1,e.rightExpression,!0,!0);break;case 4:o=Ae(e.rightExpression),pt(e.name,o.type,!1,e.rightExpression,!0);break;case 60:o=function(e){let t,n,s=!1;const i=D.getEnclosingFunction(e);if(i){const e=_n(i);if(e){const s=V.FunctionType.getSpecializedReturnType(e.functionType);if(s){const e=(0,U.getGeneratorTypeArgs)(s);e&&(e.length>=1&&(t=e[0]),e.length>=2&&(n=e[1]))}}}if(e.expression){Ae(e.expression,void 0,t).isIncomplete&&(s=!0)}return{type:n||V.UnknownType.create(),node:e,isIncomplete:s}}(e);break;case 61:o=function(e){var t;const n=Ae(e.expression).type;let s,i=(0,U.getGeneratorTypeArgs)(n);if(i)s=i.length>=2?i[2]:V.UnknownType.create();else if((0,V.isClassInstance)(n)&&V.ClassType.isBuiltIn(n,"Coroutine"))s=V.UnknownType.create();else{const r=null!==(t=Ge(n,!1,e))&&void 0!==t?t:V.UnknownType.create();i=(0,U.getGeneratorTypeArgs)(r),i&&(s=i.length>=2?i[2]:V.UnknownType.create())}return{type:s||V.UnknownType.create(),node:e}}(e);break;case 56:o=function(e,t,n){var s;let i,r;if(n){const t=$n(e,"Iterable");t&&(0,V.isInstantiableClass)(t)&&(r=V.ClassType.cloneAsInstance(V.ClassType.cloneForSpecialization(t,[n],!0)))}const a=Ae(e.expression,t,r),o=a.type;if(0==(128&t)&&(0,V.isVariadicTypeVar)(o)&&!o.isVariadicUnpacked)i={type:V.TypeVarType.cloneForUnpacked(o),node:e};else if(0!=(2097152&t)&&(0,V.isInstantiableClass)(o)&&V.ClassType.isBuiltIn(o,"tuple"))i={type:V.ClassType.cloneForUnpacked(o),node:e};else{i={type:null!==(s=je(o,!1,e))&&void 0!==s?s:V.UnknownType.create(!!a.isIncomplete),unpackedType:o,node:e,isIncomplete:a.isIncomplete}}return i}(e,n,s);break;case 54:o=Ae(e.typeAnnotation,34024);break;case 49:case 27:o=function(e){const t=0!=(32&e.token.flags);let n;n=27===e.nodeType?{node:e,type:qn(e,t?"bytes":"str")}:{node:e,type:cn(e,t?"bytes":"str",e.value)};return n}(e);break;case 0:Hn(e,(()=>{e.child&&Ae(e.child)})),o={type:V.UnknownType.create(),node:e};break;default:(0,l.assertNever)(e)}if(o||(0,l.fail)(`Unhandled expression type '${D.printExpression(e)}'`),d&&!o.isIncomplete&&(128&n&&(0,V.isTypeVar)(o.type)&&o.type.details.isVariadic&&!o.type.isVariadicInUnion&&(Xe(y.Localizer.Diagnostic.typeVarTupleContext(),e),o.type=V.UnknownType.create()),!V.TypeBase.isInstantiable(o.type))){(0,V.isClassInstance)(o.type)&&V.ClassType.isTupleClass(o.type)&&0===(null===(i=o.type.tupleTypeArguments)||void 0===i?void 0:i.length)||(it(o.type,e),o.type=V.UnknownType.create())}return 65536&n&&(0,U.isTypeAliasPlaceholder)(o.type)&&(o.type.details.illegalRecursionDetected=!0),(0,U.isTypeAliasPlaceholder)(o.type)||(fe(e,o.type,n,!!o.isIncomplete,s,!0),!s||(0,V.isAnyOrUnknown)(s)||(0,V.isNever)(s)||pe.set(e.id,s)),o}function Ee(e,t){return ke(e,{associateTypeVarsWithScope:!0,allowTypeVarTuple:1===t,disallowRecursiveTypeAlias:!0,allowUnpackedTypedDict:2===t,allowUnpackedTuple:1===t})}function ke(e,t){var n,s,i;const r=_.getFileInfo(e);if(r.isTypingStubFile||r.isTypingExtensionsStubFile){const t=function(e){if(!e.parent||54!==e.parent.nodeType)return;if(38!==e.parent.valueExpression.nodeType)return;const t=e.parent.valueExpression.value,n=new Map([["Tuple",{alias:"tuple",module:"builtins"}],["Generic",{alias:"",module:"builtins"}],["Protocol",{alias:"",module:"builtins"}],["Callable",{alias:"",module:"builtins"}],["Type",{alias:"type",module:"builtins"}],["ClassVar",{alias:"",module:"builtins"}],["Final",{alias:"",module:"builtins"}],["Literal",{alias:"",module:"builtins"}],["TypedDict",{alias:"_TypedDict",module:"self"}],["Union",{alias:"",module:"builtins"}],["Optional",{alias:"",module:"builtins"}],["Annotated",{alias:"",module:"builtins"}],["TypeAlias",{alias:"",module:"builtins"}],["Concatenate",{alias:"",module:"builtins"}],["TypeGuard",{alias:"",module:"builtins"}],["StrictTypeGuard",{alias:"",module:"builtins"}],["Unpack",{alias:"",module:"builtins"}],["Required",{alias:"",module:"builtins"}],["NotRequired",{alias:"",module:"builtins"}],["Self",{alias:"",module:"builtins"}],["NoReturn",{alias:"",module:"builtins"}],["Never",{alias:"",module:"builtins"}],["LiteralString",{alias:"",module:"builtins"}]]).get(t);if(n){const s=ge(e,0);if(s)return(0,l.assert)((0,V.isInstantiableClass)(s)),s;const i=yn(e,t,n);return fe(e,i,0,!1),i}return}(e);if(t)return t}let a=1097;(null==t?void 0:t.isVariableAnnotation)&&(a|=32768),(null==t?void 0:t.allowFinal)||(a|=16),(null==t?void 0:t.allowClassVar)||(a|=131072),(null==t?void 0:t.allowTypeVarTuple)?a|=2097152:a|=128,(null==t?void 0:t.allowParamSpec)||(a|=32),(null==t?void 0:t.associateTypeVarsWithScope)?a|=8192:a|=4096,(null==t?void 0:t.disallowRecursiveTypeAlias)&&(a|=65536),(null==t?void 0:t.allowUnpackedTypedDict)&&(a|=8388608),(null==t?void 0:t.allowUnpackedTuple)&&(a|=2097152),(null==t?void 0:t.notParsedByInterpreter)&&(a|=524288),(0,T.isAnnotationEvaluationPostponed)(r)&&(a|=4),3===(null===(n=null==e?void 0:e.parent)||void 0===n?void 0:n.nodeType)&&e.parent.typeAnnotationComment===e?a|=524292: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|=524292):41===(null===(i=null==e?void 0:e.parent)||void 0===i?void 0:i.nodeType)&&e.parent.typeAnnotationComment===e&&(a|=524292);const o=Ae(e,a).type;return(0,V.isModule)(o)&&nt(r.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.moduleAsType(),e),(0,U.convertToInstance)(o)}function we(e,t){let n=_.getFileInfo(e).isStubFile?4:0;9!==e.expression.nodeType&&(n|=2);const s=Ae(e.expression,n);if((0,V.isInstantiableClass)(s.type)&&V.ClassType.isBuiltIn(s.type,"classmethod")&&(0,U.isProperty)(t))return t;const i=[{argumentCategory:0,type:t}],r=Vt(e.expression,i,s,void 0,!0).returnType||V.UnknownType.create();return!(0,V.isFunction)(r)||r.details.declaredReturnType||r.details.parameters.some(((e,t)=>!(e.name&&!e.hasDeclaredType)||0===e.category&&(0!==t||!e.isTypeInferred)))?(0,U.isPartlyUnknown)(r)&&(0,V.isFunction)(s.type)&&!s.type.details.parameters.find((e=>void 0!==e.typeAnnotation))&&void 0===s.type.details.declaredReturnType?t:r:t}function Ne(e,t=0){if(t>V.maxTypeRecursionCount)return!0;switch(t++,e.category){case 0:case 1:case 2:case 4:case 3:return!0;case 9:return void 0!==(0,V.findSubtype)(e,(e=>Ne(e,t)));case 5:case 6:case 8:case 10:return!1;case 7:{if(V.TypeBase.isInstantiable(e))return!1;if((0,U.isTupleClass)(e)&&e.tupleTypeArguments)return(0,U.isUnboundedTupleClass)(e)||0===e.tupleTypeArguments.length;if(V.ClassType.isBuiltIn(e,"bool")&&void 0!==e.literalValue)return!1===e.literalValue;if(V.ClassType.isProtocolClass(e))return!0;if((0,U.lookUpObjectMember)(e,"__len__"))return!0;const t=(0,U.lookUpObjectMember)(e,"__bool__");if(t){const e=ls(t);if((0,V.isFunction)(e)&&e.details.declaredReturnType){const t=e.details.declaredReturnType;if((0,V.isClassInstance)(t)&&V.ClassType.isBuiltIn(t,"bool")&&!0===t.literalValue)return!1}return!0}return!1}}}function Me(e,t=0){if(t>V.maxTypeRecursionCount)return!0;switch(t++,e.category){case 1:case 5:case 6:case 8:case 10:case 4:case 2:return!0;case 9:return void 0!==(0,V.findSubtype)(e,(e=>Me(e,t)));case 0:case 3:return!1;case 7:{if(V.TypeBase.isInstantiable(e))return!0;if((0,U.isTupleClass)(e)&&e.tupleTypeArguments&&0===e.tupleTypeArguments.length)return!1;if(!1===e.literalValue||0===e.literalValue||e.literalValue===BigInt(0)||""===e.literalValue)return!1;if(V.ClassType.isProtocolClass(e))return!0;const t=(0,U.lookUpObjectMember)(e,"__bool__");if(t){const e=ls(t);if((0,V.isFunction)(e)&&e.details.declaredReturnType){const t=e.details.declaredReturnType;if((0,V.isClassInstance)(t)&&V.ClassType.isBuiltIn(t,"bool")&&!1===t.literalValue)return!1}}return!0}}}function Re(e){return(0,U.mapSubtypes)(e,(e=>{if((0,V.isClassInstance)(e)){if(void 0!==e.literalValue)return e.literalValue?void 0:e;if(V.ClassType.isBuiltIn(e,"bool"))return V.ClassType.cloneWithLiteral(e,!1)}if(Ne(e))return e}))}function Oe(e){return(0,U.mapSubtypes)(e,(e=>{if((0,V.isClassInstance)(e)){if(void 0!==e.literalValue)return e.literalValue?e:void 0;if(V.ClassType.isBuiltIn(e,"bool"))return V.ClassType.cloneWithLiteral(e,!0)}if(Me(e))return e}))}function Le(e,t,n,s={method:"get"},i,r=0,a){const o=_t(e,V.ClassType.cloneAsInstantiable(t),n,s,i,8|r,a);if(o)return{node:e,type:o.type,isIncomplete:!!o.isTypeIncomplete,isAsymmetricDescriptor:o.isAsymmetricDescriptor}}function Ve(e,t,n,s={method:"get"},i,r=0,a){let o;if(V.ClassType.isPartiallyConstructed(t))return nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.classDefinitionCycle().format({name:t.details.name}),e),{node:e,type:V.UnknownType.create()};if(0==(32&r)&&(o=_t(e,t,n,s,i,1|r,a)),o&&o.classType&&o.symbol&&(0,V.isClass)(o.classType)&&V.ClassType.isProtocolClass(o.classType)){const t=(0,M.getLastTypedDeclaredForSymbol)(o.symbol);t&&1===t.type&&!o.isClassVar&&nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.protocolMemberNotClassVar().format({memberName:n,className:o.classType.details.name}),e)}if(!o){const i=t.details.effectiveMetaclass;i&&(0,V.isInstantiableClass)(i)&&!V.ClassType.isSameGenericClass(i,t)&&(o=_t(e,i,n,s,void 0,r,t))}return o?{node:e,type:o.type,isIncomplete:!!o.isTypeIncomplete,isAsymmetricDescriptor:o.isAsymmetricDescriptor}:void 0}function Ue(e,t,n=!1){const s=(0,U.lookUpClassMember)(e,t,8);if(s){const t=ls(s);if((0,V.isFunction)(t)||(0,V.isOverloadedFunction)(t)){const s=Fs(V.ClassType.cloneAsInstance(e),t,void 0,void 0,void 0,n);if(s)return s}}}function ze(e){if(54===e.nodeType&&38===e.valueExpression.nodeType){const t=Kn(e,e.valueExpression.value,!1);if(t){return void 0!==t.symbol.getDeclarations().find((e=>(0,S.isExplicitTypeAliasDeclaration)(e)))}}return!1}function Be(e,t){let n,s,i,r=!0;switch(e.nodeType){case 38:{const t=Kn(e,e.value,!0);if(t&&(n=t.symbol,void 0===ss(n)&&2===t.scope.type)){const t=D.getEnclosingClassOrFunction(e);if(t&&10===t.nodeType){const s=fn(t);if(s){const t=(0,U.lookUpClassMember)(s.classType,e.value,24);t&&(n=t.symbol)}}}break}case 54:return Be(e.valueExpression);case 35:{const t=lt(Ae(e.leftExpression,2).type);let a;(0,V.isClassInstance)(t)?(a=(0,U.lookUpObjectMember)(t,e.memberName.value,16),s=t,i=null==a?void 0:a.classType,(null==a?void 0:a.isInstanceMember)&&(r=!1)):(0,V.isInstantiableClass)(t)&&(a=(0,U.lookUpClassMember)(t,e.memberName.value,24),s=t,i=null==a?void 0:a.classType),a&&(n=a.symbol);break}case 24:{const n=Be(e.baseExpression);if(n&&(0,V.isClassInstance)(n)){const s=(0,U.lookUpClassMember)(n,"__setitem__");if(s){const t=ls(s);if((0,V.isFunction)(t)){const i=Fs(n,t,(0,V.isInstantiableClass)(s.classType)?s.classType:void 0,e,void 0,!1);if(i&&(0,V.isFunction)(i)&&i.details.parameters.length>=2){const e=V.FunctionType.getEffectiveParameterType(i,1);if(!(0,V.isAnyOrUnknown)(e))return e}}}else if(V.ClassType.isTypedDictClass(n)){const s=(0,O.getTypeOfIndexedTypedDict)(As,e,n,t||{method:"get"});if(s)return s.type}}break}}if(n){let t=ss(n);if(t){if((0,V.isClassInstance)(t)){const e=(0,U.lookUpClassMember)(t,"__set__"),n=e?ls(e):void 0;if(n&&(0,V.isFunction)(n)&&n.details.parameters.length>=2&&(t=n.details.parameters[2].type,(0,V.isAnyOrUnknown)(t)))return}return s&&(i&&(0,V.isInstantiableClass)(i)&&(t=(0,U.partiallySpecializeType)(t,i)),((0,V.isFunction)(t)||(0,V.isOverloadedFunction)(t))&&r&&(t=Fs(s,t,void 0,e))),t}}}function We(e,t){return(0,U.mapSubtypes)(e,(e=>{if((0,V.isAnyOrUnknown)(e))return e;if((0,V.isClassInstance)(e)){const n=mt(e,"__await__",t);if(n){if((0,V.isAnyOrUnknown)(n))return n;if((0,V.isClassInstance)(n)){if(mt(n,"__iter__",t)){const e=function(e){if((0,V.isAnyOrUnknown)(e))return e;if((0,V.isClassInstance)(e)&&V.ClassType.isBuiltIn(e,"Generator")){const t=e.typeArguments;if(t&&t.length>=3)return t[2]}return}(n);if(e)return e}}}}if(t){nt(_.getFileInfo(t).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeNotAwaitable().format({type:Ps(e)}),t)}return V.UnknownType.create()}))}function je(e,t,n){const s=t?"__aiter__":"__iter__",i=t?"__anext__":"__next__";let r=!0;e=lt(e),(0,U.isOptionalType)(e)&&(n&&nt(_.getFileInfo(n).diagnosticRuleSet.reportOptionalIterable,p.DiagnosticRule.reportOptionalIterable,y.Localizer.Diagnostic.noneNotIterable(),n),e=(0,V.removeNoneFromUnion)(e));const a=(0,U.mapSubtypes)(e,(e=>{if(e=lt(e),(0,V.isAnyOrUnknown)(e))return e;const a=new c.DiagnosticAddendum;if((0,V.isClass)(e)){let r;if(V.TypeBase.isInstance(e)){if((0,U.isTupleClass)(e)&&e.tupleTypeArguments&&0===e.tupleTypeArguments.length)return V.NeverType.createNever();r=mt(e,s,n)}else V.TypeBase.isInstantiable(e)&&e.details.effectiveMetaclass&&(0,V.isInstantiableClass)(e.details.effectiveMetaclass)&&(r=mt(V.ClassType.cloneAsInstance(e.details.effectiveMetaclass),s,n,e));if(r){const e=new c.DiagnosticAddendum,o=ct(r,void 0,(r=>{if((0,V.isAnyOrUnknown)(r))return r;if((0,V.isClassInstance)(r)){const s=mt(r,i,n);if(s)return t?We(s,n):s;e.addMessage(y.Localizer.Diagnostic.methodNotDefinedOnType().format({name:i,type:Ps(r)}))}else e.addMessage(y.Localizer.Diagnostic.methodReturnsNonObject().format({name:s}))}));if(e.isEmpty())return o;a.addAddendum(e)}else{if((0,V.isClassInstance)(e)){const t=mt(e,"__getitem__",n);if(t)return t}a.addMessage(y.Localizer.Diagnostic.methodNotDefined().format({name:s}))}}n&&nt(_.getFileInfo(n).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeNotIterable().format({type:Ps(e)})+a.getString(),n),r=!1}));return r?a:void 0}function Ge(e,t,n){const s=t?"__aiter__":"__iter__";let i=!0;e=lt(e),(0,U.isOptionalType)(e)&&(n&&nt(_.getFileInfo(n).diagnosticRuleSet.reportOptionalIterable,p.DiagnosticRule.reportOptionalIterable,y.Localizer.Diagnostic.noneNotIterable(),n),e=(0,V.removeNoneFromUnion)(e));const r=(0,U.mapSubtypes)(e,(e=>{if((0,V.isAnyOrUnknown)(e))return e;if((0,V.isClass)(e)){let t;if(V.TypeBase.isInstance(e)?t=mt(e,s,n):V.TypeBase.isInstantiable(e)&&e.details.effectiveMetaclass&&(0,V.isInstantiableClass)(e.details.effectiveMetaclass)&&(t=mt(V.ClassType.cloneAsInstance(e.details.effectiveMetaclass),s,n,e)),t)return lt(t)}n&&nt(_.getFileInfo(n).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeNotIterable().format({type:Ps(e)}),n),i=!1}));return i?r:void 0}function $e(e,t){var n;return null!==(n=Ke(e,t,["typing"]))&&void 0!==n?n:Ke(e,t,["typing_extensions"])}function qe(e,t){return Ke(e,t,["_typeshed"])}function Ke(t,n,s){const i=_.getFileInfo(t),r=e({nameParts:s,importingFilePath:i.filePath});if(!r)return;const a=r.symbolTable.get(n);return a?ts(a):void 0}function He(e){const t=28===e.nodeType?e:D.getExecutionScopeNode(e);if(_.getCodeFlowComplexity(t)>1024){let n=t;28===t.nodeType?n=t.name:36===t.nodeType&&(n={start:0,length:0});const s=_.getFileInfo(e);return st(s,s.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.codeTooComplexToAnalyze(),n),!0}return!1}function Ye(e,t){if(He(e))return!0;const n=_.getFlowNode(e);if(!n)return!!e.parent&&Ye(e.parent,t);const s=t?_.getFlowNode(t):void 0;return Es.isFlowNodeReachable(n,s)}function Ze(e){const t=_.getAfterFlowNode(e);return!!t&&(!!He(e)||!!Es.isFlowNodeReachable(t)&&!!function(e,t){const n=Un(e.id);if(He(e))return!0;return void 0!==n.getTypeFromCodeFlow(t,void 0,void 0,V.UnboundType.create(),!1).type}(e,t))}function Qe(e,t,n=!0){if(He(e))return!0;const s=_.getFlowNode(e),i=_.getFlowNode(t);return!(!s||!i)&&(s===i?n:Es.isFlowNodeReachable(i,s))}function Je(e,t,n){return et("information",e,t,n)}function Xe(e,t,n){return et("error",e,t,n)}function et(e,t,n,s){if(!tt(n)){return _.getFileInfo(n).diagnosticSink.addDiagnosticWithTextRange(e,t,s||n)}}function tt(e){return q.some((t=>D.isNodeContainedWithin(e,t)))||r.isSpeculative(e)}function nt(e,t,n,s){if("none"===e)return;const i=et(e,n,s);return i&&i.setRule(t),i}function st(e,t,n,s,i){if("none"===t)return;const r=e.diagnosticSink.addDiagnosticWithTextRange(t,s,i);return n&&r.setRule(n),r}function it(e,t){const n=_.getFileInfo(t),s=new c.DiagnosticAddendum;(0,V.isUnion)(e)&&(0,U.doForEachSubtype)(e,(e=>{V.TypeBase.isInstantiable(e)||s.addMessage(y.Localizer.DiagnosticAddendum.typeNotClass().format({type:Ps(e)}))})),nt(n.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeExpectedClass().format({type:Ps(e)})+s.getString(),t)}function rt(e,t,n,s,i,r=!1,a){const o=e.value,l=Kn(e,o,!1);if(!l)return;const d=l.symbol.getDeclarations();let u=ss(l.symbol);const m=_.getFileInfo(e);if(void 0===u&&2===l.scope.type){const t=D.getEnclosingClass(e);if(t){const n=fn(t);if(n){const t=(0,U.lookUpClassMember)(n.classType,e.value,1);(null==t?void 0:t.isTypeDeclared)&&(u=ls(t))}}}let h=t;if(u&&i){let n=new c.DiagnosticAddendum;gs(u,t,n)?h=Cs(u,t):(a&&(n=a),nt(m.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeAssignmentMismatch().format({sourceType:Ps(t),destType:Ps(u)})+n.getString(),i||e),h=u)}else{const t=E.getScopeForNode(e);2===(null==t?void 0:t.type)&&(!V.TypeBase.isInstance(h)||(0,N.isConstantName)(o)||(0,M.isFinalVariable)(l.symbol)||(h=(0,U.stripLiteralValue)(h)))}const g=d.find((e=>1===e.type));g&&1===g.type&&i&&(g.isConstant?e!==d[0].node&&nt(m.diagnosticRuleSet.reportConstantRedefinition,p.DiagnosticRule.reportConstantRedefinition,y.Localizer.Diagnostic.constantRedefinition().format({name:o}),e):g.isFinal&&!r&&nt(m.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.finalReassigned().format({name:o}),e)),n||rn(m.diagnosticRuleSet.reportUnknownVariableType,p.DiagnosticRule.reportUnknownVariableType,e,h,e,s),fe(e,h,0,n,void 0,!1)}function at(e,t,n,s,a){const o=Ae(e.leftExpression,2),l=lt(o.type);if(38===e.leftExpression.nodeType){const i=D.getEnclosingClass(e);if(i){const r=fn(i);if(r&&(0,V.isInstantiableClass)(r.classType)&&((0,V.isClassInstance)(l)?V.ClassType.isSameGenericClass(l,r.classType)&&ot(e,t,n,!0,s):(0,V.isInstantiableClass)(l)&&V.ClassType.isSameGenericClass(l,r.classType)&&ot(e,t,n,!1,s),V.ClassType.isProtocolClass(r.classType))){const t=r.classType.details.fields.get(e.memberName.value);if(t){0===t.getDeclarations().filter((e=>!D.getEnclosingFunction(e.node))).length&&Xe(y.Localizer.Diagnostic.assignmentInProtocol(),e.memberName)}}}}var c;Tt(e,o,{method:"set",setType:t,setErrorNode:s,setExpectedTypeDiag:a},0).isAsymmetricDescriptor&&(c=e,r.isSpeculative(void 0)||i.add(c.id)),fe(e.memberName,t,0,n,void 0,!1),fe(e,t,0,n,void 0,!1)}function ot(e,t,n,s,i){const r=e.memberName.value,a=_.getFileInfo(e),o=D.getEnclosingClass(e);if(!o)return;const c=fn(o);if(c&&(0,V.isInstantiableClass)(c.classType)){let o=(0,U.lookUpClassMember)(c.classType,r,s?0:8);const d=c.classType.details.fields;if(o){const n=(0,V.isInstantiableClass)(o.classType)?o.classType:void 0,u=n&&V.ClassType.isSameGenericClass(c.classType,n);if(u&&s&&(null==n?void 0:n.details.inheritedSlotsNames)&&n.details.localSlotsNames&&n.details.localSlotsNames.length>0&&!n.details.inheritedSlotsNames.some((e=>e===r))){const t=(0,U.lookUpClassMember)(n,r,8);let s=!1;if(t){const e=ts(t.symbol);((0,V.isAnyOrUnknown)(e)||(0,V.isUnbound)(e)||(0,U.isMaybeDescriptorInstance)(e))&&(s=!0)}s||nt(a.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.slotsAttributeError().format({name:r}),e.memberName)}if(u&&o.isInstanceMember===s){const t=d.get(r);(0,l.assert)(void 0!==t);const n=t.getDeclarations();n.length>0&&1===n[0].type&&i&&e.memberName!==n[0].node&&n[0].isConstant&&nt(a.diagnosticRuleSet.reportConstantRedefinition,p.DiagnosticRule.reportConstantRedefinition,y.Localizer.Diagnostic.constantRedefinition().format({name:e.memberName.value}),e.memberName)}else{const n=ss(o.symbol);if(n&&!(0,U.isProperty)(n)&&!o.isInstanceMember&&s){ut(a,o.symbol,e.memberName);const n=ls(o);t=(0,V.combineTypes)([t,n])}}}o=(0,U.lookUpClassMember)(c.classType,r,16),o||!i||n||rn(a.diagnosticRuleSet.reportUnknownMemberType,p.DiagnosticRule.reportUnknownMemberType,e.memberName,t,e,!0)}}function lt(e,t){return(0,U.mapSubtypes)(e,(e=>{if((0,V.isParamSpec)(e)){if("args"===e.paramSpecAccess)return ee&&(0,V.isInstantiableClass)(ee)&&Q&&(0,V.isClassInstance)(Q)?V.ClassType.cloneAsInstance((0,U.specializeTupleClass)(ee,[{type:Q,isUnbounded:!0}])):V.UnknownType.create();if("kwargs"===e.paramSpecAccess)return se&&(0,V.isInstantiableClass)(se)&&ne&&(0,V.isInstantiableClass)(ne)&&Q&&(0,V.isClassInstance)(Q)?V.ClassType.cloneAsInstance(V.ClassType.cloneForSpecialization(se,[(0,U.convertToInstance)(ne),Q],!0)):V.UnknownType.create()}if((0,V.isVariadicTypeVar)(e)&&ee&&(0,V.isInstantiableClass)(ee))return(0,U.convertToInstance)((0,U.specializeTupleClass)(ee,[],!0,!0,!0));if((0,V.isTypeVar)(e)&&!e.details.recursiveTypeAliasName){if(e.details.boundType){const t=V.TypeBase.isInstantiable(e)?(0,U.convertToInstantiable)(e.details.boundType):e.details.boundType;return e.details.isSynthesized?t:(0,U.addConditionToType)(t,[{typeVarName:V.TypeVarType.getNameWithScope(e),constraintIndex:0,isConstrainedTypeVar:!1}])}if(e.details.recursiveTypeAliasName)return e;if(e.details.constraints.length>0){const n=[];return e.details.constraints.forEach(((s,i)=>{if(t){const n=V.TypeVarType.getNameWithScope(e),s=t.find((e=>e.typeVarName===n));if(s&&s.constraintIndex!==i)return}V.TypeBase.isInstantiable(e)&&(s=(0,U.convertToInstantiable)(s)),n.push((0,U.addConditionToType)(s,[{typeVarName:V.TypeVarType.getNameWithScope(e),constraintIndex:i,isConstrainedTypeVar:!0}]))})),(0,V.combineTypes)(n)}if(e.details.isExemptFromBoundCheck)return V.AnyType.create();if(V.TypeBase.isInstantiable(e)){if(J&&(0,V.isInstantiableClass)(J))return e.details.isSynthesized?J:(0,U.addConditionToType)(V.ClassType.cloneAsInstance(J),[{typeVarName:V.TypeVarType.getNameWithScope(e),constraintIndex:0,isConstrainedTypeVar:!1}])}else if(Q)return e.details.isSynthesized?Q:(0,U.addConditionToType)(Q,[{typeVarName:V.TypeVarType.getNameWithScope(e),constraintIndex:0,isConstrainedTypeVar:!1}]);return V.AnyType.create()}return e}))}function ct(e,t,n){const s=[];let i=!1;const r=e=>{let r=(0,V.isUnion)(e)?e:lt(e);r=(0,U.transformPossibleRecursiveTypeAlias)(r),(0,U.doForEachSubtype)(r,(r=>{var a;if(t&&!V.TypeCondition.isCompatible((0,U.getTypeCondition)(r),t))return;let o=n(r,e);if(o!==e&&(i=!0),o){const e=null===(a=(0,U.getTypeCondition)(r))||void 0===a?void 0:a.filter((e=>e.isConstrainedTypeVar));e&&e.length>0&&(o=(0,U.addConditionToType)(o,e)),s.push(o)}}))};if((0,V.isUnion)(e)?e.subtypes.forEach((e=>{r(e)})):r(e),!i)return e;const a=(0,V.combineTypes)(s);return 9===a.category&&V.UnionType.addTypeAliasSource(a,e),a}function pt(e,t,n,s,i=!1,r=!1,a){if((0,V.isTypeVar)(t)&&s&&9===s.nodeType){const n=Ae(s.leftExpression,2).type;(0,V.isInstantiableClass)(n)&&(V.ClassType.isBuiltIn(n,"TypeVar")||V.ClassType.isBuiltIn(n,"TypeVarTuple")||V.ClassType.isBuiltIn(n,"ParamSpec"))&&(38===e.nodeType&&e.value===t.details.name||Xe(t.details.isParamSpec?y.Localizer.Diagnostic.paramSpecAssignedName().format({name:V.TypeVarType.getReadableName(t)}):y.Localizer.Diagnostic.typeVarAssignedName().format({name:V.TypeVarType.getReadableName(t)}),e))}switch(t=(0,V.removeUnbound)(t),e.nodeType){case 38:rt(e,t,n,i,s,r,a);break;case 35:at(e,t,n,s,a);break;case 24:{const i=Ae(e.baseExpression,2);It(e,i,{method:"set",setType:t,setErrorNode:s,setExpectedTypeDiag:a},0),fe(e,t,0,n);break}case 31:case 52:!function(e,t,n,s){const i=31===e.nodeType?e.entries:e.expressions,r=new Array(i.length);for(let e=0;e<i.length;e++)r[e]=[];const a=i.findIndex((e=>56===e.nodeType)),o=i.findIndex((e=>56===e.nodeType));t=lt(t);const l=new c.DiagnosticAddendum;(0,U.doForEachSubtype)(t,(t=>{const n=(0,U.getSpecializedTupleType)(t);if(n&&n.tupleTypeArguments){const s=n.tupleTypeArguments.map((e=>(0,U.addConditionToType)(e.type,(0,U.getTypeCondition)(t)))),c=n.tupleTypeArguments.findIndex((e=>e.isUnbounded));if(c>=0)if(s.length>r.length)s.splice(c,1);else if(s.length<r.length){const e=s.length>0?s[c]:V.AnyType.create();for(;s.length<r.length;)s.splice(c,0,e)}if(a>=0)if(s.length>r.length){const t=s.splice(a,s.length-r.length+1);let n=(0,V.combineTypes)(t);31===e.nodeType&&(n=(0,U.stripLiteralValue)(n)),s.splice(a,0,n)}else s.length===r.length-1&&s.splice(a,0,V.NeverType.createNever());if(s.forEach(((e,t)=>{t<r.length&&r[t].push(e)})),s.length!==i.length){const n=o>=0?i.length-1:i.length,r=l.createAddendum();r.addMessage((31===e.nodeType?y.Localizer.DiagnosticAddendum.listAssignmentMismatch():y.Localizer.DiagnosticAddendum.tupleAssignmentMismatch()).format({type:Ps(t)})),r.createAddendum().addMessage(y.Localizer.DiagnosticAddendum.tupleSizeMismatch().format({expected:n,received:s.length}))}}else{const e=je(t,!1,s)||V.UnknownType.create();for(let n=0;n<i.length;n++)r[n].push((0,U.addConditionToType)(e,(0,U.getTypeCondition)(t)))}})),l.isEmpty()||nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,(31===e.nodeType?y.Localizer.Diagnostic.listAssignmentMismatch():y.Localizer.Diagnostic.tupleAssignmentMismatch()).format({type:Ps(t)})+l.getString(),e);i.forEach(((e,t)=>{const i=r[t];pt(e,0===i.length?V.UnknownType.create():(0,V.combineTypes)(i),n,s,!0)})),fe(e,t,0,n)}(e,t,n,s);break;case 54:{const n=ke(e.typeAnnotation,{isVariableAnnotation:!0,allowFinal:D.isFinalAllowedForAssignmentTarget(e.valueExpression),allowClassVar:D.isClassVarAllowedForAssignmentTarget(e.valueExpression)});if(!((0,V.isClassInstance)(n)&&(V.ClassType.isBuiltIn(n,"Final")||V.ClassType.isBuiltIn(n,"ClassVar")))){(0,V.isClassInstance)(n)&&V.ClassType.isBuiltIn(n,"TypeAlias")||gs(n,t)&&((0,V.isClassInstance)(t)&&V.ClassType.isEnumClass(t)||(t=Cs(n,t)))}pt(e.valueExpression,t,!1,s,i,r,a);break}case 56:38===e.expression.nodeType&&rt(e.expression,qn(e.expression,"list",[t]),!1,i,s);break;case 0:e.child&&Hn(e.child,(()=>{Ae(e.child)}));break;default:Xe(y.Localizer.Diagnostic.assignmentTargetExpr(),e)}}function dt(e){switch(e.nodeType){case 38:Ae(e);break;case 35:{const t=Ae(e.leftExpression),n=Tt(e,t,{method:"del"},0);fe(e.memberName,n.type,0,!1),fe(e,n.type,0,!1);break}case 24:{const t=Ae(e.baseExpression,2);It(e,t,{method:"del"},0),fe(e,V.UnboundType.create(),0,!1);break}case 52:e.expressions.forEach((e=>{dt(e)}));break;case 0:e.child&&Hn(e.child,(()=>{Ae(e.child)}));break;default:nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.delTargetExpr(),e);break}}function ut(e,t,n){r.isSpeculative(n)||e.accessedSymbolMap.set(t.id,!0)}function mt(e,t,n,s){const i=(0,U.lookUpObjectMember)(e,t,8);if(!i)return;const r=ls(i);if((0,V.isAnyOrUnknown)(r))return r;if((0,V.isFunction)(r)){const t=Fs(s||e,r,i&&(0,V.isInstantiableClass)(i.classType)?i.classType:void 0,n,void 0,!1,s);if(t)return rs(t)}}function yt(e,t,n){var s;if(V.TypeBase.isInstantiable(t)&&!(0,U.isTypeAliasPlaceholder)(t)){const i=function(e,t){var n;let s=e,i=0;(0,l.assert)(V.TypeBase.isInstantiable(t));for(;s&&(s=D.getTypeVarScopeNode(s,35===(null===(n=e.parent)||void 0===n?void 0:n.nodeType)),s);){let e;if(10===s.nodeType){const t=fn(s);t&&(e=t.classType.details.typeParameters),i++}else if(28===s.nodeType){const t=_n(s);t&&(e=[],t.functionType.details.parameters.forEach((t=>{t.hasDeclaredType&&(0,U.addTypeVarsToListIfUnique)(e,(0,U.getTypeVarArgumentsRecursive)(t.type))})),t.functionType.details.declaredReturnType&&(0,U.addTypeVarsToListIfUnique)(e,(0,U.getTypeVarArgumentsRecursive)(t.functionType.details.declaredReturnType)))}else if(36===s.nodeType)break;if(e){const n=e.find((e=>e.details.name===t.details.name));if(n&&n.scopeId)return{type:i>1?t:(0,U.convertToInstantiable)(n),foundInterveningClass:i>1}}s=s.parent}s=e;for(;s;){if(3===s.nodeType){const e=ge(s.leftExpression,0);if(e&&(0,V.isTypeVar)(e)&&e.details.recursiveTypeAliasScopeId&&e.details.recursiveTypeAliasName)return{type:V.TypeVarType.cloneForScopeId(t,e.details.recursiveTypeAliasScopeId,e.details.recursiveTypeAliasName,2),foundInterveningClass:!1}}s=s.parent}return{type:t,foundInterveningClass:!1}}(e,t);if(t=i.type,0!=(2048&n)&&void 0!==t.scopeId)t.details.isSynthesized||t.details.isParamSpec||nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeVarUsedByOuterScope().format({name:t.details.name}),e);else if(0!=(8192&n)){if(void 0===t.scopeId)if(i.foundInterveningClass)nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeVarUsedByOuterScope().format({name:t.details.name}),e);else{let n=D.getEnclosingClassOrFunction(e);if(n&&35===(null===(s=e.parent)||void 0===s?void 0:s.nodeType)&&e.parent.leftExpression===e){const s=e.parent.memberName.value;if("args"===s||"kwargs"===s){const s=D.getEnclosingClassOrFunction(n);28===(null==s?void 0:s.nodeType)?n=s:i.type.scopeId||nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.paramSpecNotUsedByOuterScope().format({name:t.details.name}),e)}}n?t=V.TypeVarType.cloneForScopeId(t,gt(n),n.name.value,28===n.nodeType?1:0):(0,l.fail)("AssociateTypeVarsWithCurrentScope flag was set but enclosing scope not found")}}else if(0!=(4096&n)&&(void 0===t.scopeId||i.foundInterveningClass)&&!t.details.isSynthesized){const n=(0,V.isParamSpec)(t)?y.Localizer.Diagnostic.paramSpecNotUsedByOuterScope():y.Localizer.Diagnostic.typeVarNotUsedByOuterScope();nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,n.format({name:t.details.name}),e)}}return t.isVariadicUnpacked&&(t=V.TypeVarType.cloneForPacked(t)),t}function ht(e,t,n){return 0==(2&n)&&((0,V.isInstantiableClass)(t)&&(0!=(64&n)&&(0,U.requiresTypeArguments)(t)&&!t.typeArguments&&nt(_.getFileInfo(e).diagnosticRuleSet.reportMissingTypeArgument,p.DiagnosticRule.reportMissingTypeArgument,y.Localizer.Diagnostic.typeArgsMissingForClass().format({name:t.aliasName||t.details.name}),e),t.typeArguments||(t=Bn(t,void 0,n,e))),0!=(64&n)&&t.typeAliasInfo&&t.typeAliasInfo.typeParameters&&t.typeAliasInfo.typeParameters.length>0&&!t.typeAliasInfo.typeArguments&&(nt(_.getFileInfo(e).diagnosticRuleSet.reportMissingTypeArgument,p.DiagnosticRule.reportMissingTypeArgument,y.Localizer.Diagnostic.typeArgsMissingForAlias().format({name:t.typeAliasInfo.name}),e),t=V.TypeBase.cloneForTypeAlias((0,U.applySolvedTypeVars)(t,new z.TypeVarContext(t.typeAliasInfo.typeVarScopeId),!0),t.typeAliasInfo.name,t.typeAliasInfo.fullName,t.typeAliasInfo.typeVarScopeId,t.typeAliasInfo.typeParameters,t.typeAliasInfo.typeParameters.map((e=>V.UnknownType.create()))))),t}function gt(e){let t="";(10===e.nodeType||28===e.nodeType)&&(t=e.name.value);return`${_.getFileInfo(e).filePath}.${e.start.toString()}-${t}`}function ft(e){const t=[];let n=e;for(;n&&(n=D.getTypeVarScopeNode(n),n);)t.push(gt(n)),n=n.parent;return t}function Tt(e,n,s,i){var r;let a=n.type;const o=e.memberName.value;let l=new c.DiagnosticAddendum;const d=_.getFileInfo(e);let m,h,g=!!n.isIncomplete;if(n.isIncomplete&&(0,V.isUnbound)(n.type))return{type:V.UnknownType.create(!0),node:e,isIncomplete:!0};(0,V.isUnion)(a)&&V.TypeBase.isSpecialForm(a)&&Q&&(a=Q);const f=()=>{if(Y&&(0,V.isInstantiableClass)(Y)){return Le(e.memberName,Y,o,s,l,void 0,n.bindToType)}};switch((0,V.isParamSpec)(a)&&a.paramSpecAccess&&(a=lt(a)),a.category){case 2:case 1:m=a;break;case 4:m=V.UnknownType.create();break;case 10:if(a.details.isParamSpec){if("args"===o){const t=D.getEnclosingParameter(e);return t&&1===t.category?{type:V.TypeVarType.cloneForParamSpecAccess(a,"args"),node:e,isIncomplete:g}:(Xe(y.Localizer.Diagnostic.paramSpecArgsUsage(),e),{type:V.UnknownType.create(g),node:e,isIncomplete:g})}if("kwargs"===o){const t=D.getEnclosingParameter(e);return t&&2===t.category?{type:V.TypeVarType.cloneForParamSpecAccess(a,"kwargs"),node:e,isIncomplete:g}:(Xe(y.Localizer.Diagnostic.paramSpecKwargsUsage(),e),{type:V.UnknownType.create(g),node:e,isIncomplete:g})}return g||nt(d.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.paramSpecUnknownMember().format({name:o}),e),{type:V.UnknownType.create(g),node:e,isIncomplete:g}}return 64&i?(g||nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeVarNoMember().format({type:Ps(a),name:o}),e.leftExpression),{type:V.UnknownType.create(g),node:e,isIncomplete:g}):a.details.recursiveTypeAliasName?{type:V.UnknownType.create(!0),node:e,isIncomplete:!0}:Tt(e,{type:lt(a),node:e,bindToType:a,isIncomplete:g},s,0);case 7:if(V.TypeBase.isInstantiable(a)){const t=Ve(e.memberName,a,o,s,l,0,n.bindToType);m=null==t?void 0:t.type,(null==t?void 0:t.isIncomplete)&&(g=!0),(null==t?void 0:t.isAsymmetricDescriptor)&&(h=!0)}else if(V.ClassType.isBuiltIn(a,"type")&&Q&&(0,V.isClassInstance)(Q)&&!n.isSuperCall){const t=Ve(e.memberName,V.ClassType.cloneAsInstantiable(Q),o,s,l,0,n.bindToType?(0,U.convertToInstance)(n.bindToType):void 0);m=null==t?void 0:t.type,(null==t?void 0:t.isIncomplete)&&(g=!0),(null==t?void 0:t.isAsymmetricDescriptor)&&(h=!0)}else{if(V.ClassType.isBuiltIn(a,"LiteralString")&&ne&&(0,V.isInstantiableClass)(ne)&&(a=V.ClassType.cloneAsInstance(ne)),V.ClassType.isEnumClass(a)){const t=a.literalValue;if(t instanceof V.EnumLiteral)if("name"===o||"_name_"===o){const n=$n(e,"str");if((0,V.isInstantiableClass)(n))return{node:e,type:V.ClassType.cloneAsInstance(V.ClassType.cloneWithLiteral(n,t.itemName)),isIncomplete:g}}else if("value"===o||"_value_"===o)return{node:e,type:t.itemType,isIncomplete:g}}const t=Le(e.memberName,a,o,s,l,void 0,n.bindToType);t&&(m=(0,U.addConditionToType)(t.type,(0,U.getTypeCondition)(a))),(null==t?void 0:t.isIncomplete)&&(g=!0),(null==t?void 0:t.isAsymmetricDescriptor)&&(h=!0)}break;case 8:{const n=V.ModuleType.getField(a,o);if(n&&!n.isExternallyHidden())"get"===s.method&&ut(_.getFileInfo(e),n,e.memberName),m=ns(n,void 0,!0).type,(0,V.isTypeVar)(m)&&(m=yt(e,m,i)),(0,V.isUnbound)(m)&&(m=V.UnknownType.create(!0)),n.isPrivateMember()&&nt(_.getFileInfo(e).diagnosticRuleSet.reportPrivateUsage,p.DiagnosticRule.reportPrivateUsage,y.Localizer.Diagnostic.privateUsedOutsideOfModule().format({name:o}),e.memberName),n.isPrivatePyTypedImport()&&nt(_.getFileInfo(e).diagnosticRuleSet.reportPrivateImportUsage,p.DiagnosticRule.reportPrivateImportUsage,y.Localizer.Diagnostic.privateImportFromPyTypedModule().format({name:o,module:a.moduleName}),e.memberName);else{if("get"===s.method){const e=V.ModuleType.getField(a,"__getattr__");if(e){if(d.executionEnvironment.pythonVersion>=u.PythonVersion.V3_7||e.getDeclarations().some((e=>e.path.toLowerCase().endsWith(".pyi")))){const t=ns(e);(0,V.isFunction)(t.type)&&(m=rs(t.type),t.isIncomplete&&(g=!0))}}}m||(g||nt(d.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.moduleUnknownMember().format({name:o}),e.memberName),m=t.evaluateUnknownImportsAsAny?V.AnyType.create():V.UnknownType.create())}break}case 9:m=(0,U.mapSubtypes)(a,(t=>{if((0,V.isNoneInstance)(t)){const t=f();return t?(m=(0,U.addConditionToType)(t.type,(0,U.getTypeCondition)(a)),t.isIncomplete&&(g=!0),m):void(g||nt(_.getFileInfo(e).diagnosticRuleSet.reportOptionalMemberAccess,p.DiagnosticRule.reportOptionalMemberAccess,y.Localizer.Diagnostic.noneUnknownMember().format({name:o}),e.memberName))}if(!(0,V.isUnbound)(t)){const i=Tt(e,{type:t,node:e,isIncomplete:n.isIncomplete},s,0);return i.isIncomplete&&(g=!0),i.type}}));break;case 5:case 6:if("__defaults__"===o)m=V.AnyType.create();else if("__self__"===o){const e=(0,V.isFunction)(a)?a:a.overloads[0];void 0!==e.preBoundFlags&&0==(4&e.preBoundFlags)&&(m=e.boundToType)}else m=X?Tt(e,{type:X,node:e},s,i).type:V.AnyType.create();break;case 3:{const e=f();e&&(m=(0,U.addConditionToType)(e.type,(0,U.getTypeCondition)(a)),e.isIncomplete&&(g=!0));break}default:l.addMessage(y.Localizer.DiagnosticAddendum.typeUnsupported().format({type:Ps(a)}))}if(!m){const t=(0,V.isFunction)(a)||(0,V.isOverloadedFunction)(a)||(0,V.isClassInstance)(a)&&V.ClassType.isBuiltIn(a,"function");if(!n.isIncomplete){let n=y.Localizer.Diagnostic.memberAccess();"set"===s.method?n=y.Localizer.Diagnostic.memberSet():"del"===s.method&&(n=y.Localizer.Diagnostic.memberDelete()),s.setExpectedTypeDiag&&(l=s.setExpectedTypeDiag);const[i,r]=t?[d.diagnosticRuleSet.reportFunctionMemberAccess,p.DiagnosticRule.reportFunctionMemberAccess]:[d.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues];nt(i,r,n.format({name:o,type:Ps(a)})+l.getString(),e.memberName)}m=t?V.AnyType.create():V.UnknownType.create()}if(0==(2&i)&&(0,V.isInstantiableClass)(m)&&!m.typeArguments&&(m=Bn(m,void 0,i,e)),"get"===s.method){let t=g;if((0,V.isInstantiableClass)(m)){const n=D.getParentNodeOfType(e,1);n&&9===(null===(r=null==n?void 0:n.parent)||void 0===r?void 0:r.nodeType)&&(t=!0)}t||rn(d.diagnosticRuleSet.reportUnknownMemberType,p.DiagnosticRule.reportUnknownMemberType,e.memberName,m,e,!1)}return{type:m,node:e,isIncomplete:g,isAsymmetricDescriptor:h}}function _t(e,t,n,s,i,r,a){var o;let c=0;1&r&&(c|=8),2&r&&(c|=2),4&r&&(c|=4),256&r&&(c|=32),128&r&&(c|=1);let p=(0,U.lookUpClassMember)(t,n,16|c);if(p||(p=(0,U.lookUpClassMember)(t,n,c)),p){let l,c=!1;if(p.symbol.isInitVar())return void(i&&i.addMessage(y.Localizer.DiagnosticAddendum.memberIsInitVar().format({name:n})));if("get"!==s.method){const n=D.getEnclosingClass(e);if(n){const e=null===(o=fn(n))||void 0===o?void 0:o.classType;e&&(0,V.isInstantiableClass)(e)&&V.ClassType.isSameGenericClass(e,t)&&(l=ss(p.symbol)||V.UnknownType.create(),l&&(0,V.isInstantiableClass)(p.classType)&&(l=(0,U.partiallySpecializeType)(l,p.classType)))}}if(!l){const n=function(e,t,n){if((0,V.isInstantiableClass)(t.classType)){const s=ns(t.symbol);if(s)return is(s.type),{node:e,type:(0,U.partiallySpecializeType)(s.type,t.classType,n),isIncomplete:!!s.isIncomplete}}return}(e,p,a?void 0:t);n?(l=n.type,n.isIncomplete&&(c=!0)):l=V.UnknownType.create()}if(V.ClassType.isTypedDictClass(t)){const e=p.symbol.getTypedDeclarations();if(e.length>0&&1===e[0].type)return void(i&&i.addMessage(y.Localizer.DiagnosticAddendum.memberUnknown().format({name:n})))}"get"===s.method&&(0,V.isInstantiableClass)(p.classType)&&V.ClassType.isSameGenericClass(p.classType,t)&&ut(_.getFileInfo(e),p.symbol,e);const d=function(e,t,n,s,i,r,a,o,l,c){const p=0!=(16&r);let d=!0,u=!1;if(e=(0,U.mapSubtypes)(e,(e=>{var m;const h=lt(e);if((0,V.isClass)(h)){let e=h,p=!1;if(V.TypeBase.isInstantiable(h)&&(h.details.effectiveMetaclass&&(0,V.isInstantiableClass)(h.details.effectiveMetaclass)&&(i||"get"===l.method)?(e=(0,U.convertToInstance)(h.details.effectiveMetaclass),p=!0):e=void 0),e){let g;g="get"===l.method?"__get__":"set"===l.method?"__set__":"__delete__";const f=(0,U.lookUpClassMember)(e,g,8);if(V.ClassType.isPropertyClass(e))if("set"===l.method){if(!f)return c&&c.addMessage(y.Localizer.DiagnosticAddendum.propertyMissingSetter().format({name:o})),void(d=!1)}else if("del"===l.method&&!f)return c&&c.addMessage(y.Localizer.DiagnosticAddendum.propertyMissingDeleter().format({name:o})),void(d=!1);if(f){let o=ls(f);const T=[{argumentCategory:0,type:V.ClassType.isClassProperty(e)?n:i?s||V.ClassType.cloneAsInstance(n):V.NoneType.createInstance()}];if("get"===l.method?T.push({argumentCategory:0,type:n}):"set"===l.method&&T.push({argumentCategory:0,type:null!==(m=l.setType)&&void 0!==m?m:V.UnknownType.create()}),V.ClassType.isPropertyClass(e)&&t&&(0,V.isInstantiableClass)(t.classType)&&(is(o),o=(0,U.partiallySpecializeType)(o,t.classType),0!=(1&r)&&V.ClassType.isProtocolClass(n)&&(c&&c.addMessage(y.Localizer.DiagnosticAddendum.propertyAccessFromProtocolClass()),d=!1)),o&&((0,V.isFunction)(o)||(0,V.isOverloadedFunction)(o))){const n=o,s=Hn(a,(()=>{var s;let i;V.ClassType.isPropertyClass(h)&&!p?t&&(0,V.isInstantiableClass)(t.classType)&&(i=t.classType):(0,V.isInstantiableClass)(f.classType)&&(i=f.classType);const r=Fs(e,n,i,a,void 0,void 0,p?h:void 0);if(r&&((0,V.isFunction)(r)||(0,V.isOverloadedFunction)(r))){const e=new z.TypeVarContext((0,U.getTypeVarScopeId)(r));i&&e.addSolveForScope((0,U.getTypeVarScopeId)(i));const t=Vt(a,T,{type:r},e,!0);if(t.argumentErrors){if("set"===l.method)if(l.setType&&(0,V.isFunction)(r)&&r.details.parameters.length>=2){const e=V.FunctionType.getEffectiveParameterType(r,1);null==c||c.addMessage(y.Localizer.DiagnosticAddendum.typeIncompatible().format({destType:Ps(e),sourceType:Ps(l.setType)}))}else(0,V.isOverloadedFunction)(r)&&(null==c||c.addMessage(y.Localizer.Diagnostic.noOverload().format({name:g})));return d=!1,V.AnyType.create()}return"get"===l.method?null!==(s=t.returnType)&&void 0!==s?s:V.UnknownType.create():V.AnyType.create()}}));if("set"===l.method&&(0,V.isClass)(f.classType)&&function(e){var t;if(void 0!==e.isAsymmetricDescriptor)return e.isAsymmetricDescriptor;let n=!1;const s=(0,U.lookUpClassMember)(e,"__get__",2),i=(0,U.lookUpClassMember)(e,"__set__",2);if(s&&i){const e=ts(s.symbol),r=ts(i.symbol);if((0,V.isFunction)(e)&&(0,V.isFunction)(r)&&r.details.parameters.length>=3&&e.details.declaredReturnType){const s=V.FunctionType.getEffectiveParameterType(r,2),i=null!==(t=V.FunctionType.getSpecializedReturnType(e))&&void 0!==t?t:V.UnknownType.create();(0,V.isTypeSame)(s,i)||(n=!0)}}else n=!1;return e.isAsymmetricDescriptor=n,n}(f.classType)&&(u=!0),s)return s}}}}else if(((0,V.isFunction)(h)||(0,V.isOverloadedFunction)(h))&&(!i||t&&!t.isInstanceMember))return Fs(i?V.ClassType.cloneAsInstance(n):n,h,t&&(0,V.isInstantiableClass)(t.classType)?t.classType:void 0,a,void 0,p,s);if("set"===l.method){if((null==t?void 0:t.symbol.isClassVar())&&8&r)return c&&c.addMessage(y.Localizer.DiagnosticAddendum.memberSetClassVar().format({name:o})),void(d=!1);const e=null==t?void 0:t.symbol.getDeclarations().find((e=>(0,S.isFinalVariableDeclaration)(e)));if(e&&!D.isNodeContainedWithin(a,e.node)){const e=D.getEnclosingFunction(a);if(!e||"__init__"!==e.name.value)return c&&c.addMessage(y.Localizer.Diagnostic.finalReassigned().format({name:o})),void(d=!1)}if((null==t?void 0:t.isInstanceMember)&&(0,V.isClass)(t.classType)&&V.ClassType.isReadOnlyInstanceVariables(t.classType))return c&&c.addMessage(y.Localizer.DiagnosticAddendum.readOnlyAttribute().format({name:o})),void(d=!1);let n=!1;if((t&&t.symbol.hasTypedDeclarations()||t&&!t.symbol.getDeclarations().some((e=>e.node===a)))&&(n=!0),n){let e=h;return i&&!t.isInstanceMember&&(0,V.isFunction)(h)&&(V.FunctionType.isClassMethod(h)||V.FunctionType.isInstanceMethod(h))&&(e=V.FunctionType.clone(h,!0)),e}}return e})),!d)return;return{type:e,isAsymmetricDescriptor:u}}(l,p,t,a,0==(1&r),r,e,n,s,i);if(!d)return;if(l=d.type,"set"===s.method&&s.setType){if(!gs(l,s.setType,null==i?void 0:i.createAddendum()))return void(i&&i.addMessage(y.Localizer.DiagnosticAddendum.memberAssignment().format({type:Ps(s.setType),name:n,classType:Ds(t)})));if((0,V.isInstantiableClass)(p.classType)&&V.ClassType.isFrozenDataClass(p.classType)&&0==(1&r))return void(i&&i.addMessage(y.Localizer.DiagnosticAddendum.dataClassFrozen().format({name:Ps(V.ClassType.cloneAsInstance(p.classType))})))}return{symbol:p.symbol,type:l,isTypeIncomplete:c,isClassMember:!p.isInstanceMember,isClassVar:p.isClassVar,classType:p.classType,isAsymmetricDescriptor:d.isAsymmetricDescriptor}}if(0==(65&r)){const i=function(e,t,n,s){var i,r,a,o;if("get"===n.method){let n=null===(i=Ve(t,e,"__getattribute__",{method:"get"},void 0,68))||void 0===i?void 0:i.type;if(n||(n=null===(r=Ve(t,e,"__getattr__",{method:"get"},void 0,68))||void 0===r?void 0:r.type),n&&(0,V.isOverloadedFunction)(n)){let e=V.AnyType.create();ne&&(0,V.isInstantiableClass)(ne)&&(e=V.ClassType.cloneWithLiteral(V.ClassType.cloneAsInstance(ne),s)),n=kt(t,n,[{argumentCategory:0,type:V.AnyType.create()},{argumentCategory:0,type:e}])}if(n&&(0,V.isFunction)(n))return rs(n)}else if("set"===n.method){if(null===(a=Ve(t,e,"__setattr__",{method:"get"},void 0,68))||void 0===a?void 0:a.type)return V.AnyType.create()}else{(0,l.assert)("del"===n.method);if(null===(o=Ve(t,e,"__detattr__",{method:"get"},void 0,68))||void 0===o?void 0:o.type)return V.AnyType.create()}return}(t,e,s,n);if(i)return{symbol:void 0,type:i,isTypeIncomplete:!1,isClassMember:!1,isClassVar:!1,isAsymmetricDescriptor:!1}}i&&i.addMessage(y.Localizer.DiagnosticAddendum.memberUnknown().format({name:n}))}function vt(e,t,n){const s=t.findIndex((e=>(0,V.isVariadicTypeVar)(e)));if(s>=0&&ee&&(0,V.isInstantiableClass)(ee))if(s<e.length){const n=e.slice(s,s+1+e.length-t.length);if(1===n.length&&(0,V.isVariadicTypeVar)(n[0].type))bt(n[0].type,n[0].node);else{n.forEach(((e,t)=>{ln(e,{allowEmptyTuple:0===t,allowVariadicTypeVar:!0,allowUnpackedTuples:!0})}));const i=[];1===n.length&&n[0].isEmptyTupleShorthand||n.forEach((e=>{(0,V.isUnpackedClass)(e.type)&&e.type.tupleTypeArguments?(0,o.appendArray)(i,e.type.tupleTypeArguments):i.push({type:(0,U.convertToInstance)(e.type),isUnbounded:!1})}));const r=(0,U.convertToInstance)((0,U.specializeTupleClass)(ee,i,!0,!0,!0));e=[...e.slice(0,s),{node:e[s].node,type:r},...e.slice(s+1+e.length-t.length,e.length)]}}else e.push({node:n,type:(0,U.convertToInstance)((0,U.specializeTupleClass)(ee,[],!0,!0,!0))});return e}function bt(e,t){return!!e.isVariadicUnpacked||(Xe(y.Localizer.Diagnostic.unpackedTypeVarTupleExpected().format({name1:e.details.name,name2:e.details.name}),t),!1)}function It(e,t,n,s){const i=function(e,t,n){var s,i;if(!(null===(s=t.typeAliasInfo)||void 0===s?void 0:s.typeParameters)||0===t.typeAliasInfo.typeParameters.length&&t.typeAliasInfo.typeArguments)return;if(!V.TypeBase.isInstantiable(t))return;if(t.typeAliasInfo.typeArguments)return;const r=t.typeAliasInfo.typeParameters;let a=vt(xt(e,n),r,e);1===r.length&&r[0].details.isParamSpec&&a&&a.every((e=>!(0,U.isEllipsisType)(e.type)&&!e.typeList&&!(0,V.isParamSpec)(e.type)))&&(a=[{type:V.UnknownType.create(),node:a[0].node,typeList:a}]),a.length>r.length&&!r.some((e=>e.details.isVariadic))&&Xe(y.Localizer.Diagnostic.typeArgsTooMany().format({name:Ps(t),expected:r.length,received:a.length}),a[r.length].node);const o=new z.TypeVarContext(t.typeAliasInfo.typeVarScopeId),l=new c.DiagnosticAddendum;r.forEach(((e,t)=>{if(e.details.isParamSpec&&t<a.length){const n=a[t].type;if(a[t].typeList){const n=V.FunctionType.createInstantiable(65536);V.TypeBase.setSpecialForm(n),a[t].typeList.forEach(((e,t)=>{V.FunctionType.addParameter(n,{category:0,name:`__p${t}`,isNameSynthesized:!0,type:(0,U.convertToInstance)(e.type),hasDeclaredType:!0})})),hs(e,n,l,o)}else if((0,V.isParamSpec)(n))hs(e,(0,U.convertToInstance)(n),l,o);else if((0,V.isInstantiableClass)(n)&&V.ClassType.isBuiltIn(n,"Concatenate")){const t=n.typeArguments,s=V.FunctionType.createInstance("","","",0);t&&t.length>0&&t.forEach(((e,n)=>{n===t.length-1?(V.FunctionType.addParameter(s,{category:0,isNameSynthesized:!1,type:V.UnknownType.create()}),(0,V.isParamSpec)(e)&&(s.details.paramSpec=e)):V.FunctionType.addParameter(s,{category:0,name:`__p${n}`,isNameSynthesized:!0,hasDeclaredType:!0,type:e})})),hs(e,s,l,o)}else if((0,U.isEllipsisType)(n)){const t=V.FunctionType.createInstantiable(98304);V.TypeBase.setSpecialForm(t),V.FunctionType.addDefaultParameters(t),hs(e,t,l,o)}else Xe(y.Localizer.Diagnostic.typeArgListExpected(),a[t].node)}else t<a.length&&a[t].typeList&&Xe(y.Localizer.Diagnostic.typeArgListNotAllowed(),a[t].node),hs(e,t<a.length?(0,U.convertToInstance)(a[t].type):V.UnknownType.create(),l,o)})),l.isEmpty()||Xe(y.Localizer.Diagnostic.typeNotSpecializable().format({type:Ps(t)})+l.getString(),e);const p=[];return null===(i=t.typeAliasInfo.typeParameters)||void 0===i||i.forEach((e=>{let t;if((0,V.isParamSpec)(e)){const n=o.getParamSpec(e);t=n?(0,U.convertParamSpecValueToType)(n):V.UnknownType.create()}else t=o.getTypeVarType(e);p.push(t||V.UnknownType.create())})),{type:V.TypeBase.cloneForTypeAlias((0,U.applySolvedTypeVars)(t,o),t.typeAliasInfo.name,t.typeAliasInfo.fullName,t.typeAliasInfo.typeVarScopeId,t.typeAliasInfo.typeParameters,p),node:e}}(e,t.type,s);if(i)return i;if((0,U.isTypeAliasPlaceholder)(t.type)){const n=xt(e,s).map((e=>(0,U.convertToInstance)(e.type)));return{type:V.TypeBase.cloneForTypeAlias(t.type,t.type.details.recursiveTypeAliasName,"",t.type.details.recursiveTypeAliasScopeId,void 0,n),node:e}}let r=!1;const a=ct(t.type,void 0,((t,i)=>{var a;if((0,V.isAnyOrUnknown)(t))return t;if(64&s&&(0,V.isTypeVar)(i))return nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeVarNotSubscriptable().format({type:Ps(i)}),e.baseExpression),xt(e,s,!1,!1),V.UnknownType.create();if((0,V.isInstantiableClass)(t)){if(t.details.effectiveMetaclass&&(0,V.isInstantiableClass)(t.details.effectiveMetaclass)&&!V.ClassType.isBuiltIn(t.details.effectiveMetaclass,"type")){if(Ve(e,t,St(n),void 0,void 0,96))return Ft(e,t,n).type}if("set"===n.method?nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.genericClassAssigned(),e.baseExpression):"del"===n.method&&nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.genericClassDeleted(),e.baseExpression),V.ClassType.isSpecialBuiltIn(t,"Literal"))return function(e,t){if(0===e.items.length)return Xe(y.Localizer.Diagnostic.literalEmptyArgs(),e.baseExpression),V.UnknownType.create();const n=[];for(const t of e.items){let s;const i=t.valueExpression;if(0!==t.argumentCategory)Xe(y.Localizer.Diagnostic.unpackedArgInTypeArgument(),i),s=V.UnknownType.create();else if(t.name)Xe(y.Localizer.Diagnostic.keywordArgInTypeArgument(),i),s=V.UnknownType.create();else if(48===i.nodeType){const t=0!=(32&i.strings[0].token.flags),n=i.strings.map((e=>e.value)).join("");s=pn(e,t?"bytes":"str",n)}else 40===i.nodeType?!i.isImaginary&&i.isInteger&&(s=pn(e,"int",i.value)):11===i.nodeType?33===i.constType?s=pn(e,"bool",!0):15===i.constType?s=pn(e,"bool",!1):26===i.constType&&(s=V.NoneType.createType()):55===i.nodeType&&33===i.operator&&40===i.expression.nodeType&&!i.expression.isImaginary&&i.expression.isInteger&&(s=pn(e,"int",-i.expression.value));if(!s){const e=Ae(i);if((0,V.isClassInstance)(e.type)&&V.ClassType.isEnumClass(e.type)&&void 0!==e.type.literalValue)s=V.ClassType.cloneAsInstantiable(e.type);else{let t=!0;(0,U.doForEachSubtype)(e.type,(e=>{(0,V.isInstantiableClass)(e)&&void 0!==e.literalValue||(t=!1)})),t&&(s=e.type)}}s||(Xe(y.Localizer.Diagnostic.literalUnsupportedType(),t),s=V.UnknownType.create()),n.push(s)}return(0,V.combineTypes)(n)}(e);if(V.ClassType.isBuiltIn(t,"InitVar")){const t=xt(e,s);return 1===t.length?t[0].type:(Xe(y.Localizer.Diagnostic.typeArgsMismatchOne().format({received:t.length}),e.baseExpression),V.UnknownType.create())}if(V.ClassType.isEnumClass(t))return V.ClassType.cloneAsInstance(t);const i=(0,V.isInstantiableClass)(t)&&V.ClassType.isBuiltIn(t,"Annotated"),r=(0,V.isInstantiableClass)(t)&&V.ClassType.hasCustomClassGetItem(t),o=(null===(a=t.details.typeParameters)||void 0===a?void 0:a.length)>0||V.ClassType.isSpecialBuiltIn(t)||V.ClassType.isBuiltIn(t,"type")||V.ClassType.isPartiallyConstructed(t),l=(0,V.isInstantiableClass)(t)&&V.ClassType.isBuiltIn(t,"Final"),c=(0,V.isInstantiableClass)(t)&&V.ClassType.isBuiltIn(t,"ClassVar");let d=xt(e,s,i,r||!o,l,c);return i||(d=vt(d,t.details.typeParameters,e)),r?t:t.typeArguments?(nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.classAlreadySpecialized().format({type:Ps((0,U.convertToInstance)(t),!0)}),e.baseExpression),t):Bn(t,d,s,e)}if((0,V.isClassInstance)(t)){const s=Ft(e,t,n);return s.isIncomplete&&(r=!0),s.type}if((0,V.isNever)(t))return V.UnknownType.create();if((0,V.isNoneInstance)(t))return nt(_.getFileInfo(e).diagnosticRuleSet.reportOptionalSubscript,p.DiagnosticRule.reportOptionalSubscript,y.Localizer.Diagnostic.noneNotSubscriptable(),e.baseExpression),V.UnknownType.create();if(!(0,V.isUnbound)(t)){nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeNotSubscriptable().format({type:Ps(t)}),e.baseExpression)}return V.UnknownType.create()}));return t.isIncomplete||e.items.forEach((e=>{he(e.valueExpression)||Ae(e.valueExpression,4&s)})),{type:a,node:e,isIncomplete:r}}function Ct(e,t=!1){return ee&&(0,V.isInstantiableClass)(ee)?(0,U.convertToInstance)((0,U.specializeTupleClass)(ee,e.map((e=>({type:e,isUnbounded:t}))))):V.UnknownType.create()}function St(e){return"get"===e.method?"__getitem__":"set"===e.method?"__setitem__":((0,l.assert)("del"===e.method),"__delitem__")}function Ft(e,t,n){var s,i,r;if((0,V.isClassInstance)(t)&&V.ClassType.isTypedDictClass(t)){const s=(0,O.getTypeOfIndexedTypedDict)(As,e,t,n);if(s)return s}const a=St(n),o=(0,V.isClassInstance)(t)?null===(s=Le(e,t,a,void 0,void 0,64))||void 0===s?void 0:s.type:null===(i=Ve(e,t,a,void 0,void 0,96))||void 0===i?void 0:i.type;if(!o){return nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.methodNotDefinedOnType().format({name:a,type:Ps(t)}),e.baseExpression),{node:e,type:V.UnknownType.create()}}if(1===e.items.length&&!e.trailingComma&&!e.items[0].name&&0===e.items[0].argumentCategory&&(0,V.isClassInstance)(t)){const n=e.items[0].valueExpression,s=Ae(n).type;if((0,V.isClassInstance)(s)&&V.ClassType.isBuiltIn(s,"int")&&(0,U.isLiteralType)(s)&&"number"==typeof s.literalValue){const n=s.literalValue,i=(0,U.getSpecializedTupleType)(t);if(i&&i.tupleTypeArguments&&!(0,U.isUnboundedTupleClass)(i)){if(n>=0&&n<i.tupleTypeArguments.length)return{node:e,type:i.tupleTypeArguments[n].type};if(n<0&&i.tupleTypeArguments.length+n>=0)return{node:e,type:i.tupleTypeArguments[i.tupleTypeArguments.length+n].type}}}else if((0,V.isClassInstance)(s)&&V.ClassType.isBuiltIn(s,"slice")){const s=(0,U.getSpecializedTupleType)(t);if(s&&s.tupleTypeArguments&&!(0,U.isUnboundedTupleClass)(s)&&46===n.nodeType&&!n.stepValue){const t=(e,t)=>{let n=t;if(e){const t=Ae(e).type;(0,V.isClassInstance)(t)&&V.ClassType.isBuiltIn(t,"int")&&(0,U.isLiteralType)(t)&&"number"==typeof t.literalValue?(n=t.literalValue,n<0&&(n=s.tupleTypeArguments.length+n)):n=-1}return n},i=t(n.startValue,0),r=t(n.endValue,s.tupleTypeArguments.length);if(i>=0&&r>0&&r<=s.tupleTypeArguments.length&&ee&&(0,V.isInstantiableClass)(ee))return{node:e,type:V.ClassType.cloneAsInstance((0,U.specializeTupleClass)(ee,s.tupleTypeArguments.slice(i,r)))}}}}const l=e.items.filter((e=>0===e.argumentCategory&&!e.name)),c=e.items.filter((e=>1===e.argumentCategory)),d=e.items.filter((e=>0===e.argumentCategory&&!!e.name)),u=e.items.filter((e=>2===e.argumentCategory));let m;if(1!==l.length||0!==c.length||e.trailingComma)if(0===l.length&&0===c.length)m=ee&&(0,V.isInstantiableClass)(ee)?(0,U.convertToInstance)((0,U.specializeTupleClass)(ee,[])):V.UnknownType.create();else{const e=[];l.forEach((t=>{e.push(Ae(t.valueExpression).type)})),c.forEach((t=>{const n=je(Ae(t.valueExpression).type,!1,t)||V.UnknownType.create();e.push(n)})),m=Ct(e,c.length>0)}else m=Ae(l[0].valueExpression).type;let h,g=[{argumentCategory:0,type:m}];if("set"===n.method){let e=n.setType||V.AnyType.create();if((0,V.isTypeVar)(e)&&e.details.constraints.length>0){e=lt(e,(0,V.isClassInstance)(t)?t.condition:void 0)}g.push({argumentCategory:0,type:e})}return d.forEach((e=>{g.push({argumentCategory:0,valueExpression:e.valueExpression,node:e,name:e.name})})),u.forEach((e=>{g.push({argumentCategory:2,valueExpression:e.valueExpression,node:e})})),Yn(e,(()=>{if(h=Vt(e,g,{type:o}),h.argumentErrors&&(0,V.isClassInstance)(m)&&0===d.length&&0===u.length){const t=[...g];t[0]={...t[0]};if(Le(e,m,"__index__")){const n=qn(e,"int");(0,V.isClassInstance)(n)&&(t[0].type=n)}h=Vt(e,t,{type:o}),h.argumentErrors||(g=t)}})),h=Vt(e,g,{type:o}),{node:e,type:null!==(r=h.returnType)&&void 0!==r?r:V.UnknownType.create(),isIncomplete:!!h.isTypeIncomplete}}function xt(e,t,n=!1,s=!1,i=!1,r=!1){const a=[];let o=t;i||r?o|=131088:(o&=-1048739,n||(o|=131088),o|=2097152);const l=(e,t)=>{let i;return i=s||n&&t>0?Ae(e,131234):function(e,t){let n,s=1097|t;_.getFileInfo(e).isStubFile&&(s|=4);31===e.nodeType?(n={type:V.UnknownType.create(),typeList:e.entries.map((e=>Ae(e,s))),node:e},_e(e,V.UnknownType.create())):(n=Ae(e,s),(0,V.isClass)(n.type)&&V.ClassType.isBuiltIn(n.type,"Protocol")&&Xe(y.Localizer.Diagnostic.protocolNotAllowedInTypeArgument(),e),0!=(131072&t)&&(0,V.isClass)(n.type)&&V.ClassType.isBuiltIn(n.type,"ClassVar")&&Xe(y.Localizer.Diagnostic.classVarNotAllowed(),e));return n}(e,o),i};return 1===e.items.length&&!e.trailingComma&&!e.items[0].name&&52===e.items[0].valueExpression.nodeType&&e.items[0].valueExpression.expressions.length>0?(e.items[0].valueExpression.expressions.forEach(((e,t)=>{a.push(l(e,t))})),_e(e.items[0].valueExpression,V.UnknownType.create())):e.items.forEach(((e,t)=>{const n=l(e.valueExpression,t);0!==e.argumentCategory&&1===e.argumentCategory&&((0,V.isVariadicTypeVar)(n.type)&&!n.type.isVariadicUnpacked?n.type=V.TypeVarType.cloneForUnpacked(n.type):(0,V.isInstantiableClass)(n.type)&&!n.type.includeSubclasses&&(0,U.isTupleClass)(n.type)&&(n.type=V.ClassType.cloneForUnpacked(n.type))),e.name&&Xe(y.Localizer.Diagnostic.keywordArgInTypeArgument(),e.valueExpression),a.push(n)})),a}function Dt(e,t){if(t=(0,U.transformPossibleRecursiveTypeAlias)(t),!(0,V.isClassInstance)(t))return;if(!ee||!(0,V.isInstantiableClass)(ee))return;let n=[];if((0,U.isTupleClass)(t)&&t.tupleTypeArguments){n=t.tupleTypeArguments.map((e=>(0,U.transformPossibleRecursiveTypeAlias)(e.type)));const s=t.tupleTypeArguments.findIndex((e=>e.isUnbounded));if(s>=0)if(n.length>e.expressions.length)n.splice(s,1);else for(;n.length<e.expressions.length;)n.splice(s,0,n[s])}else{const s=new z.TypeVarContext((0,U.getTypeVarScopeId)(ee));if(!Lt(V.ClassType.cloneAsInstance(ee),t,s,ft(e)))return;const i=(0,U.applySolvedTypeVars)(ee,s);if(!i.typeArguments||1!==i.typeArguments.length)return;const r=(0,U.transformPossibleRecursiveTypeAlias)(i.typeArguments[0]);for(let t=0;t<e.expressions.length;t++)n.push(r)}const s=e.expressions.map(((e,t)=>Ae(e,void 0,t<n.length?n[t]:void 0))),i=n.some((e=>(0,U.isLiteralTypeOrUnion)(e)));return{type:(0,U.convertToInstance)((0,U.specializeTupleClass)(ee,Pt(s),!0,!i)),node:e}}function Pt(e){const t=[];for(const n of e){let e;if(n.unpackedType?e=n.unpackedType:(0,V.isUnpacked)(n.type)&&(e=n.type),e&&(0,V.isClassInstance)(e)&&e.tupleTypeArguments){const n=e.tupleTypeArguments;n?(0,o.appendArray)(t,n):t.push({type:V.UnknownType.create(),isUnbounded:!0})}else t.push({type:n.type,isUnbounded:!!n.unpackedType})}if(t.filter((e=>e.isUnbounded)).length>1){const e=t.findIndex((e=>e.isUnbounded)),n=t.splice(e);t.push({type:(0,V.combineTypes)(n.map((e=>e.type))),isUnbounded:!0})}return t}function At(e,t){let n,s,i,r,a;if(e.arguments.forEach(((e,t)=>{if(0===t)0!==e.argumentCategory||e.name||(n=e.valueExpression);else if(0===e.argumentCategory&&e.name)if("expected_text"===e.name.value){r=e.valueExpression;const t=Ae(e.valueExpression).type;(0,V.isClassInstance)(t)&&V.ClassType.isBuiltIn(t,"str")&&"string"==typeof t.literalValue?a=t.literalValue:Xe(y.Localizer.Diagnostic.revealTypeExpectedTextArg(),e.valueExpression)}else"expected_type"===e.name.value&&(s=e.valueExpression,i=(0,U.convertToInstance)(jn(e).type));else n=void 0})),!n)return Xe(y.Localizer.Diagnostic.revealTypeArgs(),e),{node:e,type:V.UnknownType.create()};const o=Ae(n,void 0,t),l=o.type,c=D.printExpression(n),p=Ps(l,!0);if(void 0!==a&&a!==p&&Xe(y.Localizer.Diagnostic.revealTypeExpectedTextMismatch().format({expected:a,received:p}),null!=r?r:n),i&&!(0,V.isTypeSame)(i,l)){const e=Ps(i);Xe(y.Localizer.Diagnostic.revealTypeExpectedTypeMismatch().format({expected:e,received:p}),null!=s?s:n)}return Je(y.Localizer.DiagnosticAddendum.typeOfSymbol().format({name:c,type:p}),e.arguments[0]),{node:e,type:l,isIncomplete:o.isIncomplete}}function Et(e,t,n,s,i,r){const a=[],o=[];let l=!1;for(let i=0;i<t.length;i++){let c;const p=t[i],d=p.some((e=>void 0!==e));for(let t=0;t<n.length;t++){const i=n[t].overload;let u=n[t];d&&(u={...n[t]},u.argParams=u.argParams.map(((e,t)=>{if(!p[t])return e;const n={...e};return n.argType=p[t],n})));const m=s?s.clone():new z.TypeVarContext((0,U.getTypeVarScopeId)(i));m.addSolveForScope((0,U.getTypeVarScopeId)(i));const y=Yn(e,(()=>zt(e,u,m,!0,r)));if(y.isTypeIncomplete&&(l=!0),!y.argumentErrors&&y.returnType){c=i,o.push({overload:c,matchResults:u,typeVarContext:m}),a.push(y.returnType);break}}if(!c)return{argumentErrors:!0,isTypeIncomplete:l}}if(s)for(let n=0;n<t.length;n++){const t=o[n].overload,i=o[n].matchResults;Yn(e,(()=>(s.addSolveForScope((0,U.getTypeVarScopeId)(t)),s.unlock(),zt(e,i,s,!0,r))))}o[0].typeVarContext.unlock();const c=zt(e,o[0].matchResults,o[0].typeVarContext,i,r);return c.isTypeIncomplete&&(l=!0),{argumentErrors:!1,returnType:(0,V.combineTypes)(a),isTypeIncomplete:l,specializedInitSelfType:c.specializedInitSelfType}}function kt(e,t,n){let s,i=0,r=[];return t.overloads.forEach((t=>{Yn(e,(()=>{if(V.FunctionType.isOverloaded(t)){const s=Ut(e,n,t,i);s.argumentErrors||r.push(s),i++}}))})),r=wt(r),r.forEach(((t,n)=>{void 0===s&&Yn(e,(()=>{const i=Bt(e,t,new z.TypeVarContext((0,U.getTypeVarScopeId)(t.overload)),!0);i&&!i.argumentErrors&&(s=n)}))})),void 0===s?void 0:r[s].overload}function wt(e){return e.sort(((e,t)=>e.relevance!==t.relevance?t.relevance-e.relevance:e.overloadIndex-t.overloadIndex))}function Nt(e,t){let n,s=e.length-1;for(;s>=0&&!t[0][s];)s--;if(s++,s>=e.length)return;for(;s<e.length;){const t=e[s];if((0,V.isUnion)(t)){n=t;break}s++}if(!n)return;const i=[];return t.forEach((e=>{(0,U.doForEachSubtype)(n,(t=>{const n=[...e];n[s]=t,i.push(n)}))})),i}function Mt(e,t,n,s,i){var a;let o,l=!1,c=!1,d=!1,u=!1;const m=e=>(0,V.isFunction)(e)&&V.FunctionType.isSkipConstructorCheck(e),h=null===(a=Le(e,V.ClassType.cloneAsInstance(n),"__init__",{method:"get"},void 0,68))||void 0===a?void 0:a.type;if(h&&!m(h)){if(i&&(o=(0,U.mapSubtypes)(i,(i=>{i=(0,U.transformPossibleRecursiveTypeAlias)(i);const r=new z.TypeVarContext((0,U.getTypeVarScopeId)(n));if(Lt(V.ClassType.cloneAsInstance(n),i,r,ft(e))){let a;if(Yn(e,(()=>{a=Vt(e,t,{type:h},r.clone(),s,V.NoneType.createInstance())})),!(null==a?void 0:a.argumentErrors)){return Vt(e,t,{type:h},r,s,V.NoneType.createInstance()).isTypeIncomplete&&(d=!0),Rt(n,i,r)}}})),(0,V.isNever)(o)&&(o=void 0)),!o){const i=n.typeArguments?(0,U.buildTypeVarContextFromSpecializedClass)(n,!1):new z.TypeVarContext((0,U.getTypeVarScopeId)(n));i.addSolveForScope((0,U.getTypeVarScopeId)(h));const r=Vt(e,t,{type:h},i,s);if(r.argumentErrors)c=!0;else{let e=n;r.specializedInitSelfType&&(0,V.isClassInstance)(r.specializedInitSelfType)&&V.ClassType.isSameGenericClass(r.specializedInitSelfType,n)&&(e=V.ClassType.cloneAsInstantiable(r.specializedInitSelfType)),o=Ot(e,void 0,i),r.isTypeIncomplete&&(d=!0)}}l=!0,s=!0}if(!c){const r=n.details.effectiveMetaclass;let a;if(r&&(0,V.isInstantiableClass)(r)&&!V.ClassType.isSameGenericClass(r,n)&&(a=_t(e,r,"__call__",{method:"get"},void 0,352,n),a&&(u=!0)),a||(a=_t(e,n,"__new__",{method:"get"},void 0,21,n)),a&&!m(a.type)){const r=new z.TypeVarContext((0,U.getTypeVarScopeId)(n));n.typeAliasInfo&&r.addSolveForScope(n.typeAliasInfo.typeVarScopeId),r.addSolveForScope((0,U.getTypeVarScopeId)(a.type));const p=Vt(e,t,a,r,s);if(p.argumentErrors)c=!0;else{let e=p.returnType;p.isTypeIncomplete&&(d=!0),e&&((0,V.isClassInstance)(e)&&V.ClassType.isSameGenericClass(e,n)?((0,U.isPartlyUnknown)(e)||(0,U.requiresSpecialization)(e))&&void 0!==o||((0,V.isClassInstance)(e)&&V.ClassType.isTupleClass(e)&&!e.tupleTypeArguments&&e.typeArguments&&1===e.typeArguments.length&&(e=(0,U.specializeTupleClass)(e,[{type:e.typeArguments[0],isUnbounded:!0}])),o=e):o||(0,V.isUnknown)(e)||(o=e))}o?(0,V.isClassInstance)(o)&&(0,U.isTupleClass)(o)&&!o.tupleTypeArguments&&(o=function(e,t){let n=e;t&&(0,V.isClassInstance)(t)&&(0,U.isTupleClass)(t)&&t.tupleTypeArguments&&(n=(0,U.specializeTupleClass)(e,t.tupleTypeArguments));return n}(o,i)):o=Ot(n,i,r),l=!0}}if(l||t.forEach((e=>{e.valueExpression&&!r.isSpeculative(e.valueExpression)&&Ae(e.valueExpression)})),!l&&t.length>0){if(!(!!n.details.effectiveMetaclass&&(0,V.isInstantiableClass)(n.details.effectiveMetaclass)&&!V.ClassType.isBuiltIn(n.details.effectiveMetaclass))&&!u){nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.constructorNoArgs().format({type:n.aliasName||n.details.name}),e)}}if(!o)if(!i&&n.typeArguments)o=(0,U.convertToInstance)(n);else{const t=new z.TypeVarContext((0,U.getTypeVarScopeId)(n));i&&Lt(V.ClassType.cloneAsInstance(n),i,t,ft(e)),o=Ot(n,i,t)}if(!c){const s=(0,I.applyConstructorTransform)(As,e,t,n,{argumentErrors:c,returnType:o,isTypeIncomplete:d});o=s.returnType,s.isTypeIncomplete&&(d=!0),s.argumentErrors&&(c=!0)}return{argumentErrors:c,returnType:o,isTypeIncomplete:d}}function Rt(e,t,n){const s=(0,U.applySolvedTypeVars)(V.ClassType.cloneAsInstance(e),n);if(gs(t,s))return(0,V.isAny)(t)?t:s}function Ot(e,t,n){if(t){const s=(0,U.mapSubtypes)(t,(t=>Rt(e,t,n)));if(!(0,V.isNever)(s))return s}const s=(0,U.applySolvedTypeVars)(e,n,!0);return V.ClassType.cloneAsInstance(s)}function Lt(e,t,n,s){if((0,V.isAny)(t))return e.details.typeParameters.forEach((e=>{n.setTypeVarType(e,t)})),!0;if(!(0,V.isClass)(t))return!1;const i=t.typeArguments;if(!i)return gs(e,t,void 0,n,1024);if(V.ClassType.isSameGenericClass(t,e)){const s=(0,U.buildTypeVarContextFromSpecializedClass)(t);return s.getTypeVars().forEach((t=>{const i=s.getTypeVarType(t.typeVar);i&&((0,V.isTypeVar)(i)&&i.scopeId===e.details.typeVarScopeId||n.setTypeVarType(t.typeVar,1===t.typeVar.details.variance?void 0:i,2===t.typeVar.details.variance?void 0:i,t.retainLiteral))})),!0}const r=(0,U.getTypeVarScopeId)(t),a=V.ClassType.getTypeParameters(t).map(((e,t)=>{const n=V.TypeVarType.createInstance(`__dest${t}`);return n.details.isSynthesized=!0,n.details.variance=0,n.scopeId=r,n})),o=V.ClassType.cloneForSpecialization(t,a,!0),l=V.ClassType.getTypeParameters(e).map(((e,t)=>{const n=V.TypeVarType.createInstance(`__source${t}`);return n.details.isSynthesized=!0,n.details.synthesizedIndex=t,n.details.isExemptFromBoundCheck=!0,n})),c=V.ClassType.cloneForSpecialization(e,l,!0),p=new z.TypeVarContext(r);if(gs(o,c,void 0,p,1024)){let e=!0;return a.forEach(((t,r)=>{const a=p.getTypeVarType(t);if(a&&(0,V.isTypeVar)(a)&&a.details.isSynthesized&&void 0!==a.details.synthesizedIndex){const o=V.ClassType.getTypeParameters(c)[a.details.synthesizedIndex];if(r<i.length){let a=i[r];s&&(a=(0,U.transformExpectedTypeForConstructor)(a,n,s)),a?n.setTypeVarType(o,1===t.details.variance?void 0:a,2===t.details.variance?void 0:a):e=!1}}})),e}return!1}function Vt(e,t,n,s,i=!1,a,o=0){let u,h=!1,g=!1;if(o>V.maxTypeRecursionCount)return{returnType:V.UnknownType.create(),argumentErrors:!0};if(o++,V.TypeBase.isSpecialForm(n.type)){const t=9===e.nodeType?e.leftExpression:e;return nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeNotCallable().format({expression:D.printExpression(t),type:Ps(n.type,!0)}),t),{returnType:V.UnknownType.create(),argumentErrors:!0}}const f=ct(n.type,void 0,((f,T)=>{var v,b,I,C,S,P;switch(f.category){case 1:case 2:return n.isIncomplete||t.forEach((e=>{e.valueExpression&&!r.isSpeculative(e.valueExpression)&&Wn(e)})),f;case 5:{if("namedtuple"===f.details.builtInName)return nt(_.getFileInfo(e).diagnosticRuleSet.reportUntypedNamedTuple,p.DiagnosticRule.reportUntypedNamedTuple,y.Localizer.Diagnostic.namedTupleNoTypes(),e),(0,x.createNamedTupleType)(As,e,t,!1);let n=s;n||(n=new z.TypeVarContext((0,U.getTypeVarScopeId)(f)),!n.getSolveForScopes()&&V.FunctionType.isConstructorMethod(f)&&n.addSolveForScope(V.WildcardTypeVarScopeId));const r=Wt(e,t,f,n,i,a);if(r.isTypeIncomplete&&(g=!0),r.argumentErrors)h=!0;else{u=r.specializedInitSelfType;const n=(0,F.applyFunctionTransform)(As,e,t,f,{argumentErrors:r.argumentErrors,returnType:null!==(v=r.returnType)&&void 0!==v?v:V.UnknownType.create(g),isTypeIncomplete:g});r.returnType=n.returnType,n.isTypeIncomplete&&(g=!0),n.argumentErrors&&(h=!0)}return r.argumentErrors||"NewType"!==f.details.builtInName?"__import__"===f.details.builtInName?V.AnyType.create():r.returnType:$t(e,t)}case 6:{if("cast"===f.overloads[0].details.builtInName&&2===t.length){const n=jn(t[0]).type,s=Wn(t[1]).type;return(0,V.isInstantiableClass)(n)&&(0,V.isClassInstance)(s)&&(0,V.isTypeSame)(n,V.ClassType.cloneAsInstantiable(s),!0)&&nt(_.getFileInfo(e).diagnosticRuleSet.reportUnnecessaryCast,p.DiagnosticRule.reportUnnecessaryCast,y.Localizer.Diagnostic.unnecessaryCast().format({type:Ps(s)}),e),(0,U.convertToInstance)(n)}const n=function(e,t,n,s,i,r){let a=[],o=[];if(Yn(e,(()=>{let s=0;n.overloads.forEach((n=>{if(V.FunctionType.isOverloaded(n)){const i=Ut(e,t,n,s);i.argumentErrors||a.push(i),s++}})),o=t.map((e=>{if(e.type)return e.type;if(e.valueExpression){const t=e.valueExpression;return Yn(t,(()=>Ae(t).type))}return V.AnyType.create()}))})),a=wt(a),0===a.length){if(!tt(e)){const s=n.overloads[0].details.name||"<anonymous function>",i=new c.DiagnosticAddendum,r=t.map((e=>Ps(Wn(e).type)));i.addMessage(y.Localizer.DiagnosticAddendum.argumentTypes().format({types:r.join(", ")})),nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.noOverload().format({name:s})+i.getString(),e)}return{argumentErrors:!0,isTypeIncomplete:!1}}const l=t=>{const n=a.reduce(((e,t)=>t.overloadIndex>e.overloadIndex?t:e)),i=null!=s?s:new z.TypeVarContext;return i.addSolveForScope((0,U.getTypeVarScopeId)(n.overload)),i.unlock(),zt(e,n,i,t,r)};if(1===a.length)return l(!1);let d=[t.map((e=>{}))],u=!1;for(;;){const t=Et(e,d,a,s,i,r);if(t.isTypeIncomplete&&(u=!0),!t.argumentErrors)return t;if(d=Nt(o,d),!d||d.length>64)break}if(!tt(e)&&!u){const e=l(!0);return e.returnType=V.UnknownType.create(),e}return{argumentErrors:!0,isTypeIncomplete:!1}}(e,t,f,s,i,a);if(n.isTypeIncomplete&&(g=!0),n.argumentErrors)h=!0;else{u=n.specializedInitSelfType;const s=(0,F.applyFunctionTransform)(As,e,t,f,{argumentErrors:n.argumentErrors,returnType:null!==(b=n.returnType)&&void 0!==b?b:V.UnknownType.create(g),isTypeIncomplete:g});n.returnType=s.returnType,s.isTypeIncomplete&&(g=!0),s.argumentErrors&&(h=!0)}return null!==(I=n.returnType)&&void 0!==I?I:V.UnknownType.create()}case 7:if(V.TypeBase.isInstantiable(f)){if(void 0!==f.literalValue)return nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.literalNotCallable(),e),h=!0,V.UnknownType.create();if(V.ClassType.isBuiltIn(f)){const n=f.aliasName||f.details.name;if("type"===n){if(Mt(e,t,f,i,a),1===t.length){const e=Wn(t[0]).type;return(0,U.mapSubtypes)(e,(e=>(0,V.isClassInstance)(e)||(0,V.isTypeVar)(e)&&V.TypeBase.isInstance(e)||(0,V.isNoneInstance)(e)?(0,U.convertToInstantiable)((0,U.stripLiteralValue)(e)):V.AnyType.create()))}return t.length>=2&&function(e,t){const n=_.getFileInfo(e),s=Wn(t[0]).type;if(!(0,V.isClassInstance)(s)||!V.ClassType.isBuiltIn(s,"str"))return;const i=s.literalValue||"_",r=Wn(t[1]).type;if(!(0,V.isClassInstance)(r)||!(0,U.isTupleClass)(r)||void 0===r.tupleTypeArguments)return;const a=V.ClassType.createInstantiable(i,D.getClassFullName(e,n.moduleName,i),n.moduleName,n.filePath,0,D.getTypeSourceId(e),void 0,r.details.effectiveMetaclass);r.tupleTypeArguments.forEach((n=>{const s=lt(n.type);(0,V.isInstantiableClass)(s)||(0,V.isAnyOrUnknown)(s)?a.details.baseClasses.push(s):it(n.type,t[1].valueExpression||e)})),(0,U.computeMroLinearization)(a)||Xe(y.Localizer.Diagnostic.methodOrdering(),e);return a}(e,t)||V.AnyType.create()}if("TypeVar"===n)return function(e,t){var n,s,i;let r,a="";if(0===t.length)return void Xe(y.Localizer.Diagnostic.typeVarFirstArg(),e);const o=t[0];o.valueExpression&&48===o.valueExpression.nodeType?a=o.valueExpression.strings.map((e=>e.value)).join(""):Xe(y.Localizer.Diagnostic.typeVarFirstArg(),o.valueExpression||e);const l=V.TypeVarType.createInstantiable(a,!1);for(let a=1;a<t.length;a++){const o=t[a].name,c=o?o.value:void 0,p=new Map;if(c){if(p.get(c)&&Xe(y.Localizer.Diagnostic.duplicateParam().format({name:c}),t[a].valueExpression||e),"bound"===c)if(l.details.constraints.length>0)Xe(y.Localizer.Diagnostic.typeVarBoundAndConstrained(),t[a].valueExpression||e);else{const s=null!==(n=t[a].type)&&void 0!==n?n:Gn(t[a].valueExpression,void 0,void 0).type;(0,U.requiresSpecialization)(s,!0)&&Xe(y.Localizer.Diagnostic.typeVarGeneric(),t[a].valueExpression||e),l.details.boundType=(0,U.convertToInstance)(s)}else"covariant"===c?t[a].valueExpression&&Gt(t[a].valueExpression)&&(2===l.details.variance?Xe(y.Localizer.Diagnostic.typeVarVariance(),t[a].valueExpression):l.details.variance=1):"contravariant"===c?t[a].valueExpression&&Gt(t[a].valueExpression)&&(1===l.details.variance?Xe(y.Localizer.Diagnostic.typeVarVariance(),t[a].valueExpression):l.details.variance=2):Xe(y.Localizer.Diagnostic.typeVarUnknownParam().format({name:c}),(null===(s=t[a].node)||void 0===s?void 0:s.name)||t[a].valueExpression||e);p.set(c,c)}else if(l.details.boundType)Xe(y.Localizer.Diagnostic.typeVarBoundAndConstrained(),t[a].valueExpression||e);else{const n=null!==(i=t[a].type)&&void 0!==i?i:Gn(t[a].valueExpression,void 0,void 0).type;(0,U.requiresSpecialization)(n,!0)&&Xe(y.Localizer.Diagnostic.typeVarGeneric(),t[a].valueExpression||e),V.TypeVarType.addConstraint(l,(0,U.convertToInstance)(n)),void 0===r&&(r=t[a])}}1===l.details.constraints.length&&r&&nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeVarSingleConstraint(),r.valueExpression||e);return l}(e,t);if("TypeVarTuple"===n)return function(e,t){var n,s;let i="";if(0===t.length)return void Xe(y.Localizer.Diagnostic.typeVarFirstArg(),e);const r=t[0];r.valueExpression&&48===r.valueExpression.nodeType?i=r.valueExpression.strings.map((e=>e.value)).join(""):Xe(y.Localizer.Diagnostic.typeVarFirstArg(),r.valueExpression||e);const a=V.TypeVarType.createInstantiable(i,!1);a.details.isVariadic=!0;for(let i=1;i<t.length;i++)Xe(y.Localizer.Diagnostic.typeVarUnknownParam().format({name:(null===(n=t[i].name)||void 0===n?void 0:n.value)||"?"}),(null===(s=t[i].node)||void 0===s?void 0:s.name)||t[i].valueExpression||e);return a}(e,t);if("ParamSpec"===n)return function(e,t){var n,s;if(0===t.length)return void Xe(y.Localizer.Diagnostic.paramSpecFirstArg(),e);const i=t[0];let r="";i.valueExpression&&48===i.valueExpression.nodeType?r=i.valueExpression.strings.map((e=>e.value)).join(""):Xe(y.Localizer.Diagnostic.paramSpecFirstArg(),i.valueExpression||e);const a=V.TypeVarType.createInstantiable(r,!0);for(let i=1;i<t.length;i++){if(!(null===(n=t[i].name)||void 0===n?void 0:n.value)){Xe(y.Localizer.Diagnostic.paramSpecUnknownArg(),t[i].valueExpression||e);break}Xe(y.Localizer.Diagnostic.paramSpecUnknownParam().format({name:t[i].name.value}),(null===(s=t[i].node)||void 0===s?void 0:s.name)||t[i].valueExpression||e)}return a}(e,t);if("NamedTuple"===n)return(0,x.createNamedTupleType)(As,e,t,!0);if("NewType"===n)return $t(e,t);if("Protocol"===n||"Generic"===n||"Callable"===n||"Concatenate"===n||"Type"===n){return nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeNotIntantiable().format({type:n}),e),V.AnyType.create()}if("Enum"===n||"IntEnum"===n||"StrEnum"===n||"Flag"===n||"IntFlag"===n)return function(e,t,n){const s=_.getFileInfo(e);let i="enum";if(0===n.length)return;{const e=n[0];if(0!==e.argumentCategory||!e.valueExpression||48!==e.valueExpression.nodeType)return;i=e.valueExpression.strings.map((e=>e.value)).join("")}const r=V.ClassType.createInstantiable(i,D.getClassFullName(e,s.moduleName,i),s.moduleName,s.filePath,1048576,D.getTypeSourceId(e),void 0,t.details.effectiveMetaclass);r.details.baseClasses.push(t),(0,U.computeMroLinearization)(r);const a=r.details.fields;if(a.set("__class__",w.Symbol.createWithType(68,r)),n.length<2)return;{const t=n[1];if(0!==t.argumentCategory||!t.valueExpression||48!==t.valueExpression.nodeType)return;t.valueExpression.strings.map((e=>e.value)).join("").split(" ").forEach((n=>{if(n=n.trim()){const s=V.UnknownType.create(),i=w.Symbol.createWithType(4,s),r=t.valueExpression;(0,l.assert)(48===r.nodeType);const o=_.getFileInfo(e),c={type:1,node:r,isRuntimeTypeExpression:!0,path:o.filePath,range:(0,d.convertOffsetsToRange)(r.start,m.TextRange.getEnd(r),o.lines),moduleName:o.moduleName,isInExceptSuite:!1};i.addDeclaration(c),a.set(n,i)}}))}return r}(e,f,t);if("TypedDict"===n)return(0,O.createTypedDictType)(As,e,f,t);if("auto"===n&&0===t.length)return qn(e,"int")}if(V.ClassType.supportsAbstractMethods(f)){const t=Ss(f);if(t.length>0&&!f.includeSubclasses&&!(0,V.isTypeVar)(T)){const n=new c.DiagnosticAddendum,s=2;t.forEach(((e,i)=>{if(i===s)n.addMessage(y.Localizer.DiagnosticAddendum.memberIsAbstractMore().format({count:t.length-s}));else if(i<s&&(0,V.isInstantiableClass)(e.classType)){const t=e.classType.details.name;n.addMessage(y.Localizer.DiagnosticAddendum.memberIsAbstract().format({type:t,name:e.symbolName}))}})),nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.instantiateAbstract().format({type:f.details.name})+n.getString(),e)}}V.ClassType.isProtocolClass(f)&&!f.includeSubclasses&&nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.instantiateProtocol().format({type:f.details.name}),e);const n=Mt(e,t,f,i,a);n.argumentErrors&&(h=!0),n.isTypeIncomplete&&(g=!0);let s=n.returnType;if((0,V.isTypeVar)(T)&&(s=(0,U.convertToInstance)(T)),s&&(0,V.isClassInstance)(s)&&s.details.mro.some((e=>(0,V.isInstantiableClass)(e)&&V.ClassType.isBuiltIn(e,"type")))){let n="__class_"+s.details.name;if(3===t.length){const e=Wn(t[0]).type;(0,V.isClassInstance)(e)&&V.ClassType.isBuiltIn(e,"str")&&"string"==typeof e.literalValue&&(n=e.literalValue)}const i=V.ClassType.createInstantiable(n,"","",_.getFileInfo(e).filePath,0,D.getTypeSourceId(e),V.ClassType.cloneAsInstantiable(s),V.ClassType.cloneAsInstantiable(s));return i.details.baseClasses.push($n(e,"object")),i.details.effectiveMetaclass=f,(0,U.computeMroLinearization)(i),i}return s}{let n=null===(C=Le(e,f,"__call__"))||void 0===C?void 0:C.type;if(n&&((0,V.isFunction)(n)||(0,V.isOverloadedFunction)(n))){n=(0,U.removeParamSpecVariadicsFromSignature)(n);const r=Vt(e,t,{type:n},s,i,a,o);return r.argumentErrors&&(h=!0),(0,V.isTypeVar)(T)&&V.TypeBase.isInstantiable(T)&&(0,V.isClass)(f)&&V.ClassType.isBuiltIn(f,"type")?(0,U.convertToInstance)(T):null!==(S=r.returnType)&&void 0!==S?S:V.UnknownType.create()}return n&&(0,V.isAnyOrUnknown)(n)||nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.objectNotCallable().format({type:Ps(f)}),e),V.UnknownType.create()}case 3:return void nt(_.getFileInfo(e).diagnosticRuleSet.reportOptionalCall,p.DiagnosticRule.reportOptionalCall,y.Localizer.Diagnostic.noneNotCallable(),e);case 10:{f=(0,U.transformPossibleRecursiveTypeAlias)(f);const n=Vt(e,t,{type:f},s,i,a,o);return n.argumentErrors&&(h=!0),null!==(P=n.returnType)&&void 0!==P?P:V.UnknownType.create()}case 8:return void nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.moduleNotCallable(),e)}}));return{argumentErrors:h,returnType:(0,V.isNever)(f)&&!f.isNoReturn?void 0:f,isTypeIncomplete:g,specializedInitSelfType:u}}function Ut(e,t,n,s){var i;const a=(0,U.getParameterListDetails)(n);let o=0,d=!1,u=!1,m=!1,h=!1;const g=new Map;a.params.forEach((e=>{const t=e.param;t.name&&0===t.category&&g.set(t.name,{argsNeeded:0!==t.category||t.hasDefault?0:1,argsReceived:0,isPositionalOnly:e.source===U.ParameterSource.PositionOnly})}));let f=a.positionOnlyParamCount,T=null!==(i=a.firstKeywordOnlyIndex)&&void 0!==i?i:a.params.length;const v=a.argsIndex,b=a.kwargsIndex;let I,C,S=!1;if(void 0!==v&&void 0!==b){(0,l.assert)(a.params[v],"varArgListParamIndex params entry is undefined");const e=a.params[v].param;(0,l.assert)(a.params[b],"varArgDictParamIndex params entry is undefined");const t=a.params[b].param;(0,V.isParamSpec)(e.type)&&"args"===e.type.paramSpecAccess&&(0,V.isParamSpec)(t.type)&&"kwargs"===t.type.paramSpecAccess&&e.type.details.name===t.type.details.name&&(S=!0,e.type.scopeId===n.details.typeVarScopeId||e.type.scopeId===n.details.constructorTypeVarScopeId?(I=[],C=V.TypeVarType.cloneForParamSpecAccess(e.type,void 0)):f=v)}t.some((e=>1===e.argumentCategory))&&t.forEach((e=>{if(e.name){const t=a.params.findIndex((t=>t.param.name===e.name.value&&0===t.param.category));t>=0&&t>=f&&(T<0||t<T)&&(T=t)}})),T<0&&(T=a.params.length);let F=t.findIndex((e=>2===e.argumentCategory||void 0!==e.name));F<0&&(F=t.length);let x,D=[];function P(e,t){e.active&&(x=t)}let A=void 0!==t.find((e=>1===e.argumentCategory)),E=0,k=0;for(;o<F;){if(o<f&&t[o].name){nt(_.getFileInfo(t[o].name).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.argPositional(),t[o].name),u=!0}if(E>=T){A&&1===t[o].argumentCategory||(nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,1===T?y.Localizer.Diagnostic.argPositionalExpectedOne():y.Localizer.Diagnostic.argPositionalExpectedCount().format({expected:T}),t[o].valueExpression||e),u=!0);break}if(E>=a.params.length)break;(0,l.assert)(a.params[E],"paramIndex params entry is undefined");const s=a.params[E].type;if(1===t[o].argumentCategory){if(!t[o].valueExpression)break;const i=1===a.params[E].param.category&&(0,V.isVariadicTypeVar)(s);let r=!1;const l=Wn(t[o]),c=l.type;let f,v=!1;n.details.paramSpec&&E<T&&(nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,1===T?y.Localizer.Diagnostic.argPositionalExpectedOne():y.Localizer.Diagnostic.argPositionalExpectedCount().format({expected:T}),t[o].valueExpression||e),u=!0);const b=(0,U.combineSameSizedTuples)(lt(c),ee);!i&&b&&(0,V.isClassInstance)(b)&&b.tupleTypeArguments&&b.tupleTypeArguments.length>0&&k<b.tupleTypeArguments.length?(f=b.tupleTypeArguments[k].type,A=void 0!==t.find(((e,t)=>t>o&&1===e.argumentCategory)),k++,k>=b.tupleTypeArguments.length&&(k=0,v=!0)):i&&(0,V.isVariadicTypeVar)(c)?(f=c,r=!0,v=!0,h=!0):(0,V.isClassInstance)(c)&&(0,U.isTupleClass)(c)&&c.tupleTypeArguments&&1===c.tupleTypeArguments.length&&(0,V.isVariadicTypeVar)(c.tupleTypeArguments[0].type)?(f=c.tupleTypeArguments[0].type,r=!0,v=!0,h=!0):(0,V.isParamSpec)(c)&&"args"===c.paramSpecAccess?f=void 0:(f=je(c,!1,t[o].valueExpression)||V.UnknownType.create(),1!==a.params[E].param.category&&(d=!0));const C=f?{argumentCategory:0,type:f}:void 0;C&&l.isIncomplete&&(m=!0);const S=a.params[E].param.name;i&&!r?(nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.unpackedArgWithVariadicParam(),t[o].valueExpression||e),u=!0):(I&&I.push(t[o]),C&&D.push({paramCategory:a.params[E].param.category,paramType:s,requiresTypeVarMatching:(0,U.requiresSpecialization)(s),argument:C,errorNode:t[o].valueExpression||e,paramName:S,isParamNameSynthesized:a.params[E].param.isNameSynthesized})),P(t[o],a.params[E].param),S&&0===a.params[E].param.category&&g.has(S)&&g.get(S).argsReceived++,(v||1===a.params[E].param.category)&&o++,(h||1!==a.params[E].param.category)&&E++}else if(1===a.params[E].param.category)if(P(t[o],a.params[E].param),I)I.push(t[o]),o++;else{let n=a.params[E].param.category,i=s;const r=a.params[E].param.name;(0,V.isUnpackedClass)(s)&&s.tupleTypeArguments&&s.tupleTypeArguments.length>0&&(i=s.tupleTypeArguments[0].type),n=(0,V.isVariadicTypeVar)(i)?1:0;const l=F-o,c=T-E-1;l<=c?(l<c&&(nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,1===l?y.Localizer.Diagnostic.argMorePositionalExpectedOne():y.Localizer.Diagnostic.argMorePositionalExpectedCount().format({expected:l}),t[o].valueExpression||e),u=!0),E++):(D.push({paramCategory:n,paramType:i,requiresTypeVarMatching:(0,U.requiresSpecialization)(s),argument:t[o],errorNode:t[o].valueExpression||e,paramName:r,isParamNameSynthesized:a.params[E].param.isNameSynthesized,mapsToVarArgList:!0}),o++)}else{const n=a.params[E].param.name;D.push({paramCategory:a.params[E].param.category,paramType:s,requiresTypeVarMatching:(0,U.requiresSpecialization)(s),argument:t[o],errorNode:t[o].valueExpression||e,paramName:n,isParamNameSynthesized:a.params[E].param.isNameSynthesized}),P(t[o],a.params[E].param),n&&g.has(n)&&g.get(n).argsReceived++,o++,E++}}if(f>=0&&E<f&&(!A||S)){const n=a.params.findIndex((e=>e.param.hasDefault)),s=(n>=0&&n<f?n:f)-F;s>0&&(nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,1===s?y.Localizer.Diagnostic.argMorePositionalExpectedOne():y.Localizer.Diagnostic.argMorePositionalExpectedCount().format({expected:s}),t.length>F&&t[F].valueExpression||e),u=!0)}if(!u){let s;for(;o<t.length;){if(2===t[o].argumentCategory){const i=Wn(t[o]).type;if((0,V.isAnyOrUnknown)(i))s=i;else if((0,V.isClassInstance)(i)&&V.ClassType.isTypedDictClass(i)){const n=(0,O.getTypedDictMembersForClass)(As,i),s=new c.DiagnosticAddendum;n.forEach(((n,i)=>{const r=g.get(i);if(r&&!r.isPositionalOnly)if(r.argsReceived>0)s.addMessage(y.Localizer.Diagnostic.paramAlreadyAssigned().format({name:i}));else{r.argsReceived++;const s=a.params.findIndex((e=>e.param.name===i));(0,l.assert)(s>=0);const c=a.params[s].type;D.push({paramCategory:0,paramType:c,requiresTypeVarMatching:(0,U.requiresSpecialization)(c),argument:{argumentCategory:0,type:n.valueType},errorNode:t[o].valueExpression||e,paramName:i})}else if(void 0!==a.kwargsIndex){const s=a.params[a.kwargsIndex].type;D.push({paramCategory:2,paramType:s,requiresTypeVarMatching:(0,U.requiresSpecialization)(s),argument:{argumentCategory:0,type:n.valueType},errorNode:t[o].valueExpression||e,paramName:i}),g.set(i,{argsNeeded:1,argsReceived:1,isPositionalOnly:!1})}else s.addMessage(y.Localizer.Diagnostic.paramNameMissing().format({name:i}))})),s.isEmpty()||(nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.unpackedTypedDictArgument()+s.getString(),t[o].valueExpression||e),u=!0)}else if((0,V.isParamSpec)(i)&&"kwargs"===i.paramSpecAccess)s=V.AnyType.create(),n.details.paramSpec&&D.push({paramCategory:2,paramType:n.details.paramSpec,requiresTypeVarMatching:!1,argument:t[o],errorNode:t[o].valueExpression||e});else{const n=$e(e,"Mapping"),r=qn(e,"str");if(n&&(0,V.isInstantiableClass)(n)&&r&&(0,V.isClassInstance)(r)){const a=new z.TypeVarContext((0,U.getTypeVarScopeId)(n));let l=!1;if((0,V.isTypeVar)(i))l=!0;else if(gs(V.ClassType.cloneAsInstance(n),i,void 0,a)){const e=(0,U.applySolvedTypeVars)(n,a).typeArguments;e&&e.length>=2?(gs(r,e[0])&&(l=!0),s=e[1]):(l=!0,s=V.UnknownType.create())}l||(nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.unpackedDictArgumentNotMapping(),t[o].valueExpression||e),u=!0)}}I&&I.push(t[o])}else{const s=t[o].name;if(s){const n=s.value,i=g.get(n);if(i&&!i.isPositionalOnly)if(i.argsReceived>0)nt(_.getFileInfo(s).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.paramAlreadyAssigned().format({name:n}),s),u=!0;else{i.argsReceived++;const s=a.params.findIndex((e=>e.param.name===n));(0,l.assert)(s>=0);const r=a.params[s].type;D.push({paramCategory:0,paramType:r,requiresTypeVarMatching:(0,U.requiresSpecialization)(r),argument:t[o],errorNode:t[o].valueExpression||e,paramName:n}),P(t[o],a.params[s].param)}else if(void 0!==a.kwargsIndex){if(I)I.push(t[o]);else{const s=a.params[a.kwargsIndex].type;D.push({paramCategory:2,paramType:s,requiresTypeVarMatching:(0,U.requiresSpecialization)(s),argument:t[o],errorNode:t[o].valueExpression||e,paramName:n}),g.set(n,{argsNeeded:1,argsReceived:1,isPositionalOnly:!1})}(0,l.assert)(a.params[a.kwargsIndex],"paramDetails.kwargsIndex params entry is undefined"),P(t[o],a.params[a.kwargsIndex].param)}else nt(_.getFileInfo(s).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.paramNameMissing().format({name:s.value}),s),u=!0}else if(0===t[o].argumentCategory){nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,1===T?y.Localizer.Diagnostic.argPositionalExpectedOne():y.Localizer.Diagnostic.argPositionalExpectedCount().format({expected:T}),t[o].valueExpression||e),u=!0}else if(1===t[o].argumentCategory&&n.details.paramSpec){const s=Wn(t[o]).type;(0,V.isParamSpec)(s)&&"args"===s.paramSpecAccess&&D.push({paramCategory:1,paramType:n.details.paramSpec,requiresTypeVarMatching:!1,argument:t[o],errorNode:t[o].valueExpression||e})}}o++}if(!s||A&&void 0===a.argsIndex||a.params.forEach(((n,i)=>{var r,o;const l=n.param;if(i>=a.firstPositionOrKeywordIndex&&0===l.category&&l.name&&!l.hasDefault&&g.has(l.name)&&0===g.get(l.name).argsReceived){const n=a.params[i].type;D.push({paramCategory:0,paramType:n,requiresTypeVarMatching:(0,U.requiresSpecialization)(n),argument:{argumentCategory:0,type:s},errorNode:null!==(o=null===(r=t.find((e=>2===e.argumentCategory)))||void 0===r?void 0:r.valueExpression)&&void 0!==o?o:e,paramName:l.name,isParamNameSynthesized:l.isNameSynthesized}),g.get(l.name).argsReceived=1}})),!s&&!V.FunctionType.isDefaultParameterCheckDisabled(n)){const t=[...g.keys()].filter((e=>{const t=g.get(e);return!t||t.argsReceived<t.argsNeeded}));if(t.length>0){const n=t.map((e=>`"${e}"`)).join(", ");nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,1===t.length?y.Localizer.Diagnostic.argMissingForParam().format({name:n}):y.Localizer.Diagnostic.argMissingForParams().format({names:n}),e),u=!0}a.params.forEach((t=>{const n=t.param;if(0===n.category&&n.name){const t=g.get(n.name);0===t.argsNeeded&&0===t.argsReceived&&n.defaultType&&!(0,U.isEllipsisType)(n.defaultType)&&(0,U.requiresSpecialization)(n.type)&&D.push({paramCategory:n.category,paramType:n.type,requiresTypeVarMatching:!0,argument:{argumentCategory:0,type:n.defaultType},errorNode:e,paramName:n.name,isParamNameSynthesized:n.isNameSynthesized})}}))}}if((!u||!r.isSpeculative(void 0))&&void 0!==a.argsIndex&&a.argsIndex>=0&&a.params[a.argsIndex].param.hasDeclaredType&&!h){const t=a.params[a.argsIndex].type,n=D.filter((e=>e.mapsToVarArgList));if((0,V.isTypeVar)(t)&&t.details.isVariadic&&ee&&(0,V.isInstantiableClass)(ee)){const s=n.map((t=>{var n;const s=Wn(t.argument).type;return((0,V.isUnpackedVariadicTypeVar)(s)||(0,V.isClassInstance)(s)&&(0,U.isTupleClass)(s)&&s.tupleTypeArguments&&s.tupleTypeArguments.some((e=>(0,V.isUnpackedVariadicTypeVar)(e.type))))&&1!==t.argument.argumentCategory&&nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeVarTupleMustBeUnpacked(),null!==(n=t.argument.valueExpression)&&void 0!==n?n:e),{type:(0,U.stripLiteralValue)(s),isUnbounded:1===t.argument.argumentCategory}})),i={paramCategory:1,paramType:t,requiresTypeVarMatching:!0,argument:{argumentCategory:0,type:V.ClassType.cloneAsInstance((0,U.specializeTupleClass)(ee,s,!0,!0,!0))},errorNode:e,paramName:a.params[a.argsIndex].param.name,isParamNameSynthesized:a.params[a.argsIndex].param.isNameSynthesized,mapsToVarArgList:!0};D=[...D.filter((e=>!e.mapsToVarArgList)),i]}}let w=0;return d&&w--,["isinstance","issubclass"].some((e=>e===n.details.builtInName))&&2===D.length&&(D[1].expectingType=!0),{overload:n,overloadIndex:s,argumentErrors:u,isTypeIncomplete:m,argParams:D,paramSpecTarget:C,paramSpecArgList:I,activeParam:x,relevance:w}}function zt(e,t,n,s=!1,i){const r=t.overload;if(!i||(0,V.isAnyOrUnknown)(i)||(0,V.isNever)(i)||(0,U.requiresSpecialization)(i)||!r.details.declaredReturnType)return Bt(e,t,n,s);const a=rs(r);let o=i,l=4;if((0,U.containsLiteralType)(o,!0)&&(l|=128),(0,V.isUnion)(i)){let i;Yn(e,(()=>{const r=n.clone();gs(a,o,void 0,r,1024|l),i=Bt(e,t,r,s)})),i&&i.argumentErrors&&(o=void 0)}if(o){if((0,V.isClassInstance)(a)&&(0,V.isClassInstance)(o)&&!V.ClassType.isSameGenericClass(a,o)){const t=new z.TypeVarContext((0,U.getTypeVarScopeId)(a));Lt(a,o,t,ft(e));const n=V.ClassType.cloneForSpecialization(a,void 0,!1);o=(0,U.applySolvedTypeVars)(n,t)}gs(a,o,void 0,n,1024|l)}return Bt(e,t,n,s)}function Bt(e,t,n,s=!1){const i=t.overload;let r,a=t.isTypeIncomplete,o=!1;const l=(0,U.getTypeCondition)(i);if(i.boundTypeVarScopeId&&(void 0!==i.preBoundFlags&&i.boundToType&&(0,U.requiresSpecialization)(i.boundToType)&&6&i.preBoundFlags&&n.addSolveForScope(i.boundTypeVarScopeId),"__init__"===i.details.name&&V.FunctionType.isOverloaded(i)&&i.strippedFirstParamType&&i.boundToType&&(0,V.isClassInstance)(i.strippedFirstParamType)&&(0,V.isClassInstance)(i.boundToType)&&V.ClassType.isSameGenericClass(i.strippedFirstParamType,i.boundToType)&&i.strippedFirstParamType.typeArguments)){const e=i.strippedFirstParamType.details.typeParameters;r=i.strippedFirstParamType,i.strippedFirstParamType.typeArguments.forEach(((t,s)=>{if(s<e.length){const i=e[s];(0,V.isTypeSame)(i,t,!0)||n.setTypeVarType(e[s],t)}}))}["cast","isinstance","issubclass"].some((e=>e===i.details.builtInName))&&(s=!0);const c=t.argParams.filter((e=>e.requiresTypeVarMatching)).length;if(c>0){let r=Math.min(c,2);for(let o=0;o<r;o++)Yn(e,(()=>{t.argParams.forEach((e=>{if(e.requiresTypeVarMatching){const t=jt(e,n,i,s,0===o,r>1&&0===o,l);t.isTypeIncomplete&&(a=!0),0===o&&t.skippedOverloadArg&&r++}}))}));n.lock()}let d=!1,u=!1,m=[];t.argParams.forEach((e=>{var t;const r=jt(e,n,i,s,!1,!1,l);r.isCompatible||(o=!0),r.isTypeIncomplete&&(a=!0),r.condition&&(m=null!==(t=V.TypeCondition.combine(m,r.condition))&&void 0!==t?t:[]),i.details.paramSpec&&(1===e.argument.argumentCategory&&(0,V.isParamSpec)(r.argType)&&"args"===r.argType.paramSpecAccess&&(d=!0),2===e.argument.argumentCategory&&(0,V.isParamSpec)(r.argType)&&"kwargs"===r.argType.paramSpecAccess&&(u=!0))})),t.paramSpecArgList&&t.paramSpecTarget?function(e,t,n,s,i){var r;const a=s.getParamSpec(n);if(!a)return nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.paramSpecNotBound().format({type:Ps(n)}),(null===(r=t[0])||void 0===r?void 0:r.valueExpression)||e),!1;s.addSolveForScope(a.typeVarScopeId);let o=!1;const l=new Map,c=a.parameters;c.forEach((e=>{e.name&&l.set(e.name,e)}));let d=0,u=c.findIndex((e=>0!==e.category));u<0&&(u=c.length);const m=c.find((e=>1===e.category)),h=c.find((e=>2===e.category));if(t.forEach((t=>{if(0===t.argumentCategory){let n;if(t.name){const s=l.get(t.name.value);s?(n=s.type,l.delete(t.name.value)):h?n=h.type:(nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.paramNameMissing().format({name:t.name.value}),t.valueExpression||e),o=!0)}else{if(d<u){const e=c[d];n=e.type,e.name&&l.delete(e.name)}else m?n=m.type:(nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,1===c.length?y.Localizer.Diagnostic.argPositionalExpectedOne():y.Localizer.Diagnostic.argPositionalExpectedCount().format({expected:c.length}),t.valueExpression||e),o=!0);d++}n&&(jt({paramCategory:0,paramType:n,requiresTypeVarMatching:!1,argument:t,errorNode:t.valueExpression||e},s,void 0,!1,!1,!1,i)||(o=!0))}else l.clear()})),!o){let t=[...l.keys()];if(t=t.filter((e=>{const t=l.get(e);return 0===t.category&&!t.hasDefault})),t.length>0&&!a.paramSpec){const n=t.map((e=>`"${e}"`)).join(", ");nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,1===t.length?y.Localizer.Diagnostic.argMissingForParam().format({name:n}):y.Localizer.Diagnostic.argMissingForParams().format({names:n}),e),o=!0}}return!o}(e,t.paramSpecArgList,t.paramSpecTarget,n,l)||(o=!0):i.details.paramSpec&&(d&&u||(nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.paramSpecArgsMissing().format({type:Ps(i.details.paramSpec)}),e),o=!0));let h=rs(i,t.argParams);m.length>0&&(h=V.TypeBase.cloneForCondition(h,m));let g=!0,f=e;for(;;){const e=D.getTypeVarScopeNode(f);if(!e)break;const t=gt(e);n.hasSolveForScope(t)&&(g=!1),f=e}((0,V.isFunction)(h)||(0,V.isOverloadedFunction)(h)||i.details.typeVarScopeId===V.WildcardTypeVarScopeId)&&(g=!1);let T=(0,U.addConditionToType)((0,U.applySolvedTypeVars)(h,n,!1,!1,g),l);return(0,V.isUnpackedClass)(T)&&(T=V.ClassType.cloneForUnpacked(T,!1)),(0,V.isClassInstance)(T)&&V.ClassType.isBuiltIn(T,["TypeGuard","StrictTypeGuard"])&&T.typeArguments&&T.typeArguments.length>0&&te&&(0,V.isInstantiableClass)(te)&&(T=V.ClassType.cloneAsInstance(V.ClassType.cloneForTypeGuard(te,T.typeArguments[0],V.ClassType.isBuiltIn(T,"StrictTypeGuard")))),(0,V.isFunction)(T)&&!T.details.name&&(T.details={...T.details,typeVarScopeId:V.WildcardTypeVarScopeId}),r&&(r=(0,U.applySolvedTypeVars)(r,n)),{argumentErrors:o,returnType:T,isTypeIncomplete:a,activeParam:t.activeParam,specializedInitSelfType:r}}function Wt(e,t,n,s,i=!1,a){const o=Ut(e,t,n,0);return o.argumentErrors?(t.forEach((e=>{e.valueExpression&&!r.isSpeculative(e.valueExpression)&&Ae(e.valueExpression)})),{argumentErrors:!0,activeParam:o.activeParam}):zt(e,o,s,i,a)}function jt(e,t,n,s,i,a,o){let l,d,u=!1,m=!0;const h=null==n?void 0:n.details.name;if(e.argument.valueExpression){let s=(0,V.isTypeVar)(e.paramType)&&void 0!==n&&e.paramType.scopeId===n.details.typeVarScopeId?void 0:(0,U.applySolvedTypeVars)(e.paramType,t,!1,a);if(s&&(0,V.isUnknown)(s)&&(s=void 0),e.argType)l=e.argType;else{const t=e.expectingType?168:0,n=Ae(e.argument.valueExpression,t,s);l=n.type,n.isIncomplete&&(u=!0),n.typeErrors&&(m=!1),d=n.expectedTypeDiagAddendum}e.argument&&e.argument.name&&!r.isSpeculative(e.errorNode)&&fe(e.argument.name,s||l,0,u)}else if(e.argType)l=e.argType;else if(e.expectingType&&!e.argument.type&&e.argument.valueExpression){const t=Ae(e.argument.valueExpression,168);l=t.type,t.isIncomplete&&(u=!0)}else{const t=Wn(e.argument);l=t.type,t.isIncomplete&&(u=!0)}2===e.paramCategory&&(0,V.isTypeVar)(e.paramType)&&(l=(0,U.stripLiteralValue)(l)),o&&(l=ct(l,o,(e=>e)));const g=l.condition;let f=new c.DiagnosticAddendum;if((0,V.isParamSpec)(e.paramType)&&void 0!==e.paramType.paramSpecAccess)return{isCompatible:m,argType:l,isTypeIncomplete:u,condition:g};if((0,V.isParamSpec)(l)&&void 0!==l.paramSpecAccess)return{isCompatible:m,argType:l,isTypeIncomplete:u,condition:g};if(i){if((0,V.isOverloadedFunction)(l))return{isCompatible:m,argType:l,isTypeIncomplete:u,skippedOverloadArg:!0,condition:g};const t=lt(e.paramType);if((0,V.isFunction)(t)||(0,V.isOverloadedFunction)(t)){if((0,V.isInstantiableClass)(l)){const e=_s(l);if(e&&(0,V.isOverloadedFunction)(e))return{isCompatible:m,argType:l,isTypeIncomplete:u,skippedOverloadArg:!0,condition:g}}if((0,V.isClassInstance)(l)){const e=(0,U.lookUpObjectMember)(l,"__call__");if(e){const t=ls(e);if((0,V.isOverloadedFunction)(t))return{isCompatible:m,argType:l,isTypeIncomplete:u,skippedOverloadArg:!0,condition:g}}}}}if(!gs(e.paramType,l,f.createAddendum(),t)){if("none"!==_.getFileInfo(e.errorNode).diagnosticRuleSet.reportGeneralTypeIssues&&!tt(e.errorNode)&&!u){const t=_.getFileInfo(e.errorNode),n=Ps(l),s=Ps(e.paramType);let i;i=e.paramName&&!e.isParamNameSynthesized?h?y.Localizer.Diagnostic.argAssignmentParamFunction().format({argType:n,paramType:s,functionName:h,paramName:e.paramName}):y.Localizer.Diagnostic.argAssignmentParam().format({argType:n,paramType:s,paramName:e.paramName}):h?y.Localizer.Diagnostic.argAssignmentFunction().format({argType:n,paramType:s,functionName:h}):y.Localizer.Diagnostic.argAssignment().format({argType:n,paramType:s}),d&&(f=d),nt(t.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,i+f.getString(),e.errorNode)}return{isCompatible:!1,argType:l,isTypeIncomplete:u,condition:g}}if(!s){const t=(0,V.removeUnbound)(l),n=_.getFileInfo(e.errorNode),s=()=>{const t=new c.DiagnosticAddendum;return e.paramName&&t.addMessage((h?y.Localizer.DiagnosticAddendum.argParamFunction().format({paramName:e.paramName,functionName:h}):y.Localizer.DiagnosticAddendum.argParam().format({paramName:e.paramName}))+t.getString()),t};if("none"!==n.diagnosticRuleSet.reportUnknownArgumentType&&!(0,V.isAny)(e.paramType)&&!u)if((0,V.isUnknown)(t)){const t=s();nt(n.diagnosticRuleSet.reportUnknownArgumentType,p.DiagnosticRule.reportUnknownArgumentType,y.Localizer.Diagnostic.argTypeUnknown()+t.getString(),e.errorNode)}else if((0,U.isPartlyUnknown)(t,!0)){let i=!1;if((0,V.isInstantiableClass)(t)&&(i=!0),(0,U.isPartlyUnknown)(e.paramType)&&(i=!0),(0,V.isClassInstance)(t)&&t.isEmptyContainer&&(i=!0),!i){const i=s();i.addMessage(y.Localizer.DiagnosticAddendum.argumentType().format({type:Ps(t,!0)})),nt(n.diagnosticRuleSet.reportUnknownArgumentType,p.DiagnosticRule.reportUnknownArgumentType,y.Localizer.Diagnostic.argTypePartiallyUnknown()+i.getString(),e.errorNode)}}}return{isCompatible:m,argType:l,isTypeIncomplete:u,condition:g}}function Gt(e){if(11===e.nodeType){if(15===e.constType)return!1;if(33===e.constType)return!0}return Xe(y.Localizer.Diagnostic.expectedBoolLiteral(),e),!1}function $t(e,t){const n=_.getFileInfo(e);let s="_";if(t.length>=1){const e=t[0];0===e.argumentCategory&&e.valueExpression&&48===e.valueExpression.nodeType&&(s=e.valueExpression.strings.map((e=>e.value)).join(""))}if(t.length>=2){const i=jn(t[1]).type;if((0,V.isInstantiableClass)(i)){V.ClassType.isProtocolClass(i)?Xe(y.Localizer.Diagnostic.newTypeProtocolClass(),t[1].node||e):void 0!==i.literalValue&&Xe(y.Localizer.Diagnostic.newTypeLiteral(),t[1].node||e);const r=-4&i.details.flags,a=V.ClassType.createInstantiable(s,D.getClassFullName(e,n.moduleName,s),n.moduleName,n.filePath,r,D.getTypeSourceId(e),void 0,i.details.effectiveMetaclass);a.details.baseClasses.push(i),(0,U.computeMroLinearization)(a);const o=V.FunctionType.createSynthesizedInstance("__init__");V.FunctionType.addParameter(o,{category:0,name:"self",type:V.ClassType.cloneAsInstance(a),hasDeclaredType:!0}),V.FunctionType.addParameter(o,{category:0,name:"_x",type:V.ClassType.cloneAsInstance(i),hasDeclaredType:!0}),o.details.declaredReturnType=V.NoneType.createInstance(),a.details.fields.set("__init__",w.Symbol.createWithType(4,o));const l=V.FunctionType.createSynthesizedInstance("__new__",1);return V.FunctionType.addParameter(l,{category:0,name:"cls",type:a,hasDeclaredType:!0}),V.FunctionType.addDefaultParameters(l),l.details.declaredReturnType=V.ClassType.cloneAsInstance(a),a.details.fields.set("__new__",w.Symbol.createWithType(4,l)),a}(0,V.isAnyOrUnknown)(i)||Xe(y.Localizer.Diagnostic.newTypeNotAClass(),t[1].node||e)}}function qt(e){return!(!B[e]||!B[e][2])||!!W[e]}function Kt(e,t,n){const s=e.leftExpression;let i=e.rightExpression,r=!1;qt(e.operator)&&7===i.nodeType&&!i.parenthesized&&qt(i.operator)&&(Kt(i,t,n),i=i.leftExpression);let a,o=37===e.operator||36===e.operator?t:void 0;26===e.operator&&t&&(0,V.isClassInstance)(t)&&V.ClassType.isBuiltIn(t,"list")&&t.typeArguments&&t.typeArguments.length>=1&&31===e.leftExpression.nodeType&&(a=t);const l=Ae(s,n,o||a);let d=l.type;o||(37===e.operator||36===e.operator||0===e.operator&&31===e.rightExpression.nodeType||6===e.operator)&&(o=d);const m=Ae(i,n,o);let h=m.type;if((l.isIncomplete||m.isIncomplete)&&(r=!0),6===e.operator&&!Ht(d,"__or__")&&!Ht(h,"__ror__")){let t=h,s=d;if(!(0,V.isNoneInstance)(d)&&(0,V.isNoneInstance)(h)?t=V.NoneType.createType():!(0,V.isNoneInstance)(h)&&(0,V.isNoneInstance)(d)&&(s=V.NoneType.createType()),(0,U.isUnionableType)([s,t])){const i=_.getFileInfo(e);i.isStubFile||0!=(4&n)||i.executionEnvironment.pythonVersion>=u.PythonVersion.V3_10||(0,V.isAnyOrUnknown)(s)||Xe(y.Localizer.Diagnostic.unionSyntaxIllegal(),e,e.operatorToken);const r=(0,V.combineTypes)([s,t]);return(0,V.isUnion)(r)&&V.TypeBase.setSpecialForm(r),{type:r,node:e}}}let g=!1;void 0===W[e.operator]&&(12===e.operator||28===e.operator?d=(0,V.removeNoneFromUnion)(d):g=(0,U.isOptionalType)(d),12!==e.operator&&28!==e.operator||(h=(0,V.removeNoneFromUnion)(h)));const f=new c.DiagnosticAddendum,T=!D.isWithinLoop(e);let v=Zt(e.operator,d,h,e,t,f,T);if(!f.isEmpty()||!v){if(!r){const t=_.getFileInfo(e);g&&1===f.getMessages().length?nt(_.getFileInfo(e).diagnosticRuleSet.reportOptionalOperand,p.DiagnosticRule.reportOptionalOperand,y.Localizer.Diagnostic.noneOperator().format({operator:D.printOperator(e.operator)}),e.leftExpression):nt(t.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:D.printOperator(e.operator),leftType:Ps(d),rightType:Ps(h)})+f.getString(),e)}v=V.UnknownType.create()}return{type:v,node:e,isIncomplete:r}}function Ht(e,t){if(!(0,V.isInstantiableClass)(e))return!1;const n=e.details.effectiveMetaclass;if(!n||!(0,V.isInstantiableClass)(n))return!1;if(V.ClassType.isBuiltIn(n,"type"))return!1;const s=(0,U.lookUpClassMember)(n,t);return!!s&&(!(0,V.isInstantiableClass)(s.classType)||!V.ClassType.isBuiltIn(s.classType,"type"))}function Yt(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 s,i;const r=new c.DiagnosticAddendum,a=Ae(e.leftExpression),o=a.type;let l;7===e.operator&&(l=o);const d=Ae(e.rightExpression,void 0,l),u=d.type,m=!!d.isIncomplete||!!a.isIncomplete;if((0,V.isNever)(o)||(0,V.isNever)(u))i={node:e,type:V.NeverType.createNever(),isIncomplete:m};else{if(s=ct(o,void 0,((s,i)=>ct(u,(0,U.getTypeCondition)(s),((o,l)=>{if((0,V.isAnyOrUnknown)(i)||(0,V.isAnyOrUnknown)(l))return(0,U.preserveUnknown)(i,l);const c=n[e.operator][0];let p=Qt(i,[l],c,e,t);if(p||i===s||(p=Qt(s,[l],c,e,t)),p||l===o||(p=Qt(s,[o],c,e,t)),!p){const s=n[e.operator][1],o=!a.isIncomplete&&!d.isIncomplete;p=Zt(s,i,l,e,t,r,o)}return p})))),!r.isEmpty()||!s||(0,V.isNever)(s)){if(!m){nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:D.printOperator(e.operator),leftType:Ps(o),rightType:Ps(u)})+r.getString(),e)}s=V.UnknownType.create()}i={node:e,type:s,isIncomplete:m}}return pt(e.destExpression,i.type,!!i.isIncomplete,e.rightExpression),i}function Zt(e,t,n,s,i,r,a){let o,l=lt(t);if(void 0!==W[e]){if(36===e){if(!Me(l))return t;if(!Ne(l))return n;l=Re(l)}else if(37===e){if(!Ne(l))return t;if(!Me(l))return n;l=Oe(l)}if((0,V.isNever)(t)||(0,V.isNever)(n))return V.NeverType.createNever();41===e||42===e?(o=ct(n,void 0,((t,n)=>ct(l,(0,U.getTypeCondition)(t),(i=>{if((0,V.isAnyOrUnknown)(i)||(0,V.isAnyOrUnknown)(n))return(0,U.preserveUnknown)(i,t);let a=Qt(t,[i],"__contains__",s,void 0);if(!a){const e=je(t,!1,void 0);e&&gs(e,i)&&(a=qn(s,"bool"))}return a||r.addMessage(y.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:D.printOperator(e),leftType:Ps(i),rightType:Ps(t)})),a})))),o&&!(0,V.isNever)(o)&&(o=qn(s,"bool"))):o=ct(l,void 0,((t,i)=>ct(n,(0,U.getTypeCondition)(t),((t,n)=>36===e||37===e?(0,V.combineTypes)([i,n]):qn(s,"bool")))))}else if(B[e]){if((0,V.isNever)(t)||(0,V.isNever)(n))return V.NeverType.createNever();if(a){const s=(0,U.getLiteralTypeClassName)(t);if(s&&!(0,U.getTypeCondition)(t)){const i=64;if(s===(0,U.getLiteralTypeClassName)(n)&&!(0,U.getTypeCondition)(n)&&(0,U.getUnionSubtypeCount)(t)*(0,U.getUnionSubtypeCount)(n)<i)if("str"===s||"bytes"===s)0===e&&(o=(0,U.mapSubtypes)(t,(e=>(0,U.mapSubtypes)(n,(t=>{const n=e,s=t;return V.ClassType.cloneWithLiteral(n,n.literalValue+s.literalValue)})))));else if("int"===s&&(0===e||33===e||26===e||13===e||24===e)){let s=!0;o=(0,U.mapSubtypes)(t,(t=>(0,U.mapSubtypes)(n,(n=>{try{const i=t,r=n,a=BigInt(i.literalValue),o=BigInt(r.literalValue);let l;return 0===e?l=a+o:33===e?l=a-o:26===e?l=a*o:13===e?o!==BigInt(0)&&(l=a/o):24===e&&o!==BigInt(0)&&(l=a%o),void 0===l||"number"==typeof l&&isNaN(l)?void(s=!1):(l===BigInt(Number(l))&&(l=Number(l)),V.ClassType.cloneWithLiteral(i,l))}catch{return void(s=!1)}})))),s||(o=void 0)}}}o||(o=ct(t,void 0,((t,a)=>ct(n,(0,U.getTypeCondition)(t),((n,o)=>{if((0,V.isAnyOrUnknown)(a)||(0,V.isAnyOrUnknown)(o))return(0,U.preserveUnknown)(a,o);if(0===e&&(0,V.isClassInstance)(t)&&(0,U.isTupleClass)(t)&&t.tupleTypeArguments&&!(0,U.isUnboundedTupleClass)(t)&&(0,V.isClassInstance)(n)&&(0,U.isTupleClass)(n)&&n.tupleTypeArguments&&!(0,U.isUnboundedTupleClass)(n)&&ee&&(0,V.isInstantiableClass)(ee))return V.ClassType.cloneAsInstance((0,U.specializeTupleClass)(ee,[...t.tupleTypeArguments,...n.tupleTypeArguments]));const l=B[e][0];let c=Qt(Jt(a),[o],l,s,i);if(c||a===t||(c=Qt(Jt(t),[o],l,s,i)),c||o===n||(c=Qt(Jt(t),[n],l,s,i)),!c){const r=B[e][1];c=Qt(Jt(o),[a],r,s,i),c||o===n||(c=Qt(Jt(n),[a],r,s,i)),c||a===t||(c=Qt(Jt(n),[t],r,s,i))}return c||(i?r.addMessage(y.Localizer.Diagnostic.typeNotSupportBinaryOperatorBidirectional().format({operator:D.printOperator(e),leftType:Ps(t),rightType:Ps(n),expectedType:Ps(i)})):r.addMessage(y.Localizer.Diagnostic.typeNotSupportBinaryOperator().format({operator:D.printOperator(e),leftType:Ps(t),rightType:Ps(n)}))),c})))))}return o&&(0,V.isNever)(o)?void 0:o}function Qt(e,t,n,s,i){let r=!0;const a=e=>{var a,o;let l;const c=lt(e);if((0,V.isClassInstance)(c)?l=null===(a=Le(s,c,n,void 0,void 0,64,e))||void 0===a?void 0:a.type:(0,V.isInstantiableClass)(c)&&(l=null===(o=Ve(s,c,n,void 0,void 0,96))||void 0===o?void 0:o.type),l){const e=t.map((e=>({argumentCategory:0,type:e})));let n;return Yn(s,(()=>{n=Vt(s,e,{type:l},void 0,!0,i)})),n.argumentErrors&&(r=!1),n.returnType}r=!1},o=(0,U.mapSubtypes)(e,(e=>{if((0,V.isAnyOrUnknown)(e))return e;if((0,V.isClassInstance)(e)||(0,V.isInstantiableClass)(e)||(0,V.isTypeVar)(e))return a(e);if((0,V.isNoneInstance)(e)){const e=qn(s,"object");if((0,V.isClassInstance)(e))return a(e)}r=!1}));if(r)return o}function Jt(e){return((0,V.isFunction)(e)||(0,V.isOverloadedFunction)(e))&&Q?Q:e}function Xt(e,t,n){if(t=(0,U.transformPossibleRecursiveTypeAlias)(t),!(0,V.isClassInstance)(t))return;const s=[],i=[];let r=!1;if(V.ClassType.isTypedDictClass(t)){if(tn(e,s,i,!0,void 0,void 0,(0,O.getTypedDictMembersForClass)(As,t),n)&&(r=!0),V.ClassType.isTypedDictClass(t)){const a=(0,O.assignToTypedDict)(As,t,s,i,n);if(a)return{type:a,node:e,isIncomplete:r}}return}const a=qn(e,"dict");if(!(0,V.isClassInstance)(a))return;const o=new z.TypeVarContext((0,U.getTypeVarScopeId)(a));if(!Lt(a,t,o,ft(e)))return;const l=(0,U.applySolvedTypeVars)(V.ClassType.cloneAsInstantiable(a),o);if(!l.typeArguments||2!==l.typeArguments.length)return;const c=l.typeArguments[0],p=l.typeArguments[1];tn(e,s,i,!0,c,p,void 0,n)&&(r=!0);const d=(0,V.isClassInstance)(t)&&(V.ClassType.isBuiltIn(t,"dict")||V.ClassType.isBuiltIn(t,"MutableMapping")),u=sn(c,s,!1),m=sn(p,i,!d);if(!u||!m)return;return{type:qn(e,"dict",[u,m]),node:e,isIncomplete:r}}function en(e,t){const n=t?V.AnyType.create():V.UnknownType.create();let s=n,i=n,r=[],a=[],o=!1,l=!1;tn(e,r,a,t)&&(l=!0),r=r.map((e=>(0,U.stripLiteralValue)(e))),a=a.map((e=>(0,U.stripLiteralValue)(e))),s=r.length>0?(0,V.combineTypes)(r):n,a.length>0?i=_.getFileInfo(e).diagnosticRuleSet.strictDictionaryInference||t?(0,V.combineTypes)(a):(0,U.areTypesSame)(a,!0)?a[0]:n:(i=n,o=!0);const c=$n(e,"dict");return{type:(0,V.isInstantiableClass)(c)?V.ClassType.cloneAsInstance(V.ClassType.cloneForSpecialization(c,[s,i],!0,void 0,void 0,o)):V.UnknownType.create(),node:e,isIncomplete:l}}function tn(e,t,n,s,i,r,a,o){let l=!1;return e.entries.forEach(((c,d)=>{var u;let m=!0;if(17===c.nodeType){const e=Ae(c.keyExpression,void 0,null!=i?i:s?V.NeverType.createNever():void 0);e.isIncomplete&&(l=!0);let p,u=e.type;if(i){const e=lt(i);(0,V.isAnyOrUnknown)(e)||gs(e,u)&&(u=e)}p=a&&(0,V.isClassInstance)(u)&&V.ClassType.isBuiltIn(u,"str")&&(0,U.isLiteralType)(u)&&a.has(u.literalValue)?Ae(c.valueExpression,void 0,a.get(u.literalValue).valueType):Ae(c.valueExpression,void 0,null!=r?r:s?V.NeverType.createNever():void 0),o&&p.expectedTypeDiagAddendum&&o.addAddendum(p.expectedTypeDiagAddendum);const y=p.type;p.isIncomplete&&(l=!0),(s||d<$)&&(t.push(u),n.push(y)),m=!1}else if(16===c.nodeType){const i=Ae(c.expandExpression);i.isIncomplete&&(l=!0);const r=i.type;if((0,V.isAnyOrUnknown)(r))m=!1;else{let i=qe(e,"SupportsKeysAndGetItem");if(i||(i=$e(e,"Mapping")),i&&(0,V.isInstantiableClass)(i)){const a=new z.TypeVarContext((0,U.getTypeVarScopeId)(i));if(i=V.ClassType.cloneForSpecialization(i,i.details.typeParameters,!0),gs(V.ClassType.cloneAsInstance(i),r,void 0,a)){const e=(0,U.applySolvedTypeVars)(i,a).typeArguments;e&&e.length>=2&&((s||d<$)&&(t.push(e[0]),n.push(e[1])),m=!1)}else{nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.dictUnpackIsNotMapping(),c)}}}}else if(32===c.nodeType){const e=on(c,r,i),a=e.type;if(e.isIncomplete&&(l=!0),(0,V.isClassInstance)(a)&&(0,U.isTupleClass)(a)){const e=null===(u=a.tupleTypeArguments)||void 0===u?void 0:u.map((e=>e.type));e&&2===e.length&&((s||d<$)&&(t.push(e[0]),n.push(e[1])),m=!1)}}m&&(s||d<$)&&(t.push(V.UnknownType.create()),n.push(V.UnknownType.create()))})),l}function nn(e,t){const n=31===e.nodeType?"list":"set";t=(0,U.transformPossibleRecursiveTypeAlias)(t);let s=!1;if(!(0,V.isClassInstance)(t))return;const i=qn(e,n);if(!(0,V.isClassInstance)(i))return;const r=new z.TypeVarContext((0,U.getTypeVarScopeId)(i));if(!Lt(i,t,r,ft(e)))return;const a=(0,U.applySolvedTypeVars)(V.ClassType.cloneAsInstantiable(i),r);if(!a.typeArguments||1!==a.typeArguments.length)return;const o=a.typeArguments[0],l=[];e.entries.forEach((e=>{let t;t=32===e.nodeType?on(e,o):Ae(e,void 0,o),l.push(t.type),t.isIncomplete&&(s=!0)}));const c=(0,V.isClassInstance)(t)&&V.ClassType.isBuiltIn(t,n),p=sn(o,l,!c);if(!p)return;return{type:qn(e,n,[p]),node:e,isIncomplete:s}}function sn(e,t,n){const s=V.TypeVarType.createInstance("__typeArg");s.details.isSynthesized=!0,s.details.boundType=e,s.scopeId="__typeArgScopeId";let i=new z.TypeVarContext(V.WildcardTypeVarScopeId);if(i.setTypeVarType(s,n?void 0:e,e),!t.some((e=>!gs(s,(0,U.stripLiteralValue)(e),void 0,i)))||(i=new z.TypeVarContext(V.WildcardTypeVarScopeId),i.setTypeVarType(s,n?void 0:e,e,!0),!t.some((e=>!gs(s,e,void 0,i)))))return(0,U.applySolvedTypeVars)(s,i)}function rn(e,t,n,s,i,r){if("none"===e)return;const a=n.value,o=(0,V.removeUnbound)(s);if((0,V.isUnknown)(o))nt(e,t,y.Localizer.Diagnostic.typeUnknown().format({name:a}),i);else if((0,U.isPartlyUnknown)(o)&&(!r||!(0,V.isClassInstance)(s)||!s.isEmptyContainer)){const n=new c.DiagnosticAddendum;n.addMessage(y.Localizer.DiagnosticAddendum.typeOfSymbol().format({name:a,type:Ps(o,!0)})),nt(e,t,y.Localizer.Diagnostic.typePartiallyUnknown().format({name:a})+n.getString(),i)}}function an(e){var t;let n=!1;if(33===e.nodeType){const s=Ae(e.iterableExpression);s.isIncomplete&&(n=!0);const i=null!==(t=je((0,U.stripLiteralValue)(s.type),!!e.isAsync,e.iterableExpression))&&void 0!==t?t:V.UnknownType.create();pt(e.targetExpression,i,!!s.isIncomplete,e.iterableExpression)}else(0,l.assert)(34===e.nodeType),r.isSpeculative(e.testExpression)||Ae(e.testExpression);return n}function on(e,t,n){let s=!1;for(const t of e.forIfNodes)an(t)&&(s=!0);let i=V.UnknownType.create();if(17===e.expression.nodeType){const r=Ae(e.expression.keyExpression,void 0,n);r.isIncomplete&&(s=!0);let a=r.type;n&&(0,U.containsLiteralType)(n)||(a=(0,U.stripLiteralValue)(a));const o=Ae(e.expression.valueExpression,void 0,t);o.isIncomplete&&(s=!0);let l=o.type;t&&(0,U.containsLiteralType)(t)||(l=(0,U.stripLiteralValue)(l)),i=Ct([a,l])}else if(16===e.expression.nodeType)Ae(e.expression.expandExpression,void 0,t);else if((0,h.isExpressionNode)(e)){const n=Ae(e.expression,void 0,t);n.isIncomplete&&(s=!0),i=n.type}return{type:i,node:e,isIncomplete:s}}function ln(e,t){if(e.typeList){if(!(null==t?void 0:t.allowTypeArgList))return Xe(y.Localizer.Diagnostic.typeArgListNotAllowed(),e.node),!1;e.typeList.forEach((e=>{ln(e)}))}if((0,U.isEllipsisType)(e.type)&&!(null==t?void 0:t.allowTypeArgList))return Xe(y.Localizer.Diagnostic.ellipsisContext(),e.node),!1;if((0,V.isModule)(e.type))return Xe(y.Localizer.Diagnostic.moduleAsType(),e.node),!1;if((0,V.isParamSpec)(e.type)&&!(null==t?void 0:t.allowParamSpec))return Xe(y.Localizer.Diagnostic.paramSpecContext(),e.node),!1;if((0,V.isVariadicTypeVar)(e.type)&&!e.type.isVariadicInUnion){if(!(null==t?void 0:t.allowVariadicTypeVar))return Xe(y.Localizer.Diagnostic.typeVarTupleContext(),e.node),!1;bt(e.type,e.node)}return!(null==t?void 0:t.allowEmptyTuple)&&e.isEmptyTupleShorthand?(Xe(y.Localizer.Diagnostic.zeroLengthTupleNotAllowed(),e.node),!1):!((0,V.isUnpackedClass)(e.type)&&!(null==t?void 0:t.allowUnpackedTuples))||(Xe(y.Localizer.Diagnostic.unpackedArgInTypeArgument(),e.node),!1)}function cn(e,t,n){const s=qn(e,t);return(0,V.isClassInstance)(s)?V.ClassType.cloneWithLiteral(s,n):V.UnknownType.create()}function pn(e,t,n){const s=$n(e,t);return(0,V.isInstantiableClass)(s)?V.ClassType.cloneWithLiteral(s,n):V.UnknownType.create()}function dn(e,t,n,s=!1,i=!1){const r=V.ClassType.isTupleClass(e);if(t)if(r&&1===t.length&&t[0].isEmptyTupleShorthand)t=[];else{let e=!1;const i=t=>{e&&(a||(Xe(y.Localizer.Diagnostic.variadicTypeArgsTooMany(),t.node),a=!0)),e=!0};let a=!1;t.forEach(((e,a)=>{(0,U.isEllipsisType)(e.type)?r?2!==t.length||1!==a?Xe(y.Localizer.Diagnostic.ellipsisSecondArg(),e.node):(0,V.isTypeVar)(t[0].type)&&(0,V.isVariadicTypeVar)(t[0].type)&&!t[0].type.isVariadicInUnion&&Xe(y.Localizer.Diagnostic.typeVarTupleContext(),t[0].node):Xe(y.Localizer.Diagnostic.ellipsisContext(),e.node):(0,V.isParamSpec)(e.type)&&s||((0,V.isVariadicTypeVar)(e.type)&&void 0===n?(i(e),bt(e.type,e.node)):void 0===n&&(0,V.isUnpacked)(e.type)?(i(e),ln(e,{allowUnpackedTuples:!0})):ln(e))}))}let a,l=t?t.map((e=>(0,U.convertToInstance)(e.type))):[];if(void 0!==n)if(t&&l.length>n)Xe(y.Localizer.Diagnostic.typeArgsTooMany().format({name:e.aliasName||e.details.name,expected:n,received:l.length}),t[n].node),l=l.slice(0,n);else if(l.length<n)for(;l.length<n;)l.push(V.UnknownType.create());if(r){const n=[];t?t.forEach(((e,t)=>{1===t&&(0,U.isEllipsisType)(l[t])?1!==n.length||n[0].isUnbounded?Xe(y.Localizer.Diagnostic.ellipsisSecondArg(),e.node):n[0]={type:n[0].type,isUnbounded:!0}:(0,V.isUnpackedClass)(e.type)&&e.type.tupleTypeArguments?(0,o.appendArray)(n,e.type.tupleTypeArguments):n.push({type:l[t],isUnbounded:!1})})):n.push({type:V.UnknownType.create(),isUnbounded:!0}),a=(0,U.specializeTupleClass)(e,n,void 0!==t,!1)}else a=V.ClassType.cloneForSpecialization(e,l,void 0!==t);return i||V.TypeBase.setSpecialForm(a),a}function un(e,t){var n,s,i,r;const a=D.getEnclosingClass(e,!0);if(a){const o=fn(a);if(o&&V.ClassType.isEnumClass(o.classType)){let a=3===(null===(n=e.parent)||void 0===n?void 0:n.nodeType)&&e.parent.leftExpression===e||54===(null===(s=e.parent)||void 0===s?void 0:s.nodeType)&&e.parent.valueExpression===e&&3===(null===(i=e.parent.parent)||void 0===i?void 0:i.nodeType)||_.getFileInfo(e).isStubFile&&54===(null===(r=e.parent)||void 0===r?void 0:r.nodeType)&&e.parent.valueExpression===e;(0,N.isSingleDunderName)(e.value)&&(a=!1),"name"!==e.value&&"value"!==e.value||(a=!1);const l=t();if((0,V.isClassInstance)(l)&&l.details.fields.get("__get__")&&(a=!1),a)return V.ClassType.cloneAsInstance(V.ClassType.cloneWithLiteral(o.classType,new V.EnumLiteral(o.classType.details.name,e.value,l)))}}}function mn(e,t,n){if(!V.TypeBase.isInstantiable(e))return e;if((0,U.isTypeAliasPlaceholder)(e))return e;let s=[];(0,V.isTypeVar)(e)&&!V.TypeBase.isAnnotated(e)||(0,U.doForEachSubtype)(e,(e=>{(0,U.addTypeVarsToListIfUnique)(s,(0,U.getTypeVarArgumentsRecursive)(e))})),s=s.filter((e=>!e.details.isSynthesized)),s=s.map((e=>V.TypeBase.isInstance(e)?e:(0,U.convertToInstance)(e)));const i=s.filter((e=>(0,V.isVariadicTypeVar)(e)));i.length>1&&Xe(y.Localizer.Diagnostic.variadicTypeParamTooManyAlias().format({names:i.map((e=>`"${e.details.name}"`)).join(", ")}),n);const r=_.getFileInfo(t),a=gt(t),o=s.filter((e=>e.scopeId!==a&&0===e.scopeType));return o.length>0&&Xe(y.Localizer.Diagnostic.genericTypeAliasBoundTypeVar().format({names:o.map((e=>`${e.details.name}`)).join(", ")}),n),V.TypeBase.cloneForTypeAlias(e,t.value,`${r.moduleName}.${t.value}`,a,s.length>0?s:void 0)}function yn(e,t,n){const s=_.getFileInfo(e);let i=V.ClassType.createInstantiable(t,D.getClassFullName(e,s.moduleName,t),s.moduleName,s.filePath,3,0,void 0,void 0);s.isTypingExtensionsStubFile&&(i.details.flags|=65536);const r=n.alias||"object";let a;if("builtins"===n.module)a=$n(e,r);else if("collections"===n.module)a=Ke(e,r,["collections"]);else if("self"===n.module){const t=Kn(e,r,!1);t&&(a=ts(t.symbol),(0,V.isInstantiableClass)(a)&&V.ClassType.isBuiltIn(a,"_TypedDict")&&(a.details.flags&=-513))}return a&&(0,V.isInstantiableClass)(a)?n.alias?i=V.ClassType.cloneForTypingAlias(a,t):(i.details.baseClasses.push(a),i.details.effectiveMetaclass=a.details.effectiveMetaclass,(0,U.computeMroLinearization)(i)):(i.details.baseClasses.push(V.UnknownType.create()),i.details.effectiveMetaclass=V.UnknownType.create(),(0,U.computeMroLinearization)(i)),i}function hn(e){var t;const n=_.getFileInfo(e);if(ge(e,0))return;let s=0;n.isStubFile&&(s|=256),38!==e.rightExpression.nodeType&&35!==e.rightExpression.nodeType||(s|=2),ze(e.leftExpression)&&(s|=232,s&=-3);let i,r=ge(e.rightExpression,s),a=!1;if(!r&&((n.isTypingStubFile||n.isTypingExtensionsStubFile)&&(r=function(e){if(38!==e.leftExpression.nodeType)return;const t=e.leftExpression.value;if("Any"===t)return V.AnyType.create();const n=new Map([["overload",{alias:"",module:"builtins"}],["TypeVar",{alias:"",module:"builtins"}],["_promote",{alias:"",module:"builtins"}],["no_type_check",{alias:"",module:"builtins"}],["NoReturn",{alias:"",module:"builtins"}],["Never",{alias:"",module:"builtins"}],["Counter",{alias:"Counter",module:"collections"}],["List",{alias:"list",module:"builtins"}],["Dict",{alias:"dict",module:"builtins"}],["DefaultDict",{alias:"defaultdict",module:"collections"}],["Set",{alias:"set",module:"builtins"}],["FrozenSet",{alias:"frozenset",module:"builtins"}],["Deque",{alias:"deque",module:"collections"}],["ChainMap",{alias:"ChainMap",module:"collections"}],["OrderedDict",{alias:"OrderedDict",module:"collections"}]]).get(t);return n?(Ae(e.rightExpression),yn(e,t,n)):void 0}(e),r&&fe(e.rightExpression,r,0,!1)),!r)){const o=Be(e.leftExpression,{method:"set"});let l,c,d=!1;if(ze(e.leftExpression))l=e.leftExpression.valueExpression;else if(38===e.leftExpression.nodeType){const t=Kn(e.leftExpression,e.leftExpression.value,!1);if(t){const n=t.symbol.getDeclarations();1===n.length&&(0,S.isPossibleTypeAliasDeclaration)(n[0])&&(l=e.leftExpression,d=!0)}}if(l){c=V.TypeVarType.createInstantiable(`__type_alias_${l.value}`),c.details.isSynthesized=!0,c.details.recursiveTypeAliasName=l.value;const t=gt(l);c.details.recursiveTypeAliasScopeId=t,c.scopeId=t,fe(e,c,void 0,!1),fe(e.leftExpression,c,void 0,!1),54===e.leftExpression.nodeType&&fe(e.leftExpression.valueExpression,c,void 0,!1)}const u=Ae(e.rightExpression,s,o);let m=u.type;i=u.expectedTypeDiagAddendum,u.isIncomplete&&(a=!0);const h=(0,k.evaluateStaticBoolExpression)(e.rightExpression,n.executionEnvironment);if(void 0!==h){const t=qn(e,"bool");(0,V.isClassInstance)(t)&&(m=V.ClassType.cloneWithLiteral(t,h))}o&&gs(o,m)&&((0,V.isAnyOrUnknown)(m)||(m=Cs(o,m))),r=m,38!==e.leftExpression.nodeType||e.typeAnnotationComment||(r=un(e.leftExpression,(()=>r))||r),l&&(Te(e),Te(e.leftExpression),54===e.leftExpression.nodeType&&Te(e.leftExpression.valueExpression),(!d||V.TypeBase.isInstantiable(r)&&!(0,V.isUnknown)(r))&&(r=mn(r,l,e.rightExpression),(0,U.isTypeAliasRecursive)(c,r)&&nt(n.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeAliasIsRecursiveDirect().format({name:l.value}),e.rightExpression),c.details.boundType=r,c.details.recursiveTypeParameters=null===(t=r.typeAliasInfo)||void 0===t?void 0:t.typeParameters),c.details.illegalRecursionDetected&&nt(n.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeAliasIsRecursiveIndirect().format({name:l.value}),e.leftExpression))}pt(e.leftExpression,r,a,e.rightExpression,!0,!0,i),fe(e,r,0,a)}function gn(e){if(ge(e,0))return;const t=Yt(e,void 0);fe(e,t.type,0,!!t.isIncomplete)}function fn(e){const t=ge(e.name,0);if(t){if(!(0,V.isInstantiableClass)(t))return;return{classType:t,decoratedType:ge(e,0)||V.UnknownType.create()}}const n=E.getScopeForNode(e),s=_.getFileInfo(e);let i=0;(4===(null==n?void 0:n.type)||s.isTypingStubFile||s.isTypingExtensionsStubFile||s.isBuiltInStubFile)&&(i|=1,s.isTypingExtensionsStubFile&&(i|=65536),"property"===e.name.value&&(i|=2048),"tuple"===e.name.value&&(i|=524288)),s.isStubFile&&(i|=8388608);const r=V.ClassType.createInstantiable(e.name.value,D.getClassFullName(e,s.moduleName,e.name.value),s.moduleName,s.filePath,i,0,void 0,void 0,D.getDocString(e.suite.statements));r.details.typeVarScopeId=gt(e);const a=null==n?void 0:n.lookUpSymbol(e.name.value);let l;const d=_.getDeclaration(e);d&&(l=d),l&&a&&Se(a,l,r),r.details.flags|=131072,fe(e,r,void 0,!1),fe(e.name,r,void 0,!1);const h=[];let g;const f=[];let T,v=272960;s.isStubFile&&(v|=4),e.arguments.forEach((e=>{if(e.name)if("metaclass"===e.name.value)T?Xe(y.Localizer.Diagnostic.metaclassDuplicate(),e):T=e.valueExpression;else if("total"===e.name.value&&V.ClassType.isTypedDictClass(r)){const t=(0,k.evaluateStaticBoolExpression)(e.valueExpression,s.executionEnvironment);void 0===t?Xe(y.Localizer.Diagnostic.typedDictTotalParam(),e.valueExpression):t||(r.details.flags|=256)}else f.push({argumentCategory:0,node:e,name:e.name,valueExpression:e.valueExpression});else{let t=Ae(e.valueExpression,v).type;if((0,V.isUnion)(t)&&(t=(0,V.removeUnbound)(t)),(0,V.isAnyOrUnknown)(t)||(0,V.isUnbound)(t)||((0,V.isInstantiableClass)(t)?(V.ClassType.isBuiltIn(t,"Protocol")&&(!s.isStubFile&&!V.ClassType.isTypingExtensionClass(t)&&s.executionEnvironment.pythonVersion<u.PythonVersion.V3_7&&Xe(y.Localizer.Diagnostic.protocolIllegal(),e.valueExpression),r.details.flags|=8192),V.ClassType.isBuiltIn(t,"property")&&(r.details.flags|=2048),s.executionEnvironment.pythonVersion>=u.PythonVersion.V3_6&&V.ClassType.isBuiltIn(t,"NamedTuple")&&(r.details.flags|=16777252),V.ClassType.isBuiltIn(t,"TypedDict")||V.ClassType.isTypedDictClass(t)?r.details.flags|=128:V.ClassType.isTypedDictClass(r)&&!V.ClassType.isTypedDictClass(t)&&Xe(y.Localizer.Diagnostic.typedDictBaseClass(),e),(0,U.derivesFromClassRecursive)(t,r,!0)&&(Xe(y.Localizer.Diagnostic.baseClassCircular(),e),t=V.UnknownType.create())):(nt(s.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.baseClassInvalid(),e),t=V.UnknownType.create())),(0,V.isUnknown)(t)&&nt(s.diagnosticRuleSet.reportUntypedBaseClass,p.DiagnosticRule.reportUntypedBaseClass,y.Localizer.Diagnostic.baseClassUnknown(),e),r.details.baseClasses.some((e=>(0,V.isInstantiableClass)(e)&&(0,V.isInstantiableClass)(t)&&V.ClassType.isSameGenericClass(t,e)))&&nt(s.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.duplicateBaseClass(),e.name||e),r.details.baseClasses.push(t),(0,V.isInstantiableClass)(t)&&(V.ClassType.isEnumClass(t)&&(r.details.flags|=1048576),(V.ClassType.supportsAbstractMethods(t)||V.ClassType.isProtocolClass(t)&&!V.ClassType.isBuiltIn(t))&&(r.details.flags|=512),V.ClassType.isPropertyClass(t)&&(r.details.flags|=2048),V.ClassType.isFinal(t))){const n=Ds(t);Xe(y.Localizer.Diagnostic.baseClassFinal().format({type:n}),e.valueExpression)}(0,U.addTypeVarsToListIfUnique)(h,(0,U.getTypeVarArgumentsRecursive)(t)),(0,V.isInstantiableClass)(t)&&V.ClassType.isBuiltIn(t,"Generic")&&(g||(g=[],(0,U.addTypeVarsToListIfUnique)(g,(0,U.getTypeVarArgumentsRecursive)(t))))}})),r.details.baseClasses.length>1&&r.details.baseClasses.some((e=>(0,V.isInstantiableClass)(e)&&V.ClassType.isBuiltIn(e,"NamedTuple")))&&nt(s.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.namedTupleMultipleInheritance(),e.name),V.ClassType.isBuiltIn(r,"object")||0!==r.details.baseClasses.filter((e=>(0,V.isClass)(e))).length||r.details.baseClasses.push($n(e,"object")),g&&function(e,t,n){const s=t.filter((e=>!n.some((t=>t.details.name===e.details.name))));if(s.length>0){const t=new c.DiagnosticAddendum;t.addMessage(y.Localizer.DiagnosticAddendum.typeVarsMissing().format({names:s.map((e=>`"${e.details.name}"`)).join(", ")})),nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeVarsNotInGeneric()+t.getString(),e)}}(e.name,h,g),r.details.typeParameters=g||h;const b=r.details.typeParameters.filter((e=>(0,V.isVariadicTypeVar)(e)));b.length>1&&Xe(y.Localizer.Diagnostic.variadicTypeParamTooManyClass().format({names:b.map((e=>`"${e.details.name}"`)).join(", ")}),e.name,m.TextRange.combine(e.arguments)||e.name),(0,U.computeMroLinearization)(r)||Xe(y.Localizer.Diagnostic.methodOrdering(),e.name);const I=E.getScopeForNode(e.suite);r.details.fields=(null==I?void 0:I.symbolTable)||new Map;const S=null==I?void 0:I.getSlotsNames();if(S&&(r.details.localSlotsNames=S),!s.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,s=t.parameters;if(s.length>1&&!s.some(((e,n)=>!!D.getTypeAnnotationForParameter(t,n)))){const n=s.filter(((e,t)=>t>0&&e.name&&0===e.category));n.length>0&&(r.details.flags|=16384,r.details.typeParameters=n.map((n=>{const s=V.TypeVarType.createInstance(`__type_of_${n.name.value}`);return s.details.isSynthesized=!0,s.scopeId=gt(t),s.details.boundType=V.UnknownType.create(),V.TypeVarType.cloneForScopeId(s,gt(e),e.name.value,0)})))}}}}if(0!==r.details.typeParameters.length||V.ClassType.isBuiltIn(r,"type")||(r.details.baseClasses.some((e=>(0,V.isInstantiableClass)(e)&&V.ClassType.hasCustomClassGetItem(e)))||r.details.fields.has("__class_getitem__"))&&(r.details.flags|=262144),T){const e=Ae(T,v).type;((0,V.isInstantiableClass)(e)||(0,V.isUnknown)(e))&&((0,U.requiresSpecialization)(e)&&nt(s.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.metaclassIsGeneric(),T),r.details.declaredMetaclass=e,(0,V.isInstantiableClass)(e)&&(V.ClassType.isBuiltIn(e,"EnumMeta")?r.details.flags|=1048576:V.ClassType.isBuiltIn(e,"ABCMeta")&&(r.details.flags|=512)))}let F=r.details.declaredMetaclass,x=!1;if(!F||(0,V.isInstantiableClass)(F))for(const t of r.details.baseClasses){if(!(0,V.isInstantiableClass)(t)){F=V.UnknownType.create();break}{const n=t.details.effectiveMetaclass||J;if(!n||!(0,V.isInstantiableClass)(n)){F=n?V.UnknownType.create():void 0;break}F?(0,U.derivesFromClassRecursive)(n,F,!1)?F=n:(0,U.derivesFromClassRecursive)(F,n,!1)||x||(nt(s.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.metaclassConflict(),e.name),x=!0):F=n}}if(!F){const t=$n(e,"type");F=t&&(0,V.isInstantiableClass)(t)?t:V.UnknownType.create()}r.details.effectiveMetaclass=F;let P,A=r,w=!1;for(let t=e.decorators.length-1;t>=0;t--){const n=e.decorators[t],i=Tn(A,r,n);(0,U.containsUnknown)(i)?w||(nt(s.diagnosticRuleSet.reportUntypedClassDecorator,p.DiagnosticRule.reportUntypedClassDecorator,y.Localizer.Diagnostic.classDecoratorTypeUnknown(),e.decorators[t].expression),w=!0):A=i}if((0,V.isInstantiableClass)(F)&&F.details.classDataClassTransform)P=F.details.classDataClassTransform;else{const e=r.details.mro.find((e=>(0,V.isClass)(e)&&void 0!==e.details.classDataClassTransform));e&&(P=e.details.classDataClassTransform)}if(P&&((0,C.applyDataClassDefaultBehaviors)(r,P),(0,C.applyDataClassClassBehaviorOverrides)(As,r,f)),r.details.flags&=-131073,V.ClassType.isTypedDictClass(r)&&(0,O.synthesizeTypedDictClassMethods)(As,e,r,(0,V.isClass)(A)&&V.ClassType.isFinal(A)),V.ClassType.isDataClass(r)){const t=V.ClassType.isSkipSynthesizedDataClassInit(r);let n=t;if(!t){const e=(0,U.lookUpClassMember)(r,"__init__",2);if(e){const t=ls(e);(0,V.isFunction)(t)&&V.FunctionType.isSynthesizedMethod(t)||(n=!0)}}let s=!1;const i=(0,U.lookUpClassMember)(r,"__hash__",2);if(i){const e=ls(i);(0,V.isFunction)(e)&&!V.FunctionType.isSynthesizedMethod(e)&&(s=!0)}(0,C.synthesizeDataClassMethods)(As,e,r,t,n,s)}if(r.details.localSlotsNames){let e=!0;const t=[...r.details.localSlotsNames];r.details.baseClasses.forEach((n=>{(0,V.isInstantiableClass)(n)?V.ClassType.isBuiltIn(n,"object")||V.ClassType.isBuiltIn(n,"type")||V.ClassType.isBuiltIn(n,"Generic")||(void 0===n.details.inheritedSlotsNames?e=!1:(0,o.appendArray)(t,n.details.inheritedSlotsNames)):e=!1})),e&&(r.details.inheritedSlotsNames=t)}return fe(e.name,r,0,!1),fe(e,A,0,!1),function(e,t,n){const s=n.length>0?n[0].node.name:e.name,i=_t(s,t,"__init_subclass__",{method:"get"},void 0,133,t);if(i){const e=i.type;e&&Vt(s,n,{type:e},void 0,!1,V.NoneType.createInstance())}else if(t.details.effectiveMetaclass&&(0,V.isClass)(t.details.effectiveMetaclass)){const i=(0,U.lookUpClassMember)(t.details.effectiveMetaclass,"__new__",32);if(i){const t=ls(i);if((0,V.isFunction)(t)){const i=(0,U.getParameterListDetails)(t);if(void 0!==i.firstKeywordOnlyIndex){const r=new Map;for(let e=i.firstKeywordOnlyIndex;e<i.params.length;e++){const t=i.params[e];0===t.param.category&&t.param.name&&r.set(t.param.name,e)}n.forEach((n=>{var a,o,l;if(0===n.argumentCategory&&n.name){const c=null!==(a=r.get(n.name.value))&&void 0!==a?a:i.kwargsIndex;if(void 0!==c){const e=i.params[c];jt({paramCategory:e.param.category,paramType:V.FunctionType.getEffectiveParameterType(t,e.index),requiresTypeVarMatching:!1,argument:n,errorNode:null!==(o=n.valueExpression)&&void 0!==o?o:s},new z.TypeVarContext,t,!0,!0,!1,void 0),r.delete(n.name.value)}else nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.paramNameMissing().format({name:n.name.value}),null!==(l=n.name)&&void 0!==l?l:s)}}));const a=[];if(r.forEach(((e,t)=>{i.params[e].param.hasDefault||a.push(t)})),a.length>0){const e=a.map((e=>`"${e}"`)).join(", ");nt(_.getFileInfo(s).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,1===a.length?y.Localizer.Diagnostic.argMissingForParam().format({name:e}):y.Localizer.Diagnostic.argMissingForParams().format({names:e}),s)}}}}}n.forEach((e=>{e.valueExpression&&Ae(e.valueExpression)}))}(e,r,f),V.ClassType.isBuiltIn(r,"UnionType")&&(Z=V.ClassType.cloneAsInstance(r)),{classType:r,decoratedType:A}}function Tn(e,t,n){let s=_.getFileInfo(n).isStubFile?4:0;9!==n.expression.nodeType&&(s|=2);const i=Ae(n.expression,s).type;if(9===n.expression.nodeType){const e=Ae(n.expression.leftExpression,2|s).type;(0,V.isFunction)(e)&&("__dataclass_transform__"!==e.details.name&&"dataclass_transform"!==e.details.builtInName||(t.details.classDataClassTransform=(0,C.validateDataClassTransformDecorator)(As,n.expression)))}if((0,V.isOverloadedFunction)(i)){const n=(0,C.getDataclassDecoratorBehaviors)(i);if(n)return(0,C.applyDataClassDecorator)(As,t,n,void 0),e}else if((0,V.isFunction)(i)){if("final"===i.details.builtInName)return t.details.flags|=4096,e;if("runtime_checkable"===i.details.builtInName)return t.details.flags|=32768,e;let r,a;if(9===n.expression.nodeType){a=n.expression;const e=Ae(a.leftExpression,2|s).type;r=(0,C.getDataclassDecoratorBehaviors)(e)}else{const e=Ae(n.expression,s).type;r=(0,C.getDataclassDecoratorBehaviors)(e)}if(r)return(0,C.applyDataClassDecorator)(As,t,r,a),e}return we(n,e)}function _n(e){const t=_.getFileInfo(e),n=ge(e.name,0);if(n){if(!(0,V.isFunction)(n))return;return{functionType:n,decoratedType:ge(e,0)||V.UnknownType.create()}}let s;const i=_.getDeclaration(e);i&&(s=i);const r=D.getEnclosingClass(e,!0);let a;if(r){const e=fn(r);if(!e)return;a=e.classType}let l=Cn(e,!!r);(null==s?void 0:s.isGenerator)&&(l|=16),r&&"__class_getitem__"===e.name.value&&(l|=2),t.isStubFile?l|=2048:t.isInPyTypedPackage&&(l|=4096),e.isAsync&&(l|=512);const d=V.FunctionType.createInstance(e.name.value,function(e,t,n){const s=[n];let i=e;for(;i;)i=D.getEnclosingClassOrFunction(i),i&&s.push(i.name.value);return s.push(t),s.reverse().join(".")}(e,t.moduleName,e.name.value),t.moduleName,l,D.getDocString(e.suite.statements));d.details.typeVarScopeId=gt(e),"__init__"!==e.name.value&&"__new__"!==e.name.value||r&&(d.details.constructorTypeVarScopeId=gt(r)),(t.isBuiltInStubFile||t.isTypingStubFile||t.isTypingExtensionsStubFile)&&(d.details.builtInName=e.name.value),d.details.declaration=s;const u=E.getScopeForNode(e),m=null==u?void 0:u.lookUpSymbolRecursive(e.name.value);s&&m&&Se(m.symbol,s,d),fe(e,d,void 0,!1),fe(e.name,d,void 0,!1);const h=a&&V.ClassType.isPseudoGenericClass(a)&&"__init__"===e.name.value,g=[];let f=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&&Xe(y.Localizer.Diagnostic.annotatedParamCountMismatch().format({expected:t,received:n}),e.functionAnnotationComment)}const v=e=>{if(e.name){const n=Kn(e.name,e.name.value,!1);n&&ut(t,n.symbol,e.name)}};let b=!0;const I=a&&(V.FunctionType.isClassMethod(d)||V.FunctionType.isInstanceMethod(d)||V.FunctionType.isConstructorMethod(d)),C=I?1:0;if(e.parameters.forEach(((n,s)=>{let i,r,o,l,u=!1;if(n.name&&(0===s&&I||V.FunctionType.isAbstractMethod(d)||a&&V.ClassType.isProtocolClass(a))&&v(n),n.typeAnnotation)o=n.typeAnnotation;else if(n.typeAnnotationComment)o=n.typeAnnotationComment;else if(e.functionAnnotationComment&&!e.functionAnnotationComment.isParamListEllipsis){const t=s-T;t>=0&&t<e.functionAnnotationComment.paramTypeAnnotations.length&&(o=e.functionAnnotationComment.paramTypeAnnotations[t])}if(o&&(r=Ee(o,n.category),(0,V.isVariadicTypeVar)(r)&&!r.isVariadicUnpacked&&(Xe(y.Localizer.Diagnostic.unpackedTypeVarTupleExpected().format({name1:r.details.name,name2:r.details.name}),o),r=V.UnknownType.create())),!r&&h&&s>0&&0===n.category&&n.name&&(r=a.details.typeParameters[f],f++),r){const e=vn(n,r);e!==r&&(r=e,u=!0)}if(n.defaultValue&&(l=Ae(n.defaultValue,1,r).type),r){if(n.defaultValue&&l){const s=new c.DiagnosticAddendum,i=new z.TypeVarContext(d.details.typeVarScopeId);if(a&&void 0!==a.details.typeVarScopeId&&("__init__"!==e.name.value&&"__new__"!==e.name.value||i.addSolveForScope(a.details.typeVarScopeId)),!gs(r,l,s,i)){const e=nt(t.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.paramAssignmentMismatch().format({sourceType:Ps(l),paramType:Ps(r)})+s.getString(),n.defaultValue);if(u&&o){const t={action:"pyright.addoptionalforparam",offsetOfTypeNode:o.start+1};e&&e.addAction(t)}}}i=r}if(s>=C){let e=!1;0===n.category&&n.name?(0,N.isPrivateName)(n.name.value)&&(e=!0):b=!1,b&&!e&&d.details.parameters.length>C&&V.FunctionType.addParameter(d,{category:0,type:V.UnknownType.create()}),e||(b=!1)}let m=!1;i||(m=!0,i=bn(e,d.details.flags,s,a));const _={category:n.category,name:n.name?n.name.value:void 0,hasDefault:!!n.defaultValue,defaultValueExpression:n.defaultValue,defaultType:l,type:null!=i?i:V.UnknownType.create(),typeAnnotation:o,hasDeclaredType:!!o,isTypeInferred:m};if(V.FunctionType.addParameter(d,_),n.name){const t=In(e,n.category,_.type);g.push(t)}else g.push(_.type)})),b&&d.details.parameters.length>C&&V.FunctionType.addParameter(d,{category:0,type:V.UnknownType.create()}),g.forEach(((t,n)=>{const s=e.parameters[n].name;s&&((0,V.isUnknown)(t)&&(d.details.flags|=16384),fe(s,t,0,!1))})),g.length>=2){const e=g[g.length-2],t=g[g.length-1];(0,V.isParamSpec)(e)&&"args"===e.paramSpecAccess&&(0,V.isParamSpec)(t)&&"kwargs"===t.paramSpecAccess&&(d.details.flags|=32768)}if(e.returnTypeAnnotation){d.details.declaredReturnType=V.UnknownType.create();const t=ke(e.returnTypeAnnotation,{associateTypeVarsWithScope:!0,disallowRecursiveTypeAlias:!0});d.details.declaredReturnType=t}else if(e.functionAnnotationComment){d.details.declaredReturnType=V.UnknownType.create();const t=ke(e.functionAnnotationComment.returnTypeAnnotation,{associateTypeVarsWithScope:!0,disallowRecursiveTypeAlias:!0});d.details.declaredReturnType=t}else t.isStubFile&&("__init__"===e.name.value?d.details.declaredReturnType=V.NoneType.createInstance():d.details.declaredReturnType=V.UnknownType.create());(t.isStubFile||D.isSuiteEmpty(e.suite))&&d.details.declaredReturnType&&(0,V.isClassInstance)(d.details.declaredReturnType)&&V.ClassType.isBuiltIn(d.details.declaredReturnType,["Generator","AsyncGenerator","AwaitableGenerator"])&&(d.details.flags|=16);const S=e.isAsync?function(e,t){const n=V.FunctionType.clone(t);t.details.declaredReturnType&&(n.details.declaredReturnType=Fn(e,t.details.declaredReturnType,V.FunctionType.isGenerator(t)));return n.details.flags|=1024,n}(e,d):d;let F=S,x=!1;for(let n=e.decorators.length-1;n>=0;n--){const s=e.decorators[n],i=Sn(F,d,s,e);(0,U.containsUnknown)(i)?x||(nt(t.diagnosticRuleSet.reportUntypedFunctionDecorator,p.DiagnosticRule.reportUntypedFunctionDecorator,y.Localizer.Diagnostic.functionDecoratorTypeUnknown(),e.decorators[n].expression),x=!0):F=i}return(0,V.isFunction)(F)&&(V.FunctionType.isOverloaded(F)&&e.parameters.forEach((e=>{v(e)})),F=function(e,t){let n;const s=_.getDeclaration(e);s&&(n=s);const i=Kn(e,e.name.value,!1);if(i){const s=i.symbol.getDeclarations(),r=s.findIndex((e=>e===n));if(r>0){for(let e=0;e<r;e++){const t=s[e];3===t.type&&_n(t.node)}const n=[],i=s[r-1];if(3===i.type){const e=_n(i.node);e&&((0,V.isFunction)(e.decoratedType)?V.FunctionType.isOverloaded(e.decoratedType)&&n.push(e.decoratedType):(0,V.isOverloadedFunction)(e.decoratedType)&&(0,o.appendArray)(n,e.decoratedType.overloads))}if(n.push(t),1===n.length)return n[0];const a=V.OverloadedFunctionType.create(n),l=n[n.length-2];return V.FunctionType.isAbstractMethod(l)!==V.FunctionType.isAbstractMethod(t)&&nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.overloadAbstractMismatch().format({name:e.name.value}),e.name),a}}return t}(e,F)),fe(e.name,d,0,!1),fe(e,F,0,!1),{functionType:d,decoratedType:F}}function vn(e,t){var n;if(11!==(null===(n=e.defaultValue)||void 0===n?void 0:n.nodeType)||26!==e.defaultValue.constType||(0,U.isOptionalType)(t)||_.getFileInfo(e).diagnosticRuleSet.strictParameterNoneValue){if((0,V.isTypeVar)(t)&&e.defaultValue&&1===t.scopeType){const n=Ae(e.defaultValue,1,t).type;(0,V.isAny)(n)||(t=(0,V.combineTypes)([t,n]))}}else t=(0,V.combineTypes)([t,V.NoneType.createInstance()]);return t}function bn(e,t,n,s){var i;if(s){if(0===n&&0==(4&t)){const e=0!=(3&t);return(0,U.synthesizeTypeVarForSelfCls)(s,e)}const r=e.name.value,a=(0,U.lookUpClassMember)(s,r,1);if(a){const t=a.symbol.getDeclarations();if(1===t.length&&3===t[0].type){const s=t[0].node;if(s.parameters.length===e.parameters.length&&s.parameters.every(((t,n)=>{var s,i;const r=e.parameters[n];return(null===(s=r.name)||void 0===s?void 0:s.value)===(null===(i=t.name)||void 0===i?void 0:i.value)&&r.category===t.category}))){const t=s.parameters[n],r=null!==(i=t.typeAnnotation)&&void 0!==i?i:t.typeAnnotationComment;if(r){let t=Ee(r,e.parameters[n].category);const s=_.getFileInfo(e);return s.isInPyTypedPackage&&!s.isStubFile&&(t=V.TypeBase.cloneForAmbiguousType(t)),t}}}}}const r=e.parameters[n].defaultValue;if(r){const t=Ae(r,1).type;let n;if((0,V.isNoneInstance)(t)?n=(0,V.combineTypes)([V.NoneType.createInstance(),V.UnknownType.create()]):(0,V.isClassInstance)(t)&&V.ClassType.isBuiltIn(t,["tuple","list","set","dict"])||(n=(0,U.stripLiteralValue)(t)),n){const t=_.getFileInfo(e);t.isInPyTypedPackage&&!t.isStubFile&&(n=V.TypeBase.cloneForAmbiguousType(n))}return n}}function In(e,t,n){switch(t){case 0:return n;case 1:return(0,V.isTypeVar)(n)&&n.paramSpecAccess?n:(0,V.isUnpackedClass)(n)?V.ClassType.cloneForUnpacked(n,!1):ee&&(0,V.isInstantiableClass)(ee)?V.ClassType.cloneAsInstance((0,U.specializeTupleClass)(ee,[{type:n,isUnbounded:!(0,V.isVariadicTypeVar)(n)}],!0,!0)):V.UnknownType.create();case 2:{if((0,V.isTypeVar)(n)&&n.paramSpecAccess)return n;if((0,V.isClassInstance)(n)&&V.ClassType.isTypedDictClass(n)&&n.isUnpacked)return n;const t=$n(e,"dict"),s=qn(e,"str");return(0,V.isInstantiableClass)(t)&&(0,V.isClassInstance)(s)?V.ClassType.cloneAsInstance(V.ClassType.cloneForSpecialization(t,[s,n],!0)):V.UnknownType.create()}}}function Cn(e,t){const n=_.getFileInfo(e);let s=0;"__new__"===e.name.value&&t&&(s|=1),"__init_subclass__"===e.name.value&&t&&(s|=2);for(const i of e.decorators){let e=n.isStubFile?4:0;9!==i.expression.nodeType&&(e|=2);const r=Ae(i.expression,e).type;(0,V.isFunction)(r)?"abstractmethod"===r.details.builtInName?t&&(s|=8):"final"===r.details.builtInName&&(s|=8192):(0,V.isInstantiableClass)(r)&&(V.ClassType.isBuiltIn(r,"staticmethod")?t&&(s|=4):V.ClassType.isBuiltIn(r,"classmethod")&&t&&(s|=2))}return s}function Sn(e,t,n,s){let i=_.getFileInfo(n).isStubFile?4:0;9!==n.expression.nodeType&&(i|=2);const r=Ae(n.expression,i).type;if(((0,V.isInstantiableClass)(r)&&V.ClassType.isSpecialBuiltIn(r,"overload")||(0,V.isFunction)(r)&&"overload"===r.details.builtInName)&&(0,V.isFunction)(e))return e.details.flags|=256,t.details.flags|=256,e;if(9===n.expression.nodeType){const s=Ae(n.expression.leftExpression,2|i).type;if((0,V.isFunction)(s)&&("__dataclass_transform__"===s.details.name||"dataclass_transform"===s.details.builtInName))return t.details.decoratorDataClassBehaviors=(0,C.validateDataClassTransformDecorator)(As,n.expression),e}let a=we(n,e);if((0,V.isFunction)(r)){if("abstractmethod"===r.details.builtInName)return e;if(35===n.expression.nodeType){const t=Ae(n.expression.leftExpression,2|i).type;if((0,U.isProperty)(t)){const i=n.expression.memberName.value;if("setter"===i)return(0,V.isFunction)(e)?((0,A.validatePropertyMethod)(As,e,n),(0,A.clonePropertyWithSetter)(As,t,e,s)):e;if("deleter"===i)return(0,V.isFunction)(e)?((0,A.validatePropertyMethod)(As,e,n),(0,A.clonePropertyWithDeleter)(As,t,e,s)):e}}}else if((0,V.isInstantiableClass)(r)){if(V.ClassType.isBuiltIn(r))switch(r.details.name){case"classmethod":case"staticmethod":{const t="classmethod"===r.details.name?2:4;if((0,V.isFunction)(e)&&0==(e.details.flags&t)){const n=V.FunctionType.clone(e);return n.details.flags&=-8,n.details.flags|=t,n}return e}}if(V.ClassType.isPropertyClass(r)){if((0,V.isFunction)(e))return(0,A.validatePropertyMethod)(As,e,n),(0,A.createProperty)(As,n,r,e);if((0,V.isClassInstance)(e)){const t=(0,U.lookUpObjectMember)(e,"__call__");if(t){const s=ls(t);if((0,V.isFunction)(s)||(0,V.isOverloadedFunction)(s)){const t=Fs(e,s);if(t&&(0,V.isFunction)(t))return(0,A.createProperty)(As,n,r,t)}}return V.UnknownType.create()}}}return(0,V.isFunction)(e)&&(0,V.isFunction)(a)&&(a=V.FunctionType.clone(a),V.FunctionType.isOverloaded(e)&&(a.details.flags|=256),a.details.docString||(a.details.docString=e.details.docString)),a}function Fn(e,t,n){let s;if((0,V.isClassInstance)(t)&&V.ClassType.isBuiltIn(t))if("Generator"===t.details.name){const n=$e(e,"AsyncGenerator");if(n&&(0,V.isInstantiableClass)(n)){const e=[],i=t.typeArguments;i&&i.length>0&&e.push(i[0]),i&&i.length>1&&e.push(i[1]),s=V.ClassType.cloneAsInstance(V.ClassType.cloneForSpecialization(n,e,!0))}}else["AsyncGenerator","AsyncIterator","AsyncIterable"].some((e=>e===t.details.name))&&(s=t);if(!s||!n){const n=$e(e,"Coroutine");s=n&&(0,V.isInstantiableClass)(n)?V.ClassType.cloneAsInstance(V.ClassType.cloneForSpecialization(n,[V.AnyType.create(),V.AnyType.create(),t],!0)):V.UnknownType.create()}return s}function xn(e,t){var n;if(e.returnTypeAnnotation||(null===(n=e.functionAnnotationComment)||void 0===n?void 0:n.returnTypeAnnotation))return;let s=ge(e.suite,0);if(s)return s;if(!ae.has(e.id)){ae.set(e.id,!0);try{let n;const i=_.getDeclaration(e);i&&(n=i);const r=!Ze(e),a=Ze(e.suite);if(_.getFileInfo(e).isStubFile)s=V.UnknownType.create();else{if(r)s=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=Ae(t.typeExpression).type,n=(0,V.isInstantiableClass)(e)||(0,V.isClassInstance)(e)?e:void 0;if(!n||!V.ClassType.isBuiltIn(n,"NotImplementedError"))return!1}return!0}(n)?V.UnknownType.create():V.NeverType.createNoReturn();else{const e=[];(null==n?void 0:n.returnStatements)&&n.returnStatements.forEach((t=>{if(Ye(t))if(t.returnExpression){const n=Ae(t.returnExpression).type;e.push(null!=n?n:V.UnknownType.create())}else e.push(V.NoneType.createInstance())})),!r&&a&&e.push(V.NoneType.createInstance()),s=(0,V.combineTypes)(e),s=(0,V.removeUnbound)(s)}if(null==n?void 0:n.isGenerator){const t=[];let i=!1;n.yieldStatements&&n.yieldStatements.forEach((e=>{if(Ye(e))if(61===e.nodeType){const n=Ae(e.expression).type;if((0,V.isClassInstance)(n)&&V.ClassType.isBuiltIn(n,"Coroutine"))t.push(),i=!0;else{const s=je(n,!1,e);t.push(null!=s?s:V.UnknownType.create())}}else if(e.expression){const n=Ae(e.expression).type;t.push(null!=n?n:V.UnknownType.create())}else t.push(V.NoneType.createInstance())})),0===t.length&&t.push(V.NoneType.createInstance());const r=(0,V.combineTypes)(t),a=$e(e,i?"AwaitableGenerator":"Generator");if(a&&(0,V.isInstantiableClass)(a)){const e=[];i&&e.push(V.AnyType.create()),e.push(r,V.NoneType.createInstance(),(0,V.isNever)(s)?V.NoneType.createInstance():s),s=V.ClassType.cloneAsInstance(V.ClassType.cloneForSpecialization(a,e,!0))}else s=V.UnknownType.create()}}fe(e.suite,s,0,!1)}finally{ae.delete(e.id)}}return s}function Dn(e){var t;if(ge(e,0))return;const n=Ae(e.iterableExpression),s=null!==(t=je(n.type,!!e.isAsync,e.iterableExpression))&&void 0!==t?t:V.UnknownType.create();pt(e.targetExpression,s,!!n.isIncomplete,e.targetExpression),fe(e,s,0,!!n.isIncomplete)}function Pn(e){if((0,l.assert)(void 0!==e.typeExpression),ge(e,0))return;const t=Ae(e.typeExpression).type;function n(e,t){var n;if(e=lt(e),(0,V.isAnyOrUnknown)(e))return e;if((0,V.isInstantiableClass)(e))return V.ClassType.cloneAsInstance(e);if((0,V.isClassInstance)(e)){const s=null!==(n=je(e,!1,t))&&void 0!==n?n:V.UnknownType.create();return(0,U.mapSubtypes)(s,(e=>(0,V.isAnyOrUnknown)(e)?e:V.UnknownType.create()))}return V.UnknownType.create()}const s=(0,U.mapSubtypes)(t,(t=>{const s=(0,U.getSpecializedTupleType)(t);if(s&&s.tupleTypeArguments){const t=s.tupleTypeArguments.map((t=>n(t.type,e.typeExpression)));return(0,V.combineTypes)(t)}return n(t,e.typeExpression)}));e.name&&pt(e.name,s,!1,e.name),fe(e,s,0,!1)}function An(e){if(ge(e,0))return;const t=Ae(e.expression);let n=t.type;const s=e.parent&&58===e.parent.nodeType&&!!e.parent.isAsync;if((0,U.isOptionalType)(n)){nt(_.getFileInfo(e).diagnosticRuleSet.reportOptionalContextManager,p.DiagnosticRule.reportOptionalContextManager,y.Localizer.Diagnostic.noneNotUsableWith(),e.expression),n=(0,V.removeNoneFromUnion)(n)}const i=s?"__aenter__":"__enter__",r=(0,U.mapSubtypes)(n,(t=>{var n;if(t=lt(t),(0,V.isAnyOrUnknown)(t))return t;const r=new c.DiagnosticAddendum,a=new c.DiagnosticAddendum;if((0,V.isClassInstance)(t)){const o=null===(n=Le(e.expression,t,i,{method:"get"},r))||void 0===n?void 0:n.type;if(o){let t;return t=(0,V.isFunction)(o)?rs(o):V.UnknownType.create(),s&&(t=We(t,e)),t}if(!s){Le(e.expression,t,"__aenter__",{method:"get"},r)&&a.addMessage(y.Localizer.DiagnosticAddendum.asyncHelp())}}return nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeNotUsableWith().format({type:Ps(t),method:i})+a.getString(),e.expression),V.UnknownType.create()})),a=s?"__aexit__":"__exit__";(0,U.doForEachSubtype)(n,(t=>{if(t=lt(t),(0,V.isAnyOrUnknown)(t))return;const n=new c.DiagnosticAddendum;if((0,V.isClassInstance)(t)){if(Le(e.expression,t,a,{method:"get"},n))return}nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeNotUsableWith().format({type:Ps(t),method:a}),e.expression)})),e.target&&pt(e.target,r,!!t.isIncomplete,e.target),fe(e,r,0,!!t.isIncomplete)}function En(e){var t;if(ge(e,0))return;let n;if(n=e.alias?e.alias:e.module.nameParts[0],!n)return;let s=null!==(t=Mn(e,n.value))&&void 0!==t?t:V.UnknownType.create();const i=ge(e,0);i&&(0,V.isModule)(i)&&s&&(0,V.isTypeSame)(s,i)&&(s=i),rt(n,s,!1,!1),fe(e,s,0,!1)}function kn(t){var n;if(ge(t,0))return;const s=t.alias||t.name,i=_.getFileInfo(t);if((null===(n=t.alias)||void 0===n?void 0:n.value)===t.name.value){const e=Kn(t,t.name.value,!0);e&&ut(i,e.symbol,t)}let r=Mn(t,s.value);if(!r){const n=t.parent;(0,l.assert)(n&&22===n.nodeType),(0,l.assert)(!n.isWildcardImport);const s=_.getImportInfo(n.module);if(s&&s.isImportFound&&!s.isNativeLib){const n=s.resolvedPaths[s.resolvedPaths.length-1],a=e(n);let o=!1;if(a){if(o=!0,i.executionEnvironment.pythonVersion>=u.PythonVersion.V3_7||i.isStubFile){const e=a.symbolTable.get("__getattr__");if(e){const t=ts(e);(0,V.isFunction)(t)&&(r=rs(t),o=!1)}}}else n||(o=!0);o&&nt(i.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.importSymbolUnknown().format({name:t.name.value}),t.name)}r||(r=V.UnknownType.create())}rt(s,r,!1,!1),fe(t,r,0,!1)}function wn(e){if(ge(e,0))return;if(!e.parent||63!==e.parent.nodeType)return void(0,l.fail)("Expected parent of case statement to be match statement");const t=Ae(e.parent.subjectExpression);let n=t.type;for(const t of e.parent.cases){if(t===e)break;t.guardExpression||(n=(0,P.narrowTypeBasedOnPattern)(As,n,t.pattern,!1))}let s=!1;(0,U.doForEachSubtype)(lt(n),(e=>{(0,V.isClassInstance)(e)&&V.ClassType.isBuiltIn(e,"object")&&(s=!0)})),n=(0,P.narrowTypeBasedOnPattern)(As,n,e.pattern,!0),(0,P.assignTypeToPatternTargets)(As,n,!!t.isIncomplete,s,e.pattern),fe(e,n,0,!!t.isIncomplete)}function Nn(e){var t;if(ge(e,0))return;const n=e.module.nameParts[0];let s=null!==(t=Mn(e,n.value))&&void 0!==t?t:V.UnknownType.create();const i=ge(e,0);i&&(0,V.isModule)(i)&&s&&(0,V.isTypeSame)(s,i)&&(s=i),rt(n,s,!1,!1),fe(e,s,0,!1)}function Mn(e,n){const s=Kn(e,n,!0);if(!s)return;const i=s.symbol.getDeclarations().filter((t=>D.isNodeContainedWithin(e,t.node)&&6===t.type));let r=i.length>0?i[i.length-1]:void 0;if(r||(r=s.symbol.getDeclarations().find((e=>6===e.type))),!r)return;(0,l.assert)(6===r.type);const a=_.getFileInfo(e),o=es(r,!0,a.isStubFile);if(o){if(!o.declaration)return t.evaluateUnknownImportsAsAny?V.AnyType.create():V.UnknownType.create();if(23===e.nodeType&&(o.isPrivate&&nt(a.diagnosticRuleSet.reportPrivateUsage,p.DiagnosticRule.reportPrivateUsage,y.Localizer.Diagnostic.privateUsedOutsideOfModule().format({name:e.name.value}),e.name),o.privatePyTypedImporter)){const t=new c.DiagnosticAddendum;o.privatePyTypedImported&&t.addMessage(y.Localizer.DiagnosticAddendum.privateImportFromPyTypedSource().format({module:o.privatePyTypedImported})),nt(a.diagnosticRuleSet.reportPrivateImportUsage,p.DiagnosticRule.reportPrivateImportUsage,y.Localizer.Diagnostic.privateImportFromPyTypedModule().format({name:e.name.value,module:o.privatePyTypedImporter})+t.getString(),e.name)}return Jn(s.symbol,r)}}function Rn(e){var t,n,s;let i=e,r=e;function a(e){var t,n,s,i,r;return 41===e.nodeType&&30===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)||(1===e.nodeType&&(9===(null===(n=e.parent)||void 0===n?void 0:n.nodeType)||24===(null===(s=e.parent)||void 0===s?void 0:s.nodeType))||(54===(null===(i=e.parent)||void 0===i?void 0:i.nodeType)||(41===(null===(r=e.parent)||void 0===r?void 0:r.nodeType)&&(e===e.parent.typeAnnotation||e===e.parent.typeAnnotationComment)||(9===e.nodeType||24===e.nodeType||15===e.nodeType||27===e.nodeType||31===e.nodeType||30===e.nodeType||35===e.nodeType||45===e.nodeType||49===e.nodeType||48===e.nodeType||52===e.nodeType||56===e.nodeType||17===e.nodeType||16===e.nodeType||32===e.nodeType||33===e.nodeType||34===e.nodeType||65===e.nodeType||67===e.nodeType||68===e.nodeType||74===e.nodeType||66===e.nodeType||69===e.nodeType||70===e.nodeType||73===e.nodeType||71===e.nodeType||72===e.nodeType))))}if(38===e.nodeType&&e.parent){if(28===e.parent.nodeType&&e.parent.name===e)return void _n(e.parent);if(10===e.parent.nodeType&&e.parent.name===e)return void fn(e.parent);if(29===e.parent.nodeType||39===e.parent.nodeType)return void Ae(e,4)}for(;r;){const e=a(r);if(!e&&!(0,h.isExpressionNode)(r))break;e&&(i=r),r=r.parent}const o=i.parent;if(3===o.nodeType)return void(i===o.typeAnnotationComment?ke(i,{isVariableAnnotation:!0,allowFinal:D.isFinalAllowedForAssignmentTarget(o.leftExpression),allowClassVar:D.isClassVarAllowedForAssignmentTarget(o.leftExpression)}):hn(o));if(14===o.nodeType)return void dt(i);if(5===o.nodeType)return void gn(o);if(13===o.nodeType)return void(10===(null===(t=o.parent)||void 0===t?void 0:t.nodeType)?fn(o.parent):28===(null===(n=o.parent)||void 0===n?void 0:n.nodeType)&&_n(o.parent));const l=e=>{const t=e.parent;if(3===(null==t?void 0:t.nodeType)&&t.leftExpression===o)hn(t);else{const t=ke(e.typeAnnotation,{isVariableAnnotation:!0,allowFinal:D.isFinalAllowedForAssignmentTarget(e.valueExpression),allowClassVar:D.isClassVarAllowedForAssignmentTarget(e.valueExpression)});fe(e.valueExpression,t,0,!1)}};if(64===o.nodeType&&i!==o.guardExpression)return void wn(o);if(54===o.nodeType)return void l(o);if(41===o.nodeType&&i!==o.defaultValue)return void On(o);if(28===o.nodeType&&i===o.returnTypeAnnotation)return void ke(i,{associateTypeVarsWithScope:!0,disallowRecursiveTypeAlias:!0});if(37===o.nodeType)return;if(1===o.nodeType&&i===o.name)return;if(1===o.nodeType&&10===(null===(s=o.parent)||void 0===s?void 0:s.nodeType))return void fn(o.parent);if(44===o.nodeType&&o.returnExpression){const t=D.getEnclosingFunction(e),n=t?os(t):void 0;return void Ae(o.returnExpression,0,n)}const c=(0,h.isExpressionNode)(o)&&0!==o.nodeType?o:i;if(54===c.nodeType)l(c);else{Ae(c,_.getFileInfo(c).isStubFile?4:0)}}function On(e){if(!e.name)return;const t=e.parent;if(30===t.nodeType)return void Rn(t);(0,l.assert)(28===t.nodeType);const n=t,s=n.parameters.findIndex((t=>t===e)),i=D.getTypeAnnotationForParameter(n,s);if(i){const t=n.parameters[s],r=Ee(i,n.parameters[s].category),a=In(e,e.category,vn(t,r));return void fe(e.name,a,0,!1)}const r=D.getEnclosingClass(n,!0);if(r){const t=fn(r);if(t){const i=bn(n,Cn(n,!0),s,t.classType);if(i)return void fe(e.name,In(e,e.category,i),0,!1)}}fe(e.name,In(e,e.category,V.UnknownType.create()),0,!1)}function Ln(e){Pe(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 hn(t);break;case 4:return void Ae(t);case 5:return void gn(t);case 10:return void fn(t);case 41:return void On(t);case 30:return void Rn(t);case 28:return void _n(t);case 26:return void Dn(t);case 25:return void Pn(t);case 59:return void An(t);case 33:{const e=t.parent;if((0,l.assert)(32===e.nodeType),t===e.expression)Rn(e);else for(const n of e.forIfNodes)if(an(n),n===t)break;return}case 21:return void En(t);case 23:return void kn(t);case 22:return void Nn(t);case 64:return void wn(t)}t=t.parent}(0,l.fail)("Unexpected statement")}function Vn(e,t){let n=ge(e,void 0);if(n)return{node:e,type:n};const s=re;try{if(re||(re=new Map),t(),n=ge(e,void 0),n)return{node:e,type:n};if(n=re.get(e.id),n)return{node:e,type:n,isIncomplete:!0};re=s}catch(e){throw re=s,e}}function Un(e){let t=oe.get(e);return t||(t=Es.createCodeFlowAnalyzer(),oe.set(e,t)),t}function zn(e,t,n,s,i){var r;const a=(0,b.createKeyForReference)(e),o=D.getExecutionScopeNode(null!==(r=null==i?void 0:i.parent)&&void 0!==r?r:e),c=_.getCodeFlowExpressions(o);if(!c||!c.has(a))return{type:void 0,isIncomplete:!1};if(He(e))return{type:void 0,isIncomplete:!0};let p;p=ve(o)?function(){const e=ue.length;return(0,l.assert)(e>0),ue[e-1].codeFlowAnalyzer}():Un(o.id);const d=_.getFlowNode(null!=i?i:e);return void 0===d?{type:void 0,isIncomplete:!1}:p.getTypeFromCodeFlow(d,e,t,n,s)}function Bn(e,t,n,s){if(V.ClassType.isSpecialBuiltIn(e)){const i=e.aliasName||e.details.name;switch(i){case"Callable":return function(e,t){const n=V.FunctionType.createInstantiable(0);V.TypeBase.setSpecialForm(n),n.details.declaredReturnType=V.UnknownType.create();const s=D.getEnclosingClassOrFunction(t);if(n.details.typeVarScopeId=s?gt(s):V.WildcardTypeVarScopeId,e&&e.length>0){if(e[0].typeList){const t=e[0].typeList;let s=!1,i=!1;const r=e=>{s&&(i||(Xe(y.Localizer.Diagnostic.variadicTypeArgsTooMany(),e.node),i=!0)),s=!0};t.forEach(((e,t)=>{let s=e.type,i=0;const a=`__p${t.toString()}`;(0,V.isVariadicTypeVar)(s)?(bt(s,e.node),i=1,r(e)):ln(e,{allowUnpackedTuples:!0})?(0,V.isUnpackedClass)(s)&&(i=1,r(e)):s=V.UnknownType.create(),V.FunctionType.addParameter(n,{category:i,name:a,isNameSynthesized:!0,type:(0,U.convertToInstance)(s),hasDeclaredType:!0})})),V.FunctionType.addParameter(n,{category:0,isNameSynthesized:!1,type:V.UnknownType.create()})}else if((0,U.isEllipsisType)(e[0].type))V.FunctionType.addDefaultParameters(n),n.details.flags|=32768;else if((0,V.isParamSpec)(e[0].type))n.details.paramSpec=e[0].type;else if((0,V.isInstantiableClass)(e[0].type)&&V.ClassType.isBuiltIn(e[0].type,"Concatenate")){const t=e[0].type.typeArguments;t&&t.length>0&&t.forEach(((e,s)=>{s===t.length-1?(V.FunctionType.addParameter(n,{category:0,isNameSynthesized:!1,type:V.UnknownType.create()}),(0,V.isParamSpec)(e)&&(n.details.paramSpec=e)):V.FunctionType.addParameter(n,{category:0,name:`__p${s}`,isNameSynthesized:!0,hasDeclaredType:!0,type:e})}))}else Xe(y.Localizer.Diagnostic.callableFirstArg(),e[0].node);if(e.length>1){let t=e[1].type;ln(e[1])||(t=V.UnknownType.create()),n.details.declaredReturnType=(0,U.convertToInstance)(t)}else nt(_.getFileInfo(t).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.callableSecondArg(),t),n.details.declaredReturnType=V.UnknownType.create();e.length>2&&Xe(y.Localizer.Diagnostic.callableExtraArgs(),e[2].node)}else V.FunctionType.addDefaultParameters(n,!0),n.details.flags|=32768;return n}(t,s);case"Never":return t&&t.length>0&&Xe(y.Localizer.Diagnostic.typeArgsExpectingNone().format({name:"Never"}),t[0].node),V.NeverType.createNever();case"NoReturn":return t&&t.length>0&&Xe(y.Localizer.Diagnostic.typeArgsExpectingNone().format({name:"NoReturn"}),t[0].node),V.NeverType.createNoReturn();case"Optional":return function(e,t,n,s){if(!n)return 0!=(1024&s)?(Xe(y.Localizer.Diagnostic.optionalExtraArgs(),t),V.UnknownType.create()):e;if(n.length>1)return Xe(y.Localizer.Diagnostic.optionalExtraArgs(),t),V.UnknownType.create();let i=n[0].type;ln(n[0])?V.TypeBase.isInstantiable(i)||(it(i,n[0].node),i=V.UnknownType.create()):i=V.UnknownType.create();const r=(0,V.combineTypes)([i,V.NoneType.createType()]);return(0,V.isUnion)(r)&&V.TypeBase.setSpecialForm(r),r}(e,s,t,n);case"Type":{if(1===(null==t?void 0:t.length)&&(0,V.isAnyOrUnknown)(t[0].type)&&J&&(0,V.isInstantiableClass)(J))return J;let n=dn(e,t,1);return(0,V.isInstantiableClass)(n)&&(n=(0,U.explodeGenericClass)(n)),n}case"ClassVar":return function(e,t,n,s){var i;if(131072&s)return Xe(y.Localizer.Diagnostic.classVarNotAllowed(),t),V.AnyType.create();if(!n)return e;if(0===n.length)return Xe(y.Localizer.Diagnostic.classVarFirstArgMissing(),t),V.UnknownType.create();if(n.length>1)return Xe(y.Localizer.Diagnostic.classVarTooManyArgs(),n[1].node),V.UnknownType.create();const r=n[0].type;(0,U.requiresSpecialization)(r,!0,!0)&&nt(_.getFileInfo(t).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.classVarWithTypeVar(),null!==(i=n[0].node)&&void 0!==i?i:t);return r}(e,s,t,n);case"Protocol":return dn(e,t,void 0,!0);case"Tuple":return dn(e,t,void 0);case"Union":return function(e,t,n,s){const i=[];if(!n)return 0!=(1024&s)?(Xe(y.Localizer.Diagnostic.unionTypeArgCount(),t),V.NeverType.createNever()):e;for(const e of n){let t=e.type;ln(e,{allowVariadicTypeVar:!0,allowUnpackedTuples:!0})?V.TypeBase.isInstantiable(t)||(it(t,e.node),t=V.UnknownType.create()):t=V.UnknownType.create(),(0,V.isUnpackedClass)(e.type)&&e.type.tupleTypeArguments?e.type.tupleTypeArguments.forEach((e=>{i.push((0,U.convertToInstantiable)(e.type))})):((0,V.isTypeVar)(t)&&(0,V.isVariadicTypeVar)(t)&&t.isVariadicUnpacked&&(t=V.TypeVarType.cloneForUnpacked(t,!0)),i.push(t))}1===i.length&&((0,V.isVariadicTypeVar)(i[0])||(0,V.isUnpacked)(i[0])||(0,V.isNoneInstance)(i[0])||Xe(y.Localizer.Diagnostic.unionTypeArgCount(),t));const r=(0,V.combineTypes)(i);return(0,V.isUnion)(r)&&V.TypeBase.setSpecialForm(r),r}(e,s,t,n);case"Generic":return function(e,t,n,s){if(!n)return 0!=(263168&s)&&Xe(y.Localizer.Diagnostic.genericTypeArgMissing(),t),e;const i=[];return n&&(0===n.length&&Xe(y.Localizer.Diagnostic.genericTypeArgMissing(),t),n.forEach((e=>{(0,V.isTypeVar)(e.type)?(i.some((t=>(0,V.isTypeSame)(t,e.type)))&&Xe(y.Localizer.Diagnostic.genericTypeArgUnique(),e.node),i.push(e.type)):Xe(y.Localizer.Diagnostic.genericTypeArgTypeVar(),e.node)}))),dn(e,n,void 0,!0)}(e,s,t,n);case"Final":return function(e,t,n,s){return 16&s?(Xe(y.Localizer.Diagnostic.finalContext(),t),V.AnyType.create()):n&&0!==n.length?(n.length>1&&Xe(y.Localizer.Diagnostic.finalTooManyArgs(),t),n[0].type):e}(e,s,t,n);case"Annotated":return function(e,t){return t&&t.length<2&&Xe(y.Localizer.Diagnostic.annotatedTypeArgMissing(),e),t&&0!==t.length?V.TypeBase.cloneForAnnotated(t[0].type):V.AnyType.create()}(s,t);case"Concatenate":return function(e,t,n){return n&&0!==n.length?n.forEach(((e,t)=>{t===n.length-1?(0,V.isParamSpec)(e.type)||Xe(y.Localizer.Diagnostic.concatenateParamSpecMissing(),e.node):(0,V.isParamSpec)(e.type)&&Xe(y.Localizer.Diagnostic.paramSpecContext(),e.node)})):Xe(y.Localizer.Diagnostic.concatenateTypeArgsMissing(),e),dn(t,n,void 0,!0)}(s,e,t);case"TypeGuard":case"StrictTypeGuard":return function(e,t,n,s){if(!n)return 0!=(1024&s)&&Xe(y.Localizer.Diagnostic.typeGuardArgCount(),e),t;if(1!==n.length)return Xe(y.Localizer.Diagnostic.typeGuardArgCount(),e),V.UnknownType.create();const i=n.map((e=>(0,U.convertToInstance)(ln(e)?e.type:V.UnknownType.create())));return V.ClassType.cloneForSpecialization(t,i,!0)}(s,e,t,n);case"Unpack":return function(e,t,n){if(!t||1!==t.length)return Xe(y.Localizer.Diagnostic.unpackArgCount(),e),V.UnknownType.create();let s=t[0].type;(0,V.isUnion)(s)&&1===s.subtypes.length&&(s=s.subtypes[0]);const i=_.getFileInfo(e);return 0!=(2097152&n)?(0,V.isInstantiableClass)(s)&&!s.includeSubclasses&&(0,U.isTupleClass)(s)?V.ClassType.cloneForUnpacked(s):(0,V.isVariadicTypeVar)(s)&&!s.isVariadicUnpacked?V.TypeVarType.cloneForUnpacked(s):(nt(i.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.unpackExpectedTypeVarTuple(),e),V.UnknownType.create()):0!=(8388608&n)?(0,V.isInstantiableClass)(s)&&V.ClassType.isTypedDictClass(s)?V.ClassType.cloneForUnpacked(s):(nt(i.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.unpackExpectedTypedDict(),e),V.UnknownType.create()):(nt(i.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.unpackNotAllowed(),e),V.UnknownType.create())}(s,t,n);case"Required":case"NotRequired":return function(e,t,n,s,i){var r;if(!s&&0==(1024&i))return e;if(!s||1!==s.length)return Xe(n?y.Localizer.Diagnostic.requiredArgCount():y.Localizer.Diagnostic.notRequiredArgCount(),t),e;const a=s[0].type,o=D.getEnclosingClass(t,!0),l=o?fn(o):void 0;let c=!1;return l&&(0,V.isInstantiableClass)(l.classType)&&V.ClassType.isTypedDictClass(l.classType)&&54===(null===(r=t.parent)||void 0===r?void 0:r.nodeType)&&t.parent.typeAnnotation===t&&(c=!0),0!=(1048576&i)&&(c=!0),c?a:(Xe(n?y.Localizer.Diagnostic.requiredNotInTypedDict():y.Localizer.Diagnostic.notRequiredNotInTypedDict(),t),V.ClassType.cloneForSpecialization(e,[(0,U.convertToInstance)(a)],!!s))}(e,s,"Required"===i,t,n);case"Self":return function(e,t,n){var s;const i=_.getFileInfo(t);n&&nt(i.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeArgsExpectingNone().format({name:e.details.name}),null!==(s=n[0].node)&&void 0!==s?s:t);const r=D.getEnclosingClass(t),a=r?fn(r):void 0;if(!a)return nt(i.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.selfTypeContext(),t),V.UnknownType.create();const o=D.getEnclosingFunction(t);if(o){const e=Cn(o,!0);if(!D.getEnclosingFunction(o)){if(4&e)return nt(i.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.selfTypeContext(),t),V.UnknownType.create();if(o.parameters.length>0){const e=D.getTypeAnnotationForParameter(o,0);if(e&&!D.isNodeContainedWithin(t,e)){const n=ke(e,{associateTypeVarsWithScope:!0,disallowRecursiveTypeAlias:!0});(0,V.isTypeVar)(n)&&n.details.isSynthesizedSelf||nt(i.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.selfTypeWithTypedSelfOrCls(),t)}}}}return(0,U.synthesizeTypeVarForSelfCls)(a.classType,!0)}(e,s,t);case"LiteralString":return dn(e,t,0)}}const i=_.getFileInfo(s);if(i.isStubFile||i.executionEnvironment.pythonVersion>=u.PythonVersion.V3_9||(0,T.isAnnotationEvaluationPostponed)(_.getFileInfo(s))||0!=(4&n)){if(V.ClassType.isBuiltIn(e,"type")&&t){if(1===t.length&&(0,V.isAnyOrUnknown)(t[0].type))return e;const n=$e(s,"Type");if(n&&(0,V.isInstantiableClass)(n)){let e=dn(n,t,1,void 0,!0);return(0,V.isInstantiableClass)(e)&&(e=(0,U.explodeGenericClass)(e)),e}}if((0,U.isTupleClass)(e))return dn(e,t,void 0,void 0,!0)}let r=t?t.length:0;const a=V.ClassType.isPseudoGenericClass(e)?[]:V.ClassType.getTypeParameters(e);if(0===a.length&&0===r)return e;const o=a.findIndex((e=>(0,V.isVariadicTypeVar)(e)));if(t){if(r>a.length){if(!V.ClassType.isPartiallyConstructed(e)&&!V.ClassType.isTupleClass(e)){const n=_.getFileInfo(s);0===a.length?nt(n.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeArgsExpectingNone().format({name:e.aliasName||e.details.name}),t[a.length].node):1===a.length&&(0,V.isParamSpec)(a[0])||nt(n.diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeArgsTooMany().format({name:e.aliasName||e.details.name,expected:a.length,received:r}),t[a.length].node)}r=a.length}else if(r<a.length){nt(_.getFileInfo(s).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeArgsTooFew().format({name:e.aliasName||e.details.name,expected:a.length,received:r}),t.length>0?t[0].node.parent:s)}t.forEach(((e,t)=>{if(t===o){if((0,V.isClassInstance)(e.type)&&(0,U.isTupleClass)(e.type))return;if((0,V.isVariadicTypeVar)(e.type))return void bt(e.type,e.node)}const n=t<a.length?a[t]:void 0;ln(e,{allowParamSpec:!0,allowTypeArgList:null==n?void 0:n.details.isParamSpec})}))}let l=[];const d=V.ClassType.getTypeParameters(e);if(1===d.length&&d[0].details.isParamSpec&&t)if(t.every((e=>!(0,U.isEllipsisType)(e.type)&&!e.typeList&&!(0,V.isParamSpec)(e.type))))1===t.length&&(0,V.isInstantiableClass)(t[0].type)&&V.ClassType.isBuiltIn(t[0].type,"Concatenate")||(t=[{type:V.UnknownType.create(),node:t[0].node,typeList:t}]);else if(t.length>1){const e=t.find((e=>(0,V.isParamSpec)(e.type)));e&&Xe(y.Localizer.Diagnostic.paramSpecContext(),e.node);const n=t.find((e=>!!e.typeList));n&&Xe(y.Localizer.Diagnostic.typeArgListNotAllowed(),n.node)}d.forEach(((e,n)=>{if(t&&n<t.length){if(e.details.isParamSpec){const e=t[n],s=V.FunctionType.createInstantiable(65536);if(V.TypeBase.setSpecialForm(s),(0,U.isEllipsisType)(e.type))return V.FunctionType.addDefaultParameters(s),s.details.flags|=32768,void l.push(s);if(e.typeList)return e.typeList.forEach(((e,t)=>{V.FunctionType.addParameter(s,{category:0,name:`__p${t}`,isNameSynthesized:!0,type:(0,U.convertToInstance)(e.type),hasDeclaredType:!0})})),void l.push(s);if((0,V.isInstantiableClass)(e.type)&&V.ClassType.isBuiltIn(e.type,"Concatenate")){const t=e.type.typeArguments;return t&&t.length>0&&t.forEach(((e,n)=>{n===t.length-1?(0,V.isParamSpec)(e)&&(s.details.paramSpec=e):V.FunctionType.addParameter(s,{category:0,name:`__p${n}`,isNameSynthesized:!0,hasDeclaredType:!0,type:e})})),void l.push(s)}}l.push((0,U.convertToInstance)(t[n].type))}else l.push(V.UnknownType.create())})),l=l.map(((e,n)=>{if(n<r){const s=new c.DiagnosticAddendum,i=function(e,t,n,s=0,i=0){if(i>V.maxTypeRecursionCount)return t;if(i++,(0,V.isAnyOrUnknown)(t))return t;let r=t;if((0,V.isTypeVar)(t)){if((0,V.isTypeSame)(t,e,void 0,void 0,i))return t;r=lt(t)}if(e.details.boundType&&!gs(e.details.boundType,r,n.createAddendum(),void 0,s,i))return void(e.details.isSynthesized||n.addMessage(y.Localizer.DiagnosticAddendum.typeBound().format({sourceType:Ps(r),destType:Ps(e.details.boundType),name:V.TypeVarType.getReadableName(e)})));if(e.details.isParamSpec)return(0,V.isParamSpec)(t)||(0,V.isFunction)(t)&&V.FunctionType.isParamSpecValue(t)||(0,V.isClassInstance)(t)&&V.ClassType.isBuiltIn(t,"Concatenate")?t:void n.addMessage(y.Localizer.DiagnosticAddendum.typeParamSpec().format({type:Ps(t),name:V.TypeVarType.getReadableName(e)}));if((0,V.isTypeVar)(t)&&t.details.isParamSpec)return void n.addMessage(y.Localizer.Diagnostic.paramSpecContext());const a=e.details.constraints;if(0===a.length)return t;if((0,V.isTypeVar)(t)&&t.details.constraints.length>0){if(t.details.constraints.every((e=>a.some((t=>gs(t,e,void 0,void 0,void 0,i))))))return t}else{let e;for(const t of a)gs(t,r,void 0,void 0,void 0,i)&&(e&&!gs(e,t,void 0,void 0,void 0,i)||(e=t));if(e)return e}return void n.addMessage(y.Localizer.DiagnosticAddendum.typeConstrainedTypeVar().format({type:Ps(t),name:V.TypeVarType.getReadableName(e)}))}(a[n],e,s);if(i)e=i;else if(!(0,V.isClassInstance)(e)||!V.ClassType.isPartiallyConstructed(e)){nt(_.getFileInfo(t[n].node).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.typeVarAssignmentMismatch().format({type:Ps(e),name:V.TypeVarType.getReadableName(a[n])})+s.getString(),t[n].node)}}return e}));return V.ClassType.cloneForSpecialization(e,l,void 0!==t)}function Wn(e){return e.type?{type:e.type}:e.valueExpression?Ae(e.valueExpression):{type:V.UnknownType.create()}}function jn(e){return e.type?{type:e.type}:Gn(e.valueExpression)}function Gn(e,t=!1,n=!1){let s=131304;return _.getFileInfo(e).isStubFile?s|=4:s|=4194304,t||(s|=16),n&&(s|=1048576),Ae(e,s)}function $n(e,t){const n=E.getScopeForNode(e);if(n){const e=E.getBuiltInScope(n).lookUpSymbol(t);if(e)return ts(e)}return V.UnknownType.create()}function qn(e,t,n){const s=$n(e,t);if((0,V.isInstantiableClass)(s)){let e=s;return n&&(e=V.ClassType.cloneForSpecialization(e,n,void 0!==n)),V.ClassType.cloneAsInstance(e)}return s}function Kn(e,t,n,s=!1){var i;const r=E.getScopeForNode(e);let a=null==r?void 0:r.lookUpSymbolRecursive(t);const o=null!==(i=null==r?void 0:r.type)&&void 0!==i?i:3;if(a&&n&&(1!==o&&0!==o)){0===a.symbol.getDeclarations().filter((t=>{if(6!==t.type&&0!==t.type){const n=D.getExecutionScopeNode(e),s=4===t.type||3===t.type?t.node.name:t.node;if(n===D.getExecutionScopeNode(s)&&!Qe(s,e)){const t=_.getFlowNode(e);return!(t&&Es.isFlowNodeReachable(t))}}return!0})).length&&(a=1!==a.scope.type&&a.scope.parent?a.scope.parent.lookUpSymbolRecursive(t,a.isOutsideCallerModule||3===a.scope.type,a.isBeyondExecutionScope||a.scope.isIndependentlyExecutable()):void 0)}if(a&&s){let e=a;for(;3!==e.scope.type&&4!==e.scope.type&&e.scope.parent&&(e=e.scope.parent.lookUpSymbolRecursive(t,e.isOutsideCallerModule,e.isBeyondExecutionScope||e.scope.isIndependentlyExecutable()),e););3!==(null==e?void 0:e.scope.type)&&4!==(null==e?void 0:e.scope.type)||(a=e)}return a}function Hn(e,t){q.push(e);try{const e=t();return q.pop(),e}catch(e){throw q.pop(),e}}function Yn(e,t,n=!0){r.enterSpeculativeContext(e,n);try{const e=t();return r.leaveSpeculativeContext(),e}catch(e){throw r.leaveSpeculativeContext(),e}}function Zn(e,t){if((0,V.isFunction)(e)&&e.details.declaration){const n=e.details.declaration;if(3===n.type){const e=n.node,s=_.getScope(e);if(s){const e=s.lookUpSymbol(t);if(e)return e.getDeclarations().find((e=>2===e.type))}}}}function Qn(e){var t,n;switch(e.type){case 0:{if("Any"===e.intrinsicType)return V.AnyType.create();if("class"===e.intrinsicType){const t=fn(D.getEnclosingClass(e.node));return t?t.classType:void 0}const t=qn(e.node,"str"),n=qn(e.node,"int");if((0,V.isClassInstance)(n)&&(0,V.isClassInstance)(t)){if("str"===e.intrinsicType)return t;if("str | None"===e.intrinsicType)return(0,V.combineTypes)([t,V.NoneType.createInstance()]);if("int"===e.intrinsicType)return n;if("Iterable[str]"===e.intrinsicType){const n=$n(e.node,"Iterable");if((0,V.isInstantiableClass)(n))return V.ClassType.cloneAsInstance(V.ClassType.cloneForSpecialization(n,[t],!0))}if("Dict[str, Any]"===e.intrinsicType){const n=$n(e.node,"dict");if((0,V.isInstantiableClass)(n))return V.ClassType.cloneAsInstance(V.ClassType.cloneForSpecialization(n,[t,V.AnyType.create()],!0))}}return V.UnknownType.create()}case 4:{const t=fn(e.node);return t?t.decoratedType:void 0}case 5:return ke(e.node.typeAnnotation);case 3:{const t=_n(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 s=t.parameters.findIndex((t=>t===e.node));n=D.getTypeAnnotationForParameter(t,s)}}if(n){const t=Ee(n,e.node.category);return In(e.node,e.node.category,vn(e.node,t))}return}case 1:{const t=e.typeAnnotationNode;if(t){const s=ze(t)?D.getTypeAnnotationNode(t):void 0;let i;if(e.isRuntimeTypeExpression)i=(0,U.convertToInstance)(Gn(t,!0,!0).type);else{const s=e.isDefinedByMemberAccess&&35===(null===(n=e.node.parent)||void 0===n?void 0:n.nodeType)?e.node.parent:e.node;i=ke(t,{isVariableAnnotation:!0,allowClassVar:D.isClassVarAllowedForAssignmentTarget(s),allowFinal:D.isFinalAllowedForAssignmentTarget(s)})}if(i)return 38===e.node.nodeType&&(i=un(e.node,(()=>i))||i),s&&38===s.valueExpression.nodeType&&(i=mn(i,s.valueExpression,e.node)),i}return}case 6:return}}function Jn(n,s){var i,r;const a=Xn(s,!0,_.getFileInfo(s.node).isStubFile);if(!a)return t.evaluateUnknownImportsAsAny?V.AnyType.create():V.UnknownType.create();function o(e,n,s){if(n.path&&n.loadSymbolsFromPath){const i=s(n.path);if(!i)return t.evaluateUnknownImportsAsAny?V.AnyType.create():V.UnknownType.create();e.fields=i.symbolTable,e.docString=i.docString}return n.implicitImports&&n.implicitImports.forEach(((t,n)=>{let i;if(t.isUnresolved)i=V.UnknownType.create();else{const r=e.moduleName?e.moduleName+"."+n:"";i=o(V.ModuleType.create(r,t.path),t,s)}const r=w.Symbol.createWithType(0,i);e.loaderFields.set(n,r)})),e}if(6===a.type){let t=a.moduleName;if(6===s.type&&(s.symbolName&&(t+="."+s.symbolName),t.startsWith("."))){const e=_.getFileInfo(s.node).moduleName.split(".");for(t=t.substr(1);t.startsWith(".")&&e.length>0;)t=t.substr(1),e.pop();t=e.join(".")+"."+t}const n=V.ModuleType.create(t,a.path);return a.symbolName&&a.submoduleFallback?o(n,a.submoduleFallback,e):o(n,a,e)}const l=Qn(a);if(l)return l;const c=_.getFileInfo(a.node);let p=!c.isInPyTypedPackage||c.isStubFile;if(!p&&1===a.type){const e=D.getEnclosingClass(a.node,!0);if(e){const t=fn(e);t&&V.ClassType.isEnumClass(t.classType)&&(p=!0)}(a.isFinal||a.isConstant)&&(p=!0)}if(2===a.type)return null===(i=Vn(a.node.name,(()=>{On(a.node)})))||void 0===i?void 0:i.type;if(1===a.type&&a.inferredTypeSource){const e=a.typeAliasName&&a.inferredTypeSource.parent?a.inferredTypeSource.parent:a.inferredTypeSource;let t=null===(r=Vn(a.node,(()=>{Ln(e)})))||void 0===r?void 0:r.type;if(t&&38===a.node.nodeType){const e=un(a.node,(()=>{var e,t;return null!==(t=null===(e=Vn(a.inferredTypeSource,(()=>{Ln(a.inferredTypeSource)})))||void 0===e?void 0:e.type)&&void 0!==t?t:V.UnknownType.create()}));e&&(t=e)}return t&&a.typeAliasName&&(!V.TypeBase.isInstantiable(t)||(0,V.isUnknown)(t)||(0,U.isEllipsisType)(t)||(t=mn(t,a.typeAliasName,a.node),p=!0)),t&&c.isInPyTypedPackage&&!c.isStubFile&&(p||function(e,t,n){var s;const i=e.getDeclarations().filter((e=>1!==e.type||!e.isInferenceAllowedInPyTyped));if(i.length>1)return!1;if(1!==t.type)return!1;if(0===i.length)return!0;if((0,V.isTypeVar)(n))return!0;let r;const a=t.node.parent;a&&(3===a.nodeType?r=a:35===a.nodeType&&3===(null===(s=a.parent)||void 0===s?void 0:s.nodeType)&&(r=a.parent));if(!r)return!1;const o=Ae(r.rightExpression).type;if((0,V.isClassInstance)(o)&&(0,U.isLiteralType)(o))return!0;if(38===r.rightExpression.nodeType&&!V.TypeBase.isAmbiguous(o))return!0;return!1}(n,s,t)&&(p=!0),p||(t=V.TypeBase.cloneForAmbiguousType(t))),t}}function Xn(t,n,s=!1){var i;return null===(i=f.resolveAliasDeclaration(e,t,n,s))||void 0===i?void 0:i.declaration}function es(t,n,s=!1){return f.resolveAliasDeclaration(e,t,n,s)}function ts(e){return ns(e).type}function ns(e,t,n=!1){if(e.hasTypedDeclarations()){const n=ss(e,t);return{type:null!=n?n:V.UnknownType.create(),isIncomplete:!1,includesVariableDecl:e.getTypedDeclarations().some((e=>1===e.type)),isRecursiveDefinition:!n}}let s=ce.get(e.id);const i=t?t.id:void 0,a=`${void 0===i?".":i.toString()}${n?"*":""}`;if(s){const e=s.get(a);if(e)return e}const o=[],l=e.getDeclarations(),c=(0,M.isFinalVariable)(e);let p,d=!1,u=!1,m=!1;if(l.length>16)return{type:V.UnknownType.create(),isIncomplete:!1,includesVariableDecl:!1,isRecursiveDefinition:!1};if(n&&l.forEach(((e,t)=>{e.isInExceptSuite||(p=t)})),l.forEach(((n,s)=>{var i,a;let l=void 0===p||s===p;if(void 0!==t&&6!==n.type){D.getExecutionScopeNode(t)===D.getExecutionScopeNode(n.node)&&(Qe(n.node,t)||(l=!1))}if(l){const t=(0,S.isExplicitTypeAliasDeclaration)(n);if((t||(0,S.isPossibleTypeAliasDeclaration)(n))&&1===n.type&&3===(null===(a=null===(i=n.inferredTypeSource)||void 0===i?void 0:i.parent)||void 0===a?void 0:a.nodeType)&&(hn(n.inferredTypeSource.parent),n.typeAliasAnnotation&&ke(n.typeAliasAnnotation,{isVariableAnnotation:!0,allowFinal:D.isFinalAllowedForAssignmentTarget(n.node),allowClassVar:D.isClassVarAllowedForAssignmentTarget(n.node)})),Ie(e,n))try{let s=Jn(e,n);if(Ce(e)||(d=!0),s){if(1===n.type){u=!0;let e=1===n.type&&!!n.isConstant;(0,V.isClassInstance)(s)&&V.ClassType.isEnumClass(s)&&function(e){const t=D.getEnclosingClass(e.node,!0);if(!t)return!1;const n=fn(t);if(!n)return!1;return V.ClassType.isEnumClass(n.classType)}(n)&&(e=!0),!V.TypeBase.isInstance(s)||t||e||c||(s=(0,U.stripLiteralValue)(s))}o.push(s),r.isSpeculative(n.node)&&(m=!0)}else d=!0}catch(t){throw Ce(e),t}else d=!0}})),o.length>0){const t={type:(0,V.combineTypes)(o),isIncomplete:!1,includesVariableDecl:u,isRecursiveDefinition:!1};return m||(s||(s=new Map,ce.set(e.id,s)),s.set(a,t)),t}return{type:V.UnboundType.create(),isIncomplete:d,includesVariableDecl:u,isRecursiveDefinition:!1}}function ss(e,t){const n=e.getSynthesizedType();if(n)return n;let s=e.getTypedDeclarations();if(0===s.length)return;if(s.length>1&&t){const e=s.filter((e=>{if(6!==e.type){if(D.getExecutionScopeNode(t)===D.getExecutionScopeNode(e.node)&&!Qe(e.node,t,!1))return!1}return!0}));e.length>0&&(s=e)}let i=s.length-1;for(;i>=0;){const t=s[i],n=Fe(e,t);if(n)return n;if(be(e,t)<0&&Ie(e,t))try{const n=Qn(t);if(Ce(e)||4===t.type)return n}catch(t){throw Ce(e),t}i--}}function is(e){(0,V.isFunction)(e)?rs(e):(0,V.isOverloadedFunction)(e)&&e.overloads.forEach((e=>{rs(e)}))}function rs(e,t,n=!0){const s=V.FunctionType.getSpecializedReturnType(e);return s||(n?as(e,t):V.UnknownType.create())}function as(e,n){var s;let i;if(V.FunctionType.isStubDefinition(e))return V.UnknownType.create();if(e.inferredReturnType)i=e.inferredReturnType;else{if(V.FunctionType.isInstanceMethod(e)&&"__init__"===e.details.name)i=V.NoneType.createInstance();else if(e.details.declaration){const n=e.details.declaration.node;if(t.analyzeUnannotatedFunctions&&!He(n.suite)){const t=_.getCodeFlowComplexity(n);(e.details.parameters.length<=1||e.details.parameters.some((e=>e.hasDeclaredType))||t<8)&&(!function(e){const t=r.disableSpeculativeMode();try{e(),r.enableSpeculativeMode(t)}catch(e){throw r.enableSpeculativeMode(t),e}}((()=>{i=xn(n,V.FunctionType.isAbstractMethod(e))})),i&&V.FunctionType.isWrapReturnTypeInAwait(e)&&(i=Fn(n,i,!!(null===(s=e.details.declaration)||void 0===s?void 0:s.isGenerator))))}}i||(i=V.UnknownType.create()),e.inferredReturnType=i}if(t.analyzeUnannotatedFunctions&&(0,U.isPartlyUnknown)(i)&&V.FunctionType.hasUnannotatedParams(e)&&!V.FunctionType.isStubDefinition(e)&&!V.FunctionType.isPyTypedDefinition(e)&&n){const t=function(e,t){var n;let s;if(!e.details.declaration)return;const i=e.details.declaration.node;if(_.getCodeFlowComplexity(i)>=8)return;if(t.some((e=>!e.paramName)))return;if(ue.some((e=>e.functionNode===i)))return;const r=_n(i);if(!r)return;if(t.length>6)return;if(ue.length>=2)return;if(Hn(i,(()=>{const n=me;ue.push({functionNode:i,codeFlowAnalyzer:Es.createCodeFlowAnalyzer()});try{me=new Map;let a=!0;i.parameters.forEach(((e,n)=>{if(e.name){let s;const o=t.find((t=>e.name.value===t.paramName));o&&o.argument.valueExpression?(s=Ae(o.argument.valueExpression).type,(0,V.isUnknown)(s)||(a=!1)):e.defaultValue?(s=Ae(e.defaultValue).type,(0,V.isUnknown)(s)||(a=!1)):0===n&&(V.FunctionType.isInstanceMethod(r.functionType)||V.FunctionType.isClassMethod(r.functionType))&&r.functionType.details.parameters.length>0&&i.parameters[0].name&&(s=r.functionType.details.parameters[0].type),s||(s=V.UnknownType.create()),fe(e.name,s,0,!1)}})),a||(s=xn(i,V.FunctionType.isAbstractMethod(e)))}finally{ue.pop(),me=n}})),s)return s=(0,V.removeUnbound)(s),V.FunctionType.isWrapReturnTypeInAwait(e)&&!(0,V.isNever)(s)&&(s=Fn(i,s,!!(null===(n=e.details.declaration)||void 0===n?void 0:n.isGenerator))),s;return}(e,n);t&&(i=t)}return i}function os(e){const t=_n(e);return t?V.FunctionType.isAbstractMethod(t.functionType)?V.AnyType.create():V.FunctionType.isGenerator(t.functionType)?(0,U.getDeclaredGeneratorReturnType)(t.functionType):t.functionType.details.declaredReturnType:V.AnyType.create()}function ls(e){return(0,V.isInstantiableClass)(e.classType)?(0,U.partiallySpecializeType)(ts(e.symbol),e.classType,void 0,null!=J?J:V.UnknownType.create()):V.UnknownType.create()}function cs(e,t,n,s,i,r,a){if(a>V.maxTypeRecursionCount)return!0;if(a++,K.some((n=>(0,V.isTypeSame)(n.srcType,t)&&(0,V.isTypeSame)(n.destType,e))))return!0;K.push({srcType:t,destType:e});let o=!0;try{o=function(e,t,n,s,i,r,a){if(0!=(1&i))return(0,V.isTypeSame)(e,t);const o=e.details.fields,l=V.ClassType.cloneForSpecialization(e,void 0,!1),c=new z.TypeVarContext((0,U.getTypeVarScopeId)(e)),p=new z.TypeVarContext((0,U.getTypeVarScopeId)(e));(0,U.populateTypeVarContextForSelfType)(p,e,t),V.ClassType.isTypedDictClass(t)&&ie&&(0,V.isInstantiableClass)(ie)&&(t=ie);let d=!0;const u=(0,U.buildTypeVarContextFromSpecializedClass)(t),m=(0,U.containsLiteralType)(t,!0)?128:0;if(o.forEach(((s,i)=>{if(s.isClassMember()&&!s.isIgnoredForProtocolMatch()){let o,l=!1;if(!r&&"__class_getitem__"===i)return;if("__slots__"===i)return;if(r&&t.details.effectiveMetaclass&&(0,V.isInstantiableClass)(t.details.effectiveMetaclass)&&(o=(0,U.lookUpClassMember)(t.details.effectiveMetaclass,i),o&&(u.addSolveForScope((0,U.getTypeVarScopeId)(t.details.effectiveMetaclass)),l=!0)),o||(o=(0,U.lookUpClassMember)(t,i)),o){let u=ss(s);if(u){let h=(0,V.isInstantiableClass)(o.classType)?(0,U.partiallySpecializeType)(ts(o.symbol),o.classType,t):V.UnknownType.create();if((0,V.isFunction)(h)||(0,V.isOverloadedFunction)(h)){if(l){const e=Fs(t,h,void 0,void 0,a,!1,t);if(e&&(h=(0,U.removeParamSpecVariadicsFromSignature)(e)),(0,V.isFunction)(u)||(0,V.isOverloadedFunction)(u)){const e=Fs(t,u,void 0,void 0,a,!1,t);e&&(u=(0,U.removeParamSpecVariadicsFromSignature)(e))}}else if((0,V.isInstantiableClass)(o.classType)){u=(0,U.applySolvedTypeVars)(u,p);const e=Fs(r?t:V.ClassType.cloneAsInstance(t),h,o.classType,void 0,a);if(e&&(h=(0,U.removeParamSpecVariadicsFromSignature)(e)),(0,V.isFunction)(u)||(0,V.isOverloadedFunction)(u)){const e=Fs(V.ClassType.cloneAsInstance(t),u,o.classType,void 0,a);e&&(u=(0,U.removeParamSpecVariadicsFromSignature)(e))}}}else u=(0,U.applySolvedTypeVars)(u,p);const g=null==n?void 0:n.createAddendum();if((0,V.isClassInstance)(u)&&V.ClassType.isPropertyClass(u))if((0,V.isClassInstance)(h)&&V.ClassType.isPropertyClass(h)&&!r)(0,A.canAssignProperty)(As,V.ClassType.cloneAsInstantiable(u),V.ClassType.cloneAsInstantiable(h),e,t,null==g?void 0:g.createAddendum(),c,a)||(g&&g.addMessage(y.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:i})),d=!1);else{const e=ms(u,!0);e&&gs(e,h,null==g?void 0:g.createAddendum(),c,m,a)||(g&&g.addMessage(y.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:i})),d=!1)}else{const e=s.getDeclarations()[0],t=1===(null==e?void 0:e.type)&&!e.isFinal;gs(u,h,null==g?void 0:g.createAddendum(),c,t?1|m:m,a)||(g&&(t&&g.addMessage(y.Localizer.DiagnosticAddendum.memberIsInvariant().format({name:i})),g.addMessage(y.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:i}))),d=!1)}const f=s.getTypedDeclarations().some((e=>1===e.type&&!!e.isFinal));f!==o.symbol.getTypedDeclarations().some((e=>1===e.type&&!!e.isFinal))&&(f?g&&g.addMessage(y.Localizer.DiagnosticAddendum.memberIsFinalInProtocol().format({name:i})):g&&g.addMessage(y.Localizer.DiagnosticAddendum.memberIsNotFinalInProtocol().format({name:i})),d=!1)}s.isClassVar()&&!o.symbol.isClassMember()&&(n&&n.addMessage(y.Localizer.DiagnosticAddendum.protocolMemberClassVar().format({name:i})),d=!1)}else n&&n.addMessage(y.Localizer.DiagnosticAddendum.protocolMemberMissing().format({name:i})),d=!1}})),e.details.baseClasses.forEach((o=>{if((0,V.isInstantiableClass)(o)&&!V.ClassType.isBuiltIn(o,"object")&&!V.ClassType.isBuiltIn(o,"Protocol")){cs((0,U.specializeForBaseClass)(e,o),t,null==n?void 0:n.createAddendum(),s,i,r,a)||(d=!1)}})),d&&e.details.typeParameters.length>0&&e.typeArguments){const t=(0,U.applySolvedTypeVars)(l,c);ys(e,t,n,s,i,a)||(d=!1)}return d}(e,t,n,s,i,r,a)}catch(e){throw K.pop(),e}return K.pop(),o}function ps(e,t,n,s,i,r){if(r>V.maxTypeRecursionCount)return!0;r++;let a=!0;const o=e.details.fields,l=V.ClassType.cloneForSpecialization(e,void 0,!1),c=new z.TypeVarContext((0,U.getTypeVarScopeId)(e));if(o.forEach(((s,i)=>{if(s.isClassMember()&&!s.isIgnoredForProtocolMatch()){const o=t.fields.get(i);if(o){let t=ss(s);if(t){const s=ts(o);if(((0,V.isFunction)(s)||(0,V.isOverloadedFunction)(s))&&((0,V.isFunction)(t)||(0,V.isOverloadedFunction)(t))){const n=Fs(V.ClassType.cloneAsInstance(e),t,e,void 0,r);n&&(t=n)}t=(0,U.partiallySpecializeType)(t,e);const l=null==n?void 0:n.createAddendum();gs(t,s,null==l?void 0:l.createAddendum(),c,0,r)||(l&&l.addMessage(y.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:i})),a=!1)}}else n&&n.addMessage(y.Localizer.DiagnosticAddendum.protocolMemberMissing().format({name:i})),a=!1}})),e.details.baseClasses.forEach((o=>{if((0,V.isInstantiableClass)(o)&&!V.ClassType.isBuiltIn(o,"object")&&!V.ClassType.isBuiltIn(o,"Protocol")){ps((0,U.specializeForBaseClass)(e,o),t,null==n?void 0:n.createAddendum(),s,i,r)||(a=!1)}})),a&&e.details.typeParameters.length>0&&e.typeArguments){const t=(0,U.applySolvedTypeVars)(l,c);ys(e,t,n,s,i,r)||(a=!1)}return a}function ds(e,t,n,s,i,r,a){if(V.ClassType.isTypedDictClass(e)&&V.ClassType.isTypedDictClass(t))return!!(0,O.canAssignTypedDict)(As,e,t,n,r)&&(V.ClassType.isFinal(e)!==V.ClassType.isFinal(t)?(n&&n.addMessage(y.Localizer.DiagnosticAddendum.typedDictFinalMismatch().format({sourceType:Ps((0,U.convertToInstance)(t)),destType:Ps((0,U.convertToInstance)(e))})),!1):!(0!=(1&i)&&!V.ClassType.isSameGenericClass(e,t))||(0,O.canAssignTypedDict)(As,t,e,void 0,r));const o=G.get(e.details.fullName);if(o&&o.some((e=>t.details.mro.some((t=>(0,V.isClass)(t)&&e===t.details.fullName))))&&0==(1&i))return!0;const c=[],p=V.ClassType.isDerivedFrom(t,e,c);if(V.ClassType.isProtocolClass(e)&&!p)return!!cs(e,t,null==n?void 0:n.createAddendum(),s,i,!1,r)||(n&&n.addMessage(y.Localizer.DiagnosticAddendum.protocolIncompatible().format({sourceType:Ps((0,U.convertToInstance)(t)),destType:Ps((0,U.convertToInstance)(e))})),!1);if((0==(1&i)||V.ClassType.isSameGenericClass(t,e))&&p)return(0,l.assert)(c.length>0),function(e,t,n,s,i,r,a){let o=t,l=null!=i?i:new z.TypeVarContext((0,U.getTypeVarScopeId)(e)),c=r;i||(c&=-9);for(let t=n.length-1;t>=0;t--){const i=n[t];if((0,V.isUnknown)(i))return!0;if(V.ClassType.isBuiltIn(i,"object"))return!0;if(t<n.length-1&&(o=(0,U.specializeForBaseClass)(o,i)),0===t&&e.tupleTypeArguments&&o.tupleTypeArguments)return us(e,o,s,l,r,a);if(0!==V.ClassType.getTypeParameters(i).length){if(!i.typeArguments)return!0;if(!ys(i,o,s,l,c,a))return!1;l=new z.TypeVarContext((0,U.getTypeVarScopeId)(i)),c&=-9}}if(e.typeArguments){if(!ys(e,o,s,i,r,a))return!1}else if(i&&e.details.typeParameters.length>0&&o.typeArguments&&!i.isLocked()){const t=o.typeArguments;for(let n=0;n<e.details.typeParameters.length;n++){const s=n<t.length?t[n]:V.UnknownType.create();i.setTypeVarType(e.details.typeParameters[n],void 0,s)}}return!0}(e,t,c,n,s,i,r);if(V.ClassType.isBuiltIn(e,"object")&&0==(1&i))return!0;const d=a?V.ClassType.cloneAsInstance(e):e,u=a?V.ClassType.cloneAsInstance(t):t;let m=Ps(d),h=Ps(u);return m===h&&e.details.fullName&&t.details.fullName&&(m=e.details.fullName,h=t.details.fullName),n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeIncompatible().format({sourceType:h,destType:m})),!1}function us(e,t,n,s,i,r){var a,o;const l=[...null!==(a=e.tupleTypeArguments)&&void 0!==a?a:[]],c=[...null!==(o=t.tupleTypeArguments)&&void 0!==o?o:[]],p=l.findIndex((e=>(0,V.isVariadicTypeVar)(e.type))),d=l.findIndex((e=>e.isUnbounded)),u=c.findIndex((e=>e.isUnbounded));if(u>=0){const e=p>=0||d>=0?l.length-1:l.length,t=c.length>0?c[u].type:V.AnyType.create();for(;c.length<e;)c.splice(u,0,{type:t,isUnbounded:!1})}if(p>=0&&u>=0)return n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeVarTupleRequiresKnownLength()),!1;if(d>=0||p>=0){const e=c.length-l.length+1;if(e>=0)if(p>=0){if(ee&&(0,V.isInstantiableClass)(ee)){const t=c.splice(p,e),n=(0,U.convertToInstance)((0,U.specializeTupleClass)(ee,t.map((e=>({type:(0,U.stripLiteralValue)(e.type),isUnbounded:!1}))),!0,!0,!0));c.splice(p,0,{type:n,isUnbounded:!1})}}else{const t=c.splice(d,e);c.splice(d,0,{type:t.length>0?(0,V.combineTypes)(t.map((e=>e.type))):V.AnyType.create(),isUnbounded:!1})}}if(c.length===l.length)for(let e=0;e<c.length;e++){const t=null==n?void 0:n.createAddendum();if(!gs(l[e].type,c[e].type,null==t?void 0:t.createAddendum(),s,128|i,r))return t&&t.addMessage(y.Localizer.DiagnosticAddendum.tupleEntryTypeMismatch().format({entry:e+1})),!1}else{if(!(u>=0))return n&&n.addMessage(y.Localizer.DiagnosticAddendum.tupleSizeMismatch().format({expected:l.length,received:c.length})),!1;if(!e.isUnpacked)return n&&n.addMessage(y.Localizer.DiagnosticAddendum.tupleSizeMismatchIndeterminate().format({expected:l.length})),!1}return!0}function ms(e,t){if(!V.ClassType.isPropertyClass(e))return;const n=e.details.fields.get("fget");if(n){const e=ss(n);if(e&&(0,V.isFunction)(e))return rs(e,void 0,t)}}function ys(e,t,n,s,i,r){var a,o,p;(0,l.assert)(V.ClassType.isSameGenericClass(e,t));const d=V.ClassType.getTypeParameters(e);let u,m;if(!e.typeArguments||!t.typeArguments)return!0;if(V.ClassType.isTupleClass(e)?(u=null!==(o=null===(a=e.tupleTypeArguments)||void 0===a?void 0:a.map((e=>e.type)))&&void 0!==o?o:[],m=null===(p=t.tupleTypeArguments)||void 0===p?void 0:p.map((e=>e.type))):(u=e.typeArguments,m=t.typeArguments),m)for(let t=0;t<m.length;t++){const a=m[t],o=t>=u.length?u.length-1:t,l=o>=0?u[o]:V.UnknownType.create(),p=o<d.length?d[o]:void 0,h=new c.DiagnosticAddendum;if(p&&1!==p.details.variance){if(2===p.details.variance){if(!gs(a,l,h,s,2^i|128,r)){if(n){const e=n.createAddendum();e.addMessage(y.Localizer.DiagnosticAddendum.typeVarIsContravariant().format({name:V.TypeVarType.getReadableName(p)})),e.addAddendum(h)}return!1}}else if(!gs(l,a,h,s,1|i,r)&&!V.ClassType.isPseudoGenericClass(e)){if(n){const e=n.createAddendum();e.addMessage(y.Localizer.DiagnosticAddendum.typeVarIsInvariant().format({name:V.TypeVarType.getReadableName(p)})),e.addAddendum(h)}return!1}}else if(!gs(l,a,h,s,128|i,r)){if(p&&n){const e=n.createAddendum();e.addMessage(y.Localizer.DiagnosticAddendum.typeVarIsCovariant().format({name:V.TypeVarType.getReadableName(p)})),e.addAddendum(h)}return!1}}return!0}function hs(e,t,n,s,i=0,r=0){var a;let o=!0;const l=0!=(2&i);if(!e.scopeId)return!0;if(!s.hasSolveForScope(e.scopeId)){if((0,V.isAnyOrUnknown)(t)||(0,V.isClass)(t)&&V.ClassType.derivesFromAnyOrUnknown(t))return!0;if(0!=(512&i))return!0;if(l&&gs(lt(e),lt(t),void 0,void 0,i,r))return!0;if(o=!1,!e.details.isSynthesized)return n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Ps(t),destType:Ps(e)})),!1}if(0!=(8&i))return gs(lt(e),lt(t),n,void 0,i,r);if(e.details.isParamSpec)return function(e,t,n,s,i=0){if((0,V.isTypeVar)(t)&&t.details.isParamSpec){const n=s.getParamSpec(e);if(!n)return!s.isLocked()&&s.hasSolveForScope(e.scopeId)&&s.setParamSpec(e,{flags:0,parameters:[],typeVarScopeId:void 0,docString:void 0,paramSpec:t}),!0;if(0===n.parameters.length&&n.paramSpec&&(0,V.isTypeSame)(n.paramSpec,t,void 0,void 0,i))return!0}else if((0,V.isFunction)(t)){const n=t,r=t.details.parameters.map(((e,t)=>({category:e.category,name:e.name,isNameSynthesized:e.isNameSynthesized,hasDefault:!!e.hasDefault,type:V.FunctionType.getEffectiveParameterType(n,t)}))),a=s.getParamSpec(e);if(!a)return!s.isLocked()&&s.hasSolveForScope(e.scopeId)&&s.setParamSpec(e,{parameters:r,typeVarScopeId:t.details.typeVarScopeId,flags:t.details.flags,docString:t.details.docString,paramSpec:t.details.paramSpec}),!0;if(a.paramSpec===t.details.paramSpec){if(gs((0,U.convertParamSpecValueToType)(a,!0),(0,U.convertParamSpecValueToType)({parameters:r,flags:t.details.flags,typeVarScopeId:t.details.typeVarScopeId,docString:void 0,paramSpec:void 0},!0),void 0,void 0,32,i))return!0}}else if((0,V.isAnyOrUnknown)(t))return!0;n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeParamSpec().format({type:Ps(t),name:e.details.name}));return!1}(e,t,n,s,r);e.details.isVariadic&&((0,V.isUnpacked)(t)||(t=ee&&(0,V.isInstantiableClass)(ee)?(0,U.convertToInstance)((0,U.specializeTupleClass)(ee,[{type:t,isUnbounded:!1}],!0,!0,!0)):V.UnknownType.create())),V.TypeBase.isInstantiable(e)&&(0,V.isClassInstance)(t)&&V.ClassType.isBuiltIn(t,"type")&&!t.typeArguments&&(t=V.AnyType.create());const p=s.getTypeVar(e),d=null==p?void 0:p.narrowBound,u=null!==(a=null==p?void 0:p.wideBound)&&void 0!==a?a:e.details.boundType;if(e.details.constraints.length>0){let i;const a=lt(t);if((0,V.isTypeVar)(t))gs(e,a,void 0,new z.TypeVarContext(e.scopeId),void 0,r)&&(i=t,V.TypeBase.isInstantiable(t)&&(i=(0,U.convertToInstance)(t)));else{let t,n=!0;i=(0,U.mapSubtypes)(a,(s=>{let i,a;return(0,V.isAnyOrUnknown)(s)?s:(e.details.constraints.forEach(((t,n)=>{const o=V.TypeBase.isInstantiable(e)?(0,U.convertToInstantiable)(t):t;gs(o,s,void 0,void 0,void 0,r)&&(i&&!gs(V.TypeBase.isInstantiable(e)?(0,U.convertToInstantiable)(i):i,o,void 0,void 0,void 0,r)||(i=(0,U.addConditionToType)(t,(0,U.getTypeCondition)(s)),a=n))})),i||l||(n=!1),void 0===a||(0,U.getTypeCondition)(s)||(void 0!==t&&t!==a&&(n=!1),t=a),i)})),!(0,V.isNever)(i)&&n||(i=void 0),!i&&(0,V.isUnion)(a)&&(i=e.details.constraints.find((t=>gs(V.TypeBase.isInstantiable(e)?(0,U.convertToInstantiable)(t):t,a,void 0,void 0,void 0,r))))}if(!i)return n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeConstrainedTypeVar().format({type:Ps(t),name:e.details.name})),!1;if(d&&!(0,V.isAnyOrUnknown)(d)){if(!gs(d,i,void 0,void 0,void 0,r)){if(!gs(i,d,void 0,void 0,void 0,r))return n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeConstrainedTypeVar().format({type:Ps(i),name:Ps(d)})),!1;!s.isLocked()&&o&&s.setTypeVarType(e,i)}}else!s.isLocked()&&o&&s.setTypeVarType(e,i);return!0}let m=d,h=u;const g=n?new c.DiagnosticAddendum:void 0,f=0!=(128&i)||s.getRetainLiterals(e)||e.details.boundType&&(0,U.containsLiteralType)(e.details.boundType)||e.details.constraints.some((e=>(0,U.containsLiteralType)(e)));let T=f?t:(0,U.stripLiteralValue)(t);if(V.TypeBase.isInstantiable(e)){if(!(0,U.isEffectivelyInstantiable)(T))return n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Ps(T),destType:Ps(e)})),!1;T=(0,U.convertToInstance)(T)}if(l||0!=(4&i)){if(u){if(!(0,V.isTypeSame)(u,T,void 0,void 0,r))if(gs(u,lt(T),g,void 0,512&i,r))h=T;else if(!gs(T,u,g,void 0,512&i,r))return n&&g&&(n.addMessage(y.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Ps(T),destType:Ps(u)})),n.addAddendum(g)),!1}else h=T;if(d&&!gs(h,d,void 0,void 0,512&i,r))return n&&g&&(n.addMessage(y.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Ps(T),destType:Ps(d)})),n.addAddendum(g)),!1}else{if(d){if(!(0,V.isTypeSame)(d,T,void 0,void 0,r))if(gs(d,T,g,new z.TypeVarContext(e.scopeId),i,r))m=(0,U.isPartlyUnknown)(d)&&!(0,V.isUnknown)(T)&&gs(T,d,void 0,new z.TypeVarContext(e.scopeId),512&i,r)?T:d;else{if(s.isLocked()||(0,V.isTypeVar)(T))return n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Ps(d),destType:Ps(T)})),!1;const t=e;if((0,V.isVariadicTypeVar)(t))return n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Ps(d),destType:Ps(T)})),!1;m=gs(T,d,void 0,new z.TypeVarContext(e.scopeId),512&i,r)?T:(0,V.isUnion)(d)&&d.subtypes.length>64&&void 0!==e.details.boundType&&Q&&(0,V.isClassInstance)(Q)?(0,V.combineTypes)([d,Q]):(0,V.combineTypes)([d,T])}}else m=T;if(u&&m&&!(0,V.isTypeSame)(u,m,void 0,void 0,r)){let t=!0;if((0,V.isTypeVar)(u)&&((0,V.isTypeSame)(m,u)||(0,V.isUnion)(m)&&m.subtypes.some((e=>(0,V.isTypeSame)(e,u))))&&(t=!1),!gs(t?lt(u):u,m,null==n?void 0:n.createAddendum(),new z.TypeVarContext(e.scopeId),512&i,r))return n&&g&&n.addMessage(y.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Ps(T),destType:Ps(u)})),!1}}if(e.details.boundType){const a=m||h;if(V.TypeBase.isInstantiable(e)&&!V.TypeBase.isInstantiable(t))return!1;const o=e.details.isSynthesizedSelf?s:new z.TypeVarContext(e.scopeId);if(!gs(e.details.boundType,lt(a),null==n?void 0:n.createAddendum(),o,512&i,r))return e.details.isSynthesized||n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeBound().format({sourceType:Ps(a),destType:Ps(e.details.boundType),name:V.TypeVarType.getReadableName(e)})),!1}return!s.isLocked()&&o&&s.setTypeVarType(e,m,h,f),!0}function gs(e,t,n,s,i=0,r=0){var a,c;if((0,V.isUnion)(e)&&1===e.subtypes.length&&(0,V.isVariadicTypeVar)(e.subtypes[0])&&(e=e.subtypes[0]),(0,V.isUnion)(t)&&1===t.subtypes.length&&(0,V.isVariadicTypeVar)(t.subtypes[0])&&(t=t.subtypes[0]),e===t)return!(0,V.isTypeVar)(e)||e.details.isParamSpec||e.details.isVariadic||0!==e.scopeType||!s||s.isLocked()||!s.hasSolveForScope(e.scopeId)||s.getTypeVar(e)||0!=(10&i)||s.setTypeVarType(e,t),!0;if(r>V.maxTypeRecursionCount)return!0;if(r++,(0,V.isTypeVar)(e)&&e.details.recursiveTypeAliasScopeId&&(0,V.isTypeVar)(t)&&t.details.recursiveTypeAliasScopeId){if((null===(a=e.typeAliasInfo)||void 0===a?void 0:a.typeArguments)&&(null===(c=t.typeAliasInfo)||void 0===c?void 0:c.typeArguments)&&e.details.recursiveTypeAliasScopeId===t.details.recursiveTypeAliasScopeId){let a=!0;const o=t.typeAliasInfo.typeArguments;return e.typeAliasInfo.typeArguments.forEach(((e,t)=>{gs(e,t<o.length?o[t]:V.UnknownType.create(),n,s,i,r)||(a=!1)})),a}if(0!=(2048&i))return!0;i|=2048}if(e=(0,U.transformPossibleRecursiveTypeAlias)(e),t=(0,U.transformPossibleRecursiveTypeAlias)(t),(0,V.isUnbound)(e)||(0,V.isUnbound)(t))return!0;0!=(16&i)&&(t=lt(t));const p=i;if(i&=-69,(0,V.isTypeVar)(e)){if(function(e,t,n){return!(0,V.findSubtype)(t,(t=>{var s;if((0,V.isTypeSame)(e,t,!0,void 0,n))return!1;const i=V.TypeVarType.getNameWithScope(e),r=(null!==(s=(0,U.getTypeCondition)(t))&&void 0!==s?s:[]).filter((e=>e.typeVarName===i));return 0===r.length||!r.some((s=>s.typeVarName===V.TypeVarType.getNameWithScope(e)&&(e.details.boundType?((0,l.assert)(0===s.constraintIndex,"Expected constraint for bound TypeVar to have index of 0"),gs(e.details.boundType,t,void 0,void 0,void 0,n)):!(e.details.constraints.length>0)||((0,l.assert)(s.constraintIndex<e.details.constraints.length,"Constraint for constrained TypeVar is out of bounds"),gs(e.details.constraints[s.constraintIndex],t,void 0,void 0,void 0,n)))))}))}(e,t,r))return!0;if((0,V.isTypeSame)(e,t))return!0;if((0,V.isTypeVar)(t)&&t.details.isSynthesizedSelf&&t.details.boundType&&e.details.isSynthesizedSelf&&e.details.boundType)return 0==(2&i)&&s&&hs(e,t,n,s,p,r),!0;if((0,V.isVariadicTypeVar)(e)&&(0,V.isClassInstance)(t)&&(0,U.isTupleClass)(t)&&t.tupleTypeArguments&&1===t.tupleTypeArguments.length&&(0,V.isTypeSame)(e,t.tupleTypeArguments[0].type,void 0,void 0,r))return!0;if(0==(2&i)||!(0,V.isTypeVar)(t))return!!hs(e,t,n,null!=s?s:new z.TypeVarContext,p,r)&&(!(0,V.isAnyOrUnknown)(t)||0==(16&i))}if((0,V.isTypeVar)(t)){if(0!=(2&i)){if(s&&s.hasSolveForScope((0,U.getTypeVarScopeId)(t))){let i=p;if(0!=(1024&p)?i&=-7:i|=4,hs(t,e,n,s,i,r))return!0;let a=!1;return(0,V.isUnion)(e)&&(0,U.doForEachSubtype)(e,(e=>{hs(t,e,n,s,4|p,r)&&(a=!0)})),a}return gs(lt(e),lt(t),n,void 0,p,r)}if(0!=(1&i))return!!(0,V.isAnyOrUnknown)(e)||(!!((0,V.isParamSpec)(t)&&(0,V.isFunction)(e)&&V.FunctionType.shouldSkipArgsKwargsCompatibilityCheck(e)&&e.details.parameters.length<=2)||(n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Ps(t),destType:Ps(e)})),!1))}if((0,V.isAnyOrUnknown)(e))return!0;if((0,V.isAnyOrUnknown)(t)){if(s){const n=(0,U.isEllipsisType)(t)?V.AnyType.create():t;(0,U.setTypeArgumentsRecursive)(e,n,s,r)}if(0==(16&i))return!0}if((0,V.isNever)(t))return s&&(0,U.setTypeArgumentsRecursive)(e,V.UnknownType.create(),s,r),!0;if((0,V.isUnion)(t)&&V.TypeBase.isSpecialForm(t)&&(t=Z||Q||V.AnyType.create()),(0,V.isUnion)(e))if((0,V.isUnion)(t)){if(fs(e,t,void 0,s,p,r))return!0}else{const n=s?s.clone():void 0;if(Ts(e,t,void 0,n,p,r))return s&&n&&s.copyFromClone(n),!0}const d=lt(t);if((0,V.isUnion)(d))return fs(e,d,n,s,p,r);if((0,V.isUnion)(e))return Ts(e,t,n,s,p,r);if((0,V.isNoneInstance)(e)&&(0,V.isNoneInstance)(t))return!0;if((0,V.isNoneTypeClass)(e)){if((0,V.isNoneTypeClass)(t))return!0;if((0,V.isInstantiableClass)(t)&&V.ClassType.isBuiltIn(t,"NoneType"))return!0}if((0,V.isClassInstance)(t)&&V.ClassType.isBuiltIn(t,"type")){const a=t.typeArguments;if(a&&a.length>=1){if((0,V.isAnyOrUnknown)(a[0]))return!(!(0,V.isClassInstance)(e)||!V.ClassType.isBuiltIn(t,"type"))||V.TypeBase.isInstantiable(e);if((0,V.isClassInstance)(a[0])||(0,V.isTypeVar)(a[0]))return!!gs(e,(0,U.convertToInstantiable)(a[0]),null==n?void 0:n.createAddendum(),s,i,r)||(n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Ps(t),destType:Ps(e)})),!1)}}if((0,V.isInstantiableClass)(e)){const a=lt(t);if((0,V.isInstantiableClass)(a))return V.ClassType.isProtocolClass(e)&&V.ClassType.isProtocolClass(a)&&(0,V.isInstantiableClass)(t)&&!t.includeSubclasses?(n&&n.addMessage(y.Localizer.DiagnosticAddendum.protocolSourceIsNotConcrete().format({sourceType:Ps((0,U.convertToInstance)(t)),destType:Ps(e)})),!1):!!ds(e,a,n,s,i,r,!1)||(n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Ps(t),destType:Ps(e)})),!1)}if((0,V.isClassInstance)(e)){if(V.ClassType.isBuiltIn(e,"Type")){const a=e.typeArguments;if(a&&a.length>=1&&V.TypeBase.isInstance(a[0])&&V.TypeBase.isInstantiable(t))return gs(a[0],(0,U.convertToInstance)(t),n,s,i,r)}else if(V.ClassType.isBuiltIn(e,"type")){if((0,V.isAnyOrUnknown)(t)&&0!=(16&i))return!1;if(V.TypeBase.isInstantiable(t)){return!((0,V.isClass)(t)&&void 0!==t.literalValue)}}else if(V.ClassType.isBuiltIn(e,["TypeGuard","StrictTypeGuard"])&&0!=(64&p)&&(0,V.isClassInstance)(t)&&V.ClassType.isBuiltIn(t,"bool"))return!0;const a=lt(t);if((0,V.isClass)(a)&&V.TypeBase.isInstance(a)){if(void 0!==e.literalValue){if(void 0===a.literalValue||!V.ClassType.isLiteralValueSame(a,e))return n&&n.addMessage(y.Localizer.DiagnosticAddendum.literalAssignmentMismatch().format({sourceType:Ps(t),destType:Ps(e)})),!1}if(V.ClassType.isBuiltIn(e,"LiteralString")&&V.ClassType.isBuiltIn(a,"str")){if(void 0!==a.literalValue)return!0}else if(V.ClassType.isBuiltIn(a,"LiteralString")&&V.ClassType.isBuiltIn(e,"str")&&void 0===e.literalValue)return!0;return!!ds(V.ClassType.cloneAsInstantiable(e),V.ClassType.cloneAsInstantiable(a),n,s,i,r,!0)}if((0,V.isFunction)(a)||(0,V.isOverloadedFunction)(a)){const t=vs(e);if(t)return gs(t,a,n,s,i,r);if(Q&&(0,V.isClassInstance)(Q))return gs(e,Q,n,s,i,r)}else if((0,V.isModule)(a)){if(V.ClassType.isBuiltIn(e,"ModuleType"))return!0;if(V.ClassType.isProtocolClass(e))return ps(V.ClassType.cloneAsInstantiable(e),a,n,s,i,r)}else if((0,V.isInstantiableClass)(a)){const t=vs(e);if(t)return gs(t,a,n,s,i,r);if(V.ClassType.isProtocolClass(e))return cs(V.ClassType.cloneAsInstantiable(e),a,n,s,i,!0,r);const o=a.details.effectiveMetaclass;if(o)return!!(0,V.isAnyOrUnknown)(o)||ds(V.ClassType.cloneAsInstantiable(e),o,n,s,i,r,!1)}else{if((0,V.isAnyOrUnknown)(a))return 0==(16&i);if((0,V.isUnion)(a))return gs(e,a,n,s,i,r)}}if((0,V.isFunction)(e)){let a,l=lt(t);if((0,V.isClassInstance)(l)){const e=(0,U.lookUpObjectMember)(l,"__call__");if(e){const t=ls(e);if((0,V.isFunction)(t)||(0,V.isOverloadedFunction)(t)){const e=Fs(l,t,void 0,void 0,r);e&&(l=(0,U.removeParamSpecVariadicsFromSignature)(e))}}}if((0,V.isInstantiableClass)(l)&&void 0===l.literalValue){const e=_s(l,r);e&&(l=e)}if((0,V.isOverloadedFunction)(l)){if(e.details.paramSpec)return n&&n.addMessage(y.Localizer.DiagnosticAddendum.paramSpecOverload()),!1;const t=l.overloads,o=t.findIndex((t=>{if(!V.FunctionType.isOverloaded(t))return!1;const a=s?s.clone():void 0;return gs(e,t,null==n?void 0:n.createAddendum(),a,i,r)}));if(o<0)return n&&n.addMessage(y.Localizer.DiagnosticAddendum.noOverloadAssignable().format({type:Ps(e)})),!1;a=t[o]}else if((0,V.isFunction)(l))a=l;else if((0,V.isAnyOrUnknown)(l))return 0==(16&i);if(a&&function(e,t,n,s,i,r){var a,l,c,p,d,u,m,h,g,f;let T=!0;const _=0==(32&i);i&=-33,e=(0,U.removeParamSpecVariadicsFromFunction)(e),t=(0,U.removeParamSpecVariadicsFromFunction)(t);const v=(0,U.getParameterListDetails)(e),b=(0,U.getParameterListDetails)(t);!function(e,t){var n;if(void 0===t.argsIndex)return;if(e.params.length<t.argsIndex)return;let s=e.params.findIndex(((e,n)=>n>=t.argsIndex&&e.source===U.ParameterSource.KeywordOnly));s<0&&(s=e.params.length);const i=(null!==(n=t.firstKeywordOnlyIndex)&&void 0!==n?n:t.params.length)-t.argsIndex-1,r=e.params.slice(t.argsIndex,s-i),a=[];if(r.forEach((e=>{1===e.param.category?(0,V.isUnpackedVariadicTypeVar)(e.type)?a.push({type:e.type,isUnbounded:!1}):(0,V.isUnpackedClass)(e.type)&&e.type.tupleTypeArguments?(0,o.appendArray)(a,e.type.tupleTypeArguments):a.push({type:e.type,isUnbounded:!0}):a.push({type:e.type,isUnbounded:!1})})),1!==a.length||!(0,V.isVariadicTypeVar)(a[0].type)){let n;n=ee&&(0,V.isInstantiableClass)(ee)?(0,U.convertToInstance)((0,U.specializeTupleClass)(ee,a,!0,!0,!0)):V.UnknownType.create(),e.params=[...e.params.slice(0,t.argsIndex),{param:{category:1,name:"_arg_combined",isNameSynthesized:!0,hasDeclaredType:!0,type:n},type:n,index:-1,source:U.ParameterSource.PositionOrKeyword},...e.params.slice(t.argsIndex+r.length,e.params.length)];const s=e.params.findIndex((e=>1===e.param.category));e.argsIndex=s>=0?s:void 0;const i=e.params.findIndex((e=>2===e.param.category));e.kwargsIndex=i>=0?i:void 0;const o=e.params.findIndex((e=>e.source===U.ParameterSource.KeywordOnly));e.firstKeywordOnlyIndex=o>=0?o:void 0}}(b,v);const I=0==(2&i)?s:new z.TypeVarContext((0,U.getTypeVarScopeId)(e)),C=0!=(2&i)?s:new z.TypeVarContext((0,U.getTypeVarScopeId)(t)),S=0!=(2&i)?!!t.details.paramSpec:!!e.details.paramSpec,F=null!==(l=null!==(a=v.argsIndex)&&void 0!==a?a:v.firstKeywordOnlyIndex)&&void 0!==l?l:v.params.length,x=null!==(p=null!==(c=b.argsIndex)&&void 0!==c?c:b.firstKeywordOnlyIndex)&&void 0!==p?p:b.params.length,D=Math.min(F,x);for(let s=0;s<D;s++){const a=v.params[s],o=b.params[s],l=o.type,c=a.type,p=null!==(d=a.param.name)&&void 0!==d?d:"",m=null!==(u=o.param.name)&&void 0!==u?u:"";if(p&&!(0,N.isPrivateOrProtectedName)(p)&&!(0,N.isPrivateOrProtectedName)(m)){a.source===U.ParameterSource.PositionOnly||1===a.param.category||1===o.param.category||p===m||(n&&n.createAddendum().addMessage(y.Localizer.DiagnosticAddendum.functionParamName().format({srcName:m,destName:p})),T=!1)}a.param.hasDefault&&!o.param.hasDefault&&(n&&n.createAddendum().addMessage(y.Localizer.DiagnosticAddendum.functionParamDefaultMissing().format({name:m})),T=!1),0===s&&"__init__"===t.details.name&&V.FunctionType.isInstanceMethod(t)&&"__init__"===e.details.name&&V.FunctionType.isInstanceMethod(e)&&V.FunctionType.isOverloaded(e)&&a.param.hasDeclaredType||(bs(c,l,s,null==n?void 0:n.createAddendum(),I,C,i,r)||0!=(256&i)&&(0,V.isTypeVar)(l)&&l.details.isSynthesized||(T=!1))}!V.FunctionType.shouldSkipArgsKwargsCompatibilityCheck(e)&&v.firstPositionOrKeywordIndex<b.positionOnlyParamCount&&!S&&(n&&n.createAddendum().addMessage(y.Localizer.DiagnosticAddendum.argsPositionOnly().format({expected:b.positionOnlyParamCount,received:v.firstPositionOrKeywordIndex})),T=!1);if(F<x){if(!S){const e=b.params.filter((e=>!!e.param.name&&!e.param.hasDefault&&0===e.param.category)).length;if(void 0===v.argsIndex)F<e&&v.firstPositionOrKeywordIndex>0&&v.firstPositionOrKeywordIndex<x&&(n&&n.createAddendum().addMessage(y.Localizer.DiagnosticAddendum.functionTooFewParams().format({expected:e,received:F})),T=!1);else{const e=v.params[v.argsIndex].type;if(!(0,V.isAnyOrUnknown)(e))for(let t=F;t<x;t++){bs(e,b.params[t].type,t,null==n?void 0:n.createAddendum(),I,C,i,r)||(T=!1)}}}}else if(x<F)if(void 0!==b.argsIndex){const e=b.params[b.argsIndex].type;for(let t=x;t<F;t++){const s=v.params[t].type;(0,V.isVariadicTypeVar)(s)&&!(0,V.isVariadicTypeVar)(e)?(n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeVarTupleRequiresKnownLength()),T=!1):(bs(s,e,t,null==n?void 0:n.createAddendum(),I,C,i,r)||(T=!1),v.params[t].source!==U.ParameterSource.PositionOnly&&void 0===b.kwargsIndex&&(n&&n.addMessage(y.Localizer.DiagnosticAddendum.namedParamMissingInSource().format({name:null!==(m=v.params[t].param.name)&&void 0!==m?m:""})),T=!1))}}else n&&n.addMessage(y.Localizer.DiagnosticAddendum.functionTooManyParams().format({expected:x,received:F})),T=!1;if(void 0!==b.argsIndex&&void 0!==v.argsIndex&&!V.FunctionType.shouldSkipArgsKwargsCompatibilityCheck(e)){let e=v.params[v.argsIndex].type,t=b.params[b.argsIndex].type;ee&&(0,V.isInstantiableClass)(ee)&&((0,V.isUnpacked)(e)||(e=V.ClassType.cloneForUnpacked(V.ClassType.cloneAsInstance((0,U.specializeTupleClass)(ee,[{type:e,isUnbounded:!0}],!0,!0)))),(0,V.isUnpacked)(t)||(t=V.ClassType.cloneForUnpacked(V.ClassType.cloneAsInstance((0,U.specializeTupleClass)(ee,[{type:t,isUnbounded:!0}],!0,!0))))),bs(e,t,v.params[v.argsIndex].index,null==n?void 0:n.createAddendum(),I,C,i,r)||(T=!1)}V.FunctionType.shouldSkipArgsKwargsCompatibilityCheck(e)||void 0!==b.argsIndex||void 0===v.argsIndex||v.hasUnpackedVariadicTypeVar||S||(n&&n.createAddendum().addMessage(y.Localizer.DiagnosticAddendum.argsParamMissing().format({paramName:null!==(h=v.params[v.argsIndex].param.name)&&void 0!==h?h:""})),T=!1);if(!S){const t=new Map;void 0!==v.firstKeywordOnlyIndex&&v.params.forEach(((e,n)=>{n>=v.firstKeywordOnlyIndex&&e.param.name&&0===e.param.category&&t.set(e.param.name,e)}));let s=void 0!==b.firstKeywordOnlyIndex?b.firstKeywordOnlyIndex:b.params.length;F<x&&void 0===v.argsIndex&&(s=F),s>=0&&b.params.forEach(((e,a)=>{if(a>=s&&e.param.name&&0===e.param.category){const s=t.get(e.param.name),a=null==n?void 0:n.createAddendum(),o=e.type;if(s){const l=s.type,c=I?(0,U.applySolvedTypeVars)(l,I):l;gs(o,c,null==a?void 0:a.createAddendum(),void 0,i,r)||(a&&a.addMessage(y.Localizer.DiagnosticAddendum.namedParamTypeMismatch().format({name:e.param.name,sourceType:Ps(c),destType:Ps(o)})),T=!1),s.param.hasDefault&&!e.param.hasDefault&&(n&&n.createAddendum().addMessage(y.Localizer.DiagnosticAddendum.functionParamDefaultMissing().format({name:e.param.name})),T=!1),t.delete(e.param.name)}else void 0!==v.kwargsIndex||e.param.hasDefault?void 0!==v.kwargsIndex&&(bs(v.params[v.kwargsIndex].type,o,v.params[v.kwargsIndex].index,null==n?void 0:n.createAddendum(),I,C,i,r)||(T=!1)):(a&&a.addMessage(y.Localizer.DiagnosticAddendum.namedParamMissingInDest().format({name:e.param.name})),T=!1)}})),t.forEach(((e,s)=>{void 0!==b.kwargsIndex&&e.param.name?(bs(e.param.type,b.params[b.kwargsIndex].type,e.index,null==n?void 0:n.createAddendum(),I,C,i,r)||(T=!1),t.delete(s)):(n&&n.createAddendum().addMessage(y.Localizer.DiagnosticAddendum.namedParamMissingInSource().format({name:s})),T=!1)})),void 0!==b.kwargsIndex&&void 0!==v.kwargsIndex&&(bs(v.params[v.kwargsIndex].type,b.params[b.kwargsIndex].type,v.params[v.kwargsIndex].index,null==n?void 0:n.createAddendum(),I,C,i,r)||(T=!1)),V.FunctionType.shouldSkipArgsKwargsCompatibilityCheck(e)||void 0!==b.kwargsIndex||void 0===v.kwargsIndex||(n&&n.createAddendum().addMessage(y.Localizer.DiagnosticAddendum.kwargsParamMissing().format({paramName:v.params[v.kwargsIndex].param.name})),T=!1)}if(S&&(null===(g=t.details.paramSpec)||void 0===g?void 0:g.nameWithScope)===(null===(f=e.details.paramSpec)||void 0===f?void 0:f.nameWithScope)){const n=t.details.parameters.length,s=e.details.parameters.length;n!==s&&(n!==s-1||0!==e.details.parameters[s-1].category||e.details.parameters[s-1].name)&&(T=!1)}if(s){const n=0==(2&i)?C:I;if(n.getTypeVars().forEach((e=>{gs(e.typeVar,n.getTypeVarType(e.typeVar),void 0,s,void 0,r)})),s.isLocked()||s.getTypeVars().forEach((e=>{if(e.narrowBound){const t=(0,U.applySolvedTypeVars)(e.narrowBound,s);t!==e.narrowBound&&s.setTypeVarType(e.typeVar,t,e.wideBound,e.retainLiteral)}})),S){const n=0==(2&i)?e:t,r=0==(2&i)?t:e;if(n.details.paramSpec){const e=n.details.parameters.filter((e=>!!e.name&&(0!==e.category||!(0,V.isParamSpec)(e.type)))).length;let t=0;const i=[];r.details.parameters.forEach(((n,s)=>{t<e?n.name&&t++:(n.name||0!==n.category||0!==i.length)&&i.push({category:n.category,name:n.name,isNameSynthesized:n.isNameSynthesized,hasDefault:!!n.hasDefault,type:V.FunctionType.getEffectiveParameterType(r,s)})}));const a=r.details.paramSpec,o=n.details.paramSpec;if(s.hasSolveForScope(o.scopeId)){const e=V.FunctionType.createInstance("","","",64|r.details.flags,r.details.docString);e.details.typeVarScopeId=r.details.typeVarScopeId,i.forEach((t=>{V.FunctionType.addParameter(e,t)})),e.details.paramSpec=a?(0,U.convertToInstance)(a):void 0,hs(o,e,void 0,s)||(i.length>0||!a||!hs(o,(0,U.convertToInstance)(a),void 0,s))&&(T=!1)}else(!a||!(0,V.isTypeSame)(a,o,!1,!0)||i.length>0)&&(T=!1)}}}if(_){const a=rs(e);if(!(0,V.isAnyOrUnknown)(a)){const e=(0,U.applySolvedTypeVars)(rs(t),C),o=null==n?void 0:n.createAddendum();let l=!1;((0,V.isNever)(e)||gs(a,e,null==o?void 0:o.createAddendum(),s,i,r)||(0,V.isClassInstance)(e)&&V.ClassType.isBuiltIn(e,["TypeGuard","StrictTypeGuard"])&&te&&(0,V.isInstantiableClass)(te)&&gs(a,V.ClassType.cloneAsInstance(te),null==o?void 0:o.createAddendum(),s,i,r))&&(l=!0),l||(o&&o.addMessage(y.Localizer.DiagnosticAddendum.functionReturnTypeMismatch().format({sourceType:Ps(e),destType:Ps(a)})),T=!1)}}return T}(e,a,null==n?void 0:n.createAddendum(),null!=s?s:new z.TypeVarContext((0,U.getTypeVarScopeId)(e)),i,r))return!0}if((0,V.isOverloadedFunction)(e)){const a=null==n?void 0:n.createAddendum();return!!e.overloads.every((e=>{if(!V.FunctionType.isOverloaded(e))return!0;s&&s.addSolveForScope((0,U.getTypeVarScopeId)(e));return gs(e,t,null==a?void 0:a.createAddendum(),s||new z.TypeVarContext((0,U.getTypeVarScopeId)(e)),i,r)}))||(a&&a.addMessage(y.Localizer.DiagnosticAddendum.overloadNotAssignable().format({name:e.overloads[0].details.name})),!1)}return!(!(0,V.isClassInstance)(e)||!V.ClassType.isBuiltIn(e,"object")||0!=(1&i))||((0,V.isNoneInstance)(t)&&(0,V.isClassInstance)(e)&&V.ClassType.isProtocolClass(e)&&Y&&(0,V.isInstantiableClass)(Y)?cs(V.ClassType.cloneAsInstantiable(e),Y,n,s,i,!1,r):(0,V.isNoneInstance)(e)?(n&&n.addMessage(y.Localizer.DiagnosticAddendum.assignToNone()),!1):(n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Ps(t),destType:Ps(e)})),!1))}function fs(e,t,n,s,i,r){if((0,V.isTypeSame)(t,e,void 0,void 0,r))return!0;if((0,V.isUnion)(e)){if(0!=(4&i)){const n=e.subtypes.filter((e=>!(0,V.isAnyOrUnknown)(e)));if(1===n.length&&(0,V.isTypeVar)(n[0]))return gs(n[0],t,void 0,s,i,r),!0}const a=[];let o=[...t.subtypes],l=!1;if(e.subtypes.forEach((e=>{if((0,U.requiresSpecialization)(e))a.push(e);else{const t=o.findIndex((t=>(0,V.isTypeSame)(t,e,void 0,void 0,r)));t>=0?o.splice(t,1):l=!0}})),l||[...o].forEach((e=>{const t=a.findIndex((t=>(0,V.isClass)(e)&&(0,V.isClass)(t)&&V.TypeBase.isInstance(e)===V.TypeBase.isInstance(t)&&V.ClassType.isSameGenericClass(e,t)));t>=0&&(gs(a[t],e,null==n?void 0:n.createAddendum(),s,i,r)||(l=!0),a.splice(t,1),o=o.filter((t=>t!==e)))})),l||0===a.length&&0===o.length||1===a.length&&(0,V.isTypeVar)(a[0])&&gs(a[0],(0,V.combineTypes)(o),null==n?void 0:n.createAddendum(),s,i,r)||(l=!0),!l)return!0}let a=!1;return(0,U.doForEachSubtype)(t,((o,l)=>{if(!a&&!gs(e,o,void 0,s,i,r)){const c=lt(o);let p=!1;(0,U.doForEachSubtype)(t,((e,t)=>{p||l===t||gs(e,c,void 0,void 0,void 0,r)&&(p=!0)})),p||gs(e,c,null==n?void 0:n.createAddendum(),s,i,r)||(a=!0)}})),!a||(n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Ps(t),destType:Ps(e)})),!1)}function Ts(e,t,n,s,i,r){if(1&i){let a=!1;return(0,U.doForEachSubtype)(e,((o,l)=>{if(!a&&!gs(o,t,null==n?void 0:n.createAddendum(),s,i,r)){let t=!1;(0,V.isAnyOrUnknown)(o)||(0,U.doForEachSubtype)(e,((e,n)=>{l===n||t||gs(e,o,void 0,void 0,0,r)&&(t=!0)})),t||(a=!0)}})),!a||(n&&n.addMessage(y.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Ps(t),destType:Ps(e)})),!1)}const a=n?new c.DiagnosticAddendum:void 0;let o=!1;if((0,V.isNoneInstance)(t)&&(0,U.isOptionalType)(e))o=!0;else{let n,l;if((0,V.isClassInstance)(t)&&(0,U.isLiteralType)(t)&&V.UnionType.containsType(e,t,r))return!0;(0,U.doForEachSubtype)(e,(e=>{const c=null==s?void 0:s.clone();if(gs(e,t,null==a?void 0:a.createAddendum(),c,i,r)&&(o=!0,c)){const e=c.getScore();(void 0===l||l<=e)&&(l=e,n=c)}})),s&&n&&s.copyFromClone(n)}return o||(0,V.isTypeVar)(t)&&t.details.constraints.length>0&&(o=gs(e,lt(t),null==a?void 0:a.createAddendum(),s,i,r)),!!o||(n&&a&&(n.addMessage(y.Localizer.DiagnosticAddendum.typeAssignmentMismatch().format({sourceType:Ps(t),destType:Ps(e)})),n.addAddendum(a)),!1)}function _s(e,t=0){const n=(0,U.lookUpClassMember)(e,"__init__",12);if(n){const s=ls(n),i=V.ClassType.cloneAsInstance(e),r=e=>{let n=Fs(i,e,void 0,void 0,t);return n&&(n=V.FunctionType.clone(n),n.details.declaredReturnType=i,n.specializedTypes&&(n.specializedTypes.returnType=i)),n};if((0,V.isFunction)(s))return r(s);if((0,V.isOverloadedFunction)(s)){const e=[];if(s.overloads.forEach((t=>{const n=r(t);n&&e.push(n)})),0===e.length)return;return 1===e.length?e[0]:V.OverloadedFunctionType.create(e)}}const s=(0,U.lookUpClassMember)(e,"__new__",12);if(s){const n=ls(s),i=n=>Fs(e,n,void 0,void 0,t,!0);if((0,V.isFunction)(n))return i(n);if((0,V.isOverloadedFunction)(n)){const e=[];if(n.overloads.forEach((t=>{const n=i(t);n&&e.push(n)})),0===e.length)return;return 1===e.length?e[0]:V.OverloadedFunctionType.create(e)}}const i=V.FunctionType.createSynthesizedInstance("__new__",1);return i.details.declaredReturnType=V.ClassType.cloneAsInstance(e),V.FunctionType.addDefaultParameters(i),i}function vs(e){if(!(0,V.isClassInstance)(e)||!V.ClassType.isProtocolClass(e))return;for(const t of e.details.mro)if((0,V.isClass)(t)&&V.ClassType.isProtocolClass(t))for(const e of t.details.fields)if("__call__"!==e[0]&&!e[1].isIgnoredForProtocolMatch()){let t=!1;if(X&&(0,V.isClass)(X)&&X.details.fields.has(e[0])&&(t=!0),!t)return}const t=(0,U.lookUpObjectMember)(e,"__call__");if(!t)return;const n=ls(t);if((0,V.isFunction)(n)||(0,V.isOverloadedFunction)(n)){const t=Fs(e,n);if(t)return(0,U.removeParamSpecVariadicsFromSignature)(t)}}function bs(e,t,n,s,i,r,a,o){if((0,V.isTypeVar)(e)&&e.details.isSynthesized&&e.details.boundType&&(0,V.isClassInstance)(e.details.boundType)&&V.ClassType.isProtocolClass(e.details.boundType))return!0;if((0,V.isVariadicTypeVar)(e)&&!(0,V.isUnpacked)(t))return!1;let l=t,c=e,p=!1;if(0==(2&a))c=(0,U.applySolvedTypeVars)(e,i),(0,U.requiresSpecialization)(c)&&(p=!gs(l,c,void 0,i,642|a,o),c=(0,U.applySolvedTypeVars)(e,i));else if(l=(0,U.applySolvedTypeVars)(t,r),(0,U.requiresSpecialization)(l)&&(0,U.requiresSpecialization)(l)&&(p=!gs(l,c,void 0,r,-3&a|512,o),l=(0,U.applySolvedTypeVars)(t,r)),p)return s&&s.addMessage(y.Localizer.DiagnosticAddendum.paramAssignment().format({index:n+1,sourceType:Ps(e),destType:Ps(t)})),!1;return(0,V.isTypeVar)(c)&&c.details.isSynthesizedSelf||(0,V.isTypeVar)(l)&&l.details.isSynthesizedSelf&&l.details.boundType&&(l=(0,U.applySolvedTypeVars)(l.details.boundType,new z.TypeVarContext((0,U.getTypeVarScopeId)(l)),!0)),!(!gs(l,c,null==s?void 0:s.createAddendum(),0==(2&a)?r:i,a,o)&&!(0,V.isTypeSame)(e,t))||(s&&s.addMessage(y.Localizer.DiagnosticAddendum.paramAssignment().format({index:n+1,sourceType:Ps(e),destType:Ps(t)})),!1)}function Is(e,t){if(!t.tupleTypeArguments&&t.details.typeParameters.length>0&&t.typeArguments&&t.typeArguments.length<=t.details.typeParameters.length){const n=new z.TypeVarContext((0,U.getTypeVarScopeId)(t));Lt(V.ClassType.cloneForSpecialization(t,void 0,!1),e,n,[]);let s=!1;const i=t.typeArguments.map(((e,i)=>{const r=t.details.typeParameters[i],a=n.getTypeVarType(r);return a&&((0,V.isAny)(a)||(0,V.isAnyOrUnknown)(e))?(s=!0,a):e}));if(s)return V.ClassType.cloneForSpecialization(t,i,!0)}}function Cs(e,t){const n=new c.DiagnosticAddendum,s=(0,U.mapSubtypes)(t,(t=>{const s=(0,U.mapSubtypes)(e,(s=>{if((0,V.isAnyOrUnknown)(e))return e;if(gs(s,t,n)){if((0,V.isInstantiableClass)(s)&&(0,V.isInstantiableClass)(t)){const e=Is(s,t);e&&(t=e)}else if((0,V.isClassInstance)(s)&&(0,V.isClassInstance)(t)){const e=Is(V.ClassType.cloneAsInstantiable(s),V.ClassType.cloneAsInstantiable(t));e&&(t=V.ClassType.cloneAsInstance(e))}else{if(!(0,V.isTypeVar)(s)&&(0,V.isTypeVar)(t))return s;if((0,V.isAnyOrUnknown)(t))return s}return t}}));return(0,V.isNever)(s)?t:s}));return(0,V.isAnyOrUnknown)(t)?e:s}function Ss(e){const t=new Map;e.details.mro.forEach((e=>{(0,V.isInstantiableClass)(e)&&e.details.fields.forEach(((n,s)=>{if(n.isClassMember()){let i;const r=(0,M.getLastTypedDeclaredForSymbol)(n);if(r&&3===r.type){i=!!(8&Cn(r.node,!0))}else i=!1;t.has(s)||t.set(s,{symbol:n,symbolName:s,isAbstract:i,classType:e})}}))}));const n=[];return t.forEach((e=>{e.isAbstract&&n.push(e)})),n}function Fs(e,t,n,s,i=0,r=!1,a){if((0,V.isFunction)(t)){if(!e)return V.FunctionType.clone(t,!0);if(V.FunctionType.isInstanceMethod(t)){const r=(0,V.isClassInstance)(e)?e:V.ClassType.cloneAsInstance((0,U.specializeClassType)(e));return xs(e,t,n||V.ClassType.cloneAsInstantiable(r),s,i,a||r,(0,V.isClassInstance)(e))}if(V.FunctionType.isClassMethod(t)||r&&V.FunctionType.isConstructorMethod(t)){const r=(0,V.isInstantiableClass)(e)?e:V.ClassType.cloneAsInstantiable(e),o=a?(0,V.isInstantiableClass)(e)?a:(0,U.convertToInstantiable)(a):r;return xs(V.TypeBase.isInstance(e)?V.ClassType.cloneAsInstantiable(e):e,t,n||r,s,i,o,!0)}if(V.FunctionType.isStaticMethod(t)){const r=(0,V.isInstantiableClass)(e)?e:V.ClassType.cloneAsInstantiable(e);return xs(V.TypeBase.isInstance(e)?V.ClassType.cloneAsInstantiable(e):e,t,n||r,s,i,void 0,!1)}}else if((0,V.isOverloadedFunction)(t)){const o=V.OverloadedFunctionType.create([]);return t.overloads.forEach((t=>{if(V.FunctionType.isOverloaded(t)){const s=Fs(e,t,n,void 0,i,r,a);s&&V.OverloadedFunctionType.addOverload(o,s)}})),1===o.overloads.length?o.overloads[0]:0===o.overloads.length?void(s&&t.overloads.forEach((t=>{Fs(e,t,n,s,i,r,a)}))):o}return t}function xs(e,t,n,s,i,r,a=!0){const o=new z.TypeVarContext((0,U.getTypeVarScopeId)(n));if(r&&t.details.parameters.length>0){const n=t.details.parameters[0],a=V.FunctionType.getEffectiveParameterType(t,0),l=(0,U.stripLiteralValue)(r);o.addSolveForScope((0,U.getTypeVarScopeId)(t));const d=new c.DiagnosticAddendum;if((0,V.isTypeVar)(a)&&a.details.boundType&&(0,V.isClassInstance)(a.details.boundType)&&V.ClassType.isProtocolClass(a.details.boundType))o.isLocked()||o.setTypeVarType(a,V.TypeBase.isInstantiable(a)?(0,U.convertToInstance)(l):l);else if(!gs(a,l,d,o,void 0,i)&&n.name&&!n.isNameSynthesized&&n.hasDeclaredType){if(!s)return;{const i=t.details.name||"(unnamed)";nt(_.getFileInfo(s).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.bindTypeMismatch().format({type:Ps(e),methodName:i,paramName:n.name})+d.getString(),s)}}}rs(t);const l=(0,U.applySolvedTypeVars)(t,o);return V.FunctionType.clone(l,a,e,(0,U.getTypeVarScopeId)(e))}function Ds(e){return L.printObjectTypeForClass(e,t.printTypeFlags,rs)}function Ps(e,n=!1){let s=t.printTypeFlags;return n&&(s|=32),L.printType(e,s,rs)}const As={runWithCancellationToken:function(e,t){try{return H=e,t()}finally{H=void 0}},getType:xe,getTypeOfExpression:Ae,getTypeOfAnnotation:ke,getTypeOfClass:fn,getTypeOfFunction:_n,getTypeOfExpressionExpectingType:Gn,getExpectedType:De,evaluateTypeForSubnode:Vn,evaluateTypesForStatement:Ln,evaluateTypesForMatchStatement:function(e){if(ge(e,0))return;const t=Ae(e.subjectExpression);let n=t.type;for(const t of e.cases)t.guardExpression||(n=(0,P.narrowTypeBasedOnPattern)(As,n,t.pattern,!1));fe(e,n,0,!!t.isIncomplete)},evaluateTypesForCaseStatement:wn,evaluateTypeOfParameter:On,canBeTruthy:Me,canBeFalsy:Ne,removeTruthinessFromType:Re,removeFalsinessFromType:Oe,verifyRaiseExceptionType:function(e){const t=$n(e,"BaseException");if(e.typeExpression){const n=Ae(e.typeExpression).type;if(n&&t&&(0,V.isInstantiableClass)(t)){const s=new c.DiagnosticAddendum;if((0,U.doForEachSubtype)(n,(n=>{const i=lt(n);if(!(0,V.isAnyOrUnknown)(i))if((0,V.isInstantiableClass)(i)&&void 0===i.literalValue)if((0,U.derivesFromClassRecursive)(i,t,!1)){let t;Hn(e.typeExpression,(()=>{t=Mt(e.typeExpression,[],i,!1,void 0)})),t&&t.argumentErrors&&s.addMessage(y.Localizer.Diagnostic.exceptionTypeNotInstantiable().format({type:Ps(n,!1)}))}else s.addMessage(y.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:Ps(n,!1)}));else(0,V.isClassInstance)(i)&&(0,U.derivesFromClassRecursive)(V.ClassType.cloneAsInstantiable(i),t,!1)||s.addMessage(y.Localizer.Diagnostic.exceptionTypeIncorrect().format({type:Ps(n,!1)}))})),!s.isEmpty()){nt(_.getFileInfo(e).diagnosticRuleSet.reportGeneralTypeIssues,p.DiagnosticRule.reportGeneralTypeIssues,y.Localizer.Diagnostic.expectedExceptionClass()+s.getString(),e.typeExpression)}}}},verifyDeleteExpression:dt,isAfterNodeReachable:Ze,isNodeReachable:Ye,isAsymmetricDescriptorAssignment:function(e){return i.has(e.id)},suppressDiagnostics:Hn,getDeclarationsForStringNode:function(e){var t;const n=[],s=null===(t=De(e))||void 0===t?void 0:t.type;return s&&(0,U.doForEachSubtype)(s,(t=>{var s,i;if((0,V.isClassInstance)(t)&&V.ClassType.isTypedDictClass(t)){if(null===(s=t.details.typedDictEntries)||void 0===s?void 0:s.get(e.value)){const s=null===(i=(0,U.lookUpObjectMember)(t,e.value))||void 0===i?void 0:i.symbol;s&&(0,o.appendArray)(n,s.getDeclarations())}}})),0===n.length?void 0:n},getDeclarationsForNameNode:function(e,t=!0){var n;if(t&&_.isCodeUnreachable(e))return;const s=[];if(e.parent&&23===e.parent.nodeType&&e.parent.alias&&e===e.parent.name){const t=E.getScopeForNode(e);if(t){const n=t.lookUpSymbolRecursive(e.parent.alias.value);if(n){const t=n.symbol.getDeclarations().filter((t=>6===t.type&&t.node===e.parent));(0,o.appendArray)(s,(0,S.getDeclarationsWithUsesLocalNameRemoved)(t))}}}else if(e.parent&&35===e.parent.nodeType&&e===e.parent.memberName){let t=xe(e.parent.leftExpression);if(t){t=lt(t);const n=e.parent.memberName.value;(0,U.doForEachSubtype)(t,(e=>{let t;if(e=lt(e),(0,V.isInstantiableClass)(e)){let s=(0,U.lookUpClassMember)(e,n,16);if(s||(s=(0,U.lookUpClassMember)(e,n)),!s){const t=e.details.effectiveMetaclass;t&&(0,V.isInstantiableClass)(t)&&(s=(0,U.lookUpClassMember)(t,n))}s&&(t=s.symbol)}else if((0,V.isClassInstance)(e)){let s=(0,U.lookUpObjectMember)(e,n,16);s||(s=(0,U.lookUpObjectMember)(e,n)),s&&(t=s.symbol)}else(0,V.isModule)(e)&&(t=V.ModuleType.getField(e,n));if(t){const e=t.getTypedDeclarations();e.length>0?(0,o.appendArray)(s,e):(0,o.appendArray)(s,t.getDeclarations())}}))}}else if(e.parent&&37===e.parent.nodeType){const t=e.parent.nameParts.findIndex((t=>t===e)),n=_.getImportInfo(e.parent);t>=0&&n&&!n.isNativeLib&&t<n.resolvedPaths.length&&n.resolvedPaths[t]&&(Ln(e),s.push((0,S.createSynthesizedAliasDeclaration)(n.resolvedPaths[t])))}else if(e.parent&&1===e.parent.nodeType&&e===e.parent.name){const t=e.parent,i=e.value;if(t.parent&&9===t.parent.nodeType){const e=Ae(t.parent.leftExpression,2).type;if(e)if((0,V.isFunction)(e)&&e.details.declaration){const t=Zn(e,i);t&&s.push(t)}else if((0,V.isOverloadedFunction)(e))e.overloads.forEach((e=>{const t=Zn(e,i);t&&s.push(t)}));else if((0,V.isInstantiableClass)(e)){const r=null===(n=Le(t.parent.leftExpression,V.ClassType.cloneAsInstance(e),"__init__",{method:"get"},void 0,4))||void 0===n?void 0:n.type;if(r&&(0,V.isFunction)(r)){const t=Zn(r,i);if(t)s.push(t);else if(V.ClassType.isDataClass(e)){const t=(0,U.lookUpClassMember)(e,i);t&&(0,o.appendArray)(s,t.symbol.getDeclarations())}}}}}else{const t=_.getFileInfo(e),n=D.isWithinTypeAnnotation(e,!(0,T.isAnnotationEvaluationPostponed)(_.getFileInfo(e))),i=n||t.isStubFile,r=Kn(e,e.value,!i,n);r&&(0,o.appendArray)(s,r.symbol.getDeclarations())}return s},getTypeForDeclaration:Qn,resolveAliasDeclaration:Xn,resolveAliasDeclarationWithInfo:es,getTypeOfIterable:Ge,getTypeOfIterator:je,getGetterTypeFromProperty:ms,getTypeOfArgument:Wn,markNamesAccessed:function(e,t){const n=_.getFileInfo(e),s=E.getScopeForNode(e);s&&t.forEach((t=>{const i=s.lookUpSymbolRecursive(t);i&&ut(n,i.symbol,e)}))},getScopeIdForNode:gt,makeTopLevelTypeVarsConcrete:lt,mapSubtypesExpandTypeVars:ct,populateTypeVarContextBasedOnExpectedType:Lt,lookUpSymbolRecursive:Kn,getDeclaredTypeOfSymbol:ss,getEffectiveTypeOfSymbol:ts,getEffectiveTypeOfSymbolForUsage:ns,getInferredTypeOfDeclaration:Jn,getDeclaredTypeForExpression:Be,getFunctionDeclaredReturnType:os,getFunctionInferredReturnType:as,getBestOverloadForArguments:kt,getBuiltInType:$n,getTypeOfMember:ls,getTypeOfObjectMember:Le,getBoundMethod:Ue,getTypeOfMagicMethodReturn:Qt,bindFunctionToClassOrObject:Fs,getCallSignatureInfo:function(e,t,n){const s=e.leftExpression,i=xe(s);if(void 0===i)return;const r=[];let a=0;function o(){r.push({argumentCategory:a,type:V.UnknownType.create(),active:!0})}e.arguments.forEach(((e,s)=>{let i=!1;s===t&&(n?i=!0:o()),a=e.argumentCategory,r.push({valueExpression:e.valueExpression,argumentCategory:e.argumentCategory,name:e.name,active:i})})),e.arguments.length<t&&o();const l=[];function c(t){let n;Yn(e,(()=>{n=Wt(s,r,t,new z.TypeVarContext((0,U.getTypeVarScopeId)(t)),!0)})),l.push({type:t,activeParam:null==n?void 0:n.activeParam})}function p(e){(0,V.isFunction)(e)?c(e):e.overloads.forEach((e=>{V.FunctionType.isOverloaded(e)&&c(e)}))}return(0,U.doForEachSubtype)(i,(e=>{switch(e.category){case 5:case 6:p(e);break;case 7:if(V.TypeBase.isInstantiable(e)){let t;t=Ue(e,"__init__");const n=!!t&&(0,V.isFunction)(t)&&"builtins.object.__init__"===t.details.fullName,s=!!t&&(0,V.isFunction)(t)&&V.FunctionType.isSkipConstructorCheck(t);if(!t||n||s){const n=Ue(e,"__new__",!0);if(n){(0,V.isFunction)(n)&&"builtins.object.__new__"===n.details.fullName||(t=n)}}t&&p(t)}else{const t=Ue(e,"__call__");t&&p(t)}}})),0!==l.length?{callNode:e,signatures:l}:void 0},getAbstractMethods:Ss,narrowConstrainedTypeVar:function(e,t){const n=_.getFlowNode(e);if(n)return Es.narrowConstrainedTypeVar(n,t)},canAssignType:gs,canOverrideMethod:function(e,t,n,s=!0){var i,r;if((0,V.isOverloadedFunction)(e)){const t=e.overloads.find((e=>!V.FunctionType.isOverloaded(e)));if(!t)return!0;e=t}if(!(0,V.isFunction)(e))return n.addMessage(y.Localizer.DiagnosticAddendum.overrideType().format({type:Ps(e)})),!1;const a=(0,U.getParameterListDetails)(e),o=(0,U.getParameterListDetails)(t);let l=!0,c=!1;if(o.positionParamCount<a.positionParamCount)void 0===o.argsIndex&&void 0===o.kwargsIndex&&(c=!0);else if(o.positionParamCount>a.positionParamCount)for(let e=a.positionParamCount;e<o.positionParamCount;e++){const t=o.params[e].param;0===t.category&&t.name&&!t.hasDefault&&(c=!0)}c&&(n.addMessage(y.Localizer.DiagnosticAddendum.overridePositionalParamCount().format({baseCount:a.params.length,overrideCount:o.params.length})),l=!1);const p=Math.min(a.positionParamCount,o.positionParamCount);for(let e=0;e<p;e++){if(0===e&&(V.FunctionType.isInstanceMethod(t)||V.FunctionType.isClassMethod(t)||V.FunctionType.isConstructorMethod(t)))continue;const i=a.params[e].param,r=o.params[e].param;if(e>=a.positionOnlyParamCount&&!(0,N.isPrivateOrProtectedName)(i.name||"")&&0===i.category&&i.name!==r.name)0===r.category&&s&&(o.params[e].source===U.ParameterSource.PositionOnly?n.addMessage(y.Localizer.DiagnosticAddendum.overrideParamNamePositionOnly().format({index:e+1,baseName:i.name||"*"})):n.addMessage(y.Localizer.DiagnosticAddendum.overrideParamName().format({index:e+1,baseName:i.name||"*",overrideName:r.name||"*"})),l=!1);else if(e<o.positionOnlyParamCount&&e>=a.positionOnlyParamCount)n.addMessage(y.Localizer.DiagnosticAddendum.overrideParamNamePositionOnly().format({index:e+1,baseName:i.name||"*"})),l=!1;else{const s=a.params[e].type,c=o.params[e].type,p=(0,V.isTypeVar)(s)&&s.details.isSynthesized,d=(0,V.isTypeVar)(c)&&c.details.isSynthesized;p||d||i.category===r.category&&gs(c,s,n.createAddendum(),new z.TypeVarContext((0,U.getTypeVarScopeId)(t)),8)||(n.addMessage(y.Localizer.DiagnosticAddendum.overrideParamType().format({index:e+1,baseType:Ps(s),overrideType:Ps(c)})),l=!1),a.params[e].param.hasDefault&&!o.params[e].param.hasDefault&&(n.addMessage(y.Localizer.DiagnosticAddendum.overrideParamNoDefault().format({index:e+1})),l=!1)}}if(void 0!==a.argsIndex)if(void 0===o.argsIndex)n.addMessage(y.Localizer.DiagnosticAddendum.overrideParamNameMissing().format({name:null!==(i=a.params[a.argsIndex].param.name)&&void 0!==i?i:"?"})),l=!1;else{const e=o.params[o.argsIndex].type,s=a.params[a.argsIndex].type;gs(e,s,n.createAddendum(),new z.TypeVarContext((0,U.getTypeVarScopeId)(t)),8)||(n.addMessage(y.Localizer.DiagnosticAddendum.overrideParamKeywordType().format({name:null!==(r=o.params[o.argsIndex].param.name)&&void 0!==r?r:"?",baseType:Ps(s),overrideType:Ps(e)})),l=!1)}const d=a.params.filter((e=>e.source===U.ParameterSource.KeywordOnly&&0===e.param.category)),u=o.params.filter((e=>e.source===U.ParameterSource.KeywordOnly&&0===e.param.category));d.forEach((e=>{var s,i,r;const a=u.find((t=>e.param.name===t.param.name));a?(gs(a.type,e.type,n.createAddendum(),new z.TypeVarContext((0,U.getTypeVarScopeId)(t)),8)||(n.addMessage(y.Localizer.DiagnosticAddendum.overrideParamKeywordType().format({name:null!==(i=e.param.name)&&void 0!==i?i:"?",baseType:Ps(e.type),overrideType:Ps(a.type)})),l=!1),e.param.hasDefault&&!a.param.hasDefault&&(n.addMessage(y.Localizer.DiagnosticAddendum.overrideParamKeywordNoDefault().format({name:null!==(r=a.param.name)&&void 0!==r?r:"?"})),l=!1)):(n.addMessage(y.Localizer.DiagnosticAddendum.overrideParamNameMissing().format({name:null!==(s=e.param.name)&&void 0!==s?s:"?"})),l=!1)})),u.forEach((e=>{var t;d.find((t=>e.param.name===t.param.name))||void 0===a.kwargsIndex&&(e.param.hasDefault||(n.addMessage(y.Localizer.DiagnosticAddendum.overrideParamNameExtra().format({name:null!==(t=e.param.name)&&void 0!==t?t:"?"})),l=!1))}));const m=rs(e),h=rs(t);return gs(m,h,n.createAddendum(),new z.TypeVarContext((0,U.getTypeVarScopeId)(e)),8)||(n.addMessage(y.Localizer.DiagnosticAddendum.overrideReturnType().format({baseType:Ps(m),overrideType:Ps(h)})),l=!1),l},canAssignProtocolClassToSelf:function e(t,n,s=0){(0,l.assert)(V.ClassType.isProtocolClass(t)),(0,l.assert)(V.ClassType.isProtocolClass(n)),(0,l.assert)(V.ClassType.isSameGenericClass(t,n)),(0,l.assert)(t.details.typeParameters.length>0);const i=new c.DiagnosticAddendum,r=new z.TypeVarContext;let a=!0;return t.details.fields.forEach(((e,o)=>{if(a&&e.isClassMember()&&!e.isIgnoredForProtocolMatch()){const c=(0,U.lookUpClassMember)(n,o);(0,l.assert)(void 0!==c);let p=ss(e);if(p){const o=ls(c);if(p=(0,U.partiallySpecializeType)(p,t),(0,V.isClassInstance)(p)&&V.ClassType.isPropertyClass(p)&&(0,V.isClassInstance)(o)&&V.ClassType.isPropertyClass(o))(0,A.canAssignProperty)(As,V.ClassType.cloneAsInstantiable(p),V.ClassType.cloneAsInstantiable(o),t,n,i,r,s)||(a=!1);else{const t=e.getDeclarations()[0],n=1!==(null==t?void 0:t.type)||t.isFinal?0:1;gs(p,o,i,r,n,s)||(a=!1)}}}})),t.details.baseClasses.forEach((i=>{if((0,V.isInstantiableClass)(i)&&V.ClassType.isProtocolClass(i)&&!V.ClassType.isBuiltIn(i,"object")&&!V.ClassType.isBuiltIn(i,"Protocol")&&i.details.typeParameters.length>0){e((0,U.specializeForBaseClass)(t,i),(0,U.specializeForBaseClass)(n,i),s)||(a=!1)}})),a},assignTypeToExpression:pt,getBuiltInObject:qn,getTypingType:$e,inferReturnTypeIfNecessary:is,addError:Xe,addWarning:function(e,t,n){return et("warning",e,t,n)},addInformation:Je,addUnusedCode:function(e,t){if(!tt(e)){_.getFileInfo(e).diagnosticSink.addUnusedCodeWithTextRange(y.Localizer.Diagnostic.unreachableCode(),t)}},addDeprecated:function(e,t){if(!tt(t)){_.getFileInfo(t).diagnosticSink.addDeprecatedWithTextRange(e,t)}},addDiagnostic:nt,addDiagnosticForTextRange:st,printType:Ps,printFunctionParts:function(e){return L.printFunctionParts(e,t.printTypeFlags,rs)},getTypeCacheSize:function(){return le.size},disposeEvaluator:function(){ae=new Map,oe=new Map,le=new Map,ce=new Map,pe=new Map},useSpeculativeMode:Yn,setTypeForNode:_e,checkForCancellation:ye},Es=(0,v.getCodeFlowEngine)(As,r);return As}},96938:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createTypeEvaluatorWithTracker=void 0;const s=n(98173),i=n(76962),r=n(68755);t.createTypeEvaluatorWithTracker=function(e,t,n,a){if(!t.logCalls&&(0,s.isDebugMode)())return(0,r.createTypeEvaluator)(e,t);function o(e,s,r){return t.logCalls?n.log(e,(e=>(e.add(null==a?void 0:a.print(r)),i.timingStats.typeEvaluationTime.timeOperation(s))),t.minimumLoggingThreshold,!0):i.timingStats.typeEvaluationTime.timeOperation(s)}const l=t.logCalls?s=>n.log("import lookup",(t=>(t.add(null==a?void 0:a.printFileOrModuleName(s)),e(s))),t.minimumLoggingThreshold,!0):e,c=(0,r.createTypeEvaluator)(l,t);return{runWithCancellationToken:c.runWithCancellationToken,getType:e=>o("getType",(()=>c.getType(e)),e),getTypeOfExpression:(e,t,n)=>o("getTypeOfExpression",(()=>c.getTypeOfExpression(e,t,n)),e),getTypeOfAnnotation:c.getTypeOfAnnotation,getTypeOfClass:e=>o("getTypeOfClass",(()=>c.getTypeOfClass(e)),e),getTypeOfFunction:e=>o("getTypeOfFunction",(()=>c.getTypeOfFunction(e)),e),getTypeOfExpressionExpectingType:c.getTypeOfExpressionExpectingType,evaluateTypeForSubnode:c.evaluateTypeForSubnode,evaluateTypesForStatement:e=>o("evaluateTypesForStatement",(()=>c.evaluateTypesForStatement(e)),e),evaluateTypesForMatchStatement:c.evaluateTypesForMatchStatement,evaluateTypesForCaseStatement:c.evaluateTypesForCaseStatement,evaluateTypeOfParameter:c.evaluateTypeOfParameter,canBeTruthy:c.canBeTruthy,canBeFalsy:c.canBeFalsy,removeTruthinessFromType:c.removeTruthinessFromType,removeFalsinessFromType:c.removeFalsinessFromType,getExpectedType:e=>o("getExpectedType",(()=>c.getExpectedType(e)),e),verifyRaiseExceptionType:e=>o("verifyRaiseExceptionType",(()=>c.verifyRaiseExceptionType(e)),e),verifyDeleteExpression:e=>o("verifyDeleteExpression",(()=>c.verifyDeleteExpression(e)),e),isAfterNodeReachable:e=>o("isAfterNodeReachable",(()=>c.isAfterNodeReachable(e)),e),isNodeReachable:(e,t)=>o("isNodeReachable",(()=>c.isNodeReachable(e,t)),e),isAsymmetricDescriptorAssignment:c.isAsymmetricDescriptorAssignment,suppressDiagnostics:(e,t)=>o("suppressDiagnostics",(()=>c.suppressDiagnostics(e,t))),getDeclarationsForStringNode:e=>o("getDeclarationsForStringNode",(()=>c.getDeclarationsForStringNode(e)),e),getDeclarationsForNameNode:(e,t)=>o("getDeclarationsForNameNode",(()=>c.getDeclarationsForNameNode(e,t)),e),getTypeForDeclaration:e=>o("getTypeForDeclaration",(()=>c.getTypeForDeclaration(e)),e),resolveAliasDeclaration:(e,t,n)=>o("resolveAliasDeclaration",(()=>c.resolveAliasDeclaration(e,t,n)),e),resolveAliasDeclarationWithInfo:(e,t,n)=>o("resolveAliasDeclarationWithInfo",(()=>c.resolveAliasDeclarationWithInfo(e,t,n)),e),getTypeOfIterable:(e,t,n)=>o("getTypeOfIterable",(()=>c.getTypeOfIterable(e,t,n)),e),getTypeOfIterator:(e,t,n)=>o("getTypeOfIterator",(()=>c.getTypeOfIterator(e,t,n)),e),getGetterTypeFromProperty:(e,t)=>o("getGetterTypeFromProperty",(()=>c.getGetterTypeFromProperty(e,t)),e),getTypeOfArgument:c.getTypeOfArgument,markNamesAccessed:(e,t)=>o("markNamesAccessed",(()=>c.markNamesAccessed(e,t)),e),getScopeIdForNode:c.getScopeIdForNode,makeTopLevelTypeVarsConcrete:e=>o("makeTopLevelTypeVarsConcrete",(()=>c.makeTopLevelTypeVarsConcrete(e)),e),mapSubtypesExpandTypeVars:c.mapSubtypesExpandTypeVars,populateTypeVarContextBasedOnExpectedType:c.populateTypeVarContextBasedOnExpectedType,lookUpSymbolRecursive:c.lookUpSymbolRecursive,getDeclaredTypeOfSymbol:c.getDeclaredTypeOfSymbol,getEffectiveTypeOfSymbol:e=>o("getEffectiveTypeOfSymbol",(()=>c.getEffectiveTypeOfSymbol(e)),e),getEffectiveTypeOfSymbolForUsage:(e,t,n)=>o("getEffectiveTypeOfSymbolForUsage",(()=>c.getEffectiveTypeOfSymbolForUsage(e,t,n)),e),getInferredTypeOfDeclaration:c.getInferredTypeOfDeclaration,getDeclaredTypeForExpression:c.getDeclaredTypeForExpression,getFunctionDeclaredReturnType:e=>o("getFunctionDeclaredReturnType",(()=>c.getFunctionDeclaredReturnType(e)),e),getFunctionInferredReturnType:(e,t)=>o("getFunctionInferredReturnType",(()=>c.getFunctionInferredReturnType(e,t)),e),getBestOverloadForArguments:(e,t,n)=>c.getBestOverloadForArguments(e,t,n),getBuiltInType:(e,t)=>o("getBuiltInType",(()=>c.getBuiltInType(e,t)),e),getTypeOfMember:e=>o("getTypeOfMember",(()=>c.getTypeOfMember(e)),e.symbol),getTypeOfObjectMember:c.getTypeOfObjectMember,getBoundMethod:c.getBoundMethod,getTypeOfMagicMethodReturn:c.getTypeOfMagicMethodReturn,bindFunctionToClassOrObject:c.bindFunctionToClassOrObject,getCallSignatureInfo:(e,t,n)=>o("getCallSignatureInfo",(()=>c.getCallSignatureInfo(e,t,n)),e),getAbstractMethods:e=>o("getAbstractMethods",(()=>c.getAbstractMethods(e)),e),narrowConstrainedTypeVar:c.narrowConstrainedTypeVar,canAssignType:(e,t,n,s,i)=>o("canAssignType",(()=>c.canAssignType(e,t,n,s,i)),e),canOverrideMethod:(e,t,n,s)=>o("canOverrideMethod",(()=>c.canOverrideMethod(e,t,n,s)),t),canAssignProtocolClassToSelf:(e,t)=>o("canAssignProtocolClassToSelf",(()=>c.canAssignProtocolClassToSelf(e,t))),assignTypeToExpression:c.assignTypeToExpression,getBuiltInObject:c.getBuiltInObject,getTypingType:c.getTypingType,inferReturnTypeIfNecessary:c.inferReturnTypeIfNecessary,addError:(e,t)=>o("addError",(()=>c.addError(e,t)),t),addWarning:(e,t)=>o("addWarning",(()=>c.addWarning(e,t)),t),addInformation:(e,t)=>o("addInformation",(()=>c.addInformation(e,t)),t),addUnusedCode:(e,t)=>o("addUnusedCode",(()=>c.addUnusedCode(e,t)),e),addDeprecated:(e,t)=>o("addDeprecated",(()=>c.addDeprecated(e,t)),t),addDiagnostic:(e,t,n,s)=>o("addDiagnostic",(()=>c.addDiagnostic(e,t,n,s)),s),addDiagnosticForTextRange:(e,t,n,s,i)=>o("addDiagnosticForTextRange",(()=>c.addDiagnosticForTextRange(e,t,n,s,i))),printType:(e,t)=>o("printType",(()=>c.printType(e,t)),e),printFunctionParts:e=>o("printFunctionParts",(()=>c.printFunctionParts(e)),e),getTypeCacheSize:c.getTypeCacheSize,disposeEvaluator:c.disposeEvaluator,useSpeculativeMode:c.useSpeculativeMode,setTypeForNode:c.setTypeForNode,checkForCancellation:c.checkForCancellation}}},89806:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.enumerateLiteralsForType=t.getTypeNarrowingCallback=void 0;const a=n(55390),o=n(35696),l=r(n(23241)),c=n(57203),p=n(97882),d=n(22387),u=n(59195),m=n(10425),y=n(58922);function h(e,t,n,s){if(4===n.nodeType)return function(e,t,n,s){var i;return null!==(i=h(e,t,n.rightExpression,s))&&void 0!==i?i:h(e,t,n.name,s)}(e,t,n,s);if(7===n.nodeType){const i=39===n.operator||40===n.operator,r=12===n.operator||28===n.operator;if(i||r){const a=39===n.operator||12===n.operator?s:!s;if(11===n.rightExpression.nodeType&&26===n.rightExpression.constType){let s=n.leftExpression;if(4===s.nodeType&&(s=s.name),l.isMatchingExpression(t,s))return t=>function(e,t,n){const s=(0,m.mapSubtypes)(t,(e=>(0,m.transformPossibleRecursiveTypeAlias)(e)));return e.mapSubtypesExpandTypeVars(s,void 0,((e,t)=>{if((0,u.isAnyOrUnknown)(e))return e;const s=(0,u.isTypeVar)(t)&&0===t.details.constraints.length?t:e;return(0,u.isClassInstance)(e)&&u.ClassType.isBuiltIn(e,"object")?n?(0,m.addConditionToType)(u.NoneType.createInstance(),e.condition):s:(0,u.isNoneInstance)(e)===n?e:void 0}))}(e,t,a);if(24===s.nodeType&&l.isMatchingExpression(t,s.baseExpression)&&1===s.items.length&&!s.trailingComma&&0===s.items[0].argumentCategory&&!s.items[0].name&&40===s.items[0].valueExpression.nodeType&&s.items[0].valueExpression.isInteger&&!s.items[0].valueExpression.isImaginary){const t=s.items[0].valueExpression.value;if("number"==typeof t)return n=>function(e,t,n,s){return e.mapSubtypesExpandTypeVars(t,void 0,(t=>{const i=(0,m.getSpecializedTupleType)(t);if(!i||(0,m.isUnboundedTupleClass)(i)||!i.tupleTypeArguments)return t;const r=i.tupleTypeArguments.length;if(s<0||s>=r)return t;const a=e.makeTopLevelTypeVarsConcrete(i.tupleTypeArguments[s].type);if(n){if(!e.canAssignType(a,u.NoneType.createInstance()))return}else if((0,u.isNoneInstance)(a))return;return t}))}(e,n,a,t)}}if(i&&9===n.leftExpression.nodeType){const s=e.getTypeOfExpression(n.leftExpression.leftExpression,2).type;if((0,u.isInstantiableClass)(s)&&u.ClassType.isBuiltIn(s,"type")&&1===n.leftExpression.arguments.length&&0===n.leftExpression.arguments[0].argumentCategory){const s=n.leftExpression.arguments[0].valueExpression;if(l.isMatchingExpression(t,s)){const t=e.makeTopLevelTypeVarsConcrete(e.getTypeOfExpression(n.rightExpression).type);if((0,u.isInstantiableClass)(t))return e=>function(e,t,n){return(0,m.mapSubtypes)(e,(e=>{if((0,u.isClassInstance)(e)){const s=u.ClassType.isDerivedFrom(t,u.ClassType.cloneAsInstantiable(e));if(n)return s?u.ClassType.isSameGenericClass(e,t)?e:u.ClassType.cloneAsInstance(t):void 0;if(s&&u.ClassType.isFinal(e))return;return e}return(0,u.isNoneInstance)(e)?n?void 0:e:(0,u.isAnyOrUnknown)(e)&&n?u.ClassType.cloneAsInstance(t):e}))}(e,t,a)}}}if(i&&l.isMatchingExpression(t,n.leftExpression)){const t=e.getTypeOfExpression(n.rightExpression).type;if((0,u.isClassInstance)(t)&&(u.ClassType.isEnumClass(t)||u.ClassType.isBuiltIn(t,"bool"))&&void 0!==t.literalValue)return n=>v(e,n,t,a,!0)}if(r){const i=12===n.operator?s:!s;if(l.isMatchingExpression(t,n.leftExpression)){const t=e.getTypeOfExpression(n.rightExpression).type;if((0,u.isClassInstance)(t)&&void 0!==t.literalValue)return n=>v(e,n,t,i,!1)}if(l.isMatchingExpression(t,n.rightExpression)){const t=e.getTypeOfExpression(n.leftExpression).type;if((0,u.isClassInstance)(t)&&void 0!==t.literalValue)return n=>v(e,n,t,i,!1)}if(24===n.leftExpression.nodeType&&1===n.leftExpression.items.length&&!n.leftExpression.trailingComma&&0===n.leftExpression.items[0].argumentCategory&&l.isMatchingExpression(t,n.leftExpression.baseExpression)){const t=e.getTypeOfExpression(n.leftExpression.items[0].valueExpression).type;if((0,u.isClassInstance)(t)&&(0,m.isLiteralType)(t))if(u.ClassType.isBuiltIn(t,"str")){const s=e.getTypeOfExpression(n.rightExpression).type;if((0,u.isClassInstance)(s)&&void 0!==s.literalValue)return n=>function(e,t,n,s,i){let r=!0;const a=(0,m.mapSubtypes)(t,(t=>{if((0,u.isClassInstance)(t)&&u.ClassType.isTypedDictClass(t)){const r=(0,d.getTypedDictMembersForClass)(e,t).get(n.literalValue);if(r&&(0,m.isLiteralTypeOrUnion)(r.valueType))return i?e.canAssignType(r.valueType,s)?t:void 0:e.canAssignType(s,r.valueType)?void 0:t}return r=!1,t}));return r?a:t}(e,n,t,s,i)}else if(u.ClassType.isBuiltIn(t,"int")){const s=e.getTypeOfExpression(n.rightExpression).type;if((0,u.isClassInstance)(s)&&void 0!==s.literalValue)return n=>function(e,t,n,s,i){let r=!0;const a=(0,m.mapSubtypes)(t,(t=>{var a;if((0,u.isClassInstance)(t)&&u.ClassType.isTupleClass(t)&&!(0,m.isUnboundedTupleClass)(t)&&"number"==typeof n.literalValue){const r=n.literalValue;if(t.tupleTypeArguments&&r>=0&&r<t.tupleTypeArguments.length){const n=null===(a=t.tupleTypeArguments[r])||void 0===a?void 0:a.type;if(n&&(0,m.isLiteralTypeOrUnion)(n))return i?e.canAssignType(n,s)?t:void 0:e.canAssignType(s,n)?void 0:t}}return r=!1,t}));return r?a:t}(e,n,t,s,i)}}}if(r&&9===n.leftExpression.nodeType&&1===n.leftExpression.arguments.length&&40===n.rightExpression.nodeType&&n.rightExpression.isInteger){const s=n.leftExpression.arguments[0].valueExpression;if(l.isMatchingExpression(t,s)){const t=e.getTypeOfExpression(n.leftExpression.leftExpression,2).type;if((0,u.isFunction)(t)&&"builtins.len"===t.details.fullName){const t=n.rightExpression.value;if("number"==typeof t)return n=>function(e,t,n,s){return(0,m.mapSubtypes)(t,(t=>{const i=e.makeTopLevelTypeVarsConcrete(t);if(!(0,u.isClassInstance)(i)||!(0,m.isTupleClass)(i)||(0,m.isUnboundedTupleClass)(i)||!i.tupleTypeArguments)return t;return i.tupleTypeArguments.length===n===s?t:void 0}))}(e,n,t,a)}}}if(r&&35===n.leftExpression.nodeType&&l.isMatchingExpression(t,n.leftExpression.leftExpression)){const t=e.getTypeOfExpression(n.rightExpression).type,s=n.leftExpression.memberName;if((0,u.isClassInstance)(t)&&void 0!==t.literalValue)return n=>_(e,n,s.value,t,a)}if(35===n.leftExpression.nodeType&&l.isMatchingExpression(t,n.leftExpression.leftExpression)){const t=e.getTypeOfExpression(n.rightExpression).type,s=n.leftExpression.memberName;if((0,u.isClassInstance)(t)&&(u.ClassType.isEnumClass(t)||u.ClassType.isBuiltIn(t,"bool"))&&void 0!==t.literalValue)return n=>_(e,n,s.value,t,a)}if(35===n.leftExpression.nodeType&&l.isMatchingExpression(t,n.leftExpression.leftExpression)&&11===n.rightExpression.nodeType&&26===n.rightExpression.constType){const t=n.leftExpression.memberName;return n=>function(e,t,n,s){return(0,m.mapSubtypes)(t,(t=>{let i;if((0,u.isClassInstance)(t)?i=(0,m.lookUpObjectMember)(t,n):(0,u.isInstantiableClass)(t)&&(i=(0,m.lookUpClassMember)(t,n)),i&&i.isTypeDeclared){const t=e.makeTopLevelTypeVarsConcrete(e.getTypeOfMember(i));let n=!0;if(s?(0,m.doForEachSubtype)(t,(t=>{t=e.makeTopLevelTypeVarsConcrete(t),((0,m.isProperty)(t)||(0,m.isMaybeDescriptorInstance)(t))&&(n=!1),((0,u.isAnyOrUnknown)(t)||(0,u.isNoneInstance)(t)||(0,u.isNever)(t))&&(n=!1)})):n=(0,u.isNoneInstance)(t),n)return}return t}))}(e,n,t.value,a)}}if(41===n.operator&&s&&l.isMatchingExpression(t,n.leftExpression)){const t=e.getTypeOfExpression(n.rightExpression).type;return n=>function(e,t,n){if(!(0,u.isClassInstance)(n)||!u.ClassType.isBuiltIn(n))return t;const s=n.details.name;if(!["list","set","frozenset","deque","tuple"].some((e=>e===s)))return t;if(!n.typeArguments||1!==n.typeArguments.length)return t;let i=n.typeArguments[0];(0,m.isTupleClass)(n)&&n.tupleTypeArguments&&(i=(0,u.combineTypes)(n.tupleTypeArguments.map((e=>e.type))));let r=!0;const a=(0,m.stripLiteralValue)(i),o=(0,m.mapSubtypes)(t,(t=>(0,u.isAnyOrUnknown)(t)?(r=!1,t):e.canAssignType(i,t)?t:e.canAssignType(a,t)?(0,m.mapSubtypes)(i,(e=>{if((0,u.isClassInstance)(e)&&(0,u.isSameWithoutLiteralValue)(t,e))return e})):void 0));return r?o:t}(e,n,t)}if((41===n.operator||42===n.operator)&&l.isMatchingExpression(t,n.rightExpression)){const t=e.getTypeOfExpression(n.leftExpression).type;if((0,u.isClassInstance)(t)&&u.ClassType.isBuiltIn(t,"str")&&(0,m.isLiteralType)(t)){const i=41===n.operator?s:!s;return n=>function(e,t,n,s){return(0,m.mapSubtypes)(t,(t=>{if((0,u.isClassInstance)(t)&&u.ClassType.isTypedDictClass(t)){const i=(0,d.getTypedDictMembersForClass)(e,t,!0).get(n.literalValue);if(s){if(!i)return u.ClassType.isFinal(t)?void 0:t;if(i.isRequired||i.isProvided)return t;const e=t.typedDictNarrowedEntries,s=new Map;return e&&e.forEach(((e,t)=>{s.set(t,e)})),s.set(n.literalValue,{valueType:i.valueType,isRequired:!1,isProvided:!0}),u.ClassType.cloneAsInstance(u.ClassType.cloneForNarrowedTypedDictEntries(u.ClassType.cloneAsInstantiable(t),s))}return void 0!==i&&(i.isRequired||i.isProvided)?void 0:t}return t}))}(e,n,u.ClassType.cloneAsInstantiable(t),i)}}}if(9===n.nodeType){const i=e.getTypeOfExpression(n.leftExpression,2).type;if((0,u.isFunction)(i)&&("isinstance"===i.details.builtInName||"issubclass"===i.details.builtInName)&&2===n.arguments.length){const r="isinstance"===i.details.builtInName,a=n.arguments[0].valueExpression,o=n.arguments[1].valueExpression;if(l.isMatchingExpression(t,a)){const t=function(e){let t=!1;const n=[],s=e=>{e.forEach((e=>{(0,u.isInstantiableClass)(e)||(0,u.isTypeVar)(e)&&u.TypeBase.isInstantiable(e)||(0,u.isNoneTypeClass)(e)||(0,u.isFunction)(e)&&2===e.details.parameters.length&&1===e.details.parameters[0].category&&2===e.details.parameters[1].category?n.push(e):t=!0}))};return(0,m.doForEachSubtype)(e,(e=>{(0,u.isClass)(e)&&u.TypeBase.isInstance(e)&&(0,m.isTupleClass)(e)?e.tupleTypeArguments&&s(e.tupleTypeArguments.map((e=>e.type))):s([e])})),t?void 0:n}(e.getTypeOfExpression(o,168).type);if(t)return i=>{const a=T(e,i,t,r,s,!1,n);return(0,u.isNever)(a)?T(e,i,t,r,s,!0,n):a}}}if((0,u.isFunction)(i)&&"callable"===i.details.builtInName&&1===n.arguments.length){const i=n.arguments[0].valueExpression;if(l.isMatchingExpression(t,i))return t=>{let i=I(e,t,s,n,!1);return s&&(0,u.isNever)(i)&&(i=I(e,t,s,n,!0)),i}}if((0,u.isInstantiableClass)(i)&&u.ClassType.isBuiltIn(i,"bool")&&1===n.arguments.length&&!n.arguments[0].name&&l.isMatchingExpression(t,n.arguments[0].valueExpression))return t=>f(e,t,s);if(n.arguments.length>=1){const r=n.arguments[0].valueExpression;if(l.isMatchingExpression(t,r)&&(0,u.isFunction)(i)&&i.details.declaredReturnType&&(0,u.isClassInstance)(i.details.declaredReturnType)&&u.ClassType.isBuiltIn(i.details.declaredReturnType,["TypeGuard","StrictTypeGuard"])){const t=e.getTypeOfExpression(n).type;if((0,u.isClassInstance)(t)&&u.ClassType.isBuiltIn(t,"bool")&&t.typeGuardType){const n=u.ClassType.isBuiltIn(i.details.declaredReturnType,"StrictTypeGuard"),r=t.typeGuardType;return t=>function(e,t,n,s,i){if(!i)return s?n:t;return(0,m.mapSubtypes)(t,(t=>(0,m.mapSubtypes)(n,(i=>{const r=e.canAssignType(n,t),a=e.canAssignType(t,i);if(s){if(r)return t;if(a)return i}else if(!r&&!r)return t}))))}(e,t,r,s,n)}}}}if(l.isMatchingExpression(t,n))return t=>f(e,t,s);const i=function(e,t,n,s){if(38!==n.nodeType||38!==t.nodeType||n===t)return;const i=g(e,n,n);if(!i||1!==i.length||1!==i[0].type)return;const r=g(e,t,n);if(!r)return;let o=[];r.length>1&&(o=r.filter((t=>e.isNodeReachable(n,t.node)&&e.isNodeReachable(t.node,i[0].node))));if(0!==o.length)return;const c=i[0].inferredTypeSource;if(!c||l.isNodeContainedWithin(n,c)||!(0,a.isExpressionNode)(c))return;return h(e,t,c,s)}(e,t,n,s);return i||(38===t.nodeType&&55===n.nodeType&&38===n.operator?h(e,t,n.expression,!s):void 0)}function g(e,t,n){const s=(0,c.getScopeForNode)(t);if(1!==(null==s?void 0:s.type)&&3!==(null==s?void 0:s.type))return;const i=s.lookUpSymbol(t.value);if(!i)return;const r=i.getDeclarations();if(0===r.length||r.some((e=>1!==e.type&&2!==e.type)))return;let a;if(r.some((e=>{const t=2===e.type?e.node.name:e.node,n=l.getExecutionScopeNode(t);return!(!a||n===a)||(a=n,!1)})))return;const o=r.filter((t=>e.isNodeReachable(n,t.node)));return o.length>0?o:void 0}function f(e,t,n){return(0,m.mapSubtypes)(t,(t=>{if(n){if(e.canBeTruthy(t))return e.removeFalsinessFromType(t)}else if(e.canBeFalsy(t))return e.removeTruthinessFromType(t)}))}function T(e,t,n,s,i,r,a){const c=(0,m.mapSubtypes)(t,(e=>(0,m.transformPossibleRecursiveTypeAlias)(e))),p=(t,c,p,d)=>{const h=[];let g=!1,f=!1;for(const d of n){const n=e.makeTopLevelTypeVarsConcrete(d);if((0,u.isInstantiableClass)(n)){const T=!(0,u.isTypeVar)(d)&&(u.ClassType.isDerivedFrom(t,n)||s&&u.ClassType.isProtocolClass(n)&&e.canAssignType(n,t)||u.ClassType.isBuiltIn(n,"dict")&&u.ClassType.isTypedDictClass(t)),_=u.ClassType.isDerivedFrom(n,t)||s&&u.ClassType.isProtocolClass(t)&&e.canAssignType(t,n);if(T&&(g=!0),_&&T&&!u.ClassType.isSameGenericClass(t,n)&&(f=!0),i)if(T)h.push((0,m.addConditionToType)(t,p));else if(_){let n=d;if((0,u.isClass)(d)&&(u.ClassType.isSpecialBuiltIn(d)||d.details.typeParameters.length>0)){const s=new y.TypeVarContext((0,m.getTypeVarScopeId)(d)),i=u.ClassType.cloneForSpecialization(d,void 0,!1);e.populateTypeVarContextBasedOnExpectedType(i,t,s,void 0)&&(n=(0,m.applySolvedTypeVars)(i,s,!0))}h.push((0,m.addConditionToType)(n,p))}else if(r){const e=`<subclass of ${t.details.name} and ${n.details.name}>`,i=(0,o.getFileInfo)(a);let r=u.ClassType.createInstantiable(e,l.getClassFullName(a,i.moduleName,e),i.moduleName,i.filePath,0,l.getTypeSourceId(a),void 0,t.details.effectiveMetaclass,t.details.docString);r.details.baseClasses=[u.ClassType.cloneAsInstantiable(t),n],(0,m.computeMroLinearization)(r),r=(0,m.addConditionToType)(r,n.condition),(0,u.isTypeVar)(c)&&!c.details.isParamSpec&&0===c.details.constraints.length&&(r=(0,m.addConditionToType)(r,[{typeVarName:u.TypeVarType.getNameWithScope(c),constraintIndex:0,isConstrainedTypeVar:!1}])),h.push(s?u.ClassType.cloneAsInstance(r):r)}}else if((0,u.isTypeVar)(d)&&u.TypeBase.isInstantiable(d))s&&u.TypeBase.isInstance(c)?(0,u.isTypeVar)(c)&&(0,u.isTypeSame)((0,m.convertToInstance)(d),c)?i&&h.push(c):i?h.push((0,m.convertToInstance)(d)):(h.push(c),f=!0):!s&&u.TypeBase.isInstantiable(c)&&((0,u.isTypeVar)(c)&&(0,u.isTypeSame)(d,c)?i&&h.push(c):i?h.push(d):(h.push(c),f=!0));else if((0,u.isFunction)(d)&&s){let e=!1;(0,u.isClass)(t)&&(e=!!u.TypeBase.isInstantiable(c)||!!(0,m.lookUpClassMember)(t,"__call__")),e&&(i?h.push(c):g=!0)}}return i||g&&!f||h.push(d),s?h.map((e=>(0,m.convertToInstance)(e))):h},d=[],h=[],g=e.mapSubtypesExpandTypeVars(c,void 0,((t,r)=>{const o=(0,m.getTypeCondition)(t)?t:r,l=(0,u.isClassInstance)(t)&&u.ClassType.isBuiltIn(t,"type");if(i&&(0,u.isAnyOrUnknown)(t))return s?d.push((0,u.combineTypes)(n.map((e=>(0,m.convertToInstance)(e))))):d.push((0,u.combineTypes)(n)),void h.push(t);if(s){if((0,u.isNoneInstance)(t)){const e=n.some((e=>(0,u.isNoneTypeClass)(e)));return i?e?t:void 0:e?void 0:t}if(((0,u.isModule)(t)||(0,u.isClassInstance)(t)&&u.ClassType.isBuiltIn(t,"ModuleType"))&&i){const t=n.filter((t=>{const n=e.makeTopLevelTypeVarsConcrete(t);return(0,u.isInstantiableClass)(n)&&u.ClassType.isProtocolClass(n)}));if(t.length>0)return(0,m.convertToInstance)((0,u.combineTypes)(t))}if((0,u.isClassInstance)(t)&&!l)return(0,u.combineTypes)(p(u.ClassType.cloneAsInstantiable(t),(0,m.convertToInstance)(r),(0,m.getTypeCondition)(t),o));if(((0,u.isFunction)(t)||(0,u.isOverloadedFunction)(t))&&s)return(0,u.combineTypes)(((t,s)=>{const r=[];if(i)for(const i of n){const n=e.makeTopLevelTypeVarsConcrete(i);e.canAssignType(t,(0,m.convertToInstance)(n))&&((0,u.isFunction)(i)?r.push(s):r.push((0,m.convertToInstance)(i)))}else n.some((n=>{const s=e.makeTopLevelTypeVarsConcrete(n);return!((0,u.isClass)(s)&&!u.ClassType.isProtocolClass(s))&&e.canAssignType(t,(0,m.convertToInstance)(s))}))||r.push(s);return r})(t,(0,m.convertToInstance)(r)));if((0,u.isInstantiableClass)(t)||l){const e=n.some((e=>(0,u.isInstantiableClass)(e)&&u.ClassType.isBuiltIn(e,"type")));return i?e?o:void 0:e?void 0:o}}else{if((0,u.isInstantiableClass)(t))return(0,u.combineTypes)(p(t,r,(0,m.getTypeCondition)(t),o));if(l){const n=e.getBuiltInObject(a,"object");if(n&&(0,u.isClassInstance)(n))return(0,u.combineTypes)(p(u.ClassType.cloneAsInstantiable(n),(0,m.convertToInstantiable)(r),(0,m.getTypeCondition)(t),o))}}return i?void 0:o}));return(0,u.isNever)(g)&&d.length>0?(0,u.combineTypes)(d):h.length>0?(0,u.combineTypes)([g,...h]):g}function _(e,t,n,s,i){return(0,m.mapSubtypes)(t,(t=>{let r;if((0,u.isClassInstance)(t)?r=(0,m.lookUpObjectMember)(t,n):(0,u.isInstantiableClass)(t)&&(r=(0,m.lookUpClassMember)(t,n)),r&&r.isTypeDeclared){const n=e.getTypeOfMember(r);if((0,m.isLiteralTypeOrUnion)(n))return i?e.canAssignType(n,s)?t:void 0:e.canAssignType(s,n)?void 0:t}return t}))}function v(e,t,n,s,i){return(0,m.mapSubtypes)(t,(t=>{if(t=e.makeTopLevelTypeVarsConcrete(t),(0,u.isClassInstance)(t)&&u.ClassType.isSameGenericClass(n,t)){if(void 0!==t.literalValue){const e=u.ClassType.isLiteralValueSame(t,n);if(e&&!s||!e&&s)return;return t}if(s)return n;{const s=b(e,t);if(s&&s.length>0)return(0,u.combineTypes)(s.filter((e=>!u.ClassType.isLiteralValueSame(e,n))))}}else if(s&&(i||(0,u.isNoneInstance)(t)))return;return t}))}function b(e,t){if(u.ClassType.isBuiltIn(t,"bool"))return[u.ClassType.cloneWithLiteral(t,!0),u.ClassType.cloneWithLiteral(t,!1)];if(u.ClassType.isEnumClass(t)){const n=[];return t.details.fields.forEach((s=>{if(!s.isIgnoredForProtocolMatch()){const i=e.getEffectiveTypeOfSymbol(s);(0,u.isClassInstance)(i)&&u.ClassType.isSameGenericClass(t,i)&&void 0!==i.literalValue&&n.push(i)}})),n}}function I(e,t,n,s,i){return e.mapSubtypesExpandTypeVars(t,void 0,(e=>{switch(e.category){case 5:case 6:return n?e:void 0;case 3:case 8:return n?void 0:e;case 7:if(u.TypeBase.isInstantiable(e))return n?e:void 0;if((0,m.lookUpClassMember)(e,"__call__"))return n?e:void 0;if(!n)return e;if(i){const t=`<callable subtype of ${e.details.name}>`,n=(0,o.getFileInfo)(s);let i=u.ClassType.createInstantiable(t,l.getClassFullName(s,n.moduleName,t),n.moduleName,n.filePath,0,l.getTypeSourceId(s),void 0,e.details.effectiveMetaclass,e.details.docString);i.details.baseClasses=[u.ClassType.cloneAsInstantiable(e)],(0,m.computeMroLinearization)(i),i=(0,m.addConditionToType)(i,e.condition);const r=u.FunctionType.createSynthesizedInstance("__call__"),a={category:0,name:"self",type:u.ClassType.cloneAsInstance(i),hasDeclaredType:!0};return u.FunctionType.addParameter(r,a),u.FunctionType.addDefaultParameters(r),r.details.declaredReturnType=u.UnknownType.create(),i.details.fields.set("__call__",p.Symbol.createWithType(4,r)),u.ClassType.cloneAsInstance(i)}return;default:return e}}))}t.getTypeNarrowingCallback=h,t.enumerateLiteralsForType=b},22105:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.printFunctionParts=t.printObjectTypeForClass=t.printLiteralValue=t.printType=void 0;const a=r(n(23241)),o=n(59195),l=n(10425),c=/'/g,p=/\\"/g;function d(e,t,n,s=[]){const i=0!=(16&t),r=0!=(128&t);if(t&=-145,e.typeAliasInfo){let i=!0;if((0==(32&t)||s.find((t=>t===e)))&&(i=!1),!i)try{s.push(e);let i=e.typeAliasInfo.name;const r=e.typeAliasInfo.typeParameters;if(r){let a;e.typeAliasInfo.typeArguments?(0==(2&t)||e.typeAliasInfo.typeArguments.some((e=>!(0,o.isAnyOrUnknown)(e))))&&(a=[],e.typeAliasInfo.typeArguments.forEach(((e,i)=>{const c=i<r.length?r[i]:r[r.length-1];(0,o.isVariadicTypeVar)(c)&&(0,o.isClassInstance)(e)&&(0,l.isTupleClass)(e)&&e.tupleTypeArguments?e.tupleTypeArguments.forEach((e=>{a.push(d(e.type,t,n,s))})):a.push(d(e,t,n,s))}))):(0==(2&t)||r.some((e=>!(0,o.isAnyOrUnknown)(e))))&&(a=[],r.forEach((e=>{a.push(d(e,t,n,s))}))),a&&(0===a.length?i+="[()]":i+=`[${a.join(", ")}]`)}if(10!==e.category)return i}finally{s.pop()}}if(s.find((t=>{var n;return t===e||void 0!==t.typeAliasInfo&&t.typeAliasInfo.fullName===(null===(n=e.typeAliasInfo)||void 0===n?void 0:n.fullName)}))||s.length>o.maxTypeRecursionCount)return(0,o.isTypeVar)(e)&&e.details.isSynthesized&&e.details.recursiveTypeAliasName?e.details.recursiveTypeAliasName:e.typeAliasInfo?e.typeAliasInfo.name:"...";try{s.push(e);const a=0==(64&t),c=e=>void 0!==e.condition&&a?"*":"";switch(e.category){case 0:return"Unbound";case 1:return 0!=(1&t)?"Any":"Unknown";case 8:return`Module("${e.moduleName}")`;case 7:return o.TypeBase.isInstance(e)?void 0!==e.literalValue?`Literal[${u(e)}]`:`${m(e,t,n,s)}${c(e)}`:void 0!==e.literalValue?`Type[Literal[${u(e)}]]${c(e)}`:`Type[${m(e,t,n,s)}]${c(e)}`;case 5:{const i=y(e,t,n,s),a=`(${i[0].join(", ")})`;if(o.FunctionType.isParamSpecValue(e))return a;const l=`${a} -> ${i[1]}`;return r?`(${l})`:l}case 6:return`Overload[${e.overloads.map((e=>d(e,t,n,s))).join(", ")}]`;case 9:{const r=new Set,a=new Set,c=8&t?128|t:t;if(0==(32&t)&&e.typeAliasSources)for(const t of e.typeAliasSources){let i=!0,l=!0;const p=new Set;for(const n of t.subtypes){let t=0,s=!1;for(const i of e.subtypes){if((0,o.isTypeSame)(n,i,void 0,!0)){r.has(t)||(l=!1),p.add(t),s=!0;break}t++}if(!s){i=!1;break}}i&&!l&&(a.add(d(t,c,n,s)),p.forEach((e=>r.add(e))))}const p=e.subtypes.findIndex((e=>(0,o.isNoneInstance)(e)));if(p>=0&&!r.has(p)){const r=(0,o.removeNoneFromUnion)(e);if((0,o.isNever)(r))return"None";const a=d(r,c,n,s);if(8&t){const e=a+" | None";return i?`(${e})`:e}return"Optional["+a+"]"}const m=new Set,y=new Set;(0,l.doForEachSubtype)(e,((e,t)=>{r.has(t)||((0,o.isClassInstance)(e)&&void 0!==e.literalValue?m.add(u(e)):(0,o.isInstantiableClass)(e)&&void 0!==e.literalValue?y.add(u(e)):a.add(d(e,c,n,s)))}));const h=[];if(a.forEach((e=>h.push(e))),m.size>0){const e=[];m.forEach((t=>e.push(t))),h.push(`Literal[${e.join(", ")}]`)}if(y.size>0){const e=[];y.forEach((t=>e.push(t))),h.push(`Type[Literal[${e.join(", ")}]]`)}if(1===h.length)return h[0];if(8&t){const e=h.join(" | ");return i?`(${e})`:e}return`Union[${h.join(", ")}]`}case 10:{if(e.details.isSynthesized){if(e.details.recursiveTypeAliasName)return 0!=(32&t)&&e.details.boundType?d(o.TypeBase.isInstance(e)?(0,l.convertToInstance)(e.details.boundType):e.details.boundType,t,n,s):e.details.recursiveTypeAliasName;if(e.details.isSynthesizedSelf&&e.details.boundType){let i=d(e.details.boundType,-33&t,n,s);return(0,o.isAnyOrUnknown)(e.details.boundType)||(i=`Self@${i}`),o.TypeBase.isInstantiable(e)?`Type[${i}]`:i}return 0!=(1&t)?"Any":"Unknown"}if(e.details.isParamSpec)return e.paramSpecAccess?`${e.details.name}.${e.paramSpecAccess}`:`${o.TypeVarType.getReadableName(e)}`;let i=o.TypeVarType.getReadableName(e);return e.isVariadicUnpacked&&(i=`*${i}`),o.TypeBase.isInstantiable(e)?`Type[${i}]`:i}case 3:return`${o.TypeBase.isInstantiable(e)?"Type[None]":"None"}${c(e)}`;case 4:return e.isNoReturn?"NoReturn":"Never";case 2:return e.isEllipsis?"...":"Any"}return""}finally{s.pop()}}function u(e,t="'"){const n=e.literalValue;if(void 0===n)return"";let s;if("string"==typeof n){const i="bytes"===e.details.name?"b":"";let r=n;const a=50;n.length>a&&(r=n.substring(0,a)+"…"),s=JSON.stringify(r).toString(),'"'!==t&&(s=`'${s.substring(1,s.length-1).replace(p,'"').replace(c,"\\'")}'`),i&&(s=`${i}${s}`)}else"boolean"==typeof n?s=n?"True":"False":n instanceof o.EnumLiteral?s=`${n.className}.${n.itemName}`:"bigint"==typeof n?(s=n.toString(),s.endsWith("n")&&(s=s.substring(0,s.length-1))):s=n.toString();return s}function m(e,t,n,s=[]){var i,r;let a=e.aliasName||e.details.name;if(!o.ClassType.isPseudoGenericClass(e)){const l=o.ClassType.getTypeParameters(e),c=l.length>0?l[l.length-1]:void 0,p=!!c&&c.details.isVariadic,u=null!==(i=e.tupleTypeArguments)&&void 0!==i?i:null===(r=e.typeArguments)||void 0===r?void 0:r.map((e=>({type:e,isUnbounded:!1})));if(u)if(u.length>0){const i=[];let r=!0;u.forEach(((e,a)=>{const c=a<l.length?l[a]:void 0;if(c&&c.details.isVariadic&&(0,o.isClassInstance)(e.type)&&o.ClassType.isBuiltIn(e.type,"tuple")&&e.type.tupleTypeArguments)0===e.type.tupleTypeArguments.length?((0,o.isAnyOrUnknown)(e.type)||(r=!1),i.push("()")):i.push(...e.type.tupleTypeArguments.map((e=>{(0,o.isAnyOrUnknown)(e.type)||(r=!1);const i=d(e.type,t,n,s);return e.isUnbounded?`*tuple[${i}, ...]`:i})));else{(0,o.isAnyOrUnknown)(e.type)||(r=!1);const a=d(e.type,t,n,s);e.isUnbounded?1===u.length?i.push(a,"..."):i.push(`*tuple[${a}, ...]`):i.push(a)}})),e.isUnpacked&&(a="*"+a),0!=(2&t)&&r||(a+="["+i.join(", ")+"]")}else(o.ClassType.isTupleClass(e)||p)&&(a+="[()]");else l.length>0&&(0==(2&t)||l.some((e=>!(0,o.isAnyOrUnknown)(e))))&&(a+="["+l.map((e=>d(e,t,n,s))).join(", ")+"]")}return a}function y(e,t,n,s=[]){const i=[];let r=!1;e.details.parameters.forEach(((l,c)=>{if(c===e.details.parameters.length-1&&1===l.category&&(0,o.isVariadicTypeVar)(l.type)){const r=o.FunctionType.getEffectiveParameterType(e,c);if((0,o.isClassInstance)(r)&&o.ClassType.isBuiltIn(r,"tuple")&&r.tupleTypeArguments)return void r.tupleTypeArguments.forEach((e=>{const r=d(e.type,t,n,s);i.push(r)}))}let p="";1===l.category?l.name&&l.isNameSynthesized||(p+="*"):2===l.category&&(p+="**"),l.name&&!l.isNameSynthesized&&(p+=l.name,r=!0);let u="=",m=!1;if(l.name)if(l.hasDeclaredType||l.isTypeInferred){const i=o.FunctionType.getEffectiveParameterType(e,c),r=s.length<o.maxTypeRecursionCount?d(i,t,n,s):"";l.isNameSynthesized?1!==l.category||(0,o.isUnpacked)(i)||(p+="*"):p+=": ",2===l.category&&(0,o.isUnpacked)(i)&&(p+="**"),p+=r,(0,o.isParamSpec)(i)&&(1!==l.category&&2!==l.category||(m=!0)),u=" = "}else 0==(2&t)&&(l.isNameSynthesized||(p+=": "),p+="Unknown",u=" = ");else if(0===l.category){if(!r)return;p+="/"}if(l.hasDefault&&(l.defaultValueExpression?p+=u+a.printExpression(l.defaultValueExpression):p+=u+"..."),o.FunctionType.shouldSkipArgsKwargsCompatibilityCheck(e)&&!m)if(1===l.category)p="...";else if(2===l.category)return;i.push(p)})),e.details.paramSpec&&i.push(`**${d(e.details.paramSpec,t,n,s)}`);const l=n(e),c=s.length<o.maxTypeRecursionCount?d(l,144|t,n,s):"";return[i,c]}t.printType=d,t.printLiteralValue=u,t.printObjectTypeForClass=m,t.printFunctionParts=y},96786:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.TypeStubWriter=void 0;const a=r(n(35696)),o=r(n(23241)),l=n(22339),c=n(57203),p=r(n(91197)),d=n(59195);class u{constructor(e){this.importName=e,this.isAccessed=!1}}class m extends u{constructor(e,t,n){super(e),this.alias=t,this.symbol=n}}class y extends u{constructor(e,t,n){super(e),this.isWildcardImport=t,this.node=n,this.symbols=[]}addSymbol(e,t,n,s=!1){this.symbols.find((e=>e.name===t))||this.symbols.push({symbol:e,name:t,alias:n,isAccessed:s})}}class h extends l.ParseTreeWalker{constructor(e,t){super(),this._accessedImportedSymbols=e,this._treatStringsAsSymbols=t}analyze(e){this.walk(e)}walk(e){a.isCodeUnreachable(e)||super.walk(e)}visitName(e){return this._accessedImportedSymbols.set(e.value,!0),!0}visitMemberAccess(e){const t=this._getRecursiveModuleAccessExpression(e.leftExpression);return t&&this._accessedImportedSymbols.set(`${t}.${e.memberName.value}`,!0),!0}visitString(e){return this._treatStringsAsSymbols&&this._accessedImportedSymbols.set(e.value,!0),!0}_getRecursiveModuleAccessExpression(e){if(38===e.nodeType)return e.value;if(35===e.nodeType){const t=this._getRecursiveModuleAccessExpression(e.leftExpression);if(!t)return;return`${t}.${e.memberName.value}`}}}class g extends l.ParseTreeWalker{constructor(e,t,n){super(),this._stubPath=e,this._sourceFile=t,this._evaluator=n,this._indentAmount=0,this._includeAllImports=!1,this._typeStubText="",this._lineEnd="\n",this._tab=" ",this._classNestCount=0,this._functionNestCount=0,this._ifNestCount=0,this._emittedSuite=!1,this._emitDocString=!0,this._trackedImportAs=new Map,this._trackedImportFrom=new Map,this._accessedImportedSymbols=new Map,this._stubPath.endsWith("__init__.pyi")&&(this._includeAllImports=!0)}write(){const e=this._sourceFile.getParseResults();this._lineEnd=e.tokenizerOutput.predominantEndOfLineSequence,this._tab=e.tokenizerOutput.predominantTabSequence,this.walk(e.parseTree),this._writeFile()}walk(e){a.isCodeUnreachable(e)||super.walk(e)}visitClass(e){const t=e.name.value;this._emittedSuite=!0,this._emitDocString=!0,this._emitDecorators(e.decorators);let n=`class ${t}`;const s=e.arguments.filter((e=>void 0!==e.name||0!==e.argumentCategory||38!==e.valueExpression.nodeType||"object"!==e.valueExpression.value));return s.length>0&&(n+=`(${s.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,s=e.isAsync?"async ":"";if(s+=`def ${t}`,s+=`(${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&&(s+=" -> "+n),s+=":",!n){const t=this._evaluator.getTypeOfFunction(e);if(t&&(0,d.isFunction)(t.functionType)){let e=this._evaluator.getFunctionInferredReturnType(t.functionType);e=(0,d.removeUnknownFromUnion)(e),(0,d.isNever)(e)||(0,d.isUnknown)(e)||(s+=` # -> ${this._evaluator.printType(e,!1)}:`)}}this._emitLine(s),this._emitSuite((()=>{this._functionNestCount++,this.walk(e.suite),this._functionNestCount--})),this._emitLine("")}return!1}visitWhile(e){return this._emitDocString=!1,!1}visitFor(e){return this._emitDocString=!1,!1}visitTry(e){return this._emitDocString=!1,!1}visitWith(e){return this._emitDocString=!1,!1}visitIf(e){if(this._emitDocString=!1,0===this._functionNestCount&&0===this._ifNestCount){this._ifNestCount++,this._emittedSuite=!0,this._emitLine("if "+this._printExpression(e.testExpression)+":"),this._emitSuite((()=>{this.walkMultiple(e.ifSuite.statements)}));const t=e.elseSuite;t&&(this._emitLine("else:"),this._emitSuite((()=>{19===t.nodeType?this.walkMultiple([t.testExpression,t.ifSuite,t.elseSuite]):this.walkMultiple(t.statements)}))),this._ifNestCount--}return!1}visitAssignment(e){let t=!1,n="";if(38===e.leftExpression.nodeType){if("__all__"===e.leftExpression.value)return 0===this._functionNestCount&&0===this._ifNestCount&&(this._emittedSuite=!0,n=this._printExpression(e.leftExpression),n+=" = ",n+=this._printExpression(e.rightExpression),this._emitLine(n)),!1;if(0===this._functionNestCount){n=this._printExpression(e.leftExpression),e.typeAnnotationComment&&(n+=": "+this._printExpression(e.typeAnnotationComment,!0));const s=this._evaluator.getType(e.leftExpression);if(null==s?void 0:s.typeAliasInfo)t=!0;else if(9===e.rightExpression.nodeType){const n=this._evaluator.getType(e.rightExpression.leftExpression);n&&(0,d.isInstantiableClass)(n)&&d.ClassType.isBuiltIn(n,["TypeVar","TypeVarTuple","ParamSpec","NewType"])&&(t=!0)}}}else if(54===e.leftExpression.nodeType){const t=e.leftExpression.valueExpression;38===t.nodeType&&0===this._functionNestCount&&(n=`${this._printExpression(t)}: ${this._printExpression(e.leftExpression.typeAnnotation,!0)}`)}return n&&(this._emittedSuite=!0,n+=" = ",n+=t?this._printExpression(e.rightExpression):"...",this._emitLine(n)),!1}visitAugmentedAssignment(e){if(38===e.leftExpression.nodeType&&"__all__"===e.leftExpression.value&&1===e.operator&&0===this._functionNestCount&&0===this._ifNestCount){let t=this._printExpression(e.leftExpression);t+=" += ",t+=this._printExpression(e.rightExpression),this._emitLine(t)}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=(0,c.getScopeForNode)(e);return t&&e.list.forEach((e=>{const n=this._printModuleName(e.module);if(!this._trackedImportAs.has(n)){const s=e.alias?e.alias.value:e.module.nameParts.length>0?e.module.nameParts[0].value:"",i=t.lookUpSymbolRecursive(s);if(i){const t=new m(n,e.alias?e.alias.value:void 0,i.symbol);this._trackedImportAs.set(n,t)}}})),!1}visitImportFrom(e){if(this._functionNestCount>0||this._classNestCount>0)return!1;const t=(0,c.getScopeForNode)(e);if(t){const n=this._printModuleName(e.module);let s=this._trackedImportFrom.get(n);s||(s=new y(n,e.isWildcardImport,e),this._trackedImportFrom.set(n,s)),e.imports.forEach((e=>{const n=e.alias?e.alias.value:e.name.value,i=t.lookUpSymbolRecursive(n);i&&s.addSymbol(i.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 s="";1===e.category?s+="*":2===e.category&&(s+="**"),e.name&&(s+=e.name.value);const i=o.getTypeAnnotationForParameter(t,n);let r="";return i&&(r=this._printExpression(i,!0)),r&&(s+=": "+r),e.defaultValue&&(s+=r?" = ...":"=..."),s}_printExpression(e,t=!1,n=!1){return new h(this._accessedImportedSymbols,n).analyze(e),o.printExpression(e,t?1:0)}_printTrackedImports(){let e="",t=!1;return this._trackedImportAs.forEach((n=>{this._accessedImportedSymbols.get(n.alias||n.importName)&&(n.isAccessed=!0),(n.isAccessed||this._includeAllImports)&&(e+=`import ${n.importName}`,n.alias&&(e+=` as ${n.alias}`),e+=this._lineEnd,t=!0)})),this._trackedImportFrom.forEach((n=>{n.symbols.forEach((e=>{this._accessedImportedSymbols.get(e.alias||e.name)&&(e.isAccessed=!0)})),n.isWildcardImport&&(e+=`from ${n.importName} import *`+this._lineEnd,t=!0);const s=n.symbols.filter((e=>e.isAccessed||this._includeAllImports)).sort(((e,t)=>e.name<t.name?-1:e.name>t.name?1:0));s.length>0&&(e+=`from ${n.importName} import `,e+=s.map((e=>{let t=e.name;return e.alias&&(t+=" as "+e.alias),t})).join(", "),e+=this._lineEnd,t=!0)})),t&&(e+=this._lineEnd),e}_writeFile(){let e=this._printHeaderDocString();e+=this._printTrackedImports(),e+=this._typeStubText,this._sourceFile.fileSystem.writeFileSync(this._stubPath,e,"utf8")}}t.TypeStubWriter=g},10425:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getGeneratorYieldType=t.getDeclaredGeneratorReturnType=t.synthesizeTypeVarForSelfCls=t.derivesFromClassRecursive=t.specializeForBaseClass=t.buildTypeVarContext=t.buildTypeVarContextFromSpecializedClass=t.setTypeArgumentsRecursive=t.specializeClassType=t.getTypeVarArgumentsRecursive=t.addTypeVarsToListIfUnique=t.getClassFieldsRecursive=t.getClassIterator=t.getClassMemberIterator=t.lookUpClassMember=t.lookUpObjectMember=t.getProtocolSymbols=t.transformExpectedTypeForConstructor=t.applySolvedTypeVars=t.populateTypeVarContextForSelfType=t.partiallySpecializeType=t.isUnboundedTupleClass=t.isTupleClass=t.isMaybeDescriptorInstance=t.isDescriptorInstance=t.isProperty=t.isEllipsisType=t.getUnionSubtypeCount=t.getLiteralTypeClassName=t.containsLiteralType=t.isLiteralTypeOrUnion=t.isLiteralType=t.getSpecializedTupleType=t.getTypeVarScopeId=t.transformPossibleRecursiveTypeAlias=t.isTypeAliasRecursive=t.isTypeAliasPlaceholder=t.getTypeCondition=t.addConditionToType=t.stripLiteralValue=t.getFullNameOfType=t.derivesFromAnyOrUnknown=t.isUnionableType=t.preserveUnknown=t.areTypesSame=t.doForEachSubtype=t.mapSubtypes=t.isOptionalType=t.getParameterListDetails=t.ParameterSource=void 0,t.convertParamSpecValueToType=t.getDeclaringModulesForType=t.computeMroLinearization=t.requiresSpecialization=t.requiresTypeArguments=t.getGeneratorTypeArgs=t.removeParamSpecVariadicsFromFunction=t.removeParamSpecVariadicsFromSignature=t.specializeTupleClass=t.combineSameSizedTuples=t.explodeGenericClass=t.isPartlyUnknown=t.containsUnknown=t.getMembersForModule=t.getMembersForClass=t.convertToInstantiable=t.convertToInstance=t.isEffectivelyInstantiable=void 0;const s=n(9133),i=n(20823),r=n(97882),a=n(91197),o=n(15020),l=n(59195),c=n(58922);var p;function d(e,t){if((0,l.isUnion)(e)){const n=[];let s=!1;if(e.subtypes.forEach((i=>{const r=t(i);r?r!==i?(n.push(y(r,h(e))),s=!0):n.push(i):s=!0})),!s)return e;const i=(0,l.combineTypes)(n);return 9===i.category&&l.UnionType.addTypeAliasSource(i,e),i}const n=t(e);return n||l.NeverType.createNever()}function u(e,t){(0,l.isUnion)(e)?e.subtypes.forEach(((e,n)=>{t(e,n)})):t(e,0)}function m(e){return(0,l.isClass)(e)?(void 0!==e.literalValue&&(e=l.ClassType.cloneWithLiteral(e,void 0)),e):(0,l.isUnion)(e)?d(e,(e=>m(e))):e}function y(e,t){if(!t)return e;switch(e.category){case 0:case 1:case 2:case 4:case 8:case 10:return e;case 3:case 5:case 7:return l.TypeBase.cloneForCondition(e,l.TypeCondition.combine(e.condition,t));case 6:return l.OverloadedFunctionType.create(e.overloads.map((e=>y(e,t))));case 9:return(0,l.combineTypes)(e.subtypes.map((e=>y(e,t))))}}function h(e){switch(e.category){case 0:case 1:case 2:case 4:case 8:case 10:case 6:case 9:return;case 3:case 7:case 5:return e.condition}}function g(e){return(0,l.isClass)(e)||(0,l.isFunction)(e)?e.details.typeVarScopeId:(0,l.isTypeVar)(e)?e.scopeId:void 0}function f(e){return l.TypeBase.isInstance(e)&&void 0!==e.literalValue}function T(e,t=!1,n=0){var s;if(n>l.maxTypeRecursionCount)return!1;if(n++,(0,l.isClassInstance)(e)&&f(e))return!0;if(t&&(0,l.isClass)(e)){const i=(null===(s=e.tupleTypeArguments)||void 0===s?void 0:s.map((e=>e.type)))||e.typeArguments;if(i)return i.some((e=>T(e,t,n)))}if((0,l.isUnion)(e))return e.subtypes.some((e=>T(e,t,n)));if((0,l.isOverloadedFunction)(e))return e.overloads.some((e=>T(e,t,n)));if((0,l.isFunction)(e)){const s=l.FunctionType.getSpecializedReturnType(e);if(s&&T(s,t,n))return!0;for(let s=0;s<e.details.parameters.length;s++){if(T(l.FunctionType.getEffectiveParameterType(e,s),t,n))return!0}}return!1}function _(e,t=!1){return(0,l.isUnion)(e)?e.subtypes.some((e=>_(e,t))):!!(0,l.isClassInstance)(e)&&(!!e.details.fields.has("__get__")&&!(t&&!e.details.fields.has("__set__")))}function v(e){return l.ClassType.isBuiltIn(e,"tuple")}function b(e){return e.tupleTypeArguments&&e.tupleTypeArguments.some((e=>e.isUnbounded))}function I(e,t,n,s){if(l.ClassType.isUnspecialized(t))return e;const i=E(t,void 0);return n&&C(i,t,n),S(e,i,void 0,void 0,void 0,s)}function C(e,t,n){const s=w(t,!1);e.setTypeVarType(s,N(n))}function S(e,t,n=!1,s=!1,i=!1,r){if(t.isEmpty()&&!n&&!i)return e;return new j(t,n,s,i,r).apply(e)}function F(e,t,n=0){n>l.maxTypeRecursionCount||(e.details.baseClasses.forEach((e=>{(0,l.isClass)(e)&&l.ClassType.isProtocolClass(e)&&F(e,t,n+1)})),e.details.fields.forEach(((n,s)=>{n.isIgnoredForProtocolMatch()||t.set(s,{symbol:n,classType:e,isInstanceMember:n.isInstanceMember(),isClassVar:n.isClassVar(),isTypeDeclared:n.hasTypedDeclarations(),skippedUndeclaredType:!1})})))}function x(e,t,n=0){var s;return null===(s=D(e,t,n).next())||void 0===s?void 0:s.value}function*D(e,t,n=0){const s=0!=(16&n);let i=!1;if((0,l.isClass)(e)){let a=0;1&n&&(a|=1),2&n&&(a|=2),4&n&&(a|=4),32&n&&(a|=8);const o=P(e,a);for(const[e,a]of o){if(!(0,l.isInstantiableClass)(e)){if(!s){const e={symbol:r.Symbol.createWithType(0,l.UnknownType.create()),isInstanceMember:!1,isClassVar:!0,classType:l.UnknownType.create(),isTypeDeclared:!1,skippedUndeclaredType:!1};yield e}continue}if(!(0,l.isInstantiableClass)(a))continue;const o=a.details.fields;if(0==(8&n)){const e=o.get(t);if(e&&e.isInstanceMember()){const t=e.hasTypedDeclarations();if(!s||t){const n={symbol:e,isInstanceMember:!0,isClassVar:e.isClassVar(),classType:a,isTypeDeclared:t,skippedUndeclaredType:i};yield n}else i=!0}}const c=o.get(t);if(c&&c.isClassMember()){const e=c.hasTypedDeclarations();if(!s||e){let t=!1;if(l.ClassType.isDataClass(a)||l.ClassType.isTypedDictClass(a)){const e=c.getDeclarations();e.length>0&&1===e[0].type&&(t=!0)}const n={symbol:c,isInstanceMember:t,isClassVar:c.isClassVar(),classType:a,isTypeDeclared:e,skippedUndeclaredType:i};yield n}else i=!0}}}else if((0,l.isAnyOrUnknown)(e)){const e={symbol:r.Symbol.createWithType(0,l.UnknownType.create()),isInstanceMember:!1,isClassVar:!0,classType:l.UnknownType.create(),isTypeDeclared:!1,skippedUndeclaredType:!1};yield e}}function*P(e,t=0){if((0,l.isClass)(e)){let n=0!=(1&t);for(const s of e.details.mro){if(n){n=!1;continue}const i=I(s,e);if(4&t&&(0,l.isInstantiableClass)(i)&&l.ClassType.isBuiltIn(i,"object"))break;if(8&t&&(0,l.isInstantiableClass)(i)&&l.ClassType.isBuiltIn(i,"type"))break;if(yield[s,i],0!=(2&t))break}}}function A(e,t){for(const n of t)e.find((e=>(0,l.isTypeSame)(N(e),N(n))))||e.push(n)}function E(e,t=!0){const n=l.ClassType.getTypeParameters(e);let s=e.typeArguments;s||t||(s=n);const i=k(n,s,g(e));return l.ClassType.isTupleClass(e)&&e.tupleTypeArguments&&n.length>=1&&i.setVariadicTypeVar(n[0],e.tupleTypeArguments),i}function k(e,t,n){const s=new c.TypeVarContext(n);return e.forEach(((e,n)=>{let i;if(t)if((0,l.isParamSpec)(e)){if(n<t.length)if(i=t[n],(0,l.isFunction)(i)&&l.FunctionType.isParamSpecValue(i)){const t=[],n=i;i.details.parameters.forEach(((e,s)=>{t.push({category:e.category,name:e.name,hasDefault:!!e.hasDefault,isNameSynthesized:e.isNameSynthesized,type:l.FunctionType.getEffectiveParameterType(n,s)})})),s.setParamSpec(e,{parameters:t,typeVarScopeId:i.details.typeVarScopeId,flags:i.details.flags,docString:i.details.docString,paramSpec:i.details.paramSpec})}else(0,l.isParamSpec)(i)?s.setParamSpec(e,{flags:0,parameters:[],typeVarScopeId:void 0,docString:void 0,paramSpec:i}):(0,l.isAnyOrUnknown)(i)&&s.setParamSpec(e,{flags:0,parameters:l.FunctionType.getDefaultParameters(),typeVarScopeId:void 0,docString:void 0,paramSpec:void 0})}else i=n>=t.length?l.AnyType.create():t[n],s.setTypeVarType(e,i,i,!0)})),s}function w(e,t){var n;const s=l.TypeVarType.createInstance("__type_of_self__"),i=null!==(n=g(e))&&void 0!==n?n:"";s.details.isSynthesized=!0,s.details.isSynthesizedSelf=!0,s.nameWithScope=l.TypeVarType.makeNameWithScope(s.details.name,i),s.scopeId=i;const r=l.ClassType.cloneForSpecialization(e,l.ClassType.getTypeParameters(e),!1,!0);return s.details.boundType=l.ClassType.cloneAsInstance(r),t?l.TypeVarType.cloneAsInstantiable(s):s}function N(e){let t=d(e,(e=>{switch(e.category){case 7:return l.ClassType.isBuiltIn(e,"Type")?!e.typeArguments||e.typeArguments.length<1?l.UnknownType.create():M(e.typeArguments[0]):l.ClassType.cloneAsInstance(e);case 3:return l.NoneType.createInstance();case 5:if(l.TypeBase.isInstantiable(e))return l.FunctionType.cloneAsInstance(e);break;case 10:if(l.TypeBase.isInstantiable(e))return l.TypeVarType.cloneAsInstance(e)}return e}));return e.typeAliasInfo&&e!==t&&(t=l.TypeBase.cloneForTypeAlias(t,e.typeAliasInfo.name,e.typeAliasInfo.fullName,e.typeAliasInfo.typeVarScopeId,e.typeAliasInfo.typeParameters,e.typeAliasInfo.typeArguments)),t}function M(e){let t=d(e,(e=>{switch(e.category){case 7:if(l.TypeBase.isInstance(e))return l.ClassType.cloneAsInstantiable(e);break;case 3:return l.NoneType.createType();case 5:if(l.TypeBase.isInstance(e))return l.FunctionType.cloneAsInstantiable(e);break;case 10:if(l.TypeBase.isInstance(e))return l.TypeVarType.cloneAsInstantiable(e)}return e}));return e.typeAliasInfo&&e!==t&&(t=l.TypeBase.cloneForTypeAlias(t,e.typeAliasInfo.name,e.typeAliasInfo.fullName,e.typeAliasInfo.typeVarScopeId,e.typeAliasInfo.typeParameters,e.typeAliasInfo.typeArguments)),t}function R(e,t,n=!0,s=!0,i=!1){let r=(0,l.combineTypes)(t.map((e=>e.type)));s&&(r=m(r)),(0,l.isNever)(r)&&(r=l.AnyType.create());const a=l.ClassType.cloneForSpecialization(e,[r],n,void 0,t);return i&&(a.isUnpacked=!0),a}function O(e){const t=e.details.parameters.length;if(t<2)return e;const n=e.details.parameters[t-2],s=e.details.parameters[t-1];return 1===n.category&&2===s.category&&(0,l.isParamSpec)(n.type)&&(0,l.isParamSpec)(s.type)&&(0,l.isTypeSame)(n.type,s.type)?l.FunctionType.cloneRemoveParamSpecVariadics(e,n.type):e}function L(e){return(0,l.isClassInstance)(e)&&v(e)&&e.tupleTypeArguments&&e.isUnpacked?(0,l.combineTypes)(e.tupleTypeArguments.map((e=>e.type))):e}function V(e){var t;if((0,l.isClassInstance)(e)){if(l.ClassType.isBuiltIn(e,["Generator","AsyncGenerator"]))return e.typeArguments;if(l.ClassType.isBuiltIn(e,"AwaitableGenerator"))return null===(t=e.typeArguments)||void 0===t?void 0:t.slice(1)}}function U(e,t=!1,n=!1,s=0){var i;if(s>l.maxTypeRecursionCount)return!1;switch(s++,e.category){case 7:return(!l.ClassType.isPseudoGenericClass(e)||!t)&&(e.typeArguments?void 0!==e.typeArguments.find((e=>U(e,t,n,s))):l.ClassType.getTypeParameters(e).length>0);case 5:{if(e.details.paramSpec)return!0;for(let i=0;i<e.details.parameters.length;i++)if(U(l.FunctionType.getEffectiveParameterType(e,i),t,n,s))return!0;const i=e.specializedTypes&&e.specializedTypes.returnType?e.specializedTypes.returnType:e.details.declaredReturnType;if(i){if(U(i,t,n,s))return!0}else if(e.inferredReturnType&&U(e.inferredReturnType,t,n,s))return!0;return!1}case 6:return void 0!==e.overloads.find((e=>U(e,t,n,s)));case 9:return void 0!==(0,l.findSubtype)(e,(e=>U(e,t,n,s)));case 10:if(!e.details.recursiveTypeAliasName)return!e.details.isSynthesizedSelf||!n;if(null===(i=e.typeAliasInfo)||void 0===i?void 0:i.typeArguments)return e.typeAliasInfo.typeArguments.some((e=>U(e,t,n,s)))}return!1}function z(e,t,n=0){if(n>l.maxTypeRecursionCount)return;n++;const s=e=>{e&&!t.some((t=>t===e))&&t.push(e)};switch(e.category){case 7:case 5:s(e.details.moduleName);break;case 6:e.overloads.forEach((e=>{z(e,t,n)}));break;case 9:u(e,(e=>{z(e,t,n)}));break;case 8:s(e.moduleName)}}function B(e,t=!1){let n=e.parameters.length>0;if(1===e.parameters.length){const t=e.parameters[0];0!==t.category||t.name||(n=!1)}if(n||!e.paramSpec||t){const n=l.FunctionType.createInstance("","","",65536|e.flags);return e.parameters.forEach((e=>{l.FunctionType.addParameter(n,{category:e.category,name:e.name,hasDefault:e.hasDefault,isNameSynthesized:e.isNameSynthesized,hasDeclaredType:!0,type:e.type})})),t||(n.details.paramSpec=e.paramSpec),n.details.docString=e.docString,n}return e.paramSpec}!function(e){e[e.PositionOnly=0]="PositionOnly",e[e.PositionOrKeyword=1]="PositionOrKeyword",e[e.KeywordOnly=2]="KeywordOnly"}(p=t.ParameterSource||(t.ParameterSource={})),t.getParameterListDetails=function(e){const t={firstPositionOrKeywordIndex:0,positionParamCount:0,positionOnlyParamCount:0,params:[],hasUnpackedVariadicTypeVar:!1};let n=e.details.parameters.findIndex((e=>0===e.category&&!e.name));if(n<0)for(let t=0;t<e.details.parameters.length;t++){const s=e.details.parameters[t];if(0!==s.category)break;if(!s.name)break;if((0,a.isDunderName)(s.name)||!s.name.startsWith("__"))break;n=t+1}n>=0&&(t.firstPositionOrKeywordIndex=n);for(let s=0;s<n&&!e.details.parameters[s].hasDefault;s++)t.positionOnlyParamCount++;let s=!1;const i=(i,r,a)=>{if(i.name){let o;o=1===i.category?p.PositionOnly:s?p.KeywordOnly:n>=0&&r<n?p.PositionOnly:p.PositionOrKeyword,t.params.push({param:i,index:r,type:null!=a?a:l.FunctionType.getEffectiveParameterType(e,r),source:o})}};return e.details.parameters.forEach(((r,a)=>{if(1===r.category){const o=l.FunctionType.getEffectiveParameterType(e,a);r.name&&(0,l.isUnpackedClass)(o)&&o.tupleTypeArguments?o.tupleTypeArguments.forEach(((e,n)=>{const s=(0,l.isVariadicTypeVar)(e.type)||e.isUnbounded?1:0;1===s&&(t.argsIndex=t.params.length),(0,l.isVariadicTypeVar)(r.type)&&(t.hasUnpackedVariadicTypeVar=!0),i({category:s,name:`${r.name}[${n.toString()}]`,isNameSynthesized:!0,type:e.type,hasDeclaredType:!0},n,e.type)})):(r.name&&void 0===t.argsIndex&&(t.argsIndex=t.params.length,(0,l.isVariadicTypeVar)(r.type)&&(t.hasUnpackedVariadicTypeVar=!0)),!s&&(n<0||a>=n)&&(t.firstKeywordOnlyIndex=t.params.length,r.name&&t.firstKeywordOnlyIndex++,s=!0),i(r,a))}else 2===r.category?(s=!0,(0,l.isClassInstance)(r.type)&&(0,l.isUnpackedClass)(r.type)&&r.type.details.typedDictEntries?(void 0===t.firstKeywordOnlyIndex&&(t.firstKeywordOnlyIndex=t.params.length),r.type.details.typedDictEntries.forEach(((e,t)=>{i({category:0,name:t,type:e.valueType,hasDeclaredType:!0,hasDefault:!e.isRequired},a,e.valueType)}))):r.name&&(void 0===t.kwargsIndex&&(t.kwargsIndex=t.params.length),void 0===t.firstKeywordOnlyIndex&&(t.firstKeywordOnlyIndex=t.params.length),i(r,a))):0===r.category&&(r.name&&!s&&t.positionParamCount++,i(r,a))})),t},t.isOptionalType=function(e){return!!(0,l.isUnion)(e)&&void 0!==(0,l.findSubtype)(e,(e=>(0,l.isNoneInstance)(e)))},t.mapSubtypes=d,t.doForEachSubtype=u,t.areTypesSame=function(e,t){if(e.length<2)return!0;for(let n=1;n<e.length;n++)if(!(0,l.isTypeSame)(e[0],e[n],t))return!1;return!0},t.preserveUnknown=function(e,t){return(0,l.isUnknown)(e)&&e.isIncomplete?e:(0,l.isUnknown)(t)&&t.isIncomplete?t:(0,l.isUnknown)(e)||(0,l.isUnknown)(t)?l.UnknownType.create():l.AnyType.create()},t.isUnionableType=function(e){let t=3;for(const n of e)t&=n.flags;return 0!=(1&t)&&0==(2&t)},t.derivesFromAnyOrUnknown=function(e){let t=!1;return u(e,(n=>{(0,l.isAnyOrUnknown)(e)?t=!0:(0,l.isInstantiableClass)(n)?l.ClassType.hasUnknownBaseClass(n)&&(t=!0):(0,l.isClassInstance)(n)&&l.ClassType.hasUnknownBaseClass(n)&&(t=!0)})),t},t.getFullNameOfType=function(e){var t;if(null===(t=e.typeAliasInfo)||void 0===t?void 0:t.fullName)return e.typeAliasInfo.fullName;switch(e.category){case 2:case 1:return"typing.Any";case 3:return"builtins.None";case 7:case 5:return e.details.fullName;case 8:return e.moduleName;case 6:return e.overloads[0].details.fullName}},t.stripLiteralValue=m,t.addConditionToType=y,t.getTypeCondition=h,t.isTypeAliasPlaceholder=function(e){return!!(0,l.isTypeVar)(e)&&(!!e.details.recursiveTypeAliasName&&!e.details.boundType)},t.isTypeAliasRecursive=function(e,t){return 9!==t.category?t===e||(0,l.isUnbound)(t)&&t.typeAliasInfo&&t.typeAliasInfo.name===e.details.recursiveTypeAliasName:void 0!==(0,l.findSubtype)(t,(t=>(0,l.isTypeSame)(e,t)))},t.transformPossibleRecursiveTypeAlias=function(e){var t;if(e&&(0,l.isTypeVar)(e)&&e.details.recursiveTypeAliasName&&e.details.boundType){const n=l.TypeBase.isInstance(e)?N(e.details.boundType):e.details.boundType;if(!(null===(t=e.typeAliasInfo)||void 0===t?void 0:t.typeArguments)||!e.details.recursiveTypeParameters)return n;return S(n,k(e.details.recursiveTypeParameters,e.typeAliasInfo.typeArguments,g(e)))}return e},t.getTypeVarScopeId=g,t.getSpecializedTupleType=function(e){let t;if((0,l.isInstantiableClass)(e)?t=e:(0,l.isClassInstance)(e)&&(t=l.ClassType.cloneAsInstantiable(e)),!t)return;const n=t.details.mro.find((e=>(0,l.isInstantiableClass)(e)&&v(e)));if(!n||!(0,l.isInstantiableClass)(n))return;return l.ClassType.isSameGenericClass(t,n)?t:S(n,E(t))},t.isLiteralType=f,t.isLiteralTypeOrUnion=function(e){return(0,l.isClassInstance)(e)?void 0!==e.literalValue:!!(0,l.isUnion)(e)&&!(0,l.findSubtype)(e,(e=>!(0,l.isClassInstance)(e)||void 0===e.literalValue))},t.containsLiteralType=T,t.getLiteralTypeClassName=function e(t){if((0,l.isClassInstance)(t))return void 0!==t.literalValue&&l.ClassType.isBuiltIn(t)?t.details.name:void 0;if((0,l.isUnion)(t)){let n,s=!1;return u(t,(t=>{const i=e(t);i?n||(n=i):s=!0})),s?void 0:n}},t.getUnionSubtypeCount=function(e){return(0,l.isUnion)(e)?e.subtypes.length:1},t.isEllipsisType=function(e){return(0,l.isAny)(e)&&e.isEllipsis},t.isProperty=function(e){return(0,l.isClassInstance)(e)&&l.ClassType.isPropertyClass(e)},t.isDescriptorInstance=function(e,t=!1){return(0,l.isUnion)(e)?e.subtypes.every((e=>_(e,t))):_(e,t)},t.isMaybeDescriptorInstance=_,t.isTupleClass=v,t.isUnboundedTupleClass=b,t.partiallySpecializeType=I,t.populateTypeVarContextForSelfType=C,t.applySolvedTypeVars=S,t.transformExpectedTypeForConstructor=function(e,t,n){return(0,l.isTypeVar)(e)?(s=e,n.some((e=>s.scopeId===e))?e:void 0):new G(t,n).apply(e);var s},t.getProtocolSymbols=function(e){const t=new Map;return l.ClassType.isProtocolClass(e)&&F(e,t),t},t.lookUpObjectMember=function(e,t,n=0){if((0,l.isClassInstance)(e))return x(e,t,n)},t.lookUpClassMember=x,t.getClassMemberIterator=D,t.getClassIterator=P,t.getClassFieldsRecursive=function(e){const t=new Map;for(let n=e.details.mro.length-1;n>=0;n--){const s=I(e.details.mro[n],e);(0,l.isClass)(s)?s.details.fields.forEach(((e,n)=>{!e.isIgnoredForProtocolMatch()&&e.hasTypedDeclarations()&&t.set(n,{classType:s,symbol:e,isInstanceMember:e.isInstanceMember(),isClassVar:e.isClassVar(),isTypeDeclared:!0,skippedUndeclaredType:!1})})):t.clear()}return t},t.addTypeVarsToListIfUnique=A,t.getTypeVarArgumentsRecursive=function e(t,n=0){var s,i;if(n>l.maxTypeRecursionCount)return[];if(n++,null===(s=t.typeAliasInfo)||void 0===s?void 0:s.typeArguments){const s=[];return null===(i=t.typeAliasInfo)||void 0===i||i.typeArguments.forEach((t=>{A(s,e(t,n))})),s}if((0,l.isTypeVar)(t))return t.details.recursiveTypeAliasName||(0,l.isParamSpec)(t)&&t.paramSpecAccess?[]:[l.TypeBase.isInstantiable(t)?l.TypeVarType.cloneAsInstance(t):t];if((0,l.isClass)(t))return(t=>{const s=[];return t.typeArguments&&t.typeArguments.forEach((t=>{A(s,e(t,n))})),s})(t);if((0,l.isUnion)(t)){const s=[];return u(t,(t=>{A(s,e(t,n))})),s}if((0,l.isFunction)(t)){const s=[];for(let i=0;i<t.details.parameters.length;i++)A(s,e(l.FunctionType.getEffectiveParameterType(t,i),n));t.details.paramSpec&&A(s,[t.details.paramSpec]);const i=l.FunctionType.getSpecializedReturnType(t);return i&&A(s,e(i,n)),s}return[]},t.specializeClassType=function(e){const t=new c.TypeVarContext(g(e));return l.ClassType.getTypeParameters(e).forEach((e=>{t.setTypeVarType(e,l.UnknownType.create())})),S(e,t)},t.setTypeArgumentsRecursive=function e(t,n,s,i=0){if(!(i>l.maxTypeRecursionCount||(i++,s.isLocked())))switch(t.category){case 9:u(t,(t=>{e(t,n,s,i)}));break;case 7:t.typeArguments&&t.typeArguments.forEach((t=>{e(t,n,s,i)})),t.tupleTypeArguments&&t.tupleTypeArguments.forEach((t=>{e(t.type,n,s,i)}));break;case 5:t.specializedTypes?(t.specializedTypes.parameterTypes.forEach((t=>{e(t,n,s,i)})),t.specializedTypes.returnType&&e(t.specializedTypes.returnType,n,s,i)):(t.details.parameters.forEach((t=>{e(t.type,n,s,i)})),t.details.declaredReturnType&&e(t.details.declaredReturnType,n,s,i),t.details.paramSpec&&!s.hasTypeVar(t.details.paramSpec)&&(0,l.isAnyOrUnknown)(n)&&s.setParamSpec(t.details.paramSpec,{flags:0,parameters:l.FunctionType.getDefaultParameters(),typeVarScopeId:void 0,docString:void 0,paramSpec:void 0}));break;case 6:t.overloads.forEach((t=>{e(t,n,s,i)}));break;case 10:s.hasTypeVar(t)||s.setTypeVarType(t,n)}},t.buildTypeVarContextFromSpecializedClass=E,t.buildTypeVarContext=k,t.specializeForBaseClass=function(e,t){if(0===l.ClassType.getTypeParameters(t).length)return t;const n=S(t,E(e));return(0,i.assert)((0,l.isInstantiableClass)(n)),n},t.derivesFromClassRecursive=function e(t,n,s){if(l.ClassType.isSameGenericClass(t,n))return!0;for(const i of t.details.baseClasses)if((0,l.isInstantiableClass)(i)){if(e(i,n,s))return!0}else if(!s&&(0,l.isAnyOrUnknown)(i))return!0;return!1},t.synthesizeTypeVarForSelfCls=w,t.getDeclaredGeneratorReturnType=function(e){const t=l.FunctionType.getSpecializedReturnType(e);if(t){const e=V(t);if(e)return e.length>=3?e[2]:l.UnknownType.create()}},t.getGeneratorYieldType=function(e,t){let n=!0;const s=d(e,(e=>{if((0,l.isAnyOrUnknown)(e))return e;if((0,l.isClassInstance)(e)){if([["AsyncIterable","Iterable"],["AsyncIterator","Iterator"],["AsyncGenerator","Generator"],["","AwaitableGenerator"]].some((n=>l.ClassType.isBuiltIn(e,t?n[0]:n[1]))))return e.typeArguments&&e.typeArguments.length>=1?e.typeArguments[0]:l.UnknownType.create()}n=!1}));return n?s:void 0},t.isEffectivelyInstantiable=function e(t){return!!l.TypeBase.isInstantiable(t)||(!(!(0,l.isClassInstance)(t)||!l.ClassType.isBuiltIn(t,"type"))||!!(0,l.isUnion)(t)&&t.subtypes.every((t=>e(t))))},t.convertToInstance=N,t.convertToInstantiable=M,t.getMembersForClass=function(e,t,n){for(let s=0;s<e.details.mro.length;s++){const i=e.details.mro[s];if((0,l.isInstantiableClass)(i)){const e=l.ClassType.isTypedDictClass(i);i.details.fields.forEach(((s,i)=>{if((s.isClassMember()||n&&s.isInstanceMember())&&!(e&&(0,o.isTypedDictMemberAccessedThroughIndex)(s)||s.isInitVar())){const e=t.get(i);e?!e.hasTypedDeclarations()&&s.hasTypedDeclarations()&&t.set(i,s):t.set(i,s)}}))}}if(!n){const n=e.details.effectiveMetaclass;if(n&&(0,l.isInstantiableClass)(n))for(const e of n.details.mro){if(!(0,l.isInstantiableClass)(e))break;e.details.fields.forEach(((e,n)=>{const s=t.get(n);s?!s.hasTypedDeclarations()&&e.hasTypedDeclarations()&&t.set(n,e):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 u(e,(e=>{(0,l.isUnknown)(e)&&(t=!0)})),t},t.isPartlyUnknown=function e(t,n=!1,s=0){var i,r;if(s>l.maxTypeRecursionCount)return!1;if(s++,(0,l.isUnknown)(t))return!0;if((null===(i=t.typeAliasInfo)||void 0===i?void 0:i.typeArguments)&&t.typeAliasInfo.typeArguments.some((t=>e(t,n,s))))return!0;if((0,l.isUnion)(t))return void 0!==(0,l.findSubtype)(t,(t=>e(t,n,s)));if((0,l.isClass)(t)){if(l.TypeBase.isInstance(t)&&(n=!1),!n&&!l.ClassType.isPseudoGenericClass(t)){const i=(null===(r=t.tupleTypeArguments)||void 0===r?void 0:r.map((e=>e.type)))||t.typeArguments;if(i)for(const t of i)if(e(t,n,s))return!0}return!1}if((0,l.isOverloadedFunction)(t))return t.overloads.some((t=>e(t,!1,s)));if((0,l.isFunction)(t)){for(let n=0;n<t.details.parameters.length;n++)if(t.details.parameters[n].name){if(e(l.FunctionType.getEffectiveParameterType(t,n),!1,s))return!0}return!(!t.details.declaredReturnType||l.FunctionType.isParamSpecValue(t)||!e(t.details.declaredReturnType,!1,s))}return!1},t.explodeGenericClass=function(e){return e.typeArguments&&1===e.typeArguments.length&&(0,l.isUnion)(e.typeArguments[0])?(0,l.combineTypes)(e.typeArguments[0].subtypes.map((t=>l.ClassType.cloneForSpecialization(e,[t],!0)))):e},t.combineSameSizedTuples=function(e,t){if(!t||!(0,l.isInstantiableClass)(t)||b(t))return;let n,s=!0;return u(e,(e=>{if((0,l.isClassInstance)(e)){let t;(0,l.isClass)(e)&&v(e)&&!b(e)&&(t=e),t||(t=e.details.mro.find((e=>(0,l.isClass)(e)&&v(e)&&!b(e)))),t&&(0,l.isClass)(t)&&t.tupleTypeArguments?n?n.length===t.tupleTypeArguments.length?t.tupleTypeArguments.forEach(((e,t)=>{n[t].push(e.type)})):s=!1:n=t.tupleTypeArguments.map((e=>[e.type])):s=!1}else s=!1})),s&&n?N(R(t,n.map((e=>({type:(0,l.combineTypes)(e),isUnbounded:!1}))))):void 0},t.specializeTupleClass=R,t.removeParamSpecVariadicsFromSignature=function(e){if((0,l.isFunction)(e))return O(e);const t=[];let n=!1;for(const s of e.overloads){const e=O(s);t.push(e),e!==s&&(n=!0)}return n?l.OverloadedFunctionType.create(t):e},t.removeParamSpecVariadicsFromFunction=O,t.getGeneratorTypeArgs=V,t.requiresTypeArguments=function(e){if(e.details.typeParameters.length>0)return!e.details.typeParameters[0].details.isSynthesized;if(l.ClassType.isSpecialBuiltIn(e)){if(["Tuple","Callable","Generic","Type","Optional","Union","Literal","Annotated","TypeGuard","StrictTypeGuard"].some((t=>t===(e.aliasName||e.details.name))))return!0}return!1},t.requiresSpecialization=U,t.computeMroLinearization=function(e){let t=!0;const n=e.details.baseClasses.filter(((t,n)=>{if((0,l.isInstantiableClass)(t)&&l.ClassType.isBuiltIn(t,"Generic")){if(l.ClassType.isProtocolClass(e))return!1;if(e.details.baseClasses.some(((e,t)=>t>n&&(0,l.isInstantiableClass)(e)&&e.typeArguments&&e.isTypeArgumentExplicit)))return!1}return!0})),s=[];n.forEach(((e,t)=>{if((0,l.isInstantiableClass)(e)){const t=E(e,!1);s.push(e.details.mro.map((e=>S(e,t))))}else s.push([e])})),s.push(n.map((t=>S(t,E(e,!1)))));const i=E(e,!1);e.details.mro.push(S(e,i));const r=(e,t)=>t.some((t=>t.findIndex((t=>(0,l.isInstantiableClass)(t)&&l.ClassType.isSameGenericClass(t,e)))>0)),a=(e,t)=>{for(let n=0;n<t.length;n++)t[n]=t[n].filter((t=>!(0,l.isInstantiableClass)(t)||!l.ClassType.isSameGenericClass(t,e)))};for(;;){let n,i=!1;for(let t=0;t<s.length;t++){const o=s[t];if(o.length>0){if(void 0===n&&(n=o),!(0,l.isInstantiableClass)(o[0])){i=!0,e.details.mro.push(o[0]),o.shift();break}if(!r(o[0],s)){i=!0,e.details.mro.push(o[0]),a(o[0],s);break}}}if(!n)break;i||(t=!1,(0,l.isInstantiableClass)(n[0])?(e.details.mro.push(n[0]),a(n[0],s)):(e.details.mro.push(n[0]),n.shift()))}return t},t.getDeclaringModulesForType=function(e){const t=[];return z(e,t),t},t.convertParamSpecValueToType=B;class W{constructor(){this._isTransformingTypeArg=!1,this._pendingTypeVarTransformations=new Set}apply(e,t=0){var n;if(t>l.maxTypeRecursionCount)return e;if(t++,!U(e=this._transformGenericTypeAlias(e,t)))return e;if((0,l.isAnyOrUnknown)(e))return e;if((0,l.isNoneInstance)(e))return e;if((0,l.isTypeVar)(e)){if(e.details.recursiveTypeAliasName){if(!(null===(n=e.typeAliasInfo)||void 0===n?void 0:n.typeArguments))return e;let s=!1;const i=e.typeAliasInfo.typeArguments.map((e=>{const n=this.apply(e,t);return n!==e&&(s=!0),n}));return s?l.TypeBase.cloneForTypeAlias(e,e.typeAliasInfo.name,e.typeAliasInfo.fullName,e.typeAliasInfo.typeVarScopeId,e.typeAliasInfo.typeParameters,i):e}let s=e;const i=l.TypeVarType.getNameWithScope(e);return this._pendingTypeVarTransformations.has(i)||(s=this.transformTypeVar(e),this._isTransformingTypeArg||(this._pendingTypeVarTransformations.add(i),s=this.apply(s,t),this._pendingTypeVarTransformations.delete(i)),(0,l.isVariadicTypeVar)(e)&&e.isVariadicInUnion&&(s=L(s))),s}if((0,l.isUnion)(e)){const n=d(e,(e=>{let n=this.apply(e,t);if((0,l.isVariadicTypeVar)(e)&&!(0,l.isVariadicTypeVar)(n)){const e=[];u(n,(t=>{e.push(L(t))})),n=(0,l.combineTypes)(e)}return n}));return this.transformUnion&&(0,l.isUnion)(n)?this.transformUnion(n):n}if((0,l.isClass)(e))return this._transformTypeVarsInClassType(e,t);if((0,l.isFunction)(e))return this._transformTypeVarsInFunctionType(e,t);if((0,l.isOverloadedFunction)(e)){let n=!1;const s=[];return e.overloads.forEach((e=>{const i=this._transformTypeVarsInFunctionType(e,t);s.push(i),i!==e&&(n=!0)})),n?l.OverloadedFunctionType.create(s):e}return e}transformTypeVar(e){return e}transformVariadicTypeVar(e){}transformParamSpec(e){}transformUnion(e){return e}_transformGenericTypeAlias(e,t){if(!e.typeAliasInfo||!e.typeAliasInfo.typeParameters||!e.typeAliasInfo.typeArguments)return e;let n=!1;const s=e.typeAliasInfo.typeArguments.map((s=>{const i=this.apply(s,t);return e!==i&&(n=!0),i}));return n?l.TypeBase.cloneForTypeAlias(e,e.typeAliasInfo.name,e.typeAliasInfo.fullName,e.typeAliasInfo.typeVarScopeId,e.typeAliasInfo.typeParameters,s):e}_transformTypeVarsInClassType(e,t){if(0===l.ClassType.getTypeParameters(e).length&&!l.ClassType.isSpecialBuiltIn(e))return e;let n,i=[],r=!1;const a=l.ClassType.getTypeParameters(e),o=e=>{const t=this.transformParamSpec(e);return t?(r=!0,B(t)):e},c=this._isTransformingTypeArg;return this._isTransformingTypeArg=!0,e.typeArguments?i=e.typeArguments.map((e=>{if((0,l.isTypeVar)(e)&&e.details.isParamSpec)return o(e);let n=this.apply(e,t);return n!==e&&(r=!0,(0,l.isTypeVar)(e)&&(0,l.isVariadicTypeVar)(e)&&e.isVariadicInUnion&&(n=L(n))),n})):a.forEach((e=>{let n=e;if(e.details.isParamSpec)n=o(e),n!==e&&(r=!0);else{const s=l.TypeVarType.getNameWithScope(e);this._pendingTypeVarTransformations.has(s)||(n=this.transformTypeVar(e),n!==e&&(this._isTransformingTypeArg||(this._pendingTypeVarTransformations.add(s),n=this.apply(n,t),this._pendingTypeVarTransformations.delete(s)),r=!0))}i.push(n)})),l.ClassType.isTupleClass(e)&&(e.tupleTypeArguments?(n=[],e.tupleTypeArguments.forEach((e=>{const i=this.apply(e.type,t);i!==e.type&&(r=!0),(0,l.isVariadicTypeVar)(e.type)&&(0,l.isClassInstance)(i)&&v(i)&&i.tupleTypeArguments?(0,s.appendArray)(n,i.tupleTypeArguments):n.push({type:i,isUnbounded:e.isUnbounded})}))):a.length>0&&(n=this.transformVariadicTypeVar(a[0]),n&&(r=!0))),this._isTransformingTypeArg=c,r?l.ClassType.cloneForSpecialization(e,i,!0,void 0,n):e}_transformTypeVarsInFunctionType(e,t){let n=e;if(n.details.paramSpec){const e=this.transformParamSpec(n.details.paramSpec);e&&(n=l.FunctionType.cloneForParamSpec(n,e))}const s=l.FunctionType.getSpecializedReturnType(n),i=s?this.apply(s,t):void 0;let r=s!==i;const a={parameterTypes:[],returnType:i};if(n.details.parameters.length>=2){const e=n.details.parameters[n.details.parameters.length-2],t=n.details.parameters[n.details.parameters.length-1],s=l.FunctionType.getEffectiveParameterType(n,n.details.parameters.length-2),i=l.FunctionType.getEffectiveParameterType(n,n.details.parameters.length-1);if(1===e.category&&2===t.category&&(0,l.isParamSpec)(s)&&(0,l.isParamSpec)(i)&&(0,l.isTypeSame)(s,i)){const e=this.transformParamSpec(s);e&&(e.parameters.length>0||void 0===e.paramSpec||!(0,l.isTypeSame)(s,e.paramSpec))&&(n=l.FunctionType.cloneForParamSpecApplication(n,e))}}let o,c,p;for(let e=0;e<n.details.parameters.length;e++){const s=l.FunctionType.getEffectiveParameterType(n,e),i=this.apply(s,t);a.parameterTypes.push(i),void 0===o&&(0,l.isVariadicTypeVar)(s)&&1===n.details.parameters[e].category&&(o=e,(0,l.isClassInstance)(i)&&v(i)&&i.isUnpacked&&(c=i.tupleTypeArguments)),s!==i&&(r=!0)}if(!r)return n;if(n.inferredReturnType&&(p=this.apply(n.inferredReturnType,t)),!c)return l.FunctionType.cloneForSpecialization(n,a,p);const d=l.FunctionType.createSynthesizedInstance("");let u=!1,m=!1;return a.parameterTypes.forEach(((e,t)=>{if(t===o){let e=!1;c.forEach((t=>{l.FunctionType.addParameter(d,{category:t.isUnbounded?1:0,name:`__p${d.details.parameters.length}`,isNameSynthesized:!0,type:t.type,hasDeclaredType:!0}),t.isUnbounded&&(e=!0)})),e?m=!0:u=!0}else{const s={...n.details.parameters[t]};1!==s.category||s.name?2===s.category&&(u=!1):u=!1,0===s.category&&s.name&&u&&(l.FunctionType.addParameter(d,{category:1,type:l.UnknownType.create()}),u=!1),s.type=e,s.name&&s.isNameSynthesized&&(s.name=`__p${d.details.parameters.length}`),0===s.category&&!s.name&&m||l.FunctionType.addParameter(d,s)}})),d.details.declaredReturnType=a.returnType,d}}class j extends W{constructor(e,t=!1,n=!1,s=!1,i){super(),this._typeVarContext=e,this._unknownIfNotFound=t,this._useNarrowBoundOnly=n,this._eliminateUnsolvedInUnions=s,this._typeClassType=i}transformTypeVar(e){if(e.scopeId&&this._typeVarContext.hasSolveForScope(e.scopeId)){let t=this._typeVarContext.getTypeVarType(e,this._useNarrowBoundOnly);if(!t&&this._useNarrowBoundOnly){const n=this._typeVarContext.getTypeVarType(e);n&&T(n,!0)&&(t=n)}if(t)return l.TypeBase.isInstantiable(e)&&(t=(0,l.isAnyOrUnknown)(t)&&this._typeClassType&&(0,l.isInstantiableClass)(this._typeClassType)?l.ClassType.cloneForSpecialization(l.ClassType.cloneAsInstance(this._typeClassType),[t],!0):M(t)),t;if(this._unknownIfNotFound)return l.UnknownType.create()}return e}transformUnion(e){if(this._eliminateUnsolvedInUnions){const t=d(e,(e=>{if(!(0,l.isTypeVar)(e)||void 0===e.scopeId||!this._typeVarContext.hasSolveForScope(e.scopeId))return e}));return(0,l.isNever)(t)?e:t}return e}transformVariadicTypeVar(e){if(e.scopeId&&this._typeVarContext.hasSolveForScope(e.scopeId))return this._typeVarContext.getVariadicTypeVar(e)}transformParamSpec(e){if(!e.scopeId||!this._typeVarContext.hasSolveForScope(e.scopeId))return;const t=this._typeVarContext.getParamSpec(e);if(t)return t;if(this._unknownIfNotFound){return{flags:0,parameters:l.FunctionType.getDefaultParameters(!0),typeVarScopeId:void 0,docString:void 0,paramSpec:void 0}}}}class G extends W{constructor(e,t){super(),this._typeVarContext=e,this._liveTypeVarScopes=t,this.dummyScopeId="__expected_type_scope_id",this.dummyTypeVarPrefix="__expected_type_",this._typeVarContext.addSolveForScope(this.dummyScopeId)}_isTypeVarLive(e){return this._liveTypeVarScopes.some((t=>e.scopeId===t))}_createDummyTypeVar(e){if(e.details.isSynthesized&&e.details.name.startsWith(this.dummyTypeVarPrefix))return e;const t=l.TypeBase.isInstance(e);let n=l.TypeVarType.createInstance(`__expected_type_${G.synthesizedTypeVarIndexForExpectedType}`);return n.details.isSynthesized=!0,n.scopeId=this.dummyScopeId,n.nameWithScope=l.TypeVarType.makeNameWithScope(n.details.name,this.dummyScopeId),t||(n=M(n)),n.details.boundType=e.details.boundType,n.details.constraints=e.details.constraints,n.details.variance=e.details.variance,G.synthesizedTypeVarIndexForExpectedType++,n}transformTypeVar(e){return this._isTypeVarLive(e)?e:this._createDummyTypeVar(e)}}G.synthesizedTypeVarIndexForExpectedType=1},58922:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TypeVarContext=void 0;const s=n(20823),i=n(59195),r=n(10425);class a{constructor(e){this._isLocked=!1,Array.isArray(e)?this._solveForScopes=e:this._solveForScopes=void 0!==e?[e]:void 0,this._typeVarMap=new Map,this._paramSpecMap=new Map}clone(){const e=new a;return this._solveForScopes&&(e._solveForScopes=[...this._solveForScopes]),this._typeVarMap.forEach((t=>{e.setTypeVarType(t.typeVar,t.narrowBound,t.wideBound,t.retainLiteral)})),this._paramSpecMap.forEach((t=>{e.setParamSpec(t.paramSpec,t.type)})),this._variadicTypeVarMap&&this._variadicTypeVarMap.forEach((t=>{e.setVariadicTypeVar(t.typeVar,t.types)})),e._isLocked=this._isLocked,e}copyFromClone(e){this._typeVarMap=e._typeVarMap,this._paramSpecMap=e._paramSpecMap,this._variadicTypeVarMap=e._variadicTypeVarMap,this._isLocked=e._isLocked}getSolveForScopes(){return this._solveForScopes}hasSolveForScope(e){return void 0!==e&&void 0!==this._solveForScopes&&this._solveForScopes.some((t=>t===e||t===i.WildcardTypeVarScopeId))}setSolveForScopes(e){this._solveForScopes=e}addSolveForScope(e){void 0===e||this.hasSolveForScope(e)||(this._solveForScopes||(this._solveForScopes=[]),this._solveForScopes.push(e))}isEmpty(){return 0===this._typeVarMap.size&&0===this._paramSpecMap.size}getScore(){let e=0;return this._typeVarMap.forEach((t=>{e+=1;const n=this.getTypeVarType(t.typeVar);e+=1-this._getComplexityScoreForType(n)})),e+=this._paramSpecMap.size,e}hasTypeVar(e){return this._typeVarMap.has(this._getKey(e))}getTypeVarType(e,t=!1){const n=this._typeVarMap.get(this._getKey(e));if(n)return n.narrowBound?n.narrowBound:t?void 0:n.wideBound}setTypeVarType(e,t,n,i){(0,s.assert)(!this._isLocked);const r=this._getKey(e);this._typeVarMap.set(r,{typeVar:e,narrowBound:t,wideBound:n,retainLiteral:i})}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){(0,s.assert)(!this._isLocked);const n=this._getKey(e);this._variadicTypeVarMap||(this._variadicTypeVarMap=new Map),this._variadicTypeVarMap.set(n,{typeVar:e,types:t})}getTypeVar(e){const t=this._getKey(e);return this._typeVarMap.get(t)}getTypeVars(){const e=[];return this._typeVarMap.forEach((t=>{e.push(t)})),e}hasParamSpec(e){return this._paramSpecMap.has(this._getKey(e))}getParamSpec(e){var t;return null===(t=this._paramSpecMap.get(this._getKey(e)))||void 0===t?void 0:t.type}setParamSpec(e,t){(0,s.assert)(!this._isLocked),this._paramSpecMap.set(this._getKey(e),{paramSpec:e,type:t})}typeVarCount(){return this._typeVarMap.size}getWideTypeBound(e){const t=this._typeVarMap.get(this._getKey(e));if(t)return t.wideBound}getRetainLiterals(e){const t=this._typeVarMap.get(this._getKey(e));return!!(null==t?void 0:t.retainLiteral)}lock(){(0,s.assert)(!this._isLocked),this._isLocked=!0}unlock(){this._isLocked=!1}isLocked(){return this._isLocked}_getKey(e){return i.TypeVarType.getNameWithScope(e)}_getComplexityScoreForType(e,t=0){if(t>i.maxTypeRecursionCount)return 1;switch(t++,e.category){case 1:case 2:case 3:case 5:case 6:case 10:return.5;case 0:case 4:return 1;case 9:{let n=0;return e.subtypes.length<16&&(0,r.doForEachSubtype)(e,(e=>{const s=this._getComplexityScoreForType(e,t);n=Math.max(n,s)})),.75+n/4}case 7:return this._getComplexityScoreForClass(e,t)}return 0}_getComplexityScoreForClass(e,t){let n=0,s=0;e.tupleTypeArguments?e.tupleTypeArguments.forEach((e=>{n+=this._getComplexityScoreForType(e.type,t),s++})):e.typeArguments?e.typeArguments.forEach((e=>{n+=this._getComplexityScoreForType(e,t),s++})):e.details.typeParameters&&e.details.typeParameters.forEach((e=>{n+=this._getComplexityScoreForType(i.AnyType.create(),t),s++}));return.5+.25*(s>0?n/s:0)}}t.TypeVarContext=a},22387:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getTypeOfIndexedTypedDict=t.assignToTypedDict=t.canAssignTypedDict=t.getTypedDictMembersForClass=t.synthesizeTypedDictClassMethods=t.createTypedDictType=void 0;const a=n(9133),o=n(20823),l=n(24319),c=n(15741),p=n(28348),d=n(80957),u=n(74426),m=r(n(35696)),y=r(n(23241)),h=n(97882),g=n(15020),f=n(59195),T=n(10425);function _(e,t,n,s){(0,o.assert)(f.ClassType.isTypedDictClass(n));const i=f.FunctionType.createSynthesizedInstance("__new__",1);f.FunctionType.addParameter(i,{category:0,name:"cls",type:n,hasDeclaredType:!0}),f.FunctionType.addDefaultParameters(i),i.details.declaredReturnType=f.ClassType.cloneAsInstance(n);const r=f.FunctionType.createSynthesizedInstance("__init__");f.FunctionType.addParameter(r,{category:0,name:"self",type:f.ClassType.cloneAsInstance(n),hasDeclaredType:!0}),r.details.declaredReturnType=f.NoneType.createInstance(),f.FunctionType.addParameter(r,{category:1,type:f.AnyType.create(),hasDeclaredType:!0});const l=v(e,n);l.forEach(((e,t)=>{f.FunctionType.addParameter(r,{category:0,name:t,hasDefault:!e.isRequired,type:e.valueType,hasDeclaredType:!0})}));const c=n.details.fields;c.set("__init__",h.Symbol.createWithType(4,r)),c.set("__new__",h.Symbol.createWithType(4,i));const p=e.getBuiltInType(t,"str");if((0,f.isInstantiableClass)(p)){const i={category:0,name:"self",type:f.ClassType.cloneAsInstance(n),hasDeclaredType:!0},r=e=>{let t=f.TypeVarType.createInstance("__TDefault");return t=f.TypeVarType.cloneForScopeId(t,e.details.typeVarScopeId,n.details.name,1),t},o=(n,s,a,o=!1,l=!1)=>{const c=f.FunctionType.createSynthesizedInstance("get",256);if(f.FunctionType.addParameter(c,i),c.details.typeVarScopeId=e.getScopeIdForNode(t),f.FunctionType.addParameter(c,{category:0,name:"k",type:n,hasDeclaredType:!0}),a){const e=r(c);let t,n;o?(t=f.AnyType.create(),n=null!=s?s:f.AnyType.create()):(t=l&&s?s:e,n=s?l?s:(0,f.combineTypes)([s,e]):e),f.FunctionType.addParameter(c,{category:0,name:"default",type:t,hasDeclaredType:!0}),c.details.declaredReturnType=n}else c.details.declaredReturnType=o?s:(0,f.combineTypes)([null!=s?s:f.AnyType.create(),f.NoneType.createInstance()]);return c},d=(n,s)=>{const a={category:0,name:"k",type:n,hasDeclaredType:!0},o=f.FunctionType.createSynthesizedInstance("pop",256);f.FunctionType.addParameter(o,i),f.FunctionType.addParameter(o,a),o.details.declaredReturnType=s;const l=f.FunctionType.createSynthesizedInstance("pop",256);f.FunctionType.addParameter(l,i),f.FunctionType.addParameter(l,a),l.details.typeVarScopeId=e.getScopeIdForNode(t);const c=r(l);return f.FunctionType.addParameter(l,{category:0,name:"default",hasDeclaredType:!0,type:c,hasDefault:!0}),l.details.declaredReturnType=(0,f.combineTypes)([s,c]),[o,l]},u=(e,t)=>{const n=f.FunctionType.createSynthesizedInstance("setdefault",256);return f.FunctionType.addParameter(n,i),f.FunctionType.addParameter(n,{category:0,name:"k",hasDeclaredType:!0,type:e}),f.FunctionType.addParameter(n,{category:0,name:"default",hasDeclaredType:!0,type:t}),n.details.declaredReturnType=t,n},m=e=>{const t=f.FunctionType.createSynthesizedInstance("delitem",256);return f.FunctionType.addParameter(t,i),f.FunctionType.addParameter(t,{category:0,name:"k",hasDeclaredType:!0,type:e}),t.details.declaredReturnType=f.NoneType.createInstance(),t},y=[],g=[],T=[];if(l.forEach(((e,t)=>{const n=f.ClassType.cloneAsInstance(f.ClassType.cloneWithLiteral(p,t));y.push(o(n,e.valueType,!1,e.isRequired)),e.isRequired?y.push(o(n,e.valueType,!0,!0,!0)):(y.push(o(n,e.valueType,!0,!1,!0)),y.push(o(n,e.valueType,!0,!1,!1))),(0,a.appendArray)(g,d(n,e.valueType)),T.push(u(n,e.valueType))})),s){const n=e.getTypingType(t,"LiteralString");if(n&&(0,f.isInstantiableClass)(n)){const e=f.ClassType.cloneAsInstance(n);y.push(o(e,f.NoneType.createInstance(),!1,!0)),y.push(o(e,void 0,!0))}}const _=f.ClassType.cloneAsInstance(p);y.push(o(_,f.AnyType.create(),!1)),y.push(o(_,f.AnyType.create(),!0)),c.set("get",h.Symbol.createWithType(4,f.OverloadedFunctionType.create(y))),g.length>0&&c.set("pop",h.Symbol.createWithType(4,f.OverloadedFunctionType.create(g))),T.length>0&&c.set("setdefault",h.Symbol.createWithType(4,f.OverloadedFunctionType.create(T))),c.set("__delitem__",h.Symbol.createWithType(4,m(_)))}}function v(e,t,n=!1){if(!t.details.typedDictEntries){const n=new Map;b(e,t,n),t.details.typedDictEntries=n}const s=new Map;return t.details.typedDictEntries.forEach(((e,t)=>{s.set(t,{...e})})),n&&t.typedDictNarrowedEntries&&t.typedDictNarrowedEntries.forEach(((e,t)=>{s.set(t,{...e})})),s}function b(e,t,n,s=0){(0,o.assert)(f.ClassType.isTypedDictClass(t)),s>f.maxTypeRecursionCount||(s++,t.details.baseClasses.forEach((t=>{(0,f.isInstantiableClass)(t)&&f.ClassType.isTypedDictClass(t)&&b(e,t,n,s)})),t.details.fields.forEach(((s,i)=>{if(!s.isIgnoredForProtocolMatch()){const r=(0,g.getLastTypedDeclaredForSymbol)(s);if(r&&1===r.type){const a=e.getEffectiveTypeOfSymbol(s);let o=!f.ClassType.isCanOmitDictValues(t);(0,g.isRequiredTypedDictVariable)(s)?o=!0:(0,g.isNotRequiredTypedDictVariable)(s)&&(o=!1);const p=n.get(i);if(p&&!(0,f.isTypeSame)(p.valueType,a)){const t=new l.DiagnosticAddendum;t.addMessage(u.Localizer.DiagnosticAddendum.typedDictFieldRedefinition().format({parentType:e.printType(p.valueType),childType:e.printType(a)})),e.addDiagnostic(m.getFileInfo(r.node).diagnosticRuleSet.reportGeneralTypeIssues,c.DiagnosticRule.reportGeneralTypeIssues,u.Localizer.Diagnostic.typedDictFieldRedefinition().format({name:i})+t.getString(),r.node)}n.set(i,{valueType:a,isRequired:o,isProvided:!1})}}})))}t.createTypedDictType=function(e,t,n,s){const i=m.getFileInfo(t);let r="TypedDict";if(0===s.length)e.addError(u.Localizer.Diagnostic.typedDictFirstArg(),t);else{const n=s[0];0===n.argumentCategory&&n.valueExpression&&48===n.valueExpression.nodeType?r=n.valueExpression.strings.map((e=>e.value)).join(""):e.addError(u.Localizer.Diagnostic.typedDictFirstArg(),s[0].valueExpression||t)}const a=f.ClassType.createInstantiable(r,y.getClassFullName(t,i.moduleName,r),i.moduleName,i.filePath,128,y.getTypeSourceId(t),void 0,n.details.effectiveMetaclass);a.details.baseClasses.push(n),(0,T.computeMroLinearization)(a);const o=a.details.fields;o.set("__class__",h.Symbol.createWithType(68,a));let l=!1;if(s.length<2)e.addError(u.Localizer.Diagnostic.typedDictSecondArgDict(),t);else{const n=s[1],r=new Map;if(0===n.argumentCategory&&n.valueExpression&&15===n.valueExpression.nodeType){l=!0;const t=n.valueExpression;t.entries.forEach((t=>{if(17!==t.nodeType)return void e.addError(u.Localizer.Diagnostic.typedDictSecondArgDictEntry(),t);if(48!==t.keyExpression.nodeType)return void e.addError(u.Localizer.Diagnostic.typedDictEntryName(),t.keyExpression);const n=t.keyExpression.strings.map((e=>e.value)).join("");if(!n)return void e.addError(u.Localizer.Diagnostic.typedDictEmptyName(),t.keyExpression);if(r.has(n))return void e.addError(u.Localizer.Diagnostic.typedDictEntryUnique(),t.keyExpression);r.set(n,!0);const s=e.getTypeOfExpressionExpectingType(t.valueExpression,!0,!0),a=new h.Symbol(8),l={type:1,node:t.keyExpression,path:i.filePath,typeAnnotationNode:t.valueExpression,isRequired:s.isRequired,isNotRequired:s.isNotRequired,isRuntimeTypeExpression:!0,range:(0,p.convertOffsetsToRange)(t.keyExpression.start,d.TextRange.getEnd(t.keyExpression),i.lines),moduleName:i.moduleName,isInExceptSuite:!1};a.addDeclaration(l),o.set(n,a)})),e.setTypeForNode(t)}else if(n.name)for(let n=1;n<s.length;n++){const i=s[n];if(!i.name||!i.valueExpression)continue;if(r.has(i.name.value)){e.addError(u.Localizer.Diagnostic.typedDictEntryUnique(),i.valueExpression);continue}r.set(i.name.value,!0);const a=e.getTypeOfExpressionExpectingType(i.valueExpression,!0,!0),l=new h.Symbol(8),c=m.getFileInfo(t),y={type:1,node:i.name,path:c.filePath,typeAnnotationNode:i.valueExpression,isRequired:a.isRequired,isNotRequired:a.isNotRequired,isRuntimeTypeExpression:!0,range:(0,p.convertOffsetsToRange)(i.name.start,d.TextRange.getEnd(i.valueExpression),c.lines),moduleName:c.moduleName,isInExceptSuite:!1};l.addDeclaration(y),o.set(i.name.value,l)}else e.addError(u.Localizer.Diagnostic.typedDictSecondArgDict(),t)}return l&&(s.length>=3&&(!s[2].name||"total"!==s[2].name.value||!s[2].valueExpression||11!==s[2].valueExpression.nodeType||15!==s[2].valueExpression.constType&&33!==s[2].valueExpression.constType?e.addError(u.Localizer.Diagnostic.typedDictTotalParam(),s[2].valueExpression||t):15===s[2].valueExpression.constType&&(a.details.flags|=256)),s.length>3&&e.addError(u.Localizer.Diagnostic.typedDictExtraArgs(),s[3].valueExpression||t)),_(e,t,a,!1),a},t.synthesizeTypedDictClassMethods=_,t.getTypedDictMembersForClass=v,t.canAssignTypedDict=function(e,t,n,s,i=0){let r=!0;const a=v(e,t),o=v(e,n,!0);return a.forEach(((a,l)=>{const c=o.get(l);c?(a.isRequired&&!c.isRequired?(s&&s.addMessage(u.Localizer.DiagnosticAddendum.typedDictFieldRequired().format({name:l,type:e.printType(t)})),r=!1):!a.isRequired&&c.isRequired&&(s&&s.addMessage(u.Localizer.DiagnosticAddendum.typedDictFieldNotRequired().format({name:l,type:e.printType(t)})),r=!1),e.canAssignType(a.valueType,c.valueType,void 0,void 0,void 0,i)||(s&&s.addMessage(u.Localizer.DiagnosticAddendum.memberTypeMismatch().format({name:l})),r=!1)):(s&&s.addMessage(u.Localizer.DiagnosticAddendum.typedDictFieldMissing().format({name:l,type:e.printType(n)})),r=!1)})),r},t.assignToTypedDict=function(e,t,n,s,i){(0,o.assert)((0,f.isClassInstance)(t)),(0,o.assert)(f.ClassType.isTypedDictClass(t)),(0,o.assert)(n.length===s.length);let r=!0;const a=new Map,l=v(e,t);if(n.forEach(((n,o)=>{if((0,f.isClassInstance)(n)&&f.ClassType.isBuiltIn(n,"str")&&(0,T.isLiteralType)(n)){const c=n.literalValue,p=l.get(c);p?(e.canAssignType(p.valueType,s[o])||(i&&i.addMessage(u.Localizer.DiagnosticAddendum.typedDictFieldTypeMismatch().format({name:n.literalValue,type:e.printType(s[o])})),r=!1),p.isRequired||a.set(c,{valueType:s[o],isRequired:!1,isProvided:!0}),p.isProvided=!0):(r=!1,i&&i.addMessage(u.Localizer.DiagnosticAddendum.typedDictFieldUndefined().format({name:n.literalValue,type:e.printType(f.ClassType.cloneAsInstance(t))})))}else r=!1})),r&&(l.forEach(((n,s)=>{n.isRequired&&!n.isProvided&&(i&&i.addMessage(u.Localizer.DiagnosticAddendum.typedDictFieldRequired().format({name:s,type:e.printType(t)})),r=!1)})),r))return 0===a.size?t:f.ClassType.cloneForNarrowedTypedDictEntries(t,a)},t.getTypeOfIndexedTypedDict=function(e,t,n,s){if(1!==t.items.length)return e.addError(u.Localizer.Diagnostic.typeArgsMismatchOne().format({received:t.items.length}),t),{node:t,type:f.UnknownType.create()};if(t.trailingComma||t.items[0].name||0!==t.items[0].argumentCategory)return;const i=v(e,n,"get"===s.method),r=e.getTypeOfExpression(t.items[0].valueExpression),a=r.type;let o=new l.DiagnosticAddendum,p=!0;const d=(0,T.mapSubtypes)(a,(r=>{if((0,f.isAnyOrUnknown)(r))return r;if((0,f.isClassInstance)(r)&&f.ClassType.isBuiltIn(r,"str")){if(void 0===r.literalValue)return f.UnknownType.create();const a=r.literalValue,l=i.get(a);return l?(l.isRequired||l.isProvided||"get"!==s.method||y.isWithinTryBlock(t,!0)||o.addMessage(u.Localizer.DiagnosticAddendum.keyNotRequired().format({name:a,type:e.printType(n)})),"set"===s.method?e.canAssignType(l.valueType,s.setType||f.AnyType.create(),o)||(p=!1):"del"===s.method&&l.isRequired&&(o.addMessage(u.Localizer.DiagnosticAddendum.keyRequiredDeleted().format({name:a})),p=!1),l.valueType):(o.addMessage(u.Localizer.DiagnosticAddendum.keyUndefined().format({name:a,type:e.printType(n)})),p=!1,f.UnknownType.create())}return o.addMessage(u.Localizer.DiagnosticAddendum.typeNotStringLiteral().format({type:e.printType(r)})),p=!1,f.UnknownType.create()}));if(s.setExpectedTypeDiag&&(o=s.setExpectedTypeDiag),!o.isEmpty()){let n;n="set"===s.method?u.Localizer.Diagnostic.typedDictSet():"del"===s.method?u.Localizer.Diagnostic.typedDictDelete():u.Localizer.Diagnostic.typedDictAccess();const i=m.getFileInfo(t);e.addDiagnostic(p?i.diagnosticRuleSet.reportTypedDictNotRequiredAccess:i.diagnosticRuleSet.reportGeneralTypeIssues,p?c.DiagnosticRule.reportTypedDictNotRequiredAccess:c.DiagnosticRule.reportGeneralTypeIssues,n+o.getString(),t)}return{node:t,type:d,isIncomplete:!!r.isIncomplete}}},59195:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isSameWithoutLiteralValue=t.combineTypes=t.findSubtype=t.removeFromUnion=t.removeNoneFromUnion=t.removeUnbound=t.removeIncompleteUnknownFromUnion=t.removeUnknownFromUnion=t.isTypeSame=t.getTypeAliasInfo=t.isOverloadedFunction=t.isFunction=t.isParamSpec=t.isUnpacked=t.isUnpackedClass=t.isUnpackedVariadicTypeVar=t.isVariadicTypeVar=t.isTypeVar=t.isModule=t.isClassInstance=t.isInstantiableClass=t.isClass=t.isPossiblyUnbound=t.isUnion=t.isUnbound=t.isAnyOrUnknown=t.isUnknown=t.isAny=t.isNoneTypeClass=t.isNoneInstance=t.isNever=t.TypeVarType=t.UnionType=t.TypeCondition=t.AnyType=t.NeverType=t.NoneType=t.OverloadedFunctionType=t.FunctionType=t.ClassType=t.ModuleType=t.UnknownType=t.UnboundType=t.TypeBase=t.maxTypeRecursionCount=t.EnumLiteral=t.WildcardTypeVarScopeId=void 0;const s=n(20823);t.WildcardTypeVarScopeId="*";class i{constructor(e,t,n){this.className=e,this.itemName=t,this.itemType=n}}var r,a,o,l,c,p,d,u;function m(e){return 4===e.category}function y(e){return 3===e.category&&r.isInstance(e)}function h(e){return 1===e.category}function g(e){return 2===e.category||1===e.category||!!T(e)&&void 0===e.subtypes.find((e=>!g(e)))}function f(e){return 0===e.category}function T(e){return 9===e.category}function _(e){return 7===e.category}function v(e){return 7===e.category&&r.isInstantiable(e)}function b(e){return 7===e.category&&r.isInstance(e)}function I(e){return 10===e.category}function C(e){return T(e)&&1===e.subtypes.length&&(e=e.subtypes[0]),10===e.category&&e.details.isVariadic&&!!e.isVariadicUnpacked}function S(e){return!(!_(e)||!e.isUnpacked)}function F(e,n,s=!1,i=!1,r=0){var a,c;if(e===n)return!0;if(e.category!==n.category)return!1;if(!i&&e.flags!==n.flags)return!1;if(r>t.maxTypeRecursionCount)return!0;switch(r++,e.category){case 7:{const t=n;if(!o.isSameGenericClass(e,t,r))return!1;if(!d.isSame(e.condition,n.condition))return!1;if(!s||!o.isPseudoGenericClass(e))if(e.tupleTypeArguments&&t.tupleTypeArguments){const n=e.tupleTypeArguments||[],i=t.tupleTypeArguments||[];if(n.length!==i.length)return!1;for(let e=0;e<n.length;e++){if(!F(n[e].type,i[e].type,s,!1,r))return!1;if(n[e].isUnbounded!==i[e].isUnbounded)return!1}}else{const n=e.typeArguments||[],i=t.typeArguments||[],a=Math.max(n.length,i.length);for(let e=0;e<a;e++){if(!F(e<n.length?n[e]:p.create(),e<i.length?i[e]:p.create(),s,!1,r))return!1}}return!!o.isLiteralValueSame(e,t)}case 5:{const t=n,i=e.details.parameters,a=t.details.parameters;if(i.length!==a.length)return!1;const o=i.findIndex((e=>0===e.category&&!e.name)),c=a.findIndex((e=>0===e.category&&!e.name));for(let n=0;n<i.length;n++){const p=i[n],d=a[n];if(p.category!==d.category)return!1;const u=void 0!==o&&n>=o;if(u!==(void 0!==c&&n>=c))return!1;if(u&&p.name!==d.name)return!1;if(!F(l.getEffectiveParameterType(e,n),l.getEffectiveParameterType(t,n),s,!1,r))return!1}let p=e.details.declaredReturnType;e.specializedTypes&&e.specializedTypes.returnType&&(p=e.specializedTypes.returnType),!p&&e.inferredReturnType&&(p=e.inferredReturnType);let d=t.details.declaredReturnType;return t.specializedTypes&&t.specializedTypes.returnType&&(d=t.specializedTypes.returnType),!d&&t.inferredReturnType&&(d=t.inferredReturnType),!!(!p&&!d||p&&d&&F(p,d,s,!1,r))}case 6:{const t=n;if(e.overloads.length!==t.overloads.length)return!1;for(let n=0;n<e.overloads.length;n++)if(!F(e.overloads[n],t.overloads[n],s,i,r))return!1;return!0}case 9:{const t=n,s=e.subtypes,i=t.subtypes;return s.length===i.length&&void 0===D(e,(e=>!u.containsType(t,e,r)))}case 10:{const t=n;if(e.scopeId!==t.scopeId)return!1;if(e.details.recursiveTypeParameters&&t.details.recursiveTypeParameters){const t=(null===(a=null==e?void 0:e.typeAliasInfo)||void 0===a?void 0:a.typeArguments)||[],i=(null===(c=null==n?void 0:n.typeAliasInfo)||void 0===c?void 0:c.typeArguments)||[],o=Math.max(t.length,i.length);for(let e=0;e<o;e++){if(!F(e<t.length?t[e]:p.create(),e<i.length?i[e]:p.create(),s,!1,r))return!1}}if(e.details===t.details)return!0;if(e.details.name!==t.details.name||e.details.isParamSpec!==t.details.isParamSpec||e.details.isVariadic!==t.details.isVariadic||e.details.isSynthesized!==t.details.isSynthesized||e.details.variance!==t.details.variance||e.scopeId!==t.scopeId)return!1;const i=e.details.boundType,o=t.details.boundType;if(i){if(!o||!F(i,o,s,!1,r))return!1}else if(o)return!1;const l=e.details.constraints,d=t.details.constraints;if(l.length!==d.length)return!1;for(let e=0;e<l.length;e++)if(!F(l[e],d[e],s,!1,r))return!1;return!0}case 8:{const t=n;return e.fields===t.fields||0===e.fields.size&&0===t.fields.size}}return!0}function x(e,t){if(T(e)){const n=e.subtypes.filter((e=>!t(e)));if(n.length<e.subtypes.length){const t=P(n);return T(t)&&u.addTypeAliasSource(t,e),t}}return e}function D(e,t){return T(e)?e.subtypes.find((e=>t(e))):t(e)?e:void 0}function P(e,t){let n=!1;if(0===(e=e.filter((e=>(4===e.category&&e.isNoReturn&&(n=!0),4!==e.category)))).length)return n?c.createNoReturn():c.createNever();let s=!0;for(let t=1;t<e.length;t++)if(e[t]!==e[0]){s=!1;break}if(s)return e[0];let i=[];const r=new Set;for(const t of e)T(t)?(i=i.concat(t.subtypes),t.typeAliasInfo?r.add(t):t.typeAliasSources&&t.typeAliasSources.forEach((e=>{r.add(e)}))):i.push(t);if(i=i.sort(((e,t)=>b(e)&&void 0!==e.literalValue||v(e)&&void 0!==e.literalValue?1:b(t)&&void 0!==t.literalValue||v(t)&&void 0!==t.literalValue?-1:b(e)&&e.isEmptyContainer?1:b(t)&&t.isEmptyContainer?-1:0)),0===i.length)return a.create();const l=u.create();r.size>0&&(l.typeAliasSources=r);let d=!1;return i.forEach(((e,n)=>{0===n?u.addType(l,e):void 0===t||l.subtypes.length<t?function(e,t){if(b(t)&&void 0===t.condition){if(o.isBuiltIn(t,"str")&&void 0!==t.literalValue&&void 0!==e.literalStrMap)return void(e.literalStrMap.has(t.literalValue)||u.addType(e,t));if(o.isBuiltIn(t,"int")&&void 0!==t.literalValue&&void 0!==e.literalIntMap&&"number"==typeof t.literalValue)return void(e.literalIntMap.has(t.literalValue)||u.addType(e,t))}for(let n=0;n<e.subtypes.length;n++){const s=e.subtypes[n];if(F(s,t))return;if(b(s)&&b(t)){if(A(s,t)&&void 0===s.literalValue)return;if(o.isBuiltIn(s,"bool")&&!s.condition&&o.isBuiltIn(t,"bool")&&!t.condition&&void 0!==t.literalValue&&!t.literalValue===s.literalValue)return void(e.subtypes[n]=o.cloneWithLiteral(s,void 0))}if(b(t)&&t.isEmptyContainer&&b(s)&&o.isSameGenericClass(s,t))return}u.addType(e,t)}(l,e):d=!0})),d?p.create():1===l.subtypes.length?l.subtypes[0]:l}function A(e,t){return!!F(e,t)||(v(t)&&void 0!==t.literalValue||!(!b(t)||void 0===t.literalValue))&&F(e,t=o.cloneWithLiteral(t,void 0))}t.EnumLiteral=i,t.maxTypeRecursionCount=14,function(e){function t(e){return{...e}}e.isInstantiable=function(e){return 0!=(1&e.flags)},e.isInstance=function(e){return 0!=(2&e.flags)},e.isAnnotated=function(e){return 0!=(4&e.flags)},e.isSpecialForm=function(e){return 0!=(8&e.flags)},e.setSpecialForm=function(e){return e.flags|=8},e.isAmbiguous=function(e){return!!e.isAmbiguous},e.cloneType=t,e.cloneForTypeAlias=function(e,n,s,i,r,a){const o=t(e);return o.typeAliasInfo={name:n,fullName:s,typeParameters:r,typeArguments:a,typeVarScopeId:i},o},e.cloneForAnnotated=function(e){const n=t(e);return n.flags|=4,n},e.cloneForCondition=function(e,n){if(void 0===e.condition&&void 0===n)return e;const s=t(e);return s.condition=n,s},e.cloneForAmbiguousType=function(e){if(e.isAmbiguous)return e;const n=t(e);return n.isAmbiguous=!0,n}}(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,isIncomplete:!1},n={category:1,flags:3,isIncomplete:!0};e.create=function(e=!1){return e?n:t}}(a=t.UnknownType||(t.UnknownType={})),function(e){e.create=function(e,t,n){return{category:8,fields:n||new Map,loaderFields:new Map,flags:1,moduleName:e,filePath:t}},e.getField=function(e,t){let n=e.fields.get(t);if(e.loaderFields)if(n){if(n.isExternallyHidden()){const s=e.loaderFields.get(t);s&&!s.isExternallyHidden()&&(n=s)}}else n=e.loaderFields.get(t);return n}}(t.ModuleType||(t.ModuleType={})),function(e){function n(e){if(r.isInstantiable(e))return e;const t=r.cloneType(e);return t.flags&=-3,t.flags|=1,t}function s(e,t){if(!(1&e.details.flags))return!1;if(void 0!==t){const n=Array.isArray(t)?t:[t];return n.some((t=>t===e.details.name))||n.some((t=>t===e.aliasName))}return!0}function o(n,s,i=0){if(i>t.maxTypeRecursionCount)return!0;if(i++,n.details===s.details)return!0;const r=n.details,a=s.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(s,"NamedTuple"))return!0;if(e.isBuiltIn(n,"tuple")&&e.isBuiltIn(s,"tuple"))return!0;for(let e=0;e<r.baseClasses.length;e++)if(!F(r.baseClasses[e],a.baseClasses[e],!0,void 0,i))return!1;if((r.declaredMetaclass||a.declaredMetaclass)&&(!r.declaredMetaclass||!a.declaredMetaclass||!F(r.declaredMetaclass,a.declaredMetaclass,!0,void 0,i)))return!1;for(let e=0;e<r.typeParameters.length;e++)if(!F(r.typeParameters[e],a.typeParameters[e],!0,void 0,i))return!1;return!0}e.createInstantiable=function(e,t,n,s,i,r,a,o,l){return{category:7,details:{name:e,fullName:t,moduleName:n,filePath:s,flags:i,typeSourceId:r,baseClasses:[],declaredMetaclass:a,effectiveMetaclass:o,mro:[],fields:new Map,typeParameters:[],docString:l},flags:1}},e.cloneAsInstance=function(e){if(r.isInstance(e))return e;const t=r.cloneType(e);return t.flags&=~9,t.flags|=2,t.includeSubclasses=!0,t},e.cloneAsInstantiable=n,e.cloneForSpecialization=function(e,t,n,s=!1,i,o){const l=r.cloneType(e);return l.typeArguments=t?t.map((e=>m(e)&&!e.isNoReturn?a.create():e)):void 0,l.isTypeArgumentExplicit=n,s&&(l.includeSubclasses=!0),l.tupleTypeArguments=i?i.map((e=>m(e.type)?{type:a.create(),isUnbounded:e.isUnbounded}:e)):void 0,void 0!==o&&(l.isEmptyContainer=o),l},e.cloneWithLiteral=function(e,t){const n=r.cloneType(e);return n.literalValue=t,n},e.cloneForTypingAlias=function(e,t){const n=r.cloneType(e);return n.aliasName=t,n},e.cloneForNarrowedTypedDictEntries=function(e,t){const n=r.cloneType(e);return n.typedDictNarrowedEntries=t,n},e.cloneWithNewTypeParameters=function(e,t){const n=r.cloneType(e);return n.details={...n.details},n.details.typeParameters=t,n},e.cloneForTypeGuard=function(e,t,n){const s=r.cloneType(e);return s.typeGuardType=t,s.isStrictTypeGuard=n,s},e.cloneForSymbolTableUpdate=function(e){const t=r.cloneType(e);return t.details={...t.details},t.details.fields=new Map(t.details.fields),t.details.mro=[...t.details.mro],t.details.mro[0]=n(t),t},e.cloneForUnpacked=function(e,t=!0){const n=r.cloneType(e);return n.isUnpacked=t,n},e.isLiteralValueSame=function(e,t){return void 0===e.literalValue?void 0===t.literalValue:void 0!==t.literalValue&&(e.literalValue instanceof i?t.literalValue instanceof i&&e.literalValue.itemName===t.literalValue.itemName:e.literalValue===t.literalValue)},e.isUnspecialized=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=s,e.derivesFromAnyOrUnknown=function(e){return e.details.mro.some((e=>!_(e)))},e.supportsAbstractMethods=function(e){return!!(512&e.details.flags)},e.isDataClass=function(e){return!!(4&e.details.flags)},e.isSkipSynthesizedDataClassInit=function(e){return!!(16&e.details.flags)},e.isSkipSynthesizedDataClassEq=function(e){return!!(32&e.details.flags)},e.isFrozenDataClass=function(e){return!!(8&e.details.flags)},e.isSynthesizedDataclassOrder=function(e){return!!(64&e.details.flags)},e.isDataClassKeywordOnlyParams=function(e){return!!(2097152&e.details.flags)},e.isGeneratedDataClassSlots=function(e){return!!(33554432&e.details.flags)},e.isSynthesizeDataClassUnsafeHash=function(e){return!!(67108864&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.isClassProperty=function(e){return!!(4194304&e.details.flags)},e.isFinal=function(e){return!!(4096&e.details.flags)},e.isProtocolClass=function(e){return!!(8192&e.details.flags)},e.isDefinedInStub=function(e){return!!(8388608&e.details.flags)},e.isPseudoGenericClass=function(e){return!!(16384&e.details.flags)},e.getDataClassEntries=function(e){return e.details.dataClassEntries||[]},e.isRuntimeCheckable=function(e){return!!(32768&e.details.flags)},e.isTypingExtensionClass=function(e){return!!(65536&e.details.flags)},e.isPartiallyConstructed=function(e){return!!(131072&e.details.flags)},e.hasCustomClassGetItem=function(e){return!!(262144&e.details.flags)},e.isTupleClass=function(e){return!!(524288&e.details.flags)},e.isReadOnlyInstanceVariables=function(e){return!!(16777216&e.details.flags)},e.getTypeParameters=function(e){return e.details.typeParameters},e.hasUnknownBaseClass=function(e){return e.details.mro.some((e=>g(e)))},e.isSameGenericClass=o,e.isDerivedFrom=function e(t,n,i){if(o(t,n))return i&&i.push(t),!0;if(s(t)&&s(n,"object"))return i&&i.push(n),!0;for(const s of t.details.baseClasses)if(v(s)){if(e(s,n,i))return i&&i.push(t),!0}else if(g(s))return i&&i.push(a.create()),!0;return!1}}(o=t.ClassType||(t.ClassType={})),function(e){function t(e,t,n,s,i,r){return{category:5,details:{name:e,fullName:t,moduleName:n,flags:s,parameters:[],docString:r},flags:i}}function n(e=!1){return[{category:1,name:"args",type:e?a.create():p.create(),hasDeclaredType:!e},{category:2,name:"kwargs",type:e?a.create():p.create(),hasDeclaredType:!e}]}function i(e,t){return(0,s.assert)(t<e.details.parameters.length,"Parameter types array overflow"),e.specializedTypes&&t<e.specializedTypes.parameterTypes.length?e.specializedTypes.parameterTypes[t]:e.details.parameters[t].type}e.createInstance=function(e,n,s,i,r){return t(e,n,s,i,2,r)},e.createInstantiable=function(e,n){return t("","","",e,1,n)},e.createSynthesizedInstance=function(e,n=0){return t(e,"","",64|n,2)},e.clone=function(e,n=!1,s,r){const a=t(e.details.name,e.details.fullName,e.details.moduleName,e.details.flags,e.flags,e.details.docString);return a.details={...e.details},a.boundToType=s,a.preBoundFlags=a.details.flags,n&&(e.details.parameters.length>0&&0===e.details.parameters[0].category?(e.details.parameters.length>0&&!e.details.parameters[0].isTypeInferred&&(a.strippedFirstParamType=i(e,0)),a.details.parameters=e.details.parameters.slice(1)):n=!1,a.details.flags&=-4,a.details.flags|=4),void 0!==e.typeAliasInfo&&(a.typeAliasInfo=e.typeAliasInfo),e.specializedTypes&&(a.specializedTypes={parameterTypes:n?e.specializedTypes.parameterTypes.slice(1):e.specializedTypes.parameterTypes,returnType:e.specializedTypes.returnType}),a.inferredReturnType=e.inferredReturnType,a.boundTypeVarScopeId=r,a},e.cloneAsInstance=function(e){(0,s.assert)(r.isInstantiable(e));const t=r.cloneType(e);return t.flags&=~9,t.flags|=2,t},e.cloneAsInstantiable=function(e){(0,s.assert)(r.isInstance(e));const t=r.cloneType(e);return t.flags&=-11,t.flags|=1,t},e.cloneForSpecialization=function(e,n,i){const r=t(e.details.name,e.details.fullName,e.details.moduleName,e.details.flags,e.flags,e.details.docString);return r.details=e.details,(0,s.assert)(n.parameterTypes.length===e.details.parameters.length),r.specializedTypes=n,i&&(r.inferredReturnType=i),r},e.cloneForParamSpec=function(n,s){const i=t(n.details.name,n.details.fullName,n.details.moduleName,n.details.flags,n.flags,n.details.docString);return i.details={...n.details},delete i.details.paramSpec,s&&(i.details.parameters=[...n.details.parameters,...s.parameters.map((e=>({category:e.category,name:e.name,hasDefault:e.hasDefault,isNameSynthesized:e.isNameSynthesized,hasDeclaredType:!0,type:e.type})))],i.details.docString||(i.details.docString=s.docString),i.details.flags=32775&s.flags|64,e.isParamSpecValue(n)&&(i.details.flags|=65536),n.specializedTypes&&(i.specializedTypes={parameterTypes:[...n.specializedTypes.parameterTypes],returnType:n.specializedTypes.returnType},s.parameters.forEach((e=>{i.specializedTypes.parameterTypes.push(e.type)}))),i.details.paramSpec=s.paramSpec),i},e.cloneWithNewFlags=function(e,t){const n=r.cloneType(e);return n.details={...e.details},n.details.flags=t,n},e.cloneForParamSpecApplication=function(e,t){const n=r.cloneType(e);if(n.details={...e.details},n.details.parameters=n.details.parameters.slice(0,n.details.parameters.length-2),t.parameters.some((e=>0===e.category&&!e.name))&&n.details.parameters.length>0){const e=n.details.parameters[n.details.parameters.length-1];0!==e.category||e.name||n.details.parameters.pop()}return t.parameters.forEach((e=>{n.details.parameters.push({category:e.category,name:e.name,hasDefault:e.hasDefault,isNameSynthesized:e.isNameSynthesized,hasDeclaredType:!0,type:e.type})})),n.details.paramSpec=t.paramSpec,n.details.docString||(n.details.docString=t.docString),n},e.cloneRemoveParamSpecVariadics=function(e,n){const s=t(e.details.name,e.details.fullName,e.details.moduleName,e.details.flags,e.flags,e.details.docString);return s.details={...e.details},s.details.parameters=s.details.parameters.slice(0,s.details.parameters.length-2),e.specializedTypes&&(s.specializedTypes={...e.specializedTypes},s.specializedTypes.parameterTypes=s.specializedTypes.parameterTypes.slice(0,s.specializedTypes.parameterTypes.length-2)),s.details.paramSpec||(s.details.paramSpec=n),s},e.addDefaultParameters=function(t,s=!1){n(s).forEach((n=>{e.addParameter(t,n)}))},e.getDefaultParameters=n,e.hasDefaultParameters=function(t){let n=!1,s=!1;for(let i=0;i<t.details.parameters.length;i++){const r=t.details.parameters[i];if(r.name){if(0===r.category)return!1;if(1===r.category?n=!0:2===r.category&&(s=!0),!g(e.getEffectiveParameterType(t,i)))return!1}}return n&&s},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.shouldSkipArgsKwargsCompatibilityCheck=function(e){return 0!=(32768&e.details.flags)},e.isParamSpecValue=function(e){return 0!=(65536&e.details.flags)},e.getEffectiveParameterType=i,e.addParameter=function(e,t){e.details.parameters.push(t)},e.getSpecializedReturnType=function(e){return e.specializedTypes&&e.specializedTypes.returnType?e.specializedTypes.returnType:e.details.declaredReturnType}}(l=t.FunctionType||(t.FunctionType={})),function(e){e.create=function(e){return{category:6,overloads:e,flags:2}},e.addOverload=function(e,t){e.overloads.push(t)}}(t.OverloadedFunctionType||(t.OverloadedFunctionType={})),function(e){const t={category:3,flags:2},n={category:3,flags:1};e.createInstance=function(){return t},e.createType=function(){return n}}(t.NoneType||(t.NoneType={})),function(e){const t={category:4,flags:3,isNoReturn:!1},n={category:4,flags:3,isNoReturn:!0};e.createNever=function(){return t},e.createNoReturn=function(){return n}}(c=t.NeverType||(t.NeverType={})),function(e){const t={category:2,isEllipsis:!1,flags:3},n={category:2,isEllipsis:!0,flags:3};e.create=function(e=!1){return e?n:t}}(p=t.AnyType||(t.AnyType={})),function(e){function t(e,t){return e.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 s=[...e];return n.forEach((e=>{s.some((n=>0===t(e,n)))||s.push(e)})),s.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 s=t.find((t=>n.typeVarName===t.typeVarName&&(e=!0,n.constraintIndex===t.constraintIndex)));if(e&&!s)return!1}return!0}}(d=t.TypeCondition||(t.TypeCondition={})),function(e){e.create=function(){return{category:9,subtypes:[],flags:3}},e.addType=function(e,t){b(t)&&o.isBuiltIn(t,"str")&&void 0!==t.literalValue&&void 0===t.condition?(void 0===e.literalStrMap&&(e.literalStrMap=new Map),e.literalStrMap.set(t.literalValue,t)):b(t)&&o.isBuiltIn(t,"int")&&void 0!==t.literalValue&&"number"==typeof t.literalValue&&void 0===t.condition&&(void 0===e.literalIntMap&&(e.literalIntMap=new Map),e.literalIntMap.set(t.literalValue,t)),e.flags&=t.flags,e.subtypes.push(t)},e.containsType=function(e,t,n=0){if(b(t)&&void 0===t.condition){if(o.isBuiltIn(t,"str")&&void 0!==t.literalValue&&void 0!==e.literalStrMap)return e.literalStrMap.has(t.literalValue);if(o.isBuiltIn(t,"int")&&void 0!==t.literalValue&&"number"==typeof t.literalValue&&void 0!==e.literalIntMap)return e.literalIntMap.has(t.literalValue)}return void 0!==e.subtypes.find((e=>F(e,t,void 0,void 0,n)))},e.addTypeAliasSource=function(e,t){if(9===t.category){const n=t.typeAliasInfo?[t]:t.typeAliasSources;n&&(e.typeAliasSources||(e.typeAliasSources=new Set),n.forEach((t=>{e.typeAliasSources.add(t)})))}}}(u=t.UnionType||(t.UnionType={})),function(e){function t(e,t){return`${e}.${t}`}function n(e,t,n){return{category:10,details:{name:e,constraints:[],variance:0,isParamSpec:t,isVariadic:!1,isSynthesized:!1},flags:n}}e.createInstance=function(e){return n(e,!1,2)},e.createInstantiable=function(e,t=!1){return n(e,t,1)},e.cloneAsInstance=function(e){(0,s.assert)(r.isInstantiable(e));const t=r.cloneType(e);return t.flags&=~9,t.flags|=2,t},e.cloneAsInstantiable=function(e){(0,s.assert)(r.isInstance(e));const t=r.cloneType(e);return t.flags&=-11,t.flags|=1,t},e.cloneForScopeId=function(e,n,s,i){const a=r.cloneType(e);return a.nameWithScope=t(e.details.name,n),a.scopeId=n,a.scopeName=s,a.scopeType=i,a},e.cloneForUnpacked=function(e,t=!1){(0,s.assert)(e.details.isVariadic);const n=r.cloneType(e);return n.isVariadicUnpacked=!0,n.isVariadicInUnion=t,n},e.cloneForPacked=function(e){(0,s.assert)(e.details.isVariadic);const t=r.cloneType(e);return t.isVariadicUnpacked=!1,t.isVariadicInUnion=!1,t},e.cloneAsInvariant=function(e){if(e.details.isParamSpec||e.details.isVariadic)return e;if(0===e.details.variance&&void 0===e.details.boundType&&0===e.details.constraints.length)return e;const t=r.cloneType(e);return t.details={...t.details},t.details.variance=0,t.details.boundType=void 0,t.details.constraints=[],t},e.cloneForParamSpecAccess=function(e,t){const n=r.cloneType(e);return n.paramSpecAccess=t,n},e.cloneAsSpecializedSelf=function(e,t){(0,s.assert)(e.details.isSynthesizedSelf);const n=r.cloneType(e);return n.details={...n.details},n.details.boundType=t,n},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=m,t.isNoneInstance=y,t.isNoneTypeClass=function(e){return 3===e.category&&r.isInstantiable(e)},t.isAny=function(e){return 2===e.category},t.isUnknown=h,t.isAnyOrUnknown=g,t.isUnbound=f,t.isUnion=T,t.isPossiblyUnbound=function e(t){return!!f(t)||!!T(t)&&void 0!==t.subtypes.find((t=>e(t)))},t.isClass=_,t.isInstantiableClass=v,t.isClassInstance=b,t.isModule=function(e){return 8===e.category},t.isTypeVar=I,t.isVariadicTypeVar=function(e){return 10===e.category&&e.details.isVariadic},t.isUnpackedVariadicTypeVar=C,t.isUnpackedClass=S,t.isUnpacked=function(e){return C(e)||S(e)},t.isParamSpec=function(e){return 10===e.category&&e.details.isParamSpec},t.isFunction=function(e){return 5===e.category},t.isOverloadedFunction=function(e){return 6===e.category},t.getTypeAliasInfo=function(e){return e.typeAliasInfo?e.typeAliasInfo:I(e)&&e.details.recursiveTypeAliasName&&e.details.boundType&&e.details.boundType.typeAliasInfo?e.details.boundType.typeAliasInfo:void 0},t.isTypeSame=F,t.removeUnknownFromUnion=function(e){return x(e,(e=>h(e)))},t.removeIncompleteUnknownFromUnion=function(e){return x(e,(e=>h(e)&&e.isIncomplete))},t.removeUnbound=function(e){return T(e)?x(e,(e=>f(e))):f(e)?a.create():e},t.removeNoneFromUnion=function(e){return x(e,(e=>y(e)))},t.removeFromUnion=x,t.findSubtype=D,t.combineTypes=P,t.isSameWithoutLiteralValue=A},69546:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.BackgroundAnalysisRunnerBase=t.BackgroundAnalysisBase=void 0;const a=n(71267),o=n(20166),l=n(73054),c=n(15179),p=n(38213),d=n(14943),u=n(11043),m=r(n(20823)),y=n(24319),h=n(68384),g=n(77134);t.BackgroundAnalysisBase=class{constructor(e){this.console=e,this._onAnalysisCompletion=o.nullCallback}setup(e){this._worker=e,e.on("message",(e=>this.onMessage(e))),e.on("error",(e=>{this.log(u.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:m.fail(`${e.requestType} is not expected`)}}setCompletionCallback(e){this._onAnalysisCompletion=null!=e?e:o.nullCallback}setImportResolver(e){this.enqueueRequest({requestType:"setImportResolver",data:e.host.kind})}setConfigOptions(e){this.enqueueRequest({requestType:"setConfigOptions",data:e})}setTrackedFiles(e){this.enqueueRequest({requestType:"setTrackedFiles",data:e})}setAllowedThirdPartyImports(e){this.enqueueRequest({requestType:"setAllowedThirdPartyImports",data:e})}ensurePartialStubPackages(e){this.enqueueRequest({requestType:"ensurePartialStubPackages",data:{executionRoot:e}})}setFileOpened(e,t,n,s){this.enqueueRequest({requestType:"setFileOpened",data:{filePath:e,version:t,contents:n,options:s}})}setFileClosed(e){this.enqueueRequest({requestType:"setFileClosed",data:e})}markAllFilesDirty(e,t){this.enqueueRequest({requestType:"markAllFilesDirty",data:{evenIfContentsAreSame:e,indexingNeeded:t}})}markFilesDirty(e,t,n){this.enqueueRequest({requestType:"markFilesDirty",data:{filePaths:e,evenIfContentsAreSame:t,indexingNeeded:n}})}startAnalysis(e,t){this._startOrResumeAnalysis("analyze",e,t)}_startOrResumeAnalysis(e,t,n){const{port1:s,port2:i}=new a.MessageChannel;s.on("message",(e=>{switch(e.requestType){case"analysisResult":this._onAnalysisCompletion(T(e.data));break;case"analysisPaused":i.close(),s.close(),this._startOrResumeAnalysis("resumeAnalysis",t,n);break;case"indexResult":{const{path:n,indexResults:s}=e.data;null==t||t.setWorkspaceIndex(n,s);break}case"analysisDone":(0,h.disposeCancellationToken)(n),i.close(),s.close();break;default:m.fail(`${e.requestType} is not expected`)}}));const r=(0,h.getCancellationTokenId)(n);this.enqueueRequest({requestType:e,data:r,port:i})}startIndexing(e,t,n,s,i){}refreshIndexing(e,t,n,s){}cancelIndexing(e){}async getDiagnosticsForRange(e,t,n){(0,p.throwIfCancellationRequested)(n);const{port1:s,port2:i}=new a.MessageChannel,r=(0,c.getBackgroundWaiter)(s),o=(0,h.getCancellationTokenId)(n);this.enqueueRequest({requestType:"getDiagnosticsForRange",data:{filePath:e,range:t,cancellationId:o},port:i});const l=await r;return i.close(),s.close(),_(l)}async writeTypeStub(e,t,n,s){(0,p.throwIfCancellationRequested)(s);const{port1:i,port2:r}=new a.MessageChannel,o=(0,c.getBackgroundWaiter)(i),l=(0,h.getCancellationTokenId)(s);this.enqueueRequest({requestType:"writeTypeStub",data:{targetImportPath:e,targetIsSingleFile:t,stubPath:n,cancellationId:l},port:r}),await o,r.close(),i.close()}invalidateAndForceReanalysis(e){this.enqueueRequest({requestType:"invalidateAndForceReanalysis",data:e})}restart(){this.enqueueRequest({requestType:"restart",data:null})}enqueueRequest(e){this._worker&&this._worker.postMessage(e,e.port?[e.port]:void 0)}log(e,t){(0,u.log)(this.console,e,t)}};class f extends c.BackgroundThreadBase{constructor(e){super(a.workerData),this._extension=e;const t=a.workerData;this.log(u.LogLevel.Info,`Background analysis(${a.threadId}) root directory: ${t.rootDirectory}`),this._configOptions=new d.ConfigOptions(t.rootDirectory),this._host=this.createHost(),this._importResolver=this.createImportResolver(this.fs,this._configOptions,this._host);const n=this.getConsole();this._logTracker=new g.LogTracker(n,`BG(${a.threadId})`),this._program=new l.Program(this._importResolver,this._configOptions,n,this._extension,this._logTracker)}get program(){return this._program}start(){this.log(u.LogLevel.Info,`Background analysis(${a.threadId}) started`),null===a.parentPort||void 0===a.parentPort||a.parentPort.on("message",(e=>this.onMessage(e))),null===a.parentPort||void 0===a.parentPort||a.parentPort.on("error",(e=>m.fail(`failed ${e}`))),null===a.parentPort||void 0===a.parentPort||a.parentPort.on("exit",(e=>{0!==e&&m.fail(`worker stopped with exit code ${e}`)}))}onMessage(e){switch(this.log(u.LogLevel.Log,`Background analysis message: ${e.requestType}`),e.requestType){case"analyze":{const t=e.port,n=(0,h.getCancellationTokenFromId)(e.data),s=this.program.getFilesToAnalyzeCount();this._onAnalysisCompletion(t,{diagnostics:[],filesInProgram:this.program.getFileCount(),filesRequiringAnalysis:s,checkingOnlyOpenFiles:this.program.isCheckingOnlyOpenFiles(),fatalErrorOccurred:!1,configParseErrorOccurred:!1,elapsedTime:0}),this._analyzeOneChunk(t,n,e);break}case"resumeAnalysis":{const t=e.port,n=(0,h.getCancellationTokenFromId)(e.data);this._analyzeOneChunk(t,n,e);break}case"getDiagnosticsForRange":(0,c.run)((()=>{const{filePath:t,range:n,cancellationId:s}=e.data,i=(0,h.getCancellationTokenFromId)(s);return(0,p.throwIfCancellationRequested)(i),this.program.getDiagnosticsForRange(t,n)}),e.port);break;case"writeTypeStub":(0,c.run)((()=>{const{targetImportPath:t,targetIsSingleFile:n,stubPath:s,cancellationId:i}=e.data,r=(0,h.getCancellationTokenFromId)(i);(0,o.analyzeProgram)(this.program,void 0,this._configOptions,o.nullCallback,this.getConsole(),r),this.program.writeTypeStub(t,n,s,r)}),e.port);break;case"setImportResolver":this._importResolver=this.createImportResolver(this.fs,this._configOptions,this.createHost()),this.program.setImportResolver(this._importResolver);break;case"setConfigOptions":this._configOptions=(0,c.createConfigOptionsFrom)(e.data),this._importResolver=this.createImportResolver(this.fs,this._configOptions,this._host),this.program.setConfigOptions(this._configOptions),this.program.setImportResolver(this._importResolver);break;case"setTrackedFiles":{const t=this.program.setTrackedFiles(e.data);this._reportDiagnostics(t,this.program.getFilesToAnalyzeCount(),0);break}case"setAllowedThirdPartyImports":this.program.setAllowedThirdPartyImports(e.data);break;case"ensurePartialStubPackages":{const{executionRoot:t}=e.data,n=this._configOptions.getExecutionEnvironments().find((e=>e.root===t));n&&this._importResolver.ensurePartialStubPackages(n);break}case"setFileOpened":{const{filePath:t,version:n,contents:s,options:i}=e.data;this.program.setFileOpened(t,n,s,i);break}case"setFileClosed":{const t=this.program.setFileClosed(e.data);this._reportDiagnostics(t,this.program.getFilesToAnalyzeCount(),0);break}case"markAllFilesDirty":{const{evenIfContentsAreSame:t,indexingNeeded:n}=e.data;this.program.markAllFilesDirty(t,n);break}case"markFilesDirty":{const{filePaths:t,evenIfContentsAreSame:n,indexingNeeded:s}=e.data;this.program.markFilesDirty(t,n,s);break}case"invalidateAndForceReanalysis":this._importResolver.invalidateCache(),this.program.markAllFilesDirty(!0,e.data);break;case"restart":this._importResolver=this.createImportResolver(this.fs,this._configOptions,this._host),this.program.setImportResolver(this._importResolver);break;default:m.fail(`${e.requestType} is not expected`)}}_analyzeOneChunk(e,t,n){(0,o.analyzeProgram)(this.program,{openFilesTimeInMs:50,noOpenFilesTimeInMs:200},this._configOptions,(t=>this._onAnalysisCompletion(e,t)),this.getConsole(),t)?this._analysisPaused(e,n.data):(this.processIndexing(e,t),this.analysisDone(e,n.data))}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,version:e.version,diagnostics:_(e.diagnostics)}))),e}function _(e){return e.map((e=>{const t=new y.Diagnostic(e.category,e.message,e.range);if(e._actions)for(const n of e._actions)t.addAction(n);if(e._rule&&t.setRule(e._rule),e._relatedInfo)for(const n of e._relatedInfo)t.addRelatedInfo(n.message,n.filePath,n.range);return t}))}t.BackgroundAnalysisRunnerBase=f},15179:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getBackgroundWaiter=t.run=t.createConfigOptionsFrom=t.BackgroundThreadBase=void 0;const a=n(71267),o=n(38213),l=n(14943),c=n(11043),p=r(n(20823)),d=n(49085),u=n(37633);t.BackgroundThreadBase=class{constructor(e){(0,o.setCancellationFolderName)(e.cancellationFolderName),global.__rootDirectory=e.rootDirectory,this.fs=new u.PyrightFileSystem((0,d.createFromRealFileSystem)(this.getConsole()))}log(e,t){null===a.parentPort||void 0===a.parentPort||a.parentPort.postMessage({requestType:"log",data:{level:e,message:t}})}getConsole(){return{log:e=>{this.log(c.LogLevel.Log,e)},info:e=>{this.log(c.LogLevel.Info,e)},warn:e=>{this.log(c.LogLevel.Warn,e)},error:e=>{this.log(c.LogLevel.Error,e)},level:c.LogLevel.Log}}},t.createConfigOptionsFrom=function(e){const t=new l.ConfigOptions(e.projectRoot),n=e=>({wildcardRoot:e.wildcardRoot,regExp:new RegExp(e.regExp.source)});return t.pythonPath=e.pythonPath,t.typeshedPath=e.typeshedPath,t.stubPath=e.stubPath,t.autoExcludeVenv=e.autoExcludeVenv,t.verboseOutput=e.verboseOutput,t.checkOnlyOpenFiles=e.checkOnlyOpenFiles,t.useLibraryCodeForTypes=e.useLibraryCodeForTypes,t.internalTestMode=e.internalTestMode,t.indexGenerationMode=e.indexGenerationMode,t.venvPath=e.venvPath,t.venv=e.venv,t.defaultPythonVersion=e.defaultPythonVersion,t.defaultPythonPlatform=e.defaultPythonPlatform,t.defaultExtraPaths=e.defaultExtraPaths,t.diagnosticRuleSet=e.diagnosticRuleSet,t.executionEnvironments=e.executionEnvironments,t.autoImportCompletions=e.autoImportCompletions,t.indexing=e.indexing,t.logTypeEvaluationTime=e.logTypeEvaluationTime,t.typeEvaluationTimeThreshold=e.typeEvaluationTimeThreshold,t.include=e.include.map((e=>n(e))),t.exclude=e.exclude.map((e=>n(e))),t.ignore=e.ignore.map((e=>n(e))),t.strict=e.strict.map((e=>n(e))),t},t.run=function(e,t){try{const n=e();t.postMessage({kind:"ok",data:n})}catch(e){if(o.OperationCanceledException.is(e))return void t.postMessage({kind:"cancelled",data:e.message});t.postMessage({kind:"failed",data:`Exception: ${e.message} in ${e.stack}`})}},t.getBackgroundWaiter=function(e){return new Promise(((t,n)=>{e.on("message",(e=>{switch(e.kind){case"ok":t(e.data);break;case"cancelled":n(new o.OperationCanceledException);break;case"failed":n(e.data);break;default:p.fail(`unknown kind ${e.kind}`)}}))}))}},67284:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CommandController=void 0;const s=n(29335),i=n(62105),r=n(58062),a=n(60675);t.CommandController=class{constructor(e){this._createStub=new i.CreateTypeStubCommand(e),this._restartServer=new a.RestartServerCommand(e),this._quickAction=new r.QuickActionCommand(e)}async execute(e,t){switch(e.command){case"pyright.organizeimports":case"pyright.addoptionalforparam":return this._quickAction.execute(e,t);case"pyright.createtypestub":return this._createStub.execute(e,t);case"pyright.restartserver":return this._restartServer.execute(e);default:return new s.ResponseError(1,"Unsupported command")}}isLongRunningCommand(e){return"pyright.createtypestub"===e}}},9055:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CommandResult=void 0;const s=n(30922);!function(e){e.is=function(e){return e&&e.edits&&s.WorkspaceEdit.is(e.edits)}}(t.CommandResult||(t.CommandResult={}))},62105:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CreateTypeStubCommand=void 0;const s=n(38213),i=n(22060);t.CreateTypeStubCommand=class{constructor(e){this._ls=e}async execute(e,t){if(e.arguments&&e.arguments.length>=2){const n=e.arguments[0],r=e.arguments[1],a=e.arguments[2],o=await i.AnalyzerServiceExecutor.cloneService(this._ls,await this._ls.getWorkspaceForFile(null!=a?a:n),r,this._ls.createBackgroundAnalysis());try{await o.writeTypeStubInBackground(t),o.dispose();const e=`Type stub was successfully created for '${r}'.`;this._ls.window.showInformationMessage(e),this._ls.reanalyze()}catch(e){if(s.OperationCanceledException.is(e)){const e=`Type stub creation for '${r}' 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 '${r}'`+t,this._ls.console.error(t),this._ls.window.showErrorMessage(t)}}}}}},58062:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.QuickActionCommand=void 0;const s=n(34815);t.QuickActionCommand=class{constructor(e){this._ls=e}async execute(e,t){if(e.arguments&&e.arguments.length>=1){const n=e.arguments[0],i=e.arguments.slice(1),r=this._ls.decodeTextDocumentUri(n),a=await this._ls.getWorkspaceForFile(r);if("pyright.organizeimports"===e.command&&a.disableOrganizeImports)return[];const o=a.serviceInstance.performQuickAction(r,e.command,i,t);return(0,s.convertTextEdits)(n,o)}}}},60675:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RestartServerCommand=void 0;t.RestartServerCommand=class{constructor(e){this._ls=e}async execute(e){this._ls.restart()}}},38213:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultCancellationProvider=t.CancelAfter=t.throwIfCancellationRequested=t.OperationCanceledException=t.setCancellationFolderName=t.getCancellationFolderName=void 0;const s=n(20947),i=n(29335),r=n(98173);let a;t.getCancellationFolderName=function(){return a},t.setCancellationFolderName=function(e){a=e};class o extends i.ResponseError{constructor(){super(i.LSPErrorCodes.RequestCancelled,"request cancelled")}static is(e){return e.code===i.LSPErrorCodes.RequestCancelled}}t.OperationCanceledException=o,t.throwIfCancellationRequested=function(e){if(!(0,r.isDebugMode)()&&e.isCancellationRequested)throw new o},t.CancelAfter=function(...e){const t=new s.CancellationTokenSource,n=[];for(const s of e)n.push(s.onCancellationRequested((e=>{t.cancel()})));return n.push(t.token.onCancellationRequested((e=>{n.forEach((e=>e.dispose()))}))),t};t.DefaultCancellationProvider=class{createCancellationTokenSource(){return new s.CancellationTokenSource}}},9133:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getMapValues=t.addIfUnique=t.createMapFromItems=t.removeArrayElements=t.getOrAdd=t.getNestedProperty=t.flatten=t.binarySearchKey=t.binarySearch=t.every=t.some=t.map=t.stableSort=t.cloneAndSort=t.insertAt=t.addRange=t.find=t.appendArray=t.append=t.contains=t.emptyArray=void 0;const s=n(98173);function i(e,t,n=s.equateValues){if(e)for(const s of e)if(n(s,t))return!0;return!1}function r(e,t){return t<0?e.length+t:t}function a(e,t,n,s){if(void 0===t||0===t.length)return e;if(void 0===e)return t.slice(n,s);n=void 0===n?0:r(t,n),s=void 0===s?t.length:r(t,s);for(let i=n;i<s&&i<t.length;i++)void 0!==t[i]&&e.push(t[i]);return e}function o(e,t){return t}function l(e,t){return!!e&&(t?e.some(t):e.length>0)}function c(e,t,n,s,i){if(!l(e))return-1;let r=i||0,a=e.length-1;for(;r<=a;){const i=r+(a-r>>1);switch(s(n(e[i]),t)){case-1:r=i+1;break;case 0:return i;case 1:a=i-1}}return~r}t.emptyArray=[],t.contains=i,t.append=function(e,t){return void 0===t?e:void 0===e?[t]:(e.push(t),e)},t.appendArray=function(e,t){if(t.length<256)e.push(...t);else for(const n of t)e.push(n)},t.find=function(e,t){for(let n=0;n<e.length;n++){const s=e[n];if(t(s,n))return s}},t.addRange=a,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,i)=>n(e[t],e[i])||(0,s.compareValues)(t,i)))}(e,n,t),n.map((t=>e[t]))},t.map=function(e,t){if(e)return e.map(t)},t.some=l,t.every=function(e,t){return!e||e.every(t)},t.binarySearch=function(e,t,n,s,i){return c(e,n(t),n,s,i)},t.binarySearchKey=c,t.flatten=function(e){const t=[];for(const n of e)n&&((0,s.isArray)(n)?a(t,n):t.push(n));return t},t.getNestedProperty=function(e,t){return t.split(".").reduce(((e,t)=>e&&e[t]),e)},t.getOrAdd=function(e,t,n){const s=e.get(t);if(void 0!==s)return s;const i=n();return e.set(t,i),i},t.removeArrayElements=function(e,t){for(let n=0;n<e.length;n++)t(e[n])&&(e.splice(n,1),n--);return e},t.createMapFromItems=function(e,t){return e.map((e=>t(e))).reduce(((t,n,s)=>(t.set(n,(t.get(n)||[]).concat(e[s])),t)),new Map)},t.addIfUnique=function(e,t,n=s.equateValues){return i(e,t,n)||e.push(t),e},t.getMapValues=function(e,t){const n=[];return e.forEach(((e,s)=>{t(s,e)&&n.push(e)})),n}},96795:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CommandLineOptions=t.getDiagnosticSeverityOverrides=void 0,t.getDiagnosticSeverityOverrides=function(){return["error","warning","information","none"]};t.CommandLineOptions=class{constructor(e,t){this.fileSpecs=[],this.logTypeEvaluationTime=!1,this.typeEvaluationTimeThreshold=50,this.enableAmbientAnalysis=!0,this.analyzeUnannotatedFunctions=!0,this.executionRoot=e,this.fromVsCodeExtension=t}}},14943:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ConfigOptions=t.getStrictDiagnosticRuleSet=t.getBasicDiagnosticRuleSet=t.getOffDiagnosticRuleSet=t.getStrictModeNotOverriddenRules=t.getDiagLevelDiagnosticRules=t.getBooleanDiagnosticRules=t.cloneDiagnosticRuleSet=t.ExecutionEnvironment=t.PythonPlatform=void 0;const a=n(71017),o=n(96453),l=r(n(97956)),c=n(9133),p=n(15741),d=n(94647),u=n(57485);!function(e){e.Darwin="Darwin",e.Windows="Windows",e.Linux="Linux"}(t.PythonPlatform||(t.PythonPlatform={}));class m{constructor(e,t,n,s){this.extraPaths=[],this.root=e||void 0,this.pythonVersion=t||u.latestStablePythonVersion,this.pythonPlatform=n,this.extraPaths=[...null!=s?s:[]]}}function y(e=!1){const t=[p.DiagnosticRule.strictListInference,p.DiagnosticRule.strictSetInference,p.DiagnosticRule.strictDictionaryInference,p.DiagnosticRule.strictParameterNoneValue];return e&&t.push(p.DiagnosticRule.enableTypeIgnoreComments),t}function h(){return[p.DiagnosticRule.reportGeneralTypeIssues,p.DiagnosticRule.reportPropertyTypeMismatch,p.DiagnosticRule.reportFunctionMemberAccess,p.DiagnosticRule.reportMissingImports,p.DiagnosticRule.reportMissingModuleSource,p.DiagnosticRule.reportMissingTypeStubs,p.DiagnosticRule.reportImportCycles,p.DiagnosticRule.reportUnusedImport,p.DiagnosticRule.reportUnusedClass,p.DiagnosticRule.reportUnusedFunction,p.DiagnosticRule.reportUnusedVariable,p.DiagnosticRule.reportDuplicateImport,p.DiagnosticRule.reportWildcardImportFromLibrary,p.DiagnosticRule.reportOptionalSubscript,p.DiagnosticRule.reportOptionalMemberAccess,p.DiagnosticRule.reportOptionalCall,p.DiagnosticRule.reportOptionalIterable,p.DiagnosticRule.reportOptionalContextManager,p.DiagnosticRule.reportOptionalOperand,p.DiagnosticRule.reportTypedDictNotRequiredAccess,p.DiagnosticRule.reportUntypedFunctionDecorator,p.DiagnosticRule.reportUntypedClassDecorator,p.DiagnosticRule.reportUntypedBaseClass,p.DiagnosticRule.reportUntypedNamedTuple,p.DiagnosticRule.reportPrivateUsage,p.DiagnosticRule.reportPrivateImportUsage,p.DiagnosticRule.reportConstantRedefinition,p.DiagnosticRule.reportIncompatibleMethodOverride,p.DiagnosticRule.reportIncompatibleVariableOverride,p.DiagnosticRule.reportInconsistentConstructor,p.DiagnosticRule.reportOverlappingOverload,p.DiagnosticRule.reportMissingSuperCall,p.DiagnosticRule.reportUninitializedInstanceVariable,p.DiagnosticRule.reportInvalidStringEscapeSequence,p.DiagnosticRule.reportUnknownParameterType,p.DiagnosticRule.reportUnknownArgumentType,p.DiagnosticRule.reportUnknownLambdaType,p.DiagnosticRule.reportUnknownVariableType,p.DiagnosticRule.reportUnknownMemberType,p.DiagnosticRule.reportMissingParameterType,p.DiagnosticRule.reportMissingTypeArgument,p.DiagnosticRule.reportInvalidTypeVarUse,p.DiagnosticRule.reportCallInDefaultInitializer,p.DiagnosticRule.reportUnnecessaryIsInstance,p.DiagnosticRule.reportUnnecessaryCast,p.DiagnosticRule.reportUnnecessaryComparison,p.DiagnosticRule.reportAssertAlwaysTrue,p.DiagnosticRule.reportSelfClsParameterName,p.DiagnosticRule.reportImplicitStringConcatenation,p.DiagnosticRule.reportUndefinedVariable,p.DiagnosticRule.reportUnboundVariable,p.DiagnosticRule.reportInvalidStubStatement,p.DiagnosticRule.reportIncompleteStub,p.DiagnosticRule.reportUnsupportedDunderAll,p.DiagnosticRule.reportUnusedCallResult,p.DiagnosticRule.reportUnusedCoroutine,p.DiagnosticRule.reportUnusedExpression,p.DiagnosticRule.reportUnnecessaryTypeIgnoreComment,p.DiagnosticRule.reportMatchNotExhaustive]}function g(){return{printUnknownAsAny:!0,omitTypeArgsIfAny:!0,omitUnannotatedParamType:!0,omitConditionalConstraint:!0,pep604Printing:!0,strictListInference:!1,strictSetInference:!1,strictDictionaryInference:!1,strictParameterNoneValue:!0,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"none",reportPropertyTypeMismatch:"none",reportFunctionMemberAccess:"none",reportMissingImports:"warning",reportMissingModuleSource:"warning",reportMissingTypeStubs:"none",reportImportCycles:"none",reportUnusedImport:"none",reportUnusedClass:"none",reportUnusedFunction:"none",reportUnusedVariable:"none",reportDuplicateImport:"none",reportWildcardImportFromLibrary:"none",reportOptionalSubscript:"none",reportOptionalMemberAccess:"none",reportOptionalCall:"none",reportOptionalIterable:"none",reportOptionalContextManager:"none",reportOptionalOperand:"none",reportTypedDictNotRequiredAccess:"none",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportPrivateImportUsage:"none",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportInconsistentConstructor:"none",reportOverlappingOverload:"none",reportMissingSuperCall:"none",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"none",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingParameterType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"none",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportUnnecessaryComparison:"none",reportAssertAlwaysTrue:"none",reportSelfClsParameterName:"none",reportImplicitStringConcatenation:"none",reportUnboundVariable:"none",reportUndefinedVariable:"warning",reportInvalidStubStatement:"none",reportIncompleteStub:"none",reportUnsupportedDunderAll:"none",reportUnusedCallResult:"none",reportUnusedCoroutine:"none",reportUnusedExpression:"none",reportUnnecessaryTypeIgnoreComment:"none",reportMatchNotExhaustive:"none"}}function f(){return{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!0,omitConditionalConstraint:!1,pep604Printing:!0,strictListInference:!1,strictSetInference:!1,strictDictionaryInference:!1,strictParameterNoneValue:!0,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"error",reportPropertyTypeMismatch:"none",reportFunctionMemberAccess:"none",reportMissingImports:"error",reportMissingModuleSource:"warning",reportMissingTypeStubs:"none",reportImportCycles:"none",reportUnusedImport:"none",reportUnusedClass:"none",reportUnusedFunction:"none",reportUnusedVariable:"none",reportDuplicateImport:"none",reportWildcardImportFromLibrary:"warning",reportOptionalSubscript:"error",reportOptionalMemberAccess:"error",reportOptionalCall:"error",reportOptionalIterable:"error",reportOptionalContextManager:"error",reportOptionalOperand:"error",reportTypedDictNotRequiredAccess:"error",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportPrivateImportUsage:"error",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportInconsistentConstructor:"none",reportOverlappingOverload:"none",reportMissingSuperCall:"none",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"warning",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingParameterType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"warning",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportUnnecessaryComparison:"none",reportAssertAlwaysTrue:"warning",reportSelfClsParameterName:"warning",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"none",reportIncompleteStub:"none",reportUnsupportedDunderAll:"warning",reportUnusedCallResult:"none",reportUnusedCoroutine:"error",reportUnusedExpression:"warning",reportUnnecessaryTypeIgnoreComment:"none",reportMatchNotExhaustive:"none"}}function T(){return{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!1,omitConditionalConstraint:!1,pep604Printing:!0,strictListInference:!0,strictSetInference:!0,strictDictionaryInference:!0,strictParameterNoneValue:!0,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"error",reportPropertyTypeMismatch:"none",reportFunctionMemberAccess:"error",reportMissingImports:"error",reportMissingModuleSource:"warning",reportMissingTypeStubs:"error",reportImportCycles:"error",reportUnusedImport:"error",reportUnusedClass:"error",reportUnusedFunction:"error",reportUnusedVariable:"error",reportDuplicateImport:"error",reportWildcardImportFromLibrary:"error",reportOptionalSubscript:"error",reportOptionalMemberAccess:"error",reportOptionalCall:"error",reportOptionalIterable:"error",reportOptionalContextManager:"error",reportOptionalOperand:"error",reportTypedDictNotRequiredAccess:"error",reportUntypedFunctionDecorator:"error",reportUntypedClassDecorator:"error",reportUntypedBaseClass:"error",reportUntypedNamedTuple:"error",reportPrivateUsage:"error",reportPrivateImportUsage:"error",reportConstantRedefinition:"error",reportIncompatibleMethodOverride:"error",reportIncompatibleVariableOverride:"error",reportInconsistentConstructor:"error",reportOverlappingOverload:"error",reportMissingSuperCall:"none",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"error",reportUnknownParameterType:"error",reportUnknownArgumentType:"error",reportUnknownLambdaType:"error",reportUnknownVariableType:"error",reportUnknownMemberType:"error",reportMissingParameterType:"error",reportMissingTypeArgument:"error",reportInvalidTypeVarUse:"error",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"error",reportUnnecessaryCast:"error",reportUnnecessaryComparison:"error",reportAssertAlwaysTrue:"error",reportSelfClsParameterName:"error",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"error",reportIncompleteStub:"error",reportUnsupportedDunderAll:"error",reportUnusedCallResult:"none",reportUnusedCoroutine:"error",reportUnusedExpression:"error",reportUnnecessaryTypeIgnoreComment:"none",reportMatchNotExhaustive:"error"}}t.ExecutionEnvironment=m,t.cloneDiagnosticRuleSet=function(e){return Object.assign({},e)},t.getBooleanDiagnosticRules=y,t.getDiagLevelDiagnosticRules=h,t.getStrictModeNotOverriddenRules=function(){return[p.DiagnosticRule.reportMissingModuleSource]},t.getOffDiagnosticRuleSet=g,t.getBasicDiagnosticRuleSet=f,t.getStrictDiagnosticRuleSet=T;class _{constructor(e,t){this.include=[],this.exclude=[],this.ignore=[],this.strict=[],this.autoImportCompletions=!0,this.indexing=!1,this.logTypeEvaluationTime=!1,this.typeEvaluationTimeThreshold=50,this.initializedFromJson=!1,this.analyzeUnannotatedFunctions=!0,this.executionEnvironments=[],this.projectRoot=e,this.typeCheckingMode=t,this.diagnosticRuleSet=_.getDiagnosticRuleSet(t)}static getDiagnosticRuleSet(e){return"strict"===e?{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!1,omitConditionalConstraint:!1,pep604Printing:!0,strictListInference:!0,strictSetInference:!0,strictDictionaryInference:!0,strictParameterNoneValue:!0,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"error",reportPropertyTypeMismatch:"none",reportFunctionMemberAccess:"error",reportMissingImports:"error",reportMissingModuleSource:"warning",reportMissingTypeStubs:"error",reportImportCycles:"error",reportUnusedImport:"error",reportUnusedClass:"error",reportUnusedFunction:"error",reportUnusedVariable:"error",reportDuplicateImport:"error",reportWildcardImportFromLibrary:"error",reportOptionalSubscript:"error",reportOptionalMemberAccess:"error",reportOptionalCall:"error",reportOptionalIterable:"error",reportOptionalContextManager:"error",reportOptionalOperand:"error",reportTypedDictNotRequiredAccess:"error",reportUntypedFunctionDecorator:"error",reportUntypedClassDecorator:"error",reportUntypedBaseClass:"error",reportUntypedNamedTuple:"error",reportPrivateUsage:"error",reportPrivateImportUsage:"error",reportConstantRedefinition:"error",reportIncompatibleMethodOverride:"error",reportIncompatibleVariableOverride:"error",reportInconsistentConstructor:"error",reportOverlappingOverload:"error",reportMissingSuperCall:"none",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"error",reportUnknownParameterType:"error",reportUnknownArgumentType:"error",reportUnknownLambdaType:"error",reportUnknownVariableType:"error",reportUnknownMemberType:"error",reportMissingParameterType:"error",reportMissingTypeArgument:"error",reportInvalidTypeVarUse:"error",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"error",reportUnnecessaryCast:"error",reportUnnecessaryComparison:"error",reportAssertAlwaysTrue:"error",reportSelfClsParameterName:"error",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"error",reportIncompleteStub:"error",reportUnsupportedDunderAll:"error",reportUnusedCallResult:"none",reportUnusedCoroutine:"error",reportUnusedExpression:"error",reportUnnecessaryTypeIgnoreComment:"none",reportMatchNotExhaustive:"error"}:"off"===e?{printUnknownAsAny:!0,omitTypeArgsIfAny:!0,omitUnannotatedParamType:!0,omitConditionalConstraint:!0,pep604Printing:!0,strictListInference:!1,strictSetInference:!1,strictDictionaryInference:!1,strictParameterNoneValue:!0,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"none",reportPropertyTypeMismatch:"none",reportFunctionMemberAccess:"none",reportMissingImports:"warning",reportMissingModuleSource:"warning",reportMissingTypeStubs:"none",reportImportCycles:"none",reportUnusedImport:"none",reportUnusedClass:"none",reportUnusedFunction:"none",reportUnusedVariable:"none",reportDuplicateImport:"none",reportWildcardImportFromLibrary:"none",reportOptionalSubscript:"none",reportOptionalMemberAccess:"none",reportOptionalCall:"none",reportOptionalIterable:"none",reportOptionalContextManager:"none",reportOptionalOperand:"none",reportTypedDictNotRequiredAccess:"none",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportPrivateImportUsage:"none",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportInconsistentConstructor:"none",reportOverlappingOverload:"none",reportMissingSuperCall:"none",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"none",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingParameterType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"none",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportUnnecessaryComparison:"none",reportAssertAlwaysTrue:"none",reportSelfClsParameterName:"none",reportImplicitStringConcatenation:"none",reportUnboundVariable:"none",reportUndefinedVariable:"warning",reportInvalidStubStatement:"none",reportIncompleteStub:"none",reportUnsupportedDunderAll:"none",reportUnusedCallResult:"none",reportUnusedCoroutine:"none",reportUnusedExpression:"none",reportUnnecessaryTypeIgnoreComment:"none",reportMatchNotExhaustive:"none"}:{printUnknownAsAny:!1,omitTypeArgsIfAny:!1,omitUnannotatedParamType:!0,omitConditionalConstraint:!1,pep604Printing:!0,strictListInference:!1,strictSetInference:!1,strictDictionaryInference:!1,strictParameterNoneValue:!0,enableTypeIgnoreComments:!0,reportGeneralTypeIssues:"error",reportPropertyTypeMismatch:"none",reportFunctionMemberAccess:"none",reportMissingImports:"error",reportMissingModuleSource:"warning",reportMissingTypeStubs:"none",reportImportCycles:"none",reportUnusedImport:"none",reportUnusedClass:"none",reportUnusedFunction:"none",reportUnusedVariable:"none",reportDuplicateImport:"none",reportWildcardImportFromLibrary:"warning",reportOptionalSubscript:"error",reportOptionalMemberAccess:"error",reportOptionalCall:"error",reportOptionalIterable:"error",reportOptionalContextManager:"error",reportOptionalOperand:"error",reportTypedDictNotRequiredAccess:"error",reportUntypedFunctionDecorator:"none",reportUntypedClassDecorator:"none",reportUntypedBaseClass:"none",reportUntypedNamedTuple:"none",reportPrivateUsage:"none",reportPrivateImportUsage:"error",reportConstantRedefinition:"none",reportIncompatibleMethodOverride:"none",reportIncompatibleVariableOverride:"none",reportInconsistentConstructor:"none",reportOverlappingOverload:"none",reportMissingSuperCall:"none",reportUninitializedInstanceVariable:"none",reportInvalidStringEscapeSequence:"warning",reportUnknownParameterType:"none",reportUnknownArgumentType:"none",reportUnknownLambdaType:"none",reportUnknownVariableType:"none",reportUnknownMemberType:"none",reportMissingParameterType:"none",reportMissingTypeArgument:"none",reportInvalidTypeVarUse:"warning",reportCallInDefaultInitializer:"none",reportUnnecessaryIsInstance:"none",reportUnnecessaryCast:"none",reportUnnecessaryComparison:"none",reportAssertAlwaysTrue:"warning",reportSelfClsParameterName:"warning",reportImplicitStringConcatenation:"none",reportUnboundVariable:"error",reportUndefinedVariable:"error",reportInvalidStubStatement:"none",reportIncompleteStub:"none",reportUnsupportedDunderAll:"warning",reportUnusedCallResult:"none",reportUnusedCoroutine:"error",reportUnusedExpression:"warning",reportUnnecessaryTypeIgnoreComment:"none",reportMatchNotExhaustive:"none"}}getDefaultExecEnvironment(){return new m(this.projectRoot,this.defaultPythonVersion,this.defaultPythonPlatform,this.defaultExtraPaths)}findExecEnvironment(e){var t;return null!==(t=this.executionEnvironments.find((t=>{const n=(0,d.ensureTrailingDirectorySeparator)((0,d.normalizePath)((0,d.combinePaths)(this.projectRoot,t.root)));return e.startsWith(n)})))&&void 0!==t?t:this.getDefaultExecEnvironment()}getExecutionEnvironments(){return this.executionEnvironments.length>0?this.executionEnvironments:[this.getDefaultExecEnvironment()]}initializeFromJson(e,t,n,s,i,r,o=!1){if(this.initializedFromJson=!0,!o&&(this.include=[],void 0!==e.include))if(Array.isArray(e.include)){e.include.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "include" array should be a string.`):(0,a.isAbsolute)(e)?n.error(`Ignoring path "${e}" in "include" array because it is not relative.`):this.include.push((0,d.getFileSpec)(s,this.projectRoot,e))}))}else n.error('Config "include" entry must must contain an array.');if(this.exclude=[],void 0!==e.exclude)if(Array.isArray(e.exclude)){e.exclude.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "exclude" array should be a string.`):(0,a.isAbsolute)(e)?n.error(`Ignoring path "${e}" in "exclude" array because it is not relative.`):this.exclude.push((0,d.getFileSpec)(s,this.projectRoot,e))}))}else n.error('Config "exclude" entry must contain an array.');if(this.ignore=[],void 0!==e.ignore)if(Array.isArray(e.ignore)){e.ignore.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "ignore" array should be a string.`):(0,a.isAbsolute)(e)?n.error(`Ignoring path "${e}" in "ignore" array because it is not relative.`):this.ignore.push((0,d.getFileSpec)(s,this.projectRoot,e))}))}else n.error('Config "ignore" entry must contain an array.');if(this.strict=[],void 0!==e.strict)if(Array.isArray(e.strict)){e.strict.forEach(((e,t)=>{"string"!=typeof e?n.error(`Index ${t} of "strict" array should be a string.`):(0,a.isAbsolute)(e)?n.error(`Ignoring path "${e}" in "strict" array because it is not relative.`):this.strict.push((0,d.getFileSpec)(s,this.projectRoot,e))}))}else n.error('Config "strict" entry must contain an array.');let l;void 0!==e.typeCheckingMode&&("off"===e.typeCheckingMode||"basic"===e.typeCheckingMode||"strict"===e.typeCheckingMode?l=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.')),this.typeCheckingMode=l||t;const c=_.getDiagnosticRuleSet(this.typeCheckingMode);if(this.diagnosticRuleSet={...c},this.applyDiagnosticOverrides(r),y(!0).forEach((t=>{this.diagnosticRuleSet[t]=this._convertBoolean(e[t],t,this.diagnosticRuleSet[t])})),h().forEach((t=>{this.diagnosticRuleSet[t]=this._convertDiagnosticLevel(e[t],t,this.diagnosticRuleSet[t])})),this.venvPath=void 0,void 0!==e.venvPath&&("string"!=typeof e.venvPath?n.error('Config "venvPath" field must contain a string.'):this.venvPath=(0,d.normalizePath)((0,d.combinePaths)(this.projectRoot,e.venvPath))),this.venv=void 0,void 0!==e.venv&&("string"!=typeof e.venv?n.error('Config "venv" field must contain a string.'):this.venv=e.venv),void 0!==e.extraPaths)if(this.defaultExtraPaths=[],Array.isArray(e.extraPaths)){e.extraPaths.forEach(((e,t)=>{"string"!=typeof e?n.error(`Config "extraPaths" field ${t} must be a string.`):this.defaultExtraPaths.push((0,d.normalizePath)((0,d.combinePaths)(this.projectRoot,e)))}))}else n.error('Config "extraPaths" field must contain an array.');if(void 0!==e.pythonVersion)if("string"==typeof e.pythonVersion){const t=(0,u.versionFromString)(e.pythonVersion);t?this.defaultPythonVersion=t:n.error('Config "pythonVersion" field contains unsupported version.')}else n.error('Config "pythonVersion" field must contain a string.');if(this.ensureDefaultPythonVersion(i,n),void 0!==e.pythonPlatform&&("string"!=typeof e.pythonPlatform?n.error('Config "pythonPlatform" field must contain a string.'):this.defaultPythonPlatform=e.pythonPlatform),this.ensureDefaultPythonPlatform(i,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?(0,d.normalizePath)((0,d.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=(0,d.normalizePath)((0,d.combinePaths)(this.projectRoot,e.typingsPath)))),void 0!==e.stubPath&&("string"!=typeof e.stubPath?n.error('Config "stubPath" field must contain a string.'):this.stubPath=(0,d.normalizePath)((0,d.combinePaths)(this.projectRoot,e.stubPath))),void 0!==e.verboseOutput&&("boolean"!=typeof e.verboseOutput?n.error('Config "verboseOutput" field must be true or false.'):this.verboseOutput=e.verboseOutput),void 0!==e.useLibraryCodeForTypes&&("boolean"!=typeof e.useLibraryCodeForTypes?n.error('Config "useLibraryCodeForTypes" field must be true or false.'):this.useLibraryCodeForTypes=e.useLibraryCodeForTypes),this.executionEnvironments=[],void 0!==e.executionEnvironments)if(Array.isArray(e.executionEnvironments)){e.executionEnvironments.forEach(((e,t)=>{const s=this._initExecutionEnvironmentFromJson(e,t,n);s&&this.executionEnvironments.push(s)}))}else n.error('Config "executionEnvironments" field must contain an array.');void 0!==e.autoImportCompletions&&("boolean"!=typeof e.autoImportCompletions?n.error('Config "autoImportCompletions" field must be true or false.'):this.autoImportCompletions=e.autoImportCompletions),void 0!==e.indexing&&("boolean"!=typeof e.indexing?n.error('Config "indexing" field must be true or false.'):this.indexing=e.indexing),void 0!==e.logTypeEvaluationTime&&("boolean"!=typeof e.logTypeEvaluationTime?n.error('Config "logTypeEvaluationTime" field must be true or false.'):this.logTypeEvaluationTime=e.logTypeEvaluationTime),void 0!==e.typeEvaluationTimeThreshold&&("number"!=typeof e.typeEvaluationTimeThreshold?n.error('Config "typeEvaluationTimeThreshold" field must be a number.'):this.typeEvaluationTimeThreshold=e.typeEvaluationTimeThreshold)}ensureDefaultPythonPlatform(e,t){void 0===this.defaultPythonPlatform&&(this.defaultPythonPlatform=e.getPythonPlatform(),void 0!==this.defaultPythonPlatform&&t.info(`Assuming Python platform ${this.defaultPythonPlatform}`))}ensureDefaultPythonVersion(e,t){if(void 0!==this.defaultPythonVersion)return;const n=[];this.defaultPythonVersion=e.getPythonVersion(this.pythonPath,n),void 0!==this.defaultPythonVersion&&t.info(`Assuming Python version ${(0,u.versionToString)(this.defaultPythonVersion)}`);for(const e of n)t.info(e)}ensureDefaultExtraPaths(e,t,n){const s=[];if(t){const t=(0,d.resolvePaths)(this.projectRoot,l.src);e.existsSync(t)&&!e.existsSync((0,d.resolvePaths)(t,"__init__.py"))&&s.push(t)}if(n&&n.length>0)for(const t of n){const n=(0,d.resolvePaths)(this.projectRoot,t);s.push(n),(0,d.isDirectory)(e,n)&&(0,c.appendArray)(s,(0,o.getPathsFromPthFiles)(e,n))}s.length>0&&(this.defaultExtraPaths=s)}applyDiagnosticOverrides(e){if(e)for(const t of h()){const n=e[t];void 0!==n&&(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 s=new m(this.projectRoot,this.defaultPythonVersion,this.defaultPythonPlatform,this.defaultExtraPaths);if(e.root&&"string"==typeof e.root?s.root=(0,d.normalizePath)((0,d.combinePaths)(this.projectRoot,e.root)):n.error(`Config executionEnvironments index ${t}: missing root value.`),e.extraPaths)if(Array.isArray(e.extraPaths)){e.extraPaths.forEach(((e,i)=>{"string"!=typeof e?n.error(`Config executionEnvironments index ${t}: extraPaths field ${i} must be a string.`):s.extraPaths.push((0,d.normalizePath)((0,d.combinePaths)(this.projectRoot,e)))}))}else n.error(`Config executionEnvironments index ${t}: extraPaths field must contain an array.`);if(e.pythonVersion)if("string"==typeof e.pythonVersion){const i=(0,u.versionFromString)(e.pythonVersion);i?s.pythonVersion=i: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?s.pythonPlatform=e.pythonPlatform:n.error(`Config executionEnvironments index ${t} pythonPlatform must be a string.`)),s}catch{n.error(`Config executionEnvironments index ${t} is not accessible.`)}}}t.ConfigOptions=_},11043:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.log=t.ConsoleWithLogLevel=t.StderrConsoleWithLevel=t.StderrConsole=t.StandardConsoleWithLevel=t.StandardConsole=t.NullConsole=t.LogLevel=void 0;const a=r(n(20823));var o;!function(e){e.Error="error",e.Warn="warn",e.Info="info",e.Log="log"}(o=t.LogLevel||(t.LogLevel={}));t.NullConsole=class{constructor(){this.logCount=0,this.infoCount=0,this.warnCount=0,this.errorCount=0}log(e){this.logCount++}info(e){this.infoCount++}warn(e){this.warnCount++}error(e){this.errorCount++}};class l{log(e){console.info(e)}info(e){console.info(e)}warn(e){console.warn(e)}error(e){console.error(e)}}t.StandardConsole=l;t.StandardConsoleWithLevel=class extends l{constructor(e=o.Log){super(),this._maxLevel=e}get level(){return this._maxLevel}};class c{log(e){console.error(e)}info(e){console.error(e)}warn(e){console.error(e)}error(e){console.error(e)}}t.StderrConsole=c;t.StderrConsoleWithLevel=class extends c{constructor(e=o.Log){super(),this._maxLevel=e}get level(){return this._maxLevel}};function p(e,t,n){switch(t){case o.Log:e.log(n);break;case o.Info:e.info(n);break;case o.Warn:e.warn(n);break;case o.Error:e.error(n);break;default:a.fail(`${t} is not expected`)}}t.ConsoleWithLogLevel=class{constructor(e,t=""){this._console=e,this._name=t,this._levelMap=new Map([[o.Error,0],[o.Warn,1],[o.Info,2],[o.Log,3]]),this._maxLevel=2}get level(){switch(this._maxLevel){case 0:return o.Error;case 1:return o.Warn;case 2:return o.Info}return o.Log}set level(e){let t=this._levelMap.get(e);void 0===t&&(t=this._levelMap.get(o.Info)),this._maxLevel=t}error(e){this._log(o.Error,`${this._prefix}${e}`)}warn(e){this._log(o.Warn,`${this._prefix}${e}`)}info(e){this._log(o.Info,`${this._prefix}${e}`)}log(e){this._log(o.Log,`${this._prefix}${e}`)}get _prefix(){return this._name?`(${this._name}) `:""}_log(e,t){this._getNumericalLevel(e)>this._maxLevel||p(this._console,e,t)}_getNumericalLevel(e){const t=this._levelMap.get(e);return a.assert(void 0!==t,"Logger: unknown log level."),void 0!==t?t:2}},t.log=p},98173:(e,t)=>{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.isDefined=t.isThenable=t.isDebugMode=t.toBoolean=t.hasProperty=t.isBoolean=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},t.isBoolean=function(e){return"boolean"==typeof e};const s=Object.prototype.hasOwnProperty;t.hasProperty=function(e,t){return s.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)},t.isDefined=function(e){return void 0!==e}},53316:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.randomBytesHex=void 0;const s=n(20823);let i;try{i=n(6113),(null==i?void 0:i.randomBytes)||(i=void 0)}catch{}t.randomBytesHex=function(e){if(i)return i.randomBytes(e).toString("hex");if(crypto){const n=crypto.getRandomValues(new Uint8Array(e));return t=n,[...t].map((e=>e.toString(16).padStart(2,"0"))).join("")}var t;(0,s.fail)("crypto library not found")}},20823:(e,t,n)=>{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 s=n(9133),i=n(98173);function r(e,t){const n=new Error(e?`Debug Failure. ${e}`:"Debug Failure.");throw Error.captureStackTrace&&Error.captureStackTrace(n,t||r),n}function a(e,t,n){null==e&&r(t,n||a)}t.assert=function e(t,n,s,i){t||(s&&(n+="\r\nVerbose Debug Information: "+("string"==typeof s?s:s())),r(n?"False expression: "+n:"False expression.",i||e))},t.fail=r,t.assertDefined=a,t.assertEachDefined=function e(t,n,s){for(const i of t)a(i,n,s||e)},t.assertNever=function e(t,n="Illegal value:",s){r(`${n} ${JSON.stringify(t)}`,s||e)},t.getFunctionName=function(e){if("function"!=typeof e)return"";if((0,i.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 s=e[n];"number"==typeof s&&t.push([s,n])}return(0,s.stableSort)(t,((e,t)=>(0,i.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[s,i]of r){if(s>e)break;0!==s&&s&e&&(t=`${t}${t?"|":""}${i}`,n&=~s)}if(0===n)return t}else for(const[t,n]of r)if(t===e)return n;return e.toString()},t.getErrorString=function(e){return(e.stack?e.stack.toString():void 0)||("string"==typeof e.message?e.message:void 0)||JSON.stringify(e)},t.getSerializableError=function(e){if(!e)return;return JSON.stringify(e).length>2?e:{name:e.name&&(0,i.isString)(e.name)?e.name:"noname",message:e.message&&(0,i.isString)(e.message)?e.message:"nomessage",stack:e.stack&&(0,i.isString)(e.stack)?e.stack:void 0}}},10219:(e,t)=>{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 s(e=null){return new n(e)}t.createDeferred=s,t.createDeferredFrom=function(...e){const t=s();return Promise.all(e).then(t.resolve.bind(t)).catch(t.reject.bind(t)),t},t.createDeferredFromPromise=function(e){const t=s();return e.then(t.resolve.bind(t)).catch(t.reject.bind(t)),t}},24319:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DiagnosticAddendum=t.Diagnostic=t.convertLevelToCategory=void 0;const s=n(9133);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 i{constructor(){this._messages=[],this._childAddenda=[]}addMessage(e){this._messages.push(e)}createAddendum(){const e=new i;return this.addAddendum(e),e}getString(e=5,t=8){let n=this._getLinesRecursive(e,t);n.length>t&&(n=n.slice(0,t),n.push(" ..."));const s=n.join("\n");return s.length>0?"\n"+s:""}isEmpty(){return 0===this._getMessageCount()}addAddendum(e){this._childAddenda.push(e)}getChildren(){return this._childAddenda}getMessages(){return this._messages}_getMessageCount(e=0){if(e>64)return 0;let t=this._messages.length;for(const n of this._childAddenda)t+=n._getMessageCount(e+1);return t}_getLinesRecursive(e,t,n=0){if(e<=0||n>64)return[];let i=[];for(const r of this._childAddenda){const a=this._messages.length>0?e-1:e;if((0,s.appendArray)(i,r._getLinesRecursive(a,t,n+1)),i.length>=t){i=i.slice(0,t);break}}const r=this._messages.length>0?"  ":"";return this._messages.concat(i).map((e=>r+e))}}t.DiagnosticAddendum=i},15741:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DiagnosticRule=void 0,function(e){e.strictListInference="strictListInference",e.strictSetInference="strictSetInference",e.strictDictionaryInference="strictDictionaryInference",e.strictParameterNoneValue="strictParameterNoneValue",e.enableTypeIgnoreComments="enableTypeIgnoreComments",e.reportGeneralTypeIssues="reportGeneralTypeIssues",e.reportPropertyTypeMismatch="reportPropertyTypeMismatch",e.reportFunctionMemberAccess="reportFunctionMemberAccess",e.reportMissingImports="reportMissingImports",e.reportMissingModuleSource="reportMissingModuleSource",e.reportMissingTypeStubs="reportMissingTypeStubs",e.reportImportCycles="reportImportCycles",e.reportUnusedImport="reportUnusedImport",e.reportUnusedClass="reportUnusedClass",e.reportUnusedFunction="reportUnusedFunction",e.reportUnusedVariable="reportUnusedVariable",e.reportDuplicateImport="reportDuplicateImport",e.reportWildcardImportFromLibrary="reportWildcardImportFromLibrary",e.reportOptionalSubscript="reportOptionalSubscript",e.reportOptionalMemberAccess="reportOptionalMemberAccess",e.reportOptionalCall="reportOptionalCall",e.reportOptionalIterable="reportOptionalIterable",e.reportOptionalContextManager="reportOptionalContextManager",e.reportOptionalOperand="reportOptionalOperand",e.reportTypedDictNotRequiredAccess="reportTypedDictNotRequiredAccess",e.reportUntypedFunctionDecorator="reportUntypedFunctionDecorator",e.reportUntypedClassDecorator="reportUntypedClassDecorator",e.reportUntypedBaseClass="reportUntypedBaseClass",e.reportUntypedNamedTuple="reportUntypedNamedTuple",e.reportPrivateUsage="reportPrivateUsage",e.reportPrivateImportUsage="reportPrivateImportUsage",e.reportConstantRedefinition="reportConstantRedefinition",e.reportIncompatibleMethodOverride="reportIncompatibleMethodOverride",e.reportIncompatibleVariableOverride="reportIncompatibleVariableOverride",e.reportInconsistentConstructor="reportInconsistentConstructor",e.reportOverlappingOverload="reportOverlappingOverload",e.reportMissingSuperCall="reportMissingSuperCall",e.reportUninitializedInstanceVariable="reportUninitializedInstanceVariable",e.reportInvalidStringEscapeSequence="reportInvalidStringEscapeSequence",e.reportUnknownParameterType="reportUnknownParameterType",e.reportUnknownArgumentType="reportUnknownArgumentType",e.reportUnknownLambdaType="reportUnknownLambdaType",e.reportUnknownVariableType="reportUnknownVariableType",e.reportUnknownMemberType="reportUnknownMemberType",e.reportMissingParameterType="reportMissingParameterType",e.reportMissingTypeArgument="reportMissingTypeArgument",e.reportInvalidTypeVarUse="reportInvalidTypeVarUse",e.reportCallInDefaultInitializer="reportCallInDefaultInitializer",e.reportUnnecessaryIsInstance="reportUnnecessaryIsInstance",e.reportUnnecessaryCast="reportUnnecessaryCast",e.reportUnnecessaryComparison="reportUnnecessaryComparison",e.reportAssertAlwaysTrue="reportAssertAlwaysTrue",e.reportSelfClsParameterName="reportSelfClsParameterName",e.reportImplicitStringConcatenation="reportImplicitStringConcatenation",e.reportUndefinedVariable="reportUndefinedVariable",e.reportUnboundVariable="reportUnboundVariable",e.reportInvalidStubStatement="reportInvalidStubStatement",e.reportIncompleteStub="reportIncompleteStub",e.reportUnsupportedDunderAll="reportUnsupportedDunderAll",e.reportUnusedCallResult="reportUnusedCallResult",e.reportUnusedCoroutine="reportUnusedCoroutine",e.reportUnusedExpression="reportUnusedExpression",e.reportUnnecessaryTypeIgnoreComment="reportUnnecessaryTypeIgnoreComment",e.reportMatchNotExhaustive="reportMatchNotExhaustive"}(t.DiagnosticRule||(t.DiagnosticRule={}))},85036:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextRangeDiagnosticSink=t.DiagnosticSink=void 0;const s=n(9133),i=n(24319),r=n(28348),a=n(14551);class o{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)}addDeprecated(e,t,n){const s=new i.Diagnostic(4,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}:${(0,a.hashString)(e.message)}}`;return this._diagnosticMap.has(t)||(this._diagnosticList.push(e),this._diagnosticMap.set(t,e)),e}addDiagnostics(e){(0,s.appendArray)(this._diagnosticList,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))}getDeprecated(){return this._diagnosticList.filter((e=>4===e.category))}}t.DiagnosticSink=o;t.TextRangeDiagnosticSink=class extends o{constructor(e,t){super(t),this._lines=e}addDiagnosticWithTextRange(e,t,n){const s=(0,r.convertOffsetsToRange)(n.start,n.start+n.length,this._lines);switch(e){case"error":return this.addError(t,s);case"warning":return this.addWarning(t,s);case"information":return this.addInformation(t,s);default:throw new Error(`${e} is not expected value`)}}addUnusedCodeWithTextRange(e,t,n){return this.addUnusedCode(e,(0,r.convertOffsetsToRange)(t.start,t.start+t.length,this._lines),n)}addDeprecatedWithTextRange(e,t,n){return this.addDeprecated(e,(0,r.convertOffsetsToRange)(t.start,t.start+t.length,this._lines),n)}}},53117:()=>{Promise.prototype.ignoreErrors=function(){this.catch((()=>{}))}},68384:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.FileBasedCancellationProvider=t.getCancellationTokenId=t.getCancellationTokenFromId=t.disposeCancellationToken=t.getCancellationStrategyFromArgv=void 0;const a=r(n(57147)),o=r(n(22037)),l=r(n(71017)),c=n(20947),p=n(29335),d=n(38213);class u{static shouldCheck(){const e=Date.now().valueOf();return e-this._lastCheckTimestamp>=5&&(this._lastCheckTimestamp=e,!0)}}u._lastCheckTimestamp=0;class m{constructor(e){this.cancellationFilePath=e,this.isCancelled=!1}cancel(){this.isCancelled||(this.isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this._disposeEmitter()))}get isCancellationRequested(){return!!this.isCancelled||(u.shouldCheck()&&this._pipeExists()&&this.cancel(),this.isCancelled)}get onCancellationRequested(){return this._emitter||(this._emitter=new p.Emitter),this._emitter.event}dispose(){this._disposeEmitter()}_disposeEmitter(){this._emitter&&(this._emitter.dispose(),this._emitter=void 0)}_pipeExists(){try{return a.statSync(this.cancellationFilePath),!0}catch(e){return!1}}}class y extends m{constructor(e){super(e),this._disposed=!1}cancel(){this._disposed||this.isCancelled||(this._createPipe(),super.cancel())}get isCancellationRequested(){return this.isCancelled}dispose(){this._disposed=!0,super.dispose(),this._removePipe()}_createPipe(){try{a.writeFileSync(this.cancellationFilePath,"",{flag:"w"})}catch{}}_removePipe(){try{a.unlinkSync(this.cancellationFilePath)}catch{}}}class h{constructor(e,t=!1){this._cancellationFilePath=e,this._ownFile=t}get token(){return this._token||(this._token=this._ownFile?new y(this._cancellationFilePath):new m(this._cancellationFilePath)),this._token}cancel(){this._token?this._token.cancel():this._token=p.CancellationToken.Cancelled}dispose(){this._token?this._token instanceof m&&this._token.dispose():this._token=p.CancellationToken.None}}function g(e,t){return l.join(function(e){return l.join(o.tmpdir(),"python-languageserver-cancellation",e)}(e),`cancellation-${String(t)}.tmp`)}class f{constructor(e){this.folderName=e}createCancellationTokenSource(e){return new h(g(this.folderName,e))}}t.getCancellationStrategyFromArgv=function(e){let t;for(let s=0;s<e.length;s++){const i=e[s];if("--cancellationReceive"===i)t=n(e[s+1]);else{const e=i.split("=");"--cancellationReceive"===e[0]&&(t=n(e[1]))}}return t&&!(0,d.getCancellationFolderName)()&&(0,d.setCancellationFolderName)(t.folderName),t=t||p.CancellationReceiverStrategy.Message,{receiver:t,sender:p.CancellationSenderStrategy.Message};function n(e){const t=function(e){const t=/^file:(.+)$/,n=e.match(t);return n?n[1]:void 0}(e);return t?new f(t):void 0}},t.disposeCancellationToken=function(e){e instanceof m&&e.dispose()},t.getCancellationTokenFromId=function(e){return e?new m(e):p.CancellationToken.None},t.getCancellationTokenId=function(e){return e instanceof m?e.cancellationFilePath:void 0};let T=0;t.FileBasedCancellationProvider=class{constructor(e){this._prefix=e}createCancellationTokenSource(){const e=(0,d.getCancellationFolderName)();return e?new h(g(e,`${this._prefix}-${String(T++)}`),!0):new c.CancellationTokenSource}}},6021:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VirtualDirent=t.nullFileWatcherProvider=t.ignoredWatchEventFunction=void 0,t.ignoredWatchEventFunction=function(e){const t=e.map((e=>e.toLowerCase()));return e=>{if(!e||e.indexOf("__pycache__")>=0)return!0;const n=e.toLowerCase();return t.every((e=>n.indexOf(e)<0))}};const n={close(){}};t.nullFileWatcherProvider={createFileWatcher:(e,t)=>n,onFileChange(e,t){}};t.VirtualDirent=class{constructor(e,t){this.name=e,this._file=t}isFile(){return this._file}isDirectory(){return!this._file}isBlockDevice(){return!1}isCharacterDevice(){return!1}isSymbolicLink(){return!1}isFIFO(){return!1}isSocket(){return!1}}},31343:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.FullAccessHost=t.LimitedAccessHost=void 0;const a=r(n(32081)),o=n(14943),l=n(20823),c=n(60964),p=n(94647),d=n(57485),u=["import os, os.path, sys","normalize = lambda p: os.path.normcase(os.path.normpath(p))","cwd = normalize(os.getcwd())",'orig_sys_path = [p for p in sys.path if p != ""]','sys.path[:] = [p for p in sys.path if p != "" and normalize(p) != cwd]'],m=[...u,"import sys, json","json.dump(dict(path=orig_sys_path, prefix=sys.prefix), sys.stdout)"].join("; "),y=[...u,"import sys, json","json.dump(dict(major=sys.version_info[0], minor=sys.version_info[1]), sys.stdout)"].join("; ");class h extends c.NoAccessHost{get kind(){return 1}getPythonPlatform(e){return"darwin"===process.platform?o.PythonPlatform.Darwin:"linux"===process.platform?o.PythonPlatform.Linux:"win32"===process.platform?o.PythonPlatform.Windows:void 0}}t.LimitedAccessHost=h;class g extends h{constructor(e){super(),this._fs=e}static createHost(e,t){switch(e){case 2:return new c.NoAccessHost;case 1:return new h;case 0:return new g(t);default:(0,l.assertNever)(e)}}get kind(){return 0}getPythonSearchPaths(e,t){const n=null!=t?t:[];let s=this._executePythonInterpreter(e,(e=>this._getSearchPathResultFromInterpreter(this._fs,e,n)));return s||(s={paths:[],prefix:""}),n.push(`Received ${s.paths.length} paths from interpreter`),s.paths.forEach((e=>{n.push(` ${e}`)})),s}getPythonVersion(e,t){const n=null!=t?t:[];try{const t=["-c",y],s=this._executePythonInterpreter(e,(e=>a.execFileSync(e,t,{encoding:"utf8"}))),i=JSON.parse(s),r=(0,d.versionFromMajorMinor)(i.major,i.minor);return void 0===r?void n.push(`Python version ${i.major}.${i.minor} from interpreter is unsupported`):r}catch{return void n.push("Unable to get Python version from interpreter")}}_executePythonInterpreter(e,t){if(e)return t(e);{let e;try{"win32"!==process.platform&&(e=t("python3"))}catch{}return void 0!==e?e:t("python")}}_getSearchPathResultFromInterpreter(e,t,n){const s={paths:[],prefix:""};try{const i=["-c",m];n.push(`Executing interpreter: '${t}'`);const r=a.execFileSync(t,i,{encoding:"utf8"});try{const t=JSON.parse(r);for(let i of t.path)if(i=i.trim(),i){const t=(0,p.normalizePath)(i);e.existsSync(t)&&(0,p.isDirectory)(e,t)?s.paths.push(t):n.push(`Skipping '${t}' because it is not a valid directory`)}s.prefix=t.prefix,0===s.paths.length&&n.push("Found no valid directories")}catch(e){throw n.push(`Could not parse output: '${r}'`),e}}catch{return}return s}}t.FullAccessHost=g},60964:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NoAccessHost=void 0;t.NoAccessHost=class{get kind(){return 2}getPythonSearchPaths(e,t){return null==t||t.push("No access to python executable."),{paths:[],prefix:""}}getPythonVersion(e,t){}getPythonPlatform(e){}}},77134:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LogTracker=void 0;const s=n(11043),i=n(76962);t.LogTracker=class{constructor(e,t){this._console=e,this._prefix=t,this._dummyState=new r,this._indentation="",this._previousTitles=[]}log(e,t,n=-1,i=!1){if(void 0===this._console)return t(this._dummyState);const a=this._console.level;if(void 0===a||a!==s.LogLevel.Log&&a!==s.LogLevel.Info)return t(this._dummyState);const o=this._indentation;this._previousTitles.push(`${o}${e} ...`),this._indentation+=" ";const l=new r;try{return t(l)}finally{const t=l.duration;if(this._indentation=o,this._previousTitles.length>0&&(l.isSuppressed()||t<=n))this._previousTitles.pop();else{this._printPreviousTitles();let n=`[${this._prefix}] ${this._indentation}${e}${l.get()} (${t}ms)`;i&&l.fileReadTotal+l.tokenizeTotal+l.parsingTotal+l.resolveImportsTotal+l.bindingTotal>0&&(n+=` [f:${l.fileReadTotal}, t:${l.tokenizeTotal}, p:${l.parsingTotal}, i:${l.resolveImportsTotal}, b:${l.bindingTotal}]`),this._console.log(n),t>=2e3&&this._console.info(`[${this._prefix}] Long operation: ${e} (${t}ms)`)}}}_printPreviousTitles(){if(this._previousTitles.pop(),!(this._previousTitles.length<=0)){for(const e of this._previousTitles)this._console.log(`[${this._prefix}] ${e}`);this._previousTitles.length=0}}};class r{constructor(){this._start=new i.Duration,this._startFile=i.timingStats.readFileTime.totalTime,this._startToken=i.timingStats.tokenizeFileTime.totalTime,this._startParse=i.timingStats.parseFileTime.totalTime,this._startImport=i.timingStats.resolveImportsTime.totalTime,this._startBind=i.timingStats.bindTime.totalTime}get duration(){return this._start.getDurationInMilliseconds()}get fileReadTotal(){return i.timingStats.readFileTime.totalTime-this._startFile}get tokenizeTotal(){return i.timingStats.tokenizeFileTime.totalTime-this._startToken}get parsingTotal(){return i.timingStats.parseFileTime.totalTime-this._startParse}get resolveImportsTotal(){return i.timingStats.resolveImportsTime.totalTime-this._startImport}get bindingTotal(){return i.timingStats.bindTime.totalTime-this._startBind}add(e){e&&(this._addendum=e)}get(){return this._addendum?` [${this._addendum}]`:""}suppress(){this._suppress=!0}isSuppressed(){return!!this._suppress}}},13727:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fromLSPAny=t.toLSPAny=void 0,t.toLSPAny=function(e){return e},t.fromLSPAny=function(e){return e}},97956:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.stubsSuffix=t.src=t.distPackages=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.distPackages="dist-packages",t.src="src",t.stubsSuffix="-stubs"},94647:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.isFileSystemCaseSensitiveInternal=t.isFileSystemCaseSensitive=t.normalizePathCase=t.convertPathToUri=t.extractPathFromUri=t.convertUriToPath=t.isDiskPathRoot=t.isRootedDiskPath=t.getRegexEscapedSeparator=t.getFileSpec=t.hasPythonExtension=t.getWildcardRoot=t.getWildcardRegexPattern=t.getFileSystemEntriesFromDirEntries=t.getFileSystemEntries=t.tryRealpath=t.tryStat=t.isFile=t.isDirectory=t.normalizePath=t.stripFileExtension=t.getFileName=t.getFileExtension=t.stripTrailingDirectorySeparator=t.hasTrailingDirectorySeparator=t.ensureTrailingDirectorySeparator=t.comparePathsCaseInsensitive=t.comparePathsCaseSensitive=t.getRelativePathComponentsFromDirectory=t.getRelativePathFromDirectory=t.getBaseFileName=t.getAnyExtensionFromPath=t.changeAnyExtension=t.containsPath=t.comparePaths=t.combinePaths=t.resolvePaths=t.normalizeSlashes=t.directoryExists=t.fileExists=t.getFileSize=t.makeDirectories=t.getRelativePath=t.combinePathComponents=t.reducePathComponents=t.getPathComponents=t.getRootLength=t.getDirectoryPath=t.forEachAncestorDirectory=t.FileSpec=void 0,t.getDirectoryChangeKind=t.getLibraryPathWithoutExtension=void 0;const a=r(n(71017)),o=n(15585),l=n(9133),c=n(98173),p=n(53316),d=r(n(20823)),u=n(14551);let m;function y(e){return e.substr(0,Math.max(h(e),e.lastIndexOf(a.sep)))}function h(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=_(e),n=h(t),s=t.substring(0,n),i=t.substring(n).split(a.sep);return i.length>0&&!i[i.length-1]&&i.pop(),f([s,...i])}function f(e){if(!(0,l.some)(e))return[];const t=[e[0]];for(let n=1;n<e.length;n++){const s=e[n];if(s&&"."!==s){if(".."===s)if(t.length>1){if(".."!==t[t.length-1]){t.pop();continue}}else if(t[0])continue;t.push(s)}}return t}function T(e){if(0===e.length)return"";return _((e[0]&&S(e[0]))+e.slice(1).join(a.sep))}!function(e){e.is=function(e){const t=e;return t&&!!t.wildcardRoot&&!!t.regExp}}(t.FileSpec||(t.FileSpec={})),t.forEachAncestorDirectory=function(e,t){for(;;){const n=t(e);if(void 0!==n)return n;const s=y(e);if(s===e)return;e=s}},t.getDirectoryPath=y,t.getRootLength=h,t.getPathComponents=g,t.reducePathComponents=f,t.combinePathComponents=T,t.getRelativePath=function(e,t){if(!e.startsWith(S(t)))return;const n=g(e);let s=".";for(let e=g(t).length;e<n.length;e++)s+=a.sep+n[e];return s},t.makeDirectories=function(e,t,n){if(!t.startsWith(n))return;const s=g(t);let i=n;for(let t=g(n).length;t<s.length;t++)i=v(i,s[t]),e.existsSync(i)||e.mkdirSync(i)},t.getFileSize=function(e,t){const n=k(e,t);return(null==n?void 0:n.isFile())?n.size:0},t.fileExists=function(e,t){return U(e,t,0)},t.directoryExists=function(e,t){return U(e,t,1)};function _(e,t=a.sep){if(e.includes((e=>"/"===e?"\\":"/")(t))){const n=/[\\/]/g;return e.replace(n,t)}return e}function v(e,...t){e&&(e=_(e));for(let n of t)n&&(n=_(n),e=e&&0===h(n)?S(e)+n:n);return e}function b(e,t,n){if(t)return function(e,t,n){if("string"==typeof t)return V(e,t,n)||"";for(const s of t){const t=V(e,s,n);if(t)return t}return""}(x(e),t,n?u.equateStringsCaseInsensitive:u.equateStringsCaseSensitive);const s=I(e),i=s.lastIndexOf(".");return i>=0?s.substring(i):""}function I(e,t,n){if(h(e=_(e))===e.length)return"";const s=(e=x(e)).slice(Math.max(h(e),e.lastIndexOf(a.sep)+1)),i=void 0!==t&&void 0!==n?b(s,t,n):void 0;return i?s.slice(0,s.length-i.length):s}function C(e,t,n){d.assert(h(e)>0==h(t)>0,"Paths must either both be absolute or both be relative");const s="function"==typeof n?n:c.identity,i=function(e,t,n,s){const i=g(e),r=g(t);let a;for(a=0;a<i.length&&a<r.length;a++){const e=s(i[a]),t=s(r[a]);if(!(0===a?u.equateStringsCaseInsensitive:n)(e,t))break}if(0===a)return r;const o=r.slice(a),l=[];for(;a<i.length;a++)l.push("..");return["",...l,...o]}(e,t,"boolean"==typeof n&&n?u.equateStringsCaseInsensitive:u.equateStringsCaseSensitive,s);return i}function S(e){return F(e)?e:e+a.sep}function F(e){if(0===e.length)return!1;const t=e.charCodeAt(e.length-1);return 47===t||92===t}function x(e){return F(e)?e.substr(0,e.length-1):e}function D(e,t=!1){if(!t)return a.extname(e);const n=(e=P(e)).indexOf(".");return e.substr(n)}function P(e){return a.basename(e)}function A(e,t=!1){const n=D(e,t);return e.substr(0,e.length-n.length)}function E(e){return _(a.normalize(e))}function k(e,t){try{return e.statSync(t)}catch(e){return}}function w(e,t,n){const s=e.sort(((e,t)=>e.name<t.name?-1:e.name>t.name?1:0)),i=[],r=[];for(const e of s)if("."!==e.name&&".."!==e.name)if(e.isFile())i.push(e.name);else if(e.isDirectory())r.push(e.name);else if(e.isSymbolicLink()){const s=k(t,v(n,e.name));(null==s?void 0:s.isFile())?i.push(e.name):(null==s?void 0:s.isDirectory())&&r.push(e.name)}return{files:i,directories:r}}function N(e,t){let n=E(v(e,t));R(n)||(n=S(n));const s=g(n),i=O(),r=`(${i}[^${i}.][^${i}]*)*?`,a=new RegExp(`[^\\w\\s${i}]`,"g");s.length>0&&(s[0]=x(s[0]));let o="",l=!0;for(let e of s)"**"===e?o+=r:(l||(e=i+e),o+=e.replace(a,(e=>"*"===e?`[^${i}]*`:"?"===e?`[^${i}]`:"\\"+e)),l=!1);return o}function M(e,t){let n=E(v(e,t));R(n)||(n=S(n));const s=g(n);if(s.length>0&&(s[0]=x(s[0])),1===s.length&&!s[0])return a.sep;let i="",r=!0;for(let e of s){if("**"===e)break;if(e.match(/[*?]/))break;r||(e=a.sep+e),i+=e,r=!1}return i}function R(e){return e.endsWith(".py")||e.endsWith(".pyi")}function O(){return"/"===a.sep?"/":"\\\\"}function L(e,t,n){if(e===t)return 0;if(void 0===e)return-1;if(void 0===t)return 1;const s=e.substring(0,h(e)),i=t.substring(0,h(t)),r=(0,u.compareStringsCaseInsensitive)(s,i);if(0!==r)return r;const a=O(),o=new RegExp(`(^|${a}).{0,2}($|${a})`),l=e.substring(s.length),p=t.substring(i.length);if(!o.test(l)&&!o.test(p))return n(l,p);const d=g(e),m=g(t),y=Math.min(d.length,m.length);for(let e=1;e<y;e++){const t=n(d[e],m[e]);if(0!==t)return t}return(0,c.compareValues)(d.length,m.length)}function V(e,t,n){if(t.startsWith(".")||(t="."+t),e.length>=t.length&&46===e.charCodeAt(e.length-t.length)){const s=e.slice(e.length-t.length);if(n(s,t))return s}}function U(e,t,n){try{const s=e.statSync(t);switch(n){case 0:return s.isFile();case 1:return s.isDirectory();default:return!1}}catch(e){return!1}}function z(e){let t=E(o.URI.parse(e).path);return t.match(/^\\[a-zA-Z]:\\/)&&(t=t.substr(1)),t}function B(e){return void 0!==m||(m=W(e)),m}function W(e){let t;try{let n,s;do{n=`${(0,p.randomBytesHex)(21)}-a`,t=a.join(e.tmpdir(),n),s=a.join(e.tmpdir(),n.toUpperCase())}while(e.existsSync(t)||e.existsSync(s));return e.writeFileSync(t,"","utf8"),!e.existsSync(s)}catch(e){return!1}finally{t&&e.unlinkSync(t)}}t.normalizeSlashes=_,t.resolvePaths=function(e,...t){return E((0,l.some)(t)?v(e,...t):_(e))},t.combinePaths=v,t.comparePaths=function(e,t,n,s){return e=E(e),t=E(t),"string"==typeof n?(e=v(n,e),t=v(n,t)):"boolean"==typeof n&&(s=n),L(e,t,(0,u.getStringComparer)(s))},t.containsPath=function(e,t,n,s){if("string"==typeof n?(e=v(n,e),t=v(n,t)):"boolean"==typeof n&&(s=n),void 0===e||void 0===t)return!1;if(e===t)return!0;const i=g(e),r=g(t);if(r.length<i.length)return!1;const a=s?u.equateStringsCaseInsensitive:u.equateStringsCaseSensitive;for(let e=0;e<i.length;e++){if(!(0===e?u.equateStringsCaseInsensitive:a)(i[e],r[e]))return!1}return!0},t.changeAnyExtension=function(e,t,n,s){const i=void 0!==n&&void 0!==s?b(e,n,s):b(e);return i?e.slice(0,e.length-i.length)+(t.startsWith(".")?t:"."+t):e},t.getAnyExtensionFromPath=b,t.getBaseFileName=I,t.getRelativePathFromDirectory=function(e,t,n){return T(C(e,t,n))},t.getRelativePathComponentsFromDirectory=C,t.comparePathsCaseSensitive=function(e,t){return L(e,t,u.compareStringsCaseSensitive)},t.comparePathsCaseInsensitive=function(e,t){return L(e,t,u.compareStringsCaseInsensitive)},t.ensureTrailingDirectorySeparator=S,t.hasTrailingDirectorySeparator=F,t.stripTrailingDirectorySeparator=x,t.getFileExtension=D,t.getFileName=P,t.stripFileExtension=A,t.normalizePath=E,t.isDirectory=function(e,t){var n,s;return null!==(s=null===(n=k(e,t))||void 0===n?void 0:n.isDirectory())&&void 0!==s&&s},t.isFile=function(e,t){var n,s;return null!==(s=null===(n=k(e,t))||void 0===n?void 0:n.isFile())&&void 0!==s&&s},t.tryStat=k,t.tryRealpath=function(e,t){try{return e.realpathSync(t)}catch(e){return}},t.getFileSystemEntries=function(e,t){try{return w(e.readdirEntriesSync(t||"."),e,t)}catch(e){return{files:[],directories:[]}}},t.getFileSystemEntriesFromDirEntries=w,t.getWildcardRegexPattern=N,t.getWildcardRoot=M,t.hasPythonExtension=R,t.getFileSpec=function(e,t,n){let s=N(t,n);s=`^(${s})($|${O()})`;const i=new RegExp(s,B(e)?void 0:"i");return{wildcardRoot:M(t,n),regExp:i}},t.getRegexEscapedSeparator=O,t.isRootedDiskPath=function(e){return h(e)>0},t.isDiskPathRoot=function(e){const t=h(e);return t>0&&t===e.length},t.convertUriToPath=function(e,t){return e.getMappedFilePath(z(t))},t.extractPathFromUri=z,t.convertPathToUri=function(e,t){return e.getUri(e.getOriginalFilePath(t))},t.normalizePathCase=function(e,t){return B(e)?t:t.toLowerCase()},t.isFileSystemCaseSensitive=B,t.isFileSystemCaseSensitiveInternal=W,t.getLibraryPathWithoutExtension=function(e){let t=A(e);return t.endsWith("__init__")&&(t=t.substr(0,t.length-9)),t},t.getDirectoryChangeKind=function(e,t,n){if(e.realCasePath(t)===e.realCasePath(n))return"Same";const s=C(t,n,(t=>e.realCasePath(t)));return 3===s.length&&".."===s[1]&&".."!==s[2]?"Renamed":"Moved"}},28348:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertTextRangeToRange=t.convertRangeToTextRange=t.convertPositionToOffset=t.convertOffsetsToRange=t.convertOffsetToPosition=void 0;const s=n(20823),i=n(80957);function r(e,t){if(0===t.end)return{line:0,character:0};let n=0;e>=t.end&&(e=t.end-1,n=1);const i=t.getItemContaining(e);(0,s.assert)(i>=0&&i<=t.length);const r=t.getItemAt(i);return(0,s.assert)(void 0!==r),{line:i,character:e-r.start+n}}function a(e,t,n){return{start:r(e,n),end:r(t,n)}}function o(e,t){if(!(e.line>=t.count))return t.getItemAt(e.line).start+e.character}t.convertOffsetToPosition=r,t.convertOffsetsToRange=a,t.convertPositionToOffset=o,t.convertRangeToTextRange=function(e,t){const n=o(e.start,t);if(void 0===n)return;const s=o(e.end,t);return void 0!==s?i.TextRange.fromBounds(n,s):void 0},t.convertTextRangeToRange=function(e,t){return a(e.start,i.TextRange.getEnd(e),t)}},76913:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ProgressReportTracker=void 0;t.ProgressReportTracker=class{constructor(e){this._reporter=e,this._isDisplayingProgress=!1}isEnabled(e){var t;return!!this._isDisplayingProgress||null!==(t=this._reporter.isEnabled(e))&&void 0!==t&&t}begin(){this._isDisplayingProgress||(this._isDisplayingProgress=!0,this._reporter.begin())}report(e){this._isDisplayingProgress&&this._reporter.report(e)}end(){this._isDisplayingProgress&&(this._isDisplayingProgress=!1,this._reporter.end())}}},57485:(e,t)=>{var n;function s(e,t){if(isNaN(e)||isNaN(t))return;if(e>255||t>255)return;const s=256*e+t;return void 0!==n[s]&&i(s)?s:void 0}function i(e){return e>>8==3}Object.defineProperty(t,"__esModule",{value:!0}),t.is3x=t.versionFromMajorMinor=t.versionFromString=t.versionToString=t.latestStablePythonVersion=t.PythonVersion=void 0,function(e){e[e.V3_0=768]="V3_0",e[e.V3_1=769]="V3_1",e[e.V3_2=770]="V3_2",e[e.V3_3=771]="V3_3",e[e.V3_4=772]="V3_4",e[e.V3_5=773]="V3_5",e[e.V3_6=774]="V3_6",e[e.V3_7=775]="V3_7",e[e.V3_8=776]="V3_8",e[e.V3_9=777]="V3_9",e[e.V3_10=778]="V3_10",e[e.V3_11=779]="V3_11"}(n=t.PythonVersion||(t.PythonVersion={})),t.latestStablePythonVersion=n.V3_10,t.versionToString=function(e){return`${e>>8&255}.${255&e}`},t.versionFromString=function(e){const t=e.split(".");if(t.length<2)return;return s(parseInt(t[0],10),parseInt(t[1],10))},t.versionFromMajorMinor=s,t.is3x=i},49085:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.WorkspaceFileWatcherProvider=t.createFromRealFileSystem=void 0;const a=n(59480),o=n(41811),l=r(n(57147)),c=r(n(88554)),p=n(15585),d=n(11043),u=n(6021),m=n(94647);c.setGracefulCleanup(),t.createFromRealFileSystem=function(e,t){return e=null!=e?e:new d.NullConsole,new C(null!=t?t:u.nullFileWatcherProvider,e)};const y=".zip",h=".egg";function g(e){let t=e.indexOf(y);if(t<=0&&(t=e.indexOf(h),t<=0))return null;if(e[t-1]===a.ppath.sep)return null;const n=t+y.length;return e.length>n&&e[n]!==a.ppath.sep?null:e.slice(0,n)}function f(e){return e.endsWith(y)||e.endsWith(h)}const T=[Buffer.from([80,75,3,4]),Buffer.from([80,75,5,6]),Buffer.from([80,75,7,8])];function _(e,t){let n;try{n=e.openSync(t,"r");const s=Buffer.alloc(4);if(e.readSync(n,s,0,4,0)<4)return!1;for(const e of T)if(0===s.compare(e))return!0;return!1}catch{return!1}finally{void 0!==n&&e.closeSync(n)}}class v extends a.ZipOpenFS{getZipSync(e,t){return super.getZipSync(e,t)}findZip(e){if(this.filter&&!this.filter.test(e))return null;let t="";for(;;){const n=g(e.substr(t.length));if(!n)return null;if(t=this.pathUtils.join(t,n),!1===this.isZip.has(t)){if(this.notZip.has(t))continue;try{if(!this.baseFs.lstatSync(t).isFile()){this.notZip.add(t);continue}if(!_(this.baseFs,t)){this.notZip.add(t);continue}try{this.getZipSync(t,(()=>{}))}catch{this.notZip.add(t);continue}}catch{return null}this.isZip.add(t)}return{archivePath:t,subPath:this.pathUtils.join(a.PortablePath.root,e.substr(t.length))}}}}class b extends a.PosixFS{constructor(){const e=new v({libzip:()=>(0,o.getLibzipSync)(),useCache:!0,maxOpenFiles:80,readOnlyArchives:!0});super(new a.VirtualFS({baseFs:e})),this._eggZipOpenFS=e}isZip(e){return!!this._eggZipOpenFS.findZip(this.mapToBase(e))}}const I=new b;class C{constructor(e,t){this._fileWatcherProvider=e,this._console=t}existsSync(e){try{return I.existsSync(e)}catch{return!1}}mkdirSync(e,t){I.mkdirSync(e,t)}chdir(e){process.chdir(e)}readdirSync(e){return I.readdirSync(e)}readdirEntriesSync(e){return I.readdirSync(e,{withFileTypes:!0}).map((t=>f(t.name)&&t.isFile()&&I.isZip(e)?{name:t.name,isFile:()=>!1,isDirectory:()=>!0,isBlockDevice:()=>!1,isCharacterDevice:()=>!1,isSymbolicLink:()=>!1,isFIFO:()=>!1,isSocket:()=>!1}:t))}readFileSync(e,t=null){return"utf8"===t||"utf-8"===t?I.readFileSync(e,"utf8"):I.readFileSync(e)}writeFileSync(e,t,n){I.writeFileSync(e,t,n||void 0)}statSync(e){const t=I.statSync(e);return f(e)&&t.isFile()&&I.isZip(e)?{...t,isFile:()=>!1,isDirectory:()=>!0}:t}unlinkSync(e){I.unlinkSync(e)}realpathSync(e){return I.realpathSync(e)}getModulePath(){return global.__rootDirectory}createFileSystemWatcher(e,t){return this._fileWatcherProvider.createFileWatcher(e.map((e=>this.realCasePath(e))),t)}createReadStream(e){return I.createReadStream(e)}createWriteStream(e){return I.createWriteStream(e)}copyFileSync(e,t){I.copyFileSync(e,t)}readFile(e){return I.readFilePromise(e)}async readFileText(e,t){if("utf8"===t||"utf-8"===t)return I.readFilePromise(e,"utf8");return(await I.readFilePromise(e)).toString(t)}tmpdir(){if(!this._tmpdir){const e=c.dirSync({prefix:"pyright"});this._tmpdir=e.name}return this._tmpdir}tmpfile(e){return c.fileSync({dir:this.tmpdir(),discardDescriptor:!0,...e}).name}realCasePath(e){try{if(!l.existsSync(e))return e;const t=l.realpathSync.native(e),n=(0,m.getRootLength)(t);return n<=0?t:t.substr(0,n).toLowerCase()+t.substr(n)}catch(t){return this._console.error(`Failed to get real file system casing for ${e}: ${t}`),e}}isMappedFilePath(e){return!1}getOriginalFilePath(e){return e}getMappedFilePath(e){return e}getUri(e){return p.URI.file(e).toString()}isInZipOrEgg(e){return/[^\\/]\.(?:egg|zip)[\\/]/.test(e)&&I.isZip(e)}}t.WorkspaceFileWatcherProvider=class{constructor(){this._fileWatchers=[]}createFileWatcher(e,t){const n=this,s={close(){n._fileWatchers=n._fileWatchers.filter((e=>e!==s))},workspacePaths:e,eventHandler:t};return n._fileWatchers.push(s),s}onFileChange(e,t){this._fileWatchers.forEach((n=>{n.workspacePaths.some((e=>t.startsWith(e)))&&n.eventHandler(e,t)}))}}},14551:function(e,t,n){var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getLastDottedString=t.getCharacterCount=t.equateStringsCaseSensitive=t.equateStringsCaseInsensitive=t.getStringComparer=t.compareStringsCaseSensitive=t.compareStringsCaseInsensitive=t.hashString=t.isPatternInSymbol=t.computeCompletionSimilarity=void 0;const i=s(n(68505)),r=n(98173);function a(e,t){return e===t?0:void 0===e?-1:void 0===t?1:(0,r.compareComparableValues)(e.toUpperCase(),t.toUpperCase())}function o(e,t){return(0,r.compareComparableValues)(e,t)}t.computeCompletionSimilarity=function(e,t){if(t.startsWith(e))return 1;const n=t.toLocaleLowerCase(),s=e.toLocaleLowerCase();if(n.startsWith(s))return.75;let r=n.length,a=Number.MAX_VALUE;for(;r>0;){const e=(0,i.default)(n.substr(0,r),s);e<a&&(a=e),r--}return a>=e.length?0:.5*((e.length-a)/e.length)},t.isPatternInSymbol=function(e,t){const n=e.toLocaleLowerCase(),s=t.toLocaleLowerCase(),i=n.length,r=s.length;let a=0,o=0;for(;a<i&&o<r;)n[a]===s[o]&&(a+=1),o+=1;return a===i},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=a,t.compareStringsCaseSensitive=o,t.getStringComparer=function(e){return e?a:o},t.equateStringsCaseInsensitive=function(e,t){return 0===a(e,t)},t.equateStringsCaseSensitive=function(e,t){return 0===o(e,t)},t.getCharacterCount=function(e,t){let n=0;for(let s=0;s<e.length;s++)e[s]===t&&n++;return n},t.getLastDottedString=function(e){const t=e.lastIndexOf(".");return t>0?e.substring(t+1):e}},34815:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertTextEdits=void 0,t.convertTextEdits=function(e,t){if(!t)return{};const n=[];return t.forEach((e=>{n.push({range:e.range,newText:e.replacementText})})),{changes:{[e]:n}}}},80957:(e,t)=>{var n;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 i(){return{line:0,character:0}}function r(e,t){return 0===s(e,t)}function a(e){return 0===e.character&&0===e.line}function o(e,t){t&&(Array.isArray(t)?t.forEach((t=>{o(e,t)})):(s(t.start,e.start)<0&&(e.start=t.start),s(t.end,e.end)>0&&(e.end=t.end)))}Object.defineProperty(t,"__esModule",{value:!0}),t.combineRange=t.extendRange=t.isEmptyRange=t.isEmptyPosition=t.getEmptyRange=t.rangesAreEqual=t.positionsAreEqual=t.doesRangeContain=t.doRangesIntersect=t.doRangesOverlap=t.getEmptyPosition=t.comparePositions=t.Range=t.Position=t.TextRange=void 0,function(e){function t(e,t){if(e<0)throw new Error("start must be non-negative");if(t<0)throw new Error("length must be non-negative");return{start:e,length:t}}function n(e){return e.start+e.length}function s(e,t){return t>=e.start&&t<=n(e)}function i(e,t){t&&(Array.isArray(t)?t.forEach((t=>{i(e,t)})):(t.start<e.start&&(e.length+=e.start-t.start,e.start=t.start),n(t)>n(e)&&(e.length+=n(t)-n(e))))}e.create=t,e.fromBounds=function(e,n){if(e<0)throw new Error("start must be non-negative");if(e>n)throw new Error("end must be greater than or equal to start");return t(e,n-e)},e.getEnd=n,e.contains=function(e,t){return t>=e.start&&t<n(e)},e.containsRange=function(e,t){return t.start>=e.start&&n(t)<=n(e)},e.overlaps=s,e.overlapsRange=function(e,t){return s(e,t.start)||s(t,e.start)},e.extend=i,e.combine=function(e){if(0===e.length)return;const t=e[0];for(let n=1;n<e.length;n++)i(t,e[n]);return t}}(t.TextRange||(t.TextRange={})),function(e){e.is=function(e){const t=e;return t&&void 0!==t.line&&void 0!==t.character},e.print=function(e){return`(${e.line}:${e.character})`}}(n=t.Position||(t.Position={})),function(e){e.is=function(e){const t=e;return t&&void 0!==t.start&&void 0!==t.end},e.print=function(e){return`${n.print(e.start)}-${n.print(e.end)}`}}(t.Range||(t.Range={})),t.comparePositions=s,t.getEmptyPosition=i,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.positionsAreEqual=r,t.rangesAreEqual=function(e,t){return r(e.start,t.start)&&r(e.end,t.end)},t.getEmptyRange=function(){return{start:{line:0,character:0},end:{line:0,character:0}}},t.isEmptyPosition=a,t.isEmptyRange=function(e){return a(e.start)&&a(e.end)},t.extendRange=o,t.combineRange=function(e){if(0===e.length)return;const t=e[0];for(let n=1;n<e.length;n++)o(t,e[n]);return t}},979:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextRangeCollection=void 0;const s=n(80957);t.TextRangeCollection=class{constructor(e){this._items=e}get start(){return this._items.length>0?this._items[0].start:0}get end(){const e=this._items[this._items.length-1];return this._items.length>0?e.start+e.length:0}get length(){return this.end-this.start}get count(){return this._items.length}contains(e){return e>=this.start&&e<this.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 s=Math.floor(t+(n-t)/2),i=this._items[s];if(e>=i.start&&(s>=this.count-1||e<this._items[s+1].start))return s;e<i.start?n=s-1:t=s+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 i=Math.floor(t+(n-t)/2),r=this._items[i];if(s.TextRange.contains(r,e))return i;if(i<this.count-1&&s.TextRange.getEnd(r)<=e&&e<this._items[i+1].start)return-1;e<r.start?n=i-1:t=i+1}return-1}}},76962:(e,t)=>{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 s{constructor(){this.totalTime=0,this.callCount=0,this.isTiming=!1}timeOperation(e){if(this.callCount++,this.isTiming)return e();{this.isTiming=!0;const t=new n,s=e();return this.totalTime+=t.getDurationInMilliseconds(),this.isTiming=!1,s}}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=s;class i{constructor(){this.totalDuration=new n,this.findFilesTime=new s,this.readFileTime=new s,this.tokenizeFileTime=new s,this.parseFileTime=new s,this.resolveImportsTime=new s,this.cycleDetectionTime=new s,this.bindTime=new s,this.typeCheckerTime=new s,this.typeEvaluationTime=new s}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=i,t.timingStats=new i},58465:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UriParser=void 0;const s=n(94647);t.UriParser=class{constructor(e){this._fs=e}decodeTextDocumentPosition(e,t){return{filePath:(0,s.convertUriToPath)(this._fs,e.uri),position:t}}decodeTextDocumentUri(e){return(0,s.convertUriToPath)(this._fs,e)}}},19728:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.convertWorkspaceDocumentEdits=t.convertWorkspaceEdits=void 0;const s=n(29335),i=n(94647),r=n(9133),a=n(20823);t.convertWorkspaceEdits=function(e,t){const n={changes:{}};return t.forEach((t=>{const s=(0,i.convertPathToUri)(e,t.filePath);n.changes[s]=n.changes[s]||[],n.changes[s].push({range:t.range,newText:t.replacementText})})),n},t.convertWorkspaceDocumentEdits=function(e,t,n,o="default"){const l={documentChanges:[],changeAnnotations:n},c=(0,r.createMapFromItems)(t.edits,(e=>e.filePath));for(const[t,n]of c)l.documentChanges.push(s.TextDocumentEdit.create({uri:(0,i.convertPathToUri)(e,t),version:null},[...n.map((e=>({range:e.range,newText:e.replacementText,annotationId:o})))]));for(const n of t.fileOperations)switch(n.kind){case"create":l.documentChanges.push(s.CreateFile.create((0,i.convertPathToUri)(e,n.filePath),void 0,o));break;case"rename":l.documentChanges.push(s.RenameFile.create((0,i.convertPathToUri)(e,n.oldFilePath),(0,i.convertPathToUri)(e,n.newFilePath),void 0,o));break;case"delete":l.documentChanges.push(s.DeleteFile.create((0,i.convertPathToUri)(e,n.filePath),void 0,o));break;default:(0,a.assertNever)(n)}return l}},52599:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.LanguageServerBase=void 0,n(53117);const s=n(29335),i=n(57403),r=n(47041),a=n(44314),o=n(9055),l=n(38213),c=n(9133),p=n(96795),d=n(14943),u=n(11043),m=n(10219),y=n(13727),h=n(94647),g=n(76913),f=n(58465),T=n(19728),_=n(22060),v=n(27888),b=n(54989),I=n(8871),C=n(74426),S=n(37633),F=(0,i.attachWorkDone)(void 0,void 0);t.LanguageServerBase=class{constructor(e,t,n){var i,r;this._serverOptions=e,this._connection=t,this.console=n,this._lastTriggerKind=s.CompletionTriggerKind.Invoked,this.rootPath="",this.client={hasConfigurationCapability:!1,hasVisualStudioExtensionsCapability:!1,hasWorkspaceFoldersCapability:!1,hasWatchFileCapability:!1,hasActiveParameterCapability:!1,hasSignatureLabelOffsetCapability:!1,hasHierarchicalDocumentSymbolCapability:!1,hasWindowProgressCapability:!1,hasGoToDeclarationCapability:!1,hasDocumentChangeCapability:!1,hasDocumentAnnotationCapability:!1,hoverContentFormat:s.MarkupKind.PlainText,completionDocFormat:s.MarkupKind.PlainText,completionSupportsSnippet:!1,signatureDocFormat:s.MarkupKind.PlainText,supportsDeprecatedDiagnosticTag:!1,supportsUnnecessaryDiagnosticTag:!1,completionItemResolveSupportsAdditionalTextEdits:!1},global.__rootDirectory=e.rootDirectory,this.console.info(`${e.productName} language server ${e.version&&e.version+" "}starting`),this.console.info(`Server root directory: ${e.rootDirectory}`),this._workspaceMap=this._serverOptions.workspaceMap,this._fileWatcherProvider=this._serverOptions.fileWatcherProvider,this.fs=new S.PyrightFileSystem(this._serverOptions.fileSystem),this._uriParser=new f.UriParser(this.fs);const a=this.fs.getModulePath();a&&this.fs.chdir(a),this.setupConnection(null!==(i=e.supportedCommands)&&void 0!==i?i:[],null!==(r=e.supportedCodeActions)&&void 0!==r?r:[]),this._progressReporter=new g.ProgressReportTracker(this.createProgressReporter()),this._connection.listen()}decodeTextDocumentUri(e){return this._uriParser.decodeTextDocumentUri(e)}async getConfiguration(e,t){if(this.client.hasConfigurationCapability){const n={};return void 0!==e&&(n.scopeUri=e),void 0!==t&&(n.section=t),this._connection.workspace.getConfiguration(n)}if(this._defaultClientConfig)return(0,c.getNestedProperty)(this._defaultClientConfig,t)}isOpenFilesOnly(e){return"workspace"!==e}get allowModuleRename(){return!1}getSeverityOverrides(e){const t=e;if((0,p.getDiagnosticSeverityOverrides)().includes(t))return t}getDiagnosticRuleName(e){const t=e;if((0,d.getDiagLevelDiagnosticRules)().includes(t))return t}createBackgroundAnalysisProgram(e,t,n,s,i,a){return new r.BackgroundAnalysisProgram(e,t,n,s,i,a)}setExtension(e){this._serverOptions.extension=e}get window(){return this._connection.window}get supportAdvancedEdits(){return this.client.hasDocumentChangeCapability&&this.client.hasDocumentAnnotationCapability}createAnalyzerService(e){this.console.log(`Starting service instance "${e}"`);const t=new a.AnalyzerService(e,this.fs,this.console,this.createHost.bind(this),this.createImportResolver.bind(this),void 0,this._serverOptions.extension,this.createBackgroundAnalysis(),this._serverOptions.maxAnalysisTimeInForeground,this.createBackgroundAnalysisProgram.bind(this),this._serverOptions.cancellationProvider);return t.setCompletionCallback((e=>this.onAnalysisCompletedHandler(e))),t}async getWorkspaceForFile(e){const t=this._workspaceMap.getWorkspaceForFile(this,e);return await t.isInitialized.promise,t}reanalyze(){this._workspaceMap.forEach((e=>{e.serviceInstance.invalidateAndForceReanalysis()}))}restart(){this._workspaceMap.forEach((e=>{e.serviceInstance.restart()}))}setupConnection(e,t){this._connection.onInitialize((n=>this.initialize(n,e,t))),this._connection.onInitialized((()=>this.onInitialized())),this._connection.onDidChangeConfiguration((e=>this.onDidChangeConfiguration(e))),this._connection.onCodeAction(((e,t)=>this.executeCodeAction(e,t))),this._connection.onDefinition((async(e,t)=>this.onDefinition(e,t))),this._connection.onDeclaration((async(e,t)=>this.onDeclaration(e,t))),this._connection.onTypeDefinition((async(e,t)=>this.onTypeDefinition(e,t))),this._connection.onReferences((async(e,t,n,s)=>this.onReferences(e,t,n,s))),this._connection.onDocumentSymbol((async(e,t)=>this.onDocumentSymbol(e,t))),this._connection.onWorkspaceSymbol((async(e,t,n,s)=>this.onWorkspaceSymbol(e,t,s))),this._connection.onHover((async(e,t)=>this.onHover(e,t))),this._connection.onDocumentHighlight((async(e,t)=>this.onDocumentHighlight(e,t))),this._connection.onSignatureHelp((async(e,t)=>this.onSignatureHelp(e,t))),this._connection.onCompletion(((e,t)=>this.onCompletion(e,t))),this._connection.onCompletionResolve((async(e,t)=>this.onCompletionResolve(e,t))),this._connection.onPrepareRename((async(e,t)=>this.onPrepareRenameRequest(e,t))),this._connection.onRenameRequest((async(e,t)=>this.onRenameRequest(e,t)));const n=this._connection.languages.callHierarchy;n.onPrepare((async(e,t)=>this.onPrepare(e,t))),n.onIncomingCalls((async(e,t)=>this.onIncomingCalls(e,t))),n.onOutgoingCalls((async(e,t)=>this.onOutgoingCalls(e,t))),this._connection.onDidOpenTextDocument((async e=>this.onDidOpenTextDocument(e))),this._connection.onDidChangeTextDocument((async e=>this.onDidChangeTextDocument(e))),this._connection.onDidCloseTextDocument((async e=>this.onDidCloseTextDocument(e))),this._connection.onDidChangeWatchedFiles((e=>this.onDidChangeWatchedFiles(e))),this._connection.onExecuteCommand((async(e,t,n)=>this.onExecuteCommand(e,t,n)))}initialize(e,t,n){var i,r,a,o,l,c,p,d,u,m,y,h,g,f,T,_,v,b,I,S,F,x,D,P,A,E,k,w,N,M,R,O,L,V,U,z,B,W;e.locale&&(0,C.setLocaleOverride)(e.locale),this.rootPath=e.rootPath||"";const j=e.capabilities;this.client.hasConfigurationCapability=!!(null===(i=j.workspace)||void 0===i?void 0:i.configuration),this.client.hasWatchFileCapability=!!(null===(a=null===(r=j.workspace)||void 0===r?void 0:r.didChangeWatchedFiles)||void 0===a?void 0:a.dynamicRegistration),this.client.hasWorkspaceFoldersCapability=!!(null===(o=j.workspace)||void 0===o?void 0:o.workspaceFolders),this.client.hasVisualStudioExtensionsCapability=!!j.supportsVisualStudioExtensions,this.client.hasActiveParameterCapability=!!(null===(p=null===(c=null===(l=j.textDocument)||void 0===l?void 0:l.signatureHelp)||void 0===c?void 0:c.signatureInformation)||void 0===p?void 0:p.activeParameterSupport),this.client.hasSignatureLabelOffsetCapability=!!(null===(y=null===(m=null===(u=null===(d=j.textDocument)||void 0===d?void 0:d.signatureHelp)||void 0===u?void 0:u.signatureInformation)||void 0===m?void 0:m.parameterInformation)||void 0===y?void 0:y.labelOffsetSupport),this.client.hasHierarchicalDocumentSymbolCapability=!!(null===(g=null===(h=j.textDocument)||void 0===h?void 0:h.documentSymbol)||void 0===g?void 0:g.hierarchicalDocumentSymbolSupport),this.client.hasDocumentChangeCapability=!!(null===(T=null===(f=j.workspace)||void 0===f?void 0:f.workspaceEdit)||void 0===T?void 0:T.documentChanges)&&!!(null===(_=j.workspace.workspaceEdit)||void 0===_?void 0:_.resourceOperations),this.client.hasDocumentAnnotationCapability=!!(null===(b=null===(v=j.workspace)||void 0===v?void 0:v.workspaceEdit)||void 0===b?void 0:b.changeAnnotationSupport),this.client.hoverContentFormat=this._getCompatibleMarkupKind(null===(S=null===(I=j.textDocument)||void 0===I?void 0:I.hover)||void 0===S?void 0:S.contentFormat),this.client.completionDocFormat=this._getCompatibleMarkupKind(null===(D=null===(x=null===(F=j.textDocument)||void 0===F?void 0:F.completion)||void 0===x?void 0:x.completionItem)||void 0===D?void 0:D.documentationFormat),this.client.completionSupportsSnippet=!!(null===(E=null===(A=null===(P=j.textDocument)||void 0===P?void 0:P.completion)||void 0===A?void 0:A.completionItem)||void 0===E?void 0:E.snippetSupport),this.client.signatureDocFormat=this._getCompatibleMarkupKind(null===(N=null===(w=null===(k=j.textDocument)||void 0===k?void 0:k.signatureHelp)||void 0===w?void 0:w.signatureInformation)||void 0===N?void 0:N.documentationFormat);const G=(null===(O=null===(R=null===(M=j.textDocument)||void 0===M?void 0:M.publishDiagnostics)||void 0===R?void 0:R.tagSupport)||void 0===O?void 0:O.valueSet)||[];this.client.supportsUnnecessaryDiagnosticTag=G.some((e=>e===s.DiagnosticTag.Unnecessary)),this.client.supportsDeprecatedDiagnosticTag=G.some((e=>e===s.DiagnosticTag.Deprecated)),this.client.hasWindowProgressCapability=!!(null===(L=j.window)||void 0===L?void 0:L.workDoneProgress),this.client.hasGoToDeclarationCapability=!!(null===(V=j.textDocument)||void 0===V?void 0:V.declaration),this.client.completionItemResolveSupportsAdditionalTextEdits=!!(null===(W=null===(B=null===(z=null===(U=j.textDocument)||void 0===U?void 0:U.completion)||void 0===z?void 0:z.completionItem)||void 0===B?void 0:B.resolveSupport)||void 0===W?void 0:W.properties.some((e=>"additionalTextEdits"===e))),e.workspaceFolders?e.workspaceFolders.forEach((e=>{const t=this._uriParser.decodeTextDocumentUri(e.uri);this._workspaceMap.set(t,this.createWorkspaceServiceInstance(e,t))})):e.rootPath&&this._workspaceMap.set(e.rootPath,this.createWorkspaceServiceInstance(void 0,e.rootPath));return{capabilities:{textDocumentSync:s.TextDocumentSyncKind.Incremental,definitionProvider:{workDoneProgress:!0},declarationProvider:{workDoneProgress:!0},typeDefinitionProvider:{workDoneProgress:!0},referencesProvider:{workDoneProgress:!0},documentSymbolProvider:{workDoneProgress:!0},workspaceSymbolProvider:{workDoneProgress:!0},hoverProvider:{workDoneProgress:!0},documentHighlightProvider:{workDoneProgress:!0},renameProvider:{prepareProvider:!0,workDoneProgress:!0},completionProvider:{triggerCharacters:this.client.hasVisualStudioExtensionsCapability?[".","[","@"]:[".","["],resolveProvider:!0,workDoneProgress:!0},signatureHelpProvider:{triggerCharacters:["(",",",")"],workDoneProgress:!0},codeActionProvider:{codeActionKinds:n,workDoneProgress:!0},executeCommandProvider:{commands:t,workDoneProgress:!0},callHierarchyProvider:!0}}}onInitialized(){this.client.hasWorkspaceFoldersCapability&&(this._connection.workspace.onDidChangeWorkspaceFolders((e=>{e.removed.forEach((e=>{const t=this._uriParser.decodeTextDocumentUri(e.uri);this._workspaceMap.delete(t)})),e.added.forEach((async e=>{const t=this._uriParser.decodeTextDocumentUri(e.uri),n=this.createWorkspaceServiceInstance(e,t);this._workspaceMap.set(t,n),await this.updateSettingsForWorkspace(n)}))})),this._setupFileWatcher())}_setupFileWatcher(){if(!this.client.hasWatchFileCapability)return;const e=[...a.configFileNames.map((e=>({globPattern:`**/${e}`,kind:s.WatchKind.Create|s.WatchKind.Change|s.WatchKind.Delete}))),{globPattern:"**",kind:s.WatchKind.Create|s.WatchKind.Change|s.WatchKind.Delete}];for(const t of this._workspaceMap.getNonDefaultWorkspaces())t.searchPathsToWatch.forEach((t=>{e.push({globPattern:`${(0,h.normalizeSlashes)(this.fs.realCasePath(t),"/")}/**`,kind:s.WatchKind.Create|s.WatchKind.Change|s.WatchKind.Delete})}));this._connection.client.register(s.DidChangeWatchedFilesNotification.type,{watchers:e}).then((e=>{this._lastFileWatcherRegistration&&this._lastFileWatcherRegistration.dispose(),this._lastFileWatcherRegistration=e}))}onDidChangeConfiguration(e){this.console.log("Received updated settings"),(null==e?void 0:e.settings)&&(this._defaultClientConfig=null==e?void 0:e.settings),this.updateSettingsForAllWorkspaces()}async onDefinition(e,t){return this.getDefinitions(e,t,this.client.hasGoToDeclarationCapability?v.DefinitionFilter.PreferSource:v.DefinitionFilter.All,((e,t,n,s,i)=>e.serviceInstance.getDefinitionForPosition(t,n,s,i)))}async onDeclaration(e,t){return this.getDefinitions(e,t,this.client.hasGoToDeclarationCapability?v.DefinitionFilter.PreferStubs:v.DefinitionFilter.All,((e,t,n,s,i)=>e.serviceInstance.getDefinitionForPosition(t,n,s,i)))}async onTypeDefinition(e,t){return this.getDefinitions(e,t,v.DefinitionFilter.All,((e,t,n,s,i)=>e.serviceInstance.getTypeDefinitionForPosition(t,n,i)))}async getDefinitions(e,t,n,i){this.recordUserInteractionTime();const{filePath:r,position:a}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),o=await this.getWorkspaceForFile(r);if(o.disableLanguageServices)return;const l=i(o,r,a,n,t);return l?l.filter((e=>!this.fs.isInZipOrEgg(e.path))).map((e=>s.Location.create((0,h.convertPathToUri)(this.fs,e.path),e.range))):void 0}async onReferences(e,t,n,i){this._pendingFindAllRefsCancellationSource&&(this._pendingFindAllRefsCancellationSource.cancel(),this._pendingFindAllRefsCancellationSource=void 0);const r=await this._getProgressReporter(n,C.Localizer.CodeAction.findingReferences(),t),a=r.source;this._pendingFindAllRefsCancellationSource=a;try{const{filePath:t,position:n}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),o=await this.getWorkspaceForFile(t);if(o.disableLanguageServices)return;const l=e=>e.filter((e=>!this.fs.isInZipOrEgg(e.path))).map((e=>s.Location.create((0,h.convertPathToUri)(this.fs,e.path),e.range))),p=[],d=i?e=>i.report(l(e)):e=>(0,c.appendArray)(p,l(e));return o.serviceInstance.reportReferencesForPosition(t,n,e.context.includeDeclaration,d,a.token),p}finally{r.reporter.done(),a.dispose()}}async onDocumentSymbol(e,t){this.recordUserInteractionTime();const n=this._uriParser.decodeTextDocumentUri(e.textDocument.uri),s=await this.getWorkspaceForFile(n);if(s.disableLanguageServices)return;const i=[];return s.serviceInstance.addSymbolsForDocument(n,i,t),this.client.hasHierarchicalDocumentSymbolCapability?i:(0,b.convertToFlatSymbols)(e.textDocument.uri,i)}async onWorkspaceSymbol(e,t,n){const s=[],i=n?e=>n.report(e):e=>(0,c.appendArray)(s,e);for(const n of this._workspaceMap.values())await n.isInitialized.promise,n.disableLanguageServices||n.disableWorkspaceSymbol||n.serviceInstance.reportSymbolsForWorkspace(e.query,i,t);return s}async onHover(e,t){const{filePath:n,position:s}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),i=(await this.getWorkspaceForFile(n)).serviceInstance.getHoverForPosition(n,s,this.client.hoverContentFormat,t);return(0,I.convertHoverResults)(this.client.hoverContentFormat,i)}async onDocumentHighlight(e,t){const{filePath:n,position:s}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position);return(await this.getWorkspaceForFile(n)).serviceInstance.getDocumentHighlight(n,s,t)}async onSignatureHelp(e,t){var n,i;const{filePath:r,position:a}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),o=await this.getWorkspaceForFile(r);if(o.disableLanguageServices)return;const l=o.serviceInstance.getSignatureHelpForPosition(r,a,this.client.signatureDocFormat,t);if(!l)return;const c=l.signatures.map((e=>{let t=[];e.parameters&&(t=e.parameters.map((e=>s.ParameterInformation.create(this.client.hasSignatureLabelOffsetCapability?[e.startOffset,e.endOffset]:e.text,e.documentation))));const n=s.SignatureInformation.create(e.label,void 0,...t);return void 0!==e.documentation&&(n.documentation=e.documentation),void 0!==e.activeParameter&&(n.activeParameter=e.activeParameter),n})),p=e=>{var t;return void 0!==e.activeParameter||!l.callHasParameters&&!(null===(t=e.parameters)||void 0===t?void 0:t.length)};let d=c.findIndex(p);-1===d&&(d=void 0);let u=void 0!==d?c[d].activeParameter:void 0;if((null===(n=e.context)||void 0===n?void 0:n.isRetrigger)&&e.context.triggerKind!==s.SignatureHelpTriggerKind.Invoked){const t=null===(i=e.context.activeSignatureHelp)||void 0===i?void 0:i.activeSignature;if(void 0!==t&&t<c.length){const e=c[t];p(e)&&(d=t,u=e.activeParameter)}}return(this.client.hasActiveParameterCapability||void 0===d)&&(u=Math.max(...c.map((e=>{var t,n;return null!==(n=null===(t=e.parameters)||void 0===t?void 0:t.length)&&void 0!==n?n:0})))),{signatures:c,activeSignature:d,activeParameter:u}}async onCompletion(e,t){var n,i;const r=this._lastTriggerKind!==s.CompletionTriggerKind.TriggerForIncompleteCompletions||(null===(n=e.context)||void 0===n?void 0:n.triggerKind)!==s.CompletionTriggerKind.TriggerForIncompleteCompletions;this._lastTriggerKind=null===(i=e.context)||void 0===i?void 0:i.triggerKind;const{filePath:a,position:o}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),l=await this.getWorkspaceForFile(a);if(l.disableLanguageServices)return;const c=await this.getWorkspaceCompletionsForPosition(l,a,o,l.rootPath,this.getCompletionOptions(e),t);return c&&c.completionList&&(c.completionList.isIncomplete=r),null==c?void 0:c.completionList}async onCompletionResolve(e,t){const n=(0,y.fromLSPAny)(e.data);if(n&&n.filePath){const s=await this.getWorkspaceForFile(n.workspacePath);this.resolveWorkspaceCompletionItem(s,n.filePath,e,t)}return e}async onPrepareRenameRequest(e,t){const{filePath:n,position:s}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),i=await this.getWorkspaceForFile(n);if(i.disableLanguageServices)return null;const r=i.serviceInstance.canRenameSymbolAtPosition(n,s,""===i.rootPath,this.allowModuleRename,t);return null!=r?r:null}async onRenameRequest(e,t){const{filePath:n,position:s}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),i=await this.getWorkspaceForFile(n);if(i.disableLanguageServices)return;const r=i.serviceInstance.renameSymbolAtPosition(n,s,e.newName,""===i.rootPath,this.allowModuleRename,t);return r?(0,T.convertWorkspaceDocumentEdits)(this.fs,r):void 0}async onPrepare(e,t){const{filePath:n,position:s}=this._uriParser.decodeTextDocumentPosition(e.textDocument,e.position),i=await this.getWorkspaceForFile(n);if(i.disableLanguageServices)return null;const r=i.serviceInstance.getCallForPosition(n,s,t)||null;return r?this.fs.isInZipOrEgg(r.uri)?null:(r.uri=(0,h.convertPathToUri)(this.fs,r.uri),[r]):null}async onIncomingCalls(e,t){const{filePath:n,position:s}=this._uriParser.decodeTextDocumentPosition(e.item,e.item.range.start),i=await this.getWorkspaceForFile(n);if(i.disableLanguageServices)return null;let r=i.serviceInstance.getIncomingCallsForPosition(n,s,t)||null;return r&&0!==r.length?(r=r.filter((e=>!this.fs.isInZipOrEgg(e.from.uri))),r.forEach((e=>{e.from.uri=(0,h.convertPathToUri)(this.fs,e.from.uri)})),r):null}async onOutgoingCalls(e,t){const{filePath:n,position:s}=this._uriParser.decodeTextDocumentPosition(e.item,e.item.range.start),i=await this.getWorkspaceForFile(n);if(i.disableLanguageServices)return null;let r=i.serviceInstance.getOutgoingCallsForPosition(n,s,t)||null;return r&&0!==r.length?(r=r.filter((e=>!this.fs.isInZipOrEgg(e.to.uri))),r.forEach((e=>{e.to.uri=(0,h.convertPathToUri)(this.fs,e.to.uri)})),r):null}async onDidOpenTextDocument(e,t=!1){const n=this._uriParser.decodeTextDocumentUri(e.textDocument.uri);if(!this.fs.addUriMap(e.textDocument.uri,n))return;(await this.getWorkspaceForFile(n)).serviceInstance.setFileOpened(n,e.textDocument.version,e.textDocument.text,t)}async onDidChangeTextDocument(e,t=!1){this.recordUserInteractionTime();const n=this._uriParser.decodeTextDocumentUri(e.textDocument.uri);if(!this.fs.hasUriMapEntry(e.textDocument.uri,n))return;(await this.getWorkspaceForFile(n)).serviceInstance.updateOpenFileContents(n,e.textDocument.version,e.contentChanges,t)}async onDidCloseTextDocument(e){const t=this._uriParser.decodeTextDocumentUri(e.textDocument.uri);if(!this.fs.removeUriMap(e.textDocument.uri,t))return;(await this.getWorkspaceForFile(t)).serviceInstance.setFileClosed(t)}onDidChangeWatchedFiles(e){e.changes.forEach((e=>{const t=this.fs.realCasePath(this._uriParser.decodeTextDocumentUri(e.uri)),n=1===e.type?"add":"change";this._fileWatcherProvider.onFileChange(n,t)}))}async onExecuteCommand(e,t,n){this._pendingCommandCancellationSource&&(this._pendingCommandCancellationSource.cancel(),this._pendingCommandCancellationSource=void 0);const i=async t=>{const n=await this.executeCommand(e,t);return s.WorkspaceEdit.is(n)&&this._connection.workspace.applyEdit({label:`Command '${e.command}'`,edit:n}),o.CommandResult.is(n)&&await this._connection.workspace.applyEdit({label:n.label,edit:n.edits}),n};if(!this.isLongRunningCommand(e.command)){return await i(t)}{const e=await this._getProgressReporter(n,C.Localizer.CodeAction.executingCommand(),t),s=e.source;this._pendingCommandCancellationSource=s;try{return await i(s.token)}finally{e.reporter.done(),s.dispose()}}}resolveWorkspaceCompletionItem(e,t,n,s){e.serviceInstance.resolveCompletionItem(t,n,this.getCompletionOptions(),void 0,s)}getWorkspaceCompletionsForPosition(e,t,n,s,i,r){return e.serviceInstance.getCompletionsForPosition(t,n,s,i,void 0,r)}updateSettingsForAllWorkspaces(){this._workspaceMap.forEach((e=>{this.updateSettingsForWorkspace(e).ignoreErrors()})),this._setupFileWatcher()}getCompletionOptions(e){return{format:this.client.completionDocFormat,snippet:this.client.completionSupportsSnippet,lazyEdit:this.client.completionItemResolveSupportsAdditionalTextEdits,autoImport:!0}}createWorkspaceServiceInstance(e,t){var n,s,i;return{workspaceName:null!==(n=null==e?void 0:e.name)&&void 0!==n?n:"",rootPath:t,rootUri:null!==(s=null==e?void 0:e.uri)&&void 0!==s?s:"",serviceInstance:this.createAnalyzerService(null!==(i=null==e?void 0:e.name)&&void 0!==i?i:t),disableLanguageServices:!1,disableOrganizeImports:!1,disableWorkspaceSymbol:!1,isInitialized:(0,m.createDeferred)(),searchPathsToWatch:[]}}convertDiagnostics(e){return[{uri:(0,h.convertPathToUri)(this.fs,e.filePath),version:e.version,diagnostics:this._convertDiagnostics(e.diagnostics)}]}onAnalysisCompletedHandler(e){if(e.diagnostics.forEach((e=>{this.fs.isInZipOrEgg(e.filePath)||(this._sendDiagnostics(this.convertDiagnostics(e)),this.fs.pendingRequest(e.filePath,e.diagnostics.length>0))})),this._progressReporter.isEnabled(e))if(e.filesRequiringAnalysis>0){this._progressReporter.begin();const t=1===e.filesRequiringAnalysis?C.Localizer.CodeAction.filesToAnalyzeOne():C.Localizer.CodeAction.filesToAnalyzeCount().format({count:e.filesRequiringAnalysis});this._progressReporter.report(t)}else this._progressReporter.end();else this._progressReporter.end()}async updateSettingsForWorkspace(e,t){var n;t=null!=t?t:await this.getSettings(e),this.console.level=null!==(n=t.logLevel)&&void 0!==n?n:u.LogLevel.Info,this.updateOptionsAndRestartService(e,t),e.disableLanguageServices=!!t.disableLanguageServices,e.disableOrganizeImports=!!t.disableOrganizeImports,e.isInitialized.resolve(!0)}updateOptionsAndRestartService(e,t,n){var s;_.AnalyzerServiceExecutor.runWithOptions(this.rootPath,e,t,n),e.searchPathsToWatch=null!==(s=e.serviceInstance.librarySearchPathsToWatch)&&void 0!==s?s:[]}convertLogLevel(e){if(!e)return u.LogLevel.Info;switch(e.toLowerCase()){case"error":return u.LogLevel.Error;case"warning":return u.LogLevel.Warn;case"information":default:return u.LogLevel.Info;case"trace":return u.LogLevel.Log}}_sendDiagnostics(e){for(const t of e)this._connection.sendDiagnostics(t)}_getCompatibleMarkupKind(e){const t=[s.MarkupKind.PlainText,s.MarkupKind.Markdown];for(const n of null!=e?e:[])if(t.includes(n))return n;return s.MarkupKind.PlainText}async _getProgressReporter(e,t,n){if(e.constructor!==F.constructor)return{reporter:e,source:(0,l.CancelAfter)(n)};const s=await this._connection.window.createWorkDoneProgress();return s.begin(t,void 0,void 0,!0),{reporter:s,source:(0,l.CancelAfter)(n,s.token)}}_convertDiagnostics(e){const t=[];return e.forEach((e=>{const n=function(e){switch(e){case 0:return s.DiagnosticSeverity.Error;case 1:return s.DiagnosticSeverity.Warning;case 2:return s.DiagnosticSeverity.Information;case 3:case 4:return s.DiagnosticSeverity.Hint}}(e.category),i=e.getRule(),r=s.Diagnostic.create(e.range,e.message,n,i,this._serverOptions.productName);if(3===e.category){if(r.tags=[s.DiagnosticTag.Unnecessary],r.severity=s.DiagnosticSeverity.Hint,!this.client.supportsUnnecessaryDiagnosticTag)return}else if(4===e.category&&(r.tags=[s.DiagnosticTag.Deprecated],r.severity=s.DiagnosticSeverity.Hint,!this.client.supportsDeprecatedDiagnosticTag))return;if(i){const e=this.getDocumentationUrlForDiagnosticRule(i);e&&(r.codeDescription={href:e})}const a=e.getRelatedInfo();a.length>0&&(r.relatedInformation=a.filter((e=>!this.fs.isInZipOrEgg(e.filePath))).map((e=>s.DiagnosticRelatedInformation.create(s.Location.create((0,h.convertPathToUri)(this.fs,e.filePath),e.range),e.message)))),t.push(r)})),t}recordUserInteractionTime(){this._workspaceMap.forEach((e=>{e.serviceInstance.recordUserInteractionTime()}))}getDocumentationUrlForDiagnosticRule(e){return"https://github.com/microsoft/pyright/blob/main/docs/configuration.md"}expandPathVariables(e,t){return t.replace(/\$\{(.*?)\}/g,((t,n)=>{const s=n.trim();return"workspaceFolder"===s?e:"env:HOME"===s&&void 0!==process.env.HOME?process.env.HOME:"env:USERNAME"===s&&void 0!==process.env.USERNAME?process.env.USERNAME:"env:VIRTUAL_ENV"===s&&void 0!==process.env.VIRTUAL_ENV?process.env.VIRTUAL_ENV:t}))}}},22060:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnalyzerServiceExecutor=void 0;const s=n(96453),i=n(96795),r=n(11043),a=n(10219),o=n(94647);class l{static runWithOptions(e,t,n,a,l=!0){const c=function(e,t,n,a,l){var c,p;const d=new i.CommandLineOptions(t,!0);d.checkOnlyOpenFiles=n.openFilesOnly,d.useLibraryCodeForTypes=n.useLibraryCodeForTypes,d.typeCheckingMode=n.typeCheckingMode,d.autoImportCompletions=n.autoImportCompletions,d.indexing=n.indexing,d.logTypeEvaluationTime=null!==(c=n.logTypeEvaluationTime)&&void 0!==c&&c,d.typeEvaluationTimeThreshold=null!==(p=n.typeEvaluationTimeThreshold)&&void 0!==p?p:50,d.enableAmbientAnalysis=a,a?(d.watchForSourceChanges=n.watchForSourceChanges,d.watchForLibraryChanges=n.watchForLibraryChanges,d.watchForConfigChanges=n.watchForConfigChanges):(d.watchForSourceChanges=!1,d.watchForLibraryChanges=!1,d.watchForConfigChanges=!1);n.venvPath&&(d.venvPath=(0,o.combinePaths)(t||e,n.venvPath));n.pythonPath&&((0,s.isPythonBinary)(n.pythonPath)||(d.pythonPath=(0,o.combinePaths)(t||e,n.pythonPath)));n.typeshedPath&&(d.typeshedPath=n.typeshedPath);n.stubPath&&(d.stubPath=n.stubPath);n.logLevel===r.LogLevel.Log&&(d.verboseOutput=!0);l&&(d.typeStubTargetImportName=l);return d.autoSearchPaths=n.autoSearchPaths,d.extraPaths=n.extraPaths,d.diagnosticSeverityOverrides=n.diagnosticSeverityOverrides,d}(e,t.rootPath,n,l,a);t.serviceInstance.setOptions(c)}static async cloneService(e,t,n,s,i){const r={workspaceName:"temp workspace for cloned service",rootPath:t.rootPath,rootUri:t.rootUri,serviceInstance:t.serviceInstance.clone("cloned service",s,i),disableLanguageServices:!0,disableOrganizeImports:!0,isInitialized:(0,a.createDeferred)(),searchPathsToWatch:[]},o=await e.getSettings(t);return l.runWithOptions(e.rootPath,r,o,n,!1),r.serviceInstance}}t.AnalyzerServiceExecutor=l},82615:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.convertSymbolKindToCompletionItemKind=t.AutoImporter=t.buildModuleSymbolsMap=void 0;const a=n(29335),o=n(45214),l=r(n(91197)),c=n(38213),p=n(9133),d=n(94647),u=r(n(14551)),m=n(76962),y=n(80088);t.buildModuleSymbolsMap=function(e,t,n){const s=new Map;return(0,c.throwIfCancellationRequested)(n),e.forEach((e=>{if(e.shadows.length>0)return;const n=e.sourceFile.getFilePath(),i=e.sourceFile.getModuleSymbolTable();if(i){const e=(0,d.stripFileExtension)((0,d.getFileName)(n));if(l.isPrivateOrProtectedName(e))return;return void s.set(n,{forEach(e){i.forEach(((t,n)=>{if(t.isExternallyHidden())return;const s=t.getDeclarations();if(!s||0===s.length)return;const i=s[0];if(!i)return;if(6===i.type)return;const r=1!==i.type||i.isConstant||i.isFinal?void 0:a.SymbolKind.Variable;e({symbol:t,kind:r},n,!1)}))}})}const r=e.sourceFile.getCachedIndexResults();r&&t&&!r.privateOrProtected&&s.set(n,h(r,!1))})),s};function h(e,t){return{forEach(n){e.symbols.forEach((e=>{e.externallyVisible&&n({importAlias:e.alias,kind:e.kind,itemKind:e.itemKind},e.name,t)}))}}}function g(e){switch(e){case a.SymbolKind.File:return a.CompletionItemKind.File;case a.SymbolKind.Module:case a.SymbolKind.Namespace:return a.CompletionItemKind.Module;case a.SymbolKind.Package:return a.CompletionItemKind.Folder;case a.SymbolKind.Class:return a.CompletionItemKind.Class;case a.SymbolKind.Method:return a.CompletionItemKind.Method;case a.SymbolKind.Property:return a.CompletionItemKind.Property;case a.SymbolKind.Field:return a.CompletionItemKind.Field;case a.SymbolKind.Constructor:return a.CompletionItemKind.Constructor;case a.SymbolKind.Enum:return a.CompletionItemKind.Enum;case a.SymbolKind.Interface:return a.CompletionItemKind.Interface;case a.SymbolKind.Function:return a.CompletionItemKind.Function;case a.SymbolKind.Variable:case a.SymbolKind.Array:return a.CompletionItemKind.Variable;case a.SymbolKind.String:return a.CompletionItemKind.Constant;case a.SymbolKind.Number:case a.SymbolKind.Boolean:return a.CompletionItemKind.Value;case a.SymbolKind.Constant:case a.SymbolKind.Null:return a.CompletionItemKind.Constant;case a.SymbolKind.Object:case a.SymbolKind.Key:return a.CompletionItemKind.Value;case a.SymbolKind.EnumMember:return a.CompletionItemKind.EnumMember;case a.SymbolKind.Struct:return a.CompletionItemKind.Struct;case a.SymbolKind.Event:return a.CompletionItemKind.Event;case a.SymbolKind.Operator:return a.CompletionItemKind.Operator;case a.SymbolKind.TypeParameter:return a.CompletionItemKind.TypeParameter;default:return}}t.AutoImporter=class{constructor(e,t,n,s,i,r,a){this._execEnvironment=e,this._importResolver=t,this._parseResults=n,this._invocationPosition=s,this._excludes=i,this._moduleSymbolMap=r,this._options=a,this._stopWatch=new m.Duration,this._perfInfo={indexUsed:!1,totalInMs:0,moduleTimeInMS:0,indexTimeInMS:0,importAliasTimeInMS:0,symbolCount:0,indexCount:0,importAliasCount:0},this._importStatements=(0,o.getTopLevelImports)(this._parseResults.parseTree,!0),this._perfInfo.indexUsed=!!this._options.libraryMap}getAutoImportCandidatesForAbbr(e,t,n){const s=this._getCandidates(t.importName,1,e,n).get(t.importName);return s?s.filter((e=>e.source===t.importFrom)):[]}getAutoImportCandidates(e,t,n,s){const i=[];return this._getCandidates(e,t,n,s).forEach((e=>(0,p.appendArray)(i,e))),i}getPerfInfo(){return this._perfInfo.totalInMs=this._stopWatch.getDurationInMilliseconds(),this._perfInfo}_getCandidates(e,t,n,s){const i=new Map,r=new Map;return this._addImportsFromModuleMap(e,t,n,r,i,s),this._addImportsFromLibraryMap(e,t,n,r,i,s),this._addImportsFromImportAliasMap(r,n,i,s),i}_addImportsFromLibraryMap(e,t,n,s,i,r){var a;const o=this._stopWatch.getDurationInMilliseconds();null===(a=this._options.libraryMap)||void 0===a||a.forEach(((a,o)=>{if(a.privateOrProtected)return;if(this._moduleSymbolMap.has(o))return;const l=this._isStubFileOrHasInit(this._options.libraryMap,o);this._processModuleSymbolTable(h(a,!0),o,e,t,l,n,s,i,r)})),this._perfInfo.indexTimeInMS=this._stopWatch.getDurationInMilliseconds()-o}_addImportsFromModuleMap(e,t,n,s,i,r){const a=this._stopWatch.getDurationInMilliseconds();this._moduleSymbolMap.forEach(((a,o)=>{const l=this._isStubFileOrHasInit(this._moduleSymbolMap,o);this._processModuleSymbolTable(a,o,e,t,l,n,s,i,r)})),this._perfInfo.moduleTimeInMS=this._stopWatch.getDurationInMilliseconds()-a}_isStubFileOrHasInit(e,t){const n=(0,d.getDirectoryPath)(t),s=(0,d.combinePaths)(n,"__init__.py"),i=s+"i";return{isStub:t.endsWith(".pyi"),hasInit:e.has(s)||e.has(i)}}_processModuleSymbolTable(e,t,n,s,i,r,o,l,p){(0,c.throwIfCancellationRequested)(p);const[d,m,y]=this._getImportPartsForSymbols(t);if(!d)return;const h=u.getCharacterCount(d,".");if(e.forEach(((e,a,c)=>{var p;if(this._perfIndexCount(e,c),!this._shouldIncludeVariable(e,a,i.isStub,c))return;if(!this._isSimilar(n,a,s))return;if(this._containsName(a,d,l))return;if(e.importAlias)return void this._addToImportAliasMap(e.importAlias,{importParts:{symbolName:a,importName:a,importFrom:d,filePath:t,dotCount:h,moduleNameAndType:y},importGroup:m,symbol:e.symbol,kind:e.importAlias.kind,itemKind:e.importAlias.itemKind},o);const u=this._getTextEditsForAutoImportByFilePath(d,a,r,a,m,t);this._addResult(l,{name:a,alias:r,symbol:e.symbol,source:d,kind:null!==(p=e.itemKind)&&void 0!==p?p:g(e.kind),insertionText:u.insertionText,edits:u.edits})})),!i.isStub&&!i.hasInit)return;const f=this._getImportParts(t);if(!f)return;if(!this._isSimilar(n,f.importName,s))return;this._containsName(f.importName,f.importFrom,l)||this._addToImportAliasMap({modulePath:t,originalName:f.importName,kind:a.SymbolKind.Module,itemKind:a.CompletionItemKind.Module},{importParts:f,importGroup:m,kind:a.SymbolKind.Module,itemKind:a.CompletionItemKind.Module},o)}_shouldIncludeVariable(e,t,n,s){var i;return!(!n&&e.kind===a.SymbolKind.Variable)||(!(!this._options.allowVariableInAll||s||!(null===(i=e.symbol)||void 0===i?void 0:i.isInDunderAll()))||l.isPublicConstantOrTypeAlias(t))}_addImportsFromImportAliasMap(e,t,n,s){(0,c.throwIfCancellationRequested)(s);const i=this._stopWatch.getDurationInMilliseconds();e.forEach((e=>{this._perfInfo.importAliasCount+=e.size,e.forEach((e=>{var s,i;if(t){if(this._importStatements.mapByFilePath.has(e.importParts.filePath))return;if(e.importParts.importFrom){const t=this._importStatements.orderedImports.find((t=>t.moduleName===e.importParts.importFrom));if(t&&22===t.node.nodeType&&t.node.imports.some((t=>t.name.value===e.importParts.symbolName)))return}}if(this._containsName(e.importParts.importName,e.importParts.importFrom,n))return;const r=this._getTextEditsForAutoImportByFilePath(null!==(s=e.importParts.importFrom)&&void 0!==s?s:e.importParts.importName,e.importParts.symbolName,t,e.importParts.importName,e.importGroup,e.importParts.filePath);this._addResult(n,{name:e.importParts.importName,alias:t,symbol:e.symbol,kind:null!==(i=e.itemKind)&&void 0!==i?i:g(e.kind),source:e.importParts.importFrom,insertionText:r.insertionText,edits:r.edits})}))})),this._perfInfo.importAliasTimeInMS=this._stopWatch.getDurationInMilliseconds()-i}_addToImportAliasMap(e,t,n){if(!n.has(e.modulePath)){const s=new Map;return s.set(e.originalName,t),void n.set(e.modulePath,s)}const s=n.get(e.modulePath);if(!s.has(e.originalName))return void s.set(e.originalName,t);const i=s.get(e.originalName);this._compareImportAliasData(i,t)<=0||s.set(e.originalName,t)}_compareImportAliasData(e,t){const n=e.importGroup-t.importGroup;if(0!==n)return n;const s=e.importParts.dotCount-t.importParts.dotCount;return 0!==s?s:e.symbol&&!t.symbol?-1:!e.symbol&&t.symbol?1:u.getStringComparer()(e.importParts.importName,t.importParts.importName)}_getImportPartsForSymbols(e){const t=this._importStatements.mapByFilePath.get(e);if(t)return[t.moduleName,(0,o.getImportGroup)(t),{importType:2,isLocalTypingsFile:!1,moduleName:t.moduleName}];{const t=this._getModuleNameAndTypeFromFilePath(e);return[t.moduleName,(0,o.getImportGroupFromModuleNameAndType)(t),t]}}_getImportParts(e){return t("__init__"===(0,d.stripFileExtension)((0,d.getFileName)(e))?this._getModuleNameAndTypeFromFilePath((0,d.getDirectoryPath)(e)):this._getModuleNameAndTypeFromFilePath(e));function t(t){const n=t.moduleName;if(!n)return;const s=n.lastIndexOf("."),i=s>0?n.substring(s+1):void 0,r=s>0?n.substring(0,s):void 0;return{symbolName:i,importName:null!=i?i:n,importFrom:r,filePath:e,dotCount:u.getCharacterCount(n,"."),moduleNameAndType:t}}}_isSimilar(e,t,n){if(1===n)return e===t;if(e.length<=0||t.length<=0)return!1;if(!this._options.patternMatcher){const n="_"!==e[0]&&"_"===t[0]&&t.length>1?1:0;return e[0].toLocaleLowerCase()===t[n].toLocaleLowerCase()&&u.isPatternInSymbol(e,t)}return this._options.patternMatcher(e,t)}_shouldExclude(e){return this._excludes.has(e,y.CompletionMap.labelOnlyIgnoringAutoImports)}_containsName(e,t,n){if(this._shouldExclude(e))return!0;const s=n.get(e);return!!(null==s?void 0:s.some((e=>e.source===t)))}_getModuleNameAndTypeFromFilePath(e){return this._importResolver.getModuleNameForImport(e,this._execEnvironment)}_getTextEditsForAutoImportByFilePath(e,t,n,s,i,r){var a,l,c,p,d,u;const m=this._importStatements.mapByFilePath.get(r);if(m){if(20===m.node.nodeType){const e=null===(l=null===(a=m.subnode)||void 0===a?void 0:a.alias)||void 0===l?void 0:l.value;if(t)return{insertionText:`${null!=e?e:m.moduleName}.${t}`,edits:[]};if(e)return{insertionText:`${e}`,edits:[]}}if(t&&22===m.node.nodeType&&!m.node.isWildcardImport){const i=m.node.imports.find((e=>e.name.value===t));if(i){const e=null===(c=i.alias)||void 0===c?void 0:c.value;return{insertionText:`${null!=e?e:t}`,edits:[]}}if(e===m.moduleName)return{insertionText:null!=n?n:s,edits:this._options.lazyEdit?void 0:(0,o.getTextEditsForAutoImportSymbolAddition)({name:t,alias:n},m,this._parseResults)}}}else if(t){const i=this._importStatements.orderedImports.find((t=>t.moduleName===e));if(i&&22===i.node.nodeType&&!i.node.isWildcardImport){const e=i.node.imports.find((e=>e.name.value===t));if(!e)return{insertionText:null!=n?n:s,edits:this._options.lazyEdit?void 0:(0,o.getTextEditsForAutoImportSymbolAddition)({name:t,alias:n},i,this._parseResults)};{const t=null===(p=e.alias)||void 0===p?void 0:p.value;if(t)return{insertionText:`${t}`,edits:[]}}}const a=null===(d=this._importStatements.implicitImports)||void 0===d?void 0:d.get(r);if(a){const e=null===(u=a.alias)||void 0===u?void 0:u.value;return{insertionText:`${null!=e?e:a.name.value}.${t}`,edits:[]}}}return{insertionText:null!=n?n:s,edits:this._options.lazyEdit?void 0:(0,o.getTextEditsForAutoImportInsertion)({name:t,alias:n},this._importStatements,e,i,this._parseResults,this._invocationPosition)}}_perfIndexCount(e,t){e.symbol?this._perfInfo.symbolCount++:t&&this._perfInfo.indexCount++}_addResult(e,t){let n=e.get(t.name);n||(n=[],e.set(t.name,n)),n.push(t)}},t.convertSymbolKindToCompletionItemKind=g},30424:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CallHierarchyProvider=void 0;const a=n(29335),o=r(n(88023)),l=r(n(23241)),c=n(22339),p=n(59195),d=n(10425),u=n(38213),m=n(94647),y=n(28348),h=n(80957);t.CallHierarchyProvider=class{static getCallForDeclaration(e,t,n,s){if((0,u.throwIfCancellationRequested)(s),3===t.type||4===t.type){return{name:e,kind:T(t,n),uri:t.path,range:t.range,selectionRange:t.range}}}static getIncomingCallsForDeclaration(e,t,n,s,i,r){(0,u.throwIfCancellationRequested)(r);const a=new f(e,t,n,s,i,r).findCalls();return a.length>0?a:void 0}static getOutgoingCallsForDeclaration(e,t,n,s){let i;if((0,u.throwIfCancellationRequested)(s),3===e.type)i=e.node;else if(4===e.type){const t=n.getTypeForDeclaration(e);if(t&&(0,p.isInstantiableClass)(t)){const e=(0,d.lookUpClassMember)(t,"__init__",14);if(e){const t=n.getTypeOfMember(e);if(t&&(0,p.isFunction)(t)){const t=e.symbol.getDeclarations();if(t&&t.length>0){const e=t[0];3===e.type&&(i=e.node)}}}}}if(!i)return;const r=new g(i,t,n,s).findCalls();return r.length>0?r:void 0}static getTargetDeclaration(e,t){let n=e[0];for(const s of e)if((o.hasTypeForDeclaration(s)||!o.hasTypeForDeclaration(n))&&(3===s.type||4===s.type)&&(n=s,s.node===t))break;return n}};class g extends c.ParseTreeWalker{constructor(e,t,n,s){super(),this._parseRoot=e,this._parseResults=t,this._evaluator=n,this._cancellationToken=s,this._outgoingCalls=[]}findCalls(){return this.walk(this._parseRoot),this._outgoingCalls}visitCall(e){let t;if((0,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){(0,u.throwIfCancellationRequested)(this._cancellationToken);const t=this._evaluator.getType(e.leftExpression);return t&&(0,d.doForEachSubtype)(t,(t=>{let n=t;if(n=this._evaluator.makeTopLevelTypeVarsConcrete(n),!(0,p.isClassInstance)(n))return;const s=(0,d.lookUpObjectMember)(n,e.memberName.value);if(!s)return;const i=this._evaluator.getTypeOfMember(s),r=s.symbol.getDeclarations();i&&(0,p.isClassInstance)(i)&&p.ClassType.isPropertyClass(i)&&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 s={name:e.value,kind:T(n,this._evaluator),uri:n.path,range:n.range,selectionRange:n.range};let i=this._outgoingCalls.find((e=>e.to.uri===s.uri&&(0,h.rangesAreEqual)(e.to.range,s.range)));i||(i={to:s,fromRanges:[]},this._outgoingCalls.push(i));const r=(0,y.convertOffsetsToRange)(e.start,e.start+e.length,this._parseResults.tokenizerOutput.lines);i.fromRanges.push(r)}}class f extends c.ParseTreeWalker{constructor(e,t,n,s,i,r){super(),this._filePath=e,this._symbolName=t,this._declaration=n,this._parseResults=s,this._evaluator=i,this._cancellationToken=r,this._incomingCalls=[]}findCalls(){return this.walk(this._parseResults.parseTree),this._incomingCalls}visitCall(e){let t;if((0,u.throwIfCancellationRequested)(this._cancellationToken),38===e.leftExpression.nodeType?t=e.leftExpression:35===e.leftExpression.nodeType&&(t=e.leftExpression.memberName),t&&t.value===this._symbolName){const e=this._evaluator.getDeclarationsForNameNode(t);if(e){e.map((e=>this._evaluator.resolveAliasDeclaration(e,!0))).filter((e=>void 0!==e)).some((e=>o.areDeclarationsSame(e,this._declaration)))&&this._addIncomingCallForDeclaration(t)}}return!0}visitMemberAccess(e){if((0,u.throwIfCancellationRequested)(this._cancellationToken),e.memberName.value===this._symbolName){const t=this._evaluator.getType(e.leftExpression);t&&(0,d.doForEachSubtype)(t,(t=>{let n=t;if(n=this._evaluator.makeTopLevelTypeVarsConcrete(n),!(0,p.isClassInstance)(n))return;const s=(0,d.lookUpObjectMember)(n,e.memberName.value);if(!s)return;const i=this._evaluator.getTypeOfMember(s),r=s.symbol.getDeclarations();i&&r.some((e=>o.areDeclarationsSame(e,this._declaration)))&&this._addIncomingCallForDeclaration(e.memberName)}))}return!0}_addIncomingCallForDeclaration(e){const t=l.getExecutionScopeNode(e);if(!t)return;let n;if(36===t.nodeType){const e=(0,y.convertOffsetsToRange)(0,0,this._parseResults.tokenizerOutput.lines),t=(0,m.getFileName)(this._filePath);n={name:`(module) ${t}`,kind:a.SymbolKind.Module,uri:this._filePath,range:e,selectionRange:e}}else if(30===t.nodeType){const e=(0,y.convertOffsetsToRange)(t.start,t.start+t.length,this._parseResults.tokenizerOutput.lines);n={name:"(lambda)",kind:a.SymbolKind.Function,uri:this._filePath,range:e,selectionRange:e}}else{const e=(0,y.convertOffsetsToRange)(t.name.start,t.name.start+t.name.length,this._parseResults.tokenizerOutput.lines);n={name:t.name.value,kind:a.SymbolKind.Function,uri:this._filePath,range:e,selectionRange:e}}let s=this._incomingCalls.find((e=>e.from.uri===n.uri&&(0,h.rangesAreEqual)(e.from.range,n.range)));s||(s={from:n,fromRanges:[]},this._incomingCalls.push(s));const i=(0,y.convertOffsetsToRange)(e.start,e.start+e.length,this._parseResults.tokenizerOutput.lines);s.fromRanges.push(i)}}function T(e,t){let n;switch(e.type){case 4:case 5:n=a.SymbolKind.Class;break;case 3:if(e.isMethod){const s=t.getTypeForDeclaration(e);n=s&&(0,d.isProperty)(s)?a.SymbolKind.Property:a.SymbolKind.Method}else n=a.SymbolKind.Function;break;default:n=a.SymbolKind.Function}return n}},70926:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CodeActionProvider=void 0;const s=n(29335),i=n(38213),r=n(94647),a=n(74426);t.CodeActionProvider=class{static async getCodeActionsForPosition(e,t,n,o){(0,i.throwIfCancellationRequested)(o);const l=[];if(!e.disableLanguageServices){const i=await e.serviceInstance.getDiagnosticsForRange(t,n,o),c=i.find((e=>{const t=e.getActions();return t&&t.find((e=>"pyright.createtypestub"===e.action))}));if(c){const n=c.getActions().find((e=>"pyright.createtypestub"===e.action));if(n){const i=s.CodeAction.create(a.Localizer.CodeAction.createTypeStubFor().format({moduleName:n.moduleName}),s.Command.create(a.Localizer.CodeAction.createTypeStub(),"pyright.createtypestub",e.rootPath,n.moduleName,t),s.CodeActionKind.QuickFix);l.push(i)}}const p=i.find((e=>{const t=e.getActions();return t&&t.find((e=>"pyright.addoptionalforparam"===e.action))}));if(p){const n=p.getActions().find((e=>"pyright.addoptionalforparam"===e.action));if(n){const i=e.serviceInstance.getImportResolver().fileSystem,o=s.CodeAction.create(a.Localizer.CodeAction.addOptionalToAnnotation(),s.Command.create(a.Localizer.CodeAction.addOptionalToAnnotation(),"pyright.addoptionalforparam",(0,r.convertPathToUri)(i,t),n.offsetOfTypeNode),s.CodeActionKind.QuickFix);l.push(o)}}}return l}}},80088:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.CompletionMap=t.CompletionProvider=t.dictionaryKeyDetail=t.autoImportDetail=void 0;const a=n(29335),o=r(n(35696)),l=n(16800),c=n(88023),p=n(21736),d=r(n(23241)),u=n(23241),m=n(57203),y=n(93989),h=r(n(91197)),g=n(15020),f=n(22387),T=n(58333),_=n(22105),v=n(59195),b=n(10425),I=n(38213),C=n(9133),S=r(n(20823)),F=n(20823),x=n(13727),D=n(28348),P=n(57485),A=r(n(14551)),E=n(80957),k=n(80957),w=n(76962),N=n(55390),M=n(82615),R=n(9272),O=n(31807);var L,V;!function(e){const t=["True","False","None","and","or","not","is","lambda","yield","assert","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","nonlocal","pass","raise","return","try","while","with"],n=[...t,"async","await"],s=[...n,"case","match"];e.forVersion=function(e){return e>=P.PythonVersion.V3_10?s:e>=P.PythonVersion.V3_5?n:t}}(L||(L={})),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.EnumMember=8]="EnumMember",e[e.NormalSymbol=9]="NormalSymbol",e[e.PrivateSymbol=10]="PrivateSymbol",e[e.DunderSymbol=11]="DunderSymbol",e[e.AutoImport=12]="AutoImport"}(V||(V={})),t.autoImportDetail="Auto-import",t.dictionaryKeyDetail="Dictionary key";class U{constructor(e,t,n,s,i,r,a,o,l,c,p,d,u){this._workspacePath=e,this._parseResults=t,this._fileContents=n,this._importResolver=s,this._position=i,this._filePath=r,this._configOptions=a,this._importLookup=o,this._evaluator=l,this._options=c,this._sourceMapper=p,this._autoImportMaps=d,this._cancellationToken=u,this._insideStringLiteral=!1,this._execEnv=this._configOptions.findExecEnvironment(this._filePath)}getCompletionsForPosition(){var e,t;const n=(0,D.convertPositionToOffset)(this._position,this._parseResults.tokenizerOutput.lines);if(void 0===n)return;const s=d.getTokenOverlapping(this._parseResults.tokenizerOutput.tokens,n);5===(null==s?void 0:s.type)&&(this._insideStringLiteral=!!k.TextRange.contains(s,n)||!!(65536&s.flags));let i=d.findNodeByOffset(this._parseResults.parseTree,n);const r=i,a=i?d.getNodeDepth(i):0;if(!r||38!==r.nodeType){let t=n,s=!1;for(;t>=0;){t--;const n=this._fileContents.substr(t,1);if("("===n||"\n"===n||"}"===n)break;","===n&&(s=!0);const o=d.findNodeByOffset(this._parseResults.parseTree,t);if(o&&o!==r){d.getNodeDepth(o)>a&&(i=o,s&&23===(null===(e=i.parent)||void 0===e?void 0:e.nodeType)&&(i=i.parent));break}}}if(void 0===i)return;const o=this._parseResults.tokenizerOutput.lines.getItemAt(this._position.line),l=this._fileContents.substr(o.start,o.length),c=l.substr(0,this._position.character),p=l.substr(this._position.character),u=c.search(/\w+$/),m=u>=0?c.substr(u):"";if(this._isWithinComment(n))return;let y=i;for(;y&&0!==y.nodeType;)y=y.parent;let h=y||i;for(;;){if((0,I.throwIfCancellationRequested)(this._cancellationToken),49===h.nodeType)return this._getLiteralCompletions(h,m,c,p);if(48===h.nodeType||27===h.nodeType)return;if(37===h.nodeType)return this._getImportModuleCompletions(h);if(0===h.nodeType)return this._getExpressionErrorCompletions(h,m,c,p);if(35===h.nodeType)return this._getMemberAccessCompletions(h.leftExpression,m);if(15===h.nodeType){const e=new z;if(this._addTypedDictKeys(h,void 0,c,p,e))return{completionMap:e}}const e=d.getFirstAncestorOrSelfOfKind(h,17);if(e&&15===(null===(t=e.parent)||void 0===t?void 0:t.nodeType)){const t=e.parent;if(t.trailingCommaToken&&t.trailingCommaToken.start<n){const e=new z;if(this._addTypedDictKeys(t,void 0,c,p,e))return{completionMap:e}}}if(38===h.nodeType){const e=this._tryGetNameCompletions(h,n,m,c,p);if(e||void 0===e)return e}if(22===h.nodeType)return this._getImportFromCompletions(h,m);if((0,N.isExpressionNode)(h))return this._getExpressionCompletions(h,m,c,p);if(50===h.nodeType){if(h.parent&&25===h.parent.nodeType&&!h.parent.name&&h.parent.typeExpression&&k.TextRange.getEnd(h.parent.typeExpression)<n&&n<=h.parent.exceptSuite.start)return;if(h.parent&&10===h.parent.nodeType&&(!h.parent.name||!h.parent.name.value)&&0===h.parent.arguments.length&&n<=h.parent.suite.start)return;return this._getStatementCompletions(h,m,c,p)}if(36===h.nodeType)return this._getStatementCompletions(h,m,c,p);if(41===h.nodeType&&0===h.length&&h.parent&&30===h.parent.nodeType)return;if(!h.parent)break;h=h.parent}}resolveCompletionItem(e){(0,I.throwIfCancellationRequested)(this._cancellationToken);const t=(0,x.fromLSPAny)(e.data),n=e.label;let s="";t.autoImportText&&(s=t.autoImportText);const i=U._mostRecentCompletions.findIndex((e=>e.label===n&&e.autoImportText===s));if(i>0&&(U._mostRecentCompletions=U._mostRecentCompletions.splice(i,1)),0!==i&&U._mostRecentCompletions.unshift({label:n,autoImportText:s}),U._mostRecentCompletions.length>128&&U._mostRecentCompletions.pop(),t.symbolLabel)if(this._itemToResolve=e,t.autoImportText){if(!e.additionalTextEdits){const e={completionMap:new z};this._addAutoImportCompletions(t.symbolLabel,1,!1,e)}}else this.getCompletionsForPosition()}_tryGetNameCompletions(e,t,n,s,i){var r;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&&k.TextRange.getEnd(e.parent.parent)<t)return;return this._getImportModuleCompletions(e.parent)}if(23===e.parent.nodeType){if(e.parent.alias===e)return;const s=e.parent.parent;if(s&&22===s.nodeType){if(!e.parent.alias&&k.TextRange.getEnd(e.parent)<t)return;return e.parent.name===e?this._getImportFromCompletions(s,n):this._getImportFromCompletions(s,"")}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===(r=e.parent.decorators)||void 0===r?void 0:r.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&&k.TextRange.contains(e.parent.targetExpression,e.start)||33===e.parent.nodeType&&k.TextRange.contains(e.parent.targetExpression,e.start))){if(3===e.parent.nodeType||4===e.parent.nodeType){if((4===e.parent.nodeType?e.parent.name:e.parent.leftExpression)!==e||0===n.length)return!1;const t=this._evaluator.getDeclarationsForNameNode(e);if(1!==(null==t?void 0:t.length)||!(0,l.isVariableDeclaration)(t[0])||t[0].node!==e)return!1;const r=this._getExpressionCompletions(e,n,s,i);return(null==r?void 0:r.completionMap)&&r.completionMap.delete(e.value),r}return!1}}}}_isWithinComment(e){var t,n;const s=function(e,t){const n=t.getItemAtPosition(e);if(n<0)return;let s=t.getItemAt(n);if(e>s.start&&e<s.start+s.length)return;for(let e=n-1;e>=0;e--){const n=t.getItemAt(e);if(s.start!==n.start)break;s=n}if(e<=s.start)return s;return S.assert(n+1<t.length),t.getItemAt(n+1)}(e,this._parseResults.tokenizerOutput.tokens);return!!s&&(null!==(n=null===(t=s.comments)||void 0===t?void 0:t.some((t=>k.TextRange.overlaps(t,e))))&&void 0!==n&&n)}_getExpressionErrorCompletions(e,t,n,s){var i;switch(e.category){case 0:return this._createSingleKeywordCompletion("in");case 1:return this._createSingleKeywordCompletion("else");case 2:case 4:return this._getExpressionCompletions(e,t,n,s);case 3:{let i=this._getLiteralCompletions(e,t,n,s);return i&&i.completionMap||(i=this._getExpressionCompletions(e,t,n,s)),i}case 7:if(e.child&&(0,N.isExpressionNode)(e.child))return this._getMemberAccessCompletions(e.child,t);break;case 10:if(e.child&&38===e.child.nodeType)return(null===(i=e.decorators)||void 0===i?void 0:i.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}_createSingleKeywordCompletion(e){const t=a.CompletionItem.create(e);t.kind=a.CompletionItemKind.Keyword,t.sortText=this._makeSortText(V.LikelyKeyword,e);const n=new z;return n.set(t),{completionMap:n}}_getMethodOverloadsCompletions(e,t){var n;const s=function(e,t){const n=d.getEnclosingClass(t,!1);if(n){const t=e.getTypeOfClass(n);if(!t)return;const s=new Map;for(const e of t.classType.details.mro)(0,v.isInstantiableClass)(e)&&(0,b.getMembersForClass)(e,s,!1);return s}const s=d.getEnclosingModule(t);if(s){const e=o.getScope(s);return null==e?void 0:e.symbolTable}return}(this._evaluator,t);if(!s)return;const i=28===(null===(n=t.parent)||void 0===n?void 0:n.nodeType)||void 0,r=new z,a=d.getEnclosingFunction(t);return s.forEach(((n,s)=>{const o=(0,g.getLastTypedDeclaredForSymbol)(n);if(!o||3!==o.type)return;if(!o.node.decorators.some((e=>this._isOverload(e))))return;const l=n.getDeclarations();if((1!==l.length||!l.some((e=>e.node===a)))&&A.isPatternInSymbol(t.value,s)){const a=this._createReplaceEdits(e,t,o.node.name.value);this._addSymbol(s,n,t.value,r,{funcParensDisabled:i,edits:{textEdit:a}})}})),{completionMap:r}}_getMethodOverrideCompletions(e,t,n){var s,i;const r=d.getEnclosingClass(t,!0);if(!r)return;const o=this._evaluator.getTypeOfClass(r);if(!o)return;const l=new Map;for(let e=1;e<o.classType.details.mro.length;e++){const t=o.classType.details.mro[e];(0,v.isInstantiableClass)(t)&&(0,b.getMembersForClass)(t,l,!1)}const c=null!==(s=null==n?void 0:n.some((e=>this._checkDecorator(e,"staticmethod"))))&&void 0!==s&&s,p=null!==(i=null==n?void 0:n.some((e=>this._checkDecorator(e,"classmethod"))))&&void 0!==i&&i,u=new z;return l.forEach(((n,s)=>{let i=(0,g.getLastTypedDeclaredForSymbol)(n);if(i&&3===i.type&&A.isPatternInSymbol(t.value,s)){const r=this._evaluator.getTypeForDeclaration(i);if(!r)return;let l=(0,v.isClassInstance)(r)&&v.ClassType.isPropertyClass(r);if(h.isDunderName(s)&&(l=!1),!(0,v.isFunction)(r)&&!l)return;if(l){const e=n.getTypedDeclarations();e.length>0&&3===e[0].type&&(i=e[0])}const d=(0,v.isFunction)(r)&&v.FunctionType.isStaticMethod(r),m=(0,v.isFunction)(r)&&v.FunctionType.isClassMethod(r)&&"__init_subclass__"!==s;if(c!==d||p!==m)return;const g=this._printMethodSignature(o.classType,i);let f;if((0,y.isStubFile)(this._filePath))f=`${g}: ...`;else{f=`${g}:\n${this._printOverriddenMethodBody(o.classType,d,l,i)}`}const T=this._createReplaceEdits(e,t,f);this._addSymbol(s,n,t.value,u,{funcParensDisabled:!0,edits:{format:this._options.snippet?a.InsertTextFormat.Snippet:void 0,textEdit:T}})}})),{completionMap:u}}_createReplaceEdits(e,t,n){const s=38===(null==t?void 0:t.nodeType)?this._position.character-e.length+t.value.length:this._position.character,i={start:{line:this._position.line,character:this._position.character-e.length},end:{line:this._position.line,character:s}};return a.TextEdit.replace(i,n)}_printMethodSignature(e,t){const n=t.node;let s;(0,y.isStubFile)(this._filePath)?s=!0:e.details.moduleName===t.moduleName&&(s=!1);const i=(0,y.isStubFile)(this._filePath)?1:void 0,r=n.parameters.map(((e,t)=>{let r="";1===e.category?r+="*":2===e.category&&(r+="**"),e.name&&(r+=e.name.value);const a=d.getTypeAnnotationForParameter(n,t);if(a&&(r+=": "+d.printExpression(a,i)),e.defaultValue){r+=a?" = ":"=";r+=(null!=s?s:!o(e.defaultValue))?"...":d.printExpression(e.defaultValue,i)}return r||e.name||0!==e.category?r:"/"})).join(", ");let a=n.name.value+"("+r+")";return n.returnTypeAnnotation?a+=" -> "+d.printExpression(n.returnTypeAnnotation,i):n.functionAnnotationComment&&(a+=" -> "+d.printExpression(n.functionAnnotationComment.returnTypeAnnotation,i)),a;function o(e){switch(e.nodeType){case 40:case 11:return!0;case 49:return 0==(64&e.token.flags);case 48:return e.strings.every(o);case 55:return o(e.expression);case 7:return o(e.leftExpression)&&o(e.rightExpression);default:return!1}}}_printOverriddenMethodBody(e,t,n,s){let i=" ";if(1===e.details.baseClasses.length&&(0,v.isClass)(e.details.baseClasses[0])&&"builtins.object"===e.details.baseClasses[0].details.fullName)return i+=this._options.snippet?"${0:pass}":"pass",i;if(0===s.node.parameters.length)return i+=this._options.snippet?"${0:pass}":"pass",i;const r=function(e){const t=[];let n=!1;for(const s of e)s.name&&t.push([s,n]),n=1===s.category||2===s.category;return t}(t?s.node.parameters:s.node.parameters.slice(1));return"__init__"!==s.node.name.value&&(i+="return "),s.node.isAsync&&(i+="await "),n?i+`super().${s.node.name.value}`:i+`super().${s.node.name.value}(${r.map((function(e){var t;const n=null===(t=e[0].name)||void 0===t?void 0:t.value;if(1===e[0].category)return`*${n}`;if(2===e[0].category)return`**${n}`;return e[1]?`${n}=${n}`:n})).join(", ")})`}_getMemberAccessCompletions(e,t){const n=new Map,s=new z;let i={},r=this._evaluator.getType(e);return r&&(r=this._evaluator.makeTopLevelTypeVarsConcrete(r),(0,b.doForEachSubtype)(r,(i=>{if(i=this._evaluator.makeTopLevelTypeVarsConcrete(i),(0,v.isClass)(i))(0,b.getMembersForClass)(i,n,v.TypeBase.isInstance(i));else if((0,v.isModule)(i))(0,b.getMembersForModule)(i,n);else if((0,v.isFunction)(i)||(0,v.isOverloadedFunction)(i)){const t=this._evaluator.getBuiltInType(e,"function");t&&(0,v.isInstantiableClass)(t)&&(0,b.getMembersForClass)(t,n,!0)}else if((0,v.isNoneInstance)(i)){const t=this._evaluator.getBuiltInType(e,"object");t&&(0,v.isInstantiableClass)(t)&&(0,b.getMembersForClass)(t,n,v.TypeBase.isInstance(i))}this._addSymbolsForSymbolTable(n,(()=>!0),t,!1,(0,v.isClass)(i)?i:void 0,s)}))),(!r||(0,v.isUnknown)(r)||(0,v.isUnbound)(r))&&(i=this._getLastKnownModule(e,r)),{completionMap:s,memberAccessInfo:i}}_getLastKnownModule(e,t){var n;let s=e,i=t,r=35===e.nodeType?null==e?void 0:e.memberName.value:void 0;for(;s&&(9===s.nodeType||35===s.nodeType?(s=s.leftExpression,void 0===r&&(r=35===s.nodeType&&null!==(n=null==s?void 0:s.memberName.value)&&void 0!==n?n:"")):s=void 0,!s||(i=this._evaluator.getType(s),void 0===i||(0,v.isUnknown)(i)||(0,v.isUnbound)(i))););const a={};if(i&&!(0,v.isUnknown)(i)&&!(0,v.isUnbound)(i)&&s){const e=(0,b.getDeclaringModulesForType)(i);a.lastKnownModule=e.find((e=>"typing"!==e)),35===s.nodeType?a.lastKnownMemberName=s.memberName.value:(38===s.nodeType&&(0,v.isInstantiableClass)(i)||38===s.nodeType&&(0,v.isClassInstance)(i))&&(a.lastKnownMemberName=i.details.name),a.unknownMemberName=r}return a}_getStatementCompletions(e,t,n,s){return this._getExpressionCompletions(e,t,n,s)}_getExpressionCompletions(e,n,s,i){var r,o,l,c;const p=this._isIndexArgument(e);if(!p&&40===e.nodeType)return;if(59===(null===(r=e.parent)||void 0===r?void 0:r.nodeType)&&e.parent===(null===(o=e.parent.target)||void 0===o?void 0:o.parent))return;const d=new z,u={completionMap:d};if(".."===s.slice(-2))return u;if(this._addCallArgumentCompletions(e,n,s,i,!1,d),this._addSymbols(e,n,d),this._findMatchingKeywords(L.forVersion(this._execEnv.pythonVersion),n).map((e=>{if(d.has(e))return;const t=a.CompletionItem.create(e);t.kind=a.CompletionItemKind.Keyword,t.sortText=this._makeSortText(V.Keyword,e),d.set(t)})),n.startsWith("_")||this._itemToResolve||this._addAutoImportCompletions(n,.25,this._options.lazyEdit,u),0===e.nodeType)if(3===e.category&&24===(null===(l=e.parent)||void 0===l?void 0:l.nodeType))this._tryAddTypedDictStringLiteral(e.parent,void 0,void 0,d);else if(2===e.category&&e.parent&&3===e.parent.nodeType){const t=null===(c=this._evaluator.getExpectedType(e))||void 0===c?void 0:c.type;t&&this._addLiteralValuesForTargetType(t,s,n,i,d)}if(p){const s=e.parent.parent;this._getIndexerKeys(s,e).forEach((e=>{d.has(e)||this._addNameToCompletions(e,a.CompletionItemKind.Constant,n,d,{sortText:this._makeSortText(V.LiteralValue,e),itemDetail:t.dictionaryKeyDetail})}))}return u}_isIndexArgument(e){const t=e.parent;return t&&1===t.nodeType&&0===t.argumentCategory&&t.parent&&24===t.parent.nodeType&&t.parent.baseExpression&&38===t.parent.baseExpression.nodeType}_addCallArgumentCompletions(e,t,n,s,i,r){const a=(0,D.convertPositionToOffset)(this._position,this._parseResults.tokenizerOutput.lines),o=(0,u.getCallNodeAndActiveParameterIndex)(e,a,this._parseResults.tokenizerOutput.tokens);if(!o)return;const l=this._evaluator.getCallSignatureInfo(o.callNode,o.activeIndex,o.activeOrFake);if(l){const e=(0,D.convertOffsetToPosition)(l.callNode.leftExpression.start+l.callNode.leftExpression.length,this._parseResults.tokenizerOutput.lines);(0,E.comparePositions)(this._position,e)>0&&(i||this._addNamedParameters(l,t,r),this._addLiteralValuesForArgument(l,n,t,s,r))}}_addLiteralValuesForArgument(e,t,n,s,i){e.signatures.forEach((e=>{if(!e.activeParam)return;const r=e.type,a=r.details.parameters.indexOf(e.activeParam);if(a<0)return;const o=r.details.parameters[a].type;this._addLiteralValuesForTargetType(o,t,n,s,i)}))}_addLiteralValuesForTargetType(e,t,n,s,i){const r=this._getQuoteValueFromPriorText(t);this._getSubTypesWithLiteralValues(e).forEach((e=>{if(v.ClassType.isBuiltIn(e,"str")){const t=(0,_.printLiteralValue)(e,r.quoteCharacter);void 0===r.stringValue?this._addNameToCompletions(t,a.CompletionItemKind.Constant,n,i,{sortText:this._makeSortText(V.LiteralValue,e.literalValue)}):this._addStringLiteralToCompletions(t.substr(1,t.length-2),r.stringValue,s,r.quoteCharacter,i)}}))}_getDictExpressionStringKeys(e,t){const n=function(e){if(15===e.nodeType)return e;let t=e;for(;t&&15!==t.nodeType&&45!==t.nodeType;)if(t=t.parent,!t)return;return t}(e);return n?n.entries.flatMap((e=>17!==e.nodeType||(null==t?void 0:t.has(e.keyExpression.id))?[]:48===e.keyExpression.nodeType?[e.keyExpression.strings.map((e=>e.value)).join("")]:[])):[]}_getSubTypesWithLiteralValues(e){const t=[];return(0,b.doForEachSubtype)(e,(e=>{(0,v.isClassInstance)(e)&&(0,b.isLiteralType)(e)&&t.push(e)})),t}_getIndexerKeyType(e){var t;if((v.ClassType.isBuiltIn(e,"dict")||v.ClassType.isBuiltIn(e,"Mapping"))&&2===(null===(t=e.typeArguments)||void 0===t?void 0:t.length))return e.typeArguments[0];const n=(0,b.lookUpObjectMember)(e,"__getitem__");if(null==n?void 0:n.symbol.hasDeclarations()){const e=n.symbol.getDeclarations()[0];if((0,l.isFunctionDeclaration)(e)&&e.isMethod){const t=this._evaluator.getTypeForDeclaration(e);if(t&&(0,v.isFunction)(t)&&2===t.details.parameters.length)return t.details.parameters[1].type}}}_getIndexerKeys(e,t){var n,s,i,r,a,o,l,c,p;if(38!==e.baseExpression.nodeType)return[];const u=this._evaluator.getType(e.baseExpression);if(!u||!(0,v.isClassInstance)(u))return[];const m=this._getIndexerKeyType(u);if(m){const e=[];if(this._getSubTypesWithLiteralValues(m).forEach((t=>{(v.ClassType.isBuiltIn(t,"str")||v.ClassType.isBuiltIn(t,"int")||v.ClassType.isBuiltIn(t,"bool")||v.ClassType.isBuiltIn(t,"bytes")||v.ClassType.isEnumClass(t))&&e.push((0,_.printLiteralValue)(t,this._parseResults.tokenizerOutput.predominantSingleQuoteCharacter))})),e.length>0)return e}const y=null!==(n=this._evaluator.getDeclarationsForNameNode(e.baseExpression))&&void 0!==n?n:[],h=y.length>0?y[0]:void 0;if(!h||1!==h.type&&2!==h.type)return[];if(h.path!==this._filePath)return[];let g=e.baseExpression;if(h.node){const e=d.getEvaluationScopeNode(h.node);(null===(s=d.getFileInfoFromNode(g))||void 0===s?void 0:s.filePath)===(null===(i=d.getFileInfoFromNode(e))||void 0===i?void 0:i.filePath)&&(g=e)}const f=R.DocumentSymbolCollector.collectFromNode(e.baseExpression,this._evaluator,this._cancellationToken,g),T=new Set;for(const e of f){const n=54===(null===(r=e.node.parent)||void 0===r?void 0:r.nodeType)?e.node.parent:e.node;if(3===(null===(a=n.parent)||void 0===a?void 0:a.nodeType)||4===(null===(o=n.parent)||void 0===o?void 0:o.nodeType)){if(15===n.parent.rightExpression.nodeType){const e=n.parent.rightExpression;for(const t of e.entries.filter((e=>17===e.nodeType))){const e=this._parseResults.text.substr(t.keyExpression.start,t.keyExpression.length).trim();e.length>0&&T.add(e)}}if(9===n.parent.rightExpression.nodeType){const e=n.parent.rightExpression,t=this._evaluator.getType(e.leftExpression);if(!t||!(0,v.isInstantiableClass)(t)||!v.ClassType.isBuiltIn(t,"dict"))continue;for(const t of e.arguments){const e=null!==(c=null===(l=t.name)||void 0===l?void 0:l.value.trim())&&void 0!==c?c:"",n=this._parseResults.tokenizerOutput.predominantSingleQuoteCharacter;e.length>0&&T.add(`${n}${e}${n}`)}}}if(24===(null===(p=n.parent)||void 0===p?void 0:p.nodeType)&&1===n.parent.items.length&&0!==n.parent.items[0].valueExpression.nodeType&&!k.TextRange.containsRange(n.parent,t)){const e=n.parent.items[0],t=this._parseResults.text.substr(e.valueExpression.start,e.valueExpression.length).trim();t.length>0&&T.add(t)}}return[...T]}_getLiteralCompletions(e,n,s,i){var r,o,l;let c=e.parent;if(!c)return;const p=new z;if((0,N.isExpressionNode)(c)){const t=this._evaluator.getExpectedType(c);if(t&&(0,b.isLiteralTypeOrUnion)(t.type))return this._addLiteralValuesForTargetType(t.type,s,n,i,p),{completionMap:p};if(49===e.nodeType&&(null===(r=e.parent)||void 0===r?void 0:r.parent)){const t=e.parent.parent;let n;if(17===t.nodeType&&t.keyExpression===e.parent&&15===(null===(o=t.parent)||void 0===o?void 0:o.nodeType)?n=t.parent:45===(null==t?void 0:t.nodeType)&&(n=t),n&&this._addTypedDictKeys(n,e,s,i,p))return{completionMap:p}}}if(1!==c.nodeType){if(48!==c.nodeType||c.strings.length>1)return;if(c=c.parent,!c)return}if(1===c.nodeType&&24===(null===(l=c.parent)||void 0===l?void 0:l.nodeType)){if(!this._tryAddTypedDictStringLiteral(c.parent,49===e.nodeType?s:"",i,p)){const r=this._getIndexerKeys(c.parent,e),o=this._getQuoteValueFromPriorText(s);for(const s of r){const r=/^["|'].*["|']$/.test(s);if(49!==e.nodeType||r)if(r){const e=s.substr(1,s.length-2);this._addStringLiteralToCompletions(e,o.stringValue,i,o.quoteCharacter,p,t.dictionaryKeyDetail)}else this._addNameToCompletions(s,a.CompletionItemKind.Constant,n,p,{sortText:this._makeSortText(V.LiteralValue,s),itemDetail:t.dictionaryKeyDetail})}if(0===p.size)return}}else{S.assert(49===e.nodeType);const t=(0,D.convertPositionToOffset)(this._position,this._parseResults.tokenizerOutput.lines),r=c.start<t&&t<k.TextRange.getEnd(e);this._addCallArgumentCompletions(e,n,s,i,r,p)}return{completionMap:p}}_addTypedDictKeys(e,t,n,s,i){var r;const a=this._evaluator.getExpectedType(e);if(!a)return!1;if(d.getNodeDepth(a.node)<d.getNodeDepth(e))return!1;let o=[];if((0,b.doForEachSubtype)(a.type,(e=>{(0,v.isClassInstance)(e)&&v.ClassType.isTypedDictClass(e)&&o.push(e)})),0===o.length)return!1;const l=this._getDictExpressionStringKeys(e,t?new Set([null===(r=t.parent)||void 0===r?void 0:r.id]):void 0);o=this._tryNarrowTypedDicts(o,l);const c=this._getQuoteValueFromPriorText(n),p=new Set(l);return o.forEach((e=>{(0,f.getTypedDictMembersForClass)(this._evaluator,e,!0).forEach(((e,t)=>{p.has(t)||i.has(t)||(p.add(t),this._addStringLiteralToCompletions(t,c?c.stringValue:void 0,s,c?c.quoteCharacter:this._parseResults.tokenizerOutput.predominantSingleQuoteCharacter,i))}))})),!0}_tryNarrowTypedDicts(e,t){const n=e.flatMap((e=>{const n=(0,f.getTypedDictMembersForClass)(this._evaluator,e,!0);for(let e=0;e<t.length;e++)if(!n.has(t[e]))return[];return[e]}));return 0===n.length?e:n}_getQuoteValueFromPriorText(e){if(this._insideStringLiteral){const t=e.lastIndexOf("'"),n=e.lastIndexOf('"');if(t>n)return{quoteCharacter:"'",stringValue:e.substr(t+1)};if(n>t)return{quoteCharacter:'"',stringValue:e.substr(n+1)}}return{stringValue:undefined,quoteCharacter:this._parseResults.tokenizerOutput.predominantSingleQuoteCharacter}}_tryAddTypedDictStringLiteral(e,t,n,s){if(!e)return!1;const i=this._evaluator.getType(e.baseExpression);if(!i||!(0,v.isClassInstance)(i))return!1;if(!v.ClassType.isTypedDictClass(i))return!1;const r=(0,f.getTypedDictMembersForClass)(this._evaluator,i,!0),a=t?this._getQuoteValueFromPriorText(t):void 0;return r.forEach(((e,t)=>{this._addStringLiteralToCompletions(t,a?a.stringValue:void 0,n,a?a.quoteCharacter:this._parseResults.tokenizerOutput.predominantSingleQuoteCharacter,s)})),!0}_addStringLiteralToCompletions(e,t,n,s,i,r){if(A.isPatternInSymbol(t||"",e)){const o=`${s}${e}${s}`;if(i.has(o))return;const l=a.CompletionItem.create(o);l.kind=a.CompletionItemKind.Constant,l.sortText=this._makeSortText(V.LiteralValue,o);let c=this._position.character;void 0!==t&&(c-=t.length+1);let p=this._position.character;void 0!==n&&n.startsWith(s)&&p++;const d={start:{line:this._position.line,character:c},end:{line:this._position.line,character:p}};l.textEdit=a.TextEdit.replace(d,o),l.detail=r,i.set(l)}}_addAutoImportCompletions(e,t,n,s){var i,r,o;if(!s.completionMap||!this._configOptions.autoImportCompletions||!this._options.autoImport)return;const l=this._autoImportMaps.getModuleSymbolsMap(),c=new M.AutoImporter(this._execEnv,this._importResolver,this._parseResults,this._position,s.completionMap,l,{libraryMap:this._autoImportMaps.libraryMap,lazyEdit:n}),p=[],d=null===(i=this._autoImportMaps.nameMap)||void 0===i?void 0:i.get(e);d&&e.length>1&&!s.completionMap.has(e)&&(0,C.appendArray)(p,c.getAutoImportCandidatesForAbbr(e,d,this._cancellationToken)),p.push(...c.getAutoImportCandidates(e,t,void 0,this._cancellationToken));const u=c.getPerfInfo(),m=new w.Duration;for(const t of p)t.symbol?this._addSymbol(t.name,t.symbol,e,s.completionMap,{autoImportSource:t.source,autoImportAlias:t.alias,edits:{textEdit:this._createReplaceEdits(e,void 0,t.insertionText),additionalTextEdits:t.edits}}):this._addNameToCompletions(null!==(r=t.alias)&&void 0!==r?r:t.name,null!==(o=t.kind)&&void 0!==o?o:a.CompletionItemKind.Module,e,s.completionMap,{autoImportText:this._getAutoImportText(t.name,t.source,t.alias),edits:{textEdit:this._createReplaceEdits(e,void 0,t.insertionText),additionalTextEdits:t.edits}});s.autoImportInfo={indexUsed:u.indexUsed,totalTimeInMS:u.totalInMs,moduleTimeInMS:u.moduleTimeInMS,indexTimeInMS:u.indexTimeInMS,importAliasTimeInMS:u.importAliasTimeInMS,itemCount:p.length,symbolCount:u.symbolCount,indexCount:u.indexCount,importAliasCount:u.importAliasCount,additionTimeInMS:m.getDurationInMilliseconds()}}_getImportFromCompletions(e,t){if(e.isWildcardImport)return;const n=o.getImportInfo(e.module);if(!n)return;const s=new z,i=n.resolvedPaths.length>0?n.resolvedPaths[n.resolvedPaths.length-1]:"",r=this._importLookup(i);return r&&this._addSymbolsForSymbolTable(r.symbolTable,((t,n)=>t.getDeclarations().some((e=>!(0,l.isIntrinsicDeclaration)(e)))&&!e.imports.find((e=>e.name.value===n))),t,!0,void 0,s),n.implicitImports.forEach((n=>{e.imports.find((e=>e.name.value===n.name))||this._addNameToCompletions(n.name,a.CompletionItemKind.Module,t,s)})),{completionMap:s}}_findMatchingKeywords(e,t){return e.filter((e=>!t||A.isPatternInSymbol(t,e)))}_addNamedParameters(e,t,n){const s=new Map;e.signatures.forEach((e=>{this._addNamedParametersToMap(e.type,s)})),e.callNode.arguments.forEach((e=>{e.name&&s.delete(e.name.value)})),s.forEach((e=>{if(A.isPatternInSymbol(t,e)){const t=e+"=";if(n.has(t))return;const s=a.CompletionItem.create(t);s.kind=a.CompletionItemKind.Variable;const i={workspacePath:this._workspacePath,filePath:this._filePath,position:this._position};s.data=(0,x.toLSPAny)(i),s.sortText=this._makeSortText(V.NamedParameter,e),s.filterText=e,n.set(s)}}))}_addNamedParametersToMap(e,t){e.details.parameters.forEach((e=>{e.name&&!e.isNameSynthesized&&(h.isPrivateOrProtectedName(e.name)||t.set(e.name,e.name))}))}_addSymbols(e,t,n){let s=e;for(;s;){let e=(0,m.getScopeForNode)(s);if(e){for(;e;)this._addSymbolsForSymbolTable(e.symbolTable,(()=>!0),t,!1,void 0,n),e=e.parent;if(10===s.nodeType){const e=this._evaluator.getTypeOfClass(s);e&&(0,v.isInstantiableClass)(e.classType)&&e.classType.details.mro.forEach(((e,s)=>{(0,v.isInstantiableClass)(e)&&this._addSymbolsForSymbolTable(e.details.fields,(e=>!!e.isClassMember()&&e.getDeclarations().some((e=>1===e.type))),t,!1,void 0,n)}))}break}s=s.parent}}_addSymbolsForSymbolTable(e,t,n,s,i,r){e.forEach(((e,a)=>{!(e.isExternallyHidden()&&!e.getDeclarations().some((e=>(0,c.isDefinedInFile)(e,this._filePath))))&&t(e,a)&&(r.has(a)||this._addSymbol(a,e,n,r,{boundObjectOrClass:i,funcParensDisabled:s}))}))}_addSymbol(e,t,n,s,i){var r,o,l;if(t.isPrivatePyTypedImport())return;let c=(0,g.getLastTypedDeclaredForSymbol)(t);if(!c){const e=t.getDeclarations();e.length>0&&(c=e[e.length-1])}if(c){let d=a.CompletionItemKind.Variable;if(c=this._evaluator.resolveAliasDeclaration(c,!0),c&&(d=this._convertDeclarationTypeToItemKind(c),1===c.type&&i.boundObjectOrClass&&(0,v.isInstantiableClass)(i.boundObjectOrClass)&&v.ClassType.isEnumClass(i.boundObjectOrClass)&&3===(null===(r=c.node.parent)||void 0===r?void 0:r.nodeType)&&(d=a.CompletionItemKind.EnumMember),this._itemToResolve)){const n=(0,x.fromLSPAny)(this._itemToResolve.data);if(n.symbolLabel===e&&!n.autoImportText){const n=this._evaluator.getEffectiveTypeOfSymbol(t);if(n){let s,r;switch(c.type){case 0:case 1:case 2:{let t=!1;if(n&&v.TypeBase.isInstantiable(n)){const s=(0,v.getTypeAliasInfo)(n);s&&s.name===e&&(t=!0)}s=e+": "+this._evaluator.printType(n,t);break}case 3:{const t=i.boundObjectOrClass&&((0,v.isFunction)(n)||(0,v.isOverloadedFunction)(n))?this._evaluator.bindFunctionToClassOrObject(i.boundObjectOrClass,n):n;if(t)if((0,b.isProperty)(t)&&i.boundObjectOrClass&&(0,v.isClassInstance)(i.boundObjectOrClass)){const n=this._evaluator.getGetterTypeFromProperty(t,!0)||v.UnknownType.create();s=e+": "+this._evaluator.printType(n,!1)+" (property)"}else s=(0,v.isOverloadedFunction)(t)?(0,O.getOverloadedFunctionTooltip)(t,this._evaluator,35):e+": "+this._evaluator.printType(t,!1);break}case 4:case 5:s="class "+e+"()";break;case 6:if(s=e,c.path){const e=this._importLookup(c.path);e&&(r=e.docString)}break;default:s=e}if(1===c.type&&c.typeAliasName&&c.docString)r=c.docString;else if((0,v.isModule)(n))r=(0,T.getModuleDocString)(n,c,this._sourceMapper);else if((0,v.isInstantiableClass)(n))r=(0,T.getClassDocString)(n,c,this._sourceMapper);else if((0,v.isFunction)(n)){const e=i.boundObjectOrClass?this._evaluator.bindFunctionToClassOrObject(i.boundObjectOrClass,n):n;e&&(0,v.isFunction)(e)&&(r=(0,O.getFunctionDocStringFromType)(e,this._sourceMapper,this._evaluator))}else if((0,v.isOverloadedFunction)(n)){const e=i.boundObjectOrClass?this._evaluator.bindFunctionToClassOrObject(i.boundObjectOrClass,n):n;e&&(0,v.isOverloadedFunction)(e)&&(r=(0,O.getOverloadedFunctionDocStringsFromType)(e,this._sourceMapper,this._evaluator).find((e=>e)))}else if(3===(null==c?void 0:c.type))r=(0,T.getPropertyDocStringInherited)(c,this._sourceMapper,this._evaluator);else if(1===(null==c?void 0:c.type)){const e=null!==(o=t.getDeclarations().find((e=>1===e.type&&!!e.docString)))&&void 0!==o?o:c;r=(0,T.getVariableDocString)(e,this._sourceMapper)}if(this._options.format===a.MarkupKind.Markdown){let e="```python\n"+s+"\n```\n";r&&(e+="---\n",e+=(0,p.convertDocStringToMarkdown)(r)),e=e.trimEnd(),this._itemToResolve.documentation={kind:a.MarkupKind.Markdown,value:e}}else if(this._options.format===a.MarkupKind.PlainText){let e=s+"\n";r&&(e+="\n",e+=(0,p.convertDocStringToPlainText)(r)),e=e.trimEnd(),this._itemToResolve.documentation={kind:a.MarkupKind.PlainText,value:e}}else(0,F.fail)(`Unsupported markup type: ${this._options.format}`)}}}const u=i.autoImportSource?this._getAutoImportText(e,i.autoImportSource,i.autoImportAlias):void 0;this._addNameToCompletions(null!==(l=i.autoImportAlias)&&void 0!==l?l:e,d,n,s,{autoImportText:u,funcParensDisabled:i.funcParensDisabled,edits:i.edits})}else{if(t.getSynthesizedType()){const t=a.CompletionItemKind.Variable;this._addNameToCompletions(e,t,n,s,{funcParensDisabled:i.funcParensDisabled,edits:i.edits})}}}_getAutoImportText(e,t,n){const s=(0,O.getAutoImportText)(e,t,n);return this._options.format===a.MarkupKind.Markdown?`\`\`\`\n${s}\n\`\`\``:this._options.format===a.MarkupKind.PlainText?s:void(0,F.fail)(`Unsupported markup type: ${this._options.format}`)}_addNameToCompletions(e,n,s,i,r){var o,l,c;if(!(!!(null==r?void 0:r.autoImportText)||A.isPatternInSymbol(s,e)))return;if(i.has(e,z.matchKindAndImportText,n,null==r?void 0:r.autoImportText))return;const d=a.CompletionItem.create(e);d.kind=n;const u={workspacePath:this._workspacePath,filePath:this._filePath,position:this._position};if((null==r?void 0:r.funcParensDisabled)&&(u.funcParensDisabled=!0),d.data=(0,x.toLSPAny)(u),(null==r?void 0:r.sortText)||(null==r?void 0:r.itemDetail)?(d.sortText=r.sortText,d.detail=r.itemDetail):(null==r?void 0:r.autoImportText)?(d.sortText=this._makeSortText(V.AutoImport,e,r.autoImportText),u.autoImportText=r.autoImportText,d.detail=t.autoImportDetail):n===a.CompletionItemKind.EnumMember?d.sortText=this._makeSortText(V.EnumMember,e):h.isDunderName(e)?d.sortText=this._makeSortText(V.DunderSymbol,e):""===s&&h.isPrivateOrProtectedName(e)?d.sortText=this._makeSortText(V.PrivateSymbol,e):d.sortText=this._makeSortText(V.NormalSymbol,e),u.symbolLabel=e,this._options.format===a.MarkupKind.Markdown){let e="";(null==r?void 0:r.autoImportText)&&(e+=r.autoImportText,(r.typeDetail||r.documentation)&&(e+="\n\n")),(null==r?void 0:r.typeDetail)&&(e+="```python\n"+r.typeDetail+"\n```\n"),(null==r?void 0:r.documentation)&&(e+="---\n",e+=(0,p.convertDocStringToMarkdown)(r.documentation)),e=e.trimEnd(),e&&(d.documentation={kind:a.MarkupKind.Markdown,value:e})}else if(this._options.format===a.MarkupKind.PlainText){let e="";(null==r?void 0:r.autoImportText)&&(e+=r.autoImportText,(r.typeDetail||r.documentation)&&(e+="\n\n")),(null==r?void 0:r.typeDetail)&&(e+=r.typeDetail+"\n"),(null==r?void 0:r.documentation)&&(e+="\n"+(0,p.convertDocStringToPlainText)(r.documentation)),e=e.trimEnd(),e&&(d.documentation={kind:a.MarkupKind.PlainText,value:e})}else(0,F.fail)(`Unsupported markup type: ${this._options.format}`);if((null===(o=null==r?void 0:r.edits)||void 0===o?void 0:o.format)&&(d.insertTextFormat=r.edits.format),(null===(l=null==r?void 0:r.edits)||void 0===l?void 0:l.textEdit)&&(d.textEdit=r.edits.textEdit),(null===(c=null==r?void 0:r.edits)||void 0===c?void 0:c.additionalTextEdits)&&(d.additionalTextEdits=r.edits.additionalTextEdits.map((e=>({range:{start:{line:e.range.start.line,character:e.range.start.character},end:{line:e.range.end.line,character:e.range.end.character}},newText:e.replacementText}))),this._itemToResolve)){(0,x.fromLSPAny)(this._itemToResolve.data).autoImportText===u.autoImportText&&(this._itemToResolve.additionalTextEdits=d.additionalTextEdits)}i.set(d)}_getRecentListIndex(e,t){return U._mostRecentCompletions.findIndex((n=>n.label===e&&n.autoImportText===t))}_makeSortText(e,t,n=""){const s=this._getRecentListIndex(t,n);return s>=0&&(e===V.AutoImport?e=V.RecentAutoImport:e===V.ImportModuleName?e=V.RecentImportModuleName:e!==V.Keyword&&e!==V.NormalSymbol&&e!==V.PrivateSymbol&&e!==V.DunderSymbol||(e=V.RecentKeywordOrSymbol)),this._formatInteger(e,2)+"."+this._formatInteger(s,4)+"."+t}_formatInteger(e,t){const n="0".charCodeAt(0);let s="";for(let i=0;i<t;i++){let t=Math.floor(e%10);t<0&&(t=9),s=String.fromCharCode(t+n)+s,e=Math.floor(e/10)}return s}_convertDeclarationTypeToItemKind(e){const t=this._evaluator.resolveAliasDeclaration(e,!0);if(!t)return a.CompletionItemKind.Variable;switch(t.type){case 0:return"class"===t.intrinsicType?a.CompletionItemKind.Class:a.CompletionItemKind.Variable;case 2:return a.CompletionItemKind.Variable;case 1:return t.isConstant||t.isFinal?a.CompletionItemKind.Constant:a.CompletionItemKind.Variable;case 3:if(this._isPossiblePropertyDeclaration(t)){const e=this._evaluator.getTypeOfFunction(t.node);if(e&&(0,b.isProperty)(e.decoratedType))return a.CompletionItemKind.Property}return t.isMethod?a.CompletionItemKind.Method:a.CompletionItemKind.Function;case 4:case 5:return a.CompletionItemKind.Class;case 6:return a.CompletionItemKind.Module}}_getImportModuleCompletions(e){const t={leadingDots:e.leadingDots,hasTrailingDot:e.hasTrailingDot||!1,nameParts:e.nameParts.map((e=>e.value)),importedSymbols:[]},n=this._importResolver.getCompletionSuggestions(this._filePath,this._execEnv,t),s=new z;if(!e.hasTrailingDot&&e.parent&&22===e.parent.nodeType&&e.parent.missingImportKeyword){const e="import",t=a.CompletionItem.create(e);t.kind=a.CompletionItemKind.Keyword,t.sortText=this._makeSortText(V.Keyword,e),s.set(t)}return n.forEach((e=>{if(s.has(e))return;const t=a.CompletionItem.create(e);t.kind=a.CompletionItemKind.Module,t.sortText=this._makeSortText(V.ImportModuleName,e),s.set(t)})),{completionMap:s}}_isPossiblePropertyDeclaration(e){return e.isMethod&&e.node.decorators.length>0}}t.CompletionProvider=U,U._mostRecentCompletions=[];class z{constructor(){this._completions=new Map}get size(){return this._completions.size}set(e){const t=this._completions.get(e.label);t?Array.isArray(t)?t.push(e):this._completions.set(e.label,[t,e]):this._completions.set(e.label,e)}get(e){return this._completions.get(e)}has(e,t,n,s){const i=this._completions.get(e);return!!i&&(!t||t(i,n,s))}clear(){this._completions.clear()}delete(e){return this._completions.delete(e)}toArray(){var e;const t=[];return null===(e=this._completions)||void 0===e||e.forEach((e=>{Array.isArray(e)?e.forEach((e=>{t.push(e)})):t.push(e)})),t}static matchKindAndImportText(e,t,n){var s;return Array.isArray(e)?!!e.find((e=>{var s;return e.kind===t&&(null===(s=B(e))||void 0===s?void 0:s.autoImportText)===n})):e.kind===t&&(null===(s=B(e))||void 0===s?void 0:s.autoImportText)===n}static labelOnlyIgnoringAutoImports(e){var t;if(Array.isArray(e)){if(e.find((e=>{var t;return!(null===(t=B(e))||void 0===t?void 0:t.autoImportText)})))return!0}else if(!(null===(t=B(e))||void 0===t?void 0:t.autoImportText))return!0;return!1}}function B(e){return(0,x.fromLSPAny)(e.data)}t.CompletionMap=z},27888:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DefinitionProvider=t.DefinitionFilter=void 0;const a=n(35696),o=n(16800),l=r(n(23241)),c=n(93989),p=n(59195),d=n(10425),u=n(38213),m=n(9133),y=n(98173),h=n(28348),g=n(80957);var f;!function(e){e.All="all",e.PreferSource="preferSource",e.PreferStubs="preferStubs"}(f=t.DefinitionFilter||(t.DefinitionFilter={}));class T{static getDefinitionsForPosition(e,t,n,s,i,r){(0,u.throwIfCancellationRequested)(r);const a=(0,h.convertPositionToOffset)(n,t.tokenizerOutput.lines);if(void 0===a)return;const o=l.findNodeByOffset(t.parseTree,a);if(void 0===o)return;const p=[];if(38===o.nodeType){const t=i.getDeclarationsForNameNode(o);T._resolveDeclarations(t,i,p,e)}else if(49===o.nodeType){const t=i.getDeclarationsForStringNode(o);T._resolveDeclarations(t,i,p,e)}if(0===p.length)return;if(s===f.All)return p;const d=s===f.PreferStubs,m=e=>d===(0,c.isStubFile)(e.path);return p.find(m)?p.filter(m):p}static getTypeDefinitionsForPosition(e,t,n,s,i,r){var a;(0,u.throwIfCancellationRequested)(r);const o=(0,h.convertPositionToOffset)(n,t.tokenizerOutput.lines);if(void 0===o)return;const c=l.findNodeByOffset(t.parseTree,o);if(void 0===c)return;const p=[];if(38===c.nodeType){const t=s.getType(c);if(t){let n=[];(0,d.doForEachSubtype)(t,(t=>{7===(null==t?void 0:t.category)&&(0,m.appendArray)(n,e.findClassDeclarationsByType(i,t))})),0===n.length&&(n=null!==(a=s.getDeclarationsForNameNode(c))&&void 0!==a?a:[]),T._resolveDeclarations(n,s,p,e)}}else if(49===c.nodeType){const t=s.getDeclarationsForStringNode(c);T._resolveDeclarations(t,s,p,e)}return 0!==p.length?p:void 0}static _resolveDeclarations(e,t,n,s){e&&e.forEach((e=>{let i=t.resolveAliasDeclaration(e,!0,!0);if(i&&i.path){if(6===i.type&&i.isUnresolved)return;if(6===i.type&&i.symbolName&&i.submoduleFallback&&i.submoduleFallback.path&&(i=i.submoduleFallback),this._addIfUnique(n,{path:i.path,range:i.range}),(0,o.isFunctionDeclaration)(i)){const e=t.getTypeForDeclaration(i);if(e&&(0,p.isOverloadedFunction)(e))for(const t of e.overloads.map((e=>e.details.declaration)).filter(y.isDefined))this._addIfUnique(n,{path:t.path,range:t.range})}if((0,c.isStubFile)(i.path))if(6===i.type)s.findModules(i.path).map((e=>{var t;return null===(t=(0,a.getFileInfo)(e))||void 0===t?void 0:t.filePath})).filter(y.isDefined).forEach((e=>this._addIfUnique(n,this._createModuleEntry(e))));else{const e=s.findDeclarations(i);for(const t of e)t&&t.path&&this._addIfUnique(n,{path:t.path,range:t.range})}}}))}static _createModuleEntry(e){return{path:e,range:{start:{line:0,character:0},end:{line:0,character:0}}}}static _addIfUnique(e,t){for(const n of e)if(n.path===t.path&&(0,g.rangesAreEqual)(n.range,t.range))return;e.push(t)}}t.DefinitionProvider=T},70234:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentHighlightProvider=void 0;const a=n(29335),o=r(n(23241)),l=n(38213),c=n(28348),p=n(80957),d=n(9272);t.DocumentHighlightProvider=class{static getDocumentHighlight(e,t,n,s){(0,l.throwIfCancellationRequested)(s);const i=(0,c.convertPositionToOffset)(t,e.tokenizerOutput.lines);if(void 0===i)return;const r=o.findNodeByOffset(e.parseTree,i);if(void 0===r)return;if(38!==r.nodeType)return;return d.DocumentSymbolCollector.collectFromNode(r,n,s,e.parseTree,!0).map((t=>({kind:38===t.node.nodeType&&o.isWriteAccess(t.node)?a.DocumentHighlightKind.Write:a.DocumentHighlightKind.Read,range:(0,c.convertOffsetsToRange)(t.range.start,p.TextRange.getEnd(t.range),e.tokenizerOutput.lines)})))}}},9272:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentSymbolCollector=void 0;const a=r(n(35696)),o=n(16800),l=n(88023),c=n(23241),p=r(n(23241)),d=n(22339),u=r(n(57203)),m=n(93989),y=n(59195),h=n(10425),g=n(38213),f=n(9133),T=n(20823);class _ extends d.ParseTreeWalker{constructor(e,t,n,s,i,r=!1,a=!0){super(),this._symbolName=e,this._declarations=t,this._evaluator=n,this._cancellationToken=s,this._startingNode=i,this._treatModuleInImportAndFromImportSame=r,this._skipUnreachableCode=a,this._results=[],this._dunderAllNameNodes=new Set,this._setDunderAllNodes(this._startingNode)}static collectFromNode(e,t,n,s,i=!1,r=!0){const a=e.value,o=this.getDeclarationsForNode(e,t,!0,n);if(!(s=null!=s?s:(0,c.getModuleNode)(e)))return[];return new _(a,o,t,n,s,i,r).collect()}static getDeclarationsForNode(e,t,n,s,i){(0,g.throwIfCancellationRequested)(s);const r=this._getDeclarationsForNode(e,t),a=[];return r.forEach((e=>{const s=t.resolveAliasDeclaration(e,n);if(s&&(a.push(s),i&&(0,m.isStubFile)(s.path))){const e=i.findDeclarations(s);for(const t of e)t&&t.path&&this._addIfUnique(a,t)}})),a}collect(){return this.walk(this._startingNode),this._results}walk(e){this._skipUnreachableCode&&a.isCodeUnreachable(e)||super.walk(e)}visitName(e){if((0,g.throwIfCancellationRequested)(this._cancellationToken),e.value!==this._symbolName)return!1;if(this._declarations.length>0){const t=_._getDeclarationsForNode(e,this._evaluator,this._skipUnreachableCode);t&&t.length>0&&t.some((e=>this._resultsContainsDeclaration(e)))&&this._addResult(e)}else this._addResult(e);return!1}visitString(e){return(0,g.throwIfCancellationRequested)(this._cancellationToken),this._dunderAllNameNodes.has(e)&&this._addResult(e),!1}_addResult(e){const t=38===e.nodeType?e:(0,c.getStringNodeValueRange)(e);this._results.push({node:e,range:t})}_resultsContainsDeclaration(e){const t=this._evaluator.resolveAliasDeclaration(e,!1);if(!t)return!1;if(this._declarations.some((e=>(0,l.areDeclarationsSame)(e,t,this._treatModuleInImportAndFromImportSame))))return!0;const n=this._getResolveAliasDeclaration(t);return!(!n||n===t)&&this._declarations.some((e=>(0,l.areDeclarationsSame)(e,n,this._treatModuleInImportAndFromImportSame)))}_getResolveAliasDeclaration(e){if(n(e))return(0,l.getDeclarationsWithUsesLocalNameRemoved)([e])[0];const t=this._evaluator.resolveAliasDeclaration(e,!0);return n(t)?(0,l.getDeclarationsWithUsesLocalNameRemoved)([t])[0]:t;function n(e){return!!e&&6===e.type&&e.node&&e.usesLocalName&&21===e.node.nodeType}}_setDunderAllNodes(e){if(36!==e.nodeType)return;const t=a.getDunderAllInfo(e);if(!t)return;const n=u.getScopeForNode(e);n&&t.stringNodes.forEach((e=>{if(e.value!==this._symbolName)return;const t=n.lookUpSymbolRecursive(e.value);t&&t.symbol.getDeclarations().some((e=>this._resultsContainsDeclaration(e)))&&this._dunderAllNameNodes.add(e)}))}static _addIfUnique(e,t){for(const n of e)if((0,l.areDeclarationsSame)(n,t))return;e.push(t)}static _getDeclarationsForNode(e,t,n=!0){var s;return 37!==(null===(s=e.parent)||void 0===s?void 0:s.nodeType)?this._getDeclarationsForNonModuleNameNode(e,t,n):this._getDeclarationsForModuleNameNode(e,t)}static _getDeclarationsForNonModuleNameNode(e,t,n=!0){var s,i;(0,T.assert)(37!==(null===(s=e.parent)||void 0===s?void 0:s.nodeType));let r=t.getDeclarationsForNameNode(e,n)||[];if(23===(null===(i=e.parent)||void 0===i?void 0:i.nodeType)&&(r=r.filter((t=>t.node===e.parent))),0===r.length){const n=t.getType(e);if(8===(null==n?void 0:n.category))return[(0,l.createSynthesizedAliasDeclaration)(n.filePath)]}for(const e of r.filter((e=>(0,o.isAliasDeclaration)(e)&&!e.loadSymbolsFromPath))){const s=e.node;23!==s.nodeType&&r.push(...t.getDeclarationsForNameNode(s.module.nameParts[0],n)||[])}for(const e of r.filter((e=>(0,o.isFunctionDeclaration)(e)&&e.isMethod&&e.node.name.value.length>0))){const n=e,s=p.getEnclosingClass(n.node),i=s?t.getTypeOfClass(s):void 0;if(i)for(const e of i.classType.details.mro)if((0,y.isInstantiableClass)(e)){const t=(0,h.lookUpClassMember)(e,n.node.name.value),s=(0,h.lookUpClassMember)(e,n.node.name.value,1);t&&!s&&t.symbol.getDeclarations().filter((e=>(0,o.isFunctionDeclaration)(e)&&e.isMethod)).forEach((e=>this._addIfUnique(r,e)))}}return r}static _getDeclarationsForModuleNameNode(e,t){var n,s,i,r,a;(0,T.assert)(37===(null===(n=e.parent)||void 0===n?void 0:n.nodeType));const c=e.parent;if(21===(null===(s=c.parent)||void 0===s?void 0:s.nodeType)||22===(null===(i=c.parent)||void 0===i?void 0:i.nodeType)){const n=c.nameParts.findIndex((t=>t===e));if(0===n){const n=[];if(n.push(...(null===(r=t.getDeclarationsForNameNode(c.nameParts[0]))||void 0===r?void 0:r.filter((e=>(0,o.isAliasDeclaration)(e))))||[]),0===n.length)return n;const s=1===c.nameParts.length&&21===c.parent.nodeType&&!!c.parent.alias,i=s?c.parent.alias.value:c.nameParts[0].value,p=null===(a=u.getScopeForNode(e))||void 0===a?void 0:a.lookUpSymbolRecursive(i);if(p&&1===c.nameParts.length){let e=[];(0,f.appendArray)(e,p.symbol.getDeclarations().filter((e=>(0,o.isAliasDeclaration)(e)))),e.length>1&&(e=e.filter((e=>void 0!==(e=e).firstNamePart?e.firstNamePart===c.nameParts[0].value:e.node===c.parent))),s&&(e=(0,l.getDeclarationsWithUsesLocalNameRemoved)(e)),n.push(...e)}return n}return n>0&&t.getDeclarationsForNameNode(c.nameParts[n])||[]}return[]}}t.DocumentSymbolCollector=_},54989:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.DocumentSymbolProvider=t.convertToFlatSymbols=t.getIndexAliasData=void 0;const a=n(29335),o=n(15585),l=n(82048),c=r(n(35696)),p=n(88023),d=n(15020),u=n(10425),m=n(38213),y=n(28348),h=r(n(14551)),g=n(82615);function f(e,t){var n;if(!t.symbolName)return;const s=(0,l.resolveAliasDeclaration)(e,t,!0,!1);if(!s||!s.declaration)return;if(s.isPrivate)return;const i=(0,p.getNameFromDeclaration)(s.declaration);if(!i||s.declaration.path.length<=0)return;const r=null!==(n=_(i,s.declaration))&&void 0!==n?n:a.SymbolKind.Module;return{originalName:i,modulePath:s.declaration.path,kind:r,itemKind:(0,g.convertSymbolKindToCompletionItemKind)(r)}}t.getIndexAliasData=f,t.convertToFlatSymbols=function(e,t){const n=[];for(const s of t)C(n,e,s);return n};class T{static getSymbolsForDocument(e,t,n,s,i,r){var a;const o=[];if(!t&&!n)return o;return v(null!==(a=null==t?void 0:t.symbols)&&void 0!==a?a:T.indexSymbols(e,n,{indexingForAutoImportMode:!1},r),s,i,"",o,r),o}static addHierarchicalSymbolsForDocument(e,t,n,s,i){var r;if(!t&&!n)return;b(null!==(r=null==t?void 0:t.symbols)&&void 0!==r?r:T.indexSymbols(e,n,{indexingForAutoImportMode:!1},i),s,i)}static indexSymbols(e,t,n,s){const i=[];return I(e,t,t.parseTree,n,i,s),i}}function _(e,t,n){let s;switch(t.type){case 4:case 5:s=a.SymbolKind.Class;break;case 3:if(t.isMethod){const e=null==n?void 0:n.getTypeForDeclaration(t);s=e&&(0,u.isProperty)(e)?a.SymbolKind.Property:a.SymbolKind.Method}else s=a.SymbolKind.Function;break;case 6:s=a.SymbolKind.Module;break;case 2:if("self"===e||"cls"===e||"_"===e)return;s=a.SymbolKind.Variable;break;case 1:if("_"===e)return;s=t.isConstant||t.isFinal?a.SymbolKind.Constant:a.SymbolKind.Variable;break;default:s=a.SymbolKind.Variable}return s}function v(e,t,n,s,i,r){if((0,m.throwIfCancellationRequested)(r),e)for(const l of e)if(!l.alias){if(h.isPatternInSymbol(n,l.name)){const e={uri:o.URI.file(t).toString(),range:l.selectionRange},n={name:l.name,kind:l.kind,location:e};s.length&&(n.containerName=s),i.push(n)}v(l.children,t,n,a(s,l.name),i,r)}function a(e,t){return e.length>0?`${e}.${t}`:t}}function b(e,t,n){if((0,m.throwIfCancellationRequested)(n),e)for(const s of e){if(s.alias)continue;const e=[];b(s.children,e,n);const i={name:s.name,kind:s.kind,range:s.range,selectionRange:s.selectionRange,children:e};t.push(i)}}function I(e,t,n,s,i,r){(0,m.throwIfCancellationRequested)(r);const a=c.getScope(n);if(!a)return;a.symbolTable.forEach(((n,a)=>{if(n.isIgnoredForProtocolMatch())return;if(s.indexingForAutoImportMode&&!s.forceIndexing&&!e.isStubFile&&!e.isInPyTypedPackage&&!n.isInDunderAll())return;let o=(0,d.getLastTypedDeclaredForSymbol)(n);if(!o&&n.hasDeclarations()&&(o=n.getDeclarations()[0]),o){if(6===o.type){if(!s.indexingForAutoImportMode)return;if(!o.loadSymbolsFromPath||o.path.length<=0)return}!function(e,t,n,s,i,r,a,o){if(s.indexingForAutoImportMode&&!i)return;const l=_(r,n);if(void 0===l)return;const p=n.range;let d=p;const u=[];4!==n.type&&3!==n.type||(s.indexingForAutoImportMode||I(e,t,n.node,s,u,o),d=(0,y.convertOffsetsToRange)(n.node.start,n.node.start+n.node.length,t.tokenizerOutput.lines));let m;if(6===n.type&&(m=f(c.getFileInfo(t.parseTree).importLookup,n),!m))return;const h={name:r,externallyVisible:i,kind:l,itemKind:(0,g.convertSymbolKindToCompletionItemKind)(l),alias:m,range:s.indexingForAutoImportMode?void 0:d,selectionRange:s.indexingForAutoImportMode?void 0:p,children:s.indexingForAutoImportMode?void 0:u};a.push(h)}(e,t,o,s,!n.isExternallyHidden(),a,i,r)}}))}function C(e,t,n,s){const i={name:n.name,kind:n.kind,location:a.Location.create(t,n.range)};if(n.tags&&(i.tags=n.tags),s&&(i.containerName=s.name),e.push(i),n.children)for(const s of n.children)C(e,t,s,n)}t.DocumentSymbolProvider=T},8871:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.convertHoverResults=t.HoverProvider=void 0;const a=n(29335),o=n(21736),l=r(n(23241)),c=n(59195),p=n(10425),d=n(38213),u=n(20823),m=n(28348),y=n(80957),h=n(31807);t.HoverProvider=class{static getHoverForPosition(e,t,n,s,i,r){var a;(0,d.throwIfCancellationRequested)(r);const o=(0,m.convertPositionToOffset)(n,t.tokenizerOutput.lines);if(void 0===o)return;const p=l.findNodeByOffset(t.parseTree,o);if(void 0===p)return;const u={parts:[],range:{start:(0,m.convertOffsetToPosition)(p.start,t.tokenizerOutput.lines),end:(0,m.convertOffsetToPosition)(y.TextRange.getEnd(p),t.tokenizerOutput.lines)}};if(38===p.nodeType){const t=i.getDeclarationsForNameNode(p);if(t&&t.length>0){let n=t[0];6===n.type&&t.length>1&&(n=t[1]),this._addResultsForDeclaration(s,e,u.parts,n,p,i)}else if((!p.parent||37!==p.parent.nodeType)&&0===u.parts.length){const t=i.getType(p)||c.UnknownType.create();let n="";n=(0,c.isModule)(t)?"(module) "+p.value:p.value+": "+i.printType(t,!1),this._addResultsPart(u.parts,n,!0),this._addDocumentationPart(s,e,u.parts,p,i,void 0)}}else if(49===p.nodeType){const t=null===(a=i.getExpectedType(p))||void 0===a?void 0:a.type;void 0!==t&&this._tryAddPartsForTypedDictKey(s,e,i,p,t,u.parts)}return u.parts.length>0?u:void 0}static _addResultsForDeclaration(e,t,n,s,i,r){var a;const o=r.resolveAliasDeclaration(s,!0);if(o)switch(o.type){case 0:this._addResultsPart(n,i.value+this._getTypeText(i,r),!0),this._addDocumentationPart(e,t,n,i,r,o);break;case 1:{let l=o.isConstant||o.isFinal?"constant":"variable",p=i;21===s.node.nodeType||23===s.node.nodeType?s.node.alias&&i!==s.node.alias&&38===o.node.nodeType&&(p=o.node):1===(null===(a=i.parent)||void 0===a?void 0:a.nodeType)&&i.parent.name===i&&38===s.node.nodeType&&(p=s.node);const d=r.getType(p);let u,m=!1;if(null==d?void 0:d.typeAliasInfo){const e=(0,c.getTypeAliasInfo)(d);(null==e?void 0:e.name)===p.value&&((0,c.isTypeVar)(d)?(l=d.details.isParamSpec?"param spec":"type variable",u=d.details.name):(m=!0,l="type alias"))}const y=u||i.value+this._getTypeText(p,r,m);this._addResultsPart(n,`(${l}) ${y}`,!0),this._addDocumentationPart(e,t,n,i,r,o);break}case 2:this._addResultsPart(n,"(parameter) "+i.value+this._getTypeText(i,r),!0),this._addDocumentationPart(e,t,n,i,r,o);break;case 4:case 5:if(this._addInitMethodInsteadIfCallNode(e,i,r,n,t,o))return;this._addResultsPart(n,"(class) "+i.value,!0),this._addDocumentationPart(e,t,n,i,r,o);break;case 3:{let s="function";if(o.isMethod){const e=r.getTypeForDeclaration(o);s=e&&(0,p.isMaybeDescriptorInstance)(e,!1)?"property":"method"}const a=r.getType(i);a&&(0,c.isOverloadedFunction)(a)?this._addResultsPart(n,`(${s})\n${(0,h.getOverloadedFunctionTooltip)(a,r)}`,!0):this._addResultsPart(n,`(${s}) `+i.value+this._getTypeText(i,r),!0),this._addDocumentationPart(e,t,n,i,r,o);break}case 6:this._addResultsPart(n,"(module) "+i.value,!0),this._addDocumentationPart(e,t,n,i,r,o)}else this._addResultsPart(n,"(import) "+i.value+this._getTypeText(i,r),!0)}static _tryAddPartsForTypedDictKey(e,t,n,s,i,r){(0,p.doForEachSubtype)(i,(i=>{var a,o;if((0,c.isClassInstance)(i)&&c.ClassType.isTypedDictClass(i)){const l=null===(a=i.details.typedDictEntries)||void 0===a?void 0:a.get(s.value);if(l){r.length>0&&r.push({text:"\n\n---\n"});const a="(key) "+s.value+": "+n.printType(l.valueType,!1);this._addResultsPart(r,a,!0);const c=null===(o=i.details.fields.get(s.value))||void 0===o?void 0:o.getDeclarations();if(void 0!==c&&0!==(null==c?void 0:c.length)){const s=c[0];1===s.type&&void 0!==s.docString&&this._addDocumentationPartForType(e,t,r,i,s,n)}}}}))}static _addInitMethodInsteadIfCallNode(e,t,n,s,i,r){let a=t;if(a.parent&&35===a.parent.nodeType&&t===a.parent.memberName&&(a=t.parent),!a||!a.parent||9!==a.parent.nodeType||a.parent.leftExpression!==a)return!1;const o=n.getType(t);if(!o||!(0,c.isInstantiableClass)(o))return!1;const l=(0,p.lookUpClassMember)(o,"__init__",8);if(!l)return!1;const d=n.getType(a.parent),u=n.getTypeOfMember(l);if(!(d&&u&&(0,c.isClassInstance)(d)&&(0,c.isFunction)(u)))return!1;const m=n.bindFunctionToClassOrObject(d,u);if(!m||!(0,c.isFunction)(m))return!1;const y=n.printFunctionParts(m),h=`${t.value}(${y[0].join(", ")})`;this._addResultsPart(s,"(class) "+h,!0);return this._addDocumentationPartForType(e,i,s,m,r,n)||this._addDocumentationPartForType(e,i,s,o,r,n),!0}static _getTypeText(e,t,n=!1){const s=t.getType(e)||c.UnknownType.create();return": "+t.printType(s,n)}static _addDocumentationPart(e,t,n,s,i,r){const a=i.getType(s);a&&this._addDocumentationPartForType(e,t,n,a,r,i)}static _addDocumentationPartForType(e,t,n,s,i,r){const a=(0,h.getDocumentationPartsForTypeAndDecl)(t,s,i,r);let o=!1;for(const t of a)t&&(o=!0,this._addDocumentationResultsPart(e,n,t));return o}static _addDocumentationResultsPart(e,t,n){if(n)if(e===a.MarkupKind.Markdown){const e=(0,o.convertDocStringToMarkdown)(n);t.length>0&&e.length>0&&t.push({text:"---\n"}),this._addResultsPart(t,e)}else e===a.MarkupKind.PlainText?this._addResultsPart(t,(0,o.convertDocStringToPlainText)(n)):(0,u.fail)(`Unsupported markup type: ${e}`)}static _addResultsPart(e,t,n=!1){e.push({python:n,text:t})}},t.convertHoverResults=function(e,t){if(!t)return;const n=t.parts.map((t=>{if(t.python){if(e===a.MarkupKind.Markdown)return"```python\n"+t.text+"\n```\n";if(e===a.MarkupKind.PlainText)return t.text+"\n\n";(0,u.fail)(`Unsupported markup type: ${e}`)}return t.text})).join("").trimEnd();return{contents:{kind:e,value:n},range:t.range}}},64677:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ImportSorter=void 0;const s=n(45214),i=n(38213),r=n(28348),a=n(80957);t.ImportSorter=class{constructor(e,t){this._parseResults=e,this._cancellationToken=t}sort(){(0,i.throwIfCancellationRequested)(this._cancellationToken);const e=[],t=(0,s.getTopLevelImports)(this._parseResults.parseTree),n=t.orderedImports.map((e=>e)).sort(((e,t)=>(0,s.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:(0,r.convertOffsetToPosition)(e[0].node.start,this._parseResults.tokenizerOutput.lines),end:(0,r.convertOffsetToPosition)(a.TextRange.getEnd(n),this._parseResults.tokenizerOutput.lines)}}_addSecondaryReplacementRanges(e,t){let n=e.findIndex((e=>e.followsNonImportStatement));if(!(n<0))for(;;){let s=e.findIndex(((e,t)=>t>n&&e.followsNonImportStatement));if(s<0&&(s=e.length),t.push({range:{start:(0,r.convertOffsetToPosition)(e[n].node.start,this._parseResults.tokenizerOutput.lines),end:(0,r.convertOffsetToPosition)(a.TextRange.getEnd(e[s-1].node),this._parseResults.tokenizerOutput.lines)},replacementText:""}),n=s,n>=e.length)break}}_generateSortedImportText(e){let t="",n=(0,s.getImportGroup)(e[0]);for(const i of e){const r=(0,s.getImportGroup)(i);let a;n!==r&&(t+=this._parseResults.tokenizerOutput.predominantEndOfLineSequence,n=r),a=20===i.node.nodeType?this._formatImportNode(i.subnode,i.moduleName):this._formatImportFromNode(i.node,i.moduleName),i!==e[e.length-1]&&(a+=this._parseResults.tokenizerOutput.predominantEndOfLineSequence),t+=a}return t}_formatImportNode(e,t){let n=`import ${t}`;return e.alias&&(n+=` as ${e.alias.value}`),n}_formatImportFromNode(e,t){const n=e.imports.sort(((e,t)=>this._compareSymbols(e,t))).map((e=>{let t=e.name.value;return e.alias&&(t+=` as ${e.alias.value}`),t}));let s=`from ${t} import `;if(e.isWildcardImport)return s+"*";const i=n.join(", ");if(s.length+i.length<=88)return s+i;s+="("+this._parseResults.tokenizerOutput.predominantEndOfLineSequence;for(const e of n)s+=this._parseResults.tokenizerOutput.predominantTabSequence+e+","+this._parseResults.tokenizerOutput.predominantEndOfLineSequence;return s+=")",s}_compareSymbols(e,t){return e.name.value<t.name.value?-1:1}}},47458:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.performQuickAction=void 0;const a=n(45214),o=r(n(23241)),l=n(38213),c=n(9133),p=n(28348),d=n(80957),u=n(64677);t.performQuickAction=function(e,t,n,s){if("pyright.organizeimports"===e){return new u.ImportSorter(n,s).sort()}if("pyright.addoptionalforparam"===e&&t.length>=1){return function(e,t,n){(0,l.throwIfCancellationRequested)(n);let s=o.findNodeByOffset(e.parseTree,t);for(;s&&41!==s.nodeType;)s=s.parent;if(!s)return[];const i=s.typeAnnotation||s.typeAnnotationComment;if(!i)return[];const r=[],u=(0,p.convertOffsetToPosition)(i.start,e.tokenizerOutput.lines),m=(0,p.convertOffsetToPosition)(d.TextRange.getEnd(i),e.tokenizerOutput.lines);r.push({range:{start:u,end:u},replacementText:"Optional["}),r.push({range:{start:m,end:m},replacementText:"]"});const y=(0,a.getTopLevelImports)(e.parseTree),h=y.orderedImports.find((e=>"typing"===e.moduleName));if(h&&22===h.node.nodeType&&!h.node.isWildcardImport){const t=(0,a.getTextEditsForAutoImportSymbolAddition)({name:"Optional"},h,e);(0,c.appendArray)(r,t)}else{const t=(0,a.getTextEditsForAutoImportInsertion)({name:"Optional"},y,"typing",0,e,u);(0,c.appendArray)(r,t)}return r}(n,parseInt(t[0],10),s)}return[]}},5165:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.ReferencesProvider=t.FindReferencesTreeWalker=t.ReferencesResult=void 0;const a=n(16800),o=r(n(23241)),l=n(38213),c=n(9133),p=n(20823),d=n(28348),u=n(80957),m=n(9272);class y{constructor(e,t,n,s,i){this.requiresGlobalSearch=e,this.nodeAtOffset=t,this.symbolName=n,this.declarations=s,this._reporter=i,this._locations=[],this.nonImportDeclarations=s.filter((e=>{var t;return!(0,a.isAliasDeclaration)(e)||!(!e.usesLocalName||!e.node)&&(22!==e.node.nodeType&&(null===(t=e.node.alias)||void 0===t?void 0:t.value)===n)}))}get containsOnlyImportDecls(){return this.declarations.length>0&&0===this.nonImportDeclarations.length}get locations(){return this._locations}addLocations(...e){0!==e.length&&(this._reporter&&this._reporter(e),(0,c.appendArray)(this._locations,e))}}t.ReferencesResult=y;class h{constructor(e,t,n,s,i,r){this._parseResults=e,this._filePath=t,this._referencesResult=n,this._includeDeclaration=s,this._evaluator=i,this._cancellationToken=r}findReferences(e=this._parseResults.parseTree){const t=new m.DocumentSymbolCollector(this._referencesResult.symbolName,this._referencesResult.declarations,this._evaluator,this._cancellationToken,e,!0,!1),n=[];for(const e of t.collect())(this._includeDeclaration||e.node!==this._referencesResult.nodeAtOffset)&&n.push({path:this._filePath,range:{start:(0,d.convertOffsetToPosition)(e.range.start,this._parseResults.tokenizerOutput.lines),end:(0,d.convertOffsetToPosition)(u.TextRange.getEnd(e.range),this._parseResults.tokenizerOutput.lines)}});return n}}t.FindReferencesTreeWalker=h;t.ReferencesProvider=class{static getDeclarationForNode(e,t,n,s,i,r){(0,l.throwIfCancellationRequested)(r);const a=m.DocumentSymbolCollector.getDeclarationsForNode(n,s,!1,r,e);if(0===a.length)return;const c=function(e,t,n,s){const i=e.lookUpSymbolRecursive(n,n.value,!1);if(i&&!r(i.symbol))return!1;return s.some((e=>{var n,s;if(e.path!==t)return!0;const i=o.getEvaluationScopeNode(e.node);return 36===i.nodeType||10===i.nodeType||35===(null===(s=null===(n=e.node)||void 0===n?void 0:n.parent)||void 0===s?void 0:s.nodeType)&&e.node===e.node.parent.memberName}));function r(e){return!e.isExternallyHidden()&&e.getDeclarations().reduce(((e,t)=>{if(!e)return!1;switch(t.type){case 6:case 0:case 5:return e;case 4:case 3:case 2:return e&&a(t.node.name);case 1:return 38===t.node.nodeType&&(e&&a(t.node));default:(0,p.assertNever)(t)}}),!0)}function a(t){const n=o.getEvaluationScopeNode(t);switch(n.nodeType){case 10:case 28:{const t=n.name,s=e.lookUpSymbolRecursive(t,t.value,!1);return!s||r(s.symbol)}case 30:case 32:return!1;case 36:return!0;default:(0,p.assertNever)(n)}}}(s,t,n,a);return new y(c,n,n.value,a,i)}static getDeclarationForPosition(e,t,n,s,i,r,a){(0,l.throwIfCancellationRequested)(a);const c=(0,d.convertPositionToOffset)(s,t.tokenizerOutput.lines);if(void 0===c)return;const p=o.findNodeByOffset(t.parseTree,c);return void 0!==p&&38===p.nodeType?this.getDeclarationForNode(e,n,p,i,r,a):void 0}static addReferences(e,t,n,s,i,r){const a=new h(e,t,n,s,i,r);n.addLocations(...a.findReferences())}}},67906:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.RenameModuleProvider=void 0;const s=n(29335),i=n(35696),r=n(16800),a=n(88023),o=n(67145),l=n(45214),c=n(23241),p=n(22339),d=n(93989),u=n(9133),m=n(98173),y=n(20823),h=n(94647),g=n(28348),f=n(80957),T=n(55390),_=n(9272);var v;!function(e){e[e.File=0]="File",e[e.Folder=1]="Folder",e[e.Symbol=2]="Symbol"}(v||(v={}));class b{constructor(e,t,n,s,i,r,a,o,l){if(this._fs=e,this._evaluator=t,this._moduleFilePath=n,this._moduleNameAndType=i,this._newModuleNameAndType=r,this._type=a,this._declarations=o,this._token=l,this._results=new Map,this._aliasIntroduced=new Set,this._newModuleFilePath=(0,h.resolvePaths)(s),this._moduleNames=this._moduleName.split("."),this._newModuleNames=this._newModuleName.split("."),this._moduleNames.length!==this._newModuleNames.length)return void(this._onlyNameChanged=!1);let c=0;for(c=0;c<this._moduleNames.length-1&&this._moduleNames[c]===this._newModuleNames[c];c++);this._onlyNameChanged=c===this._moduleNames.length-1,(0,y.assert)(this._type!==v.Folder||this._onlyNameChanged,"We only support simple rename for folder")}static createForModule(e,t,n,s,i,r){if(e.fileSystem.existsSync(s)){if((0,h.isFile)(e.fileSystem,s))return this._create(e,t,n,s,i,v.File,r);if((0,h.isDirectory)(e.fileSystem,s)){if("Renamed"!==(0,h.getDirectoryChangeKind)(e.fileSystem,s,i))return;let a=(0,h.combinePaths)(s,"__init__.pyi");if(!e.fileSystem.existsSync(a)&&(a=(0,h.combinePaths)(s,"__init__.py"),!e.fileSystem.existsSync(a)))return;return this._create(e,t,n,a,(0,h.combinePaths)(i,(0,h.getFileName)(a)),v.Folder,r)}}}static createForSymbol(e,t,n,s,i,a,o){if(!e.fileSystem.existsSync(s))return;const l=a.filter((e=>(0,r.isClassDeclaration)(e)||(0,r.isFunctionDeclaration)(e)||(0,r.isVariableDeclaration)(e)));return 0!==l.length?this._create(e,t,n,s,i,v.Symbol,l,o):void 0}static getRenameModulePath(e){const t=e.find((e=>!e.node));if(t)return t.path;const n=[...e.reduce(((e,t)=>e.add(t.path)),new Set)],s=n.findIndex((e=>(0,d.isStubFile)(e)));return s>=0?n[s]:n[0]}static getRenameModulePathInfo(e,t){const n=function(e){if("__init__"===(0,h.stripFileExtension)((0,h.getFileName)(e)))return(0,h.getDirectoryPath)(e);return e}(e),s=function(e,t){const n=(0,h.getFileExtension)(e),s=(0,h.getDirectoryPath)(e);return(0,h.combinePaths)(s,`${t}${n}`)}(n,t);return{filePath:n,newFilePath:s}}static _create(e,t,n,i,r,l,c,p){const u=t.findExecEnvironment(i),m=e.getModuleNameForImport(i,u);if(!m.moduleName)return;const y=e.getModuleNameForImport(r,u);if(!y.moduleName)return;p=s.CancellationToken.is(c)?c:p;const h=s.CancellationToken.is(c)?[]:c;return 0===h.length&&(h.push((0,a.createSynthesizedAliasDeclaration)(i)),(0,d.isStubFile)(i)&&(e.resolveImport(i,u,(0,o.createImportedModuleDescriptor)(m.moduleName)),e.getSourceFilesFromStub(i,u,!1).forEach((e=>h.push((0,a.createSynthesizedAliasDeclaration)(e)))))),new b(e.fileSystem,n,i,r,m,y,l,h,p)}renameReferences(e,t){switch(this._type){case v.Folder:return this._renameFolderReferences(e,t);case v.File:return this._renameModuleReferences(e,t);case v.Symbol:return this._updateSymbolReferences(e,t);default:return(0,y.assertNever)(this._type,`${this._type} is unknown`)}}_updateSymbolReferences(e,t){var n,s,i,o;const p=new _.DocumentSymbolCollector(null!==(n=(0,a.getNameFromDeclaration)(this._declarations[0]))&&void 0!==n?n:"",this._declarations,this._evaluator,this._token,t.parseTree,!0,!1),d=(0,l.getTopLevelImports)(t.parseTree,!0),m=d.orderedImports.find((e=>e.moduleName===this._newModuleName)),y=new Set,h=new Map;for(const n of p.collect()){const a=n.node;if(49===a.nodeType)continue;if((0,c.isFromImportName)(a)){const n=null===(s=a.parent)||void 0===s?void 0:s.parent,r=this._getNewModuleName(e,n.module.leadingDots>0,!1);if(1===n.imports.length)this._addResultWithTextRange(e,n.module,t,r);else{const s=a.parent;this._addFromImportNameDeletion(e,t,y,n.imports,s);const o={name:s.name.value,alias:null===(i=s.alias)||void 0===i?void 0:i.value};this._addResultEdits(this._getTextEditsForNewOrExistingFromImport(e,n,t,y,d,r,[o]))}continue}const l=(0,c.getDottedNameWithGivenNodeAsLastName)(a);if(l===a||35!==l.nodeType)continue;const p=35===l.leftExpression.nodeType?l.leftExpression.memberName:38===l.leftExpression.nodeType?l.leftExpression:void 0;if(!p)continue;const m=null===(o=this._evaluator.getDeclarationsForNameNode(p))||void 0===o?void 0:o.filter((e=>(0,r.isAliasDeclaration)(e)&&(21===e.node.nodeType||23===e.node.nodeType)));if(!m||0===m.length)continue;const g=m[0].node;(0,u.getOrAdd)(h,g,(()=>[])).push(l)}for(const[n,s]of h){let i;if(this._canReplaceImportName(t,n,s)){const s=this._getReferenceModuleName(d,m);if(21===n.nodeType)s?(i=s,this._addImportNameDeletion(e,t,y,n.parent.list,n)):(i=n.alias?n.alias.value:this._newModuleName,this._addResultWithTextRange(e,n.module,t,this._newModuleName));else if(s)i=s,this._addFromImportNameDeletion(e,t,y,n.parent.imports,n);else{const s=n.parent,r=this._getNewModuleName(e,s.module.leadingDots>0,!0);i=n.alias?n.alias.value:this._newLastModuleName,this._addResultWithTextRange(e,s.module,t,r),this._addResultWithTextRange(e,n.name,t,this._newLastModuleName)}}else{const n=this._getReferenceModuleName(d,m);n?i=n:(i=this._newModuleName,this._addResultEdits((0,l.getTextEditsForAutoImportInsertion)([],d,this._newModuleName,(0,l.getImportGroupFromModuleNameAndType)(this._newModuleNameAndType),t,(0,g.convertOffsetToPosition)(t.parseTree.length,t.tokenizerOutput.lines)).map((t=>({filePath:e,range:t.range,replacementText:t.replacementText})))))}for(const n of s)this._addResultWithTextRange(e,n.leftExpression,t,i)}}_getReferenceModuleName(e,t){var n,s;if(t&&20===t.node.nodeType)return(null===(n=t.subnode)||void 0===n?void 0:n.alias)?t.subnode.alias.value:this._newModuleName;if(null===(s=e.implicitImports)||void 0===s?void 0:s.has(this._newModuleFilePath)){const t=e.implicitImports.get(this._newModuleFilePath);return t.alias?t.alias.value:t.name.value}}_canReplaceImportName(e,t,n){var s;const i=null!==(s=t.alias)&&void 0!==s?s:21===t.nodeType?t.module.nameParts[t.module.nameParts.length-1]:t.name,r=_.DocumentSymbolCollector.getDeclarationsForNode(i,this._evaluator,!1,this._token);if(0===r.length)return!1;const a=new _.DocumentSymbolCollector(i.value,r,this._evaluator,this._token,e.parseTree,!0,!1);for(const e of a.collect())if(!((0,c.isImportModuleName)(e.node)||(0,c.isImportAlias)(e.node)||(0,c.isFromImportModuleName)(e.node)||(0,c.isFromImportName)(e.node)||(0,c.isFromImportAlias)(e.node)||n.some((t=>f.TextRange.containsRange(t,e.node)))))return!1;return!0}_renameFolderReferences(e,t){const n=new _.DocumentSymbolCollector(this.lastModuleName,this._declarations,this._evaluator,this._token,t.parseTree,!0,!1);for(const s of n.collect())this._addResultWithTextRange(e,s.range,t,this._newLastModuleName)}_renameModuleReferences(e,t){const n=new _.DocumentSymbolCollector(this.lastModuleName,this._declarations,this._evaluator,this._token,t.parseTree,!0,!1),s=new Set,i=n.collect();this._updateModuleReferences(e,t,s,i),this._updateRelativeModuleNamePath(e,t,s,i)}_updateRelativeModuleNamePath(e,t,n,s){if(e!==this._moduleFilePath)return;let i;for(const r of this._getNewRelativeModuleNamesForFileMoved(e,I.collect(t.parseTree).filter((e=>!s.some((t=>f.TextRange.containsRange(e.parent,t.node))))))){if(this._addResultWithTextRange(e,r.moduleName,t,r.newModuleName),!r.itemsToMove)continue;const s=r.moduleName.parent;for(const i of r.itemsToMove)this._addFromImportNameDeletion(e,t,n,s.imports,i);i=null!=i?i:(0,l.getTopLevelImports)(t.parseTree,!1),this._addResultEdits(this._getTextEditsForNewOrExistingFromImport(e,s,t,n,i,(0,l.getRelativeModuleName)(this._fs,this._newModuleFilePath,this._newModuleFilePath,!1,!0),r.itemsToMove.map((e=>{var t;return{name:e.name.value,alias:null===(t=e.alias)||void 0===t?void 0:t.value}}))))}}_updateModuleReferences(e,t,n,s){var i,a,o,p,d;let u;for(const m of s){const y=m.node;if(49===y.nodeType){this._addResultWithTextRange(e,m.range,t,this._newLastModuleName);continue}if((0,c.isImportModuleName)(y)){if(!(0,c.isLastNameOfModuleName)(y))continue;const n=(0,c.getFirstAncestorOrSelfOfKind)(y,37);if(1===n.nameParts.length&&21===(null===(i=n.parent)||void 0===i?void 0:i.nodeType)&&!n.parent.alias&&this._newModuleNames.length>1){this._aliasIntroduced.add(n.parent),this._addResultWithTextRange(e,n,t,`${this._newModuleName} as ${this._newLastModuleName}`);continue}this._addResultWithTextRange(e,n,t,this._newModuleName);continue}if((0,c.isImportAlias)(y)){this._addResultWithTextRange(e,m.range,t,this._newLastModuleName);continue}if((0,c.isFromImportModuleName)(y)){if(!(0,c.isLastNameOfModuleName)(y))continue;const i=(0,c.getFirstAncestorOrSelfOfKind)(y,37),r=i.parent,a=[],o=[];for(const e of r.imports)this._isExportedSymbol(e.name)?a.push(e):o.push(e);if(0===o.length){this._addResultWithTextRange(e,i,t,this._getNewModuleName(e,i.leadingDots>0,!1));continue}if(0===a.length)continue;if(r.module.leadingDots>0)for(const n of this._getNewRelativeModuleNamesForFileMoved(e,[r.module]))this._addResultWithTextRange(e,n.moduleName,t,n.newModuleName);for(const s of a)this._addFromImportNameDeletion(e,t,n,r.imports,s);u=null!=u?u:(0,l.getTopLevelImports)(t.parseTree,!1),this._addResultEdits(this._getTextEditsForNewOrExistingFromImport(e,r,t,n,u,this._newModuleName,a.map((e=>{var t;return{name:s.findIndex((t=>t.node===e.name))>=0?this._newLastModuleName:e.name.value,alias:s.findIndex((t=>t.node===e.alias))>=0?this._newLastModuleName:null===(t=e.alias)||void 0===t?void 0:t.value}}))));continue}if((0,c.isFromImportName)(y)){if(n.has(y.id))continue;const s=null===(a=y.parent)||void 0===a?void 0:a.parent,i=this._getNewModuleName(e,s.module.leadingDots>0,!0);if(this._isExportedSymbol(y)){this._addResultWithTextRange(e,m.range,t,this._newLastModuleName);continue}if(1===s.imports.length)this._addResultWithTextRange(e,s.module,t,i),this._addResultWithTextRange(e,m.range,t,this._newLastModuleName);else{const r=y.parent;if(s.module.leadingDots>0)for(const n of this._getNewRelativeModuleNamesForFileMoved(e,[s.module]))this._addResultWithTextRange(e,n.moduleName,t,n.newModuleName);this._addFromImportNameDeletion(e,t,n,s.imports,r),u=null!=u?u:(0,l.getTopLevelImports)(t.parseTree,!1);const a={name:this._newLastModuleName,alias:(null===(o=r.alias)||void 0===o?void 0:o.value)===this.lastModuleName?this._newLastModuleName:null===(p=r.alias)||void 0===p?void 0:p.value};this._addResultEdits(this._getTextEditsForNewOrExistingFromImport(e,s,t,n,u,i,[a]))}continue}if((0,c.isFromImportAlias)(y)){if(n.has(y.id))continue;this._addResultWithTextRange(e,m.range,t,this._newLastModuleName);continue}const h=_.DocumentSymbolCollector.getDeclarationsForNode(y,this._evaluator,!1,this._token).filter((e=>(0,r.isAliasDeclaration)(e)));if(this._onlyNameChanged)this._addResultWithTextRange(e,m.range,t,this._newLastModuleName);else if(null==h?void 0:h.some((e=>!(e.usesLocalName||e.node&&21!==e.node.nodeType||this._aliasIntroduced.has(e.node))))){const n=(0,c.getDottedNameWithGivenNodeAsLastName)(y);if(35!==(null===(d=n.parent)||void 0===d?void 0:d.nodeType)){this._addResultWithTextRange(e,n,t,this._newModuleName);continue}const s=this._evaluator.getDeclarationsForNameNode(n.parent.memberName);if(!s||0===s.length)continue;this._addResultWithTextRange(e,n,t,this._newModuleName)}else m.node.value===this._newLastModuleName||this._addResultWithTextRange(e,m.range,t,this._newLastModuleName)}}_getNewRelativeModuleNamesForFileMoved(e,t){if(e!==this._moduleFilePath)return[];const n="__init__"===(0,h.stripFileExtension)((0,h.getFileName)(e)),s=(0,h.getDirectoryPath)(e),i=[];for(const e of t){if(0===e.leadingDots)continue;const t=this._getNewModuleNameInfoForFileMoved(e,n,s);if(!t)continue;const r=(0,l.getRelativeModuleName)(this._fs,t.src,t.dest,!1,!0);i.push({moduleName:e,newModuleName:r,itemsToMove:t.itemsToMove})}return i}_getNewModuleNameInfoForFileMoved(e,t,n){const s=(0,i.getImportInfo)(e);if(!s)return;let r=s.resolvedPaths[s.resolvedPaths.length-1];if(!r){if(0!==e.nameParts.length)return;{const t=(0,l.getDirectoryLeadingDotsPointsTo)(n,e.leadingDots);if(!t)return;r=(0,h.combinePaths)(t,"__init__.py")}}if(this._moduleFilePath!==r||!t)return{src:this._newModuleFilePath,dest:r};const a=[],o=[];for(const t of e.parent.imports)this._isExportedSymbol(t.name)?a.push(t):o.push(t);return 0===o.length?{src:this._newModuleFilePath,dest:this._newModuleFilePath}:0===a.length?{src:this._newModuleFilePath,dest:this._moduleFilePath}:{src:this._newModuleFilePath,dest:this._moduleFilePath,itemsToMove:[...a]}}_isExportedSymbol(e){const t=this._evaluator.getDeclarationsForNameNode(e);return!!t&&!t.some((e=>(0,r.isAliasDeclaration)(e)&&e.submoduleFallback))}_getNewModuleName(e,t,n){const s=e===this._moduleFilePath?this._newModuleFilePath:e,i=t?(0,l.getRelativeModuleName)(this._fs,s,this._newModuleFilePath,n,!0):this._newModuleName;if(n&&i.endsWith(this._newLastModuleName)){const e=i===this._newLastModuleName?0:i.length>this._newLastModuleName.length+1&&"."!==i[i.length-this._newLastModuleName.length-2]?1:0,t=i.length-this._newLastModuleName.length-e,n=i.substr(0,t);return n.length>0?n:"."}return i}getEdits(){const e=[];return this._results.forEach((t=>(0,u.appendArray)(e,t))),e}get lastModuleName(){return this._moduleNames[this._moduleNames.length-1]}get _moduleName(){return this._moduleNameAndType.moduleName}get _newLastModuleName(){return this._newModuleNames[this._newModuleNames.length-1]}get _newModuleName(){return this._newModuleNameAndType.moduleName}_addImportNameDeletion(e,t,n,s,i){this._addImportNameDeletionInternal(e,t,n,s,i,20),n.add(i.module.id),i.module.nameParts.forEach((e=>n.add(e.id))),i.alias&&n.add(i.alias.id)}_addFromImportNameDeletion(e,t,n,s,i){this._addImportNameDeletionInternal(e,t,n,s,i,22),n.add(i.name.id),i.alias&&n.add(i.alias.id)}_addImportNameDeletionInternal(e,t,n,s,i,r){const a=(0,l.getTextRangeForImportNameDeletion)(s,s.findIndex((e=>e===i)));this._addResultWithTextRange(e,a,t,""),n.add(i.id);let o=0;for(o=s.length-1;o>=0&&n.has(s[o].id);o--);if(-1===o){const n=(0,c.getFirstAncestorOrSelfOfKind)(i,r);n&&this._addResultWithRange(e,(0,c.getFullStatementRange)(n,t.tokenizerOutput),"")}else if(o>=0&&o<s.length-2){const n=f.TextRange.getEnd(s[o]),i=f.TextRange.getEnd(s[o+1])-n;this._addResultWithTextRange(e,{start:n,length:i},t,"")}}_addResultWithTextRange(e,t,n,s){n.text.substr(t.start,t.length)!==s&&this._addResultWithRange(e,(0,g.convertTextRangeToRange)(t,n.tokenizerOutput.lines),s)}_addResultEdits(e){e.forEach((e=>this._addResultWithRange(e.filePath,e.range,e.replacementText)))}_getDeletionsForSpan(e,t){var n;return(0,m.isString)(e)&&(e=null!==(n=this._results.get(e))&&void 0!==n?n:[]),e.filter((e=>""===e.replacementText&&(0,f.doRangesIntersect)(e.range,t)))}_removeEdits(e,t){var n;(0,m.isString)(e)&&(e=null!==(n=this._results.get(e))&&void 0!==n?n:[]),(0,u.removeArrayElements)(e,(e=>t.findIndex((t=>t===e))>=0))}_addResultWithRange(e,t,n){const s=(0,u.getOrAdd)(this._results,e,(()=>[]));if(""===n){const e=this._getDeletionsForSpan(s,t);e.length>0&&(this._removeEdits(s,e),(0,f.extendRange)(t,e.map((e=>e.range))))}s.some((e=>(0,f.rangesAreEqual)(e.range,t)&&e.replacementText===n))||s.push({filePath:e,range:t,replacementText:n})}_getTextEditsForNewOrExistingFromImport(e,t,n,s,i,r,a){const o=i.orderedImports.find((e=>e.moduleName===r));if(o&&22===o.node.nodeType&&!o.node.isWildcardImport){const i=(0,l.getTextEditsForAutoImportSymbolAddition)(a,o,n);if(o.node!==t)return i.map((t=>({filePath:e,range:t.range,replacementText:t.replacementText})));if(this._onlyNameChanged&&1===a.length&&1===i.length){const r=this._getDeletionsForSpan(e,i[0].range);if(0===r.length)return[{filePath:e,range:i[0].range,replacementText:i[0].replacementText}];{const i=a[0].alias===this._newLastModuleName?this.lastModuleName:a[0].alias,o=t.imports.find((e=>{var t;return e.name.value===this.lastModuleName&&(null===(t=e.alias)||void 0===t?void 0:t.value)===i}));if(o)return this._removeEdits(e,r),o.alias&&s.delete(o.alias.id),[{filePath:e,range:(0,g.convertTextRangeToRange)(o.name,n.tokenizerOutput.lines),replacementText:this._newLastModuleName}]}}}return(0,l.getTextEditsForAutoImportInsertion)(a,i,r,(0,l.getImportGroupFromModuleNameAndType)(this._newModuleNameAndType),n,(0,g.convertOffsetToPosition)(n.parseTree.length,n.tokenizerOutput.lines)).map((t=>({filePath:e,range:t.range,replacementText:t.replacementText})))}}t.RenameModuleProvider=b;class I extends p.ParseTreeWalker{constructor(){super(...arguments),this._result=[]}walk(e){(0,T.isExpressionNode)(e)||super.walk(e)}visitModuleName(e){return this._result.push(e),!1}static collect(e){const t=new I;return t.walk(e),t._result}}},75659:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.SignatureHelpProvider=void 0;const a=n(29335),o=n(21736),l=n(20822),c=r(n(23241)),p=n(23241),d=n(38213),u=n(28348),m=n(31807);t.SignatureHelpProvider=class{static getSignatureHelpForPosition(e,t,n,s,i,r){var a;(0,d.throwIfCancellationRequested)(r);const o=(0,u.convertPositionToOffset)(t,e.tokenizerOutput.lines);if(void 0===o)return;let l=c.findNodeByOffset(e.parseTree,o);const m=l,y=l?c.getNodeDepth(l):0;let h=o-1;for(;h>=0&&","!==e.text.substr(h,1);){const t=c.findNodeByOffset(e.parseTree,h);if(t&&t!==m){c.getNodeDepth(t)>y&&(l=t);break}h--}if(void 0===l)return;const g=(0,p.getCallNodeAndActiveParameterIndex)(l,o,e.tokenizerOutput.tokens);if(!g)return;const f=s.getCallSignatureInfo(g.callNode,g.activeIndex,g.activeOrFake);if(!f)return;return{signatures:f.signatures.map((e=>this._makeSignature(f.callNode,e,n,s,i))),callHasParameters:!!(null===(a=f.callNode.arguments)||void 0===a?void 0:a.length)}}static _makeSignature(e,t,n,s,i){var r;const c=t.type,p=s.printFunctionParts(c),d=[],u=null!==(r=(0,m.getFunctionDocStringFromType)(c,n,s))&&void 0!==r?r:this._getDocStringFromCallNode(e,n,s);let y="(";const h=c.details.parameters;let g;p[0].forEach(((e,t)=>{let n="";t<h.length?n=h[t].name||"":h.length>0&&(n=h[h.length-1].name||""),d.push({startOffset:y.length,endOffset:y.length+e.length,text:e,documentation:(0,l.extractParameterDocumentation)(u||"",n)}),y+=e,t<p[0].length-1&&(y+=", ")})),y+=") -> "+p[1],t.activeParam&&(g=h.indexOf(t.activeParam),-1===g&&(g=void 0));const f={label:y,parameters:d,activeParameter:g};return u&&(i===a.MarkupKind.Markdown?f.documentation={kind:a.MarkupKind.Markdown,value:(0,o.convertDocStringToMarkdown)(u)}:f.documentation={kind:a.MarkupKind.PlainText,value:(0,o.convertDocStringToPlainText)(u)}),f}static _getDocStringFromCallNode(e,t,n){var s;let i;const r=e.leftExpression;if(38===r.nodeType?i=r:35===r.nodeType&&(i=r.memberName),i)for(const e of null!==(s=n.getDeclarationsForNameNode(i))&&void 0!==s?s:[]){const s=n.resolveAliasDeclaration(e,!0);if(!s)continue;const r=n.getType(i);if(!r)continue;const a=(0,m.getDocumentationPartsForTypeAndDecl)(t,r,s,n);if(a.length>0)return a.join("\n\n")}}}},31807:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.getAutoImportText=t.getDocumentationPartsForTypeAndDecl=t.getOverloadedFunctionDocStringsFromType=t.getFunctionDocStringFromType=t.getOverloadedFunctionTooltip=void 0;const a=r(n(23241)),o=n(58333),l=n(59195),c=n(98173);function p(e,t,n){const s=e.details.declaration,i=s?a.getEnclosingClass(s.node):void 0,r=i?n.getTypeOfClass(i):void 0;return(0,o.getFunctionDocStringInherited)(e,s,t,null==r?void 0:r.classType)}function d(e,t,n){if(0===e.overloads.length)return[];const s=e.overloads[0].details.declaration,i=s?a.getEnclosingClass(s.node):void 0,r=i?n.getTypeOfClass(i):void 0;return(0,o.getOverloadedFunctionDocStringsInherited)(e,e.overloads.map((e=>e.details.declaration)).filter(c.isDefined),t,n,null==r?void 0:r.classType)}t.getOverloadedFunctionTooltip=function(e,t,n=70){let s="";const i=e.overloads.filter((e=>l.FunctionType.isOverloaded(e))).map((e=>e.details.name+t.printType(e,!1)));for(let e=0;e<i.length;e++)0!==e&&i[e].length>n&&i[e-1].length<=n&&(s+="\n"),s+=i[e],e<i.length-1&&(s+="\n",i[e].length>n&&(s+="\n"));return s},t.getFunctionDocStringFromType=p,t.getOverloadedFunctionDocStringsFromType=d,t.getDocumentationPartsForTypeAndDecl=function(e,t,n,s){if(1===(null==n?void 0:n.type)&&n.typeAliasName&&n.docString)return[n.docString];if((0,l.isModule)(t)){const s=(0,o.getModuleDocString)(t,n,e);if(s)return[s]}else if((0,l.isInstantiableClass)(t)){const s=(0,o.getClassDocString)(t,n,e);if(s)return[s]}else if((0,l.isFunction)(t)){const n=p(t,e,s);if(n)return[n]}else{if((0,l.isOverloadedFunction)(t))return d(t,e,s);if(1===(null==n?void 0:n.type)){const t=(0,o.getVariableDocString)(n,e);if(t)return[t]}else if(3===(null==n?void 0:n.type)){const t=(0,o.getPropertyDocStringInherited)(n,e,s);if(t)return[t]}}return[]},t.getAutoImportText=function(e,t,n){let s;return s=t?`from ${t} import ${e}`:`import ${e}`,n&&(s=`${s} as ${n}`),s}},74426:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Localizer=t.setLocaleOverride=t.ParameterizedString=void 0;const s=n(20823),i=n(5213),r=n(51527),a=n(54678),o=n(84337),l=n(65082),c=n(91918),p=n(58165),d=n(59216);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 m="en-us",y=new Map([["de",r],["en-us",i],["es",a],["fr",o],["ja",l],["ru",c],["zh-cn",p],["zh-tw",d]]);let h,g,f={};function T(e){void 0===h&&(h=function(){f=function(){const e=v(m);if(e)return e;return console.error("Could not load default strings"),{}}();return function(e){if(e===m)return{};let t=v(e);if(void 0!==t)return t;const n=e.split("-");if(n.length>0&&n[0]&&(t=v(n[0]),void 0!==t))return t;return{}}(function(){if(g)return g;try{if(null===navigator||void 0===navigator?void 0:navigator.language)return navigator.language.toLowerCase()}catch{}const e=process.env,t=e.VSCODE_NLS_CONFIG;if(t)try{return JSON.parse(t).locale}catch{}const n=e.LC_ALL||e.LC_MESSAGES||e.LANG||e.LANGUAGE;if(n){const e=n.split(".");if(e.length>0&&e[0])return e[0]}return m}())}());const t=e.split("."),n=_(h,t)||_(f,t);if(n)return n;(0,s.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 v(e){return y.get(e)}t.setLocaleOverride=function(e){g=e.toLowerCase()},function(e){let t,n,s,i;!function(e){e.annotatedParamCountMismatch=()=>new u(T("Diagnostic.annotatedParamCountMismatch")),e.annotatedTypeArgMissing=()=>T("Diagnostic.annotatedTypeArgMissing"),e.annotationFormatString=()=>T("Diagnostic.annotationFormatString"),e.annotationNotSupported=()=>T("Diagnostic.annotationNotSupported"),e.annotationSpansStrings=()=>T("Diagnostic.annotationSpansStrings"),e.annotationStringEscape=()=>T("Diagnostic.annotationStringEscape"),e.argAssignment=()=>new u(T("Diagnostic.argAssignment")),e.argAssignmentFunction=()=>new u(T("Diagnostic.argAssignmentFunction")),e.argAssignmentParam=()=>new u(T("Diagnostic.argAssignmentParam")),e.argAssignmentParamFunction=()=>new u(T("Diagnostic.argAssignmentParamFunction")),e.argMissingForParam=()=>new u(T("Diagnostic.argMissingForParam")),e.argMissingForParams=()=>new u(T("Diagnostic.argMissingForParams")),e.argMorePositionalExpectedCount=()=>new u(T("Diagnostic.argMorePositionalExpectedCount")),e.argMorePositionalExpectedOne=()=>T("Diagnostic.argMorePositionalExpectedOne"),e.argPositional=()=>T("Diagnostic.argPositional"),e.argPositionalExpectedCount=()=>new u(T("Diagnostic.argPositionalExpectedCount")),e.argPositionalExpectedOne=()=>T("Diagnostic.argPositionalExpectedOne"),e.argTypePartiallyUnknown=()=>T("Diagnostic.argTypePartiallyUnknown"),e.argTypeUnknown=()=>T("Diagnostic.argTypeUnknown"),e.assertAlwaysTrue=()=>T("Diagnostic.assertAlwaysTrue"),e.assertTypeArgs=()=>T("Diagnostic.assertTypeArgs"),e.assertTypeTypeMismatch=()=>new u(T("Diagnostic.assertTypeTypeMismatch")),e.assignmentExprContext=()=>T("Diagnostic.assignmentExprContext"),e.assignmentExprComprehension=()=>new u(T("Diagnostic.assignmentExprComprehension")),e.assignmentExprInSubscript=()=>T("Diagnostic.assignmentExprInSubscript"),e.assignmentInProtocol=()=>T("Diagnostic.assignmentInProtocol"),e.assignmentTargetExpr=()=>T("Diagnostic.assignmentTargetExpr"),e.asyncNotInAsyncFunction=()=>T("Diagnostic.asyncNotInAsyncFunction"),e.awaitIllegal=()=>T("Diagnostic.awaitIllegal"),e.awaitNotInAsync=()=>T("Diagnostic.awaitNotInAsync"),e.backticksIllegal=()=>T("Diagnostic.backticksIllegal"),e.baseClassCircular=()=>T("Diagnostic.baseClassCircular"),e.baseClassInvalid=()=>T("Diagnostic.baseClassInvalid"),e.baseClassFinal=()=>new u(T("Diagnostic.baseClassFinal")),e.baseClassMethodTypeIncompatible=()=>new u(T("Diagnostic.baseClassMethodTypeIncompatible")),e.baseClassVariableTypeIncompatible=()=>new u(T("Diagnostic.baseClassVariableTypeIncompatible")),e.baseClassUnknown=()=>T("Diagnostic.baseClassUnknown"),e.bindTypeMismatch=()=>new u(T("Diagnostic.bindTypeMismatch")),e.breakOutsideLoop=()=>T("Diagnostic.breakOutsideLoop"),e.callableExtraArgs=()=>T("Diagnostic.callableExtraArgs"),e.callableFirstArg=()=>T("Diagnostic.callableFirstArg"),e.callableSecondArg=()=>T("Diagnostic.callableSecondArg"),e.casePatternIsIrrefutable=()=>T("Diagnostic.casePatternIsIrrefutable"),e.classAlreadySpecialized=()=>new u(T("Diagnostic.classAlreadySpecialized")),e.classDecoratorTypeUnknown=()=>T("Diagnostic.classDecoratorTypeUnknown"),e.classDefinitionCycle=()=>new u(T("Diagnostic.classDefinitionCycle")),e.classGetItemClsParam=()=>T("Diagnostic.classGetItemClsParam"),e.classMethodClsParam=()=>T("Diagnostic.classMethodClsParam"),e.classNotRuntimeSubscriptable=()=>new u(T("Diagnostic.classNotRuntimeSubscriptable")),e.classPatternBuiltInArgCount=()=>T("Diagnostic.classPatternBuiltInArgCount"),e.classPatternBuiltInArgPositional=()=>T("Diagnostic.classPatternBuiltInArgPositional"),e.classPatternTypeAlias=()=>new u(T("Diagnostic.classPatternTypeAlias")),e.classVarNotAllowed=()=>T("Diagnostic.classVarNotAllowed"),e.classVarFirstArgMissing=()=>T("Diagnostic.classVarFirstArgMissing"),e.classVarOverridesInstanceVar=()=>new u(T("Diagnostic.classVarOverridesInstanceVar")),e.classVarTooManyArgs=()=>T("Diagnostic.classVarTooManyArgs"),e.classVarWithTypeVar=()=>T("Diagnostic.classVarWithTypeVar"),e.clsSelfParamTypeMismatch=()=>new u(T("Diagnostic.clsSelfParamTypeMismatch")),e.codeTooComplexToAnalyze=()=>T("Diagnostic.codeTooComplexToAnalyze"),e.comparisonAlwaysFalse=()=>new u(T("Diagnostic.comparisonAlwaysFalse")),e.comparisonAlwaysTrue=()=>new u(T("Diagnostic.comparisonAlwaysTrue")),e.comprehensionInDict=()=>T("Diagnostic.comprehensionInDict"),e.comprehensionInSet=()=>T("Diagnostic.comprehensionInSet"),e.concatenateParamSpecMissing=()=>T("Diagnostic.concatenateParamSpecMissing"),e.concatenateTypeArgsMissing=()=>T("Diagnostic.concatenateTypeArgsMissing"),e.constantRedefinition=()=>new u(T("Diagnostic.constantRedefinition")),e.constructorNoArgs=()=>new u(T("Diagnostic.constructorNoArgs")),e.constructorParametersMismatch=()=>new u(T("Diagnostic.constructorParametersMismatch")),e.continueInFinally=()=>T("Diagnostic.continueInFinally"),e.continueOutsideLoop=()=>T("Diagnostic.continueOutsideLoop"),e.dataClassBaseClassNotFrozen=()=>T("Diagnostic.dataClassBaseClassNotFrozen"),e.dataClassFieldWithDefault=()=>T("Diagnostic.dataClassFieldWithDefault"),e.dataClassPostInitParamCount=()=>new u(T("Diagnostic.dataClassPostInitParamCount")),e.dataClassPostInitType=()=>new u(T("Diagnostic.dataClassPostInitType")),e.dataClassSlotsOverwrite=()=>T("Diagnostic.dataClassSlotsOverwrite"),e.dataClassTransformExpectedBoolLiteral=()=>T("Diagnostic.dataClassTransformExpectedBoolLiteral"),e.dataClassTransformFieldDescriptor=()=>new u(T("Diagnostic.dataClassTransformFieldDescriptor")),e.dataClassTransformPositionalParam=()=>T("Diagnostic.dataClassTransformPositionalParam"),e.dataClassTransformUnknownArgument=()=>new u(T("Diagnostic.dataClassTransformUnknownArgument")),e.declaredReturnTypePartiallyUnknown=()=>new u(T("Diagnostic.declaredReturnTypePartiallyUnknown")),e.declaredReturnTypeUnknown=()=>T("Diagnostic.declaredReturnTypeUnknown"),e.defaultValueContainsCall=()=>T("Diagnostic.defaultValueContainsCall"),e.defaultValueNotAllowed=()=>T("Diagnostic.defaultValueNotAllowed"),e.defaultValueNotEllipsis=()=>T("Diagnostic.defaultValueNotEllipsis"),e.deprecatedType=()=>new u(T("Diagnostic.deprecatedType")),e.dictExpandIllegalInComprehension=()=>T("Diagnostic.dictExpandIllegalInComprehension"),e.dictInAnnotation=()=>T("Diagnostic.dictInAnnotation"),e.dictKeyValuePairs=()=>T("Diagnostic.dictKeyValuePairs"),e.dictUnpackIsNotMapping=()=>T("Diagnostic.dictUnpackIsNotMapping"),e.delTargetExpr=()=>T("Diagnostic.delTargetExpr"),e.dunderAllSymbolNotPresent=()=>new u(T("Diagnostic.dunderAllSymbolNotPresent")),e.duplicateArgsParam=()=>T("Diagnostic.duplicateArgsParam"),e.duplicateBaseClass=()=>T("Diagnostic.duplicateBaseClass"),e.duplicateCatchAll=()=>T("Diagnostic.duplicateCatchAll"),e.duplicateEnumMember=()=>new u(T("Diagnostic.duplicateEnumMember")),e.duplicateImport=()=>new u(T("Diagnostic.duplicateImport")),e.duplicateKwargsParam=()=>T("Diagnostic.duplicateKwargsParam"),e.duplicateKeywordOnly=()=>T("Diagnostic.duplicateKeywordOnly"),e.duplicateParam=()=>new u(T("Diagnostic.duplicateParam")),e.duplicateCapturePatternTarget=()=>new u(T("Diagnostic.duplicateCapturePatternTarget")),e.duplicateStarPattern=()=>T("Diagnostic.duplicateStarPattern"),e.duplicateStarStarPattern=()=>T("Diagnostic.duplicateStarStarPattern"),e.duplicatePositionOnly=()=>T("Diagnostic.duplicatePositionOnly"),e.duplicateUnpack=()=>T("Diagnostic.duplicateUnpack"),e.ellipsisContext=()=>T("Diagnostic.ellipsisContext"),e.ellipsisSecondArg=()=>T("Diagnostic.ellipsisSecondArg"),e.enumClassOverride=()=>new u(T("Diagnostic.enumClassOverride")),e.exceptionGroupIncompatible=()=>T("Diagnostic.exceptionGroupIncompatible"),e.exceptionTypeIncorrect=()=>new u(T("Diagnostic.exceptionTypeIncorrect")),e.exceptionTypeNotClass=()=>new u(T("Diagnostic.exceptionTypeNotClass")),e.exceptionTypeNotInstantiable=()=>new u(T("Diagnostic.exceptionTypeNotInstantiable")),e.expectedAfterDecorator=()=>T("Diagnostic.expectedAfterDecorator"),e.expectedArrow=()=>T("Diagnostic.expectedArrow"),e.expectedAsAfterException=()=>T("Diagnostic.expectedAsAfterException"),e.expectedAssignRightHandExpr=()=>T("Diagnostic.expectedAssignRightHandExpr"),e.expectedBinaryRightHandExpr=()=>T("Diagnostic.expectedBinaryRightHandExpr"),e.expectedBoolLiteral=()=>T("Diagnostic.expectedBoolLiteral"),e.expectedCase=()=>T("Diagnostic.expectedCase"),e.expectedClassName=()=>T("Diagnostic.expectedClassName"),e.expectedCloseBrace=()=>T("Diagnostic.expectedCloseBrace"),e.expectedCloseBracket=()=>T("Diagnostic.expectedCloseBracket"),e.expectedCloseParen=()=>T("Diagnostic.expectedCloseParen"),e.expectedColon=()=>T("Diagnostic.expectedColon"),e.expectedComplexNumberLiteral=()=>T("Diagnostic.expectedComplexNumberLiteral"),e.expectedDecoratorExpr=()=>T("Diagnostic.expectedDecoratorExpr"),e.expectedDecoratorName=()=>T("Diagnostic.expectedDecoratorName"),e.expectedDecoratorNewline=()=>T("Diagnostic.expectedDecoratorNewline"),e.expectedDelExpr=()=>T("Diagnostic.expectedDelExpr"),e.expectedElse=()=>T("Diagnostic.expectedElse"),e.expectedExceptionClass=()=>T("Diagnostic.expectedExceptionClass"),e.expectedExceptionObj=()=>T("Diagnostic.expectedExceptionObj"),e.expectedExpr=()=>T("Diagnostic.expectedExpr"),e.expectedImport=()=>T("Diagnostic.expectedImport"),e.expectedImportAlias=()=>T("Diagnostic.expectedImportAlias"),e.expectedImportSymbols=()=>T("Diagnostic.expectedImportSymbols"),e.expectedIdentifier=()=>T("Diagnostic.expectedIdentifier"),e.expectedIndentedBlock=()=>T("Diagnostic.expectedIndentedBlock"),e.expectedIn=()=>T("Diagnostic.expectedIn"),e.expectedInExpr=()=>T("Diagnostic.expectedInExpr"),e.expectedFunctionAfterAsync=()=>T("Diagnostic.expectedFunctionAfterAsync"),e.expectedFunctionName=()=>T("Diagnostic.expectedFunctionName"),e.expectedMemberName=()=>T("Diagnostic.expectedMemberName"),e.expectedModuleName=()=>T("Diagnostic.expectedModuleName"),e.expectedNameAfterAs=()=>T("Diagnostic.expectedNameAfterAs"),e.expectedNamedParameter=()=>T("Diagnostic.expectedNamedParameter"),e.expectedNewline=()=>T("Diagnostic.expectedNewline"),e.expectedNewlineOrSemicolon=()=>T("Diagnostic.expectedNewlineOrSemicolon"),e.expectedOpenParen=()=>T("Diagnostic.expectedOpenParen"),e.expectedParamName=()=>T("Diagnostic.expectedParamName"),e.expectedPatternExpr=()=>T("Diagnostic.expectedPatternExpr"),e.expectedPatternSubjectExpr=()=>T("Diagnostic.expectedPatternSubjectExpr"),e.expectedPatternValue=()=>T("Diagnostic.expectedPatternValue"),e.expectedReturnExpr=()=>T("Diagnostic.expectedReturnExpr"),e.expectedSliceIndex=()=>T("Diagnostic.expectedSliceIndex"),e.expectedTypeNotString=()=>T("Diagnostic.expectedTypeNotString"),e.expectedYieldExpr=()=>T("Diagnostic.expectedYieldExpr"),e.finalClassIsAbstract=()=>new u(T("Diagnostic.finalClassIsAbstract")),e.finalContext=()=>T("Diagnostic.finalContext"),e.finalMethodOverride=()=>new u(T("Diagnostic.finalMethodOverride")),e.finalReassigned=()=>new u(T("Diagnostic.finalReassigned")),e.finalRedeclaration=()=>new u(T("Diagnostic.finalRedeclaration")),e.finalRedeclarationBySubclass=()=>new u(T("Diagnostic.finalRedeclarationBySubclass")),e.finalTooManyArgs=()=>T("Diagnostic.finalTooManyArgs"),e.finalUnassigned=()=>new u(T("Diagnostic.finalUnassigned")),e.formatStringBrace=()=>T("Diagnostic.formatStringBrace"),e.formatStringBytes=()=>T("Diagnostic.formatStringBytes"),e.formatStringEscape=()=>T("Diagnostic.formatStringEscape"),e.formatStringInPattern=()=>T("Diagnostic.formatStringInPattern"),e.formatStringIllegal=()=>T("Diagnostic.formatStringIllegal"),e.formatStringUnicode=()=>T("Diagnostic.formatStringUnicode"),e.formatStringUnterminated=()=>T("Diagnostic.formatStringUnterminated"),e.functionDecoratorTypeUnknown=()=>T("Diagnostic.functionDecoratorTypeUnknown"),e.functionInConditionalExpression=()=>T("Diagnostic.functionInConditionalExpression"),e.generatorAsyncReturnType=()=>T("Diagnostic.generatorAsyncReturnType"),e.generatorNotParenthesized=()=>T("Diagnostic.generatorNotParenthesized"),e.generatorSyncReturnType=()=>T("Diagnostic.generatorSyncReturnType"),e.genericClassAssigned=()=>T("Diagnostic.genericClassAssigned"),e.genericClassDeleted=()=>T("Diagnostic.genericClassDeleted"),e.genericNotAllowed=()=>T("Diagnostic.genericNotAllowed"),e.genericTypeAliasBoundTypeVar=()=>new u(T("Diagnostic.genericTypeAliasBoundTypeVar")),e.genericTypeArgMissing=()=>T("Diagnostic.genericTypeArgMissing"),e.genericTypeArgTypeVar=()=>T("Diagnostic.genericTypeArgTypeVar"),e.genericTypeArgUnique=()=>T("Diagnostic.genericTypeArgUnique"),e.globalReassignment=()=>new u(T("Diagnostic.globalReassignment")),e.globalRedefinition=()=>new u(T("Diagnostic.globalRedefinition")),e.implicitStringConcat=()=>T("Diagnostic.implicitStringConcat"),e.importCycleDetected=()=>T("Diagnostic.importCycleDetected"),e.importDepthExceeded=()=>new u(T("Diagnostic.importDepthExceeded")),e.importResolveFailure=()=>new u(T("Diagnostic.importResolveFailure")),e.importSourceResolveFailure=()=>new u(T("Diagnostic.importSourceResolveFailure")),e.importSymbolUnknown=()=>new u(T("Diagnostic.importSymbolUnknown")),e.incompatibleMethodOverride=()=>new u(T("Diagnostic.incompatibleMethodOverride")),e.inconsistentIndent=()=>T("Diagnostic.inconsistentIndent"),e.inconsistentTabs=()=>T("Diagnostic.inconsistentTabs"),e.initMustReturnNone=()=>T("Diagnostic.initMustReturnNone"),e.initSubclassClsParam=()=>T("Diagnostic.initSubclassClsParam"),e.instanceMethodSelfParam=()=>T("Diagnostic.instanceMethodSelfParam"),e.instanceVarOverridesClassVar=()=>new u(T("Diagnostic.instanceVarOverridesClassVar")),e.instantiateAbstract=()=>new u(T("Diagnostic.instantiateAbstract")),e.instantiateProtocol=()=>new u(T("Diagnostic.instantiateProtocol")),e.internalBindError=()=>new u(T("Diagnostic.internalBindError")),e.internalParseError=()=>new u(T("Diagnostic.internalParseError")),e.internalTypeCheckingError=()=>new u(T("Diagnostic.internalTypeCheckingError")),e.invalidIdentifierChar=()=>T("Diagnostic.invalidIdentifierChar"),e.invalidStubStatement=()=>T("Diagnostic.invalidStubStatement"),e.invalidTokenChars=()=>new u(T("Diagnostic.invalidTokenChars")),e.isInstanceInvalidType=()=>new u(T("Diagnostic.isInstanceInvalidType")),e.isSubclassInvalidType=()=>new u(T("Diagnostic.isSubclassInvalidType")),e.keyValueInSet=()=>T("Diagnostic.keyValueInSet"),e.keywordArgInTypeArgument=()=>T("Diagnostic.keywordArgInTypeArgument"),e.keywordOnlyAfterArgs=()=>T("Diagnostic.keywordOnlyAfterArgs"),e.keywordSubscriptIllegal=()=>T("Diagnostic.keywordSubscriptIllegal"),e.lambdaReturnTypeUnknown=()=>T("Diagnostic.lambdaReturnTypeUnknown"),e.lambdaReturnTypePartiallyUnknown=()=>new u(T("Diagnostic.lambdaReturnTypePartiallyUnknown")),e.listAssignmentMismatch=()=>new u(T("Diagnostic.listAssignmentMismatch")),e.listInAnnotation=()=>T("Diagnostic.listInAnnotation"),e.literalUnsupportedType=()=>T("Diagnostic.literalUnsupportedType"),e.literalEmptyArgs=()=>T("Diagnostic.literalEmptyArgs"),e.literalNotCallable=()=>T("Diagnostic.literalNotCallable"),e.matchIncompatible=()=>T("Diagnostic.matchIncompatible"),e.matchIsNotExhaustive=()=>T("Diagnostic.matchIsNotExhaustive"),e.maxParseDepthExceeded=()=>T("Diagnostic.maxParseDepthExceeded"),e.memberAccess=()=>new u(T("Diagnostic.memberAccess")),e.memberDelete=()=>new u(T("Diagnostic.memberDelete")),e.memberSet=()=>new u(T("Diagnostic.memberSet")),e.metaclassConflict=()=>T("Diagnostic.metaclassConflict"),e.metaclassDuplicate=()=>T("Diagnostic.metaclassDuplicate"),e.metaclassIsGeneric=()=>T("Diagnostic.metaclassIsGeneric"),e.methodNotDefined=()=>new u(T("Diagnostic.methodNotDefined")),e.methodNotDefinedOnType=()=>new u(T("Diagnostic.methodNotDefinedOnType")),e.methodOrdering=()=>T("Diagnostic.methodOrdering"),e.methodOverridden=()=>new u(T("Diagnostic.methodOverridden")),e.methodReturnsNonObject=()=>new u(T("Diagnostic.methodReturnsNonObject")),e.missingProtocolMembers=()=>T("Diagnostic.missingProtocolMembers"),e.missingSuperCall=()=>new u(T("Diagnostic.missingSuperCall")),e.moduleAsType=()=>T("Diagnostic.moduleAsType"),e.moduleNotCallable=()=>T("Diagnostic.moduleNotCallable"),e.moduleUnknownMember=()=>new u(T("Diagnostic.moduleUnknownMember")),e.namedExceptAfterCatchAll=()=>T("Diagnostic.namedExceptAfterCatchAll"),e.namedParamAfterParamSpecArgs=()=>new u(T("Diagnostic.namedParamAfterParamSpecArgs")),e.namedTupleEmptyName=()=>T("Diagnostic.namedTupleEmptyName"),e.namedTupleFirstArg=()=>T("Diagnostic.namedTupleFirstArg"),e.namedTupleMultipleInheritance=()=>T("Diagnostic.namedTupleMultipleInheritance"),e.namedTupleNameType=()=>T("Diagnostic.namedTupleNameType"),e.namedTupleNameUnique=()=>T("Diagnostic.namedTupleNameUnique"),e.namedTupleNoTypes=()=>T("Diagnostic.namedTupleNoTypes"),e.namedTupleSecondArg=()=>T("Diagnostic.namedTupleSecondArg"),e.newClsParam=()=>T("Diagnostic.newClsParam"),e.newTypeLiteral=()=>T("Diagnostic.newTypeLiteral"),e.newTypeNotAClass=()=>T("Diagnostic.newTypeNotAClass"),e.newTypeProtocolClass=()=>T("Diagnostic.newTypeProtocolClass"),e.nonDefaultAfterDefault=()=>T("Diagnostic.nonDefaultAfterDefault"),e.noneNotCallable=()=>T("Diagnostic.noneNotCallable"),e.noneNotIterable=()=>T("Diagnostic.noneNotIterable"),e.noneNotSubscriptable=()=>T("Diagnostic.noneNotSubscriptable"),e.noneNotUsableWith=()=>T("Diagnostic.noneNotUsableWith"),e.noneOperator=()=>new u(T("Diagnostic.noneOperator")),e.noneUnknownMember=()=>new u(T("Diagnostic.noneUnknownMember")),e.nonLocalNoBinding=()=>new u(T("Diagnostic.nonLocalNoBinding")),e.nonLocalReassignment=()=>new u(T("Diagnostic.nonLocalReassignment")),e.nonLocalRedefinition=()=>new u(T("Diagnostic.nonLocalRedefinition")),e.nonLocalInModule=()=>T("Diagnostic.nonLocalInModule"),e.noOverload=()=>new u(T("Diagnostic.noOverload")),e.noReturnContainsReturn=()=>T("Diagnostic.noReturnContainsReturn"),e.noReturnContainsYield=()=>T("Diagnostic.noReturnContainsYield"),e.noReturnReturnsNone=()=>T("Diagnostic.noReturnReturnsNone"),e.notRequiredArgCount=()=>T("Diagnostic.notRequiredArgCount"),e.notRequiredNotInTypedDict=()=>T("Diagnostic.notRequiredNotInTypedDict"),e.objectNotCallable=()=>new u(T("Diagnostic.objectNotCallable")),e.obscuredClassDeclaration=()=>new u(T("Diagnostic.obscuredClassDeclaration")),e.obscuredFunctionDeclaration=()=>new u(T("Diagnostic.obscuredFunctionDeclaration")),e.obscuredMethodDeclaration=()=>new u(T("Diagnostic.obscuredMethodDeclaration")),e.obscuredParameterDeclaration=()=>new u(T("Diagnostic.obscuredParameterDeclaration")),e.obscuredVariableDeclaration=()=>new u(T("Diagnostic.obscuredVariableDeclaration")),e.operatorLessOrGreaterDeprecated=()=>T("Diagnostic.operatorLessOrGreaterDeprecated"),e.optionalExtraArgs=()=>T("Diagnostic.optionalExtraArgs"),e.orPatternIrrefutable=()=>T("Diagnostic.orPatternIrrefutable"),e.orPatternMissingName=()=>T("Diagnostic.orPatternMissingName"),e.overlappingOverload=()=>new u(T("Diagnostic.overlappingOverload")),e.overloadAbstractMismatch=()=>new u(T("Diagnostic.overloadAbstractMismatch")),e.overloadImplementationMismatch=()=>new u(T("Diagnostic.overloadImplementationMismatch")),e.overloadReturnTypeMismatch=()=>new u(T("Diagnostic.overloadReturnTypeMismatch")),e.overloadWithImplementation=()=>new u(T("Diagnostic.overloadWithImplementation")),e.overloadWithoutImplementation=()=>new u(T("Diagnostic.overloadWithoutImplementation")),e.paramAfterKwargsParam=()=>T("Diagnostic.paramAfterKwargsParam"),e.paramAlreadyAssigned=()=>new u(T("Diagnostic.paramAlreadyAssigned")),e.paramAnnotationMissing=()=>new u(T("Diagnostic.paramAnnotationMissing")),e.paramNameMissing=()=>new u(T("Diagnostic.paramNameMissing")),e.paramSpecArgsKwargsUsage=()=>T("Diagnostic.paramSpecArgsKwargsUsage"),e.paramSpecArgsMissing=()=>new u(T("Diagnostic.paramSpecArgsMissing")),e.paramSpecArgsUsage=()=>T("Diagnostic.paramSpecArgsUsage"),e.paramSpecAssignedName=()=>new u(T("Diagnostic.paramSpecAssignedName")),e.paramSpecContext=()=>T("Diagnostic.paramSpecContext"),e.paramSpecFirstArg=()=>T("Diagnostic.paramSpecFirstArg"),e.paramSpecKwargsUsage=()=>T("Diagnostic.paramSpecKwargsUsage"),e.paramSpecNotBound=()=>new u(T("Diagnostic.paramSpecNotBound")),e.paramSpecNotUsedByOuterScope=()=>new u(T("Diagnostic.paramSpecNotUsedByOuterScope")),e.paramSpecUnknownArg=()=>T("Diagnostic.paramSpecUnknownArg"),e.paramSpecUnknownMember=()=>new u(T("Diagnostic.paramSpecUnknownMember")),e.paramSpecUnknownParam=()=>new u(T("Diagnostic.paramSpecUnknownParam")),e.paramTypeCovariant=()=>T("Diagnostic.paramTypeCovariant"),e.paramTypeUnknown=()=>new u(T("Diagnostic.paramTypeUnknown")),e.paramAssignmentMismatch=()=>new u(T("Diagnostic.paramAssignmentMismatch")),e.paramTypePartiallyUnknown=()=>new u(T("Diagnostic.paramTypePartiallyUnknown")),e.parenthesizedContextManagerIllegal=()=>T("Diagnostic.parenthesizedContextManagerIllegal"),e.positionArgAfterNamedArg=()=>T("Diagnostic.positionArgAfterNamedArg"),e.privateImportFromPyTypedModule=()=>new u(T("Diagnostic.privateImportFromPyTypedModule")),e.positionOnlyAfterArgs=()=>T("Diagnostic.positionOnlyAfterArgs"),e.positionOnlyAfterKeywordOnly=()=>T("Diagnostic.positionOnlyAfterKeywordOnly"),e.positionOnlyIncompatible=()=>T("Diagnostic.positionOnlyIncompatible"),e.positionOnlyFirstParam=()=>T("Diagnostic.positionOnlyFirstParam"),e.privateUsedOutsideOfClass=()=>new u(T("Diagnostic.privateUsedOutsideOfClass")),e.privateUsedOutsideOfModule=()=>new u(T("Diagnostic.privateUsedOutsideOfModule")),e.propertyOverridden=()=>new u(T("Diagnostic.propertyOverridden")),e.propertyStaticMethod=()=>T("Diagnostic.propertyStaticMethod"),e.protectedUsedOutsideOfClass=()=>new u(T("Diagnostic.protectedUsedOutsideOfClass")),e.protocolBaseClass=()=>new u(T("Diagnostic.protocolBaseClass")),e.protocolIllegal=()=>T("Diagnostic.protocolIllegal"),e.protocolMemberNotClassVar=()=>new u(T("Diagnostic.protocolMemberNotClassVar")),e.protocolNotAllowedInTypeArgument=()=>T("Diagnostic.protocolNotAllowedInTypeArgument"),e.protocolUsedInCall=()=>new u(T("Diagnostic.protocolUsedInCall")),e.protocolVarianceContravariant=()=>new u(T("Diagnostic.protocolVarianceContravariant")),e.protocolVarianceCovariant=()=>new u(T("Diagnostic.protocolVarianceCovariant")),e.protocolVarianceInvariant=()=>new u(T("Diagnostic.protocolVarianceInvariant")),e.recursiveDefinition=()=>new u(T("Diagnostic.recursiveDefinition")),e.relativeImportNotAllowed=()=>T("Diagnostic.relativeImportNotAllowed"),e.requiredArgCount=()=>T("Diagnostic.requiredArgCount"),e.requiredNotInTypedDict=()=>T("Diagnostic.requiredNotInTypedDict"),e.returnMissing=()=>new u(T("Diagnostic.returnMissing")),e.returnOutsideFunction=()=>T("Diagnostic.returnOutsideFunction"),e.returnTypeContravariant=()=>T("Diagnostic.returnTypeContravariant"),e.returnTypeMismatch=()=>new u(T("Diagnostic.returnTypeMismatch")),e.returnTypeUnknown=()=>T("Diagnostic.returnTypeUnknown"),e.returnTypePartiallyUnknown=()=>new u(T("Diagnostic.returnTypePartiallyUnknown")),e.revealLocalsArgs=()=>T("Diagnostic.revealLocalsArgs"),e.revealLocalsNone=()=>T("Diagnostic.revealLocalsNone"),e.revealTypeArgs=()=>T("Diagnostic.revealTypeArgs"),e.revealTypeExpectedTextArg=()=>T("Diagnostic.revealTypeExpectedTextArg"),e.revealTypeExpectedTextMismatch=()=>new u(T("Diagnostic.revealTypeExpectedTextMismatch")),e.revealTypeExpectedTypeMismatch=()=>new u(T("Diagnostic.revealTypeExpectedTypeMismatch")),e.selfTypeContext=()=>T("Diagnostic.selfTypeContext"),e.selfTypeWithTypedSelfOrCls=()=>T("Diagnostic.selfTypeWithTypedSelfOrCls"),e.setterGetterTypeMismatch=()=>T("Diagnostic.setterGetterTypeMismatch"),e.starPatternInAsPattern=()=>T("Diagnostic.starPatternInAsPattern"),e.starPatternInOrPattern=()=>T("Diagnostic.starPatternInOrPattern"),e.singleOverload=()=>new u(T("Diagnostic.singleOverload")),e.slotsAttributeError=()=>new u(T("Diagnostic.slotsAttributeError")),e.slotsClassVarConflict=()=>new u(T("Diagnostic.slotsClassVarConflict")),e.starStarWildcardNotAllowed=()=>T("Diagnostic.starStarWildcardNotAllowed"),e.staticClsSelfParam=()=>T("Diagnostic.staticClsSelfParam"),e.strictTypeGuardReturnType=()=>new u(T("Diagnostic.strictTypeGuardReturnType")),e.stringNonAsciiBytes=()=>T("Diagnostic.stringNonAsciiBytes"),e.stringNotSubscriptable=()=>T("Diagnostic.stringNotSubscriptable"),e.stringUnsupportedEscape=()=>T("Diagnostic.stringUnsupportedEscape"),e.stringUnterminated=()=>T("Diagnostic.stringUnterminated"),e.stubFileMissing=()=>new u(T("Diagnostic.stubFileMissing")),e.stubUsesGetAttr=()=>T("Diagnostic.stubUsesGetAttr"),e.sublistParamsIncompatible=()=>T("Diagnostic.sublistParamsIncompatible"),e.superCallArgCount=()=>T("Diagnostic.superCallArgCount"),e.superCallFirstArg=()=>new u(T("Diagnostic.superCallFirstArg")),e.superCallSecondArg=()=>new u(T("Diagnostic.superCallSecondArg")),e.superCallZeroArgForm=()=>T("Diagnostic.superCallZeroArgForm"),e.symbolIsUnbound=()=>new u(T("Diagnostic.symbolIsUnbound")),e.symbolIsUndefined=()=>new u(T("Diagnostic.symbolIsUndefined")),e.symbolIsPossiblyUnbound=()=>new u(T("Diagnostic.symbolIsPossiblyUnbound")),e.symbolOverridden=()=>new u(T("Diagnostic.symbolOverridden")),e.totalOrderingMissingMethod=()=>T("Diagnostic.totalOrderingMissingMethod"),e.trailingCommaInFromImport=()=>T("Diagnostic.trailingCommaInFromImport"),e.tryWithoutExcept=()=>T("Diagnostic.tryWithoutExcept"),e.tupleAssignmentMismatch=()=>new u(T("Diagnostic.tupleAssignmentMismatch")),e.tupleInAnnotation=()=>T("Diagnostic.tupleInAnnotation"),e.tupleIndexOutOfRange=()=>new u(T("Diagnostic.tupleIndexOutOfRange")),e.typeAliasIsRecursiveDirect=()=>new u(T("Diagnostic.typeAliasIsRecursiveDirect")),e.typeAliasIsRecursiveIndirect=()=>new u(T("Diagnostic.typeAliasIsRecursiveIndirect")),e.typeAliasNotInModuleOrClass=()=>T("Diagnostic.typeAliasNotInModuleOrClass"),e.typeAliasRedeclared=()=>new u(T("Diagnostic.typeAliasRedeclared")),e.typeAnnotationCall=()=>T("Diagnostic.typeAnnotationCall"),e.typeAnnotationVariable=()=>T("Diagnostic.typeAnnotationVariable"),e.typeArgListExpected=()=>T("Diagnostic.typeArgListExpected"),e.typeArgListNotAllowed=()=>T("Diagnostic.typeArgListNotAllowed"),e.typeArgsExpectingNone=()=>new u(T("Diagnostic.typeArgsExpectingNone")),e.typeArgsMismatchOne=()=>new u(T("Diagnostic.typeArgsMismatchOne")),e.typeArgsMissingForAlias=()=>new u(T("Diagnostic.typeArgsMissingForAlias")),e.typeArgsMissingForClass=()=>new u(T("Diagnostic.typeArgsMissingForClass")),e.typeArgsTooFew=()=>new u(T("Diagnostic.typeArgsTooFew")),e.typeArgsTooMany=()=>new u(T("Diagnostic.typeArgsTooMany")),e.typeAssignmentMismatch=()=>new u(T("Diagnostic.typeAssignmentMismatch")),e.typeCallNotAllowed=()=>T("Diagnostic.typeCallNotAllowed"),e.typedDictAccess=()=>T("Diagnostic.typedDictAccess"),e.typedDictBadVar=()=>T("Diagnostic.typedDictBadVar"),e.typedDictBaseClass=()=>T("Diagnostic.typedDictBaseClass"),e.typedDictDelete=()=>T("Diagnostic.typedDictDelete"),e.typedDictEmptyName=()=>T("Diagnostic.typedDictEmptyName"),e.typedDictEntryName=()=>T("Diagnostic.typedDictEntryName"),e.typedDictEntryUnique=()=>T("Diagnostic.typedDictEntryUnique"),e.typedDictExtraArgs=()=>T("Diagnostic.typedDictExtraArgs"),e.typedDictFieldRedefinition=()=>new u(T("Diagnostic.typedDictFieldRedefinition")),e.typedDictFirstArg=()=>T("Diagnostic.typedDictFirstArg"),e.typedDictSecondArgDict=()=>T("Diagnostic.typedDictSecondArgDict"),e.typedDictSecondArgDictEntry=()=>T("Diagnostic.typedDictSecondArgDictEntry"),e.typedDictSet=()=>T("Diagnostic.typedDictSet"),e.typedDictTotalParam=()=>T("Diagnostic.typedDictTotalParam"),e.typeExpectedClass=()=>new u(T("Diagnostic.typeExpectedClass")),e.typeGuardArgCount=()=>T("Diagnostic.typeGuardArgCount"),e.typeNotAwaitable=()=>new u(T("Diagnostic.typeNotAwaitable")),e.typeNotCallable=()=>new u(T("Diagnostic.typeNotCallable")),e.typeNotIntantiable=()=>new u(T("Diagnostic.typeNotIntantiable")),e.typeNotIterable=()=>new u(T("Diagnostic.typeNotIterable")),e.typeNotSpecializable=()=>new u(T("Diagnostic.typeNotSpecializable")),e.typeNotSubscriptable=()=>new u(T("Diagnostic.typeNotSubscriptable")),e.typeNotUsableWith=()=>new u(T("Diagnostic.typeNotUsableWith")),e.typeNotSupportBinaryOperator=()=>new u(T("Diagnostic.typeNotSupportBinaryOperator")),e.typeNotSupportBinaryOperatorBidirectional=()=>new u(T("Diagnostic.typeNotSupportBinaryOperatorBidirectional")),e.typeNotSupportUnaryOperator=()=>new u(T("Diagnostic.typeNotSupportUnaryOperator")),e.typeNotSupportUnaryOperatorBidirectional=()=>new u(T("Diagnostic.typeNotSupportUnaryOperatorBidirectional")),e.typePartiallyUnknown=()=>new u(T("Diagnostic.typePartiallyUnknown")),e.typeUnknown=()=>new u(T("Diagnostic.typeUnknown")),e.typeVarAssignedName=()=>new u(T("Diagnostic.typeVarAssignedName")),e.typeVarAssignmentMismatch=()=>new u(T("Diagnostic.typeVarAssignmentMismatch")),e.typeVarBoundAndConstrained=()=>T("Diagnostic.typeVarBoundAndConstrained"),e.typeVarFirstArg=()=>T("Diagnostic.typeVarFirstArg"),e.typeVarGeneric=()=>T("Diagnostic.typeVarGeneric"),e.typeVarNoMember=()=>new u(T("Diagnostic.typeVarNoMember")),e.typeVarNotSubscriptable=()=>new u(T("Diagnostic.typeVarNotSubscriptable")),e.typeVarNotUsedByOuterScope=()=>new u(T("Diagnostic.typeVarNotUsedByOuterScope")),e.typeVarSingleConstraint=()=>T("Diagnostic.typeVarSingleConstraint"),e.typeVarsNotInGeneric=()=>T("Diagnostic.typeVarsNotInGeneric"),e.typeVarTupleMustBeUnpacked=()=>T("Diagnostic.typeVarTupleMustBeUnpacked"),e.typeVarTupleContext=()=>T("Diagnostic.typeVarTupleContext"),e.typeVarUnknownParam=()=>new u(T("Diagnostic.typeVarUnknownParam")),e.typeVarUsedByOuterScope=()=>new u(T("Diagnostic.typeVarUsedByOuterScope")),e.typeVarUsedOnlyOnce=()=>new u(T("Diagnostic.typeVarUsedOnlyOnce")),e.typeVarVariance=()=>T("Diagnostic.typeVarVariance"),e.unaccessedClass=()=>new u(T("Diagnostic.unaccessedClass")),e.unaccessedFunction=()=>new u(T("Diagnostic.unaccessedFunction")),e.unaccessedImport=()=>new u(T("Diagnostic.unaccessedImport")),e.unaccessedSymbol=()=>new u(T("Diagnostic.unaccessedSymbol")),e.unaccessedVariable=()=>new u(T("Diagnostic.unaccessedVariable")),e.unexpectedAsyncToken=()=>T("Diagnostic.unexpectedAsyncToken"),e.unexpectedExprToken=()=>T("Diagnostic.unexpectedExprToken"),e.unexpectedIndent=()=>T("Diagnostic.unexpectedIndent"),e.unexpectedUnindent=()=>T("Diagnostic.unexpectedUnindent"),e.unionSyntaxIllegal=()=>T("Diagnostic.unionSyntaxIllegal"),e.unionTypeArgCount=()=>T("Diagnostic.unionTypeArgCount"),e.uninitializedInstanceVariable=()=>new u(T("Diagnostic.uninitializedInstanceVariable")),e.unnecessaryCast=()=>new u(T("Diagnostic.unnecessaryCast")),e.unnecessaryIsInstanceAlways=()=>new u(T("Diagnostic.unnecessaryIsInstanceAlways")),e.unnecessaryIsSubclassAlways=()=>new u(T("Diagnostic.unnecessaryIsSubclassAlways")),e.unnecessaryPyrightIgnore=()=>T("Diagnostic.unnecessaryPyrightIgnore"),e.unnecessaryPyrightIgnoreRule=()=>new u(T("Diagnostic.unnecessaryPyrightIgnoreRule")),e.unnecessaryTypeIgnore=()=>T("Diagnostic.unnecessaryTypeIgnore"),e.unpackArgCount=()=>T("Diagnostic.unpackArgCount"),e.unpackedArgInTypeArgument=()=>T("Diagnostic.unpackedArgInTypeArgument"),e.unpackedArgWithVariadicParam=()=>T("Diagnostic.unpackedArgWithVariadicParam"),e.unpackedDictArgumentNotMapping=()=>T("Diagnostic.unpackedDictArgumentNotMapping"),e.unpackedSubscriptIllegal=()=>T("Diagnostic.unpackedSubscriptIllegal"),e.unpackedTypedDictArgument=()=>T("Diagnostic.unpackedTypedDictArgument"),e.unpackedTypeVarTupleExpected=()=>new u(T("Diagnostic.unpackedTypeVarTupleExpected")),e.unpackExpectedTypedDict=()=>T("Diagnostic.unpackExpectedTypedDict"),e.unpackExpectedTypeVarTuple=()=>T("Diagnostic.unpackExpectedTypeVarTuple"),e.unpackIllegalInComprehension=()=>T("Diagnostic.unpackIllegalInComprehension"),e.unpackInAnnotation=()=>T("Diagnostic.unpackInAnnotation"),e.unpackInDict=()=>T("Diagnostic.unpackInDict"),e.unpackInSet=()=>T("Diagnostic.unpackInSet"),e.unpackNotAllowed=()=>T("Diagnostic.unpackNotAllowed"),e.unpackOperatorNotAllowed=()=>T("Diagnostic.unpackOperatorNotAllowed"),e.unpackTuplesIllegal=()=>T("Diagnostic.unpackTuplesIllegal"),e.unreachableCode=()=>T("Diagnostic.unreachableCode"),e.unreachableExcept=()=>T("Diagnostic.unreachableExcept"),e.unsupportedDunderAllOperation=()=>T("Diagnostic.unsupportedDunderAllOperation"),e.unusedCallResult=()=>new u(T("Diagnostic.unusedCallResult")),e.unusedCoroutine=()=>T("Diagnostic.unusedCoroutine"),e.unusedExpression=()=>T("Diagnostic.unusedExpression"),e.varAnnotationIllegal=()=>T("Diagnostic.varAnnotationIllegal"),e.variadicTypeArgsTooMany=()=>T("Diagnostic.variadicTypeArgsTooMany"),e.variadicTypeParamTooManyAlias=()=>new u(T("Diagnostic.variadicTypeParamTooManyAlias")),e.variadicTypeParamTooManyClass=()=>new u(T("Diagnostic.variadicTypeParamTooManyClass")),e.walrusIllegal=()=>T("Diagnostic.walrusIllegal"),e.walrusNotAllowed=()=>T("Diagnostic.walrusNotAllowed"),e.wildcardInFunction=()=>T("Diagnostic.wildcardInFunction"),e.wildcardLibraryImport=()=>T("Diagnostic.wildcardLibraryImport"),e.yieldFromIllegal=()=>T("Diagnostic.yieldFromIllegal"),e.yieldFromOutsideAsync=()=>T("Diagnostic.yieldFromOutsideAsync"),e.yieldOutsideFunction=()=>T("Diagnostic.yieldOutsideFunction"),e.yieldTypeMismatch=()=>new u(T("Diagnostic.yieldTypeMismatch")),e.yieldWithinListCompr=()=>T("Diagnostic.yieldWithinListCompr"),e.zeroCaseStatementsFound=()=>T("Diagnostic.zeroCaseStatementsFound"),e.zeroLengthTupleNotAllowed=()=>T("Diagnostic.zeroLengthTupleNotAllowed")}(t=e.Diagnostic||(e.Diagnostic={})),function(e){e.argParam=()=>new u(T("DiagnosticAddendum.argParam")),e.argParamFunction=()=>new u(T("DiagnosticAddendum.argParamFunction")),e.argsParamMissing=()=>new u(T("DiagnosticAddendum.argsParamMissing")),e.argsPositionOnly=()=>new u(T("DiagnosticAddendum.argsPositionOnly")),e.argumentType=()=>new u(T("DiagnosticAddendum.argumentType")),e.argumentTypes=()=>new u(T("DiagnosticAddendum.argumentTypes")),e.assignToNone=()=>T("DiagnosticAddendum.assignToNone"),e.asyncHelp=()=>T("DiagnosticAddendum.asyncHelp"),e.baseClassProvidesType=()=>new u(T("DiagnosticAddendum.baseClassProvidesType")),e.dataClassFrozen=()=>new u(T("DiagnosticAddendum.dataClassFrozen")),e.dataClassFieldLocation=()=>T("DiagnosticAddendum.dataClassFieldLocation"),e.finalMethod=()=>T("DiagnosticAddendum.finalMethod"),e.functionParamDefaultMissing=()=>new u(T("DiagnosticAddendum.functionParamDefaultMissing")),e.functionParamName=()=>new u(T("DiagnosticAddendum.functionParamName")),e.functionReturnTypeMismatch=()=>new u(T("DiagnosticAddendum.functionReturnTypeMismatch")),e.functionTooFewParams=()=>new u(T("DiagnosticAddendum.functionTooFewParams")),e.incompatibleGetter=()=>T("DiagnosticAddendum.incompatibleGetter"),e.incompatibleSetter=()=>T("DiagnosticAddendum.incompatibleSetter"),e.incompatibleDeleter=()=>T("DiagnosticAddendum.incompatibleDeleter"),e.initMethodLocation=()=>new u(T("DiagnosticAddendum.initMethodLocation")),e.initMethodSignature=()=>new u(T("DiagnosticAddendum.initMethodSignature")),e.functionTooManyParams=()=>new u(T("DiagnosticAddendum.functionTooManyParams")),e.keyNotRequired=()=>new u(T("DiagnosticAddendum.keyNotRequired")),e.keyRequiredDeleted=()=>new u(T("DiagnosticAddendum.keyRequiredDeleted")),e.keyUndefined=()=>new u(T("DiagnosticAddendum.keyUndefined")),e.kwargsParamMissing=()=>new u(T("DiagnosticAddendum.kwargsParamMissing")),e.listAssignmentMismatch=()=>new u(T("DiagnosticAddendum.listAssignmentMismatch")),e.literalAssignmentMismatch=()=>new u(T("DiagnosticAddendum.literalAssignmentMismatch")),e.matchIsNotExhaustiveType=()=>new u(T("DiagnosticAddendum.matchIsNotExhaustiveType")),e.matchIsNotExhaustiveHint=()=>T("DiagnosticAddendum.matchIsNotExhaustiveHint"),e.memberAssignment=()=>new u(T("DiagnosticAddendum.memberAssignment")),e.memberIsAbstract=()=>new u(T("DiagnosticAddendum.memberIsAbstract")),e.memberIsAbstractMore=()=>new u(T("DiagnosticAddendum.memberIsAbstractMore")),e.memberIsFinalInProtocol=()=>new u(T("DiagnosticAddendum.memberIsFinalInProtocol")),e.memberIsInitVar=()=>new u(T("DiagnosticAddendum.memberIsInitVar")),e.memberIsInvariant=()=>new u(T("DiagnosticAddendum.memberIsInvariant")),e.memberIsNotFinalInProtocol=()=>new u(T("DiagnosticAddendum.memberIsNotFinalInProtocol")),e.memberSetClassVar=()=>new u(T("DiagnosticAddendum.memberSetClassVar")),e.memberTypeMismatch=()=>new u(T("DiagnosticAddendum.memberTypeMismatch")),e.memberUnknown=()=>new u(T("DiagnosticAddendum.memberUnknown")),e.missingProtocolMember=()=>new u(T("DiagnosticAddendum.missingProtocolMember")),e.missingGetter=()=>T("DiagnosticAddendum.missingGetter"),e.missingSetter=()=>T("DiagnosticAddendum.missingSetter"),e.missingDeleter=()=>T("DiagnosticAddendum.missingDeleter"),e.namedParamMissingInDest=()=>new u(T("DiagnosticAddendum.namedParamMissingInDest")),e.namedParamMissingInSource=()=>new u(T("DiagnosticAddendum.namedParamMissingInSource")),e.namedParamTypeMismatch=()=>new u(T("DiagnosticAddendum.namedParamTypeMismatch")),e.newMethodLocation=()=>new u(T("DiagnosticAddendum.newMethodLocation")),e.newMethodSignature=()=>new u(T("DiagnosticAddendum.newMethodSignature")),e.noOverloadAssignable=()=>new u(T("DiagnosticAddendum.noOverloadAssignable")),e.orPatternMissingName=()=>new u(T("DiagnosticAddendum.orPatternMissingName")),e.overloadSignature=()=>T("DiagnosticAddendum.overloadSignature"),e.overloadNotAssignable=()=>new u(T("DiagnosticAddendum.overloadNotAssignable")),e.overloadWithImplementation=()=>T("DiagnosticAddendum.overloadWithImplementation"),e.overriddenMethod=()=>T("DiagnosticAddendum.overriddenMethod"),e.overriddenSymbol=()=>T("DiagnosticAddendum.overriddenSymbol"),e.overrideParamKeywordNoDefault=()=>new u(T("DiagnosticAddendum.overrideParamKeywordNoDefault")),e.overrideParamKeywordType=()=>new u(T("DiagnosticAddendum.overrideParamKeywordType")),e.overrideParamName=()=>new u(T("DiagnosticAddendum.overrideParamName")),e.overrideParamNameExtra=()=>new u(T("DiagnosticAddendum.overrideParamNameExtra")),e.overrideParamNameMissing=()=>new u(T("DiagnosticAddendum.overrideParamNameMissing")),e.overrideParamNamePositionOnly=()=>new u(T("DiagnosticAddendum.overrideParamNamePositionOnly")),e.overrideParamNoDefault=()=>new u(T("DiagnosticAddendum.overrideParamNoDefault")),e.overrideParamType=()=>new u(T("DiagnosticAddendum.overrideParamType")),e.overridePositionalParamCount=()=>new u(T("DiagnosticAddendum.overridePositionalParamCount")),e.overrideReturnType=()=>new u(T("DiagnosticAddendum.overrideReturnType")),e.overrideType=()=>new u(T("DiagnosticAddendum.overrideType")),e.paramAssignment=()=>new u(T("DiagnosticAddendum.paramAssignment")),e.paramSpecOverload=()=>T("DiagnosticAddendum.paramSpecOverload"),e.paramType=()=>new u(T("DiagnosticAddendum.paramType")),e.privateImportFromPyTypedSource=()=>new u(T("DiagnosticAddendum.privateImportFromPyTypedSource")),e.propertyAccessFromProtocolClass=()=>T("DiagnosticAddendum.propertyAccessFromProtocolClass"),e.propertyMethodIncompatible=()=>new u(T("DiagnosticAddendum.propertyMethodIncompatible")),e.propertyMethodMissing=()=>new u(T("DiagnosticAddendum.propertyMethodMissing")),e.propertyMissingDeleter=()=>new u(T("DiagnosticAddendum.propertyMissingDeleter")),e.propertyMissingSetter=()=>new u(T("DiagnosticAddendum.propertyMissingSetter")),e.protocolMemberClassVar=()=>new u(T("DiagnosticAddendum.protocolMemberClassVar")),e.protocolIncompatible=()=>new u(T("DiagnosticAddendum.protocolIncompatible")),e.protocolMemberMissing=()=>new u(T("DiagnosticAddendum.protocolMemberMissing")),e.protocolSourceIsNotConcrete=()=>new u(T("DiagnosticAddendum.protocolSourceIsNotConcrete")),e.readOnlyAttribute=()=>new u(T("DiagnosticAddendum.readOnlyAttribute")),e.seeDeclaration=()=>T("DiagnosticAddendum.seeDeclaration"),e.seeClassDeclaration=()=>T("DiagnosticAddendum.seeClassDeclaration"),e.seeFunctionDeclaration=()=>T("DiagnosticAddendum.seeFunctionDeclaration"),e.seeMethodDeclaration=()=>T("DiagnosticAddendum.seeMethodDeclaration"),e.seeParameterDeclaration=()=>T("DiagnosticAddendum.seeParameterDeclaration"),e.seeVariableDeclaration=()=>T("DiagnosticAddendum.seeVariableDeclaration"),e.tupleEntryTypeMismatch=()=>new u(T("DiagnosticAddendum.tupleEntryTypeMismatch")),e.tupleAssignmentMismatch=()=>new u(T("DiagnosticAddendum.tupleAssignmentMismatch")),e.tupleSizeMismatch=()=>new u(T("DiagnosticAddendum.tupleSizeMismatch")),e.tupleSizeMismatchIndeterminate=()=>new u(T("DiagnosticAddendum.tupleSizeMismatchIndeterminate")),e.typeAssignmentMismatch=()=>new u(T("DiagnosticAddendum.typeAssignmentMismatch")),e.typeBound=()=>new u(T("DiagnosticAddendum.typeBound")),e.typeConstrainedTypeVar=()=>new u(T("DiagnosticAddendum.typeConstrainedTypeVar")),e.typedDictFieldMissing=()=>new u(T("DiagnosticAddendum.typedDictFieldMissing")),e.typedDictFieldNotRequired=()=>new u(T("DiagnosticAddendum.typedDictFieldNotRequired")),e.typedDictFieldRedefinition=()=>new u(T("DiagnosticAddendum.typedDictFieldRedefinition")),e.typedDictFieldRequired=()=>new u(T("DiagnosticAddendum.typedDictFieldRequired")),e.typedDictFieldTypeMismatch=()=>new u(T("DiagnosticAddendum.typedDictFieldTypeMismatch")),e.typedDictFieldUndefined=()=>new u(T("DiagnosticAddendum.typedDictFieldUndefined")),e.typedDictFinalMismatch=()=>new u(T("DiagnosticAddendum.typedDictFinalMismatch")),e.typeIncompatible=()=>new u(T("DiagnosticAddendum.typeIncompatible")),e.typeNotCallable=()=>new u(T("DiagnosticAddendum.typeNotCallable")),e.typeNotClass=()=>new u(T("DiagnosticAddendum.typeNotClass")),e.typeParamSpec=()=>new u(T("DiagnosticAddendum.typeParamSpec")),e.typeNotStringLiteral=()=>new u(T("DiagnosticAddendum.typeNotStringLiteral")),e.typeOfSymbol=()=>new u(T("DiagnosticAddendum.typeOfSymbol")),e.typeUnsupported=()=>new u(T("DiagnosticAddendum.typeUnsupported")),e.typeVarIsContravariant=()=>new u(T("DiagnosticAddendum.typeVarIsContravariant")),e.typeVarIsCovariant=()=>new u(T("DiagnosticAddendum.typeVarIsCovariant")),e.typeVarIsInvariant=()=>new u(T("DiagnosticAddendum.typeVarIsInvariant")),e.typeVarTupleRequiresKnownLength=()=>T("DiagnosticAddendum.typeVarTupleRequiresKnownLength"),e.typeVarNotAllowed=()=>T("DiagnosticAddendum.typeVarNotAllowed"),e.typeVarsMissing=()=>new u(T("DiagnosticAddendum.typeVarsMissing")),e.unreachableExcept=()=>new u(T("DiagnosticAddendum.unreachableExcept")),e.useDictInstead=()=>T("DiagnosticAddendum.useDictInstead"),e.useListInstead=()=>T("DiagnosticAddendum.useListInstead"),e.useTupleInstead=()=>T("DiagnosticAddendum.useTupleInstead"),e.useTypeInstead=()=>T("DiagnosticAddendum.useTypeInstead")}(n=e.DiagnosticAddendum||(e.DiagnosticAddendum={})),function(e){e.addOptionalToAnnotation=()=>T("CodeAction.addOptionalToAnnotation"),e.createTypeStub=()=>T("CodeAction.createTypeStub"),e.createTypeStubFor=()=>new u(T("CodeAction.createTypeStubFor")),e.executingCommand=()=>T("CodeAction.executingCommand"),e.filesToAnalyzeOne=()=>T("CodeAction.filesToAnalyzeOne"),e.filesToAnalyzeCount=()=>new u(T("CodeAction.filesToAnalyzeCount")),e.findingReferences=()=>T("CodeAction.findingReferences"),e.organizeImports=()=>T("CodeAction.organizeImports")}(s=e.CodeAction||(e.CodeAction={})),function(e){e.moveFile=()=>new u(T("Refactoring.moveFile")),e.moveFileLabel=()=>new u(T("Refactoring.moveFileLabel")),e.moveFileDescription=()=>new u(T("Refactoring.moveFileDescription"))}(i=e.Refactoring||(e.Refactoring={}))}(t.Localizer||(t.Localizer={}))},83108:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getConnectionOptions=t.run=void 0;const s=n(9283),i=n(71267),r=n(68384);function a(){return{cancellationStrategy:(0,r.getCancellationStrategyFromArgv)(process.argv)}}t.run=function(e,t){n(6553).install(),i.isMainThread?e((0,s.createConnection)(a())):t()},t.getConnectionOptions=a},19794:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterStream=void 0;const s=n(49900);t.CharacterStream=class{constructor(e){this._text=e,this._position=0,this._currentChar=e.length>0?e.charCodeAt(0):0,this._isEndOfStream=0===e.length}getText(){return this._text}get position(){return this._position}set position(e){this._position=e,this._checkBounds()}get currentChar(){return this._currentChar}getCurrentChar(){return this._currentChar}get nextChar(){return this.position+1<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(0,s.isWhiteSpace)(this.currentChar)}isAtLineBreak(){return(0,s.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)}}},49900:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.isBinary=t.isOctal=t.isHex=t.isDecimal=t.isNumber=t.isLineBreak=t.isWhiteSpace=t.isSurrogateChar=t.isIdentifierChar=t.isIdentifierStartChar=void 0;const a=r(n(52846));var o;!function(e){e[e.NotIdentifierChar=0]="NotIdentifierChar",e[e.StartIdentifierChar=1]="StartIdentifierChar",e[e.IdentifierChar=2]="IdentifierChar",e[e.SurrogateChar=3]="SurrogateChar"}(o||(o={}));const l=256,c=new Array(l),p={},d={};let u=!1;function m(e){return e>=48&&e<=57||95===e}function y(e,t){if(p[e]!==o.SurrogateChar)return o.NotIdentifierChar;const n=d[e];return n?n[t]:o.NotIdentifierChar}t.isIdentifierStartChar=function(e,t){if(e<l)return c[e]===o.StartIdentifierChar;let n;return u||(b(!1),u=!0),n=void 0!==t?y(e,t):p[e],n===o.StartIdentifierChar},t.isIdentifierChar=function(e,t){return e<l?c[e]===o.StartIdentifierChar||c[e]===o.IdentifierChar:(u||(b(!1),u=!0),void 0!==t?y(e,t):p[e]===o.StartIdentifierChar||p[e]===o.IdentifierChar)},t.isSurrogateChar=function(e){return!(e<l)&&(u||(b(!1),u=!0),p[e]===o.SurrogateChar)},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=m,t.isHex=function(e){return m(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],a.unicodeLu,a.unicodeLl,a.unicodeLt,a.unicodeLo,a.unicodeLm,a.unicodeNl],g=[a.unicodeLuSurrogate,a.unicodeLlSurrogate,a.unicodeLoSurrogate,a.unicodeLmSurrogate,a.unicodeNlSurrogate],f=[[183,903,4969,4970,4971,4972,4973,4974,4975,4976,4977,6618],a.unicodeMn,a.unicodeMc,a.unicodeNd,a.unicodePc],T=[a.unicodeMnSurrogate,a.unicodeMcSurrogate,a.unicodeNdSurrogate];function _(e,t,n,s,i){for(let r=0;r<e.length;r++){const a=e[r];let o,c;Array.isArray(a)?(o=a[0],c=a[1]):o=c=a;for(let e=o;e<=c;e++)e<l?s[e]=t:i[e]=t;if(n&&o>=l)break}}function v(e,t){for(const n in e)d[n]||(d[n]={},p[n]=o.SurrogateChar),_(e[n],t,!1,d[n],d[n])}function b(e){if(c.fill(o.NotIdentifierChar),f.forEach((t=>{_(t,o.IdentifierChar,e,c,p)})),h.forEach((t=>{_(t,o.StartIdentifierChar,e,c,p)})),!e){for(const e of T)v(e,o.IdentifierChar);for(const e of g)v(e,o.StartIdentifierChar)}}b(!0)},55390:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SetNode=t.DictionaryExpandEntryNode=t.DictionaryKeyEntryNode=t.DictionaryNode=t.StringListNode=t.FormatStringNode=t.StringNode=t.NumberNode=t.EllipsisNode=t.ConstantNode=t.NameNode=t.LambdaNode=t.MemberAccessNode=t.YieldFromNode=t.YieldNode=t.SliceNode=t.IndexNode=t.ListComprehensionNode=t.CallNode=t.TupleNode=t.UnpackNode=t.TernaryNode=t.AwaitNode=t.AugmentedAssignmentNode=t.FunctionAnnotationNode=t.TypeAnnotationNode=t.AssignmentNode=t.AssignmentExpressionNode=t.BinaryOperationNode=t.UnaryOperationNode=t.ErrorNode=t.isExpressionNode=t.StatementListNode=t.DecoratorNode=t.WithItemNode=t.WithNode=t.ClassNode=t.ParameterNode=t.FunctionNode=t.ExceptNode=t.TryNode=t.ListComprehensionIfNode=t.ListComprehensionForNode=t.ForNode=t.WhileNode=t.IfNode=t.SuiteNode=t.ModuleNode=t.extendRange=t.getNextNodeId=void 0,t.PatternValueNode=t.PatternMappingExpandEntryNode=t.PatternMappingKeyEntryNode=t.PatternMappingNode=t.PatternCaptureNode=t.PatternClassArgumentNode=t.PatternClassNode=t.PatternLiteralNode=t.PatternAsNode=t.PatternSequenceNode=t.CaseNode=t.MatchNode=t.RaiseNode=t.ReturnNode=t.ContinueNode=t.BreakNode=t.AssertNode=t.NonlocalNode=t.GlobalNode=t.ImportFromAsNode=t.ImportFromNode=t.ImportAsNode=t.ModuleNameNode=t.ImportNode=t.PassNode=t.DelNode=t.ArgumentNode=t.ListNode=void 0;const s=n(80957);let i=1;function r(e,t){t.start<e.start&&(e.length+=e.start-t.start,e.start=t.start),s.TextRange.getEnd(t)>s.TextRange.getEnd(e)&&(e.length=s.TextRange.getEnd(t)-e.start)}t.getNextNodeId=function(){return i++},t.extendRange=r,function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:36,id:i++,statements:[]}}}(t.ModuleNode||(t.ModuleNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:50,id:i++,statements:[]}}}(t.SuiteNode||(t.SuiteNode={})),function(e){e.create=function(e,t,n,s){const a={start:e.start,length:e.length,nodeType:19,id:i++,testExpression:t,ifSuite:n,elseSuite:s};return t.parent=a,n.parent=a,r(a,t),r(a,n),s&&(r(a,s),s.parent=a),a}}(t.IfNode||(t.IfNode={})),function(e){e.create=function(e,t,n){const s={start:e.start,length:e.length,nodeType:57,id:i++,testExpression:t,whileSuite:n};return t.parent=s,n.parent=s,r(s,n),s}}(t.WhileNode||(t.WhileNode={})),function(e){e.create=function(e,t,n,s){const a={start:e.start,length:e.length,nodeType:26,id:i++,targetExpression:t,iterableExpression:n,forSuite:s};return t.parent=a,n.parent=a,s.parent=a,r(a,s),a}}(t.ForNode||(t.ForNode={})),function(e){e.create=function(e,t,n){const s={start:e.start,length:e.length,nodeType:33,id:i++,targetExpression:t,iterableExpression:n};return t.parent=s,n.parent=s,r(s,t),r(s,n),s}}(t.ListComprehensionForNode||(t.ListComprehensionForNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:34,id:i++,testExpression:t};return t.parent=n,r(n,t),n}}(t.ListComprehensionIfNode||(t.ListComprehensionIfNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:53,id:i++,trySuite:t,exceptClauses:[]};return t.parent=n,r(n,t),n}}(t.TryNode||(t.TryNode={})),function(e){e.create=function(e,t,n){const s={start:e.start,length:e.length,nodeType:25,id:i++,exceptSuite:t,isExceptGroup:n};return t.parent=s,r(s,t),s}}(t.ExceptNode||(t.ExceptNode={})),function(e){e.create=function(e,t,n){const s={start:e.start,length:e.length,nodeType:28,id:i++,decorators:[],name:t,parameters:[],suite:n};return t.parent=s,n.parent=s,r(s,n),s}}(t.FunctionNode||(t.FunctionNode={})),function(e){e.create=function(e,t){return{start:e.start,length:e.length,nodeType:41,id:i++,category:t}}}(t.ParameterNode||(t.ParameterNode={})),function(e){e.create=function(e,t,n){const s={start:e.start,length:e.length,nodeType:10,id:i++,decorators:[],name:t,arguments:[],suite:n};return t.parent=s,n.parent=s,r(s,n),s},e.createDummyForDecorators=function(e){const t={start:e[0].start,length:0,nodeType:10,id:i++,decorators:e,name:{start:e[0].start,length:0,id:0,nodeType:38,token:{type:7,start:0,length:0,comments:[],value:""},value:""},arguments:[],suite:{start:e[0].start,length:0,id:0,nodeType:50,statements:[]}};return e.forEach((e=>{e.parent=t,r(t,e)})),t.name.parent=t,t.suite.parent=t,t}}(t.ClassNode||(t.ClassNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:58,id:i++,withItems:[],suite:t};return t.parent=n,r(n,t),n}}(t.WithNode||(t.WithNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:59,id:i++,expression:e};return e.parent=t,t}}(t.WithItemNode||(t.WithItemNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:13,id:i++,expression:t};return t.parent=n,r(n,t),n}}(t.DecoratorNode||(t.DecoratorNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:47,id:i++,statements:[]}}}(t.StatementListNode||(t.StatementListNode={})),t.isExpressionNode=function(e){switch(e.nodeType){case 0:case 55:case 7:case 4:case 54:case 6:case 51:case 56:case 52:case 9:case 32:case 24:case 46:case 60:case 61:case 35:case 30:case 38:case 11:case 18:case 40:case 49:case 27:case 48:case 15:case 16:case 31:case 45:return!0;default:return!1}},function(e){e.create=function(e,t,n,s){const a={start:e.start,length:e.length,nodeType:0,id:i++,category:t,child:n,decorators:s};return n&&(n.parent=a,r(a,n)),s&&(s.forEach((e=>{e.parent=a})),s.length>0&&r(a,s[0])),a}}(t.ErrorNode||(t.ErrorNode={})),function(e){e.create=function(e,t,n){var s;const a={start:e.start,length:e.length,nodeType:55,id:i++,operator:n,operatorToken:e,expression:t};return t.parent=a,a.maxChildDepth=1+(null!==(s=t.maxChildDepth)&&void 0!==s?s:0),r(a,t),a}}(t.UnaryOperationNode||(t.UnaryOperationNode={})),function(e){e.create=function(e,t,n,s){var a,o;const l={start:e.start,length:e.length,nodeType:7,id:i++,leftExpression:e,operatorToken:n,operator:s,rightExpression:t};return e.parent=l,t.parent=l,l.maxChildDepth=1+Math.max(null!==(a=e.maxChildDepth)&&void 0!==a?a:0,null!==(o=t.maxChildDepth)&&void 0!==o?o:0),r(l,t),l}}(t.BinaryOperationNode||(t.BinaryOperationNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:4,id:i++,name:e,rightExpression:t};return e.parent=n,t.parent=n,r(n,t),n}}(t.AssignmentExpressionNode||(t.AssignmentExpressionNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:3,id:i++,leftExpression:e,rightExpression:t};return e.parent=n,t.parent=n,r(n,t),n}}(t.AssignmentNode||(t.AssignmentNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:54,id:i++,valueExpression:e,typeAnnotation:t};return e.parent=n,t.parent=n,r(n,t),n}}(t.TypeAnnotationNode||(t.TypeAnnotationNode={})),function(e){e.create=function(e,t,n,s){const a={start:e.start,length:e.length,nodeType:62,id:i++,isParamListEllipsis:t,paramTypeAnnotations:n,returnTypeAnnotation:s};return n.forEach((e=>{e.parent=a})),s.parent=a,r(a,s),a}}(t.FunctionAnnotationNode||(t.FunctionAnnotationNode={})),function(e){e.create=function(e,t,n,s){const a={start:e.start,length:e.length,nodeType:5,id:i++,leftExpression:e,operator:n,rightExpression:t,destExpression:s};return e.parent=a,t.parent=a,s.parent=a,r(a,t),a}}(t.AugmentedAssignmentNode||(t.AugmentedAssignmentNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:6,id:i++,expression:t};return t.parent=n,r(n,t),n}}(t.AwaitNode||(t.AwaitNode={})),function(e){e.create=function(e,t,n){const s={start:e.start,length:e.length,nodeType:51,id:i++,ifExpression:e,testExpression:t,elseExpression:n};return e.parent=s,t.parent=s,n.parent=s,r(s,n),s}}(t.TernaryNode||(t.TernaryNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:56,id:i++,expression:t};return t.parent=n,r(n,t),n}}(t.UnpackNode||(t.UnpackNode={})),function(e){e.create=function(e,t){return{start:e.start,length:e.length,nodeType:52,id:i++,expressions:[],enclosedInParens:t}}}(t.TupleNode||(t.TupleNode={})),function(e){e.create=function(e,t,n){var s;const a={start:e.start,length:e.length,nodeType:9,id:i++,leftExpression:e,arguments:t,trailingComma:n};return e.parent=a,a.maxChildDepth=1+(null!==(s=e.maxChildDepth)&&void 0!==s?s:0),t.length>0&&(t.forEach((e=>{e.parent=a})),r(a,t[t.length-1])),a}}(t.CallNode||(t.CallNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:32,id:i++,expression:e,forIfNodes:[]};return e.parent=t,t}}(t.ListComprehensionNode||(t.ListComprehensionNode={})),function(e){e.create=function(e,t,n,s){var a;const o={start:e.start,length:e.length,nodeType:24,id:i++,baseExpression:e,items:t,trailingComma:n};return e.parent=o,t.forEach((e=>{e.parent=o})),r(o,s),o.maxChildDepth=1+(null!==(a=e.maxChildDepth)&&void 0!==a?a:0),o}}(t.IndexNode||(t.IndexNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:46,id:i++}}}(t.SliceNode||(t.SliceNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:60,id:i++,expression:t};return t&&(t.parent=n,r(n,t)),n}}(t.YieldNode||(t.YieldNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:61,id:i++,expression:t};return t.parent=n,r(n,t),n}}(t.YieldFromNode||(t.YieldFromNode={})),function(e){e.create=function(e,t){var n;const s={start:e.start,length:e.length,nodeType:35,id:i++,leftExpression:e,memberName:t};return e.parent=s,t.parent=s,r(s,t),s.maxChildDepth=1+(null!==(n=e.maxChildDepth)&&void 0!==n?n:0),s}}(t.MemberAccessNode||(t.MemberAccessNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:30,id:i++,parameters:[],expression:t};return t.parent=n,r(n,t),n}}(t.LambdaNode||(t.LambdaNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:38,id:i++,token:e,value:e.value}}}(t.NameNode||(t.NameNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:11,id:i++,constType:e.keywordType}}}(t.ConstantNode||(t.ConstantNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:18,id:i++}}}(t.EllipsisNode||(t.EllipsisNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:40,id:i++,value:e.value,isInteger:e.isInteger,isImaginary:e.isImaginary}}}(t.NumberNode||(t.NumberNode={})),function(e){e.create=function(e,t,n){return{start:e.start,length:e.length,nodeType:49,id:i++,token:e,value:t,hasUnescapeErrors:n}}}(t.StringNode||(t.StringNode={})),function(e){e.create=function(e,t,n,s){const r={start:e.start,length:e.length,nodeType:27,id:i++,token:e,value:t,hasUnescapeErrors:n,expressions:s};return s.forEach((e=>{e.parent=r})),r}}(t.FormatStringNode||(t.FormatStringNode={})),function(e){e.create=function(e){const t={start:e[0].start,length:e[0].length,nodeType:48,id:i++,strings:e};return e.length>0&&(e.forEach((e=>{e.parent=t})),r(t,e[e.length-1])),t}}(t.StringListNode||(t.StringListNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:15,id:i++,entries:[]}}}(t.DictionaryNode||(t.DictionaryNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:17,id:i++,keyExpression:e,valueExpression:t};return e.parent=n,t.parent=n,r(n,t),n}}(t.DictionaryKeyEntryNode||(t.DictionaryKeyEntryNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:16,id:i++,expandExpression:e};return e.parent=t,t}}(t.DictionaryExpandEntryNode||(t.DictionaryExpandEntryNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:45,id:i++,entries:[]}}}(t.SetNode||(t.SetNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:31,id:i++,entries:[]}}}(t.ListNode||(t.ListNode={})),function(e){e.create=function(e,t,n){const s={start:e?e.start:t.start,length:e?e.length:t.length,nodeType:1,id:i++,valueExpression:t,argumentCategory:n};return t.parent=s,r(s,t),s}}(t.ArgumentNode||(t.ArgumentNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:14,id:i++,expressions:[]}}}(t.DelNode||(t.DelNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:42,id:i++}}}(t.PassNode||(t.PassNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:20,id:i++,list:[]}}}(t.ImportNode||(t.ImportNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:37,id:i++,leadingDots:0,nameParts:[]}}}(t.ModuleNameNode||(t.ModuleNameNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:21,id:i++,module:e};return e.parent=t,t}}(t.ImportAsNode||(t.ImportAsNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:22,id:i++,module:t,imports:[],isWildcardImport:!1,usesParens:!1};return t.parent=n,r(n,t),n}}(t.ImportFromNode||(t.ImportFromNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:23,id:i++,name:e};return e.parent=t,t}}(t.ImportFromAsNode||(t.ImportFromAsNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:29,id:i++,nameList:[]}}}(t.GlobalNode||(t.GlobalNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:39,id:i++,nameList:[]}}}(t.NonlocalNode||(t.NonlocalNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:2,id:i++,testExpression:t};return t.parent=n,r(n,t),n}}(t.AssertNode||(t.AssertNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:8,id:i++}}}(t.BreakNode||(t.BreakNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:12,id:i++}}}(t.ContinueNode||(t.ContinueNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:44,id:i++}}}(t.ReturnNode||(t.ReturnNode={})),function(e){e.create=function(e){return{start:e.start,length:e.length,nodeType:43,id:i++}}}(t.RaiseNode||(t.RaiseNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:63,id:i++,subjectExpression:t,cases:[]};return t.parent=n,r(n,t),n}}(t.MatchNode||(t.MatchNode={})),function(e){e.create=function(e,t,n,s,a){const o={start:e.start,length:e.length,nodeType:64,id:i++,pattern:t,isIrrefutable:n,guardExpression:s,suite:a};return r(o,a),t.parent=o,a.parent=o,s&&(s.parent=o),o}}(t.CaseNode||(t.CaseNode={})),function(e){e.create=function(e,t){const n=t.findIndex((e=>1===e.orPatterns.length&&69===e.orPatterns[0].nodeType&&e.orPatterns[0].isStar)),s={start:e.start,length:e.length,nodeType:65,id:i++,entries:t,starEntryIndex:n>=0?n:void 0};return t.length>0&&r(s,t[t.length-1]),t.forEach((e=>{e.parent=s})),s}}(t.PatternSequenceNode||(t.PatternSequenceNode={})),function(e){e.create=function(e,t){const n={start:e[0].start,length:e[0].length,nodeType:66,id:i++,orPatterns:e,target:t};return e.length>1&&r(n,e[e.length-1]),e.forEach((e=>{e.parent=n})),t&&(r(n,t),t.parent=n),n}}(t.PatternAsNode||(t.PatternAsNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:67,id:i++,expression:e};return e.parent=t,t}}(t.PatternLiteralNode||(t.PatternLiteralNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:68,id:i++,className:e,arguments:t};return e.parent=n,t.forEach((e=>{e.parent=n})),t.length>0&&r(n,t[t.length-1]),n}}(t.PatternClassNode||(t.PatternClassNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:74,id:i++,pattern:e,name:t};return e.parent=n,t&&(r(n,t),t.parent=n),n}}(t.PatternClassArgumentNode||(t.PatternClassArgumentNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:69,id:i++,target:e,isStar:void 0!==t,isWildcard:"_"===e.value};return e.parent=n,t&&r(n,t),n}}(t.PatternCaptureNode||(t.PatternCaptureNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:70,id:i++,entries:t};return t.length>0&&r(n,t[t.length-1]),t.forEach((e=>{e.parent=n})),n}}(t.PatternMappingNode||(t.PatternMappingNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:71,id:i++,keyPattern:e,valuePattern:t};return e.parent=n,t.parent=n,r(n,t),n}}(t.PatternMappingKeyEntryNode||(t.PatternMappingKeyEntryNode={})),function(e){e.create=function(e,t){const n={start:e.start,length:e.length,nodeType:72,id:i++,target:t};return t.parent=n,r(n,t),n}}(t.PatternMappingExpandEntryNode||(t.PatternMappingExpandEntryNode={})),function(e){e.create=function(e){const t={start:e.start,length:e.length,nodeType:73,id:i++,expression:e};return e.parent=t,t}}(t.PatternValueNode||(t.PatternValueNode={}))},14014:function(e,t,n){var s=this&&this.__createBinding||(Object.create?function(e,t,n,s){void 0===s&&(s=n),Object.defineProperty(e,s,{enumerable:!0,get:function(){return t[n]}})}:function(e,t,n,s){void 0===s&&(s=n),e[s]=t[n]}),i=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)&&s(t,e,n);return i(t,e),t};Object.defineProperty(t,"__esModule",{value:!0}),t.Parser=t.ParseOptions=void 0;const a=n(9133),o=n(20823),l=n(24319),c=n(85036),p=n(28348),d=n(57485),u=n(76962),m=n(74426),y=n(55390),h=r(n(78722)),g=n(7280),f=n(66945);class T{constructor(){this.isStubFile=!1,this.pythonVersion=d.latestStablePythonVersion,this.reportInvalidStringEscapeSequence=!1,this.skipFunctionAndClassBody=!1,this.ipythonMode=!1}}t.ParseOptions=T;const _=256;class v{constructor(){this._tokenIndex=0,this._areErrorsSuppressed=!1,this._parseOptions=new T,this._diagSink=new c.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){u.timingStats.tokenizeFileTime.timeOperation((()=>{this._startNewParse(e,0,e.length,t,n)}));const s=y.ModuleNode.create({start:0,length:e.length});return u.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(m.Localizer.Diagnostic.inconsistentTabs(),t):this._addError(m.Localizer.Diagnostic.unexpectedIndent(),e)}const t=this._parseStatement();t?(t.parent=s,s.statements.push(t)):this._consumeTokensUntilType([2])}})),(0,o.assert)(void 0!==this._tokenizerOutput),{text:e,parseTree:s,importedModules:this._importedModules,futureImports:this._futureImportMap,tokenizerOutput:this._tokenizerOutput,containsWildcardImport:this._containsWildcardImport,typingSymbolAliases:this._typingSymbolAliases}}parseTextExpression(e,t,n,s,i=0,r=0,a){const o=new c.DiagnosticSink;let l;if(this._startNewParse(e,t,n,s,o,r),a&&(this._typingSymbolAliases=new Map(a)),1===i)l=this._parseTypeAnnotation();else if(2===i)l=this._parseFunctionTypeAnnotation();else{const e=this._parseTestOrStarExpressionList(!1,!0);e.parseError?l=e.parseError:(0===e.list.length&&this._addError(m.Localizer.Diagnostic.expectedExpr(),this._peekToken()),l=this._makeExpressionOrTuple(e,!1))}return 2===this._peekTokenType()&&this._getNextToken(),this._atEof()||this._addError(m.Localizer.Diagnostic.unexpectedExprToken(),this._peekToken()),{parseTree:l,lines:this._tokenizerOutput.lines,diagnostics:o.fetchAndClear()}}_startNewParse(e,t,n,s,i,r=0){this._fileContents=e,this._parseOptions=s,this._diagSink=i;const a=new g.Tokenizer;this._tokenizerOutput=a.tokenize(e,t,n,r,this._parseOptions.ipythonMode),this._tokenIndex=0}_parseStatement(){switch(this._consumeTokenIfType(4)&&this._addError(m.Localizer.Diagnostic.unexpectedUnindent(),this._peekToken()),this._peekKeywordType()){case 20:return this._parseIfStatement();case 35:return this._parseWhileStatement();case 17:return this._parseForStatement();case 34:return this._parseTryStatement();case 36:return this._parseWithStatement();case 10:return this._parseFunctionDef();case 7:return this._parseClassDef();case 3:return this._parseAsyncStatement();case 25:{const e=this._peekToken(1);let t=!1;if(10===e.type||11===e.type||12===e.type||20===e.type||2===e.type||1===e.type)t=!0;else if(9===e.type){const n=e;26!==n.operatorType&&33!==n.operatorType&&(t=!0)}if(!t){const e=this._parseMatchStatement();if(e)return e}}}return 22===this._peekOperatorType()?this._parseDecorated():this._parseSimpleStatement()}_parseAsyncStatement(){const e=this._getKeywordToken(3);switch(this._peekKeywordType()){case 10:return this._parseFunctionDef(e);case 36:return this._parseWithStatement(e);case 17:return this._parseForStatement(e)}this._addError(m.Localizer.Diagnostic.unexpectedAsyncToken(),e)}_parseMatchStatement(){let e=!1;if(this._suppressErrors((()=>{const t=this._tokenIndex;this._getKeywordToken(25);const n=this._parseTestOrStarListAsExpression(!0,!0,12,m.Localizer.Diagnostic.expectedReturnExpr());e=0!==n.nodeType&&10===this._peekToken().type,this._tokenIndex=t})),!e)return;const t=this._getKeywordToken(25),n=this._parseTestOrStarListAsExpression(!0,!0,12,m.Localizer.Diagnostic.expectedReturnExpr()),s=y.MatchNode.create(t,n),i=this._peekToken();if(this._consumeTokenIfType(10))if(this._consumeTokenIfType(2)){const e=this._peekToken();if(this._consumeTokenIfType(3)){const t=e;t.isIndentAmbiguous&&this._addError(m.Localizer.Diagnostic.inconsistentTabs(),t)}else this._addError(m.Localizer.Diagnostic.expectedIndentedBlock(),this._peekToken());for(;;){const e=this._peekToken();if(3===e.type){this._getNextToken();const t=e;t.isIndentAmbiguous?this._addError(m.Localizer.Diagnostic.inconsistentTabs(),t):this._addError(m.Localizer.Diagnostic.unexpectedIndent(),e)}const t=this._parseCaseStatement();t?(t.parent=s,s.cases.push(t)):this._consumeTokensUntilType([2,10])&&this._getNextToken();const n=this._peekToken();if(this._consumeTokenIfType(4)){n.matchesIndent||this._addError(m.Localizer.Diagnostic.inconsistentIndent(),n),n.isDedentAmbiguous&&this._addError(m.Localizer.Diagnostic.inconsistentTabs(),n);break}if(1===this._peekTokenType())break}s.cases.length>0?(0,y.extendRange)(s,s.cases[s.cases.length-1]):this._addError(m.Localizer.Diagnostic.zeroCaseStatementsFound(),t)}else this._addError(m.Localizer.Diagnostic.expectedNewline(),i);else this._addError(m.Localizer.Diagnostic.expectedColon(),i),this._consumeTokensUntilType([2,10])&&this._getNextToken();this._getLanguageVersion()<d.PythonVersion.V3_10&&this._addError(m.Localizer.Diagnostic.matchIncompatible(),t);for(let e=0;e<s.cases.length-1;e++){const t=s.cases[e];!t.guardExpression&&t.isIrrefutable&&this._addError(m.Localizer.Diagnostic.casePatternIsIrrefutable(),t.pattern)}return s}_parseCaseStatement(){const e=this._peekToken();if(!this._consumeTokenIfKeyword(6))return void this._addError(m.Localizer.Diagnostic.expectedCase(),e);const t=this._parsePatternSequence();let n,s;if(t.parseError)n=t.parseError;else if(0===t.list.length)this._addError(m.Localizer.Diagnostic.expectedPatternExpr(),this._peekToken()),n=y.ErrorNode.create(e,11);else if(1!==t.list.length||t.trailingComma)n=y.PatternSequenceNode.create(t.list[0],t.list);else{const e=t.list[0].orPatterns[0];n=69===e.nodeType&&e.isStar?y.PatternSequenceNode.create(t.list[0],t.list):t.list[0]}this._consumeTokenIfKeyword(20)&&(s=this._parseTestExpression(!0));const i=this._parseSuite(this._isInFunction);return y.CaseNode.create(e,n,this._isPatternIrrefutable(n),s,i)}_isPatternIrrefutable(e){return 69===e.nodeType||66===e.nodeType&&e.orPatterns.some((e=>this._isPatternIrrefutable(e)))}_getPatternTargetNames(e,t){switch(e.nodeType){case 65:e.entries.forEach((e=>{this._getPatternTargetNames(e,t)}));break;case 68:e.arguments.forEach((e=>{this._getPatternTargetNames(e.pattern,t)}));break;case 66:e.target&&t.set(e.target.value,!0),e.orPatterns.forEach((e=>{this._getPatternTargetNames(e,t)}));break;case 69:e.isWildcard||t.set(e.target.value,!0);break;case 70:e.entries.forEach((e=>{72===e.nodeType?t.set(e.target.value,!0):(this._getPatternTargetNames(e.keyPattern,t),this._getPatternTargetNames(e.valuePattern,t))}))}}_parsePatternSequence(){const e=this._parseExpressionListGeneric((()=>this._parsePatternAs())),t=e.list.filter((e=>1===e.orPatterns.length&&69===e.orPatterns[0].nodeType&&e.orPatterns[0].isStar));t.length>1&&this._addError(m.Localizer.Diagnostic.duplicateStarPattern(),t[1].orPatterns[0]);const n=new Map;return e.list.forEach((e=>{e.orPatterns.forEach((e=>{69!==e.nodeType||e.isStar||e.isWildcard||(n.has(e.target.value)?this._addError(m.Localizer.Diagnostic.duplicateCapturePatternTarget().format({name:e.target.value}),e):n.set(e.target.value,e))}))})),e}_parsePatternAs(){const e=[];for(;;){const t=this._parsePatternAtom();if(e.push(t),!this._consumeTokenIfOperator(6))break}let t;if(e.length>1&&e.forEach((e=>{69===e.nodeType&&e.isStar&&this._addError(m.Localizer.Diagnostic.starPatternInOrPattern(),e)})),this._consumeTokenIfKeyword(1)){const e=this._getTokenIfIdentifier();e?t=y.NameNode.create(e):this._addError(m.Localizer.Diagnostic.expectedNameAfterAs(),this._peekToken())}t&&1===e.length&&69===e[0].nodeType&&e[0].isStar&&this._addError(m.Localizer.Diagnostic.starPatternInAsPattern(),e[0]),e.forEach(((t,n)=>{n<e.length-1&&this._isPatternIrrefutable(t)&&this._addError(m.Localizer.Diagnostic.orPatternIrrefutable(),t)}));const n=new Map;return e.forEach((e=>{this._getPatternTargetNames(e,n)})),e.forEach((e=>{const t=new Map;if(this._getPatternTargetNames(e,t),t.size<n.size){const s=Array.from(n.keys()).filter((e=>!t.has(e))),i=new l.DiagnosticAddendum;i.addMessage(m.Localizer.DiagnosticAddendum.orPatternMissingName().format({name:s.map((e=>`"${e}"`)).join(", ")})),this._addError(m.Localizer.Diagnostic.orPatternMissingName()+i.getString(),e)}})),y.PatternAsNode.create(e,t)}_parsePatternAtom(){const e=this._parsePatternLiteral();if(e)return e;const t=this._parsePatternCaptureOrValue();if(t){const e=this._peekToken();if(0===t.nodeType||!this._consumeTokenIfType(13))return t;const n=this._parseClassPatternArgList(),s=69===t.nodeType?t.target:t.expression,i=y.PatternClassNode.create(s,n);return this._consumeTokenIfType(14)||(this._addError(m.Localizer.Diagnostic.expectedCloseParen(),e),this._consumeTokensUntilType([2]),(0,y.extendRange)(i,this._peekToken())),i}const n=this._peekToken();if(26===this._peekOperatorType()){const e=this._getNextToken(),t=this._getTokenIfIdentifier();return t?y.PatternCaptureNode.create(y.NameNode.create(t),e):(this._addError(m.Localizer.Diagnostic.expectedIdentifier(),this._peekToken()),y.ErrorNode.create(e,2))}if(13===n.type||15===n.type){const e=this._getNextToken(),t=this._parsePatternSequence();let s;if(t.parseError)s=t.parseError;else if(1!==t.list.length||t.trailingComma||13!==e.type)s=y.PatternSequenceNode.create(e,t.list);else{const i=t.list[0].orPatterns[0];s=69===i.nodeType&&i.isStar?y.PatternSequenceNode.create(e,t.list):t.list[0],(0,y.extendRange)(s,n)}const i=this._peekToken();return this._consumeTokenIfType(13===n.type?14:16)?(0,y.extendRange)(s,i):(this._addError(13===n.type?m.Localizer.Diagnostic.expectedCloseParen():m.Localizer.Diagnostic.expectedCloseBracket(),n),this._consumeTokensUntilType([10,13===n.type?14:16])),s}if(17===n.type){const e=this._getNextToken(),t=this._parsePatternMapping(e),s=this._peekToken();return this._consumeTokenIfType(18)?(0,y.extendRange)(t,s):(this._addError(m.Localizer.Diagnostic.expectedCloseBrace(),n),this._consumeTokensUntilType([10,18])),t}return this._handleExpressionParseError(11,m.Localizer.Diagnostic.expectedPatternExpr())}_parseClassPatternArgList(){const e=[];let t=!1;for(;;){const n=this._peekTokenType();if(14===n||2===n||1===n)break;const s=this._parseClassPatternArgument();if(s.name?t=!0:t&&!s.name&&this._addError(m.Localizer.Diagnostic.positionArgAfterNamedArg(),s),e.push(s),!this._consumeTokenIfType(12))break}return e}_parseClassPatternArgument(){const e=this._peekToken(),t=this._peekToken(1);let n;7!==e.type&&8!==e.type||9!==t.type||2!==t.operatorType||(this._getNextToken(),n=y.NameNode.create(e),this._getNextToken());const s=this._parsePatternAs();return y.PatternClassArgumentNode.create(s,n)}_parsePatternLiteral(){const e=this._peekToken(),t=this._peekOperatorType();if(6===e.type||33===t)return this._parsePatternLiteralNumber();if(5===e.type){const e=this._parseAtom();return(0,o.assert)(48===e.nodeType),e.strings.forEach((e=>{64&e.token.flags&&this._addError(m.Localizer.Diagnostic.formatStringInPattern(),e)})),y.PatternLiteralNode.create(e)}if(8===e.type){const t=e;if(15===t.keywordType||33===t.keywordType||26===t.keywordType)return y.PatternLiteralNode.create(this._parseAtom())}}_parsePatternLiteralNumber(){const e=this._parseArithmeticExpression();let t,n;return 7===e.nodeType?33!==e.operator&&0!==e.operator||(t=e.leftExpression,n=e.rightExpression):t=e,t&&(55===t.nodeType&&33===t.operator&&(t=t.expression),(40!==t.nodeType||void 0!==n&&t.isImaginary)&&(this._addError(m.Localizer.Diagnostic.expectedComplexNumberLiteral(),e),n=void 0)),n&&(55===n.nodeType&&33===n.operator&&(n=n.expression),40===n.nodeType&&n.isImaginary||this._addError(m.Localizer.Diagnostic.expectedComplexNumberLiteral(),e)),y.PatternLiteralNode.create(e)}_parsePatternMapping(e){const t=this._parseExpressionListGeneric((()=>this._parsePatternMappingItem()));if(t.list.length>0){const n=t.list.filter((e=>72===e.nodeType));return n.length>1&&this._addError(m.Localizer.Diagnostic.duplicateStarStarPattern(),n[1]),y.PatternMappingNode.create(e,t.list)}return t.parseError||y.ErrorNode.create(this._peekToken(),11)}_parsePatternMappingItem(){let e;const t=this._peekToken();if(this._consumeTokenIfOperator(29)){const e=this._getTokenIfIdentifier();if(!e)return this._addError(m.Localizer.Diagnostic.expectedIdentifier(),this._peekToken()),y.ErrorNode.create(this._peekToken(),11);const n=y.NameNode.create(e);return"_"===e.value&&this._addError(m.Localizer.Diagnostic.starStarWildcardNotAllowed(),n),y.PatternMappingExpandEntryNode.create(t,n)}const n=this._parsePatternLiteral();if(n)e=n;else{const t=this._parsePatternCaptureOrValue();t&&(73===t.nodeType?e=t:(this._addError(m.Localizer.Diagnostic.expectedPatternValue(),t),e=y.ErrorNode.create(this._peekToken(),11)))}let s;return e||(this._addError(m.Localizer.Diagnostic.expectedPatternExpr(),this._peekToken()),e=y.ErrorNode.create(this._peekToken(),11)),this._consumeTokenIfType(10)?s=this._parsePatternAs():(this._addError(m.Localizer.Diagnostic.expectedColon(),this._peekToken()),s=y.ErrorNode.create(this._peekToken(),11)),y.PatternMappingKeyEntryNode.create(e,s)}_parsePatternCaptureOrValue(){const e=this._peekToken();if(7===e.type||8===e.type){let e;for(;;){const t=this._getTokenIfIdentifier();if(!t){this._addError(m.Localizer.Diagnostic.expectedIdentifier(),this._peekToken());break}{const n=y.NameNode.create(t);e=e?y.MemberAccessNode.create(e,n):n}if(!this._consumeTokenIfType(20))break}return e?35===e.nodeType?y.PatternValueNode.create(e):y.PatternCaptureNode.create(e):(this._addError(m.Localizer.Diagnostic.expectedIdentifier(),this._peekToken()),y.ErrorNode.create(this._peekToken(),11))}}_parseIfStatement(e=20){const t=this._getKeywordToken(e),n=this._parseTestExpression(!0),s=this._parseSuite(this._isInFunction),i=y.IfNode.create(t,n,s);return this._consumeTokenIfKeyword(13)?(i.elseSuite=this._parseSuite(this._isInFunction),i.elseSuite.parent=i,(0,y.extendRange)(i,i.elseSuite)):12===this._peekKeywordType()&&(i.elseSuite=this._parseIfStatement(12),i.elseSuite.parent=i,(0,y.extendRange)(i,i.elseSuite)),i}_parseLoopSuite(){const e=this._isInLoop,t=this._isInFinally;this._isInLoop=!0,this._isInFinally=!1;const n=this._parseSuite(this._isInFunction);return this._isInLoop=e,this._isInFinally=t,n}_parseSuite(e=!1,t=!1,n){const s=this._peekToken(),i=y.SuiteNode.create(s);if(!this._consumeTokenIfType(10)&&(this._addError(m.Localizer.Diagnostic.expectedColon(),s),this._consumeTokensUntilType([2,10])))if(10===this._peekTokenType())this._getNextToken();else if(3!==this._peekToken(1).type)return this._getNextToken(),i;if(t){if(this._consumeTokenIfType(2)){let e=0;for(;;){const t=this._getNextToken();if(3===t.type&&e++,4===t.type&&(t.isDedentAmbiguous&&this._addError(m.Localizer.Diagnostic.inconsistentTabs(),t),e--,0===e))break;if(1===t.type)break}}else this._parseSimpleStatement();return this._tokenIndex>0&&(0,y.extendRange)(i,this._tokenizerOutput.tokens.getItemAt(this._tokenIndex-1)),i}n&&n();const r=this._isInFunction;if(this._isInFunction=e,this._consumeTokenIfType(2)){n&&n();const e=this._peekToken();if(this._consumeTokenIfType(3)){const t=e;t.isIndentAmbiguous&&this._addError(m.Localizer.Diagnostic.inconsistentTabs(),t)}else this._addError(m.Localizer.Diagnostic.expectedIndentedBlock(),this._peekToken());for(;;){const e=this._peekToken();if(3===e.type){this._getNextToken();const t=e;t.isIndentAmbiguous?this._addError(m.Localizer.Diagnostic.inconsistentTabs(),t):this._addError(m.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(m.Localizer.Diagnostic.inconsistentIndent(),n),n.isDedentAmbiguous&&this._addError(m.Localizer.Diagnostic.inconsistentTabs(),n);break}if(1===this._peekTokenType())break}}else{const e=this._parseSimpleStatement();i.statements.push(e),e.parent=i}return i.statements.length>0&&(0,y.extendRange)(i,i.statements[i.statements.length-1]),this._isInFunction=r,i}_parseForStatement(e){const t=this._getKeywordToken(17),n=this._parseExpressionListAsPossibleTuple(2,m.Localizer.Diagnostic.expectedExpr(),t);let s,i,r;if(this._consumeTokenIfKeyword(22)){if(s=this._parseTestOrStarListAsExpression(!1,!0,2,m.Localizer.Diagnostic.expectedInExpr()),i=this._parseLoopSuite(),this._getLanguageVersion()<d.PythonVersion.V3_9&&!this._parseOptions.isStubFile&&52===s.nodeType&&!s.enclosedInParens){let e=!1;s.expressions.forEach((t=>{56!==t.nodeType||e||(this._addError(m.Localizer.Diagnostic.unpackOperatorNotAllowed(),t),e=!0)}))}this._consumeTokenIfKeyword(13)&&(r=this._parseSuite(this._isInFunction))}else s=this._handleExpressionParseError(0,m.Localizer.Diagnostic.expectedIn()),i=y.SuiteNode.create(this._peekToken());const a=y.ForNode.create(t,n,s,i);return a.elseSuite=r,r&&((0,y.extendRange)(a,r),r.parent=a),e&&(a.isAsync=!0,a.asyncToken=e,(0,y.extendRange)(a,e)),a}_tryParseListComprehension(e){const t=this._tryParseCompForStatement();if(!t)return;56===e.nodeType?this._addError(m.Localizer.Diagnostic.unpackIllegalInComprehension(),e):16===e.nodeType&&this._addError(m.Localizer.Diagnostic.dictExpandIllegalInComprehension(),e);const n=y.ListComprehensionNode.create(e),s=[t];for(;;){const e=this._tryParseCompForStatement()||this._tryParseCompIfStatement();if(!e)break;e.parent=n,s.push(e)}return n.forIfNodes=s,s.length>0&&(s.forEach((e=>{e.parent=n})),(0,y.extendRange)(n,s[s.length-1])),n}_tryParseCompForStatement(){const e=this._peekKeywordType();if(3===e){const e=this._peekToken(1);if(8!==e.type||17!==e.keywordType)return}else if(17!==e)return;let t;3===this._peekKeywordType()&&(t=this._getKeywordToken(3));const n=this._getKeywordToken(17),s=this._parseExpressionListAsPossibleTuple(2,m.Localizer.Diagnostic.expectedExpr(),n);let i;this._consumeTokenIfKeyword(22)?this._disallowAssignmentExpression((()=>{i=this._parseOrTest()})):i=this._handleExpressionParseError(0,m.Localizer.Diagnostic.expectedIn());const r=y.ListComprehensionForNode.create(t||n,s,i);return t&&(r.isAsync=!0,r.asyncToken=t),r}_tryParseCompIfStatement(){if(20!==this._peekKeywordType())return;const e=this._getKeywordToken(20),t=this._tryParseLambdaExpression()||this._parseAssignmentExpression(!0);return y.ListComprehensionIfNode.create(e,t)}_parseWhileStatement(){const e=this._getKeywordToken(35),t=y.WhileNode.create(e,this._parseTestExpression(!0),this._parseLoopSuite());return this._consumeTokenIfKeyword(13)&&(t.elseSuite=this._parseSuite(this._isInFunction),t.elseSuite.parent=t,(0,y.extendRange)(t,t.elseSuite)),t}_parseTryStatement(){const e=this._getKeywordToken(34),t=this._parseSuite(this._isInFunction),n=y.TryNode.create(e,t);let s=!1;for(;;){const e=this._peekToken();if(!this._consumeTokenIfKeyword(14))break;const t=this._peekToken();let i,r,a=!1;if(this._consumeTokenIfOperator(26)&&(this._getLanguageVersion()<d.PythonVersion.V3_11&&!this._parseOptions.isStubFile&&this._addError(m.Localizer.Diagnostic.exceptionGroupIncompatible(),t),a=!0),10!==this._peekTokenType())if(i=this._parseTestExpression(!0),this._consumeTokenIfKeyword(1))r=this._getTokenIfIdentifier(),r||this._addError(m.Localizer.Diagnostic.expectedNameAfterAs(),this._peekToken());else{const e=this._peekToken();this._consumeTokenIfType(12)&&(this._addError(m.Localizer.Diagnostic.expectedAsAfterException(),e),this._parseTestExpression(!1))}i?s&&this._addError(m.Localizer.Diagnostic.namedExceptAfterCatchAll(),i):(s&&this._addError(m.Localizer.Diagnostic.duplicateCatchAll(),e),s=!0);const o=this._parseSuite(this._isInFunction),l=y.ExceptNode.create(e,o,a);i&&(l.typeExpression=i,l.typeExpression.parent=l),r&&(l.name=y.NameNode.create(r),l.name.parent=l),n.exceptClauses.push(l),l.parent=n}return n.exceptClauses.length>0&&((0,y.extendRange)(n,n.exceptClauses[n.exceptClauses.length-1]),this._consumeTokenIfKeyword(13)&&(n.elseSuite=this._parseSuite(this._isInFunction),n.elseSuite.parent=n,(0,y.extendRange)(n,n.elseSuite))),this._consumeTokenIfKeyword(16)&&(n.finallySuite=this._parseSuite(this._isInFunction),n.finallySuite.parent=n,(0,y.extendRange)(n,n.finallySuite)),n.finallySuite||0!==n.exceptClauses.length||this._addError(m.Localizer.Diagnostic.tryWithoutExcept(),e),n}_parseFunctionDef(e,t){const n=this._getKeywordToken(10),s=this._getTokenIfIdentifier();if(!s)return this._addError(m.Localizer.Diagnostic.expectedFunctionName(),n),y.ErrorNode.create(n,10,void 0,t);const i=this._peekToken();if(!this._consumeTokenIfType(13))return this._addError(m.Localizer.Diagnostic.expectedOpenParen(),this._peekToken()),y.ErrorNode.create(s,10,y.NameNode.create(s),t);const r=this._parseVarArgsList(14,!0);let a,o;this._consumeTokenIfType(14)||(this._addError(m.Localizer.Diagnostic.expectedCloseParen(),i),this._consumeTokensUntilType([10])),this._consumeTokenIfType(21)&&(a=this._parseTypeAnnotation());const l=this._parseSuite(!0,this._parseOptions.skipFunctionAndClassBody,(()=>{o||(o=this._getTypeAnnotationCommentText())})),c=y.FunctionNode.create(n,y.NameNode.create(s),l);return e&&(c.isAsync=!0,(0,y.extendRange)(c,e)),c.parameters=r,r.forEach((e=>{e.parent=c})),t&&(c.decorators=t,t.forEach((e=>{e.parent=c})),t.length>0&&(0,y.extendRange)(c,t[0])),a&&(c.returnTypeAnnotation=a,c.returnTypeAnnotation.parent=c,(0,y.extendRange)(c,a)),o&&this._parseFunctionTypeAnnotationComment(o,c),c}_parseVarArgsList(e,t){const n=new Map,s=[];let i=!1,r=!1,a=!1,o=!1,l=!1,c=!1;for(;this._peekTokenType()!==e;){const p=this._parseParameter(t);if(!p){this._consumeTokensUntilType([e]);break}if(p.name){const e=p.name.value;n.has(e)?this._addError(m.Localizer.Diagnostic.duplicateParam().format({name:e}),p.name):n.set(e,e)}else 0===p.category&&0===s.length&&this._addError(m.Localizer.Diagnostic.positionOnlyFirstParam(),p);0===p.category&&(p.name?p.defaultValue?i=!0:!i||a||l||r||(this._addError(m.Localizer.Diagnostic.nonDefaultAfterDefault(),p),r=!0):(o?this._addError(m.Localizer.Diagnostic.duplicatePositionOnly(),p):a?this._addError(m.Localizer.Diagnostic.positionOnlyAfterKeywordOnly(),p):l&&this._addError(m.Localizer.Diagnostic.positionOnlyAfterArgs(),p),o=!0)),s.push(p),1===p.category&&(p.name?((a||l)&&this._addError(m.Localizer.Diagnostic.duplicateArgsParam(),p),l=!0):(a?this._addError(m.Localizer.Diagnostic.duplicateKeywordOnly(),p):l&&this._addError(m.Localizer.Diagnostic.keywordOnlyAfterArgs(),p),a=!0)),2===p.category?(c&&this._addError(m.Localizer.Diagnostic.duplicateKwargsParam(),p),c=!0):c&&this._addError(m.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,(0,y.extendRange)(p,p.typeAnnotationComment))}if(!d)break}if(s.length>0){const e=s[s.length-1];1!==e.category||e.name||this._addError(m.Localizer.Diagnostic.expectedNamedParameter(),e)}return s}_parseParameter(e){let t=0,n=0;const s=this._peekToken();this._consumeTokenIfOperator(26)?t=1:this._consumeTokenIfOperator(29)?t=2:this._consumeTokenIfOperator(10)&&(this._getLanguageVersion()<d.PythonVersion.V3_8&&!this._parseOptions.isStubFile&&this._addError(m.Localizer.Diagnostic.positionOnlyIncompatible(),s),n=1);const i=this._getTokenIfIdentifier();if(!i){if(1===t){return y.ParameterNode.create(s,1)}if(1===n){return y.ParameterNode.create(s,0)}if(13===this._peekTokenType()){const e=this._getNextToken();this._consumeTokensUntilType([14])&&this._getNextToken(),this._addError(m.Localizer.Diagnostic.sublistParamsIncompatible(),e)}else this._addError(m.Localizer.Diagnostic.expectedParamName(),this._peekToken())}let r=0;1===t?r=1:2===t&&(r=2);const a=y.ParameterNode.create(s,r);return i&&(a.name=y.NameNode.create(i),a.name.parent=a,(0,y.extendRange)(a,i)),e&&this._consumeTokenIfType(10)&&(a.typeAnnotation=this._parseTypeAnnotation(1===r),a.typeAnnotation.parent=a,(0,y.extendRange)(a,a.typeAnnotation)),this._consumeTokenIfOperator(2)&&(a.defaultValue=this._parseTestExpression(!1),a.defaultValue.parent=a,(0,y.extendRange)(a,a.defaultValue),t>0&&this._addError(m.Localizer.Diagnostic.defaultValueNotAllowed(),a.defaultValue)),a}_parseWithStatement(e){const t=this._getKeywordToken(36);let n=[];const s=this._peekToken();let i=!1;if(13===s.type){const e=this._tokenIndex;this._suppressErrors((()=>{for(this._getNextToken();n.push(this._parseWithItem()),this._consumeTokenIfType(12)&&14!==this._peekToken().type;);14===this._peekToken().type&&10===this._peekToken(1).type&&(i=1!==n.length||void 0!==n[0].target),this._tokenIndex=e,n=[]}))}for(i&&(this._consumeTokenIfType(13),this._getLanguageVersion()<d.PythonVersion.V3_9&&this._addError(m.Localizer.Diagnostic.parenthesizedContextManagerIllegal(),s));n.push(this._parseWithItem()),this._consumeTokenIfType(12)&&14!==this._peekToken().type;);i&&(this._consumeTokenIfType(14)||this._addError(m.Localizer.Diagnostic.expectedCloseParen(),s));const r=this._parseSuite(this._isInFunction),a=y.WithNode.create(t,r);return e&&(a.isAsync=!0,a.asyncToken=e,(0,y.extendRange)(a,e)),a.withItems=n,n.forEach((e=>{e.parent=a})),a}_parseWithItem(){const e=this._parseTestExpression(!0),t=y.WithItemNode.create(e);return this._consumeTokenIfKeyword(1)&&(t.target=this._parseExpression(!1),t.target.parent=t,(0,y.extendRange)(t,t.target)),t}_parseDecorated(){const e=[];for(;22===this._peekOperatorType();)e.push(this._parseDecorator());const t=this._peekToken();if(8===t.type)if(3===t.keywordType){if(this._getNextToken(),10===this._peekKeywordType())return this._parseFunctionDef(t,e);this._addError(m.Localizer.Diagnostic.expectedFunctionAfterAsync(),this._peekToken())}else{if(10===t.keywordType)return this._parseFunctionDef(void 0,e);if(7===t.keywordType)return this._parseClassDef(e)}return this._addError(m.Localizer.Diagnostic.expectedAfterDecorator(),this._peekToken()),y.ClassNode.createDummyForDecorators(e)}_parseDecorator(){const e=this._getNextToken();(0,o.assert)(22===e.operatorType);const t=this._parseTestExpression(!0);if(this._getLanguageVersion()<d.PythonVersion.V3_9){let e=!1;(this._isNameOrMemberAccessExpression(t)||9===t.nodeType&&this._isNameOrMemberAccessExpression(t.leftExpression))&&(e=!0),e||this._addError(m.Localizer.Diagnostic.expectedDecoratorExpr(),t)}const n=y.DecoratorNode.create(e,t);return this._consumeTokenIfType(2)||(this._addError(m.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(7);let n=this._getTokenIfIdentifier();n||(this._addError(m.Localizer.Diagnostic.expectedClassName(),this._peekToken()),n=f.IdentifierToken.create(0,0,"",void 0));let s=[];const i=this._peekToken();this._consumeTokenIfType(13)&&(s=this._parseArgList().args,this._consumeTokenIfType(14)||this._addError(m.Localizer.Diagnostic.expectedCloseParen(),i));const r=this._parseSuite(!1,this._parseOptions.skipFunctionAndClassBody),a=y.ClassNode.create(t,y.NameNode.create(n),r);return a.arguments=s,s.forEach((e=>{e.parent=a})),e&&(a.decorators=e,e.length>0&&(e.forEach((e=>{e.parent=a})),(0,y.extendRange)(a,e[0]))),a}_parsePassStatement(){return y.PassNode.create(this._getKeywordToken(30))}_parseBreakStatement(){const e=this._getKeywordToken(5);return this._isInLoop||this._addError(m.Localizer.Diagnostic.breakOutsideLoop(),e),y.BreakNode.create(e)}_parseContinueStatement(){const e=this._getKeywordToken(8);return this._isInLoop?this._isInFinally&&this._addError(m.Localizer.Diagnostic.continueInFinally(),e):this._addError(m.Localizer.Diagnostic.continueOutsideLoop(),e),y.ContinueNode.create(e)}_parseReturnStatement(){const e=this._getKeywordToken(32),t=y.ReturnNode.create(e);if(this._isInFunction||this._addError(m.Localizer.Diagnostic.returnOutsideFunction(),e),!this._isNextTokenNeverExpression()){const e=this._parseTestOrStarListAsExpression(!0,!0,2,m.Localizer.Diagnostic.expectedReturnExpr());this._reportConditionalErrorForStarTupleElement(e),t.returnExpression=e,t.returnExpression.parent=t,(0,y.extendRange)(t,e)}return t}_parseFromStatement(){const e=this._getKeywordToken(18),t=this._parseDottedModuleName(!0),n=y.ImportFromNode.create(e,t),s=0===t.leadingDots&&1===t.nameParts.length&&"__future__"===t.nameParts[0].value,i=this._peekToken();if(this._consumeTokenIfKeyword(21)){(0,y.extendRange)(n,i);const e=this._peekToken();if(this._consumeTokenIfOperator(26))(0,y.extendRange)(n,e),n.isWildcardImport=!0,n.wildcardToken=e,this._containsWildcardImport=!0;else{const e=this._peekToken(),t=this._consumeTokenIfType(13);let i;for(;;){const e=this._getTokenIfIdentifier();if(!e)break;i=void 0;const t=y.ImportFromAsNode.create(y.NameNode.create(e));if(this._consumeTokenIfKeyword(1)){const e=this._getTokenIfIdentifier();e?(t.alias=y.NameNode.create(e),t.alias.parent=t,(0,y.extendRange)(t,e)):this._addError(m.Localizer.Diagnostic.expectedImportAlias(),this._peekToken())}n.imports.push(t),t.parent=n,(0,y.extendRange)(n,t),s&&this._futureImportMap.set(e.value,!0);const r=this._peekToken();if(!this._consumeTokenIfType(12))break;i=r}if(0===n.imports.length&&this._addError(m.Localizer.Diagnostic.expectedImportSymbols(),this._peekToken()),t){n.usesParens=!0;const t=this._peekToken();this._consumeTokenIfType(14)?(0,y.extendRange)(n,t):this._addError(m.Localizer.Diagnostic.expectedCloseParen(),e)}else i&&this._addError(m.Localizer.Diagnostic.trailingCommaInFromImport(),i)}}else this._addError(m.Localizer.Diagnostic.expectedImport(),this._peekToken()),t.hasTrailingDot||(n.missingImportKeyword=!0);this._importedModules.push({nameNode:n.module,leadingDots:n.module.leadingDots,nameParts:n.module.nameParts.map((e=>e.value)),importedSymbols:n.imports.map((e=>e.name.value))});let r=!1;if(1===n.module.nameParts.length){const e=n.module.nameParts[0].value;"typing"!==e&&"typing_extensions"!==e||(r=!0)}if(r){const e=["Literal","TypeAlias","Annotated"];n.isWildcardImport?e.forEach((e=>{this._typingSymbolAliases.set(e,e)})):n.imports.forEach((t=>{var n;e.some((e=>e===t.name.value))&&this._typingSymbolAliases.set((null===(n=t.alias)||void 0===n?void 0:n.value)||t.name.value,t.name.value)}))}return n}_parseImportStatement(){var e;const t=this._getKeywordToken(21),n=y.ImportNode.create(t);for(;;){const t=this._parseDottedModuleName(),s=y.ImportAsNode.create(t);if(this._consumeTokenIfKeyword(1)){const e=this._getTokenIfIdentifier();e?(s.alias=y.NameNode.create(e),s.alias.parent=s,(0,y.extendRange)(s,s.alias)):this._addError(m.Localizer.Diagnostic.expectedImportAlias(),this._peekToken())}if(s.module.leadingDots>0&&this._addError(m.Localizer.Diagnostic.relativeImportNotAllowed(),s.module),n.list.push(s),s.parent=n,this._importedModules.push({nameNode:s.module,leadingDots:s.module.leadingDots,nameParts:s.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=s.alias)||void 0===e?void 0:e.value)||n)}if(!this._consumeTokenIfType(12))break}return n.list.length>0&&(0,y.extendRange)(n,n.list[n.list.length-1]),n}_parseDottedModuleName(e=!1){var t;const n=y.ModuleNameNode.create(this._peekToken());for(;;){const e=null!==(t=this._getTokenIfType(19))&&void 0!==t?t:this._getTokenIfType(20);if(!e)break;19===e.type?n.leadingDots+=3:n.leadingDots++,(0,y.extendRange)(n,e)}for(;;){const t=this._getTokenIfIdentifier();if(!t){(!e||0===n.leadingDots||n.nameParts.length>0)&&(this._addError(m.Localizer.Diagnostic.expectedModuleName(),this._peekToken()),n.hasTrailingDot=!0);break}const s=y.NameNode.create(t);n.nameParts.push(s),s.parent=n,(0,y.extendRange)(n,s);const i=this._peekToken();if(!this._consumeTokenIfType(20))break;(0,y.extendRange)(n,i)}return n}_parseGlobalStatement(){const e=this._getKeywordToken(19),t=y.GlobalNode.create(e);return t.nameList=this._parseNameList(),t.nameList.length>0&&(t.nameList.forEach((e=>{e.parent=t})),(0,y.extendRange)(t,t.nameList[t.nameList.length-1])),t}_parseNonlocalStatement(){const e=this._getKeywordToken(27),t=y.NonlocalNode.create(e);return t.nameList=this._parseNameList(),t.nameList.length>0&&(t.nameList.forEach((e=>{e.parent=t})),(0,y.extendRange)(t,t.nameList[t.nameList.length-1])),t}_parseNameList(){const e=[];for(;;){const t=this._getTokenIfIdentifier();if(!t){this._addError(m.Localizer.Diagnostic.expectedIdentifier(),this._peekToken());break}if(e.push(y.NameNode.create(t)),!this._consumeTokenIfType(12))break}return e}_parseRaiseStatement(){const e=this._getKeywordToken(31),t=y.RaiseNode.create(e);return this._isNextTokenNeverExpression()||(t.typeExpression=this._parseTestExpression(!0),t.typeExpression.parent=t,(0,y.extendRange)(t,t.typeExpression),this._consumeTokenIfKeyword(18)?(t.valueExpression=this._parseTestExpression(!0),t.valueExpression.parent=t,(0,y.extendRange)(t,t.valueExpression)):this._consumeTokenIfType(12)&&(t.valueExpression=this._parseTestExpression(!0),t.valueExpression.parent=t,(0,y.extendRange)(t,t.valueExpression),this._consumeTokenIfType(12)&&(t.tracebackExpression=this._parseTestExpression(!0),t.tracebackExpression.parent=t,(0,y.extendRange)(t,t.tracebackExpression)))),t}_parseAssertStatement(){const e=this._getKeywordToken(2),t=this._parseTestExpression(!0),n=y.AssertNode.create(e,t);if(this._consumeTokenIfType(12)){const e=this._parseTestExpression(!0);n.exceptionExpression=e,n.exceptionExpression.parent=n,(0,y.extendRange)(n,e)}return n}_parseDelStatement(){const e=this._getKeywordToken(11),t=this._parseExpressionList(!0);t.parseError||0!==t.list.length||this._addError(m.Localizer.Diagnostic.expectedDelExpr(),this._peekToken());const n=y.DelNode.create(e);return n.expressions=t.list,n.expressions.length>0&&(n.expressions.forEach((e=>{e.parent=n})),(0,y.extendRange)(n,n.expressions[n.expressions.length-1])),n}_parseYieldExpression(){const e=this._getKeywordToken(37),t=this._peekToken();if(this._consumeTokenIfKeyword(18))return this._getLanguageVersion()<d.PythonVersion.V3_3&&this._addError(m.Localizer.Diagnostic.yieldFromIllegal(),t),y.YieldFromNode.create(e,this._parseTestExpression(!0));let n;return this._isNextTokenNeverExpression()||(n=this._parseTestOrStarListAsExpression(!0,!0,2,m.Localizer.Diagnostic.expectedYieldExpr()),this._reportConditionalErrorForStarTupleElement(n)),y.YieldNode.create(e,n)}_tryParseYieldExpression(){if(37===this._peekKeywordType())return this._parseYieldExpression()}_parseSimpleStatement(){const e=y.StatementListNode.create(this._peekToken());for(;;){if(0===this._peekTokenType()){const e=this._getNextToken(),t=this._fileContents.substr(e.start,e.length).charCodeAt(0);this._addError(m.Localizer.Diagnostic.invalidTokenChars().format({text:`\\u${t.toString(16)}`}),e),this._consumeTokensUntilType([2]);break}const t=this._parseSmallStatement();if(e.statements.push(t),t.parent=e,(0,y.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(m.Localizer.Diagnostic.expectedNewlineOrSemicolon(),this._peekToken()),e}_parseSmallStatement(){switch(this._peekKeywordType()){case 30:return this._parsePassStatement();case 5:return this._parseBreakStatement();case 8:return this._parseContinueStatement();case 32:return this._parseReturnStatement();case 18:return this._parseFromStatement();case 21:return this._parseImportStatement();case 19:return this._parseGlobalStatement();case 27:return this._parseNonlocalStatement();case 31:return this._parseRaiseStatement();case 2:return this._parseAssertStatement();case 11:return this._parseDelStatement();case 37:return this._parseYieldExpression()}return this._parseExpressionStatement()}_makeExpressionOrTuple(e,t){if(1===e.list.length&&!e.trailingComma)return 56===e.list[0].nodeType&&this._addError(m.Localizer.Diagnostic.unpackOperatorNotAllowed(),e.list[0]),e.list[0];const n=e.list.length>0?e.list[0]:this._peekToken(-1),s=y.TupleNode.create(n,t);return s.expressions=e.list,e.list.length>0&&(e.list.forEach((e=>{e.parent=s})),(0,y.extendRange)(s,e.list[e.list.length-1])),s}_parseExpressionListAsPossibleTuple(e,t,n){if(this._isNextTokenNeverExpression())return this._addError(t,n),y.ErrorNode.create(n,e);const s=this._parseExpressionList(!0);return s.parseError?s.parseError:this._makeExpressionOrTuple(s,!1)}_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,s){if(this._isNextTokenNeverExpression())return this._handleExpressionParseError(n,s);const i=this._parseTestOrStarExpressionList(e,t);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,t){const n=this._parseExpressionListGeneric((()=>this._parseTestOrStarExpression(e)));if(!t&&!n.parseError){let e=!1;for(const t of n.list)if(56===t.nodeType){if(e){this._addError(m.Localizer.Diagnostic.duplicateUnpack(),t);break}e=!0}}return n}_parseExpression(e){const t=this._peekToken();return e&&this._consumeTokenIfOperator(26)?y.UnpackNode.create(t,this._parseExpression(!1)):this._parseBitwiseOrExpression()}_parseTestOrStarExpression(e){return 26===this._peekOperatorType()?this._parseExpression(!0):this._parseTestExpression(e)}_parseTestExpression(e){if(24===this._peekKeywordType())return this._parseLambdaExpression();const t=e?this._parseAssignmentExpression():this._parseOrTest();if(0===t.nodeType)return t;if(!this._consumeTokenIfKeyword(20))return t;const n=this._parseOrTest();if(0===n.nodeType)return n;if(!this._consumeTokenIfKeyword(13))return this._handleExpressionParseError(1,m.Localizer.Diagnostic.expectedElse());const s=this._parseTestExpression(!0);return 0===s.nodeType?s:y.TernaryNode.create(t,n,s)}_parseAssignmentExpression(e=!1){const t=this._parseOrTest();if(0===t.nodeType)return t;if(38!==t.nodeType)return t;const n=this._peekToken();if(!this._consumeTokenIfOperator(35))return t;(!this._assignmentExpressionsAllowed||this._isParsingTypeAnnotation||e)&&this._addError(m.Localizer.Diagnostic.walrusNotAllowed(),n),this._getLanguageVersion()<d.PythonVersion.V3_8&&this._addError(m.Localizer.Diagnostic.walrusIllegal(),n);const s=this._parseTestExpression(!1);return y.AssignmentExpressionNode.create(t,s)}_parseOrTest(){let e=this._parseAndTest();if(0===e.nodeType)return e;for(;;){const t=this._peekToken();if(!this._consumeTokenIfKeyword(29))break;const n=this._parseAndTest();e=this._createBinaryOperationNode(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=this._createBinaryOperationNode(e,n,t,36)}return e}_parseNotTest(){const e=this._peekToken();if(this._consumeTokenIfKeyword(28)){const t=this._parseNotTest();return this._createUnaryOperationNode(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(g.Tokenizer.isOperatorComparison(this._peekOperatorType()))t=this._peekOperatorType(),19===t&&(this._addError(m.Localizer.Diagnostic.operatorLessOrGreaterDeprecated(),n),t=28),this._getNextToken();else if(this._consumeTokenIfKeyword(22))t=41;else if(this._consumeTokenIfKeyword(23))t=this._consumeTokenIfKeyword(28)?40:39;else if(28===this._peekKeywordType()){const e=this._peekToken(1);8===e.type&&22===e.keywordType&&(this._getNextToken(),this._getNextToken(),t=42)}if(void 0===t)break;const s=this._parseComparison();e=this._createBinaryOperationNode(e,s,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=this._createBinaryOperationNode(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=this._createBinaryOperationNode(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=this._createBinaryOperationNode(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 s=this._parseArithmeticExpression();e=this._createBinaryOperationNode(e,s,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 s=this._parseArithmeticTerm();if(0===s.nodeType)return s;e=this._createBinaryOperationNode(e,s,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 s=this._parseArithmeticFactor();e=this._createBinaryOperationNode(e,s,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 this._createUnaryOperationNode(e,n,t)}const n=this._parseAtomExpression();if(0===n.nodeType)return n;const s=this._peekToken();if(this._consumeTokenIfOperator(29)){const e=this._parseArithmeticFactor();return this._createBinaryOperationNode(n,e,s,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()<d.PythonVersion.V3_5&&this._addError(m.Localizer.Diagnostic.awaitIllegal(),e));let t=this._parseAtom();if(0===t.nodeType)return t;for(;;){const e=this._peekToken();if(this._consumeTokenIfType(13)){const n=this._isParsingTypeAnnotation;this._isParsingTypeAnnotation=!1;const s=this._parseArgList(),i=y.CallNode.create(t,s.args,s.trailingComma);(s.args.length>1||s.trailingComma)&&s.args.forEach((e=>{32===e.valueExpression.nodeType&&(e.valueExpression.isParenthesized||this._addError(m.Localizer.Diagnostic.generatorNotParenthesized(),e.valueExpression))}));const r=this._peekToken();let a=!1;if(this._consumeTokenIfType(14)?((0,y.extendRange)(i,r),a=!0):(this._addError(m.Localizer.Diagnostic.expectedCloseParen(),e),this._consumeTokensUntilType([2]),(0,y.extendRange)(i,this._peekToken())),this._isParsingTypeAnnotation=n,this._isParsingTypeAnnotation){const e=new l.DiagnosticAddendum;38===t.nodeType&&"type"===t.value&&(e.addMessage(m.Localizer.DiagnosticAddendum.useTypeInstead()),this._addError(m.Localizer.Diagnostic.typeCallNotAllowed()+e.getString(),i))}if(t=i,void 0!==t.maxChildDepth&&t.maxChildDepth>=_&&(t=y.ErrorNode.create(t,14),this._addError(m.Localizer.Diagnostic.maxParseDepthExceeded(),t)),!a)break}else if(this._consumeTokenIfType(15)){const n=this._isParsingIndexTrailer,s=this._isParsingTypeAnnotation;(this._isTypingAnnotation(t,"Literal")||this._isTypingAnnotation(t,"Annotated"))&&(this._isParsingTypeAnnotation=!1),this._isParsingIndexTrailer=!0;const i=this._parseSubscriptList();this._isParsingTypeAnnotation=s,this._isParsingIndexTrailer=n;const r=this._peekToken(),a=y.IndexNode.create(t,i.list,i.trailingComma,r);(0,y.extendRange)(a,a),this._consumeTokenIfType(16)||this._handleExpressionParseError(6,m.Localizer.Diagnostic.expectedCloseBracket(),e,a),t=a,void 0!==t.maxChildDepth&&t.maxChildDepth>=_&&(t=y.ErrorNode.create(t,14),this._addError(m.Localizer.Diagnostic.maxParseDepthExceeded(),t))}else{if(!this._consumeTokenIfType(20))break;{const n=this._getTokenIfIdentifier();if(!n)return this._handleExpressionParseError(7,m.Localizer.Diagnostic.expectedMemberName(),e,t);t=y.MemberAccessNode.create(t,y.NameNode.create(n)),void 0!==t.maxChildDepth&&t.maxChildDepth>=_&&(t=y.ErrorNode.create(t,14),this._addError(m.Localizer.Diagnostic.maxParseDepthExceeded(),t))}}}return e?y.AwaitNode.create(e,t):t}_parseSubscriptList(){const e=[];let t=!1,n=!1;for(;;){const s=this._peekToken();if(10!==s.type&&this._isNextTokenNeverExpression())break;let i=0;this._consumeTokenIfOperator(26)?i=1:this._consumeTokenIfOperator(29)&&(i=2);const r=this._tokenIndex;let a,o=this._parsePossibleSlice();if(0===i)if(this._consumeTokenIfOperator(2)){const e=o;o=this._parsePossibleSlice(),38===e.nodeType?a=e.token:this._addError(m.Localizer.Diagnostic.expectedParamName(),e)}else 38===o.nodeType&&35===this._peekOperatorType()&&(this._tokenIndex=r,o=this._parseTestExpression(!0),!this._parseOptions.isStubFile&&this._getLanguageVersion()<d.PythonVersion.V3_10&&this._addError(m.Localizer.Diagnostic.assignmentExprInSubscript(),o));const l=y.ArgumentNode.create(s,o,i);if(a&&(l.name=y.NameNode.create(a),l.name.parent=l),l.name?t=!0:t&&0===l.argumentCategory&&this._addError(m.Localizer.Diagnostic.positionArgAfterNamedArg(),l),e.push(l),l.name&&this._addError(m.Localizer.Diagnostic.keywordSubscriptIllegal(),l.name),0!==i){const e=this._parseOptions.isStubFile||this._getLanguageVersion()>=d.PythonVersion.V3_11;2!==i&&e||this._addError(m.Localizer.Diagnostic.unpackedSubscriptIllegal(),l)}if(!this._consumeTokenIfType(12)){n=!1;break}n=!0}if(0===e.length){const t=this._handleExpressionParseError(3,m.Localizer.Diagnostic.expectedSliceIndex(),void 0,void 0,[16]);e.push(y.ArgumentNode.create(this._peekToken(),t,0))}return{list:e,trailingComma:n}}_parsePossibleSlice(){const e=this._peekToken(),t=[void 0,void 0,void 0];let n=0,s=!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;s=!0}if(!s)return t[0]?t[0]:y.ErrorNode.create(this._peekToken(),3);const i=y.SliceNode.create(e);i.startValue=t[0],i.startValue&&(i.startValue.parent=i),i.endValue=t[1],i.endValue&&(i.endValue.parent=i),i.stepValue=t[2],i.stepValue&&(i.stepValue.parent=i);const r=t[2]||t[1]||t[0];return r&&(0,y.extendRange)(i,r),i}_parseArgList(){const e=[];let t=!1,n=!1;for(;;){const s=this._peekTokenType();if(14===s||2===s||1===s)break;n=!1;const i=this._parseArgument();if(i.name?t=!0:t&&0===i.argumentCategory&&this._addError(m.Localizer.Diagnostic.positionArgAfterNamedArg(),i),e.push(i),!this._consumeTokenIfType(12))break;n=!0}return{args:e,trailingComma:n}}_parseArgument(){const e=this._peekToken();let t=0;this._consumeTokenIfOperator(26)?t=1:this._consumeTokenIfOperator(29)&&(t=2);let n,s=this._parseTestExpression(!0);if(0===t)if(this._consumeTokenIfOperator(2)){const e=s;s=this._parseTestExpression(!1),38===e.nodeType?n=e.token:this._addError(m.Localizer.Diagnostic.expectedParamName(),e)}else{const e=this._tryParseListComprehension(s);e&&(s=e)}const i=y.ArgumentNode.create(e,s,t);return n&&(i.name=y.NameNode.create(n),i.name.parent=i),i}_parseAtom(){const e=this._peekToken();if(19===e.type)return y.EllipsisNode.create(this._getNextToken());if(6===e.type)return y.NumberNode.create(this._getNextToken());if(7===e.type)return y.NameNode.create(this._getNextToken());if(5===e.type)return this._parseStringList();if(22===e.type){this._getNextToken(),this._addError(m.Localizer.Diagnostic.backticksIllegal(),e);const t=this._parseTestListAsExpression(2,m.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 l.DiagnosticAddendum;t.addMessage(m.Localizer.DiagnosticAddendum.useTupleInstead()),this._addError(m.Localizer.Diagnostic.tupleInAnnotation()+t.getString(),e)}return 7===e.nodeType&&(e.parenthesized=!0),48===e.nodeType&&(e.isParenthesized=!0),32===e.nodeType&&(e.isParenthesized=!0),e}if(15===e.type){const e=this._parseListAtom();if(this._isParsingTypeAnnotation&&!this._isParsingIndexTrailer){const t=new l.DiagnosticAddendum;t.addMessage(m.Localizer.DiagnosticAddendum.useListInstead()),this._addError(m.Localizer.Diagnostic.listInAnnotation()+t.getString(),e)}return e}if(17===e.type){const e=this._parseDictionaryOrSetAtom();if(this._isParsingTypeAnnotation){const t=new l.DiagnosticAddendum;t.addMessage(m.Localizer.DiagnosticAddendum.useDictInstead()),this._addError(m.Localizer.Diagnostic.dictInAnnotation()+t.getString(),e)}return e}if(8===e.type){const t=e;if(15===t.keywordType||33===t.keywordType||9===t.keywordType||26===t.keywordType)return y.ConstantNode.create(this._getNextToken());const n=this._getTokenIfIdentifier();if(n)return y.NameNode.create(n)}return this._handleExpressionParseError(2,m.Localizer.Diagnostic.expectedExpr())}_handleExpressionParseError(e,t,n,s,i){this._addError(t,null!=n?n:this._peekToken());const r=y.ErrorNode.create(this._peekToken(),e,s),o=[2];return i&&(0,a.appendArray)(o,i),this._consumeTokensUntilType(o),r}_parseLambdaExpression(e=!0){const t=this._getKeywordToken(24),n=this._parseVarArgsList(10,!1);let s;this._consumeTokenIfType(10)||this._addError(m.Localizer.Diagnostic.expectedColon(),this._peekToken()),s=e?this._parseTestExpression(!1):this._tryParseLambdaExpression(!1)||this._parseOrTest();const i=y.LambdaNode.create(t,s);return i.parameters=n,n.forEach((e=>{e.parent=i})),i}_tryParseLambdaExpression(e=!0){if(24===this._peekKeywordType())return this._parseLambdaExpression(e)}_parseTupleAtom(){var e;const t=this._getNextToken();(0,o.assert)(13===t.type);const n=this._tryParseYieldExpression();if(n)return 14!==this._peekTokenType()?this._handleExpressionParseError(8,m.Localizer.Diagnostic.expectedCloseParen(),t,n):((0,y.extendRange)(n,this._getNextToken()),n);const s=this._parseTestListWithComprehension(),i=this._makeExpressionOrTuple(s,!0),r=1===s.list.length&&!s.trailingComma;if(r||(0,y.extendRange)(i,t),14!==this._peekTokenType())return this._handleExpressionParseError(8,m.Localizer.Diagnostic.expectedCloseParen(),t,null!==(e=s.parseError)&&void 0!==e?e:i);{const e=this._getNextToken();r||(0,y.extendRange)(i,e)}return i}_parseListAtom(){var e;const t=this._getNextToken();(0,o.assert)(15===t.type);const n=this._parseTestListWithComprehension(),s=this._peekToken();return this._consumeTokenIfType(16)?i():this._handleExpressionParseError(9,m.Localizer.Diagnostic.expectedCloseBracket(),t,null!==(e=n.parseError)&&void 0!==e?e:i());function i(){const e=y.ListNode.create(t);return s&&(0,y.extendRange)(e,s),n.list.length>0&&(n.list.forEach((t=>{t.parent=e})),(0,y.extendRange)(e,n.list[n.list.length-1])),e.entries=n.list,e}}_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();(0,o.assert)(17===e.type);const t=[],n=[];let s,i=!1,r=!1,a=!1,l=!0;for(;18!==this._peekTokenType();){let e,c,p;s=void 0;const d=this._peekToken();if(this._consumeTokenIfOperator(29)?e=this._parseExpression(!1):(c=this._parseTestOrStarExpression(!0),this._consumeTokenIfType(10)&&(p=this._parseTestExpression(!1))),c&&p)if(56===c.nodeType&&this._addError(m.Localizer.Diagnostic.unpackInDict(),c),r)this._addError(m.Localizer.Diagnostic.keyValueInSet(),p);else{const e=y.DictionaryKeyEntryNode.create(c,p);let n=e;const s=this._tryParseListComprehension(e);s&&(n=s,a=!0,l||this._addError(m.Localizer.Diagnostic.comprehensionInDict(),n)),t.push(n),i=!0}else if(e)if(r)this._addError(m.Localizer.Diagnostic.unpackInSet(),e);else{const n=y.DictionaryExpandEntryNode.create(e);(0,y.extendRange)(n,d);let s=n;const r=this._tryParseListComprehension(n);r&&(s=r,a=!0,l||this._addError(m.Localizer.Diagnostic.comprehensionInDict(),e)),t.push(s),i=!0}else if((0,o.assert)(void 0!==c),c)if(i){const e=y.ErrorNode.create(this._peekToken(),13),n=y.DictionaryKeyEntryNode.create(c,e);t.push(n),this._addError(m.Localizer.Diagnostic.dictKeyValuePairs(),c)}else{const e=this._tryParseListComprehension(c);e&&(c=e,a=!0,l||this._addError(m.Localizer.Diagnostic.comprehensionInSet(),c)),n.push(c),r=!0}if(a)break;if(12!==this._peekTokenType())break;s=this._getNextToken(),l=!1}let c=this._peekToken();if(this._consumeTokenIfType(18)||(this._addError(m.Localizer.Diagnostic.expectedCloseBrace(),e),c=void 0),r){const t=y.SetNode.create(e);return c&&(0,y.extendRange)(t,c),n.length>0&&(0,y.extendRange)(t,n[n.length-1]),n.forEach((e=>{e.parent=t})),t.entries=n,t}const p=y.DictionaryNode.create(e);return s&&(p.trailingCommaToken=s,(0,y.extendRange)(p,s)),c&&(0,y.extendRange)(p,c),t.length>0&&(t.forEach((e=>{e.parent=p})),(0,y.extendRange)(p,t[t.length-1])),p.entries=t,p}_parseExpressionListGeneric(e,t=(()=>this._isNextTokenNeverExpression()),n=(()=>!1)){let s=!1;const i=[];let r;for(;!t();){const t=e();if(0===t.nodeType){r=t;break}if(i.push(t),n())break;if(!this._consumeTokenIfType(12)){s=!1;break}s=!0}return{trailingComma:s,list:i,parseError:r}}_parseExpressionStatement(){let e,t=this._parseTestOrStarListAsExpression(!1,!1,2,m.Localizer.Diagnostic.expectedExpr());if(0===t.nodeType)return t;if(this._consumeTokenIfType(10)){if(e=this._parseTypeAnnotation(),t=y.TypeAnnotationNode.create(t,e),!this._parseOptions.isStubFile&&this._getLanguageVersion()<d.PythonVersion.V3_6&&this._addError(m.Localizer.Diagnostic.varAnnotationIllegal(),e),!this._consumeTokenIfOperator(2))return t;const n=this._isTypingAnnotation(e,"TypeAlias"),s=this._isParsingTypeAnnotation;n&&(this._isParsingTypeAnnotation=!0);const i=this._tryParseYieldExpression()||this._parseTestOrStarListAsExpression(!1,!0,2,m.Localizer.Diagnostic.expectedAssignRightHandExpr());return this._isParsingTypeAnnotation=s,y.AssignmentNode.create(t,i)}if(this._consumeTokenIfOperator(2))return this._parseChainAssignments(t);if(g.Tokenizer.isOperatorAssignment(this._peekOperatorType())){const e=this._getNextToken(),n=this._tryParseYieldExpression()||this._parseTestListAsExpression(2,m.Localizer.Diagnostic.expectedBinaryRightHandExpr()),s=Object.assign({},t);return s.id=(0,y.getNextNodeId)(),y.AugmentedAssignmentNode.create(t,n,e.operatorType,s)}return t}_parseChainAssignments(e){let t=this._tryParseYieldExpression()||this._parseTestOrStarListAsExpression(!1,!0,2,m.Localizer.Diagnostic.expectedAssignRightHandExpr());if(0===t.nodeType)return y.AssignmentNode.create(e,t);if(this._consumeTokenIfOperator(2)&&(t=this._parseChainAssignments(t),0===t.nodeType))return t;const n=y.AssignmentNode.create(e,t),s=this._parseVariableTypeAnnotationComment();return s&&(n.typeAnnotationComment=s,n.typeAnnotationComment.parent=n,(0,y.extendRange)(n,n.typeAnnotationComment)),n}_parseFunctionTypeAnnotation(){const e=this._peekToken();if(!this._consumeTokenIfType(13))return void this._addError(m.Localizer.Diagnostic.expectedOpenParen(),this._peekToken());let t=[];for(;;){const e=this._peekTokenType();if(14===e||2===e||1===e)break;this._consumeTokenIfOperator(26)||this._consumeTokenIfOperator(29);const n=this._parseTypeAnnotation();if(t.push(n),!this._consumeTokenIfType(12))break}if(this._consumeTokenIfType(14)||(this._addError(m.Localizer.Diagnostic.expectedCloseParen(),e),this._consumeTokensUntilType([10])),!this._consumeTokenIfType(21))return void this._addError(m.Localizer.Diagnostic.expectedArrow(),this._peekToken());const n=this._parseTypeAnnotation();let s=!1;return 1===t.length&&18===t[0].nodeType&&(t=[],s=!0),y.FunctionAnnotationNode.create(e,s,t,n)}_parseTypeAnnotation(e=!1){const t=this._isParsingTypeAnnotation;this._isParsingTypeAnnotation=!0;const n=this._peekToken(),s=this._consumeTokenIfOperator(26);s&&(e?!this._parseOptions.isStubFile&&this._getLanguageVersion()<d.PythonVersion.V3_11&&this._addError(m.Localizer.Diagnostic.unpackedSubscriptIllegal(),n):this._addError(m.Localizer.Diagnostic.unpackInAnnotation(),n));let i=this._parseTestExpression(!1);return s&&e&&(i=y.UnpackNode.create(n,i)),this._isParsingTypeAnnotation=t,i}_reportStringTokenErrors(e,t){65536&e.flags&&this._addError(m.Localizer.Diagnostic.stringUnterminated(),e),t.nonAsciiInBytes&&this._addError(m.Localizer.Diagnostic.stringNonAsciiBytes(),e),64&e.flags&&(this._getLanguageVersion()<d.PythonVersion.V3_6&&this._addError(m.Localizer.Diagnostic.formatStringIllegal(),e),32&e.flags&&this._addError(m.Localizer.Diagnostic.formatStringBytes(),e),16&e.flags&&this._addError(m.Localizer.Diagnostic.formatStringUnicode(),e))}_makeStringNode(e){const t=h.getUnescapedString(e);return this._reportStringTokenErrors(e,t),y.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 s=n[2];if(s.trim().match(/^ignore(\s|\[|$)/))return;const i=e.start+e.length+n[1].length;return f.StringToken.create(i,s.length,0,s,0,void 0)}_parseVariableTypeAnnotationComment(){const e=this._getTypeAnnotationCommentText();if(!e)return;const t=this._makeStringNode(e),n=y.StringListNode.create([t]),s=(new v).parseTextExpression(this._fileContents,e.start,e.length,this._parseOptions,1,void 0,this._typingSymbolAliases);return s.diagnostics.forEach((e=>{this._addError(e.message,n)})),s.parseTree?((0,o.assert)(62!==s.parseTree.nodeType),s.parseTree):void 0}_parseFunctionTypeAnnotationComment(e,t){const n=this._makeStringNode(e),s=y.StringListNode.create([n]),i=(new v).parseTextExpression(this._fileContents,e.start,e.length,this._parseOptions,2,void 0,this._typingSymbolAliases);if(i.diagnostics.forEach((e=>{this._addError(e.message,s)})),!i.parseTree||62!==i.parseTree.nodeType)return;const r=i.parseTree;t.functionAnnotationComment=r,r.parent=t,(0,y.extendRange)(t,r)}_parseFormatStringSegment(e,t,n,s){(0,o.assert)(t.isExpression);const i=(new v).parseTextExpression(this._fileContents,e.start+e.prefixLength+e.quoteMarkLength+t.offset+n,s,this._parseOptions,0,1,this._typingSymbolAliases);return i.diagnostics.forEach((t=>{const n=(t.range?(0,p.convertPositionToOffset)(t.range.start,i.lines):e.start)||e.start,s={start:n,length:((t.range?((0,p.convertPositionToOffset)(t.range.end,i.lines)||0)+1:e.start+e.length)||e.start+e.length)-n};this._addError(t.message,s)})),i.parseTree}_parseFormatString(e){const t=h.getUnescapedString(e);this._reportStringTokenErrors(e,t);const n=[];for(const s of t.formatStringSegments)if(s.isExpression){const t=this._getFormatStringExpressionLength(s.value.trimEnd()),i=this._parseFormatStringSegment(e,s,0,t);i&&((0,o.assert)(62!==i.nodeType),n.push(i));const r=s.value.substr(t);let a=0,l=0;for(let i=0;i<r.length;i++)if(123===r.charCodeAt(i))0===a&&(l=i+1),a++;else if(125===r.charCodeAt(i)&&a>0&&(a--,0===a)){const r=this._getFormatStringExpressionLength(s.value.substr(t+l,i-l)),a=this._parseFormatStringSegment(e,s,t+l,r);a&&((0,o.assert)(62!==a.nodeType),n.push(a))}}return y.FormatStringNode.create(e,t.value,t.unescapeErrors.length>0,n)}_getFormatStringExpressionLength(e){let t=0;const n=[];let s,i=0,r=0,a=0;for(;t<e.length;){const o=e[t],l=n.length>0||i>0||r>0||a>0,c=n.length>0;if("="===o)s=t;else{if(":"===o){if(!l)break}else if("!"===o){if(!l&&(t===e.length-1||"="!==e[t+1]))break}else if("'"===o||'"'===o){let s=o;t+2<e.length&&e[t+1]===o&&e[t+2]===o&&(s=o+o+o,t+=2),n.length>0&&n[n.length-1]===s?n.pop():0===n.length&&n.push(s)}else"("===o?c||r++:")"===o?!c&&r>0&&r--:"{"===o?c||i++:"}"===o?!c&&i>0&&i--:"["===o?c||a++:"]"===o&&!c&&a>0&&a--;" "!==o&&(s=void 0)}t++}return this._parseOptions.pythonVersion>=d.PythonVersion.V3_8&&void 0!==s&&(t=s),t}_createBinaryOperationNode(e,t,n,s){return void 0!==e.maxChildDepth&&e.maxChildDepth>=_&&(e=y.ErrorNode.create(e,14),this._addError(m.Localizer.Diagnostic.maxParseDepthExceeded(),e)),void 0!==t.maxChildDepth&&t.maxChildDepth>=_&&(t=y.ErrorNode.create(t,14),this._addError(m.Localizer.Diagnostic.maxParseDepthExceeded(),t)),y.BinaryOperationNode.create(e,t,n,s)}_createUnaryOperationNode(e,t,n){return void 0!==t.maxChildDepth&&t.maxChildDepth>=_&&(t=y.ErrorNode.create(t,14),this._addError(m.Localizer.Diagnostic.maxParseDepthExceeded(),t)),y.UnaryOperationNode.create(e,t,n)}_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=y.StringListNode.create(e);if(this._isParsingTypeAnnotation)if(t.strings.length>1)this._addError(m.Localizer.Diagnostic.annotationSpansStrings(),t);else if(64&t.strings[0].token.flags)this._addError(m.Localizer.Diagnostic.annotationFormatString(),t);else{const e=t.strings[0].token,n=h.getUnescapedString(t.strings[0].token).value,s=e.start,i=e.prefixLength+e.quoteMarkLength;if(n.length!==e.length-i-e.quoteMarkLength)this._addError(m.Localizer.Diagnostic.annotationStringEscape(),t);else{const e=(new v).parseTextExpression(this._fileContents,s+i,n.length,this._parseOptions,1,0!=(4&t.strings[0].token.flags)?1:0,this._typingSymbolAliases);e.diagnostics.forEach((e=>{this._addError(e.message,t)})),e.parseTree&&((0,o.assert)(62!==e.parseTree.nodeType),t.typeAnnotation=e.parseTree,t.typeAnnotation.parent=t)}}return t}_reportConditionalErrorForStarTupleElement(e){if(52===e.nodeType&&!(e.enclosedInParens||this._parseOptions.pythonVersion>=d.PythonVersion.V3_8))for(const t of e.expressions)if(56===t.nodeType)return void this._addError(m.Localizer.Diagnostic.unpackTuplesIllegal(),t)}_isNextTokenNeverExpression(){switch(this._peekToken().type){case 8:switch(this._peekKeywordType()){case 17:case 22:case 20:return!0}break;case 9:switch(this._peekOperatorType()){case 1:case 34:case 27:case 11:case 25:case 4:case 7:case 9:case 18:case 32:case 30:case 14:case 2:return!0}break;case 3:case 4:case 2:case 1:case 11:case 14:case 16:case 18:case 12:case 10:return!0}return!1}_disallowAssignmentExpression(e){const t=this._assignmentExpressionsAllowed;this._assignmentExpressionsAllowed=!1,e(),this._assignmentExpressionsAllowed=t}_getNextToken(){const e=this._tokenizerOutput.tokens.getItemAt(this._tokenIndex);return this._atEof()||this._tokenIndex++,e}_atEof(){return this._tokenIndex>=this._tokenizerOutput.tokens.count-1}_peekToken(e=0){return this._tokenIndex+e<0?this._tokenizerOutput.tokens.getItemAt(0):this._tokenIndex+e>=this._tokenizerOutput.tokens.count?this._tokenizerOutput.tokens.getItemAt(this._tokenizerOutput.tokens.count-1):this._tokenizerOutput.tokens.getItemAt(this._tokenIndex+e)}_peekTokenType(){return this._peekToken().type}_peekKeywordType(){const e=this._peekToken();if(8===e.type)return e.keywordType}_peekOperatorType(){const e=this._peekToken();if(9===e.type)return e.operatorType}_getTokenIfIdentifier(){const e=this._peekToken();if(7===e.type)return this._getNextToken();if(0===e.type)return this._getNextToken(),this._addError(m.Localizer.Diagnostic.invalidIdentifierChar(),e),f.IdentifierToken.create(e.start,e.length,"",e.comments);if(8===e.type){const t=this._peekKeywordType();if([9,25,6].find((e=>e===t))){const t=this._fileContents.substr(e.start,e.length);return this._getNextToken(),f.IdentifierToken.create(e.start,e.length,t,e.comments)}}}_consumeTokensUntilType(e){for(;;){const t=this._peekToken();if(e.some((e=>e===t.type)))return!0;if(1===t.type)return!1;this._getNextToken()}}_getTokenIfType(e){if(this._peekTokenType()===e)return this._getNextToken()}_consumeTokenIfType(e){return!!this._getTokenIfType(e)}_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(0,o.assert)(8===t.type),(0,o.assert)(t.keywordType===e),t}_getLanguageVersion(){return this._parseOptions.pythonVersion}_suppressErrors(e){const t=this._areErrorsSuppressed;try{this._areErrorsSuppressed=!0,e()}finally{this._areErrorsSuppressed=t}}_addError(e,t){(0,o.assert)(void 0!==t),this._areErrorsSuppressed||this._diagSink.addError(e,(0,p.convertOffsetsToRange)(t.start,t.start+t.length,this._tokenizerOutput.lines))}}t.Parser=v},78722:(e,t)=>{function n(e){return e>=48&&e<=57||(e>=97&&e<=122||e>=65&&e<=90)}function s(e){return e>=48&&e<=55}function i(e){return e>=48&&e<=57||(e>=97&&e<=102||e>=65&&e<=70)}function r(e){return e>=48&&e<=57?e-48:e>=97&&e<=102?e-97+10:e>=65&&e<=70?e-65+10:0}Object.defineProperty(t,"__esModule",{value:!0}),t.getUnescapedString=void 0,t.getUnescapedString=function(e){const t=e.escapedValue,a=0!=(8&e.flags),o=0!=(64&e.flags);if(a&&!o)return{value:t,unescapeErrors:[],nonAsciiInBytes:!1,formatStringSegments:[]};const l=[];for(let e=0;e<t.length;e++)l.push(t.charCodeAt(e));const c=0!=(32&e.flags);if(!o&&!l.some((e=>13===e||10===e||92===e)))return{value:t,unescapeErrors:[],nonAsciiInBytes:c&&l.some((e=>e>=128)),formatStringSegments:[]};let p=0,d={offset:0,length:0,valueParts:[],isExpression:!1,hasFormatSpecifier:!1},u=0;const m={valueParts:[],unescapeErrors:[],nonAsciiInBytes:!1,formatStringSegments:[]},y=()=>{a||m.unescapeErrors.push({offset:u-1,length:2,errorType:0})},h=(e=0)=>u+e>=l.length?3:l[u+e],g=e=>{let t=!1,n=0,s="";for(let s=0;s<e;s++){const e=h(1+s);if(!i(e)){t=!0;break}n=16*n+r(e)}return t?(y(),s="\\"+String.fromCharCode(h()),u++):(s=String.fromCharCode(n),u+=1+e),s},f=e=>{const t=String.fromCharCode(e);m.valueParts.push(t),d.valueParts.push(t)};for(;;){let e=h();if(3===e)return o&&(d.isExpression&&m.unescapeErrors.push({offset:d.offset,length:u-d.offset,errorType:3}),u!==d.offset&&(d.length=u-d.offset,m.formatStringSegments.push(d))),_=m,{..._,value:_.valueParts.join(""),formatStringSegments:_.formatStringSegments.map((e=>({...e,value:e.valueParts.join("")})))};if(92===e){if(o&&d.isExpression&&!d.hasFormatSpecifier&&m.unescapeErrors.push({offset:u,length:1,errorType:1}),u++,a){f(e);continue}e=h();let t="";if(13===e||10===e)13===e&&10===h(1)&&(a&&(t+=String.fromCharCode(e)),u++,e=h()),a&&(t="\\"+t+String.fromCharCode(e)),u++;else if(a)t="\\"+String.fromCharCode(e),u++;else switch(e){case 92:case 39:case 34:t=String.fromCharCode(e),u++;break;case 97:t="",u++;break;case 98:t="\b",u++;break;case 102:t="\f",u++;break;case 110:t="\n",u++;break;case 114:t="\r",u++;break;case 116:t="\t",u++;break;case 118:t="\v",u++;break;case 120:t=g(2);break;case 78:{let s=!1,i=1;if(123!==h(i))s=!0;else for(i++;;){const e=h(i);if(125===e)break;if(!n(e)&&45!==e&&32!==(T=e)&&9!==T){s=!0;break}i++}s?(y(),t="\\"+String.fromCharCode(e),u++):(t="-",u+=1+i);break}case 117:t=g(4);break;case 85:t=g(8);break;default:if(s(e)){let n=e-48;u++,e=h(),s(e)&&(n=8*n+e-48,u++,e=h(),s(e)&&(n=8*n+e-48,u++)),t=String.fromCharCode(n)}else t="\\",y()}m.valueParts.push(t),d.valueParts.push(t)}else if(10===e||13===e)13===e&&10===h(1)&&(f(e),u++,e=h()),f(e),u++;else if(o&&123===e)d.isExpression||123!==h(1)?(0===p?(d.length=u-d.offset,d.length>0&&m.formatStringSegments.push(d),u++,d={offset:u,length:0,valueParts:[],isExpression:!0,hasFormatSpecifier:!1}):(f(e),u++),p++):(f(e),u+=2);else if(o&&125===e)d.isExpression||125!==h(1)?0===p?(m.unescapeErrors.push({offset:u,length:1,errorType:2}),u++):(p--,0===p?(d.length=u-d.offset,m.formatStringSegments.push(d),u++,d={offset:u,length:0,valueParts:[],isExpression:!1,hasFormatSpecifier:!1}):(f(e),u++)):(f(e),u+=2);else if(!d.isExpression||39!==e&&34!==e)d.isExpression&&58===e&&(d.hasFormatSpecifier=!0),c&&e>=128&&(m.nonAsciiInBytes=!0),f(e),u++;else{const t=e;f(e);const n=h(1)===t&&h(2)===t;for(n&&(u+=2,f(e),f(e),m.valueParts.push(String.fromCharCode(e)),m.valueParts.push(String.fromCharCode(e)));;){u++;let e=h();if(3===e)break;if(92!==e){if((10===e||13===e)&&!n)break;if(e===t){if(!n){u++,f(e);break}if(h(1)===t&&h(2)===t){u+=3,f(e),f(e),f(e);break}}f(e)}else f(e),u++,e=h(),f(e)}}}var T,_}},7280:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Tokenizer=t.defaultTabSize=void 0;const s=n(979),i=n(49900),r=n(19794),a=n(66945),o=new Map([["and",0],["as",1],["assert",2],["async",3],["await",4],["break",5],["case",6],["class",7],["continue",8],["__debug__",9],["def",10],["del",11],["elif",12],["else",13],["except",14],["finally",16],["for",17],["from",18],["global",19],["if",20],["import",21],["in",22],["is",23],["lambda",24],["match",25],["nonlocal",27],["not",28],["or",29],["pass",30],["raise",31],["return",32],["try",34],["while",35],["with",36],["yield",37],["False",15],["None",26],["True",33]]),l={0:3,1:4,2:4,3:2,4:4,5:1,6:2,7:4,8:2,9:4,10:2,11:4,12:10,13:2,14:4,15:10,16:10,17:2,18:4,19:26,20:10,21:10,22:2,23:4,24:2,25:4,26:2,27:4,28:10,29:2,30:4,31:2,32:4,33:2,34:4,36:2,37:2,38:1,39:2,40:2,41:2,42:2};t.defaultTabSize=8;t.Tokenizer=class{constructor(){this._cs=new r.CharacterStream(""),this._tokens=[],this._prevLineStart=0,this._parenDepth=0,this._lineRanges=[],this._indentAmounts=[],this._typeIgnoreLines=new Map,this._pyrightIgnoreLines=new Map,this._crCount=0,this._crLfCount=0,this._lfCount=0,this._indentCount=0,this._indentTabCount=0,this._indentSpacesTotal=0,this._singleQuoteCount=0,this._doubleQuoteCount=0,this._ipythonMode=!1}tokenize(e,n,i,o=0,l=!1){if(void 0===n)n=0;else if(n<0||n>e.length)throw new Error("Invalid range start");if(void 0===i)i=e.length;else{if(i<0||n+i>e.length)throw new Error("Invalid range length");n+i<e.length&&(e=e.substr(0,n+i))}this._cs=new r.CharacterStream(e),this._cs.position=n,this._tokens=[],this._prevLineStart=0,this._parenDepth=o,this._lineRanges=[],this._indentAmounts=[],this._ipythonMode=l;const c=n+i;for(0===n&&this._readIndentationAfterNewLine();!(this._cs.isEndOfStream()||(this._addNextToken(),this._cs.position>=c)););0!==this._tokens.length&&2===this._tokens[this._tokens.length-1].type||this._tokens.push(a.NewLineToken.create(this._cs.position,0,3,this._getComments())),this._setIndent(0,0,!1,!1),this._tokens.push(a.Token.create(1,this._cs.position,0,this._getComments())),this._addLineRange();let p="\n";this._crCount>this._crLfCount&&this._crCount>this._lfCount?p="\r":this._crLfCount>this._crCount&&this._crLfCount>this._lfCount&&(p="\r\n");let d=" ";if(this._indentTabCount>this._indentCount/2)d="\t";else if(this._indentCount>0){let e=Math.round(this._indentSpacesTotal/this._indentCount);e<1?e=1:e>t.defaultTabSize&&(e=t.defaultTabSize),d="";for(let t=0;t<e;t++)d+=" "}return{tokens:new s.TextRangeCollection(this._tokens),lines:new s.TextRangeCollection(this._lineRanges),typeIgnoreLines:this._typeIgnoreLines,typeIgnoreAll:this._typeIgnoreAll,pyrightIgnoreLines:this._pyrightIgnoreLines,predominantEndOfLineSequence:p,predominantTabSequence:d,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;if(this._ipythonMode&&this._isIPythonMagics())return this._handleIPythonMagics(37===this._cs.currentChar?1:2),!0;switch(this._cs.currentChar){case 65279:return 0!==this._cs.position&&this._handleInvalid();case 13:{const e=10===this._cs.nextChar?2:1,t=2===e?2:0;return this._handleNewLine(e,t),!0}case 10:return this._handleNewLine(1,1),!0;case 92:return 13===this._cs.nextChar?(10===this._cs.lookAhead(2)?this._cs.advance(3):this._cs.advance(2),this._addLineRange(),!0):10===this._cs.nextChar?(this._cs.advance(2),this._addLineRange(),!0):this._handleInvalid();case 40:this._parenDepth++,this._tokens.push(a.Token.create(13,this._cs.position,1,this._getComments()));break;case 41:this._parenDepth>0&&this._parenDepth--,this._tokens.push(a.Token.create(14,this._cs.position,1,this._getComments()));break;case 91:this._parenDepth++,this._tokens.push(a.Token.create(15,this._cs.position,1,this._getComments()));break;case 93:this._parenDepth>0&&this._parenDepth--,this._tokens.push(a.Token.create(16,this._cs.position,1,this._getComments()));break;case 123:this._parenDepth++,this._tokens.push(a.Token.create(17,this._cs.position,1,this._getComments()));break;case 125:this._parenDepth>0&&this._parenDepth--,this._tokens.push(a.Token.create(18,this._cs.position,1,this._getComments()));break;case 44:this._tokens.push(a.Token.create(12,this._cs.position,1,this._getComments()));break;case 96:this._tokens.push(a.Token.create(22,this._cs.position,1,this._getComments()));break;case 59:this._tokens.push(a.Token.create(11,this._cs.position,1,this._getComments()));break;case 58:if(61===this._cs.nextChar){this._tokens.push(a.OperatorToken.create(this._cs.position,2,35,this._getComments())),this._cs.advance(1);break}this._tokens.push(a.Token.create(10,this._cs.position,1,this._getComments()));break;default:if(this._isPossibleNumber()&&this._tryNumber())return!0;if(46===this._cs.currentChar){if(46===this._cs.nextChar&&46===this._cs.lookAhead(2))return this._tokens.push(a.Token.create(19,this._cs.position,3,this._getComments())),this._cs.advance(3),!0;this._tokens.push(a.Token.create(20,this._cs.position,1,this._getComments()));break}return!(!this._tryIdentifier()&&!this._tryOperator())||this._handleInvalid()}return!1}_addLineRange(){const e=this._cs.position-this._prevLineStart;e>0&&this._lineRanges.push({start:this._prevLineStart,length:e}),this._prevLineStart=this._cs.position}_handleNewLine(e,t){0===this._parenDepth&&3!==t&&(0!==this._tokens.length&&2===this._tokens[this._tokens.length-1].type||this._tokens.push(a.NewLineToken.create(this._cs.position,e,t,this._getComments()))),0===t?this._crCount++:2===t?this._crLfCount++:this._lfCount++,this._cs.advance(e),this._addLineRange(),this._readIndentationAfterNewLine()}_readIndentationAfterNewLine(){let e=0,n=0,s=!1,i=!1;for(;!this._cs.isEndOfStream();)switch(this._cs.currentChar){case 32:e++,n++,i=!0,this._cs.moveNext();break;case 9:e++,n+=t.defaultTabSize-n%t.defaultTabSize,s=!0,this._cs.moveNext();break;case 12:e=0,n=0,s=!1,i=!1,this._cs.moveNext();break;default:return void this._setIndent(e,n,i,s);case 35:case 10:case 13:return}}_setIndent(e,t,n,s){if(!(this._parenDepth>0))if(0===this._indentAmounts.length)t>0&&(this._indentCount++,s&&this._indentTabCount++,this._indentSpacesTotal+=t,this._indentAmounts.push({tab1Spaces:e,tab8Spaces:t,isSpacePresent:n,isTabPresent:s}),this._tokens.push(a.IndentToken.create(this._cs.position,0,t,!1,this._getComments())));else{const i=this._indentAmounts[this._indentAmounts.length-1];if(i.tab8Spaces<t){const r=(i.isSpacePresent&&s||i.isTabPresent&&n)&&i.tab1Spaces>=e;this._indentCount++,s&&this._indentTabCount++,this._indentSpacesTotal+=t-this._indentAmounts[this._indentAmounts.length-1].tab8Spaces,this._indentAmounts.push({tab1Spaces:e,tab8Spaces:t,isSpacePresent:n,isTabPresent:s}),this._tokens.push(a.IndentToken.create(this._cs.position,0,t,r,this._getComments()))}else if(i.tab8Spaces===t)(i.isSpacePresent&&s||i.isTabPresent&&n)&&this._tokens.push(a.IndentToken.create(this._cs.position,0,t,!0,this._getComments()));else{let e=i.isSpacePresent&&s||i.isTabPresent&&n;const r=[];for(;this._indentAmounts.length>0&&this._indentAmounts[this._indentAmounts.length-1].tab8Spaces>t;)r.push(this._indentAmounts.length>1?this._indentAmounts[this._indentAmounts.length-2].tab8Spaces:0),this._indentAmounts.pop();r.forEach(((n,s)=>{const i=s<r.length-1||n===t,o=s<r.length-1?n:t;this._tokens.push(a.DedentToken.create(this._cs.position,0,o,i,e,this._getComments())),e=!1}))}}}_tryIdentifier(){const e=()=>{for(;;)if((0,i.isIdentifierChar)(this._cs.currentChar))this._cs.moveNext();else{if(!(0,i.isIdentifierChar)(this._cs.currentChar,this._cs.nextChar))break;this._cs.moveNext(),this._cs.moveNext()}},t=this._cs.position;if((0,i.isIdentifierStartChar)(this._cs.currentChar)?(this._cs.moveNext(),e()):(0,i.isIdentifierStartChar)(this._cs.currentChar,this._cs.nextChar)&&(this._cs.moveNext(),this._cs.moveNext(),e()),this._cs.position>t){const e=this._cs.getText().substr(t,this._cs.position-t);return o.has(e)?this._tokens.push(a.KeywordToken.create(t,this._cs.position-t,o.get(e),this._getComments())):this._tokens.push(a.IdentifierToken.create(t,this._cs.position-t,e,this._getComments())),!0}return!1}_isPossibleNumber(){return!!(0,i.isDecimal)(this._cs.currentChar)||!(46!==this._cs.currentChar||!(0,i.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)&&(0,i.isHex)(this._cs.lookAhead(2))){for(this._cs.advance(2),n=2;(0,i.isHex)(this._cs.currentChar);)this._cs.moveNext();t=16}if((98===this._cs.nextChar||66===this._cs.nextChar)&&(0,i.isBinary)(this._cs.lookAhead(2))){for(this._cs.advance(2),n=2;(0,i.isBinary)(this._cs.currentChar);)this._cs.moveNext();t=2}if((111===this._cs.nextChar||79===this._cs.nextChar)&&(0,i.isOctal)(this._cs.lookAhead(2))){for(this._cs.advance(2),n=2;(0,i.isOctal)(this._cs.currentChar);)this._cs.moveNext();t=8}if(t>0){const s=this._cs.getText().substr(e,this._cs.position-e),i=s.replace(/_/g,"");let r=parseInt(i.substr(n),t);if(!isNaN(r)){const t=BigInt(i);return isFinite(r)&&BigInt(r)===t||(r=t),this._tokens.push(a.NumberToken.create(e,s.length,r,!0,!1,this._getComments())),!0}}}let t=!1,n=!1;if(this._cs.currentChar>=49&&this._cs.currentChar<=57){for(;(0,i.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=t.replace(/_/g,"");let s=parseInt(n,10);if(!isNaN(s)){let i=!1;const r=BigInt(n);return isFinite(s)&&BigInt(s)===r||(s=r),106!==this._cs.currentChar&&74!==this._cs.currentChar||(i=!0,t+=String.fromCharCode(this._cs.currentChar),this._cs.moveNext()),this._tokens.push(a.NumberToken.create(e,t.length,s,!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 s=!1;return 106!==this._cs.currentChar&&74!==this._cs.currentChar||(s=!0,t+=String.fromCharCode(this._cs.currentChar),this._cs.moveNext()),this._tokens.push(a.NumberToken.create(e,this._cs.position-e,n,!1,s,this._getComments())),!0}}return this._cs.position=e,!1}_tryOperator(){let e=0;const t=this._cs.nextChar;let n;switch(this._cs.currentChar){case 43:e=61===t?2:1,n=2===e?1:0;break;case 38:e=61===t?2:1,n=2===e?4:3;break;case 124:e=61===t?2:1,n=2===e?7:6;break;case 94:e=61===t?2:1,n=2===e?9:8;break;case 61:e=61===t?2:1,n=2===e?12:2;break;case 33:if(61!==t)return!1;e=2,n=28;break;case 37:e=61===t?2:1,n=2===e?25:24;break;case 126:e=1,n=5;break;case 45:if(62===t)return this._tokens.push(a.Token.create(21,this._cs.position,2,this._getComments())),this._cs.advance(2),!0;e=61===t?2:1,n=2===e?34:33;break;case 42:42===t?(e=61===this._cs.lookAhead(2)?3:2,n=3===e?30:29):(e=61===t?2:1,n=2===e?27:26);break;case 47:47===t?(e=61===this._cs.lookAhead(2)?3:2,n=3===e?14:13):(e=61===t?2:1,n=2===e?11:10);break;case 60:60===t?(e=61===this._cs.lookAhead(2)?3:2,n=3===e?18:17):62===t?(e=2,n=19):(e=61===t?2:1,n=2===e?21:20);break;case 62:62===t?(e=61===this._cs.lookAhead(2)?3:2,n=3===e?32:31):(e=61===t?2:1,n=2===e?16:15);break;case 64:e=61===t?2:1,n=2===e?23:22;break;default:return!1}return this._tokens.push(a.OperatorToken.create(this._cs.position,e,n,this._getComments())),this._cs.advance(e),e>0}_handleInvalid(){const e=this._cs.position;for(;10!==this._cs.currentChar&&13!==this._cs.currentChar&&!this._cs.isAtWhiteSpace()&&!this._cs.isEndOfStream();)(0,i.isSurrogateChar)(this._cs.currentChar)?(this._cs.moveNext(),this._cs.moveNext()):this._cs.moveNext();const t=this._cs.position-e;return t>0&&(this._tokens.push(a.Token.create(0,e,t,this._getComments())),!0)}_getComments(){const e=this._comments;return this._comments=void 0,e}_isIPythonMagics(){const e=this._tokens.length>0?this._tokens[this._tokens.length-1]:void 0;return!(void 0!==e&&2!==e.type&&3!==e.type||37!==this._cs.currentChar&&33!==this._cs.currentChar)}_handleIPythonMagics(e){const t=this._cs.position+1;let n=t;do{this._cs.skipToEol();const e=this._cs.position-n;if(!this._cs.getText().substr(n,e).match(/\\\s*$/))break;n=this._cs.position+1}while(!this._cs.isEndOfStream());const s=this._cs.position-t,i=this._cs.getText().substr(t,s),r=a.Comment.create(t,s,i,e);this._addComments(r)}_handleComment(){const e=this._cs.position+1;this._cs.skipToEol();const t=this._cs.position-e,n=this._cs.getText().substr(e,t),s=a.Comment.create(e,t,n),i=n.match(/^\s*type:\s*ignore(\s*\[([\s*\w-,]*)\]|\s|$)/);if(i){const t={range:{start:e,length:i[0].length},rulesList:this._getIgnoreCommentRulesList(e,i)};this._tokens.findIndex((e=>2!==e.type&&e&&3!==e.type))<0?this._typeIgnoreAll=t:this._typeIgnoreLines.set(this._lineRanges.length,t)}const r=n.match(/^\s*pyright:\s*ignore(\s*\[([\s*\w-,]*)\]|\s|$)/);if(r){const t={range:{start:e,length:r[0].length},rulesList:this._getIgnoreCommentRulesList(e,r)};this._pyrightIgnoreLines.set(this._lineRanges.length,t)}this._addComments(s)}_getIgnoreCommentRulesList(e,t){if(t.length<3||void 0===t[2])return;const n=t[2].split(","),s=[];let i=e+t[0].indexOf("[")+1;for(const e of n){const t=e.trimStart();i+=e.length-t.length;const n=t.trimEnd();n.length>0&&s.push({range:{start:i,length:n.length},text:n}),i+=t.length+1}return s}_addComments(e){this._comments?this._comments.push(e):this._comments=[e]}_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 s=this._skipToEndOfStringLiteral(e),i=this._cs.position;this._tokens.push(a.StringToken.create(n,i-n,s.flags,s.escapedValue,t,this._getComments()))}_skipToEndOfStringLiteral(e){const t=1&e?39:34,n=0!=(4&e);let s=[];for(;;){if(this._cs.isEndOfStream())return e|=65536,{escapedValue:String.fromCharCode.apply(void 0,s),flags:e};if(92===this._cs.currentChar)s.push(this._cs.currentChar),this._cs.moveNext(),13===this._cs.getCurrentChar()||10===this._cs.getCurrentChar()?(13===this._cs.getCurrentChar()&&10===this._cs.nextChar&&(s.push(this._cs.currentChar),this._cs.moveNext()),s.push(this._cs.currentChar),this._cs.moveNext(),this._addLineRange()):(s.push(this._cs.currentChar),this._cs.moveNext());else if(10===this._cs.currentChar||13===this._cs.currentChar){if(!n)return e|=65536,{escapedValue:String.fromCharCode.apply(void 0,s),flags:e};13===this._cs.currentChar&&10===this._cs.nextChar&&(s.push(this._cs.currentChar),this._cs.moveNext()),s.push(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}s.push(this._cs.currentChar),this._cs.moveNext()}}return s.length>32768&&(s=s.slice(0,32768),e|=131072),{escapedValue:String.fromCharCode.apply(void 0,s),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();(0,i.isDecimal)(this._cs.currentChar);)this._cs.moveNext()}}},66945:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.IdentifierToken=t.OperatorToken=t.NumberToken=t.StringToken=t.KeywordToken=t.NewLineToken=t.DedentToken=t.IndentToken=t.Token=t.Comment=void 0,function(e){e.create=function(e,t,n,s=0){return{type:s,start:e,length:t,value:n}}}(t.Comment||(t.Comment={})),function(e){e.create=function(e,t,n,s){return{start:t,length:n,type:e,comments:s}}}(t.Token||(t.Token={})),function(e){e.create=function(e,t,n,s,i){return{start:e,length:t,type:3,isIndentAmbiguous:s,comments:i,indentAmount:n}}}(t.IndentToken||(t.IndentToken={})),function(e){e.create=function(e,t,n,s,i,r){return{start:e,length:t,type:4,comments:r,indentAmount:n,matchesIndent:s,isDedentAmbiguous:i}}}(t.DedentToken||(t.DedentToken={})),function(e){e.create=function(e,t,n,s){return{start:e,length:t,type:2,comments:s,newLineType:n}}}(t.NewLineToken||(t.NewLineToken={})),function(e){e.create=function(e,t,n,s){return{start:e,length:t,type:8,comments:s,keywordType:n}}}(t.KeywordToken||(t.KeywordToken={})),function(e){e.create=function(e,t,n,s,i,r){return{start:e,length:t,type:5,flags:n,escapedValue:s,prefixLength:i,quoteMarkLength:4&n?3:1,comments:r}}}(t.StringToken||(t.StringToken={})),function(e){e.create=function(e,t,n,s,i,r){return{start:e,length:t,type:6,isInteger:s,isImaginary:i,value:n,comments:r}}}(t.NumberToken||(t.NumberToken={})),function(e){e.create=function(e,t,n,s){return{start:e,length:t,type:9,operatorType:n,comments:s}}}(t.OperatorToken||(t.OperatorToken={})),function(e){e.create=function(e,t,n,s){return{start:e,length:t,type:7,value:n.normalize("NFKC"),comments:s}}}(t.IdentifierToken||(t.IdentifierToken={}))},52846:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.unicodePc=t.unicodeNdSurrogate=t.unicodeNd=t.unicodeMcSurrogate=t.unicodeMc=t.unicodeMnSurrogate=t.unicodeMn=t.unicodeNlSurrogate=t.unicodeNl=t.unicodeLmSurrogate=t.unicodeLm=t.unicodeLoSurrogate=t.unicodeLo=t.unicodeLt=t.unicodeLlSurrogate=t.unicodeLl=t.unicodeLuSurrogate=t.unicodeLu=void 0,t.unicodeLu=[[65,90],[192,214],[216,222],256,258,260,262,264,266,268,270,272,274,276,278,280,282,284,286,288,290,292,294,296,298,300,302,304,306,308,310,313,315,317,319,321,323,325,327,330,332,334,336,338,340,342,344,346,348,350,352,354,356,358,360,362,364,366,368,370,372,374,[376,377],379,381,[385,386],388,[390,391],[393,395],[398,401],[403,404],[406,408],[412,413],[415,416],418,420,[422,423],425,428,[430,431],[433,435],437,[439,440],444,452,455,458,461,463,465,467,469,471,473,475,478,480,482,484,486,488,490,492,494,497,500,[502,504],506,508,510,512,514,516,518,520,522,524,526,528,530,532,534,536,538,540,542,544,546,548,550,552,554,556,558,560,562,[570,571],[573,574],577,[579,582],584,586,588,590,880,882,886,895,902,[904,906],908,[910,911],[913,929],[931,939],975,[978,980],984,986,988,990,992,994,996,998,1e3,1002,1004,1006,1012,1015,[1017,1018],[1021,1071],1120,1122,1124,1126,1128,1130,1132,1134,1136,1138,1140,1142,1144,1146,1148,1150,1152,1162,1164,1166,1168,1170,1172,1174,1176,1178,1180,1182,1184,1186,1188,1190,1192,1194,1196,1198,1200,1202,1204,1206,1208,1210,1212,1214,[1216,1217],1219,1221,1223,1225,1227,1229,1232,1234,1236,1238,1240,1242,1244,1246,1248,1250,1252,1254,1256,1258,1260,1262,1264,1266,1268,1270,1272,1274,1276,1278,1280,1282,1284,1286,1288,1290,1292,1294,1296,1298,1300,1302,1304,1306,1308,1310,1312,1314,1316,1318,1320,1322,1324,1326,[1329,1366],[4256,4293],4295,4301,[5024,5109],7680,7682,7684,7686,7688,7690,7692,7694,7696,7698,7700,7702,7704,7706,7708,7710,7712,7714,7716,7718,7720,7722,7724,7726,7728,7730,7732,7734,7736,7738,7740,7742,7744,7746,7748,7750,7752,7754,7756,7758,7760,7762,7764,7766,7768,7770,7772,7774,7776,7778,7780,7782,7784,7786,7788,7790,7792,7794,7796,7798,7800,7802,7804,7806,7808,7810,7812,7814,7816,7818,7820,7822,7824,7826,7828,7838,7840,7842,7844,7846,7848,7850,7852,7854,7856,7858,7860,7862,7864,7866,7868,7870,7872,7874,7876,7878,7880,7882,7884,7886,7888,7890,7892,7894,7896,7898,7900,7902,7904,7906,7908,7910,7912,7914,7916,7918,7920,7922,7924,7926,7928,7930,7932,7934,[7944,7951],[7960,7965],[7976,7983],[7992,7999],[8008,8013],8025,8027,8029,8031,[8040,8047],[8120,8123],[8136,8139],[8152,8155],[8168,8172],[8184,8187],8450,8455,[8459,8461],[8464,8466],8469,[8473,8477],8484,8486,8488,[8490,8493],[8496,8499],[8510,8511],8517,8579,[11264,11310],11360,[11362,11364],11367,11369,11371,[11373,11376],11378,11381,[11390,11392],11394,11396,11398,11400,11402,11404,11406,11408,11410,11412,11414,11416,11418,11420,11422,11424,11426,11428,11430,11432,11434,11436,11438,11440,11442,11444,11446,11448,11450,11452,11454,11456,11458,11460,11462,11464,11466,11468,11470,11472,11474,11476,11478,11480,11482,11484,11486,11488,11490,11499,11501,11506,42560,42562,42564,42566,42568,42570,42572,42574,42576,42578,42580,42582,42584,42586,42588,42590,42592,42594,42596,42598,42600,42602,42604,42624,42626,42628,42630,42632,42634,42636,42638,42640,42642,42644,42646,42648,42650,42786,42788,42790,42792,42794,42796,42798,42802,42804,42806,42808,42810,42812,42814,42816,42818,42820,42822,42824,42826,42828,42830,42832,42834,42836,42838,42840,42842,42844,42846,42848,42850,42852,42854,42856,42858,42860,42862,42873,42875,[42877,42878],42880,42882,42884,42886,42891,42893,42896,42898,42902,42904,42906,42908,42910,42912,42914,42916,42918,42920,[42922,42926],[42928,42932],42934,[65313,65338],[66560,66599],[66736,66771],[68736,68786],[71840,71871],[119808,119833],[119860,119885],[119912,119937],119964,[119966,119967],119970,[119973,119974],[119977,119980],[119982,119989],[120016,120041],[120068,120069],[120071,120074],[120077,120084],[120086,120092],[120120,120121],[120123,120126],[120128,120132],120134,[120138,120144],[120172,120197],[120224,120249],[120276,120301],[120328,120353],[120380,120405],[120432,120457],[120488,120512],[120546,120570],[120604,120628],[120662,120686],[120720,120744],120778,[125184,125217]],t.unicodeLuSurrogate={55297:[[56320,56359],[56496,56531]],55299:[[56448,56498]],55302:[[56480,56511]],55323:[[56896,56927]],55349:[[56320,56345],[56372,56397],[56424,56449],56476,[56478,56479],56482,[56485,56486],[56489,56492],[56494,56501],[56528,56553],[56580,56581],[56583,56586],[56589,56596],[56598,56604],[56632,56633],[56635,56638],[56640,56644],56646,[56650,56656],[56684,56709],[56736,56761],[56788,56813],[56840,56865],[56892,56917],[56944,56969],[57e3,57024],[57058,57082],[57116,57140],[57174,57198],[57232,57256],[57290,57290]],55354:[[56576,56609]]},t.unicodeLl=[[97,122],181,[223,246],[248,255],257,259,261,263,265,267,269,271,273,275,277,279,281,283,285,287,289,291,293,295,297,299,301,303,305,307,309,[311,312],314,316,318,320,322,324,326,[328,329],331,333,335,337,339,341,343,345,347,349,351,353,355,357,359,361,363,365,367,369,371,373,375,378,380,[382,384],387,389,392,[396,397],402,405,[409,411],414,417,419,421,424,[426,427],429,432,436,438,[441,442],[445,447],454,457,460,462,464,466,468,470,472,474,[476,477],479,481,483,485,487,489,491,493,[495,496],499,501,505,507,509,511,513,515,517,519,521,523,525,527,529,531,533,535,537,539,541,543,545,547,549,551,553,555,557,559,561,[563,569],572,[575,576],578,583,585,587,589,[591,659],[661,687],881,883,887,[891,893],912,[940,974],[976,977],[981,983],985,987,989,991,993,995,997,999,1001,1003,1005,[1007,1011],1013,1016,[1019,1020],[1072,1119],1121,1123,1125,1127,1129,1131,1133,1135,1137,1139,1141,1143,1145,1147,1149,1151,1153,1163,1165,1167,1169,1171,1173,1175,1177,1179,1181,1183,1185,1187,1189,1191,1193,1195,1197,1199,1201,1203,1205,1207,1209,1211,1213,1215,1218,1220,1222,1224,1226,1228,[1230,1231],1233,1235,1237,1239,1241,1243,1245,1247,1249,1251,1253,1255,1257,1259,1261,1263,1265,1267,1269,1271,1273,1275,1277,1279,1281,1283,1285,1287,1289,1291,1293,1295,1297,1299,1301,1303,1305,1307,1309,1311,1313,1315,1317,1319,1321,1323,1325,1327,[1377,1415],[5112,5117],[7296,7304],[7424,7467],[7531,7543],[7545,7578],7681,7683,7685,7687,7689,7691,7693,7695,7697,7699,7701,7703,7705,7707,7709,7711,7713,7715,7717,7719,7721,7723,7725,7727,7729,7731,7733,7735,7737,7739,7741,7743,7745,7747,7749,7751,7753,7755,7757,7759,7761,7763,7765,7767,7769,7771,7773,7775,7777,7779,7781,7783,7785,7787,7789,7791,7793,7795,7797,7799,7801,7803,7805,7807,7809,7811,7813,7815,7817,7819,7821,7823,7825,7827,[7829,7837],7839,7841,7843,7845,7847,7849,7851,7853,7855,7857,7859,7861,7863,7865,7867,7869,7871,7873,7875,7877,7879,7881,7883,7885,7887,7889,7891,7893,7895,7897,7899,7901,7903,7905,7907,7909,7911,7913,7915,7917,7919,7921,7923,7925,7927,7929,7931,7933,[7935,7943],[7952,7957],[7968,7975],[7984,7991],[8e3,8005],[8016,8023],[8032,8039],[8048,8061],[8064,8071],[8080,8087],[8096,8103],[8112,8116],[8118,8119],8126,[8130,8132],[8134,8135],[8144,8147],[8150,8151],[8160,8167],[8178,8180],[8182,8183],8458,[8462,8463],8467,8495,8500,8505,[8508,8509],[8518,8521],8526,8580,[11312,11358],11361,[11365,11366],11368,11370,11372,11377,[11379,11380],[11382,11387],11393,11395,11397,11399,11401,11403,11405,11407,11409,11411,11413,11415,11417,11419,11421,11423,11425,11427,11429,11431,11433,11435,11437,11439,11441,11443,11445,11447,11449,11451,11453,11455,11457,11459,11461,11463,11465,11467,11469,11471,11473,11475,11477,11479,11481,11483,11485,11487,11489,[11491,11492],11500,11502,11507,[11520,11557],11559,11565,42561,42563,42565,42567,42569,42571,42573,42575,42577,42579,2581,42583,42585,42587,42589,42591,42593,42595,42597,42599,42601,42603,42605,42625,42627,42629,42631,42633,42635,42637,42639,42641,42643,42645,42647,42649,42651,42787,42789,42791,42793,42795,42797,[42799,42801],42803,42805,42807,42809,42811,42813,42815,42817,42819,42821,42823,42825,42827,42829,42831,42833,42835,42837,42839,42841,42843,42845,42847,42849,42851,42853,42855,42857,42859,42861,42863,[42865,42872],42874,42876,42879,42881,42883,42885,42887,42892,42894,42897,[42899,42901],42903,42905,42907,42909,42911,42913,42915,42917,42919,42921,42933,42935,43002,[43824,43866],[43872,43877],[43888,43967],[64256,64262],[64275,64279],[65345,65370],[66600,66639],[66776,66811],[68800,68850],[71872,71903],[119834,119859],[119886,119892],[119894,119911],[119938,119963],[119990,119993],119995,[119997,120003],[120005,120015],[120042,120067],[120094,120119],[120146,120171],[120198,120223],[120250,120275],[120302,120327],[120354,120379],[120406,120431],[120458,120485],[120514,120538],[120540,120545],[120572,120596],[120598,120603],[120630,120654],[120656,120661],[120688,120712],[120714,120719],[120746,120770],[120772,120777],120779,[125218,125251]],t.unicodeLlSurrogate={55297:[[56360,56399],[56536,56571]],55299:[[56512,56562]],55302:[[56512,56543]],55323:[[56928,56959]],55349:[[56346,56371],[56398,56404],[56406,56423],[56450,56475],[56502,56505],56507,[56509,56515],[56517,56527],[56554,56579],[56606,56631],[56658,56683],[56710,56735],[56762,56787],[56814,56839],[56866,56891],[56918,56943],[56970,56997],[57026,57050],[57052,57057],[57084,57108],[57110,57115],[57142,57166],[57168,57173],[57200,57224],[57226,57231],[57258,57282],[57284,57289],[57291,57291]],55354:[[56610,56643]]},t.unicodeLt=[453,456,459,498,[8072,8079],[8088,8095],[8104,8111],8124,8140,8188],t.unicodeLo=[170,186,443,[448,451],660,[1488,1514],[1520,1522],[1568,1599],[1601,1610],[1646,1647],[1649,1747],1749,[1774,1775],[1786,1788],1791,1808,[1810,1839],[1869,1957],1969,[1994,2026],[2048,2069],[2112,2136],[2144,2154],[2208,2228],[2230,2237],[2308,2361],2365,2384,[2392,2401],[2418,2432],[2437,2444],[2447,2448],[2451,2472],[2474,2480],2482,[2486,2489],2493,2510,[2524,2525],[2527,2529],[2544,2545],2556,[2565,2570],[2575,2576],[2579,2600],[2602,2608],[2610,2611],[2613,2614],[2616,2617],[2649,2652],2654,[2674,2676],[2693,2701],[2703,2705],[2707,2728],[2730,2736],[2738,2739],[2741,2745],2749,2768,[2784,2785],2809,[2821,2828],[2831,2832],[2835,2856],[2858,2864],[2866,2867],[2869,2873],2877,[2908,2909],[2911,2913],2929,2947,[2949,2954],[2958,2960],[2962,2965],[2969,2970],2972,[2974,2975],[2979,2980],[2984,2986],[2990,3001],3024,[3077,3084],[3086,3088],[3090,3112],[3114,3129],3133,[3160,3162],[3168,3169],3200,[3205,3212],[3214,3216],[3218,3240],[3242,3251],[3253,3257],3261,3294,[3296,3297],[3313,3314],[3333,3340],[3342,3344],[3346,3386],3389,3406,[3412,3414],[3423,3425],[3450,3455],[3461,3478],[3482,3505],[3507,3515],3517,[3520,3526],[3585,3632],[3634,3635],[3648,3653],[3713,3714],3716,[3719,3720],3722,3725,[3732,3735],[3737,3743],[3745,3747],3749,3751,[3754,3755],[3757,3760],[3762,3763],3773,[3776,3780],[3804,3807],3840,[3904,3911],[3913,3948],[3976,3980],[4096,4138],4159,[4176,4181],[4186,4189],4193,[4197,4198],[4206,4208],[4213,4225],4238,[4304,4346],[4349,4680],[4682,4685],[4688,4694],4696,[4698,4701],[4704,4744],[4746,4749],[4752,4784],[4786,4789],[4792,4798],4800,[4802,4805],[4808,4822],[4824,4880],[4882,4885],[4888,4954],[4992,5007],[5121,5740],[5743,5759],[5761,5786],[5792,5866],[5873,5880],[5888,5900],[5902,5905],[5920,5937],[5952,5969],[5984,5996],[5998,6e3],[6016,6067],6108,[6176,6210],[6212,6263],[6272,6276],[6279,6312],6314,[6320,6389],[6400,6430],[6480,6509],[6512,6516],[6528,6571],[6576,6601],[6656,6678],[6688,6740],[6917,6963],[6981,6987],[7043,7072],[7086,7087],[7098,7141],[7168,7203],[7245,7247],[7258,7287],[7401,7404],[7406,7409],[7413,7414],[8501,8504],[11568,11623],[11648,11670],[11680,11686],[11688,11694],[11696,11702],[11704,11710],[11712,11718],[11720,11726],[11728,11734],[11736,11742],12294,12348,[12353,12438],12447,[12449,12538],12543,[12549,12590],[12593,12686],[12704,12730],[12784,12799],[13312,19893],[19968,40938],[40960,40980],[40982,42124],[42192,42231],[42240,42507],[42512,42527],[42538,42539],42606,[42656,42725],42895,42999,[43003,43009],[43011,43013],[43015,43018],[43020,43042],[43072,43123],[43138,43187],[43250,43255],43259,43261,[43274,43301],[43312,43334],[43360,43388],[43396,43442],[43488,43492],[43495,43503],[43514,43518],[43520,43560],[43584,43586],[43588,43595],[43616,43631],[43633,43638],43642,[43646,43695],43697,[43701,43702],[43705,43709],43712,43714,[43739,43740],[43744,43754],43762,[43777,43782],[43785,43790],[43793,43798],[43808,43814],[43816,43822],[43968,44002],[44032,55203],[55216,55238],[55243,55291],[63744,64109],[64112,64217],64285,[64287,64296],[64298,64310],[64312,64316],64318,[64320,64321],[64323,64324],[64326,64433],[64467,64829],[64848,64911],[64914,64967],[65008,65019],[65136,65140],[65142,65276],[65382,65391],[65393,65437],[65440,65470],[65474,65479],[65482,65487],[65490,65495],[65498,65500],[65536,65547],[65549,65574],[65576,65594],[65596,65597],[65599,65613],[65616,65629],[65664,65786],[66176,66204],[66208,66256],[66304,66335],[66349,66368],[66370,66377],[66384,66421],[66432,66461],[66464,66499],[66504,66511],[66640,66717],[66816,66855],[66864,66915],[67072,67382],[67392,67413],[67424,67431],[67584,67589],67592,[67594,67637],[67639,67640],67644,[67647,67669],[67680,67702],[67712,67742],[67808,67826],[67828,67829],[67840,67861],[67872,67897],[67968,68023],[68030,68031],68096,[68112,68115],[68117,68119],[68121,68147],[68192,68220],[68224,68252],[68288,68295],[68297,68324],[68352,68405],[68416,68437],[68448,68466],[68480,68497],[68608,68680],[69635,69687],[69763,69807],[69840,69864],[69891,69926],[69968,70002],70006,[70019,70066],[70081,70084],70106,70108,[70144,70161],[70163,70187],[70272,70278],70280,[70282,70285],[70287,70301],[70303,70312],[70320,70366],[70405,70412],[70415,70416],[70419,70440],[70442,70448],[70450,70451],[70453,70457],70461,70480,[70493,70497],[70656,70708],[70727,70730],[70784,70831],[70852,70853],70855,[71040,71086],[71128,71131],[71168,71215],71236,[71296,71338],[71424,71449],71935,72192,[72203,72242],72250,72272,[72284,72323],[72326,72329],[72384,72440],[72704,72712],[72714,72750],72768,[72818,72847],[72960,72966],[72968,72969],[72971,73008],73030,[73728,74649],[74880,75075],[77824,78894],[82944,83526],[92160,92728],[92736,92766],[92880,92909],[92928,92975],[93027,93047],[93053,93071],[93952,94020],94032,[94208,100332],[100352,101106],[110592,110878],[110960,111355],[113664,113770],[113776,113788],[113792,113800],[113808,113817],[124928,125124],[126464,126467],[126469,126495],[126497,126498],126500,126503,[126505,126514],[126516,126519],126521,126523,126530,126535,126537,126539,[126541,126543],[126545,126546],126548,126551,126553,126555,126557,126559,[126561,126562],126564,[126567,126570],[126572,126578],[126580,126583],[126585,126588],126590,[126592,126601],[126603,126619],[126625,126627],[126629,126633],[126635,126651],[131072,173782],[173824,177972],[177984,178205],[178208,183969],[183984,191456],[194560,195101]],t.unicodeLoSurrogate={55296:[[56320,56331],[56333,56358],[56360,56378],[56380,56381],[56383,56397],[56400,56413],[56448,56570],[56960,56988],[56992,57040],[57088,57119],[57133,57152],[57154,57161],[57168,57205],[57216,57245],[57248,57283],[57288,57295]],55297:[[56400,56477],[56576,56615],[56624,56675],[56832,57142],[57152,57173],[57184,57191]],55298:[[56320,56325],[56328,56328],[56330,56373],[56375,56376],[56380,56380],[56383,56405],[56416,56438],[56448,56478],[56544,56562],[56564,56565],[56576,56597],[56608,56633],[56704,56759],[56766,56767],[56832,56832],[56848,56851],[56853,56855],[56857,56885],[56928,56956],[56960,56988],[57024,57031],[57033,57060],[57088,57141],[57152,57173],[57184,57202],[57216,57233]],55299:[[56320,56392],[56576,56611],[56960,57001],[57008,57009],[57088,57116],57127,[57136,57157],[57264,57284],[57312,57334]],55300:[[56323,56375],[56451,56495],[56528,56552],[56579,56614],56644,56647,[56656,56690],56694,[56707,56754],[56769,56772],56794,56796,[56832,56849],[56851,56875],[56960,56966],56968,[56970,56973],[56975,56989],[56991,57e3],[57008,57054],[57093,57100],[57103,57104],[57107,57128],[57130,57136],[57138,57139],[57141,57145],57149,57168,[57181,57185]],55301:[[56320,56372],[56391,56394],[56415,56417],[56448,56495],[56516,56517],56519,[56704,56750],[56792,56795],[56832,56879],56900,[56960,57002],57016,[57088,57114]],55302:[[56320,56363],[56575,56582],56585,[56588,56595],[56597,56598],[56600,56623],56639,56641,[56736,56743],[56746,56784],56801,56803,56832,[56843,56882],56890,56912,[56924,56969],56989,[57024,57080]],55303:[[56320,56328],[56330,56366],56384,56434,[56576,56582],[56584,56585],[56587,56624],56646,[56672,56677],[56679,56680],[56682,56713],56728,[57056,57074],57264],55304:[[56320,57241]],55305:[[56448,56643]],55308:[[56320,57343]],55309:[[56320,56366]],55313:[[56320,56902]],55322:[[56320,56888],[56896,56926],[57040,57069],[57088,57135],[57187,57207],[57213,57231]],55323:[[57088,57162],57168],55324:[56320],55329:[57335],55330:[[56320,57343]],55331:[[56320,56533],[56576,56576],[56584,56584]],55340:[[56320,56606],[56656,56658],[56676,56679],[56688,57083]],55343:[[56320,56426],[56432,56444],[56448,56456],[56464,56473]],55352:[[56576,56620],56654,[57024,57067]],55354:[[56320,56516]],55355:[[56832,56835],[56837,56863],[56865,56866],56868,56871,[56873,56882],[56884,56887],56889,56891,56898,56903,56905,56907,[56909,56911],[56913,56914],56916,56919,56921,56923,56925,56927,[56929,56930],56932,[56935,56938],[56940,56946],[56948,56951],[56953,56956],56958,[56960,56969],[56971,56987],[56993,56995],[56997,57001],[57003,57019]],55360:[56320],55401:[57053,57088],55405:[57140,57152],55406:[56349,56352],55411:[56993,57008],55418:[57312],55422:[[56320,56861]],55424:[56320],55428:[57162]},t.unicodeLm=[[688,705],[710,721],[736,740],748,750,884,890,1369,1600,[1765,1766],[2036,2037],2042,2074,2084,2088,2417,3654,3782,4348,6103,6211,6823,[7288,7293],[7468,7530],7544,[7579,7615],8305,8319,[8336,8348],[11388,11389],11631,11823,12293,[12337,12341],12347,[12445,12446],[12540,12542],40981,[42232,42237],42508,42623,[42652,42653],[42775,42783],42864,42888,[43e3,43001],43471,43494,43632,43741,[43763,43764],[43868,43871],65392,[65438,65439],[92992,92995],[94099,94111],[94176,94177]],t.unicodeLmSurrogate={55322:[[57152,57155]],55323:[[57235,57247],[57312,57313],57315],55352:[[56631,56637]],55354:[56651]},t.unicodeNl=[[5870,5872],[8544,8578],[8581,8584],12295,[12321,12329],[12344,12346],[42726,42735],[65856,65908],66369,66378,[66513,66517],[74752,74862]],t.unicodeNlSurrogate={55296:[[56640,56692],57153,57162,[57297,57301]],55305:[[56320,56430]]},t.unicodeMn=[[768,879],[1155,1159],[1425,1469],1471,[1473,1474],[1476,1477],1479,[1552,1562],[1611,1631],1648,[1750,1756],[1759,1764],[1767,1768],[1770,1773],1809,[1840,1866],[1958,1968],[2027,2035],[2070,2073],[2075,2083],[2085,2087],[2089,2093],[2137,2139],[2260,2273],[2275,2306],2362,2364,[2369,2376],2381,[2385,2391],[2402,2403],2433,2492,[2497,2500],2509,[2530,2531],[2561,2562],2620,[2625,2626],[2631,2632],[2635,2637],2641,[2672,2673],2677,[2689,2690],2748,[2753,2757],[2759,2760],2765,[2786,2787],[2810,2815],2817,2876,2879,[2881,2884],2893,2902,[2914,2915],2946,3008,3021,3072,[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3170,3171],3201,3260,3263,3270,[3276,3277],[3298,3299],[3328,3329],[3387,3388],[3393,3396],3405,[3426,3427],3530,[3538,3540],3542,3633,[3636,3642],[3655,3662],3761,[3764,3769],[3771,3772],[3784,3789],[3864,3865],3893,3895,3897,[3953,3966],[3968,3972],[3974,3975],[3981,3991],[3993,4028],4038,[4141,4144],[4146,4151],[4153,4154],[4157,4158],[4184,4185],[4190,4192],[4209,4212],4226,[4229,4230],4237,4253,[4957,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],6086,[6089,6099],6109,[6155,6157],[6277,6278],6313,[6432,6434],[6439,6440],6450,[6457,6459],[6679,6680],6683,6742,[6744,6750],6752,6754,[6757,6764],[6771,6780],6783,[6832,6845],[6912,6915],6964,[6966,6970],6972,6978,[7019,7027],[7040,7041],[7074,7077],[7080,7081],[7083,7085],7142,[7144,7145],7149,[7151,7153],[7212,7219],[7222,7223],[7376,7378],[7380,7392],[7394,7400],7405,7412,[7416,7417],[7616,7673],[7675,7679],[8400,8412],8417,[8421,8432],[11503,11505],11647,[11744,11775],[12330,12333],[12441,12442],42607,[42612,42621],[42654,42655],[42736,42737],43010,43014,43019,[43045,43046],[43204,43205],[43232,43249],[43302,43309],[43335,43345],[43392,43394],43443,[43446,43449],43452,43493,[43561,43566],[43569,43570],[43573,43574],43587,43596,43644,43696,[43698,43700],[43703,43704],[43710,43711],43713,[43756,43757],43766,44005,44008,44013,64286,[65024,65039],[65056,65071],66045,66272,[66422,66426],[68097,68099],[68101,68102],[68108,68111],[68152,68154],68159,[68325,68326],69633,[69688,69702],[69759,69761],[69811,69814],[69817,69818],[69888,69890],[69927,69931],[69933,69940],70003,[70016,70017],[70070,70078],[70090,70092],[70191,70193],70196,[70198,70199],70206,70367,[70371,70378],[70400,70401],70460,70464,[70502,70508],[70512,70516],[70712,70719],[70722,70724],70726,[70835,70840],70842,[70847,70848],[70850,70851],[71090,71093],[71100,71101],[71103,71104],[71132,71133],[71219,71226],71229,[71231,71232],71339,71341,[71344,71349],71351,[71453,71455],[71458,71461],[71463,71467],[72193,72198],[72201,72202],[72243,72248],[72251,72254],72263,[72273,72278],[72281,72283],[72330,72342],[72344,72345],[72752,72758],[72760,72765],72767,[72850,72871],[72874,72880],[72882,72883],[72885,72886],[73009,73014],73018,[73020,73021],[73023,73029],73031,[92912,92916],[92976,92982],[94095,94098],[113821,113822],[119143,119145],[119163,119170],[119173,119179],[119210,119213],[119362,119364],[121344,121398],[121403,121452],121461,121476,[121499,121503],[121505,121519],[122880,122886],[122888,122904],[122907,122913],[122915,122916],[122918,122922],[125136,125142],[125252,125258],[917760,917999]],t.unicodeMnSurrogate={55296:[56829,57056,[57206,57210]],55298:[[56833,56835],[56837,56838],[56844,56847],[56888,56890],56895,[57061,57062]],55299:[[56612,56615],[57003,57004],[57158,57168]],55300:[56321,[56376,56390],[56447,56449],[56499,56502],[56505,56506],[56576,56578],[56615,56619],[56621,56628],56691,[56704,56705],[56758,56766],[56777,56780],56783,[56879,56881],56884,[56886,56887],56894,57055,[57059,57066],[57088,57089],[57147,57148],57152,[57190,57196],[57200,57204]],55301:[[56376,56383],[56386,56388],56390,56414,[56499,56504],56506,[56511,56512],[56514,56515],[56754,56757],[56764,56765],[56767,56768],[56796,56797],[56883,56890],56893,[56895,56896],57003,57005,[57008,57013],57015,[57117,57119],[57122,57125],[57127,57131]],55302:[[56367,56375],[56377,56378],[56635,56636],56638,56643,[56788,56791],[56794,56795],56800,[56833,56842],[56883,56888],[56891,56894],56903,[56913,56918],[56921,56923],[56970,56982],[56984,56985]],55303:[[56368,56374],[56376,56381],56383,[56466,56487],[56490,56496],[56498,56499],[56501,56502],[56625,56630],56634,[56636,56637],[56639,56645],56647,[56720,56721],56725,56727,[57075,57076]],55322:[[57072,57076],[57136,57142]],55323:[57167,[57231,57234],57316],55343:[[56477,56478]],55348:[[56679,56681],[56699,56706],[56709,56715],[56746,56749],[56898,56900]],55350:[[56832,56886],[56891,56940],56949,56964,[56987,56991],[56993,57007]],55352:[[56320,56326],[56328,56344],[56347,56353],[56355,56356],[56358,56362],[56624,56630],[57068,57071]],55354:[[56528,56534],[56644,56650]],56128:[[56576,56815]]},t.unicodeMc=[2307,2363,[2366,2368],[2377,2380],[2382,2383],[2434,2435],[2494,2496],[2503,2504],[2507,2508],2519,2563,[2622,2624],2691,[2750,2752],2761,[2763,2764],[2818,2819],2878,2880,[2887,2888],[2891,2892],2903,[3006,3007],[3009,3010],[3014,3016],[3018,3020],3031,[3073,3075],[3137,3140],[3202,3203],3262,[3264,3268],[3271,3272],[3274,3275],[3285,3286],[3330,3331],[3390,3392],[3398,3400],[3402,3404],3415,[3458,3459],[3535,3537],[3544,3551],[3570,3571],[3902,3903],3967,[4139,4140],4145,4152,[4155,4156],[4182,4183],[4194,4196],[4199,4205],[4227,4228],[4231,4236],4239,[4250,4252],6070,[6078,6085],[6087,6088],[6435,6438],[6441,6443],[6448,6449],[6451,6456],[6681,6682],6741,6743,6753,[6755,6756],[6765,6770],6916,6965,6971,[6973,6977],[6979,6980],7042,7073,[7078,7079],7082,7143,[7146,7148],7150,[7154,7155],[7204,7211],[7220,7221],7393,[7410,7411],7415,[12334,12335],[43043,43044],43047,[43136,43137],[43188,43203],[43346,43347],43395,[43444,43445],[43450,43451],[43453,43456],[43567,43568],[43571,43572],43597,43643,43645,43755,[43758,43759],43765,[44003,44004],[44006,44007],[44009,44010],44012,69632,69634,69762,[69808,69810],[69815,69816],69932,70018,[70067,70069],[70079,70080],[70188,70190],[70194,70195],70197,[70368,70370],[70402,70403],[70462,70463],[70465,70468],[70471,70472],[70475,70477],70487,[70498,70499],[70709,70711],[70720,70721],70725,[70832,70834],70841,[70843,70846],70849,[71087,71089],[71096,71099],71102,[71216,71218],[71227,71228],71230,71340,[71342,71343],71350,[71456,71457],71462,[72199,72200],72249,[72279,72280],72343,72751,72766,72873,72881,72884,[94033,94078],[119141,119142],[119149,119154]],t.unicodeMcSurrogate={55300:[56320,56322,56450,[56496,56498],[56503,56504],56620,[56645,56646],56706,[56755,56757],[56767,56768],56782,[56876,56878],[56882,56883],56885,[57056,57058],[57090,57091],[57150,57151],[57153,57156],[57159,57160],[57163,57165],57175,[57186,57187]],55301:[[56373,56375],[56384,56385],56389,[56496,56498],56505,[56507,56510],56513,[56751,56753],[56760,56763],56766,[56880,56882],[56891,56892],56894,57004,[57006,57007],57014,[57120,57121],57126],55302:[[56364,56366],56376,[56624,56629],[56631,56632],56637,56640,56642,[56785,56787],[56796,56799],56804,56889,[56919,56920],56983],55303:[56367,56382,56489,56497,56500,[56714,56718],[56723,56724],56726,[57077,57078]],55323:[[57169,57223],[57328,57329]],55348:[[56677,56678],[56685,56690]]},t.unicodeNd=[[48,57],[1632,1641],[1776,1785],[1984,1993],[2406,2415],[2534,2543],[2662,2671],[2790,2799],[2918,2927],[3046,3055],[3174,3183],[3302,3311],[3430,3439],[3558,3567],[3664,3673],[3792,3801],[3872,3881],[4160,4169],[4240,4249],[6112,6121],[6160,6169],[6470,6479],[6608,6617],[6784,6793],[6800,6809],[6992,7001],[7088,7097],[7232,7241],[7248,7257],[42528,42537],[43216,43225],[43264,43273],[43472,43481],[43504,43513],[43600,43609],[44016,44025],[65296,65305],[66720,66729],[69734,69743],[69872,69881],[69942,69951],[70096,70105],[70384,70393],[70736,70745],[70864,70873],[71248,71257],[71360,71369],[71472,71481],[71904,71913],[72784,72793],[73040,73049],[92768,92777],[93008,93017],[120782,120831],[125264,125273]],t.unicodeNdSurrogate={55297:[[56480,56489]],55299:[[56624,56633]],55300:[[56422,56431],[56560,56569],[56630,56639],[56784,56793],[57072,57081]],55301:[[56400,56409],[56528,56537],[56912,56921],[57024,57033],[57136,57145]],55302:[[56544,56553],56656],55303:[[56400,56409],[56656,56665],[56736,56745]],55322:[[56928,56937],[57168,57177]],55349:[[57294,57343]],55352:[[56640,56649],[57072,57081]],55354:[[56656,56665]],55358:[[57328,57337]]},t.unicodePc=[95,[8255,8256],8276,[65075,65076],[65101,65103],65343]},37633:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PyrightFileSystem=void 0;const s=n(26477),i=n(97956),r=n(94647),a=n(67763);class o extends a.ReadOnlyAugmentedFileSystem{constructor(e){super(e),this._rootSearched=new Set,this._partialStubPackagePaths=new Set,this._conflictMap=new Map,this._customUriMap=new Map}mkdirSync(e,t){this._realFS.mkdirSync(e,t)}chdir(e){this._realFS.chdir(e)}writeFileSync(e,t,n){this._realFS.writeFileSync(this._getOriginalPath(e),t,n)}unlinkSync(e){this._realFS.unlinkSync(this._getOriginalPath(e))}createWriteStream(e){return this._realFS.createWriteStream(this._getOriginalPath(e))}copyFileSync(e,t){this._realFS.copyFileSync(this._getOriginalPath(e),this._getOriginalPath(t))}getUri(e){const t=this._customUriMap.get(this.getMappedFilePath(e));return t?t.uri:this._realFS.getUri(e)}hasUriMapEntry(e,t){const n=this._customUriMap.get(t);return!(!n||n.uri!==e)}addUriMap(e,t){const n=this._customUriMap.get(t);return n?n.uri===e&&(n.closed=!1,!0):(this._customUriMap.set(t,{uri:e,closed:!1,hasPendingRequest:!1}),!0)}removeUriMap(e,t){const n=this._customUriMap.get(t);return!(!n||n.uri!==e)&&(n.hasPendingRequest?(n.closed=!0,!0):(this._customUriMap.delete(t),!0))}pendingRequest(e,t){const n=this._customUriMap.get(e);n&&(t||!n.closed?n.hasPendingRequest=t:this._customUriMap.delete(e))}isPartialStubPackagesScanned(e){var t;return this.isPathScanned(null!==(t=e.root)&&void 0!==t?t:"")}isPathScanned(e){return this._rootSearched.has(e)}processPartialStubPackages(e,t){var n;for(const a of e){if(this._rootSearched.add(a),!this._realFS.existsSync(a)||!(0,r.isDirectory)(this._realFS,a))continue;let e=[];try{e=this._realFS.readdirEntriesSync(a)}catch{}for(const o of e){const e=(0,r.combinePaths)(a,o.name);if(!(o.isSymbolicLink()?!!(null===(n=(0,r.tryStat)(this._realFS,e))||void 0===n?void 0:n.isDirectory()):o.isDirectory())||!o.name.endsWith(i.stubsSuffix))continue;const l=(0,s.getPyTypedInfo)(this._realFS,e);if(!l||!l.isPartiallyTyped)continue;let c;this._partialStubPackagePaths.add(e);const p=o.name.substr(0,o.name.length-i.stubsSuffix.length);for(const n of t){const t=(0,r.combinePaths)(n,p);try{const n=(0,r.tryStat)(this._realFS,t);if(!(null==n?void 0:n.isDirectory()))continue;const i=(0,s.getPyTypedInfo)(this._realFS,t);if(i&&!i.isPartiallyTyped)continue;c=null!=c?c:this._getRelativePathPartialStubs(e);for(const n of c){const s=(0,r.combinePaths)(e,n),i=(0,r.combinePaths)(t,n);if(this.existsSync(i)){const e=(0,r.changeAnyExtension)(i,"py"),t=(0,r.changeAnyExtension)((0,r.combinePaths)(this.tmpdir(),"conflictFiles",p,n),"py");this._conflictMap.has(i)||this.existsSync(e)||this.existsSync(t)||(this._recordMovedEntry(t,s,!1),this._conflictMap.set(i,t))}else this._recordMovedEntry(i,s)}}catch{}}}}}clearPartialStubs(){super._clear(),this._rootSearched.clear(),this._partialStubPackagePaths.clear(),this._conflictMap.clear()}getConflictedFile(e){return this._conflictMap.get(e)}_getRelativePathPartialStubs(e){const t=[],n=(0,r.ensureTrailingDirectorySeparator)(e).length,s=e=>{for(const i of this._realFS.readdirEntriesSync(e)){const a=(0,r.combinePaths)(e,i.name);let o=i.isDirectory(),l=i.isFile();if(i.isSymbolicLink()){const e=(0,r.tryStat)(this._realFS,a);e&&(o=e.isDirectory(),l=e.isFile())}if(o&&s(a),l&&i.name.endsWith(".pyi")){const e=a.substring(n);e&&t.push(e)}}};return s(e),t}_isMovedEntry(e){return this._partialStubPackagePaths.has(e)||super._isMovedEntry(e)}}t.PyrightFileSystem=o},67763:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ReadOnlyAugmentedFileSystem=void 0;const s=n(9133),i=n(6021),r=n(94647);t.ReadOnlyAugmentedFileSystem=class{constructor(e){this._realFS=e,this._entryMap=new Map,this._reverseEntryMap=new Map,this._folderMap=new Map}existsSync(e){return!this._isMovedEntry(e)&&this._realFS.existsSync(this._getOriginalPath(e))}mkdirSync(e,t){throw new Error("Operation is not allowed.")}chdir(e){throw new Error("Operation is not allowed.")}readdirEntriesSync(e){const t=(0,r.ensureTrailingDirectorySeparator)(e),n=[],s=this._folderMap.get(t);return s&&!this._realFS.existsSync(e)||n.push(...this._realFS.readdirEntriesSync(e).filter((t=>!this._isMovedEntry((0,r.combinePaths)(e,t.name))))),s?n.concat(s.map((e=>new i.VirtualDirent(e.name,e.isFile)))):n}readdirSync(e){return this.readdirEntriesSync(e).map((e=>e.name))}readFileSync(e,t){return this._realFS.readFileSync(this._getOriginalPath(e),t)}writeFileSync(e,t,n){throw new Error("Operation is not allowed.")}statSync(e){return this._realFS.statSync(this._getOriginalPath(e))}unlinkSync(e){throw new Error("Operation is not allowed.")}realpathSync(e){return this._entryMap.has(e)?e:this._realFS.realpathSync(e)}getModulePath(){return this._realFS.getModulePath()}createFileSystemWatcher(e,t){return this._realFS.createFileSystemWatcher(e,t)}createReadStream(e){return this._realFS.createReadStream(this._getOriginalPath(e))}createWriteStream(e){throw new Error("Operation is not allowed.")}copyFileSync(e,t){throw new Error("Operation is not allowed.")}readFile(e){return this._realFS.readFile(this._getOriginalPath(e))}readFileText(e,t){return this._realFS.readFileText(this._getOriginalPath(e),t)}tmpdir(){return this._realFS.tmpdir()}tmpfile(e){return this._realFS.tmpfile(e)}realCasePath(e){return this._realFS.realCasePath(e)}getUri(e){return this._realFS.getUri(e)}isMappedFilePath(e){return this._entryMap.has(e)||this._realFS.isMappedFilePath(e)}getOriginalFilePath(e){return this._realFS.getOriginalFilePath(this._getOriginalPath(e))}getMappedFilePath(e){var t;const n=this._realFS.getMappedFilePath(e);return null!==(t=this._reverseEntryMap.get(n))&&void 0!==t?t:n}isInZipOrEgg(e){return this._realFS.isInZipOrEgg(e)}_recordMovedEntry(e,t,n=!0,i=!0){this._entryMap.set(e,t),n&&this._reverseEntryMap.set(t,e);const a=(0,r.ensureTrailingDirectorySeparator)((0,r.getDirectoryPath)(e)),o=(0,s.getOrAdd)(this._folderMap,a,(()=>[])),l=(0,r.getFileName)(e);o.some((e=>e.name===l))||o.push({name:l,isFile:i})}_getOriginalPath(e){var t;return null!==(t=this._entryMap.get(e))&&void 0!==t?t:e}_isMovedEntry(e){return this._reverseEntryMap.has(e)}_clear(){this._entryMap.clear(),this._reverseEntryMap.clear(),this._folderMap.clear()}}},64553:(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WorkspaceMap=void 0;const s=n(10219);class i extends Map{constructor(){super(...arguments),this._defaultWorkspacePath="<default>"}getNonDefaultWorkspaces(){const e=[];return this.forEach((t=>{t.rootPath&&e.push(t)})),e}getWorkspaceForFile(e,t){let n,i;if(this.forEach((e=>{e.rootPath&&t.startsWith(e.rootPath)&&(void 0===n||e.rootPath.startsWith(n))&&(n=e.rootPath,i=e)})),void 0===i){let t=this.get(this._defaultWorkspacePath);if(!t){const n=[...this.keys()];if(1===n.length)return this.get(n[0]);t={workspaceName:"",rootPath:"",rootUri:"",serviceInstance:e.createAnalyzerService(this._defaultWorkspacePath),disableLanguageServices:!1,disableOrganizeImports:!1,isInitialized:(0,s.createDeferred)(),searchPathsToWatch:[]},this.set(this._defaultWorkspacePath,t),e.updateSettingsForWorkspace(t).ignoreErrors()}return t}return i}}t.WorkspaceMap=i},51527:e=>{e.exports={}},5213:e=>{e.exports=JSON.parse('{"Diagnostic":{"annotatedParamCountMismatch":"Parameter annotation count mismatch: expected {expected} but received {received}","annotatedTypeArgMissing":"Expected one type argument and one or more annotations for \\"Annotated\\"","annotationFormatString":"Type annotations cannot use format string literals (f-strings)","annotationNotSupported":"Type annotation not supported for this type of expression","annotationSpansStrings":"Type annotations cannot span multiple string literals","annotationStringEscape":"Type annotations cannot contain escape characters","argAssignment":"Argument of type \\"{argType}\\" cannot be assigned to parameter of type \\"{paramType}\\"","argAssignmentFunction":"Argument of type \\"{argType}\\" cannot be assigned to parameter of type \\"{paramType}\\" in function \\"{functionName}\\"","argAssignmentParam":"Argument of type \\"{argType}\\" cannot be assigned to parameter \\"{paramName}\\" of type \\"{paramType}\\"","argAssignmentParamFunction":"Argument of type \\"{argType}\\" cannot be assigned to parameter \\"{paramName}\\" of type \\"{paramType}\\" in function \\"{functionName}\\"","argMissingForParam":"Argument missing for parameter {name}","argMissingForParams":"Arguments missing for parameters {names}","argMorePositionalExpectedCount":"Expected {expected} more positional arguments","argMorePositionalExpectedOne":"Expected 1 more positional argument","argPositional":"Expected positional argument","argPositionalExpectedCount":"Expected {expected} positional arguments","argPositionalExpectedOne":"Expected 1 positional argument","argTypePartiallyUnknown":"Argument type is partially unknown","argTypeUnknown":"Argument type is unknown","assertAlwaysTrue":"Assert expression always evaluates to true","assertTypeArgs":"\\"assert_type\\" expects two positional arguments","assertTypeTypeMismatch":"\\"assert_type\\" mismatch: expected \\"{expected}\\" but received \\"{received}\\"","assignmentExprContext":"Assignment expression must be within module, function or lambda","assignmentExprComprehension":"Assignment expression target \\"{name}\\" cannot use same name as comprehension for target","assignmentInProtocol":"Instance or class variables within a Protocol class must be explicitly declared within the class body","assignmentExprInSubscript":"Assignment expressions within a subscript are supported only in Python 3.10 and newer","assignmentTargetExpr":"Expression cannot be assignment target","asyncNotInAsyncFunction":"Use of \\"async\\" not allowed outside of async function","awaitIllegal":"Use of \\"await\\" requires Python 3.5 or newer","awaitNotInAsync":"\\"await\\" allowed only within async function","backticksIllegal":"Expressions surrounded by backticks are not supported in Python 3.x; use repr instead","baseClassCircular":"Class cannot derive from itself","baseClassFinal":"Base class \\"{type}\\" is marked final and cannot be subclassed","baseClassInvalid":"Argument to class must be a base class","baseClassMethodTypeIncompatible":"Base classes for class \\"{classType}\\" define method \\"{name}\\" in incompatible way","baseClassVariableTypeIncompatible":"Base classes for class \\"{classType}\\" define variable \\"{name}\\" in incompatible way","baseClassUnknown":"Base class type is unknown, obscuring type of derived class","bindTypeMismatch":"Could not bind method \\"{methodName}\\" because \\"{type}\\" is not assignable to parameter \\"{paramName}\\"","breakOutsideLoop":"\\"break\\" can be used only within a loop","callableExtraArgs":"Expected only two type arguments to \\"Callable\\"","callableFirstArg":"Expected parameter type list or \\"...\\"","callableSecondArg":"Expected return type as second type argument for \\"Callable\\"","casePatternIsIrrefutable":"Irrefutable pattern is allowed only for the last case statement","classAlreadySpecialized":"Type \\"{type}\\" is already specialized","classDecoratorTypeUnknown":"Untyped class decorator obscures type of class; ignoring decorator","classDefinitionCycle":"Class definition for \\"{name}\\" depends on itself","classGetItemClsParam":"__class_getitem__ override should take a \\"cls\\" parameter","classMethodClsParam":"Class methods should take a \\"cls\\" parameter","classNotRuntimeSubscriptable":"Subscript for class \\"{name}\\" will generate runtime exception; enclose type annotation in quotes","classPatternBuiltInArgCount":"Class pattern accepts at most 1 positional sub-pattern","classPatternBuiltInArgPositional":"Class pattern accepts only positional sub-pattern","classPatternTypeAlias":"\\"{type}\\" cannot be used in a class pattern because it is a specialized type alias","classVarNotAllowed":"\\"ClassVar\\" is not allowed in this context","classVarFirstArgMissing":"Expected a type argument after \\"ClassVar\\"","classVarOverridesInstanceVar":"Class variable \\"{name}\\" overrides instance variable of same name in class \\"{className}\\"","classVarTooManyArgs":"Expected only one type argument after \\"ClassVar\\"","classVarWithTypeVar":"\\"ClassVar\\" type cannot include type variables","clsSelfParamTypeMismatch":"Type of parameter \\"{name}\\" must be a supertype of its class \\"{classType}\\"","codeTooComplexToAnalyze":"Code is too complex to analyze; reduce complexity by refactoring into subroutines or reducing conditional code paths","comparisonAlwaysFalse":"Condition will always evaluate to False since the types \\"{leftType}\\" and \\"{rightType}\\" have no overlap","comparisonAlwaysTrue":"Condition will always evaluate to True since the types \\"{leftType}\\" and \\"{rightType}\\" have no overlap","comprehensionInDict":"Comprehension cannot be used with other dictionary entries","comprehensionInSet":"Comprehension cannot be used with other set entries","concatenateParamSpecMissing":"Last type argument for \\"Concatenate\\" must be a ParamSpec","concatenateTypeArgsMissing":"\\"Concatenate\\" requires at least two type arguments","constantRedefinition":"\\"{name}\\" is constant (because it is uppercase) and cannot be redefined","constructorParametersMismatch":"Mismatch between signature of __new__ and __init__ in class \\"{classType}\\"","continueInFinally":"\\"continue\\" cannot be used within a finally clause","continueOutsideLoop":"\\"continue\\" can be used only within a loop","constructorNoArgs":"Expected no arguments to \\"{type}\\" constructor","dataClassBaseClassNotFrozen":"A frozen class cannot inherit from a class that is not frozen","dataClassFieldWithDefault":"Fields without default values cannot appear after fields with default values","dataClassPostInitParamCount":"Dataclass __post_init__ incorrect parameter count; number of InitVar fields is {expected}","dataClassPostInitType":"Dataclass __post_init__ method parameter type mismatch for field \\"{fieldName}\\"","dataClassSlotsOverwrite":"__slots__ is already defined in class","dataClassTransformExpectedBoolLiteral":"Expected expression that statically evaluates to True or False","dataClassTransformFieldDescriptor":"Expected tuple of classes or functions but received type \\"{type}\\"","dataClassTransformPositionalParam":"All arguments to \\"dataclass_transform\\" must be keyword arguments","dataClassTransformUnknownArgument":"Argument \\"{name}\\" is not supported by dataclass_transform","declaredReturnTypePartiallyUnknown":"Declared return type, \\"{returnType}\\", is partially unknown","declaredReturnTypeUnknown":"Declared return type is unknown","defaultValueContainsCall":"Function calls and mutable objects not allowed within parameter default value expression","defaultValueNotAllowed":"Parameter with \\"*\\" or \\"**\\" cannot have default value","defaultValueNotEllipsis":"Default values in stub files should be specified as \\"...\\"","deprecatedType":"This type is deprecated as of Python {version}; use \\"{replacement}\\" instead","delTargetExpr":"Expression cannot be deleted","dictExpandIllegalInComprehension":"Dictionary expansion not allowed in comprehension","dictInAnnotation":"Dictionary expression not allowed in type annotation","dictKeyValuePairs":"Dictionary entries must contain key/value pairs","dictUnpackIsNotMapping":"Expected mapping for dictionary unpack operator","dunderAllSymbolNotPresent":"\\"{name}\\" is specified in __all__ but is not present in module","duplicateArgsParam":"Only one \\"*\\" parameter allowed","duplicateBaseClass":"Duplicate base class not allowed","duplicateCatchAll":"Only one catch-all except clause allowed","duplicateEnumMember":"Enum member \\"{name}\\" is already declared","duplicateImport":"\\"{importName}\\" is imported more than once","duplicateKwargsParam":"Only one \\"**\\" parameter allowed","duplicateKeywordOnly":"Only one \\"*\\" separator allowed","duplicateParam":"Duplicate parameter \\"{name}\\"","duplicateCapturePatternTarget":"Capture target \\"{name}\\" cannot appear more than once within the same pattern","duplicateStarPattern":"Only one \\"*\\" pattern allowed in a pattern sequence","duplicateStarStarPattern":"Only one \\"**\\" entry allowed","duplicatePositionOnly":"Only one \\"/\\" parameter allowed","duplicateUnpack":"Only one unpack operation allowed in list","ellipsisContext":"\\"...\\" not allowed in this context","ellipsisSecondArg":"\\"...\\" allowed only as the second of two arguments","enumClassOverride":"Enum class \\"{name}\\" is final and cannot be subclassed","exceptionGroupIncompatible":"Exception group syntax (\\"except*\\") requires Python 3.11 or newer","exceptionTypeIncorrect":"\\"{type}\\" does not derive from BaseException","exceptionTypeNotClass":"\\"{type}\\" is not valid exception class","exceptionTypeNotInstantiable":"Constructor for exception type \\"{type}\\" requires one or more arguments","expectedAfterDecorator":"Expected function or class declaration after decorator","expectedArrow":"Expected \\"->\\" followed by return type annotation","expectedAsAfterException":"Expected \\"as\\" after exception type","expectedAssignRightHandExpr":"Expected expression to the right of \\"=\\"","expectedBinaryRightHandExpr":"Expected expression to the right of operator","expectedBoolLiteral":"Expected True or False","expectedCase":"Expected \\"case\\" statement","expectedClassName":"Expected class name","expectedCloseBrace":"\\"{\\" was not closed","expectedCloseBracket":"\\"[\\" was not closed","expectedCloseParen":"\\"(\\" was not closed","expectedColon":"Expected \\":\\"","expectedComplexNumberLiteral":"Expected complex number literal for pattern matching","expectedDecoratorExpr":"Expression form not supported for decorator prior to Python 3.9","expectedDecoratorName":"Expected decorator name","expectedDecoratorNewline":"Expected new line at end of decorator","expectedDelExpr":"Expected expression after \\"del\\"","expectedElse":"Expected \\"else\\"","expectedExceptionClass":"Invalid exception class or object","expectedExceptionObj":"Expected exception object, exception class or None","expectedExpr":"Expected expression","expectedIdentifier":"Expected identifier","expectedImport":"Expected \\"import\\"","expectedImportAlias":"Expected symbol after \\"as\\"","expectedImportSymbols":"Expected one or more symbol names after import","expectedIndentedBlock":"Expected indented block","expectedInExpr":"Expected expression after \\"in\\"","expectedIn":"Expected \\"in\\"","expectedFunctionAfterAsync":"Expected function definition after \\"async\\"","expectedFunctionName":"Expected function name after \\"def\\"","expectedMemberName":"Expected member name after \\".\\"","expectedModuleName":"Expected module name","expectedNameAfterAs":"Expected symbol name after \\"as\\"","expectedNamedParameter":"Keyword parameter must follow \\"*\\"","expectedNewline":"Expected newline","expectedNewlineOrSemicolon":"Statements must be separated by newlines or semicolons","expectedOpenParen":"Expected \\"(\\"","expectedParamName":"Expected parameter name","expectedPatternExpr":"Expected pattern expression","expectedPatternSubjectExpr":"Expected pattern subject expression","expectedPatternValue":"Expected pattern value expression of the form \\"a.b\\"","expectedReturnExpr":"Expected expression after \\"return\\"","expectedSliceIndex":"Expected index or slice expression","expectedTypeNotString":"Expected type but received a string literal","expectedYieldExpr":"Expected expression in yield statement","finalClassIsAbstract":"Class \\"{type}\\" is marked final and must implement all abstract methods","finalContext":"\\"Final\\" not allowed in this context","finalMethodOverride":"Method \\"{name}\\" cannot override final method defined in class \\"{className}\\"","finalReassigned":"\\"{name}\\" is declared as Final and cannot be reassigned","finalRedeclaration":"\\"{name}\\" was previously declared as Final","finalRedeclarationBySubclass":"\\"{name}\\" cannot be redeclared because parent class \\"{className}\\" declares it as Final","finalTooManyArgs":"Expected a single type argument after \\"Final\\"","finalUnassigned":"\\"{name}\\" is declared Final, but value is not assigned","formatStringBrace":"Single close brace not allowed within f-string literal; use double close brace","formatStringBytes":"Format string literals (f-strings) cannot be binary","formatStringEscape":"Escape sequence (backslash) not allowed in expression portion of f-string","formatStringInPattern":"Format string not allowed in pattern","formatStringUnicode":"Format string literals (f-strings) cannot be unicode","formatStringIllegal":"Format string literals (f-strings) require Python 3.6 or newer","formatStringUnterminated":"Unterminated expression in f-string; missing close brace","functionDecoratorTypeUnknown":"Untyped function decorator obscures type of function; ignoring decorator","functionInConditionalExpression":"Conditional expression references function which always evaluates to True","generatorAsyncReturnType":"Return type of async generator function must be \\"AsyncGenerator\\" or \\"AsyncIterable\\"","generatorNotParenthesized":"Generator expressions must be parenthesized if not sole argument","generatorSyncReturnType":"Return type of generator function must be \\"Generator\\" or \\"Iterable\\"","genericClassAssigned":"Generic class type cannot be assigned","genericClassDeleted":"Generic class type cannot be deleted","genericNotAllowed":"\\"Generic\\" is not valid in this context","genericTypeAliasBoundTypeVar":"Generic type alias within class cannot use bound type variables {names}","genericTypeArgMissing":"\\"Generic\\" requires at least one type argument","genericTypeArgTypeVar":"Type argument for \\"Generic\\" must be a type variable","genericTypeArgUnique":"Type arguments for \\"Generic\\" must be unique","globalReassignment":"\\"{name}\\" is assigned before global declaration","globalRedefinition":"\\"{name}\\" was already declared global","implicitStringConcat":"Implicit string concatenation not allowed","importCycleDetected":"Cycle detected in import chain","importDepthExceeded":"Import chain depth exceeded {depth}","importResolveFailure":"Import \\"{importName}\\" could not be resolved","importSourceResolveFailure":"Import \\"{importName}\\" could not be resolved from source","importSymbolUnknown":"\\"{name}\\" is unknown import symbol","incompatibleMethodOverride":"Method \\"{name}\\" overrides class \\"{className}\\" in an incompatible manner","inconsistentIndent":"Unindent amount does not match previous indent","initMustReturnNone":"Return type of \\"__init__\\" must be None","inconsistentTabs":"Inconsistent use of tabs and spaces in indentation","initSubclassClsParam":"__init_subclass__ override should take a \\"cls\\" parameter","instanceMethodSelfParam":"Instance methods should take a \\"self\\" parameter","instanceVarOverridesClassVar":"Instance variable \\"{name}\\" overrides class variable of same name in class \\"{className}\\"","instantiateAbstract":"Cannot instantiate abstract class \\"{type}\\"","instantiateProtocol":"Cannot instantiate protocol class \\"{type}\\"","internalBindError":"An internal error occurred while binding file \\"{file}\\": {message}","internalParseError":"An internal error occurred while parsing file \\"{file}\\": {message}","internalTypeCheckingError":"An internal error occurred while type checking file \\"{file}\\": {message}","invalidIdentifierChar":"Invalid character in identifier","invalidStubStatement":"Statement is meaningless within a type stub file","invalidTokenChars":"Invalid character \\"{text}\\" in token","isInstanceInvalidType":"Second argument to \\"isinstance\\" must be a class or tuple of classes","isSubclassInvalidType":"Second argument to \\"issubclass\\" must be a class or tuple of classes","keyValueInSet":"Key/value pairs are not allowed within a set","keywordArgInTypeArgument":"Keyword arguments cannot be used in type argument lists","keywordOnlyAfterArgs":"Keyword-only argument separator not allowed after \\"*\\" parameter","keywordSubscriptIllegal":"Keyword arguments within subscripts are not supported","lambdaReturnTypeUnknown":"Return type of lambda is unknown","lambdaReturnTypePartiallyUnknown":"Return type of lambda, \\"{returnType}\\", is partially unknown","listAssignmentMismatch":"Expression with type \\"{type}\\" cannot be assigned to target list","listInAnnotation":"List expression not allowed in type annotation","literalUnsupportedType":"Type arguments for \\"Literal\\" must be None, a literal value (int, bool, str, or bytes), or an enum value","literalEmptyArgs":"Expected one or more type arguments after \\"Literal\\"","literalNotCallable":"Literal type cannot be instantiated","matchIncompatible":"Match statements require Python 3.10 or newer","matchIsNotExhaustive":"Cases within match statement do not exhaustively handle all values","maxParseDepthExceeded":"Maximum parse depth exceeded; break expression into smaller sub-expressions","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","metaclassIsGeneric":"Metaclass cannot be generic","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","missingProtocolMembers":"Class derives from one or more protocol classes but does not implement all required members","missingSuperCall":"Method \\"{methodName}\\" does not call the method of the same name in parent class","moduleAsType":"Module cannot be used as a type","moduleNotCallable":"Module is not callable","moduleUnknownMember":"\\"{name}\\" is not a known member of module","namedExceptAfterCatchAll":"A named except clause cannot appear after catch-all except clause","namedParamAfterParamSpecArgs":"Keyword parameter \\"{name}\\" cannot appear in signature after ParamSpec args parameter","namedTupleEmptyName":"Names within a named tuple cannot be empty","namedTupleMultipleInheritance":"Multiple inheritance with NamedTuple is not supported","namedTupleFirstArg":"Expected named tuple class name as first argument","namedTupleNameType":"Expected two-entry tuple specifying entry name and type","namedTupleNameUnique":"Names within a named tuple must be unique","namedTupleNoTypes":"\\"namedtuple\\" provides no types for tuple entries; use \\"NamedTuple\\" instead","namedTupleSecondArg":"Expected named tuple entry list as second argument","newClsParam":"__new__ override should take a \\"cls\\" parameter","newTypeLiteral":"NewType cannot be used with Literal type","newTypeNotAClass":"Expected class as second argument to NewType","newTypeProtocolClass":"NewType cannot be used with protocol class","nonDefaultAfterDefault":"Non-default argument follows default argument","noneNotCallable":"Object of type \\"None\\" cannot be called","noneNotIterable":"Object of type \\"None\\" cannot be used as iterable value","noneOperator":"Operator \\"{operator}\\" not supported for \\"None\\"","noneNotSubscriptable":"Object of type \\"None\\" is not subscriptable","noneNotUsableWith":"Object of type \\"None\\" cannot be used with \\"with\\"","noneUnknownMember":"\\"{name}\\" is not a known member of \\"None\\"","nonLocalNoBinding":"No binding for nonlocal \\"{name}\\" found","nonLocalReassignment":"\\"{name}\\" is assigned before nonlocal declaration","nonLocalRedefinition":"\\"{name}\\" was already declared nonlocal","nonLocalInModule":"Nonlocal declaration not allowed at module level","noOverload":"No overloads for \\"{name}\\" match the provided arguments","noReturnContainsReturn":"Function with declared return type \\"NoReturn\\" cannot include a return statement","noReturnContainsYield":"Function with declared return type \\"NoReturn\\" cannot include a yield statement","noReturnReturnsNone":"Function with declared type of \\"NoReturn\\" cannot return \\"None\\"","notRequiredArgCount":"Expected a single type argument after \\"NotRequired\\"","notRequiredNotInTypedDict":"\\"NotRequired\\" is not allowed in this context","objectNotCallable":"Object of type \\"{type}\\" is not callable","obscuredClassDeclaration":"Class declaration \\"{name}\\" is obscured by a declaration of the same name","obscuredFunctionDeclaration":"Function declaration \\"{name}\\" is obscured by a declaration of the same name","obscuredMethodDeclaration":"Method declaration \\"{name}\\" is obscured by a declaration of the same name","obscuredParameterDeclaration":"Parameter declaration \\"{name}\\" is obscured by a declaration of the same name","obscuredVariableDeclaration":"Declaration \\"{name}\\" is obscured by a declaration of the same name","operatorLessOrGreaterDeprecated":"Operator \\"<>\\" is not supported in Python 3; use \\"!=\\" instead","optionalExtraArgs":"Expected one type argument after \\"Optional\\"","orPatternIrrefutable":"Irrefutable pattern allowed only as the last subpattern in an \\"or\\" pattern","orPatternMissingName":"All subpatterns within an \\"or\\" pattern must target the same names","overlappingOverload":"Overload {obscured} for \\"{name}\\" will never be used because its parameters overlap overload {obscuredBy}","overloadAbstractMismatch":"Overloaded methods must all be abstract or not","overloadImplementationMismatch":"Overloaded implementation is not consistent with signature of overload {index}","overloadReturnTypeMismatch":"Overload {prevIndex} for \\"{name}\\" overlaps overload {newIndex} and returns an incompatible type","overloadWithImplementation":"\\"{name}\\" is marked as overload, but it includes an implementation","overloadWithoutImplementation":"\\"{name}\\" is marked as overload, but no implementation is provided","paramAfterKwargsParam":"Parameter cannot follow \\"**\\" parameter","paramAlreadyAssigned":"Parameter \\"{name}\\" is already assigned","paramAnnotationMissing":"Type annotation is missing for parameter \\"{name}\\"","paramNameMissing":"No parameter named \\"{name}\\"","paramSpecArgsKwargsUsage":"\\"args\\" and \\"kwargs\\" members of ParamSpec must both appear within a function signature","paramSpecArgsMissing":"Arguments for ParamSpec \\"{type}\\" are missing","paramSpecArgsUsage":"\\"args\\" member of ParamSpec is valid only when used with *args parameter","paramSpecAssignedName":"ParamSpec must be assigned to a variable named \\"{name}\\"","paramSpecContext":"ParamSpec not allowed in this context","paramSpecFirstArg":"Expected name of ParamSpec as first argument","paramSpecKwargsUsage":"\\"kwargs\\" member of ParamSpec is valid only when used with **kwargs parameter","paramSpecNotBound":"Param spec \\"{type}\\" has no bound value","paramSpecNotUsedByOuterScope":"ParamSpec \\"{name}\\" has no meaning in this context","paramSpecUnknownArg":"ParamSpec does not support more than one argument","paramSpecUnknownMember":"\\"{name}\\" is not a known member of ParamSpec","paramSpecUnknownParam":"\\"{name}\\" is unknown parameter to ParamSpec","paramAssignmentMismatch":"Expression of type \\"{sourceType}\\" cannot be assigned to parameter of type \\"{paramType}\\"","paramTypeCovariant":"Covariant type variable cannot be used in parameter type","paramTypeUnknown":"Type of parameter \\"{paramName}\\" is unknown","paramTypePartiallyUnknown":"Type of parameter \\"{paramName}\\" is partially unknown","parenthesizedContextManagerIllegal":"Parentheses within \\"with\\" statement requires Python 3.9 or newer","positionArgAfterNamedArg":"Positional argument cannot appear after keyword arguments","privateImportFromPyTypedModule":"\\"{name}\\" is not exported from module \\"{module}\\"","positionOnlyAfterArgs":"Position-only argument separator not allowed after \\"*\\" parameter","positionOnlyAfterKeywordOnly":"\\"/\\" parameter must appear before \\"*\\" parameter","positionOnlyIncompatible":"Position-only argument separator requires Python 3.8 or newer","positionOnlyFirstParam":"Position-only argument separator not allowed as first parameter","privateUsedOutsideOfClass":"\\"{name}\\" is private and used outside of the class in which it is declared","privateUsedOutsideOfModule":"\\"{name}\\" is private and used outside of the module in which it is declared","propertyOverridden":"\\"{name}\\" incorrectly overrides property of same name in class \\"{className}\\"","propertyStaticMethod":"Static methods not allowed for property getter, setter or deleter","protectedUsedOutsideOfClass":"\\"{name}\\" is protected and used outside of the class in which it is declared","protocolBaseClass":"Protocol class \\"{classType}\\" cannot derive from non-protocol class \\"{baseType}\\"","protocolIllegal":"Use of \\"Protocol\\" requires Python 3.7 or newer","protocolMemberNotClassVar":"Protocol class \\"{className}\\" does not define \\"{memberName}\\" as a ClassVar","protocolNotAllowedInTypeArgument":"\\"Protocol\\" cannot be used as a type argument","protocolVarianceContravariant":"Type variable \\"{variable}\\" used in generic protocol \\"{class}\\" should be contravariant","protocolVarianceCovariant":"Type variable \\"{variable}\\" used in generic protocol \\"{class}\\" should be covariant","protocolVarianceInvariant":"Type variable \\"{variable}\\" used in generic protocol \\"{class}\\" should be invariant","protocolUsedInCall":"Protocol class cannot be used in \\"{name}\\" call","relativeImportNotAllowed":"Relative imports cannot be used with \\"import .a\\" form; use \\"from . import a\\" instead","recursiveDefinition":"Type of \\"{name}\\" could not be determined because it refers to itself","requiredArgCount":"Expected a single type argument after \\"Required\\"","requiredNotInTypedDict":"\\"Required\\" is not allowed in this context","returnOutsideFunction":"\\"return\\" can be used only within a function","returnMissing":"Function with declared type of \\"{returnType}\\" must return value","returnTypeContravariant":"Contravariant type variable cannot be used in return type","returnTypeMismatch":"Expression of type \\"{exprType}\\" cannot be assigned to return type \\"{returnType}\\"","returnTypeUnknown":"Return type is unknown","returnTypePartiallyUnknown":"Return type, \\"{returnType}\\", is partially unknown","revealLocalsArgs":"Expected no arguments for \\"reveal_locals\\" call","revealLocalsNone":"No locals in this scope","revealTypeArgs":"Expected a single positional argument for \\"reveal_type\\" call","revealTypeExpectedTextArg":"The \\"expected_text\\" argument for function \\"reveal_type\\" must be a str literal value","revealTypeExpectedTextMismatch":"Type text mismatch; expected \\"{expected}\\" but received \\"{received}\\"","revealTypeExpectedTypeMismatch":"Type mismatch; expected \\"{expected}\\" but received \\"{received}\\"","selfTypeContext":"\\"Self\\" is not valid in this context","selfTypeWithTypedSelfOrCls":"\\"Self\\" cannot be used in a function with a `self` or `cls` parameter that has a type annotation other than \\"Self\\"","setterGetterTypeMismatch":"Property setter value type is not assignable to the getter return type","singleOverload":"\\"{name}\\" is marked as overload, but additional overloads are missing","slotsAttributeError":"\\"{name}\\" is not specified in __slots__","slotsClassVarConflict":"\\"{name}\\" conflicts with instance variable declared in __slots__","starPatternInAsPattern":"Star pattern cannot be used with \\"as\\" target","starPatternInOrPattern":"Star pattern cannot be ORed within other patterns","starStarWildcardNotAllowed":"** cannot be used with wildcard \\"_\\"","staticClsSelfParam":"Static methods should not take a \\"self\\" or \\"cls\\" parameter","strictTypeGuardReturnType":"Return type of StrictTypeGuard (\\"{returnType}\\") is not assignable to value parameter type (\\"{type}\\")","stringNonAsciiBytes":"Non-ASCII character not allowed in bytes string literal","stringNotSubscriptable":"String expression cannot be subscripted in type annotation; enclose entire annotation in quotes","stringUnsupportedEscape":"Unsupported escape sequence in string literal","stringUnterminated":"String literal is unterminated","stubFileMissing":"Stub file not found for \\"{importName}\\"","stubUsesGetAttr":"Type stub file is incomplete; \\"__getattr__\\" obscures type errors for module","sublistParamsIncompatible":"Sublist parameters are not supported in Python 3.x","superCallArgCount":"Expected no more than two arguments to \\"super\\" call","superCallFirstArg":"Expected class type as first argument to \\"super\\" call but received \\"{type}\\"","superCallSecondArg":"Second argument to \\"super\\" call must be object or class that derives from \\"{type}\\"","superCallZeroArgForm":"Zero-argument form of \\"super\\" call is valid only within a class","symbolIsUnbound":"\\"{name}\\" is unbound","symbolIsUndefined":"\\"{name}\\" is not defined","symbolIsPossiblyUnbound":"\\"{name}\\" is possibly unbound","symbolOverridden":"\\"{name}\\" overrides symbol of same name in class \\"{className}\\"","totalOrderingMissingMethod":"Class must define one of \\"__lt__\\", \\"__le__\\", \\"__gt__\\", or \\"__ge__\\" to use total_ordering","trailingCommaInFromImport":"Trailing comma not allowed without surrounding parentheses","tryWithoutExcept":"Try statement must have at least one except or finally clause","tupleAssignmentMismatch":"Expression with type \\"{type}\\" cannot be assigned to target tuple","tupleInAnnotation":"Tuple expression not allowed in type annotation","tupleIndexOutOfRange":"Index {index} is out of range for type {type}","typeAliasIsRecursiveDirect":"Type alias \\"{name}\\" cannot use itself in its definition","typeAliasIsRecursiveIndirect":"Type alias \\"{name}\\" cannot refer to itself indirectly in its definition","typeAliasNotInModuleOrClass":"A TypeAlias can be defined only within a module or class scope","typeAliasRedeclared":"\\"{name}\\" is declared as a TypeAlias and can be assigned only once","typeArgListExpected":"Expected ParamSpec, ellipsis, or list of types","typeArgListNotAllowed":"List expression not allowed for this type argument","typeAnnotationCall":"Illegal type annotation: call expression not allowed","typeAnnotationVariable":"Illegal type annotation: variable not allowed unless it is a type alias","typeArgsExpectingNone":"Expected no type arguments for class \\"{name}\\"","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 \\"{name}\\"; expected {expected} but received {received}","typeArgsTooMany":"Too many type arguments provided for \\"{name}\\"; expected {expected} but received {received}","typeAssignmentMismatch":"Expression of type \\"{sourceType}\\" cannot be assigned to declared type \\"{destType}\\"","typeCallNotAllowed":"type() call should not be used in type annotation","typedDictAccess":"Could not access item in TypedDict","typedDictBadVar":"TypedDict classes can contain only type annotations","typedDictBaseClass":"All base classes for \\"TypedDict\\" classes must also be \\"TypedDict\\" classes","typedDictDelete":"Could not delete item in TypedDict","typedDictEmptyName":"Names within a TypedDict cannot be empty","typedDictEntryName":"Expected string literal for dictionary entry name","typedDictEntryUnique":"Names within a dictionary must be unique","typedDictExtraArgs":"Extra TypedDict arguments not supported","typedDictFieldRedefinition":"Type of TypedDict field \\"{name}\\" cannot be redefined","typedDictFirstArg":"Expected TypedDict class name as first argument","typedDictSecondArgDict":"Expected dict or keyword parameter as second parameter","typedDictSecondArgDictEntry":"Expected simple dictionary entry","typedDictSet":"Could not assign item in TypedDict","typedDictTotalParam":"Expected \\"total\\" parameter to have a value of True or False","typeExpectedClass":"Expected class type but received \\"{type}\\"","typeGuardArgCount":"Expected a single type argument after \\"TypeGuard\\"","typeNotAwaitable":"\\"{type}\\" is not awaitable","typeNotCallable":"\\"{expression}\\" has type \\"{type}\\" and is not callable","typeNotIntantiable":"\\"{type}\\" cannot be instantiated","typeNotIterable":"\\"{type}\\" is not iterable","typeNotSpecializable":"Could not specialize type \\"{type}\\"","typeNotSubscriptable":"Object of type \\"{type}\\" is not subscriptable","typeNotUsableWith":"Object of type \\"{type}\\" cannot be used with \\"with\\" because it does not implement {method}","typeNotSupportBinaryOperator":"Operator \\"{operator}\\" not supported for types \\"{leftType}\\" and \\"{rightType}\\"","typeNotSupportBinaryOperatorBidirectional":"Operator \\"{operator}\\" not supported for types \\"{leftType}\\" and \\"{rightType}\\" when expected type is \\"{expectedType}\\"","typeNotSupportUnaryOperator":"Operator \\"{operator}\\" not supported for type \\"{type}\\"","typeNotSupportUnaryOperatorBidirectional":"Operator \\"{operator}\\" not supported for type \\"{type}\\" when expected type is \\"{expectedType}\\"","typePartiallyUnknown":"Type of \\"{name}\\" is partially unknown","typeUnknown":"Type of \\"{name}\\" is unknown","typeVarAssignedName":"TypeVar must be assigned to a variable named \\"{name}\\"","typeVarAssignmentMismatch":"Type \\"{type}\\" cannot be assigned to type variable \\"{name}\\"","typeVarBoundAndConstrained":"TypeVar cannot be both bound and constrained","typeVarFirstArg":"Expected name of TypeVar as first argument","typeVarGeneric":"TypeVar bound type cannot be generic","typeVarNoMember":"TypeVar \\"{type}\\" has no member \\"{name}\\"","typeVarNotSubscriptable":"TypeVar \\"{type}\\" is not subscriptable","typeVarNotUsedByOuterScope":"Type variable \\"{name}\\" has no meaning in this context","typeVarSingleConstraint":"TypeVar cannot have only a single constraint","typeVarsNotInGeneric":"Generic[] must include all type variables","typeVarTupleContext":"TypeVarTuple not allowed in this context","typeVarTupleMustBeUnpacked":"Unpack operator is required for TypeVarTuple value","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","unionTypeArgCount":"Union requires two or more type arguments","uninitializedInstanceVariable":"Instance variable \\"{name}\\" is not initialized in the class body or __init__ method","unnecessaryCast":"Unnecessary \\"cast\\" call; type is already \\"{type}\\"","unnecessaryIsInstanceAlways":"Unnecessary isinstance call; \\"{testType}\\" is always an instance of \\"{classType}\\"","unnecessaryIsSubclassAlways":"Unnecessary issubclass call; \\"{testType}\\" is always a subclass of \\"{classType}\\"","unnecessaryPyrightIgnore":"Unnecessary \\"# pyright: ignore\\" comment","unnecessaryPyrightIgnoreRule":"Unnecessary \\"# pyright: ignore\\" rule: \\"{name}\\"","unnecessaryTypeIgnore":"Unnecessary \\"# type: ignore\\" comment","unpackArgCount":"Expected a single type argument after \\"Unpack\\"","unpackedArgInTypeArgument":"Unpacked arguments cannot be used in type argument lists","unpackedArgWithVariadicParam":"Unpacked argument cannot be used for TupleTypeVar parameter","unpackedDictArgumentNotMapping":"Argument expression after ** must be a mapping with a \\"str\\" key type","unpackedSubscriptIllegal":"Unpack operator in subscript requires Python 3.11 or newer","unpackedTypedDictArgument":"Unable to match unpacked TypedDict argument to parameters","unpackedTypeVarTupleExpected":"Expected unpacked TypeVarTuple; use Unpack[{name1}] or *{name2}","unpackExpectedTypedDict":"Expected TypedDict type argument for Unpack","unpackExpectedTypeVarTuple":"Expected TypeVarTuple or Tuple as type argument for Unpack","unpackIllegalInComprehension":"Unpack operation not allowed in comprehension","unpackInAnnotation":"Unpack operator not allowed in type annotation","unpackInDict":"Unpack operation not allowed in dictionaries","unpackInSet":"Unpack operator not allowed within a set","unpackNotAllowed":"Unpack not allowed in this context","unpackOperatorNotAllowed":"Unpack operation not allowed in this context","unpackTuplesIllegal":"Unpack operation not allowed in tuples prior to Python 3.8","unreachableCode":"Code is unreachable","unreachableExcept":"Except clause is unreachable because exception is already handled","unsupportedDunderAllOperation":"Operation on \\"__all__\\" is not supported, so exported symbol list may be incorrect","unusedCallResult":"Result of call expression is of type \\"{type}\\" and is not used; assign to variable \\"_\\" if this is intentional","unusedCoroutine":"Result of async function call is not used; use \\"await\\" or assign result to variable","unusedExpression":"Expression value is unused","varAnnotationIllegal":"Type annotations for variables requires Python 3.6 or newer; use type comment for compatibility with previous versions","variadicTypeArgsTooMany":"Type argument list can have at most one unpacked TypeVarTuple or Tuple","variadicTypeParamTooManyAlias":"Type alias can have at most one TypeVarTuple type parameter but received multiple ({names})","variadicTypeParamTooManyClass":"Generic class can have at most one TypeVarTuple type parameter but received multiple ({names})","walrusIllegal":"Operator \\":=\\" requires Python 3.8 or newer","walrusNotAllowed":"Operator \\":=\\" not allowed in this context","wildcardInFunction":"Wildcard import not allowed within a class or function","wildcardLibraryImport":"Wildcard import from a library not allowed","yieldFromIllegal":"Use of \\"yield from\\" requires Python 3.3 or newer","yieldFromOutsideAsync":"\\"yield from\\" not allowed in an async function","yieldOutsideFunction":"\\"yield\\" not allowed outside of a function or lambda","yieldTypeMismatch":"Expression of type \\"{exprType}\\" cannot be assigned to yield type \\"{yieldType}\\"","yieldWithinListCompr":"\\"yield\\" not allowed inside a list comprehension","zeroCaseStatementsFound":"Match statement must include at least one case statement","zeroLengthTupleNotAllowed":"Zero-length tuple not allowed in this context"},"DiagnosticAddendum":{"argParam":"Argument corresponds to parameter \\"{paramName}\\"","argParamFunction":"Argument corresponds to parameter \\"{paramName}\\" in function \\"{functionName}\\"","argsParamMissing":"Parameter \\"*{paramName}\\" has no corresponding parameter","argsPositionOnly":"Position-only parameter mismatch; expected {expected} but received {received}","argumentType":"Argument type is \\"{type}\\"","argumentTypes":"Argument types: ({types})","assignToNone":"Type cannot be assigned to type \\"None\\"","asyncHelp":"Did you mean \\"async with\\"?","baseClassProvidesType":"Base class \\"{baseClass}\\" provides type \\"{type}\\"","dataClassFieldLocation":"Field declaration","dataClassFrozen":"\\"{name}\\" is frozen","finalMethod":"Final method","keyNotRequired":"\\"{name}\\" is not a required key in \\"{type}\\", so access may result in runtime exception","keyRequiredDeleted":"\\"{name}\\" is a required key and cannot be deleted","keyUndefined":"\\"{name}\\" is not a defined key in \\"{type}\\"","functionParamDefaultMissing":"Parameter \\"{name}\\" is missing default argument","functionParamName":"Parameter name mismatch: \\"{destName}\\" versus \\"{srcName}\\"","functionReturnTypeMismatch":"Function return type \\"{sourceType}\\" is incompatible with type \\"{destType}\\"","functionTooFewParams":"Function accepts too few positional parameters; expected {expected} but received {received}","functionTooManyParams":"Function accepts too many positional parameters; expected {expected} but received {received}","incompatibleGetter":"Property getter method is incompatible","incompatibleSetter":"Property setter method is incompatible","initMethodLocation":"The __init__ method is defined in class \\"{type}\\"","incompatibleDeleter":"Property deleter method is incompatible","initMethodSignature":"Signature of __init__ is \\"{type}\\"","kwargsParamMissing":"Parameter \\"**{paramName}\\" has no corresponding parameter","listAssignmentMismatch":"Type \\"{type}\\" is incompatible with target list","literalAssignmentMismatch":"\\"{sourceType}\\" cannot be assigned to type \\"{destType}\\"","matchIsNotExhaustiveType":"Unhandled type: \\"{type}\\"","matchIsNotExhaustiveHint":"If exhaustive handling is not intended, add \\"case _: pass\\"","memberSetClassVar":"Member \\"{name}\\" cannot be assigned through a class instance because it is a ClassVar","memberAssignment":"Expression of type \\"{type}\\" cannot be assigned to member \\"{name}\\" of class \\"{classType}\\"","memberIsAbstract":"\\"{type}.{name}\\" is abstract","memberIsAbstractMore":"and {count} more...","memberIsFinalInProtocol":"\\"{name}\\" is marked Final in protocol","memberIsInitVar":"Member \\"{name}\\" is an init-only field","memberIsInvariant":"\\"{name}\\" is invariant because it is mutable","memberIsNotFinalInProtocol":"\\"{name}\\" is not marked Final in protocol","memberTypeMismatch":"\\"{name}\\" is an incompatible type","memberUnknown":"Member \\"{name}\\" is unknown","missingProtocolMember":"Member \\"{name}\\" is declared in protocol class \\"{classType}\\"","missingGetter":"Property getter method is missing","missingSetter":"Property setter method is missing","missingDeleter":"Property deleter method is missing","namedParamMissingInDest":"Keyword parameter \\"{name}\\" is missing in destination","namedParamMissingInSource":"Keyword parameter \\"{name}\\" is missing in source","namedParamTypeMismatch":"Keyword parameter \\"{name}\\" of type \\"{sourceType}\\" cannot be assigned to type \\"{destType}\\"","newMethodLocation":"The __new__ method is defined in class \\"{type}\\"","newMethodSignature":"Signature of __new__ is \\"{type}\\"","noOverloadAssignable":"No overloaded function matches type \\"{type}\\"","orPatternMissingName":"Missing names: {name}","overloadSignature":"Overload signature is defined here","overloadNotAssignable":"One or more overloads of \\"{name}\\" is not assignable","overloadWithImplementation":"The body of a function overload should be \\"...\\"","overriddenMethod":"Overridden method","overriddenSymbol":"Overridden symbol","overrideParamKeywordNoDefault":"Keyword parameter \\"{name}\\" mismatch: base parameter has default argument value, override parameter does not","overrideParamKeywordType":"Keyword parameter \\"{name}\\" type mismatch: base parameter is type \\"{baseType}\\", override parameter is type \\"{overrideType}\\"","overrideParamName":"Parameter {index} name mismatch: base parameter is named \\"{baseName}\\", override parameter is named \\"{overrideName}\\"","overrideParamNameExtra":"Parameter \\"{name}\\" is missing in base","overrideParamNameMissing":"Parameter \\"{name}\\" is missing in override","overrideParamNamePositionOnly":"Parameter {index} name mismatch: base parameter is named \\"{baseName}\\", override parameter is position-only\\"","overrideParamNoDefault":"Parameter {index} mismatch: base parameter has default argument value, override parameter does not","overrideParamType":"Parameter {index} type mismatch: base parameter is type \\"{baseType}\\", override parameter is type \\"{overrideType}\\"","overridePositionalParamCount":"Positional parameter count mismatch; base method has {baseCount}, but override has {overrideCount}","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}\\"","privateImportFromPyTypedSource":"Import from \\"{module}\\" instead","propertyAccessFromProtocolClass":"A property defined within a protocol class cannot be accessed as a class variable","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","protocolIncompatible":"\\"{sourceType}\\" is incompatible with protocol \\"{destType}\\"","protocolMemberClassVar":"\\"{name}\\" is not a class variable","protocolMemberMissing":"\\"{name}\\" is not present","protocolSourceIsNotConcrete":"\\"{sourceType}\\" is not a concrete class type and cannot be assigned to type \\"{destType}\\"","readOnlyAttribute":"Attribute \\"{name}\\" is read-only","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","tupleAssignmentMismatch":"Type \\"{type}\\" is incompatible with target tuple","tupleSizeMismatch":"Element size mismatch; expected {expected} but received {received}","tupleSizeMismatchIndeterminate":"Tuple size mismatch; expected {expected} but received indeterminate number","typeAssignmentMismatch":"Type \\"{sourceType}\\" cannot be assigned to type \\"{destType}\\"","typeBound":"Type \\"{sourceType}\\" is incompatible with bound type \\"{destType}\\" for type variable \\"{name}\\"","typeConstrainedTypeVar":"Type \\"{type}\\" is incompatible with constrained type variable \\"{name}\\"","typedDictFieldMissing":"\\"{name}\\" is missing from \\"{type}\\"","typedDictFieldNotRequired":"\\"{name}\\" is not required in \\"{type}\\"","typedDictFieldRequired":"\\"{name}\\" is required in \\"{type}\\"","typedDictFieldTypeMismatch":"Type \\"{type}\\" is not assignable to field \\"{name}\\"","typedDictFieldRedefinition":"Type in parent class is \\"{parentType}\\" and type in child class is \\"{childType}\\"","typedDictFieldUndefined":"\\"{name}\\" is an undefined field in type \\"{type}\\"","typedDictFinalMismatch":"\\"{sourceType}\\" is incompatible with \\"{destType}\\" because of a @final mismatch","typeIncompatible":"\\"{sourceType}\\" is incompatible with \\"{destType}\\"","typeNotCallable":"Type \\"{type}\\" is not callable","typeNotClass":"\\"{type}\\" is not a class","typeParamSpec":"Type \\"{type}\\" is incompatible with ParamSpec \\"{name}\\"","typeNotStringLiteral":"\\"{type}\\" is not a string literal","typeOfSymbol":"Type of \\"{name}\\" is \\"{type}\\"","typeUnsupported":"Type \\"{type}\\" is unsupported","typeVarIsContravariant":"TypeVar \\"{name}\\" is contravariant","typeVarIsCovariant":"TypeVar \\"{name}\\" is covariant","typeVarIsInvariant":"TypeVar \\"{name}\\" is invariant","typeVarNotAllowed":"TypeVar or generic type with type arguments not allowed","typeVarsMissing":"Missing type variables: {names}","typeVarTupleRequiresKnownLength":"TypeVarTuple cannot be bound to a tuple of unknown length","unreachableExcept":"\\"{exceptionType}\\" is a subclass of \\"{parentType}\\"","useDictInstead":"Use Dict[T1, T2] to indicate a dictionary type","useListInstead":"Use List[T] to indicate a list type or Union[T1, T2] to indicate a union type","useTupleInstead":"Use Tuple[T1, ..., Tn] to indicate a tuple type or Union[T1, T2] to indicate a union type","useTypeInstead":"Use Type[T] instead"},"CodeAction":{"addOptionalToAnnotation":"Add \\"Optional\\" to Type Annotation","createTypeStub":"Create Type Stub","createTypeStubFor":"Create Type Stub For \\"{moduleName}\\"","executingCommand":"Executing command","filesToAnalyzeOne":"1 file to analyze","filesToAnalyzeCount":"{count} files to analyze","findingReferences":"Finding references","organizeImports":"Organize Imports"},"Refactoring":{"moveFile":"Do you want to update all import references for \\"{oldModuleName}\\" to \\"{newModuleName}\\"?","moveFileLabel":"Update all import references for \\"{oldModuleName}\\" to \\"{newModuleName}\\"?","moveFileDescription":"Update all import references for \\"{oldModuleName}\\" to \\"{newModuleName}\\"?"}}')},54678:e=>{e.exports={}},84337:e=>{e.exports={}},65082:e=>{e.exports={}},91918:e=>{e.exports={}},58165:e=>{e.exports={}},59216:e=>{e.exports={}}};
//# sourceMappingURL=pyright.bundle.js.map