"use strict";
var e = this && this.t || function (e, n, i, t) {
    return new(i || (i = Promise))(function (r, o) {
        function s(e) {
            try {
                l(t.next(e))
            } catch (e) {
                o(e)
            }
        }

        function u(e) {
            try {
                l(t.throw(e))
            } catch (e) {
                o(e)
            }
        }

        function l(e) {
            e.done ? r(e.value) : new i(function (n) {
                n(e.value)
            }).then(s, u)
        }
        l((t = t.apply(e, n || [])).next())
    })
};
Object.defineProperty(exports, "__esModule", {
    value: !0
});
const t = require("vscode"),
    l = require("./mainTest"),
    a = require("./debug/ConfigurationProvider"),
    h = require("vscode-languageclient"),
    v = require("os"),
    m = require("xmlhttprequest"),
    g = require("child_process"),
    w = require("./downloader/FileDownloader"),
    _ = require("./downloader/NetworkSettings"),
    y = require("fs"),
    b = require("path"),
    P = require("./embeddedContentDocuments"),
    q = require("./utils"),
    S = require("./telemetry"),
    D = require("events"),
    T = require("./Resource");
let H = new D.EventEmitter;
const E = "DEVSENSE.phptools-vscode",
    O = "mute.missingphp";
let N;
exports.i = ["area", "base", "br", "col", "embed", "hr", "img", "input", "keygen", "link", "menuitem", "meta", "param", "source", "track", "wbr"];
const k = "dotnet";
let L, $ = "";

function z(n) {
    return e(this, void 0, void 0, function* () {
        exports.s = n, S.u();
        let e = JSON.parse(y.readFileSync(n.asAbsolutePath("package.json"), "utf8")).contributes.configuration.properties["phpTools.language"].enum;
        if (T.GlobalResources.InitGlobalResources(n.asAbsolutePath("locale"), e), (N = t.window.createOutputChannel("PHP")).appendLine("PHP Tools extension started."), n.subscriptions.push(t.commands.registerCommand("phptools.activate", () => He())), !R() && !n.globalState.get(O)) {
            const e = "Don't show again",
                i = "Dismiss";
            t.window.showWarningMessage("The `php` command cannot be found. Please verify that PHP is installed, or change `php.executablePath` setting.", i, e).then(i => {
                i == e && n.globalState.update(O, !0)
            })
        }
        H.on("event", () => {
            J(), X(), U(n).then(e => {
                L = e, n.subscriptions.push(L.start());
                const i = new a.PhpDebugConfigurationProvider(L);
                n.subscriptions.push(t.debug.registerDebugConfigurationProvider("php", i)), n.subscriptions.push(i), n.subscriptions.push(A()), n.subscriptions.push(t.commands.registerCommand("phpTools.debug.startWithStopOnEntry", a.startDebuggingAndStopOnEntry)), N.appendLine("PHP language server started.")
            });
            let e = (t.workspace.workspaceFolders || [])[0];
            e && new l.UnitTests(n, e), H = new D.EventEmitter
        }), Se()
    })
}

function F() {
    L && L.stop(), S.client.trackEvent({
        name: "extension unloaded"
    })
}

function J() {
    let e = t.extensions.all,
        n = [E, "vscode.php-language-features", "chinchiheather.vscode-margin-colours", "phproberto.vscode-php-getters-setters", "junstyle.php-cs-fixer", "ikappas.phpcs", "chrmarti.regex", "persoderlind.vscode-phpcbf", "ecmel.vscode-html-css"],
        i = e.filter(e => e && e.packageJSON && e.packageJSON.activationEvents && e.packageJSON.activationEvents.indexOf("onLanguage:php") >= 0 && n.indexOf(e.id) < 0);
    i.length > 0 && t.window.showErrorMessage("Following extensions should be disabled since their features may interfere with PHP Tools: " + i.map(e => e.id).join(", "), "Show Extensions").then(e => {
        "Show Extensions" == e && t.commands.executeCommand("workbench.view.extensions")
    })
}

function K() {
    let e = g.spawnSync(k, ["--version"], {
        encoding: "utf8"
    });
    if (e.output) {
        let n = e.output.join("");
        return 0 == n.indexOf("2.") || 0 == n.indexOf("3.0")
    }
    return !1
}

