/*! grafana - v3.1.0 - 2016-07-18
 * Copyright (c) 2016 Torkel Ödegaard; Licensed Apache-2.0 */

define(["angular","lodash","jquery","../core_module"],function(a,b,c,d){"use strict";d["default"].controller("InspectCtrl",["$scope",function(d){function e(a){for(var b=[],c=a.split("&"),d=0;d<c.length;d++){var e=c[d].split("=");e[1].length>0&&b.push({key:e[0],value:window.unescape(e[1])})}return b}var f=d.inspector;d.init=function(){d.editor={index:0},f.error&&(b.isString(f.error.data)?d.response=c("<div>"+f.error.data+"</div>").text():f.error.data?d.response=a.toJson(f.error.data,!0):f.error.message&&(d.message=f.error.message),f.error.config&&f.error.config.params&&(d.request_parameters=b.map(f.error.config.params,function(a,b){return{key:b,value:a}})),f.error.stack&&(d.editor.index=2,d.stack_trace=f.error.stack,d.message=f.error.message),f.error.config&&f.error.config.data&&(d.editor.index=1,b.isString(f.error.config.data)?d.request_parameters=e(f.error.config.data):d.request_parameters=b.map(f.error.config.data,function(b,c){return{key:c,value:a.toJson(b,!0)}})))}}])});