"use strict";
var __extends = (this && this.__extends) || (function () {
    var extendStatics = function (d, b) {
        extendStatics = Object.setPrototypeOf ||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
            function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        if (typeof b !== "function" && b !== null)
            throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var framepay_error_1 = __importDefault(require("../../framepay-error"));
var base_element_1 = __importDefault(require("./base-element"));
var GooglePayElement = /** @class */ (function (_super) {
    __extends(GooglePayElement, _super);
    function GooglePayElement() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    GooglePayElement.prototype.setupElement = function () {
        var _this = this;
        var Framepay = this.props.Framepay;
        var makeElement = function () {
            // elementNode already checked in BaseElement.handleSetupElement
            // just ts checks fix
            if (!_this.elementNode) {
                throw (0, framepay_error_1.default)({
                    code: framepay_error_1.default.codes.elementMountError,
                    details: "GooglePayElement invalid elementNode",
                });
            }
            try {
                return Framepay.googlePay.mount(_this.elementNode);
            }
            catch (e) {
                throw (0, framepay_error_1.default)({
                    code: framepay_error_1.default.codes.elementMountError,
                    details: "GooglePayElement error in remote api call",
                    trace: e,
                });
            }
        };
        var element = makeElement();
        this.setState({ element: element });
    };
    return GooglePayElement;
}(base_element_1.default));
exports.default = GooglePayElement;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ29vZ2xlcGF5LWVsZW1lbnQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvbGliL2NvbXBvbmVudHMvZWxlbWVud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