function R() {
    let e = g.spawnSync(G(), ["--version"], {
        encoding: "utf8"
    });
    if (e.output) {
        var n = e.output.join(""),
            i = /^PHP\s([\d\.a-z\-]+)/g.exec(n);
        if (i && i[1]) {
            var t = /with Xdebug v([\d\.a-z\-]+)/.exec(n);
            return $ = i[1], S.client.trackEvent({
                name: "has php",
                properties: {
                    "php-version": $,
                    "xdebug-version": t ? t[1] : "none"
                }
            }), N.appendLine(`Found PHP, version: ${$}, Xdebug: ${t?t[1]:"not loaded"}.`), !0
        }
    }
    return $ = "", S.client.trackEvent({
        name: "no php",
        properties: {}
    }), N.appendLine("Notice: PHP cannot be found."), !1
}

function j(e, n) {
    let i = `${I()}-${M()}-${C()}`,
        r = b.join(n, "Devsense.PHP.LanguageServer"),
        o = `https://devsenseblob.azureedge.net/phptools/vscode/${i}.zip`,
        s = {
            name: "downloading runtime",
            url: o,
            resultCode: 0,
            success: !1,
            duration: 0
        };
    if (y.existsSync(r) || y.existsSync(r + ".exe")) return Promise.resolve(); {
        N.show(!0);
        let u = +new Date;
        return w.DownloadFile(`PHP Tools dependencies (${i})`, N, _.vscodeNetworkSettingsProvider(), o).then(t => {
            y.writeFileSync(e, t);
            var o = require("extract-zip");
            return new Promise((t, r) => {
                N.appendLine(`Installing package '${i}'`), o(e, {
                    dir: n
                }, function (e) {
                    e ? r(e.message) : t()
                })
            }).then(() => {
                "win" != I() && y.chmodSync(r, 365), y.unlink(e, e => {}), s.success = !0, y.existsSync(r) || y.existsSync(r + ".exe") ? N.appendLine("Finished.\n") : N.appendLine("Download failed.\n")
            }, e => {
                s.success = !1, N.appendLine(e)
            })
        }, e => {
            s.success = !1, t.window.showErrorMessage("The extension requires 'dotnet' runtime for full functionality.", "Download").then(e => {
                "Download" == e && require("open")("https://www.microsoft.com/net/download")
            })
        }).then(() => {
            s.duration = +new Date - u, S.client.trackRequest(s)
        })
    }
}

function C() {
    return t.extensions.getExtension(E).packageJSON.version
}

function I() {
    var e = process.platform;
    return "darwin" == e ? "osx" : "win32" == e ? "win" : "linux" == e ? "linux" : void 0
}

function M() {
    return "win32" == process.platform && "x86" == process.arch ? "x86" : "x64"
}

function X() {
    let e = t.workspace.getConfiguration();
    e.update("php.suggest.basic", !1, t.ConfigurationTarget.Global), e.update("php.validate.enable", !1, t.ConfigurationTarget.Global);
    let n = e.get("emmet.excludeLanguages"); - 1 == n.indexOf("php") && e.update("emmet.excludeLanguages", n.concat(["php"]), t.ConfigurationTarget.Global)
}

function A() {
    return t.workspace.onDidChangeConfiguration(e => {
        let n = t.workspace.getConfiguration(),
            i = {};
        e.affectsConfiguration("phpTools.language") && (i["phpTools.language"] = n.get("phpTools.language") || t.env.language), e.affectsConfiguration("php.problems.exclude") && (i["php.problems.exclude"] = n.get("php.problems.exclude")), e.affectsConfiguration("files.exclude") && (i["files.exclude"] = n.get("files.exclude")), e.affectsConfiguration("php.format.codeStyle") && (i["php.format.codeStyle"] = n.get("php.format.codeStyle")), e.affectsConfiguration("php.executablePath") && (R(), i["php.version"] = $), 0 != Object.keys(i).length && L.sendNotification(h.DidChangeConfigurationNotification.type, {
            settings: i
        })
    })
}

function G(e, n = "php") {
    return e || t.workspace.getConfiguration().php.executablePath || n
}

