react 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/.travis.yml +5 -2
  2. package/README.md +16 -2
  3. package/browser-test/dist.html +1 -1
  4. package/browser-test/index.html +3 -3
  5. package/browser-test/min.html +1 -1
  6. package/dist/react.js +407 -557
  7. package/dist/react.min.js +22 -1
  8. package/doc/advanced.md +9 -1
  9. package/lib/base-task.js +16 -19
  10. package/lib/cb-task.js +5 -5
  11. package/lib/core.js +7 -7
  12. package/lib/dsl.js +29 -29
  13. package/lib/error.js +4 -4
  14. package/lib/event-collector.js +6 -6
  15. package/lib/event-manager.js +13 -6
  16. package/lib/eventemitter.js +3 -3
  17. package/lib/finalcb-first-task.js +4 -4
  18. package/lib/finalcb-task.js +4 -4
  19. package/lib/id.js +3 -3
  20. package/lib/input-parser.js +10 -10
  21. package/lib/log-events.js +23 -14
  22. package/lib/parse.js +3 -3
  23. package/lib/promise-resolve.js +4 -4
  24. package/lib/promise-task.js +4 -4
  25. package/lib/react.js +7 -7
  26. package/lib/ret-task.js +4 -4
  27. package/lib/sprintf.js +8 -8
  28. package/lib/status.js +3 -3
  29. package/lib/task.js +44 -47
  30. package/lib/track-tasks.js +4 -4
  31. package/lib/validate.js +8 -8
  32. package/lib/vcon.js +31 -8
  33. package/lib/when-task.js +7 -8
  34. package/package.json +7 -8
  35. package/test/ast.mocha.js +4 -4
  36. package/test/cb-task.mocha.js +17 -17
  37. package/test/core-deferred.mocha.js +8 -8
  38. package/test/core-when.mocha.js +7 -7
  39. package/test/core.mocha.js +52 -52
  40. package/test/dsl.mocha.js +45 -43
  41. package/test/event-manager.mocha.js +2 -2
  42. package/test/exec-options.mocha.js +4 -4
  43. package/test/finalcb-task.mocha.js +6 -6
  44. package/test/input-parser.mocha.js +1 -1
  45. package/test/log-events.mocha.js +88 -0
  46. package/test/module-use.mocha.js +24 -7
  47. package/test/promise-auto-resolve.mocha.js +4 -4
  48. package/test/ret-task.mocha.js +18 -18
  49. package/test/task.mocha.js +3 -3
  50. package/test/validate-cb-task.mocha.js +11 -11
  51. package/test/validate-ret-task.mocha.js +14 -14
  52. package/test/validate.mocha.js +57 -57
  53. package/test/vcon.mocha.js +13 -13
  54. package/vendor/chai/chai.js +3371 -1158
  55. package/vendor/requirejs/require.js +1447 -1455
  56. package/vendor/requirejs/require.min.js +31 -28
  57. package/vendor/mocha/mocha.css +0 -135
  58. package/vendor/mocha/mocha.js +0 -3589
