var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};

function commonjsRequire () {
	throw new Error('Dynamic requires are not currently supported by rollup-plugin-commonjs');
}

function unwrapExports (x) {
	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}

function createCommonjsModule(fn, module) {
	return module = { exports: {} }, fn(module, module.exports), module.exports;
}

function getCjsExportFromNamespace (n) {
	return n && n['default'] || n;
}

var definitions = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var ConnectionState;
(function (ConnectionState) {
    ConnectionState[ConnectionState["DISCONNECTED"] = 0] = "DISCONNECTED";
    ConnectionState[ConnectionState["CONNECTING"] = 1] = "CONNECTING";
    ConnectionState[ConnectionState["CONNECTED"] = 2] = "CONNECTED";
    ConnectionState[ConnectionState["DISCONNECTING"] = 3] = "DISCONNECTING";
})(ConnectionState = exports.ConnectionState || (exports.ConnectionState = {}));

});

var definitions$1 = unwrapExports(definitions);
var definitions_1 = definitions.ConnectionState;

var comProtocol_interface = createCommonjsModule(function (module, exports) {
"use strict";
var __extends = (commonjsGlobal && commonjsGlobal.__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 (b.hasOwnProperty(p)) d[p] = b[p]; };
        return extendStatics(d, b);
    };
    return function (d, b) {
        extendStatics(d, b);
        function __() { this.constructor = d; }
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
var ComProtocol;
(function (ComProtocol) {
    var Errors = /** @class */ (function (_super) {
        __extends(Errors, _super);
        // private static fromErrorCode(code: ErrorCode) {
        //     return new ComProtocolError(code, ComProtocolError.errorCodeToMessage(code));
        // }
        // public static errorCodeToMessage(code: ErrorCode): string {
        //     switch (code) {
        //         case ErrorCode.ProtocolNotConnected:
        //             return
        //         case ErrorCode.TimeoutError:
        //             return "request timeout";
        //         default:
        //             return "unknown error"
        //     }
        // }
        function Errors(code, msg) {
            var _this = _super.call(this, msg) || this;
            _this.code = code;
            return _this;
        }
        Errors.operationCanceled = function () {
            return new Errors(ErrorCode.OperationCancelled, 'Communication protocol operation cancelled');
        };
        Errors.notConnected = function (info) {
            return new Errors(ErrorCode.ProtocolNotConnected, 'Communication protocol is not connected');
        };
        Errors.timeoutError = function (info) {
            return new Errors(ErrorCode.TimeoutError, info.msg || 'Communication protocol timeout');
        };
        Errors.unknownError = function () {
            return new Errors(ErrorCode.UnknownError, 'Unnown communication protocol error');
        };
        return Errors;
    }(Error));
    ComProtocol.Errors = Errors;
    var ErrorCode;
    (function (ErrorCode) {
        ErrorCode["ProtocolNotConnected"] = "ProtocolNotConnected";
        ErrorCode["TimeoutError"] = "TimeoutError";
        ErrorCode["UnknownError"] = "UnknownError";
        ErrorCode["OperationCancelled"] = "OperationCancelled";
    })(ErrorCode = ComProtocol.ErrorCode || (ComProtocol.ErrorCode = {}));
})(ComProtocol = exports.ComProtocol || (exports.ComProtocol = {}));

});

var comProtocol_interface$1 = unwrapExports(comProtocol_interface);
var comProtocol_interface_1 = comProtocol_interface.ComProtocol;

var public_api = createCommonjsModule(function (module, exports) {
"use strict";
function __export(m) {
    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(definitions);
__export(comProtocol_interface);

});

var public_api$1 = unwrapExports(public_api);

var iotizeDeviceClient_jsProtocolApi = createCommonjsModule(function (module, exports) {
"use strict";
/**
 * Generated bundle index. Do not edit.
 */
function __export(m) {
    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
Object.defineProperty(exports, "__esModule", { value: true });
__export(public_api);

});

var iotizeDeviceClient_jsProtocolApi$1 = unwrapExports(iotizeDeviceClient_jsProtocolApi);

export default iotizeDeviceClient_jsProtocolApi$1;
//# sourceMappingURL=iotize-device-client.js-protocol-api.js.map