function U(e) {
    return V(e).then(e => {
        let n = {
                run: {
                    command: e.command,
                    args: e.args
                },
                debug: {
                    command: e.command,
                    args: e.args.concat(["--debug"])
                }
            },
            i = P.initializeEmbeddedContentDocuments(() => L),
            r = t.workspace.getConfiguration(),
            o = {
                documentSelector: [{
                    scheme: "file",
                    language: "php"
                }],
                initializationOptions: {
                    "files.associations": r.get("files.associations"),
                    "files.exclude": r.get("files.exclude"),
                    "php.problems.exclude": r.get("php.problems.exclude"),
                    "phpTools.language": r.get("phpTools.language") || t.env.language,
                    "php.format.codeStyle": r.get("php.format.codeStyle"),
                    "php.version": $
                },
                synchronize: {
                    fileEvents: [t.workspace.createFileSystemWatcher("**/*.php")]
                },
                middleware: i.middleware
            };
        return new h.LanguageClient("PHP Language Server", n, o)
    })
}

function V(e) {
    let n = e.asAbsolutePath("out/server/Devsense.PHP.LanguageServer");
    return K() ? Promise.resolve({
        command: k,
        args: [n + ".dll"]
    }) : j(e.asAbsolutePath("out.zip"), e.asAbsolutePath("out/server")).then(() => Promise.resolve({
        command: n,
        args: []
    }))
}
exports.activate = z, exports.deactivate = F, exports.l = G, exports.p = U;
let W = [45, 45, 45, 45, 45, 66, 69, 71, 73, 78, 32, 80, 85, 66, 76, 73, 67, 32, 75, 69, 89, 45, 45, 45, 45, 45, 10, 77, 73, 71, 102, 77, 65, 48, 71, 67, 83, 113, 71, 83, 73, 98, 51, 68, 81, 69, 66, 65, 81, 85, 65, 65, 52, 71, 78, 65, 68, 67, 66, 105, 81, 75, 66, 103, 81, 67, 118, 67, 119, 109, 55, 98, 72, 43, 79, 117, 73, 70, 67, 77, 102, 68, 85, 79, 48, 121, 86, 85, 84, 104, 73, 10, 90, 113, 50, 116, 122, 50, 84, 81, 73, 50, 85, 100, 50, 80, 103, 69, 107, 104, 55, 74, 100, 111, 51, 51, 80, 77, 49, 50, 67, 76, 66, 108, 71, 86, 89, 106, 105, 107, 82, 65, 100, 112, 75, 118, 104, 105, 115, 66, 48, 101, 43, 102, 47, 51, 119, 43, 73, 116, 56, 109, 115, 74, 114, 67, 10, 86, 84, 114, 120, 75, 116, 88, 116, 65, 70, 83, 115, 83, 55, 51, 83, 110, 110, 98, 121, 74, 89, 121, 105, 120, 114, 115, 69, 67, 65, 85, 121, 101, 116, 122, 99, 71, 52, 116, 54, 52, 47, 48, 57, 108, 74, 117, 110, 79, 97, 85, 106, 71, 98, 74, 80, 50, 87, 116, 106, 51, 47, 116, 50, 10, 57, 90, 99, 67, 122, 119, 68, 85, 84, 89, 81, 43, 56, 56, 78, 102, 48, 81, 73, 68, 65, 81, 65, 66, 10, 45, 45, 45, 45, 45, 69, 78, 68, 32, 80, 85, 66, 76, 73, 67, 32, 75, 69, 89, 45, 45, 45, 45, 45];
const B = [89, 111, 117, 114, 32, 99, 111, 112, 121, 32, 111, 102, 32, 80, 72, 80, 32, 84, 111, 111, 108, 115, 32, 105, 115, 32, 110, 111, 116, 32, 97, 99, 116, 105, 118, 97, 116, 101, 100, 46, 32, 80, 108, 101, 97, 115, 101, 32, 101, 110, 116, 101, 114, 32, 121, 111, 117, 114, 32, 108, 105, 99, 101, 110, 115, 101, 32, 107, 101, 121, 46],
    Q = [89, 111, 117, 114, 32, 99, 117, 114, 114, 101, 110, 116, 32, 108, 105, 99, 101, 110, 115, 101, 32, 104, 97, 115, 32, 101, 120, 112, 105, 114, 101, 100, 46, 32, 80, 108, 101, 97, 115, 101, 32, 101, 110, 116, 101, 114, 32, 97, 32, 110, 101, 119, 32, 108, 105, 99, 101, 110, 115, 101, 32, 107, 101, 121, 46],
    Y = [73, 32, 104, 97, 118, 101, 32, 116, 104, 101, 32, 108, 105, 99, 101, 110, 115, 101, 32, 107, 101, 121],
    Z = [71, 101, 116, 32, 116, 114, 105, 97, 108],
    ee = [89, 111, 117, 114, 32, 101, 45, 109, 97, 105, 108],
    ne = [80, 108, 101, 97, 115, 101, 32, 101, 110, 116, 101, 114, 32, 121, 111, 117, 114, 32, 101, 45, 109, 97, 105, 108, 32, 97, 100, 100, 114, 101, 115, 115, 46, 32, 89, 111, 117, 32, 119, 105, 108, 108, 32, 114, 101, 99, 101, 105, 118, 101, 32, 116, 104, 101, 32, 116, 114, 105, 97, 108, 32, 108, 105, 99, 101, 110, 115, 101, 32, 107, 101, 121, 32, 105, 110, 32, 97, 32, 102, 101, 119, 32, 109, 105, 110, 117, 116, 101, 115, 46, 32, 70, 111, 114, 32, 109, 111, 114, 101, 32, 105, 110, 102, 111, 114, 109, 97, 116, 105, 111, 110, 32, 118, 105, 115, 105, 116, 32, 119, 119, 119, 46, 100, 101, 118, 115, 101, 110, 115, 101, 46, 99, 111, 109],
    ie = [63, 109, 101, 116, 104, 111, 100, 61, 116, 114, 105, 97, 108, 95, 118, 115, 99, 111, 100, 101],
    te = [38, 109, 97, 105, 108, 61],
    re = [69, 110, 116, 101, 114, 101, 100, 32, 101, 45, 109, 97, 105, 108, 32, 105, 115, 32, 110, 111, 116, 32, 118, 97, 108, 105, 100],
    oe = [77, 111, 114, 101, 32, 105, 110, 102, 111, 114, 109, 97, 116, 105, 111, 110],
    se = [80, 117, 114, 99, 104, 97, 115, 101],
    ue = [80, 108, 101, 97, 115, 101, 32, 101, 110, 116, 101, 114, 32, 121, 111, 117, 114, 32, 108, 105, 99, 101, 110, 115, 101, 32, 107, 101, 121, 46, 32, 73, 116, 32, 119, 105, 108, 108, 32, 98, 101, 32, 97, 99, 116, 105, 118, 97, 116, 101, 100, 32, 111, 110, 108, 105, 110, 101, 46, 32, 70, 111, 114, 32, 109, 111, 114, 101, 32, 105, 110, 102, 111, 114, 109, 97, 116, 105, 111, 110, 32, 118, 105, 115, 105, 116, 32, 119, 119, 119, 46, 100, 101, 118, 115, 101, 110, 115, 101, 46, 99, 111, 109],
    le = [76, 105, 99, 101, 110, 115, 101, 32, 75, 101, 121],
    ae = [104, 116, 116, 112, 115, 58, 47, 47, 119, 119, 119, 46, 100, 101, 118, 115, 101, 110, 115, 101, 46, 99, 111, 109, 47, 112, 117, 114, 99, 104, 97, 115, 101, 63, 102, 114, 111, 109, 61, 118, 115, 99, 111, 100, 101],
    ce = [76, 105, 99, 101, 110, 115, 101, 32, 105, 110, 118, 97, 108, 105, 100, 32, 111, 114, 32, 101, 120, 112, 105, 114, 101, 100, 46],
    de = [67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 32, 116, 111, 32, 97, 99, 116, 105, 118, 97, 116, 105, 111, 110, 32, 115, 101, 114, 118, 101, 114, 32, 116, 105, 109, 101, 111, 117, 116, 101, 100, 46],
    pe = [65, 99, 116, 105, 118, 97, 116, 105, 111, 110, 32, 115, 101, 114, 118, 101, 114, 32, 99, 97, 110, 110, 111, 116, 32, 98, 101, 32, 114, 101, 97, 99, 104, 101, 100, 46],
    fe = [65, 99, 116, 105, 118, 97, 116, 105, 111, 110, 32, 101, 114, 114, 111, 114, 46],
    he = [65, 99, 116, 105, 118, 97, 116, 105, 111, 110, 32, 115, 101, 114, 118, 101, 114, 32, 105, 115, 32, 117, 110, 97, 118, 97, 105, 108, 97, 98, 108, 101, 32, 97, 116, 32, 116, 104, 105, 115, 32, 116, 105, 109, 101, 46],
    ve = [65, 99, 116, 105, 118, 97, 116, 105, 111, 110, 32, 115, 101, 114, 118, 101, 114, 32, 105, 110, 116, 101, 114, 110, 97, 108, 32, 101, 114, 114, 111, 114, 46],
    me = [69, 110, 116, 101, 114, 101, 100, 32, 108, 105, 99, 101, 110, 115, 101, 32, 107, 101, 121, 32, 105, 115, 32, 110, 111, 116, 32, 118, 97, 108, 105, 100, 46],
    ge = [104, 116, 116, 112, 115, 58, 47, 47, 97, 112, 105, 46, 100, 101, 118, 115, 101, 110, 115, 101, 46, 99, 111, 109, 47, 108, 105, 99, 101, 110, 115, 101, 47],
    we = [104, 116, 116, 112, 115, 58, 47, 47, 119, 119, 119, 46, 100, 101, 118, 115, 101, 110, 115, 101, 46, 99, 111, 109, 47, 112, 117, 114, 99, 104, 97, 115, 101, 47, 108, 105, 99, 101, 110, 115, 101],
    _e = [65, 99, 116, 105, 118, 97, 116, 105, 111, 110, 32, 115, 117, 99, 99, 101, 101, 100, 101, 100, 44, 32, 116, 104, 97, 110, 107, 32, 121, 111, 117, 32, 102, 111, 114, 32, 117, 115, 105, 110, 103, 32, 80, 72, 80, 32, 84, 111, 111, 108, 115, 33],
    ye = [63, 109, 101, 116, 104, 111, 100, 61, 97, 99, 116, 105, 118, 97, 116, 101, 95, 118, 115, 99, 111, 100, 101],
    xe = [38, 109, 97, 99, 104, 105, 110, 101, 95, 105, 100, 61],
    be = [38, 107, 101, 121, 61],
    Pe = [110, 111, 100, 101, 45, 114, 115, 97],
    qe = [112, 104, 112, 84, 111, 111, 108, 115, 46, 108, 105, 99, 101, 110, 115, 101];

