(function(a){a.promise=function(d){var e=[],h="resolve",g="reject",b="function",f=function(k,j,i){if(e.length&&typeof(cb=e.shift()[k])==b&&(i=cb.apply(j,i))){f(h,j,[i])}},c=[function(){f(h,d,arguments)},function(){f(g,d,arguments)},function(j,i){e.push({resolve:j,reject:i});return d}];if(typeof(d=d||{})==b){d.__v=d.apply(d,c)}return[h,g,"then"].reduce(function(k,l,j){return Object.defineProperty(k,l,{value:c[j],enumerable:false,writable:false,configurable:false})},d)}})(window.promise=window.promise||{});