module.exports=function(i){require("source-map-support").install();var s=require("./core/modbus-core"),o=require("./modbus-basics"),r=[],n=null;i.nodes.registerType("modbus-response-filter",function(e){i.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=i.nodes.getNode(e.ioFile);var t=this;n=t.ioFile,r=t.ioFile&&void 0!==t.ioFile.configData?t.ioFile.configData:r,o.setNodeStatusTo("active",t),t.ioFile.on("updatedConfig",function(e){r=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){o.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&&s.internalDebug(e.payload.length+" Registers And Filter Length Of "+t.registers+" Does Not Match")))}),t.on("close",function(){o.setNodeStatusTo("closed",t)})}),i.httpAdmin.get("/modbus/iofile/valuenames",i.auth.needsPermission("iofile.read"),function(e,t){if(n&&void 0!==n.configData)return t.json(n.configData);t.json(r)})};
//# sourceMappingURL=maps/modbus-response-filter.js.map