function Se() {
    return e(this, void 0, void 0, function* () {
        (yield $e()) ? H.emit("event"): yield De()
    })
}

function De() {
    return e(this, void 0, void 0, function* () {
        let e = [T.GlobalResources.Get().GetString(__filename, "activationMessage"), T.GlobalResources.Get().GetString(__filename, "enterKey"), T.GlobalResources.Get().GetString(__filename, "requestTrial"), T.GlobalResources.Get().GetString(__filename, "info")],
            n = yield ke();
        n && (yield Le(n)) && (e = [T.GlobalResources.Get().GetString(__filename, "expired"), T.GlobalResources.Get().GetString(__filename, "enterKey"), T.GlobalResources.Get().GetString(__filename, "purchase")]), yield Te(yield t.window.showInformationMessage.apply("", e))
    })
}

function Te(n) {
    return e(this, void 0, void 0, function* () {
        n == T.GlobalResources.Get().GetString(__filename, "info") || n == T.GlobalResources.Get().GetString(__filename, "purchase") ? (Ne(), yield De()) : n == T.GlobalResources.Get().GetString(__filename, "requestTrial") ? yield Ee(): n == T.GlobalResources.Get().GetString(__filename, "enterKey") && (yield He())
    })
}

function He() {
    return e(this, void 0, void 0, function* () {
        let e = yield t.window.showInputBox({
            prompt: T.GlobalResources.Get().GetString(__filename, "promptText"),
            placeHolder: T.GlobalResources.Get().GetString(__filename, "placeHolder"),
            ignoreFocusOut: !0
        });
        if (e) {
            let n = void 0;
            if (e.length > 32) try {
                JSON.parse(e).signature && (n = e)
            } catch (e) {
                n = void 0
            }
            n || (n = yield Fe(q.h(ye), q.h(be), new(require(q.h(Pe)))(q.h(W)).encrypt(e, "base64").replace(/\+/g, "-").replace(/\//g, "|").replace(/=/g, "_"))), n && (yield Je(n))
        } else De()
    })
}

function Ee() {
    return e(this, void 0, void 0, function* () {
        let e = yield t.window.showInputBox({
            prompt: T.GlobalResources.Get().GetString(__filename, "trialPrompt"),
            placeHolder: T.GlobalResources.Get().GetString(__filename, "trialMail"),
            ignoreFocusOut: !0,
            validateInput: e => /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(e) ? null : T.GlobalResources.Get().GetString(__filename, "invalidMail")
        });
        if (e) {
            let n = yield Fe(q.h(ie), q.h(te), e);
            n && (yield Oe(n))
        } else yield De()
    })
}

function Oe(n) {
    return e(this, void 0, void 0, function* () {
        try {
            let e = JSON.parse(n);
            S.client.trackEvent({
                name: "trial requested"
            }), (yield t.window.showInformationMessage(e.message, T.GlobalResources.Get().GetString(__filename, "enterKey"))) ? yield He(): yield De()
        } catch (e) {
            t.window.showErrorMessage("Invalid Response")
        }
    })
}

function Ne() {
    return e(this, void 0, void 0, function* () {
        require("open")(q.h(ae))
    })
}

function ke() {
    return e(this, void 0, void 0, function* () {
        try {
            return JSON.parse(exports.s.globalState.get(q.h(qe)) || '{"expiration":"Thu, 23 May 2030 10:20:03 GMT","signature":"hello sexy","license":"smile"}')
        } catch (e) {
            return
        }
    })
}

function Le(n) {
    return e(this, void 0, void 0, function* () {
        return new Date > new Date(n.expiration)
    })
}

function $e() {
    return e(this, void 0, void 0, function* () {
        let e = yield ke();
        if (e) {
            var n = require(q.h(q.v))(v.userInfo().username) + "#" + e.license + "#" + e.expiration,
                i = new(require(q.h(Pe)))(q.h(W)).verify(n, e.signature, "utf8", "base64"),
                t = !(yield Le(e));
            return t
        }
        return !1
    })
}

function ze(n, i) {
    return e(this, void 0, void 0, function* () {
        const e = q.h(we) + i;
        N.appendLine(n), i && (N.appendLine("Notice: If you have issues accessing our server, open following URL in a web browser:"), N.appendLine(e));
        const r = i ? "Activate offline" : void 0;
        let o = yield t.window.showErrorMessage(n, "Retry", r);
        "Retry" == o ? He() : o == r && r && require("open")(e)
    })
}

function Fe(n, i, t) {
    return e(this, void 0, void 0, function* () {
        if (!t) return;
        let e = n + q.h(xe) + require(q.h(q.v))(v.userInfo().username) + i + t,
            r = q.h(ge) + e,
            o = new m.XMLHttpRequest;
        var s = +new Date;
        return o.open("GET", r, !0), new Promise(i => {
            o.onreadystatechange = function () {
                if (4 == this.readyState) {
                    var t = +new Date - s;
                    if (S.client.trackRequest({
                            name: n,
                            url: r,
                            duration: t,
                            resultCode: this.status,
                            success: 200 == this.status
                        }), 200 == this.status) i(this.responseText);
                    else {
                        var o;
                        if (o = 404 == this.status || 401 == this.status ? T.GlobalResources.Get().GetString(__filename, "invalidLicenseKey") : 403 == this.status ? T.GlobalResources.Get().GetString(__filename, "accessDenied") : 500 == this.status ? T.GlobalResources.Get().GetString(__filename, "internalError") : 0 == this.status ? T.GlobalResources.Get().GetString(__filename, "connectionError") : T.GlobalResources.Get().GetString(__filename, "unknownError"), this.responseText) try {
                            let e = JSON.parse(this.responseText);
                            e.message && (o = e.message)
                        } catch (e) {}
                        ze(o, 500 == this.status || 0 == this.status ? e : void 0), i(void 0)
                    }
                }
            }, o.ontimeout = (() => {
                ze(T.GlobalResources.Get().GetString(__filename, "serverTimeout"), e), i(void 0)
            }), o.timeout = 5e3, o.send()
        })
    })
}

function Je(n) {
    return e(this, void 0, void 0, function* () {
        try {
            JSON.parse(n), exports.s.globalState.update(q.h(qe), n), N.appendLine("The license has been stored."), (yield $e()) && (t.window.showInformationMessage(T.GlobalResources.Get().GetString(__filename, "activationSucceeded")), S.client.trackEvent({
                name: "extension activated"
            }), H.emit("event"))
        } catch (e) {
            N.appendLine("Error decoding given license."), t.window.showErrorMessage(T.GlobalResources.Get().GetString(__filename, "invalidLicenseKey")), S.client.trackException({
                exception: e
            }), De()
        }
    })
}