calc-transporte
Version:
Calculadora de transporte AMBA
2 lines (1 loc) • 29 kB
JavaScript
!function(f){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=f();else if("function"==typeof define&&define.amd)define([],f);else{var g;g="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,g.calcTransporte=f()}}(function(){return function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){return o(e[i][1][r]||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r}()({1:[function(require,module,exports){module.exports={sube:[{date:"2018-02-01",values:[{trip:1,value:1},{trip:2,value:.5},{trip:3,value:.25}]}],subway:[{date:"2016-10-01",values:[{trip:21,value:.8},{trip:31,value:.7},{trip:41,value:.6}]}],benefit1:[{date:"1999-01-01",value:.45}],benefit2:[{date:"2016-05-01",value:4},{date:"2018-05-01",value:6},{date:"2018-07-01",value:7}]}},{}],2:[function(require,module,exports){module.exports={bus:[{date:"2010-01-01",values:[{id:"0",price:1.1},{id:"4",price:1.75}]},{date:"2011-12-01",values:[{id:"0",price:1.5},{id:"4",price:2.2}]},{date:"2014-01-01",values:[{id:"0",price:2.5},{id:"1",price:2.7},{id:"2",price:2.85},{id:"3",price:3.9},{id:"4",price:4.5}]},{date:"2014-07-01",values:[{id:"0",price:3},{id:"1",price:3.25},{id:"2",price:3.5},{id:"3",price:4},{id:"4",price:4.7}]},{date:"2016-04-01",values:[{id:"0",price:6},{id:"1",price:6.25},{id:"2",price:6.5},{id:"3",price:6.75},{id:"4",price:7}]},{date:"2018-02-01",values:[{id:"0",price:8},{id:"1",price:8.25},{id:"2",price:8.5},{id:"3",price:9},{id:"4",price:9.5}]},{date:"2018-04-01",values:[{id:"0",price:9},{id:"1",price:9.25},{id:"2",price:9.5},{id:"3",price:10.25},{id:"4",price:10.75}]},{date:"2018-06-01",values:[{id:"0",price:10},{id:"1",price:10.5},{id:"2",price:10.75},{id:"3",price:11.25},{id:"4",price:11.75}]},{date:"2018-08-15",values:[{id:"0",price:11},{id:"1",price:11.75},{id:"2",price:12.25},{id:"3",price:13},{id:"4",price:13.75}]},{date:"2018-09-15",values:[{id:"0",price:12},{id:"1",price:13},{id:"2",price:13.75},{id:"3",price:14.5},{id:"4",price:15.25}]},{date:"2018-10-15",values:[{id:"0",price:13},{id:"1",price:14.25},{id:"2",price:15},{id:"3",price:15.75},{id:"4",price:16.5}]},{date:"2019-01-12",values:[{id:"0",price:15},{id:"1",price:16.5},{id:"2",price:17.5},{id:"3",price:18.5},{id:"4",price:19}]},{date:"2019-02-15",values:[{id:"0",price:16.5},{id:"1",price:18},{id:"2",price:19},{id:"3",price:20},{id:"4",price:21}]},{date:"2019-03-15",values:[{id:"0",price:18},{id:"1",price:20},{id:"2",price:21},{id:"3",price:22},{id:"4",price:23}]}],train:{sanmartin:[{date:"2016-04-01",values:[{id:"0",price:4},{id:"1",price:5},{id:"2",price:6}]},{date:"2018-02-01",values:[{id:"0",price:5.5},{id:"1",price:6.75},{id:"2",price:8}]},{date:"2018-04-01",values:[{id:"0",price:6.25},{id:"1",price:7.5},{id:"2",price:9}]},{date:"2018-06-01",values:[{id:"0",price:6.75},{id:"1",price:8.25},{id:"2",price:10}]},{date:"2018-08-15",values:[{id:"0",price:7.5},{id:"1",price:9.5},{id:"2",price:11.25}]},{date:"2018-09-15",values:[{id:"0",price:8.25},{id:"1",price:10.25},{id:"2",price:12.5}]},{date:"2018-10-15",values:[{id:"0",price:8.75},{id:"1",price:11},{id:"2",price:13.25}]},{date:"2019-01-12",values:[{id:"0",price:10},{id:"1",price:12.25},{id:"2",price:15}]},{date:"2019-02-15",values:[{id:"0",price:11.25},{id:"1",price:14},{id:"2",price:16.75}]},{date:"2019-03-15",values:[{id:"0",price:12.25},{id:"1",price:15.5},{id:"2",price:18.5}]}],mitre:[{date:"2016-04-01",values:[{id:"0",price:4},{id:"1",price:5},{id:"2",price:6}]},{date:"2018-02-01",values:[{id:"0",price:5.5},{id:"1",price:6.75},{id:"2",price:8}]},{date:"2018-04-01",values:[{id:"0",price:6.25},{id:"1",price:7.5},{id:"2",price:9}]},{date:"2018-06-01",values:[{id:"0",price:6.75},{id:"1",price:8.25},{id:"2",price:10}]},{date:"2018-08-15",values:[{id:"0",price:7.5},{id:"1",price:9.5},{id:"2",price:11.25}]},{date:"2018-09-15",values:[{id:"0",price:8.25},{id:"1",price:10.25},{id:"2",price:12.5}]},{date:"2018-10-15",values:[{id:"0",price:8.75},{id:"1",price:11},{id:"2",price:13.25}]},{date:"2019-01-12",values:[{id:"0",price:10},{id:"1",price:12.25},{id:"2",price:15}]},{date:"2019-02-15",values:[{id:"0",price:11.25},{id:"1",price:14},{id:"2",price:16.75}]},{date:"2019-03-15",values:[{id:"0",price:12.25},{id:"1",price:15.5},{id:"2",price:18.5}]}],sarmiento:[{date:"2016-04-01",values:[{id:"0",price:4},{id:"1",price:5},{id:"2",price:6}]},{date:"2018-02-01",values:[{id:"0",price:5.5},{id:"1",price:6.75},{id:"2",price:8}]},{date:"2018-04-01",values:[{id:"0",price:6.25},{id:"1",price:7.5},{id:"2",price:9}]},{date:"2018-06-01",values:[{id:"0",price:6.75},{id:"1",price:8.25},{id:"2",price:10}]},{date:"2018-08-15",values:[{id:"0",price:7.5},{id:"1",price:9.5},{id:"2",price:11.25}]},{date:"2018-09-15",values:[{id:"0",price:8.25},{id:"1",price:10.25},{id:"2",price:12.5}]},{date:"2018-10-15",values:[{id:"0",price:8.75},{id:"1",price:11},{id:"2",price:13.25}]},{date:"2019-01-12",values:[{id:"0",price:10},{id:"1",price:12.25},{id:"2",price:15}]},{date:"2019-02-15",values:[{id:"0",price:11.25},{id:"1",price:14},{id:"2",price:16.75}]},{date:"2019-03-15",values:[{id:"0",price:12.25},{id:"1",price:15.5},{id:"2",price:18.5}]}],belgranosur:[{date:"2016-04-01",values:[{id:"0",price:2},{id:"1",price:2.4},{id:"2",price:3.4}]},{date:"2018-02-01",values:[{id:"0",price:2.75},{id:"1",price:3.25},{id:"2",price:4.5}]},{date:"2018-04-01",values:[{id:"0",price:3},{id:"1",price:3.75},{id:"2",price:5}]},{date:"2018-06-01",values:[{id:"0",price:3.25},{id:"1",price:4},{id:"2",price:5.5}]},{date:"2018-08-15",values:[{id:"0",price:4},{id:"1",price:5},{id:"2",price:6.75}]},{date:"2018-09-15",values:[{id:"0",price:4.75},{id:"1",price:5.75},{id:"2",price:7.75}]},{date:"2018-10-15",values:[{id:"0",price:5.5},{id:"1",price:6.5},{id:"2",price:8.5}]},{date:"2018-12-01",values:[{id:"0",price:5.5},{id:"1",price:7.25},{id:"2",price:8.75}]},{date:"2019-01-12",values:[{id:"0",price:6.25},{id:"1",price:8.25},{id:"2",price:10}]},{date:"2019-02-15",values:[{id:"0",price:7},{id:"1",price:9.25},{id:"2",price:11}]},{date:"2019-03-15",values:[{id:"0",price:7.75},{id:"1",price:10.25},{id:"2",price:12.25}]}],urquiza:[{date:"2016-04-01",values:[{id:"0",price:2},{id:"1",price:3},{id:"2",price:3.6}]},{date:"2018-02-01",values:[{id:"0",price:3},{id:"1",price:4},{id:"2",price:5}]},{date:"2018-04-01",values:[{id:"0",price:3.25},{id:"1",price:4.5},{id:"2",price:5.5}]},{date:"2018-06-01",values:[{id:"0",price:3.5},{id:"1",price:5},{id:"2",price:6}]},{date:"2018-08-15",values:[{id:"0",price:4.25},{id:"1",price:6},{id:"2",price:7.25}]},{date:"2018-09-15",values:[{id:"0",price:5},{id:"1",price:7},{id:"2",price:8.5}]},{date:"2018-10-15",values:[{id:"0",price:5.75},{id:"1",price:8},{id:"2",price:9.5}]}],belgranonorte:[{date:"2016-04-01",values:[{id:"0",price:2},{id:"1",price:2.4},{id:"2",price:3.4},{id:"3",price:3.5},{id:"4",price:4},{id:"5",price:4.8}]},{date:"2018-02-01",values:[{id:"0",price:2.75},{id:"1",price:3.25},{id:"2",price:4.5},{id:"3",price:4.75},{id:"4",price:5.5},{id:"5",price:6.5}]},{date:"2018-04-01",values:[{id:"0",price:3},{id:"1",price:3.75},{id:"2",price:5},{id:"3",price:5.25},{id:"4",price:6.25},{id:"5",price:7.25}]},{date:"2018-06-01",values:[{id:"0",price:3.25},{id:"1",price:4},{id:"2",price:5.5},{id:"3",price:5.75},{id:"4",price:6.75},{id:"5",price:8}]},{date:"2018-08-15",values:[{id:"0",price:3.75},{id:"1",price:4.5},{id:"2",price:6.25},{id:"3",price:6.5},{id:"4",price:7.75},{id:"5",price:9.25}]},{date:"2018-09-15",values:[{id:"0",price:4.25},{id:"1",price:5},{id:"2",price:6.75},{id:"3",price:7.25},{id:"4",price:8.5},{id:"5",price:10}]},{date:"2018-10-15",values:[{id:"0",price:4.75},{id:"1",price:5.5},{id:"2",price:7.5},{id:"3",price:8},{id:"4",price:9.25},{id:"5",price:11}]}],roca:[{date:"2016-04-01",values:[{id:"0",price:2},{id:"1",price:3},{id:"2",price:4}]},{date:"2018-02-01",values:[{id:"0",price:2.75},{id:"1",price:4},{id:"2",price:5.5}]},{date:"2018-04-01",values:[{id:"0",price:3},{id:"1",price:4.5},{id:"2",price:6.25}]},{date:"2018-06-01",values:[{id:"0",price:3.25},{id:"1",price:5},{id:"2",price:6}]},{date:"2018-08-15",values:[{id:"0",price:4},{id:"1",price:5},{id:"2",price:6.75}]},{date:"2018-09-15",values:[{id:"0",price:4.75},{id:"1",price:5.75},{id:"2",price:7.75}]},{date:"2018-10-15",values:[{id:"0",price:5.5},{id:"1",price:6.5},{id:"2",price:8.5}]},{date:"2018-12-01",values:[{id:"0",price:5.5},{id:"1",price:7.25},{id:"2",price:8.75}]},{date:"2019-01-12",values:[{id:"0",price:6.25},{id:"1",price:8.25},{id:"2",price:10}]},{date:"2019-02-15",values:[{id:"0",price:7},{id:"1",price:9.25},{id:"2",price:11}]},{date:"2019-03-15",values:[{id:"0",price:7.75},{id:"1",price:10.25},{id:"2",price:12.25}]}]},subway:[{date:"2016-10-01",values:[{id:"0",price:7.5}]},{date:"2018-08-01",values:[{id:"0",price:12.5}]},{date:"2018-11-20",values:[{id:"0",price:13.5}]},{date:"2018-12-20",values:[{id:"0",price:14.5}]},{date:"2019-01-20",values:[{id:"0",price:15.5}]},{date:"2019-02-20",values:[{id:"0",price:16.5}]}],trolley:[{date:"2016-10-01",values:[{id:"0",price:2.5}]},{date:"2018-08-01",values:[{id:"0",price:4}]}]}},{}],3:[function(require,module,exports){"use strict";module.exports=require("./lib/calc_transporte")},{"./lib/calc_transporte":5}],4:[function(require,module,exports){"use strict";function Benefit(values){var self=this;values=defaults(clone(values||{}),defaultBenefitValues),self.values=values}var utils=require("./utils"),defaults=require("lodash.defaults"),flowRight=require("lodash.flowright"),defaultBenefitValues=require("../data/benefit-values.json"),clone=flowRight(JSON.parse,JSON.stringify);Benefit.prototype.getSubeBenefit=function(trip,date){return getBenefit(this.values.sube,trip,date)},Benefit.prototype.getSubwayBenefit=function(trip,date){return getBenefit(this.values.subway,trip,date)},Benefit.prototype.getSocialBenefit=function(transport,date){var self=this,data=self.values.benefit1;"subway"==transport&&(data=self.values.benefit2);var _date=utils.getClosestDate(date,data);return _date>date?-1:data.find(function(element){return element.date===_date}).value};var getBenefit=function(values,index,date){var result=1,_date=utils.getClosestDate(date,values);return _date>date?result:(values.find(function(element){return element.date===_date}).values.forEach(function(item){index>=item.trip&&(result=item.value)}),result)};module.exports=Benefit},{"../data/benefit-values.json":1,"./utils":7,"lodash.defaults":8,"lodash.flowright":9}],5:[function(require,module,exports){"use strict";function CalcTransporte(values,benefitValues){var self=this;self.transport=new Transport(values),self.benefit=new Benefit(benefitValues)}var defaults=require("lodash.defaults"),flowRight=require("lodash.flowright"),forEach=require("lodash.foreach"),utils=require("./utils"),Transport=require("./transport"),Benefit=require("./benefit"),defaultOptions={date:null,roundtrip:!0,benefit:!1,weekTimes:5,trips:[]},clone=flowRight(JSON.parse,JSON.stringify);CalcTransporte.prototype.getTransports=function(){return this.transport.getTransports()},CalcTransporte.prototype.getTrainLines=function(){return this.transport.getTrainLines()},CalcTransporte.prototype.getPricesByDate=function(date){return this.transport.getPricesByDate(date)},CalcTransporte.prototype.calculate=function(options){var self=this;options.date=utils.formatDate(options.date),options=defaults(clone(options||{}),defaultOptions),forEach(options,function(n,key){null!=defaultOptions[key]&&typeof n!=typeof defaultOptions[key]&&(n=defaultOptions[key],options[key]=defaultOptions[key])});var indexTimes,times=4*options.weekTimes,trips=createTrips(self,options),result={going:{cost:0,costDaily:0,savingDaily:0,trip:[]},returning:{cost:0,costDaily:0,savingDaily:0,trip:[]},discounts:{sube:0,social:0,subway:0}},subwayTimes=0;for(indexTimes=0;indexTimes<times;indexTimes++)trips.forEach(function(trip){var price=trip.price;if("subway"==trip.transport){subwayTimes++;var priceWithDiscountSubway=price*self.benefit.getSubwayBenefit(subwayTimes,trip.date);result.discounts.subway+=price-priceWithDiscountSubway,price=priceWithDiscountSubway}else{var price=price*trip.socialBenefit;result.discounts.social+=trip.price-price}var priceWithDiscountSube=price*trip.subeBenefit,_priceTrip=0,_discountSube=0;price-priceWithDiscountSube<8?(_priceTrip=priceWithDiscountSube,_discountSube=price-priceWithDiscountSube):(_priceTrip=price-8,_discountSube=8),result[trip.type].cost+=_priceTrip,result.discounts.sube+=_discountSube,0==indexTimes&&(result[trip.type].trip[trip.index-1]={transport:trip.transport,price:trip.price,priceWithDiscount:_priceTrip},result[trip.type].costDaily+=_priceTrip,result[trip.type].savingDaily+=trip.price-_priceTrip)});var final={};return final.goingDailyTotal=result.going.costDaily,final.goingDailySaving=result.going.savingDaily,final.returningDailyTotal=result.returning.costDaily,final.returningDailySaving=result.returning.savingDaily,final.savingMonthly=result.discounts.sube+result.discounts.social+result.discounts.subway,final.costMonthly=result.going.cost+result.returning.cost,final.goingTrip=result.going.trip,final.returningTrip=result.returning.trip,final};var createTrips=function(self,options){var trips=[],getPrices=!1,date=utils.formatDate(new Date);return null!=options.date&&(date=options.date,getPrices=!0),trips=trips.concat(createTrip(self,options,options.trips,"going",date,getPrices)),options.roundtrip&&(trips=trips.concat(createTrip(self,options,options.trips.reverse(),"returning",date,getPrices))),trips},createTrip=function(self,options,trips,type,date,getPrices){var _trips=[],index=1,subeNetworkIndex=1;return trips.forEach(function(trip){var _trip={transport:null,index:null,type:type,price:null,subeBenefit:1,socialBenefit:1,date:date};_trip.transport=trip.transport,_trip.index=index,_trip.price=getPrices?self.transport.getPriceByTransportLineDateAndId(trip.transport,trip.line,date,trip.id):trip.price,options.benefit&&"subway"!=trip.transport&&(_trip.socialBenefit=self.benefit.getSocialBenefit(trip.transport,date)),"subway"==trip.transport&&index>1&&"subway"==options.trips[index-2].transport||subeNetworkIndex>6||(_trip.subeBenefit=self.benefit.getSubeBenefit(subeNetworkIndex,date),subeNetworkIndex++),_trips[index-1]=_trip,index++}),_trips};module.exports=CalcTransporte},{"./benefit":4,"./transport":6,"./utils":7,"lodash.defaults":8,"lodash.flowright":9,"lodash.foreach":10}],6:[function(require,module,exports){"use strict";function Transport(values){var self=this;values=defaults(clone(values||{}),defaultsValues),self.values=values}var defaultsValues=require("../data/default-values.json"),defaults=require("lodash.defaults"),flowRight=require("lodash.flowright"),utils=require("./utils"),clone=flowRight(JSON.parse,JSON.stringify);Transport.prototype.getTransports=function(){var self=this;return Object.keys(self.values)},Transport.prototype.getTrainLines=function(){var self=this;return Object.keys(self.values.train)},Transport.prototype.getPricesByDate=function(date){var self=this,transports=self.getTransports(),_result={};return transports.forEach(function(transport){self.getPricesByTransportAndDate(transport,date,_result)}),_result},Transport.prototype.getPricesByTransportAndDate=function(transport,date,_result){var self=this;if("train"==transport){_result[transport]={};self.getTrainLines().forEach(function(line){var _date=date;void 0!==date&&null!=date||(_date=utils.formatDate(new Date)),_date=utils.getClosestDate(_date,self.values[transport][line]),_result[transport][line]={date:_date,values:null},_result[transport][line].values=self.values[transport][line].find(function(element){return element.date===_date}).values})}else{var _date=date;void 0!==date&&null!=date||(_date=utils.formatDate(new Date)),_date=utils.getClosestDate(_date,self.values[transport]),_result[transport]={date:_date,values:null},_result[transport].values=self.values[transport].find(function(element){return element.date===_date}).values}return _result},Transport.prototype.getPriceByTransportLineDateAndId=function(transport,line,date,id){var self=this,transports=self.getTransports(),_result={};self.getPricesByTransportAndDate(transport,date,_result),transports.forEach(function(transport){self.getPricesByTransportAndDate(transport,date,_result)});var data;data="train"==transport?_result[transport][line].values:_result[transport].values;var ids=data.map(function(o){return o.id});ids.sort(utils.Comparator);var idToFind=utils.getNearest(ids,id);return data.find(function(element){return element.id===idToFind}).price},module.exports=Transport},{"../data/default-values.json":2,"./utils":7,"lodash.defaults":8,"lodash.flowright":9}],7:[function(require,module,exports){"use strict";var formatDate=function(date){if(null==date)return null;var year=date.getFullYear(),month=date.getMonth()+1;month<10&&(month="0"+month);var day=date.getDate();return day<10&&(day="0"+day),year+"-"+month+"-"+day},Comparator=function(a,b){return a<b?-1:a>b?1:0},getClosestDate=function(date,data){var dates=data.map(function(o){return o.date});return dates.sort(Comparator),getNearest(dates,date)},getNearest=function(array,item){var nearest,BreakException={};try{array.forEach(function(x){if(nearest&&!(item>=x))throw BreakException;nearest=x})}catch(e){if(e!==BreakException)throw e}return nearest};module.exports={formatDate:formatDate,Comparator:Comparator,getClosestDate:getClosestDate,getNearest:getNearest}},{}],8:[function(require,module,exports){function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}function baseTimes(n,iteratee){for(var index=-1,result=Array(n);++index<n;)result[index]=iteratee(index);return result}function arrayLikeKeys(value,inherited){var result=isArray(value)||isArguments(value)?baseTimes(value.length,String):[],length=result.length,skipIndexes=!!length;for(var key in value)!inherited&&!hasOwnProperty.call(value,key)||skipIndexes&&("length"==key||isIndex(key,length))||result.push(key);return result}function assignInDefaults(objValue,srcValue,key,object){return void 0===objValue||eq(objValue,objectProto[key])&&!hasOwnProperty.call(object,key)?srcValue:objValue}function assignValue(object,key,value){var objValue=object[key];hasOwnProperty.call(object,key)&&eq(objValue,value)&&(void 0!==value||key in object)||(object[key]=value)}function baseKeysIn(object){if(!isObject(object))return nativeKeysIn(object);var isProto=isPrototype(object),result=[];for(var key in object)("constructor"!=key||!isProto&&hasOwnProperty.call(object,key))&&result.push(key);return result}function baseRest(func,start){return start=nativeMax(void 0===start?func.length-1:start,0),function(){for(var args=arguments,index=-1,length=nativeMax(args.length-start,0),array=Array(length);++index<length;)array[index]=args[start+index];index=-1;for(var otherArgs=Array(start+1);++index<start;)otherArgs[index]=args[index];return otherArgs[start]=array,apply(func,this,otherArgs)}}function copyObject(source,props,object,customizer){object||(object={});for(var index=-1,length=props.length;++index<length;){var key=props[index],newValue=customizer?customizer(object[key],source[key],key,object,source):void 0;assignValue(object,key,void 0===newValue?source[key]:newValue)}return object}function isIndex(value,length){return!!(length=null==length?MAX_SAFE_INTEGER:length)&&("number"==typeof value||reIsUint.test(value))&&value>-1&&value%1==0&&value<length}function isIterateeCall(value,index,object){if(!isObject(object))return!1;var type=typeof index;return!!("number"==type?isArrayLike(object)&&isIndex(index,object.length):"string"==type&&index in object)&&eq(object[index],value)}function isPrototype(value){var Ctor=value&&value.constructor;return value===("function"==typeof Ctor&&Ctor.prototype||objectProto)}function nativeKeysIn(object){var result=[];if(null!=object)for(var key in Object(object))result.push(key);return result}function eq(value,other){return value===other||value!==value&&other!==other}function isArguments(value){return isArrayLikeObject(value)&&hasOwnProperty.call(value,"callee")&&(!propertyIsEnumerable.call(value,"callee")||objectToString.call(value)==argsTag)}function isArrayLike(value){return null!=value&&isLength(value.length)&&!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isObjectLike(value){return!!value&&"object"==typeof value}function keysIn(object){return isArrayLike(object)?arrayLikeKeys(object,!0):baseKeysIn(object)}var MAX_SAFE_INTEGER=9007199254740991,argsTag="[object Arguments]",funcTag="[object Function]",genTag="[object GeneratorFunction]",reIsUint=/^(?:0|[1-9]\d*)$/,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,propertyIsEnumerable=objectProto.propertyIsEnumerable,nativeMax=Math.max,isArray=Array.isArray,assignInWith=function(assigner){return baseRest(function(object,sources){var index=-1,length=sources.length,customizer=length>1?sources[length-1]:void 0,guard=length>2?sources[2]:void 0;for(customizer=assigner.length>3&&"function"==typeof customizer?(length--,customizer):void 0,guard&&isIterateeCall(sources[0],sources[1],guard)&&(customizer=length<3?void 0:customizer,length=1),object=Object(object);++index<length;){var source=sources[index];source&&assigner(object,source,index,customizer)}return object})}(function(object,source,srcIndex,customizer){copyObject(source,keysIn(source),object,customizer)}),defaults=baseRest(function(args){return args.push(void 0,assignInDefaults),apply(assignInWith,void 0,args)});module.exports=defaults},{}],9:[function(require,module,exports){(function(global){function apply(func,thisArg,args){switch(args.length){case 0:return func.call(thisArg);case 1:return func.call(thisArg,args[0]);case 2:return func.call(thisArg,args[0],args[1]);case 3:return func.call(thisArg,args[0],args[1],args[2])}return func.apply(thisArg,args)}function arrayPush(array,values){for(var index=-1,length=values.length,offset=array.length;++index<length;)array[offset+index]=values[index];return array}function baseFlatten(array,depth,predicate,isStrict,result){var index=-1,length=array.length;for(predicate||(predicate=isFlattenable),result||(result=[]);++index<length;){var value=array[index];depth>0&&predicate(value)?depth>1?baseFlatten(value,depth-1,predicate,isStrict,result):arrayPush(result,value):isStrict||(result[result.length]=value)}return result}function baseRest(func,start){return start=nativeMax(void 0===start?func.length-1:start,0),function(){for(var args=arguments,index=-1,length=nativeMax(args.length-start,0),array=Array(length);++index<length;)array[index]=args[start+index];index=-1;for(var otherArgs=Array(start+1);++index<start;)otherArgs[index]=args[index];return otherArgs[start]=array,apply(func,this,otherArgs)}}function isFlattenable(value){return isArray(value)||isArguments(value)||!!(spreadableSymbol&&value&&value[spreadableSymbol])}function isArguments(value){return isArrayLikeObject(value)&&hasOwnProperty.call(value,"callee")&&(!propertyIsEnumerable.call(value,"callee")||objectToString.call(value)==argsTag)}function isArrayLike(value){return null!=value&&isLength(value.length)&&!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isObjectLike(value){return!!value&&"object"==typeof value}var FUNC_ERROR_TEXT="Expected a function",MAX_SAFE_INTEGER=9007199254740991,argsTag="[object Arguments]",funcTag="[object Function]",genTag="[object GeneratorFunction]",freeGlobal="object"==typeof global&&global&&global.Object===Object&&global,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,Symbol=root.Symbol,propertyIsEnumerable=objectProto.propertyIsEnumerable,spreadableSymbol=Symbol?Symbol.isConcatSpreadable:void 0,nativeMax=Math.max,isArray=Array.isArray,flowRight=function(fromRight){return baseRest(function(funcs){funcs=baseFlatten(funcs,1);var length=funcs.length,index=length;for(fromRight&&funcs.reverse();index--;)if("function"!=typeof funcs[index])throw new TypeError(FUNC_ERROR_TEXT);return function(){for(var index=0,result=length?funcs[index].apply(this,arguments):arguments[0];++index<length;)result=funcs[index].call(this,result);return result}})}(!0);module.exports=flowRight}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],10:[function(require,module,exports){function arrayEach(array,iteratee){for(var index=-1,length=array?array.length:0;++index<length&&!1!==iteratee(array[index],index,array););return array}function baseTimes(n,iteratee){for(var index=-1,result=Array(n);++index<n;)result[index]=iteratee(index);return result}function arrayLikeKeys(value,inherited){var result=isArray(value)||isArguments(value)?baseTimes(value.length,String):[],length=result.length,skipIndexes=!!length;for(var key in value)!inherited&&!hasOwnProperty.call(value,key)||skipIndexes&&("length"==key||isIndex(key,length))||result.push(key);return result}function baseForOwn(object,iteratee){return object&&baseFor(object,iteratee,keys)}function baseKeys(object){if(!isPrototype(object))return nativeKeys(object);var result=[];for(var key in Object(object))hasOwnProperty.call(object,key)&&"constructor"!=key&&result.push(key);return result}function isIndex(value,length){return!!(length=null==length?MAX_SAFE_INTEGER:length)&&("number"==typeof value||reIsUint.test(value))&&value>-1&&value%1==0&&value<length}function isPrototype(value){var Ctor=value&&value.constructor;return value===("function"==typeof Ctor&&Ctor.prototype||objectProto)}function forEach(collection,iteratee){return(isArray(collection)?arrayEach:baseEach)(collection,"function"==typeof iteratee?iteratee:identity)}function isArguments(value){return isArrayLikeObject(value)&&hasOwnProperty.call(value,"callee")&&(!propertyIsEnumerable.call(value,"callee")||objectToString.call(value)==argsTag)}function isArrayLike(value){return null!=value&&isLength(value.length)&&!isFunction(value)}function isArrayLikeObject(value){return isObjectLike(value)&&isArrayLike(value)}function isFunction(value){var tag=isObject(value)?objectToString.call(value):"";return tag==funcTag||tag==genTag}function isLength(value){return"number"==typeof value&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return!!value&&("object"==type||"function"==type)}function isObjectLike(value){return!!value&&"object"==typeof value}function keys(object){return isArrayLike(object)?arrayLikeKeys(object):baseKeys(object)}function identity(value){return value}var MAX_SAFE_INTEGER=9007199254740991,argsTag="[object Arguments]",funcTag="[object Function]",genTag="[object GeneratorFunction]",reIsUint=/^(?:0|[1-9]\d*)$/,objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty,objectToString=objectProto.toString,propertyIsEnumerable=objectProto.propertyIsEnumerable,nativeKeys=function(func,transform){return function(arg){return func(transform(arg))}}(Object.keys,Object),baseEach=function(eachFunc,fromRight){return function(collection,iteratee){if(null==collection)return collection;if(!isArrayLike(collection))return eachFunc(collection,iteratee);for(var length=collection.length,index=fromRight?length:-1,iterable=Object(collection);(fromRight?index--:++index<length)&&!1!==iteratee(iterable[index],index,iterable););return collection}}(baseForOwn),baseFor=function(fromRight){return function(object,iteratee,keysFunc){for(var index=-1,iterable=Object(object),props=keysFunc(object),length=props.length;length--;){var key=props[fromRight?length:++index];if(!1===iteratee(iterable[key],key,iterable))break}return object}}(),isArray=Array.isArray;module.exports=forEach},{}]},{},[3])(3)});