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,GAAc,uBAAyB,OACvC,OAAO,EAEX,IACI,MAAM,EAAU,yBAAyB,uBAAuB,KAAK,SAC/D,EAAW,EAAQ,qBAAqB,GAAU,mBAAmB,sBAAsB,wBAAwB,IACnH,EAAkB,EAAS,YAAY,YACvC,EAAsB,EAAS,YACjC,gBAAgB,WAAW,uBAAuB,IAAoB,gBAAgB,WAAW,oBAAoB,IACrH,iBAAiB,0BAA0B,EAAiB,GAC5D,EAAQ,OACR,EAAQ,YAEH,gBAAgB,WAAW,mBAAmB,IAAoB,gBAAgB,WAAW,sBAAsB,IACxH,iBAAiB,sBAAsB,EAAiB,GACxD,EAAQ,OACR,EAAQ,YAGR,KAAK,QAAQ,eAAe,OAAO,KAAK,GAAG,sGAAsG,EAAgB,sCAAsC,EAAoB,iBAE/N,KAAK,QAAQ,eAAe,OAAO,KAAK,GAAG,wCAAwC,aAAa,MAAQ,IAC5G,CACA,MAAO,GACH,KAAK,QAAQ,eAAe,OAAO,KAAK,GAAG,0CAA0C,EAAM,uBAAuB,EAAM,QAC5H,CACA,OAAO,CACX,CACA,OAAO,QAAU,yBAAyB,gBAAgB,kBAAkB,CAAC,EAAS,KAClF,GAAK,EAAQ,WACb,KAAO,EACP,KAAK,QAAQ,eAAe,OAAO,KAAK,GAAG,sBAAsB","file":"/npm/typescript-method-delegate@1.0.1/dist/src/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/typescript-method-delegate@1.0.1/dist/src/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","\"use strict\";\nconst hrtime_now_1 = require(\"hrtime-now\");\nconst typescript_ast_util_1 = require(\"typescript-ast-util\");\nconst typescript_plugin_util_1 = require(\"typescript-plugin-util\");\nconst ts_simple_ast_1 = require(\"ts-simple-ast\");\nconst methodDelegate_1 = require(\"./methodDelegate\");\nconst PLUGIN_NAME = 'typescript-plugin-method-delegate';\nconst REFACTOR_ACTION_NAME = `${PLUGIN_NAME}-refactor-action`;\nlet ts;\nlet info;\nconst pluginDefinition = { getApplicableRefactors, getEditsForRefactor };\nlet target;\nfunction getApplicableRefactors(fileName, positionOrRange) {\n    const t0 = hrtime_now_1.now();\n    const refactors = info.languageService.getApplicableRefactors(fileName, positionOrRange) || [];\n    const program = info.languageService.getProgram();\n    const sourceFile = program.getSourceFile(fileName);\n    if (!sourceFile) {\n        return refactors;\n    }\n    target = typescript_ast_util_1.findChildContainingRange(sourceFile, typescript_ast_util_1.positionOrRangeToRange(positionOrRange));\n    if (!(target && [ts.SyntaxKind.PropertySignature, ts.SyntaxKind.PropertyDeclaration].includes(target.kind))) {\n        info.project.projectService.logger.info(`${PLUGIN_NAME} no getEditsForRefactor because findChildContainedRange undefined, target.kind == ${typescript_ast_util_1.getKindName(target.kind) + ' - ' + [ts.SyntaxKind.PropertySignature, ts.SyntaxKind.PropertyDeclaration].join(', ')}`);\n        return refactors;\n    }\n    if (![ts.SyntaxKind.PropertySignature, ts.SyntaxKind.PropertyDeclaration].includes(target.kind)) {\n        target = target.parent;\n    }\n    const name = target.name && target.name.getText() || '';\n    refactors.push({\n        name: `${PLUGIN_NAME}-refactor-info`,\n        description: 'Add type',\n        actions: [\n            { name: REFACTOR_ACTION_NAME, description: 'Delegate methods to property\"' + name + '\"' }\n        ],\n    });\n    info.project.projectService.logger.info(`${PLUGIN_NAME} getApplicableRefactors took ${hrtime_now_1.now() - t0}`);\n    return refactors;\n}\nfunction getEditsForRefactor(fileName, formatOptions, positionOrRange, refactorName, actionName) {\n    const t0 = hrtime_now_1.now();\n    const refactors = info.languageService.getEditsForRefactor(fileName, formatOptions, positionOrRange, refactorName, actionName);\n    if (actionName != REFACTOR_ACTION_NAME || !target) {\n        return refactors;\n    }\n    try {\n        const project = typescript_plugin_util_1.createSimpleASTProject(info.project);\n        const descAtPo = project.getSourceFileOrThrow(fileName).getDescendantAtPos(typescript_ast_util_1.positionOrRangeToNumber(positionOrRange));\n        const typeDeclaration = descAtPo.getParent().getParent();\n        const propertyDeclaration = descAtPo.getParent();\n        if (ts_simple_ast_1.TypeGuards.isInterfaceDeclaration(typeDeclaration) && ts_simple_ast_1.TypeGuards.isPropertySignature(propertyDeclaration)) {\n            methodDelegate_1.methodDelegateOnInterface(typeDeclaration, propertyDeclaration);\n            project.emit();\n            project.saveSync();\n        }\n        else if (ts_simple_ast_1.TypeGuards.isClassDeclaration(typeDeclaration) && ts_simple_ast_1.TypeGuards.isPropertyDeclaration(propertyDeclaration)) {\n            methodDelegate_1.methodDelegateOnClass(typeDeclaration, propertyDeclaration);\n            project.emit();\n            project.saveSync();\n        }\n        else {\n            info.project.projectService.logger.info(`${PLUGIN_NAME} getEditsForRefactor not executed because typeguards didn't applied for typeDeclaration:${typeDeclaration.getKindName()}, propertyDeclaration:${propertyDeclaration.getKindName()}`);\n        }\n        info.project.projectService.logger.info(`${PLUGIN_NAME} getEditsForRefactor took ${hrtime_now_1.now() - t0}`);\n    }\n    catch (error) {\n        info.project.projectService.logger.info(`${PLUGIN_NAME} getEditsForRefactor error: ${error.toString()} - stack: ${error.stack}`);\n    }\n    return refactors;\n}\nmodule.exports = typescript_plugin_util_1.getPluginCreate(pluginDefinition, (modules, anInfo) => {\n    ts = modules.typescript;\n    info = anInfo;\n    info.project.projectService.logger.info(`${PLUGIN_NAME} created`);\n});\n"]}