admins-components 5.0.6 → 5.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -488,4 +488,4 @@ Project '${d.projectName}' (${jI[d.projectKind]}) ${o}
|
|
|
488
488
|
`,o++};this.projectService.externalProjects.forEach(c),this.projectService.configuredProjects.forEach(c),this.projectService.inferredProjects.forEach(c)}}this.logger.msg(a,"Err")}send(t){if(t.type==="event"&&!this.canUseEvents){this.logger.hasLevel(3)&&this.logger.info(`Session does not support events: ignored event: ${bT(t)}`);return}this.writeMessage(t)}writeMessage(t){const n=kye(t,this.logger,this.byteLength,this.host.newLine);this.host.write(n)}event(t,n){this.send(Cye(n,t))}doOutput(t,n,i,a,o,c){const d={seq:0,type:"response",command:n,request_seq:i,success:a,performanceData:o&&IMe(o)};if(a){let p;if(qa(t))d.body=t,p=t.metadata,delete t.metadata;else if(typeof t=="object")if(t.metadata){const{metadata:y,...b}=t;d.body=b,p=y}else d.body=t;else d.body=t;p&&(d.metadata=p)}else F.assert(t===void 0);c&&(d.message=c),this.send(d)}semanticCheck(t,n){var i,a;const o=Rc();(i=Hn)==null||i.push(Hn.Phase.Session,"semanticCheck",{file:t,configFilePath:n.canonicalConfigFilePath});const c=SMe(n,t)?of:n.getLanguageService().getSemanticDiagnostics(t).filter(d=>!!d.file);this.sendDiagnosticsEvent(t,n,c,"semanticDiag",o),(a=Hn)==null||a.pop()}syntacticCheck(t,n){var i,a;const o=Rc();(i=Hn)==null||i.push(Hn.Phase.Session,"syntacticCheck",{file:t,configFilePath:n.canonicalConfigFilePath}),this.sendDiagnosticsEvent(t,n,n.getLanguageService().getSyntacticDiagnostics(t),"syntaxDiag",o),(a=Hn)==null||a.pop()}suggestionCheck(t,n){var i,a;const o=Rc();(i=Hn)==null||i.push(Hn.Phase.Session,"suggestionCheck",{file:t,configFilePath:n.canonicalConfigFilePath}),this.sendDiagnosticsEvent(t,n,n.getLanguageService().getSuggestionDiagnostics(t),"suggestionDiag",o),(a=Hn)==null||a.pop()}regionSemanticCheck(t,n,i){var a,o,c;const d=Rc();(a=Hn)==null||a.push(Hn.Phase.Session,"regionSemanticCheck",{file:t,configFilePath:n.canonicalConfigFilePath});let p;if(!this.shouldDoRegionCheck(t)||!(p=n.getLanguageService().getRegionSemanticDiagnostics(t,i))){(o=Hn)==null||o.pop();return}this.sendDiagnosticsEvent(t,n,p.diagnostics,"regionSemanticDiag",d,p.spans),(c=Hn)==null||c.pop()}shouldDoRegionCheck(t){var n;const i=(n=this.projectService.getScriptInfoForNormalizedPath(t))==null?void 0:n.textStorage.getLineInfo().getLineCount();return!!(i&&i>=this.regionDiagLineCountThreshold)}sendDiagnosticsEvent(t,n,i,a,o,c){try{const d=F.checkDefined(n.getScriptInfo(t)),p=Rc()-o,y={file:t,diagnostics:i.map(b=>TMe(t,n,b)),spans:c==null?void 0:c.map(b=>M0(b,d))};this.event(y,a),this.addDiagnosticsPerformanceData(t,a,p)}catch(d){this.logError(d,a)}}updateErrorCheck(t,n,i,a=!0){if(n.length===0)return;F.assert(!this.suppressDiagnosticEvents);const o=this.changeSeq,c=Math.min(i,200);let d=0;const p=()=>{if(d++,n.length>d)return t.delay("checkOne",c,b)},y=(S,E)=>{if(this.semanticCheck(S,E),this.changeSeq===o){if(this.getPreferences(S).disableSuggestions)return p();t.immediate("suggestionCheck",()=>{this.suggestionCheck(S,E),p()})}},b=()=>{if(this.changeSeq!==o)return;let S,E=n[d];if(ba(E)?E=this.toPendingErrorCheck(E):"ranges"in E&&(S=E.ranges,E=this.toPendingErrorCheck(E.file)),!E)return p();const{fileName:A,project:O}=E;if(jg(O),!!O.containsFile(A,a)&&(this.syntacticCheck(A,O),this.changeSeq===o)){if(O.projectService.serverMode!==0)return p();if(S)return t.immediate("regionSemanticCheck",()=>{const M=this.projectService.getScriptInfoForNormalizedPath(A);M&&this.regionSemanticCheck(A,O,S.map(L=>this.getRange({file:A,...L},M))),this.changeSeq===o&&t.immediate("semanticCheck",()=>y(A,O))});t.immediate("semanticCheck",()=>y(A,O))}};n.length>d&&this.changeSeq===o&&t.delay("checkOne",i,b)}cleanProjects(t,n){if(n){this.logger.info(`cleaning ${t}`);for(const i of n)i.getLanguageService(!1).cleanupSemanticCache(),i.cleanupProgram()}}cleanup(){this.cleanProjects("inferred projects",this.projectService.inferredProjects),this.cleanProjects("configured projects",ma(this.projectService.configuredProjects.values())),this.cleanProjects("external projects",this.projectService.externalProjects),this.host.gc&&(this.logger.info("host.gc()"),this.host.gc())}getEncodedSyntacticClassifications(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t);return i.getEncodedSyntacticClassifications(n,t)}getEncodedSemanticClassifications(t){const{file:n,project:i}=this.getFileAndProject(t),a=t.format==="2020"?"2020":"original";return i.getLanguageService().getEncodedSemanticClassifications(n,t,a)}getProject(t){return t===void 0?void 0:this.projectService.findProject(t)}getConfigFileAndProject(t){const n=this.getProject(t.projectFileName),i=Ac(t.file);return{configFile:n&&n.hasConfigFile(i)?i:void 0,project:n}}getConfigFileDiagnostics(t,n,i){const a=n.getAllProjectErrors(),o=n.getLanguageService().getCompilerOptionsDiagnostics(),c=sr(bn(a,o),d=>!!d.file&&d.file.fileName===t);return i?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(c):Dt(c,d=>i9(d,!1))}convertToDiagnosticsWithLinePositionFromDiagnosticFile(t){return t.map(n=>({message:N0(n.messageText,this.host.newLine),start:n.start,length:n.length,category:dC(n),code:n.code,source:n.source,startLocation:n.file&&X4(ro(n.file,n.start)),endLocation:n.file&&X4(ro(n.file,n.start+n.length)),reportsUnnecessary:n.reportsUnnecessary,reportsDeprecated:n.reportsDeprecated,relatedInformation:Dt(n.relatedInformation,Tee)}))}getCompilerOptionsDiagnostics(t){const n=this.getProject(t.projectFileName);return this.convertToDiagnosticsWithLinePosition(sr(n.getLanguageService().getCompilerOptionsDiagnostics(),i=>!i.file),void 0)}convertToDiagnosticsWithLinePosition(t,n){return t.map(i=>({message:N0(i.messageText,this.host.newLine),start:i.start,length:i.length,category:dC(i),code:i.code,source:i.source,startLocation:n&&n.positionToLineOffset(i.start),endLocation:n&&n.positionToLineOffset(i.start+i.length),reportsUnnecessary:i.reportsUnnecessary,reportsDeprecated:i.reportsDeprecated,relatedInformation:Dt(i.relatedInformation,Tee)}))}getDiagnosticsWorker(t,n,i,a){const{project:o,file:c}=this.getFileAndProject(t);if(n&&SMe(o,c))return of;const d=o.getScriptInfoForNormalizedPath(c),p=i(o,c);return a?this.convertToDiagnosticsWithLinePosition(p,d):p.map(y=>TMe(c,o,y))}getDefinition(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=this.mapDefinitionInfoLocations(a.getLanguageService().getDefinitionAtPosition(i,o)||of,a);return n?this.mapDefinitionInfo(c,a):c.map(une.mapToOriginalLocation)}mapDefinitionInfoLocations(t,n){return t.map(i=>{const a=AMe(i,n);return a?{...a,containerKind:i.containerKind,containerName:i.containerName,kind:i.kind,name:i.name,failedAliasResolution:i.failedAliasResolution,...i.unverified&&{unverified:i.unverified}}:i})}getDefinitionAndBoundSpan(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=F.checkDefined(a.getScriptInfo(i)),d=a.getLanguageService().getDefinitionAndBoundSpan(i,o);if(!d||!d.definitions)return{definitions:of,textSpan:void 0};const p=this.mapDefinitionInfoLocations(d.definitions,a),{textSpan:y}=d;return n?{definitions:this.mapDefinitionInfo(p,a),textSpan:M0(y,c)}:{definitions:p.map(une.mapToOriginalLocation),textSpan:y}}findSourceDefinition(t){var n;const{file:i,project:a}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=a.getLanguageService().getDefinitionAtPosition(i,o);let d=this.mapDefinitionInfoLocations(c||of,a).slice();if(this.projectService.serverMode===0&&(!ft(d,A=>Ac(A.fileName)!==i&&!A.isAmbient)||ft(d,A=>!!A.failedAliasResolution))){const A=Kd(J=>J.textSpan.start,FQ(this.host.useCaseSensitiveFileNames));d==null||d.forEach(J=>A.add(J));const O=a.getNoDtsResolutionProject(i),M=O.getLanguageService(),L=(n=M.getDefinitionAtPosition(i,o,!0,!1))==null?void 0:n.filter(J=>Ac(J.fileName)!==i);if(ft(L))for(const J of L){if(J.unverified){const q=S(J,a.getLanguageService().getProgram(),M.getProgram());if(ft(q)){for(const z of q)A.add(z);continue}}A.add(J)}else{const J=d.filter(q=>Ac(q.fileName)!==i&&q.isAmbient);for(const q of ft(J)?J:b()){const z=y(q.fileName,i,O);if(!z)continue;const G=this.projectService.getOrCreateScriptInfoNotOpenedByClient(z,O.currentDirectory,O.directoryStructureHost,!1);if(!G)continue;O.containsScriptInfo(G)||(O.addRoot(G),O.updateGraph());const Z=M.getProgram(),ne=F.checkDefined(Z.getSourceFile(z));for(const oe of E(q.name,ne,Z))A.add(oe)}}d=ma(A.values())}return d=d.filter(A=>!A.isAmbient&&!A.failedAliasResolution),this.mapDefinitionInfo(d,a);function y(A,O,M){var L,J,q;const z=gj(A);if(z&&A.lastIndexOf(fy)===z.topLevelNodeModulesIndex){const G=A.substring(0,z.packageRootIndex),Z=(L=a.getModuleResolutionCache())==null?void 0:L.getPackageJsonInfoCache(),ne=a.getCompilationSettings(),oe=VN(ns(G,a.getCurrentDirectory()),qN(Z,a,ne));if(!oe)return;const re=tY(oe,{moduleResolution:2},a,a.getModuleResolutionCache()),Ee=A.substring(z.topLevelPackageNameIndex+1,z.packageRootIndex),pe=WN(wF(Ee)),K=a.toPath(A);if(re&&ft(re,ve=>a.toPath(ve)===K))return(J=M.resolutionCache.resolveSingleModuleNameWithoutWatching(pe,O).resolvedModule)==null?void 0:J.resolvedFileName;{const ve=A.substring(z.packageRootIndex+1),ge=`${pe}/${gp(ve)}`;return(q=M.resolutionCache.resolveSingleModuleNameWithoutWatching(ge,O).resolvedModule)==null?void 0:q.resolvedFileName}}}function b(){const A=a.getLanguageService(),O=A.getProgram(),M=qp(O.getSourceFile(i),o);return(ic(M)||Ze(M))&&Yc(M.parent)&&wce(M,L=>{var J;if(L===M)return;const q=(J=A.getDefinitionAtPosition(i,L.getStart(),!0,!1))==null?void 0:J.filter(z=>Ac(z.fileName)!==i&&z.isAmbient).map(z=>({fileName:z.fileName,name:Xm(M)}));if(ft(q))return q})||of}function S(A,O,M){var L;const J=M.getSourceFile(A.fileName);if(!J)return;const q=qp(O.getSourceFile(i),o),z=O.getTypeChecker().getSymbolAtLocation(q),G=z&&_l(z,276);if(!G)return;const Z=((L=G.propertyName)==null?void 0:L.text)||G.name.text;return E(Z,J,M)}function E(A,O,M){const L=Qc.Core.getTopMostDeclarationNamesInFile(A,O);return Or(L,J=>{const q=M.getTypeChecker().getSymbolAtLocation(J),z=q3(J);if(q&&z)return V4.createDefinitionInfo(z,M.getTypeChecker(),q,z,!0)})}}getEmitOutput(t){const{file:n,project:i}=this.getFileAndProject(t);if(!i.shouldEmitFile(i.getScriptInfo(n)))return{emitSkipped:!0,outputFiles:[],diagnostics:[]};const a=i.getLanguageService().getEmitOutput(n);return t.richResponse?{...a,diagnostics:t.includeLinePosition?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(a.diagnostics):a.diagnostics.map(o=>i9(o,!0))}:a}mapJSDocTagInfo(t,n,i){return t?t.map(a=>{var o;return{...a,text:i?this.mapDisplayParts(a.text,n):(o=a.text)==null?void 0:o.map(c=>c.text).join("")}}):[]}mapDisplayParts(t,n){return t?t.map(i=>i.kind!=="linkName"?i:{...i,target:this.toFileSpan(i.target.fileName,i.target.textSpan,n)}):[]}mapSignatureHelpItems(t,n,i){return t.map(a=>({...a,documentation:this.mapDisplayParts(a.documentation,n),parameters:a.parameters.map(o=>({...o,documentation:this.mapDisplayParts(o.documentation,n)})),tags:this.mapJSDocTagInfo(a.tags,n,i)}))}mapDefinitionInfo(t,n){return t.map(i=>({...this.toFileSpanWithContext(i.fileName,i.textSpan,i.contextSpan,n),...i.unverified&&{unverified:i.unverified}}))}static mapToOriginalLocation(t){return t.originalFileName?(F.assert(t.originalTextSpan!==void 0,"originalTextSpan should be present if originalFileName is"),{...t,fileName:t.originalFileName,textSpan:t.originalTextSpan,targetFileName:t.fileName,targetTextSpan:t.textSpan,contextSpan:t.originalContextSpan,targetContextSpan:t.contextSpan}):t}toFileSpan(t,n,i){const a=i.getLanguageService(),o=a.toLineColumnOffset(t,n.start),c=a.toLineColumnOffset(t,Il(n));return{file:t,start:{line:o.line+1,offset:o.character+1},end:{line:c.line+1,offset:c.character+1}}}toFileSpanWithContext(t,n,i,a){const o=this.toFileSpan(t,n,a),c=i&&this.toFileSpan(t,i,a);return c?{...o,contextStart:c.start,contextEnd:c.end}:o}getTypeDefinition(t){const{file:n,project:i}=this.getFileAndProject(t),a=this.getPositionInFile(t,n),o=this.mapDefinitionInfoLocations(i.getLanguageService().getTypeDefinitionAtPosition(n,a)||of,i);return this.mapDefinitionInfo(o,i)}mapImplementationLocations(t,n){return t.map(i=>{const a=AMe(i,n);return a?{...a,kind:i.kind,displayParts:i.displayParts}:i})}getImplementation(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=this.mapImplementationLocations(a.getLanguageService().getImplementationAtPosition(i,o)||of,a);return n?c.map(({fileName:d,textSpan:p,contextSpan:y})=>this.toFileSpanWithContext(d,p,y,a)):c.map(une.mapToOriginalLocation)}getSyntacticDiagnosticsSync(t){const{configFile:n}=this.getConfigFileAndProject(t);return n?of:this.getDiagnosticsWorker(t,!1,(i,a)=>i.getLanguageService().getSyntacticDiagnostics(a),!!t.includeLinePosition)}getSemanticDiagnosticsSync(t){const{configFile:n,project:i}=this.getConfigFileAndProject(t);return n?this.getConfigFileDiagnostics(n,i,!!t.includeLinePosition):this.getDiagnosticsWorker(t,!0,(a,o)=>a.getLanguageService().getSemanticDiagnostics(o).filter(c=>!!c.file),!!t.includeLinePosition)}getSuggestionDiagnosticsSync(t){const{configFile:n}=this.getConfigFileAndProject(t);return n?of:this.getDiagnosticsWorker(t,!0,(i,a)=>i.getLanguageService().getSuggestionDiagnostics(a),!!t.includeLinePosition)}getJsxClosingTag(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.getPositionInFile(t,n),o=i.getJsxClosingTagAtPosition(n,a);return o===void 0?void 0:{newText:o.newText,caretOffset:0}}getLinkedEditingRange(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.getPositionInFile(t,n),o=i.getLinkedEditingRangeAtPosition(n,a),c=this.projectService.getScriptInfoForNormalizedPath(n);if(!(c===void 0||o===void 0))return vvt(o,c)}getDocumentHighlights(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.getPositionInFile(t,i),c=a.getLanguageService().getDocumentHighlights(i,o,t.filesToSearch);return c?n?c.map(({fileName:d,highlightSpans:p})=>{const y=a.getScriptInfo(d);return{file:d,highlightSpans:p.map(({textSpan:b,kind:S,contextSpan:E})=>({...wye(b,E,y),kind:S}))}}):c:of}provideInlayHints(t){const{file:n,project:i}=this.getFileAndProject(t),a=this.projectService.getScriptInfoForNormalizedPath(n);return i.getLanguageService().provideInlayHints(n,t,this.getPreferences(n)).map(c=>{const{position:d,displayParts:p}=c;return{...c,position:a.positionToLineOffset(d),displayParts:p==null?void 0:p.map(({text:y,span:b,file:S})=>{if(b){F.assertIsDefined(S,"Target file should be defined together with its span.");const E=this.projectService.getScriptInfo(S);return{text:y,span:{start:E.positionToLineOffset(b.start),end:E.positionToLineOffset(b.start+b.length),file:S}}}else return{text:y}})}})}mapCode(t){var n;const i=this.getHostFormatOptions(),a=this.getHostPreferences(),{file:o,languageService:c}=this.getFileAndLanguageServiceForSyntacticOperation(t),d=this.projectService.getScriptInfoForNormalizedPath(o),p=(n=t.mapping.focusLocations)==null?void 0:n.map(b=>b.map(S=>{const E=d.lineOffsetToPosition(S.start.line,S.start.offset),A=d.lineOffsetToPosition(S.end.line,S.end.offset);return{start:E,length:A-E}})),y=c.mapCode(o,t.mapping.contents,p,i,a);return this.mapTextChangesToCodeEdits(y)}getCopilotRelatedInfo(){return{relatedFiles:[]}}setCompilerOptionsForInferredProjects(t){this.projectService.setCompilerOptionsForInferredProjects(t.options,t.projectRootPath)}getProjectInfo(t){return this.getProjectInfoWorker(t.file,t.projectFileName,t.needFileNameList,t.needDefaultConfiguredProjectInfo,!1)}getProjectInfoWorker(t,n,i,a,o){const{project:c}=this.getFileAndProjectWorker(t,n);return jg(c),{configFileName:c.getProjectName(),languageServiceDisabled:!c.languageServiceEnabled,fileNames:i?c.getFileNames(!1,o):void 0,configuredProjectInfo:a?this.getDefaultConfiguredProjectInfo(t):void 0}}getDefaultConfiguredProjectInfo(t){var n;const i=this.projectService.getScriptInfo(t);if(!i)return;const a=this.projectService.findDefaultConfiguredProjectWorker(i,3);if(!a)return;let o,c;return a.seenProjects.forEach((d,p)=>{p!==a.defaultProject&&(d!==3?(o??(o=[])).push(Ac(p.getConfigFilePath())):(c??(c=[])).push(Ac(p.getConfigFilePath())))}),(n=a.seenConfigs)==null||n.forEach(d=>(o??(o=[])).push(d)),{notMatchedByConfig:o,notInProject:c,defaultProject:a.defaultProject&&Ac(a.defaultProject.getConfigFilePath())}}getRenameInfo(t){const{file:n,project:i}=this.getFileAndProject(t),a=this.getPositionInFile(t,n),o=this.getPreferences(n);return i.getLanguageService().getRenameInfo(n,a,o)}getProjects(t,n,i){let a,o;if(t.projectFileName){const c=this.getProject(t.projectFileName);c&&(a=[c])}else{const c=n?this.projectService.getScriptInfoEnsuringProjectsUptoDate(t.file):this.projectService.getScriptInfo(t.file);if(c)n||this.projectService.ensureDefaultProjectForFile(c);else return i?of:(this.projectService.logErrorForScriptInfoNotFound(t.file),f1.ThrowNoProject());a=c.containingProjects,o=this.projectService.getSymlinkedProjects(c)}return a=sr(a,c=>c.languageServiceEnabled&&!c.isOrphan()),!i&&(!a||!a.length)&&!o?(this.projectService.logErrorForScriptInfoNotFound(t.file??t.projectFileName),f1.ThrowNoProject()):o?{projects:a,symLinkedProjects:o}:a}getDefaultProject(t){if(t.projectFileName){const i=this.getProject(t.projectFileName);if(i)return i;if(!t.file)return f1.ThrowNoProject()}return this.projectService.getScriptInfo(t.file).getDefaultProject()}getRenameLocations(t,n){const i=Ac(t.file),a=this.getPositionInFile(t,i),o=this.getProjects(t),c=this.getDefaultProject(t),d=this.getPreferences(i),p=this.mapRenameInfo(c.getLanguageService().getRenameInfo(i,a,d),F.checkDefined(this.projectService.getScriptInfo(i)));if(!p.canRename)return n?{info:p,locs:[]}:[];const y=_vt(o,c,{fileName:t.file,pos:a},!!t.findInStrings,!!t.findInComments,d,this.host.useCaseSensitiveFileNames);return n?{info:p,locs:this.toSpanGroups(y)}:y}mapRenameInfo(t,n){if(t.canRename){const{canRename:i,fileToRename:a,displayName:o,fullDisplayName:c,kind:d,kindModifiers:p,triggerSpan:y}=t;return{canRename:i,fileToRename:a,displayName:o,fullDisplayName:c,kind:d,kindModifiers:p,triggerSpan:M0(y,n)}}else return t}toSpanGroups(t){const n=new Map;for(const{fileName:i,textSpan:a,contextSpan:o,originalContextSpan:c,originalTextSpan:d,originalFileName:p,...y}of t){let b=n.get(i);b||n.set(i,b={file:i,locs:[]});const S=F.checkDefined(this.projectService.getScriptInfo(i));b.locs.push({...wye(a,o,S),...y})}return ma(n.values())}getReferences(t,n){const i=Ac(t.file),a=this.getProjects(t),o=this.getPositionInFile(t,i),c=pvt(a,this.getDefaultProject(t),{fileName:t.file,pos:o},this.host.useCaseSensitiveFileNames,this.logger);if(!n)return c;const d=this.getPreferences(i),p=this.getDefaultProject(t),y=p.getScriptInfoForNormalizedPath(i),b=p.getLanguageService().getQuickInfoAtPosition(i,o),S=b?D5(b.displayParts):"",E=b&&b.textSpan,A=E?y.positionToLineOffset(E.start).offset:0,O=E?y.getSnapshot().getText(E.start,Il(E)):"";return{refs:pn(c,L=>L.references.map(J=>FMe(this.projectService,J,d))),symbolName:O,symbolStartOffset:A,symbolDisplayString:S}}getFileReferences(t,n){const i=this.getProjects(t),a=Ac(t.file),o=this.getPreferences(a),c={fileName:a,pos:0},d=Eye(i,this.getDefaultProject(t),c,c,EMe,b=>(this.logger.info(`Finding references to file ${a} in project ${b.getProjectName()}`),b.getLanguageService().getFileReferences(a)));let p;if(qa(d))p=d;else{p=[];const b=xee(this.host.useCaseSensitiveFileNames);d.forEach(S=>{for(const E of S)b.has(E)||(p.push(E),b.add(E))})}return n?{refs:p.map(b=>FMe(this.projectService,b,o)),symbolName:`"${t.file}"`}:p}openClientFile(t,n,i,a){this.projectService.openClientFileWithNormalizedPath(t,n,i,!1,a)}getPosition(t,n){return t.position!==void 0?t.position:n.lineOffsetToPosition(t.line,t.offset)}getPositionInFile(t,n){const i=this.projectService.getScriptInfoForNormalizedPath(n);return this.getPosition(t,i)}getFileAndProject(t){return this.getFileAndProjectWorker(t.file,t.projectFileName)}getFileAndLanguageServiceForSyntacticOperation(t){const{file:n,project:i}=this.getFileAndProject(t);return{file:n,languageService:i.getLanguageService(!1)}}getFileAndProjectWorker(t,n){const i=Ac(t),a=this.getProject(n)||this.projectService.ensureDefaultProjectForFile(i);return{file:i,project:a}}getOutliningSpans(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=a.getOutliningSpans(i);if(n){const c=this.projectService.getScriptInfoForNormalizedPath(i);return o.map(d=>({textSpan:M0(d.textSpan,c),hintSpan:M0(d.hintSpan,c),bannerText:d.bannerText,autoCollapse:d.autoCollapse,kind:d.kind}))}else return o}getTodoComments(t){const{file:n,project:i}=this.getFileAndProject(t);return i.getLanguageService().getTodoComments(n,t.descriptors)}getDocCommentTemplate(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.getPositionInFile(t,n);return i.getDocCommentTemplateAtPosition(n,a,this.getPreferences(n),this.getFormatOptions(n))}getSpanOfEnclosingComment(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=t.onlyMultiLine,o=this.getPositionInFile(t,n);return i.getSpanOfEnclosingComment(n,o,a)}getIndentation(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.getPositionInFile(t,n),o=t.options?Y4(t.options):this.getFormatOptions(n),c=i.getIndentationAtPosition(n,a,o);return{position:a,indentation:c}}getBreakpointStatement(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.getPositionInFile(t,n);return i.getBreakpointStatementAtPosition(n,a)}getNameOrDottedNameSpan(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.getPositionInFile(t,n);return i.getNameOrDottedNameSpan(n,a,a)}isValidBraceCompletion(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.getPositionInFile(t,n);return i.isValidBraceCompletionAtPosition(n,a,t.openingBrace.charCodeAt(0))}getQuickInfoWorker(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=a.getLanguageService().getQuickInfoAtPosition(i,this.getPosition(t,o));if(!c)return;const d=!!this.getPreferences(i).displayPartsForJSDoc;if(n){const p=D5(c.displayParts);return{kind:c.kind,kindModifiers:c.kindModifiers,start:o.positionToLineOffset(c.textSpan.start),end:o.positionToLineOffset(Il(c.textSpan)),displayString:p,documentation:d?this.mapDisplayParts(c.documentation,a):D5(c.documentation),tags:this.mapJSDocTagInfo(c.tags,a,d)}}else return d?c:{...c,tags:this.mapJSDocTagInfo(c.tags,a,!1)}}getFormattingEditsForRange(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.projectService.getScriptInfoForNormalizedPath(n),o=a.lineOffsetToPosition(t.line,t.offset),c=a.lineOffsetToPosition(t.endLine,t.endOffset),d=i.getFormattingEditsForRange(n,o,c,this.getFormatOptions(n));if(d)return d.map(p=>this.convertTextChangeToCodeEdit(p,a))}getFormattingEditsForRangeFull(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=t.options?Y4(t.options):this.getFormatOptions(n);return i.getFormattingEditsForRange(n,t.position,t.endPosition,a)}getFormattingEditsForDocumentFull(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=t.options?Y4(t.options):this.getFormatOptions(n);return i.getFormattingEditsForDocument(n,a)}getFormattingEditsAfterKeystrokeFull(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=t.options?Y4(t.options):this.getFormatOptions(n);return i.getFormattingEditsAfterKeystroke(n,t.position,t.key,a)}getFormattingEditsAfterKeystroke(t){const{file:n,languageService:i}=this.getFileAndLanguageServiceForSyntacticOperation(t),a=this.projectService.getScriptInfoForNormalizedPath(n),o=a.lineOffsetToPosition(t.line,t.offset),c=this.getFormatOptions(n),d=i.getFormattingEditsAfterKeystroke(n,o,t.key,c);if(t.key===`
|
|
489
489
|
`&&(!d||d.length===0||lvt(d,o))){const{lineText:p,absolutePosition:y}=a.textStorage.getAbsolutePositionAndLineText(t.line);if(p&&p.search("\\S")<0){const b=i.getIndentationAtPosition(n,o,c);let S=0,E,A;for(E=0,A=p.length;E<A;E++)if(p.charAt(E)===" ")S++;else if(p.charAt(E)===" ")S+=c.tabSize;else break;if(b!==S){const O=y+E;d.push({span:su(y,O),newText:Lu.getIndentationString(b,c)})}}}if(d)return d.map(p=>({start:a.positionToLineOffset(p.span.start),end:a.positionToLineOffset(Il(p.span)),newText:p.newText?p.newText:""}))}getCompletions(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),d=a.getLanguageService().getCompletionsAtPosition(i,c,{...cye(this.getPreferences(i)),triggerCharacter:t.triggerCharacter,triggerKind:t.triggerKind,includeExternalModuleExports:t.includeExternalModuleExports,includeInsertTextCompletions:t.includeInsertTextCompletions},a.projectService.getFormatCodeOptions(i));if(d===void 0)return;if(n==="completions-full")return d;const p=t.prefix||"",y=Or(d.entries,S=>{if(d.isMemberCompletion||Va(S.name.toLowerCase(),p.toLowerCase())){const E=S.replacementSpan?M0(S.replacementSpan,o):void 0;return{...S,replacementSpan:E,hasAction:S.hasAction||void 0,symbol:void 0}}});return n==="completions"?(d.metadata&&(y.metadata=d.metadata),y):{...d,optionalReplacementSpan:d.optionalReplacementSpan&&M0(d.optionalReplacementSpan,o),entries:y}}getCompletionEntryDetails(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),d=a.projectService.getFormatCodeOptions(i),p=!!this.getPreferences(i).displayPartsForJSDoc,y=Or(t.entryNames,b=>{const{name:S,source:E,data:A}=typeof b=="string"?{name:b,source:void 0,data:void 0}:b;return a.getLanguageService().getCompletionEntryDetails(i,c,S,d,E,this.getPreferences(i),A?Ms(A,xvt):void 0)});return n?p?y:y.map(b=>({...b,tags:this.mapJSDocTagInfo(b.tags,a,!1)})):y.map(b=>({...b,codeActions:Dt(b.codeActions,S=>this.mapCodeAction(S)),documentation:this.mapDisplayParts(b.documentation,a),tags:this.mapJSDocTagInfo(b.tags,a,p)}))}getCompileOnSaveAffectedFileList(t){const n=this.getProjects(t,!0,!0),i=this.projectService.getScriptInfo(t.file);return i?fvt(i,a=>this.projectService.getScriptInfoForPath(a),n,(a,o)=>{if(!a.compileOnSaveEnabled||!a.languageServiceEnabled||a.isOrphan())return;const c=a.getCompilationSettings();if(!(c.noEmit||sf(o.fileName)&&!cvt(c)))return{projectFileName:a.getProjectName(),fileNames:a.getCompileOnSaveAffectedFileList(o),projectUsesOutFile:!!c.outFile}}):of}emitFile(t){const{file:n,project:i}=this.getFileAndProject(t);if(i||f1.ThrowNoProject(),!i.languageServiceEnabled)return t.richResponse?{emitSkipped:!0,diagnostics:[]}:!1;const a=i.getScriptInfo(n),{emitSkipped:o,diagnostics:c}=i.emitFile(a,(d,p,y)=>this.host.writeFile(d,p,y));return t.richResponse?{emitSkipped:o,diagnostics:t.includeLinePosition?this.convertToDiagnosticsWithLinePositionFromDiagnosticFile(c):c.map(d=>i9(d,!0))}:!o}getSignatureHelpItems(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),d=a.getLanguageService().getSignatureHelpItems(i,c,t),p=!!this.getPreferences(i).displayPartsForJSDoc;if(d&&n){const y=d.applicableSpan;return{...d,applicableSpan:{start:o.positionToLineOffset(y.start),end:o.positionToLineOffset(y.start+y.length)},items:this.mapSignatureHelpItems(d.items,a,p)}}else return p||!d?d:{...d,items:d.items.map(y=>({...y,tags:this.mapJSDocTagInfo(y.tags,a,!1)}))}}toPendingErrorCheck(t){const n=Ac(t),i=this.projectService.tryGetDefaultProjectForFile(n);return i&&{fileName:n,project:i}}getDiagnostics(t,n,i){this.suppressDiagnosticEvents||i.length>0&&this.updateErrorCheck(t,i,n)}change(t){const n=this.projectService.getScriptInfo(t.file);F.assert(!!n),n.textStorage.switchToScriptVersionCache();const i=n.lineOffsetToPosition(t.line,t.offset),a=n.lineOffsetToPosition(t.endLine,t.endOffset);i>=0&&(this.changeSeq++,this.projectService.applyChangesToFile(n,ri({span:{start:i,length:a-i},newText:t.insertString})))}reload(t){const n=Ac(t.file),i=t.tmpfile===void 0?void 0:Ac(t.tmpfile),a=this.projectService.getScriptInfoForNormalizedPath(n);a&&(this.changeSeq++,a.reloadFromFile(i))}saveToTmp(t,n){const i=this.projectService.getScriptInfo(t);i&&i.saveTo(n)}closeClientFile(t){if(!t)return;const n=co(t);this.projectService.closeClientFile(n)}mapLocationNavigationBarItems(t,n){return Dt(t,i=>({text:i.text,kind:i.kind,kindModifiers:i.kindModifiers,spans:i.spans.map(a=>M0(a,n)),childItems:this.mapLocationNavigationBarItems(i.childItems,n),indent:i.indent}))}getNavigationBarItems(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=a.getNavigationBarItems(i);return o?n?this.mapLocationNavigationBarItems(o,this.projectService.getScriptInfoForNormalizedPath(i)):o:void 0}toLocationNavigationTree(t,n){return{text:t.text,kind:t.kind,kindModifiers:t.kindModifiers,spans:t.spans.map(i=>M0(i,n)),nameSpan:t.nameSpan&&M0(t.nameSpan,n),childItems:Dt(t.childItems,i=>this.toLocationNavigationTree(i,n))}}getNavigationTree(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=a.getNavigationTree(i);return o?n?this.toLocationNavigationTree(o,this.projectService.getScriptInfoForNormalizedPath(i)):o:void 0}getNavigateToItems(t,n){const i=this.getFullNavigateToItems(t);return n?pn(i,({project:a,navigateToItems:o})=>o.map(c=>{const d=a.getScriptInfo(c.fileName),p={name:c.name,kind:c.kind,kindModifiers:c.kindModifiers,isCaseSensitive:c.isCaseSensitive,matchKind:c.matchKind,file:c.fileName,start:d.positionToLineOffset(c.textSpan.start),end:d.positionToLineOffset(Il(c.textSpan))};return c.kindModifiers&&c.kindModifiers!==""&&(p.kindModifiers=c.kindModifiers),c.containerName&&c.containerName.length>0&&(p.containerName=c.containerName),c.containerKind&&c.containerKind.length>0&&(p.containerKind=c.containerKind),p})):pn(i,({navigateToItems:a})=>a)}getFullNavigateToItems(t){const{currentFileOnly:n,searchValue:i,maxResultCount:a,projectFileName:o}=t;if(n){F.assertIsDefined(t.file);const{file:E,project:A}=this.getFileAndProject(t);return[{project:A,navigateToItems:A.getLanguageService().getNavigateToItems(i,a,E)}]}const c=this.getHostPreferences(),d=[],p=new Map;if(!t.file&&!o)this.projectService.loadAncestorProjectTree(),this.projectService.forEachEnabledProject(E=>y(E));else{const E=this.getProjects(t);CMe(E,void 0,A=>y(A))}return d;function y(E){const A=E.getLanguageService().getNavigateToItems(i,a,void 0,E.isNonTsProject(),c.excludeLibrarySymbolsInNavTo),O=sr(A,M=>b(M)&&!kee(BI(M),E));O.length&&d.push({project:E,navigateToItems:O})}function b(E){const A=E.name;if(!p.has(A))return p.set(A,[E]),!0;const O=p.get(A);for(const M of O)if(S(M,E))return!1;return O.push(E),!0}function S(E,A){return E===A?!0:!E||!A?!1:E.containerKind===A.containerKind&&E.containerName===A.containerName&&E.fileName===A.fileName&&E.isCaseSensitive===A.isCaseSensitive&&E.kind===A.kind&&E.kindModifiers===A.kindModifiers&&E.matchKind===A.matchKind&&E.name===A.name&&E.textSpan.start===A.textSpan.start&&E.textSpan.length===A.textSpan.length}}getSupportedCodeFixes(t){if(!t)return JK();if(t.file){const{file:i,project:a}=this.getFileAndProject(t);return a.getLanguageService().getSupportedCodeFixes(i)}const n=this.getProject(t.projectFileName);return n||f1.ThrowNoProject(),n.getLanguageService().getSupportedCodeFixes()}isLocation(t){return t.line!==void 0}extractPositionOrRange(t,n){let i,a;return this.isLocation(t)?i=o(t):a=this.getRange(t,n),F.checkDefined(i===void 0?a:i);function o(c){return c.position!==void 0?c.position:n.lineOffsetToPosition(c.line,c.offset)}}getRange(t,n){const{startPosition:i,endPosition:a}=this.getStartAndEndPosition(t,n);return{pos:i,end:a}}getApplicableRefactors(t){const{file:n,project:i}=this.getFileAndProject(t),a=i.getScriptInfoForNormalizedPath(n);return i.getLanguageService().getApplicableRefactors(n,this.extractPositionOrRange(t,a),this.getPreferences(n),t.triggerReason,t.kind,t.includeInteractiveActions).map(c=>({...c,actions:c.actions.map(d=>({...d,range:d.range?{start:X4({line:d.range.start.line,character:d.range.start.offset}),end:X4({line:d.range.end.line,character:d.range.end.offset})}:void 0}))}))}getEditsForRefactor(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=a.getScriptInfoForNormalizedPath(i),c=a.getLanguageService().getEditsForRefactor(i,this.getFormatOptions(i),this.extractPositionOrRange(t,o),t.refactor,t.action,this.getPreferences(i),t.interactiveRefactorArguments);if(c===void 0)return{edits:[]};if(n){const{renameFilename:d,renameLocation:p,edits:y}=c;let b;if(d!==void 0&&p!==void 0){const S=a.getScriptInfoForNormalizedPath(Ac(d));b=Dye(RD(S.getSnapshot()),d,p,y)}return{renameLocation:b,renameFilename:d,edits:this.mapTextChangesToCodeEdits(y),notApplicableReason:c.notApplicableReason}}return c}getMoveToRefactoringFileSuggestions(t){const{file:n,project:i}=this.getFileAndProject(t),a=i.getScriptInfoForNormalizedPath(n);return i.getLanguageService().getMoveToRefactoringFileSuggestions(n,this.extractPositionOrRange(t,a),this.getPreferences(n))}preparePasteEdits(t){const{file:n,project:i}=this.getFileAndProject(t);return i.getLanguageService().preparePasteEditsForFile(n,t.copiedTextSpan.map(a=>this.getRange({file:n,startLine:a.start.line,startOffset:a.start.offset,endLine:a.end.line,endOffset:a.end.offset},this.projectService.getScriptInfoForNormalizedPath(n))))}getPasteEdits(t){const{file:n,project:i}=this.getFileAndProject(t);if(RI(n))return;const a=t.copiedFrom?{file:t.copiedFrom.file,range:t.copiedFrom.spans.map(c=>this.getRange({file:t.copiedFrom.file,startLine:c.start.line,startOffset:c.start.offset,endLine:c.end.line,endOffset:c.end.offset},i.getScriptInfoForNormalizedPath(Ac(t.copiedFrom.file))))}:void 0,o=i.getLanguageService().getPasteEdits({targetFile:n,pastedText:t.pastedText,pasteLocations:t.pasteLocations.map(c=>this.getRange({file:n,startLine:c.start.line,startOffset:c.start.offset,endLine:c.end.line,endOffset:c.end.offset},i.getScriptInfoForNormalizedPath(n))),copiedFrom:a,preferences:this.getPreferences(n)},this.getFormatOptions(n));return o&&this.mapPasteEditsAction(o)}organizeImports(t,n){F.assert(t.scope.type==="file");const{file:i,project:a}=this.getFileAndProject(t.scope.args),o=a.getLanguageService().organizeImports({fileName:i,mode:t.mode??(t.skipDestructiveCodeActions?"SortAndCombine":void 0),type:"file"},this.getFormatOptions(i),this.getPreferences(i));return n?this.mapTextChangesToCodeEdits(o):o}getEditsForFileRename(t,n){const i=Ac(t.oldFilePath),a=Ac(t.newFilePath),o=this.getHostFormatOptions(),c=this.getHostPreferences(),d=new Set,p=[];return this.projectService.loadAncestorProjectTree(),this.projectService.forEachEnabledProject(y=>{const b=y.getLanguageService().getEditsForFileRename(i,a,o,c),S=[];for(const E of b)d.has(E.fileName)||(p.push(E),S.push(E.fileName));for(const E of S)d.add(E)}),n?p.map(y=>this.mapTextChangeToCodeEdit(y)):p}getCodeFixes(t,n){const{file:i,project:a}=this.getFileAndProject(t),o=a.getScriptInfoForNormalizedPath(i),{startPosition:c,endPosition:d}=this.getStartAndEndPosition(t,o);let p;try{p=a.getLanguageService().getCodeFixesAtPosition(i,c,d,t.errorCodes,this.getFormatOptions(i),this.getPreferences(i))}catch(y){const b=a.getLanguageService(),S=[...b.getSyntacticDiagnostics(i),...b.getSemanticDiagnostics(i),...b.getSuggestionDiagnostics(i)].map(A=>h7(c,d-c,A.start,A.length)&&A.code),E=t.errorCodes.find(A=>!S.includes(A));throw E!==void 0&&(y.message=`BADCLIENT: Bad error code, ${E} not found in range ${c}..${d} (found: ${S.join(", ")}); could have caused this error:
|
|
490
490
|
${y.message}`),y}return n?p.map(y=>this.mapCodeFixAction(y)):p}getCombinedCodeFix({scope:t,fixId:n},i){F.assert(t.type==="file");const{file:a,project:o}=this.getFileAndProject(t.args),c=o.getLanguageService().getCombinedCodeFix({type:"file",fileName:a},n,this.getFormatOptions(a),this.getPreferences(a));return i?{changes:this.mapTextChangesToCodeEdits(c.changes),commands:c.commands}:c}applyCodeActionCommand(t){const n=t.command;for(const i of Ch(n)){const{file:a,project:o}=this.getFileAndProject(i);o.getLanguageService().applyCodeActionCommand(i,this.getFormatOptions(a)).then(c=>{},c=>{})}return{}}getStartAndEndPosition(t,n){let i,a;return t.startPosition!==void 0?i=t.startPosition:(i=n.lineOffsetToPosition(t.startLine,t.startOffset),t.startPosition=i),t.endPosition!==void 0?a=t.endPosition:(a=n.lineOffsetToPosition(t.endLine,t.endOffset),t.endPosition=a),{startPosition:i,endPosition:a}}mapCodeAction({description:t,changes:n,commands:i}){return{description:t,changes:this.mapTextChangesToCodeEdits(n),commands:i}}mapCodeFixAction({fixName:t,description:n,changes:i,commands:a,fixId:o,fixAllDescription:c}){return{fixName:t,description:n,changes:this.mapTextChangesToCodeEdits(i),commands:a,fixId:o,fixAllDescription:c}}mapPasteEditsAction({edits:t,fixId:n}){return{edits:this.mapTextChangesToCodeEdits(t),fixId:n}}mapTextChangesToCodeEdits(t){return t.map(n=>this.mapTextChangeToCodeEdit(n))}mapTextChangeToCodeEdit(t){const n=this.projectService.getScriptInfoOrConfig(t.fileName);return!!t.isNewFile==!!n&&(n||this.projectService.logErrorForScriptInfoNotFound(t.fileName),F.fail("Expected isNewFile for (only) new files. "+JSON.stringify({isNewFile:!!t.isNewFile,hasScriptInfo:!!n}))),n?{fileName:t.fileName,textChanges:t.textChanges.map(i=>hvt(i,n))}:bvt(t)}convertTextChangeToCodeEdit(t,n){return{start:n.positionToLineOffset(t.span.start),end:n.positionToLineOffset(t.span.start+t.span.length),newText:t.newText?t.newText:""}}getBraceMatching(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getPosition(t,o),d=a.getBraceMatchingAtPosition(i,c);return d?n?d.map(p=>M0(p,o)):d:void 0}getDiagnosticsForProject(t,n,i){if(this.suppressDiagnosticEvents)return;const{fileNames:a,languageServiceDisabled:o}=this.getProjectInfoWorker(i,void 0,!0,void 0,!0);if(o)return;const c=a.filter(M=>!M.includes("lib.d.ts"));if(c.length===0)return;const d=[],p=[],y=[],b=[],S=Ac(i),E=this.projectService.ensureDefaultProjectForFile(S);for(const M of c)this.getCanonicalFileName(M)===this.getCanonicalFileName(i)?d.push(M):this.projectService.getScriptInfo(M).isScriptOpen()?p.push(M):sf(M)?b.push(M):y.push(M);const O=[...d,...p,...y,...b].map(M=>({fileName:M,project:E}));this.updateErrorCheck(t,O,n,!1)}configurePlugin(t){this.projectService.configurePlugin(t)}getSmartSelectionRange(t,n){const{locations:i}=t,{file:a,languageService:o}=this.getFileAndLanguageServiceForSyntacticOperation(t),c=F.checkDefined(this.projectService.getScriptInfo(a));return Dt(i,d=>{const p=this.getPosition(d,c),y=o.getSmartSelectionRange(a,p);return n?this.mapSelectionRange(y,c):y})}toggleLineComment(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfo(i),c=this.getRange(t,o),d=a.toggleLineComment(i,c);if(n){const p=this.projectService.getScriptInfoForNormalizedPath(i);return d.map(y=>this.convertTextChangeToCodeEdit(y,p))}return d}toggleMultilineComment(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),d=a.toggleMultilineComment(i,c);if(n){const p=this.projectService.getScriptInfoForNormalizedPath(i);return d.map(y=>this.convertTextChangeToCodeEdit(y,p))}return d}commentSelection(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),d=a.commentSelection(i,c);if(n){const p=this.projectService.getScriptInfoForNormalizedPath(i);return d.map(y=>this.convertTextChangeToCodeEdit(y,p))}return d}uncommentSelection(t,n){const{file:i,languageService:a}=this.getFileAndLanguageServiceForSyntacticOperation(t),o=this.projectService.getScriptInfoForNormalizedPath(i),c=this.getRange(t,o),d=a.uncommentSelection(i,c);if(n){const p=this.projectService.getScriptInfoForNormalizedPath(i);return d.map(y=>this.convertTextChangeToCodeEdit(y,p))}return d}mapSelectionRange(t,n){const i={textSpan:M0(t.textSpan,n)};return t.parent&&(i.parent=this.mapSelectionRange(t.parent,n)),i}getScriptInfoFromProjectService(t){const n=Ac(t),i=this.projectService.getScriptInfoForNormalizedPath(n);return i||(this.projectService.logErrorForScriptInfoNotFound(n),f1.ThrowNoProject())}toProtocolCallHierarchyItem(t){const n=this.getScriptInfoFromProjectService(t.file);return{name:t.name,kind:t.kind,kindModifiers:t.kindModifiers,file:t.file,containerName:t.containerName,span:M0(t.span,n),selectionSpan:M0(t.selectionSpan,n)}}toProtocolCallHierarchyIncomingCall(t){const n=this.getScriptInfoFromProjectService(t.from.file);return{from:this.toProtocolCallHierarchyItem(t.from),fromSpans:t.fromSpans.map(i=>M0(i,n))}}toProtocolCallHierarchyOutgoingCall(t,n){return{to:this.toProtocolCallHierarchyItem(t.to),fromSpans:t.fromSpans.map(i=>M0(i,n))}}prepareCallHierarchy(t){const{file:n,project:i}=this.getFileAndProject(t),a=this.projectService.getScriptInfoForNormalizedPath(n);if(a){const o=this.getPosition(t,a),c=i.getLanguageService().prepareCallHierarchy(n,o);return c&&QQ(c,d=>this.toProtocolCallHierarchyItem(d))}}provideCallHierarchyIncomingCalls(t){const{file:n,project:i}=this.getFileAndProject(t),a=this.getScriptInfoFromProjectService(n);return i.getLanguageService().provideCallHierarchyIncomingCalls(n,this.getPosition(t,a)).map(c=>this.toProtocolCallHierarchyIncomingCall(c))}provideCallHierarchyOutgoingCalls(t){const{file:n,project:i}=this.getFileAndProject(t),a=this.getScriptInfoFromProjectService(n);return i.getLanguageService().provideCallHierarchyOutgoingCalls(n,this.getPosition(t,a)).map(c=>this.toProtocolCallHierarchyOutgoingCall(c,a))}getCanonicalFileName(t){const n=this.host.useCaseSensitiveFileNames?t:f0(t);return co(n)}exit(){}notRequired(t){return t&&this.doOutput(void 0,t.command,t.seq,!0,this.performanceData),{responseRequired:!1,performanceData:this.performanceData}}requiredResponse(t){return{response:t,responseRequired:!0,performanceData:this.performanceData}}addProtocolHandler(t,n){if(this.handlers.has(t))throw new Error(`Protocol handler already exists for command "${t}"`);this.handlers.set(t,n)}setCurrentRequest(t){F.assert(this.currentRequestId===void 0),this.currentRequestId=t,this.cancellationToken.setRequest(t)}resetCurrentRequest(t){F.assert(this.currentRequestId===t),this.currentRequestId=void 0,this.cancellationToken.resetRequest(t)}executeWithRequestId(t,n,i){const a=this.performanceData;try{return this.performanceData=i,this.setCurrentRequest(t),n()}finally{this.resetCurrentRequest(t),this.performanceData=a}}executeCommand(t){const n=this.handlers.get(t.command);if(n){const i=this.executeWithRequestId(t.seq,()=>n(t),void 0);return this.projectService.enableRequestedPlugins(),i}else return this.logger.msg(`Unrecognized JSON command:${bT(t)}`,"Err"),this.doOutput(void 0,"unknown",t.seq,!1,void 0,`Unrecognized JSON command: ${t.command}`),{responseRequired:!1}}onMessage(t){var n,i,a,o,c,d,p;this.gcTimer.scheduleCollect();let y;const b=this.performanceData;this.logger.hasLevel(2)&&(y=this.hrtime(),this.logger.hasLevel(3)&&this.logger.info(`request:${lI(this.toStringMessage(t))}`));let S,E;try{S=this.parseMessage(t),E=S.arguments&&S.arguments.file?S.arguments:void 0,(n=Hn)==null||n.instant(Hn.Phase.Session,"request",{seq:S.seq,command:S.command}),(i=Hn)==null||i.push(Hn.Phase.Session,"executeCommand",{seq:S.seq,command:S.command},!0);const{response:A,responseRequired:O,performanceData:M}=this.executeCommand(S);if((a=Hn)==null||a.pop(),this.logger.hasLevel(2)){const L=ovt(this.hrtime(y)).toFixed(4);O?this.logger.perftrc(`${S.seq}::${S.command}: elapsed time (in milliseconds) ${L}`):this.logger.perftrc(`${S.seq}::${S.command}: async elapsed time (in milliseconds) ${L}`)}(o=Hn)==null||o.instant(Hn.Phase.Session,"response",{seq:S.seq,command:S.command,success:!!A}),A?this.doOutput(A,S.command,S.seq,!0,M):O&&this.doOutput(void 0,S.command,S.seq,!1,M,"No content available.")}catch(A){if((c=Hn)==null||c.popAll(),A instanceof c3){(d=Hn)==null||d.instant(Hn.Phase.Session,"commandCanceled",{seq:S==null?void 0:S.seq,command:S==null?void 0:S.command}),this.doOutput({canceled:!0},S.command,S.seq,!0,this.performanceData);return}this.logErrorWorker(A,this.toStringMessage(t),E),(p=Hn)==null||p.instant(Hn.Phase.Session,"commandError",{seq:S==null?void 0:S.seq,command:S==null?void 0:S.command,message:A.message}),this.doOutput(void 0,S?S.command:"unknown",S?S.seq:0,!1,this.performanceData,"Error processing request. "+A.message+`
|
|
491
|
-
`+A.stack)}finally{this.performanceData=b}}parseMessage(t){return JSON.parse(t)}toStringMessage(t){return t}getFormatOptions(t){return this.projectService.getFormatCodeOptions(t)}getPreferences(t){return this.projectService.getPreferences(t)}getHostFormatOptions(){return this.projectService.getHostFormatCodeOptions()}getHostPreferences(){return this.projectService.getHostPreferences()}};function IMe(e){const t=e.diagnosticsDuration&&ma(e.diagnosticsDuration,([n,i])=>({...i,file:n}));return{...e,diagnosticsDuration:t}}function M0(e,t){return{start:t.positionToLineOffset(e.start),end:t.positionToLineOffset(Il(e))}}function wye(e,t,n){const i=M0(e,n),a=t&&M0(t,n);return a?{...i,contextStart:a.start,contextEnd:a.end}:i}function hvt(e,t){return{start:OMe(t,e.span.start),end:OMe(t,Il(e.span)),newText:e.newText}}function OMe(e,t){return bye(e)?yvt(e.getLineAndCharacterOfPosition(t)):e.positionToLineOffset(t)}function vvt(e,t){const n=e.ranges.map(i=>({start:t.positionToLineOffset(i.start),end:t.positionToLineOffset(i.start+i.length)}));return e.wordPattern?{ranges:n,wordPattern:e.wordPattern}:{ranges:n}}function yvt(e){return{line:e.line+1,offset:e.character+1}}function bvt(e){F.assert(e.textChanges.length===1);const t=Fs(e.textChanges);return F.assert(t.span.start===0&&t.span.length===0),{fileName:e.fileName,textChanges:[{start:{line:0,offset:0},end:{line:0,offset:0},newText:t.newText}]}}function Dye(e,t,n,i){const a=Svt(e,t,i),{line:o,character:c}=_A(ww(a),n);return{line:o+1,offset:c+1}}function Svt(e,t,n){for(const{fileName:i,textChanges:a}of n)if(i===t)for(let o=a.length-1;o>=0;o--){const{newText:c,span:{start:d,length:p}}=a[o];e=e.slice(0,d)+c+e.slice(d+p)}return e}function FMe(e,{fileName:t,textSpan:n,contextSpan:i,isWriteAccess:a,isDefinition:o},{disableLineTextInReferences:c}){const d=F.checkDefined(e.getScriptInfo(t)),p=wye(n,i,d),y=c?void 0:Tvt(d,p);return{file:t,...p,lineText:y,isWriteAccess:a,isDefinition:o}}function Tvt(e,t){const n=e.lineToTextSpan(t.start.line-1);return e.getSnapshot().getText(n.start,Il(n)).replace(/\r|\n/g,"")}function xvt(e){return e===void 0||e&&typeof e=="object"&&typeof e.exportName=="string"&&(e.fileName===void 0||typeof e.fileName=="string")&&(e.ambientModuleName===void 0||typeof e.ambientModuleName=="string"&&(e.isPackageJsonImport===void 0||typeof e.isPackageJsonImport=="boolean"))}var Q4=4,Aye=(e=>(e[e.PreStart=0]="PreStart",e[e.Start=1]="Start",e[e.Entire=2]="Entire",e[e.Mid=3]="Mid",e[e.End=4]="End",e[e.PostEnd=5]="PostEnd",e))(Aye||{}),kvt=class{constructor(){this.goSubtree=!0,this.lineIndex=new a9,this.endBranch=[],this.state=2,this.initialText="",this.trailingText="",this.lineIndex.root=new K4,this.startPath=[this.lineIndex.root],this.stack=[this.lineIndex.root]}get done(){return!1}insertLines(e,t){t&&(this.trailingText=""),e?e=this.initialText+e+this.trailingText:e=this.initialText+this.trailingText;const i=a9.linesFromText(e).lines;i.length>1&&i[i.length-1]===""&&i.pop();let a,o;for(let d=this.endBranch.length-1;d>=0;d--)this.endBranch[d].updateCounts(),this.endBranch[d].charCount()===0&&(o=this.endBranch[d],d>0?a=this.endBranch[d-1]:a=this.branchNode);o&&a.remove(o);const c=this.startPath[this.startPath.length-1];if(i.length>0)if(c.text=i[0],i.length>1){let d=new Array(i.length-1),p=c;for(let S=1;S<i.length;S++)d[S-1]=new iU(i[S]);let y=this.startPath.length-2;for(;y>=0;){const S=this.startPath[y];d=S.insertAt(p,d),y--,p=S}let b=d.length;for(;b>0;){const S=new K4;S.add(this.lineIndex.root),d=S.insertAt(this.lineIndex.root,d),b=d.length,this.lineIndex.root=S}this.lineIndex.root.updateCounts()}else for(let d=this.startPath.length-2;d>=0;d--)this.startPath[d].updateCounts();else{this.startPath[this.startPath.length-2].remove(c);for(let p=this.startPath.length-2;p>=0;p--)this.startPath[p].updateCounts()}return this.lineIndex}post(e,t,n){n===this.lineCollectionAtBranch&&(this.state=4),this.stack.pop()}pre(e,t,n,i,a){const o=this.stack[this.stack.length-1];this.state===2&&a===1&&(this.state=1,this.branchNode=o,this.lineCollectionAtBranch=n);let c;function d(p){return p.isLeaf()?new iU(""):new K4}switch(a){case 0:this.goSubtree=!1,this.state!==4&&o.add(n);break;case 1:this.state===4?this.goSubtree=!1:(c=d(n),o.add(c),this.startPath.push(c));break;case 2:this.state!==4?(c=d(n),o.add(c),this.startPath.push(c)):n.isLeaf()||(c=d(n),o.add(c),this.endBranch.push(c));break;case 3:this.goSubtree=!1;break;case 4:this.state!==4?this.goSubtree=!1:n.isLeaf()||(c=d(n),o.add(c),this.endBranch.push(c));break;case 5:this.goSubtree=!1,this.state!==1&&o.add(n);break}this.goSubtree&&this.stack.push(c)}leaf(e,t,n){this.state===1?this.initialText=n.text.substring(0,e):this.state===2?(this.initialText=n.text.substring(0,e),this.trailingText=n.text.substring(e+t)):this.trailingText=n.text.substring(e+t)}},Cvt=class{constructor(e,t,n){this.pos=e,this.deleteLen=t,this.insertedText=n}getTextChangeRange(){return v7(Gf(this.pos,this.deleteLen),this.insertedText?this.insertedText.length:0)}},Cee=class fw{constructor(){this.changes=[],this.versions=new Array(fw.maxVersions),this.minVersion=0,this.currentVersion=0}versionToIndex(t){if(!(t<this.minVersion||t>this.currentVersion))return t%fw.maxVersions}currentVersionToIndex(){return this.currentVersion%fw.maxVersions}edit(t,n,i){this.changes.push(new Cvt(t,n,i)),(this.changes.length>fw.changeNumberThreshold||n>fw.changeLengthThreshold||i&&i.length>fw.changeLengthThreshold)&&this.getSnapshot()}getSnapshot(){return this._getSnapshot()}_getSnapshot(){let t=this.versions[this.currentVersionToIndex()];if(this.changes.length>0){let n=t.index;for(const i of this.changes)n=n.edit(i.pos,i.deleteLen,i.insertedText);t=new MMe(this.currentVersion+1,this,n,this.changes),this.currentVersion=t.version,this.versions[this.currentVersionToIndex()]=t,this.changes=[],this.currentVersion-this.minVersion>=fw.maxVersions&&(this.minVersion=this.currentVersion-fw.maxVersions+1)}return t}getSnapshotVersion(){return this._getSnapshot().version}getAbsolutePositionAndLineText(t){return this._getSnapshot().index.lineNumberToInfo(t)}lineOffsetToPosition(t,n){return this._getSnapshot().index.absolutePositionOfStartOfLine(t)+(n-1)}positionToLineOffset(t){return this._getSnapshot().index.positionToLineOffset(t)}lineToTextSpan(t){const n=this._getSnapshot().index,{lineText:i,absolutePosition:a}=n.lineNumberToInfo(t+1),o=i!==void 0?i.length:n.absolutePositionOfStartOfLine(t+2)-a;return Gf(a,o)}getTextChangesBetweenVersions(t,n){if(t<n)if(t>=this.minVersion){const i=[];for(let a=t+1;a<=n;a++){const o=this.versions[this.versionToIndex(a)];for(const c of o.changesSincePreviousVersion)i.push(c.getTextChangeRange())}return use(i)}else return;else return TL}getLineCount(){return this._getSnapshot().index.getLineCount()}static fromString(t){const n=new fw,i=new MMe(0,n,new a9);n.versions[n.currentVersion]=i;const a=a9.linesFromText(t);return i.index.load(a.lines),n}};Cee.changeNumberThreshold=8,Cee.changeLengthThreshold=256,Cee.maxVersions=8;var Eee=Cee,MMe=class gQe{constructor(t,n,i,a=of){this.version=t,this.cache=n,this.index=i,this.changesSincePreviousVersion=a}getText(t,n){return this.index.getText(t,n-t)}getLength(){return this.index.getLength()}getChangeRange(t){if(t instanceof gQe&&this.cache===t.cache)return this.version<=t.version?TL:this.cache.getTextChangesBetweenVersions(t.version,this.version)}},a9=class jTe{constructor(){this.checkEdits=!1}absolutePositionOfStartOfLine(t){return this.lineNumberToInfo(t).absolutePosition}positionToLineOffset(t){const{oneBasedLine:n,zeroBasedColumn:i}=this.root.charOffsetToLineInfo(1,t);return{line:n,offset:i+1}}positionToColumnAndLineText(t){return this.root.charOffsetToLineInfo(1,t)}getLineCount(){return this.root.lineCount()}lineNumberToInfo(t){const n=this.getLineCount();if(t<=n){const{position:i,leaf:a}=this.root.lineNumberToInfo(t,0);return{absolutePosition:i,lineText:a&&a.text}}else return{absolutePosition:this.root.charCount(),lineText:void 0}}load(t){if(t.length>0){const n=[];for(let i=0;i<t.length;i++)n[i]=new iU(t[i]);this.root=jTe.buildTreeFromBottom(n)}else this.root=new K4}walk(t,n,i){this.root.walk(t,n,i)}getText(t,n){let i="";return n>0&&t<this.root.charCount()&&this.walk(t,n,{goSubtree:!0,done:!1,leaf:(a,o,c)=>{i=i.concat(c.text.substring(a,a+o))}}),i}getLength(){return this.root.charCount()}every(t,n,i){i||(i=this.root.charCount());const a={goSubtree:!0,done:!1,leaf(o,c,d){t(d,o,c)||(this.done=!0)}};return this.walk(n,i-n,a),!a.done}edit(t,n,i){if(this.root.charCount()===0)return F.assert(n===0),i!==void 0?(this.load(jTe.linesFromText(i).lines),this):void 0;{let a;if(this.checkEdits){const d=this.getText(0,this.root.charCount());a=d.slice(0,t)+i+d.slice(t+n)}const o=new kvt;let c=!1;if(t>=this.root.charCount()){t=this.root.charCount()-1;const d=this.getText(t,1);i?i=d+i:i=d,n=0,c=!0}else if(n>0){const d=t+n,{zeroBasedColumn:p,lineText:y}=this.positionToColumnAndLineText(d);p===0&&(n+=y.length,i=i?i+y:y)}if(this.root.walk(t,n,o),o.insertLines(i,c),this.checkEdits){const d=o.lineIndex.getText(0,o.lineIndex.getLength());F.assert(a===d,"buffer edit mismatch")}return o.lineIndex}}static buildTreeFromBottom(t){if(t.length<Q4)return new K4(t);const n=new Array(Math.ceil(t.length/Q4));let i=0;for(let a=0;a<n.length;a++){const o=Math.min(i+Q4,t.length);n[a]=new K4(t.slice(i,o)),i=o}return this.buildTreeFromBottom(n)}static linesFromText(t){const n=ww(t);if(n.length===0)return{lines:[],lineMap:n};const i=new Array(n.length),a=n.length-1;for(let c=0;c<a;c++)i[c]=t.substring(n[c],n[c+1]);const o=t.substring(n[a]);return o.length>0?i[a]=o:i.pop(),{lines:i,lineMap:n}}},K4=class BTe{constructor(t=[]){this.children=t,this.totalChars=0,this.totalLines=0,t.length&&this.updateCounts()}isLeaf(){return!1}updateCounts(){this.totalChars=0,this.totalLines=0;for(const t of this.children)this.totalChars+=t.charCount(),this.totalLines+=t.lineCount()}execWalk(t,n,i,a,o){return i.pre&&i.pre(t,n,this.children[a],this,o),i.goSubtree?(this.children[a].walk(t,n,i),i.post&&i.post(t,n,this.children[a],this,o)):i.goSubtree=!0,i.done}skipChild(t,n,i,a,o){a.pre&&!a.done&&(a.pre(t,n,this.children[i],this,o),a.goSubtree=!0)}walk(t,n,i){if(this.children.length===0)return;let a=0,o=this.children[a].charCount(),c=t;for(;c>=o;)this.skipChild(c,n,a,i,0),c-=o,a++,o=this.children[a].charCount();if(c+n<=o){if(this.execWalk(c,n,i,a,2))return}else{if(this.execWalk(c,o-c,i,a,1))return;let d=n-(o-c);for(a++,o=this.children[a].charCount();d>o;){if(this.execWalk(0,o,i,a,3))return;d-=o,a++,o=this.children[a].charCount()}if(d>0&&this.execWalk(0,d,i,a,4))return}if(i.pre){const d=this.children.length;if(a<d-1)for(let p=a+1;p<d;p++)this.skipChild(0,0,p,i,5)}}charOffsetToLineInfo(t,n){if(this.children.length===0)return{oneBasedLine:t,zeroBasedColumn:n,lineText:void 0};for(const o of this.children){if(o.charCount()>n)return o.isLeaf()?{oneBasedLine:t,zeroBasedColumn:n,lineText:o.text}:o.charOffsetToLineInfo(t,n);n-=o.charCount(),t+=o.lineCount()}const i=this.lineCount();if(i===0)return{oneBasedLine:1,zeroBasedColumn:0,lineText:void 0};const a=F.checkDefined(this.lineNumberToInfo(i,0).leaf);return{oneBasedLine:i,zeroBasedColumn:a.charCount(),lineText:void 0}}lineNumberToInfo(t,n){for(const i of this.children){const a=i.lineCount();if(a>=t)return i.isLeaf()?{position:n,leaf:i}:i.lineNumberToInfo(t,n);t-=a,n+=i.charCount()}return{position:n,leaf:void 0}}splitAfter(t){let n;const i=this.children.length;t++;const a=t;if(t<i){for(n=new BTe;t<i;)n.add(this.children[t]),t++;n.updateCounts()}return this.children.length=a,n}remove(t){const n=this.findChildIndex(t),i=this.children.length;if(n<i-1)for(let a=n;a<i-1;a++)this.children[a]=this.children[a+1];this.children.pop()}findChildIndex(t){const n=this.children.indexOf(t);return F.assert(n!==-1),n}insertAt(t,n){let i=this.findChildIndex(t);const a=this.children.length,o=n.length;if(a<Q4&&i===a-1&&o===1)return this.add(n[0]),this.updateCounts(),[];{const c=this.splitAfter(i);let d=0;for(i++;i<Q4&&d<o;)this.children[i]=n[d],i++,d++;let p=[],y=0;if(d<o){y=Math.ceil((o-d)/Q4),p=new Array(y);let b=0;for(let E=0;E<y;E++)p[E]=new BTe;let S=p[0];for(;d<o;)S.add(n[d]),d++,S.children.length===Q4&&(b++,S=p[b]);for(let E=p.length-1;E>=0;E--)p[E].children.length===0&&p.pop()}c&&p.push(c),this.updateCounts();for(let b=0;b<y;b++)p[b].updateCounts();return p}}add(t){this.children.push(t),F.assert(this.children.length<=Q4)}charCount(){return this.totalChars}lineCount(){return this.totalLines}},iU=class{constructor(e){this.text=e}isLeaf(){return!0}walk(e,t,n){n.leaf(e,t,this)}charCount(){return this.text.length}lineCount(){return 1}},LMe=class hQe{constructor(t,n,i,a,o,c){this.telemetryEnabled=t,this.logger=n,this.host=i,this.globalTypingsCacheLocation=a,this.event=o,this.maxActiveRequestCount=c,this.activeRequestCount=0,this.requestQueue=Op(),this.requestMap=new Map,this.requestedRegistry=!1,this.packageInstallId=0}isKnownTypesPackageName(t){var n;return K2.validatePackageName(t)!==K2.NameValidationResult.Ok?!1:(this.requestedRegistry||(this.requestedRegistry=!0,this.installer.send({kind:"typesRegistry"})),!!((n=this.typesRegistryCache)!=null&&n.has(t)))}installPackage(t){this.packageInstallId++;const n={kind:"installPackage",...t,id:this.packageInstallId},i=new Promise((a,o)=>{(this.packageInstalledPromise??(this.packageInstalledPromise=new Map)).set(this.packageInstallId,{resolve:a,reject:o})});return this.installer.send(n),i}attach(t){this.projectService=t,this.installer=this.createInstallerProcess()}onProjectClosed(t){this.installer.send({projectName:t.getProjectName(),kind:"closeProject"})}enqueueInstallTypingsRequest(t,n,i){const a=Lve(t,n,i);this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling throttled operation:${bT(a)}`),this.activeRequestCount<this.maxActiveRequestCount?this.scheduleRequest(a):(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Deferring request for: ${a.projectName}`),this.requestQueue.enqueue(a),this.requestMap.set(a.projectName,a))}handleMessage(t){var n,i;switch(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Received response:${bT(t)}`),t.kind){case GX:this.typesRegistryCache=new Map(Object.entries(t.typesRegistry));break;case T$:{const a=(n=this.packageInstalledPromise)==null?void 0:n.get(t.id);F.assertIsDefined(a,"Should find the promise for package install"),(i=this.packageInstalledPromise)==null||i.delete(t.id),t.success?a.resolve({successMessage:t.message}):a.reject(t.message),this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case $pe:{const a={message:t.message};this.event(a,"typesInstallerInitializationFailed");break}case YX:{const a={eventId:t.eventId,packages:t.packagesToInstall};this.event(a,"beginInstallTypes");break}case XX:{if(this.telemetryEnabled){const c={telemetryEventName:"typingsInstalled",payload:{installedPackages:t.packagesToInstall.join(","),installSuccess:t.installSuccess,typingsInstallerVersion:t.typingsInstallerVersion}};this.event(c,"telemetry")}const a={eventId:t.eventId,packages:t.packagesToInstall,success:t.installSuccess};this.event(a,"endInstallTypes");break}case S$:{this.projectService.updateTypingsForProject(t);break}case b$:{for(this.activeRequestCount>0?this.activeRequestCount--:F.fail("TIAdapter:: Received too many responses");!this.requestQueue.isEmpty();){const a=this.requestQueue.dequeue();if(this.requestMap.get(a.projectName)===a){this.requestMap.delete(a.projectName),this.scheduleRequest(a);break}this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Skipping defunct request for: ${a.projectName}`)}this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case ZF:this.projectService.watchTypingLocations(t);break}}scheduleRequest(t){this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling request for: ${t.projectName}`),this.activeRequestCount++,this.host.setTimeout(()=>{this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Sending request:${bT(t)}`),this.installer.send(t)},hQe.requestDelayMillis,`${t.projectName}::${t.kind}`)}};LMe.requestDelayMillis=100;var RMe=LMe,jMe={};x(jMe,{ActionInvalidate:()=>S$,ActionPackageInstalled:()=>T$,ActionSet:()=>b$,ActionWatchTypingLocations:()=>ZF,Arguments:()=>QX,AutoImportProviderProject:()=>nye,AuxiliaryProject:()=>tye,CharRangeSection:()=>Aye,CloseFileWatcherEvent:()=>dee,CommandNames:()=>xMe,ConfigFileDiagEvent:()=>lee,ConfiguredProject:()=>iye,ConfiguredProjectLoadKind:()=>uye,CreateDirectoryWatcherEvent:()=>pee,CreateFileWatcherEvent:()=>_ee,Errors:()=>f1,EventBeginInstallTypes:()=>YX,EventEndInstallTypes:()=>XX,EventInitializationFailed:()=>$pe,EventTypesRegistry:()=>GX,ExternalProject:()=>nee,GcTimer:()=>zve,InferredProject:()=>eye,LargeFileReferencedEvent:()=>cee,LineIndex:()=>a9,LineLeaf:()=>iU,LineNode:()=>K4,LogLevel:()=>Fve,Msg:()=>Mve,OpenFileInfoTelemetryEvent:()=>aye,Project:()=>QD,ProjectInfoTelemetryEvent:()=>fee,ProjectKind:()=>jI,ProjectLanguageServiceStateEvent:()=>uee,ProjectLoadingFinishEvent:()=>oee,ProjectLoadingStartEvent:()=>see,ProjectService:()=>yye,ProjectsUpdatedInBackgroundEvent:()=>tU,ScriptInfo:()=>Hve,ScriptVersionCache:()=>Eee,Session:()=>NMe,TextStorage:()=>Wve,ThrottledOperations:()=>Uve,TypingsInstallerAdapter:()=>RMe,allFilesAreJsOrDts:()=>Qve,allRootFilesAreJsOrDts:()=>Xve,asNormalizedPath:()=>Y9e,convertCompilerOptions:()=>rU,convertFormatOptions:()=>Y4,convertScriptKindName:()=>gee,convertTypeAcquisition:()=>oye,convertUserPreferences:()=>cye,convertWatchOptions:()=>n9,countEachFileTypes:()=>Z5,createInstallTypingsRequest:()=>Lve,createModuleSpecifierCache:()=>Tye,createNormalizedPathMap:()=>X9e,createPackageJsonCache:()=>xye,createSortedArray:()=>Jve,emptyArray:()=>of,findArgument:()=>XAe,formatDiagnosticToProtocol:()=>i9,formatMessage:()=>kye,getBaseConfigFileName:()=>ree,getDetailWatchInfo:()=>bee,getLocationInNewDocument:()=>Dye,hasArgument:()=>YAe,hasNoTypeScriptSource:()=>Kve,indent:()=>lI,isBackgroundProject:()=>t9,isConfigFile:()=>bye,isConfiguredProject:()=>Db,isDynamicFileName:()=>RI,isExternalProject:()=>e9,isInferredProject:()=>G4,isInferredProjectName:()=>Rve,isProjectDeferredClose:()=>r9,makeAutoImportProviderProjectName:()=>Bve,makeAuxiliaryProjectName:()=>$ve,makeInferredProjectName:()=>jve,maxFileSize:()=>aee,maxProgramSizeForNonTsFiles:()=>iee,normalizedPathToPath:()=>H4,nowString:()=>QAe,nullCancellationToken:()=>bMe,nullTypingsInstaller:()=>nU,protocol:()=>qve,scriptInfoIsContainedByBackgroundProject:()=>Gve,scriptInfoIsContainedByDeferredClosedProject:()=>Yve,stringifyIndented:()=>bT,toEvent:()=>Cye,toNormalizedPath:()=>Ac,tryConvertScriptKindName:()=>mee,typingsInstaller:()=>Ove,updateProjectIfDirty:()=>jg}),typeof console<"u"&&(F.loggingHost={log(e,t){switch(e){case 1:return console.error(t);case 2:return console.warn(t);case 3:return console.log(t);case 4:return console.log(t)}}})})({get exports(){return u},set exports(_){u=_,l.exports&&(l.exports=_)}})})(ZSe)),ZSe.exports}enr();const tnr=oA({name:"PartnerPickerElement",setup(l,u){const{value:_}=u.element,g=w.ref(""),x=w.ref("");w.watch(_,W=>{W&&I(W)},{deep:!0});const D=exports.ppeconfig.onFetchData,I=W=>{W&&exports.ppeconfig.onFetchData(W,$)},$=(W,ee,R)=>{g.value=ee,x.value=R,_.value!=W&&(_.value=W)};return{logoUrl:g,pname:x,value:_,fetchData:I,onFetchData:D,gotData:$}}}),rnr={class:"d-flex flex-column flex-md-row gap-2"},nnr={class:"d-flex flex-row gap-2 w-100"},inr=["src"],anr={class:"w-100"},snr=["value"],onr={class:"w-100"},cnr=["value"];function lnr(l,u,_,g,x,D){const I=w.resolveComponent("ElementLayout");return w.openBlock(),w.createBlock(I,null,w.createSlots({element:w.withCtx(()=>[w.createElementVNode("div",rnr,[w.createElementVNode("div",nnr,[w.createElementVNode("img",{class:"partner-picker__logo__preview",alt:"",src:l.logoUrl},null,8,inr),w.createElementVNode("div",anr,[w.createElementVNode("input",{type:"text",class:"form-control",value:l.pname,disabled:"",placeholder:"Neve"},null,8,snr)])]),w.createElementVNode("div",onr,[w.createElementVNode("input",{id:"partner-id",type:"text",class:"form-control",value:l.value,onChange:u[0]||(u[0]=$=>l.fetchData($.target.value)),placeholder:"Azonoító"},null,40,cnr)])])]),_:2},[w.renderList(l.elementSlots,($,W)=>({name:W,fn:w.withCtx(()=>[w.renderSlot(l.$slots,W,{el$:l.el$},()=>[(w.openBlock(),w.createBlock(w.resolveDynamicComponent($),{el$:l.el$},null,8,["el$"]))])])}))]),1024)}const unr=sC(tnr,[["render",lnr]]);exports.gisConfig=void 0;const fnr=l=>(exports.gisConfig=l,exports.gisConfig),_nr=oA({name:"GalleryImageSelectorElement",setup(l,u){const{value:_}=u.element,g=w.ref([]),x=W=>{_.value.activeImageIndex=0,_.value.galleryId=W.target.value,exports.gisConfig.onFetchGallery(W.target.value,ee=>{g.value=ee.items||[],$()})};w.watch(()=>_.value,(W,ee)=>{!W||(W==null?void 0:W.galleryId)===(ee==null?void 0:ee.galleryId)||exports.gisConfig.onFetchGallery(W==null?void 0:W.galleryId,R=>{g.value=R.items||[],$()})},{immediate:!0,deep:!0});const D=W=>{_.value.activeImageIndex=W.target.value,$()},I=w.ref(),$=()=>{var W;if(g.value&&_.value.activeImageIndex>=0){const ee=(W=g.value[_.value.activeImageIndex])==null?void 0:W.url;I.value=ee;return}I.value=null};return{onGalleryIdChanged:x,onActiveIndexChanged:D,imageUrl:I,value:_}}}),pnr={key:0},dnr=["src"],mnr={key:1},gnr=["value"],hnr=["value"];function vnr(l,u,_,g,x,D){const I=w.resolveComponent("ElementLayout");return w.openBlock(),w.createBlock(I,null,w.createSlots({_:2},[l.value?{name:"element",fn:w.withCtx(()=>[l.imageUrl?(w.openBlock(),w.createElementBlock("div",pnr,[w.createElementVNode("img",{class:"gallery__preview",alt:"",src:l.imageUrl},null,8,dnr)])):w.createCommentVNode("",!0),l.imageUrl?w.createCommentVNode("",!0):(w.openBlock(),w.createElementBlock("div",mnr,[...u[2]||(u[2]=[w.createElementVNode("p",{class:"gallery__preview-empty"},"Nincs kép kiválasztva!",-1)])])),w.createElementVNode("div",null,[u[3]||(u[3]=w.createElementVNode("label",{for:"galleryId",class:"form-label"},"Galéria azonosító",-1)),w.createElementVNode("input",{type:"text",id:"galleryId",placeholder:"Galéria azonosító",class:"form-control",value:l.value.galleryId,onInput:u[0]||(u[0]=$=>l.onGalleryIdChanged($))},null,40,gnr)]),w.createElementVNode("div",null,[u[4]||(u[4]=w.createElementVNode("label",{for:"activeImageIndex",class:"form-label"},"Aktív kép index",-1)),w.createElementVNode("input",{type:"number",id:"activeImageIndex",placeholder:"Aktív kép index",class:"form-control",value:l.value.activeImageIndex,onInput:u[1]||(u[1]=$=>l.onActiveIndexChanged($))},null,40,hnr)])]),key:"0"}:void 0,w.renderList(l.elementSlots,($,W)=>({name:W,fn:w.withCtx(()=>[w.renderSlot(l.$slots,W,{el$:l.el$},()=>[(w.openBlock(),w.createBlock(w.resolveDynamicComponent($),{el$:l.el$},null,8,["el$"]))])])}))]),1024)}const ynr=sC(_nr,[["render",vnr]]);function bnr(l){window.dispatchEvent(new CustomEvent("toast-notification-message",{detail:l}))}function Snr(l,u,_,g){Tnr(u,_).then(x=>{l.use(z6t,{config:{url:x.url,realm:x.realm,clientId:g},init:{onLoad:"login-required",checkLoginIframe:!!x.silentSsoCheckUrl,silentCheckSsoRedirectUri:x.silentSsoCheckUrl}})})}async function Tnr(l,u){const _=Kqe(l);return new Promise((g,x)=>{_.getKeycloakConfig.successCallback=D=>{const I=D.environments.find($=>$.name===u);I?g(I):x(`No matching environment was found in response for ${u}`)},_.getKeycloakConfig.execute()})}const xnr={CheckBox:nq,CheckBoxList:Wqe,DropDown:BM,DropDownButton:Hqe,DropDownMenu:Ine,DropDownCallBack:$Te,ExternalArticleOfferComponent:YTe,FilterCompact:JTe,FilterControl:zTe,IconButton:L8,ImagePickerComponent:$M,InternalArticleOfferComponent:GTe,PaginatorControl:qTe,RadioButton:VTe,RadioButtonGroup:tVe,SpinningProgress:WTe,TableToList:rVe,TableToListOptions:nVe,TextListBox:iVe,ToastComponent:HTe,ToastWrapper:aVe,CalendarComponent:UTe,HeaderComponent:sVe},knr={install(l){Object.entries(xnr).forEach(([u,_])=>{l.component(u,_)})}};exports.ArticleEditorService=eVe;exports.ArticleOfferElement=frr;exports.ArticlePickerElement=Irr;exports.CalendarComponent=UTe;exports.CheckBox=nq;exports.CheckBoxList=Wqe;exports.ConfigService=Zqe;exports.DateTimePickerElement=Yrr;exports.DropDown=BM;exports.DropDownButton=Hqe;exports.DropDownCallBack=$Te;exports.DropDownMenu=Ine;exports.ExternalArticleOfferComponent=YTe;exports.ExternalArticleOfferElement=Wrr;exports.FetchDetails=JP;exports.FetchError=One;exports.FilterCompact=JTe;exports.FilterControl=zTe;exports.FilterDate=YAt;exports.FilterDropDown=GAt;exports.FilterText=HAt;exports.GalleryImageSelectorElement=ynr;exports.HeaderComponent=sVe;exports.IconButton=L8;exports.ImagePickerComponent=$M;exports.ImagePickerDetailsElement=jrr;exports.ImagePickerElement=Mrr;exports.InternalArticleOfferComponent=GTe;exports.InternalArticleOfferElement=Urr;exports.Methods=_w;exports.PaginatorControl=qTe;exports.PartnerPickerElement=unr;exports.RadioButton=VTe;exports.RadioButtonGroup=tVe;exports.SpinningProgress=WTe;exports.TableToList=rVe;exports.TableToListOptions=nVe;exports.TableToListOptionsPersister=iTe;exports.TextListBox=iVe;exports.ToastComponent=HTe;exports.ToastWrapper=aVe;exports.configureArticleOfferElement=err;exports.configureArticlePickerElement=_rr;exports.configureExternalArticleOfferElement=zrr;exports.configureGalleryImageSelectorElement=fnr;exports.configureImagePickerElement=prr;exports.configureInternalArticleOfferElement=Brr;exports.configurePartnerPickerElement=Xrr;exports.debounce=dAt;exports.default=knr;exports.initRequest=UP;exports.localDateTimeToDate=pAt;exports.localDateTimeToUTC=fAt;exports.localDateTimeToUTCDate=_At;exports.localToDateStr=iq;exports.localToStr=Qqe;exports.localToUtcStr=_ne;exports.sendMsgToToast=bnr;exports.toDateString=oAt;exports.toDateStringFromUtc=uAt;exports.toDateTimeString=cAt;exports.toDateTimeStringFromUtc=lAt;exports.useAdminKeycloak=Snr;exports.useArticleEditorService=mAt;exports.useConfigService=Kqe;
|
|
491
|
+
`+A.stack)}finally{this.performanceData=b}}parseMessage(t){return JSON.parse(t)}toStringMessage(t){return t}getFormatOptions(t){return this.projectService.getFormatCodeOptions(t)}getPreferences(t){return this.projectService.getPreferences(t)}getHostFormatOptions(){return this.projectService.getHostFormatCodeOptions()}getHostPreferences(){return this.projectService.getHostPreferences()}};function IMe(e){const t=e.diagnosticsDuration&&ma(e.diagnosticsDuration,([n,i])=>({...i,file:n}));return{...e,diagnosticsDuration:t}}function M0(e,t){return{start:t.positionToLineOffset(e.start),end:t.positionToLineOffset(Il(e))}}function wye(e,t,n){const i=M0(e,n),a=t&&M0(t,n);return a?{...i,contextStart:a.start,contextEnd:a.end}:i}function hvt(e,t){return{start:OMe(t,e.span.start),end:OMe(t,Il(e.span)),newText:e.newText}}function OMe(e,t){return bye(e)?yvt(e.getLineAndCharacterOfPosition(t)):e.positionToLineOffset(t)}function vvt(e,t){const n=e.ranges.map(i=>({start:t.positionToLineOffset(i.start),end:t.positionToLineOffset(i.start+i.length)}));return e.wordPattern?{ranges:n,wordPattern:e.wordPattern}:{ranges:n}}function yvt(e){return{line:e.line+1,offset:e.character+1}}function bvt(e){F.assert(e.textChanges.length===1);const t=Fs(e.textChanges);return F.assert(t.span.start===0&&t.span.length===0),{fileName:e.fileName,textChanges:[{start:{line:0,offset:0},end:{line:0,offset:0},newText:t.newText}]}}function Dye(e,t,n,i){const a=Svt(e,t,i),{line:o,character:c}=_A(ww(a),n);return{line:o+1,offset:c+1}}function Svt(e,t,n){for(const{fileName:i,textChanges:a}of n)if(i===t)for(let o=a.length-1;o>=0;o--){const{newText:c,span:{start:d,length:p}}=a[o];e=e.slice(0,d)+c+e.slice(d+p)}return e}function FMe(e,{fileName:t,textSpan:n,contextSpan:i,isWriteAccess:a,isDefinition:o},{disableLineTextInReferences:c}){const d=F.checkDefined(e.getScriptInfo(t)),p=wye(n,i,d),y=c?void 0:Tvt(d,p);return{file:t,...p,lineText:y,isWriteAccess:a,isDefinition:o}}function Tvt(e,t){const n=e.lineToTextSpan(t.start.line-1);return e.getSnapshot().getText(n.start,Il(n)).replace(/\r|\n/g,"")}function xvt(e){return e===void 0||e&&typeof e=="object"&&typeof e.exportName=="string"&&(e.fileName===void 0||typeof e.fileName=="string")&&(e.ambientModuleName===void 0||typeof e.ambientModuleName=="string"&&(e.isPackageJsonImport===void 0||typeof e.isPackageJsonImport=="boolean"))}var Q4=4,Aye=(e=>(e[e.PreStart=0]="PreStart",e[e.Start=1]="Start",e[e.Entire=2]="Entire",e[e.Mid=3]="Mid",e[e.End=4]="End",e[e.PostEnd=5]="PostEnd",e))(Aye||{}),kvt=class{constructor(){this.goSubtree=!0,this.lineIndex=new a9,this.endBranch=[],this.state=2,this.initialText="",this.trailingText="",this.lineIndex.root=new K4,this.startPath=[this.lineIndex.root],this.stack=[this.lineIndex.root]}get done(){return!1}insertLines(e,t){t&&(this.trailingText=""),e?e=this.initialText+e+this.trailingText:e=this.initialText+this.trailingText;const i=a9.linesFromText(e).lines;i.length>1&&i[i.length-1]===""&&i.pop();let a,o;for(let d=this.endBranch.length-1;d>=0;d--)this.endBranch[d].updateCounts(),this.endBranch[d].charCount()===0&&(o=this.endBranch[d],d>0?a=this.endBranch[d-1]:a=this.branchNode);o&&a.remove(o);const c=this.startPath[this.startPath.length-1];if(i.length>0)if(c.text=i[0],i.length>1){let d=new Array(i.length-1),p=c;for(let S=1;S<i.length;S++)d[S-1]=new iU(i[S]);let y=this.startPath.length-2;for(;y>=0;){const S=this.startPath[y];d=S.insertAt(p,d),y--,p=S}let b=d.length;for(;b>0;){const S=new K4;S.add(this.lineIndex.root),d=S.insertAt(this.lineIndex.root,d),b=d.length,this.lineIndex.root=S}this.lineIndex.root.updateCounts()}else for(let d=this.startPath.length-2;d>=0;d--)this.startPath[d].updateCounts();else{this.startPath[this.startPath.length-2].remove(c);for(let p=this.startPath.length-2;p>=0;p--)this.startPath[p].updateCounts()}return this.lineIndex}post(e,t,n){n===this.lineCollectionAtBranch&&(this.state=4),this.stack.pop()}pre(e,t,n,i,a){const o=this.stack[this.stack.length-1];this.state===2&&a===1&&(this.state=1,this.branchNode=o,this.lineCollectionAtBranch=n);let c;function d(p){return p.isLeaf()?new iU(""):new K4}switch(a){case 0:this.goSubtree=!1,this.state!==4&&o.add(n);break;case 1:this.state===4?this.goSubtree=!1:(c=d(n),o.add(c),this.startPath.push(c));break;case 2:this.state!==4?(c=d(n),o.add(c),this.startPath.push(c)):n.isLeaf()||(c=d(n),o.add(c),this.endBranch.push(c));break;case 3:this.goSubtree=!1;break;case 4:this.state!==4?this.goSubtree=!1:n.isLeaf()||(c=d(n),o.add(c),this.endBranch.push(c));break;case 5:this.goSubtree=!1,this.state!==1&&o.add(n);break}this.goSubtree&&this.stack.push(c)}leaf(e,t,n){this.state===1?this.initialText=n.text.substring(0,e):this.state===2?(this.initialText=n.text.substring(0,e),this.trailingText=n.text.substring(e+t)):this.trailingText=n.text.substring(e+t)}},Cvt=class{constructor(e,t,n){this.pos=e,this.deleteLen=t,this.insertedText=n}getTextChangeRange(){return v7(Gf(this.pos,this.deleteLen),this.insertedText?this.insertedText.length:0)}},Cee=class fw{constructor(){this.changes=[],this.versions=new Array(fw.maxVersions),this.minVersion=0,this.currentVersion=0}versionToIndex(t){if(!(t<this.minVersion||t>this.currentVersion))return t%fw.maxVersions}currentVersionToIndex(){return this.currentVersion%fw.maxVersions}edit(t,n,i){this.changes.push(new Cvt(t,n,i)),(this.changes.length>fw.changeNumberThreshold||n>fw.changeLengthThreshold||i&&i.length>fw.changeLengthThreshold)&&this.getSnapshot()}getSnapshot(){return this._getSnapshot()}_getSnapshot(){let t=this.versions[this.currentVersionToIndex()];if(this.changes.length>0){let n=t.index;for(const i of this.changes)n=n.edit(i.pos,i.deleteLen,i.insertedText);t=new MMe(this.currentVersion+1,this,n,this.changes),this.currentVersion=t.version,this.versions[this.currentVersionToIndex()]=t,this.changes=[],this.currentVersion-this.minVersion>=fw.maxVersions&&(this.minVersion=this.currentVersion-fw.maxVersions+1)}return t}getSnapshotVersion(){return this._getSnapshot().version}getAbsolutePositionAndLineText(t){return this._getSnapshot().index.lineNumberToInfo(t)}lineOffsetToPosition(t,n){return this._getSnapshot().index.absolutePositionOfStartOfLine(t)+(n-1)}positionToLineOffset(t){return this._getSnapshot().index.positionToLineOffset(t)}lineToTextSpan(t){const n=this._getSnapshot().index,{lineText:i,absolutePosition:a}=n.lineNumberToInfo(t+1),o=i!==void 0?i.length:n.absolutePositionOfStartOfLine(t+2)-a;return Gf(a,o)}getTextChangesBetweenVersions(t,n){if(t<n)if(t>=this.minVersion){const i=[];for(let a=t+1;a<=n;a++){const o=this.versions[this.versionToIndex(a)];for(const c of o.changesSincePreviousVersion)i.push(c.getTextChangeRange())}return use(i)}else return;else return TL}getLineCount(){return this._getSnapshot().index.getLineCount()}static fromString(t){const n=new fw,i=new MMe(0,n,new a9);n.versions[n.currentVersion]=i;const a=a9.linesFromText(t);return i.index.load(a.lines),n}};Cee.changeNumberThreshold=8,Cee.changeLengthThreshold=256,Cee.maxVersions=8;var Eee=Cee,MMe=class gQe{constructor(t,n,i,a=of){this.version=t,this.cache=n,this.index=i,this.changesSincePreviousVersion=a}getText(t,n){return this.index.getText(t,n-t)}getLength(){return this.index.getLength()}getChangeRange(t){if(t instanceof gQe&&this.cache===t.cache)return this.version<=t.version?TL:this.cache.getTextChangesBetweenVersions(t.version,this.version)}},a9=class jTe{constructor(){this.checkEdits=!1}absolutePositionOfStartOfLine(t){return this.lineNumberToInfo(t).absolutePosition}positionToLineOffset(t){const{oneBasedLine:n,zeroBasedColumn:i}=this.root.charOffsetToLineInfo(1,t);return{line:n,offset:i+1}}positionToColumnAndLineText(t){return this.root.charOffsetToLineInfo(1,t)}getLineCount(){return this.root.lineCount()}lineNumberToInfo(t){const n=this.getLineCount();if(t<=n){const{position:i,leaf:a}=this.root.lineNumberToInfo(t,0);return{absolutePosition:i,lineText:a&&a.text}}else return{absolutePosition:this.root.charCount(),lineText:void 0}}load(t){if(t.length>0){const n=[];for(let i=0;i<t.length;i++)n[i]=new iU(t[i]);this.root=jTe.buildTreeFromBottom(n)}else this.root=new K4}walk(t,n,i){this.root.walk(t,n,i)}getText(t,n){let i="";return n>0&&t<this.root.charCount()&&this.walk(t,n,{goSubtree:!0,done:!1,leaf:(a,o,c)=>{i=i.concat(c.text.substring(a,a+o))}}),i}getLength(){return this.root.charCount()}every(t,n,i){i||(i=this.root.charCount());const a={goSubtree:!0,done:!1,leaf(o,c,d){t(d,o,c)||(this.done=!0)}};return this.walk(n,i-n,a),!a.done}edit(t,n,i){if(this.root.charCount()===0)return F.assert(n===0),i!==void 0?(this.load(jTe.linesFromText(i).lines),this):void 0;{let a;if(this.checkEdits){const d=this.getText(0,this.root.charCount());a=d.slice(0,t)+i+d.slice(t+n)}const o=new kvt;let c=!1;if(t>=this.root.charCount()){t=this.root.charCount()-1;const d=this.getText(t,1);i?i=d+i:i=d,n=0,c=!0}else if(n>0){const d=t+n,{zeroBasedColumn:p,lineText:y}=this.positionToColumnAndLineText(d);p===0&&(n+=y.length,i=i?i+y:y)}if(this.root.walk(t,n,o),o.insertLines(i,c),this.checkEdits){const d=o.lineIndex.getText(0,o.lineIndex.getLength());F.assert(a===d,"buffer edit mismatch")}return o.lineIndex}}static buildTreeFromBottom(t){if(t.length<Q4)return new K4(t);const n=new Array(Math.ceil(t.length/Q4));let i=0;for(let a=0;a<n.length;a++){const o=Math.min(i+Q4,t.length);n[a]=new K4(t.slice(i,o)),i=o}return this.buildTreeFromBottom(n)}static linesFromText(t){const n=ww(t);if(n.length===0)return{lines:[],lineMap:n};const i=new Array(n.length),a=n.length-1;for(let c=0;c<a;c++)i[c]=t.substring(n[c],n[c+1]);const o=t.substring(n[a]);return o.length>0?i[a]=o:i.pop(),{lines:i,lineMap:n}}},K4=class BTe{constructor(t=[]){this.children=t,this.totalChars=0,this.totalLines=0,t.length&&this.updateCounts()}isLeaf(){return!1}updateCounts(){this.totalChars=0,this.totalLines=0;for(const t of this.children)this.totalChars+=t.charCount(),this.totalLines+=t.lineCount()}execWalk(t,n,i,a,o){return i.pre&&i.pre(t,n,this.children[a],this,o),i.goSubtree?(this.children[a].walk(t,n,i),i.post&&i.post(t,n,this.children[a],this,o)):i.goSubtree=!0,i.done}skipChild(t,n,i,a,o){a.pre&&!a.done&&(a.pre(t,n,this.children[i],this,o),a.goSubtree=!0)}walk(t,n,i){if(this.children.length===0)return;let a=0,o=this.children[a].charCount(),c=t;for(;c>=o;)this.skipChild(c,n,a,i,0),c-=o,a++,o=this.children[a].charCount();if(c+n<=o){if(this.execWalk(c,n,i,a,2))return}else{if(this.execWalk(c,o-c,i,a,1))return;let d=n-(o-c);for(a++,o=this.children[a].charCount();d>o;){if(this.execWalk(0,o,i,a,3))return;d-=o,a++,o=this.children[a].charCount()}if(d>0&&this.execWalk(0,d,i,a,4))return}if(i.pre){const d=this.children.length;if(a<d-1)for(let p=a+1;p<d;p++)this.skipChild(0,0,p,i,5)}}charOffsetToLineInfo(t,n){if(this.children.length===0)return{oneBasedLine:t,zeroBasedColumn:n,lineText:void 0};for(const o of this.children){if(o.charCount()>n)return o.isLeaf()?{oneBasedLine:t,zeroBasedColumn:n,lineText:o.text}:o.charOffsetToLineInfo(t,n);n-=o.charCount(),t+=o.lineCount()}const i=this.lineCount();if(i===0)return{oneBasedLine:1,zeroBasedColumn:0,lineText:void 0};const a=F.checkDefined(this.lineNumberToInfo(i,0).leaf);return{oneBasedLine:i,zeroBasedColumn:a.charCount(),lineText:void 0}}lineNumberToInfo(t,n){for(const i of this.children){const a=i.lineCount();if(a>=t)return i.isLeaf()?{position:n,leaf:i}:i.lineNumberToInfo(t,n);t-=a,n+=i.charCount()}return{position:n,leaf:void 0}}splitAfter(t){let n;const i=this.children.length;t++;const a=t;if(t<i){for(n=new BTe;t<i;)n.add(this.children[t]),t++;n.updateCounts()}return this.children.length=a,n}remove(t){const n=this.findChildIndex(t),i=this.children.length;if(n<i-1)for(let a=n;a<i-1;a++)this.children[a]=this.children[a+1];this.children.pop()}findChildIndex(t){const n=this.children.indexOf(t);return F.assert(n!==-1),n}insertAt(t,n){let i=this.findChildIndex(t);const a=this.children.length,o=n.length;if(a<Q4&&i===a-1&&o===1)return this.add(n[0]),this.updateCounts(),[];{const c=this.splitAfter(i);let d=0;for(i++;i<Q4&&d<o;)this.children[i]=n[d],i++,d++;let p=[],y=0;if(d<o){y=Math.ceil((o-d)/Q4),p=new Array(y);let b=0;for(let E=0;E<y;E++)p[E]=new BTe;let S=p[0];for(;d<o;)S.add(n[d]),d++,S.children.length===Q4&&(b++,S=p[b]);for(let E=p.length-1;E>=0;E--)p[E].children.length===0&&p.pop()}c&&p.push(c),this.updateCounts();for(let b=0;b<y;b++)p[b].updateCounts();return p}}add(t){this.children.push(t),F.assert(this.children.length<=Q4)}charCount(){return this.totalChars}lineCount(){return this.totalLines}},iU=class{constructor(e){this.text=e}isLeaf(){return!0}walk(e,t,n){n.leaf(e,t,this)}charCount(){return this.text.length}lineCount(){return 1}},LMe=class hQe{constructor(t,n,i,a,o,c){this.telemetryEnabled=t,this.logger=n,this.host=i,this.globalTypingsCacheLocation=a,this.event=o,this.maxActiveRequestCount=c,this.activeRequestCount=0,this.requestQueue=Op(),this.requestMap=new Map,this.requestedRegistry=!1,this.packageInstallId=0}isKnownTypesPackageName(t){var n;return K2.validatePackageName(t)!==K2.NameValidationResult.Ok?!1:(this.requestedRegistry||(this.requestedRegistry=!0,this.installer.send({kind:"typesRegistry"})),!!((n=this.typesRegistryCache)!=null&&n.has(t)))}installPackage(t){this.packageInstallId++;const n={kind:"installPackage",...t,id:this.packageInstallId},i=new Promise((a,o)=>{(this.packageInstalledPromise??(this.packageInstalledPromise=new Map)).set(this.packageInstallId,{resolve:a,reject:o})});return this.installer.send(n),i}attach(t){this.projectService=t,this.installer=this.createInstallerProcess()}onProjectClosed(t){this.installer.send({projectName:t.getProjectName(),kind:"closeProject"})}enqueueInstallTypingsRequest(t,n,i){const a=Lve(t,n,i);this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling throttled operation:${bT(a)}`),this.activeRequestCount<this.maxActiveRequestCount?this.scheduleRequest(a):(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Deferring request for: ${a.projectName}`),this.requestQueue.enqueue(a),this.requestMap.set(a.projectName,a))}handleMessage(t){var n,i;switch(this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Received response:${bT(t)}`),t.kind){case GX:this.typesRegistryCache=new Map(Object.entries(t.typesRegistry));break;case T$:{const a=(n=this.packageInstalledPromise)==null?void 0:n.get(t.id);F.assertIsDefined(a,"Should find the promise for package install"),(i=this.packageInstalledPromise)==null||i.delete(t.id),t.success?a.resolve({successMessage:t.message}):a.reject(t.message),this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case $pe:{const a={message:t.message};this.event(a,"typesInstallerInitializationFailed");break}case YX:{const a={eventId:t.eventId,packages:t.packagesToInstall};this.event(a,"beginInstallTypes");break}case XX:{if(this.telemetryEnabled){const c={telemetryEventName:"typingsInstalled",payload:{installedPackages:t.packagesToInstall.join(","),installSuccess:t.installSuccess,typingsInstallerVersion:t.typingsInstallerVersion}};this.event(c,"telemetry")}const a={eventId:t.eventId,packages:t.packagesToInstall,success:t.installSuccess};this.event(a,"endInstallTypes");break}case S$:{this.projectService.updateTypingsForProject(t);break}case b$:{for(this.activeRequestCount>0?this.activeRequestCount--:F.fail("TIAdapter:: Received too many responses");!this.requestQueue.isEmpty();){const a=this.requestQueue.dequeue();if(this.requestMap.get(a.projectName)===a){this.requestMap.delete(a.projectName),this.scheduleRequest(a);break}this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Skipping defunct request for: ${a.projectName}`)}this.projectService.updateTypingsForProject(t),this.event(t,"setTypings");break}case ZF:this.projectService.watchTypingLocations(t);break}}scheduleRequest(t){this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Scheduling request for: ${t.projectName}`),this.activeRequestCount++,this.host.setTimeout(()=>{this.logger.hasLevel(3)&&this.logger.info(`TIAdapter:: Sending request:${bT(t)}`),this.installer.send(t)},hQe.requestDelayMillis,`${t.projectName}::${t.kind}`)}};LMe.requestDelayMillis=100;var RMe=LMe,jMe={};x(jMe,{ActionInvalidate:()=>S$,ActionPackageInstalled:()=>T$,ActionSet:()=>b$,ActionWatchTypingLocations:()=>ZF,Arguments:()=>QX,AutoImportProviderProject:()=>nye,AuxiliaryProject:()=>tye,CharRangeSection:()=>Aye,CloseFileWatcherEvent:()=>dee,CommandNames:()=>xMe,ConfigFileDiagEvent:()=>lee,ConfiguredProject:()=>iye,ConfiguredProjectLoadKind:()=>uye,CreateDirectoryWatcherEvent:()=>pee,CreateFileWatcherEvent:()=>_ee,Errors:()=>f1,EventBeginInstallTypes:()=>YX,EventEndInstallTypes:()=>XX,EventInitializationFailed:()=>$pe,EventTypesRegistry:()=>GX,ExternalProject:()=>nee,GcTimer:()=>zve,InferredProject:()=>eye,LargeFileReferencedEvent:()=>cee,LineIndex:()=>a9,LineLeaf:()=>iU,LineNode:()=>K4,LogLevel:()=>Fve,Msg:()=>Mve,OpenFileInfoTelemetryEvent:()=>aye,Project:()=>QD,ProjectInfoTelemetryEvent:()=>fee,ProjectKind:()=>jI,ProjectLanguageServiceStateEvent:()=>uee,ProjectLoadingFinishEvent:()=>oee,ProjectLoadingStartEvent:()=>see,ProjectService:()=>yye,ProjectsUpdatedInBackgroundEvent:()=>tU,ScriptInfo:()=>Hve,ScriptVersionCache:()=>Eee,Session:()=>NMe,TextStorage:()=>Wve,ThrottledOperations:()=>Uve,TypingsInstallerAdapter:()=>RMe,allFilesAreJsOrDts:()=>Qve,allRootFilesAreJsOrDts:()=>Xve,asNormalizedPath:()=>Y9e,convertCompilerOptions:()=>rU,convertFormatOptions:()=>Y4,convertScriptKindName:()=>gee,convertTypeAcquisition:()=>oye,convertUserPreferences:()=>cye,convertWatchOptions:()=>n9,countEachFileTypes:()=>Z5,createInstallTypingsRequest:()=>Lve,createModuleSpecifierCache:()=>Tye,createNormalizedPathMap:()=>X9e,createPackageJsonCache:()=>xye,createSortedArray:()=>Jve,emptyArray:()=>of,findArgument:()=>XAe,formatDiagnosticToProtocol:()=>i9,formatMessage:()=>kye,getBaseConfigFileName:()=>ree,getDetailWatchInfo:()=>bee,getLocationInNewDocument:()=>Dye,hasArgument:()=>YAe,hasNoTypeScriptSource:()=>Kve,indent:()=>lI,isBackgroundProject:()=>t9,isConfigFile:()=>bye,isConfiguredProject:()=>Db,isDynamicFileName:()=>RI,isExternalProject:()=>e9,isInferredProject:()=>G4,isInferredProjectName:()=>Rve,isProjectDeferredClose:()=>r9,makeAutoImportProviderProjectName:()=>Bve,makeAuxiliaryProjectName:()=>$ve,makeInferredProjectName:()=>jve,maxFileSize:()=>aee,maxProgramSizeForNonTsFiles:()=>iee,normalizedPathToPath:()=>H4,nowString:()=>QAe,nullCancellationToken:()=>bMe,nullTypingsInstaller:()=>nU,protocol:()=>qve,scriptInfoIsContainedByBackgroundProject:()=>Gve,scriptInfoIsContainedByDeferredClosedProject:()=>Yve,stringifyIndented:()=>bT,toEvent:()=>Cye,toNormalizedPath:()=>Ac,tryConvertScriptKindName:()=>mee,typingsInstaller:()=>Ove,updateProjectIfDirty:()=>jg}),typeof console<"u"&&(F.loggingHost={log(e,t){switch(e){case 1:return console.error(t);case 2:return console.warn(t);case 3:return console.log(t);case 4:return console.log(t)}}})})({get exports(){return u},set exports(_){u=_,l.exports&&(l.exports=_)}})})(ZSe)),ZSe.exports}enr();const tnr=oA({name:"PartnerPickerElement",setup(l,u){const{value:_}=u.element,g=w.ref(""),x=w.ref("");w.watch(_,W=>{W&&I(W)},{deep:!0});const D=exports.ppeconfig.onFetchData,I=W=>{W&&exports.ppeconfig.onFetchData(W,$)},$=(W,ee,R)=>{g.value=ee,x.value=R,_.value!=W&&(_.value=W)};return{logoUrl:g,pname:x,value:_,fetchData:I,onFetchData:D,gotData:$}}}),rnr={class:"d-flex flex-column flex-md-row gap-2"},nnr={class:"d-flex flex-row gap-2 w-100"},inr=["src"],anr={class:"w-100"},snr=["value"],onr={class:"w-100"},cnr=["value"];function lnr(l,u,_,g,x,D){const I=w.resolveComponent("ElementLayout");return w.openBlock(),w.createBlock(I,null,w.createSlots({element:w.withCtx(()=>[w.createElementVNode("div",rnr,[w.createElementVNode("div",nnr,[w.createElementVNode("img",{class:"partner-picker__logo__preview",alt:"",src:l.logoUrl},null,8,inr),w.createElementVNode("div",anr,[w.createElementVNode("input",{type:"text",class:"form-control",value:l.pname,disabled:"",placeholder:"Neve"},null,8,snr)])]),w.createElementVNode("div",onr,[w.createElementVNode("input",{id:"partner-id",type:"text",class:"form-control",value:l.value,onChange:u[0]||(u[0]=$=>l.fetchData($.target.value)),placeholder:"Azonoító"},null,40,cnr)])])]),_:2},[w.renderList(l.elementSlots,($,W)=>({name:W,fn:w.withCtx(()=>[w.renderSlot(l.$slots,W,{el$:l.el$},()=>[(w.openBlock(),w.createBlock(w.resolveDynamicComponent($),{el$:l.el$},null,8,["el$"]))])])}))]),1024)}const unr=sC(tnr,[["render",lnr]]);exports.gisConfig=void 0;const fnr=l=>(exports.gisConfig=l,exports.gisConfig),_nr=oA({name:"GalleryImageSelectorElement",setup(l,u){const{value:_}=u.element,g=w.ref([]),x=W=>{_.value.activeImageIndex=0,_.value.galleryId=W.target.value,exports.gisConfig.onFetchGallery(W.target.value,ee=>{g.value=ee.items||[],$()})};w.watch(()=>_.value,(W,ee)=>{!W||(W==null?void 0:W.galleryId)===(ee==null?void 0:ee.galleryId)||exports.gisConfig.onFetchGallery(W==null?void 0:W.galleryId,R=>{g.value=R.items||[],$()})},{immediate:!0,deep:!0});const D=W=>{_.value.activeImageIndex=W.target.value,$()},I=w.ref(),$=()=>{var W;if(g.value&&_.value.activeImageIndex>=0){const ee=(W=g.value[_.value.activeImageIndex])==null?void 0:W.url;I.value=ee;return}I.value=null};return{onGalleryIdChanged:x,onActiveIndexChanged:D,imageUrl:I,value:_}}}),pnr={key:0},dnr=["src"],mnr={key:1},gnr=["value"],hnr=["value"];function vnr(l,u,_,g,x,D){const I=w.resolveComponent("ElementLayout");return w.openBlock(),w.createBlock(I,null,w.createSlots({_:2},[l.value?{name:"element",fn:w.withCtx(()=>[l.imageUrl?(w.openBlock(),w.createElementBlock("div",pnr,[w.createElementVNode("img",{class:"gallery__preview",alt:"",src:l.imageUrl},null,8,dnr)])):w.createCommentVNode("",!0),l.imageUrl?w.createCommentVNode("",!0):(w.openBlock(),w.createElementBlock("div",mnr,[...u[2]||(u[2]=[w.createElementVNode("p",{class:"gallery__preview-empty"},"Nincs kép kiválasztva!",-1)])])),w.createElementVNode("div",null,[u[3]||(u[3]=w.createElementVNode("label",{for:"galleryId",class:"form-label"},"Galéria azonosító",-1)),w.createElementVNode("input",{type:"text",id:"galleryId",placeholder:"Galéria azonosító",class:"form-control",value:l.value.galleryId,onInput:u[0]||(u[0]=$=>l.onGalleryIdChanged($))},null,40,gnr)]),w.createElementVNode("div",null,[u[4]||(u[4]=w.createElementVNode("label",{for:"activeImageIndex",class:"form-label"},"Aktív kép index",-1)),w.createElementVNode("input",{type:"number",id:"activeImageIndex",placeholder:"Aktív kép index",class:"form-control",value:l.value.activeImageIndex,onInput:u[1]||(u[1]=$=>l.onActiveIndexChanged($))},null,40,hnr)])]),key:"0"}:void 0,w.renderList(l.elementSlots,($,W)=>({name:W,fn:w.withCtx(()=>[w.renderSlot(l.$slots,W,{el$:l.el$},()=>[(w.openBlock(),w.createBlock(w.resolveDynamicComponent($),{el$:l.el$},null,8,["el$"]))])])}))]),1024)}const ynr=sC(_nr,[["render",vnr]]);function bnr(l){window.dispatchEvent(new CustomEvent("toast-notification-message",{detail:l}))}function Snr(l,u,_,g){Tnr(u,_).then(x=>{l.use(z6t,{config:{url:x.url,realm:x.realm,clientId:g},init:{onLoad:"login-required",checkLoginIframe:!!x.silentSsoCheckUrl,silentCheckSsoRedirectUri:x.silentSsoCheckUrl}})})}async function Tnr(l,u){const _=Kqe(l);return new Promise((g,x)=>{_.getKeycloakConfig.routeParams.value.name="keycloak-jwt",_.getKeycloakConfig.successCallback=D=>{const I=D.environments.find($=>$.name===u);I?g(I):x(`No matching environment was found in response for ${u}`)},_.getKeycloakConfig.execute()})}const xnr={CheckBox:nq,CheckBoxList:Wqe,DropDown:BM,DropDownButton:Hqe,DropDownMenu:Ine,DropDownCallBack:$Te,ExternalArticleOfferComponent:YTe,FilterCompact:JTe,FilterControl:zTe,IconButton:L8,ImagePickerComponent:$M,InternalArticleOfferComponent:GTe,PaginatorControl:qTe,RadioButton:VTe,RadioButtonGroup:tVe,SpinningProgress:WTe,TableToList:rVe,TableToListOptions:nVe,TextListBox:iVe,ToastComponent:HTe,ToastWrapper:aVe,CalendarComponent:UTe,HeaderComponent:sVe},knr={install(l){Object.entries(xnr).forEach(([u,_])=>{l.component(u,_)})}};exports.ArticleEditorService=eVe;exports.ArticleOfferElement=frr;exports.ArticlePickerElement=Irr;exports.CalendarComponent=UTe;exports.CheckBox=nq;exports.CheckBoxList=Wqe;exports.ConfigService=Zqe;exports.DateTimePickerElement=Yrr;exports.DropDown=BM;exports.DropDownButton=Hqe;exports.DropDownCallBack=$Te;exports.DropDownMenu=Ine;exports.ExternalArticleOfferComponent=YTe;exports.ExternalArticleOfferElement=Wrr;exports.FetchDetails=JP;exports.FetchError=One;exports.FilterCompact=JTe;exports.FilterControl=zTe;exports.FilterDate=YAt;exports.FilterDropDown=GAt;exports.FilterText=HAt;exports.GalleryImageSelectorElement=ynr;exports.HeaderComponent=sVe;exports.IconButton=L8;exports.ImagePickerComponent=$M;exports.ImagePickerDetailsElement=jrr;exports.ImagePickerElement=Mrr;exports.InternalArticleOfferComponent=GTe;exports.InternalArticleOfferElement=Urr;exports.Methods=_w;exports.PaginatorControl=qTe;exports.PartnerPickerElement=unr;exports.RadioButton=VTe;exports.RadioButtonGroup=tVe;exports.SpinningProgress=WTe;exports.TableToList=rVe;exports.TableToListOptions=nVe;exports.TableToListOptionsPersister=iTe;exports.TextListBox=iVe;exports.ToastComponent=HTe;exports.ToastWrapper=aVe;exports.configureArticleOfferElement=err;exports.configureArticlePickerElement=_rr;exports.configureExternalArticleOfferElement=zrr;exports.configureGalleryImageSelectorElement=fnr;exports.configureImagePickerElement=prr;exports.configureInternalArticleOfferElement=Brr;exports.configurePartnerPickerElement=Xrr;exports.debounce=dAt;exports.default=knr;exports.initRequest=UP;exports.localDateTimeToDate=pAt;exports.localDateTimeToUTC=fAt;exports.localDateTimeToUTCDate=_At;exports.localToDateStr=iq;exports.localToStr=Qqe;exports.localToUtcStr=_ne;exports.sendMsgToToast=bnr;exports.toDateString=oAt;exports.toDateStringFromUtc=uAt;exports.toDateTimeString=cAt;exports.toDateTimeStringFromUtc=lAt;exports.useAdminKeycloak=Snr;exports.useArticleEditorService=mAt;exports.useConfigService=Kqe;
|
|
@@ -193511,7 +193511,7 @@ function Hir(l, u, _, g) {
|
|
|
193511
193511
|
async function Ynr(l, u) {
|
|
193512
193512
|
const _ = t4t(l);
|
|
193513
193513
|
return new Promise((g, x) => {
|
|
193514
|
-
_.getKeycloakConfig.successCallback = (w) => {
|
|
193514
|
+
_.getKeycloakConfig.routeParams.value.name = "keycloak-jwt", _.getKeycloakConfig.successCallback = (w) => {
|
|
193515
193515
|
const I = w.environments.find((B) => B.name === u);
|
|
193516
193516
|
I ? g(I) : x(`No matching environment was found in response for ${u}`);
|
|
193517
193517
|
}, _.getKeycloakConfig.execute();
|