!function(){"use strict";angular.module("urish.promisesToolkit",[]).service("ngPromisesToolkit",["$window","$rootScope",function(a,b){function c(a){return Object.create(e,{$$promise:{value:a,writable:!1}})}var d,e={then:function(){return c(this.$$promise.then.apply(this.$$promise,arguments))},"catch":function(){return c(this.$$promise.catch.apply(this.$$promise,arguments))},"finally":function(){return c(this.$$promise.finally.apply(this.$$promise,arguments))},progress:function(a){return this.then(void 0,void 0,a)},forward:function(a){return this.then(function(b){return a.resolve(b),b},function(b){return a.reject(b),d.reject(b)},function(b){return a.notify(b),b})},timeout:function(c,e){var f=d.defer();(angular.isUndefined(e)||angular.isString(e))&&(e=new Error(e||"Timed out after "+c+" ms"),e.code="ETIMEDOUT");var g=a.setTimeout(function(){b.$apply(function(){f.reject(e)})},c);return this.forward(f).finally(function(){window.clearTimeout(g)}),f.promise},property:function(a){return this.then(function(b){return b[a]})},assignTo:function(a,b){return this.then(function(c){a[b]=c})}};this._init=function(a){d=a},this.PromisePrototype=e,this.wrapPromise=c}]).config(function(a){a.decorator("$q",function(a,b){function c(c){return function(){return b.wrapPromise(c.apply(a,arguments))}}var d=a.defer;return a.defer=function(){var c=d.apply(a,arguments);return c.promise=b.wrapPromise(c.promise),c},a.reject=c(a.reject),a.when=c(a.when),a.all=c(a.all),b._init(a),a})})}();