"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
function initApiJs({ webViewHooks }) {
    webViewHooks.jsHook.tapPromise('apiJs', (jsArr) => __awaiter(this, void 0, void 0, function* () {
        return jsArr.concat([`
<script type="text/javascript">
const vscode = acquireVsCodeApi();
window.parentCallbacks = {};
window.webviewListener = {};
function triggerParentListener(listenerName, params, callback) {
    const id = uuidv4();
    vscode.postMessage({
        filepath: window.globalParserFilePath,
        id: id,
        type: 'intl-js-vscode.triggerParentListener',
        listenerName: listenerName,
        params,
    });
    window.parentCallbacks[id] = callback;
}
</script>
        `]);
    }));
}
exports.default = initApiJs;
//# sourceMappingURL=webviewApi.js.map