"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const rxjs_1 = require("rxjs");
const operators_1 = require("rxjs/operators");
const appSupportsQuitApp_1 = __importDefault(require("../appSupportsQuitApp"));
const quitApp_1 = __importDefault(require("./quitApp"));
const attemptToQuitApp = (transport, appAndVersion) => appAndVersion && (0, appSupportsQuitApp_1.default)(appAndVersion)
    ? (0, rxjs_1.from)((0, quitApp_1.default)(transport)).pipe((0, operators_1.concatMap)(() => (0, rxjs_1.of)({
        type: "appQuitted",
    })), (0, operators_1.catchError)(e => (0, rxjs_1.throwError)(() => e)))
    : (0, rxjs_1.of)({
        type: "appDetected",
    });
exports.default = attemptToQuitApp;
//# sourceMappingURL=attemptToQuitApp.js.map