!function(name,context,definition){context[name]=definition(),"undefined"!=typeof module&&module.exports?module.exports=context[name]:"function"==typeof define&&define.amd&&define(function(){return context[name]})}("Promise","undefined"!=typeof global?global:this,function(){"use strict";function schedule(fn,self){scheduling_queue.add(fn,self),cycle||(cycle=timer(scheduling_queue.drain))}function isThenable(o){var _then,o_type=typeof o;return null==o||"object"!=o_type&&"function"!=o_type||(_then=o.then),"function"==typeof _then&&_then}function notify(){for(var i=0;i0&&schedule(notify,self))}catch(err){reject.call(new MakeDefWrapper(self),err)}}}function reject(msg){var self=this;self.triggered||(self.triggered=!0,self.def&&(self=self.def),self.msg=msg,self.state=2,self.chain.length>0&&schedule(notify,self))}function iteratePromises(Constructor,arr,resolver,rejecter){for(var idx=0;idx