text: /*! nools - v0.4.4 - 2016-11-06
  * http://c2fo.github.com/nools
  * Copyright (c) 2016 Doug Martin (http://c2fo.com); Licensed  */
  !function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};b[g][0].call(j.exports,function(a){var c=b[g][1][a];return e(c?c:a)},j,j.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){(function(){"use strict";var b=a("../");"function"!=typeof Object.getPrototypeOf&&(Object.getPrototypeOf="".__proto__===String.prototype?function(a){return a.__proto__}:function(a){return a.constructor.prototype}),"function"==typeof this.define&&this.define.amd?define([],function(){return b}):this.nools=b}).call("undefined"!=typeof window?window:this)},{"../":2}],2:[function(a,b,c){b.exports=c=a("./lib")},{"./lib":15}],3:[function(a,b,c){"use strict";var d=a("./extended"),e=d.declare,f=d.AVLTree,g=d.LinkedList,h=d.isPromiseLike,i=a("events").EventEmitter,j=e({instance:{constructor:function(){this.memory={},this.memoryValues=new g},clear:function(){this.memoryValues.clear(),this.memory={}},remove:function(a){var b=a.hashCode,c=this.memory,d=c[b];return d&&(this.memoryValues.remove(d),delete c[b]),d},insert:function(a){var b=a.hashCode;if(b in this.memory)throw new Error("Activation already in agenda "+a.rule.name+" agenda");this.memoryValues.push(this.memory[b]=a)}}}),k="main";b.exports=e(i,{instance:{constructor:function(a,b){this.agendaGroups={},this.agendaGroupStack=[k],this.rules={},this.flow=a,this.comparator=b,this.setFocus(k).addAgendaGroup(k)},addAgendaGroup:function(a){d.has(this.agendaGroups,a)||(this.agendaGroups[a]=new f({compare:this.comparator}))},getAgendaGroup:function(a){return this.agendaGroups[a||k]},setFocus:function(a){return a!==this.getFocused()&&this.agendaGroups[a]&&(this.agendaGroupStack.push(a),this.emit("focused",a)),this},getFocused:function(){var a=this.agendaGroupStack;return a[a.length-1]},getFocusedAgenda:function(){return this.agendaGroups[this.getFocused()]},register:function(a){var b=a.rule.agendaGroup;this.rules[a.name]={tree:new f({compare:this.comparator}),factTable:new j},b&&this.addAgendaGroup(b)},isEmpty:function(){for(var a=this.agendaGroupStack,b=!1;this.getFocusedAgenda().isEmpty()&&this.getFocused()!==k;)a.pop(),b=!0;return b&&this.emit("focused",this.getFocused()),this.getFocusedAgenda().isEmpty()},fireNext:function(){for(var a=this.agendaGroupStack,b=!1;this.getFocusedAgenda().isEmpty()&&this.getFocused()!==k;)a.pop();if(!this.getFocusedAgenda().isEmpty()){var c=this.pop();this.emit("fire",c.rule.name,c.match.factHash);var d=c.rule.fire(this.flow,c.match);b=h(d)?d.then(function(){return!0}):!0}return b},pop:function(){for(var a=this.getFocusedAgenda(),b=a.__root;b.right;)b=b.right;var c=b.data;a.remove(c);var d=this.rules[c.name];return d.tree.remove(c),d.factTable.remove(c),c},peek:function(){for(var a=this.getFocusedAgenda(),b=a.__root;b.right;)b=b.right;return b.data},modify:function(a,b){this.retract(a,b),this.insert(a,b)},retract:function(a,b){var c=this.rules[a.name];b.rule=a;var d=c.factTable.remove(b);d&&(this.getAgendaGroup(a.rule.agendaGroup).remove(d),c.tree.remove(d))},insert:function(a,b){var c=this.rules[a.name],d=a.rule,e=d.agendaGroup;c.tree.insert(b),this.getAgendaGroup(e).insert(b),d.autoFocus&&this.setFocus(e),c.factTable.insert(b)},dispose:function(){for(var a in this.agendaGroups)this.agendaGroups[a].clear();var b=this.rules;for(a in b)a in b&&(b[a].tree.clear(),b[a].factTable.clear());this.rules={}}}})},{"./extended":12,events:60}],4:[function(require,module,exports){"use strict";var extd=require("../extended"),forEach=extd.forEach,isString=extd.isString;exports.modifiers=["assert","modify","retract","emit","halt","focus","getFacts"];var createFunction=function(body,defined,scope,scopeNames,definedNames){var declares=[];forEach(definedNames,function(a){-1!==body.indexOf(a)&&declares.push("var "+a+"= defined."+a+";")}),forEach(scopeNames,function(a){-1!==body.indexOf(a)&&declares.push("var "+a+"= scope."+a+";")}),body=["((function(){",declares.join(""),"\n	return ",body,"\n})())"].join("");try{return eval(body)}catch(e){throw new Error("Invalid action : "+body+"\n"+e.message)}},createDefined=function(){var a=function(a,b,c){if(isString(a)){var d=[];extd(b).keys().forEach(function(b){-1!==a.indexOf(b)&&d.push("var "+b+"= defined."+b+";")}),extd(c).keys().forEach(function(b){-1!==a.indexOf(b)&&d.push("var "+b+"= function(){var prop = scope."+b+"; return __objToStr__.call(prop) === '[object Function]' ? prop.apply(void 0, arguments) : prop;};")}),d.length&&d.unshift("var __objToStr__ = Object.prototype.toString;"),a=[d.join(""),"return ",a,";"].join(""),a=new Function("defined","scope",a)(b,c)}var e=a.hasOwnProperty("constructor")&&"function"==typeof a.constructor?a.constructor:function(b){b=b||{};for(var c in b)c in a&&(this[c]=b[c])},f=e.prototype;for(var g in a)f[g]=a[g];return e};return function(b,c,d){return a(b.properties,c,d)}}();exports.createFunction=createFunction,exports.createDefined=createDefined},{"../extended":12}],5:[function(a,b,c){var d=a("__browserify_Buffer").Buffer,e=a("../extended"),f=a("../parser"),g=a("../constraintMatcher.js"),h=e.indexOf,i=e.forEach,j=e.removeDuplicates,k=e.map,l=e.hash,m=l.keys,n=e.merge,o=a("../rule"),p=a("./common"),q=p.modifiers,r=p.createDefined,s=p.createFunction,t=function(a,b,c,d){var f=[];i(b,function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= facts."+b+";")}),e(c).keys().forEach(function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= defined."+b+";")}),e(d).keys().forEach(function(b){-1!==a.indexOf(b)&&f.push("var "+b+"= scope."+b+";")}),e(q).forEach(function(b){-1!==a.indexOf(b)&&f.push("if(!"+b+"){ var "+b+"= flow."+b+";}")});var g=["facts","flow"];/next\(.*\)/.test(a)&&g.push("next"),a=f.join("")+a;try{return new Function("defined, scope","return "+new Function(g.join(","),a).toString())(c,d)}catch(h){throw new Error("Invalid action : "+a+"\n"+h.message)}},u=function(){function a(c,d,e,f,g){if(c.length){var h=c[0];if("not"===h||"exists"===h){var k=[];c.shift(),b(c,e,k,f,g);var l=k[0];l.unshift(h),d.push(l)}else if("or"===h){var m=[h];c.shift(),i(c,function(b){a(b,m,e,f,g)}),d.push(m)}else b(c,e,d,f,g),e=j(e)}}var b=function(a,b,c,d,j){var k=[],l=a[0],m=a[1],n=a[2],o=a[3];if(e.isHash(n)&&(o=n,n=null),!l||!(l=d[l]))throw new Error("Invalid class "+a[0]+" for rule "+j);if(k.push(l),k.push(m,n,o),c.push(k),b.push(m),n&&i(g.getIdentifiers(f.parseConstraint(n)),function(a){b.push(a)}),e.isObject(o))for(var p in o){var q=o[p];-1===h(b,q)&&b.push(q)}};return function(b,c,d){var f=b.name;if(e.isEmpty(b))throw new Error("Rule is empty");var g=b.options||{};g.scope=d;var h=b.constraints||[],j=h.length;j||(h=["true"]);var k=b.action;if(e.isUndefined(k))throw new Error("No action was defined for rule "+f);var l=[],m=[];return i(h,function(b){a(b,l,m,c,f)}),o.createRule(f,g,l,t(k,m,c,d))}}();c.parse=function(a,b){return f.parseRuleSet(a,b)},c.compile=function(a,b,c,f){e.isFunction(b)?(c=b,b={}):b=b||{};var g=a.name||b.name;if(!g)throw new Error("Name must be present in JSON or options");var h=new f(g),j=n({Array:Array,String:String,Number:Number,Boolean:Boolean,RegExp:RegExp,Date:Date,Object:Object},b.define||{});"undefined"!=typeof d&&(j.Buffer=d);var l=n({console:console},b.scope);i(a.scope,function(a){l[a.name]=!0}),i(a.define,function(a){j[a.name]=r(a,j,l)}),e(j).forEach(function(a,b){h.addDefined(b,a)});var o=e(a.scope).pluck("name").union(e(l).keys().value()).value(),p=k(m(j),function(a){return a});i(a.scope,function(a){l[a.name]=s(a.body,j,l,o,p)});var q=a.rules;return q.length&&i(q,function(a){h.__rules=h.__rules.concat(u(a,j,l))}),c&&c.call(h,h),h},c.transpile=a("./transpile").transpile},{"../constraintMatcher.js":9,"../extended":12,"../parser":44,"../rule":49,"./common":4,"./transpile":6,__browserify_Buffer:63}],6:[function(a,b,c){function d(a){a=n(a)?new Function("return "+a+";")():a;var b,c=["(function(){"];a.hasOwnProperty("constructor")&&"function"==typeof a.constructor?c.push("var Defined = "+a.constructor.toString()+";"):c.push("var Defined = function(opts){ for(var i in opts){if(opts.hasOwnProperty(i)){this[i] = opts[i];}}};"),c.push("var proto = Defined.prototype;");for(var d in a)a.hasOwnProperty(d)&&(b=a[d],c.push("proto."+d+" = "+(j.isFunction(b)?b.toString():j.format("%j",b))+";"));return c.push("return Defined;"),c.push("}())"),c.join("")}function e(a,b,c,d){var e=[],f={};k(b,function(b){-1!==a.indexOf(b)&&(f[b]=!0,e.push("var "+b+"= facts."+b+";"))}),j(c).keys().forEach(function(b){-1===a.indexOf(b)||f[b]||(f[b]=!0,e.push("var "+b+"= defined."+b+";"))}),j(d).keys().forEach(function(b){-1===a.indexOf(b)||f[b]||(f[b]=!0,e.push("var "+b+"= scope."+b+";"))}),j(o).forEach(function(b){-1===a.indexOf(b)||f[b]||e.push("var "+b+"= flow."+b+";")});var g=["facts","flow"];/next\(.*\)/.test(a)&&g.push("next"),a=e.join("")+a;try{return["function(",g.join(","),"){",a,"}"].join("")}catch(h){throw new Error("Invalid action : "+a+"\n"+h.message)}}function f(a,b){if(a.length&&j.isString(a[0])){var c=a[0].match(" *(from)");if(c)switch(c=c[0]){case"from":b.push(', "',a.shift(),'"');break;default:throw new Error("Unrecognized modifier "+c)}}}function g(a,b,c){if(a.length&&j.isHash(a[0])){var d=a.shift();j(d).values().forEach(function(a){-1===l(c,a)&&c.push(a)}),b.push(","+j.format("%j",[d]))}}function h(a,b){a=a.slice(0);var c=[];if("or"===a[0])return c.push('["'+a.shift()+'"'),c.push(j.map(a,function(a){return h(a,b)}).join(",")+"]"),c;if(("not"===a[0]||"exists"===a[0])&&c.push('"',a.shift(),'", '),b.push(a[1]),c.push(a[0],', "'+a[1].replace(/\\/g,"\\\\").replace(/"/g,'\\"')+'"'),a.splice(0,2),a.length){var d=a.shift();j.isString(d)&&d?(c.push(',"'+d.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),'"'),k(p.getIdentifiers(q.parseConstraint(d)),function(a){b.push(a)})):(c.push(',"true"'),a.unshift(d))}return f(a,c),g(a,c,b),"["+c.join("")+"]"}var i=a("__browserify_Buffer").Buffer,j=a("../extended"),k=j.forEach,l=j.indexOf,m=j.merge,n=j.isString,o=a("./common").modifiers,p=a("../constraintMatcher"),q=a("../parser");c.transpile=function(a,b){b=b||{};var c=[];c.push("(function(){"),c.push("return function(options){"),c.push("options = options || {};"),c.push("var bind = function(scope, fn){return function(){return fn.apply(scope, arguments);};}, defined = {Array: Array, String: String, Number: Number, Boolean: Boolean, RegExp: RegExp, Date: Date, Object: Object}, scope = options.scope || {};"),c.push("var optDefined = options.defined || {}; for(var i in optDefined){defined[i] = optDefined[i];}");var f=m({Array:Array,String:String,Number:Number,Boolean:Boolean,RegExp:RegExp,Date:Date,Object:Object},b.define||{});"undefined"!=typeof i&&(f.Buffer=i);var g=m({console:console},b.scope);return c.push(["return nools.flow('",b.name,"', function(){"].join("")),c.push(j(a.define||[]).map(function(a){var b=a.name;return a[b]={},["var",b,"= defined."+b,"= this.addDefined('"+b+"',",d(a.properties)+");"].join(" ")}).value().join("\n")),c.push(j(a.scope||[]).map(function(a){var b=a.name;return g[b]={},["var",b,"= scope."+b,"= ",a.body,";"].join(" ")}).value().join("\n")),c.push("scope.console = console;\n"),c.push(j(a.rules||[]).map(function(a){var b=[],c=["this.rule('",a.name.replace(/'/g,"\\'"),"'"],d=j.merge(a.options||{},{scope:"scope"});return c.push(",",j.format("%j",[d]).replace(/(:"scope")/,":scope")),a.constraints&&!j.isEmpty(a.constraints)&&(c.push(", ["),c.push(j(a.constraints).map(function(a){return h(a,b)}).value().join(",")),c.push("]")),c.push(",",e(a.action,b,f,g)),c.push(");"),c.join("")}).value().join("")),c.push("});"),c.push("};"),c.push("}());"),c.join("")}},{"../constraintMatcher":9,"../extended":12,"../parser":44,"./common":4,__browserify_Buffer:63}],7:[function(a,b,c){function d(a,b){return a.rule.priority-b.rule.priority}function e(a,b){return a.counter-b.counter}function f(a,b){for(var c=0,d=a.match.recency,e=b.match.recency,f=d.length-1,g=e.length-1;d[c]===e[c]&&f>c&&g>c&&c++;);var h=d[c]-e[c];return h||(h=f-g),h}function g(a,b){return a.recency-b.recency}var h=a("./extended").map,i={salience:d,bucketCounter:e,factRecency:f,activationRecency:g};c.strategies=i,c.strategy=function(a){a=h(a,function(a){return i[a]});var b=a.length;return function(c,d){var e=-1,f=0,g=c===d||c.name===d.name&&c.hashCode===d.hashCode;if(!g){for(;++e<b&&!f;)f=a[e](c,d);f=f>0?1:-1}return f}}},{"./extended":12}],8:[function(a,b,c){"use strict";var d,e=a("./extended"),f=e.deepEqual,g=e.merge,h=e.instanceOf,i=e.filter,j=e.declare,k=0,l=j({type:null,instance:{constructor:function(b){d||(d=a("./constraintMatcher")),this.id=k++,this.constraint=b,e.bindAll(this,["assert"])},assert:function(){throw new Error("not implemented")},getIndexableProperties:function(){return[]},equal:function(a){return h(a,this._static)&&this.get("alias")===a.get("alias")&&e.deepEqual(this.constraint,a.constraint)},getters:{variables:function(){return[this.get("alias")]}}}});l.extend({instance:{type:"object",constructor:function(a){this._super([a])},assert:function(a){return a instanceof this.constraint||a.constructor===this.constraint},equal:function(a){return h(a,this._static)&&this.constraint===a.constraint}}}).as(c,"ObjectConstraint");var m=l.extend({instance:{type:"equality",constructor:function(a,b){this._super([a]),b=b||{},this.pattern=b.pattern,this._matcher=d.getMatcher(a,b,!0)},assert:function(a){return this._matcher(a)}}}).as(c,"EqualityConstraint");m.extend({instance:{type:"inequality"}}).as(c,"InequalityConstraint"),m.extend({instance:{type:"comparison"}}).as(c,"ComparisonConstraint"),l.extend({instance:{type:"equality",constructor:function(){this._super([[!0]])},equal:function(a){return h(a,this._static)&&this.get("alias")===a.get("alias")},assert:function(){return!0}}}).as(c,"TrueConstraint");var n=l.extend({instance:{type:"reference",constructor:function(a,b){this.cache={},this._super([a]),b=b||{},this.values=[],this.pattern=b.pattern,this._options=b,this._matcher=d.getMatcher(a,b,!1)},assert:function(a,b){try{return this._matcher(a,b)}catch(c){throw new Error("Error with evaluating pattern "+this.pattern+" "+c.message)}},merge:function(a){var b=this;return a instanceof n&&(b=new this._static([this.constraint,a.constraint,"and"],g({},this._options,this._options)),b._alias=this._alias||a._alias,b.vars=this.vars.concat(a.vars)),b},equal:function(a){return h(a,this._static)&&e.deepEqual(this.constraint,a.constraint)},getters:{variables:function(){return this.vars},alias:function(){return this._alias}},setters:{alias:function(a){this._alias=a,this.vars=i(d.getIdentifiers(this.constraint),function(b){return b!==a})}}}}).as(c,"ReferenceConstraint");n.extend({instance:{type:"reference_equality",op:"eq",getIndexableProperties:function(){return d.getIndexableProperties(this.constraint)}}}).as(c,"ReferenceEqualityConstraint").extend({instance:{type:"reference_inequality",op:"neq"}}).as(c,"ReferenceInequalityConstraint").extend({instance:{type:"reference_gt",op:"gt"}}).as(c,"ReferenceGTConstraint").extend({instance:{type:"reference_gte",op:"gte"}}).as(c,"ReferenceGTEConstraint").extend({instance:{type:"reference_lt",op:"lt"}}).as(c,"ReferenceLTConstraint").extend({instance:{type:"reference_lte",op:"lte"}}).as(c,"ReferenceLTEConstraint"),l.extend({instance:{type:"hash",constructor:function(a){this._super([a])},equal:function(a){return e.instanceOf(a,this._static)&&this.get("alias")===a.get("alias")&&e.deepEqual(this.constraint,a.constraint)},assert:function(){return!0},getters:{variables:function(){return this.constraint}}}}).as(c,"HashConstraint"),l.extend({instance:{constructor:function(a,b){this.type="from",this.constraints=d.getSourceMatcher(a,b||{},!0),e.bindAll(this,["assert"])},equal:function(a){return h(a,this._static)&&this.get("alias")===a.get("alias")&&f(this.constraints,a.constraints)},assert:function(a,b){return this.constraints(a,b)},getters:{variables:function(){return this.constraint}}}}).as(c,"FromConstraint"),l.extend({instance:{constructor:function(a,b){this.type="custom",this.fn=a,this.options=b,e.bindAll(this,["assert"])},equal:function(a){return h(a,this._static)&&this.fn===a.constraint},assert:function(a,b){return this.fn(a,b)}}}).as(c,"CustomConstraint")},{"./constraintMatcher":9,"./extended":12}],9:[function(a,b,c){"use strict";function d(a){return e(a).map(function(a){return f(a)?f(a[0])?d(a).value():a.reverse().join("."):a}).flatten().filter(function(a){return!!a})}var e=a("./extended"),f=e.isArray,g=e.forEach,h=e.some,i=e.indexOf,j=e.isNumber,k=e.removeDuplicates,l=a("./constraint"),m={indexOf:e.indexOf,now:function(){return new Date},Date:function(a,b,c,d,e,f,g){var h=new Date;return j(a)&&h.setYear(a),j(b)&&h.setMonth(b),j(c)&&h.setDate(c),j(d)&&h.setHours(d),j(e)&&h.setMinutes(e),j(f)&&h.setSeconds(f),j(g)&&h.setMilliseconds(g),h},lengthOf:function(a,b){return a.length===b},isTrue:function(a){return a===!0},isFalse:function(a){return a===!1},isNotNull:function(a){return null!==a},dateCmp:function(a,b){return e.compare(a,b)}};g(["years","days","months","hours","minutes","seconds"],function(a){m[a+"FromNow"]=e[a+"FromNow"],m[a+"Ago"]=e[a+"Ago"]}),g(["isArray","isNumber","isHash","isObject","isDate","isBoolean","isString","isRegExp","isNull","isEmpty","isUndefined","isDefined","isUndefinedOrNull","isPromiseLike","isFunction","deepEqual"],function(a){var b=e[a];m[a]=function(){return b.apply(e,arguments)}});var n={equal:function(a,b){var c=!1;return a===b?c=!0:a[2]===b[2]&&(c=-1!==i(["string","number","boolean","regexp","identifier","null"],a[2])?a[0]===b[0]:"unary"===a[2]||"logicalNot"===a[2]?this.equal(a[0],b[0]):this.equal(a[0],b[0])&&this.equal(a[1],b[1])),c},__getProperties:function(a){var b=[];if(a){var c=a[2];if(!c)return b;"prop"!==c&&"identifier"!==c&&"string"!==c&&"number"!==c&&"boolean"!==c&&"regexp"!==c&&"unary"!==c&&"unary"!==c?(b[0]=this.__getProperties(a[0]),b[1]=this.__getProperties(a[1])):b="identifier"===c?[a[0]]:n.__getProperties(a[1]).concat(n.__getProperties(a[0]))}return b},getIndexableProperties:function(a){return"composite"===a[2]?this.getIndexableProperties(a[0]):/^(\w+(\['[^']*'])*) *([!=]==?|[<>]=?) (\w+(\['[^']*'])*)$/.test(this.parse(a))?d(this.__getProperties(a)).flatten().value():[]},getIdentifiers:function(a){var b=[],c=a[2];if("identifier"===c)return[a[0]];if("function"===c)b=b.concat(this.getIdentifiers(a[0])).concat(this.getIdentifiers(a[1]));else if("string"!==c&&"number"!==c&&"boolean"!==c&&"regexp"!==c&&"unary"!==c&&"unary"!==c)if("prop"===c){if(b=b.concat(this.getIdentifiers(a[0])),a[1])for(var d=a[1];f(d);){if("function"===d[2]){b=b.concat(this.getIdentifiers(d[1]));break}d=d[1]}}else a[0]&&(b=b.concat(this.getIdentifiers(a[0]))),a[1]&&(b=b.concat(this.getIdentifiers(a[1])));return k(b)},toConstraints:function(a,b){var c=[],d=b.alias,e=b.scope||{},f=a[2];if("and"===f)c=c.concat(this.toConstraints(a[0],b)).concat(this.toConstraints(a[1],b));else if("composite"===f||"or"===f||"lt"===f||"gt"===f||"lte"===f||"gte"===f||"like"===f||"notLike"===f||"eq"===f||"neq"===f||"seq"===f||"sneq"===f||"in"===f||"notIn"===f||"prop"===f||"propLookup"===f||"function"===f||"logicalNot"===f){var g=h(this.getIdentifiers(a),function(a){return!(a===d||a in m||a in e)});switch(f){case"eq":c.push(new l[g?"ReferenceEqualityConstraint":"EqualityConstraint"](a,b));break;case"seq":c.push(new l[g?"ReferenceEqualityConstraint":"EqualityConstraint"](a,b));break;case"neq":c.push(new l[g?"ReferenceInequalityConstraint":"InequalityConstraint"](a,b));break;case"sneq":c.push(new l[g?"ReferenceInequalityConstraint":"InequalityConstraint"](a,b));break;case"gt":c.push(new l[g?"ReferenceGTConstraint":"ComparisonConstraint"](a,b));break;case"gte":c.push(new l[g?"ReferenceGTEConstraint":"ComparisonConstraint"](a,b));break;case"lt":c.push(new l[g?"ReferenceLTConstraint":"ComparisonConstraint"](a,b));break;case"lte":c.push(new l[g?"ReferenceLTEConstraint":"ComparisonConstraint"](a,b));break;default:c.push(new l[g?"ReferenceConstraint":"ComparisonConstraint"](a,b))}}return c},parse:function(a){return this[a[2]](a[0],a[1])},composite:function(a){return this.parse(a)},and:function(a,b){return["(",this.parse(a),"&&",this.parse(b),")"].join(" ")},or:function(a,b){return["(",this.parse(a),"||",this.parse(b),")"].join(" ")},prop:function(a,b){return"function"===b[2]?[this.parse(a),this.parse(b)].join("."):[this.parse(a),"['",this.parse(b),"']"].join("")},propLookup:function(a,b){return"function"===b[2]?[this.parse(a),this.parse(b)].join("."):[this.parse(a),"[",this.parse(b),"]"].join("")},unary:function(a){return-1*this.parse(a)},plus:function(a,b){return[this.parse(a),"+",this.parse(b)].join(" ")},minus:function(a,b){return[this.parse(a),"-",this.parse(b)].join(" ")},mult:function(a,b){return[this.parse(a),"*",this.parse(b)].join(" ")},div:function(a,b){return[this.parse(a),"/",this.parse(b)].join(" ")},mod:function(a,b){return[this.parse(a),"%",this.parse(b)].join(" ")},lt:function(a,b){return[this.parse(a),"<",this.parse(b)].join(" ")},gt:function(a,b){return[this.parse(a),">",this.parse(b)].join(" ")},lte:function(a,b){return[this.parse(a),"<=",this.parse(b)].join(" ")},gte:function(a,b){return[this.parse(a),">=",this.parse(b)].join(" ")},like:function(a,b){return[this.parse(b),".test(",this.parse(a),")"].join("")},notLike:function(a,b){return["!",this.parse(b),".test(",this.parse(a),")"].join("")},eq:function(a,b){return[this.parse(a),"==",this.parse(b)].join(" ")},seq:function(a,b){return[this.parse(a),"===",this.parse(b)].join(" ")},neq:function(a,b){return[this.parse(a),"!=",this.parse(b)].join(" ")},sneq:function(a,b){return[this.parse(a),"!==",this.parse(b)].join(" ")},"in":function(a,b){return["(indexOf(",this.parse(b),",",this.parse(a),")) != -1"].join("")},notIn:function(a,b){return["(indexOf(",this.parse(b),",",this.parse(a),")) == -1"].join("")},arguments:function(a,b){var c=[];return a&&c.push(this.parse(a)),b&&c.push(this.parse(b)),c.join(",")},array:function(a){var b=[];return a?(b=this.parse(a),f(b)?b:["[",b,"]"].join("")):["[",b.join(","),"]"].join("")},"function":function(a,b){var c=this.parse(b);return[this.parse(a),"(",c,")"].join("")},string:function(a){return"'"+a+"'"},number:function(a){return a},"boolean":function(a){return a},regexp:function(a){return a},identifier:function(a){return a},"null":function(){return"null"},logicalNot:function(a){return["!(",this.parse(a),")"].join("")}},o=0,p=c.toJs=function(a,b,c,d,f){var g=n.parse(a);b=b||{};var h=n.getIdentifiers(a),i=["var indexOf = definedFuncs.indexOf; var hasOwnProperty = Object.prototype.hasOwnProperty;"],j=[];e(h).filter(function(a){var c=["var ",a," = "];if(m.hasOwnProperty(a))c.push("definedFuncs['",a,"']");else{if(!b.hasOwnProperty(a))return!0;c.push("scope['",a,"']")}return c.push(";"),i.push(c.join("")),!1}).forEach(function(a){var b=["var ",a," = "];d||a!==c?b.push("fact."+a):a===c&&b.push("hash.",a,""),b.push(";"),j.push(b.join(""))});var k=i.join("")+"return function matcher"+o++ +(d?"(fact){":"(fact, hash){")+j.join("")+" return "+(f?f(g):g)+";}",l=new Function("definedFuncs, scope",k)(m,b);return l};c.getMatcher=function(a,b,c){return b=b||{},p(a,b.scope,b.alias,c,function(a){return"!!("+a+")"})},c.getSourceMatcher=function(a,b,c){return b=b||{},p(a,b.scope,b.alias,c,function(a){return a})},c.toConstraints=function(a,b){return"function"==typeof a?[new l.CustomConstraint(a,b)]:n.toConstraints(a,b)},c.equal=function(a,b){return n.equal(a,b)},c.getIdentifiers=function(a){return n.getIdentifiers(a)},c.getIndexableProperties=function(a){return n.getIndexableProperties(a)}},{"./constraint":8,"./extended":12}],10:[function(a,b,c){"use strict";function d(a,b){for(var c="",d=-1,e=a.length;++d<e;)c+=a[d].id+":";return c+=b}function e(a,b,c){for(var d,e=-1,f=c.length;++e<f;)d=c[e],a[d]=b[d]}function f(a,b,c){k.apply(a,b);for(var d,e=-1,f=c.length,g=a.length;++e<f;)d=c[e],-1===j(a,d)&&(a[g++]=d)}var g=a("./extended"),h=g.isBoolean,i=g.declare,j=g.indexOf,k=Array.prototype.push,l=i({instance:{isMatch:!0,hashCode:"",facts:null,factIds:null,factHash:null,recency:null,aliases:null,constructor:function(){this.facts=[],this.factIds=[],this.factHash={},this.recency=[],this.aliases=[]},addFact:function(a){return k.call(this.facts,a),k.call(this.recency,a.recency),k.call(this.factIds,a.id),this.hashCode=this.factIds.join(":"),this},merge:function(a){var b=new l;return b.isMatch=a.isMatch,k.apply(b.facts,this.facts),k.apply(b.facts,a.facts),k.apply(b.aliases,this.aliases),k.apply(b.aliases,a.aliases),b.hashCode=this.hashCode+":"+a.hashCode,e(b.factHash,this.factHash,this.aliases),e(b.factHash,a.factHash,a.aliases),f(b.recency,this.recency,a.recency),b}}}),m=i({instance:{match:null,factHash:null,aliases:null,fact:null,hashCode:null,paths:null,pathsHash:null,constructor:function(a,b,c){this.fact=a,c?this.match=c:this.match=(new l).addFact(a),this.factHash=this.match.factHash,this.aliases=this.match.aliases,this.hashCode=this.match.hashCode,b?(this.paths=b,this.pathsHash=d(b,this.hashCode)):this.pathsHash=this.hashCode},set:function(a,b){return this.factHash[a]=b,this.aliases.push(a),this},isMatch:function(a){return h(a)?(this.match.isMatch=a,this):this.match.isMatch},mergeMatch:function(a){var b=this.match=this.match.merge(a);return this.factHash=b.factHash,this.hashCode=b.hashCode,this.aliases=b.aliases,this},clone:function(a,b,c){return new m(a||this.fact,b||this.path,c||this.match)}}}).as(b)},{"./extended":12}],11:[function(a,b,c){var d=a("./extended"),e=d.Promise,f=a("./nextTick"),g=d.isPromiseLike;e.extend({instance:{looping:!1,constructor:function(a,b){this._super([]),this.flow=a,this.agenda=a.agenda,this.rootNode=a.rootNode,this.matchUntilHalt=!!b,d.bindAll(this,["onAlter","callNext"])},halt:function(){this.__halted=!0,this.looping||this.callback()},onAlter:function(){this.flowAltered=!0,this.looping||!this.matchUntilHalt||this.__halted||this.callNext()},setup:function(){var a=this.flow;this.rootNode.resetCounter(),a.on("assert",this.onAlter),a.on("modify",this.onAlter),a.on("retract",this.onAlter)},tearDown:function(){var a=this.flow;a.removeListener("assert",this.onAlter),a.removeListener("modify",this.onAlter),a.removeListener("retract",this.onAlter)},__handleAsyncNext:function(a){var b=this,c=b.agenda;return a.then(function(){b.looping=!1,c.isEmpty()?(!b.matchUntilHalt||b.__halted)&&b.callback():(b.flowAltered&&(b.rootNode.incrementCounter(),b.flowAltered=!1),b.__halted?b.callback():b.callNext()),b=null},this.errback)},__handleSyncNext:function(a){return this.looping=!1,this.agenda.isEmpty()||this.flowAltered&&(this.rootNode.incrementCounter(),this.flowAltered=!1),a&&!this.__halted?f(this.callNext):(!this.matchUntilHalt||this.__halted)&&this.callback(),a},callback:function(){this.tearDown(),this._super(arguments)},callNext:function(){this.looping=!0;var a=this.agenda.fireNext();return g(a)?this.__handleAsyncNext(a):this.__handleSyncNext(a)},execute:function(){return this.setup(),this.callNext(),this}}}).as(b)},{"./extended":12,"./nextTick":17}],12:[function(a,b,c){function d(a){var b=a.match(/(\w+)\(\)$/);return b?(a=b[1],function(b){return b[a]()}):function(b){return b[a]}}function e(a){if(a=a.split("."),1===a.length)return d(a[0]);var b=o(a,function(a){return d(a)}),c=b.length;return function(a){for(var d=-1,e=a;++d<c;)e=b[d](e);return e}}function f(a,b){a=p.call(a);var c,d,e=-1;for(d=a.length;++e<d;)c=a[e],-1===n(b,c)&&(q.call(a,e--,1),d--);return a}function g(a,b){var c,d,e=-1;for(d=a.length;++e<d;)c=a[e],-1===n(b,c)&&(q.call(a,e--,1),d--);return a}function h(a,b){var c,d,e=-1;for(d=a.length;++e<d;)c=a[e],-1!==n(b,c)&&(q.call(a,e--,1),d--);return a}function i(a,b){var c,d,e,f=[],g=-1,h=b.length,i=a.length;if(h>i){for(f=a.slice();++g<h;)for(d=b[g],c=-1,i=f.length;++c<i;)if(f[c]===d){f.splice(c,1);break}}else for(;++g<i;){for(d=a[g],c=-1,e=!1;++c<h;)if(b[c]===d){e=!0;break}e||f.push(d)}return f}function j(a,b){var c={};for(var d in a)hasOwnProperty.call(b,d)||(c[d]=a[d]);return c}function k(a,b){return m(a.concat(b))}var l=a("array-extended"),m=l.unique,n=l.indexOf,o=l.map,p=Array.prototype.slice,q=Array.prototype.splice;b.exports=a("extended")().register(a("date-extended")).register(l).register(a("object-extended")).register(a("string-extended")).register(a("promise-extended")).register(a("function-extended")).register(a("is-extended")).register("intersection",f).register("inPlaceIntersection",g).register("inPlaceDifference",h).register("diffArr",i).register("diffHash",j).register("unionArr",k).register("plucker",e).register("HashTable",a("ht")).register("declare",a("declare.js")).register(a("leafy")).register("LinkedList",a("./linkedList"))},{"./linkedList":16,"array-extended":52,"date-extended":53,"declare.js":55,extended:56,"function-extended":59,ht:65,"is-extended":66,leafy:67,"object-extended":68,"promise-extended":69,"string-extended":70}],13:[function(a,b,c){"use strict";var d=a("./extended"),e=d.bind,f=d.declare,g=a("./nodes"),h=a("events").EventEmitter,i=a("./workingMemory"),j=i.WorkingMemory,k=a("./executionStrategy"),l=a("./agenda");b.exports=f(h,{instance:{name:null,executionStrategy:null,constructor:function(a,b){this.env=null,this.name=a,this.__rules={},this.conflictResolutionStrategy=b,this.workingMemory=new j,this.agenda=new l(this,b),this.agenda.on("fire",e(this,"emit","fire")),this.agenda.on("focused",e(this,"emit","focused")),this.rootNode=new g.RootNode(this.workingMemory,this.agenda),d.bindAll(this,"halt","assert","retract","modify","focus","emit","getFacts","getFact")},getFacts:function(a){var b;return b=a?this.workingMemory.getFactsByType(a):this.workingMemory.getFacts()},getFact:function(a){var b;return b=a?this.workingMemory.getFactsByType(a):this.workingMemory.getFacts(),b&&b[0]},focus:function(a){return this.agenda.setFocus(a),this},halt:function(){return this.executionStrategy.halt(),this},dispose:function(){this.workingMemory.dispose(),this.agenda.dispose(),this.rootNode.dispose()},assert:function(a){return this.rootNode.assertFact(this.workingMemory.assertFact(a)),this.emit("assert",a),a},retract:function(a){return this.rootNode.retractFact(this.workingMemory.retractFact(a)),this.emit("retract",a),a},modify:function(a,b){return"function"==typeof b&&b.call(a,a),this.rootNode.modifyFact(this.workingMemory.modifyFact(a)),this.emit("modify",a),a},print:function(){this.rootNode.print()},containsRule:function(a){return this.rootNode.containsRule(a)},rule:function(a){this.rootNode.assertRule(a)},matchUntilHalt:function(a){return(this.executionStrategy=new k(this,!0)).execute().classic(a).promise()},match:function(a){return(this.executionStrategy=new k(this)).execute().classic(a).promise()}}})},{"./agenda":3,"./executionStrategy":11,"./extended":12,"./nodes":27,"./workingMemory":50,events:60}],14:[function(a,b,c){"use strict";var d=a("./extended"),e=d.instanceOf,f=d.forEach,g=d.declare,h=a("./pattern").InitialFact,i=a("./conflict"),j=i.strategy(["salience","activationRecency"]),k=a("./rule"),l=a("./flow"),m={},n=g({instance:{constructor:function(a,b){if(this.name=a,this.cb=b,this.__rules=[],this.__defined={},this.conflictResolutionStrategy=j,b&&b.call(this,this),m.hasOwnProperty(a))throw new Error("Flow with "+a+" already defined");m[a]=this},conflictResolution:function(a){return this.conflictResolutionStrategy=i.strategy(a),this},getDefined:function(a){var b=this.__defined[a.toLowerCase()];if(!b)throw new Error(a+" flow class is not defined");return b},addDefined:function(a,b){return this.__defined[a.toLowerCase()]=b,b},rule:function(){return this.__rules=this.__rules.concat(k.createRule.apply(k,arguments)),this},getSession:function(){var a=new l(this.name,this.conflictResolutionStrategy);f(this.__rules,function(b){a.rule(b)}),a.assert(new h);for(var b=0,c=arguments.length;c>b;b++)a.assert(arguments[b]);return a},containsRule:function(a){return d.some(this.__rules,function(b){return b.name===a})}},"static":{getFlow:function(a){return m[a]},hasFlow:function(a){return d.has(m,a)},deleteFlow:function(a){
  return e(a,n)&&(a=a.name),delete m[a],n},deleteFlows:function(){for(var a in m)a in m&&delete m[a];return n},create:function(a,b){return new n(a,b)}}}).as(b)},{"./conflict":7,"./extended":12,"./flow":13,"./pattern":48,"./rule":49}],15:[function(a,b,c){"use strict";function d(a){return/\.nools$/.test(a)}function e(a){var b;return b=d(a)?i.parse(g.readFileSync(a,"utf8"),a):i.parse(a)}var f=a("./extended"),g=a("fs"),h=a("path"),i=a("./compile"),j=a("./flowContainer");c.Flow=j,c.getFlow=j.getFlow,c.hasFlow=j.hasFlow,c.deleteFlow=function(a){return j.deleteFlow(a),this},c.deleteFlows=function(){return j.deleteFlows(),this},c.flow=j.create,c.compile=function(a,b,c){if(f.isFunction(b)?(c=b,b={}):b=b||{},f.isString(a)&&(b.name=b.name||(d(a)?h.basename(a,h.extname(a)):null),a=e(a)),!b.name)throw new Error("Name required when compiling nools source");return i.compile(a,b,c,j)},c.transpile=function(a,b){return b=b||{},f.isString(a)&&(b.name=b.name||(d(a)?h.basename(a,h.extname(a)):null),a=e(a)),i.transpile(a,b)},c.parse=e},{"./compile":5,"./extended":12,"./flowContainer":14,fs:61,path:62}],16:[function(a,b,c){var d=a("declare.js");d({instance:{constructor:function(){this.head=null,this.tail=null,this.length=null},push:function(a){var b=this.tail,c=this.head,d={data:a,prev:b,next:null};return b&&(this.tail.next=d),this.tail=d,c||(this.head=d),this.length++,d},remove:function(a){a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev,this.length--},forEach:function(a){for(var b={next:this.head};b=b.next;)a(b.data)},toArray:function(){for(var a={next:this.head},b=[];a=a.next;)b.push(a);return b},removeByData:function(a){for(var b={next:this.head};b=b.next;)if(b.data===a){this.remove(b);break}},getByData:function(a){for(var b={next:this.head};b=b.next;)if(b.data===a)return b},clear:function(){this.head=this.tail=null,this.length=0}}}).as(b)},{"declare.js":55}],17:[function(a,b,c){var d,e=a("__browserify_process"),f=a("./extended");if("function"==typeof setImmediate)d="undefined"!=typeof window?f.bind(window,setImmediate):setImmediate;else if("undefined"!=typeof e)d=e.nextTick;else if("undefined"!=typeof MessageChannel){var g=new MessageChannel,h={},i=h;g.port1.onmessage=function(){h=h.next;var a=h.task;delete h.task,a()},d=function(a){i=i.next={task:a},g.port2.postMessage(0)}}else d=function(a){setTimeout(a,0)};b.exports=d},{"./extended":12,__browserify_process:64}],18:[function(a,b,c){var d=a("./node"),e=a("../extended").intersection;d.extend({instance:{__propagatePaths:function(a,b){for(var c,d,f,g,h=this.__entrySet,i=h.length;--i>-1;)c=h[i],d=c.key,f=c.value,(g=e(f,b.paths)).length&&d[a](b.clone(null,g,null))},__propagateNoPaths:function(a,b){for(var c=this.__entrySet,d=c.length;--d>-1;)c[d].key[a](b)},__propagate:function(a,b){b.paths?this.__propagatePaths(a,b):this.__propagateNoPaths(a,b)}}}).as(b)},{"../extended":12,"./node":37}],19:[function(a,b,c){var d=a("./alphaNode");d.extend({instance:{constructor:function(){this._super(arguments),this.alias=this.constraint.get("alias")},toString:function(){return"AliasNode"+this.__count},assert:function(a){return this.__propagate("assert",a.set(this.alias,a.fact.object))},modify:function(a){return this.__propagate("modify",a.set(this.alias,a.fact.object))},retract:function(a){return this.__propagate("retract",a.set(this.alias,a.fact.object))},equal:function(a){return a instanceof this._static&&this.alias===a.alias}}}).as(b)},{"./alphaNode":20}],20:[function(a,b,c){"use strict";var d=a("./node");d.extend({instance:{constructor:function(a){this._super([]),this.constraint=a,this.constraintAssert=this.constraint.assert},toString:function(){return"AlphaNode "+this.__count},equal:function(a){return this.constraint.equal(a.constraint)}}}).as(b)},{"./node":37}],21:[function(a,b,c){var d=a("../extended"),e=d.hash.keys,f=a("./node"),g=a("./misc/leftMemory"),h=a("./misc/rightMemory");f.extend({instance:{nodeType:"BetaNode",constructor:function(){this._super([]),this.leftMemory={},this.rightMemory={},this.leftTuples=new g,this.rightTuples=new h},__propagate:function(a,b){for(var c,d,e=this.__entrySet,f=e.length;--f>-1;)c=e[f],d=c.key,d[a](b)},dispose:function(){this.leftMemory={},this.rightMemory={},this.leftTuples.clear(),this.rightTuples.clear()},disposeLeft:function(a){this.leftMemory={},this.leftTuples.clear(),this.propagateDispose(a)},disposeRight:function(a){this.rightMemory={},this.rightTuples.clear(),this.propagateDispose(a)},hashCode:function(){return this.nodeType+" "+this.__count},toString:function(){return this.nodeType+" "+this.__count},retractLeft:function(a){a=this.removeFromLeftMemory(a).data;for(var b=a.rightMatches,c=e(b),d=-1,f=c.length;++d<f;)this.__propagate("retract",b[c[d]].clone())},retractRight:function(a){a=this.removeFromRightMemory(a).data;for(var b=a.leftMatches,c=e(b),d=-1,f=c.length;++d<f;)this.__propagate("retract",b[c[d]].clone())},assertLeft:function(a){this.__addToLeftMemory(a);for(var b=this.rightTuples.getRightMemory(a),c=-1,d=b.length;++c<d;)this.propagateFromLeft(a,b[c].data)},assertRight:function(a){this.__addToRightMemory(a);for(var b=this.leftTuples.getLeftMemory(a),c=-1,d=b.length;++c<d;)this.propagateFromRight(a,b[c].data)},modifyLeft:function(a){var b=this.removeFromLeftMemory(a).data;this.__addToLeftMemory(a);var c,d=this.rightTuples.getRightMemory(a),e=d.length,f=-1;if(e)for(c=b.rightMatches;++f<e;)this.propagateAssertModifyFromLeft(a,c,d[f].data);else this.propagateRetractModifyFromLeft(b)},modifyRight:function(a){var b=this.removeFromRightMemory(a).data;this.__addToRightMemory(a);var c=this.leftTuples.getLeftMemory(a);if(c.length)for(var d=b.leftMatches,e=-1,f=c.length;++e<f;)this.propagateAssertModifyFromRight(a,d,c[e].data);else this.propagateRetractModifyFromRight(b)},propagateFromLeft:function(a,b){this.__propagate("assert",this.__addToMemoryMatches(b,a,a.clone(null,null,a.match.merge(b.match))))},propagateFromRight:function(a,b){this.__propagate("assert",this.__addToMemoryMatches(a,b,b.clone(null,null,b.match.merge(a.match))))},propagateRetractModifyFromLeft:function(a){for(var b=a.rightMatches,c=e(b),d=c.length,f=-1;++f<d;)this.__propagate("retract",b[c[f]].clone())},propagateRetractModifyFromRight:function(a){for(var b=a.leftMatches,c=e(b),d=c.length,f=-1;++f<d;)this.__propagate("retract",b[c[f]].clone())},propagateAssertModifyFromLeft:function(a,b,c){var d=c.hashCode;d in b?this.__propagate("modify",this.__addToMemoryMatches(c,a,a.clone(null,null,a.match.merge(c.match)))):this.propagateFromLeft(a,c)},propagateAssertModifyFromRight:function(a,b,c){var d=c.hashCode;d in b?this.__propagate("modify",this.__addToMemoryMatches(a,c,a.clone(null,null,c.match.merge(a.match)))):this.propagateFromRight(a,c)},removeFromRightMemory:function(a){var b,c=a.hashCode;a=this.rightMemory[c]||null;var d=this.rightTuples;if(a){var f=this.leftMemory;b=a.data;var g=b.leftMatches;d.remove(a);for(var h=e(g),i=-1,j=h.length;++i<j;)delete f[h[i]].data.rightMatches[c];delete this.rightMemory[c]}return a},removeFromLeftMemory:function(a){var b=a.hashCode;if(a=this.leftMemory[b]||null){var c=this.rightMemory,d=a.data.rightMatches;this.leftTuples.remove(a);for(var f=e(d),g=-1,h=f.length;++g<h;)delete c[f[g]].data.leftMatches[b];delete this.leftMemory[b]}return a},getRightMemoryMatches:function(a){var b=this.leftMemory[a.hashCode],c={};return b&&(c=b.rightMatches),c},__addToMemoryMatches:function(a,b,c){var d,e=a.hashCode,f=this.rightMemory[e],g=b.hashCode;if(f){if(f=f.data,g in f.leftMatches)throw new Error("Duplicate left fact entry");f.leftMatches[g]=c}if(d=this.leftMemory[g]){if(d=d.data,e in d.rightMatches)throw new Error("Duplicate right fact entry");d.rightMatches[e]=c}return c},__addToRightMemory:function(a){var b=a.hashCode,c=this.rightMemory;return b in c?!1:(c[b]=this.rightTuples.push(a),a.leftMatches={},!0)},__addToLeftMemory:function(a){var b=a.hashCode,c=this.leftMemory;return b in c?!1:(c[b]=this.leftTuples.push(a),a.rightMatches={},!0)}}}).as(b)},{"../extended":12,"./misc/leftMemory":32,"./misc/rightMemory":34,"./node":37}],22:[function(a,b,c){var d=a("./alphaNode");d.extend({instance:{constructor:function(){this.memory={},this._super(arguments),this.constraintAssert=this.constraint.assert},assert:function(a){(this.memory[a.pathsHash]=this.constraintAssert(a.factHash))&&this.__propagate("assert",a)},modify:function(a){var b=this.memory,c=a.pathsHash,d=b[c];(b[c]=this.constraintAssert(a.factHash))?this.__propagate(d?"modify":"assert",a):d&&this.__propagate("retract",a)},retract:function(a){var b=a.pathsHash,c=this.memory;c[b]&&this.__propagate("retract",a),delete c[b]},toString:function(){return"EqualityNode"+this.__count}}}).as(b)},{"./alphaNode":20}],23:[function(a,b,c){var d=a("./fromNotNode"),e=a("../extended"),f=a("../context"),g=e.isDefined,h=e.isArray;d.extend({instance:{nodeType:"ExistsFromNode",retractLeft:function(a){var b=this.removeFromLeftMemory(a);b&&(b=b.data,b.blocked&&this.__propagate("retract",b.clone()))},__modify:function(a,b){var c=b.blocked,d=a.factHash,e=this.from(d);if(h(e)){for(var f=0,i=e.length;i>f;f++)if(this.__isMatch(a,e[f],!0)){a.blocked=!0;break}}else g(e)&&(a.blocked=this.__isMatch(a,e,!0));var j=a.blocked;j?c?this.__propagate("modify",a.clone()):this.__propagate("assert",a.clone()):c&&this.__propagate("retract",a.clone())},__findMatches:function(a){var b=a.factHash,c=this.from(b),d=!1;if(h(c)){for(var e=0,f=c.length;f>e;e++)if(this.__isMatch(a,c[e],!0))return a.blocked=!0,void this.__propagate("assert",a.clone())}else g(c)&&this.__isMatch(a,c,!0)&&(a.blocked=!0,this.__propagate("assert",a.clone()));return d},__isMatch:function(a,b,c){var d=!1;if(this.type(b)){var e=this.workingMemory.getFactHandle(b),g=new f(e,null,null).mergeMatch(a.match).set(this.alias,b);if(c){var h=this.fromMemory[e.id];h||(h=this.fromMemory[e.id]={}),h[a.hashCode]=a}for(var i=g.factHash,j=this.__equalityConstraints,k=0,l=j.length;l>k;k++){if(!j[k](i)){d=!1;break}d=!0}}return d},assertLeft:function(a){this.__addToLeftMemory(a),this.__findMatches(a)}}}).as(b)},{"../context":10,"../extended":12,"./fromNotNode":26}],24:[function(a,b,c){var d=a("./notNode"),e=a("../linkedList");d.extend({instance:{nodeType:"ExistsNode",blockedContext:function(a,b){a.blocker=b,this.removeFromLeftMemory(a),this.addToLeftBlockedMemory(b.blocking.push(a)),this.__propagate("assert",this.__cloneContext(a))},notBlockedContext:function(a,b){this.__addToLeftMemory(a),b&&this.__propagate("retract",this.__cloneContext(a))},propagateFromLeft:function(a){this.notBlockedContext(a,!1)},retractLeft:function(a){var b;if(!this.removeFromLeftMemory(a)){if(!(b=this.removeFromLeftBlockedMemory(a)))throw new Error;this.__propagate("retract",this.__cloneContext(b.data))}},modifyLeft:function(a){var b,c,d,e,f=this.removeFromLeftMemory(a),g=this.constraint,h=this.rightTuples,i=h.length,j=!1;if(f||(f=this.removeFromLeftBlockedMemory(a),j=!0),!f)throw new Error;if(b=f.data,b&&b.blocker&&(e=this.rightMemory[b.blocker.hashCode]),e?(g.isMatch(a,d=e.data)&&(this.__propagate(j?"modify":"assert",this.__cloneContext(b)),a.blocker=d,this.addToLeftBlockedMemory(d.blocking.push(a)),a=null),a&&(c={next:e.next})):c={next:h.head},a&&i)for(c={next:h.head};c=c.next;)if(g.isMatch(a,d=c.data)){this.__propagate(j?"modify":"assert",this.__cloneContext(b)),this.addToLeftBlockedMemory(d.blocking.push(a)),a.blocker=d,a=null;break}a&&(this.__addToLeftMemory(a),j&&this.__propagate("retract",this.__cloneContext(a)))},modifyRight:function(a){var b=this.removeFromRightMemory(a);if(!b)throw new Error;var c,d,f=b.data,g=this.leftTuples,h=g.length,i=this.constraint,j=f.blocking;if(this.__addToRightMemory(a),a.blocking=new e,h||j.length){if(j.length)for(var k,l={next:j.head};l=l.next;)if(c=l.data,c.blocker=null,i.isMatch(c,a))c.blocker=a,this.addToLeftBlockedMemory(a.blocking.push(c)),this.__propagate("assert",this.__cloneContext(c)),c=null;else{for(c.blocker=null,d=b;d=d.next;)if(i.isMatch(c,k=d.data)){c.blocker=k,this.addToLeftBlockedMemory(k.blocking.push(c)),this.__propagate("assert",this.__cloneContext(c)),c=null;break}c&&this.__addToLeftMemory(c)}if(h)for(d={next:g.head};d=d.next;)c=d.data,i.isMatch(c,a)&&(this.__propagate("assert",this.__cloneContext(c)),this.removeFromLeftMemory(c),this.addToLeftBlockedMemory(a.blocking.push(c)),c.blocker=a)}}}}).as(b)},{"../linkedList":16,"./notNode":38}],25:[function(a,b,c){var d=a("./joinNode"),e=a("../extended"),f=a("../constraint"),g=f.EqualityConstraint,h=f.HashConstraint,i=f.ReferenceConstraint,j=a("../context"),k=e.isDefined,l=e.isEmpty,m=e.forEach,n=e.isArray,o={isMatch:function(){return!1}};d.extend({instance:{nodeType:"FromNode",constructor:function(a,b){this._super(arguments),this.workingMemory=b,this.fromMemory={},this.pattern=a,this.type=a.get("constraints")[0].assert,this.alias=a.get("alias"),this.from=a.from.assert;var c=this.__equalityConstraints=[],d=[];m(this.constraints=this.pattern.get("constraints").slice(1),function(a){a instanceof g||a instanceof i?c.push(a.assert):a instanceof h&&(d=d.concat(a.get("variables")))}),this.__variables=d},__createMatches:function(a){var b=a.factHash,c=this.from(b);if(n(c))for(var d=0,e=c.length;e>d;d++)this.__checkMatch(a,c[d],!0);else k(c)&&this.__checkMatch(a,c,!0)},__checkMatch:function(a,b,c){var d;return(d=this.__createMatch(a,b)).isMatch()&&c&&this.__propagate("assert",d.clone()),d},__createMatch:function(a,b){if(this.type(b)){var c,d=this.workingMemory.getFactHandle(b,!0),e=new j(d,null,null).set(this.alias,b),f=d.id,g=e.factHash,h=a.factHash;for(var i in h)g[i]=h[i];for(var k=this.__equalityConstraints,l=this.__variables,m=-1,n=k.length;++m<n;)if(!k[m](g,g)){c=o;break}var p=this.fromMemory[f];if(p||(p=this.fromMemory[f]={}),!c){var q;for(m=-1,n=l.length;++m<n;)q=l[m],g[q]=b[q];a.fromMatches[d.id]=c=e.clone(d,null,a.match.merge(e.match))}return p[a.hashCode]=[a,c],c}return o},retractRight:function(){throw new Error("Shouldnt have gotten here")},removeFromFromMemory:function(a){var b=a.fact.id,c=this.fromMemory[b];if(c){var d;for(var e in c)if(d=c[e],d[1]===a){delete c[e],l(c)&&delete this.fromMemory[b];break}}},retractLeft:function(a){var b=this.removeFromLeftMemory(a);if(b){b=b.data;var c=b.fromMatches;for(var d in c)this.removeFromFromMemory(c[d]),this.__propagate("retract",c[d].clone())}},modifyLeft:function(a){var b,c,d,e,f,g=this.removeFromLeftMemory(a);if(g){this.__addToLeftMemory(a);var h=g.data,i=a.fromMatches={},j=h.fromMatches,l=this.from(a.factHash);if(n(l))for(c=0,d=l.length;d>c;c++)b=this.__checkMatch(a,l[c],!1),b.isMatch()&&(e=b.fact.id,e in j?this.__propagate("modify",b.clone()):this.__propagate("assert",b.clone()));else k(l)&&(b=this.__checkMatch(a,l,!1),b.isMatch()&&(e=b.fact.id,e in j?this.__propagate("modify",b.clone()):this.__propagate("assert",b.clone())));for(c in j)c in i||(this.removeFromFromMemory(j[c]),this.__propagate("retract",j[c].clone()))}else this.assertLeft(a);f=a.fact,e=f.id;var m=this.fromMemory[e];if(this.fromMemory[e]={},m){var o,p,q,r,s=f.object;for(c in m)p=m[c],o=p[0],q=p[1],r=q.isMatch(),o.hashCode!==a.hashCode&&(b=this.__createMatch(o,s,!1),r&&this.__propagate("retract",q.clone()),b.isMatch()&&this.__propagate(r?"modify":"assert",b.clone()))}},assertLeft:function(a){this.__addToLeftMemory(a),a.fromMatches={},this.__createMatches(a)},assertRight:function(){throw new Error("Shouldnt have gotten here")}}}).as(b)},{"../constraint":8,"../context":10,"../extended":12,"./joinNode":28}],26:[function(a,b,c){var d=a("./joinNode"),e=a("../extended"),f=a("../constraint"),g=f.EqualityConstraint,h=f.HashConstraint,i=f.ReferenceConstraint,j=a("../context"),k=e.isDefined,l=e.forEach,m=e.isArray;d.extend({instance:{nodeType:"FromNotNode",constructor:function(a,b){this._super(arguments),this.workingMemory=b,this.pattern=a,this.type=a.get("constraints")[0].assert,this.alias=a.get("alias"),this.from=a.from.assert,this.fromMemory={};var c=this.__equalityConstraints=[],d=[];l(this.constraints=this.pattern.get("constraints").slice(1),function(a){a instanceof g||a instanceof i?c.push(a.assert):a instanceof h&&(d=d.concat(a.get("variables")))}),this.__variables=d},retractLeft:function(a){var b=this.removeFromLeftMemory(a);b&&(b=b.data,b.blocked||this.__propagate("retract",b.clone()))},__modify:function(a,b){var c=b.blocked,d=a.factHash,e=this.from(d);if(m(e)){for(var f=0,g=e.length;g>f;f++)if(this.__isMatch(a,e[f],!0)){a.blocked=!0;break}}else k(e)&&(a.blocked=this.__isMatch(a,e,!0));var h=a.blocked;h?c||this.__propagate("retract",b.clone()):c?this.__propagate("assert",a.clone()):this.__propagate("modify",a.clone())},modifyLeft:function(a){var b=this.removeFromLeftMemory(a);if(!b)throw new Error;this.__addToLeftMemory(a),this.__modify(a,b.data);var c=this.fromMemory[a.fact.id];if(this.fromMemory[a.fact.id]={},c)for(var d in c)if(d!==a.hashCode){var e=c[d];b=this.removeFromLeftMemory(e),b&&(e=e.clone(),e.blocked=!1,this.__addToLeftMemory(e),this.__modify(e,b.data))}},__findMatches:function(a){var b=a.factHash,c=this.from(b),d=!1;if(m(c)){for(var e=0,f=c.length;f>e;e++)if(this.__isMatch(a,c[e],!0))return void(a.blocked=!0);this.__propagate("assert",a.clone())}else k(c)&&!(a.blocked=this.__isMatch(a,c,!0))&&this.__propagate("assert",a.clone());return d},__isMatch:function(a,b,c){var d=!1;if(this.type(b)){var e=this.workingMemory.getFactHandle(b),f=new j(e,null).mergeMatch(a.match).set(this.alias,b);if(c){var g=this.fromMemory[e.id];g||(g=this.fromMemory[e.id]={}),g[a.hashCode]=a}for(var h=f.factHash,i=this.__equalityConstraints,k=0,l=i.length;l>k;k++){if(!i[k](h,h)){d=!1;break}d=!0}}return d},assertLeft:function(a){this.__addToLeftMemory(a),this.__findMatches(a)},assertRight:function(){throw new Error("Shouldnt have gotten here")},retractRight:function(){throw new Error("Shouldnt have gotten here")}}}).as(b)},{"../constraint":8,"../context":10,"../extended":12,"./joinNode":28}],27:[function(a,b,c){"use strict";function d(a){return g(a.constraints||[],function(a){return a instanceof t})}var e=a("../extended"),f=e.forEach,g=e.some,h=e.declare,i=a("../pattern.js"),j=i.ObjectPattern,k=i.FromPattern,l=i.FromNotPattern,m=i.ExistsPattern,n=i.FromExistsPattern,o=i.NotPattern,p=i.CompositePattern,q=i.InitialFactPattern,r=a("../constraint"),s=r.HashConstraint,t=r.ReferenceConstraint,u=a("./aliasNode"),v=a("./equalityNode"),w=a("./joinNode"),x=a("./betaNode"),y=a("./notNode"),z=a("./fromNode"),A=a("./fromNotNode"),B=a("./existsNode"),C=a("./existsFromNode"),D=a("./leftAdapterNode"),E=a("./rightAdapterNode"),F=a("./typeNode"),G=a("./terminalNode"),H=a("./propertyNode");h({instance:{constructor:function(a,b){this.terminalNodes=[],this.joinNodes=[],this.nodes=[],this.constraints=[],this.typeNodes=[],this.__ruleCount=0,this.bucket={counter:0,recency:0},this.agendaTree=b,this.workingMemory=a},assertRule:function(a){var b=new G(this.bucket,this.__ruleCount++,a,this.agendaTree);this.__addToNetwork(a,a.pattern,b),this.__mergeJoinNodes(),this.terminalNodes.push(b)},resetCounter:function(){this.bucket.counter=0},incrementCounter:function(){this.bucket.counter++},assertFact:function(a){for(var b=this.typeNodes,c=b.length-1;c>=0;c--)b[c].assert(a)},retractFact:function(a){for(var b=this.typeNodes,c=b.length-1;c>=0;c--)b[c].retract(a)},modifyFact:function(a){for(var b=this.typeNodes,c=b.length-1;c>=0;c--)b[c].modify(a)},containsRule:function(a){return g(this.terminalNodes,function(b){return b.rule.name===a})},dispose:function(){for(var a=this.typeNodes,b=a.length-1;b>=0;b--)a[b].dispose()},__mergeJoinNodes:function(){for(var a=this.joinNodes,b=0;b<a.length;b++){var c=a[b],d=a[b+1];c&&d&&c.constraint&&d.constraint&&c.constraint.equal(d.constraint)&&(c.merge(d),a.splice(b+1,1))}},__checkEqual:function(a){for(var b=this.constraints,c=b.length-1;c>=0;c--){var d=b[c];if(a.equal(d))return d}return b.push(a),a},__createTypeNode:function(a,b){for(var c=new F(b.get("constraints")[0]),d=this.typeNodes,e=d.length-1;e>=0;e--){var f=d[e];if(c.equal(f))return f}return d.push(c),c},__createEqualityNode:function(a,b){return this.__checkEqual(new v(b)).addRule(a)},__createPropertyNode:function(a,b){return this.__checkEqual(new H(b)).addRule(a)},__createAliasNode:function(a,b){return this.__checkEqual(new u(b)).addRule(a)},__createAdapterNode:function(a,b){return("left"===b?new D:new E).addRule(a)},__createJoinNode:function(a,b,c,e){var f;b.rightPattern instanceof o?f=new y:b.rightPattern instanceof n?f=new C(b.rightPattern,this.workingMemory):b.rightPattern instanceof m?f=new B:b.rightPattern instanceof l?f=new A(b.rightPattern,this.workingMemory):b.rightPattern instanceof k?f=new z(b.rightPattern,this.workingMemory):b instanceof p&&!d(b.leftPattern)&&!d(b.rightPattern)?(f=new x,this.joinNodes.push(f)):(f=new w,this.joinNodes.push(f)),f.__rule__=a;var g=f;if(c instanceof x){var h=this.__createAdapterNode(a,e);g.addOutNode(h,b),g=h}return g.addOutNode(c,b),f.addRule(a)},__addToNetwork:function(a,b,c,d){b instanceof j?b instanceof q||d&&"left"!==d?this.__createAlphaNode(a,b,c,d):this.__createBetaNode(a,new p(new q,b),c,d):b instanceof p&&this.__createBetaNode(a,b,c,d)},__createBetaNode:function(a,b,c,d){var e=this.__createJoinNode(a,b,c,d);return this.__addToNetwork(a,b.rightPattern,e,"right"),this.__addToNetwork(a,b.leftPattern,e,"left"),c.addParentNode(e),e},__createAlphaNode:function(a,b,c,d){var e,f;if(!(b instanceof k)){var g=b.get("constraints");e=this.__createTypeNode(a,b);var h=this.__createAliasNode(a,b);e.addOutNode(h,b),h.addParentNode(e),f=h;for(var i=g.length-1;i>0;i--){var j,l=g[i];if(l instanceof s)j=this.__createPropertyNode(a,l);else{if(l instanceof t){c.constraint.addConstraint(l);continue}j=this.__createEqualityNode(a,l)}f.addOutNode(j,b),j.addParentNode(f),f=j}if(c instanceof x){var m=this.__createAdapterNode(a,d);m.addParentNode(f),f.addOutNode(m,b),f=m}return c.addParentNode(f),f.addOutNode(c,b),e}},print:function(){f(this.terminalNodes,function(a){a.print("    ")})}}}).as(c,"RootNode")},{"../constraint":8,"../extended":12,"../pattern.js":48,"./aliasNode":19,"./betaNode":21,"./equalityNode":22,"./existsFromNode":23,"./existsNode":24,"./fromNode":25,"./fromNotNode":26,"./joinNode":28,"./leftAdapterNode":30,"./notNode":38,"./propertyNode":39,"./rightAdapterNode":40,"./terminalNode":41,"./typeNode":42}],28:[function(a,b,c){var d=a("./betaNode"),e=a("./joinReferenceNode");d.extend({instance:{constructor:function(){this._super(arguments),this.constraint=new e(this.leftTuples,this.rightTuples)},nodeType:"JoinNode",propagateFromLeft:function(a,b){var c;return(c=this.constraint.match(a,b)).isMatch&&this.__propagate("assert",this.__addToMemoryMatches(b,a,a.clone(null,null,c))),this},propagateFromRight:function(a,b){var c;return(c=this.constraint.match(b,a)).isMatch&&this.__propagate("assert",this.__addToMemoryMatches(a,b,a.clone(null,null,c))),this},propagateAssertModifyFromLeft:function(a,b,c){var d,e=c.hashCode;if(e in b){d=this.constraint.match(a,c);var f=d.isMatch;f?this.__propagate("modify",this.__addToMemoryMatches(c,a,a.clone(null,null,d))):this.__propagate("retract",b[e].clone())}else this.propagateFromLeft(a,c)},propagateAssertModifyFromRight:function(a,b,c){var d,e=c.hashCode;if(e in b){d=this.constraint.match(c,a);var f=d.isMatch;f?this.__propagate("modify",this.__addToMemoryMatches(a,c,a.clone(null,null,d))):this.__propagate("retract",b[e].clone())}else this.propagateFromRight(a,c)}}}).as(b)},{"./betaNode":21,"./joinReferenceNode":29}],29:[function(a,b,c){function d(a,b,c){return a===b[1]&&(c=j[c]),c}function e(a,b,c){return a===b[1]&&(c=j[c]),c}var f=a("./node"),g=a("../constraint"),h=g.ReferenceEqualityConstraint,i={isDefault:!0,assert:function(){return!0},equal:function(){return!1}},j={gt:"lte",gte:"lte",lt:"gte",lte:"gte",eq:"eq",neq:"neq"};f.extend({instance:{constraint:i,constructor:function(a,b){this._super(arguments),this.constraint=i,this.constraintAssert=i.assert,this.rightIndexes=[],this.leftIndexes=[],this.constraintLength=0,this.leftMemory=a,this.rightMemory=b},addConstraint:function(a){if(a instanceof h){var b=a.getIndexableProperties(),c=a.get("alias");if(2===b.length&&c){for(var f,g,i=-1,j=[];++i<2;){var k=b[i];null===k.match(new RegExp("^"+c+"(\\.?)"))?(j.push(k),f=k):(j.push(k),g=k)}if(f&&g){var l=e(f,j,a.op),m=d(g,j,a.op);this.rightMemory.addIndex(g,f,m),this.leftMemory.addIndex(f,g,l)}}}this.constraint.isDefault?(this.constraint=a,this.isDefault=!1):this.constraint=this.constraint.merge(a),this.constraintAssert=this.constraint.assert},equal:function(a){return this.constraint.equal(a.constraint)},isMatch:function(a,b){return this.constraintAssert(a.factHash,b.factHash)},match:function(a,b){var c={isMatch:!1};return this.constraintAssert(a.factHash,b.factHash)&&(c=a.match.merge(b.match)),c}}}).as(b)},{"../constraint":8,"./node":37}],30:[function(a,b,c){var d=a("./adapterNode");d.extend({instance:{propagateAssert:function(a){this.__propagate("assertLeft",a)},propagateRetract:function(a){this.__propagate("retractLeft",a)},propagateResolve:function(a){this.__propagate("retractResolve",a)},propagateModify:function(a){this.__propagate("modifyLeft",a)},retractResolve:function(a){this.__propagate("retractResolve",a)},dispose:function(a){this.propagateDispose(a)},toString:function(){return"LeftAdapterNode "+this.__count}}}).as(b)},{"./adapterNode":18}],31:[function(a,b,c){c.getMemory=function(){function a(a,b,c){var d,e=0,f=-1;if(c>m)for(;m&&++f<c;)l[(d=b[f]).hashCode]&&(a[e++]=d,m--);else h.apply(a,b);m=0,l={}}function b(a,b,c){var d,e=0,f=-1;if(c>i)for(;++f<c;)i?k[(d=b[f]).hashCode]?i--:a[e++]=d:a[e++]=b[f];i=0,k={}}function c(a,b,c){if(m===c)f(a,b,c);else if(c>i)for(var d,e,g=0,h=-1;++h<c;)!k[e=(d=b[h]).hashCode]&&l[e]&&(a[g++]=d);i=0,k={},m=0,l={}}function d(d,e){var f=j;return e&&(i||m?(f=[],i?m?c(f,d,e):b(f,d,e):a(f,d,e)):f=d),f}function e(a,b,c){var d;return"gt"===a?d=b.findGT(c):"gte"===a?d=b.findGTE(c):"lt"===a?d=b.findLT(c):"lte"===a&&(d=b.findLTE(c)),d}function f(a,b){if(b)for(var c,d=-1;++d<b;)c=a[d].hashCode,k[c]||(k[c]=!0,i++)}function g(a,b){if(b)for(var c,d=-1;++d<b;)c=a[d].hashCode,l[c]||(l[c]=!0,m++)}var h=Array.prototype.push,i=0,j=[],k={},l={},m=0;return function(a,b,c){for(var h,i,k,l,m,n,o,p=-1,q=c.length,r=a.tuples,s=r.length,t=!1,u=a.tables;++p<q&&s;)h=c[p],i=h[3](b),k=h[4],m=u[h[0]],"eq"===k||"seq"===k?(l=m.get(i))?(s=(r=(a=l).tuples).length,u=l.tables):s=(r=j).length:"neq"===k||"sneq"===k?(l=m.get(i))&&(o=(n=l.tuples).length,f(n,o)):t?(o=(n=e(k,m,i)).length)?g(n,o):(r=n,s=o):(s=(r=e(k,m,i)).length,t=!0);return d(r,s)}}()},{}],32:[function(a,b,c){var d=a("./memory");d.extend({instance:{getLeftMemory:function(a){return this.getMemory(a)}}}).as(b)},{"./memory":33}],33:[function(a,b,c){var d=a("../../extended"),e=d.plucker,f=d.declare,g=a("./helpers").getMemory,h=a("./table"),i=a("./tupleEntry"),j=0;f({instance:{length:0,constructor:function(){this.head=null,this.tail=null,this.indexes=[],this.tables=new i(null,new h,!1)},push:function(a){var b=this.tail,c=this.head,d={data:a,tuples:[],hashCode:j++,prev:b,next:null};return b&&(this.tail.next=d),this.tail=d,c||(this.head=d),this.length++,this.__index(d),this.tables.addNode(d),d},remove:function(a){a.prev?a.prev.next=a.next:this.head=a.next,a.next?a.next.prev=a.prev:this.tail=a.prev,this.tables.removeNode(a),this.__removeFromIndex(a),this.length--},forEach:function(a){for(var b={next:this.head};b=b.next;)a(b.data)},toArray:function(){return this.tables.tuples.slice()},clear:function(){this.head=this.tail=null,this.length=0,this.clearIndexes()},clearIndexes:function(){this.tables={},this.indexes.length=0},__index:function(a){for(var b,c,d,e,f,g,j,k=a.data,l=k.factHash,m=this.indexes,n=this.tables,o=-1,p=m.length;++o<p;)c=m[o],d=c[2](l),e=c[0],f=n.tables,(b=(g=f[e]||(f[e]=new h)).get(d))||(b=new i(d,g,!0),g.set(d,b)),g!==j&&a.tuples.push(b.addNode(a)),j=g,"eq"===c[4]&&(n=b)},__removeFromIndex:function(a){for(var b=a.tuples,c=b.length;--c>=0;)b[c].removeNode(a);a.tuples.length=0},getMemory:function(a){var b;return b=this.length?g(this.tables,a.factHash,this.indexes):[]},__createIndexTree:function(){var a=this.tables.tables={},b=this.indexes;a[b[0][0]]=new h},addIndex:function(a,b,c){this.indexes.push([a,b,e(a),e(b),c||"eq"]),this.indexes.sort(function(a,b){var c=a[4],d=b[4];return c===d?0:c>d?1:c===d?0:-1}),this.__createIndexTree()}}}).as(b)},{"../../extended":12,"./helpers":31,"./table":35,"./tupleEntry":36}],34:[function(a,b,c){var d=a("./memory");d.extend({instance:{getRightMemory:function(a){return this.getMemory(a)}}}).as(b)},{"./memory":33}],35:[function(a,b,c){function d(a,b){a=a.key,b=b.key;var c;return c=a==b?0:a>b?1:b>a?-1:1}function e(a,b){return 1===d(a,b)}function f(a,b){return-1!==d(a,b)}function g(a,b){return-1===d(a,b)}function h(a,b){return 1!==d(a,b)}function i(a,b,c){p.key=b;for(var d,e=[],f=0,g=a.__root;;)if(g)g=(o[f++]=g).left;else{if(!(f>0))break;if(d=(g=o[--f]).data,!c(d,p))break;l.apply(e,d.value.tuples),g=g.right}return o.length=0,e}function j(a,b,c){p.key=b;for(var d,e=[],f=0,g=a.__root;;)if(g)g=(o[f++]=g).right;else{if(!(f>0))break;if(d=(g=o[--f]).data,!c(d,p))break;l.apply(e,d.value.tuples),g=g.left}return o.length=0,e}var k=a("../../extended"),l=Array.prototype.push,m=k.HashTable,n=k.AVLTree,o=[],p={key:null};n.extend({instance:{constructor:function(){this._super([{compare:d}]),this.gtCache=new m,this.gteCache=new m,this.ltCache=new m,this.lteCache=new m,this.hasGTCache=!1,this.hasGTECache=!1,this.hasLTCache=!1,this.hasLTECache=!1},clearCache:function(){this.hasGTCache&&this.gtCache.clear()&&(this.hasGTCache=!1),this.hasGTECache&&this.gteCache.clear()&&(this.hasGTECache=!1),this.hasLTCache&&this.ltCache.clear()&&(this.hasLTCache=!1),this.hasLTECache&&this.lteCache.clear()&&(this.hasLTECache=!1)},contains:function(a){return this._super([{key:a}])},set:function(a,b){this.insert({key:a,value:b}),this.clearCache()},get:function(a){var b=this.find({key:a});return b&&b.value},remove:function(a){return this.clearCache(),this._super([{key:a}])},findGT:function(a){var b=this.gtCache.get(a);return b||(this.hasGTCache=!0,this.gtCache.put(a,b=j(this,a,e))),b},findGTE:function(a){var b=this.gteCache.get(a);return b||(this.hasGTECache=!0,this.gteCache.put(a,b=j(this,a,f))),b},findLT:function(a){var b=this.ltCache.get(a);return b||(this.hasLTCache=!0,this.ltCache.put(a,b=i(this,a,g))),b},findLTE:function(a){var b=this.lteCache.get(a);return b||(this.hasLTECache=!0,this.lteCache.put(a,b=i(this,a,h))),b}}}).as(b)},{"../../extended":12}],36:[function(a,b,c){var d=a("../../extended"),e=d.indexOf,f=0;d.declare({instance:{tuples:null,tupleMap:null,hashCode:null,tables:null,entry:null,constructor:function(a,b,c){this.val=a,this.canRemove=c,this.tuples=[],this.tupleMap={},this.hashCode=f++,this.tables={},this.length=0,this.entry=b},addNode:function(a){return this.tuples[this.length++]=a,this.length>1&&this.entry.clearCache(),this},removeNode:function(a){var b=this.tuples,c=e(b,a);-1!==c&&(b.splice(c,1),this.length--,this.entry.clearCache()),this.canRemove&&!this.length&&this.entry.remove(this.val)}}}).as(b)},{"../../extended":12}],37:[function(a,b,c){var d=a("../extended"),e=d.forEach,f=d.indexOf,g=d.intersection,h=d.declare,i=d.HashTable,j=a("../context"),k=0;h({instance:{constructor:function(){this.nodes=new i,this.rules=[],this.parentNodes=[],this.__count=k++,this.__entrySet=[]},addRule:function(a){return-1===f(this.rules,a)&&this.rules.push(a),this},merge:function(a){a.nodes.forEach(function(b){for(var c=b.value,d=b.key,e=0,f=c.length;f>e;e++)this.addOutNode(d,c[e]);a.nodes.remove(d)},this);for(var b=a.parentNodes,c=0,d=a.parentNodes.l;d>c;c++){var e=b[c];this.addParentNode(e),e.nodes.remove(a)}return this},resolve:function(a,b){return a.hashCode===b.hashCode},print:function(a){console.log(a+this.toString()),e(this.parentNodes,function(b){b.print("    "+a)})},addOutNode:function(a,b){this.nodes.contains(a)||this.nodes.put(a,[]),this.nodes.get(a).push(b),this.__entrySet=this.nodes.entrySet()},addParentNode:function(a){-1===f(this.parentNodes,a)&&this.parentNodes.push(a)},shareable:function(){
  return!1},__propagate:function(a,b){for(var c,d,e,f,h=this.__entrySet,i=h.length;--i>-1;)c=h[i],d=c.key,e=c.value,(f=g(e,b.paths)).length&&d[a](new j(b.fact,f,b.match))},dispose:function(a){this.propagateDispose(a)},retract:function(a){this.propagateRetract(a)},propagateDispose:function(a,b){b=b||this.nodes;for(var c=this.__entrySet,d=c.length-1;d>=0;d--){var e=c[d],f=e.key;f.dispose(a)}},propagateAssert:function(a){this.__propagate("assert",a)},propagateRetract:function(a){this.__propagate("retract",a)},assert:function(a){this.propagateAssert(a)},modify:function(a){this.propagateModify(a)},propagateModify:function(a){this.__propagate("modify",a)}}}).as(b)},{"../context":10,"../extended":12}],38:[function(a,b,c){var d=a("./joinNode"),e=a("../linkedList"),f=a("../context"),g=a("../pattern").InitialFact;d.extend({instance:{nodeType:"NotNode",constructor:function(){this._super(arguments),this.leftTupleMemory={},this.notMatch=new f(new g).match},__cloneContext:function(a){return a.clone(null,null,a.match.merge(this.notMatch))},retractRight:function(a){var b=this.removeFromRightMemory(a),c=b.data,d=c.blocking;if(d.length){for(var e,f,g=this.constraint,h={next:d.head};h=h.next;){e=h.data,this.removeFromLeftBlockedMemory(e);var i,j=this.rightTuples.getRightMemory(e),k=j.length;for(i=-1;++i<k;)if(g.isMatch(e,f=j[i].data)){this.blockedContext(e,f),e=null;break}e&&this.notBlockedContext(e,!0)}d.clear()}},blockedContext:function(a,b,c){a.blocker=b,this.removeFromLeftMemory(a),this.addToLeftBlockedMemory(b.blocking.push(a)),c&&this.__propagate("retract",this.__cloneContext(a))},notBlockedContext:function(a,b){this.__addToLeftMemory(a),b&&this.__propagate("assert",this.__cloneContext(a))},propagateFromLeft:function(a){this.notBlockedContext(a,!0)},propagateFromRight:function(a){this.notBlockedContext(a,!0)},blockFromAssertRight:function(a,b){this.blockedContext(a,b,!0)},blockFromAssertLeft:function(a,b){this.blockedContext(a,b,!1)},retractLeft:function(a){var b=this.removeFromLeftMemory(a);if(b)b=b.data,this.__propagate("retract",this.__cloneContext(b));else if(!this.removeFromLeftBlockedMemory(a))throw new Error},assertLeft:function(a){for(var b,c=this.rightTuples.getRightMemory(a),d=this.constraint,e=-1,f=c.length;++e<f;)d.isMatch(a,b=c[e].data)&&(this.blockFromAssertLeft(a,b),a=null,e=f);a&&this.propagateFromLeft(a)},assertRight:function(a){this.__addToRightMemory(a),a.blocking=new e;for(var b,c=this.leftTuples.getLeftMemory(a).slice(),d=-1,f=c.length,g=this.constraint;++d<f;)b=c[d].data,g.isMatch(b,a)&&this.blockFromAssertRight(b,a)},addToLeftBlockedMemory:function(a){var b=a.data,c=b.hashCode,d=this.leftMemory[c];return this.leftTupleMemory[c]=a,d&&this.leftTuples.remove(d),this},removeFromLeftBlockedMemory:function(a){var b=this.leftTupleMemory[a.hashCode]||null;return b&&(delete this.leftTupleMemory[a.hashCode],b.data.blocker.blocking.remove(b)),b},modifyLeft:function(a){var b,c,d,e,f=this.removeFromLeftMemory(a),g=this.constraint,h=this.rightTuples.getRightMemory(a),i=h.length,j=!1;if(f||(f=this.removeFromLeftBlockedMemory(a),j=!0),!f)throw new Error;if(b=f.data,b&&b.blocker&&(e=this.rightMemory[b.blocker.hashCode],b.blocker=null),e&&g.isMatch(a,d=e.data)&&(j||this.__propagate("retract",this.__cloneContext(b)),a.blocker=d,this.addToLeftBlockedMemory(d.blocking.push(a)),a=null),a&&i)for(c=-1;++c<i;)if(g.isMatch(a,d=h[c].data)){j||this.__propagate("retract",this.__cloneContext(b)),this.addToLeftBlockedMemory(d.blocking.push(a)),a.blocker=d,a=null;break}a&&(this.__addToLeftMemory(a),j?this.__propagate("assert",this.__cloneContext(a)):this.__propagate("modify",this.__cloneContext(a)))},modifyRight:function(a){var b=this.removeFromRightMemory(a);if(!b)throw new Error;var c,d,f,g=b.data,h=this.leftTuples.getLeftMemory(a).slice(),i=h.length,j=this.constraint,k=g.blocking;this.__addToRightMemory(a),a.blocking=new e;for(var l,m={next:k.head};m=m.next;)if(c=m.data,c.blocker=null,j.isMatch(c,a))c.blocker=a,this.addToLeftBlockedMemory(a.blocking.push(c)),c=null;else{for(c.blocker=null,f=b;f=f.next;)if(j.isMatch(c,l=f.data)){c.blocker=l,this.addToLeftBlockedMemory(l.blocking.push(c)),c=null;break}c&&(this.__addToLeftMemory(c),this.__propagate("assert",this.__cloneContext(c)))}if(i)for(d=-1;++d<i;)c=h[d].data,j.isMatch(c,a)&&(this.__propagate("retract",this.__cloneContext(c)),this.removeFromLeftMemory(c),this.addToLeftBlockedMemory(a.blocking.push(c)),c.blocker=a)}}}).as(b)},{"../context":10,"../linkedList":16,"../pattern":48,"./joinNode":28}],39:[function(a,b,c){var d=a("./alphaNode"),e=a("../context"),f=a("../extended");d.extend({instance:{constructor:function(){this._super(arguments),this.alias=this.constraint.get("alias"),this.varLength=(this.variables=f(this.constraint.get("variables")).toArray().value()).length},assert:function(a){var b,c=new e(a.fact,a.paths),d=this.variables,f=a.fact.object;c.set(this.alias,f);for(var g=0,h=this.varLength;h>g;g++)b=d[g],c.set(b[1],f[b[0]]);this.__propagate("assert",c)},retract:function(a){this.__propagate("retract",new e(a.fact,a.paths))},modify:function(a){var b,c=new e(a.fact,a.paths),d=this.variables,f=a.fact.object;c.set(this.alias,f);for(var g=0,h=this.varLength;h>g;g++)b=d[g],c.set(b[1],f[b[0]]);this.__propagate("modify",c)},toString:function(){return"PropertyNode"+this.__count}}}).as(b)},{"../context":10,"../extended":12,"./alphaNode":20}],40:[function(a,b,c){var d=a("./adapterNode");d.extend({instance:{retractResolve:function(a){this.__propagate("retractResolve",a)},dispose:function(a){this.propagateDispose(a)},propagateAssert:function(a){this.__propagate("assertRight",a)},propagateRetract:function(a){this.__propagate("retractRight",a)},propagateResolve:function(a){this.__propagate("retractResolve",a)},propagateModify:function(a){this.__propagate("modifyRight",a)},toString:function(){return"RightAdapterNode "+this.__count}}}).as(b)},{"./adapterNode":18}],41:[function(a,b,c){var d=a("./node"),e=a("../extended"),f=e.bind;d.extend({instance:{constructor:function(a,b,c,d){this._super([]),this.resolve=f(this,this.resolve),this.rule=c,this.index=b,this.name=this.rule.name,this.agenda=d,this.bucket=a,d.register(this)},__assertModify:function(a){var b=a.match;if(b.isMatch){var c=this.rule,d=this.bucket;this.agenda.insert(this,{rule:c,hashCode:a.hashCode,index:this.index,name:c.name,recency:d.recency++,match:b,counter:d.counter})}},assert:function(a){this.__assertModify(a)},modify:function(a){this.agenda.retract(this,a),this.__assertModify(a)},retract:function(a){this.agenda.retract(this,a)},retractRight:function(a){this.agenda.retract(this,a)},retractLeft:function(a){this.agenda.retract(this,a)},assertLeft:function(a){this.__assertModify(a)},assertRight:function(a){this.__assertModify(a)},toString:function(){return"TerminalNode "+this.rule.name}}}).as(b)},{"../extended":12,"./node":37}],42:[function(a,b,c){var d=a("./alphaNode"),e=a("../context");d.extend({instance:{assert:function(a){this.constraintAssert(a.object)&&this.__propagate("assert",a)},modify:function(a){this.constraintAssert(a.object)&&this.__propagate("modify",a)},retract:function(a){this.constraintAssert(a.object)&&this.__propagate("retract",a)},toString:function(){return"TypeNode"+this.__count},dispose:function(){for(var a=this.__entrySet,b=a.length-1;b>=0;b--){var c=a[b],d=c.key,e=c.value;d.dispose({paths:e})}},__propagate:function(a,b){for(var c=this.__entrySet,d=-1,f=c.length;++d<f;){var g=c[d],h=g.key,i=g.value;h[a](new e(b,i))}}}}).as(b)},{"../context":10,"./alphaNode":20}],43:[function(a,b,c){var d=a("__browserify_process"),e=function(){function a(){this.yy={}}var b=function(a,b,c,d){for(c=c||{},d=a.length;d--;c[a[d]]=b);return c},c=[1,29],d=[1,30],e=[1,26],f=[1,24],g=[1,16],h=[1,18],i=[1,19],j=[1,20],k=[1,21],l=[1,22],m=[5,38,49],n=[1,33],o=[5,36,38,49],p=[5,8,11,12,13,15,17,19,20,21,22,24,25,26,27,28,29,36,38,49],q=[2,2],r=[5,24,25,26,27,28,29,36,38,49],s=[1,42],t=[1,43],u=[1,44],v=[1,45],w=[5,8,11,12,13,15,17,19,20,21,22,24,25,26,27,28,29,31,33,36,38,40,46,49],x=[1,46],y=[1,47],z=[1,48],A=[5,19,20,21,22,24,25,26,27,28,29,36,38,49],B=[1,50],C=[5,8,11,12,13,15,17,19,20,21,22,24,25,26,27,28,29,31,33,36,38,40,43,44,46,48,49],D=[5,17,19,20,21,22,24,25,26,27,28,29,36,38,49],E=[1,55],F=[1,54],G=[5,8,15,17,19,20,21,22,24,25,26,27,28,29,36,38,49],H=[1,56],I=[1,57],J=[1,58],K=[1,87],L=[40,46,49],M={trace:function(){},yy:{},symbols_:{error:2,expressions:3,EXPRESSION:4,EOF:5,UNARY_EXPRESSION:6,LITERAL_EXPRESSION:7,"-":8,"!":9,MULTIPLICATIVE_EXPRESSION:10,"*":11,"/":12,"%":13,ADDITIVE_EXPRESSION:14,"+":15,EXPONENT_EXPRESSION:16,"^":17,RELATIONAL_EXPRESSION:18,"<":19,">":20,"<=":21,">=":22,EQUALITY_EXPRESSION:23,"==":24,"===":25,"!=":26,"!==":27,"=~":28,"!=~":29,IN_EXPRESSION:30,"in":31,ARRAY_EXPRESSION:32,notIn:33,OBJECT_EXPRESSION:34,AND_EXPRESSION:35,"&&":36,OR_EXPRESSION:37,"||":38,ARGUMENT_LIST:39,",":40,IDENTIFIER_EXPRESSION:41,IDENTIFIER:42,".":43,"[":44,STRING_EXPRESSION:45,"]":46,NUMBER_EXPRESSION:47,"(":48,")":49,STRING:50,NUMBER:51,REGEXP_EXPRESSION:52,REGEXP:53,BOOLEAN_EXPRESSION:54,BOOLEAN:55,NULL_EXPRESSION:56,NULL:57,$accept:0,$end:1},terminals_:{2:"error",5:"EOF",8:"-",9:"!",11:"*",12:"/",13:"%",15:"+",17:"^",19:"<",20:">",21:"<=",22:">=",24:"==",25:"===",26:"!=",27:"!==",28:"=~",29:"!=~",31:"in",33:"notIn",36:"&&",38:"||",40:",",42:"IDENTIFIER",43:".",44:"[",46:"]",48:"(",49:")",50:"STRING",51:"NUMBER",53:"REGEXP",55:"BOOLEAN",57:"NULL"},productions_:[0,[3,2],[6,1],[6,2],[6,2],[10,1],[10,3],[10,3],[10,3],[14,1],[14,3],[14,3],[16,1],[16,3],[18,1],[18,3],[18,3],[18,3],[18,3],[23,1],[23,3],[23,3],[23,3],[23,3],[23,3],[23,3],[30,1],[30,3],[30,3],[30,3],[30,3],[35,1],[35,3],[37,1],[37,3],[39,1],[39,3],[41,1],[34,1],[34,3],[34,4],[34,4],[34,4],[34,3],[34,4],[45,1],[47,1],[52,1],[54,1],[56,1],[32,2],[32,3],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,3],[4,1]],performAction:function(a,b,c,d,e,f,g){var h=f.length-1;switch(e){case 1:return f[h-1];case 3:this.$=[f[h],null,"unary"];break;case 4:this.$=[f[h],null,"logicalNot"];break;case 6:this.$=[f[h-2],f[h],"mult"];break;case 7:this.$=[f[h-2],f[h],"div"];break;case 8:this.$=[f[h-2],f[h],"mod"];break;case 10:this.$=[f[h-2],f[h],"plus"];break;case 11:this.$=[f[h-2],f[h],"minus"];break;case 13:this.$=[f[h-2],f[h],"pow"];break;case 15:this.$=[f[h-2],f[h],"lt"];break;case 16:this.$=[f[h-2],f[h],"gt"];break;case 17:this.$=[f[h-2],f[h],"lte"];break;case 18:this.$=[f[h-2],f[h],"gte"];break;case 20:this.$=[f[h-2],f[h],"eq"];break;case 21:this.$=[f[h-2],f[h],"seq"];break;case 22:this.$=[f[h-2],f[h],"neq"];break;case 23:this.$=[f[h-2],f[h],"sneq"];break;case 24:this.$=[f[h-2],f[h],"like"];break;case 25:this.$=[f[h-2],f[h],"notLike"];break;case 27:case 29:this.$=[f[h-2],f[h],"in"];break;case 28:case 30:this.$=[f[h-2],f[h],"notIn"];break;case 32:this.$=[f[h-2],f[h],"and"];break;case 34:this.$=[f[h-2],f[h],"or"];break;case 36:this.$=[f[h-2],f[h],"arguments"];break;case 37:this.$=[String(a),null,"identifier"];break;case 39:this.$=[f[h-2],f[h],"prop"];break;case 40:case 41:case 42:this.$=[f[h-3],f[h-1],"propLookup"];break;case 43:this.$=[f[h-2],[null,null,"arguments"],"function"];break;case 44:this.$=[f[h-3],f[h-1],"function"];break;case 45:this.$=[String(a.replace(/^['|"]|['|"]$/g,"")),null,"string"];break;case 46:this.$=[Number(a),null,"number"];break;case 47:this.$=[a,null,"regexp"];break;case 48:this.$=["true"==a.replace(/^\s+/,""),null,"boolean"];break;case 49:this.$=[null,null,"null"];break;case 50:this.$=[null,null,"array"];break;case 51:this.$=[f[h-1],null,"array"];break;case 59:this.$=[f[h-1],null,"composite"]}},table:[{3:1,4:2,6:28,7:7,8:c,9:d,10:27,14:25,16:17,18:8,23:6,30:5,32:15,34:14,35:4,37:3,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{1:[3]},{5:[1,31]},b([5,49],[2,60],{38:[1,32]}),b(m,[2,33],{36:n}),b(o,[2,31]),b(o,[2,26],{24:[1,34],25:[1,35],26:[1,36],27:[1,37],28:[1,38],29:[1,39]}),b(p,q,{31:[1,40],33:[1,41]}),b(r,[2,19],{19:s,20:t,21:u,22:v}),b(w,[2,52]),b(w,[2,53]),b(w,[2,54]),b(w,[2,55]),b(w,[2,56]),b(w,[2,57],{43:x,44:y,48:z}),b(w,[2,58]),{4:49,6:28,7:7,8:c,9:d,10:27,14:25,16:17,18:8,23:6,30:5,32:15,34:14,35:4,37:3,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},b(A,[2,14],{17:B}),b(w,[2,45]),b(w,[2,46]),b(w,[2,47]),b(w,[2,48]),b(w,[2,49]),b(C,[2,38]),{7:53,32:15,34:14,39:52,41:23,42:e,44:f,45:9,46:[1,51],47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},b(D,[2,12],{8:E,15:F}),b(C,[2,37]),b(G,[2,9],{11:H,12:I,13:J}),b(p,[2,5]),{6:59,7:60,8:c,9:d,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:61,7:60,8:c,9:d,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{1:[2,1]},{6:28,7:7,8:c,9:d,10:27,14:25,16:17,18:8,23:6,30:5,32:15,34:14,35:62,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:28,7:7,8:c,9:d,10:27,14:25,16:17,18:8,23:6,30:63,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:28,7:60,8:c,9:d,10:27,14:25,16:17,18:64,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:28,7:60,8:c,9:d,10:27,14:25,16:17,18:65,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:28,7:60,8:c,9:d,10:27,14:25,16:17,18:66,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:28,7:60,8:c,9:d,10:27,14:25,16:17,18:67,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:28,7:60,8:c,9:d,10:27,14:25,16:17,18:68,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:28,7:60,8:c,9:d,10:27,14:25,16:17,18:69,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{32:70,34:71,41:23,42:e,44:f},{32:72,34:73,41:23,42:e,44:f},{6:28,7:60,8:c,9:d,10:27,14:25,16:74,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:28,7:60,8:c,9:d,10:27,14:25,16:75,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:28,7:60,8:c,9:d,10:27,14:25,16:76,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:28,7:60,8:c,9:d,10:27,14:25,16:77,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{41:78,42:e},{34:81,41:23,42:e,45:79,47:80,50:h,51:i},{7:53,32:15,34:14,39:83,41:23,42:e,44:f,45:9,47:10,48:g,49:[1,82],50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{49:[1,84]},{6:28,7:60,8:c,9:d,10:27,14:85,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},b(w,[2,50]),{40:K,46:[1,86]},b(L,[2,35]),{6:28,7:60,8:c,9:d,10:88,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:28,7:60,8:c,9:d,10:89,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:90,7:60,8:c,9:d,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:91,7:60,8:c,9:d,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},{6:92,7:60,8:c,9:d,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},b(p,[2,3]),b(p,q),b(p,[2,4]),b(m,[2,34],{36:n}),b(o,[2,32]),b(r,[2,20],{19:s,20:t,21:u,22:v}),b(r,[2,21],{19:s,20:t,21:u,22:v}),b(r,[2,22],{19:s,20:t,21:u,22:v}),b(r,[2,23],{19:s,20:t,21:u,22:v}),b(r,[2,24],{19:s,20:t,21:u,22:v}),b(r,[2,25],{19:s,20:t,21:u,22:v}),b(o,[2,27]),b(o,[2,29],{43:x,44:y,48:z}),b(o,[2,28]),b(o,[2,30],{43:x,44:y,48:z}),b(A,[2,15],{17:B}),b(A,[2,16],{17:B}),b(A,[2,17],{17:B}),b(A,[2,18],{17:B}),b(C,[2,39]),{46:[1,93]},{46:[1,94]},{43:x,44:y,46:[1,95],48:z},b(C,[2,43]),{40:K,49:[1,96]},b(w,[2,59]),b(D,[2,13],{8:E,15:F}),b(w,[2,51]),{7:97,32:15,34:14,41:23,42:e,44:f,45:9,47:10,48:g,50:h,51:i,52:11,53:j,54:12,55:k,56:13,57:l},b(G,[2,10],{11:H,12:I,13:J}),b(G,[2,11],{11:H,12:I,13:J}),b(p,[2,6]),b(p,[2,7]),b(p,[2,8]),b(C,[2,40]),b(C,[2,41]),b(C,[2,42]),b(C,[2,44]),b(L,[2,36])],defaultActions:{31:[2,1]},parseError:function(a,b){function c(a,b){this.message=a,this.hash=b}if(!b.recoverable)throw c.prototype=Error,new c(a,b);this.trace(a)},parse:function(a){var b=this,c=[0],d=[null],e=[],f=this.table,g="",h=0,i=0,j=0,k=2,l=1,m=e.slice.call(arguments,1),n=Object.create(this.lexer),o={yy:{}};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(o.yy[p]=this.yy[p]);n.setInput(a,o.yy),o.yy.lexer=n,o.yy.parser=this,"undefined"==typeof n.yylloc&&(n.yylloc={});var q=n.yylloc;e.push(q);var r=n.options&&n.options.ranges;"function"==typeof o.yy.parseError?this.parseError=o.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var s,t,u,v,w,x,y,z,A,B=function(){var a;return a=n.lex()||l,"number"!=typeof a&&(a=b.symbols_[a]||a),a},C={};;){if(u=c[c.length-1],this.defaultActions[u]?v=this.defaultActions[u]:((null===s||"undefined"==typeof s)&&(s=B()),v=f[u]&&f[u][s]),"undefined"==typeof v||!v.length||!v[0]){var D="";A=[];for(x in f[u])this.terminals_[x]&&x>k&&A.push("'"+this.terminals_[x]+"'");D=n.showPosition?"Parse error on line "+(h+1)+":\n"+n.showPosition()+"\nExpecting "+A.join(", ")+", got '"+(this.terminals_[s]||s)+"'":"Parse error on line "+(h+1)+": Unexpected "+(s==l?"end of input":"'"+(this.terminals_[s]||s)+"'"),this.parseError(D,{text:n.match,token:this.terminals_[s]||s,line:n.yylineno,loc:q,expected:A})}if(v[0]instanceof Array&&v.length>1)throw new Error("Parse Error: multiple actions possible at state: "+u+", token: "+s);switch(v[0]){case 1:c.push(s),d.push(n.yytext),e.push(n.yylloc),c.push(v[1]),s=null,t?(s=t,t=null):(i=n.yyleng,g=n.yytext,h=n.yylineno,q=n.yylloc,j>0&&j--);break;case 2:if(y=this.productions_[v[1]][1],C.$=d[d.length-y],C._$={first_line:e[e.length-(y||1)].first_line,last_line:e[e.length-1].last_line,first_column:e[e.length-(y||1)].first_column,last_column:e[e.length-1].last_column},r&&(C._$.range=[e[e.length-(y||1)].range[0],e[e.length-1].range[1]]),w=this.performAction.apply(C,[g,i,h,o.yy,v[1],d,e].concat(m)),"undefined"!=typeof w)return w;y&&(c=c.slice(0,-1*y*2),d=d.slice(0,-1*y),e=e.slice(0,-1*y)),c.push(this.productions_[v[1]][0]),d.push(C.$),e.push(C._$),z=f[c[c.length-2]][c[c.length-1]],c.push(z);break;case 3:return!0}}return!0}},N=function(){var a={EOF:1,parseError:function(a,b){if(!this.yy.parser)throw new Error(a);this.yy.parser.parseError(a,b)},setInput:function(a,b){return this.yy=b||this.yy||{},this._input=a,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},input:function(){var a=this._input[0];this.yytext+=a,this.yyleng++,this.offset++,this.match+=a,this.matched+=a;var b=a.match(/(?:\r\n?|\n).*/g);return b?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),a},unput:function(a){var b=a.length,c=a.split(/(?:\r\n?|\n)/g);this._input=a+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-b),this.offset-=b;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),c.length-1&&(this.yylineno-=c.length-1);var e=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:c?(c.length===d.length?this.yylloc.first_column:0)+d[d.length-c.length].length-c[0].length:this.yylloc.first_column-b},this.options.ranges&&(this.yylloc.range=[e[0],e[0]+this.yyleng-b]),this.yyleng=this.yytext.length,this},more:function(){return this._more=!0,this},reject:function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},less:function(a){this.unput(this.match.slice(a))},pastInput:function(){var a=this.matched.substr(0,this.matched.length-this.match.length);return(a.length>20?"...":"")+a.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var a=this.match;return a.length<20&&(a+=this._input.substr(0,20-a.length)),(a.substr(0,20)+(a.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var a=this.pastInput(),b=new Array(a.length+1).join("-");return a+this.upcomingInput()+"\n"+b+"^"},test_match:function(a,b){var c,d,e;if(this.options.backtrack_lexer&&(e={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(e.yylloc.range=this.yylloc.range.slice(0))),d=a[0].match(/(?:\r\n?|\n).*/g),d&&(this.yylineno+=d.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:d?d[d.length-1].length-d[d.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+a[0].length},this.yytext+=a[0],this.match+=a[0],this.matches=a,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(a[0].length),this.matched+=a[0],c=this.performAction.call(this,this.yy,this,b,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),c)return c;if(this._backtrack){for(var f in e)this[f]=e[f];return!1}return!1},next:function(){if(this.done)return this.EOF;this._input||(this.done=!0);var a,b,c,d;this._more||(this.yytext="",this.match="");for(var e=this._currentRules(),f=0;f<e.length;f++)if(c=this._input.match(this.rules[e[f]]),c&&(!b||c[0].length>b[0].length)){if(b=c,d=f,this.options.backtrack_lexer){if(a=this.test_match(c,e[f]),a!==!1)return a;if(this._backtrack){b=!1;continue}return!1}if(!this.options.flex)break}return b?(a=this.test_match(b,e[d]),a!==!1?a:!1):""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var a=this.next();return a?a:this.lex()},begin:function(a){this.conditionStack.push(a)},popState:function(){var a=this.conditionStack.length-1;return a>0?this.conditionStack.pop():this.conditionStack[0]},_currentRules:function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},topState:function(a){return a=this.conditionStack.length-1-Math.abs(a||0),a>=0?this.conditionStack[a]:"INITIAL"},pushState:function(a){this.begin(a)},stateStackSize:function(){return this.conditionStack.length},options:{},performAction:function(a,b,c,d){switch(c){case 0:return 31;case 1:return 33;case 2:return"from";case 3:return 24;case 4:return 25;case 5:return 26;case 6:return 27;case 7:return 21;case 8:return 19;case 9:return 22;case 10:return 20;case 11:return 28;case 12:return 29;case 13:return 36;case 14:return 38;case 15:return 57;case 16:return 55;case 17:break;case 18:return 51;case 19:return 50;case 20:return 50;case 21:return 42;case 22:return 53;case 23:return 43;case 24:return 11;case 25:return 12;case 26:return 13;case 27:return 40;case 28:return 8;case 29:return 28;case 30:return 29;case 31:return 25;case 32:return 24;case 33:return 27;case 34:return 26;case 35:return 21;case 36:return 22;case 37:return 20;case 38:return 19;case 39:return 36;case 40:return 38;case 41:return 15;case 42:return 17;case 43:return 48;case 44:return 46;case 45:return 44;case 46:return 49;case 47:return 9;case 48:return 5}},rules:[/^(?:\s+in\b)/,/^(?:\s+notIn\b)/,/^(?:\s+from\b)/,/^(?:\s+(eq|EQ)\b)/,/^(?:\s+(seq|SEQ)\b)/,/^(?:\s+(neq|NEQ)\b)/,/^(?:\s+(sneq|SNEQ)\b)/,/^(?:\s+(lte|LTE)\b)/,/^(?:\s+(lt|LT)\b)/,/^(?:\s+(gte|GTE)\b)/,/^(?:\s+(gt|GT)\b)/,/^(?:\s+(like|LIKE)\b)/,/^(?:\s+(notLike|NOT_LIKE)\b)/,/^(?:\s+(and|AND)\b)/,/^(?:\s+(or|OR)\b)/,/^(?:\s*(null)\b)/,/^(?:\s*(true|false)\b)/,/^(?:\s+)/,/^(?:-?[0-9]+(?:\.[0-9]+)?\b)/,/^(?:'[^']*')/,/^(?:"[^"]*")/,/^(?:([a-zA-Z_$][0-9a-zA-Z_$]*))/,/^(?:^\/((?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/[imgy]{0,4})(?!\w))/,/^(?:\.)/,/^(?:\*)/,/^(?:\/)/,/^(?:\%)/,/^(?:,)/,/^(?:-)/,/^(?:=~)/,/^(?:!=~)/,/^(?:===)/,/^(?:==)/,/^(?:!==)/,/^(?:!=)/,/^(?:<=)/,/^(?:>=)/,/^(?:>)/,/^(?:<)/,/^(?:&&)/,/^(?:\|\|)/,/^(?:\+)/,/^(?:\^)/,/^(?:\()/,/^(?:\])/,/^(?:\[)/,/^(?:\))/,/^(?:!)/,/^(?:$)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48],inclusive:!0}}};return a}();return M.lexer=N,a.prototype=M,M.Parser=a,new a}();"undefined"!=typeof a&&"undefined"!=typeof c&&(c.parser=e,c.Parser=e.Parser,c.parse=function(){return e.parse.apply(e,arguments)},c.main=function(b){b[1]||(console.log("Usage: "+b[0]+" FILE"),d.exit(1));var e=a("fs").readFileSync(a("path").normalize(b[1]),"utf8");return c.parser.parse(e)},"undefined"!=typeof b&&a.main===b&&c.main(d.argv.slice(1)))},{__browserify_process:64,fs:61,path:62}],44:[function(a,b,c){!function(){"use strict";var b=a("./constraint/parser"),d=a("./nools/nool.parser");c.parseConstraint=function(a){try{return b.parse(a)}catch(c){throw new Error("Invalid expression '"+a+"'")}},c.parseRuleSet=function(a,b){return d.parse(a,b)}}()},{"./constraint/parser":43,"./nools/nool.parser":45}],45:[function(a,b,c){"use strict";var d=a("./tokens.js"),e=a("../../extended"),f=e.hash.keys,g=a("./util.js"),h=function(a,b,c){var d=a;a=a.replace(/\/\/(.*)/g,"").replace(/\r\n|\r|\n/g," ");for(var e,i=new RegExp("^("+f(b).join("|")+")");a&&-1!==(e=g.findNextTokenIndex(a));){a=a.substr(e);var j=a.match(i);if(null===j)throw new Error("Error parsing "+a);if(j=j[1],!(j in b))throw new Error("Unknown token"+j);try{a=b[j](a,c,h).replace(/^\s*|\s*$/g,"")}catch(k){throw new Error("Invalid "+j+" definition \n"+k.message+"; \nstarting at : "+d)}}};c.parse=function(a,b){var c={define:[],rules:[],scope:[],loaded:[],file:b};return h(a,d,c),c}},{"../../extended":12,"./tokens.js":46,"./util.js":47}],46:[function(require,module,exports){var process=require("__browserify_process"),utils=require("./util.js"),fs=require("fs"),extd=require("../../extended"),filter=extd.filter,indexOf=extd.indexOf,predicates=["not","or","exists"],predicateRegExp=new RegExp("^("+predicates.join("|")+") *\\((.*)\\)$","m"),predicateBeginExp=new RegExp(" *("+predicates.join("|")+") *\\(","g"),isWhiteSpace=function(a){return 0===a.replace(/[\s|\n|\r|\t]/g,"").length},joinFunc=function(a,b){return"; "+b},splitRuleLineByPredicateExpressions=function(a){var b=a.replace(/,\s*(\$?\w+\s*:)/g,joinFunc),c=filter(b.split(predicateBeginExp),function(a){return""!==a}),d=c.length,e=[];if(!d)return b;for(var f=0;d>f;f++)-1!==indexOf(predicates,c[f])?e.push([c[f],"(",c[++f].replace(/, *$/,"")].join("")):e.push(c[f].replace(/, *$/,""));return e.join(";")},ruleTokens={salience:function(){var a=/^(salience|priority)\s*:\s*(-?\d+)\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=parseInt(d[2],10);if(isNaN(e))throw new Error("Invalid salience/priority "+d[2]);return c.options.priority=e,b.replace(d[0],"")}throw new Error("invalid format")}}(),agendaGroup:function(){var a=/^(agenda-group|agendaGroup)\s*:\s*([a-zA-Z_$][0-9a-zA-Z_$]*|"[^"]*"|'[^']*')\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=d[2];if(!e)throw new Error("Invalid agenda-group "+d[2]);return c.options.agendaGroup=e.replace(/^["']|["']$/g,""),b.replace(d[0],"")}throw new Error("invalid format")}}(),autoFocus:function(){var a=/^(auto-focus|autoFocus)\s*:\s*(true|false)\s*[,;]?/;return function(b,c){if(a.test(b)){var d=b.match(a),e=d[2];if(!e)throw new Error("Invalid auto-focus "+d[2]);return c.options.autoFocus="true"===e?!0:!1,b.replace(d[0],"")}throw new Error("invalid format")}}(),"agenda-group":function(){return this.agendaGroup.apply(this,arguments)},"auto-focus":function(){return this.autoFocus.apply(this,arguments)},priority:function(){return this.salience.apply(this,arguments)},when:function(){var ruleRegExp=/^(\$?\w+) *: *(\w+)(.*)/,constraintRegExp=/(\{ *(?:["']?\$?\w+["']?\s*:\s*["']?\$?\w+["']? *(?:, *["']?\$?\w+["']?\s*:\s*["']?\$?\w+["']?)*)+ *\})/,fromRegExp=/(\bfrom\s+.*)/,parseRules=function(str){for(var rules=[],ruleLines=str.split(";"),l=ruleLines.length,ruleLine,i=0;l>i&&(ruleLine=ruleLines[i].replace(/^\s*|\s*$/g,"").replace(/\n/g,""));i++)if(!isWhiteSpace(ruleLine)){var rule=[];if(predicateRegExp.test(ruleLine)){var m=ruleLine.match(predicateRegExp),pred=m[1].replace(/^\s*|\s*$/g,"");if(rule.push(pred),ruleLine=m[2].replace(/^\s*|\s*$/g,""),"or"===pred){rule=rule.concat(parseRules(splitRuleLineByPredicateExpressions(ruleLine))),rules.push(rule);continue}}var parts=ruleLine.match(ruleRegExp);if(!parts||!parts.length)throw new Error("Invalid constraint "+ruleLine);rule.push(parts[2],parts[1]);var constraints=parts[3].replace(/^\s*|\s*$/g,""),hashParts=constraints.match(constraintRegExp),from=null,fromMatch;if(hashParts){var hash=hashParts[1],constraint=constraints.replace(hash,"");fromRegExp.test(constraint)&&(fromMatch=constraint.match(fromRegExp),from=fromMatch[0],constraint=constraint.replace(fromMatch[0],"")),constraint&&rule.push(constraint.replace(/^\s*|\s*$/g,"")),hash&&rule.push(eval("("+hash.replace(/(\$?\w+)\s*:\s*(\$?\w+)/g,'"$1" : "$2"')+")"))}else constraints&&!isWhiteSpace(constraints)&&(fromRegExp.test(constraints)&&(fromMatch=constraints.match(fromRegExp),from=fromMatch[0],constraints=constraints.replace(fromMatch[0],"")),rule.push(constraints));from&&rule.push(from),rules.push(rule)}return rules};return function(a,b){var c=a.replace(/^when\s*/,"").replace(/^\s*|\s*$/g,"");if("{"===utils.findNextToken(c)){var d=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(d,""),b.constraints=parseRules(d.replace(/^\{\s*|\}\s*$/g,"")),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}}(),then:function(){return function(a,b){if(b.action)throw new Error("action already defined for rule"+b.name);var c=a.replace(/^then\s*/,"").replace(/^\s*|\s*$/g,"");if("{"===utils.findNextToken(c)){var d=utils.getTokensBetween(c,"{","}",!0).join("");if(c=c.replace(d,""),b.action||(b.action=d.replace(/^\{\s*|\}\s*$/g,"")),!isWhiteSpace(c))throw new Error("Error parsing then block "+a);return c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}}()},topLevelTokens={"/":function(a){return a.match(/^\/\*/)?a.replace(/\/\*.*?\*\//,""):a},define:function(a,b){var c=a.replace(/^define\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*)/);if(d){if(c=c.replace(d[0],"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(c)){d=d[1];var e=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(e,""),b.define.push({name:d,properties:"("+e+")"}),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},"import":function(a,b,c){if("undefined"!=typeof window)throw new Error("import cannot be used in a browser");var d=a.replace(/^import\s*/,"");if("("===utils.findNextToken(d)){var e=utils.getParamList(d);if(d=d.replace(e,"").replace(/^\s*|\s*$/g,""),";"===utils.findNextToken(d)&&(d=d.replace(/\s*;/,"")),e=e.replace(/[\(|\)]/g,"").split(","),1===e.length){if(e=utils.resolve(b.file||process.cwd(),e[0].replace(/["|']/g,"")),-1===indexOf(b.loaded,e)){var f=b.file;b.file=e,c(fs.readFileSync(e,"utf8"),topLevelTokens,b),
  b.loaded.push(e),b.file=f}return d}throw new Error("import accepts a single file")}throw new Error("unexpected token : expected : '(' found : '"+utils.findNextToken(d)+"'")},global:function(a,b){var c=a.replace(/^global\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*\s*)/);if(d){if(c=c.replace(d[0],"").replace(/^\s*|\s*$/g,""),"="===utils.findNextToken(c)){d=d[1].replace(/^\s+|\s+$/g,"");var e=utils.getTokensBetween(c,"=",";",!0).join(""),f=e.substring(1,e.length-1);if(f=f.replace(/^\s+|\s+$/g,""),/^require\(/.test(f)){var g=utils.getParamList(f.replace("require")).replace(/[\(|\)]/g,"").split(",");1===g.length&&(g=g[0].replace(/["|']/g,""),f=["require('",utils.resolve(b.file||process.cwd(),g),"')"].join(""))}return b.scope.push({name:d,body:f}),c=c.replace(e,"")}throw new Error("unexpected token : expected : '=' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},"function":function(a,b){var c=a.replace(/^function\s*/,""),d=c.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*)\s*/);if(d){if(c=c.replace(d[0],""),"("===utils.findNextToken(c)){d=d[1];var e=utils.getParamList(c);if(c=c.replace(e,"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(c)){var f=utils.getTokensBetween(c,"{","}",!0).join("");return c=c.replace(f,""),b.scope.push({name:d,body:"function"+e+f}),c}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(c)+"'")}throw new Error("unexpected token : expected : '(' found : '"+utils.findNextToken(c)+"'")}throw new Error("missing name")},rule:function(a,b,c){var d=a.replace(/^rule\s*/,""),e=d.match(/^([a-zA-Z_$][0-9a-zA-Z_$]*|"[^"]*"|'[^']*')/);if(e){if(d=d.replace(e[0],"").replace(/^\s*|\s*$/g,""),"{"===utils.findNextToken(d)){e=e[1].replace(/^["']|["']$/g,"");var f={name:e,options:{},constraints:null,action:null},g=utils.getTokensBetween(d,"{","}",!0).join("");return d=d.replace(g,""),c(g.replace(/^\{\s*|\}\s*$/g,""),ruleTokens,f),b.rules.push(f),d}throw new Error("unexpected token : expected : '{' found : '"+utils.findNextToken(d)+"'")}throw new Error("missing name")}};module.exports=topLevelTokens},{"../../extended":12,"./util.js":47,__browserify_process:64,fs:61}],47:[function(a,b,c){var d=a("__browserify_process"),e=a("path"),f=/[\s|\n|\r|\t]/,g=e.sep||("win32"===d.platform?"\\":"/"),h={"{":"}","}":"{","(":")",")":"(","[":"]"},i=c.getTokensBetween=function(a,b,c,d){var e=0,f=[];b||(b=h[c],e=1),c||(c=h[b]),a=Object(a);for(var g,i=!1,j=0,k=!1;g=a.charAt(j++);)if(g===b)e++,i?f.push(g):(i=!0,d&&f.push(g));else if(g===c&&j){if(e--,0===e){d&&f.push(g),k=!0;break}f.push(g)}else i&&f.push(g);if(!k)throw new Error("Unable to match "+b+" in "+a);return f};c.getParamList=function(a){return i(a,"(",")",!0).join("")},c.resolve=function(a,b){return"win32"===d.platform&&(b=b.replace(/\//g,"\\")),""!==e.extname(a)&&(a=e.dirname(a)),1===b.split(g).length?b:e.resolve(a,b).replace(/\\/g,"/")};var j=c.findNextTokenIndex=function(a,b,c){b=b||0,c=c||a.length;var d=-1,e=a.length;for((!c||c>e)&&(c=e);c>b;b++){var g=a.charAt(b);if(!f.test(g)){d=b;break}}return d};c.findNextToken=function(a,b,c){return a.charAt(j(a,b,c))}},{__browserify_process:64,path:62}],48:[function(a,b,c){"use strict";var d=a("./extended"),e=d.isEmpty,f=d.merge,g=d.forEach,h=d.declare,i=a("./constraintMatcher"),j=a("./constraint"),k=j.EqualityConstraint,l=j.FromConstraint,m=0,n=h({}),o=n.extend({instance:{constructor:function(a,b,c,d,h){h=h||{},this.id=m++,this.type=a,this.alias=b,this.conditions=c,this.pattern=h.pattern;var k=[new j.ObjectConstraint(a)],l=i.toConstraints(c,f({alias:b},h));if(l.length)k=k.concat(l);else{var n=new j.TrueConstraint;k.push(n)}if(d&&!e(d)){var o=new j.HashConstraint(d);k.push(o)}g(k,function(a){a.set("alias",b)}),this.constraints=k},getSpecificity:function(){for(var a=this.constraints,b=0,c=0,d=a.length;d>c;c++)a[c]instanceof k&&b++;return b},hasConstraint:function(a){return d.some(this.constraints,function(b){return b instanceof a})},hashCode:function(){return[this.type,this.alias,d.format("%j",this.conditions)].join(":")},toString:function(){return d.format("%j",this.constraints)}}}).as(c,"ObjectPattern"),p=o.extend({instance:{constructor:function(a,b,c,d,e,f){this._super([a,b,c,d,f]),this.from=new l(e,f)},hasConstraint:function(a){return d.some(this.constraints,function(b){return b instanceof a})},getSpecificity:function(){return this._super(arguments)+1},hashCode:function(){return[this.type,this.alias,d.format("%j",this.conditions),this.from.from].join(":")},toString:function(){return d.format("%j from %s",this.constraints,this.from.from)}}}).as(c,"FromPattern");p.extend().as(c,"FromNotPattern"),o.extend().as(c,"NotPattern"),o.extend().as(c,"ExistsPattern"),p.extend().as(c,"FromExistsPattern"),n.extend({instance:{constructor:function(a,b){this.id=m++,this.leftPattern=a,this.rightPattern=b},hashCode:function(){return[this.leftPattern.hashCode(),this.rightPattern.hashCode()].join(":")},getSpecificity:function(){return this.rightPattern.getSpecificity()+this.leftPattern.getSpecificity()},getters:{constraints:function(){return this.leftPattern.constraints.concat(this.rightPattern.constraints)}}}}).as(c,"CompositePattern");var q=h({instance:{constructor:function(){this.id=m++,this.recency=0}}}).as(c,"InitialFact");o.extend({instance:{constructor:function(){this._super([q,"__i__",[],{}])},assert:function(){return!0}}}).as(c,"InitialFactPattern")},{"./constraint":8,"./constraintMatcher":9,"./extended":12}],49:[function(a,b,c){"use strict";function d(a,b,c,d){f(b)?(d=c,c=b):b=b||{};var g=e.every(c,function(a){return f(a)});g&&1===c.length&&(c=c[0],g=!1);var h=[],i=b.scope||{};if(c.scope=i,g){for(var j,k=function(a,b){m[b]?e(m).forEach(function(b){b.push(a)}):(m[b]=0===b?[]:m[b-1].slice(),0!==b&&m[b].pop(),m[b].push(a))},l=c.length,m=[],n=0;l>n;n++)j=c[n],j.scope=i,e.forEach(y(j),k);h=e.map(m,function(c){for(var e=null,f=0;f<c.length;f++)e=null===e?new t(c[f++],c[f]):new t(e,c[f]);return new z(a,b,e,d)})}else h=e.map(y(c),function(c){return new z(a,b,c,d)});return h}var e=a("./extended"),f=e.isArray,g=e.Promise,h=e.declare,i=e.isHash,j=e.isString,k=e.format,l=a("./parser"),m=a("./pattern"),n=m.ObjectPattern,o=m.FromPattern,p=m.NotPattern,q=m.ExistsPattern,r=m.FromNotPattern,s=m.FromExistsPattern,t=m.CompositePattern,u=function(a){return"function"==typeof a?a:l.parseConstraint(a)},v=e.switcher().isUndefinedOrNull(function(){return null}).isLike(/^from +/,function(a){return{from:a.replace(/^from +/,"").replace(/^\s*|\s*$/g,"")}}).def(function(a){throw new Error("invalid rule constraint option "+a)}).switcher(),w=e.switcher().isLength(1,function(a){throw new Error("invalid rule constraint "+k("%j",[a]))}).isLength(2,function(a){return a.push("true"),a}).isLength(3,function(a){if(j(a[2])&&/^from +/.test(a[2])){var b=a[2];a.splice(2,0,"true"),a[3]=null,a[4]=v(b)}else i(a[2])&&a.splice(2,0,"true");return a}).isLength(4,function(a){return j(a[3])&&(a.splice(3,0,null),a[4]=v(a[4])),a}).def(function(a){return 5===a.length&&(a[4]=v(a[4])),a}).switcher(),x=function(a,b){b=b||{};var c=e.switcher().isEq("string",function(){return String}).isEq("date",function(){return Date}).isEq("array",function(){return Array}).isEq("boolean",function(){return Boolean}).isEq("regexp",function(){return RegExp}).isEq("number",function(){return Number}).isEq("object",function(){return Object}).isEq("hash",function(){return Object}).def(function(a){throw new TypeError("invalid param type "+a)}).switcher(),d=e.switcher().isString(function(a){var d=b[a];return d?d:c(a.toLowerCase())}).isFunction(function(a){return a}).deepEqual([],function(){return Array}).def(function(a){throw new Error("invalid param type "+a)}).switcher();return d(a)},y=e.switcher().containsAt("or",0,function(a){return a.shift(),e(a).map(function(b){return b.scope=a.scope,y(b)}).flatten().value()}).containsAt("not",0,function(a){return a.shift(),a=w(a),a[4]&&a[4].from?[new r(x(a[0],a.scope),a[1]||"m",u(a[2]||"true"),a[3]||{},u(a[4].from),{scope:a.scope,pattern:a[2]})]:[new p(x(a[0],a.scope),a[1]||"m",u(a[2]||"true"),a[3]||{},{scope:a.scope,pattern:a[2]})]}).containsAt("exists",0,function(a){return a.shift(),a=w(a),a[4]&&a[4].from?[new s(x(a[0],a.scope),a[1]||"m",u(a[2]||"true"),a[3]||{},u(a[4].from),{scope:a.scope,pattern:a[2]})]:[new q(x(a[0],a.scope),a[1]||"m",u(a[2]||"true"),a[3]||{},{scope:a.scope,pattern:a[2]})]}).def(function(a){return"function"==typeof a?[a]:(a=w(a),a[4]&&a[4].from?[new o(x(a[0],a.scope),a[1]||"m",u(a[2]||"true"),a[3]||{},u(a[4].from),{scope:a.scope,pattern:a[2]})]:[new n(x(a[0],a.scope),a[1]||"m",u(a[2]||"true"),a[3]||{},{scope:a.scope,pattern:a[2]})])}).switcher(),z=h({instance:{constructor:function(a,b,c,d){this.name=a,this.pattern=c,this.cb=d,b.agendaGroup&&(this.agendaGroup=b.agendaGroup,this.autoFocus=e.isBoolean(b.autoFocus)?b.autoFocus:!1),this.priority=b.priority||b.salience||0},fire:function(a,b){var c=new g,d=this.cb;try{3===d.length?d.call(a,b.factHash,a,c.resolve):c=d.call(a,b.factHash,a)}catch(e){c.errback(e)}return c}}});c.createRule=d},{"./extended":12,"./parser":44,"./pattern":48}],50:[function(a,b,c){"use strict";var d=a("declare.js"),e=a("./linkedList"),f=a("./pattern").InitialFact,g=0,h=d({instance:{constructor:function(a){this.object=a,this.recency=0,this.id=g++},equals:function(a){return a===this.object},hashCode:function(){return this.id}}});d({instance:{constructor:function(){this.recency=0,this.facts=new e},dispose:function(){this.facts.clear()},getFacts:function(){for(var a,b={next:this.facts.head},c=[],d=0;b=b.next;)(a=b.data.object)instanceof f||(c[d++]=a);return c},getFactsByType:function(a){for(var b={next:this.facts.head},c=[],d=0;b=b.next;){var e=b.data.object;e instanceof f||!(e instanceof a||e.constructor===a)||(c[d++]=e)}return c},getFactHandle:function(a){for(var b,c={next:this.facts.head};c=c.next;){var d=c.data;if(d.equals(a))return d}return b||(b=new h(a),b.recency=this.recency++),b},modifyFact:function(a){for(var b={next:this.facts.head};b=b.next;){var c=b.data;if(c.equals(a))return c.recency=this.recency++,c}throw new Error("the fact to modify does not exist")},assertFact:function(a){var b=new h(a);return b.recency=this.recency++,this.facts.push(b),b},retractFact:function(a){for(var b=this.facts,c={next:b.head};c=c.next;){var d=c.data;if(d.equals(a))return b.remove(c),d}throw new Error("the fact to remove does not exist")}}}).as(c,"WorkingMemory")},{"./linkedList":16,"./pattern":48,"declare.js":55}],51:[function(a,b,c){(function(){"use strict";function d(a,b){function c(a,b){var c=-1,d=0,e=a.length,f=[];for(b=b||0,c+=b;++c<e;)f[d++]=a[c];return f}var d=(Array.prototype.slice,b.isArguments);return a.define(d,{toArray:c}).expose({argsToArray:c})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended"],function(a,b){return d(a,b)}):this.argumentsExtended=d(this.extended,this.isExtended)}).call(this)},{extended:56,"is-extended":66}],52:[function(a,b,c){(function(){"use strict";function d(a,b,c){function d(a,b){return o(b,function(b,c){return N(c)||(c=[c]),c.unshift(a),b.unshift(c),b},[])}function e(a,b,c){for(var d=[],e=0;e<b.length;e++)d.push([a].concat(y(b,e)).slice(0,c));return d}function f(a,b){var c,d,e=[],f=-1;for(d=a.length;++f<d;)c=a[f],-1!==g(b,c)&&e.push(c);return e}function g(a,b,c){for(var d=(c||0)-1,e=a.length;++d<e;)if(a[d]===b)return d;return-1}function h(a,b,c){if(!N(a))throw new TypeError;var d=Object(a),e=d.length>>>0;if(0===e)return-1;var f=e;arguments.length>2&&(f=Number(arguments[2]),f!==f?f=0:0!==f&&f!==1/0&&f!==-(1/0)&&(f=(f>0||-1)*P(Q(f))));for(var g=f>=0?R(f,e-1):e-Q(f);g>=0;g--)if(g in d&&d[g]===b)return g;return-1}function i(a,b,c){if(a&&X&&X===a.filter)return a.filter(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=[],g=0;e>g;g++)if(g in d){var h=d[g];b.call(c,h,g,d)&&f.push(h)}return f}function j(a,b,c){if(!N(a)||"function"!=typeof b)throw new TypeError;if(a&&T&&T===a.forEach)return a.forEach(b,c),a;for(var d=0,e=a.length;e>d;++d)b.call(c||a,a[d],d,a);return a}function k(a,b,c){if(a&&Y&&Y===a.every)return a.every(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=0;e>f;f++)if(f in d&&!b.call(c,d[f],f,d))return!1;return!0}function l(a,b,c){if(a&&Z&&Z===a.some)return a.some(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=0;e>f;f++)if(f in d&&b.call(c,d[f],f,d))return!0;return!1}function m(a,b,c){if(a&&U&&U===a.map)return a.map(b,c);if(!N(a)||"function"!=typeof b)throw new TypeError;for(var d=Object(a),e=d.length>>>0,f=[],g=0;e>g;g++)g in d&&f.push(b.call(c,d[g],g,d));return f}function n(a,b,c){var d=arguments.length>2;if(a&&V&&V===a.reduce)return d?a.reduce(b,c):a.reduce(b);if(!N(a)||"function"!=typeof b)throw new TypeError;var e=0,f=a.length>>0;if(arguments.length<3){if(0===f)throw new TypeError("Array length is 0 and no second argument");c=a[0],e=1}else c=arguments[2];for(;f>e;)e in a&&(c=b.call(void 0,c,a[e],e,a)),++e;return c}function o(a,b,c){var d=arguments.length>2;if(a&&W&&W===a.reduceRight)return d?a.reduceRight(b,c):a.reduceRight(b);if(!N(a)||"function"!=typeof b)throw new TypeError;var e=Object(a),f=e.length>>>0;if(0===f&&2===arguments.length)throw new TypeError;var g=f-1;if(arguments.length>=3)c=arguments[2];else for(;;)if(g in a){c=a[g--];break}for(;g>=0;)g in e&&(c=b.call(void 0,c,e[g],g,e)),g--;return c}function p(a){var c=[];if(null!==a){var d=$(arguments);if(1===d.length)if(N(a))c=a;else if(b.isHash(a))for(var e in a)a.hasOwnProperty(e)&&c.push([e,a[e]]);else c.push(a);else j(d,function(a){c=c.concat(p(a))})}return c}function q(a){return a=a||[],a.length?n(a,function(a,b){return a+b}):0}function r(a){if(a=a||[],a.length){var c=q(a);if(b.isNumber(c))return c/a.length;throw new Error("Cannot average an array of non numbers.")}return 0}function s(a,b){return _(a,b)}function t(a,b){return _(a,b)[0]}function u(a,b){return _(a,b)[a.length-1]}function v(a){var b=a,c=J($(arguments,1));return N(a)&&(b=i(a,function(a){return-1===g(c,a)})),b}function w(a){var b,c=[],d=-1,e=0;if(a)for(b=a.length;++d<b;){var f=a[d];-1===g(c,f)&&(c[e++]=f)}return c}function x(a){return w(a)}function y(a,b){var c=a.slice();return"number"!=typeof b&&(b=1),b&&N(a)?(b>0?(c.push(c.shift()),b--):(c.unshift(c.pop()),b++),y(c,b)):c}function z(a,b){var c=[];if(N(a)){var d=a.slice(0);"number"!=typeof b&&(b=a.length),b?b<=a.length&&(c=n(a,function(a,c,f){var g;return g=b>1?e(c,y(d,f).slice(1),b):[[c]],a.concat(g)},[])):c=[[]]}return c}function A(){var a=[],c=$(arguments);if(c.length>1){var d=c.shift();N(d)&&(a=n(d,function(a,d,e){for(var f=[d],g=0;g<c.length;g++){var h=c[g];N(h)&&!b.isUndefined(h[e])?f.push(h[e]):f.push(null)}return a.push(f),a},[]))}return a}function B(a){var b=[];if(N(a)&&a.length){var c;j(a,function(a){!N(a)||c&&a.length!==c.length||(j(a,function(a,c){b[c]||(b[c]=[]),b[c].push(a)}),c=a)})}return b}function C(a,b){var c=[];if(b=$(arguments),a=b.shift(),N(a)&&b.length)for(var d=0,e=b.length;e>d;d++)c.push(a[b[d]]||null);return c}function D(){var a=[],b=$(arguments);if(b.length>1){for(var c=0,d=b.length;d>c;c++)a=a.concat(b[c]);a=w(a)}return a}function E(){var a,b,c=[],d=-1;if(a=arguments.length>1?$(arguments):arguments[0],N(a))for(c=a[0],d=0,b=a.length;++d<b;)c=f(c,a[d]);return w(c)}function F(a){var b=[];return N(a)&&a.length&&(b=n(a,function(a,b){var c=m(a,function(a){return a.concat(b)});return a.concat(c)},[[]])),b}function G(a,b){var c=[];return N(a)&&N(b)&&a.length&&b.length&&(c=d(a[0],b).concat(G(a.slice(1),b))),c}function H(a){var c=[];return N(a)&&a.length&&(c=i(a,function(a){return!b.isUndefinedOrNull(a)})),c}function I(a,c){c=b.isNumber(c)?c:1,c||(c=1),a=p(a||[]);for(var d=[],e=0;++e<=c;)d=d.concat(a);return d}function J(a){var b,c=$(arguments);return b=c.length>1?c:p(a),n(b,function(a,b){return a.concat(b)},[])}function K(a,b){b=b.split(".");var c=a.slice(0);return j(b,function(a){var b=a.match(/(\w+)\(\)$/);c=m(c,function(c){return b?c[b[1]]():c[a]})}),c}function L(a,b,c){return c=$(arguments,2),m(a,function(a){var d=M(b)?a[b]:b;return d.apply(a,c)})}var M=b.isString,N=Array.isArray||b.isArray,O=b.isDate,P=Math.floor,Q=Math.abs,R=(Math.max,Math.min),S=Array.prototype,T=(S.indexOf,S.forEach),U=S.map,V=S.reduce,W=S.reduceRight,X=S.filter,Y=S.every,Z=S.some,$=c.argsToArray,_=function(){var a=function(a,b){return k(a,b)},b=function(a,b){return a-b},c=function(a,b){return a.getTime()-b.getTime()};return function(d,e){var f=[];return N(d)&&(f=d.slice(),e?"function"==typeof e?f.sort(e):f.sort(function(a,b){var c=a[e],d=b[e];return M(c)&&M(d)?c>d?1:d>c?-1:0:O(c)&&O(d)?c.getTime()-d.getTime():c-d}):a(f,M)?f.sort():a(f,O)?f.sort(c):f.sort(b)),f}}(),aa={toArray:p,sum:q,avg:r,sort:s,min:t,max:u,difference:v,removeDuplicates:w,unique:x,rotate:y,permutations:z,zip:A,transpose:B,valuesAt:C,union:D,intersect:E,powerSet:F,cartesian:G,compact:H,multiply:I,flatten:J,pluck:K,invoke:L,forEach:j,map:m,filter:i,reduce:n,reduceRight:o,some:l,every:k,indexOf:g,lastIndexOf:h};return a.define(N,aa).expose(aa)}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","arguments-extended"],function(a,b,c){return d(a,b,c)}):this.arrayExtended=d(this.extended,this.isExtended,this.argumentsExtended)}).call(this)},{"arguments-extended":51,extended:56,"is-extended":66}],53:[function(a,b,c){(function(){"use strict";function d(a,b,c){function d(a,b,c,d){a=""+a,c=c||" ";for(var e=a.length;b>e;)d?a+=c:a=c+a,e++;return a}function e(a,c,d){var f=a;if(b.isString(f)){if(a.length>c)if(d){var g=a.length;f=a.substring(g-c,g)}else f=a.substring(0,c)}else f=e(""+f,c);return f}function f(a,c,d){if(!b.isArray(a)||"function"!=typeof c)throw new TypeError;for(var e=Object(a),f=e.length>>>0,g=0;f>g;g++)if(g in e&&!c.call(d,e[g],g,e))return!1;return!0}function g(a,b){return A.difference(new Date(a.getFullYear(),0,1,a.getHours()),a,null,b)+1}function h(a,b,c){b=b||0;var d=a[c?"getUTCFullYear":"getFullYear"](),e=new Date(d,0,1).getDay(),f=(e-b+7)%7,h=o((g(a)+f-1)/7);return e===b&&h++,h}function i(a){var b=a.toString(),c="",d=b.indexOf("(");return d>-1&&(c=b.substring(++d,b.indexOf(")"))),c}function j(a,b){return a.replace(/([a-z])\1*/gi,function(a){var c,d=a.charAt(0),e=a.length,f="0?",g="0{0,2}";if("y"===d)c="\\d{2,4}";else if("M"===d)c=e>2?"\\S+?":"1[0-2]|"+f+"[1-9]";else if("D"===d)c="[12][0-9][0-9]|3[0-5][0-9]|36[0-6]|"+g+"[1-9][0-9]|"+f+"[1-9]";else if("d"===d)c="3[01]|[12]\\d|"+f+"[1-9]";else if("w"===d)c="[1-4][0-9]|5[0-3]|"+f+"[1-9]";else if("E"===d)c="\\S+";else if("h"===d)c="1[0-2]|"+f+"[1-9]";else if("K"===d)c="1[01]|"+f+"\\d";else if("H"===d)c="1\\d|2[0-3]|"+f+"\\d";else if("k"===d)c="1\\d|2[0-4]|"+f+"[1-9]";else if("m"===d||"s"===d)c="[0-5]\\d";else if("S"===d)c="\\d{"+e+"}";else if("a"===d){var h="AM",i="PM";c=h+"|"+i,h!==h.toLowerCase()&&(c+="|"+h.toLowerCase()),i!==i.toLowerCase()&&(c+="|"+i.toLowerCase()),c=c.replace(/\./g,"\\.")}else c="v"===d||"z"===d||"Z"===d||"G"===d||"q"===d||"Q"===d?".*":" "===d?"\\s*":d+"*";return b&&b.push(a),"("+c+")"}).replace(/[\xa0 ]/g,"[\\s\\xa0]")}function k(a){B[a+"sFromNow"]=function(b){return A.add(new Date,a,b)},B[a+"sAgo"]=function(b){return A.add(new Date,a,-b)}}for(var l=function(){function a(a,b,c){return a=a.replace(/s$/,""),e.hasOwnProperty(a)?e[a](b,c):[c,"UTC"+a.charAt(0).toUpperCase()+a.substring(1)+"s",!1]}function b(a,b,c,e){return a=a.replace(/s$/,""),d(f[a](b,c,e))}var c=Math.floor,d=Math.round,e={day:function(a,b){return[b,"Date",!1]},weekday:function(a,b){var c,d,e=b%5,f=a.getDay(),g=0;e?(c=e,d=parseInt(b/5,10)):(c=b>0?5:-5,d=b>0?(b-5)/5:(b+5)/5),6===f&&b>0?g=1:0===f&&0>b&&(g=-1);var h=f+c;return(0===h||6===h)&&(g=b>0?2:-2),[7*d+c+g,"Date",!1]},year:function(a,b){return[b,"FullYear",!0]},week:function(a,b){return[7*b,"Date",!1]},quarter:function(a,b){return[3*b,"Month",!0]},month:function(a,b){return[b,"Month",!0]}},f={quarter:function(a,b,d){var e=b.getFullYear()-a.getFullYear(),f=a[d?"getUTCMonth":"getMonth"](),g=b[d?"getUTCMonth":"getMonth"](),h=c(f/3)+1,i=c(g/3)+1;return i+=4*e,i-h},weekday:function(a,c,d){var e,f=b("day",a,c,d),g=f%7;if(0===g)f=5*b("week",a,c,d);else{var h=0,i=a[d?"getUTCDay":"getDay"](),j=c[d?"getUTCDay":"getDay"]();e=parseInt(f/7,10);var k=new Date(+a);k.setDate(k[d?"getUTCDate":"getDate"]()+7*e);var l=k[d?"getUTCDay":"getDay"]();f>0?6===i||6===j?h=-1:0===i?h=0:(0===j||l+g>5)&&(h=-2):0>f&&(6===i?h=0:0===i||0===j?h=1:(6===j||0>l+g)&&(h=2)),f+=h,f-=2*e}return f},year:function(a,b){return b.getFullYear()-a.getFullYear()},month:function(a,b,c){var d=a[c?"getUTCMonth":"getMonth"](),e=b[c?"getUTCMonth":"getMonth"]();return e-d+12*(b.getFullYear()-a.getFullYear())},week:function(a,c,e){return d(b("day",a,c,e)/7)},day:function(a,b){return 1.1574074074074074e-8*(b.getTime()-a.getTime())},hour:function(a,b){return 2.7777777777777776e-7*(b.getTime()-a.getTime())},minute:function(a,b){return 16666666666666667e-21*(b.getTime()-a.getTime())},second:function(a,b){return.001*(b.getTime()-a.getTime())},millisecond:function(a,b){return b.getTime()-a.getTime()}};return{addTransform:a,differenceTransform:b}}(),m=l.addTransform,n=l.differenceTransform,o=Math.floor,p=Math.round,q=Math.min,r=Math.pow,s=Math.ceil,t=Math.abs,u=["January","February","March","April","May","June","July","August","September","October","November","December"],v=["Jan.","Feb.","Mar.","Apr.","May.","Jun.","Jul.","Aug.","Sep.","Oct.","Nov.","Dec."],w=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],x=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],y=["Before Christ","Anno Domini"],z=["BC","AD"],A={getDaysInMonth:function(a){var b=a.getMonth(),c=[31,28,31,30,31,30,31,31,30,31,30,31];return 1===b&&A.isLeapYear(a)?29:c[b]},isLeapYear:function(a,b){var c=a[b?"getUTCFullYear":"getFullYear"]();return c%400===0||c%4===0&&c%100!==0},isWeekend:function(a,b){var c=(a||new Date)[b?"getUTCDay":"getDay"]();return 0===c||6===c},getTimezoneName:i,compare:function(a,b,c){return a=new Date(+a),b=new Date(+(b||new Date)),"date"===c?(a.setHours(0,0,0,0),b.setHours(0,0,0,0)):"time"===c&&(a.setFullYear(0,0,0),b.setFullYear(0,0,0)),a>b?1:b>a?-1:0},add:function(a,b,c){var d=m(b,a,c||0);c=d[0];var e=d[1],f=new Date(+a),g=d[2];return e&&f["set"+e](f["get"+e]()+c),g&&f.getDate()<a.getDate()&&f.setDate(0),f},difference:function(a,b,c,d){return b=b||new Date,c=c||"day",n(c,a,b,d)},format:function(a,b,c){c=c||!1;var f,j,k,l,m,n,q,A;return c?(f=a.getUTCFullYear(),j=a.getUTCMonth(),k=a.getUTCDay(),l=a.getUTCDate(),m=a.getUTCHours(),n=a.getUTCMinutes(),q=a.getUTCSeconds(),A=a.getUTCMilliseconds()):(f=a.getFullYear(),j=a.getMonth(),l=a.getDate(),k=a.getDay(),m=a.getHours(),n=a.getMinutes(),q=a.getSeconds(),A=a.getMilliseconds()),b.replace(/([A-Za-z])\1*/g,function(b){var B,C,D=b.charAt(0),E=b.length;if("d"===D)B=""+l,C=!0;else if("H"!==D||B)if("m"!==D||B)if("s"===D)B||(B=""+q),C=!0;else if("G"===D)B=(4>E?z:y)[0>f?0:1];else if("y"===D)B=f,E>1&&(2===E?B=e(""+B,2,!0):C=!0);else if("Q"===D.toUpperCase())B=s((j+1)/3),C=!0;else if("M"===D)3>E?(B=j+1,C=!0):B=(3===E?v:u)[j];else if("w"===D)B=h(a,0,c),C=!0;else if("D"===D)B=g(a,c),C=!0;else if("E"===D)3>E?(B=k+1,C=!0):B=(-3===E?x:w)[k];else if("a"===D)B=12>m?"AM":"PM";else if("h"===D)B=m%12||12,C=!0;else if("K"===D)B=m%12,C=!0;else if("k"===D)B=m||24,C=!0;else if("S"===D)B=p(A*r(10,E-3)),C=!0;else if("z"===D||"v"===D||"Z"===D){if(B=i(a),"z"!==D&&"v"!==D||B||(E=4),!B||"Z"===D){var F=a.getTimezoneOffset(),G=[F>=0?"-":"+",d(o(t(F)/60),2,"0"),d(t(F)%60,2,"0")];4===E&&(G.splice(0,0,"GMT"),G.splice(3,0,":")),B=G.join("")}}else B=b;else B=""+n,C=!0;else B=""+m,C=!0;return C&&(B=d(B,E,"0")),B})}},B={},C=["year","month","day","hour","minute","second"],D=0,E=C.length;E>D;D++)k(C[D]);var F={parseDate:function(a,b){if(!b)throw new Error("format required when calling dateExtender.parse");var d=[],e=j(b,d),g=new RegExp("^"+e+"$","i"),h=g.exec(a);if(!h)return null;var i=[1970,0,1,0,0,0,0],k="",l=f(h,function(a,b){if(b){var e=d[b-1],f=e.length,g=e.charAt(0);if("y"===g)if(100>a){a=parseInt(a,10);var h=""+(new Date).getFullYear(),j=100*h.substring(0,2),l=q(h.substring(2,4)+20,99);i[0]=l>a?j+a:j-100+a}else i[0]=a;else if("M"===g){if(f>2){var m,n,o=u;3===f&&(o=v),a=a.replace(".","").toLowerCase();var p=!1;for(m=0,n=o.length;n>m&&!p;m++){var r=o[m].replace(".","").toLocaleLowerCase();r===a&&(a=m,p=!0)}if(!p)return!1}else a--;i[1]=a}else if("E"===g||"e"===g){var s=w;3===f&&(s=x),a=a.toLowerCase(),s=c.map(s,function(a){return a.toLowerCase()});var t=c.indexOf(s,a);if(-1===t){if(a=parseInt(a,10),isNaN(a)||a>s.length)return!1}else a=t}else if("D"===g||"d"===g)"D"===g&&(i[1]=0),i[2]=a;else if("a"===g){var y="am",z="pm",A=/\./g;a=a.replace(A,"").toLowerCase(),k=a===z?"p":a===y?"a":""}else"k"===g||"h"===g||"H"===g||"K"===g?("k"===g&&24===+a&&(a=0),i[3]=a):"m"===g?i[4]=a:"s"===g?i[5]=a:"S"===g&&(i[6]=a)}return!0});if(l){var m=+i[3];"p"===k&&12>m?i[3]=m+12:"a"===k&&12===m&&(i[3]=0);var n=new Date(i[0],i[1],i[2],i[3],i[4],i[5],i[6]),o=-1!==c.indexOf(d,"d"),p=-1!==c.indexOf(d,"M"),r=i[1],s=i[2],t=n.getMonth(),y=n.getDate();return p&&t>r||o&&y>s?null:n}return null}},G=a.define(b.isDate,A).define(b.isString,F).define(b.isNumber,B);for(D in A)A.hasOwnProperty(D)&&(G[D]=A[D]);for(D in F)F.hasOwnProperty(D)&&(G[D]=F[D]);for(D in B)B.hasOwnProperty(D)&&(G[D]=B[D]);return G}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","array-extended"],function(a,b,c){return d(a,b,c)}):this.dateExtended=d(this.extended,this.isExtended,this.arrayExtended)}).call(this)},{"array-extended":52,extended:56,"is-extended":66}],54:[function(a,b,c){!function(){function a(){function a(a,b){return b=b||0,x.call(a,b)}function b(a){return"[object Array]"===Object.prototype.toString.call(a)}function c(a){var b;return null!==a&&a!==b&&"object"==typeof a}function d(a){var b=c(a);return b&&a.constructor===Object}function e(a,b){if(a&&a.length)for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}function f(a,b,c){var d,f;for(d in b)b.hasOwnProperty(d)&&-1===e(c,d)&&(f=b[d],d in a&&a[d]===f||(a[d]=f));return a}function g(a,c){var d=this.__meta,e=d.supers,f=e.length,g=d.superMeta,h=g.pos;if(f>h){a=a?B(a)||b(a)?a:[a]:[];var i,j=g.name,k=g.f;do if(i=e[h][j],"function"==typeof i&&(i=i._f||i)!==k)return g.pos=1+h,i.apply(this,a);while(f>++h)}return null}function h(){var a=this.__meta,b=a.supers,c=b.length,d=a.superMeta,e=d.pos;if(c>e){var f,g=d.name,h=d.f;do if(f=b[e][g],"function"==typeof f&&(f=f._f||f)!==h)return d.pos=1+e,f.bind(this);while(c>++e)}return null}function i(a){var b=this.__getters__;return b.hasOwnProperty(a)?b[a].apply(this):this[a]}function j(b,c){var e=this.__setters__;if(!d(b))return e.hasOwnProperty(b)?e[b].apply(this,a(arguments,1)):this[b]=c;for(var f in b){var g=b[f];e.hasOwnProperty(f)?e[b].call(this,g):this[f]=g}}function k(){var a=this.__meta||{},b=a.supers,c=b.length,d=a.superMeta,e=d.pos;if(c>e){var f,g=d.name,h=d.f;do if(f=b[e][g],"function"==typeof f&&(f=f._f||f)!==h)return d.pos=1+e,f.apply(this,arguments);while(c>++e)}return null}function l(a,b){if(a.toString().match(A)){var c=function(){var c,d=this.__meta||{},e=d.superMeta;switch(d.superMeta={f:a,pos:0,name:b},arguments.length){case 0:c=a.call(this);break;case 1:c=a.call(this,arguments[0]);break;case 2:c=a.call(this,arguments[0],arguments[1]);break;case 3:c=a.call(this,arguments[0],arguments[1],arguments[2]);break;default:c=a.apply(this,arguments)}return d.superMeta=e,c};return c._f=a,c}return a._f=a,a}function m(a,b){var c=b.setters||{},d=a.__setters__,e=a.__getters__;for(var f in c)d.hasOwnProperty(f)||(d[f]=c[f]);c=b.getters||{};for(f in c)e.hasOwnProperty(f)||(e[f]=c[f]);for(var g in b)if("getters"!==g&&"setters"!==g){var h=b[g];"function"==typeof h?a.hasOwnProperty(g)||(a[g]=l(k,g)):a[g]=h}}function n(){for(var b=a(arguments),c=b.length,d=this.prototype,e=d.__meta,f=this.__meta,g=d.__meta.bases,h=g.slice(),i=f.supers||[],j=e.supers||[],k=0;c>k;k++){var l=b[k],n=l.prototype,p=n.__meta,q=l.__meta;!p&&(p=n.__meta={proto:n||{}}),!q&&(q=l.__meta={proto:l.__proto__||{}}),m(d,p.proto||{}),m(this,q.proto||{}),o(l.prototype,j,g),o(l,i,h)}return this}function o(a,b,c){var d=a.__meta;!d&&(d=a.__meta={});var f=a.__meta.unique;if(!f&&(d.unique="declare"+ ++y),-1===e(c,f)){c.push(f);for(var g=a.__meta.supers||[],h=g.length-1||0;h>=0;)o(g[h--],b,c);b.unshift(a)}}function p(a,b){var c=b.setters,d=a.__setters__,e=a.__getters__;if(c)for(var f in c)d[f]=c[f];if(c=b.getters||{})for(f in c)e[f]=c[f];for(f in b)if("getters"!=f&&"setters"!=f){var g=b[f];if("function"==typeof g){var h=g.__meta||{};h.isConstructor?a[f]=g:a[f]=l(g,f)}else a[f]=g}}function q(a,b){return a&&b?a[b]=this:a.exports=a=this,this}function r(a){return u(this,a)}function s(a){z.prototype=a.prototype;var b=new z;return z.prototype=null,b}function t(a,c,e){var i={},j=[],m="declare"+ ++y,q=[],r=[],t=[],u=[],v={supers:t,unique:m,bases:q,superMeta:{f:null,pos:0,name:null}},x={supers:u,unique:m,bases:r,isConstructor:!0,superMeta:{f:null,pos:0,name:null}};if(d(c)&&!e&&(e=c,c=w),"function"==typeof c||b(c)?(j=b(c)?c:[c],c=j.shift(),a.__meta=x,i=s(c),i.__meta=v,i.__getters__=f({},i.__getters__||{}),i.__setters__=f({},i.__setters__||{}),a.__getters__=f({},a.__getters__||{}),a.__setters__=f({},a.__setters__||{}),o(c.prototype,t,q),o(c,u,r)):(a.__meta=x,i.__meta=v,i.__getters__=i.__getters__||{},i.__setters__=i.__setters__||{},a.__getters__=a.__getters__||{},a.__setters__=a.__setters__||{}),a.prototype=i,e){var z=v.proto=e.instance||{},A=x.proto=e["static"]||{};A.init=A.init||k,p(i,z),p(a,A),z.hasOwnProperty("constructor")?i.constructor=l(z.constructor,"constructor"):i.constructor=z.constructor=l(k,"constructor")}else v.proto={},x.proto={},a.init=l(k,"init"),i.constructor=l(k,"constructor");j.length&&n.apply(a,j),c&&f(a,f(f({},c),a)),i._super=a._super=g,i._getSuper=a._getSuper=h,i._static=a}function u(a,b){function c(){switch(arguments.length){case 0:this.constructor.call(this);break;case 1:this.constructor.call(this,arguments[0]);break;case 2:this.constructor.call(this,arguments[0],arguments[1]);break;case 3:this.constructor.call(this,arguments[0],arguments[1],arguments[2]);break;default:this.constructor.apply(this,arguments)}}return t(c,a,b),c.init()||c}function v(a,b){function c(){return d||(this.constructor.apply(this,arguments),d=this),d}var d;return t(c,a,b),c.init()||c}var w,x=Array.prototype.slice,y=0,z=new Function,A=/(super)/g,B=function(a){return"[object Arguments]"===Object.prototype.toString.call(a)};return B(arguments)||(B=function(a){return!(!a||!a.hasOwnProperty("callee"))}),w=u({instance:{get:i,set:j},"static":{get:i,set:j,mixin:n,extend:r,as:q}}),u.singleton=v,u}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=a()):"function"==typeof define&&define.amd?define(a):this.declare=a()}()},{}],55:[function(a,b,c){b.exports=a("./declare.js")},{"./declare.js":54}],56:[function(a,b,c){(function(){"use strict";function d(a){function b(){var b=a.define();return b.expose({register:function(a,c){c||(c=a,a=null);var d=typeof c;if(a)b[a]=c;else if(c&&"function"===d)b.extend(c);else{if("object"!==d)throw new TypeError("extended.register must be called with an extender function");b.expose(c)}return b},define:function(){return a.define.apply(a,arguments)}}),b}function c(){return b()}(function(){function a(a,b){var c,d;for(c in b)b.hasOwnProperty(c)&&(d=b[c],c in a&&a[c]===d||(a[c]=d));return a}return function(b){b||(b={});for(var c=1,d=arguments.length;d>c;c++)a(b,arguments[c]);return b}})();return c.define=function(){return a.define.apply(a,arguments)},c}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extender"))):"function"==typeof define&&define.amd?define(["extender"],function(a){return d(a)}):this.extended=d(this.extender);
  }).call(this)},{extender:58}],57:[function(a,b,c){(function(){function d(a){function b(a,b){if(a&&a.length)for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1}function c(a){return"[object Array]"===Object.prototype.toString.call(a)}function d(b){function c(a,b,c){if("function"!=typeof c)throw new TypeError("when extending type you must provide a function");var d;d="constructor"===b?function(){this._super(arguments),c.apply(this,arguments)}:function(){var a=f.call(arguments);a.unshift(this._value);var b=c.apply(this,a);return b!==e?this.__extender__(b):this},a[b]=d}function d(a,b,c){if("function"!=typeof c)throw new TypeError("when extending type you must provide a function");var d;d="constructor"===b?function(){this._super(arguments),c.apply(this,arguments)}:function(){var a=f.call(arguments);return a.unshift(this._value),c.apply(this,a)},a[b]=d}function h(a,b,e){for(var f in b)b.hasOwnProperty(f)&&("getters"!==f&&"setters"!==f?"noWrap"===f?h(a,b[f],!0):e?d(a,f,b[f]):c(a,f,b[f]):a[f]=b[f])}function i(a){var b,c,d=a;if(!(a instanceof m)){var e=m;for(b=0,c=n.length;c>b;b++){var f=n[b];f[0](a)&&(e=e.extend({instance:f[1]}))}d=new e(a),d.__extender__=i}return d}function j(){return!0}function k(a,b){if(arguments.length){"object"==typeof a&&(b=a,a=j),b=b||{};var d={};h(d,b),d.hasOwnProperty("constructor")||(b.hasOwnProperty("constructor")?c(d,"constructor",b.constructor):d.constructor=function(){this._super(arguments)}),n.push([a,d])}return i}function l(a){return a&&a.hasOwnProperty("__defined__")&&(i.__defined__=n=n.concat(a.__defined__)),g(i,a,["define","extend","expose","__defined__"]),i}b=b||[];var m=a({instance:{constructor:function(a){this._value=a},value:function(){return this._value},eq:function(a){return this.__extender__(this._value===a)},neq:function(a){return this.__extender__(this._value!==a)},print:function(){return console.log(this._value),this}}}),n=[];return i.define=k,i.extend=l,i.expose=function(){for(var a,b=0,c=arguments.length;c>b;b++)a=arguments[b],"object"==typeof a&&g(i,a,["define","extend","expose","__defined__"]);return i},i.__defined__=n,i}var e,f=Array.prototype.slice,g=function(){function a(a,c,d){var e,f;for(e in c)c.hasOwnProperty(e)&&-1===b(d,e)&&(f=c[e],e in a&&a[e]===f||(a[e]=f));return a}return function(b){b||(b={});var d=arguments.length,e=arguments[arguments.length-1];c(e)?d--:e=[];for(var f=1;d>f;f++)a(b,arguments[f],e);return b}}();return{define:function(){return d().define.apply(d,arguments)},extend:function(a){return d().define().extend(a)}}}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("declare.js"))):"function"==typeof define&&define.amd?define(["declare"],function(a){return d(a)}):this.extender=d(this.declare)}).call(this)},{"declare.js":55}],58:[function(a,b,c){b.exports=a("./extender.js")},{"./extender.js":57}],59:[function(a,b,c){(function(){"use strict";function d(a,b,c){function d(a,b,c){var d;switch((b||[]).length){case 0:d=a.call(c);break;case 1:d=a.call(c,b[0]);break;case 2:d=a.call(c,b[0],b[1]);break;case 3:d=a.call(c,b[0],b[1],b[2]);break;default:d=a.apply(c,b)}return d}function e(a,b,c){if(c=p(arguments,2),n(b)&&!(b in a))throw new Error(b+" property not defined in scope");if(!n(b)&&!o(b))throw new Error(b+" is not a function");return n(b)?function(){var e=a[b];return o(e)?d(e,c.concat(p(arguments)),a):e}:c.length?function(){return d(b,c.concat(p(arguments)),a)}:function(){return d(b,arguments,a)}}function f(a,b){if(b=p(arguments,1),!n(a)&&!o(a))throw new Error(a+" must be the name of a property or function to execute");return n(a)?function(){var c=p(arguments),e=c.shift(),f=e[a];return o(f)?(c=b.concat(c),d(f,c,e)):f}:function(){var c=p(arguments),e=c.shift();return c=b.concat(c),d(a,c,e)}}function g(a,b,c){if(c=p(arguments,2),n(b)&&!(b in a))throw new Error(b+" property not defined in scope");if(!n(b)&&!o(b))throw new Error(b+" is not a function");return n(b)?function(){var e=a[b];return o(e)?d(e,c,a):e}:function(){return d(b,c,a)}}function h(a){var b=p(arguments,1);if(!m(a)&&!o(a))throw new TypeError("scope must be an object");if(1===b.length&&l(b[0])&&(b=b[0]),!b.length){b=[];for(var c in a)a.hasOwnProperty(c)&&o(a[c])&&b.push(c)}for(var d=0,f=b.length;f>d;d++)a[b[d]]=e(a,a[b[d]]);return a}function i(a,b){if(b=p(arguments,1),!n(a)&&!o(a))throw new Error(a+" must be the name of a property or function to execute");return n(a)?function(){var c=this[a];if(o(c)){var e=b.concat(p(arguments));return d(c,e,this)}return c}:function(){var c=b.concat(p(arguments));return d(a,c,this)}}function j(a,b){return function(){var c=p(arguments);return b?d(a,arguments,this):function(){return d(a,c.concat(p(arguments)),this)}}}function k(a,b,c){var d;if(d=c?e(c,b):b,a)for(var f=a-1,g=f;g>=0;g--)d=j(d,g===f);return d}var l=b.isArray,m=b.isObject,n=b.isString,o=b.isFunction,p=c.argsToArray;return a.define(m,{bind:e,bindAll:h,bindIgnore:g,curry:function(a,b,c){return k(b,c,a)}}).define(o,{bind:function(a,b){return d(e,[b,a].concat(p(arguments,2)),this)},bindIgnore:function(a,b){return d(g,[b,a].concat(p(arguments,2)),this)},partial:i,applyFirst:f,curry:function(a,b,c){return k(b,a,c)},noWrap:{f:function(){return this.value()}}}).define(n,{bind:function(a,b){return e(b,a)},bindIgnore:function(a,b){return g(b,a)},partial:i,applyFirst:f,curry:function(a,b,c){return k(b,a,c)}}).expose({bind:e,bindAll:h,bindIgnore:g,partial:i,applyFirst:f,curry:k})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","arguments-extended"],function(a,b,c){return d(a,b,c)}):this.functionExtended=d(this.extended,this.isExtended,this.argumentsExtended)}).call(this)},{"arguments-extended":51,extended:56,"is-extended":66}],60:[function(a,b,c){function d(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;c<a.length;c++)if(b===a[c])return c;return-1}var e=a("__browserify_process");e.EventEmitter||(e.EventEmitter=function(){});var f=c.EventEmitter=e.EventEmitter,g="function"==typeof Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},h=10;f.prototype.setMaxListeners=function(a){this._events||(this._events={}),this._events.maxListeners=a},f.prototype.emit=function(a){if("error"===a&&(!this._events||!this._events.error||g(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var b=this._events[a];if(!b)return!1;if("function"==typeof b){switch(arguments.length){case 1:b.call(this);break;case 2:b.call(this,arguments[1]);break;case 3:b.call(this,arguments[1],arguments[2]);break;default:var c=Array.prototype.slice.call(arguments,1);b.apply(this,c)}return!0}if(g(b)){for(var c=Array.prototype.slice.call(arguments,1),d=b.slice(),e=0,f=d.length;f>e;e++)d[e].apply(this,c);return!0}return!1},f.prototype.addListener=function(a,b){if("function"!=typeof b)throw new Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",a,b),this._events[a])if(g(this._events[a])){if(!this._events[a].warned){var c;c=void 0!==this._events.maxListeners?this._events.maxListeners:h,c&&c>0&&this._events[a].length>c&&(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())}this._events[a].push(b)}else this._events[a]=[this._events[a],b];else this._events[a]=b;return this},f.prototype.on=f.prototype.addListener,f.prototype.once=function(a,b){var c=this;return c.on(a,function d(){c.removeListener(a,d),b.apply(this,arguments)}),this},f.prototype.removeListener=function(a,b){if("function"!=typeof b)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[a])return this;var c=this._events[a];if(g(c)){var e=d(c,b);if(0>e)return this;c.splice(e,1),0==c.length&&delete this._events[a]}else this._events[a]===b&&delete this._events[a];return this},f.prototype.removeAllListeners=function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)},f.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),g(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]},f.listenerCount=function(a,b){var c;return c=a._events&&a._events[b]?"function"==typeof a._events[b]?1:a._events[b].length:0}},{__browserify_process:64}],61:[function(a,b,c){},{}],62:[function(a,b,c){function d(a,b){for(var c=[],d=0;d<a.length;d++)b(a[d],d,a)&&c.push(a[d]);return c}function e(a,b){for(var c=0,d=a.length;d>=0;d--){var e=a[d];"."==e?a.splice(d,1):".."===e?(a.splice(d,1),c++):c&&(a.splice(d,1),c--)}if(b)for(;c--;c)a.unshift("..");return a}var f=a("__browserify_process"),g=/^(.+\/(?!$)|\/)?((?:.+?)?(\.[^.]*)?)$/;c.resolve=function(){for(var a="",b=!1,c=arguments.length;c>=-1&&!b;c--){var g=c>=0?arguments[c]:f.cwd();"string"==typeof g&&g&&(a=g+"/"+a,b="/"===g.charAt(0))}return a=e(d(a.split("/"),function(a){return!!a}),!b).join("/"),(b?"/":"")+a||"."},c.normalize=function(a){var b="/"===a.charAt(0),c="/"===a.slice(-1);return a=e(d(a.split("/"),function(a){return!!a}),!b).join("/"),a||b||(a="."),a&&c&&(a+="/"),(b?"/":"")+a},c.join=function(){var a=Array.prototype.slice.call(arguments,0);return c.normalize(d(a,function(a,b){return a&&"string"==typeof a}).join("/"))},c.dirname=function(a){var b=g.exec(a)[1]||"",c=!1;return b?1===b.length||c&&b.length<=3&&":"===b.charAt(1)?b:b.substring(0,b.length-1):"."},c.basename=function(a,b){var c=g.exec(a)[2]||"";return b&&c.substr(-1*b.length)===b&&(c=c.substr(0,c.length-b.length)),c},c.extname=function(a){return g.exec(a)[3]||""},c.relative=function(a,b){function d(a){for(var b=0;b<a.length&&""===a[b];b++);for(var c=a.length-1;c>=0&&""===a[c];c--);return b>c?[]:a.slice(b,c-b+1)}a=c.resolve(a).substr(1),b=c.resolve(b).substr(1);for(var e=d(a.split("/")),f=d(b.split("/")),g=Math.min(e.length,f.length),h=g,i=0;g>i;i++)if(e[i]!==f[i]){h=i;break}for(var j=[],i=h;i<e.length;i++)j.push("..");return j=j.concat(f.slice(h)),j.join("/")},c.sep="/"},{__browserify_process:64}],63:[function(a,b,c){a=function(a,b,c,d){function e(d){if(!c[d]){if(!b[d]){if(a)return a(d);throw new Error("Cannot find module '"+d+"'")}var f=c[d]={exports:{}};b[d][0](function(a){var c=b[d][1][a];return e(c?c:a)},f,f.exports)}return c[d].exports}for(var f=0;f<d.length;f++)e(d[f]);return e}("undefined"!=typeof a&&a,{1:[function(a,b,c){function d(a){if(Object.keys)return Object.keys(a);var b=[];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c);return b}function e(a,b){return void 0===b?""+b:"number"!=typeof b||!isNaN(b)&&isFinite(b)?"function"==typeof b||b instanceof RegExp?b.toString():b:b.toString()}function f(a,b){return"string"==typeof a?a.length<b?a:a.slice(0,b):a}function g(a,b,c,d,e){throw new r.AssertionError({message:c,actual:a,expected:b,operator:d,stackStartFunction:e})}function h(a,b){a||g(a,!0,b,"==",r.ok)}function i(a,b){if(a===b)return!0;if(p.isBuffer(a)&&p.isBuffer(b)){if(a.length!=b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!==b[c])return!1;return!0}return a instanceof Date&&b instanceof Date?a.getTime()===b.getTime():"object"!=typeof a&&"object"!=typeof b?a==b:l(a,b)}function j(a){return null===a||void 0===a}function k(a){return"[object Arguments]"==Object.prototype.toString.call(a)}function l(a,b){if(j(a)||j(b))return!1;if(a.prototype!==b.prototype)return!1;if(k(a))return k(b)?(a=q.call(a),b=q.call(b),i(a,b)):!1;try{var c,e,f=d(a),g=d(b)}catch(h){return!1}if(f.length!=g.length)return!1;for(f.sort(),g.sort(),e=f.length-1;e>=0;e--)if(f[e]!=g[e])return!1;for(e=f.length-1;e>=0;e--)if(c=f[e],!i(a[c],b[c]))return!1;return!0}function m(a,b){return a&&b?b instanceof RegExp?b.test(a):a instanceof b?!0:b.call({},a)===!0?!0:!1:!1}function n(a,b,c,d){var e;"string"==typeof c&&(d=c,c=null);try{b()}catch(f){e=f}if(d=(c&&c.name?" ("+c.name+").":".")+(d?" "+d:"."),a&&!e&&g("Missing expected exception"+d),!a&&m(e,c)&&g("Got unwanted exception"+d),a&&e&&c&&!m(e,c)||!a&&e)throw e}var o=a("util"),p=a("buffer").Buffer,q=Array.prototype.slice,r=b.exports=h;r.AssertionError=function(a){this.name="AssertionError",this.message=a.message,this.actual=a.actual,this.expected=a.expected,this.operator=a.operator;var b=a.stackStartFunction||g;Error.captureStackTrace&&Error.captureStackTrace(this,b)},o.inherits(r.AssertionError,Error),r.AssertionError.prototype.toString=function(){return this.message?[this.name+":",this.message].join(" "):[this.name+":",f(JSON.stringify(this.actual,e),128),this.operator,f(JSON.stringify(this.expected,e),128)].join(" ")},r.AssertionError.__proto__=Error.prototype,r.fail=g,r.ok=h,r.equal=function(a,b,c){a!=b&&g(a,b,c,"==",r.equal)},r.notEqual=function(a,b,c){a==b&&g(a,b,c,"!=",r.notEqual)},r.deepEqual=function(a,b,c){i(a,b)||g(a,b,c,"deepEqual",r.deepEqual)},r.notDeepEqual=function(a,b,c){i(a,b)&&g(a,b,c,"notDeepEqual",r.notDeepEqual)},r.strictEqual=function(a,b,c){a!==b&&g(a,b,c,"===",r.strictEqual)},r.notStrictEqual=function(a,b,c){a===b&&g(a,b,c,"!==",r.notStrictEqual)},r["throws"]=function(a,b,c){n.apply(this,[!0].concat(q.call(arguments)))},r.doesNotThrow=function(a,b,c){n.apply(this,[!1].concat(q.call(arguments)))},r.ifError=function(a){if(a)throw a}},{util:2,buffer:3}],2:[function(a,b,c){function d(a){return a instanceof Array||Array.isArray(a)||a&&a!==Object.prototype&&d(a.__proto__)}function e(a){return a instanceof RegExp||"object"==typeof a&&"[object RegExp]"===Object.prototype.toString.call(a)}function f(a){if(a instanceof Date)return!0;if("object"!=typeof a)return!1;var b=Date.prototype&&h(Date.prototype),c=a.__proto__&&h(a.__proto__);return JSON.stringify(c)===JSON.stringify(b)}a("events");c.isArray=d,c.isDate=function(a){return"[object Date]"===Object.prototype.toString.call(a)},c.isRegExp=function(a){return"[object RegExp]"===Object.prototype.toString.call(a)},c.print=function(){},c.puts=function(){},c.debug=function(){},c.inspect=function(a,b,i,j){function k(a,i){if(a&&"function"==typeof a.inspect&&a!==c&&(!a.constructor||a.constructor.prototype!==a))return a.inspect(i);switch(typeof a){case"undefined":return m("undefined","undefined");case"string":var j="'"+JSON.stringify(a).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return m(j,"string");case"number":return m(""+a,"number");case"boolean":return m(""+a,"boolean")}if(null===a)return m("null","null");var n=g(a),o=b?h(a):n;if("function"==typeof a&&0===o.length){if(e(a))return m(""+a,"regexp");var p=a.name?": "+a.name:"";return m("[Function"+p+"]","special")}if(f(a)&&0===o.length)return m(a.toUTCString(),"date");var q,r,s;if(d(a)?(r="Array",s=["[","]"]):(r="Object",s=["{","}"]),"function"==typeof a){var t=a.name?": "+a.name:"";q=e(a)?" "+a:" [Function"+t+"]"}else q="";if(f(a)&&(q=" "+a.toUTCString()),0===o.length)return s[0]+q+s[1];if(0>i)return e(a)?m(""+a,"regexp"):m("[Object]","special");l.push(a);var u=o.map(function(b){var c,e;if(a.__lookupGetter__&&(a.__lookupGetter__(b)?e=a.__lookupSetter__(b)?m("[Getter/Setter]","special"):m("[Getter]","special"):a.__lookupSetter__(b)&&(e=m("[Setter]","special"))),n.indexOf(b)<0&&(c="["+b+"]"),e||(l.indexOf(a[b])<0?(e=null===i?k(a[b]):k(a[b],i-1),e.indexOf("\n")>-1&&(e=d(a)?e.split("\n").map(function(a){return"  "+a}).join("\n").substr(2):"\n"+e.split("\n").map(function(a){return"   "+a}).join("\n"))):e=m("[Circular]","special")),"undefined"==typeof c){if("Array"===r&&b.match(/^\d+$/))return e;c=JSON.stringify(""+b),c.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(c=c.substr(1,c.length-2),c=m(c,"name")):(c=c.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),c=m(c,"string"))}return c+": "+e});l.pop();var v=0,w=u.reduce(function(a,b){return v++,b.indexOf("\n")>=0&&v++,a+b.length+1},0);return u=w>50?s[0]+(""===q?"":q+"\n ")+" "+u.join(",\n  ")+" "+s[1]:s[0]+q+" "+u.join(", ")+" "+s[1]}var l=[],m=function(a,b){var c={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]},d={special:"cyan",number:"blue","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"}[b];return d?"["+c[d][0]+"m"+a+"["+c[d][1]+"m":a};return j||(m=function(a,b){return a}),k(a,"undefined"==typeof i?2:i)};c.log=function(a){},c.pump=null;var g=Object.keys||function(a){var b=[];for(var c in a)b.push(c);return b},h=Object.getOwnPropertyNames||function(a){var b=[];for(var c in a)Object.hasOwnProperty.call(a,c)&&b.push(c);return b},i=Object.create||function(a,b){var c;if(null===a)c={__proto__:null};else{if("object"!=typeof a)throw new TypeError("typeof prototype["+typeof a+"] != 'object'");var d=function(){};d.prototype=a,c=new d,c.__proto__=a}return"undefined"!=typeof b&&Object.defineProperties&&Object.defineProperties(c,b),c};c.inherits=function(a,b){a.super_=b,a.prototype=i(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})};var j=/%[sdj%]/g;c.format=function(a){if("string"!=typeof a){for(var b=[],d=0;d<arguments.length;d++)b.push(c.inspect(arguments[d]));return b.join(" ")}for(var d=1,e=arguments,f=e.length,g=String(a).replace(j,function(a){if("%%"===a)return"%";if(d>=f)return a;switch(a){case"%s":return String(e[d++]);case"%d":return Number(e[d++]);case"%j":return JSON.stringify(e[d++]);default:return a}}),h=e[d];f>d;h=e[++d])g+=null===h||"object"!=typeof h?" "+h:" "+c.inspect(h);return g}},{events:4}],5:[function(a,b,c){c.readIEEE754=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?0:e-1,m=c?1:-1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:(n?-1:1)*(1/0);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.writeIEEE754=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?f-1:0,o=d?-1:1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],6:[function(a,b,c){var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){if(a.source===window&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var b=c.shift();b()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.binding=function(a){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(a){throw new Error("process.chdir is not supported")}},{}],4:[function(a,b,c){!function(a){function b(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;c<a.length;c++)if(b===a[c])return c;return-1}a.EventEmitter||(a.EventEmitter=function(){});var d=c.EventEmitter=a.EventEmitter,e="function"==typeof Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},f=10;d.prototype.setMaxListeners=function(a){this._events||(this._events={}),this._events.maxListeners=a},d.prototype.emit=function(a){if("error"===a&&(!this._events||!this._events.error||e(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var b=this._events[a];if(!b)return!1;if("function"==typeof b){switch(arguments.length){case 1:b.call(this);break;case 2:b.call(this,arguments[1]);break;case 3:b.call(this,arguments[1],arguments[2]);break;default:var c=Array.prototype.slice.call(arguments,1);b.apply(this,c)}return!0}if(e(b)){for(var c=Array.prototype.slice.call(arguments,1),d=b.slice(),f=0,g=d.length;g>f;f++)d[f].apply(this,c);return!0}return!1},d.prototype.addListener=function(a,b){if("function"!=typeof b)throw new Error("addListener only takes instances of Function");if(this._events||(this._events={}),this.emit("newListener",a,b),this._events[a])if(e(this._events[a])){if(!this._events[a].warned){var c;c=void 0!==this._events.maxListeners?this._events.maxListeners:f,c&&c>0&&this._events[a].length>c&&(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())}this._events[a].push(b)}else this._events[a]=[this._events[a],b];else this._events[a]=b;return this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){var c=this;return c.on(a,function d(){c.removeListener(a,d),b.apply(this,arguments)}),this},d.prototype.removeListener=function(a,c){if("function"!=typeof c)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[a])return this;var d=this._events[a];if(e(d)){var f=b(d,c);if(0>f)return this;d.splice(f,1),0==d.length&&delete this._events[a]}else this._events[a]===c&&delete this._events[a];return this},d.prototype.removeAllListeners=function(a){return 0===arguments.length?(this._events={},this):(a&&this._events&&this._events[a]&&(this._events[a]=null),this)},d.prototype.listeners=function(a){return this._events||(this._events={}),this._events[a]||(this._events[a]=[]),e(this._events[a])||(this._events[a]=[this._events[a]]),this._events[a]}}(a("__browserify_process"))},{__browserify_process:6}],"buffer-browserify":[function(a,b,c){b.exports=a("q9TxCC")},{}],q9TxCC:[function(a,b,c){function d(a){this.length=a}function e(a){return 16>a?"0"+a.toString(16):a.toString(16)}function f(a){for(var b=[],c=0;c<a.length;c++)if(a.charCodeAt(c)<=127)b.push(a.charCodeAt(c));else for(var d=encodeURIComponent(a.charAt(c)).substr(1).split("%"),e=0;e<d.length;e++)b.push(parseInt(d[e],16));return b}function g(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function h(b){return a("base64-js").toByteArray(b)}function i(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);)b[e+c]=a[e],e++;return e}function j(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function k(a){return a=~~Math.ceil(+a),0>a?0:a}function l(a,b,c){if(!(this instanceof l))return new l(a,b,c);var e;if("number"==typeof c)this.length=k(b),this.parent=a,this.offset=c;else{switch(e=typeof a){case"number":this.length=k(a);break;case"string":this.length=l.byteLength(a,b);break;case"object":this.length=k(a.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(this.length>l.poolSize?(this.parent=new d(this.length),this.offset=0):((!E||E.length-E.used<this.length)&&n(),this.parent=E,this.offset=E.used,E.used+=this.length),m(a))for(var f=0;f<this.length;f++)a instanceof l?this.parent[f+this.offset]=a.readUInt8(f):this.parent[f+this.offset]=a[f];else"string"==e&&(this.length=this.write(a,0,b))}}function m(a){return Array.isArray(a)||l.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function n(){E=new d(l.poolSize),E.used=0}function o(a,b,c,d){var e=0;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+1<a.length,"Trying to read beyond buffer length")),b>=a.length?0:(c?(e=a.parent[a.offset+b]<<8,b+1<a.length&&(e|=a.parent[a.offset+b+1])):(e=a.parent[a.offset+b],b+1<a.length&&(e|=a.parent[a.offset+b+1]<<8)),e)}function p(a,b,c,d){var e=0;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+3<a.length,"Trying to read beyond buffer length")),b>=a.length?0:(c?(b+1<a.length&&(e=a.parent[a.offset+b+1]<<16),b+2<a.length&&(e|=a.parent[a.offset+b+2]<<8),b+3<a.length&&(e|=a.parent[a.offset+b+3]),e+=a.parent[a.offset+b]<<24>>>0):(b+2<a.length&&(e=a.parent[a.offset+b+2]<<16),b+1<a.length&&(e|=a.parent[a.offset+b+1]<<8),e|=a.parent[a.offset+b],b+3<a.length&&(e+=a.parent[a.offset+b+3]<<24>>>0)),e)}function q(a,b,c,d){var e,f;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+1<a.length,"Trying to read beyond buffer length")),f=o(a,b,c,d),e=32768&f,e?-1*(65535-f+1):f}function r(a,b,c,d){var e,f;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+3<a.length,"Trying to read beyond buffer length")),f=p(a,b,c,d),e=2147483648&f,e?-1*(4294967295-f+1):f}function s(b,c,d,e){return e||(D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(c+3<b.length,"Trying to read beyond buffer length")),a("./buffer_ieee754").readIEEE754(b,c,d,23,4)}function t(b,c,d,e){return e||(D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(c+7<b.length,"Trying to read beyond buffer length")),a("./buffer_ieee754").readIEEE754(b,c,d,52,8)}function u(a,b){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(a>=0,"specified a negative value for writing an unsigned value"),D.ok(b>=a,"value is larger than maximum value for type"),D.ok(Math.floor(a)===a,"value has a fractional component")}function v(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1<a.length,"trying to write beyond buffer length"),u(b,65535));for(var f=0;f<Math.min(a.length-c,2);f++)a.parent[a.offset+c+f]=(b&255<<8*(d?1-f:f))>>>8*(d?1-f:f)}function w(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3<a.length,"trying to write beyond buffer length"),u(b,4294967295));for(var f=0;f<Math.min(a.length-c,4);f++)a.parent[a.offset+c+f]=b>>>8*(d?3-f:f)&255}function x(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value"),D.ok(Math.floor(a)===a,"value has a fractional component")}function y(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value")}function z(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1<a.length,"Trying to write beyond buffer length"),x(b,32767,-32768)),b>=0?v(a,b,c,d,e):v(a,65535+b+1,c,d,e)}function A(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3<a.length,"Trying to write beyond buffer length"),x(b,2147483647,-2147483648)),b>=0?w(a,b,c,d,e):w(a,4294967295+b+1,c,d,e)}function B(b,c,d,e,f){f||(D.ok(void 0!==c&&null!==c,"missing value"),D.ok("boolean"==typeof e,"missing or invalid endian"),D.ok(void 0!==d&&null!==d,"missing offset"),D.ok(d+3<b.length,"Trying to write beyond buffer length"),y(c,3.4028234663852886e38,-3.4028234663852886e38)),a("./buffer_ieee754").writeIEEE754(b,c,d,e,23,4)}function C(b,c,d,e,f){f||(D.ok(void 0!==c&&null!==c,"missing value"),D.ok("boolean"==typeof e,"missing or invalid endian"),D.ok(void 0!==d&&null!==d,"missing offset"),D.ok(d+7<b.length,"Trying to write beyond buffer length"),y(c,1.7976931348623157e308,-1.7976931348623157e308)),a("./buffer_ieee754").writeIEEE754(b,c,d,e,52,8)}var D=a("assert");c.INSPECT_MAX_BYTES=50,d.byteLength=function(a,b){switch(b||"utf8"){case"hex":return a.length/2;case"utf8":case"utf-8":return f(a).length;case"ascii":case"binary":return a.length;case"base64":return h(a).length;default:throw new Error("Unknown encoding")}},d.prototype.utf8Write=function(a,b,c){return d._charsWritten=i(f(a),this,b,c)},d.prototype.asciiWrite=function(a,b,c){return d._charsWritten=i(g(a),this,b,c)},d.prototype.binaryWrite=d.prototype.asciiWrite,d.prototype.base64Write=function(a,b,c){return d._charsWritten=i(h(a),this,b,c)},d.prototype.base64Slice=function(b,c){var d=Array.prototype.slice.apply(this,arguments);return a("base64-js").fromByteArray(d)},d.prototype.utf8Slice=function(){for(var a=Array.prototype.slice.apply(this,arguments),b="",c="",d=0;d<a.length;)a[d]<=127?(b+=j(c)+String.fromCharCode(a[d]),c=""):c+="%"+a[d].toString(16),d++;return b+j(c)},d.prototype.asciiSlice=function(){for(var a=Array.prototype.slice.apply(this,arguments),b="",c=0;c<a.length;c++)b+=String.fromCharCode(a[c]);return b},d.prototype.binarySlice=d.prototype.asciiSlice,d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=e(this[d]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<SlowBuffer "+a.join(" ")+">"},d.prototype.hexSlice=function(a,b){var c=this.length;(!a||0>a)&&(a=0),(!b||0>b||b>c)&&(b=c);for(var d="",f=a;b>f;f++)d+=e(this[f]);return d},d.prototype.toString=function(a,b,c){if(a=String(a||"utf8").toLowerCase(),b=+b||0,"undefined"==typeof c&&(c=this.length),+c==b)return"";switch(a){case"hex":return this.hexSlice(b,c);case"utf8":case"utf-8":return this.utf8Slice(b,c);case"ascii":return this.asciiSlice(b,c);case"binary":return this.binarySlice(b,c);case"base64":return this.base64Slice(b,c);case"ucs2":case"ucs-2":return this.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},d.prototype.hexWrite=function(a,b,c){b=+b||0;var e=this.length-b;c?(c=+c,c>e&&(c=e)):c=e;var f=a.length;if(f%2)throw new Error("Invalid hex string");c>f/2&&(c=f/2);for(var g=0;c>g;g++){var h=parseInt(a.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");this[b+g]=h}return d._charsWritten=2*g,g},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var e=d;d=b,b=c,c=e}b=+b||0;var f=this.length-b;switch(c?(c=+c,c>f&&(c=f)):c=f,d=String(d||"utf8").toLowerCase()){case"hex":return this.hexWrite(a,b,c);case"utf8":case"utf-8":return this.utf8Write(a,b,c);case"ascii":return this.asciiWrite(a,b,c);case"binary":return this.binaryWrite(a,b,c);case"base64":return this.base64Write(a,b,c);case"ucs2":case"ucs-2":return this.ucs2Write(a,b,c);default:throw new Error("Unknown encoding")}},d.prototype.slice=function(a,b){if(void 0===b&&(b=this.length),b>this.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this,b-a,+a)},d.prototype.copy=function(a,b,c,d){for(var e=[],f=c;d>f;f++)D.ok("undefined"!=typeof this[f],"copying undefined buffer bytes!"),e.push(this[f]);for(var f=b;f<b+e.length;f++)a[f]=e[f-b]},d.prototype.fill=function(a,b,c){if(c>this.length)throw new Error("oob");if(b>c)throw new Error("oob");for(var d=b;c>d;d++)this[d]=a},c.SlowBuffer=d,c.Buffer=l,l.poolSize=8192;var E;l.isBuffer=function(a){return a instanceof l||a instanceof d},l.concat=function(a,b){if(!Array.isArray(a))throw new Error("Usage: Buffer.concat(list, [totalLength])\n       list should be an Array.");if(0===a.length)return new l(0);if(1===a.length)return a[0];if("number"!=typeof b){b=0;for(var c=0;c<a.length;c++){var d=a[c];b+=d.length}}for(var e=new l(b),f=0,c=0;c<a.length;c++){var d=a[c];d.copy(e,f),f+=d.length}return e},l.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=e(this.parent[d+this.offset]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},l.prototype.get=function(a){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]},l.prototype.set=function(a,b){
  if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]=b},l.prototype.write=function(a,b,c,e){if(isFinite(b))isFinite(c)||(e=c,c=void 0);else{var f=e;e=b,b=c,c=f}b=+b||0;var g=this.length-b;c?(c=+c,c>g&&(c=g)):c=g,e=String(e||"utf8").toLowerCase();var h;switch(e){case"hex":h=this.parent.hexWrite(a,this.offset+b,c);break;case"utf8":case"utf-8":h=this.parent.utf8Write(a,this.offset+b,c);break;case"ascii":h=this.parent.asciiWrite(a,this.offset+b,c);break;case"binary":h=this.parent.binaryWrite(a,this.offset+b,c);break;case"base64":h=this.parent.base64Write(a,this.offset+b,c);break;case"ucs2":case"ucs-2":h=this.parent.ucs2Write(a,this.offset+b,c);break;default:throw new Error("Unknown encoding")}return l._charsWritten=d._charsWritten,h},l.prototype.toString=function(a,b,c){switch(a=String(a||"utf8").toLowerCase(),"undefined"==typeof b||0>b?b=0:b>this.length&&(b=this.length),"undefined"==typeof c||c>this.length?c=this.length:0>c&&(c=0),b+=this.offset,c+=this.offset,a){case"hex":return this.parent.hexSlice(b,c);case"utf8":case"utf-8":return this.parent.utf8Slice(b,c);case"ascii":return this.parent.asciiSlice(b,c);case"binary":return this.parent.binarySlice(b,c);case"base64":return this.parent.base64Slice(b,c);case"ucs2":case"ucs-2":return this.parent.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},l.byteLength=d.byteLength,l.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),"string"==typeof a&&(a=a.charCodeAt(0)),"number"!=typeof a||isNaN(a))throw new Error("value is not a number");if(b>c)throw new Error("end < start");if(c===b)return 0;if(0==this.length)return 0;if(0>b||b>=this.length)throw new Error("start out of bounds");if(0>c||c>this.length)throw new Error("end out of bounds");return this.parent.fill(a,b+this.offset,c+this.offset)},l.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||(d=this.length),b||(b=0),c>d)throw new Error("sourceEnd < sourceStart");if(d===c)return 0;if(0==a.length||0==e.length)return 0;if(0>b||b>=a.length)throw new Error("targetStart out of bounds");if(0>c||c>=e.length)throw new Error("sourceStart out of bounds");if(0>d||d>e.length)throw new Error("sourceEnd out of bounds");return d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c),this.parent.copy(a.parent,b+a.offset,c+this.offset,d+this.offset)},l.prototype.slice=function(a,b){if(void 0===b&&(b=this.length),b>this.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this.parent,b-a,+a+this.offset)},l.prototype.utf8Slice=function(a,b){return this.toString("utf8",a,b)},l.prototype.binarySlice=function(a,b){return this.toString("binary",a,b)},l.prototype.asciiSlice=function(a,b){return this.toString("ascii",a,b)},l.prototype.utf8Write=function(a,b){return this.write(a,b,"utf8")},l.prototype.binaryWrite=function(a,b){return this.write(a,b,"binary")},l.prototype.asciiWrite=function(a,b){return this.write(a,b,"ascii")},l.prototype.readUInt8=function(a,b){var c=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a<c.length,"Trying to read beyond buffer length")),a>=c.length?void 0:c.parent[c.offset+a]},l.prototype.readUInt16LE=function(a,b){return o(this,a,!1,b)},l.prototype.readUInt16BE=function(a,b){return o(this,a,!0,b)},l.prototype.readUInt32LE=function(a,b){return p(this,a,!1,b)},l.prototype.readUInt32BE=function(a,b){return p(this,a,!0,b)},l.prototype.readInt8=function(a,b){var c,d=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a<d.length,"Trying to read beyond buffer length")),a>=d.length?void 0:(c=128&d.parent[d.offset+a],c?-1*(255-d.parent[d.offset+a]+1):d.parent[d.offset+a])},l.prototype.readInt16LE=function(a,b){return q(this,a,!1,b)},l.prototype.readInt16BE=function(a,b){return q(this,a,!0,b)},l.prototype.readInt32LE=function(a,b){return r(this,a,!1,b)},l.prototype.readInt32BE=function(a,b){return r(this,a,!0,b)},l.prototype.readFloatLE=function(a,b){return s(this,a,!1,b)},l.prototype.readFloatBE=function(a,b){return s(this,a,!0,b)},l.prototype.readDoubleLE=function(a,b){return t(this,a,!1,b)},l.prototype.readDoubleBE=function(a,b){return t(this,a,!0,b)},l.prototype.writeUInt8=function(a,b,c){var d=this;c||(D.ok(void 0!==a&&null!==a,"missing value"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b<d.length,"trying to write beyond buffer length"),u(a,255)),b<d.length&&(d.parent[d.offset+b]=a)},l.prototype.writeUInt16LE=function(a,b,c){v(this,a,b,!1,c)},l.prototype.writeUInt16BE=function(a,b,c){v(this,a,b,!0,c)},l.prototype.writeUInt32LE=function(a,b,c){w(this,a,b,!1,c)},l.prototype.writeUInt32BE=function(a,b,c){w(this,a,b,!0,c)},l.prototype.writeInt8=function(a,b,c){var d=this;c||(D.ok(void 0!==a&&null!==a,"missing value"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b<d.length,"Trying to write beyond buffer length"),x(a,127,-128)),a>=0?d.writeUInt8(a,b,c):d.writeUInt8(255+a+1,b,c)},l.prototype.writeInt16LE=function(a,b,c){z(this,a,b,!1,c)},l.prototype.writeInt16BE=function(a,b,c){z(this,a,b,!0,c)},l.prototype.writeInt32LE=function(a,b,c){A(this,a,b,!1,c)},l.prototype.writeInt32BE=function(a,b,c){A(this,a,b,!0,c)},l.prototype.writeFloatLE=function(a,b,c){B(this,a,b,!1,c)},l.prototype.writeFloatBE=function(a,b,c){B(this,a,b,!0,c)},l.prototype.writeDoubleLE=function(a,b,c){C(this,a,b,!1,c)},l.prototype.writeDoubleBE=function(a,b,c){C(this,a,b,!0,c)},d.prototype.readUInt8=l.prototype.readUInt8,d.prototype.readUInt16LE=l.prototype.readUInt16LE,d.prototype.readUInt16BE=l.prototype.readUInt16BE,d.prototype.readUInt32LE=l.prototype.readUInt32LE,d.prototype.readUInt32BE=l.prototype.readUInt32BE,d.prototype.readInt8=l.prototype.readInt8,d.prototype.readInt16LE=l.prototype.readInt16LE,d.prototype.readInt16BE=l.prototype.readInt16BE,d.prototype.readInt32LE=l.prototype.readInt32LE,d.prototype.readInt32BE=l.prototype.readInt32BE,d.prototype.readFloatLE=l.prototype.readFloatLE,d.prototype.readFloatBE=l.prototype.readFloatBE,d.prototype.readDoubleLE=l.prototype.readDoubleLE,d.prototype.readDoubleBE=l.prototype.readDoubleBE,d.prototype.writeUInt8=l.prototype.writeUInt8,d.prototype.writeUInt16LE=l.prototype.writeUInt16LE,d.prototype.writeUInt16BE=l.prototype.writeUInt16BE,d.prototype.writeUInt32LE=l.prototype.writeUInt32LE,d.prototype.writeUInt32BE=l.prototype.writeUInt32BE,d.prototype.writeInt8=l.prototype.writeInt8,d.prototype.writeInt16LE=l.prototype.writeInt16LE,d.prototype.writeInt16BE=l.prototype.writeInt16BE,d.prototype.writeInt32LE=l.prototype.writeInt32LE,d.prototype.writeInt32BE=l.prototype.writeInt32BE,d.prototype.writeFloatLE=l.prototype.writeFloatLE,d.prototype.writeFloatBE=l.prototype.writeFloatBE,d.prototype.writeDoubleLE=l.prototype.writeDoubleLE,d.prototype.writeDoubleBE=l.prototype.writeDoubleBE},{assert:1,"./buffer_ieee754":5,"base64-js":7}],7:[function(a,b,c){!function(a){"use strict";function c(a){var b,c,d,f,g,h;if(a.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(g=a.indexOf("="),g=g>0?a.length-g:0,h=[],d=g>0?a.length-4:a.length,b=0,c=0;d>b;b+=4,c+=3)f=e.indexOf(a[b])<<18|e.indexOf(a[b+1])<<12|e.indexOf(a[b+2])<<6|e.indexOf(a[b+3]),h.push((16711680&f)>>16),h.push((65280&f)>>8),h.push(255&f);return 2===g?(f=e.indexOf(a[b])<<2|e.indexOf(a[b+1])>>4,h.push(255&f)):1===g&&(f=e.indexOf(a[b])<<10|e.indexOf(a[b+1])<<4|e.indexOf(a[b+2])>>2,h.push(f>>8&255),h.push(255&f)),h}function d(a){function b(a){return e[a>>18&63]+e[a>>12&63]+e[a>>6&63]+e[63&a]}var c,d,f,g=a.length%3,h="";for(c=0,f=a.length-g;f>c;c+=3)d=(a[c]<<16)+(a[c+1]<<8)+a[c+2],h+=b(d);switch(g){case 1:d=a[a.length-1],h+=e[d>>2],h+=e[d<<4&63],h+="==";break;case 2:d=(a[a.length-2]<<8)+a[a.length-1],h+=e[d>>10],h+=e[d>>4&63],h+=e[d<<2&63],h+="="}return h}var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";b.exports.toByteArray=c,b.exports.fromByteArray=d}()},{}],8:[function(a,b,c){c.readIEEE754=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?0:e-1,m=c?1:-1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:(n?-1:1)*(1/0);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.writeIEEE754=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?f-1:0,o=d?-1:1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],3:[function(a,b,c){function d(a){this.length=a}function e(a){return 16>a?"0"+a.toString(16):a.toString(16)}function f(a){for(var b=[],c=0;c<a.length;c++)if(a.charCodeAt(c)<=127)b.push(a.charCodeAt(c));else for(var d=encodeURIComponent(a.charAt(c)).substr(1).split("%"),e=0;e<d.length;e++)b.push(parseInt(d[e],16));return b}function g(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function h(b){return a("base64-js").toByteArray(b)}function i(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);)b[e+c]=a[e],e++;return e}function j(a){try{return decodeURIComponent(a)}catch(b){return String.fromCharCode(65533)}}function k(a){return a=~~Math.ceil(+a),0>a?0:a}function l(a,b,c){if(!(this instanceof l))return new l(a,b,c);var e;if("number"==typeof c)this.length=k(b),this.parent=a,this.offset=c;else{switch(e=typeof a){case"number":this.length=k(a);break;case"string":this.length=l.byteLength(a,b);break;case"object":this.length=k(a.length);break;default:throw new Error("First argument needs to be a number, array or string.")}if(this.length>l.poolSize?(this.parent=new d(this.length),this.offset=0):((!E||E.length-E.used<this.length)&&n(),this.parent=E,this.offset=E.used,E.used+=this.length),m(a))for(var f=0;f<this.length;f++)this.parent[f+this.offset]=a[f];else"string"==e&&(this.length=this.write(a,0,b))}}function m(a){return Array.isArray(a)||l.isBuffer(a)||a&&"object"==typeof a&&"number"==typeof a.length}function n(){E=new d(l.poolSize),E.used=0}function o(a,b,c,d){var e=0;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+1<a.length,"Trying to read beyond buffer length")),c?(e=a.parent[a.offset+b]<<8,e|=a.parent[a.offset+b+1]):(e=a.parent[a.offset+b],e|=a.parent[a.offset+b+1]<<8),e}function p(a,b,c,d){var e=0;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+3<a.length,"Trying to read beyond buffer length")),c?(e=a.parent[a.offset+b+1]<<16,e|=a.parent[a.offset+b+2]<<8,e|=a.parent[a.offset+b+3],e+=a.parent[a.offset+b]<<24>>>0):(e=a.parent[a.offset+b+2]<<16,e|=a.parent[a.offset+b+1]<<8,e|=a.parent[a.offset+b],e+=a.parent[a.offset+b+3]<<24>>>0),e}function q(a,b,c,d){var e,f;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+1<a.length,"Trying to read beyond buffer length")),f=o(a,b,c,d),e=32768&f,e?-1*(65535-f+1):f}function r(a,b,c,d){var e,f;return d||(D.ok("boolean"==typeof c,"missing or invalid endian"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b+3<a.length,"Trying to read beyond buffer length")),f=p(a,b,c,d),e=2147483648&f,e?-1*(4294967295-f+1):f}function s(b,c,d,e){return e||(D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(c+3<b.length,"Trying to read beyond buffer length")),a("./buffer_ieee754").readIEEE754(b,c,d,23,4)}function t(b,c,d,e){return e||(D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(c+7<b.length,"Trying to read beyond buffer length")),a("./buffer_ieee754").readIEEE754(b,c,d,52,8)}function u(a,b){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(a>=0,"specified a negative value for writing an unsigned value"),D.ok(b>=a,"value is larger than maximum value for type"),D.ok(Math.floor(a)===a,"value has a fractional component")}function v(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1<a.length,"trying to write beyond buffer length"),u(b,65535)),d?(a.parent[a.offset+c]=(65280&b)>>>8,a.parent[a.offset+c+1]=255&b):(a.parent[a.offset+c+1]=(65280&b)>>>8,a.parent[a.offset+c]=255&b)}function w(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3<a.length,"trying to write beyond buffer length"),u(b,4294967295)),d?(a.parent[a.offset+c]=b>>>24&255,a.parent[a.offset+c+1]=b>>>16&255,a.parent[a.offset+c+2]=b>>>8&255,a.parent[a.offset+c+3]=255&b):(a.parent[a.offset+c+3]=b>>>24&255,a.parent[a.offset+c+2]=b>>>16&255,a.parent[a.offset+c+1]=b>>>8&255,a.parent[a.offset+c]=255&b)}function x(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value"),D.ok(Math.floor(a)===a,"value has a fractional component")}function y(a,b,c){D.ok("number"==typeof a,"cannot write a non-number as a number"),D.ok(b>=a,"value larger than maximum allowed value"),D.ok(a>=c,"value smaller than minimum allowed value")}function z(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+1<a.length,"Trying to write beyond buffer length"),x(b,32767,-32768)),b>=0?v(a,b,c,d,e):v(a,65535+b+1,c,d,e)}function A(a,b,c,d,e){e||(D.ok(void 0!==b&&null!==b,"missing value"),D.ok("boolean"==typeof d,"missing or invalid endian"),D.ok(void 0!==c&&null!==c,"missing offset"),D.ok(c+3<a.length,"Trying to write beyond buffer length"),x(b,2147483647,-2147483648)),b>=0?w(a,b,c,d,e):w(a,4294967295+b+1,c,d,e)}function B(b,c,d,e,f){f||(D.ok(void 0!==c&&null!==c,"missing value"),D.ok("boolean"==typeof e,"missing or invalid endian"),D.ok(void 0!==d&&null!==d,"missing offset"),D.ok(d+3<b.length,"Trying to write beyond buffer length"),y(c,3.4028234663852886e38,-3.4028234663852886e38)),a("./buffer_ieee754").writeIEEE754(b,c,d,e,23,4)}function C(b,c,d,e,f){f||(D.ok(void 0!==c&&null!==c,"missing value"),D.ok("boolean"==typeof e,"missing or invalid endian"),D.ok(void 0!==d&&null!==d,"missing offset"),D.ok(d+7<b.length,"Trying to write beyond buffer length"),y(c,1.7976931348623157e308,-1.7976931348623157e308)),a("./buffer_ieee754").writeIEEE754(b,c,d,e,52,8)}var D=a("assert");c.INSPECT_MAX_BYTES=50,d.byteLength=function(a,b){switch(b||"utf8"){case"hex":return a.length/2;case"utf8":case"utf-8":return f(a).length;case"ascii":return a.length;case"base64":return h(a).length;default:throw new Error("Unknown encoding")}},d.prototype.utf8Write=function(a,b,c){return d._charsWritten=i(f(a),this,b,c)},d.prototype.asciiWrite=function(a,b,c){return d._charsWritten=i(g(a),this,b,c)},d.prototype.base64Write=function(a,b,c){return d._charsWritten=i(h(a),this,b,c)},d.prototype.base64Slice=function(b,c){var d=Array.prototype.slice.apply(this,arguments);return a("base64-js").fromByteArray(d)},d.prototype.utf8Slice=function(){for(var a=Array.prototype.slice.apply(this,arguments),b="",c="",d=0;d<a.length;)a[d]<=127?(b+=j(c)+String.fromCharCode(a[d]),c=""):c+="%"+a[d].toString(16),d++;return b+j(c)},d.prototype.asciiSlice=function(){for(var a=Array.prototype.slice.apply(this,arguments),b="",c=0;c<a.length;c++)b+=String.fromCharCode(a[c]);return b},d.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=e(this[d]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<SlowBuffer "+a.join(" ")+">"},d.prototype.hexSlice=function(a,b){var c=this.length;(!a||0>a)&&(a=0),(!b||0>b||b>c)&&(b=c);for(var d="",f=a;b>f;f++)d+=e(this[f]);return d},d.prototype.toString=function(a,b,c){if(a=String(a||"utf8").toLowerCase(),b=+b||0,"undefined"==typeof c&&(c=this.length),+c==b)return"";switch(a){case"hex":return this.hexSlice(b,c);case"utf8":case"utf-8":return this.utf8Slice(b,c);case"ascii":return this.asciiSlice(b,c);case"binary":return this.binarySlice(b,c);case"base64":return this.base64Slice(b,c);case"ucs2":case"ucs-2":return this.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},d.prototype.hexWrite=function(a,b,c){b=+b||0;var e=this.length-b;c?(c=+c,c>e&&(c=e)):c=e;var f=a.length;if(f%2)throw new Error("Invalid hex string");c>f/2&&(c=f/2);for(var g=0;c>g;g++){var h=parseInt(a.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");this[b+g]=h}return d._charsWritten=2*g,g},d.prototype.write=function(a,b,c,d){if(isFinite(b))isFinite(c)||(d=c,c=void 0);else{var e=d;d=b,b=c,c=e}b=+b||0;var f=this.length-b;switch(c?(c=+c,c>f&&(c=f)):c=f,d=String(d||"utf8").toLowerCase()){case"hex":return this.hexWrite(a,b,c);case"utf8":case"utf-8":return this.utf8Write(a,b,c);case"ascii":return this.asciiWrite(a,b,c);case"binary":return this.binaryWrite(a,b,c);case"base64":return this.base64Write(a,b,c);case"ucs2":case"ucs-2":return this.ucs2Write(a,b,c);default:throw new Error("Unknown encoding")}},d.prototype.slice=function(a,b){if(void 0===b&&(b=this.length),b>this.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this,b-a,+a)},d.prototype.copy=function(a,b,c,d){for(var e=[],f=c;d>f;f++)D.ok("undefined"!=typeof this[f],"copying undefined buffer bytes!"),e.push(this[f]);for(var f=b;f<b+e.length;f++)a[f]=e[f-b]},c.SlowBuffer=d,c.Buffer=l,l.poolSize=8192;var E;l.isBuffer=function(a){return a instanceof l||a instanceof d},l.concat=function(a,b){if(!Array.isArray(a))throw new Error("Usage: Buffer.concat(list, [totalLength])\n       list should be an Array.");if(0===a.length)return new l(0);if(1===a.length)return a[0];if("number"!=typeof b){b=0;for(var c=0;c<a.length;c++){var d=a[c];b+=d.length}}for(var e=new l(b),f=0,c=0;c<a.length;c++){var d=a[c];d.copy(e,f),f+=d.length}return e},l.prototype.inspect=function(){for(var a=[],b=this.length,d=0;b>d;d++)if(a[d]=e(this.parent[d+this.offset]),d==c.INSPECT_MAX_BYTES){a[d+1]="...";break}return"<Buffer "+a.join(" ")+">"},l.prototype.get=function(a){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]},l.prototype.set=function(a,b){if(0>a||a>=this.length)throw new Error("oob");return this.parent[this.offset+a]=b},l.prototype.write=function(a,b,c,e){if(isFinite(b))isFinite(c)||(e=c,c=void 0);else{var f=e;e=b,b=c,c=f}b=+b||0;var g=this.length-b;c?(c=+c,c>g&&(c=g)):c=g,e=String(e||"utf8").toLowerCase();var h;switch(e){case"hex":h=this.parent.hexWrite(a,this.offset+b,c);break;case"utf8":case"utf-8":h=this.parent.utf8Write(a,this.offset+b,c);break;case"ascii":h=this.parent.asciiWrite(a,this.offset+b,c);break;case"binary":h=this.parent.binaryWrite(a,this.offset+b,c);break;case"base64":h=this.parent.base64Write(a,this.offset+b,c);break;case"ucs2":case"ucs-2":h=this.parent.ucs2Write(a,this.offset+b,c);break;default:throw new Error("Unknown encoding")}return l._charsWritten=d._charsWritten,h},l.prototype.toString=function(a,b,c){switch(a=String(a||"utf8").toLowerCase(),"undefined"==typeof b||0>b?b=0:b>this.length&&(b=this.length),"undefined"==typeof c||c>this.length?c=this.length:0>c&&(c=0),b+=this.offset,c+=this.offset,a){case"hex":return this.parent.hexSlice(b,c);case"utf8":case"utf-8":return this.parent.utf8Slice(b,c);case"ascii":return this.parent.asciiSlice(b,c);case"binary":return this.parent.binarySlice(b,c);case"base64":return this.parent.base64Slice(b,c);case"ucs2":case"ucs-2":return this.parent.ucs2Slice(b,c);default:throw new Error("Unknown encoding")}},l.byteLength=d.byteLength,l.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),"string"==typeof a&&(a=a.charCodeAt(0)),"number"!=typeof a||isNaN(a))throw new Error("value is not a number");if(b>c)throw new Error("end < start");if(c===b)return 0;if(0==this.length)return 0;if(0>b||b>=this.length)throw new Error("start out of bounds");if(0>c||c>this.length)throw new Error("end out of bounds");return this.parent.fill(a,b+this.offset,c+this.offset)},l.prototype.copy=function(a,b,c,d){var e=this;if(c||(c=0),d||(d=this.length),b||(b=0),c>d)throw new Error("sourceEnd < sourceStart");if(d===c)return 0;if(0==a.length||0==e.length)return 0;if(0>b||b>=a.length)throw new Error("targetStart out of bounds");if(0>c||c>=e.length)throw new Error("sourceStart out of bounds");if(0>d||d>e.length)throw new Error("sourceEnd out of bounds");return d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c),this.parent.copy(a.parent,b+a.offset,c+this.offset,d+this.offset)},l.prototype.slice=function(a,b){if(void 0===b&&(b=this.length),b>this.length)throw new Error("oob");if(a>b)throw new Error("oob");return new l(this.parent,b-a,+a+this.offset)},l.prototype.utf8Slice=function(a,b){return this.toString("utf8",a,b)},l.prototype.binarySlice=function(a,b){return this.toString("binary",a,b)},l.prototype.asciiSlice=function(a,b){return this.toString("ascii",a,b)},l.prototype.utf8Write=function(a,b){return this.write(a,b,"utf8")},l.prototype.binaryWrite=function(a,b){return this.write(a,b,"binary")},l.prototype.asciiWrite=function(a,b){return this.write(a,b,"ascii")},l.prototype.readUInt8=function(a,b){var c=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a<c.length,"Trying to read beyond buffer length")),c.parent[c.offset+a]},l.prototype.readUInt16LE=function(a,b){return o(this,a,!1,b)},l.prototype.readUInt16BE=function(a,b){return o(this,a,!0,b)},l.prototype.readUInt32LE=function(a,b){return p(this,a,!1,b)},l.prototype.readUInt32BE=function(a,b){return p(this,a,!0,b)},l.prototype.readInt8=function(a,b){var c,d=this;return b||(D.ok(void 0!==a&&null!==a,"missing offset"),D.ok(a<d.length,"Trying to read beyond buffer length")),c=128&d.parent[d.offset+a],c?-1*(255-d.parent[d.offset+a]+1):d.parent[d.offset+a]},l.prototype.readInt16LE=function(a,b){return q(this,a,!1,b)},l.prototype.readInt16BE=function(a,b){return q(this,a,!0,b)},l.prototype.readInt32LE=function(a,b){return r(this,a,!1,b)},l.prototype.readInt32BE=function(a,b){return r(this,a,!0,b)},l.prototype.readFloatLE=function(a,b){return s(this,a,!1,b)},l.prototype.readFloatBE=function(a,b){return s(this,a,!0,b)},l.prototype.readDoubleLE=function(a,b){return t(this,a,!1,b)},l.prototype.readDoubleBE=function(a,b){return t(this,a,!0,b)},l.prototype.writeUInt8=function(a,b,c){var d=this;c||(D.ok(void 0!==a&&null!==a,"missing value"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b<d.length,"trying to write beyond buffer length"),u(a,255)),d.parent[d.offset+b]=a},l.prototype.writeUInt16LE=function(a,b,c){v(this,a,b,!1,c)},l.prototype.writeUInt16BE=function(a,b,c){v(this,a,b,!0,c)},l.prototype.writeUInt32LE=function(a,b,c){w(this,a,b,!1,c)},l.prototype.writeUInt32BE=function(a,b,c){w(this,a,b,!0,c)},l.prototype.writeInt8=function(a,b,c){var d=this;c||(D.ok(void 0!==a&&null!==a,"missing value"),D.ok(void 0!==b&&null!==b,"missing offset"),D.ok(b<d.length,"Trying to write beyond buffer length"),x(a,127,-128)),a>=0?d.writeUInt8(a,b,c):d.writeUInt8(255+a+1,b,c)},l.prototype.writeInt16LE=function(a,b,c){z(this,a,b,!1,c)},l.prototype.writeInt16BE=function(a,b,c){z(this,a,b,!0,c)},l.prototype.writeInt32LE=function(a,b,c){A(this,a,b,!1,c)},l.prototype.writeInt32BE=function(a,b,c){A(this,a,b,!0,c)},l.prototype.writeFloatLE=function(a,b,c){B(this,a,b,!1,c)},l.prototype.writeFloatBE=function(a,b,c){B(this,a,b,!0,c)},l.prototype.writeDoubleLE=function(a,b,c){C(this,a,b,!1,c)},l.prototype.writeDoubleBE=function(a,b,c){C(this,a,b,!0,c)},d.prototype.readUInt8=l.prototype.readUInt8,d.prototype.readUInt16LE=l.prototype.readUInt16LE,d.prototype.readUInt16BE=l.prototype.readUInt16BE,d.prototype.readUInt32LE=l.prototype.readUInt32LE,d.prototype.readUInt32BE=l.prototype.readUInt32BE,d.prototype.readInt8=l.prototype.readInt8,d.prototype.readInt16LE=l.prototype.readInt16LE,d.prototype.readInt16BE=l.prototype.readInt16BE,d.prototype.readInt32LE=l.prototype.readInt32LE,d.prototype.readInt32BE=l.prototype.readInt32BE,d.prototype.readFloatLE=l.prototype.readFloatLE,d.prototype.readFloatBE=l.prototype.readFloatBE,d.prototype.readDoubleLE=l.prototype.readDoubleLE,d.prototype.readDoubleBE=l.prototype.readDoubleBE,d.prototype.writeUInt8=l.prototype.writeUInt8,d.prototype.writeUInt16LE=l.prototype.writeUInt16LE,d.prototype.writeUInt16BE=l.prototype.writeUInt16BE,d.prototype.writeUInt32LE=l.prototype.writeUInt32LE,d.prototype.writeUInt32BE=l.prototype.writeUInt32BE,d.prototype.writeInt8=l.prototype.writeInt8,d.prototype.writeInt16LE=l.prototype.writeInt16LE,d.prototype.writeInt16BE=l.prototype.writeInt16BE,d.prototype.writeInt32LE=l.prototype.writeInt32LE,d.prototype.writeInt32BE=l.prototype.writeInt32BE,d.prototype.writeFloatLE=l.prototype.writeFloatLE,d.prototype.writeFloatBE=l.prototype.writeFloatBE,d.prototype.writeDoubleLE=l.prototype.writeDoubleLE,d.prototype.writeDoubleBE=l.prototype.writeDoubleBE},{assert:1,"./buffer_ieee754":8,"base64-js":9}],9:[function(a,b,c){!function(a){"use strict";function c(a){var b,c,d,f,g,h;if(a.length%4>0)throw"Invalid string. Length must be a multiple of 4";for(g=a.indexOf("="),g=g>0?a.length-g:0,h=[],d=g>0?a.length-4:a.length,b=0,c=0;d>b;b+=4,c+=3)f=e.indexOf(a[b])<<18|e.indexOf(a[b+1])<<12|e.indexOf(a[b+2])<<6|e.indexOf(a[b+3]),h.push((16711680&f)>>16),h.push((65280&f)>>8),h.push(255&f);return 2===g?(f=e.indexOf(a[b])<<2|e.indexOf(a[b+1])>>4,h.push(255&f)):1===g&&(f=e.indexOf(a[b])<<10|e.indexOf(a[b+1])<<4|e.indexOf(a[b+2])>>2,h.push(f>>8&255),h.push(255&f)),h}function d(a){function b(a){return e[a>>18&63]+e[a>>12&63]+e[a>>6&63]+e[63&a]}var c,d,f,g=a.length%3,h="";for(c=0,f=a.length-g;f>c;c+=3)d=(a[c]<<16)+(a[c+1]<<8)+a[c+2],h+=b(d);switch(g){case 1:d=a[a.length-1],h+=e[d>>2],h+=e[d<<4&63],h+="==";break;case 2:d=(a[a.length-2]<<8)+a[a.length-1],h+=e[d>>10],h+=e[d>>4&63],h+=e[d<<2&63],h+="="}return h}var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";b.exports.toByteArray=c,b.exports.fromByteArray=d}()},{}]},{},[]),b.exports=a("buffer-browserify")},{}],64:[function(a,b,c){var d=b.exports={};d.nextTick=function(){var a="undefined"!=typeof window&&window.setImmediate,b="undefined"!=typeof window&&window.postMessage&&window.addEventListener;if(a)return function(a){return window.setImmediate(a)};if(b){var c=[];return window.addEventListener("message",function(a){var b=a.source;if((b===window||null===b)&&"process-tick"===a.data&&(a.stopPropagation(),c.length>0)){var d=c.shift();d()}},!0),function(a){c.push(a),window.postMessage("process-tick","*")}}return function(a){setTimeout(a,0)}}(),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.binding=function(a){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(a){throw new Error("process.chdir is not supported")}},{}],65:[function(a,b,c){(function(){"use strict";function d(a){var b=function(a){return"string"==typeof a?a:"object"==typeof a&&a.hashCode?a.hashCode():""+a},c=a.declare({instance:{constructor:function(){this.__entries=[],this.__keys=[],this.__values=[]},pushValue:function(a,b){return this.__keys.push(a),this.__values.push(b),this.__entries.push({key:a,value:b}),b},remove:function(a){for(var b,c=null,d=this.__entries,e=this.__keys,f=this.__values,g=d.length-1;g>=0;g--)if((b=d[g])&&b.key===a)return d.splice(g,1),e.splice(g,1),f.splice(g,1),b.value;return c},set:function(a,b){for(var c=null,d=this.__entries,e=this.__values,f=d.length-1;f>=0;f--){var g=d[f];if(g&&a===g.key){e[f]=b,g.value=b,c=b;break}}return c||d.push({key:a,value:b}),c},find:function(a){for(var b,c=null,d=this.__entries,e=d.length-1;e>=0;e--)if(b=d[e],b&&a===b.key){c=b.value;break}return c},getEntrySet:function(){return this.__entries},getKeys:function(){return this.__keys},getValues:function(a){return this.__values}}});return a.declare({instance:{constructor:function(){this.__map={}},entrySet:function(){var a=[],b=this.__map;for(var c in b)b.hasOwnProperty(c)&&(a=a.concat(b[c].getEntrySet()));return a},put:function(a,d){var e=b(a),f=null;return(f=this.__map[e])||(f=this.__map[e]=new c),f.pushValue(a,d),d},remove:function(a){var c=b(a),d=null,e=this.__map[c];return e&&(d=e.remove(a)),d},get:function(a){var c,d=b(a),e=null;return(c=this.__map[d])&&(e=c.find(a)),e},set:function(a,d){var e=b(a),f=null,g=null,h=this.__map;return f=(g=h[e])?g.set(a,d):(h[e]=new c).pushValue(a,d)},contains:function(a){var c=b(a),d=!1,e=null;return(e=this.__map[c])&&(d=!!e.find(a)),d},concat:function(a){if(a instanceof this._static){for(var b=new this._static,c=a.entrySet().concat(this.entrySet()),d=c.length-1;d>=0;d--){var e=c[d];b.put(e.key,e.value)}return b}throw new TypeError("When joining hashtables the joining arg must be a HashTable")},filter:function(b,c){var d=this.entrySet(),e=new this._static;d=a.filter(d,b,c);for(var f=d.length-1;f>=0;f--){var g=d[f];e.put(g.key,g.value)}return e},forEach:function(b,c){var d=this.entrySet();a.forEach(d,b,c)},every:function(b,c){var d=this.entrySet();return a.every(d,b,c)},map:function(b,c){var d=this.entrySet();return a.map(d,b,c)},some:function(b,c){var d=this.entrySet();return a.some(d,b,c)},reduce:function(b,c){var d=this.entrySet();return a.reduce(d,b,c)},reduceRight:function(b,c){var d=this.entrySet();return a.reduceRight(d,b,c)},clear:function(){this.__map={}},keys:function(){var a=[],b=this.__map;for(var c in b)a=a.concat(b[c].getKeys());return a},values:function(){var a=[],b=this.__map;for(var c in b)a=a.concat(b[c].getValues());return a},isEmpty:function(){return 0===this.keys().length}}})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended")().register("declare",a("declare.js")).register(a("is-extended")).register(a("array-extended")))):"function"==typeof define?define(["extended","declare","is-extended","array-extended"],function(a,b,c,e){return d(a().register("declare",b).register(c).register(e))}):this.Ht=d(this.extended().register("declare",this.declare).register(this.isExtended).register(this.arrayExtended))}).call(this)},{"array-extended":52,"declare.js":55,extended:56,"is-extended":66}],66:[function(a,b,c){var d=a("__browserify_Buffer").Buffer;(function(){"use strict";function e(a){function b(a,b){var c=-1,d=0,e=a.length,f=[];for(b=b||0,c+=b;++c<e;)f[d++]=a[c];return f}function c(a){var b=[];for(var c in a)T.call(a,c)&&b.push(c);return b}function e(a,b){if(a===b)return!0;if("undefined"!=typeof d&&d.isBuffer(a)&&d.isBuffer(b)){if(a.length!==b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!==b[c])return!1;return!0}return q(a)&&q(b)?a.getTime()===b.getTime():p(a)&&p(b)?a.source===b.source&&a.global===b.global&&a.multiline===b.multiline&&a.lastIndex===b.lastIndex&&a.ignoreCase===b.ignoreCase:r(a)&&r(b)&&a!==b?!1:"object"!=typeof a&&"object"!=typeof b?a===b:f(a,b)}function f(a,b){var d;if(m(a)||m(b))return!1;if(a.prototype!==b.prototype)return!1;if(W(a))return W(b)?(a=S.call(a),b=S.call(b),e(a,b)):!1;try{var f,g=c(a),h=c(b);if(g.length!==h.length)return!1;for(g.sort(),h.sort(),f=g.length-1;f>=0;f--)if(g[f]!==h[f])return!1;for(f=g.length-1;f>=0;f--)if(d=g[f],!e(a[d],b[d]))return!1}catch(i){return!1}return!0}function g(a){return null!==a&&"object"==typeof a}function h(a){var b=g(a);return b&&a.constructor===Object&&!a.nodeType&&!a.setInterval}function i(a){return W(a)?0===a.length:g(a)?0===c(a).length:r(a)||X(a)?0===a.length:!0}function j(a){return a===!0||a===!1||"[object Boolean]"===U.call(a)}function k(a){return"undefined"==typeof a}function l(a){return!k(a)}function m(a){return k(a)||n(a)}function n(a){return null===a}function o(a,b){return V(b)?a instanceof b:!1}function p(a){return"[object RegExp]"===U.call(a)}function q(a){return"[object Date]"===U.call(a)}function r(a){return"[object String]"===U.call(a)}function s(a){return"[object Number]"===U.call(a)}function t(a){return a===!0}function u(a){return a===!1}function v(a){return!n(a)}function w(a,b){
  return a==b}function x(a,b){return a!=b}function y(a,b){return a===b}function z(a,b){return a!==b}function A(a,b){if(X(b)&&Array.prototype.indexOf||r(b))return b.indexOf(a)>-1;if(X(b))for(var c=0,d=b.length;d>c;c++)if(w(a,b[c]))return!0;return!1}function B(a,b){return!A(a,b)}function C(a,b){return b>a}function D(a,b){return b>=a}function E(a,b){return a>b}function F(a,b){return a>=b}function G(a,b){return r(b)?null!==(""+a).match(b):p(b)?b.test(a):!1}function H(a,b){return!G(a,b)}function I(a,b){return A(b,a)}function J(a,b){return!A(b,a)}function K(a,b,c){return X(a)&&a.length>c?w(a[c],b):!1}function L(a,b,c){return X(a)?!w(a[c],b):!1}function M(a,b){return T.call(a,b)}function N(a,b){return!M(a,b)}function O(a,b){return M(a,"length")?a.length===b:!1}function P(a,b){return M(a,"length")?a.length!==b:!1}function Q(a){Z[a]=function(){this._testers.push(Y[a])}}function R(a){$[a]=function(){var c,d=b(arguments,1),e=Y[a],f=!0;if(d.length<=e.length-1)throw new TypeError("A handler must be defined when calling using switch");if(c=d.pop(),j(c)&&(f=c,c=d.pop()),!V(c))throw new TypeError("handler must be defined");this._cases.push(function(a){return e.apply(Y,a.concat(d))?[f,c.apply(this,a)]:[!1]})}}var S=Array.prototype.slice,T=Object.prototype.hasOwnProperty,U=Object.prototype.toString,V=function(a){return"[object Function]"===U.call(a)};"undefined"==typeof window||V(window.alert)||!function(a){V=function(b){return"[object Function]"===U.call(b)||b===a}}(window.alert);var W=function(a){return"[object Arguments]"===U.call(a)};W(arguments)||(W=function(a){return!(!a||!T.call(a,"callee"))});var X=Array.isArray||function(a){return"[object Array]"===U.call(a)},Y={isFunction:V,isObject:g,isEmpty:i,isHash:h,isNumber:s,isString:r,isDate:q,isArray:X,isBoolean:j,isUndefined:k,isDefined:l,isUndefinedOrNull:m,isNull:n,isArguments:W,instanceOf:o,isRegExp:p,deepEqual:e,isTrue:t,isFalse:u,isNotNull:v,isEq:w,isNeq:x,isSeq:y,isSneq:z,isIn:A,isNotIn:B,isLt:C,isLte:D,isGt:E,isGte:F,isLike:G,isNotLike:H,contains:I,notContains:J,has:M,notHas:N,isLength:O,isNotLength:P,containsAt:K,notContainsAt:L},Z={constructor:function(){this._testers=[]},noWrap:{tester:function(){var a=this._testers;return function(b){for(var c=!1,d=0,e=a.length;e>d&&!c;d++)c=a[d](b);return c}}}},$={constructor:function(){this._cases=[],this.__default=null},def:function(a,b){this.__default=b},noWrap:{switcher:function(){var a=this._cases,c=this.__default;return function(){for(var d,e=!1,f=b(arguments),g=0,h=a.length;h>g&&!e;g++)if(d=a[g](f),d.length>1&&(d[1]||d[0]))return d[1];return!e&&c?c.apply(this,f):void 0}}}};for(var _ in Y)T.call(Y,_)&&(R(_),Q(_));var aa=a.define(Y).expose(Y);return aa.tester=a.define(Z),aa.switcher=a.define($),aa}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=e(a("extended"))):"function"==typeof define&&define.amd?define(["extended"],function(a){return e(a)}):this.isExtended=e(this.extended)}).call(this)},{__browserify_Buffer:63,extended:56}],67:[function(a,b,c){(function(){"use strict";function d(a){function b(a,b){var c=0;return a>b?1:b>a?-1:b?c:1}var c=a.multiply,d=a.declare({instance:{__printNode:function(b,d){var e=[];a.isUndefinedOrNull(b)?(e.push(c("	",d)),e.push("~"),console.log(e.join(""))):(this.__printNode(b.right,d+1),e.push(c("	",d)),e.push(b.data+"\n"),console.log(e.join("")),this.__printNode(b.left,d+1))},constructor:function(a){a=a||{},this.compare=a.compare||b,this.__root=null},insert:function(){throw new Error("Not Implemented")},remove:function(){throw new Error("Not Implemented")},clear:function(){this.__root=null},isEmpty:function(){return!this.__root},traverseWithCondition:function(a,b,c){var e=!0;return a&&(b=b||d.PRE_ORDER,b===d.PRE_ORDER?(e=c(a.data),e&&(e=this.traverseWithCondition(a.left,b,c),e&&(e=this.traverseWithCondition(a.right,b,c)))):b===d.IN_ORDER?(e=this.traverseWithCondition(a.left,b,c),e&&(e=c(a.data),e&&(e=this.traverseWithCondition(a.right,b,c)))):b===d.POST_ORDER?(e=this.traverseWithCondition(a.left,b,c),e&&(e&&(e=this.traverseWithCondition(a.right,b,c)),e&&(e=c(a.data)))):b===d.REVERSE_ORDER&&(e=this.traverseWithCondition(a.right,b,c),e&&(e=c(a.data),e&&(e=this.traverseWithCondition(a.left,b,c))))),e},traverse:function(a,b,c){a&&(b=b||d.PRE_ORDER,b===d.PRE_ORDER?(c(a.data),this.traverse(a.left,b,c),this.traverse(a.right,b,c)):b===d.IN_ORDER?(this.traverse(a.left,b,c),c(a.data),this.traverse(a.right,b,c)):b===d.POST_ORDER?(this.traverse(a.left,b,c),this.traverse(a.right,b,c),c(a.data)):b===d.REVERSE_ORDER&&(this.traverse(a.right,b,c),c(a.data),this.traverse(a.left,b,c)))},forEach:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this,this.traverse(this.__root,c,function(c){a.call(b,c,this)})},map:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=new this._static;return this.traverse(this.__root,c,function(c){e.insert(a.call(b,c,this))}),e},filter:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=new this._static;return this.traverse(this.__root,c,function(c){a.call(b,c,this)&&e.insert(c)}),e},reduce:function(b,c,d){var e=this.toArray(d),f=[e,b];return a.isUndefinedOrNull(c)||f.push(c),a.reduce.apply(a,f)},reduceRight:function(b,c,d){var e=this.toArray(d),f=[e,b];return a.isUndefinedOrNull(c)||f.push(c),a.reduceRight.apply(a,f)},every:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e=!1;return this.traverseWithCondition(this.__root,c,function(c){return e=a.call(b,c,this)}),e},some:function(a,b,c){if("function"!=typeof a)throw new TypeError;c=c||d.IN_ORDER,b=b||this;var e;return this.traverseWithCondition(this.__root,c,function(c){return e=a.call(b,c,this),!e}),e},toArray:function(a){a=a||d.IN_ORDER;var b=[];return this.traverse(this.__root,a,function(a){b.push(a)}),b},contains:function(a){for(var b=!1,c=this.__root;null!==c;){var d=this.compare(a,c.data);d?c=c[-1===d?"left":"right"]:(b=!0,c=null)}return b},find:function(a){for(var b,c=this.__root;c;){var d=this.compare(a,c.data);if(!d){b=c.data;break}c=c[-1===d?"left":"right"]}return b},findLessThan:function(a,b){var c=[],e=this.compare;return this.traverseWithCondition(this.__root,d.IN_ORDER,function(d){var f=e(a,d);return!b&&0===f||1===f?(c.push(d),!0):!1}),c},findGreaterThan:function(a,b){var c=[],e=this.compare;return this.traverse(this.__root,d.REVERSE_ORDER,function(d){var f=e(a,d);return!b&&0===f||-1===f?(c.push(d),!0):!1}),c},print:function(){this.__printNode(this.__root,0)}},"static":{PRE_ORDER:"pre_order",IN_ORDER:"in_order",POST_ORDER:"post_order",REVERSE_ORDER:"reverse_order"}}),e=function(){function a(a,b,c){var d=a.__root;if(null===d||void 0===d)a.__root=f(b);else{for(var g,h=d,i=[],k=[],l=0;;){if(g=i[l]=-1===c(b,h.data)?"left":"right",k[l++]=h,!h[g]){h[g]=f(b);break}h=h[g]}if(!h[g])return null;for(;--l>=0&&(k[l].balance+="right"===i[l]?-1:1,0!==k[l].balance);)if(e(k[l].balance)>1){k[l]=j(k[l],i[l]),0!==l?k[l-1][i[l-1]]=k[l]:a.__root=k[0];break}}}function b(a,b,c){var d=a.__root;if(null!==d&&void 0!==d){for(var f,g,h=d,i=0,j=[],l=[],m={done:!1};;){if(!h)return;if(0===(g=c(b,h.data)))break;f=l[i]=-1===g?"left":"right",j[i++]=h,h=h[f]}var n=h.left,o=h.right;if(n&&o){var p=n;for(l[i]="left",j[i++]=h;p.right;)l[i]="right",j[i++]=p,p=p.right;h.data=p.data,j[i-1][j[i-1]===h?"left":"right"]=p.left}else f=n?"left":"right",0!==i?j[i-1][l[i-1]]=h[f]:a.__root=h[f];for(;--i>=0&&!m.done&&(j[i].balance+="left"===l[i]?-1:1,1!==e(j[i].balance));)e(j[i].balance)>1&&(j[i]=k(j[i],l[i],m),0!==i?j[i-1][l[i-1]]=j[i]:a.__root=j[0])}}var e=Math.abs,f=function(a){return{data:a,balance:0,left:null,right:null}},g=function(a,b,c){var d=a[c];return a[c]=d[b],d[b]=a,d},h=function(a,b,c){return a[c]=g(a[c],c,b),g(a,b,c)},i=function(a,b,c){var d="left"===b?"right":"left",e=a[b],f=e[d];0===f.balance?a.balance=e.balance=0:f.balance===c?(a.balance=-c,e.balance=0):(a.balance=0,e.balance=c),f.balance=0},j=function(a,b){var c="left"===b?"right":"left",d=a[b],e="right"===b?-1:1;return d.balance===e?(a.balance=d.balance=0,a=g(a,c,b)):(i(a,b,e),a=h(a,c,b)),a},k=function(a,b,c){var d="left"===b?"right":"left",e=a[d],f="right"===b?-1:1;return e.balance===-f?(a.balance=e.balance=0,a=g(a,b,d)):e.balance===f?(i(a,d,-f),a=h(a,b,d)):(a.balance=-f,e.balance=f,a=g(a,b,d),c.done=!0),a};return d.extend({instance:{insert:function(b){a(this,b,this.compare)},remove:function(a){b(this,a,this.compare)},__printNode:function(a,b){var d=[];a?(this.__printNode(a.right,b+1),d.push(c("	",b)),d.push(a.data+":"+a.balance+"\n"),console.log(d.join("")),this.__printNode(a.left,b+1)):(d.push(c("	",b)),d.push("~"),console.log(d.join("")))}}})}(),f=function(){function a(a,b){return{data:a,level:b,left:g,right:g}}function b(a){if(0!==a.level&&a.left.level===a.level){var b=a.left;a.left=b.right,b.right=a,a=b}return a}function e(a){if(0!==a.level&&a.right.right.level===a.level){var b=a.right;a.right=b.left,b.left=a,a=b,a.level++}return a}function f(c,d,h){if(c===g)c=a(d,1);else{var i=-1===h(d,c.data)?"left":"right";c[i]=f(c[i],d,h),c=b(c),c=e(c)}return c}var g={level:0,data:null},h=function(a,c,d){var f,i;if(a!==g){var j=d(c,a.data);if(0===j)if(f=a.left,i=a.right,f!==g&&i!==g){for(var k=f;k.right!==g;)k=k.right;a.data=k.data,a.left=h(f,k.data,d)}else a=a[f===g?"right":"left"];else{var l=-1===j?"left":"right";a[l]=h(a[l],c,d)}}if(a!==g){var m=a.level,n=a.left.level,o=a.right.level;(m-1>n||m-1>o)&&(o>--a.level&&(a.right.level=a.level),a=b(a),a=e(a))}return a};return d.extend({instance:{isEmpty:function(){return this.__root===g||this._super(arguments)},insert:function(a){this.__root||(this.__root=g),this.__root=f(this.__root,a,this.compare)},remove:function(a){this.__root=h(this.__root,a,this.compare)},traverseWithCondition:function(a){var b=!0;return a!==g?this._super(arguments):b},traverse:function(a){a!==g&&this._super(arguments)},contains:function(){return this.__root!==g?this._super(arguments):!1},__printNode:function(a,b){var d=[];a&&a.data?(this.__printNode(a.right,b+1),d.push(c("	",b)),d.push(a.data+":"+a.level+"\n"),console.log(d.join("")),this.__printNode(a.left,b+1)):(d.push(c("	",b)),d.push("~"),console.log(d.join("")))}}})}(),g=d.extend({instance:{insert:function(a){if(!this.__root)return this.__root={data:a,parent:null,left:null,right:null},this.__root;for(var b=this.compare,c=this.__root;null!==c;){var d=b(a,c.data);if(!d)return;var e=-1===d?"left":"right",f=c[e];if(!f)return c[e]={data:a,parent:c,left:null,right:null};c=f}},remove:function(a){if(null!==this.__root){for(var b,c={right:this.__root},d=c,e=null,f="right";null!==d[f];){b=d,d=d[f];var g=this.compare(a,d.data);g||(e=d),f=-1===g?"left":"right"}null!==e&&(e.data=d.data,b[b.right===d?"right":"left"]=d[null===d.left?"right":"left"]),this.__root=c.right}}}}),h=function(){var a="RED",b="BLACK",e=function(a){return null!==a&&a.red},f=function(a){return{data:a,red:!0,left:null,right:null}},g=function(a,b,c){if(!a)return f(b);var d=c(b,a.data);if(d){var j=-1===d?"left":"right",k="left"===j?"right":"left";a[j]=g(a[j],b,c);var l=a[j];if(e(l)){var m=a[k];e(m)?(a.red=!0,l.red=!1,m.red=!1):e(l[j])?a=h(a,k):e(l[k])&&(a=i(a,k))}}return a},h=function(a,b){var c="left"===b?"right":"left",d=a[c];return a[c]=d[b],d[b]=a,a.red=!0,d.red=!1,d},i=function(a,b){var c="left"===b?"right":"left";return a[c]=h(a[c],c),h(a,b)},j=function(a,b,c,d){if(a){var f;if(0===d(b,a.data)){if(!a.left||!a.right){var g=a[a.left?"left":"right"];return e(a)?c.done=!0:e(g)&&(g.red=!1,c.done=!0),g}for(var h,i=a.right;null!==i.left;)h=i,i=i.left;h&&(h.left=null),a.data=i.data,b=i.data}f=-1===d(b,a.data)?"left":"right",a[f]=j(a[f],b,c,d),c.done||(a=k(a,f,c))}else c.done=!0;return a},k=function(a,b,c){var d="left"===b?"right":"left",f=a,g=f[d];if(e(g)&&(a=h(a,b),g=f[d]),null!==g)if(e(g.left)||e(g.right)){var j=f.red,k=a===f;f=(e(g[d])?h:i)(f,b),f.red=j,f.left.red=f.right.red=0,k?a=f:a[b]=f,c.done=!0}else e(f)&&(c.done=!0),f.red=0,g.red=1;return a};return d.extend({instance:{insert:function(a){this.__root=g(this.__root,a,this.compare),this.__root.red=!1},remove:function(a){var b={done:!1},c=j(this.__root,a,b,this.compare);return null!==c&&(c.red=0),this.__root=c,a},__printNode:function(d,e){var f=[];d?(this.__printNode(d.right,e+1),f.push(c("	",e)),f.push((d.red?a:b)+":"+d.data+"\n"),console.log(f.join("")),this.__printNode(d.left,e+1)):(f.push(c("	",e)),f.push("~"),console.log(f.join("")))}}})}();return{Tree:d,AVLTree:e,AnderssonTree:f,BinaryTree:g,RedBlackTree:h,IN_ORDER:d.IN_ORDER,PRE_ORDER:d.PRE_ORDER,POST_ORDER:d.POST_ORDER,REVERSE_ORDER:d.REVERSE_ORDER}}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended")().register("declare",a("declare.js")).register(a("is-extended")).register(a("array-extended")).register(a("string-extended")))):"function"==typeof define?define(["extended","declare.js","is-extended","array-extended","string-extended"],function(a,b,c,e,f){return d(a().register("declare",b).register(c).register(e).register(f))}):this.leafy=d(this.extended().register("declare",this.declare).register(this.isExtended).register(this.arrayExtended).register(this.stringExtended))}).call(this)},{"array-extended":52,"declare.js":55,extended:56,"is-extended":66,"string-extended":70}],68:[function(a,b,c){(function(){"use strict";function d(a,b,c){function d(a,b){var c,d;for(c in b)t.call(b,c)&&(d=b[c],c in a&&a[c]===d||(a[c]=d));return a}function e(a,b){var c,d,f;for(c in b)t.call(b,c)&&(d=b[c],f=a[c],p(f,d)||(r(f)&&r(d)?a[c]=e(f,d):r(d)?a[c]=e({},d):a[c]=d));return a}function f(a){a||(a={});for(var b=1,c=arguments.length;c>b;b++)d(a,arguments[b]);return a}function g(a){a||(a={});for(var b=1,c=arguments.length;c>b;b++)e(a,arguments[b]);return a}function h(a,b){var c=a.prototype||a;return f(c,b),a}function i(a,b,c){if(!r(a)||!u(b))throw new TypeError;for(var d,e=l(a),f=0,g=e.length;g>f;++f)d=e[f],b.call(c||a,a[d],d,a);return a}function j(a,b,c){if(!r(a)||!u(b))throw new TypeError;for(var d,e,f=l(a),g={},h=0,i=f.length;i>h;++h)d=f[h],e=a[d],b.call(c||a,e,d,a)&&(g[d]=e);return g}function k(a){if(!r(a))throw new TypeError;for(var b=l(a),c=[],d=0,e=b.length;e>d;++d)c.push(a[b[d]]);return c}function l(a){if(!r(a))throw new TypeError;var b=[];for(var c in a)t.call(a,c)&&b.push(c);return b}function m(a){if(!r(a))throw new TypeError;for(var b,c=l(a),d={},e=0,f=c.length;f>e;++e)b=c[e],d[a[b]]=b;return d}function n(a){if(!r(a))throw new TypeError;for(var b,c=l(a),d=[],e=0,f=c.length;f>e;++e)b=c[e],d.push([b,a[b]]);return d}function o(a,b){if(!r(a))throw new TypeError;q(b)&&(b=[b]);for(var c,d=s(l(a),b),e={},f=0,g=d.length;g>f;++f)c=d[f],e[c]=a[c];return e}var p=b.deepEqual,q=b.isString,r=b.isHash,s=c.difference,t=Object.prototype.hasOwnProperty,u=b.isFunction,v={forEach:i,filter:j,invert:m,values:k,toArray:n,keys:l,omit:o},w={extend:h,merge:f,deepMerge:g,omit:o},x=a.define(b.isObject,w).define(r,v).define(b.isFunction,{extend:h}).expose({hash:v}).expose(w),y=x.extend;return x.extend=function(){return 1===arguments.length?y.extend.apply(x,arguments):void h.apply(null,arguments)},x}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","array-extended"],function(a,b,c){return d(a,b,c)}):this.objectExtended=d(this.extended,this.isExtended,this.arrayExtended)}).call(this)},{"array-extended":52,extended:56,"is-extended":66}],69:[function(a,b,c){var d=a("__browserify_process");(function(){"use strict";function e(a,b,c,e,f,g){function h(a,b){return function(){try{l(a.apply(null,arguments)).addCallback(b).addErrback(b)}catch(c){b.errback(c)}}}function i(a,b,c){var d=(new G).callback();return v(a,function(a){d=d.then(c?a:B(null,a)),c||(d=d.then(function(a){return b.push(a),b}))}),d}function j(a){return!w(a)&&y(a.then)}function k(a){var b=new G;return a.then(A(b,"callback"),A(b,"errback")),b.promise()}function l(a){var b;return a=C(arguments),a.length?1===a.length?(a=a.pop(),j(a)?a.addCallback&&a.addErrback?(b=new G,a.addCallback(b.callback),a.addErrback(b.errback)):b=k(a):b=x(a)&&c.every(a,j)?new H(a,!0).promise():(new G).callback(a)):b=new H(c.map(a,function(a){return l(a)}),!0).promise():b=(new G).callback(a).promise(),b}function m(a,b){return function(){var c=new G,d=C(arguments);return d.push(c.resolve),a.apply(b||this,d),c.promise()}}function n(a){if(x(a))return i(a,[],!1);throw new Error("When calling promise.serial the first argument must be an array")}function o(a){if(x(a))return i(a,[],!0);throw new Error("When calling promise.serial the first argument must be an array")}function p(a,b){a=C(arguments);var c=!1;b=a.pop();var d=l(a);return function(){return c?l(b.apply(this,arguments)):(a=arguments,d.then(A(this,function(){return c=!0,b.apply(this,a)})))}}function q(){return new G}function r(a){return new H(a,!0).promise()}function s(a){return q().errback(a)}function t(a){return q().callback(a)}var u,v=c.forEach,w=e.isUndefinedOrNull,x=e.isArray,y=e.isFunction,z=e.isBoolean,A=f.bind,B=f.bindIgnore,C=g.argsToArray;if("function"==typeof setImmediate)u="undefined"!=typeof window?setImmediate.bind(window):setImmediate;else if("undefined"!=typeof d)u=function(a){d.nextTick(a)};else if("undefined"!=typeof MessageChannel){var D=new MessageChannel,E={},F=E;D.port1.onmessage=function(){E=E.next;var a=E.task;delete E.task,a()},u=function(a){F=F.next={task:a},D.port2.postMessage(0)}}else u=function(a){setTimeout(a,0)};var G=a({instance:{__fired:!1,__results:null,__error:null,__errorCbs:null,__cbs:null,constructor:function(){this.__errorCbs=[],this.__cbs=[],f.bindAll(this,["callback","errback","resolve","classic","__resolve","addCallback","addErrback"])},__resolve:function(){if(!this.__fired){this.__fired=!0;var a,b=this.__error?this.__errorCbs:this.__cbs,c=b.length,d=this.__error||this.__results;for(a=0;c>a;a++)this.__callNextTick(b[a],d)}},__callNextTick:function(a,b){u(function(){a.apply(this,b)})},addCallback:function(a){return a&&(j(a)&&a.callback&&(a=a.callback),this.__fired&&this.__results?this.__callNextTick(a,this.__results):this.__cbs.push(a)),this},addErrback:function(a){return a&&(j(a)&&a.errback&&(a=a.errback),this.__fired&&this.__error?this.__callNextTick(a,this.__error):this.__errorCbs.push(a)),this},callback:function(a){return this.__fired||(this.__results=arguments,this.__resolve()),this.promise()},errback:function(a){return this.__fired||(this.__error=arguments,this.__resolve()),this.promise()},resolve:function(a,b){return a?this.errback(a):this.callback.apply(this,C(arguments,1)),this},classic:function(a){return"function"==typeof a&&(this.addErrback(function(b){a(b)}),this.addCallback(function(){a.apply(this,[null].concat(C(arguments)))})),this},then:function(a,b){var c=new G,d=c;return y(b)&&(d=h(b,c)),this.addErrback(d),y(a)?this.addCallback(h(a,c)):this.addCallback(c),c.promise()},both:function(a){return this.then(a,a)},promise:function(){var a={then:A(this,"then"),both:A(this,"both"),promise:function(){return a}};return v(["addCallback","addErrback","classic"],function(b){a[b]=A(this,function(){return this[b].apply(this,arguments),a})},this),a}}}),H=G.extend({instance:{__results:null,__errors:null,__promiseLength:0,__defLength:0,__firedLength:0,normalizeResults:!1,constructor:function(a,b){this.__errors=[],this.__results=[],this.normalizeResults=z(b)?b:!1,this._super(arguments),a&&a.length?(this.__defLength=a.length,v(a,this.__addPromise,this)):this.__resolve()},__addPromise:function(a,b){a.then(A(this,function(){var a=C(arguments);a.unshift(b),this.callback.apply(this,a)}),A(this,function(){var a=C(arguments);a.unshift(b),this.errback.apply(this,a)}))},__resolve:function(){if(!this.__fired){this.__fired=!0;var a,b=this.__errors.length?this.__errorCbs:this.__cbs,c=b.length,d=this.__errors.length?this.__errors:this.__results;for(a=0;c>a;a++)this.__callNextTick(b[a],d)}},__callNextTick:function(a,b){u(function(){a.apply(null,[b])})},addCallback:function(a){return a&&(j(a)&&a.callback&&(a=A(a,"callback")),this.__fired&&!this.__errors.length?this.__callNextTick(a,this.__results):this.__cbs.push(a)),this},addErrback:function(a){return a&&(j(a)&&a.errback&&(a=A(a,"errback")),this.__fired&&this.__errors.length?this.__callNextTick(a,this.__errors):this.__errorCbs.push(a)),this},callback:function(a){if(this.__fired)throw new Error("Already fired!");var b=C(arguments);return this.normalizeResults&&(b=b.slice(1),b=1===b.length?b.pop():b),this.__results[a]=b,this.__firedLength++,this.__firedLength===this.__defLength&&this.__resolve(),this.promise()},errback:function(a){if(this.__fired)throw new Error("Already fired!");var b=C(arguments);return this.normalizeResults&&(b=b.slice(1),b=1===b.length?b.pop():b),this.__errors[a]=b,this.__firedLength++,this.__firedLength===this.__defLength&&this.__resolve(),this.promise()}}});return b.define({isPromiseLike:j}).expose({isPromiseLike:j,when:l,wrap:m,wait:p,serial:n,chain:o,Promise:G,PromiseList:H,promise:q,defer:q,deferredList:r,reject:s,resolve:t})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=e(a("declare.js"),a("extended"),a("array-extended"),a("is-extended"),a("function-extended"),a("arguments-extended"))):"function"==typeof define&&define.amd?define(["declare","extended","array-extended","is-extended","function-extended","arguments-extended"],function(a,b,c,d,f,g){return e(a,b,c,d,f,g)}):this.promiseExtended=e(this.declare,this.extended,this.arrayExtended,this.isExtended,this.functionExtended,this.argumentsExtended)}).call(this)},{__browserify_process:64,"arguments-extended":51,"array-extended":52,"declare.js":55,extended:56,"function-extended":59,"is-extended":66}],70:[function(a,b,c){(function(){"use strict";function d(a,b,c,d){function e(a,b){var c=a;if(x.test(b)){var d=b.match(x),e=d[1],f=d[3],g=d[4];g&&(g=parseInt(g,10),c=c.length<g?h(c,g,f,e):i(c,g))}return c}function f(a,c){var d;if(!b.isNumber(a))throw new Error("stringExtended.format : when using %d the parameter must be a number!");if(d=""+a,x.test(c)){var e=c.match(x),f=e[1],g=e[2],j=e[3],k=e[4];g&&(d=(a>0?"+":"")+d),k&&(k=parseInt(k,10),d=d.length<k?h(d,k,j||"0",f):i(d,k))}return d}function g(a,b){var c,d=b.match(y),e=0;d&&(e=parseInt(d[0],10),isNaN(e)&&(e=0));try{c=s(a,null,e)}catch(f){throw new Error("stringExtended.format : Unable to parse json from ",a)}return c}function h(a,b,c,d){a=""+a,c=c||" ";for(var e=a.length;b>e;)d?a+=c:a=c+a,e++;return a}function i(a,c,d){var e=a;if(b.isString(e)){if(a.length>c)if(d){var f=a.length;e=a.substring(f-c,f)}else e=a.substring(0,c)}else e=i(""+e,c);return e}function j(a,d){if(d instanceof Array){var h=0,i=d.length;return a.replace(v,function(a,b,j){var k,l;if(!(i>h))return a;if(k=d[h++],"%s"===a||"%d"===a||"%D"===a)l=k+"";else if("%Z"===a)l=k.toUTCString();else if("%j"===a)try{l=s(k)}catch(m){throw new Error("stringExtended.format : Unable to parse json from ",k)}else switch(b=b.replace(/^\[|\]$/g,""),j){case"s":l=e(k,b);break;case"d":l=f(k,b);break;case"j":l=g(k,b);break;case"D":l=c.format(k,b);break;case"Z":l=c.format(k,b,!0)}return l})}if(t(d))return a.replace(w,function(a,h,i){if(i=d[i],!b.isUndefined(i)){if(!h)return""+i;if(b.isString(i))return e(i,h);if(b.isNumber(i))return f(i,h);if(b.isDate(i))return c.format(i,h);if(b.isObject(i))return g(i,h)}return a});var k=u.call(arguments).slice(1);return j(a,k)}function k(a,b){var c=[];return a&&(a.indexOf(b)>0?c=a.replace(/\s+/g,"").split(b):c.push(a)),c}function l(a,b){var c=[];if(b)for(var d=0;b>d;d++)c.push(a);return c.join("")}function m(a,c){var d,e,f;if(c)if(b.isArray(a))for(d=[],e=0,f=a.length;f>e;e++)d.push(m(a[e],c));else if(c instanceof Array)for(d=a,e=0,f=c.length;f>e;e++)d=m(d,c[e]);else c in z&&(d="["+z[c]+"m"+a+"[0m");return d}function n(a,b){return a.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g,function(a){return b&&-1!==d.indexOf(b,a)?a:"\\"+a})}function o(a){return a.replace(/^\s*|\s*$/g,"")}function p(a){return a.replace(/^\s*/,"")}function q(a){return a.replace(/\s*$/,"")}function r(a){return 0===a.length}var s;"undefined"==typeof JSON?!function(){function a(a){return 10>a?"0"+a:a}function c(c){return b.isDate(c)?isFinite(c.valueOf())?c.getUTCFullYear()+"-"+a(c.getUTCMonth()+1)+"-"+a(c.getUTCDate())+"T"+a(c.getUTCHours())+":"+a(c.getUTCMinutes())+":"+a(c.getUTCSeconds())+"Z":null:i(c)?c.valueOf():c}function d(a){return j.lastIndex=0,j.test(a)?'"'+a.replace(j,function(a){var b=k[a];return"string"==typeof b?b:"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+a+'"'}function e(a,b){var i,j,k,l,m,n=f,o=b[a];switch(o&&(o=c(o)),"function"==typeof h&&(o=h.call(b,a,o)),typeof o){case"string":return d(o);case"number":return isFinite(o)?String(o):"null";case"boolean":case"null":return String(o);case"object":if(!o)return"null";if(f+=g,m=[],"[object Array]"===Object.prototype.toString.apply(o)){for(l=o.length,i=0;l>i;i+=1)m[i]=e(i,o)||"null";return k=0===m.length?"[]":f?"[\n"+f+m.join(",\n"+f)+"\n"+n+"]":"["+m.join(",")+"]",f=n,k}if(h&&"object"==typeof h)for(l=h.length,i=0;l>i;i+=1)"string"==typeof h[i]&&(j=h[i],k=e(j,o),k&&m.push(d(j)+(f?": ":":")+k));else for(j in o)Object.prototype.hasOwnProperty.call(o,j)&&(k=e(j,o),k&&m.push(d(j)+(f?": ":":")+k));return k=0===m.length?"{}":f?"{\n"+f+m.join(",\n"+f)+"\n"+n+"}":"{"+m.join(",")+"}",f=n,k}}var f,g,h,i=b.tester().isString().isNumber().isBoolean().tester(),j=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,k={"\b":"\\b","	":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};s=function(a,b,c){var d;if(f="",g="","number"==typeof c)for(d=0;c>d;d+=1)g+=" ";else"string"==typeof c&&(g=c);if(h=b,b&&"function"!=typeof b&&("object"!=typeof b||"number"!=typeof b.length))throw new Error("JSON.stringify");return e("",{"":a})}}():s=JSON.stringify;var t=b.isHash,u=Array.prototype.slice,v=/%((?:-?\+?.?\d*)?|(?:\[[^\[|\]]*\]))?([sjdDZ])/g,w=/\{(?:\[([^\[|\]]*)\])?(\w+)\}/g,x=/(-?)(\+?)([A-Z|a-z|\W]?)([1-9][0-9]*)?$/,y=/([1-9][0-9]*)$/g,z={bold:1,bright:1,italic:3,underline:4,blink:5,inverse:7,crossedOut:9,red:31,green:32,yellow:33,blue:34,magenta:35,cyan:36,white:37,redBackground:41,greenBackground:42,yellowBackground:43,blueBackground:44,magentaBackground:45,cyanBackground:46,whiteBackground:47,encircled:52,overlined:53,grey:90,black:90},A={SMILEY:"☺",SOLID_SMILEY:"☻",HEART:"♥",DIAMOND:"♦",CLOVE:"♣",SPADE:"♠",DOT:"•",SQUARE_CIRCLE:"◘",CIRCLE:"○",FILLED_SQUARE_CIRCLE:"◙",MALE:"♂",FEMALE:"♀",EIGHT_NOTE:"♪",DOUBLE_EIGHTH_NOTE:"♫",SUN:"☼",PLAY:"►",REWIND:"◄",UP_DOWN:"↕",PILCROW:"¶",SECTION:"§",THICK_MINUS:"▬",SMALL_UP_DOWN:"↨",UP_ARROW:"↑",DOWN_ARROW:"↓",RIGHT_ARROW:"→",LEFT_ARROW:"←",RIGHT_ANGLE:"∟",LEFT_RIGHT_ARROW:"↔",TRIANGLE:"▲",DOWN_TRIANGLE:"▼",HOUSE:"⌂",C_CEDILLA:"Ç",U_UMLAUT:"ü",E_ACCENT:"é",A_LOWER_CIRCUMFLEX:"â",A_LOWER_UMLAUT:"ä",A_LOWER_GRAVE_ACCENT:"à",A_LOWER_CIRCLE_OVER:"å",C_LOWER_CIRCUMFLEX:"ç",E_LOWER_CIRCUMFLEX:"ê",E_LOWER_UMLAUT:"ë",E_LOWER_GRAVE_ACCENT:"è",I_LOWER_UMLAUT:"ï",I_LOWER_CIRCUMFLEX:"î",I_LOWER_GRAVE_ACCENT:"ì",A_UPPER_UMLAUT:"Ä",A_UPPER_CIRCLE:"Å",E_UPPER_ACCENT:"É",A_E_LOWER:"æ",A_E_UPPER:"Æ",O_LOWER_CIRCUMFLEX:"ô",O_LOWER_UMLAUT:"ö",O_LOWER_GRAVE_ACCENT:"ò",U_LOWER_CIRCUMFLEX:"û",U_LOWER_GRAVE_ACCENT:"ù",Y_LOWER_UMLAUT:"ÿ",O_UPPER_UMLAUT:"Ö",U_UPPER_UMLAUT:"Ü",CENTS:"¢",POUND:"£",YEN:"¥",CURRENCY:"¤",PTS:"₧",FUNCTION:"ƒ",A_LOWER_ACCENT:"á",I_LOWER_ACCENT:"í",O_LOWER_ACCENT:"ó",U_LOWER_ACCENT:"ú",N_LOWER_TILDE:"ñ",N_UPPER_TILDE:"Ñ",A_SUPER:"ª",O_SUPER:"º",UPSIDEDOWN_QUESTION:"¿",SIDEWAYS_L:"⌐",NEGATION:"¬",ONE_HALF:"½",ONE_FOURTH:"¼",UPSIDEDOWN_EXCLAMATION:"¡",DOUBLE_LEFT:"«",DOUBLE_RIGHT:"»",LIGHT_SHADED_BOX:"░",MEDIUM_SHADED_BOX:"▒",DARK_SHADED_BOX:"▓",VERTICAL_LINE:"│",MAZE__SINGLE_RIGHT_T:"┤",MAZE_SINGLE_RIGHT_TOP:"┐",MAZE_SINGLE_RIGHT_BOTTOM_SMALL:"┘",MAZE_SINGLE_LEFT_TOP_SMALL:"┌",MAZE_SINGLE_LEFT_BOTTOM_SMALL:"└",MAZE_SINGLE_LEFT_T:"├",MAZE_SINGLE_BOTTOM_T:"┴",MAZE_SINGLE_TOP_T:"┬",MAZE_SINGLE_CENTER:"┼",MAZE_SINGLE_HORIZONTAL_LINE:"─",MAZE_SINGLE_RIGHT_DOUBLECENTER_T:"╡",MAZE_SINGLE_RIGHT_DOUBLE_BL:"╛",MAZE_SINGLE_RIGHT_DOUBLE_T:"╢",MAZE_SINGLE_RIGHT_DOUBLEBOTTOM_TOP:"╖",MAZE_SINGLE_RIGHT_DOUBLELEFT_TOP:"╕",MAZE_SINGLE_LEFT_DOUBLE_T:"╞",MAZE_SINGLE_BOTTOM_DOUBLE_T:"╧",MAZE_SINGLE_TOP_DOUBLE_T:"╤",MAZE_SINGLE_TOP_DOUBLECENTER_T:"╥",MAZE_SINGLE_BOTTOM_DOUBLECENTER_T:"╨",MAZE_SINGLE_LEFT_DOUBLERIGHT_BOTTOM:"╘",MAZE_SINGLE_LEFT_DOUBLERIGHT_TOP:"╒",MAZE_SINGLE_LEFT_DOUBLEBOTTOM_TOP:"╓",MAZE_SINGLE_LEFT_DOUBLETOP_BOTTOM:"╙",MAZE_SINGLE_LEFT_TOP:"Γ",MAZE_SINGLE_RIGHT_BOTTOM:"╜",MAZE_SINGLE_LEFT_CENTER:"╟",MAZE_SINGLE_DOUBLECENTER_CENTER:"╫",MAZE_SINGLE_DOUBLECROSS_CENTER:"╪",MAZE_DOUBLE_LEFT_CENTER:"╣",MAZE_DOUBLE_VERTICAL:"║",MAZE_DOUBLE_RIGHT_TOP:"╗",MAZE_DOUBLE_RIGHT_BOTTOM:"╝",MAZE_DOUBLE_LEFT_BOTTOM:"╚",MAZE_DOUBLE_LEFT_TOP:"╔",MAZE_DOUBLE_BOTTOM_T:"╩",MAZE_DOUBLE_TOP_T:"╦",MAZE_DOUBLE_LEFT_T:"╠",MAZE_DOUBLE_HORIZONTAL:"═",MAZE_DOUBLE_CROSS:"╬",SOLID_RECTANGLE:"█",THICK_LEFT_VERTICAL:"▌",THICK_RIGHT_VERTICAL:"▐",SOLID_SMALL_RECTANGLE_BOTTOM:"▄",SOLID_SMALL_RECTANGLE_TOP:"▀",PHI_UPPER:"Φ",INFINITY:"∞",INTERSECTION:"∩",DEFINITION:"≡",PLUS_MINUS:"±",GT_EQ:"≥",LT_EQ:"≤",THEREFORE:"⌠",SINCE:"∵",DOESNOT_EXIST:"∄",EXISTS:"∃",FOR_ALL:"∀",EXCLUSIVE_OR:"⊕",BECAUSE:"⌡",DIVIDE:"÷",APPROX:"≈",DEGREE:"°",BOLD_DOT:"∙",DOT_SMALL:"·",CHECK:"√",ITALIC_X:"✗",SUPER_N:"ⁿ",SQUARED:"²",CUBED:"³",SOLID_BOX:"■",PERMILE:"‰",REGISTERED_TM:"®",COPYRIGHT:"©",TRADEMARK:"™",BETA:"β",GAMMA:"γ",ZETA:"ζ",ETA:"η",IOTA:"ι",KAPPA:"κ",LAMBDA:"λ",NU:"ν",XI:"ξ",OMICRON:"ο",RHO:"ρ",UPSILON:"υ",CHI_LOWER:"φ",CHI_UPPER:"χ",PSI:"ψ",ALPHA:"α",ESZETT:"ß",PI:"π",SIGMA_UPPER:"Σ",SIGMA_LOWER:"σ",MU:"µ",TAU:"τ",THETA:"Θ",OMEGA:"Ω",DELTA:"δ",PHI_LOWER:"φ",EPSILON:"ε"},B={toArray:k,pad:h,truncate:i,multiply:l,format:j,style:m,escape:n,trim:o,trimLeft:p,trimRight:q,isEmpty:r};return a.define(b.isString,B).define(b.isArray,{style:m}).expose(B).expose({characters:A})}"undefined"!=typeof c?"undefined"!=typeof b&&b.exports&&(b.exports=d(a("extended"),a("is-extended"),a("date-extended"),a("array-extended"))):"function"==typeof define&&define.amd?define(["extended","is-extended","date-extended","array-extended"],function(a,b,c,e){return d(a,b,c,e)}):this.stringExtended=d(this.extended,this.isExtended,this.dateExtended,this.arrayExtended)}).call(this)},{"array-extended":52,"date-extended":53,extended:56,"is-extended":66}]},{},[1]);