/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/node-nzbget@0.0.4/lib/nzbget.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
var request=require("request"),qs=require("querystring"),q=require("q"),NzbGet=function(t){this.username=t.username,this.password=t.password,this.url=t.url,"/"!=this.url[this.url.length-1]&&(this.url+="/"),this.debug=!0===t.debug};NzbGet.prototype.cmd=function(t,e){var r=this.username+":"+this.password+"@"+this.url+"jsonrpc/"+t;"http"!=r.substring(0,4)&&(r="http://"+r);var s=q.defer();return request({uri:r,json:!0},(function(t,e,r){if(e&&200==e.statusCode)if(t)s.reject(t);else if(200==e.statusCode&&!t&&r){try{r=JSON.parse(r)}catch(t){}s.resolve(r)}else s.reject(new Error("Body did not contain data"));else s.reject(new Error("Did not return 200"))})),s.promise},NzbGet.prototype.version=function(){return this.cmd("version").then((function(t){return t.success}))},NzbGet.prototype.history=function(){return this.cmd("history").then((function(t){return t}))},NzbGet.prototype.status=function(){return this.cmd("status").then((function(t){return t}))},NzbGet.prototype.listgroups=function(){return this.cmd("listgroups").then((function(t){return t}))},NzbGet.prototype.listfiles=function(){return this.cmd("listfiles").then((function(t){return t}))},module.exports=NzbGet;
//# sourceMappingURL=/sm/07f977005fe96abb2fc50ac566bc0144eac5fa1ac4de0da6001624a830fef9d5.map