text: define(["exports"],(function(n){"use strict";function r(n,r){return null!=n?n:r}var t,e,u;function o(n,r,t,e){return i(n).then(r,t,e)}function i(n){var r,t;return n=n instanceof c?n:h(n)?(r=s(),n.then((function(n){r.resolve(n)}),(function(n){r.reject(n)}),(function(n){r.progress(n)})),r.promise):(t=n,new c((function(n){try{return i(n?n(t):t)}catch(n){return f(n)}})))}function c(n){this.then=n}function f(n){return new c((function(r,t){try{return t?i(t(n)):f(n)}catch(r){return f(r)}}))}function s(){var n=new c(l),r=[],t=[],e=function(n,e,u){var o=s(),i="function"==typeof u?function(n){try{o.progress(u(n))}catch(n){o.progress(n)}}:function(n){o.progress(n)};return r.push((function(r){r.then(n,e).then(o.resolve,o.reject,i)})),t.push(i),o.promise},o=function(n){return v(t,n),n},h=function(n){return n=i(n),e=n.then,h=i,o=y,v(r,n),t=r=u,n};return{then:l,resolve:a,reject:p,progress:g,promise:n,resolver:{resolve:a,reject:p,progress:g}};function l(n,r,t){return e(n,r,t)}function a(n){return h(n)}function p(n){return h(f(n))}function g(n){return o(n)}}function h(n){return n&&"function"==typeof n.then}function l(n,r,t,e,u){return g(2,arguments),o(n,(function(n){var i,c,f,h,l=n.length>>>0,a=Math.max(0,Math.min(r,l)),p=[],v=l-a+1,g=[],j=s();if(a)for(f=j.progress,c=function(n){g.push(n),--v||(i=c=y,j.reject(g))},i=function(n){p.push(n),--a||(i=c=y,j.resolve(p))},h=0;h<l;++h)h in n&&o(n[h],w,m,f);else j.resolve(p);return j.then(t,e,u);function m(n){c(n)}function w(n){i(n)}}))}function a(n,r,t,e){return g(1,arguments),p(n,j).then(r,t,e)}function p(n,r){return o(n,(function(n){var t,e,u,i=t=n.length>>>0,c=[],f=s();if(i)for(e=function(n,t){o(n,r).then((function(n){c[t]=n,--i||f.resolve(c)}),f.reject)},u=0;u<t;u++)u in n?e(n[u],u):--i;else f.resolve(c);return f.promise}))}function v(n,r){for(var t,e=0;t=n[e++];)t(r)}function g(n,r){for(var t,e=r.length;n<e;)if(null!=(t=r[--e])&&"function"!=typeof t)throw new Error("arg "+e+" must be a function")}function y(){}function j(n){return n}r.EMPTY_OBJECT=Object.freeze({}),o.defer=s,o.resolve=i,o.reject=function(n){return o(n,f)},o.join=function(){return p(arguments,j)},o.all=a,o.map=p,o.reduce=function(n,r){var u=e.call(arguments,1);return o(n,(function(n){var e=n.length;return u[0]=function(n,t,u){return o(n,(function(n){return o(t,(function(t){return r(n,t,u,e)}))}))},t.apply(n,u)}))},o.any=function(n,r,t,e){return l(n,1,(function(n){return r?r(n[0]):n[0]}),t,e)},o.some=l,o.chain=function(n,r,t){var e=2<arguments.length;return o(n,(function(n){return r.resolve(n=e?t:n),n}),(function(n){return r.reject(n),f(n)}),r.progress)},o.isPromise=h,c.prototype={always:function(n,r){return this.then(n,n,r)},otherwise:function(n){return this.then(u,n)},yield:function(n){return this.then((function(){return n}))},spread:function(n){return this.then((function(r){return a(r,(function(r){return n.apply(u,r)}))}))}},e=[].slice,t=[].reduce||function(n){var r,t=0,e=Object(this),u=e.length>>>0,o=arguments;if(o.length<=1)for(;;){if(t in e){r=e[t++];break}if(++t>=u)throw new TypeError}else r=o[1];for(;t<u;++t)t in e&&(r=n(r,e[t],t,e));return r},n.defaultValue=r,n.defined=function(n){return null!=n},n.when=o}));