Object.defineProperty(exports, "__esModule", { value: true });
module.exports = function (actionAPI) {
    actionAPI.handle(function (properties, status) {
        var connectionID = properties.connectionID != undefined && properties.connectionID.length > 0
            ? properties.connectionID
            : 'none';
        var duration = properties.duration != undefined
            ? properties.duration
            : 0;
        if (connectionID != 'none') {
            var connection = actionAPI.getConnection('protor', connectionID);
            if (connection && connection.instance != undefined) {
                var protor = connection.instance;
                protor.fadeIn(duration);
            }
            else
                status('Connection not online', 'error');
        }
        else
            status('No connection specified', 'error');
    });
    actionAPI.onOpenEditor(function (editorAPI, properties) {
        var connectionID = properties.connectionID != undefined
            ? properties.connectionID
            : 'none';
        var duration = properties.duration != undefined
            ? properties.duration
            : 0;
        var connectionField = {
            id: 'connectionID',
            name: 'connection',
            type: 'connection',
            connectionType: 'protor',
            value: connectionID
        };
        var durationField = {
            id: 'duration',
            name: 'Duration',
            type: 'number',
            value: duration
        };
        editorAPI.setFields([connectionField, durationField]);
        editorAPI.onFieldChanges(function (fields) {
            var fieldObject = editorAPI.tools.objectifyFieldsValues(fields);
            editorAPI.saveProperties({ connectionID: fieldObject.connectionID, duration: fieldObject.duration });
        });
    });
};
//# sourceMappingURL=fadeIn.js.map