"use strict";
/// <reference types="@volar/typescript" />
Object.defineProperty(exports, "__esModule", { value: true });
exports.isRefAtPosition = isRefAtPosition;
const transform_1 = require("@volar/typescript/lib/node/transform");
const language_core_1 = require("@vue/language-core");
const utils_1 = require("./utils");
function isRefAtPosition(ts, language, program, sourceScript, virtualCode, position) {
    const serviceScript = sourceScript.generated.languagePlugin.typescript?.getServiceScript(virtualCode);
    if (!serviceScript) {
        return false;
    }
    const position2 = (0, transform_1.toGeneratedOffset)(language, serviceScript, sourceScript, position, language_core_1.isCompletionEnabled);
    if (!position2) {
        return false;
    }
    const sourceFile = program.getSourceFile(virtualCode.fileName);
    if (!sourceFile) {
        return false;
    }
    let node;
    for (const child of (0, utils_1.forEachTouchingNode)(ts, sourceFile, position2)) {
        if (ts.isIdentifier(child)) {
            node = child;
            break;
        }
    }
    if (!node) {
        return false;
    }
    const checker = program.getTypeChecker();
    const type = checker.getTypeAtLocation(node);
    const props = type.getProperties();
    return props.some(prop => prop.declarations?.some(decl => ts.isPropertySignature(decl)
        && ts.isComputedPropertyName(decl.name)
        && ts.isIdentifier(decl.name.expression)
        && decl.name.expression.text === 'RefSymbol'));
}
//# sourceMappingURL=isRefAtPosition.js.map