(function(a){a.http=function(c,i,f,h){var e=a.promise,g=function(l,j,k){if(typeof l=="object"){for(var m in l){if(l.hasOwnProperty(m)){j(m,l[m])}}}else{k&&k()}},d=function(m,k,j,l){return new e(function(n,v){var o=new XMLHttpRequest(),u="?",t="&",r=encodeURIComponent,q="",s="Content-Type",p="application/x-www-form-urlencoded";g(j,function(x,w){q+=t+r(x)+"="+r(w)},function(){q=j});if(m!="POST"&&m!="PUT"){k+=(k.indexOf(u)>-1?t:u)+q.substr(1);q=null}o.onload=function(){if(o.status>=200&&o.status<300){n(o.response)}else{v(o.statusText)}};o.onerror=function(){v(o.statusText)};o.open(m,k);l=l||{};l[s]=l[s]||p;g(l,function(x,w){o.setRequestHeader(x,w)});o.send(q);return o})},b=new e(["HEAD","GET","POST","PUT","DELETE"].reduce(function(k,j){k[j.toLowerCase()]=function(l,m){return d(j,c,l,m)};return k},{}));return i?b[i.toLowerCase()](f,h):b}})(window.promise=window.promise||{});