function BMXAPIResponseValidator(e,t){function u(){a(),r&&f()}function a(){n=0,r=t,i=null,s="",o={valid:!1}}function f(t){var o;t||(t=r);for(o=0;o<t.length;o++){var u=t[o].status,a=t[o].responseJSON;if(u<400)if(a||u!=BMXWorker.ResponseMessageCode.SUCCESS)continue;switch(u){case BMXWorker.ResponseMessageCode.UNAUTHORIZED:n=e.errorDefines.getErrorCode("BMX_UNAUTHORIZED_ACCESS");break;case BMXWorker.ResponseMessageCode.BAD_REQUEST:n=e.errorDefines.getErrorCode("BMX_INVALID_REQUEST_ERROR");break;case BMXWorker.ResponseMessageCode.FORBIDDEN:n=e.errorDefines.getErrorCode("MUSIC_SERVICE_API_ERROR");break;case BMXWorker.ResponseMessageCode.SERVICE_UNAVAILABLE:n=e.errorDefines.getErrorCode("MUSIC_SERVICE_COULD_NOT_CONNECT");break;default:n=e.errorDefines.getErrorCode("MUSIC_SERVICE_API_ERROR")}a&&(i=h(a),s=a.debugText);break}}function l(){var e={valid:!0};return n!==0&&(e={valid:!1,errorCode:n,errorText:s,customError:i}),e}function c(){return n===0}function h(e){var t=null;if(e){var n=e.reason&&e.reason.verbose?e.reason.verbose:"";t={title:e.name||"",message:n,options:[]};if(e.buttons)for(var r=0;r<e.buttons.length;++r)t.options.push({label:e.buttons[r].name,url:e.buttons[r].url})}return t}var n,r,i,s,o;this.getValidationResults=l,this.isValid=c,u()};