!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n;n="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,n.transduceX=t()}}(function(){return function t(n,e,r){function o(i,s){if(!e[i]){if(!n[i]){var c="function"==typeof require&&require;if(!s&&c)return c(i,!0);if(u)return u(i,!0);var f=new Error("Cannot find module '"+i+"'");throw f.code="MODULE_NOT_FOUND",f}var a=e[i]={exports:{}};n[i][0].call(a.exports,function(t){var e=n[i][1][t];return o(e?e:t)},a,a.exports,t,n,e,r)}return e[i].exports}for(var u="function"==typeof require&&require,i=0;ie;e++)n[e]=arguments[e];for(var r=[],o=n.length,u=0;o>u;u++)r.push(n[u]),r.push(j());return p.compose.apply(null,r)}function c(t,n,e){function r(t,n){if(i)return!0;if(t=t||null,p.isReduced(u)&&(u=p.unreduced(u),i=!0),(t||i||void 0===n)&&(u=o[m](u),i=!0),i)if(e)e(t,u),e=null,u=null;else if(t)throw u=null,t;return i}var o,u,i=!1,s=h.transformer(n);return o=t(s),u=o[v](),function(t,n){if(!r(t,n))try{u=o[y](u,n),r(t,n)}catch(e){r(e,n)}return i?u:void 0}}function f(t,n,e){function r(n){n&&t.emit("error",n),t.emit("end")}function o(t){f(null,t)}function u(t){f(t)}function i(){f(),s()}function s(){e.removeListener(o).removeListener(u).removeListener(i)}var f;return n=p.compose(n,A(t)),f=c(n,null,r),e.on("data",o),e.once("error",u),e.once("end",i),t}e.__esModule=!0,e.compose=s,e.callback=c,e.emitInto=f;var a=t(5),l=r(a),p=t(8),h=t(7),d=p.protocols.transducer,v=d.init,y=d.step,m=d.result,w=h.reduceImpl(i);e.reduce=w;var x=h.transduceImpl(i);e.transduce=x;var _=h.intoImpl(i);e.into=_;var b=function(t){return h.iterable(t)[p.protocols.iterator]()},g=function(t){return{done:!1,value:t}},O=function(){function t(n,e,r){u(this,t),this.xf=r,this.iter=n,this.value=e,this._step=this.__step.bind(this),this._loop=this.__loop.bind(this)}return t.prototype.iterate=function(){return l["default"].resolve(this.next()).then(this._step)},t.prototype.next=function(){var t=this;return new l["default"](function(n,e){try{var r=t.iter.next();r.done||(r=l["default"].resolve(r.value).then(g)),n(r)}catch(o){e(o)}})},t.prototype.__step=function(t){var n=this;return new l["default"](function(e,r){try{var o;o=t.done?n.xf[m](n.value):l["default"].resolve(n.xf[y](n.value,t.value)).then(n._loop),e(o)}catch(u){r(u)}})},t.prototype.__loop=function(t){var n=this;return this.value=t,new l["default"](function(e,r){try{var o;o=p.isReduced(t)?n.xf[m](p.unreduced(t)):n.iterate(),e(o)}catch(u){r(u)}})},t}(),j=function(){return T()};e.defer=j;var T=function(t){return function(n){return new I(t,n)}};e.delay=T;var I=function(){function t(n,e){u(this,t);var r=new k(n,e);this.xf=e,this.task=r,this._step=r.step.bind(r),this._result=r.result.bind(r)}return t.prototype[v]=function(){return this.task.resolved?this.task.resolved:l["default"].resolve(this.xf[v]())},t.prototype[y]=function(t,n){return this.task.resolved?this.task.resolved:l["default"].all([t,n]).then(this._step)},t.prototype[m]=function(t){return this.task.resolved?this.task.resolved:l["default"].resolve(t).then(this._result)},t}(),k=function(){function t(n,e){u(this,t),this.wait=n,this.xf=e,this.q=[]}return t.prototype.call=function(){var t=this.q[0];if(t&&!t.processing){t.processing=!0;var n=t.wait;n>0?setTimeout(t.fn,n):t.fn()}},t.prototype.step=function(t){var n=t[0],e=t[1],r=this;return new l["default"](function(t,o){function u(){try{t(r.xf[y](n,e)),r.q.shift(),r.q.length>0&&r.call()}catch(u){o(u)}}r.q.push({fn:u,wait:r.wait}),r.call()})},t.prototype.result=function(t){var n=this;return n.resolved=new l["default"](function(e,r){function o(){try{n.q=[],e(n.xf[m](t))}catch(o){r(o)}}n.q.push({fn:o}),n.call()}),n.resolved},t}(),S=function(t,n){return l["default"].resolve(t).then(q(n))};e.when=S;var q=function(t){return function(n){return new l["default"](function(e,r){var o=c(t,null,function(t,n){t?r(t):e(n)});o(null,n),o()})}};e.promiseTransform=q;var A=function(t){return function(n){return new F(t,n)}},F=function(t){function n(e,r){u(this,n),t.call(this,r),this.emitter=e}return o(n,t),n.prototype[y]=function(t,n){return this.emitter.emit("data",n),t},n}(p.Transducer)},{5:5,7:7,8:8}],3:[function(t,n,e){"use strict";function r(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function o(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+typeof n);t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(Object.setPrototypeOf?Object.setPrototypeOf(t,n):t.__proto__=n)}e.__esModule=!0;var u=t(8),i=u.protocols.transducer,s=i.step,c=i.result,f=function(t,n){return function(e){return new a(t,n,e)}};e.gen=f;var a=function(t){function n(e,o,u){r(this,n),t.call(this,u),this.stepper=new l(e,u),this.completer=o}return o(n,t),n.prototype[s]=function(t,n){return this.stepper.step(t,n)},n.prototype[c]=function(t){return this.completer&&this.completer(this.stepper._step),this.xfResult(t)},n}(u.Transducer),l=function(){function t(n,e){var o=this;r(this,t),this.xf=e,this._step=function(t){o.value=o.xf[s](o.value,t)},this.gen=n(this._step)}return t.prototype.step=function(t,n){var e=this.next,r=this.gen;return this.value=t,void 0===e&&(e=r.next()),e.done||(e=r.next(n)),this.next=e,e.done?u.reduced(this.value):this.value},t}()},{8:8}],4:[function(t,n,e){"use strict";function r(t){if(t&&t.__esModule)return t;var n={};if(null!=t)for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e]);return n["default"]=t,n}e.__esModule=!0;var o=t(2),u=r(o),i=t(3);e.async=u,e.gen=i.gen},{2:2,3:3}],5:[function(t,n,e){n.exports=t(6)().Promise},{6:6}],6:[function(t,n,e){"use strict";function r(){return o}var o={Promise:window.Promise,implementation:"window.Promise"};n.exports=r},{}],7:[function(t,n,e){"use strict";function r(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function o(t){return function(n,e,r,o){return h.isFunction(e)&&(e=x(e)),e=n(e),3===arguments.length&&(o=r,r=e[v]()),t(e,r,o)}}function u(t){return function(n,e,r){return h.isFunction(n)&&(n=x(n)),2===arguments.length&&(r=e,e=n[v]()),t(n,e,r)}}function i(t){function n(n){return function(r,o){return 1===arguments.length?h.isFunction(r)?e(n,r):(o=r,t(n,n[v](),o)):t(r(n),n[v](),o)}}function e(n,e){return function(r){return t(e(n),n[v](),r)}}return function(r,o,u){var i=a(r),s=arguments.length;return 1===s?n(i):2===s?h.isFunction(o)?e(i,o):(u=o,t(i,r,u)):t(o(i),r,u)}}function s(t,n){this[v]=t,this[y]=t,this[m]=n||h.identity}function c(t){return f(t)[w]()}function f(t){var n;return n=void 0!==t[w]?t:h.isArray(t)||h.isString(t)?new b(t):h.isFunction(t)?new g(function(){return{done:!1,value:t()}}):h.isFunction(t.next)?new g(function(){return t.next()}):new O(t)}function a(t){var n;return n=void 0===t||null===t?T:h.isFunction(t[y])?t:h.isFunction(t)?x(t):h.isArray(t)?new I(t):h.isString(t)?new k(t):new S(t)}function l(t,n){if(h.isArray(n)&&2===n.length)t[n[0]]=n[1];else{var e;for(e in n)_.call(n,e)&&(t[e]=n[e])}return t}e.__esModule=!0;var p;e.transduceImpl=o,e.reduceImpl=u,e.intoImpl=i,e.iterator=c,e.iterable=f,e.transformer=a;var h=t(8),d=h.protocols.transducer,v=d.init,y=d.step,m=d.result,w=h.protocols.iterator,x=function(t,n){return new s(t,n)};e.completing=x;var _={}.hasOwnProperty,b=function(){function t(n){r(this,t),this.arr=n}return t.prototype[w]=function(){var t=this,n=0;return{next:function(){return n>=t.arr.length?{done:!0}:{done:!1,value:t.arr[n++]}}}},t}();e.ArrayIterable=b;var g=function(){function t(n){r(this,t),this.fn=n}return t.prototype[w]=function(){return{next:this.fn}},t}();e.FunctionIterable=g;var O=function(){function t(n){r(this,t),this.obj=n,this.keys=Object.keys(n)}return t.prototype[w]=function(){var t=this,n=0;return{next:function(){if(n>=t.keys.length)return{done:!0};var e=t.keys[n++];return{done:!1,value:[e,t.obj[e]]}}}},t}();e.ObjectIterable=O;var j=Array.prototype.slice,T=(p={},p[v]=function(){},p[y]=function(t,n){return n},p[m]=h.identity,p),I=function(){function t(n){r(this,t),this.defaultValue=void 0===n?[]:n}return t.prototype[v]=function(){return j.call(this.defaultValue)},t.prototype[y]=function(t,n){return t.push(n),t},t.prototype[m]=function(t){return t},t}();e.ArrayTransformer=I;var k=function(){function t(n){r(this,t),this.strDefault=void 0===n?"":n}return t.prototype[v]=function(){return this.strDefault},t.prototype[y]=function(t,n){return t+n},t.prototype[m]=function(t){return t},t}();e.StringTransformer=k;var S=function(){function t(n){r(this,t),this.objDefault=void 0===n?{}:l({},n)}return t.prototype[v]=function(){return l({},this.objDefault)},t.prototype[m]=function(t){return t},t}();e.ObjectTransformer=S,S.prototype[y]=l},{8:8}],8:[function(t,n,e){"use strict";function r(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}function o(t){var n="[object "+t+"]";return function(t){return n===l.call(t)}}function u(t){return!!(m(t)||p(t)||t&&t[_.iterator])}function i(t){return!(!t||!h(t.next))}function s(){var t=arguments;return function(n){for(var e=t.length;e--;)n=t[e](n);return n}}function c(t,n){return(n||!j(t))&&(t=new f(t)),t}function f(t){this[g]=t,this[O]=!0}function a(t){return j(t)&&(t=t[g]),t}e.__esModule=!0,e.isIterable=u,e.isIterator=i,e.compose=s,e.reduced=c,e.unreduced=a;var l=Object.prototype.toString,p=({}.hasOwnProperty,Array.isArray||o("Array"));e.isArray=p;var h=function(t){return"function"==typeof t};e.isFunction=h;var d=function(t){return void 0===t};e.isUndefined=d;var v=o("Number");e.isNumber=v;var y=o("RegExp");e.isRegExp=y;var m=o("String");e.isString=m;var w=function(t){return t};e.identity=w;var x="undefined"!=typeof Symbol,_={iterator:x?Symbol.iterator:"@@iterator",transducer:{init:"@@transducer/init",step:"@@transducer/step",result:"@@transducer/result",reduce:"@@transducer/reduce",reduced:"@@transducer/reduced",value:"@@transducer/value"}};e.protocols=_;var b=_.transducer,g=b.value,O=b.reduced,j=function(t){return!(!t||!t[O])};e.isReduced=j;var T=_.transducer,I=T.init,k=T.step,S=T.result,q=function(){function t(n){r(this,t),this.xf=n}return t.prototype[I]=function(){return this.xfInit()},t.prototype.xfInit=function(){return this.xf[I]()},t.prototype[k]=function(t,n){return this.xfStep(t,n)},t.prototype.xfStep=function(t,n){return this.xf[k](t,n)},t.prototype[S]=function(t){return this.xfResult(t)},t.prototype.xfResult=function(t){return this.xf[S](t)},t}();e.Transducer=q},{}]},{},[1])(1)});