"use strict";module.exports=function(s){require("source-map-support").install();var i=require("./core/modbus-core"),r=require("./modbus-basics"),o=[];s.nodes.registerType("modbus-response-filter",function(e){s.nodes.createNode(this,e),this.name=e.name,this.filter=e.filter,this.registers=parseInt(e.registers)||null,this.filterResponseBuffer=e.filterResponseBuffer,this.filterValues=e.filterValues,this.filterInput=e.filterInput,this.showStatusActivities=e.showStatusActivities,this.showErrors=e.showErrors,this.showWarnings=e.showWarnings,this.ioFile=s.nodes.getNode(e.ioFile);var t=this;o=t.ioFile.configData,r.setNodeStatusTo("active",t),t.ioFile.on("updatedConfig",function(e){o=e}),t.filterFromPayload=function(e){return e.payload=e.payload.filter(function(e){return e.name===t.filter}),t.filterResponseBuffer&&delete e.responseBuffer,t.filterValues&&delete e.values,t.filterInput&&delete e.input,e},t.on("input",function(e){r.invalidPayloadIn(e)||(!(t.registers&&0<t.registers)||e.payload.length&&e.payload.length===t.registers?t.send(t.filterFromPayload(e)):(t.showErrors&&t.error(new Error(e.payload.length+" does not match "+t.registers)),t.showWarnings&&i.internalDebug(e.payload.length+" Registers And Filter Length Of "+t.registers+" Does Not Match")))}),t.on("close",function(){r.setNodeStatusTo("closed",t)})}),s.httpAdmin.get("/modbus/iofile/valuenames",s.auth.needsPermission("iofile.read"),function(e,t){t.json(o)})};
//# sourceMappingURL=maps/modbus-response-filter.js.map
