var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    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) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
import swal from 'sweetalert';
export const Alert = {
    setDefaults: swal.setDefaults,
    alert: (options) => __awaiter(this, void 0, void 0, function* () {
        if (typeof options === 'string') {
            return swal(options);
        }
        else {
            const args = {
                title: options.title,
                text: options.text
            };
            if (options.showCancelButton) {
                args.buttons = [
                    options.cancelButtonText || true,
                    options.confirmButtonText || true
                ];
            }
            else {
                if (options.confirmButtonText) {
                    args.button = options.confirmButtonText;
                }
            }
            return swal(args)
                .then((isConfirm) => {
                if (isConfirm) {
                    if (options.onConfirm) {
                        options.onConfirm();
                    }
                }
                else {
                    if (options.onCancel) {
                        options.onCancel();
                    }
                }
            });
        }
    })
};
//# sourceMappingURL=Alert.web.js.map