package/dist/react.min.js CHANGED
@@ -1 +1,22 @@
1
- !function(a,b){function e(){this._events=new Object}function f(a){a&&(a.delimiter&&(this.delimiter=a.delimiter),a.wildcard&&(this.wildcard=a.wildcard),this.wildcard&&(this.listenerTree=new Object))}function g(a){this._events=new Object,f.call(this,a)}function h(a,b,c,d){if(!c)return[];var e=[],f,g,i,j,k,l,m,n=b.length,o=b[d],p=b[d+1];if(d===n&&c._listeners){if(typeof c._listeners=="function")return a&&a.push(c._listeners),[c];for(f=0,g=c._listeners.length;f<g;f++)a&&a.push(c._listeners[f]);return[c]}if(o==="*"||o==="**"||c[o]){if(o==="*"){for(i in c)i!=="_listeners"&&c.hasOwnProperty(i)&&(e=e.concat(h(a,b,c[i],d+1)));return e}if(o==="**"){m=d+1===n||d+2===n&&p==="*",m&&c._listeners&&(e=e.concat(h(a,b,c,n)));for(i in c)i!=="_listeners"&&c.hasOwnProperty(i)&&(i==="*"||i==="**"?(c[i]._listeners&&!m&&(e=e.concat(h(a,b,c[i],n))),e=e.concat(h(a,b,c[i],d))):i===p?e=e.concat(h(a,b,c[i],d+2)):e=e.concat(h(a,b,c[i],d)));return e}e=e.concat(h(a,b,c[o],d+1))}j=c["*"],j&&h(a,b,j,d+1),k=c["**"];if(k)if(d<n){k._listeners&&h(a,b,k,n);for(i in k)i!=="_listeners"&&k.hasOwnProperty(i)&&(i===p?h(a,b,k[i],d+2):i===o?h(a,b,k[i],d+1):(l={},l[i]=k[i],h(a,b,{"**":l},d+1)))}else k._listeners?h(a,b,k,n):k["*"]&&k["*"]._listeners&&h(a,b,k["*"],n);return e}function i(a,b){a=typeof a=="string"?a.split(this.delimiter):a.slice();for(var e=0,f=a.length;e+1<f;e++)if(a[e]==="**"&&a[e+1]==="**")return;var g=this.listenerTree,h=a.shift();while(h){g[h]||(g[h]=new Object),g=g[h];if(a.length===0){if(!g._listeners)g._listeners=b;else if(typeof g._listeners=="function")g._listeners=[g._listeners,b];else if(c(g._listeners)){g._listeners.push(b);if(!g._listeners.warned){var i=d;typeof this._events.maxListeners!="undefined"&&(i=this._events.maxListeners),i>0&&g._listeners.length>i&&(g._listeners.warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",g._listeners.length),console.trace())}}return!0}h=a.shift()}return!0}var c=Array.isArray?Array.isArray:function(b){return Object.prototype.toString.call(b)==="[object Array]"},d=10;g.prototype.delimiter=".",g.prototype.setMaxListeners=function(a){this._events||e.call(this),this._events.maxListeners=a},g.prototype.event="",g.prototype.once=function(a,b){return this.many(a,1,b),this},g.prototype.many=function(a,b,c){function e(){--b===0&&d.off(a,e),c.apply(this,arguments)}var d=this;if(typeof c!="function")throw new Error("many only accepts instances of Function");return e._origin=c,this.on(a,e),d},g.prototype.emit=function(){this._events||e.call(this);var a=arguments[0];if(a==="newListener"&&!this._events.newListener)return!1;if(this._all){var b=arguments.length,c=new Array(b-1);for(var d=1;d<b;d++)c[d-1]=arguments[d];for(d=0,b=this._all.length;d<b;d++)this.event=a,this._all[d].apply(this,c)}if(a==="error"&&!this._all&&!this._events.error&&(!this.wildcard||!this.listenerTree.error))throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");var f;if(this.wildcard){f=[];var g=typeof a=="string"?a.split(this.delimiter):a.slice();h.call(this,f,g,this.listenerTree,0)}else f=this._events[a];if(typeof f=="function"){this.event=a;if(arguments.length===1)f.call(this);else if(arguments.length>1)switch(arguments.length){case 2:f.call(this,arguments[1]);break;case 3:f.call(this,arguments[1],arguments[2]);break;default:var b=arguments.length,c=new Array(b-1);for(var d=1;d<b;d++)c[d-1]=arguments[d];f.apply(this,c)}return!0}if(f){var b=arguments.length,c=new Array(b-1);for(var d=1;d<b;d++)c[d-1]=arguments[d];var i=f.slice();for(var d=0,b=i.length;d<b;d++)this.event=a,i[d].apply(this,c);return i.length>0||this._all}return this._all},g.prototype.on=function(a,b){if(typeof a=="function")return this.onAny(a),this;if(typeof b!="function")throw new Error("on only accepts instances of Function");this._events||e.call(this),this.emit("newListener",a,b);if(this.wildcard)return i.call(this,a,b),this;if(!this._events[a])this._events[a]=b;else if(typeof this._events[a]=="function")this._events[a]=[this._events[a],b];else if(c(this._events[a])){this._events[a].push(b);if(!this._events[a].warned){var f=d;typeof this._events.maxListeners!="undefined"&&(f=this._events.maxListeners),f>0&&this._events[a].length>f&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),console.trace())}}return this},g.prototype.onAny=function(a){this._all||(this._all=[]);if(typeof a!="function")throw new Error("onAny only accepts instances of Function");return this._all.push(a),this},g.prototype.addListener=g.prototype.on,g.prototype.off=function(a,b){if(typeof b!="function")throw new Error("removeListener only takes instances of Function");var d,e=[];if(this.wildcard){var f=typeof a=="string"?a.split(this.delimiter):a.slice();e=h.call(this,null,f,this.listenerTree,0)}else{if(!this._events[a])return this;d=this._events[a],e.push({_listeners:d})}for(var g=0;g<e.length;g++){var i=e[g];d=i._listeners;if(c(d)){var j=-1;for(var k=0,l=d.length;k<l;k++)if(d[k]===b||d[k].listener&&d[k].listener===b||d[k]._origin&&d[k]._origin===b){j=k;break}if(j<0)return this;this.wildcard?i._listeners.splice(j,1):this._events[a].splice(j,1),d.length===0&&(this.wildcard?delete i._listeners:delete this._events[a])}else if(d===b||d.listener&&d.listener===b||d._origin&&d._origin===b)this.wildcard?delete i._listeners:delete this._events[a]}return this},g.prototype.offAny=function(a){var b=0,c=0,d;if(a&&this._all&&this._all.length>0){d=this._all;for(b=0,c=d.length;b<c;b++)if(a===d[b])return d.splice(b,1),this}else this._all=[];return this},g.prototype.removeListener=g.prototype.off,g.prototype.removeAllListeners=function(a){if(arguments.length===0)return!this._events||e.call(this),this;if(this.wildcard){var b=typeof a=="string"?a.split(this.delimiter):a.slice(),c=h.call(this,null,b,this.listenerTree,0);for(var d=0;d<c.length;d++){var f=c[d];f._listeners=null}}else{if(!this._events[a])return this;this._events[a]=null}return this},g.prototype.listeners=function(a){if(this.wildcard){var b=[],d=typeof a=="string"?a.split(this.delimiter):a.slice();return h.call(this,b,d,this.listenerTree,0),b}return this._events||e.call(this),this._events[a]||(this._events[a]=[]),c(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]},g.prototype.listenersAny=function(){return this._all?this._all:[]},typeof define=="function"&&define.amd?define("eventemitter2",[],function(){return g}):a.EventEmitter2=g}(typeof process!="undefined"&&typeof process.title!="undefined"&&typeof exports!="undefined"?exports:window),define("react/eventemitter",["eventemitter2"],function(a){var b=a?a.EventEmitter2?a.EventEmitter2:a:EventEmitter2;return b}),define("util",["require","exports","module"],function(a,b,c){function f(a,b,c,d){var e={showHidden:b,seen:[],stylize:d?i:j};return k(e,a,typeof c=="undefined"?2:c)}function i(a,b){var c=h[b];return c?"["+g[c][0]+"m"+a+"["+g[c][1]+"m":a}function j(a,b){return a}function k(a,c,d){if(c&&typeof c.inspect=="function"&&c.inspect!==b.inspect&&(!c.constructor||c.constructor.prototype!==c))return c.inspect(d);var e=l(a,c);if(e)return e;var f=Object.keys(c),g=a.showHidden?Object.getOwnPropertyNames(c):f;if(g.length===0){if(typeof c=="function"){var h=c.name?": "+c.name:"";return a.stylize("[Function"+h+"]","special")}if(r(c))return a.stylize(RegExp.prototype.toString.call(c),"regexp");if(s(c))return a.stylize(Date.prototype.toString.call(c),"date");if(t(c))return m(c)}var i="",j=!1,k=["{","}"];q(c)&&(j=!0,k=["[","]"]);if(typeof c=="function"){var u=c.name?": "+c.name:"";i=" [Function"+u+"]"}r(c)&&(i=" "+RegExp.prototype.toString.call(c)),s(c)&&(i=" "+Date.prototype.toUTCString.call(c)),t(c)&&(i=" "+m(c));if(g.length!==0||!!j&&c.length!==0){if(d<0)return r(c)?a.stylize(RegExp.prototype.toString.call(c),"regexp"):a.stylize("[Object]","special");a.seen.push(c);var v;return j?v=n(a,c,d,f,g):v=g.map(function(b){return o(a,c,d,f,b,j)}),a.seen.pop(),p(v,i,k)}return k[0]+i+k[1]}function l(a,b){switch(typeof b){case"undefined":return a.stylize("undefined","undefined");case"string":var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string");case"number":return a.stylize(""+b,"number");case"boolean":return a.stylize(""+b,"boolean")}if(b===null)return a.stylize("null","null")}function m(a){return"["+Error.prototype.toString.call(a)+"]"}function n(a,b,c,d,e){var f=[];for(var g=0,h=b.length;g<h;++g)Object.prototype.hasOwnProperty.call(b,String(g))?f.push(o(a,b,c,d,String(g),!0)):f.push("");return e.forEach(function(e){e.match(/^\d+$/)||f.push(o(a,b,c,d,e,!0))}),f}function o(a,b,c,d,e,f){var g,h,i;i=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},i.get?i.set?h=a.stylize("[Getter/Setter]","special"):h=a.stylize("[Getter]","special"):i.set&&(h=a.stylize("[Setter]","special")),d.indexOf(e)<0&&(g="["+e+"]"),h||(a.seen.indexOf(i.value)<0?(c===null?h=k(a,i.value,null):h=k(a,i.value,c-1),h.indexOf("\n")>-1&&(f?h=h.split("\n").map(function(a){return" "+a}).join("\n").substr(2):h="\n"+h.split("\n").map(function(a){return" "+a}).join("\n"))):h=a.stylize("[Circular]","special"));if(typeof g=="undefined"){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function p(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.length+1},0);return e>60?c[0]+(b===""?"":b+"\n ")+" "+a.join(",\n ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function q(a){return Array.isArray(a)||typeof a=="object"&&u(a)==="[object Array]"}function r(a){return typeof a=="object"&&u(a)==="[object RegExp]"}function s(a){return typeof a=="object"&&u(a)==="[object Date]"}function t(a){return typeof a=="object"&&u(a)==="[object Error]"}function u(a){return Object.prototype.toString.call(a)}function v(a){return a<10?"0"+a.toString(10):a.toString(10)}function x(){var a=new Date,b=[v(a.getHours()),v(a.getMinutes()),v(a.getSeconds())].join(":");return[a.getDate(),w[a.getMonth()],b].join(" ")}var d=/%[sdj%]/g;b.format=function(a){if(typeof a!="string"){var b=[];for(var c=0;c<arguments.length;c++)b.push(f(arguments[c]));return b.join(" ")}var e=1,g=arguments,h=g.length,i=String(a).replace(d,function(a){if(a==="%%")return"%";if(e>=h)return a;switch(a){case"%s":return String(g[e++]);case"%d":return Number(g[e++]);case"%j":return JSON.stringify(g[e++]);default:return a}});for(var j=g[e];e<h;j=g[++e])j===null||typeof j!="object"?i+=" "+j:i+=" "+f(j);return i},b.print=function(){for(var a=0,b=arguments.length;a<b;++a)process.stdout.write(String(arguments[a]))},b.puts=function(){for(var a=0,b=arguments.length;a<b;++a)process.stdout.write(arguments[a]+"\n")},b.debug=function(a){process.stderr.write("DEBUG: "+a+"\n")};var e=b.error=function(a){for(var b=0,c=arguments.length;b<c;++b)process.stderr.write(arguments[b]+"\n")};b.inspect=f;var g={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},h={special:"cyan",number:"yellow","boolean":"yellow","undefined":"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};b.isArray=q,b.isRegExp=r,b.isDate=s,b.isError=t;var w=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];b.log=function(a){b.puts(x()+" - "+a.toString())},b.pump=function(a,b,c){function e(a,b,e){c&&!d&&(c(a,b,e),d=!0)}var d=!1;a.addListener("data",function(c){b.write(c)===!1&&a.pause()}),b.addListener("drain",function(){a.resume()}),a.addListener("end",function(){b.end()}),a.addListener("close",function(){e()}),a.addListener("error",function(a){b.end(),e(a)}),b.addListener("error",function(b){a.destroy(),e(b)})},b.inherits=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})},b._extend=function(a,b){if(!b)return a;var c=Object.keys(b),d=c.length;while(d--)a[c[d]]=b[c[d]];return a}}),define("react/error",["util"],function(a){function b(a){if(!Error.stackTraceLimit||Error.stackTraceLimit<a)Error.stackTraceLimit=a}function c(a){return a?a&&a.name?a.name:a:"undefined"}function d(b){if(!b.meta)return;var d=b.meta.vcon,e=b.meta.task,f="\n\n";return e&&e.f&&e.a&&(f+="Error occurs in Task function: "+c(e.f)+"("+e.a.join(",")+")\n\n"),d&&(f+="Variable Context: \n",f+=a.inspect(d),f+="\n\n"),e&&e.f&&(f+="Task Source:\n\n",f+=e.f.toString(),f+="\n\n"),f}function e(a,b){typeof a=="string"&&(a=new Error(a));var c=a.toString();return a.meta=b,a.toString=function(){return c+d(a)},a}return{ensureStackTraceLimitSet:b,augmentError:e}}),function(a,b){typeof exports=="object"?module.exports=b():typeof define=="function"&&define.amd?define("ensure-array",[],b):a.ensureArray=b()}(this,function(){function a(a,b,c){if(arguments.length===0)return[];if(arguments.length===1){if(a===undefined||a===null)return[];if(Array.isArray(a))return a}return Array.prototype.slice.call(arguments)}return a}),define("react/status",[],function(){var a={READY:"ready",RUNNING:"running",ERRORED:"errored",COMPLETE:"complete"};return a}),define("react/vcon",[],function(){function b(){}var a=":LAST_RESULTS";return b.prototype.getLastResults=function(){return this.getVar(a)},b.prototype.setLastResults=function(b){this.setVar(a,b)},b.prototype.getVar=function(a){var b=this.values;if(typeof a!="string")return a;a=a.trim();if(a==="true")return!0;if(a==="false")return!1;if(a==="null")return null;if(/^-?[0-9]+$/.test(a))return parseInt(a,10);if(/^-?[0-9.]+$/.test(a))return parseFloat(a);var c=/^("|')([^\1]*)\1$/.exec(a);if(c)return c[2];var d=a.split(".");return d.reduce(function(a,b){return a===undefined||a===null?undefined:a[b]},b)},b.prototype.saveResults=function(a,b){var c=this;a.forEach(function(a,d){c.setVar(a,b[d]!==undefined?b[d]:null)}),this.setLastResults(b)},b.prototype.setVar=function(a,b){if(!a)return;var c=this.values,d=a.split("."),e=d.pop(),f=d.reduce(function(a,b){var c=a[b];if(c===undefined||c===null)c=a[b]={};return c},c);f[e]=b},b.create=function(a,c,d,e){var f={};e&&(f["this"]=e),d&&Object.keys(d).forEach(function(a){f[a]=d[a]});var g=new b;return g.values=a.reduce(function(a,b,d){var e=c[d];return e&&(a[e]=b!==undefined?b:null),a},f),g},b}),define("react/event-manager",["./eventemitter"],function(a){function e(){}var b={wildcard:!0,delimiter:".",maxListeners:30},c=/^ast.defined$/,d={AST_DEFINED:"ast.defined",FLOW_BEGIN:"flow.begin",TASK_BEGIN:"task.begin",TASK_COMPLETE:"task.complete",TASK_ERRORED:"task.errored",FLOW_COMPLETE:"flow.complete",FLOW_ERRORED:"flow.errored",EXEC_FLOW_START:"exec.flow.start",EXEC_INPUT_PREPROCESS:"exec.input.preprocess",EXEC_TASKS_PRECREATE:"exec.tasks.precreate",EXEC_OUTTASK_CREATE:"exec.outTask.create",EXEC_TASK_START:"exec.task.start",EXEC_TASK_COMPLETE:"exec.task.complete",EXEC_TASK_ERRORED:"exec.task.errored",EXEC_FLOW_COMPLETE:"exec.flow.complete",EXEC_FLOW_ERRORED:"exec.flow.errored"};return e.create=function(){return new e},e.TYPES=d,e.prototype.TYPES=d,e.prototype.isEnabled=function(){return!!(this.emitter||this.parent&&this.parent.isEnabled())},e.prototype.on=function(c,d){this.emitter||(this.emitter=new a(b)),c==="*"?this.emitter.onAny(d):this.emitter.on(c,d)},e.prototype.emit=function(a,b,d,e){if(a===undefined)throw new Error("event is undefined");this.emitter&&this.emitter.emit.apply(this.emitter,arguments),this.parent&&this.parent.isEnabled()&&this.parent.emit.apply(this.parent,arguments),c.test(a)&&process&&process.emit&&process.emit.apply(process,arguments)},e.prototype.removeListener=function(a,b){this.emitter&&this.emitter.removeListener.apply(this.emitter,arguments)},e.global=e.create(),e}),define("react/base-task",["ensure-array","./status","./event-manager"],function(a,b,c){function d(){}function e(a){return a.indexOf(".")!==-1}return d.prototype.getOutParams=function(){return a(this.out)},d.prototype.isComplete=function(){return this.status===b.COMPLETE},d.prototype.start=function(a){this.args=a,this.env.currentTask=this,this.env.flowEmitter.emit(c.TYPES.EXEC_TASK_START,this)},d.prototype.complete=function(a){this.status=b.COMPLETE,this.results=a,this.env.currentTask=this,this.env.flowEmitter.emit(c.TYPES.EXEC_TASK_COMPLETE,this)},d.prototype.functionExists=function(a){var b=this.f;if(!b)return!1;if(b instanceof Function)return!0;if(typeof b=="string"){var c=a.getVar(b);if(c&&c instanceof Function)return!0}return!1},d.prototype.areAllDepArgsDefined=function(a){return this.a.every(function(b){return a.getVar(b)!==undefined})},d.prototype.depTasksAreDone=function(a){return!this.after||!this.after.length||this.after.every(function(b){return a[b].isComplete()})},d.prototype.parentExists=function(a,b){if(!e(a))return!0;var c=a.split(".");c.pop();var d=c.reduce(function(a,b){return a===undefined||a===null?undefined:a[b]},b.values);return d!==undefined&&d!==null},d.prototype.outParentsExist=function(a){var b=this;return this.getOutParams().every(function(c){return c===null?!0:b.parentExists(c,a)})},d.prototype.isReady=function(a,b){return!this.status&&this.functionExists(a)&&this.areAllDepArgsDefined(a)&&this.depTasksAreDone(b)&&(!this.outParentsExist||this.outParentsExist(a))},d.prototype.isMethodCall=function(){return typeof this.f=="string"&&/^.*\..*$/.test(this.f)},d.prototype.getMethodObj=function(a){var b=this.f;if(!b)return undefined;var c=b.split(".");c.pop();if(!c.length)return undefined;var d=c.reduce(function(a,b){return a===undefined||a===null?undefined:a[b]},a.values);return d},d}),define("react/input-parser",["./event-manager"],function(a){function d(a){return a&&a.reactExecOptions}function e(a){return d(a)}function f(a){return!d(a)}function g(a,b){return Object.keys(b).forEach(function(c){a[c]=b[c]}),a}function h(a,b,d){var e={};return e.args=b.map(function(b){return a.shift()}),d===c.CALLBACK&&a.length&&(e.cb=a.shift()),e.extra=a,e}function i(c,d){var i={},j=c.filter(e);j.unshift(b),i.options=j.reduce(g,{});var k=c.filter(f),l=h(k,d.inParams,i.options.outputStyle);return i.args=l.args,i.cb=l.cb,l.outputStyle&&(i.options.outputStyle=l.outputStyle),l.extra&&(i.extraArgs=l.extra),a.global.emit(a.TYPES.EXEC_INPUT_PREPROCESS,i),i}var b={reactExecOptions:!0,outputStyle:"cb"},c={CALLBACK:"cb",NONE:"none"};return i.defaultExecOptions=b,i}),define("react/id",[],function(){function b(){return a+=1,a===Number.MAX_VALUE&&(a=0),a}var a=0;return{createUniqueId:b}}),function(){var a,b,c,d,e,f=Array.prototype.slice,g=Array.prototype.indexOf||function(a){for(var b=0,c=this.length;b<c;b++)if(b in this&&this[b]===a)return b;return-1};b=/%(\d+[$])?((?:[+\x20\-#0])*)((?:[*](?:\d+[$])?)?v)?(\d*|[*](?:\d+[$])?)(?:[.](\d+|[*](?:\d+[$])?))?(hh?|ll?|[Lzjtq]|I(?:32|64)?)?([diuDUfFeEgGxXoOscpnbB])|%%/g,a="64-bit numbers aren't supported by sprint()!",c={h:2,hh:1,l:4,ll:new RangeError(a),L:4,z:4,j:4,t:4,I:4,I32:4,I64:new RangeError(a),q:new RangeError(a)},d=function(){var a,d,e,h,i,j,k;return h=arguments[0],j=2<=arguments.length?f.call(arguments,1):[],a=["[object Array]","[object Arguments]"],i=Object.prototype.toString,(k=i.call(j[0]),g.call(a,k)>=0)&&j.length===1&&(j=j[0]),d=-1,e=function(a,b,c,d){return a=""+a,a.length>b?a:d?""+a+(new Array(b-a.length+1)).join(c):""+(new Array(b-a.length+1)).join(c)+a},(""+h).replace(b,function(){var a,b,h,i,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z;return w=arguments[0],q=2<=arguments.length?f.call(arguments,1):[],h=q[0],l=q[1],z=q[2],o=q[3],s=q[4],m=q[5],y=q[6],m==null&&(m="L"),w==="%%"?"%":(n=g.call(l,"-")>=0,b=g.call(l,"0")>=0&&!n?"0":" ",a=function(a,b){var d,e,f;b==null&&(b=!1);if(m==="L"&&(a>=0||b))return parseInt(a,10);e=c[m];if(e instanceof Error)throw e;return d=e*8,a=parseInt(a,10)%Math.pow(2,d),f=Math.pow(2,d)-1,b&&a>=Math.pow(2,d-1)&&(a=-Math.pow(2,d)+a),b?a:a>>>0},x=function(){return h=(+h).toExponential(s),v&&g.call(h,".")<0&&(h=h.replace("e",".e")),h.toLowerCase().replace(/\d+$/,function(a){return e(a,3,0)})},r=function(a){return+a===0&&+s===0?"":k?a:(b=" ",e(a,s,"0"))},z&&(i=z[0]==="*"?z.length>2?j[parseInt(z.slice(1),10)-1]:j[++d]:"."),o=o[0]==="*"?o.length===1?j[++d]:j[parseInt(o.slice(1))-1]:o?o:0,s=s&&s[0]==="*"?s.length===1?j[++d]:j[parseInt(s.slice(1),10)-1]:s?s:(k=!0,6),h=j[(parseInt(h,10)||++d+1)-1],h===0&&1/h===-Infinity&&(h="-0"),h=h!=null?""+h:"",v=g.call(l,"#")>=0,arguments=function(){var a,b,c;if(z){c=[];for(a=0,b=h.length;a<b;a++)p=h[a],c.push(p.charCodeAt(0));return c}return[h]}(),u=function(){var c,d,f;f=[];for(c=0,d=arguments.length;c<d;c++)h=arguments[c],h=function(){var b;switch(y){case"d":case"i":case"D":return r(a(h,!0));case"u":case"U":return r(a(h));case"f":case"F":return h=(+h).toFixed(s).toLowerCase(),v&&g.call(h,".")<0&&!/^-?[a-z]+$/.test(h)&&(h+="."),h;case"e":case"E":return x();case"g":case"G":return+h===0||1e-4<=(b=Math.abs(h))&&b<Math.pow(10,s)?(h=(""+h).substr(0,+s+1),v?h.replace(/[.]?$/,"."):h.replace(/[.]$/,"")):x().replace(/[.]?0+e/,"e");case"x":case"X":return t=v&&+h!==0?"0x":"",""+t+r(a(h).toString(16));case"b":case"B":return t=v&&+h!==0?"0b":"",""+t+r(a(h).toString(2));case"o":case"O":return t=v?"0":"",""+t+r(a(h).toString(8));case"s":return k?h:h.substr(0,s);case"c":return String.fromCharCode(h);default:throw new Exception("Unrecognized %type (?). Shouldn't happen.")}}(),h=""+h,y===y.toUpperCase()&&(h=h.toUpperCase()),h[0]!=="-"&&(g.call(l,"+")>=0?h="+"+h:g.call(l," ")>=0&&(h=" "+h)),f.push(e(h,o,b,n));return f}.apply(this,arguments),u.join(i))})},(typeof module!=="undefined"&&module!==null?module.exports:void 0)!=null&&(module.exports=d),((e=typeof module!=="undefined"&&module!==null?module.exports:void 0)!=null?e:this).sprint=d}.call(this),define("sprint",function(){}),define("react/sprintf",["sprint"],function(a){var b=a?a:sprint;return b}),define("react/cb-task",["util","./sprintf","./base-task"],function(a,b,c){function d(c,d){return b("%s - %s",c,a.inspect(d))}function i(a){var b=this;Object.keys(a).forEach(function(c){b[c]=a[c]})}var e="cbTask requires f, a, out",f="cbTask requires f to be a function or string",g="cbTask requires a to be an array of string param names",h="cbTask requires out to be an array of string param names";return i.prototype=new c,i.prototype.constructor=i,i.validate=function(a){var b=[];if(!a.f||!a.a||!a.out)b.push(d(e,a));else{var c=typeof a.f;a.f instanceof Function||c==="string"||b.push(d(f,a)),(!Array.isArray(a.a)||!a.a.every(function(a){return typeof a=="string"}))&&b.push(d(g,a)),(!Array.isArray(a.out)||!a.out.every(function(a){return typeof a=="string"}))&&b.push(d(h,a))}return b},i.prototype.prepare=function(b,c,d){var e=this;this.cbFun=function(a,f,g,h){var i=Array.prototype.slice.call(arguments,1);if(a){b(e,a);return}c.saveResults(e.out,i),e.complete(i),d()}},i.prototype.exec=function(b,c,d){try{var e=this.a.map(function(a){return b.getVar(a)});this.start(e),e.push(this.cbFun);var f=this.f,g=b.getVar("this");this.isMethodCall()?(f=b.getVar(this.f),g=this.getMethodObj(b)):typeof f=="string"&&(f=b.getVar(f)),f.apply(g,e)}catch(h){c(this,h)}},i}),define("react/promise-task",["util","./sprintf","./base-task"],function(a,b,c){function d(c,d){return b("%s - %s",c,a.inspect(d))}function i(a){var b=this;Object.keys(a).forEach(function(c){b[c]=a[c]})}var e="promiseTask requires f, a, out",f="promiseTask requires f to be a function or string",g="promiseTask requires a to be an array of string param names",h="promiseTask requires out to be an array[1] of string param names";return i.prototype=new c,i.prototype.constructor=i,i.validate=function(a){var b=[];if(!a.f||!a.a||!a.out)b.push(d(e,a));else{var c=typeof a.f;a.f instanceof Function||c==="string"||b.push(d(f,a)),(!Array.isArray(a.a)||!a.a.every(function(a){return typeof a=="string"}))&&b.push(d(g,a)),Array.isArray(a.out)&&a.out.length<=1&&a.out.every(function(a){return typeof a=="string"})||b.push(d(h,a))}return b},i.prototype.prepare=function(b,c,d){var e=this;this.nextFn=function(a){var b=Array.prototype.slice.call(arguments);c.saveResults(e.out,b),e.complete(b),d()},this.failFn=function(a){b(e,a)}},i.prototype.exec=function(b,c,d){try{var e=this.a.map(function(a){return b.getVar(a)});this.start(e);var f=this.f,g=b.getVar("this");this.isMethodCall()?(f=b.getVar(this.f),g=this.getMethodObj(b)):typeof f=="string"&&(f=b.getVar(f));var h=f.apply(g,e);h&&typeof h.then=="function"?h.then(this.nextFn,this.failFn):this.nextFn(h)}catch(i){c(this,i)}},i}),define("react/ret-task",["util","./sprintf","./base-task"],function(a,b,c){function d(c,d){return b("%s - %s",c,a.inspect(d))}function i(a){var b=this;Object.keys(a).forEach(function(c){b[c]=a[c]})}var e="retTask requires f, a, out",f="retTask requires f to be a function or string",g="retTask requires a to be an array of string param names",h="retTask requires out to be an array with single string param name or []";return i.prototype=new c,i.prototype.constructor=i,i.validate=function(a){var b=[];if(!a.f||!a.a||!a.out)b.push(d(e,a));else{var c=typeof a.f;a.f instanceof Function||c==="string"||b.push(d(f,a)),(!Array.isArray(a.a)||!a.a.every(function(a){return typeof a=="string"}))&&b.push(d(g,a)),(!Array.isArray(a.out)||!(a.out.length===0||a.out.length===1&&typeof (a.out[0]==="string")))&&b.push(d(h,a))}return b},i.prototype.exec=function(b,c,d){try{var e=this.a.map(function(a){return b.getVar(a)});this.start(e);var f=this.f,g=b.getVar("this");this.isMethodCall()?(f=b.getVar(this.f),g=this.getMethodObj(b)):typeof f=="string"&&(f=b.getVar(f));var h=[f.apply(g,e)];b.saveResults(this.out,h),this.complete(h),d()}catch(i){c(this,i)}},i}),define("react/when-task",["util","./sprintf","./base-task"],function(a,b,c){function d(c,d){return b("%s - %s",c,a.inspect(d))}function h(a){var b=this;Object.keys(a).forEach(function(c){b[c]=a[c]})}var e="whenTask requires a, out",f="whenTask requires a to be an array[1] of string param names",g="whenTask requires out to be an array[1] of string param names";return h.prototype=new c,h.prototype.constructor=h,h.prototype.f=function(){},h.validate=function(a){var b=[];return!a.a||!a.out?b.push(d(e,a)):((!Array.isArray(a.a)||a.a.length!==1||!a.a.every(function(a){return typeof a=="string"}))&&b.push(d(f,a)),Array.isArray(a.out)&&a.out.length<=1&&a.out.every(function(a){return typeof a=="string"})||b.push(d(g,a))),b},h.prototype.prepare=function(b,c,d){var e=this;this.nextFn=function(a){var b=Array.prototype.slice.call(arguments);c.saveResults(e.out,b),e.complete(b),d()},this.failFn=function(a){b(e,a)}},h.prototype.exec=function(b,c,d){try{var e=this.a.map(function(a){return b.getVar(a)});this.start(e);var f=e[0];f&&typeof f.then=="function"?f.then(this.nextFn,this.failFn):this.nextFn(f)}catch(g){c(this,g)}},h}),define("react/finalcb-task",["./sprintf","util","./status","./event-manager"],function(a,b,c,d){function f(a){var b=a.taskDef;if(typeof a.cbFunc!="function")throw new Error("callback is not a function");var c=this;for(var d in b)c[d]=b[d];this.f=a.cbFunc,this.tasks=a.tasks,this.vCon=a.vCon,this.retValue=a.retValue,this.execOptions=a.execOptions,this.env=a.env}function g(c,d){return a("%s - %s",c,b.inspect(d))}var e="ast.outTask.a should be an array of string param names";return f.validate=function(a){var b=[];return(!Array.isArray(a.a)||!a.a.every(function(a){return typeof a=="string"}))&&b.push(g(e,a)),b},f.prototype.isReady=function(){return this.tasks.every(function(a){return a.status===c.COMPLETE})},f.prototype.exec=function(a){if(!this.f)return;if(a)this.env.error=a,this.env.flowEmitter.emit(d.TYPES.EXEC_FLOW_ERRORED,this.env),this.f.call(null,a);else{var b=this.vCon,c=this.a.map(function(a){return b.getVar(a)});c.unshift(null),this.env.results=c,this.env.flowEmitter.emit(d.TYPES.EXEC_FLOW_COMPLETE,this.env),this.f.apply(null,c)}this.f=null},f}),define("react/finalcb-first-task",["./sprintf","util","./status","./vcon","./event-manager"],function(a,b,c,d,e){function g(a){var b=a.taskDef;if(typeof a.cbFunc!="function")throw new Error("callback is not a function");var c=this;for(var d in b)c[d]=b[d];this.f=a.cbFunc,this.tasks=a.tasks,this.vCon=a.vCon,this.retValue=a.retValue,this.env=a.env}function h(c,d){return a("%s - %s",c,b.inspect(d))}var f="ast.outTask.a should be an array of string param names";return g.validate=function(a){var b=[];return(!Array.isArray(a.a)||!a.a.every(function(a){return typeof a=="string"}))&&b.push(h(f,a)),b},g.prototype.isReady=function(){var a=this.vCon.getLastResults();return a?a.some(function(a){return a!==undefined&&a!==null}):!1},g.prototype.exec=function(a){if(!this.f)return;if(a)this.env.error=a,this.env.flowEmitter.emit(e.TYPES.EXEC_FLOW_ERRORED,this.env),this.f.call(null,a);else{var b=this.vCon,c=this.a.map(function(a){return b.getVar(a)});c.unshift(null),this.env.results=c,this.env.flowEmitter.emit(e.TYPES.EXEC_FLOW_COMPLETE,this.env),this.f.apply(null,c)}this.f=null},g}),define("react/task",["util","./sprintf","ensure-array","./cb-task","./promise-task","./ret-task","./when-task","./finalcb-task","./finalcb-first-task","./status","./error","./vcon","./event-manager"],function(a,b,c,d,e,f,g,h,i,j,k,l,m){function p(){return Object.keys(n)}function r(){return Object.keys(q)}function z(c,d){return b("%s - %s",c,a.inspect(d))}function A(a){return a.type?a:(a.type="cb",a)}function B(a){a.type||(a.type=Object.keys(q)[0])}function C(a){if(!a.after)return;var b=c(a.after);b=b.map(function(a){return typeof a=="function"?a.name:a}),a.after=b}function D(a){if(!a||typeof a!="object")return[z(t,a)];A(a),C(a);var b=[];return b=b.concat(w(a)),b=b.concat(x(a)),b}function w(a){var b=[];return Object.keys(n).some(function(b){return a.type===b})||b.push(z(v,a)),b}function x(a){var b=[],c=n[a.type];return c&&(b=b.concat(c.validate(a))),b}function E(a){var b=[];B(a);var c=q[a.type];return b=b.concat(c.validate(a)),b}function F(a,c,d){function f(){}var e=[],g=a.map(function(a){return f}),h=l.create(g,a,d),i=c.map(y),j=i.filter(function(a){return a.type!=="when"});return j.forEach(function(a,c){if(!a.functionExists(h))if(!a.isMethodCall())e.push(b(s,a.f,c));else{var d=a.getMethodObj(h);d&&d!==f&&e.push(b(s,a.f,c))}}),e}function G(a){return typeof a=="function"?a.name:a?a:""}function H(a){var c=a.reduce(function(a,b){return b.name&&(a[b.name]=b),a},{});return a.forEach(function(a,d){if(!a.name){var e=G(a.f);e||(e=b(o,d));if(!e||c[e])e=b("%s_%s",e,d);a.name=e,c[e]=a}}),c}function y(a){var b=n[a.type];return new b(a)}function I(a,b,c,d,e,f){B(a);var g={taskDef:a,cbFunc:b,tasks:c,vCon:d,execOptions:e,env:f,TaskConstructor:q[a.type]};m.global.emit(m.TYPES.EXEC_OUTTASK_CREATE,g);var h=g.TaskConstructor;return new h(g)}function J(a,b){return function(d,e){d.status=j.ERRORED,d.error=e,b.env.currentTask=d,b.env.flowEmitter.emit(m.TYPES.EXEC_TASK_ERRORED,d);var f=k.augmentError(e,{task:d,vcon:a});b.exec(f)}}function K(a,b,c){return b.filter(function(b){return b.isReady(a,c)})}function L(a,b,c,d){a.forEach(function(a){a.status=j.READY}),a.forEach(function(a){a.exec(b,c,d)})}function M(a,c,d,e){var f=c.filter(function(a){return a.status===j.RUNNING||a.status===j.READY});if(!f.length){var g=c.filter(function(a){return!a.status}),h=g.map(function(a){return a.name}),i=b(u,h.join(", ")),k={env:e};d(k,new Error(i))}}function N(a,b,c,d,e,f){var g=K(a,b,c);g.length||M(a,b,d,f),L(g,a,d,e)}function O(a){return H(a),a.forEach(function(a,b,c){b!==0&&(a.after=[c[b-1].name])}),a}var n={cb:d,ret:f,promise:e,when:g},o="task_%s",q={finalcb:h,finalcbFirst:i},s="function: %s not found in locals or input params - task[%s]",t="task must be an object",u="no tasks running, flow will not complete, remaining tasks: %s",v="task.type should match one of "+Object.keys(n).join(", "),w,x,y;return{serializeTasks:O,TASK_TYPES:n,taskTypeKeys:p,OUT_TASK_TYPES:q,outTaskTypeKeys:r,setMissingType:A,validate:D,validateOutTask:E,validateLocalFunctions:F,nameTasks:H,create:y,createOutTask:I,createErrorHandler:J,findReadyAndExec:N}}),define("react/validate",["util","./sprintf","ensure-array","./task"],function(a,b,c,d){function m(c,d){return b("%s - %s",c,a.inspect(d))}function n(a){return l.test(a)}function o(a){if(!a||!a.inParams||!a.tasks||!a.outTask)return[e];var b=[];return b=b.concat(p(a.inParams)),b=b.concat(q(a.tasks)),b=b.concat(r(a.tasks)),b=b.concat(d.validateOutTask(a.outTask)),b=b.concat(s(a.locals)),b.length===0&&(a.outTask.type!=="finalcbFirst"&&(b=b.concat(u(a.tasks))),b=b.concat(d.validateLocalFunctions(a.inParams,a.tasks,a.locals)),b=b.concat(v(a))),b}function p(a){return!Array.isArray(a)||!a.every(function(a){return typeof a=="string"})?[f]:[]}function q(a){if(!Array.isArray(a))return[g];var b=[];return a.forEach(function(a){b=b.concat(d.validate(a))}),b}function r(a){if(!Array.isArray(a))return[];var c=[],d=a.filter(function(a){return a.name}),e=d.map(function(a){return a.name});return e.reduce(function(a,d){return a[d]?c.push(b("%s %s",h,d)):a[d]=!0,a},{}),c}function s(a){var b=[];return a===null&&b.push(i),b}function t(a){return c(a.out)}function u(a){var c=[];return a.reduce(function(a,d){return t(d).forEach(function(d){a[d]!==undefined?c.push(b("%s: %s",j,d)):a[d]=!0}),a},{}),c}function v(a){var c=[],d={};return a.locals&&(d=Object.keys(a.locals).reduce(function(a,b){return a[b]=!0,a},d)),a.inParams.reduce(function(a,b){return a[b]=!0,a},d),a.tasks.reduce(function(a,b){return b.out.reduce(function(a,b){return a[b]=!0,a},a)},d),a.tasks.reduce(function(a,c){return c.a.reduce(function(a,c){return!n(c)&&!d[c]&&a.push(b(k,c)),a},a)},c),a.outTask.a.reduce(function(a,c){return!n(c)&&!d[c]&&a.push(b(k,c)),a},c),c}var e="ast must be an object with inParams, tasks, and outTask",f="ast.inParams must be an array of strings",g="ast.tasks must be an array of tasks",h="ast.tasks that specify name need to be unique, duplicate:",i="ast.locals should not be null",j="multiple tasks output the same param, must be unique. param",k="missing or mispelled variable referenced in flow definition: %s",l=/^(true|false|this|null|\-?[0-9\.]+)$|'|"|\./i;return o}),define("react/core",["./eventemitter","./error","./validate","./task","./status","./vcon","./event-manager","./input-parser","./id","./sprintf"],function(a,b,c,d,e,f,g,h,i,j){function m(a){return Object.keys(k).reduce(function(a,b){return a[b]||(a[b]=k[b]),a},a)}function n(){return j("flow_%s",i.createUniqueId())}function o(){function j(b){Object.keys(b).forEach(function(a){e[a]=b[a]});var f=c(e);return f.length||(e.name||(e.name=n()),d.nameTasks(e.tasks)),Object.freeze&&(Object.keys(b).forEach(function(a){typeof b[a]=="object"&&Object.freeze(b[a])}),Object.freeze(b)),a.emit(g.TYPES.AST_DEFINED,e),f}function o(b,c,j,k){function v(){if(!t.f)return;if(t.isReady())return t.exec();d.findReadyAndExec(q,r,s,u,v,o)}var n=Array.prototype.slice.call(arguments),o={execId:i.createUniqueId(),args:n,ast:e,flowEmitter:a};o.name=e.name||o.execId,a.emit(g.TYPES.EXEC_FLOW_START,o);var p=h(n,e),q=f.create(p.args,e.inParams,e.locals,this);o.parsedInput=p,o.options=m(p.options),o.vCon=q,o.taskDefs=e.tasks.slice(),o.outTaskDef=Object.create(e.outTask),l.emit(g.TYPES.EXEC_TASKS_PRECREATE,o);var r=o.taskDefs.map(d.create),s=d.nameTasks(r),t=d.createOutTask(o.outTaskDef,p.cb,r,q,o.options,o),u=d.createErrorHandler(q,t);return r.forEach(function(b){b.id=i.createUniqueId(),b.env=o,b.prepare&&b.prepare(u,q,v,a)}),v(),t.retValue}if(arguments.length)throw new Error("react() takes no args, check API");b.ensureStackTraceLimitSet(k.stackTraceLimitMin);var a=g.create();a.parent=l;var e={name:undefined,inParams:[],tasks:[],outTask:{},locals:{}},p=o;return p.ast=e,p.setAndValidateAST=j,p.events=a,p}var k={stackTraceLimitMin:30},l=g.global;return o.options=k,o.events=l,o}),define("react/parse",["./sprintf"],function(a){function b(a){return a?a.split(",").map(function(a){return a.trim()}).filter(function(a){return a}):[]}function c(a,b){if(typeof a!="string")return a;var c=b.regex?b.regex.exec(a):a.split(b.splitStr);return c?b.fn(c,a):a}function d(b,d,e){var f=d.reduce(c,b);if(typeof f!="string")return f;throw new Error(a(e,b))}return{splitTrimFilterArgs:b,parseStr:d}}),define("react/dsl",["./sprintf","./core","./parse","./task"],function(a,b,c,d){function m(a){return a.length&&a[a.length-1].match(k)&&a.pop(),a}function n(a){return a.length&&a[0].match(l)&&a.shift(),a}function p(a){var b=c.parseStr(a,[o],f);return b.inDef=m(b.inDef),b}function q(b){var c=[],d,e,f;while(b.length>=2){e={},d=b.shift(),f=p(b.shift()),typeof b[0]=="object"&&(e=b.shift()),e.f=d,e.a=f.inDef;var g=f.type;e.out=f.outDef,e.type=g,c.push(e)}if(b.length)throw new Error(a(i,b[0]));return c}function r(a){var b=a.shift()||"",c=a.length&&typeof a[0]=="object"?a.shift():{},d=a,e={inOutParamStr:b,taskDefArr:d,options:c};return e}function s(c,d,f,g){var h=b();if(c&&j.test(c))throw new Error(a(e,c));var i=r(Array.prototype.slice.call(arguments,1)),k=p(i.inOutParamStr),l={name:c,inParams:k.inDef,tasks:q(i.taskDefArr),outTask:{a:k.outDef}};i.options&&Object.keys(i.options).forEach(function(a){l[a]=i.options[a]});var m=h.setAndValidateAST(l);if(m.length){var n=m.join("\n");throw new Error(n)}return h}function t(a,c,e,f){var g=b(),h=r(Array.prototype.slice.call(arguments,1)),i=p(h.inOutParamStr),j=d.serializeTasks(q(h.taskDefArr)),k={name:a,inParams:i.inDef,tasks:j,outTask:{type:"finalcbFirst",a:i.outDef}};h.options&&Object.keys(h.options).forEach(function(a){k[a]=h.options[a]});var l=g.setAndValidateAST(k);if(l.length){var m=l.join("\n");throw new Error(m)}return g}var e="first flow parameter should be the flow name, but found in/out def: %s",f='params in wrong format, wanted "foo, bar, cb -> err, baz" - found: %s',g='callback specified, but first out param was not "err", use for clarity. Found in/out def: %s',h="found err param, but cb/callback is not specified, is this cb-style async or sync function? Found in/out def: %s",i="extra unmatched task arg: %s",j=/\->/,k=/^cb|callback$/i,l=/^err$/i,o={splitStr:"->",fn:function(b,d){var e=c.splitTrimFilterArgs(b[0]),f=e[e.length-1],i=f&&k.test(f)?"cb":"ret",j=c.splitTrimFilterArgs(b[1]),o=j[0];if(i==="cb"&&(!o||!l.test(o)))throw new Error(a(g,d));if(i==="ret"&&o&&l.test(o))throw new Error(a(h,d));return{type:i,inDef:m(e),outDef:n(j)}}};return s.selectFirst=t,s}),define("react/track-tasks",[],function(){function b(b){if(a)return;a=!0,b.events.on(b.events.TYPES.EXEC_FLOW_START,function(a){a.startTime=Date.now(),a.flowEmitter.emit(b.events.TYPES.FLOW_BEGIN,a)}),b.events.on(b.events.TYPES.EXEC_TASK_START,function(a){a.startTime=Date.now(),a.env.flowEmitter.emit(b.events.TYPES.TASK_BEGIN,a)}),b.events.on(b.events.TYPES.EXEC_TASK_COMPLETE,function(a){a.endTime=Date.now(),a.elapsedTime=a.endTime-a.startTime,a.env.flowEmitter.emit(b.events.TYPES.TASK_COMPLETE,a)}),b.events.on(b.events.TYPES.EXEC_TASK_ERRORED,function(a){a.endTime=Date.now(),a.elapsedTime=a.endTime-a.startTime,a.env.flowEmitter.emit(b.events.TYPES.TASK_ERRORED,a)}),b.events.on(b.events.TYPES.EXEC_FLOW_COMPLETE,function(a){a.endTime=Date.now(),a.elapsedTime=a.endTime-a.startTime,a.flowEmitter.emit(b.events.TYPES.FLOW_COMPLETE,a)}),b.events.on(b.events.TYPES.EXEC_FLOW_ERRORED,function(a){a.endTime=Date.now(),a.elapsedTime=a.endTime-a.startTime,a.flowEmitter.emit(b.events.TYPES.FLOW_ERRORED,a)})}var a=!1;return b}),define("react/log-events",["util"],function(a){function f(b){var c=new Date;c.setTime(b.time);var d=b.args.filter(function(a){return typeof a!="function"}),e=c.toISOString();if(this.event==="flow.complete"){var f=b;console.error("%s: %s \tmsecs: %s \n\targs: %s \n\tresults: %s\n",this.event,f.name,f.elapsedTime,a.inspect(d),a.inspect(f.results))}else{var g=b.name,h=b.args;console.error("%s: %s \n\targs: %s\n",this.event,g,a.inspect(d))}}function g(b){var c=new Date;c.setTime(b.time);var d=b.args.filter(function(a){return typeof a!="function"}),e=c.toISOString();if(this.event==="task.complete"){var f=b;console.error("%s: %s:%s \tmsecs: %s \n\targs: %s \n\tresults: %s\n",this.event,f.env.name,f.name,f.elapsedTime,a.inspect(d),a.inspect(f.results))}else{var g=b.name,h=b.args;console.error("%s: %s:%s \n\targs: %s\n",this.event,b.env.name,b.name,a.inspect(d))}}function h(a,b){if(!a)throw new Error("flowFn is required");if(b&&b!=="*"){var h=e.test(b)?f:g;a.events.removeListener(b,h),a.events.on(b,h)}else a.events.removeListener(c,f),a.events.on(c,f),a.events.removeListener(d,g),a.events.on(d,g)}var b={},c="flow.*",d="task.*",e=/^flow\./;return b.logEvents=h,b}),define("react/promise-resolve",[],function(){function c(c){if(b)return;b=!0,c.events.on(c.events.TYPES.EXEC_TASKS_PRECREATE,function(b){var c=b.vCon.values,d=b.ast.inParams.filter(function(a){var b=c[a];return b&&typeof b.then=="function"});d.forEach(function(d){var e=d+a;c[e]=c[d],c[d]=undefined,b.taskDefs.push({type:"when",a:[e],out:[d]})})})}var a="__promise",b=!1;return c}),define("react/event-collector",[],function(){function a(a){function e(){this.events=[]}a.trackTasks();var b=/^ast\./,c=/^task\./,d=/^flow\./;return e.prototype.capture=function(e,f){function i(a){var e={event:this.event,time:Date.now()};d.test(this.event)?e.env=a:c.test(this.event)?e.task=a:b.test(this.event)&&(e.ast=a),h.events.push(e)}!f&&typeof e=="string"?(f=e,e=a):e||(e=a),f||(f="*");var g=e.events,h=this;g.on(f,i)},e.prototype.list=function(){return this.events},e.prototype.clear=function(){this.events=[]},new e}return a}),define("react",["./core","./dsl","./track-tasks","./log-events","./promise-resolve","./event-collector"],function(a,b,c,d,e,f){function h(){e(g)}function i(){c(g)}function j(a,b){return!b&&typeof a=="string"&&(b=a,a=undefined),a||(a=g),i(),d.logEvents(a,b)}function k(){return f(g)}var g=b;return g.options=a.options,g.events=a.events,g.logEvents=j,g.resolvePromises=h,g.trackTasks=i,g.createEventCollector=k,g})
1
+ // Copyright Joyent, Inc. and other Node contributors.
2
+ //
3
+ // Permission is hereby granted, free of charge, to any person obtaining a
4
+ // copy of this software and associated documentation files (the
5
+ // "Software"), to deal in the Software without restriction, including
6
+ // without limitation the rights to use, copy, modify, merge, publish,
7
+ // distribute, sublicense, and/or sell copies of the Software, and to permit
8
+ // persons to whom the Software is furnished to do so, subject to the
9
+ // following conditions:
10
+ //
11
+ // The above copyright notice and this permission notice shall be included
12
+ // in all copies or substantial portions of the Software.
13
+ //
14
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
+ // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17
+ // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
+ // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
+ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
+ // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
22
+ !function(e,t){function i(){this._events={},this._conf&&s.call(this,this._conf)}function s(e){e&&(this._conf=e,e.delimiter&&(this.delimiter=e.delimiter),e.maxListeners&&(this._events.maxListeners=e.maxListeners),e.wildcard&&(this.wildcard=e.wildcard),e.newListener&&(this.newListener=e.newListener),this.wildcard&&(this.listenerTree={}))}function o(e){this._events={},this.newListener=!1,s.call(this,e)}function u(e,t,n,r){if(!n)return[];var i=[],s,o,a,f,l,c,h,p=t.length,d=t[r],v=t[r+1];if(r===p&&n._listeners){if(typeof n._listeners=="function")return e&&e.push(n._listeners),[n];for(s=0,o=n._listeners.length;s<o;s++)e&&e.push(n._listeners[s]);return[n]}if(d==="*"||d==="**"||n[d]){if(d==="*"){for(a in n)a!=="_listeners"&&n.hasOwnProperty(a)&&(i=i.concat(u(e,t,n[a],r+1)));return i}if(d==="**"){h=r+1===p||r+2===p&&v==="*",h&&n._listeners&&(i=i.concat(u(e,t,n,p)));for(a in n)a!=="_listeners"&&n.hasOwnProperty(a)&&(a==="*"||a==="**"?(n[a]._listeners&&!h&&(i=i.concat(u(e,t,n[a],p))),i=i.concat(u(e,t,n[a],r))):a===v?i=i.concat(u(e,t,n[a],r+2)):i=i.concat(u(e,t,n[a],r)));return i}i=i.concat(u(e,t,n[d],r+1))}f=n["*"],f&&u(e,t,f,r+1),l=n["**"];if(l)if(r<p){l._listeners&&u(e,t,l,p);for(a in l)a!=="_listeners"&&l.hasOwnProperty(a)&&(a===v?u(e,t,l[a],r+2):a===d?u(e,t,l[a],r+1):(c={},c[a]=l[a],u(e,t,{"**":c},r+1)))}else l._listeners?u(e,t,l,p):l["*"]&&l["*"]._listeners&&u(e,t,l["*"],p);return i}function a(e,t){e=typeof e=="string"?e.split(this.delimiter):e.slice();for(var i=0,s=e.length;i+1<s;i++)if(e[i]==="**"&&e[i+1]==="**")return;var o=this.listenerTree,u=e.shift();while(u){o[u]||(o[u]={}),o=o[u];if(e.length===0){if(!o._listeners)o._listeners=t;else if(typeof o._listeners=="function")o._listeners=[o._listeners,t];else if(n(o._listeners)){o._listeners.push(t);if(!o._listeners.warned){var a=r;typeof this._events.maxListeners!="undefined"&&(a=this._events.maxListeners),a>0&&o._listeners.length>a&&(o._listeners.warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",o._listeners.length),console.trace())}}return!0}u=e.shift()}return!0}var n=Array.isArray?Array.isArray:function(t){return Object.prototype.toString.call(t)==="[object Array]"},r=10;o.prototype.delimiter=".",o.prototype.setMaxListeners=function(e){this._events||i.call(this),this._events.maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e},o.prototype.event="",o.prototype.once=function(e,t){return this.many(e,1,t),this},o.prototype.many=function(e,t,n){function i(){--t===0&&r.off(e,i),n.apply(this,arguments)}var r=this;if(typeof n!="function")throw new Error("many only accepts instances of Function");return i._origin=n,this.on(e,i),r},o.prototype.emit=function(){this._events||i.call(this);var e=arguments[0];if(e==="newListener"&&!this.newListener&&!this._events.newListener)return!1;if(this._all){var t=arguments.length,n=new Array(t-1);for(var r=1;r<t;r++)n[r-1]=arguments[r];for(r=0,t=this._all.length;r<t;r++)this.event=e,this._all[r].apply(this,n)}if(e==="error"&&!this._all&&!this._events.error&&(!this.wildcard||!this.listenerTree.error))throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");var s;if(this.wildcard){s=[];var o=typeof e=="string"?e.split(this.delimiter):e.slice();u.call(this,s,o,this.listenerTree,0)}else s=this._events[e];if(typeof s=="function"){this.event=e;if(arguments.length===1)s.call(this);else if(arguments.length>1)switch(arguments.length){case 2:s.call(this,arguments[1]);break;case 3:s.call(this,arguments[1],arguments[2]);break;default:var t=arguments.length,n=new Array(t-1);for(var r=1;r<t;r++)n[r-1]=arguments[r];s.apply(this,n)}return!0}if(s){var t=arguments.length,n=new Array(t-1);for(var r=1;r<t;r++)n[r-1]=arguments[r];var a=s.slice();for(var r=0,t=a.length;r<t;r++)this.event=e,a[r].apply(this,n);return a.length>0||this._all}return this._all},o.prototype.on=function(e,t){if(typeof e=="function")return this.onAny(e),this;if(typeof t!="function")throw new Error("on only accepts instances of Function");this._events||i.call(this),this.emit("newListener",e,t);if(this.wildcard)return a.call(this,e,t),this;if(!this._events[e])this._events[e]=t;else if(typeof this._events[e]=="function")this._events[e]=[this._events[e],t];else if(n(this._events[e])){this._events[e].push(t);if(!this._events[e].warned){var s=r;typeof this._events.maxListeners!="undefined"&&(s=this._events.maxListeners),s>0&&this._events[e].length>s&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),console.trace())}}return this},o.prototype.onAny=function(e){this._all||(this._all=[]);if(typeof e!="function")throw new Error("onAny only accepts instances of Function");return this._all.push(e),this},o.prototype.addListener=o.prototype.on,o.prototype.off=function(e,t){if(typeof t!="function")throw new Error("removeListener only takes instances of Function");var r,i=[];if(this.wildcard){var s=typeof e=="string"?e.split(this.delimiter):e.slice();i=u.call(this,null,s,this.listenerTree,0)}else{if(!this._events[e])return this;r=this._events[e],i.push({_listeners:r})}for(var o=0;o<i.length;o++){var a=i[o];r=a._listeners;if(n(r)){var f=-1;for(var l=0,c=r.length;l<c;l++)if(r[l]===t||r[l].listener&&r[l].listener===t||r[l]._origin&&r[l]._origin===t){f=l;break}if(f<0)return this;this.wildcard?a._listeners.splice(f,1):this._events[e].splice(f,1),r.length===0&&(this.wildcard?delete a._listeners:delete this._events[e])}else if(r===t||r.listener&&r.listener===t||r._origin&&r._origin===t)this.wildcard?delete a._listeners:delete this._events[e]}return this},o.prototype.offAny=function(e){var t=0,n=0,r;if(e&&this._all&&this._all.length>0){r=this._all;for(t=0,n=r.length;t<n;t++)if(e===r[t])return r.splice(t,1),this}else this._all=[];return this},o.prototype.removeListener=o.prototype.off,o.prototype.removeAllListeners=function(e){if(arguments.length===0)return!this._events||i.call(this),this;if(this.wildcard){var t=typeof e=="string"?e.split(this.delimiter):e.slice(),n=u.call(this,null,t,this.listenerTree,0);for(var r=0;r<n.length;r++){var s=n[r];s._listeners=null}}else{if(!this._events[e])return this;this._events[e]=null}return this},o.prototype.listeners=function(e){if(this.wildcard){var t=[],r=typeof e=="string"?e.split(this.delimiter):e.slice();return u.call(this,t,r,this.listenerTree,0),t}return this._events||i.call(this),this._events[e]||(this._events[e]=[]),n(this._events[e])||(this._events[e]=[this._events[e]]),this._events[e]},o.prototype.listenersAny=function(){return this._all?this._all:[]},typeof define=="function"&&define.amd?define("eventemitter2",[],function(){return o}):e.EventEmitter2=o}(typeof process!="undefined"&&typeof process.title!="undefined"&&typeof exports!="undefined"?exports:window),define("react/eventemitter",["eventemitter2"],function(e){var t=e?e.EventEmitter2?e.EventEmitter2:e:EventEmitter2;return t}),define("util",["require","exports","module"],function(e,t,n){function s(e,t,n,r){var i={showHidden:t,seen:[],stylize:r?a:f};return l(i,e,typeof n=="undefined"?2:n)}function a(e,t){var n=u[t];return n?"["+o[n][0]+"m"+e+"["+o[n][1]+"m":e}function f(e,t){return e}function l(e,n,r){if(n&&typeof n.inspect=="function"&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n))return n.inspect(r);var i=c(e,n);if(i)return i;var s=Object.keys(n),o=e.showHidden?Object.getOwnPropertyNames(n):s;if(o.length===0){if(typeof n=="function"){var u=n.name?": "+n.name:"";return e.stylize("[Function"+u+"]","special")}if(g(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(y(n))return e.stylize(Date.prototype.toString.call(n),"date");if(b(n))return h(n)}var a="",f=!1,l=["{","}"];m(n)&&(f=!0,l=["[","]"]);if(typeof n=="function"){var w=n.name?": "+n.name:"";a=" [Function"+w+"]"}g(n)&&(a=" "+RegExp.prototype.toString.call(n)),y(n)&&(a=" "+Date.prototype.toUTCString.call(n)),b(n)&&(a=" "+h(n));if(o.length!==0||!!f&&n.length!==0){if(r<0)return g(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special");e.seen.push(n);var E;return f?E=p(e,n,r,s,o):E=o.map(function(t){return d(e,n,r,s,t,f)}),e.seen.pop(),v(E,a,l)}return l[0]+a+l[1]}function c(e,t){switch(typeof t){case"undefined":return e.stylize("undefined","undefined");case"string":var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string");case"number":return e.stylize(""+t,"number");case"boolean":return e.stylize(""+t,"boolean")}if(t===null)return e.stylize("null","null")}function h(e){return"["+Error.prototype.toString.call(e)+"]"}function p(e,t,n,r,i){var s=[];for(var o=0,u=t.length;o<u;++o)Object.prototype.hasOwnProperty.call(t,String(o))?s.push(d(e,t,n,r,String(o),!0)):s.push("");return i.forEach(function(i){i.match(/^\d+$/)||s.push(d(e,t,n,r,i,!0))}),s}function d(e,t,n,r,i,s){var o,u,a;a=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},a.get?a.set?u=e.stylize("[Getter/Setter]","special"):u=e.stylize("[Getter]","special"):a.set&&(u=e.stylize("[Setter]","special")),r.indexOf(i)<0&&(o="["+i+"]"),u||(e.seen.indexOf(a.value)<0?(n===null?u=l(e,a.value,null):u=l(e,a.value,n-1),u.indexOf("\n")>-1&&(s?u=u.split("\n").map(function(e){return" "+e}).join("\n").substr(2):u="\n"+u.split("\n").map(function(e){return" "+e}).join("\n"))):u=e.stylize("[Circular]","special"));if(typeof o=="undefined"){if(s&&i.match(/^\d+$/))return u;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+u}function v(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf("\n")>=0&&r++,e+t.length+1},0);return i>60?n[0]+(t===""?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1]:n[0]+t+" "+e.join(", ")+" "+n[1]}function m(e){return Array.isArray(e)||typeof e=="object"&&w(e)==="[object Array]"}function g(e){return typeof e=="object"&&w(e)==="[object RegExp]"}function y(e){return typeof e=="object"&&w(e)==="[object Date]"}function b(e){return typeof e=="object"&&w(e)==="[object Error]"}function w(e){return Object.prototype.toString.call(e)}function E(e){return e<10?"0"+e.toString(10):e.toString(10)}function x(){var e=new Date,t=[E(e.getHours()),E(e.getMinutes()),E(e.getSeconds())].join(":");return[e.getDate(),S[e.getMonth()],t].join(" ")}var r=/%[sdj%]/g;t.format=function(e){if(typeof e!="string"){var t=[];for(var n=0;n<arguments.length;n++)t.push(s(arguments[n]));return t.join(" ")}var i=1,o=arguments,u=o.length,a=String(e).replace(r,function(e){if(e==="%%")return"%";if(i>=u)return e;switch(e){case"%s":return String(o[i++]);case"%d":return Number(o[i++]);case"%j":return JSON.stringify(o[i++]);default:return e}});for(var f=o[i];i<u;f=o[++i])f===null||typeof f!="object"?a+=" "+f:a+=" "+s(f);return a},t.print=function(){for(var e=0,t=arguments.length;e<t;++e)process.stdout.write(String(arguments[e]))},t.puts=function(){for(var e=0,t=arguments.length;e<t;++e)process.stdout.write(arguments[e]+"\n")},t.debug=function(e){process.stderr.write("DEBUG: "+e+"\n")};var i=t.error=function(e){for(var t=0,n=arguments.length;t<n;++t)process.stderr.write(arguments[t]+"\n")};t.inspect=s;var o={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},u={special:"cyan",number:"yellow","boolean":"yellow","undefined":"grey","null":"bold",string:"green",date:"magenta",regexp:"red"};t.isArray=m,t.isRegExp=g,t.isDate=y,t.isError=b;var S=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];t.log=function(e){t.puts(x()+" - "+e.toString())},t.pump=function(e,t,n){function i(e,t,i){n&&!r&&(n(e,t,i),r=!0)}var r=!1;e.addListener("data",function(n){t.write(n)===!1&&e.pause()}),t.addListener("drain",function(){e.resume()}),e.addListener("end",function(){t.end()}),e.addListener("close",function(){i()}),e.addListener("error",function(e){t.end(),i(e)}),t.addListener("error",function(t){e.destroy(),i(t)})},t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t._extend=function(e,t){if(!t)return e;var n=Object.keys(t),r=n.length;while(r--)e[n[r]]=t[n[r]];return e}}),define("react/error",["util"],function(e){function t(e){if(!Error.stackTraceLimit||Error.stackTraceLimit<e)Error.stackTraceLimit=e}function n(e){return e?e&&e.name?e.name:e:"undefined"}function r(t){if(!t.meta)return;var r=t.meta.vcon,i=t.meta.task,s="\n\n";return i&&i.f&&i.a&&(s+="Error occurs in Task function: "+n(i.f)+"("+i.a.join(",")+")\n\n"),r&&(s+="Variable Context: \n",s+=e.inspect(r),s+="\n\n"),i&&i.f&&(s+="Task Source:\n\n",s+=i.f.toString(),s+="\n\n"),s}function i(e,t){typeof e=="string"&&(e=new Error(e));var n=e.toString();return e.meta=t,e.toString=function(){return n+r(e)},e}return{ensureStackTraceLimitSet:t,augmentError:i}}),define("react/sprintf",["util"],function(e){var t=e.format;return t}),function(e,t){typeof exports=="object"?module.exports=t():typeof define=="function"&&define.amd?define("ensure-array",[],t):e.ensureArray=t()}(this,function(){function e(e,t,n){if(arguments.length===0)return[];if(arguments.length===1){if(e===undefined||e===null)return[];if(Array.isArray(e))return e}return Array.prototype.slice.call(arguments)}return e}),define("react/status",[],function(){var e={READY:"ready",RUNNING:"running",ERRORED:"errored",COMPLETE:"complete"};return e}),define("react/event-manager",["./eventemitter"],function(e){function i(){}var t={wildcard:!0,delimiter:".",maxListeners:30},n=/^ast.defined$/,r={AST_DEFINED:"ast.defined",FLOW_BEGIN:"flow.begin",TASK_BEGIN:"task.begin",TASK_COMPLETE:"task.complete",TASK_ERRORED:"task.errored",FLOW_COMPLETE:"flow.complete",FLOW_ERRORED:"flow.errored",EXEC_FLOW_START:"exec.flow.start",EXEC_INPUT_PREPROCESS:"exec.input.preprocess",EXEC_TASKS_PRECREATE:"exec.tasks.precreate",EXEC_OUTTASK_CREATE:"exec.outTask.create",EXEC_TASK_START:"exec.task.start",EXEC_TASK_COMPLETE:"exec.task.complete",EXEC_TASK_ERRORED:"exec.task.errored",EXEC_FLOW_COMPLETE:"exec.flow.complete",EXEC_FLOW_ERRORED:"exec.flow.errored"};return i.create=function(){return new i},i.TYPES=r,i.prototype.TYPES=r,i.prototype.isEnabled=function(){return!!(this.emitter||this.parent&&this.parent.isEnabled())},i.prototype.on=function(n,r){this.emitter||(this.emitter=new e(t)),n==="*"?this.emitter.onAny(r):this.emitter.on(n,r)},i.prototype.emit=function(e,t,r,i){if(e===undefined)throw new Error("event is undefined");this.emitter&&this.emitter.emit.apply(this.emitter,arguments),this.parent&&this.parent.isEnabled()&&this.parent.emit.apply(this.parent,arguments),n.test(e)&&typeof process!="undefined"&&process.emit&&process.emit.apply(process,arguments)},i.prototype.removeListener=function(e,t){this.emitter&&this.emitter.removeListener.apply(this.emitter,arguments)},i.prototype.removeAllListeners=function(e){this.emitter&&this.emitter.removeAllListeners.apply(this.emitter,arguments)},i.global=i.create(),i}),define("react/base-task",["ensure-array","./status","./event-manager"],function(e,t,n){function r(){}function i(e){return e.indexOf(".")!==-1}return r.prototype.getOutParams=function(){return e(this.out)},r.prototype.isComplete=function(){return this.status===t.COMPLETE},r.prototype.start=function(e){this.args=e,this.env.currentTask=this,this.env.flowEmitter.emit(n.TYPES.EXEC_TASK_START,this)},r.prototype.complete=function(e){this.status=t.COMPLETE,this.results=e,this.env.currentTask=this,this.env.flowEmitter.emit(n.TYPES.EXEC_TASK_COMPLETE,this)},r.prototype.functionExists=function(e){var t=this.f;if(!t)return!1;if(t instanceof Function)return!0;if(typeof t=="string"){var n=e.getVar(t);if(n&&n instanceof Function)return!0}return!1},r.prototype.areAllDepArgsDefined=function(e){return this.a.every(function(t){return e.getVar(t)!==undefined})},r.prototype.depTasksAreDone=function(e){return!this.after||!this.after.length||this.after.every(function(t){return e[t].isComplete()})},r.prototype.parentExists=function(e,t){if(!i(e))return!0;var n=e.split(".");n.pop();var r=n.reduce(function(e,t){return e===undefined||e===null?undefined:e[t]},t.values);return r!==undefined&&r!==null},r.prototype.outParentsExist=function(e){var t=this;return this.getOutParams().every(function(n){return n===null?!0:t.parentExists(n,e)})},r.prototype.isReady=function(e,t){return!this.status&&this.functionExists(e)&&this.areAllDepArgsDefined(e)&&this.depTasksAreDone(t)&&(!this.outParentsExist||this.outParentsExist(e))},r.prototype.isMethodCall=function(){return typeof this.f=="string"&&/^.*\..*$/.test(this.f)},r.prototype.getMethodObj=function(e){var t=this.f;if(!t)return undefined;var n=t.split(".");n.pop();if(!n.length)return undefined;var r=e.resolveNameArr(n);return r},r}),define("react/cb-task",["util","./sprintf","./base-task"],function(e,t,n){function r(n,r){return t("%s - %s",n,e.inspect(r))}function a(e){var t=this;Object.keys(e).forEach(function(n){t[n]=e[n]})}var i="cbTask requires f, a, out",s="cbTask requires f to be a function or string",o="cbTask requires a to be an array of string param names",u="cbTask requires out to be an array of string param names";return a.prototype=new n,a.prototype.constructor=a,a.validate=function(e){var t=[];if(!e.f||!e.a||!e.out)t.push(r(i,e));else{var n=typeof e.f;e.f instanceof Function||n==="string"||t.push(r(s,e)),(!Array.isArray(e.a)||!e.a.every(function(e){return typeof e=="string"}))&&t.push(r(o,e)),(!Array.isArray(e.out)||!e.out.every(function(e){return typeof e=="string"}))&&t.push(r(u,e))}return t},a.prototype.prepare=function(t,n,r){var i=this;this.cbFun=function(e,s,o,u){var a=Array.prototype.slice.call(arguments,1);if(e){t(i,e);return}n.saveResults(i.out,a),i.complete(a),r()}},a.prototype.exec=function(t,n,r){try{var i=this.a.map(function(e){return t.getVar(e)});this.start(i),i.push(this.cbFun);var s=this.f,o=t.getVar("this");this.isMethodCall()?(s=t.getVar(this.f),o=this.getMethodObj(t)):typeof s=="string"&&(s=t.getVar(s)),s.apply(o,i)}catch(u){n(this,u)}},a}),define("react/promise-task",["util","./sprintf","./base-task"],function(e,t,n){function r(n,r){return t("%s - %s",n,e.inspect(r))}function a(e){var t=this;Object.keys(e).forEach(function(n){t[n]=e[n]})}var i="promiseTask requires f, a, out",s="promiseTask requires f to be a function or string",o="promiseTask requires a to be an array of string param names",u="promiseTask requires out to be an array[1] of string param names";return a.prototype=new n,a.prototype.constructor=a,a.validate=function(e){var t=[];if(!e.f||!e.a||!e.out)t.push(r(i,e));else{var n=typeof e.f;e.f instanceof Function||n==="string"||t.push(r(s,e)),(!Array.isArray(e.a)||!e.a.every(function(e){return typeof e=="string"}))&&t.push(r(o,e)),Array.isArray(e.out)&&e.out.length<=1&&e.out.every(function(e){return typeof e=="string"})||t.push(r(u,e))}return t},a.prototype.prepare=function(t,n,r){var i=this;this.nextFn=function(e){var t=Array.prototype.slice.call(arguments);n.saveResults(i.out,t),i.complete(t),r()},this.failFn=function(e){t(i,e)}},a.prototype.exec=function(t,n,r){try{var i=this.a.map(function(e){return t.getVar(e)});this.start(i);var s=this.f,o=t.getVar("this");this.isMethodCall()?(s=t.getVar(this.f),o=this.getMethodObj(t)):typeof s=="string"&&(s=t.getVar(s));var u=s.apply(o,i);u&&typeof u.then=="function"?u.then(this.nextFn,this.failFn):this.nextFn(u)}catch(a){n(this,a)}},a}),define("react/ret-task",["util","./sprintf","./base-task"],function(e,t,n){function r(n,r){return t("%s - %s",n,e.inspect(r))}function a(e){var t=this;Object.keys(e).forEach(function(n){t[n]=e[n]})}var i="retTask requires f, a, out",s="retTask requires f to be a function or string",o="retTask requires a to be an array of string param names",u="retTask requires out to be an array with single string param name or []";return a.prototype=new n,a.prototype.constructor=a,a.validate=function(e){var t=[];if(!e.f||!e.a||!e.out)t.push(r(i,e));else{var n=typeof e.f;e.f instanceof Function||n==="string"||t.push(r(s,e)),(!Array.isArray(e.a)||!e.a.every(function(e){return typeof e=="string"}))&&t.push(r(o,e)),(!Array.isArray(e.out)||!(e.out.length===0||e.out.length===1&&typeof (e.out[0]==="string")))&&t.push(r(u,e))}return t},a.prototype.exec=function(t,n,r){try{var i=this.a.map(function(e){return t.getVar(e)});this.start(i);var s=this.f,o=t.getVar("this");this.isMethodCall()?(s=t.getVar(this.f),o=this.getMethodObj(t)):typeof s=="string"&&(s=t.getVar(s));var u=[s.apply(o,i)];t.saveResults(this.out,u),this.complete(u),r()}catch(a){n(this,a)}},a}),define("react/when-task",["util","./sprintf","./base-task"],function(e,t,n){function r(n,r){return t("%s - %s",n,e.inspect(r))}function u(e){var t=this;Object.keys(e).forEach(function(n){t[n]=e[n]})}var i="whenTask requires a, out",s="whenTask requires a to be an array[1] of string param names",o="whenTask requires out to be an array[1] of string param names";return u.prototype=new n,u.prototype.constructor=u,u.prototype.f=function(){},u.validate=function(e){var t=[];return!e.a||!e.out?t.push(r(i,e)):((!Array.isArray(e.a)||e.a.length!==1||!e.a.every(function(e){return typeof e=="string"}))&&t.push(r(s,e)),Array.isArray(e.out)&&e.out.length<=1&&e.out.every(function(e){return typeof e=="string"})||t.push(r(o,e))),t},u.prototype.prepare=function(t,n,r){var i=this;this.nextFn=function(e){var t=Array.prototype.slice.call(arguments);n.saveResults(i.out,t),i.complete(t),r()},this.failFn=function(e){t(i,e)}},u.prototype.exec=function(t,n,r){try{var i=this.a.map(function(e){return t.getVar(e)});this.start(i);var s=i[0];s&&typeof s.then=="function"?s.then(this.nextFn,this.failFn):this.nextFn(s)}catch(o){n(this,o)}},u}),define("react/finalcb-task",["./sprintf","util","./status","./event-manager"],function(e,t,n,r){function s(e){var t=e.taskDef;if(typeof e.cbFunc!="function")throw new Error("callback is not a function");var n=this;for(var r in t)n[r]=t[r];this.f=e.cbFunc,this.tasks=e.tasks,this.vCon=e.vCon,this.retValue=e.retValue,this.execOptions=e.execOptions,this.env=e.env}function o(n,r){return e("%s - %s",n,t.inspect(r))}var i="ast.outTask.a should be an array of string param names";return s.validate=function(e){var t=[];return(!Array.isArray(e.a)||!e.a.every(function(e){return typeof e=="string"}))&&t.push(o(i,e)),t},s.prototype.isReady=function(){return this.tasks.every(function(e){return e.status===n.COMPLETE})},s.prototype.exec=function(e){if(!this.f)return;if(e)this.env.error=e,this.env.flowEmitter.emit(r.TYPES.EXEC_FLOW_ERRORED,this.env),this.f.call(null,e);else{var t=this.vCon,n=this.a.map(function(e){return t.getVar(e)});n.unshift(null),this.env.results=n,this.env.flowEmitter.emit(r.TYPES.EXEC_FLOW_COMPLETE,this.env),this.f.apply(null,n)}this.f=null},s}),define("react/vcon",[],function(){function t(){}var e=":LAST_RESULTS";return t.prototype.getLastResults=function(){return this.getVar(e)},t.prototype.setLastResults=function(t){this.setVar(e,t)},t.prototype.getVar=function(e){var t=this.values;if(typeof e!="string")return e;e=e.trim();if(e==="true")return!0;if(e==="false")return!1;if(e==="null")return null;if(/^-?[0-9]+$/.test(e))return parseInt(e,10);if(/^-?[0-9.]+$/.test(e))return parseFloat(e);var n=/^("|')([^\1]*)\1$/.exec(e);if(n)return n[2];var r=e.split("."),i=this.resolveNameArr(r);return i},t.prototype.resolveNameArr=function(e){var t=this.values,n=e.reduce(function(e,t){return e===undefined||e===null?undefined:e[t]},t);return n===undefined&&this.global!==undefined&&(n=e.reduce(function(e,t){return e===undefined||e===null?undefined:e[t]},this.global)),n},t.prototype.saveResults=function(e,t){var n=this;e.forEach(function(e,r){n.setVar(e,t[r]!==undefined?t[r]:null)}),this.setLastResults(t)},t.prototype.setVar=function(e,t){if(!e)return;var n=this.values,r=e.split("."),i=r.pop(),s=r.reduce(function(e,t){var n=e[t];if(n===undefined||n===null)n=e[t]={};return n},n);s[i]=t},t.create=function(e,n,r,i){var s={};i&&(s["this"]=i),r&&Object.keys(r).forEach(function(e){s[e]=r[e]});var o=new t;return o.values=e.reduce(function(e,t,r){var i=n[r];return i&&(e[i]=t!==undefined?t:null),e},s),typeof global=="object"?o.global=global:o.global=(new Function("return this"))(),o},t}),define("react/finalcb-first-task",["./sprintf","util","./status","./vcon","./event-manager"],function(e,t,n,r,i){function o(e){var t=e.taskDef;if(typeof e.cbFunc!="function")throw new Error("callback is not a function");var n=this;for(var r in t)n[r]=t[r];this.f=e.cbFunc,this.tasks=e.tasks,this.vCon=e.vCon,this.retValue=e.retValue,this.env=e.env}function u(n,r){return e("%s - %s",n,t.inspect(r))}var s="ast.outTask.a should be an array of string param names";return o.validate=function(e){var t=[];return(!Array.isArray(e.a)||!e.a.every(function(e){return typeof e=="string"}))&&t.push(u(s,e)),t},o.prototype.isReady=function(){var e=this.vCon.getLastResults();return e?e.some(function(e){return e!==undefined&&e!==null}):!1},o.prototype.exec=function(e){if(!this.f)return;if(e)this.env.error=e,this.env.flowEmitter.emit(i.TYPES.EXEC_FLOW_ERRORED,this.env),this.f.call(null,e);else{var t=this.vCon,n=this.a.map(function(e){return t.getVar(e)});n.unshift(null),this.env.results=n,this.env.flowEmitter.emit(i.TYPES.EXEC_FLOW_COMPLETE,this.env),this.f.apply(null,n)}this.f=null},o}),define("react/task",["util","./sprintf","ensure-array","./cb-task","./promise-task","./ret-task","./when-task","./finalcb-task","./finalcb-first-task","./status","./error","./vcon","./event-manager"],function(e,t,n,r,i,s,o,u,a,f,l,c,h){function v(){return Object.keys(p)}function g(){return Object.keys(m)}function S(n,r){return t("%s - %s",n,e.inspect(r))}function x(e){return e.type?e:(e.type="cb",e)}function T(e){e.type||(e.type=Object.keys(m)[0])}function N(e){if(!e.after)return;var t=n(e.after);t=t.map(function(e){return typeof e=="function"?e.name:e}),e.after=t}function C(e){if(!e||typeof e!="object")return[S(b,e)];x(e),N(e);var t=[];return t=t.concat(k(e)),t=t.concat(L(e)),t}function k(e){var t=[];return Object.keys(p).some(function(t){return e.type===t})||t.push(S(E,e)),t}function L(e){var t=[],n=p[e.type];return n&&(t=t.concat(n.validate(e))),t}function A(e){var t=[];T(e);var n=m[e.type];return t=t.concat(n.validate(e)),t}function O(e,n,r){function s(){}var i=[],o=e.map(function(e){return s}),u=c.create(o,e,r),a=n.map(D),f=a.filter(function(e){return e.type!=="when"});return f.forEach(function(e,n){if(!e.functionExists(u))if(!e.isMethodCall())i.push(t(y,e.f,n));else{var r=e.getMethodObj(u);r&&r!==s&&i.push(t(y,e.f,n))}}),i}function M(e){return typeof e=="function"?e.name:e?e:""}function _(e){var n=e.reduce(function(e,t){return t.name&&(e[t.name]=t),e},{});return e.forEach(function(e,r){if(!e.name){var i=M(e.f);i||(i=t(d,r));if(!i||n[i])i=t("%s_%s",i,r);e.name=i,n[i]=e}}),n}function D(e){var t=p[e.type];return new t(e)}function P(e,t,n,r,i,s){T(e);var o={taskDef:e,cbFunc:t,tasks:n,vCon:r,execOptions:i,env:s,TaskConstructor:m[e.type]};h.global.emit(h.TYPES.EXEC_OUTTASK_CREATE,o);var u=o.TaskConstructor;return new u(o)}function H(e,t){return function(r,i){r.status=f.ERRORED,r.error=i,t.env.currentTask=r,t.env.flowEmitter.emit(h.TYPES.EXEC_TASK_ERRORED,r);var s=l.augmentError(i,{task:r,vcon:e});t.exec(s)}}function B(e,t,n){return t.filter(function(t){return t.isReady(e,n)})}function j(e,t,n,r){e.forEach(function(e){e.status=f.READY}),e.forEach(function(e){e.exec(t,n,r)})}function F(e,n,r,i){var s=n.filter(function(e){return e.status===f.RUNNING||e.status===f.READY});if(!s.length){var o=n.filter(function(e){return!e.status}),u=o.map(function(e){return e.name}),a=t(w,u.join(", ")),l={env:i};r(l,new Error(a))}}function I(e,t,n,r,i,s){var o=B(e,t,n);o.length||F(e,t,r,s),j(o,e,r,i)}function q(e){return _(e),e.forEach(function(e,t,n){t!==0&&(e.after=[n[t-1].name])}),e}var p={cb:r,ret:s,promise:i,when:o},d="task_%s",m={finalcb:u,finalcbFirst:a},y="function: %s not found in locals or input params - task[%s]",b="task must be an object",w="no tasks running, flow will not complete, remaining tasks: %s",E="task.type should match one of "+Object.keys(p).join(", ");return{serializeTasks:q,TASK_TYPES:p,taskTypeKeys:v,OUT_TASK_TYPES:m,outTaskTypeKeys:g,setMissingType:x,validate:C,validateOutTask:A,validateLocalFunctions:O,nameTasks:_,create:D,createOutTask:P,createErrorHandler:H,findReadyAndExec:I}}),define("react/validate",["util","./sprintf","ensure-array","./task"],function(e,t,n,r){function h(n,r){return t("%s - %s",n,e.inspect(r))}function p(e){return c.test(e)}function d(e){if(!e||!e.inParams||!e.tasks||!e.outTask)return[i];var t=[];return t=t.concat(v(e.inParams)),t=t.concat(m(e.tasks)),t=t.concat(g(e.tasks)),t=t.concat(r.validateOutTask(e.outTask)),t=t.concat(y(e.locals)),t.length===0&&(e.outTask.type!=="finalcbFirst"&&(t=t.concat(w(e.tasks))),t=t.concat(r.validateLocalFunctions(e.inParams,e.tasks,e.locals)),t=t.concat(E(e))),t}function v(e){return!Array.isArray(e)||!e.every(function(e){return typeof e=="string"})?[s]:[]}function m(e){if(!Array.isArray(e))return[o];var t=[];return e.forEach(function(e){t=t.concat(r.validate(e))}),t}function g(e){if(!Array.isArray(e))return[];var n=[],r=e.filter(function(e){return e.name}),i=r.map(function(e){return e.name});return i.reduce(function(e,r){return e[r]?n.push(t("%s %s",u,r)):e[r]=!0,e},{}),n}function y(e){var t=[];return e===null&&t.push(a),t}function b(e){return n(e.out)}function w(e){var n=[];return e.reduce(function(e,r){return b(r).forEach(function(r){e[r]!==undefined?n.push(t("%s: %s",f,r)):e[r]=!0}),e},{}),n}function E(e){var n=[],r={};return e.locals&&(r=Object.keys(e.locals).reduce(function(e,t){return e[t]=!0,e},r)),e.inParams.reduce(function(e,t){return e[t]=!0,e},r),e.tasks.reduce(function(e,t){return t.out.reduce(function(e,t){return e[t]=!0,e},e)},r),e.tasks.reduce(function(e,n){return n.a.reduce(function(e,n){return!p(n)&&!r[n]&&e.push(t(l,n)),e},e)},n),e.outTask.a.reduce(function(e,n){return!p(n)&&!r[n]&&e.push(t(l,n)),e},n),n}var i="ast must be an object with inParams, tasks, and outTask",s="ast.inParams must be an array of strings",o="ast.tasks must be an array of tasks",u="ast.tasks that specify name need to be unique, duplicate:",a="ast.locals should not be null",f="multiple tasks output the same param, must be unique. param",l="missing or mispelled variable referenced in flow definition: %s",c=/^(true|false|this|null|\-?[0-9\.]+)$|'|"|\./i;return d}),define("react/input-parser",["./event-manager"],function(e){function r(e){return e&&e.reactExecOptions}function i(e){return r(e)}function s(e){return!r(e)}function o(e,t){return Object.keys(t).forEach(function(n){e[n]=t[n]}),e}function u(e,t,r){var i={};return i.args=t.map(function(t){return e.shift()}),r===n.CALLBACK&&e.length&&(i.cb=e.shift()),i.extra=e,i}function a(n,r){var a={},f=n.filter(i);f.unshift(t),a.options=f.reduce(o,{});var l=n.filter(s),c=u(l,r.inParams,a.options.outputStyle);return a.args=c.args,a.cb=c.cb,c.outputStyle&&(a.options.outputStyle=c.outputStyle),c.extra&&(a.extraArgs=c.extra),e.global.emit(e.TYPES.EXEC_INPUT_PREPROCESS,a),a}var t={reactExecOptions:!0,outputStyle:"cb"},n={CALLBACK:"cb",NONE:"none"};return a.defaultExecOptions=t,a}),define("react/id",[],function(){function t(){return e+=1,e===Number.MAX_VALUE&&(e=0),e}var e=0;return{createUniqueId:t}}),define("react/core",["./eventemitter","./error","./validate","./task","./status","./vcon","./event-manager","./input-parser","./id","./sprintf"],function(e,t,n,r,i,s,o,u,a,f){function h(e){return Object.keys(l).reduce(function(e,t){return e[t]||(e[t]=l[t]),e},e)}function p(){return f("flow_%s",a.createUniqueId())}function d(){function f(t){Object.keys(t).forEach(function(e){i[e]=t[e]});var s=n(i);return s.length||(i.name||(i.name=p()),r.nameTasks(i.tasks)),Object.freeze&&(Object.keys(t).forEach(function(e){typeof t[e]=="object"&&Object.freeze(t[e])}),Object.freeze(t)),e.emit(o.TYPES.AST_DEFINED,i),s}function d(t,n,f,l){function E(){if(!b.f)return;if(b.isReady())return b.exec();r.findReadyAndExec(m,g,y,w,E,d)}var p=Array.prototype.slice.call(arguments),d={execId:a.createUniqueId(),args:p,ast:i,flowEmitter:e};d.name=i.name||d.execId,e.emit(o.TYPES.EXEC_FLOW_START,d);var v=u(p,i),m=s.create(v.args,i.inParams,i.locals,this);d.parsedInput=v,d.options=h(v.options),d.vCon=m,d.taskDefs=i.tasks.slice(),d.outTaskDef=Object.create(i.outTask),c.emit(o.TYPES.EXEC_TASKS_PRECREATE,d);var g=d.taskDefs.map(r.create),y=r.nameTasks(g),b=r.createOutTask(d.outTaskDef,v.cb,g,m,d.options,d),w=r.createErrorHandler(m,b);return g.forEach(function(t){t.id=a.createUniqueId(),t.env=d,t.prepare&&t.prepare(w,m,E,e)}),E(),b.retValue}if(arguments.length)throw new Error("react() takes no args, check API");t.ensureStackTraceLimitSet(l.stackTraceLimitMin);var e=o.create();e.parent=c;var i={name:undefined,inParams:[],tasks:[],outTask:{},locals:{}},v=d;return v.ast=i,v.setAndValidateAST=f,v.events=e,v}var l={stackTraceLimitMin:30},c=o.global;return d.options=l,d.events=c,d}),define("react/parse",["./sprintf"],function(e){function t(e){return e?e.split(",").map(function(e){return e.trim()}).filter(function(e){return e}):[]}function n(e,t){if(typeof e!="string")return e;var n=t.regex?t.regex.exec(e):e.split(t.splitStr);return n?t.fn(n,e):e}function r(t,r,i){var s=r.reduce(n,t);if(typeof s!="string")return s;throw new Error(e(i,t))}return{splitTrimFilterArgs:t,parseStr:r}}),define("react/dsl",["./sprintf","./core","./parse","./task"],function(e,t,n,r){function h(e){return e.length&&e[e.length-1].match(l)&&e.pop(),e}function p(e){return e.length&&e[0].match(c)&&e.shift(),e}function v(e){var t=n.parseStr(e,[d],s);return t.inDef=h(t.inDef),t}function m(t){var n=[],r,i,s;while(t.length>=2){i={},r=t.shift(),s=v(t.shift()),typeof t[0]=="object"&&(i=t.shift()),i.f=r,i.a=s.inDef;var o=s.type;i.out=s.outDef,i.type=o,n.push(i)}if(t.length)throw new Error(e(a,t[0]));return n}function g(e){var t=e.shift()||"",n=e.length&&typeof e[0]=="object"?e.shift():{},r=e,i={inOutParamStr:t,taskDefArr:r,options:n};return i}function y(n,r,s,o){var u=t();if(n&&f.test(n))throw new Error(e(i,n));var a=g(Array.prototype.slice.call(arguments,1)),l=v(a.inOutParamStr),c={name:n,inParams:l.inDef,tasks:m(a.taskDefArr),outTask:{a:l.outDef}};a.options&&Object.keys(a.options).forEach(function(e){c[e]=a.options[e]});var h=u.setAndValidateAST(c);if(h.length){var p=h.join("\n");throw new Error(p)}return u}function b(e,n,i,s){var o=t(),u=g(Array.prototype.slice.call(arguments,1)),a=v(u.inOutParamStr),f=r.serializeTasks(m(u.taskDefArr)),l={name:e,inParams:a.inDef,tasks:f,outTask:{type:"finalcbFirst",a:a.outDef}};u.options&&Object.keys(u.options).forEach(function(e){l[e]=u.options[e]});var c=o.setAndValidateAST(l);if(c.length){var h=c.join("\n");throw new Error(h)}return o}var i="first flow parameter should be the flow name, but found in/out def: %s",s='params in wrong format, wanted "foo, bar, cb -> err, baz" - found: %s',o='callback specified, but first out param was not "err", use for clarity. Found in/out def: %s',u="found err param, but cb/callback is not specified, is this cb-style async or sync function? Found in/out def: %s",a="extra unmatched task arg: %s",f=/\->/,l=/^cb|callback$/i,c=/^err$/i,d={splitStr:"->",fn:function(t,r){var i=n.splitTrimFilterArgs(t[0]),s=i[i.length-1],a=s&&l.test(s)?"cb":"ret",f=n.splitTrimFilterArgs(t[1]),d=f[0];if(a==="cb"&&(!d||!c.test(d)))throw new Error(e(o,r));if(a==="ret"&&d&&c.test(d))throw new Error(e(u,r));return{type:a,inDef:h(i),outDef:p(f)}}};return y.selectFirst=b,y}),define("react/track-tasks",[],function(){function t(t){if(e)return;e=!0,t.events.on(t.events.TYPES.EXEC_FLOW_START,function(e){e.startTime=Date.now(),e.flowEmitter.emit(t.events.TYPES.FLOW_BEGIN,e)}),t.events.on(t.events.TYPES.EXEC_TASK_START,function(e){e.startTime=Date.now(),e.env.flowEmitter.emit(t.events.TYPES.TASK_BEGIN,e)}),t.events.on(t.events.TYPES.EXEC_TASK_COMPLETE,function(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime,e.env.flowEmitter.emit(t.events.TYPES.TASK_COMPLETE,e)}),t.events.on(t.events.TYPES.EXEC_TASK_ERRORED,function(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime,e.env.flowEmitter.emit(t.events.TYPES.TASK_ERRORED,e)}),t.events.on(t.events.TYPES.EXEC_FLOW_COMPLETE,function(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime,e.flowEmitter.emit(t.events.TYPES.FLOW_COMPLETE,e)}),t.events.on(t.events.TYPES.EXEC_FLOW_ERRORED,function(e){e.endTime=Date.now(),e.elapsedTime=e.endTime-e.startTime,e.flowEmitter.emit(t.events.TYPES.FLOW_ERRORED,e)})}var e=!1;return t}),define("react/log-events",["util"],function(e){function s(t){var n=new Date;n.setTime(t.startTime);var r=t.args.filter(function(e){return typeof e!="function"}),i=n.toISOString();if(this.event==="flow.complete"){var s=t;console.error("%s: %s msecs: %s \n args: %s \n results: %s\n",this.event,s.name,s.elapsedTime,e.inspect(r),e.inspect(s.results))}else{var o=t.name,u=t.args;console.error("%s: %s \n args: %s\n",this.event,o,e.inspect(r))}}function o(t){var n=new Date;n.setTime(t.startTime);var r=t.args.filter(function(e){return typeof e!="function"}),i=n.toISOString();if(this.event==="task.complete"){var s=t;console.error("%s: %s:%s msecs: %s \n args: %s \n results: %s\n",this.event,s.env.name,s.name,s.elapsedTime,e.inspect(r),e.inspect(s.results))}else{var o=t.name,u=t.args;console.error("%s: %s:%s \n args: %s\n",this.event,t.env.name,t.name,e.inspect(r))}}function u(e,t){if(!e)throw new Error("flowFn is required");e.events._loggingEvents||(e.events._loggingEvents=[]);if(t===!1)e.events._loggingEvents.forEach(function(t){e.events.removeAllListeners(t)}),e.events._loggingEvents.length=0;else if(t&&t!=="*"){var u=i.test(t)?s:o;e.events.removeListener(t,u),e.events.on(t,u),e.events._loggingEvents.push(t)}else e.events.removeListener(n,s),e.events.on(n,s),e.events._loggingEvents.push(n),e.events.removeListener(r,o),e.events.on(r,o),e.events._loggingEvents.push(r)}var t={},n="flow.*",r="task.*",i=/^flow\./;return t.logEvents=u,t}),define("react/promise-resolve",[],function(){function n(n){if(t)return;t=!0,n.events.on(n.events.TYPES.EXEC_TASKS_PRECREATE,function(t){var n=t.vCon.values,r=t.ast.inParams.filter(function(e){var t=n[e];return t&&typeof t.then=="function"});r.forEach(function(r){var i=r+e;n[i]=n[r],n[r]=undefined,t.taskDefs.push({type:"when",a:[i],out:[r]})})})}var e="__promise",t=!1;return n}),define("react/event-collector",[],function(){function e(e){function i(){this.events=[]}e.trackTasks();var t=/^ast\./,n=/^task\./,r=/^flow\./;return i.prototype.capture=function(i,s){function a(e){var i={event:this.event,time:Date.now()};r.test(this.event)?i.env=e:n.test(this.event)?i.task=e:t.test(this.event)&&(i.ast=e),u.events.push(i)}!s&&typeof i=="string"?(s=i,i=e):i||(i=e),s||(s="*");var o=i.events,u=this;o.on(s,a)},i.prototype.list=function(){return this.events},i.prototype.clear=function(){this.events=[]},new i}return e}),define("react/react",["./core","./dsl","./track-tasks","./log-events","./promise-resolve","./event-collector"],function(e,t,n,r,i,s){function u(){i(o)}function a(){n(o)}function f(e,t){return typeof e!="function"&&(t=e,e=undefined),e||(e=o),a(),r.logEvents(e,t)}function l(){return s(o)}var o=t;return o.options=e.options,o.events=e.events,o.logEvents=f,o.resolvePromises=u,o.trackTasks=a,o.createEventCollector=l,o}),define("react",["react/react"],function(e){return e});
package/doc/advanced.md CHANGED
@@ -74,7 +74,7 @@ The AST contains the following pieces:
74
74
  - **outTask** - task definition object specifying the flow's output style and parameters containing:
75
75
  - **f** - will contain reference to the callback function at runtime
76
76
  - **a** - parameters being passed as output from the flow
77
- - **locals** - object provided which contains additional values that will become part of the React variable space like input parameters but can be defined in advance at flow definition. This can be used to provide functions and objects to React enabling string based DSL's.
77
+ - **locals** - object provided which contains additional values that will become part of the React variable space like input parameters but can be defined in advance at flow definition. This can be used to provide functions and objects to React enabling string based DSL's. The global variables are already built-in, but any locals that are needed would be specified here.
78
78
 
79
79
 
80
80
  ## Plugins (optional requires which turn on additional functionality)
@@ -102,6 +102,14 @@ react.logEvents('flow.*'); // turn on flow logging for all react functions
102
102
  react.logEvents(myReactFn, 'task.*'); // turn on task logging for myReactFn
103
103
  ```
104
104
 
105
+ To turn off logging
106
+
107
+ ```javascript
108
+ react.logEvents(false); // turn off logging
109
+ ```
110
+
111
+
112
+
105
113
  Available Events that can be logged:
106
114
 
107
115
  - flow.begin - flow execution has started (receives a flow env)
package/lib/base-task.js CHANGED
@@ -1,4 +1,3 @@
1
- 'use strict';
2
1
  /*global define:true */
3
2
 
4
3
  if (typeof define !== 'function') {
@@ -7,7 +6,8 @@ if (typeof define !== 'function') {
7
6
 
8
7
  define(['ensure-array', './status', './event-manager'],
9
8
  function (array, STATUS, EventManager) {
10
-
9
+ 'use strict';
10
+
11
11
  function BaseTask() {
12
12
  }
13
13
 
@@ -67,7 +67,7 @@ define(['ensure-array', './status', './event-manager'],
67
67
  to this if they want to do this check.
68
68
  */
69
69
  BaseTask.prototype.parentExists = function (objPropStr, vCon) {
70
- if (!isObjProperty(objPropStr)) return true; // NOT obj prop, just simple arg, ret true
70
+ if (!isObjProperty(objPropStr)) return true; // NOT obj prop, just simple arg, ret true
71
71
  var nameAndProps = objPropStr.split('.');
72
72
  nameAndProps.pop(); // pop off final prop
73
73
  var parent = nameAndProps.reduce(function (accObj, prop) {
@@ -103,21 +103,18 @@ define(['ensure-array', './status', './event-manager'],
103
103
  BaseTask.prototype.isMethodCall = function () {
104
104
  /*jshint regexp: false */
105
105
  return (typeof(this.f) === 'string' && /^.*\..*$/.test(this.f)); //str contains .
106
- };
107
-
108
- BaseTask.prototype.getMethodObj = function (vCon) { //obj.prop.prop2, returns obj.prop or undefined
109
- var name = this.f;
110
- if (!name) return undefined;
111
- var nameAndProps = name.split('.');
112
- nameAndProps.pop(); // pop off last one
113
- if (!nameAndProps.length) return undefined;
114
- var result = nameAndProps.reduce(function (accObj, prop) {
115
- if (accObj === undefined || accObj === null) return undefined; // prevent exception
116
- return accObj[prop];
117
- }, vCon.values); // vCon['foo']['bar']
118
- return result;
119
- };
106
+ };
107
+
108
+ BaseTask.prototype.getMethodObj = function (vCon) { //obj.prop.prop2, returns obj.prop or undefined
109
+ var name = this.f;
110
+ if (!name) return undefined;
111
+ var nameAndProps = name.split('.');
112
+ nameAndProps.pop(); // pop off last one
113
+ if (!nameAndProps.length) return undefined;
114
+ var result = vCon.resolveNameArr(nameAndProps);
115
+ return result;
116
+ };
120
117
 
121
118
  return BaseTask;
122
-
123
- });
119
+
120
+ });
package/lib/cb-task.js CHANGED
@@ -1,4 +1,3 @@
1
- 'use strict';
2
1
  /*global define:true */
3
2
 
4
3
  if (typeof define !== 'function') {
@@ -6,6 +5,7 @@ if (typeof define !== 'function') {
6
5
  }
7
6
 
8
7
  define(['util', './sprintf', './base-task'], function (util, sprintf, BaseTask) {
8
+ 'use strict';
9
9
 
10
10
  function format_error(errmsg, obj) {
11
11
  return sprintf('%s - %s', errmsg, util.inspect(obj));
@@ -55,7 +55,7 @@ define(['util', './sprintf', './base-task'], function (util, sprintf, BaseTask)
55
55
  vCon.saveResults(self.out, args);
56
56
  self.complete(args);
57
57
  contExec();
58
- };
58
+ };
59
59
  };
60
60
 
61
61
  CbTask.prototype.exec = function exec(vCon, handleError, contExec) {
@@ -73,12 +73,12 @@ define(['util', './sprintf', './base-task'], function (util, sprintf, BaseTask)
73
73
  } else if (typeof(func) === 'string') {
74
74
  func = vCon.getVar(func); // we want the actual fn from this string
75
75
  }
76
- func.apply(bindObj, args);
76
+ func.apply(bindObj, args);
77
77
  } catch (err) { //catch and handle the task error, calling final cb
78
78
  handleError(this, err);
79
- }
79
+ }
80
80
  };
81
81
 
82
82
  return CbTask;
83
83
 
84
- });
84
+ });
package/lib/core.js CHANGED
@@ -1,4 +1,3 @@
1
- 'use strict';
2
1
  /*global define:true */
3
2
 
4
3
  if (typeof define !== 'function') {
@@ -9,6 +8,7 @@ define(['./eventemitter', './error', './validate', './task', './status',
9
8
  './vcon', './event-manager', './input-parser', './id', './sprintf'],
10
9
  function (EventEmitter, error, validate, taskUtil, STATUS,
11
10
  VContext, EventManager, inputParser, idGenerator, sprintf) {
11
+ 'use strict';
12
12
 
13
13
  var reactOptions = {
14
14
  stackTraceLimitMin: 30
@@ -23,7 +23,7 @@ define(['./eventemitter', './error', './validate', './task', './status',
23
23
  return Object.keys(reactOptions).reduce(function (accum, k) {
24
24
  if (!accum[k]) accum[k] = reactOptions[k];
25
25
  return accum;
26
- }, parsedOptions);
26
+ }, parsedOptions);
27
27
  }
28
28
 
29
29
  /**
@@ -80,9 +80,9 @@ define(['./eventemitter', './error', './validate', './task', './status',
80
80
  });
81
81
  Object.freeze(newAST);
82
82
  }
83
- flowEmitter.emit(EventManager.TYPES.AST_DEFINED, ast);
83
+ flowEmitter.emit(EventManager.TYPES.AST_DEFINED, ast);
84
84
  return errors;
85
- }
85
+ }
86
86
 
87
87
  function exec(arg1, arg2, argN, cb) { // called to execute the flow
88
88
  /*jshint validthis: true */
@@ -102,9 +102,9 @@ define(['./eventemitter', './error', './validate', './task', './status',
102
102
  env.options = mergeOptions(parsedInput.options);
103
103
  env.vCon = vCon;
104
104
  env.taskDefs = ast.tasks.slice(); // create copy
105
- env.outTaskDef = Object.create(ast.outTask); // create copy
105
+ env.outTaskDef = Object.create(ast.outTask); // create copy
106
106
  reactEmitter.emit(EventManager.TYPES.EXEC_TASKS_PRECREATE, env); // hook
107
-
107
+
108
108
  var tasks = env.taskDefs.map(taskUtil.create);
109
109
  var tasksByName = taskUtil.nameTasks(tasks); // map names to working tasks
110
110
  var outTask = taskUtil.createOutTask(env.outTaskDef, parsedInput.cb, tasks, vCon, env.options, env);
@@ -135,4 +135,4 @@ define(['./eventemitter', './error', './validate', './task', './status',
135
135
  reactFactory.options = reactOptions; // global react options
136
136
  reactFactory.events = reactEmitter; // global react emitter
137
137
  return reactFactory; // module returns reactFactory to create a react fn
138
- });
138
+ });
package/lib/dsl.js CHANGED
@@ -1,4 +1,3 @@
1
- 'use strict';
2
1
  /*global define:true */
3
2
 
4
3
  if (typeof define !== 'function') {
@@ -7,7 +6,8 @@ if (typeof define !== 'function') {
7
6
 
8
7
  define(['./sprintf', './core', './parse', './task'],
9
8
  function (sprintf, core, parse, taskUtil) {
10
- /*jshint regexp: false */
9
+ 'use strict';
10
+ /*jshint regexp: false */
11
11
 
12
12
  var MISSING_NAME = 'first flow parameter should be the flow name, but found in/out def: %s';
13
13
  var INOUT_PARAMS_NO_MATCH = 'params in wrong format, wanted "foo, bar, cb -> err, baz" - found: %s';
@@ -31,23 +31,23 @@ define(['./sprintf', './core', './parse', './task'],
31
31
 
32
32
  var inOutDefParse = {
33
33
  splitStr: '->',
34
- fn: function (m, origStr) {
35
- var inParams = parse.splitTrimFilterArgs(m[0]);
36
- var lastParam = inParams[inParams.length - 1];
37
- var type = (lastParam && CB_NAMES_RE.test(lastParam)) ? 'cb' : 'ret';
38
- var outParams = parse.splitTrimFilterArgs(m[1]);
39
- var firstOutParam = outParams[0];
40
- if (type === 'cb' && (!firstOutParam || !ERR_NAMES_RE.test(firstOutParam))) {
41
- throw new Error(sprintf(MISSING_ERR, origStr)); // found cb, but no err param
42
- } else if (type === 'ret' && firstOutParam && ERR_NAMES_RE.test(firstOutParam)) {
43
- throw new Error(sprintf(MISSING_CB, origStr)); // found err but not cb param
44
- }
45
- return {
46
- type: type,
47
- inDef: filterOutTrailingCbParam(inParams),
48
- outDef: filterOutLeadingErrParam(outParams)
49
- };
34
+ fn: function (m, origStr) {
35
+ var inParams = parse.splitTrimFilterArgs(m[0]);
36
+ var lastParam = inParams[inParams.length - 1];
37
+ var type = (lastParam && CB_NAMES_RE.test(lastParam)) ? 'cb' : 'ret';
38
+ var outParams = parse.splitTrimFilterArgs(m[1]);
39
+ var firstOutParam = outParams[0];
40
+ if (type === 'cb' && (!firstOutParam || !ERR_NAMES_RE.test(firstOutParam))) {
41
+ throw new Error(sprintf(MISSING_ERR, origStr)); // found cb, but no err param
42
+ } else if (type === 'ret' && firstOutParam && ERR_NAMES_RE.test(firstOutParam)) {
43
+ throw new Error(sprintf(MISSING_CB, origStr)); // found err but not cb param
50
44
  }
45
+ return {
46
+ type: type,
47
+ inDef: filterOutTrailingCbParam(inParams),
48
+ outDef: filterOutLeadingErrParam(outParams)
49
+ };
50
+ }
51
51
  };
52
52
 
53
53
  function parseInOutParams(str) {
@@ -83,11 +83,11 @@ define(['./sprintf', './core', './parse', './task'],
83
83
  // if next arg is object, shift it off as options
84
84
  var options = (vargs.length && typeof(vargs[0]) === 'object') ? vargs.shift() : { };
85
85
  var taskDefArr = vargs; // rest are for the tasks
86
- var defObj = {
86
+ var defObj = {
87
87
  inOutParamStr: inOutParamStr,
88
88
  taskDefArr: taskDefArr,
89
89
  options: options
90
- };
90
+ };
91
91
  return defObj;
92
92
  }
93
93
 
@@ -95,7 +95,7 @@ define(['./sprintf', './core', './parse', './task'],
95
95
  function dslDefine(name, arg1, arg2, argN) {
96
96
  var reactFn = core();
97
97
  if (name && INOUT_RE.test(name)) throw new Error(sprintf(MISSING_NAME, name));
98
- var defObj = parseVargs(Array.prototype.slice.call(arguments, 1)); // name, already used
98
+ var defObj = parseVargs(Array.prototype.slice.call(arguments, 1)); // name, already used
99
99
  var inOutDef = parseInOutParams(defObj.inOutParamStr);
100
100
  var ast = {
101
101
  name: name,
@@ -104,18 +104,18 @@ define(['./sprintf', './core', './parse', './task'],
104
104
  outTask: { a: inOutDef.outDef }
105
105
  };
106
106
  if (defObj.options) Object.keys(defObj.options).forEach(function (k) { ast[k] = defObj.options[k]; });
107
- var errors = reactFn.setAndValidateAST(ast);
107
+ var errors = reactFn.setAndValidateAST(ast);
108
108
  if (errors.length) {
109
109
  var errorStr = errors.join('\n');
110
- throw new Error(errorStr);
110
+ throw new Error(errorStr);
111
111
  }
112
112
  return reactFn;
113
- }
113
+ }
114
114
 
115
115
  function selectFirst(name, arg1, arg2, argN) {
116
116
  var reactFn = core();
117
- var defObj = parseVargs(Array.prototype.slice.call(arguments, 1)); // name, already used
118
- var inOutDef = parseInOutParams(defObj.inOutParamStr);
117
+ var defObj = parseVargs(Array.prototype.slice.call(arguments, 1)); // name, already used
118
+ var inOutDef = parseInOutParams(defObj.inOutParamStr);
119
119
  var tasks = taskUtil.serializeTasks(parseTasks(defObj.taskDefArr));
120
120
  var ast = {
121
121
  name: name,
@@ -123,7 +123,7 @@ define(['./sprintf', './core', './parse', './task'],
123
123
  tasks: tasks,
124
124
  outTask: { type: 'finalcbFirst', a: inOutDef.outDef },
125
125
  };
126
- if (defObj.options) Object.keys(defObj.options).forEach(function (k) { ast[k] = defObj.options[k]; });
126
+ if (defObj.options) Object.keys(defObj.options).forEach(function (k) { ast[k] = defObj.options[k]; });
127
127
  var errors = reactFn.setAndValidateAST(ast);
128
128
  if (errors.length) {
129
129
  var errorStr = errors.join('\n');
@@ -134,5 +134,5 @@ define(['./sprintf', './core', './parse', './task'],
134
134
 
135
135
  dslDefine.selectFirst = selectFirst;
136
136
  return dslDefine;
137
-
138
- });
137
+
138
+ });
package/lib/error.js CHANGED
@@ -1,4 +1,3 @@
1
- 'use strict';
2
1
  /*global define:true */
3
2
 
4
3
  if (typeof define !== 'function') {
@@ -6,6 +5,7 @@ if (typeof define !== 'function') {
6
5
  }
7
6
 
8
7
  define(['util'], function (util) {
8
+ 'use strict';
9
9
 
10
10
  function ensureStackTraceLimitSet(stackTraceLimit) {
11
11
  if (!Error.stackTraceLimit || Error.stackTraceLimit < stackTraceLimit) {
@@ -36,7 +36,7 @@ define(['util'], function (util) {
36
36
  errString += task.f.toString(); //TODO need to pretty print function, gets collapsed
37
37
  errString += '\n\n';
38
38
  }
39
- return errString;
39
+ return errString;
40
40
  }
41
41
 
42
42
  function augmentError(err, meta) {
@@ -49,7 +49,7 @@ define(['util'], function (util) {
49
49
 
50
50
  return {
51
51
  ensureStackTraceLimitSet: ensureStackTraceLimitSet,
52
- augmentError: augmentError
52
+ augmentError: augmentError
53
53
  };
54
54
 
55
- });
55
+ });
@@ -1,4 +1,3 @@
1
- 'use strict';
2
1
  /*global define:true */
3
2
 
4
3
  if (typeof define !== 'function') {
@@ -6,6 +5,7 @@ if (typeof define !== 'function') {
6
5
  }
7
6
 
8
7
  define([], function () {
8
+ 'use strict';
9
9
 
10
10
  /**
11
11
  create an instance of the event collector
@@ -58,9 +58,9 @@ define([], function () {
58
58
  } else if (TASK_EVENTS_RE.test(this.event)) {
59
59
  eventObject.task = obj;
60
60
  } else if (AST_EVENTS_RE.test(this.event)) {
61
- eventObject.ast = obj;
61
+ eventObject.ast = obj;
62
62
  }
63
- self.events.push(eventObject);
63
+ self.events.push(eventObject);
64
64
  }
65
65
  emitter.on(eventId, accumEvents);
66
66
  };
@@ -73,9 +73,9 @@ define([], function () {
73
73
  this.events = []; // clear
74
74
  };
75
75
 
76
- return new EventCollector();
76
+ return new EventCollector();
77
77
  }
78
78
 
79
79
  return instantiate; // return the factory for creating EventCollector
80
-
81
- });
80
+
81
+ });
@@ -1,4 +1,3 @@
1
- 'use strict';
2
1
  /*global define:true process:false*/
3
2
 
4
3
  if (typeof define !== 'function') {
@@ -6,14 +5,16 @@ if (typeof define !== 'function') {
6
5
  }
7
6
 
8
7
  define(['./eventemitter'], function (EventEmitter) {
8
+ 'use strict';
9
+ /*jshint regexp:false */
9
10
 
10
11
  var EVENT_EMITTER2_CONFIG = {
11
12
  wildcard: true, // should the event emitter use wildcards.
12
13
  delimiter: '.', // the delimiter used to segment namespaces, defaults to `.`.
13
14
  maxListeners: 30 // the max number of listeners that can be assigned to an event, defaults to 10.
14
- };
15
+ };
15
16
 
16
- var PASS_EVENTS_PROCESS_RE = /^ast.defined$/; // events to pass up to global process
17
+ var PASS_EVENTS_PROCESS_RE = /^ast.defined$/; // events to pass up to global process
17
18
 
18
19
  var TYPES = {
19
20
  // Flow monitoring events and their params
@@ -68,15 +69,21 @@ define(['./eventemitter'], function (EventEmitter) {
68
69
  if (event === undefined) throw new Error('event is undefined');
69
70
  if (this.emitter) this.emitter.emit.apply(this.emitter, arguments);
70
71
  if (this.parent && this.parent.isEnabled()) this.parent.emit.apply(this.parent, arguments);
71
- if (PASS_EVENTS_PROCESS_RE.test(event) && process && process.emit) process.emit.apply(process, arguments); // pass some to process
72
+ if (PASS_EVENTS_PROCESS_RE.test(event) && typeof(process) !== 'undefined' && process.emit) {
73
+ process.emit.apply(process, arguments); // pass some to process
74
+ }
72
75
  };
73
76
 
74
77
  EventManager.prototype.removeListener = function (event, listener) {
75
78
  if (this.emitter) this.emitter.removeListener.apply(this.emitter, arguments);
76
79
  };
77
80
 
81
+ EventManager.prototype.removeAllListeners = function (event) {
82
+ if (this.emitter) this.emitter.removeAllListeners.apply(this.emitter, arguments);
83
+ };
84
+
78
85
 
79
86
  EventManager.global = EventManager.create(); // create one top level emitter
80
87
  return EventManager;
81
-
82
- });
88
+
89
+ });
@@ -1,4 +1,3 @@
1
- 'use strict';
2
1
  /*global define:true EventEmitter2:true */
3
2
 
4
3
  if (typeof define !== 'function') {
@@ -6,6 +5,7 @@ if (typeof define !== 'function') {
6
5
  }
7
6
 
8
7
  define(['eventemitter2'], function (EventEmitterMod) {
8
+ 'use strict';
9
9
 
10
10
  /**
11
11
  Abstract the details of getting an EventEmitter
@@ -16,5 +16,5 @@ define(['eventemitter2'], function (EventEmitterMod) {
16
16
  var EventEmitter = (EventEmitterMod) ?
17
17
  ((EventEmitterMod.EventEmitter2) ? EventEmitterMod.EventEmitter2 : EventEmitterMod) : EventEmitter2;
18
18
  return EventEmitter;
19
-
20
- });
19
+
20
+ });