import deviceClient from '@iotize/device-client.js';
import configurator from '@iotize/device-client.js/configurator';

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 schemaConfiguration = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });


function applyConfig(schema) {
    return new configurator.SchemaTapConfigurator(schema, {
        delayMs: 400
    }).configure(this);
}
exports.applyConfig = applyConfig;
Object.defineProperty(deviceClient.IoTizeDevice.prototype, 'configurator', {
    get: function () {
        if (!this['__configurator__']) {
            this['__configurator__'] = new TapConfiguratorExtension(this, {
                delayMs: 400
            });
        }
        return this['__configurator__'];
    },
    enumerable: false,
    configurable: true
});
deviceClient.IoTizeDevice.prototype.applyConfig = applyConfig;
/**
 * Tempory class in order not to break SchemaTapConfigurator API
 */
var TapConfiguratorExtension = /** @class */ (function () {
    function TapConfiguratorExtension(tap, options) {
        this.tap = tap;
        this.options = options;
    }
    Object.defineProperty(TapConfiguratorExtension.prototype, "_schemaConfigurator", {
        get: function () {
            var schema = new configurator.SchemaTapConfigurator({}, this.options);
            schema.tap = this.tap;
            return schema;
        },
        enumerable: true,
        configurable: true
    });
    TapConfiguratorExtension.prototype.configure = function (schema, options) {
        if (options === void 0) { options = {
            delayMs: 400
        }; }
        return new configurator.SchemaTapConfigurator(schema, options)
            .configure(this.tap);
    };
    TapConfiguratorExtension.prototype.setupConfigState = function () {
        return this._schemaConfigurator.setupConfigState();
    };
    TapConfiguratorExtension.prototype.applyConfig = function (newVersion) {
        if (newVersion === void 0) { newVersion = "1.0.0"; }
        return this._schemaConfigurator.applyConfig(newVersion);
    };
    TapConfiguratorExtension.prototype.isConfigured = function () {
        return this._schemaConfigurator.isConfigured();
    };
    return TapConfiguratorExtension;
}());

});

var schemaConfiguration$1 = unwrapExports(schemaConfiguration);
var schemaConfiguration_1 = schemaConfiguration.applyConfig;

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(schemaConfiguration);

});

var public_api$1 = unwrapExports(public_api);

var iotizeDeviceClient_jsExtConfigurator = 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_jsExtConfigurator$1 = unwrapExports(iotizeDeviceClient_jsExtConfigurator);

export default iotizeDeviceClient_jsExtConfigurator$1;
//# sourceMappingURL=iotize-device-client.js-ext-configurator.js.map
