Object.defineProperty(exports, "__esModule", { value: true });
//TODO: Implement wrap checkbox property in editor
module.exports = function (actionAPI) {
    //Handle the action when executed
    actionAPI.handle(function (properties, status) {
        var connectionID = properties.connectionID != undefined ? properties.connectionID : 'none';
        var wrap = properties.wrap != undefined ? properties.wrap : true;
        if (connectionID != 'none') {
            var connection = actionAPI.getConnection('mitti', connectionID);
            var mitti = connection.instance;
            mitti
                .previous(wrap)
                .then(function () {
                status("Previous clip has been selected", 'info');
            })
                .catch(function (error) {
                status(error.message, 'error');
            });
        }
        else
            status('No connection specified', 'error');
    });
    //Handle the interactive editor
    actionAPI.onOpenEditor(function (editorAPI, properties) {
        var connectionID = properties.connectionID != undefined ? properties.connectionID : 'none';
        var wrap = properties.wrap != undefined ? properties.wrap : true;
        editorAPI.onFieldChanges(function (fields) {
            var fieldValues = editorAPI.tools.objectifyFieldsValues(fields);
            editorAPI.saveProperties({ connectionID: fieldValues.connectionID, wrap: fieldValues.wrap });
        });
        editorAPI.setFields([
            {
                id: 'connectionID',
                name: 'Connection',
                type: 'connection',
                value: connectionID,
                connectionType: 'mitti'
            },
            {
                id: 'wrap',
                name: 'Wrap',
                type: 'checkbox',
                value: true
            }
        ]);
    });
};
//# sourceMappingURL=next.js.map