diff --git a/.bower.json b/.bower.json index 7f90513f16..8d11dcc4cb 100644 --- a/.bower.json +++ b/.bower.json @@ -1,7 +1,7 @@ { "name": "alasql", "description":"AlaSQL.js - JavaScript SQL database library for relational and graph data manipulation with support of localStorage, IndexedDB, and Excel", - "version": "0.1.8", + "version": "0.1.9", "license": "MIT", "keywords": [ "sql", @@ -31,7 +31,7 @@ }, "dependencies": { "js-xls": "~0.7.5", - "js-xlsx":"0.8.0", + "xlsx":"0.8.0", "es6-promise":"2.1.0" }, "devDependencies": { @@ -54,4 +54,4 @@ "bin", "lib" ] -} \ No newline at end of file +} diff --git a/CHANGELOG.md b/CHANGELOG.md index dce1b9c2f0..621ba203d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +### 0.1.9 "Torino" (29.05.2015 - 31.05.2015) +* SERIAL data type added +* Changed package.json +* Sample application AlaSQL Codex (alasql.org/codex) +* Changed type conversion procedure for INTEGER, JSON and other types +* TypeScript definition file: alasql.d.ts + ### 0.1.8 "Pisa" (22.05.2015 - 28.05.2015) * SELECT FROM syntax * Export to multiple sheets workbook @@ -9,7 +16,6 @@ * VALUE OF SELECT operator * bitHound file - ### 0.1.7 "Parma" (17.05.2015 - 22.05.2015) * Fixed BETWEEN AND and AND parsing priority bug (KPI1:95%) * Fixed SUM() with NULL(undefined) values diff --git a/README.md b/README.md index c1e57369b7..c5b56538ce 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,8 @@ AlaSQL - ([à la] (http://en.wiktionary.org/wiki/%C3%A0_la) [SQL](http://en.wiki ### This release: -- Version: 0.1.8 "Pisa" -- Updated: May 28, 2015, +- Version: 0.1.9 "Torino" +- Updated: May 31, 2015, - Test cover: [SQLLOGICTEST=62%, NIST=24%](TESTLOG.md) - [Change log](CHANGELOG.md) - [Release plan](RELEASES.md). @@ -96,12 +96,12 @@ and require the alasql.js file ## Why we are proud of AlaSQL? -* AlaSQL ♥ d3.js [see why](#d3js--alasql) -* AlaSQL ♥ Meteor [see why](#alasql-and-meteor) -* AlaSQL ♥ Angular.js [see why](#angularjs-and-alasqljs) -* AlaSQL ♥ Google Maps [see why](#google-maps--alasql) -* AlaSQL ♥ your JSON data [see why](#javascript-sugar) -* AlaSQL ♥ Google Spreadsheets [see why](#google-maps--alasql) +* AlaSQL ♥ d3.js [see why](https://github.com/agershun/alasql/wiki/readme#d3js--alasql) +* AlaSQL ♥ Meteor [see why](https://github.com/agershun/alasql/wiki/readme#alasql-and-meteor) +* AlaSQL ♥ Angular.js [see why](https://github.com/agershun/alasql/wiki/readme#angularjs-and-alasqljs) +* AlaSQL ♥ Google Maps [see why](https://github.com/agershun/alasql/wiki/readme#google-maps--alasql) +* AlaSQL ♥ your JSON data [see why](https://github.com/agershun/alasql/wiki/readme#javascript-sugar) +* AlaSQL ♥ Google Spreadsheets [see why](https://github.com/agershun/alasql/wiki/readme#google-maps--alasql) * Search paths in graph data * Read and write Excel, CSV, TAB, JSON, and text files to/from the database * Got some CPU intensive SQL? AlaSQL plays nice as a WebWorker diff --git a/console/alasql-worker.min.js b/console/alasql-worker.min.js new file mode 100644 index 0000000000..0b7e8cb9f8 --- /dev/null +++ b/console/alasql-worker.min.js @@ -0,0 +1 @@ +(function(root,factory){if(typeof define==="function"&&define.amd){define([],factory)}else if(typeof exports==="object"){module.exports=factory()}else{root.alasql=factory()}})(this,function(){function alasql(sql,params,cb){var id=alasql.lastid++;alasql.buffer[id]=cb;alasql.webworker.postMessage({id:id,sql:sql,params:params})}if(typeof importScripts==="function"){}else if(typeof exports!="object"){alasql.worker=function(path,paths,cb){if(path===true)path=undefined;if(typeof path=="undefined"){var sc=document.getElementsByTagName("script");for(var i=0;i1){var sql="REQUIRE "+paths.map(function(p){return'"'+p+'"'}).join(",");alasql(sql,[],cb)}}else if(path===false){delete alasql.webworker;return}}}alasql.lastid=0;alasql.buffer={};alasql.worker();return alasql}); \ No newline at end of file diff --git a/console/alasql.min.js b/console/alasql.min.js new file mode 100644 index 0000000000..a1cc1d1dcb --- /dev/null +++ b/console/alasql.min.js @@ -0,0 +1,10 @@ +(function(root,factory){if(typeof define==="function"&&define.amd){define([],factory)}else if(typeof exports==="object"){module.exports=factory()}else{root.alasql=factory()}})(this,function(){var alasql=function alasql(sql,params,cb,scope){if(typeof importScripts!="function"&&alasql.webworker){var id=alasql.lastid++;alasql.buffer[id]=cb;alasql.webworker.postMessage({id:id,sql:sql,params:params})}else{if(arguments.length==0){return new yy.Select({columns:[new yy.Column({columnid:"*"})],from:[new yy.ParamValue({param:0})]})}else if(arguments.length==1&&typeof sql=="object"&&sql instanceof Array){var select=new yy.Select({columns:[new yy.Column({columnid:"*"})],from:[new yy.ParamValue({param:0})]});select.preparams=[sql];return select}else{if(typeof sql=="string"&&sql[0]=="#"&&typeof document=="object"){sql=document.querySelector(sql).textContent}else if(typeof sql=="object"&&sql instanceof HTMElement){sql=sql.textContent}else if(typeof sql=="function"){sql=sql.toString().slice(14,-3)}return alasql.exec(sql,params,cb,scope)}}};alasql.version="0.1.9";alasql.debug=undefined;getAlaSQLPath();function getAlaSQLPath(){alasql.path="";if(typeof importScripts==="function"){alasql.path=""}else if(typeof exports!="undefined"){alasql.path=__dirname}else if(typeof Meteor=="object"&&Meteor.isClient){alasql.path="/packages/dist/"}else if(typeof Meteor=="object"&&Meteor.isServer){alasql.path="assets/packages/dist/"}else if(typeof document!="undefined"){var sc=document.getElementsByTagName("script");for(var i=0;i1&&($$[$0-4].toUpperCase()=="MAX"||$$[$0-4].toUpperCase()=="MIN")){this.$=new yy.FuncValue({funcid:$$[$0-4],args:$$[$0-2]})}else{this.$=new yy.AggrValue({aggregatorid:$$[$0-4].toUpperCase(),expression:$$[$0-2].pop(),over:$$[$0]})}break;case 299:this.$=new yy.AggrValue({aggregatorid:$$[$0-5].toUpperCase(),expression:$$[$0-2],distinct:true,over:$$[$0]});break;case 300:this.$=new yy.AggrValue({aggregatorid:$$[$0-5].toUpperCase(),expression:$$[$0-2],over:$$[$0]});break;case 302:case 303:this.$=new yy.Over;yy.extend(this.$,$$[$0-1]);break;case 304:this.$=new yy.Over;yy.extend(this.$,$$[$0-2]);yy.extend(this.$,$$[$0-1]);break;case 305:this.$={partition:$$[$0]};break;case 306:this.$={order:$$[$0]};break;case 307:this.$="SUM";break;case 308:this.$="COUNT";break;case 309:this.$="MIN";break;case 310:case 486:this.$="MAX";break;case 311:this.$="AVG";break;case 312:this.$="FIRST";break;case 313:this.$="LAST";break;case 314:this.$="AGGR";break;case 315:this.$="ARRAY";break;case 316:var funcid=$$[$0-4];var exprlist=$$[$0-1];if(exprlist.length>1&&(funcid.toUpperCase()=="MIN"||funcid.toUpperCase()=="MAX")){this.$=new yy.FuncValue({funcid:funcid,args:exprlist})}else if(alasql.aggr[$$[$0-4]]){this.$=new yy.AggrValue({aggregatorid:"REDUCE",funcid:funcid,expression:exprlist.pop(),distinct:$$[$0-2]=="DISTINCT"})}else{this.$=new yy.FuncValue({funcid:funcid,args:exprlist})};break;case 317:this.$=new yy.FuncValue({funcid:$$[$0-2]});break;case 319:$$[$0-2].push($$[$0]);this.$=$$[$0-2];break;case 320:this.$=new yy.NumValue({value:+$$[$0]});break;case 321:this.$=new yy.LogicValue({value:true});break;case 322:this.$=new yy.LogicValue({value:false});break;case 323:this.$=new yy.StringValue({value:$$[$0].substr(1,$$[$0].length-2).replace(/(\\\')/g,"'").replace(/(\'\')/g,"'")});break;case 324:this.$=new yy.StringValue({value:$$[$0].substr(2,$$[$0].length-3).replace(/(\\\')/g,"'").replace(/(\'\')/g,"'")});break;case 325:this.$=new yy.NullValue({value:undefined});break;case 326:this.$=new yy.VarValue({variable:$$[$0]});break;case 327:if(!yy.exists)yy.exists=[];this.$=new yy.ExistsValue({value:$$[$0-1],existsidx:yy.exists.length});yy.exists.push($$[$0-1]);break;case 328:case 329:this.$=new yy.ParamValue({param:$$[$0]});break;case 330:if(typeof yy.question=="undefined")yy.question=0;this.$=new yy.ParamValue({param:yy.question++});break;case 331:if(typeof yy.question=="undefined")yy.question=0;this.$=new yy.ParamValue({param:yy.question++,array:true});break;case 332:this.$=new yy.CaseValue({expression:$$[$0-3],whens:$$[$0-2],elses:$$[$0-1]});break;case 333:this.$=new yy.CaseValue({whens:$$[$0-2],elses:$$[$0-1]});break;case 334:case 635:case 636:this.$=$$[$0-1];this.$.push($$[$0]);break;case 336:this.$={when:$$[$0-2],then:$$[$0]};break;case 339:this.$=new yy.Op({left:$$[$0-2],op:"LIKE",right:$$[$0]});break;case 340:this.$=new yy.Op({left:$$[$0-2],op:"NOT LIKE",right:$$[$0]});break;case 341:this.$=new yy.Op({left:$$[$0-2],op:"+",right:$$[$0]});break;case 342:this.$=new yy.Op({left:$$[$0-2],op:"-",right:$$[$0]});break;case 343:this.$=new yy.Op({left:$$[$0-2],op:"*",right:$$[$0]});break;case 344:this.$=new yy.Op({left:$$[$0-2],op:"/",right:$$[$0]});break;case 345:this.$=new yy.Op({left:$$[$0-2],op:"%",right:$$[$0]});break;case 346:this.$=new yy.Op({left:$$[$0-2],op:"^",right:$$[$0]});break;case 347:case 348:case 350:this.$=new yy.Op({left:$$[$0-2],op:"->",right:$$[$0]});break;case 349:this.$=new yy.Op({left:$$[$0-4],op:"->",right:$$[$0-1]});break;case 351:case 352:case 354:this.$=new yy.Op({left:$$[$0-2],op:"!",right:$$[$0]});break;case 353:this.$=new yy.Op({left:$$[$0-4],op:"!",right:$$[$0-1]});break;case 355:this.$=new yy.Op({left:$$[$0-2],op:">",right:$$[$0]});break;case 356:this.$=new yy.Op({left:$$[$0-2],op:">=",right:$$[$0]});break;case 357:this.$=new yy.Op({left:$$[$0-2],op:"<",right:$$[$0]});break;case 358:this.$=new yy.Op({left:$$[$0-2],op:"<=",right:$$[$0]});break;case 359:this.$=new yy.Op({left:$$[$0-2],op:"=",right:$$[$0]});break;case 360:this.$=new yy.Op({left:$$[$0-2],op:"==",right:$$[$0]});break;case 361:this.$=new yy.Op({left:$$[$0-2],op:"===",right:$$[$0]});break;case 362:this.$=new yy.Op({left:$$[$0-2],op:"!=",right:$$[$0]});break;case 363:this.$=new yy.Op({left:$$[$0-2],op:"!==",right:$$[$0]});break;case 364:this.$=new yy.Op({left:$$[$0-2],op:"!===",right:$$[$0]});break;case 365:if(!yy.queries)yy.queries=[];this.$=new yy.Op({left:$$[$0-5],op:$$[$0-4],allsome:$$[$0-3],right:$$[$0-1],queriesidx:yy.queries.length});yy.queries.push($$[$0-1]);break;case 366:this.$=new yy.Op({left:$$[$0-5],op:$$[$0-4],allsome:$$[$0-3],right:$$[$0-1]});break;case 367:if($$[$0-2].op=="BETWEEN1"){if($$[$0-2].left.op=="AND"){this.$=new yy.Op({left:$$[$0-2].left.left,op:"AND",right:new yy.Op({left:$$[$0-2].left.right,op:"BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})})}else{this.$=new yy.Op({left:$$[$0-2].left,op:"BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})}}else if($$[$0-2].op=="NOT BETWEEN1"){if($$[$0-2].left.op=="AND"){this.$=new yy.Op({left:$$[$0-2].left.left,op:"AND",right:new yy.Op({left:$$[$0-2].left.right,op:"NOT BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})})}else{this.$=new yy.Op({left:$$[$0-2].left,op:"NOT BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})}}else{this.$=new yy.Op({left:$$[$0-2],op:"AND",right:$$[$0]})}break;case 368:this.$=new yy.Op({left:$$[$0-2],op:"OR",right:$$[$0]});break;case 369:this.$=new yy.UniOp({op:"NOT",right:$$[$0]});break;case 370:this.$=new yy.UniOp({op:"-",right:$$[$0]});break;case 371:this.$=new yy.UniOp({op:"+",right:$$[$0]});break;case 372:this.$=new yy.UniOp({op:"#",right:$$[$0]});break;case 373:this.$=new yy.UniOp({right:$$[$0-1]});break;case 374:if(!yy.queries)yy.queries=[];this.$=new yy.Op({left:$$[$0-4],op:"IN",right:$$[$0-1],queriesidx:yy.queries.length});yy.queries.push($$[$0-1]);break;case 375:if(!yy.queries)yy.queries=[];this.$=new yy.Op({left:$$[$0-5],op:"NOT IN",right:$$[$0-1],queriesidx:yy.queries.length});yy.queries.push($$[$0-1]);break;case 376:this.$=new yy.Op({left:$$[$0-4],op:"IN",right:$$[$0-1]});break;case 377:this.$=new yy.Op({left:$$[$0-5],op:"NOT IN",right:$$[$0-1]});break;case 378:this.$=new yy.Op({left:$$[$0-3],op:"IN",right:[]});break;case 379:this.$=new yy.Op({left:$$[$0-4],op:"NOT IN",right:[]});break;case 380:case 382:this.$=new yy.Op({left:$$[$0-2],op:"IN",right:$$[$0]});break;case 381:case 383:this.$=new yy.Op({left:$$[$0-3],op:"NOT IN",right:$$[$0]});break;case 384:this.$=new yy.Op({left:$$[$0-2],op:"BETWEEN1",right:$$[$0]});break;case 385:this.$=new yy.Op({left:$$[$0-2],op:"NOT BETWEEN1",right:$$[$0]});break;case 386:this.$=new yy.Op({op:"IS",left:$$[$0-2],right:$$[$0]});break;case 387:this.$=new yy.Convert({expression:$$[$0-2]});yy.extend(this.$,$$[$0]);break;case 388:case 389:this.$=$$[$0];break;case 390:this.$=$$[$0-1];break;case 397:this.$="ALL";break;case 398:this.$="SOME";break;case 399:this.$="ANY";break;case 400:this.$=new yy.Update({table:$$[$0-4],columns:$$[$0-2],where:$$[$0]});break;case 401:this.$=new yy.Update({table:$$[$0-2],columns:$$[$0]});break;case 404:this.$=new yy.SetColumn({column:$$[$0-2],expression:$$[$0]});break;case 405:this.$=new yy.SetColumn({variable:$$[$0-2],expression:$$[$0],method:$$[$0-3]});break;case 406:this.$=new yy.Delete({table:$$[$0-2],where:$$[$0]});break;case 407:this.$=new yy.Delete({table:$$[$0]});break;case 408:this.$=new yy.Insert({into:$$[$0-2],values:$$[$0]});break;case 409:this.$=new yy.Insert({into:$$[$0-2],"default":true});break;case 410:this.$=new yy.Insert({into:$$[$0-5],columns:$$[$0-3],values:$$[$0]});break;case 411:this.$=new yy.Insert({into:$$[$0-1],select:$$[$0]});break;case 412:this.$=new yy.Insert({into:$$[$0-4],columns:$$[$0-2],select:$$[$0]});break;case 415:this.$=[$$[$0-1]];break;case 418:this.$=$$[$0-4];$$[$0-4].push($$[$0-1]);break;case 419:case 420:case 422:case 430:this.$=$$[$0-2];$$[$0-2].push($$[$0]);break;case 431:this.$=new yy.CreateTable({table:$$[$0-4]});yy.extend(this.$,$$[$0-7]);yy.extend(this.$,$$[$0-6]);yy.extend(this.$,$$[$0-5]);yy.extend(this.$,$$[$0-2]);yy.extend(this.$,$$[$0]);break;case 432:this.$=new yy.CreateTable({table:$$[$0]});yy.extend(this.$,$$[$0-3]);yy.extend(this.$,$$[$0-2]);yy.extend(this.$,$$[$0-1]);break;case 434:this.$={"class":true};break;case 443:this.$={temporary:true};break;case 445:this.$={ifnotexists:true};break;case 446:this.$={columns:$$[$0-2],constraints:$$[$0]};break;case 447:this.$={columns:$$[$0]};break;case 448:this.$={as:$$[$0]};break;case 449:case 473:this.$=[$$[$0]];break;case 451:case 452:case 453:case 454:case 455:$$[$0].constraintid=$$[$0-1];this.$=$$[$0];break;case 458:this.$={type:"CHECK",expression:$$[$0-1]};break;case 459:this.$={type:"PRIMARY KEY",columns:$$[$0-1],clustered:($$[$0-3]+"").toUpperCase()};break;case 460:this.$={type:"FOREIGN KEY",columns:$$[$0-5],fktable:$$[$0-2],fkcolumns:$$[$0-1]};break;case 461:case 491:case 522:case 558:case 576:case 579:case 598:this.$=$$[$0-1];break;case 466:this.$={type:"UNIQUE",columns:$$[$0-1],clustered:($$[$0-3]+"").toUpperCase()};break;case 475:this.$=new yy.ColumnDef({columnid:$$[$0-2]});yy.extend(this.$,$$[$0-1]);yy.extend(this.$,$$[$0]);break;case 476:this.$=new yy.ColumnDef({columnid:$$[$0-1]});yy.extend(this.$,$$[$0]);break;case 477:this.$=new yy.ColumnDef({columnid:$$[$0],dbtypeid:""});break;case 478:this.$={dbtypeid:$$[$0-5],dbsize:$$[$0-3],dbprecision:+$$[$0-1]};break;case 479:this.$={dbtypeid:$$[$0-6]+($$[$0-5]?" "+$$[$0-5]:""),dbsize:$$[$0-3],dbprecision:+$$[$0-1]};break;case 480:this.$={dbtypeid:$$[$0-3],dbsize:$$[$0-1]};break;case 481:this.$={dbtypeid:$$[$0-4]+($$[$0-3]?" "+$$[$0-3]:""),dbsize:$$[$0-1]};break;case 482:this.$={dbtypeid:$$[$0]};break;case 483:this.$={dbtypeid:$$[$0-1]+($$[$0]?" "+$$[$0]:"")};break;case 484:this.$={dbtypeid:"ENUM",enumvalues:$$[$0-1]};break;case 485:case 678:this.$=+$$[$0];break;case 487:this.$=undefined;break;case 489:yy.extend($$[$0-1],$$[$0]);this.$=$$[$0-1];break;case 492:this.$={primarykey:true};break;case 493:case 494:this.$={foreignkey:{table:$$[$0-1],columnid:$$[$0]}};break;case 495:this.$={identity:{value:$$[$0-3],step:$$[$0-1]}};break;case 496:this.$={identity:{value:1,step:1}};break;case 497:this.$={"default":$$[$0]};break;case 498:this.$={"default":$$[$0-1]};break;case 499:this.$={"null":true};break;case 500:this.$={notnull:true};break;case 501:this.$={check:$$[$0]};break;case 502:this.$={unique:true};break;case 503:this.$=new yy.DropTable({table:$$[$0],type:$$[$0-2]});yy.extend(this.$,$$[$0-1]);break;case 505:this.$={ifexists:true};break;case 506:this.$=new yy.AlterTable({table:$$[$0-3],renameto:$$[$0]});break;case 507:this.$=new yy.AlterTable({table:$$[$0-3],addcolumn:$$[$0]});break;case 508:this.$=new yy.AlterTable({table:$$[$0-3],modifycolumn:$$[$0]});break;case 509:this.$=new yy.AlterTable({table:$$[$0-5],renamecolumn:$$[$0-2],to:$$[$0]});break;case 510:this.$=new yy.AlterTable({table:$$[$0-3],dropcolumn:$$[$0]});break;case 511:this.$=new yy.AlterTable({table:$$[$0-2],renameto:$$[$0]});break;case 512:this.$=new yy.AttachDatabase({databaseid:$$[$0],engineid:$$[$0-2].toUpperCase()});break;case 513:this.$=new yy.AttachDatabase({databaseid:$$[$0-3],engineid:$$[$0-5].toUpperCase(),args:$$[$0-1]});break;case 514:this.$=new yy.AttachDatabase({databaseid:$$[$0-2],engineid:$$[$0-4].toUpperCase(),as:$$[$0]});break;case 515:this.$=new yy.AttachDatabase({databaseid:$$[$0-5],engineid:$$[$0-7].toUpperCase(),as:$$[$0],args:$$[$0-3]});break;case 516:this.$=new yy.DetachDatabase({databaseid:$$[$0]});break;case 517:this.$=new yy.CreateDatabase({databaseid:$$[$0]});yy.extend(this.$,$$[$0]);break;case 518:this.$=new yy.CreateDatabase({engineid:$$[$0-4].toUpperCase(),databaseid:$$[$0-1],as:$$[$0]});yy.extend(this.$,$$[$0-2]);break;case 519:this.$=new yy.CreateDatabase({engineid:$$[$0-7].toUpperCase(),databaseid:$$[$0-4],args:$$[$0-2],as:$$[$0]});yy.extend(this.$,$$[$0-5]);break;case 520:this.$=new yy.CreateDatabase({engineid:$$[$0-4].toUpperCase(),as:$$[$0],args:[$$[$0-1]]});yy.extend(this.$,$$[$0-2]);break;case 521:this.$=undefined;break;case 523:case 524:this.$=new yy.UseDatabase({databaseid:$$[$0]});break;case 525:this.$=new yy.DropDatabase({databaseid:$$[$0]});yy.extend(this.$,$$[$0-1]);break;case 526:case 527:this.$=new yy.DropDatabase({databaseid:$$[$0],engineid:$$[$0-3].toUpperCase()});yy.extend(this.$,$$[$0-1]);break;case 528:this.$=new yy.CreateIndex({indexid:$$[$0-5],table:$$[$0-3],columns:$$[$0-1]});break;case 529:this.$=new yy.CreateIndex({indexid:$$[$0-5],table:$$[$0-3],columns:$$[$0-1],unique:true});break;case 530:this.$=new yy.DropIndex({indexid:$$[$0]});break;case 531:this.$=new yy.ShowDatabases;break;case 532:this.$=new yy.ShowDatabases({like:$$[$0]});break;case 533:this.$=new yy.ShowDatabases({engineid:$$[$0-1].toUpperCase()});break;case 534:this.$=new yy.ShowDatabases({engineid:$$[$0-3].toUpperCase(),like:$$[$0]});break;case 535:this.$=new yy.ShowTables;break;case 536:this.$=new yy.ShowTables({like:$$[$0]});break;case 537:this.$=new yy.ShowTables({databaseid:$$[$0]});break;case 538:this.$=new yy.ShowTables({like:$$[$0],databaseid:$$[$0-2]});break;case 539:this.$=new yy.ShowColumns({table:$$[$0]});break;case 540:this.$=new yy.ShowColumns({table:$$[$0-2],databaseid:$$[$0]});break;case 541:this.$=new yy.ShowIndex({table:$$[$0]});break;case 542:this.$=new yy.ShowIndex({table:$$[$0-2],databaseid:$$[$0]});break;case 543:this.$=new yy.ShowCreateTable({table:$$[$0]});break;case 544:this.$=new yy.ShowCreateTable({table:$$[$0-2],databaseid:$$[$0]});break;case 545:this.$=new yy.CreateTable({table:$$[$0-6],view:true,select:$$[$0-1],viewcolumns:$$[$0-4]});yy.extend(this.$,$$[$0-9]);yy.extend(this.$,$$[$0-7]);break;case 546:this.$=new yy.CreateTable({table:$$[$0-3],view:true,select:$$[$0-1]});yy.extend(this.$,$$[$0-6]);yy.extend(this.$,$$[$0-4]);break;case 550:this.$=new yy.DropTable({table:$$[$0],view:true});yy.extend(this.$,$$[$0-1]);break;case 551:this.$=new yy.Help({subject:$$[$0].value.toUpperCase()});break;case 552:this.$=new yy.Help;break;case 553:this.$=new yy.ExpressionStatement({expression:$$[$0]});break;case 554:this.$=new yy.Source({url:$$[$0].value});break;case 555:this.$=new yy.Assert({value:$$[$0]});break;case 556:this.$=new yy.Assert({value:$$[$0].value});break;case 557:this.$=new yy.Assert({value:$$[$0],message:$$[$0-2]});break;case 559:case 570:case 572:this.$=$$[$0].value;break;case 560:case 568:this.$=+$$[$0].value;break;case 561:this.$=!!$$[$0].value;break;case 569:this.$=""+$$[$0].value;break;case 575:this.$=$$[$0-1];break;case 577:case 580:this.$=$$[$0-2];break;case 578:this.$={};break;case 581:this.$=[];break;case 582:yy.extend($$[$0-2],$$[$0]);this.$=$$[$0-2];break;case 584:this.$={};this.$[$$[$0-2].substr(1,$$[$0-2].length-2)]=$$[$0];break;case 585:case 586:this.$={};this.$[$$[$0-2]]=$$[$0];break;case 589:this.$=new yy.SetVariable({variable:$$[$0-1].toLowerCase(),value:$$[$0]});break;case 590:this.$=new yy.SetVariable({variable:$$[$0-2],expression:$$[$0],method:$$[$0-3]});break;case 591:this.$=new yy.SetVariable({variable:$$[$0-3],props:$$[$0-2],expression:$$[$0],method:$$[$0-4]});break;case 592:this.$="@";break;case 593:this.$="$";break;case 599:this.$=true;break;case 600:this.$=false;break;case 601:this.$=new yy.CommitTransaction;break;case 602:this.$=new yy.RollbackTransaction;break;case 603:this.$=new yy.BeginTransaction;break;case 604:this.$=new yy.If({expression:$$[$0-2],thenstat:$$[$0-1],elsestat:$$[$0]});if($$[$0-1].exists)this.$.exists=$$[$0-1].exists;if($$[$0-1].queries)this.$.queries=$$[$0-1].queries;break;case 605:this.$=new yy.If({expression:$$[$0-1],thenstat:$$[$0]});if($$[$0].exists)this.$.exists=$$[$0].exists;if($$[$0].queries)this.$.queries=$$[$0].queries;break;case 606:this.$=$$[$0];break;case 607:this.$=new yy.While({expression:$$[$0-1],loopstat:$$[$0]});if($$[$0].exists)this.$.exists=$$[$0].exists;if($$[$0].queries)this.$.queries=$$[$0].queries;break;case 608:this.$=new yy.Continue;break;case 609:this.$=new yy.Break;break;case 610:this.$=new yy.BeginEnd({statements:$$[$0-1]});break;case 611:this.$=new yy.Print({exprs:$$[$0]});break;case 612:this.$=new yy.Print({select:$$[$0]});break;case 613:this.$=new yy.Require({paths:$$[$0]});break;case 614:this.$=new yy.Require({plugins:$$[$0]});break;case 615:case 616:this.$=$$[$0].toUpperCase();break;case 617:this.$=new yy.Echo({expr:$$[$0]});break;case 622:this.$=new yy.Declare({declares:$$[$0]});break;case 625:this.$={variable:$$[$0-1]};yy.extend(this.$,$$[$0]);break;case 626:this.$={variable:$$[$0-2]};yy.extend(this.$,$$[$0]);break;case 627:this.$={variable:$$[$0-3],expression:$$[$0]};yy.extend(this.$,$$[$0-2]);break;case 628:this.$={variable:$$[$0-4],expression:$$[$0]};yy.extend(this.$,$$[$0-2]);break;case 629:this.$=new yy.TruncateTable({table:$$[$0]});break;case 630:this.$=new yy.Merge;yy.extend(this.$,$$[$0-4]);yy.extend(this.$,$$[$0-3]);yy.extend(this.$,$$[$0-2]);yy.extend(this.$,{matches:$$[$0-1]});yy.extend(this.$,$$[$0]);break;case 631:case 632:this.$={into:$$[$0]};break;case 634:this.$={on:$$[$0]};break;case 639:this.$={matched:true,action:$$[$0]};break;case 640:this.$={matched:true,expr:$$[$0-2],action:$$[$0]};break;case 641:this.$={"delete":true};break;case 642:this.$={update:$$[$0]};break;case 643:case 644:this.$={matched:false,bytarget:true,action:$$[$0]};break;case 645:case 646:this.$={matched:false,bytarget:true,expr:$$[$0-2],action:$$[$0]};break;case 647:this.$={matched:false,bysource:true,action:$$[$0]};break;case 648:this.$={matched:false,bysource:true,expr:$$[$0-2],action:$$[$0]};break;case 649:this.$={insert:true,values:$$[$0]};break;case 650:this.$={insert:true,values:$$[$0],columns:$$[$0-3]};break;case 651:this.$={insert:true,defaultvalues:true};break;case 652:this.$={insert:true,defaultvalues:true,columns:$$[$0-3]};break;case 654:this.$={output:{columns:$$[$0]}};break;case 655:this.$={output:{columns:$$[$0-3],intovar:$$[$0],method:$$[$0-1]}};break;case 656:this.$={output:{columns:$$[$0-2],intotable:$$[$0]}};break;case 657:this.$={output:{columns:$$[$0-5],intotable:$$[$0-3],intocolumns:$$[$0-1]}};break;case 658:this.$=new yy.CreateVertex({"class":$$[$0-3],sharp:$$[$0-2],name:$$[$0-1]});yy.extend(this.$,$$[$0]);break;case 661:this.$={sets:$$[$0]};break;case 662:this.$={content:$$[$0]};break;case 663:this.$={select:$$[$0]};break;case 664:this.$=new yy.CreateEdge({from:$$[$0-3],to:$$[$0-1],name:$$[$0-5]});yy.extend(this.$,$$[$0]);break;case 665:this.$=new yy.CreateGraph({graph:$$[$0]});break;case 666:this.$=new yy.CreateGraph({from:$$[$0]});break;case 669:this.$=$$[$0-2];if($$[$0-1])this.$.json=new yy.Json({value:$$[$0-1]});if($$[$0])this.$.as=$$[$0];break;case 670:this.$={source:$$[$0-6],target:$$[$0]};if($$[$0-3])this.$.json=new yy.Json({value:$$[$0-3]});if($$[$0-2])this.$.as=$$[$0-2];yy.extend(this.$,$$[$0-4]);break;case 672:this.$={vars:$$[$0],method:$$[$0-1]};break;case 675:var s3=$$[$0-1];this.$={prop:$$[$0-3],sharp:$$[$0-2],name:typeof s3=="undefined"?undefined:s3.substr(1,s3.length-2),"class":$$[$0]};break;case 681:this.$=new yy.AddRule({left:$$[$0-2],right:$$[$0]});break;case 682:this.$=new yy.AddRule({right:$$[$0]});break;case 685:this.$=new yy.Term({termid:$$[$0]});break;case 686:this.$=new yy.Term({termid:$$[$0-3],args:$$[$0-1]});break;case 692:case 706:case 708:case 710:case 714:case 716:case 718:case 720:case 722:case 724:this.$=[];break;case 693:case 701:case 703:case 707:case 709:case 711:case 715:case 717:case 719:case 721:case 723:case 725:$$[$0-1].push($$[$0]);break;case 700:case 702:this.$=[$$[$0]];break}},table:[o([8,450,451],$V0,{6:1,7:2,10:3,11:4,15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,4:$V1,5:$V2,12:$V3,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),{1:[3]},{8:[1,97],9:98,450:$VE,451:$VF},o($VG,[2,5]),o($VG,[2,6]),o($VH,[2,9]),o($VG,$V0,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,10:101,4:$V1,5:$V2,13:[1,102],47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($VH,[2,11]),o($VH,[2,12]),o($VH,[2,13]),o($VH,[2,14]),o($VH,[2,15]),o($VH,[2,16]),o($VH,[2,17]),o($VH,[2,18]),o($VH,[2,19]),o($VH,[2,20]),o($VH,[2,21]),o($VH,[2,22]),o($VH,[2,23]),o($VH,[2,24]),o($VH,[2,25]),o($VH,[2,26]),o($VH,[2,27]),o($VH,[2,28]),o($VH,[2,29]),o($VH,[2,30]),o($VH,[2,31]),o($VH,[2,32]),o($VH,[2,33]),o($VH,[2,34]),o($VH,[2,35]),o($VH,[2,36]),o($VH,[2,37]),o($VH,[2,38]),o($VH,[2,39]),o($VH,[2,40]),o($VH,[2,41]),o($VH,[2,42]),o($VH,[2,43]),o($VH,[2,44]),o($VH,[2,45]),o($VH,[2,46]),o($VH,[2,47]),o($VH,[2,48]),o($VH,[2,49]),o($VH,[2,50]),o($VH,[2,51]),o($VH,[2,52]),o($VH,[2,53]),o($VH,[2,54]),o($VH,[2,55]),o($VH,[2,56]),o($VH,[2,57]),o($VH,[2,58]),o($VH,[2,59]),{304:[1,103]},{3:104,4:$V1,5:$V2},o($VI,[2,442],{3:106,299:110,4:$V1,5:$V2,109:$VJ,110:$VK,161:[1,108],167:[1,107],308:[1,113],352:[1,105],421:[1,109]}),{119:$VL,398:114,399:115},{157:[1,117]},{352:[1,118]},{3:120,4:$V1,5:$V2,105:[1,125],167:[1,121],304:[1,124],345:122,352:[1,119],357:[1,123]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:126,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vi1,[2,413],{292:181,172:[1,182]}),{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,172:[1,185],173:188,174:190,175:189,176:191,183:184,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1,402:183},{304:[1,195]},o($Vl1,[2,690],{73:196,84:197,85:[1,198]}),o($Vm1,[2,692],{82:199}),{3:203,4:$V1,5:$V2,164:[1,201],167:[1,204],298:[1,200],304:[1,205],352:[1,202]},{304:[1,206]},{3:209,4:$V1,5:$V2,66:207,68:208},o([264,450,451],$V0,{10:3,11:4,15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,7:211,4:$V1,5:$V2,12:$V3,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,384:[1,210],385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),{384:[1,212]},{384:[1,213]},{3:215,4:$V1,5:$V2,352:[1,214]},{3:217,4:$V1,5:$V2,173:216},o($VH,[2,552],{91:218,107:$VO,256:$Va1}),o($Vn1,[2,284]),{91:219,107:$VO,256:$Va1},{3:231,4:$V1,5:$V2,91:225,106:$VN,107:[1,222],116:$VQ,118:220,119:$Vo1,126:$VS,155:$VW,170:224,174:229,175:228,225:226,226:227,232:$Vp1,238:221,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:232,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,608]),o($VH,[2,609]),{3:147,4:$V1,5:$V2,36:234,51:144,70:$VM,72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:233,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:241,4:$V1,5:$V2,91:238,107:$VO,256:$Va1,393:236,394:237,395:239,396:$Vq1},{3:242,4:$V1,5:$V2,116:$Vr1,119:$Vs1,379:243},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:246,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{447:[1,247]},{3:93,4:$V1,5:$V2,446:249,448:248},{3:231,4:$V1,5:$V2,174:250},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:251,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vt1,$Vu1,{160:255,138:[1,254],159:[1,252],161:[1,253],169:$Vv1}),o($Vw1,[2,685],{70:[1,257]}),o($Vx1,[2,130],{123:[1,258],124:[1,259],164:[1,260],165:[1,261],166:[1,262],167:[1,263],168:[1,264]}),o($Vy1,[2,1]),o($Vy1,[2,2]),{1:[2,3]},o($VG,$V0,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,10:265,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($Vz1,[2,688]),o($Vz1,[2,689]),o($VG,[2,7]),{14:[1,266]},{3:217,4:$V1,5:$V2,173:267},{352:[1,268]},o($Vi1,$VA1,{301:269,130:$VB1}),{352:[1,271]},{3:272,4:$V1,5:$V2},{167:[1,273]},o([8,67,69,107,112,114,126,264,268,368,372,450,451],$VC1,{422:274,423:276,424:277,427:278,3:279,434:280,431:281,379:282,4:$V1,5:$V2,116:$Vr1,119:$Vs1,157:[1,275]}),{105:[1,286],300:283,304:[1,285],357:[1,284]},{91:288,107:$VO,157:[2,770],256:$Va1,420:287},o($VD1,[2,764],{414:289,3:290,4:$V1,5:$V2}),o($VI,[2,443]),o($VH,[2,622],{67:[1,291]}),o($VE1,[2,623]),{3:292,4:$V1,5:$V2},{3:217,4:$V1,5:$V2,173:293},{3:294,4:$V1,5:$V2},o($Vi1,$VF1,{346:295,130:$VG1}),{352:[1,297]},{3:298,4:$V1,5:$V2},o($Vi1,$VF1,{346:299,130:$VG1}),o($Vi1,$VF1,{346:300,130:$VG1}),o($VH1,[2,758]),o($VH1,[2,759]),o($VH,$V0,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,10:301,278:322,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,90:$VI1,97:$VJ1,98:$VK1,99:$VL1,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,120:$V8,128:$VR1,130:$V9,144:$VS1,145:$VT1,153:$VU1,154:$VV1,163:$Va,233:$Vb,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($Vn1,[2,263]),o($Vn1,[2,264]),o($Vn1,[2,265]),o($Vn1,[2,266]),o($Vn1,[2,267]),o($Vn1,[2,268]),o($Vn1,[2,269]),o($Vn1,[2,270]),o($Vn1,[2,271]),o($Vn1,[2,272]),o($Vn1,[2,273]),o($Vn1,[2,274]),o($Vn1,[2,275]),o($Vn1,[2,276]),o($Vn1,[2,277]),o($Vn1,[2,278]),{3:147,4:$V1,5:$V2,23:336,24:335,33:332,36:331,51:144,70:$VM,72:67,81:$V6,89:130,91:134,100:334,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,231:333,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,291:$Ve,298:[1,337],367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,282]),o($Vn1,[2,283]),{70:[1,338]},o([4,5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],$V82,{70:$V92,117:[1,340]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:341,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:342,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:343,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:344,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,258]),o([4,5,8,47,65,67,69,70,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,202,203,205,212,215,216,218,220,232,233,234,235,237,244,245,246,247,248,249,250,251,252,254,255,256,257,258,260,261,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,374,376,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451,452],[2,320]),o($Va2,[2,321]),o($Va2,[2,322]),o($Va2,$Vb2),o($Va2,[2,324]),o([4,5,8,47,65,67,69,70,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,257,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,374,376,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,325]),{3:346,4:$V1,5:$V2,106:[1,347],259:345},{3:348,4:$V1,5:$V2},o($Va2,[2,330]),o($Va2,[2,331]),{3:349,4:$V1,5:$V2,70:$Vc2,91:351,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:352,175:354,225:353,254:$V81,255:$V91,256:$Va1,260:$Vd1,367:355,372:$Vh1},{70:[1,356]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:357,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,262:358,265:359,266:$Vd2,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,361]},{70:[1,362]},o($Ve2,[2,563]),{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,369:363,370:366,371:368,372:$Vh1,375:364,376:[1,365]},{3:378,4:$V1,5:$V2,174:379},{70:[2,307]},{70:[2,308]},{70:[2,309]},{70:[2,310]},{70:[2,311]},{70:[2,312]},{70:[2,313]},{70:[2,314]},{70:[2,315]},{3:385,4:$V1,5:$V2,106:$Vg2,107:$Vh2,373:380,374:[1,381],377:382},{3:217,4:$V1,5:$V2,173:386},o($Vi1,[2,414]),{203:[1,388],403:387},{203:[2,631]},{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,183:389,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{36:390,72:67,81:$V6,158:92,163:$Va},o($Vi2,[2,730],{184:391,69:[1,392]}),o($Vj2,[2,163],{3:393,4:$V1,5:$V2,69:[1,394]}),o($Vj2,[2,166],{3:395,4:$V1,5:$V2,69:[1,396]}),o($Vj2,[2,167],{3:397,4:$V1,5:$V2,69:[1,398]}),o($Vj2,[2,170],{3:399,4:$V1,5:$V2,69:[1,400]}),o($Vj2,[2,173],{3:401,4:$V1,5:$V2,69:[1,402]}),o([4,5,8,65,67,69,71,93,104,136,142,143,157,180,182,194,195,196,197,198,199,200,201,202,203,205,218,264,268,450,451],$Vk2,{70:$V92,117:$Vl2}),o([4,5,8,65,67,69,71,93,104,136,142,143,180,182,194,195,196,197,198,199,200,201,202,203,205,218,264,268,450,451],[2,176]),{3:217,4:$V1,5:$V2,173:404},o($Vm2,$Vn2,{74:405,172:$Vo2}),o($Vl1,[2,691]),o($Vp2,[2,696],{86:407,164:[1,408]}),o([8,71,157,264,268,450,451],$Vn2,{367:168,74:409,92:410,3:411,118:433,132:443,134:444,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,172:$Vo2,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,368:$Vg1,372:$Vh1}),{304:[1,457]},{157:[1,458]},o($VH,[2,531],{90:[1,459]}),{352:[1,460]},{157:[1,461]},o($VH,[2,535],{90:[1,462],157:[1,463]}),{3:217,4:$V1,5:$V2,173:464},{36:465,67:[1,466],72:67,81:$V6,158:92,163:$Va},o($V43,[2,62]),{69:[1,467]},o($VH,[2,603]),{9:98,264:[1,468],450:$VE,451:$VF},o($VH,[2,601]),o($VH,[2,602]),{3:469,4:$V1,5:$V2},o($VH,[2,524]),{120:[1,470]},o([8,67,69,70,71,81,104,120,122,123,128,157,161,163,202,257,264,268,294,307,319,320,324,325,344,348,349,350,450,451],$Vk2,{117:$Vl2}),o($VH,[2,551]),o($VH,[2,554]),o($VH,[2,555]),o($VH,[2,556]),o($VH,$Vb2,{67:[1,471]}),{70:$Vc2,91:351,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:352,175:354,225:353,254:$V81,255:$V91,256:$Va1,260:$Vd1,367:355,372:$Vh1},o($V53,[2,291]),o($V53,[2,292]),o($V53,[2,293]),o($V53,[2,294]),o($V53,[2,295]),o($V53,[2,296]),o($V53,[2,297]),{70:$V92},o($VH,$V0,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,278:322,10:472,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,90:$VI1,97:$VJ1,98:$VK1,99:$VL1,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,120:$V8,128:$VR1,130:$V9,144:$VS1,145:$VT1,153:$VU1,154:$VV1,163:$Va,233:$Vb,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($VH,[2,611],{67:$V63}),o($VH,[2,612]),o($V73,[2,318],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VH,[2,613],{67:[1,475]}),o($VH,[2,614],{67:[1,476]}),o($VE1,[2,619]),o($VE1,[2,621]),o($VE1,[2,615]),o($VE1,[2,616]),{202:[1,478],378:477,382:[1,479]},{3:480,4:$V1,5:$V2},o($Vi1,[2,592]),o($Vi1,[2,593]),o($VH,[2,553],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:93,4:$V1,5:$V2,446:249,448:481},o($VH,[2,682],{67:$V93}),o($V73,[2,684]),o($VH,[2,687]),o($VH,[2,617],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Va3,$Vu1,{160:483,169:$Vv1}),o($Va3,$Vu1,{160:484,169:$Vv1}),o($Va3,$Vu1,{160:485,169:$Vv1}),o($Vb3,[2,726],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,162:486,148:487,221:488,100:489,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{70:[1,491],106:$VN,170:490},{3:93,4:$V1,5:$V2,446:249,448:492},o($Vx1,[2,131]),o($Vx1,[2,132]),o($Vx1,[2,133]),o($Vx1,[2,134]),o($Vx1,[2,135]),o($Vx1,[2,136]),o($Vx1,[2,137]),o($VG,[2,4]),o($VG,$V0,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,10:493,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),{344:[1,497],348:[1,494],349:[1,495],350:[1,496]},{3:498,4:$V1,5:$V2},{3:499,4:$V1,5:$V2},{128:[1,500]},o($Vc3,$VA1,{301:501,130:$VB1}),{202:[1,502]},{3:503,4:$V1,5:$V2},o($VH,[2,665],{67:$Vd3}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:505,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V73,[2,668]),o($Ve3,[2,772],{367:168,425:506,118:507,114:[2,776],119:$Vo1,368:$Vg1,372:$Vh1}),{114:[1,508]},o($Vf3,$Vg3,{70:[1,509]}),o($Vh3,[2,786],{435:510,439:511,112:[1,512]}),{114:[2,777]},{3:513,4:$V1,5:$V2},o($Vi1,$VA1,{301:514,130:$VB1}),o($Vi1,$VA1,{301:515,130:$VB1}),o($VH1,[2,433]),o($VH1,[2,434]),{157:[1,516]},{157:[2,771]},o($Vi3,[2,766],{415:517,418:518,112:[1,519]}),o($VD1,[2,765]),{119:$VL,399:520},{4:$Vj3,69:[1,522],236:521,338:$Vk3},o($VH,[2,407],{104:[1,525]}),o($VH,[2,516]),{3:526,4:$V1,5:$V2},{258:[1,527]},o($Vc3,$VF1,{346:528,130:$VG1}),o($VH,[2,530]),{3:217,4:$V1,5:$V2,173:529},{3:217,4:$V1,5:$V2,173:530},o($VG,[2,605],{387:531,268:[1,532]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:533,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:534,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:535,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:536,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:537,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:538,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:539,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:540,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:541,4:$V1,5:$V2,70:[1,543],106:$VN,170:542,174:544},{3:545,4:$V1,5:$V2,70:[1,547],106:$VN,170:546,174:548},o($Vl3,[2,391],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:549,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,[2,392],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:550,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,[2,393],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:551,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,[2,394],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:552,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,$Vm3,{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:553,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:554,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:555,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vl3,[2,396],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:556,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:557,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:558,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{138:[1,560],140:[1,562],279:559,286:[1,561]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:563,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:564,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:377,4:$V1,5:$V2,70:[1,565],89:568,119:$Vn3,174:569,176:567,281:566},{280:[1,571]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:572,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:573,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:574,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{4:$Vj3,236:575,338:$Vk3},{71:[1,576]},{71:[1,577]},{71:[1,578]},{71:[1,579],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[2,738]},{71:[2,739]},{109:$VJ,110:$VK},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:580,126:$VS,128:$VT,132:146,138:[1,582],153:$VU,154:$VV,155:$VW,159:[1,581],170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Va3,[2,742],{253:583,453:585,71:[1,584],138:[1,587],159:[1,586]}),{3:588,4:$V1,5:$V2,123:$Vo3,154:[1,590]},o([4,5,8,47,65,67,69,70,71,81,85,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,271,272,273,274,275,276,277,280,282,283,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,369],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,284:$V62}),o($Vp3,[2,370],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($Vp3,[2,371],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($Vn1,[2,372],{278:322}),o($Va2,[2,328]),o($Va2,[2,744]),o($Va2,[2,745]),o($Va2,[2,329]),o([4,5,8,47,65,67,69,70,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,202,203,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,326]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:591,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Ve2,[2,559]),o($Ve2,[2,560]),o($Ve2,[2,561]),o($Ve2,[2,562]),o($Ve2,[2,564]),{36:592,72:67,81:$V6,158:92,163:$Va},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,262:593,265:359,266:$Vd2,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{263:594,264:$Vq3,265:595,266:$Vd2,268:$Vr3},o($Vs3,[2,335]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:597,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:598,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{4:$Vj3,236:599,338:$Vk3},o($Ve2,[2,565]),{67:[1,601],376:[1,600]},o($Ve2,[2,581]),o($Vt3,[2,588]),o($Vu3,[2,566]),o($Vu3,[2,567]),o($Vu3,[2,568]),o($Vu3,[2,569]),o($Vu3,[2,570]),o($Vu3,[2,571]),o($Vu3,[2,572]),o($Vu3,[2,573]),o($Vu3,[2,574]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:602,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o([4,5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,374,376,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],$V82,{70:$V92,117:$Vv3}),o($Vw3,[2,285],{70:$V92}),o($Vn1,[2,286]),{67:[1,605],374:[1,604]},o($Ve2,[2,578]),o($Vx3,[2,583]),{126:[1,606]},{126:[1,607]},{126:[1,608]},{36:612,70:[1,611],72:67,81:$V6,123:[1,609],158:92,163:$Va,294:[1,610]},{202:[1,614],404:613},{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,183:615,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{203:[2,632]},{71:[1,616]},o($Vj2,[2,732],{185:617,3:618,4:$V1,5:$V2}),o($Vi2,[2,731]),o($Vj2,[2,161]),{3:619,4:$V1,5:$V2},o($Vj2,[2,164]),{3:620,4:$V1,5:$V2},o($Vj2,[2,168]),{3:621,4:$V1,5:$V2},o($Vj2,[2,171]),{3:622,4:$V1,5:$V2},o($Vj2,[2,174]),{3:623,4:$V1,5:$V2},{3:624,4:$V1,5:$V2},{122:[1,625]},o($Vy3,[2,150],{75:626,157:[1,627]}),{3:193,4:$V1,5:$V2,107:[1,632],116:$VQ,119:[1,633],126:$VS,155:$VW,173:628,174:629,175:630,176:631,260:$Vd1},{3:638,4:$V1,5:$V2,87:634,88:635,89:636,90:$Vz3},o($Vp2,[2,697]),o($VA3,[2,694],{83:639,156:640,157:[1,641]}),o($Vm1,[2,693],{127:642,153:$VB3,154:$VC3,155:$VD3}),o([4,5,8,65,67,69,71,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,172,244,245,246,247,248,249,250,251,252,264,268,368,372,450,451],[2,71],{70:[1,646]}),{94:[1,647]},{3:648,4:$V1,5:$V2},o($VE3,[2,75]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:649,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:650,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,92:652,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,101:651,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{70:[1,653]},{70:[1,654]},{70:[1,655]},o($VE3,[2,83]),o($VE3,[2,84]),o($VE3,[2,85]),o($VE3,[2,86]),o($VE3,[2,87]),o($VE3,[2,88]),{3:656,4:$V1,5:$V2},{3:657,4:$V1,5:$V2,108:[1,658]},o($VE3,[2,92]),o($VE3,[2,93]),o($VE3,[2,94]),{117:[1,659]},o($VE3,[2,96]),{3:660,4:$V1,5:$V2,70:$Vc2,91:351,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:352,175:354,225:353,254:$V81,255:$V91,256:$Va1,260:$Vd1,367:355,372:$Vh1},{119:[1,661]},{70:[1,662]},{119:[1,663]},o($VE3,[2,101]),{70:[1,664]},{3:665,4:$V1,5:$V2},{70:[1,666]},{70:[1,667]},{70:[1,668]},{70:[1,669]},{70:[1,670],138:[1,671]},{70:[1,672]},{70:[1,673]},{70:[1,674]},{70:[1,675]},{70:[1,676]},{70:[1,677]},{70:[1,678]},{70:[1,679]},{70:[1,680]},{70:[2,712]},{70:[2,713]},{3:217,4:$V1,5:$V2,173:681},{3:217,4:$V1,5:$V2,173:682},{91:683,107:$VO,256:$Va1},o($VH,[2,533],{90:[1,684]}),{3:217,4:$V1,5:$V2,173:685},{91:686,107:$VO,256:$Va1},{3:687,4:$V1,5:$V2},o($VH,[2,629]),o($VH,[2,60]),{3:209,4:$V1,5:$V2,68:688},{70:[1,689]},o($VH,[2,610]),o($VH,[2,523]),{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:690,288:691,289:693},{118:696,119:$Vo1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,607]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:697,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vl3,$Vm3,{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:698,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{91:699,107:$VO,256:$Va1},{3:241,4:$V1,5:$V2,395:700,396:$Vq1},o($VH,[2,589]),o($VH,[2,599]),o($VH,[2,600]),{97:[1,703],99:[1,701],380:702},o($VH,[2,681],{67:$V93}),{3:93,4:$V1,5:$V2,446:704},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:705,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:706,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:707,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vb3,[2,129]),o($Vb3,[2,727],{67:$VH3}),o($VI3,[2,248]),o($VI3,[2,255],{278:322,3:710,91:712,4:$V1,5:$V2,69:[1,709],90:$VI1,97:$VJ1,98:$VK1,99:$V83,106:[1,711],107:$VO,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,256:$Va1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vt1,[2,728],{171:713,452:[1,714]}),{106:$VN,170:715},{67:$V93,71:[1,716]},o($VG,[2,8]),{122:[1,717],164:[1,718]},{164:[1,719]},{164:[1,720]},{164:[1,721]},o($VH,[2,512],{69:[1,723],70:[1,722]}),o($VH,[2,517]),{258:[1,724]},{3:725,4:$V1,5:$V2,91:726,107:$VO,256:$Va1},{3:217,4:$V1,5:$V2,173:727},{202:[1,728]},o([8,67,69,71,107,112,114,126,264,268,368,372,450,451],$VC1,{424:277,427:278,3:279,434:280,431:281,379:282,423:729,4:$V1,5:$V2,116:$Vr1,119:$Vs1}),o($VH,[2,666],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($V73,[2,774],{426:730,432:731,69:$VJ3}),o($Ve3,[2,773]),o([69,107,112,114,119,126,368,372],$VC1,{434:280,424:733,3:734,4:$V1,5:$V2}),o([67,69,71,107,112,114,126,368,372],$VC1,{423:276,424:277,427:278,3:279,434:280,431:281,379:282,422:735,4:$V1,5:$V2,116:$Vr1,119:$Vs1}),o($VK3,[2,788],{436:736,107:[1,737]}),o($Vh3,[2,787]),{3:738,4:$V1,5:$V2,106:[1,739]},o($VL3,[2,672]),{3:217,4:$V1,5:$V2,173:740},{3:217,4:$V1,5:$V2,173:741},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:742,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VM3,[2,768],{416:743,91:744,107:$VO,256:$Va1}),o($Vi3,[2,767]),{3:745,4:$V1,5:$V2},o($VE1,[2,624]),o($VE1,[2,625],{99:[1,746]}),{4:$Vj3,236:747,338:$Vk3},o([5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,257,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,482],{4:[1,749],70:[1,748]}),{70:[1,750]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:751,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,525]),o($Vc3,[2,505]),{3:752,4:$V1,5:$V2,91:753,107:$VO,256:$Va1},o($VH,[2,503]),o($VH,[2,550]),o($VH,[2,604]),o($VH,$V0,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,10:754,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($VN3,[2,339],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,270:$VX1}),o($VN3,[2,340],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,270:$VX1}),o($Vp3,[2,341],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($Vp3,[2,342],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($VO3,[2,343],{278:322,97:$VJ1,98:$VK1,111:$VN1}),o($VO3,[2,344],{278:322,97:$VJ1,98:$VK1,111:$VN1}),o($VO3,[2,345],{278:322,97:$VJ1,98:$VK1,111:$VN1}),o([4,5,8,47,65,67,69,70,71,81,85,90,93,98,99,104,105,106,107,108,109,110,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,346],{278:322,97:$VJ1,111:$VN1}),o($Vw3,[2,347],{70:$V92}),o($Vn1,[2,348]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:755,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,350]),o($Vw3,[2,351],{70:$V92}),o($Vn1,[2,352]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:756,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,354]),o($VP3,[2,355],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,356],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,357],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,358],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o([4,5,8,47,65,81,99,114,115,120,130,144,145,163,233,264,268,271,272,273,274,275,276,277,282,283,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,383,385,386,388,389,390,391,392,396,397,400,401,447,449,450,451],$VQ3,{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,360],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,361],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,362],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,363],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,364],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),{70:[1,757]},{70:[2,397]},{70:[2,398]},{70:[2,399]},o($VR3,[2,367],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,284:$V62}),o([4,5,8,47,65,67,69,70,71,81,85,93,104,105,106,107,109,110,112,116,117,119,120,122,123,124,126,130,136,138,140,142,143,145,146,147,149,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,368],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62}),{3:147,4:$V1,5:$V2,36:758,51:144,70:$VM,71:[1,760],72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:759,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,380]),o($Vn1,[2,382]),o($Vn1,[2,388]),o($Vn1,[2,389]),{3:349,4:$V1,5:$V2,70:[1,761]},{3:377,4:$V1,5:$V2,70:[1,762],89:568,119:$Vn3,174:569,176:764,281:763},o($VR3,[2,384],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,284:$V62}),o($VR3,[2,385],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,284:$V62}),o([4,5,8,47,65,67,69,70,71,81,85,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,386],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,269:$VW1,270:$VX1}),o($Vn1,[2,387]),o($Vn1,[2,279]),o($Vn1,[2,280]),o($Vn1,[2,281]),o($Vn1,[2,373]),{67:$V63,71:[1,765]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:766,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:767,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:768,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Va2,[2,317]),o($Va3,[2,743]),o($Va3,[2,740]),o($Va3,[2,741]),o($Vn1,$VS3),o($VT3,[2,261]),o($Vn1,[2,257]),{71:[1,770],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,771]},{263:772,264:$Vq3,265:595,266:$Vd2,268:$Vr3},{264:[1,773]},o($Vs3,[2,334]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:774,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,775],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{69:[1,776],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{67:[1,777]},o($Ve2,[2,579]),{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:779,371:368,372:$Vh1,376:[1,778]},{71:[1,780],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:781,4:$V1,5:$V2,123:$Vo3},o($Ve2,[2,576]),{3:385,4:$V1,5:$V2,106:$Vg2,107:$Vh2,374:[1,782],377:783},{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:784,371:368,372:$Vh1},{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:785,371:368,372:$Vh1},{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:786,371:368,372:$Vh1},{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:787,367:168,368:$Vg1,372:$Vh1},{123:[1,791]},{3:638,4:$V1,5:$V2,89:793,204:792},o($VV3,[2,411]),{266:$VW3,405:794,407:795,408:796},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:798,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{202:[2,633]},o($Vj2,[2,159],{3:799,4:$V1,5:$V2,69:[1,800]}),o($Vj2,[2,160]),o($Vj2,[2,733]),o($Vj2,[2,162]),o($Vj2,[2,165]),o($Vj2,[2,169]),o($Vj2,[2,172]),o($Vj2,[2,175]),o([4,5,8,65,67,69,70,71,81,93,104,120,122,123,128,136,142,143,157,161,163,180,182,194,195,196,197,198,199,200,201,202,203,205,218,257,264,268,294,307,319,320,324,325,344,348,349,350,450,451],[2,177]),{3:801,4:$V1,5:$V2},o($VX3,[2,214],{76:802,104:[1,803]}),{3:193,4:$V1,5:$V2,70:[1,805],107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,177:804,183:806,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},o($Vm2,[2,142]),o($Vm2,[2,143]),o($Vm2,[2,144]),o($Vm2,[2,145]),o($Vm2,[2,146]),{3:349,4:$V1,5:$V2},o($Vl1,[2,66],{67:[1,807]}),o($VY3,[2,68]),o($VY3,[2,69]),{91:808,107:$VO,256:$Va1},o([8,65,67,71,93,99,104,136,142,143,157,172,180,182,194,195,196,197,198,199,200,201,205,218,264,268,450,451],$V82,{117:$Vv3}),o($VA3,[2,65]),o($VA3,[2,695]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:809,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,104]),o($VE3,[2,122]),o($VE3,[2,123]),o($VE3,[2,124]),{3:147,4:$V1,5:$V2,51:144,70:$VM,71:[2,704],89:130,91:134,100:235,103:810,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:811,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,812]},o($VE3,[2,74]),o([4,5,8,65,67,69,70,71,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,172,244,245,246,247,248,249,250,251,252,264,268,368,372,450,451],[2,76],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o([4,5,8,65,67,69,70,71,90,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,172,244,245,246,247,248,249,250,251,252,264,268,368,372,450,451],[2,77],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,813],90:$Vt2,92:814,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},o($VZ3,[2,700],{127:642,153:$VB3,154:$VC3,155:$VD3}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,92:816,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,102:815,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:817,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:818,4:$V1,5:$V2},o($VE3,[2,89]),o($VE3,[2,90]),o($VE3,[2,91]),o($VE3,[2,95]),o($VE3,[2,97]),{3:819,4:$V1,5:$V2},{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:820,288:691,289:693},{3:821,4:$V1,5:$V2},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:822,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,103]),o($VZ3,[2,706],{129:823}),o($VZ3,[2,708],{131:824}),o($VZ3,[2,710],{133:825}),o($VZ3,[2,714],{135:826}),o($V_3,$V$3,{137:827,152:828}),{70:[1,829]},o($VZ3,[2,716],{139:830}),o($VZ3,[2,718],{141:831}),o($V_3,$V$3,{152:828,137:832}),o($V_3,$V$3,{152:828,137:833}),o($V_3,$V$3,{152:828,137:834}),o($V_3,$V$3,{152:828,137:835}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,92:836,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:837,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V04,[2,720],{150:838}),o($VH,[2,543],{157:[1,839]}),o($VH,[2,539],{157:[1,840]}),o($VH,[2,532]),{91:841,107:$VO,256:$Va1},o($VH,[2,541],{157:[1,842]}),o($VH,[2,536]),o($VH,[2,537],{90:[1,843]}),o($V43,[2,61]),{36:844,72:67,81:$V6,158:92,163:$Va},o($VH,[2,401],{67:$V14,104:[1,845]}),o($V24,[2,402]),{99:[1,847]},{3:848,4:$V1,5:$V2},o($Vi1,[2,746]),o($Vi1,[2,747]),o($VH,[2,557]),o($V73,[2,319],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VP3,$VQ3,{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VE1,[2,618]),o($VE1,[2,620]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:849,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{97:[1,851],99:[1,850]},{3:853,4:$V1,5:$V2,70:$V34,106:$V44,381:852},o($V73,[2,683]),o($Vb3,[2,126],{67:$VH3}),o($Vb3,[2,127],{67:$VH3}),o($Vb3,[2,128],{67:$VH3}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:856,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:857,4:$V1,5:$V2,91:859,106:[1,858],107:$VO,256:$Va1},o($VI3,[2,250]),o($VI3,[2,252]),o($VI3,[2,254]),o($Vt1,[2,138]),o($Vt1,[2,729]),{71:[1,860]},o($Vw1,[2,686]),{3:861,4:$V1,5:$V2},{3:862,4:$V1,5:$V2},{3:864,4:$V1,5:$V2,334:863},{3:864,4:$V1,5:$V2,334:865},{3:866,4:$V1,5:$V2},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:867,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:868,4:$V1,5:$V2},o($Vc3,[2,445]),o($VH,$V54,{354:869,69:$V64,70:[1,870]}),o($VH,$V54,{354:872,69:$V64}),{70:[1,873]},{3:217,4:$V1,5:$V2,173:874},o($V73,[2,667]),o($V73,[2,669]),o($V73,[2,775]),{116:$Vr1,119:$Vs1,379:875},o($V74,[2,778],{367:168,428:876,118:877,119:$Vo1,368:$Vg1,372:$Vh1}),o($Vf3,$Vg3),{67:$Vd3,71:[1,878]},o($V84,[2,790],{437:879,438:880,126:[1,881]}),o($VK3,[2,789]),o($Vh3,[2,677]),o($Vh3,[2,678]),o($VH,[2,432],{70:[1,882]}),{69:[1,884],70:[1,883]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,122:[1,885],128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($VV3,$V94,{72:67,158:92,417:886,36:889,81:$V6,120:$Va4,163:$Va,419:$Vb4}),o($VM3,[2,769]),o($Vi3,[2,659]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:890,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE1,[2,626],{99:[1,891]}),{106:$Vc4,247:$Vd4,337:892},o([4,5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,257,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,483],{70:[1,895]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:897,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,295:896,367:168,368:$Vg1,372:$Vh1},o($VH,[2,406],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VH,[2,526]),o($VH,[2,527]),o($VH,[2,606]),{71:[1,898],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,899],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:147,4:$V1,5:$V2,36:900,51:144,70:$VM,72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:901,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{71:[1,902]},{67:$V63,71:[1,903]},o($Vn1,[2,378]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:904,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,36:905,51:144,70:$VM,71:[1,907],72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:906,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,381]),o($Vn1,[2,383]),o($Vn1,$Ve4,{239:908,240:$Vf4}),{71:[1,910],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,911],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{67:$V63,71:[1,912]},{3:913,4:$V1,5:$V2,154:[1,914]},o($Ve2,[2,558]),o($Vn1,[2,327]),{264:[1,915]},o($Vn1,[2,333]),{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,264:[2,337],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:916,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{4:$Vj3,236:917,338:$Vk3},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:918,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Ve2,[2,580]),o($Vt3,[2,587]),o($Vu3,[2,575]),o($VT3,$VS3),o($Ve2,[2,577]),o($Vx3,[2,582]),o($Vx3,[2,584]),o($Vx3,[2,585]),o($Vx3,[2,586]),o($VV3,[2,408],{67:$Vg4}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:897,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,295:921,367:168,368:$Vg1,372:$Vh1},o($Vh4,[2,416]),o($Vh4,[2,417]),o($VV3,[2,409]),{67:$Vi4,71:[1,922]},o($Vj4,[2,429]),o($VH,[2,653],{406:924,407:925,408:926,266:$VW3,413:[1,927]}),o($Vk4,[2,637]),o($Vk4,[2,638]),{128:[1,929],409:[1,928]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,266:[2,634],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Vj2,[2,157]),{3:930,4:$V1,5:$V2},o($VH,[2,511]),o($Vl4,[2,216],{77:931,205:[1,932]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:933,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vy3,[2,147],{178:934,187:936,179:937,188:938,193:941,67:$Vm4,180:$Vn4,182:$Vo4,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4}),{3:193,4:$V1,5:$V2,36:390,70:$Vj1,72:67,81:$V6,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,158:92,163:$Va,173:188,174:190,175:189,176:191,177:950,183:806,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},o($Vj4,[2,155]),{3:638,4:$V1,5:$V2,88:951,89:636,90:$Vz3},o($VY3,[2,70]),o($VA3,[2,125],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{71:[1,952]},{67:$V63,71:[2,705]},{3:147,4:$V1,5:$V2,51:144,70:$VM,71:[2,698],89:130,91:134,95:953,96:954,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,215:[1,956],222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,78]),o($VZ3,[2,701],{127:642,153:$VB3,154:$VC3,155:$VD3}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,958],90:$Vt2,92:959,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},o($VZ3,[2,702],{127:642,153:$VB3,154:$VC3,155:$VD3}),{71:[1,960],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,961]},o($VE3,[2,98]),{67:$V14,71:[1,962]},o($VE3,[2,100]),{67:$V63,71:[1,963]},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,964],90:$Vt2,92:965,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,966],90:$Vt2,92:967,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,968],90:$Vt2,92:969,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,970],90:$Vt2,92:971,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{67:$Vx4,71:[1,972]},o($Vy4,[2,121],{367:168,3:411,118:433,132:443,134:444,92:974,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,368:$Vg1,372:$Vh1}),o($V_3,$V$3,{152:828,137:975}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,976],90:$Vt2,92:977,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,978],90:$Vt2,92:979,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{67:$Vx4,71:[1,980]},{67:$Vx4,71:[1,981]},{67:$Vx4,71:[1,982]},{67:$Vx4,71:[1,983]},{71:[1,984],127:642,153:$VB3,154:$VC3,155:$VD3},{67:$VH3,71:[1,985]},{3:411,4:$V1,5:$V2,65:$Vq2,67:[1,986],69:$Vr2,70:$Vs2,90:$Vt2,92:987,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:988,4:$V1,5:$V2},{3:989,4:$V1,5:$V2},o($VH,[2,534]),{3:990,4:$V1,5:$V2},{91:991,107:$VO,256:$Va1},{71:[1,992]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:993,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,288:994,289:693},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:995,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{99:[1,996]},o($VH,[2,590],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:997,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:853,4:$V1,5:$V2,70:$V34,106:$V44,381:998},o($Vz4,[2,595]),o($Vz4,[2,596]),o($Vz4,[2,597]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:999,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VI3,[2,247]),o($VI3,[2,249]),o($VI3,[2,251]),o($VI3,[2,253]),o($Vt1,[2,139]),o($VH,[2,506]),{122:[1,1e3]},o($VH,[2,507]),o($V73,[2,477],{236:1001,4:$Vj3,336:[1,1002],338:$Vk3}),o($VH,[2,508]),o($VH,[2,510]),{67:$V63,71:[1,1003]},o($VH,[2,514]),o($VH,[2,518]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:1004,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:1005,4:$V1,5:$V2},o($VH,[2,520]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1006,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,1007]},{3:1008,4:$V1,5:$V2},{69:$VJ3,114:[2,780],429:1009,432:1010},o($V74,[2,779]),o($V73,[2,671]),o($V84,[2,675]),o($V84,[2,791]),{3:1011,4:$V1,5:$V2},{3:864,4:$V1,5:$V2,69:[1,1014],302:1012,309:1013,334:1015},{3:638,4:$V1,5:$V2,89:793,204:1016},{36:1017,72:67,81:$V6,158:92,163:$Va},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1018,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VV3,[2,658]),{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:1019,288:691,289:693},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:1020,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VV3,[2,663]),o($VE1,[2,627],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1021,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{67:[1,1022],71:[1,1023]},o($Vy4,[2,485]),o($Vy4,[2,486]),{106:$Vc4,247:$Vd4,337:1024},{67:$VA4,71:[1,1025]},o($Vy4,[2,421],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vn1,[2,349]),o($Vn1,[2,353]),{71:[1,1027]},{67:$V63,71:[1,1028]},o($Vn1,[2,374]),o($Vn1,[2,376]),{71:[1,1029],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,1030]},{67:$V63,71:[1,1031]},o($Vn1,[2,379]),o($Vn1,[2,298]),{70:[1,1032]},o($Vn1,$Ve4,{239:1033,240:$Vf4}),o($Vn1,$Ve4,{239:1034,240:$Vf4}),o($Va2,[2,316]),o($VT3,[2,259]),o($Vn1,[2,256]),o($Vn1,[2,332]),o($Vs3,[2,336],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{67:[1,1036],71:[1,1035]},{67:[1,1038],71:[1,1037],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:913,4:$V1,5:$V2},{70:[1,1039],116:$VQ,118:1040,119:$Vo1,126:$VS,155:$VW,175:1041,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{67:$VA4,71:[1,1042]},{36:1044,72:67,81:$V6,123:[1,1043],158:92,163:$Va},{3:638,4:$V1,5:$V2,89:1045},o($VH,[2,630]),o($Vk4,[2,635]),o($Vk4,[2,636]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:1046,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{144:[1,1048],267:[1,1047]},{409:[1,1049]},o($Vj2,[2,158]),o($VB4,[2,235],{78:1050,93:[1,1051]}),{94:[1,1052]},o($VX3,[2,215],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vy3,[2,148],{188:938,193:941,187:1053,179:1054,180:$Vn4,182:$Vo4,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4}),{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,183:1055,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},o($VC4,[2,181]),o($VC4,[2,182]),{3:193,4:$V1,5:$V2,70:[1,1060],116:$VQ,118:1058,119:$VR,126:$VS,155:$VW,173:1057,174:1061,175:1059,176:1062,189:1056,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{181:[1,1063],195:$VD4},{181:[1,1065],195:$VE4},o($VF4,[2,198]),{180:[1,1069],182:[1,1068],193:1067,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4},o($VF4,[2,200]),{195:[1,1070]},{182:[1,1072],195:[1,1071]},{182:[1,1074],195:[1,1073]},{182:[1,1075]},{195:[1,1076]},{195:[1,1077]},{67:$Vm4,178:1078,179:937,180:$Vn4,182:$Vo4,187:936,188:938,193:941,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4},o($VY3,[2,67]),o($VE3,[2,80]),{67:$VG4,71:[1,1079]},{71:[1,1081]},o($VH4,[2,237]),{71:[2,699]},o($VH4,[2,239],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,215:[1,1082],216:[1,1083],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VE3,[2,79]),o($VZ3,[2,703],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,81]),o($VE3,[2,82]),o($VE3,[2,99]),o($VE3,[2,102]),o($VE3,[2,105]),o($VZ3,[2,707],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,106]),o($VZ3,[2,709],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,107]),o($VZ3,[2,711],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,108]),o($VZ3,[2,715],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,109]),o($V_3,[2,722],{151:1084}),o($V_3,[2,725],{127:642,153:$VB3,154:$VC3,155:$VD3}),{67:$Vx4,71:[1,1085]},o($VE3,[2,111]),o($VZ3,[2,717],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,112]),o($VZ3,[2,719],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,113]),o($VE3,[2,114]),o($VE3,[2,115]),o($VE3,[2,116]),o($VE3,[2,117]),o($VE3,[2,118]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:1086,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V04,[2,721],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VH,[2,544]),o($VH,[2,540]),o($VH,[2,542]),o($VH,[2,538]),o($V43,[2,63]),o($VH,[2,400],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($V24,[2,403]),o($V24,[2,404],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1087,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,591],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vz4,[2,594]),{71:[1,1088],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:1089,4:$V1,5:$V2},o($V73,[2,487],{335:1090,339:1091,340:1092,317:1100,128:$VI4,161:$VJ4,257:$VK4,294:$VL4,307:$VM4,319:$VN4,320:$VO4,324:$VP4,325:$VQ4}),o($V73,[2,476]),o($VH,[2,513],{69:[1,1103]}),{67:$V63,71:[1,1104]},o($VH,[2,522]),{67:$VG4,71:[1,1105]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1106,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VL3,[2,673]),{114:[1,1107]},{114:[2,781]},o($V84,[2,676]),{71:[1,1108]},{67:[1,1109],71:[2,447]},{36:1110,72:67,81:$V6,158:92,163:$Va},o($Vy4,[2,473]),{67:$Vi4,71:[1,1111]},o($VH,[2,762],{359:1112,360:1113,65:$VR4}),o($VV3,$V94,{72:67,158:92,278:322,36:889,417:1115,81:$V6,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,120:$Va4,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,163:$Va,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72,419:$Vb4}),o($VV3,[2,661],{67:$V14}),o($VV3,[2,662],{67:$V63}),o($VE1,[2,628],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{106:[1,1116]},o($VS4,[2,480]),{67:[1,1117],71:[1,1118]},o($VS4,[2,484]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1119,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,365]),o($Vn1,[2,366]),o($Vn1,[2,390]),o($Vn1,[2,375]),o($Vn1,[2,377]),{93:$VT4,241:1120,242:1121,243:[1,1122]},o($Vn1,[2,299]),o($Vn1,[2,300]),o($Vn1,[2,287]),{106:[1,1124]},o($Vn1,[2,289]),{106:[1,1125]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:897,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,295:1126,367:168,368:$Vg1,372:$Vh1},o($Vh4,[2,419]),o($Vh4,[2,420]),o($Vh4,[2,415]),{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:1127,367:168,368:$Vg1,372:$Vh1},o($VV3,[2,412]),o($Vj4,[2,430]),o($VH,[2,654],{67:$VH3,172:[1,1128]}),{287:$VU4,290:$VV4,410:1129},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1132,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{94:[1,1134],144:[1,1135],267:[1,1133]},o($VW4,[2,243],{79:1136,218:[1,1137]}),{94:[1,1138]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1139,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VC4,[2,179]),o($VC4,[2,180]),o($Vj4,[2,156]),o($VC4,[2,213],{190:1145,202:[1,1146],203:[1,1147]}),o($V_4,[2,184],{3:1148,4:$V1,5:$V2,69:[1,1149]}),o($V$4,[2,734],{191:1150,69:[1,1151]}),{3:1152,4:$V1,5:$V2,69:[1,1153]},{36:1154,72:67,81:$V6,158:92,163:$Va},o($V_4,[2,192],{3:1155,4:$V1,5:$V2,69:[1,1156]}),o($V_4,[2,195],{3:1157,4:$V1,5:$V2,69:[1,1158]}),{70:[1,1159]},o($VF4,[2,210]),{70:[1,1160]},o($VF4,[2,206]),o($VF4,[2,199]),{195:$VE4},{195:$VD4},o($VF4,[2,201]),o($VF4,[2,202]),{195:[1,1161]},o($VF4,[2,204]),{195:[1,1162]},{195:[1,1163]},o($VF4,[2,208]),o($VF4,[2,209]),{71:[1,1164],179:1054,180:$Vn4,182:$Vo4,187:1053,188:938,193:941,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4},o($VE3,[2,72]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:1165,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,73]),o($VH4,[2,240]),{217:[1,1166]},o($Vy4,[2,120],{367:168,3:411,118:433,132:443,134:444,92:1167,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,368:$Vg1,372:$Vh1}),o($VE3,[2,110]),{67:$V63,71:[1,1168]},o($V24,[2,405],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vz4,[2,598]),o($VH,[2,509]),o($V73,[2,475]),o($V73,[2,488],{317:1100,340:1169,128:$VI4,161:$VJ4,257:$VK4,294:$VL4,307:$VM4,319:$VN4,320:$VO4,324:$VP4,325:$VQ4}),o($V53,[2,490]),{321:[1,1170]},{321:[1,1171]},{3:217,4:$V1,5:$V2,173:1172},o($V53,[2,496],{70:[1,1173]}),{3:231,4:$V1,5:$V2,70:[1,1175],91:225,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:224,174:229,175:228,225:226,226:227,232:$Vp1,238:1174,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1},o($V53,[2,499]),{257:[1,1176]},o($V53,[2,501]),o($V53,[2,502]),{70:[1,1177]},{3:1178,4:$V1,5:$V2},o($VH,$V54,{354:1179,69:$V64}),o($VH,[2,528]),{67:$VG4,71:[1,1180]},o([8,67,71,107,112,126,264,268,450,451],$VC1,{434:280,379:282,3:734,430:1181,424:1182,431:1183,4:$V1,5:$V2,116:$Vr1,119:$Vs1}),o($VH,[2,435],{303:1184,305:1185,306:1186,4:$V05,294:$V15,307:$V25}),o($V35,$V45,{3:864,310:1190,334:1191,311:1192,312:1193,4:$V1,5:$V2,318:$V55}),{71:[2,448]},{69:[1,1195]},o($VH,[2,546]),o($VH,[2,763]),{319:[1,1197],361:[1,1196]},o($VV3,[2,664]),{71:[1,1198]},{106:[1,1199]},o($VS4,[2,481]),o($Vy4,[2,422],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{71:[1,1200],93:$VT4,242:1201},{71:[1,1202]},{94:[1,1203]},{94:[1,1204]},{71:[1,1205]},{71:[1,1206]},{67:$VA4,71:[1,1207]},o($VV3,[2,410],{67:$Vg4}),{3:217,4:$V1,5:$V2,116:$Vr1,119:$Vs1,173:1209,379:1208},o($Vk4,[2,639]),o($Vk4,[2,641]),{120:[1,1210]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1211],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{291:$V65,411:1212},{365:[1,1215],412:[1,1214]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1216,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VA3,[2,226],{80:1217,136:[1,1218],142:[1,1220],143:[1,1219]}),{106:$VN,170:1221},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1222,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vl4,[2,224],{207:1223,67:$V75,212:[1,1225]}),o($V85,[2,218]),{120:[1,1226]},{70:[1,1227]},{70:[1,1228]},o($V85,[2,223],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VC4,[2,183]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1229,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:638,4:$V1,5:$V2,89:793,204:1230},o($V_4,[2,185]),{3:1231,4:$V1,5:$V2},o($V_4,[2,736],{192:1232,3:1233,4:$V1,5:$V2}),o($V$4,[2,735]),o($V_4,[2,188]),{3:1234,4:$V1,5:$V2},{71:[1,1235]},o($V_4,[2,193]),{3:1236,4:$V1,5:$V2},o($V_4,[2,196]),{3:1237,4:$V1,5:$V2},{36:1238,72:67,81:$V6,158:92,163:$Va},{36:1239,72:67,81:$V6,158:92,163:$Va},o($VF4,[2,203]),o($VF4,[2,205]),o($VF4,[2,207]),o($Vy3,[2,149]),o($VH4,[2,238]),o($VH4,[2,241],{215:[1,1240]}),o($V_3,[2,723],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,119]),o($V53,[2,489]),o($V53,[2,492]),{325:[1,1241]},o($V53,[2,756],{343:1242,341:1243,70:$V95}),{106:$VN,170:1245},o($V53,[2,497]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1246,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V53,[2,500]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1247,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,515]),o($VH,[2,519]),o($VH,[2,529]),o($V73,[2,670]),o($V73,[2,782]),o($V73,[2,783]),o($VH,[2,431]),o($VH,[2,436],{306:1248,4:$V05,294:$V15,307:$V25}),o($Va5,[2,438]),o($Va5,[2,439]),{99:[1,1249]},{99:[1,1250]},{67:[1,1251],71:[2,446]},o($Vy4,[2,474]),o($Vy4,[2,449]),{161:[1,1259],167:[1,1260],313:1252,314:1253,315:1254,316:1255,317:1256,319:$VN4,320:[1,1257],321:[1,1261],324:[1,1258]},{3:1262,4:$V1,5:$V2},{36:1263,72:67,81:$V6,158:92,163:$Va},{362:[1,1264]},{363:[1,1265]},o($VS4,[2,478]),{71:[1,1266]},o($Vn1,[2,302]),{71:[1,1267]},o($Vn1,[2,303]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1268,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1269,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,288]),o($Vn1,[2,290]),o($Vh4,[2,418]),{3:1270,4:$V1,5:$V2},o($VH,[2,656],{70:[1,1271]}),{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:1272,288:691,289:693},{287:$VU4,290:$VV4,410:1273},o($Vk4,[2,643]),{70:[1,1275],123:[1,1274],294:[1,1276]},{144:[1,1278],267:[1,1277]},{144:[1,1280],267:[1,1279]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1281],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($VA3,[2,64]),{36:1282,72:67,81:$V6,138:[1,1283],158:92,163:$Va,213:[1,1284]},{36:1285,72:67,81:$V6,158:92,163:$Va,213:[1,1286]},{36:1287,72:67,81:$V6,158:92,163:$Va,213:[1,1288]},o($VW4,[2,245],{219:1289,220:[1,1290]}),o($VB4,[2,236],{67:$VG4}),o($Vl4,[2,217]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,208:1291,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1292,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,1293]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1294,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1295,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VC4,[2,211],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VC4,[2,212],{67:$Vi4}),o($V_4,[2,186]),o($V_4,[2,187]),o($V_4,[2,737]),o($V_4,[2,189]),{3:1296,4:$V1,5:$V2,69:[1,1297]},o($V_4,[2,194]),o($V_4,[2,197]),{71:[1,1298]},{71:[1,1299]},o($VH4,[2,242]),{3:217,4:$V1,5:$V2,173:1300},o($V53,[2,494]),o($V53,[2,757]),{3:1301,4:$V1,5:$V2},{67:[1,1302]},{71:[1,1303],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,1304],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Va5,[2,437]),{3:1305,4:$V1,5:$V2},{106:$VN,170:1306},o($V35,$V45,{312:1193,311:1307,318:$V55}),o($V73,[2,451]),o($V73,[2,452]),o($V73,[2,453]),o($V73,[2,454]),o($V73,[2,455]),{321:[1,1308]},{321:[1,1309]},{3:1311,4:$V1,5:$V2,70:[2,752],333:1310},{3:1312,4:$V1,5:$V2},{3:1313,4:$V1,5:$V2},o($V35,[2,457]),o($VH,[2,760],{358:1314,360:1315,65:$VR4}),o($VH,[2,547]),o($VH,[2,548],{318:[1,1316]}),o($VS4,[2,479]),o($Vn1,[2,304]),o([71,93],[2,305],{67:$V75}),{67:$VG4,71:[2,306]},o($VH,[2,655]),{3:638,4:$V1,5:$V2,89:793,204:1317},o($Vk4,[2,642],{67:$V14}),o($Vk4,[2,640]),{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:1318,367:168,368:$Vg1,372:$Vh1},{3:638,4:$V1,5:$V2,89:793,204:1319},{123:[1,1320]},{291:$V65,411:1321},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1322,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{291:$V65,411:1323},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1324,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{291:$V65,411:1325},o($VA3,[2,227]),{36:1326,72:67,81:$V6,158:92,163:$Va,213:[1,1327]},{36:1328,72:67,81:$V6,158:92,163:$Va},o($VA3,[2,229]),{36:1329,72:67,81:$V6,158:92,163:$Va},o($VA3,[2,230]),{36:1330,72:67,81:$V6,158:92,163:$Va},o($VW4,[2,244]),{106:$VN,170:1331},o($V85,[2,219]),o($Vl4,[2,225],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1332,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{67:$V75,71:[1,1333]},{67:$V75,71:[1,1334]},o($V_4,[2,190]),{3:1335,4:$V1,5:$V2},{3:1336,4:$V1,5:$V2,69:[1,1337]},{3:1338,4:$V1,5:$V2,69:[1,1339]},o($V53,[2,754],{342:1340,341:1341,70:$V95}),{71:[1,1342]},{106:$VN,170:1343},o($V53,[2,498]),o($V53,[2,458]),o($Va5,[2,440]),o($Va5,[2,441]),o($Vy4,[2,450]),{3:1345,4:$V1,5:$V2,70:[2,748],322:1344},{70:[1,1346]},{70:[1,1347]},{70:[2,753]},{70:[1,1348]},{70:[1,1349]},o($VH,[2,545]),o($VH,[2,761]),o($V35,$V45,{312:1193,311:1350,318:$V55}),{67:$Vi4,71:[1,1351]},o($Vk4,[2,649],{67:$Vg4}),{67:$Vi4,71:[1,1352]},o($Vk4,[2,651]),o($Vk4,[2,644]),{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1353],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Vk4,[2,647]),{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1354],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Vk4,[2,645]),o($VA3,[2,228]),{36:1355,72:67,81:$V6,158:92,163:$Va},o($VA3,[2,231]),o($VA3,[2,233]),o($VA3,[2,234]),o($VW4,[2,246]),{67:$V75,71:[1,1356]},o($V85,[2,221]),o($V85,[2,222]),o($V_4,[2,191]),o($VC4,[2,151]),{3:1357,4:$V1,5:$V2},o($VC4,[2,153]),{3:1358,4:$V1,5:$V2},o($V53,[2,493]),o($V53,[2,755]),o($V53,[2,491]),{71:[1,1359]},{70:[1,1360]},{70:[2,749]},{3:1362,4:$V1,5:$V2,107:$Vb5,323:1361},{3:638,4:$V1,5:$V2,89:793,204:1364},{3:638,4:$V1,5:$V2,89:793,204:1365},{3:638,4:$V1,5:$V2,89:793,204:1366},o($VH,[2,549]),o($VH,[2,657]),{123:[1,1367],294:[1,1368]},{291:$V65,411:1369},{287:$VU4,290:$VV4,410:1370},o($VA3,[2,232]),o($V85,[2,220]),o($VC4,[2,152]),o($VC4,[2,154]),o($V53,[2,495]),{3:1362,4:$V1,5:$V2,107:$Vb5,323:1371},{67:$Vc5,71:[1,1372]},o($Vy4,[2,469]),o($Vy4,[2,470]),{67:$Vi4,71:[1,1374]},{67:$Vi4,71:[1,1375]},{67:$Vi4,71:[1,1376]},{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:1377,367:168,368:$Vg1,372:$Vh1},{123:[1,1378]},o($Vk4,[2,646]),o($Vk4,[2,648]),{67:$Vc5,71:[1,1379]},{325:[1,1380]},{3:1381,4:$V1,5:$V2,107:[1,1382]},o($V73,[2,466]),o($V73,[2,467]),o($V73,[2,468]),o($Vk4,[2,650],{67:$Vg4}),o($Vk4,[2,652]),o($V73,[2,459]),{3:217,4:$V1,5:$V2,173:1383},o($Vy4,[2,471]),o($Vy4,[2,472]),o($Vd5,[2,750],{326:1384,328:1385,70:[1,1386]}),o($V73,[2,462],{327:1387,329:1388,202:[1,1389]}),o($Vd5,[2,751]),{3:1362,4:$V1,5:$V2,107:$Vb5,323:1390},o($V73,[2,460]),{202:[1,1392],330:1391},{290:[1,1393]},{67:$Vc5,71:[1,1394]},o($V73,[2,463]),{287:[1,1395]},{331:[1,1396]},o($Vd5,[2,461]),{331:[1,1397]},{332:[1,1398]},{332:[1,1399]},{202:[2,464]},o($V73,[2,465])],defaultActions:{97:[2,3],171:[2,307],172:[2,308],173:[2,309],174:[2,310],175:[2,311],176:[2,312],177:[2,313],178:[2,314],179:[2,315],184:[2,631],281:[2,777],288:[2,771],335:[2,738],336:[2,739],389:[2,632],455:[2,712],456:[2,713],560:[2,397],561:[2,398],562:[2,399],615:[2,633],956:[2,699],1010:[2,781],1110:[2,448],1311:[2,753],1345:[2,749],1398:[2,464]},parseError:function parseError(str,hash){if(hash.recoverable){this.trace(str) +}else{throw new Error(str)}},parse:function parse(input){var self=this,stack=[0],tstack=[],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,recovering=0,TERROR=2,EOF=1;var args=lstack.slice.call(arguments,1);var lexer=Object.create(this.lexer);var sharedState={yy:{}};for(var k in this.yy){if(Object.prototype.hasOwnProperty.call(this.yy,k)){sharedState.yy[k]=this.yy[k]}}lexer.setInput(input,sharedState.yy);sharedState.yy.lexer=lexer;sharedState.yy.parser=this;if(typeof lexer.yylloc=="undefined"){lexer.yylloc={}}var yyloc=lexer.yylloc;lstack.push(yyloc);var ranges=lexer.options&&lexer.options.ranges;if(typeof sharedState.yy.parseError==="function"){this.parseError=sharedState.yy.parseError}else{this.parseError=Object.getPrototypeOf(this).parseError}function popStack(n){stack.length=stack.length-2*n;vstack.length=vstack.length-n;lstack.length=lstack.length-n}_token_stack:function lex(){var token;token=lexer.lex()||EOF;if(typeof token!=="number"){token=self.symbols_[token]||token}return token}var symbol,preErrorSymbol,state,action,a,r,yyval={},p,len,newState,expected;while(true){state=stack[stack.length-1];if(this.defaultActions[state]){action=this.defaultActions[state]}else{if(symbol===null||typeof symbol=="undefined"){symbol=lex()}action=table[state]&&table[state][symbol]}if(typeof action==="undefined"||!action.length||!action[0]){var errStr="";expected=[];for(p in table[state]){if(this.terminals_[p]&&p>TERROR){expected.push("'"+this.terminals_[p]+"'")}}if(lexer.showPosition){errStr="Parse error on line "+(yylineno+1)+":\n"+lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'"}else{errStr="Parse error on line "+(yylineno+1)+": Unexpected "+(symbol==EOF?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'")}this.parseError(errStr,{text:lexer.match,token:this.terminals_[symbol]||symbol,line:lexer.yylineno,loc:yyloc,expected:expected})}if(action[0]instanceof Array&&action.length>1){throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol)}switch(action[0]){case 1:stack.push(symbol);vstack.push(lexer.yytext);lstack.push(lexer.yylloc);stack.push(action[1]);symbol=null;if(!preErrorSymbol){yyleng=lexer.yyleng;yytext=lexer.yytext;yylineno=lexer.yylineno;yyloc=lexer.yylloc;if(recovering>0){recovering--}}else{symbol=preErrorSymbol;preErrorSymbol=null}break;case 2:len=this.productions_[action[1]][1];yyval.$=vstack[vstack.length-len];yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column};if(ranges){yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]}r=this.performAction.apply(yyval,[yytext,yyleng,yylineno,sharedState.yy,action[1],vstack,lstack].concat(args));if(typeof r!=="undefined"){return r}if(len){stack=stack.slice(0,-1*len*2);vstack=vstack.slice(0,-1*len);lstack=lstack.slice(0,-1*len)}stack.push(this.productions_[action[1]][0]);vstack.push(yyval.$);lstack.push(yyval._$);newState=table[stack[stack.length-2]][stack[stack.length-1]];stack.push(newState);break;case 3:return true}}return true}};var lexer=function(){var lexer={EOF:1,parseError:function parseError(str,hash){if(this.yy.parser){this.yy.parser.parseError(str,hash)}else{throw new Error(str)}},setInput:function(input,yy){this.yy=yy||this.yy||{};this._input=input;this._more=this._backtrack=this.done=false;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};if(this.options.ranges){this.yylloc.range=[0,0]}this.offset=0;return this},input:function(){var ch=this._input[0];this.yytext+=ch;this.yyleng++;this.offset++;this.match+=ch;this.matched+=ch;var lines=ch.match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno++;this.yylloc.last_line++}else{this.yylloc.last_column++}if(this.options.ranges){this.yylloc.range[1]++}this._input=this._input.slice(1);return ch},unput:function(ch){var len=ch.length;var lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-len);this.offset-=len;var oldLines=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);if(lines.length-1){this.yylineno-=lines.length-1}var r=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len};if(this.options.ranges){this.yylloc.range=[r[0],r[0]+this.yyleng-len]}this.yyleng=this.yytext.length;return this},more:function(){this._more=true;return this},reject:function(){if(this.options.backtrack_lexer){this._backtrack=true}else{return 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})}return this},less:function(n){this.unput(this.match.slice(n))},pastInput:function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var next=this.match;if(next.length<20){next+=this._input.substr(0,20-next.length)}return(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var pre=this.pastInput();var c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},test_match:function(match,indexed_rule){var token,lines,backup;if(this.options.backtrack_lexer){backup={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};if(this.options.ranges){backup.yylloc.range=this.yylloc.range.slice(0)}}lines=match[0].match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno+=lines.length}this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length};this.yytext+=match[0];this.match+=match[0];this.matches=match;this.yyleng=this.yytext.length;if(this.options.ranges){this.yylloc.range=[this.offset,this.offset+=this.yyleng]}this._more=false;this._backtrack=false;this._input=this._input.slice(match[0].length);this.matched+=match[0];token=this.performAction.call(this,this.yy,this,indexed_rule,this.conditionStack[this.conditionStack.length-1]);if(this.done&&this._input){this.done=false}if(token){return token}else if(this._backtrack){for(var k in backup){this[k]=backup[k]}return false}return false},next:function(){if(this.done){return this.EOF}if(!this._input){this.done=true}var token,match,tempMatch,index;if(!this._more){this.yytext="";this.match=""}var rules=this._currentRules();for(var i=0;imatch[0].length)){match=tempMatch;index=i;if(this.options.backtrack_lexer){token=this.test_match(tempMatch,rules[i]);if(token!==false){return token}else if(this._backtrack){match=false;continue}else{return false}}else if(!this.options.flex){break}}}if(match){token=this.test_match(match,rules[index]);if(token!==false){return token}return false}if(this._input===""){return this.EOF}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}},lex:function lex(){var r=this.next();if(r){return r}else{return this.lex()}},begin:function begin(condition){this.conditionStack.push(condition)},popState:function popState(){var n=this.conditionStack.length-1;if(n>0){return this.conditionStack.pop()}else{return this.conditionStack[0]}},_currentRules:function _currentRules(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules}else{return this.conditions["INITIAL"].rules}},topState:function topState(n){n=this.conditionStack.length-1-Math.abs(n||0);if(n>=0){return this.conditionStack[n]}else{return"INITIAL"}},pushState:function pushState(condition){this.begin(condition)},stateStackSize:function stateStackSize(){return this.conditionStack.length},options:{"case-insensitive":true},performAction:function anonymous(yy,yy_,$avoiding_name_collisions,YY_START){var YYSTATE=YY_START;switch($avoiding_name_collisions){case 0:return 233;break;case 1:return 260;break;case 2:return 368;break;case 3:return 5;break;case 4:return 5;break;case 5:return 256;break;case 6:return 256;break;case 7:return 107;break;case 8:return 107;break;case 9:return;break;case 10:break;case 11:return 145;break;case 12:return 144;break;case 13:yy_.yytext="VALUE";return 163;break;case 14:yy_.yytext="ROW";return 163;break;case 15:yy_.yytext="COLUMN";return 163;break;case 16:yy_.yytext="MATRIX";return 163;break;case 17:yy_.yytext="INDEX";return 163;break;case 18:yy_.yytext="RECORDSET";return 163;break;case 19:yy_.yytext="TEXT";return 163;break;case 20:yy_.yytext="SELECT";return 163;break;case 21:return"ABSOLUTE";break;case 22:return 332;break;case 23:return 349;break;case 24:return 251;break;case 25:return 138;break;case 26:return 347;break;case 27:return 144;break;case 28:return 201;break;case 29:return 140;break;case 30:return 181;break;case 31:return 252;break;case 32:return 69;break;case 33:return 366;break;case 34:return 215;break;case 35:return 351;break;case 36:return 307;break;case 37:return 248;break;case 38:return 386;break;case 39:return 282;break;case 40:return 390;break;case 41:return 283;break;case 42:return 269;break;case 43:return 94;break;case 44:return 261;break;case 45:return 235;break;case 46:return 319;break;case 47:return 105;break;case 48:return"CLOSE";break;case 49:return 216;break;case 50:return 164;break;case 51:return 164;break;case 52:return 383;break;case 53:return 318;break;case 54:return 419;break;case 55:return 389;break;case 56:return 237;break;case 57:return 213;break;case 58:return 245;break;case 59:return 298;break;case 60:return 180;break;case 61:return 211;break;case 62:return 232;break;case 63:return"CURSOR";break;case 64:return 352;break;case 65:return 397;break;case 66:return 294;break;case 67:return 290;break;case 68:return"DELETED";break;case 69:return 215;break;case 70:return 353;break;case 71:return 159;break;case 72:return 344;break;case 73:return 396;break;case 74:return 110;break;case 75:return 264;break;case 76:return 338;break;case 77:return 268;break;case 78:return 143;break;case 79:return 258;break;case 80:return 12;break;case 81:return 255;break;case 82:return"FETCH";break;case 83:return 249;break;case 84:return 324;break;case 85:return 157;break;case 86:return 451;break;case 87:return 421;break;case 88:return 205;break;case 89:return 209;break;case 90:return 212;break;case 91:return 364;break;case 92:return 130;break;case 93:return 307;break;case 94:return 284;break;case 95:return 280;break;case 96:return 167;break;case 97:return 196;break;case 98:return 291;break;case 99:return"INSERTED";break;case 100:return 142;break;case 101:return 172;break;case 102:return 195;break;case 103:return 321;break;case 104:return 250;break;case 105:return"LET";break;case 106:return 197;break;case 107:return 90;break;case 108:return 218;break;case 109:return 409;break;case 110:return 165;break;case 111:return 247;break;case 112:return 401;break;case 113:return 246;break;case 114:return 143;break;case 115:return 350;break;case 116:return 194;break;case 117:return"NEXT";break;case 118:return 234;break;case 119:return 217;break;case 120:return 331;break;case 121:return 128;break;case 122:return 257;break;case 123:return 382;break;case 124:return 202;break;case 125:return 362;break;case 126:return 220;break;case 127:return"OPEN";break;case 128:return 363;break;case 129:return 145;break;case 130:return 93;break;case 131:return 182;break;case 132:return 240;break;case 133:return 146;break;case 134:return 243;break;case 135:return 452;break;case 136:return 14;break;case 137:return 320;break;case 138:return 391;break;case 139:return"PRIOR";break;case 140:return 13;break;case 141:return 361;break;case 142:return 168;break;case 143:return"REDUCE";break;case 144:return 325;break;case 145:return"RELATIVE";break;case 146:return 85;break;case 147:return 348;break;case 148:return 149;break;case 149:return 392;break;case 150:return"RESTORE";break;case 151:return 147;break;case 152:return 147;break;case 153:return 198;break;case 154:return 385;break;case 155:return 210;break;case 156:return 124;break;case 157:return 352;break;case 158:return 81;break;case 159:return 200;break;case 160:return 120;break;case 161:return 120;break;case 162:return 356;break;case 163:return 286;break;case 164:return 365;break;case 165:return"STRATEGY";break;case 166:return"STORE";break;case 167:return 244;break;case 168:return 304;break;case 169:return 304;break;case 170:return 412;break;case 171:return 308;break;case 172:return 308;break;case 173:return 166;break;case 174:return 267;break;case 175:return"TIMEOUT";break;case 176:return 122;break;case 177:return 169;break;case 178:return 384;break;case 179:return 384;break;case 180:return 254;break;case 181:return 400;break;case 182:return 136;break;case 183:return 161;break;case 184:return 287;break;case 185:return 355;break;case 186:return 203;break;case 187:return 123;break;case 188:return 109;break;case 189:return 357;break;case 190:return 266;break;case 191:return 104;break;case 192:return 388;break;case 193:return 65;break;case 194:return 384;break;case 195:return 106;break;case 196:return 106;break;case 197:return 97;break;case 198:return 112;break;case 199:return 153;break;case 200:return 270;break;case 201:return 154;break;case 202:return 108;break;case 203:return 113;break;case 204:return 277;break;case 205:return 274;break;case 206:return 276;break;case 207:return 273;break;case 208:return 271;break;case 209:return 114;break;case 210:return 272;break;case 211:return 275;break;case 212:return 115;break;case 213:return 99;break;case 214:return 275;break;case 215:return 70;break;case 216:return 71;break;case 217:return 119;break;case 218:return 372;break;case 219:return 374;break;case 220:return 376;break;case 221:return 447;break;case 222:return 449;break;case 223:return 117;break;case 224:return 67;break;case 225:return 285;break;case 226:return 126;break;case 227:return 450;break;case 228:return 116;break;case 229:return 155;break;case 230:return 111;break;case 231:return 98;break;case 232:return 4;break;case 233:return 8;break;case 234:return"INVALID";break}},rules:[/^(?:``([^\`])+``)/i,/^(?:\[\?\])/i,/^(?:@\[)/i,/^(?:\[([^\]])*?\])/i,/^(?:`([^\`])*?`)/i,/^(?:N(['](\\.|[^']|\\')*?['])+)/i,/^(?:X(['](\\.|[^']|\\')*?['])+)/i,/^(?:(['](\\.|[^']|\\')*?['])+)/i,/^(?:(["](\\.|[^"]|\\")*?["])+)/i,/^(?:--(.*?)($|\r\n|\r|\n))/i,/^(?:\s+)/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:VALUE\s+OF\s+SELECT\b)/i,/^(?:ROW\s+OF\s+SELECT\b)/i,/^(?:COLUMN\s+OF\s+SELECT\b)/i,/^(?:MATRIX\s+OF\s+SELECT\b)/i,/^(?:INDEX\s+OF\s+SELECT\b)/i,/^(?:RECORDSET\s+OF\s+SELECT\b)/i,/^(?:TEXT\s+OF\s+SELECT\b)/i,/^(?:SELECT\b)/i,/^(?:ABSOLUTE\b)/i,/^(?:ACTION\b)/i,/^(?:ADD\b)/i,/^(?:AGGR\b)/i,/^(?:ALL\b)/i,/^(?:ALTER\b)/i,/^(?:AND\b)/i,/^(?:ANTI\b)/i,/^(?:ANY\b)/i,/^(?:APPLY\b)/i,/^(?:ARRAY\b)/i,/^(?:AS\b)/i,/^(?:ASSERT\b)/i,/^(?:ASC\b)/i,/^(?:ATTACH\b)/i,/^(?:AUTO(_)?INCREMENT\b)/i,/^(?:AVG\b)/i,/^(?:BEGIN\b)/i,/^(?:BETWEEN\b)/i,/^(?:BREAK\b)/i,/^(?:NOT\s+BETWEEN\b)/i,/^(?:NOT\s+LIKE\b)/i,/^(?:BY\b)/i,/^(?:CASE\b)/i,/^(?:CAST\b)/i,/^(?:CHECK\b)/i,/^(?:CLASS\b)/i,/^(?:CLOSE\b)/i,/^(?:COLLATE\b)/i,/^(?:COLUMN\b)/i,/^(?:COLUMNS\b)/i,/^(?:COMMIT\b)/i,/^(?:CONSTRAINT\b)/i,/^(?:CONTENT\b)/i,/^(?:CONTINUE\b)/i,/^(?:CONVERT\b)/i,/^(?:CORRESPONDING\b)/i,/^(?:COUNT\b)/i,/^(?:CREATE\b)/i,/^(?:CROSS\b)/i,/^(?:CUBE\b)/i,/^(?:CURRENT_TIMESTAMP\b)/i,/^(?:CURSOR\b)/i,/^(?:DATABASE(S)?)/i,/^(?:DECLARE\b)/i,/^(?:DEFAULT\b)/i,/^(?:DELETE\b)/i,/^(?:DELETED\b)/i,/^(?:DESC\b)/i,/^(?:DETACH\b)/i,/^(?:DISTINCT\b)/i,/^(?:DROP\b)/i,/^(?:ECHO\b)/i,/^(?:EDGE\b)/i,/^(?:END\b)/i,/^(?:ENUM\b)/i,/^(?:ELSE\b)/i,/^(?:EXCEPT\b)/i,/^(?:EXISTS\b)/i,/^(?:EXPLAIN\b)/i,/^(?:FALSE\b)/i,/^(?:FETCH\b)/i,/^(?:FIRST\b)/i,/^(?:FOREIGN\b)/i,/^(?:FROM\b)/i,/^(?:GO\b)/i,/^(?:GRAPH\b)/i,/^(?:GROUP\b)/i,/^(?:GROUPING\b)/i,/^(?:HAVING\b)/i,/^(?:HELP\b)/i,/^(?:IF\b)/i,/^(?:IDENTITY\b)/i,/^(?:IS\b)/i,/^(?:IN\b)/i,/^(?:INDEX\b)/i,/^(?:INNER\b)/i,/^(?:INSERT\b)/i,/^(?:INSERTED\b)/i,/^(?:INTERSECT\b)/i,/^(?:INTO\b)/i,/^(?:JOIN\b)/i,/^(?:KEY\b)/i,/^(?:LAST\b)/i,/^(?:LET\b)/i,/^(?:LEFT\b)/i,/^(?:LIKE\b)/i,/^(?:LIMIT\b)/i,/^(?:MATCHED\b)/i,/^(?:MATRIX\b)/i,/^(?:MAX\b)/i,/^(?:MERGE\b)/i,/^(?:MIN\b)/i,/^(?:MINUS\b)/i,/^(?:MODIFY\b)/i,/^(?:NATURAL\b)/i,/^(?:NEXT\b)/i,/^(?:NEW\b)/i,/^(?:NOCASE\b)/i,/^(?:NO\b)/i,/^(?:NOT\b)/i,/^(?:NULL\b)/i,/^(?:OFF\b)/i,/^(?:ON\b)/i,/^(?:ONLY\b)/i,/^(?:OFFSET\b)/i,/^(?:OPEN\b)/i,/^(?:OPTION\b)/i,/^(?:OR\b)/i,/^(?:ORDER\b)/i,/^(?:OUTER\b)/i,/^(?:OVER\b)/i,/^(?:PATH\b)/i,/^(?:PARTITION\b)/i,/^(?:PERCENT\b)/i,/^(?:PLAN\b)/i,/^(?:PRIMARY\b)/i,/^(?:PRINT\b)/i,/^(?:PRIOR\b)/i,/^(?:QUERY\b)/i,/^(?:READ\b)/i,/^(?:RECORDSET\b)/i,/^(?:REDUCE\b)/i,/^(?:REFERENCES\b)/i,/^(?:RELATIVE\b)/i,/^(?:REMOVE\b)/i,/^(?:RENAME\b)/i,/^(?:REPEAT\b)/i,/^(?:REQUIRE\b)/i,/^(?:RESTORE\b)/i,/^(?:RETURN\b)/i,/^(?:RETURNS\b)/i,/^(?:RIGHT\b)/i,/^(?:ROLLBACK\b)/i,/^(?:ROLLUP\b)/i,/^(?:ROW\b)/i,/^(?:SCHEMA(S)?)/i,/^(?:SEARCH\b)/i,/^(?:SEMI\b)/i,/^(?:SET\b)/i,/^(?:SETS\b)/i,/^(?:SHOW\b)/i,/^(?:SOME\b)/i,/^(?:SOURCE\b)/i,/^(?:STRATEGY\b)/i,/^(?:STORE\b)/i,/^(?:SUM\b)/i,/^(?:TABLE\b)/i,/^(?:TABLES\b)/i,/^(?:TARGET\b)/i,/^(?:TEMP\b)/i,/^(?:TEMPORARY\b)/i,/^(?:TEXTSTRING\b)/i,/^(?:THEN\b)/i,/^(?:TIMEOUT\b)/i,/^(?:TO\b)/i,/^(?:TOP\b)/i,/^(?:TRAN\b)/i,/^(?:TRANSACTION\b)/i,/^(?:TRUE\b)/i,/^(?:TRUNCATE\b)/i,/^(?:UNION\b)/i,/^(?:UNIQUE\b)/i,/^(?:UPDATE\b)/i,/^(?:USE\b)/i,/^(?:USING\b)/i,/^(?:VALUE(S)?)/i,/^(?:VERTEX\b)/i,/^(?:VIEW\b)/i,/^(?:WHEN\b)/i,/^(?:WHERE\b)/i,/^(?:WHILE\b)/i,/^(?:WITH\b)/i,/^(?:WORK\b)/i,/^(?:(\d*[.])?\d+[eE]\d+)/i,/^(?:(\d*[.])?\d+)/i,/^(?:->)/i,/^(?:#)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:\*)/i,/^(?:\/)/i,/^(?:%)/i,/^(?:!===)/i,/^(?:===)/i,/^(?:!==)/i,/^(?:==)/i,/^(?:>=)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:<>)/i,/^(?:<)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:\()/i,/^(?:\))/i,/^(?:@)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:\])/i,/^(?::-)/i,/^(?:\?-)/i,/^(?:\.)/i,/^(?:,)/i,/^(?:::)/i,/^(?::)/i,/^(?:;)/i,/^(?:\$)/i,/^(?:\?)/i,/^(?:!)/i,/^(?:\^)/i,/^(?:[a-zA-Z_][a-zA-Z_0-9]*)/i,/^(?:$)/i,/^(?:.)/i],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,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234],inclusive:true}}};return lexer}();parser.lexer=lexer;function Parser(){this.yy={}}Parser.prototype=parser;parser.Parser=Parser;return new Parser}();if(typeof require!=="undefined"&&typeof exports!=="undefined"){exports.parser=parser;exports.Parser=parser.Parser;exports.parse=function(){return parser.parse.apply(parser,arguments)};exports.main=function commonjsMain(args){if(!args[1]){console.log("Usage: "+args[0]+" FILE");process.exit(1)}var source=require("fs").readFileSync(require("path").normalize(args[1]),"utf8");return exports.parser.parse(source)};if(typeof module!=="undefined"&&require.main===module){exports.main(process.argv.slice(1))}}alasql.prettyflag=false;alasql.pretty=function(sql,flag){var pf=alasql.prettyflag;alasql.prettyflag=!flag;var s=alasql.parse(sql).toString();alasql.prettyflag=pf;return s};function K(s){if(alasql.prettyflag){return''+s.toUpperCase()+""}else{return s}}function P(s){if(alasql.prettyflag){return''+s+""}else{return s}}function L(s){if(alasql.prettyflag){return''+s+""}else{return s}}function N(s){if(alasql.prettyflag){return''+s+""}else{return s}}function S(s){if(alasql.prettyflag){return''+s+""}else{return s}}function NL(){if(alasql.prettyflag){return"
"}else{return" "}}function ID(){if(alasql.prettyflag){return"     "}else{return""}}var utils=alasql.utils={};function n2u(s){return"(y="+s+",y===y?y:undefined)"}function und(s,r){return"(y="+s+',typeof y=="undefined"?undefined:'+r+")"}function returnTrue(){return true}function returnUndefined(){}var escapeq=utils.escapeq=function(s){return s.replace(/\'/g,"\\'")};var escapeqq=utils.undoubleq=function(s){return s.replace(/(\')/g,"''")};var doubleq=utils.doubleq=function(s){return s.replace(/(\'\')/g,"\\'")};var doubleqq=utils.doubleqq=function(s){return s.replace(/\'/g,"'")};var cutbom=function(s){if(s[0]==String.fromCharCode(65279))s=s.substr(1);return s};var loadFile=utils.loadFile=function(path,asy,success,error){if(typeof exports=="object"||typeof Meteor!="undefined"&&Meteor.isServer){if(typeof Meteor!="undefined"){var fs=Npm.require("fs")}else{var fs=require("fs")}if(typeof path=="undefined"){var buff="";process.stdin.setEncoding("utf8");process.stdin.on("readable",function(){var chunk=process.stdin.read();if(chunk!==null){buff+=chunk.toString()}});process.stdin.on("end",function(){success(cutbom(buff))})}else{if(asy){fs.readFile(path,function(err,data){if(err){throw err}success(cutbom(data.toString()))})}else{var data=fs.readFileSync(path);success(cutbom(data.toString()))}}}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:false},function(fileEntry){fileEntry.file(function(file){var fileReader=new FileReader;fileReader.onloadend=function(e){success(cutbom(this.result))};fileReader.readAsText(file)})})})}else{if(typeof path=="string"){if(path.substr(0,1)=="#"&&typeof document!="undefined"){var data=document.querySelector(path).textContent;success(data)}else{var xhr=new XMLHttpRequest;xhr.onreadystatechange=function(){if(xhr.readyState===XMLHttpRequest.DONE){if(xhr.status===200){if(success)success(cutbom(xhr.responseText))}else{if(error)error(xhr)}}};xhr.open("GET",path,asy);xhr.send()}}else if(path instanceof Event){var files=path.target.files;var reader=new FileReader;var name=files[0].name;reader.onload=function(e){var data=e.target.result;success(cutbom(data))};reader.readAsText(files[0])}}};var loadBinaryFile=utils.loadBinaryFile=function(path,asy,success,error){if(typeof exports=="object"||typeof Meteor!="undefined"&&Meteor.isServer){if(typeof Meteor!="undefined"){var fs=Npm.require("fs")}else{var fs=require("fs")}if(asy){fs.readFile(path,function(err,data){if(err){throw err}var arr=new Array;for(var i=0;i!=data.length;++i)arr[i]=String.fromCharCode(data[i]);success(arr.join(""))})}else{var data=fs.readFileSync(path);var arr=new Array;for(var i=0;i!=data.length;++i)arr[i]=String.fromCharCode(data[i]);success(arr.join(""))}}else{if(typeof path=="string"){var xhr=new XMLHttpRequest;xhr.open("GET",path,asy);xhr.responseType="arraybuffer";xhr.onload=function(){var data=new Uint8Array(xhr.response);var arr=new Array;for(var i=0;i!=data.length;++i)arr[i]=String.fromCharCode(data[i]);success(arr.join(""))};xhr.send()}else if(path instanceof Event){var files=path.target.files;var reader=new FileReader;var name=files[0].name;reader.onload=function(e){var data=e.target.result;success(data)};reader.readAsBinaryString(files[0])}}};var removeFile=utils.removeFile=function(path,cb){if(typeof exports=="object"){var fs=require("fs");fs.remove(path,cb)}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:false},function(fileEntry){fileEntry.remove(cb);if(cb)cb()},function(){if(cb)cb()})})}else{throw new Error("You can remove files only in Node.js and Apache Cordova")}};var deleteFile=utils.deleteFile=function(path,cb){if(typeof exports=="object"){var fs=require("fs");fs.unlink(path,cb)}};var fileExists=utils.fileExists=function(path,cb){if(typeof exports=="object"){var fs=require("fs");fs.exists(path,cb)}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:false},function(fileEntry){cb(true)},function(){cb(false)})})}else{throw new Error("You can use exists() only in Node.js or Apach Cordova")}};var saveFile=utils.saveFile=function(path,data,cb){var res=1;if(typeof path=="undefined"){res=data;if(cb)res=cb(res)}else{if(typeof exports=="object"){var fs=require("fs");var data=fs.writeFileSync(path,data);if(cb)res=cb(res)}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:true},function(fileEntry){fileEntry.createWriter(function(fileWriter){fileWriter.onwriteend=function(){if(cb)res=cb(res)};fileWriter.write(data)})})})}else{if(isIE()==9){var ndata=data.replace(/\r\n/g,"&#A;&#D;");ndata=ndata.replace(/\n/g,"&#D;");ndata=ndata.replace(/\t/g," ");var testlink=window.open("about:blank","_blank");testlink.document.write(ndata);testlink.document.close();testlink.document.execCommand("SaveAs",false,path);testlink.close()}else{var blob=new Blob([data],{type:"text/plain;charset=utf-8"});saveAs(blob,path);if(cb)res=cb(res)}}}return res};function isIE(){var myNav=navigator.userAgent.toLowerCase();return myNav.indexOf("msie")!=-1?parseInt(myNav.split("msie")[1]):false}var hash=utils.hash=function hash(str){var h=0;if(str.length==0)return h;for(var i=0;i=26){i=(i/26|0)-1;addr=String.fromCharCode(65+i%26)+addr;if(i>26){i=(i/26|0)-1;addr=String.fromCharCode(65+i%26)+addr}}return addr};var xlscn=utils.xlscn=function(s){var n=s.charCodeAt(0)-65;if(s.length>1){n=(n+1)*26+s.charCodeAt(1)-65;if(s.length>2){n=(n+1)*26+s.charCodeAt(2)-65}}return n};var domEmptyChildren=utils.domEmptyChildren=function(container){var len=container.childNodes.length;while(len--){container.removeChild(container.lastChild)}};alasql.utils.uncomment=function uncomment(str){str=("__"+str+"__").split("");var quote=false,quoteSign,blockComment=false,lineComment=false;for(var i=0,l=str.length;ialasql.MAXSQLCACHESIZE){db.resetSqlCache()}db.sqlCacheSize++;db.sqlCache[hh]=statement}var res=alasql.res=statement(params,cb,scope);return res}else{alasql.precompile(ast.statements[0],alasql.useid,params);var res=alasql.res=ast.statements[0].execute(databaseid,params,cb,scope);return res}}else{if(cb){alasql.adrun(databaseid,ast,params,cb,scope)}else{return alasql.drun(databaseid,ast,params,cb,scope)}}};alasql.drun=function(databaseid,ast,params,cb,scope){var useid=alasql.useid;if(useid!=databaseid)alasql.use(databaseid);var res=[];for(var i=0,ilen=ast.statements.length;i0){if(selectors&&selectors[0]&&selectors[0].srchid=="PROP"&&selectors[0].args&&selectors[0].args[0]){if(selectors[0].args[0].toUpperCase()=="XML"){stope.mode="XML";selectors.shift()}else if(selectors[0].args[0].toUpperCase()=="HTML"){stope.mode="HTML";selectors.shift()}else if(selectors[0].args[0].toUpperCase()=="JSON"){stope.mode="JSON";selectors.shift()}}if(selectors.length>0&&selectors[0].srchid=="VALUE"){stope.value=true;selectors.shift()}}if(this.from instanceof yy.Column){var dbid=this.from.databaseid||databaseid;fromdata=alasql.databases[dbid].tables[this.from.columnid].data}else if(this.from instanceof yy.FuncValue&&alasql.from[this.from.funcid.toUpperCase()]){var args=this.from.args.map(function(arg){var as=arg.toJavaScript();var fn=new Function("params,alasql","var y;return "+as).bind(this);return fn(params,alasql)});fromdata=alasql.from[this.from.funcid.toUpperCase()].apply(this,args)}else if(typeof this.from=="undefined"){fromdata=alasql.databases[databaseid].objects}else{var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());fromdata=fromfn(params,alasql);if(typeof Mongo=="object"&&typeof Mongo.Collection!="object"&&fromdata instanceof Mongo.Collection){fromdata=fromdata.find().fetch()}}if(typeof selectors!="undefined"&&selectors.length>0){if(false){selectors.forEach(function(selector){if(selector.srchid=="TO"){alasql.vars[selector.args[0]]=[]}})}res=processSelector(selectors,0,fromdata)}else{res=fromdata}if(this.into){var a1,a2;if(typeof this.into.args[0]!="undefined"){a1=new Function("params,alasql","var y;return "+this.into.args[0].toJavaScript())(params,alasql)}if(typeof this.into.args[1]!="undefined"){a2=new Function("params,alasql","var y;return "+this.into.args[1].toJavaScript())(params,alasql)}res=alasql.into[this.into.funcid.toUpperCase()](a1,a2,res,[],cb)}else{if(stope.value&&res.length>0)res=res[0];if(cb)res=cb(res)}return res;function processSelector(selectors,sidx,value){var sel=selectors[sidx];var SECURITY_BREAK=1e5;if(sel.selid){if(sel.selid=="PATH"){var queue=[{node:value,stack:[]}];var visited={};var path=[];var objects=alasql.databases[alasql.useid].objects;while(queue.length>0){var q=queue.shift();var node=q.node;var stack=q.stack;var r=processSelector(sel.args,0,node);if(r.length>0){if(sidx+1+1>selectors.length){return stack}else{var rv=[];if(stack&&stack.length>0){stack.forEach(function(stv){rv=rv.concat(processSelector(selectors,sidx+1,stv))})}return rv}}else{if(typeof visited[node.$id]!="undefined"){continue}else{visited[node.$id]=true;if(node.$out&&node.$out.length>0){node.$out.forEach(function(edgeid){var edge=objects[edgeid];var stack2=stack.concat(edge);stack2.push(objects[edge.$out[0]]);queue.push({node:objects[edge.$out[0]],stack:stack2})})}}}}return[]}if(sel.selid=="NOT"){var nest=processSelector(sel.args,0,value);if(nest.length>0){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="DISTINCT"){if(typeof sel.args=="undefined"||sel.args.length==0){var nest=distinctArray(value)}else{var nest=processSelector(sel.args,0,value)}if(nest.length==0){return[]}else{var res=distinctArray(nest);if(sidx+1+1>selectors.length){return res}else{return processSelector(selectors,sidx+1,res)}}}else if(sel.selid=="AND"){var res=true;sel.args.forEach(function(se){res=res&&processSelector(se,0,value).length>0});if(!res){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="OR"){var res=false;sel.args.forEach(function(se){res=res||processSelector(se,0,value).length>0});if(!res){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="ALL"){var nest=processSelector(sel.args[0],0,value);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return nest}else{return processSelector(selectors,sidx+1,nest)}}}else if(sel.selid=="ANY"){var nest=processSelector(sel.args[0],0,value);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return[nest[0]]}else{return processSelector(selectors,sidx+1,[nest[0]])}}}else if(sel.selid=="UNIONALL"){var nest=[];sel.args.forEach(function(se){nest=nest.concat(processSelector(se,0,value))});if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return nest}else{return processSelector(selectors,sidx+1,nest)}}}else if(sel.selid=="UNION"){var nest=[];sel.args.forEach(function(se){nest=nest.concat(processSelector(se,0,value))});var nest=distinctArray(nest);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return nest}else{return processSelector(selectors,sidx+1,nest)}}}else if(sel.selid=="IF"){var nest=processSelector(sel.args,0,value);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="REPEAT"){var lmin=sel.args[0].value;if(!sel.args[1]){var lmax=lmin}else{var lmax=sel.args[1].value}if(sel.args[2]){var lvar=sel.args[2].variable}else{var lvar}var lsel=sel.sels;var retval=[];if(lmin==0){if(sidx+1+1>selectors.length){retval=[value]}else{if(lvar)alasql.vars[lvar]=0;retval=retval.concat(processSelector(selectors,sidx+1,value))}}if(lmax>0){var nests=[{value:value,lvl:1}];var i=0;while(nests.length>0){var nest=nests[0];nests.shift();if(nest.lvl<=lmax){if(lvar)alasql.vars[lvar]=nest.lvl;var nest1=processSelector(sel.sels,0,nest.value);nest1.forEach(function(n){nests.push({value:n,lvl:nest.lvl+1})});if(nest.lvl>=lmin){if(sidx+1+1>selectors.length){retval=retval.concat(nest1)}else{nest1.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}}}i++;if(i>SECURITY_BREAK){throw new Error("Security brake. Number of iterations = "+i)}}}return retval}else if(sel.selid=="TO"){var oldv=alasql.vars[sel.args[0]];var newv=[];if(typeof oldv!="undefined"){newv=oldv.slice(0)}else{newv=[]}newv.push(value);if(sidx+1+1>selectors.length){return[value]}else{alasql.vars[sel.args[0]]=newv;var r1=processSelector(selectors,sidx+1,value);alasql.vars[sel.args[0]]=oldv;return r1}}else if(sel.selid=="ARRAY"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="SUM"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest.reduce(function(sum,current){return sum+current},0)}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="AVG"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest.reduce(function(sum,current){return sum+current},0)/nest.length}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="COUNT"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest.length}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="FIRST"){var nest=processSelector(sel.args,0,value);if(nest.length>0)var val=nest[0];else return[];if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="LAST"){var nest=processSelector(sel.args,0,value);if(nest.length>0)var val=nest[nest.length-1];else return[];if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="MIN"){var nest=processSelector(sel.args,0,value);if(nest.length==0)return[];var val=nest.reduce(function(min,current){return Math.min(min,current)},Infinity);if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="MAX"){var nest=processSelector(sel.args,0,value);if(nest.length==0)return[];var val=nest.reduce(function(max,current){return Math.max(max,current)},-Infinity);if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="PLUS"){var retval=[];var nests=processSelector(sel.args,0,value).slice();if(sidx+1+1>selectors.length){retval=retval.concat(nests)}else{nests.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}var i=0;while(nests.length>0){var nest=nests.shift();nest=processSelector(sel.args,0,nest);nests=nests.concat(nest);if(sidx+1+1>selectors.length){retval=retval.concat(nest)}else{nest.forEach(function(n){var rn=processSelector(selectors,sidx+1,n);retval=retval.concat(rn)})}i++;if(i>SECURITY_BREAK){throw new Error("Security brake. Number of iterations = "+i)}}return retval}else if(sel.selid=="STAR"){var retval=[];retval=processSelector(selectors,sidx+1,value);var nests=processSelector(sel.args,0,value).slice();if(sidx+1+1>selectors.length){retval=retval.concat(nests)}else{nests.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}var i=0;while(nests.length>0){var nest=nests[0];nests.shift();nest=processSelector(sel.args,0,nest);nests=nests.concat(nest);if(sidx+1+1>selectors.length){}else{nest.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}i++;if(i>SECURITY_BREAK){throw new Error("Security brake. Number of iterations = "+i)}}return retval}else if(sel.selid=="QUESTION"){var retval=[];retval=retval.concat(processSelector(selectors,sidx+1,value));var nest=processSelector(sel.args,0,value);if(sidx+1+1>selectors.length){}else{nest.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}return retval}else if(sel.selid=="WITH"){var nest=processSelector(sel.args,0,value);if(nest.length==0){return[]}else{var r={status:1,values:nest}}}else if(sel.selid=="ROOT"){if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,fromdata)}}else{throw new Error("Wrong selector "+sel.selid)}}else if(sel.srchid){var r=alasql.srch[sel.srchid.toUpperCase()](value,sel.args,stope,params)}else{throw new Error("Selector not found")}if(typeof r=="undefined"){r={status:1,values:[value]}}var res=[];if(r.status==1){var arr=r.values;if(sidx+1+1>selectors.length){res=arr}else{for(var i=0;i0){return{status:1,values:arr}}else{return{status:-1,values:[]}}}else{if(typeof val!="object"||val===null||typeof args!="object"||typeof val[args[0]]=="undefined"){return{status:-1,values:[]}}else{return{status:1,values:[val[args[0]]]}}}};alasql.srch.APROP=function(val,args,stope){if(typeof val!="object"||val===null||typeof args!="object"||typeof val[args[0]]=="undefined"){return{status:1,values:[undefined]}}else{return{status:1,values:[val[args[0]]]}}};alasql.srch.ORDERBY=function(val,args,stope){var res=val.sort(compileSearchOrder(args));return{status:1,values:res}};alasql.srch.EQ=function(val,args,stope,params){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);if(val==exprfn(val,alasql,params)){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.LIKE=function(val,args,stope,params){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);if(val.toUpperCase().match(new RegExp("^"+exprfn(val,alasql,params).toUpperCase().replace(/%/g,".*")+"$"),"g")){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.ATTR=function(val,args,stope){if(stope.mode=="XML"){if(typeof args=="undefined"){return{status:1,values:[val.attributes]}}else{if(typeof val=="object"&&typeof val.attributes=="object"&&typeof val.attributes[args[0]]!="undefined"){return{status:1,values:[val.attributes[args[0]]]}}else{return{status:-1,values:[]}}}}else{throw new Error("ATTR is not using in usual mode")}};alasql.srch.CONTENT=function(val,args,stope){if(stope.mode=="XML"){return{status:1,values:[val.content]}}else{throw new Error("ATTR is not using in usual mode")}};alasql.srch.SHARP=function(val,args,stope){var obj=alasql.databases[alasql.useid].objects[args[0]];if(typeof val!="undefined"&&val===obj){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.PARENT=function(val,args,stope){console.log("PARENT");return{status:-1,values:[]}};alasql.srch.CHILD=function(val,args,stope){if(typeof val=="object"){if(val instanceof Array){return{status:1,values:val}}else{if(stope.mode=="XML"){return{status:1,values:Object.keys(val.children).map(function(key){return val.children[key]})}}else{return{status:1,values:Object.keys(val).map(function(key){return val[key]})}}}}else{return{status:1,values:[]}}};alasql.srch.KEYS=function(val,args){if(typeof val=="object"&&val!==null){return{status:1,values:Object.keys(val)}}else{return{status:1,values:[]}}};alasql.srch.WHERE=function(val,args){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql","return "+exprs);if(exprfn(val,alasql)){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.NAME=function(val,args){if(val.name==args[0]){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.CLASS=function(val,args){if(val.$class==args){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.VERTEX=function(val,args){if(val.$node=="VERTEX"){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.INSTANCEOF=function(val,args){if(val instanceof alasql.fn[args[0]]){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.EDGE=function(val,args){if(val.$node=="EDGE"){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.EX=function(val,args,stope,params){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);return{status:1,values:[exprfn(val,alasql,params)]}};alasql.srch.RETURN=function(val,args,stope,params){var res={};if(args&&args.length>0){args.forEach(function(arg){var exprs=arg.toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);if(typeof arg.as=="undefined")arg.as=arg.toString();res[arg.as]=exprfn(val,alasql,params)})}return{status:1,values:[res]}};alasql.srch.REF=function(val,args){return{status:1,values:[alasql.databases[alasql.useid].objects[val]]}};alasql.srch.OUT=function(val,args){if(val.$out&&val.$out.length>0){var res=val.$out.map(function(v){return alasql.databases[alasql.useid].objects[v]});return{status:1,values:res}}else{return{status:-1,values:[]}}};alasql.srch.IN=function(val,args){if(val.$in&&val.$in.length>0){var res=val.$in.map(function(v){return alasql.databases[alasql.useid].objects[v]});return{status:1,values:res}}else{return{status:-1,values:[]}}};alasql.srch.AS=function(val,args){alasql.vars[args[0]]=val;return{status:1,values:[val]}};alasql.srch.AT=function(val,args){var v=alasql.vars[args[0]];return{status:1,values:[v]}};alasql.srch.CLONEDEEP=function(val,args){var z=cloneDeep(val);return{status:1,values:[z]}};alasql.srch.SET=function(val,args,stope,params){var s=args.map(function(st){if(st.method=="@"){return"alasql.vars['"+st.variable+"']="+st.expression.toJavaScript("x","")}else if(st.method=="$"){return"params['"+st.variable+"']="+st.expression.toJavaScript("x","")}else{return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}}).join(";");var setfn=new Function("x,params,alasql",s);setfn(val,params,alasql);return{status:1,values:[val]}};alasql.srch.ROW=function(val,args,stope,params){var s="var y;return [";s+=args.map(function(arg){return arg.toJavaScript("x","")}).join(",");s+="]";var setfn=new Function("x,params,alasql",s);var rv=setfn(val,params,alasql);return{status:1,values:[rv]}};alasql.srch.D3=function(val,args,stope,params){if(val.$node=="VERTEX"){}else if(val.$node=="EDGE"){val.source=val.$in[0];val.target=val.$out[0]}return{status:1,values:[val]}};compileSearchOrder=function(order){if(order){if(order&&order.length==1&&order[0].expression&&typeof order[0].expression=="function"){var func=order[0].expression;return function(a,b){var ra=func(a),rb=func(b);if(ra>rb)return 1;if(ra==rb)return 0;return-1}}var s="";var sk="";order.forEach(function(ord,idx){var dg="";if(ord.expression instanceof yy.NumValue){ord.expression=self.columns[ord.expression.value-1]}if(ord.expression instanceof yy.Column){var columnid=ord.expression.columnid;if(alasql.options.valueof)dg=".valueOf()";if(ord.nocase)dg+=".toUpperCase()";if(columnid=="_"){s+="if(a"+dg+(ord.direction=="ASC"?">":"<")+"b"+dg+")return 1;";s+="if(a"+dg+"==b"+dg+"){"}else{s+="if((a['"+columnid+"']||'')"+dg+(ord.direction=="ASC"?">":"<")+"(b['"+columnid+"']||'')"+dg+")return 1;";s+="if((a['"+columnid+"']||'')"+dg+"==(b['"+columnid+"']||'')"+dg+"){"}}else{dg=".valueOf()";if(ord.nocase)dg+=".toUpperCase()";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+(ord.direction=="ASC"?">(":"<(")+ord.toJavaScript("b","")+"||'')"+dg+")return 1;";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+"==("+ord.toJavaScript("b","")+"||'')"+dg+"){"}sk+="}"});s+="return 0;";s+=sk+"return -1";return new Function("a,b",s)}};function queryfn(query,oldscope,cb,A,B){var ms;query.sourceslen=query.sources.length;var slen=query.sourceslen;query.query=query;query.A=A;query.B=B;query.cb=cb;query.oldscope=oldscope;if(query.queriesfn){query.sourceslen+=query.queriesfn.length;slen+=query.queriesfn.length;query.queriesdata=[];query.queriesfn.forEach(function(q,idx){q.query.params=query.params;if(false){queryfn(q.query,query.oldscope,queryfn2,-idx-1,query)}else{queryfn2([],-idx-1,query)}})}var scope;if(!oldscope)scope={};else scope=cloneDeep(oldscope);query.scope=scope;var result;query.sources.forEach(function(source,idx){source.query=query;var rs=source.datafn(query,query.params,queryfn2,idx,alasql);if(typeof rs!=undefined){if((query.intofn||query.intoallfn)&&rs instanceof Array)rs=rs.length;result=rs}source.queriesdata=query.queriesdata});if(slen==0)result=queryfn3(query);return result}function queryfn2(data,idx,query){if(idx>=0){var source=query.sources[idx];source.data=data;if(typeof source.data=="function"){source.getfn=source.data;source.dontcache=source.getfn.dontcache;if(source.joinmode=="OUTER"||source.joinmode=="RIGHT"||source.joinmode=="ANTI"){source.dontcache=false}source.data={}}}else{query.queriesdata[-idx-1]=flatArray(data)}query.sourceslen--;if(query.sourceslen>0)return;return queryfn3(query)}function queryfn3(query){var scope=query.scope;preIndex(query);query.data=[];query.xgroups={};query.groups=[];var h=0;doJoin(query,scope,h);if(query.groupfn){query.data=[];if(query.groups.length==0){var g={};if(query.selectGroup.length>0){query.selectGroup.forEach(function(sg){if(sg.aggregatorid=="COUNT"||sg.aggregatorid=="SUM"){g[sg.nick]=0}else{g[sg.nick]=undefined}})}query.groups=[g]}for(var i=0,ilen=query.groups.length;i0){var removeKeys=query.removeKeys;var jlen=removeKeys.length;if(jlen>0){for(var i=0,ilen=query.data.length;i0){query.columns=query.columns.filter(function(column){var found=false;removeKeys.forEach(function(key){if(column.columnid==key)found=true});return!found})}}if(typeof query.removeLikeKeys!="undefined"&&query.removeLikeKeys.length>0){var removeLikeKeys=query.removeLikeKeys;for(var i=0,ilen=query.data.length;i0){query.columns=query.columns.filter(function(column){var found=false;removeLikeKeys.forEach(function(key){if(column.columnid.match(key))found=true});return!found})}}if(query.intoallfn){var res=query.intoallfn(query.columns,query.cb,query.params,query.alasql);return res}else if(query.intofn){for(var i=0,ilen=query.data.length;i0&&source.optimization=="ix"&&source.onleftfn&&source.onrightfn){if(source.databaseid&&alasql.databases[source.databaseid].tables[source.tableid]){if(!alasql.databases[source.databaseid].tables[source.tableid].indices)query.database.tables[source.tableid].indices={};var ixx=alasql.databases[source.databaseid].tables[source.tableid].indices[hash(source.onrightfns+"`"+source.srcwherefns)];if(!alasql.databases[source.databaseid].tables[source.tableid].dirty&&ixx){source.ix=ixx}}if(!source.ix){source.ix={};var scope={};var i=0;var ilen=source.data.length;var dataw;while((dataw=source.data[i])||source.getfn&&(dataw=source.getfn(i))||i=query.sources.length){if(query.wherefn(scope,query.params,alasql)){if(query.groupfn){query.groupfn(scope,query.params,alasql)}else{query.data.push(query.selectfn(scope,query.params,alasql))}}}else if(query.sources[h].applyselect){var source=query.sources[h];source.applyselect(query.params,function(data){if(data.length>0){for(var i=0;i0){s+=NL()+ID()+K("GROUP BY")+" "+this.group.map(function(grp){return grp.toString()}).join(", ")}if(this.having)s+=NL()+ID()+K("HAVING")+" "+this.having.toString();if(this.order&&this.order.length>0){s+=NL()+ID()+K("ORDER BY")+" "+this.order.map(function(ord){return ord.toString()}).join(", ")}if(this.limit)s+=NL()+ID()+K("LIMIT")+" "+this.limit.value;if(this.offset)s+=NL()+ID()+K("OFFSET")+" "+this.offset.value;if(this.union)s+=NL()+K("UNION")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.union.toString();if(this.unionall)s+=NL()+K("UNION ALL")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.unionall.toString();if(this.except)s+=NL()+K("EXCEPT")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.except.toString();if(this.intersect)s+=NL()+K("INTERSECT")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.intersect.toString();return s};yy.Select.prototype.toJavaScript=function(context,tableid,defcols){var s="alasql.utils.flatArray(this.queriesfn["+(this.queriesidx-1)+"](this.params,null,"+context+"))[0]";return s};yy.Select.prototype.compile=function(databaseid){var db=alasql.databases[databaseid];var query=new Query;query.removeKeys=[];query.explain=this.explain;query.explaination=[];query.explid=1;query.modifier=this.modifier;query.database=db;this.compileWhereExists(query);this.compileQueries(query);query.defcols=this.compileDefCols(query,databaseid);query.fromfn=this.compileFrom(query);if(this.joins)this.compileJoins(query);query.rownums=[];this.compileSelectGroup0(query);if(this.group||query.selectGroup.length>0){query.selectgfns=this.compileSelectGroup1(query)}else{query.selectfns=this.compileSelect1(query)}this.compileRemoveColumns(query);if(this.where)this.compileWhereJoins(query);query.wherefn=this.compileWhere(query);if(this.group||query.selectGroup.length>0)query.groupfn=this.compileGroup(query);if(this.having)query.havingfn=this.compileHaving(query);if(this.group||query.selectGroup.length>0){query.selectgfn=this.compileSelectGroup2(query)}else{query.selectfn=this.compileSelect2(query)}query.distinct=this.distinct;if(this.order)query.orderfn=this.compileOrder(query);if(this.top){query.limit=this.top.value}else if(this.limit){query.limit=this.limit.value;if(this.offset){query.offset=this.offset.value}}query.percent=this.percent;query.corresponding=this.corresponding;if(this.union){query.unionfn=this.union.compile(databaseid);if(this.union.order){query.orderfn=this.union.compileOrder(query)}else{query.orderfn=null}}else if(this.unionall){query.unionallfn=this.unionall.compile(databaseid);if(this.unionall.order){query.orderfn=this.unionall.compileOrder(query)}else{query.orderfn=null}}else if(this.except){query.exceptfn=this.except.compile(databaseid);if(this.except.order){query.orderfn=this.except.compileOrder(query)}else{query.orderfn=null}}else if(this.intersect){query.intersectfn=this.intersect.compile(databaseid);if(this.intersect.order){query.intersectfn=this.intersect.compileOrder(query)}else{query.orderfn=null}}if(this.into){if(this.into instanceof yy.Table){if(alasql.options.autocommit&&alasql.databases[this.into.databaseid||databaseid].engineid){query.intoallfns='return alasql.engines["'+alasql.databases[this.into.databaseid||databaseid].engineid+'"]'+'.intoTable("'+(this.into.databaseid||databaseid)+'","'+this.into.tableid+'",this.data, columns, cb);'}else{query.intofns="alasql.databases['"+(this.into.databaseid||databaseid)+"'].tables"+"['"+this.into.tableid+"'].data.push(r);"}}else if(this.into instanceof yy.VarValue){query.intoallfns='alasql.vars["'+this.into.variable+'"]=this.data;res=this.data.length;if(cb)res=cb(res);return res;'}else if(this.into instanceof yy.FuncValue){var qs="return alasql.into['"+this.into.funcid.toUpperCase()+"'](";if(this.into.args&&this.into.args.length>0){qs+=this.into.args[0].toJavaScript()+",";if(this.into.args.length>1){qs+=this.into.args[1].toJavaScript()+","}else{qs+="undefined,"}}else{qs+="undefined, undefined,"}query.intoallfns=qs+"this.data,columns,cb)"}else if(this.into instanceof yy.ParamValue){query.intofns="params['"+this.into.param+"'].push(r)"}if(query.intofns){query.intofn=new Function("r,i,params,alasql","var y;"+query.intofns)}else if(query.intoallfns){query.intoallfn=new Function("columns,cb,params,alasql","var y;"+query.intoallfns)}}var statement=function(params,cb,oldscope){query.params=params;var res1=queryfn(query,oldscope,function(res){if(query.rownums.length>0){for(var i=0,ilen=res.length;i0){var allcol={};for(var i=0;i0){var key;if(columns&&columns.length>0)key=columns[0].columnid;else key=Object.keys(res[0])[0];res=res[0][key]}else{res=undefined}}if(modifier=="ROW"){if(res.length>0){var key;var a=[];for(var key in res[0]){a.push(res[0][key])}res=a}else{res=undefined}}if(modifier=="COLUMN"){var ar=[];if(res.length>0){var key;if(columns&&columns.length>0)key=columns[0].columnid;else key=Object.keys(res[0])[0];for(var i=0,ilen=res.length;i0){key=columns[0].columnid;val=columns[1].columnid}else{var okeys=Object.keys(res[0]);key=okeys[0];val=okeys[1]}for(var i=0,ilen=res.length;i0)key=columns[0].columnid;else key=Object.keys(res[0])[0];var s="";for(var i=0,ilen=res.length;i0){if(tq.args[0]){s+=tq.args[0].toJavaScript("query.oldscope")+","}else{s+="null,"}if(tq.args[1]){s+=tq.args[1].toJavaScript("query.oldscope")+","}else{s+="null,"}}else{s+="null,null,"}s+="cb,idx,query";s+=");/*if(cb)res=cb(res,idx,query);*/return res";source.datafn=new Function("query, params, cb, idx, alasql",s)}else if(tq instanceof yy.FromData){source.datafn=function(query,params,cb,idx,alasql){var res=tq.data;if(cb)res=cb(res,idx,query);return res}}else{throw new Error("Wrong table at FROM")}query.sources.push(source)});query.defaultTableid=query.sources[0].alias};alasql.prepareFromData=function(data,array){var res=data;if(typeof data=="string"){res=data.split(/\r?\n/);if(array){for(var i=0,ilen=res.length;i0){if(jn.args[0]){s+=jn.args[0].toJavaScript("query.oldscope")+","}else{s+="null,"}if(jn.args[1]){s+=jn.args[1].toJavaScript("query.oldscope")+","}else{s+="null,"}}else{s+="null,null,"}s+="cb,idx,query";s+=");/*if(cb)res=cb(res,idx,query);*/return res";source.datafn=new Function("query, params, cb, idx, alasql",s);query.aliases[source.alias]={type:"funcvalue"}}var alias=source.alias;if(jn.natural){if(jn.using||jn.on){throw new Error("NATURAL JOIN cannot have USING or ON clauses")}else{if(query.sources.length>0){var prevSource=query.sources[query.sources.length-1];var prevTable=alasql.databases[prevSource.databaseid].tables[prevSource.tableid];var table=alasql.databases[source.databaseid].tables[source.tableid];if(prevTable&&table){var c1=prevTable.columns.map(function(col){return col.columnid});var c2=table.columns.map(function(col){return col.columnid});jn.using=arrayIntersect(c1,c2).map(function(colid){return{columnid:colid}})}else{throw new Error("In this version of Alasql NATURAL JOIN "+"works for tables with predefined columns only")}}}}if(jn.using){var prevSource=query.sources[query.sources.length-1];source.onleftfns=jn.using.map(function(col){return"p['"+(prevSource.alias||prevSource.tableid)+"']['"+col.columnid+"']"}).join('+"`"+');source.onleftfn=new Function("p,params,alasql","var y;return "+source.onleftfns);source.onrightfns=jn.using.map(function(col){return"p['"+(source.alias||source.tableid)+"']['"+col.columnid+"']"}).join('+"`"+');source.onrightfn=new Function("p,params,alasql","var y;return "+source.onrightfns);source.optimization="ix"}else if(jn.on){if(jn.on instanceof yy.Op&&jn.on.op=="="&&!jn.on.allsome){source.optimization="ix";var lefts="";var rights="";var middles="";var middlef=false;var ls=jn.on.left.toJavaScript("p",query.defaultTableid,query.defcols);var rs=jn.on.right.toJavaScript("p",query.defaultTableid,query.defcols);if(ls.indexOf("p['"+alias+"']")>-1&&!(rs.indexOf("p['"+alias+"']")>-1)){if((ls.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){rights=ls}else{middlef=true}}else if(!(ls.indexOf("p['"+alias+"']")>-1)&&rs.indexOf("p['"+alias+"']")>-1){if((rs.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){lefts=ls}else{middlef=true}}else{middlef=true}if(rs.indexOf("p['"+alias+"']")>-1&&!(ls.indexOf("p['"+alias+"']")>-1)){if((rs.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){rights=rs}else{middlef=true}}else if(!(rs.indexOf("p['"+alias+"']")>-1)&&ls.indexOf("p['"+alias+"']")>-1){if((ls.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){lefts=rs}else{middlef=true}}else{middlef=true}if(middlef){rights="";lefts="";middles=jn.on.toJavaScript("p",query.defaultTableid,query.defcols);source.optimization="no"}source.onleftfns=lefts;source.onrightfns=rights;source.onmiddlefns=middles||"true";source.onleftfn=new Function("p,params,alasql","var y;return "+source.onleftfns);source.onrightfn=new Function("p,params,alasql","var y;return "+source.onrightfns);source.onmiddlefn=new Function("p,params,alasql","var y;return "+source.onmiddlefns)}else{source.optimization="no";source.onmiddlefns=jn.on.toJavaScript("p",query.defaultTableid,query.defcols);source.onmiddlefn=new Function("p,params,alasql","var y;return "+jn.on.toJavaScript("p",query.defaultTableid,query.defcols))}}query.sources.push(source)}})};yy.Select.prototype.compileWhere=function(query){if(this.where){if(typeof this.where=="function"){return this.where}else{s=this.where.toJavaScript("p",query.defaultTableid,query.defcols);query.wherefns=s;return new Function("p,params,alasql","var y;return "+s)}}else return function(){return true}};yy.Select.prototype.compileWhereJoins=function(query){return;optimizeWhereJoin(query,this.where.expression);query.sources.forEach(function(source){if(source.srcwherefns){source.srcwherefn=new Function("p,params,alasql","var y;return "+source.srcwherefns)}if(source.wxleftfns){source.wxleftfn=new Function("p,params,alasql","var y;return "+source.wxleftfns)}if(source.wxrightfns){source.wxrightfn=new Function("p,params,alasql","var y;return "+source.wxrightfns)}})};function optimizeWhereJoin(query,ast){if(!ast)return false;if(!(ast instanceof yy.Op))return;if(ast.op!="="&&ast.op!="AND")return;if(ast.allsome)return;var s=ast.toJavaScript("p",query.defaultTableid,query.defcols);var fsrc=[];query.sources.forEach(function(source,idx){if(source.tableid){if(s.indexOf("p['"+source.alias+"']")>-1)fsrc.push(source)}});if(fsrc.length==0){return}else if(fsrc.length==1){if(!(s.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+fsrc[0].alias+"']"})){return}var src=fsrc[0];src.srcwherefns=src.srcwherefns?src.srcwherefns+"&&"+s:s;if(ast instanceof yy.Op&&(ast.op=="="&&!ast.allsome)){if(ast.left instanceof yy.Column){var ls=ast.left.toJavaScript("p",query.defaultTableid,query.defcols);var rs=ast.right.toJavaScript("p",query.defaultTableid,query.defcols);if(rs.indexOf("p['"+fsrc[0].alias+"']")==-1){fsrc[0].wxleftfns=ls;fsrc[0].wxrightfns=rs}}if(ast.right instanceof yy.Column){var ls=ast.left.toJavaScript("p",query.defaultTableid,query.defcols);var rs=ast.right.toJavaScript("p",query.defaultTableid,query.defcols);if(ls.indexOf("p['"+fsrc[0].alias+"']")==-1){fsrc[0].wxleftfns=rs;fsrc[0].wxrightfns=ls}}}ast.reduced=true;return}else{if(ast.op="AND"){optimizeWhereJoin(query,ast.left);optimizeWhereJoin(query,ast.right)}}}yy.Select.prototype.compileGroup=function(query){var self=this;if(query.sources.length>0){var tableid=query.sources[0].alias}else{var tableid=""}var defcols=query.defcols;var allgroup=[[]];if(this.group){allgroup=decartes(this.group,query)}var allgroups=[];allgroup.forEach(function(a){allgroups=arrayUnion(allgroups,a)});query.allgroups=allgroups;if(false){allgroups.forEach(function(col2){if(query.selectColumns[colid]){}else{var tmpid="default";if(query.sources.length>0)tmpid=query.sources[0].alias;if(Object.keys(query.selectColumns).length!=0)query.removeKeys.push(colid);query.selectfns+="r['"+escapeq(colid)+"']="+new yy.Column({columnid:colid}).toJavaScript("p",tmpid)+";"}})}var s="";allgroup.forEach(function(agroup){s+="var acc,g=this.xgroups[";var rg=agroup.map(function(col2){var columnid=col2.split(" ")[0];var coljs=col2.split(" ")[1];if(columnid=="")return"1";else return coljs});if(rg.length==0)rg=["''"];s+=rg.join('+"`"+');s+="];if(!g) {this.groups.push((g=this.xgroups[";s+=rg.join('+"`"+');s+="] = {";s+=agroup.map(function(col2){var columnid=col2.split(" ")[0];var coljs=col2.split(" ")[1];if(columnid=="")return"";else return"'"+columnid+"':"+coljs+","}).join("");var neggroup=arrayDiff(allgroups,agroup);s+=neggroup.map(function(col2){var columnid=col2.split(" ")[0];var coljs=col2.split(" ")[1];return"'"+columnid+"':null,"}).join("");var aft="";s+=query.selectGroup.map(function(col,idx){var colexp=col.expression.toJavaScript("p",tableid,defcols);var colas=col.nick;if(col instanceof yy.AggrValue){if(col.distinct){aft+=",g['$$_VALUES_"+colas+"']={},g['$$_VALUES_"+colas+"']["+colexp+"]=true"}if(col.aggregatorid=="SUM"){return"'"+colas+"':("+colexp+")||0,"}else if(col.aggregatorid=="MIN"||col.aggregatorid=="MAX"||col.aggregatorid=="FIRST"||col.aggregatorid=="LAST"){return"'"+colas+"':"+colexp+","}else if(col.aggregatorid=="ARRAY"){return"'"+colas+"':["+colexp+"],"}else if(col.aggregatorid=="COUNT"){if(col.expression.columnid=="*"){return"'"+colas+"':1,"}else{return"'"+colas+"':(typeof "+colexp+' != "undefined")?1:0,'}}else if(col.aggregatorid=="AVG"){query.removeKeys.push("_SUM_"+colas);query.removeKeys.push("_COUNT_"+colas);return"'"+colas+"':"+colexp+",'_SUM_"+colas+"':("+colexp+")||0,'_COUNT_"+colas+"':(typeof "+colexp+' != "undefined")?1:0,'}else if(col.aggregatorid=="AGGR"){aft+=",g['"+colas+"']="+col.expression.toJavaScript("g",-1);return""}else if(col.aggregatorid=="REDUCE"){query.removeKeys.push("_REDUCE_"+colas);return"'"+colas+"':alasql.aggr['"+col.funcid+"']("+colexp+",undefined,(acc={})),"+"'__REDUCE__"+colas+"':acc,"}return""}else return""}).join("");s+="}"+aft+",g));} else {";s+=query.selectGroup.map(function(col,idx){var colas=col.nick;var colexp=col.expression.toJavaScript("p",tableid,defcols);if(col instanceof yy.AggrValue){if(col.distinct){var pre="if(typeof "+colexp+'!="undefined" && (!g[\'$$_VALUES_'+colas+"']["+colexp+"])) {";var post="g['$$_VALUES_"+colas+"']["+colexp+"]=true;}"}else{var pre="",post=""}if(col.aggregatorid=="SUM"){return pre+"g['"+colas+"']+=("+colexp+"||0);"+post}else if(col.aggregatorid=="COUNT"){if(col.expression.columnid=="*")return pre+"g['"+colas+"']++;"+post;else{return pre+"if(typeof "+colexp+'!="undefined") g[\''+colas+"']++;"+post}}else if(col.aggregatorid=="ARRAY"){return pre+"g['"+colas+"'].push("+colexp+");"+post}else if(col.aggregatorid=="MIN"){return pre+"g['"+colas+"']=Math.min(g['"+colas+"'],"+colexp+");"+post}else if(col.aggregatorid=="MAX"){return pre+"g['"+colas+"']=Math.max(g['"+colas+"'],"+colexp+");"+post}else if(col.aggregatorid=="FIRST"){return""}else if(col.aggregatorid=="LAST"){return pre+"g['"+colas+"']="+colexp+";"+post}else if(col.aggregatorid=="AVG"){return pre+"g['_SUM_"+colas+"']+=(y="+colexp+")||0;"+"g['_COUNT_"+colas+'\']+=(typeof y!="undefined")?1:0;'+"g['"+colas+"']=g['_SUM_"+colas+"']/g['_COUNT_"+colas+"'];"+post}else if(col.aggregatorid=="AGGR"){return pre+"g['"+colas+"']="+col.expression.toJavaScript("g",-1)+";"+post}else if(col.aggregatorid=="REDUCE"){return pre+"g['"+colas+"']=alasql.aggr."+col.funcid+"("+colexp+",g['"+colas+"'],g['__REDUCE__"+colas+"']);"+post}return""}else return""}).join("");s+="}"});return new Function("p,params,alasql",s)};function compileSelectStar(query,alias){var s="",sp="",ss=[];query.ixsources={};query.sources.forEach(function(source){query.ixsources[source.alias]=source});var columns;if(query.ixsources[alias]){var columns=query.ixsources[alias].columns}if(columns&&columns.length>0){columns.forEach(function(tcol){ss.push("'"+tcol.columnid+"':p['"+alias+"']['"+tcol.columnid+"']");query.selectColumns[escapeq(tcol.columnid)]=true;var coldef={columnid:tcol.columnid,dbtypeid:tcol.dbtypeid,dbsize:tcol.dbsize,dbprecision:tcol.dbprecision,dbenum:tcol.dbenum};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef})}else{sp+='var w=p["'+alias+'"];for(var k in w){r[k]=w[k]};';query.dirtyColumns=true}return{s:ss.join(","),sp:sp}}yy.Select.prototype.compileSelect1=function(query){var self=this;query.columns=[];query.xcolumns={};query.selectColumns={};query.dirtyColumns=false;var s="var r={";var sp="";var ss=[];this.columns.forEach(function(col){if(col instanceof yy.Column){if(col.columnid=="*"){if(col.func){sp+="r=params['"+col.param+"'](p['"+query.sources[0].alias+"'],p,params,alasql);"}else if(col.tableid){var ret=compileSelectStar(query,col.tableid);if(ret.s)ss=ss.concat(ret.s);sp+=ret.sp}else{for(var alias in query.aliases){var ret=compileSelectStar(query,alias);if(ret.s)ss=ss.concat(ret.s);sp+=ret.sp}}}else{var tbid=col.tableid;var dbid=col.databaseid||query.sources[0].databaseid||query.database.databaseid;if(!tbid)tbid=query.defcols[col.columnid];if(!tbid)tbid=query.defaultTableid;if(col.columnid!="_"){ss.push("'"+escapeq(col.as||col.columnid)+"':p['"+tbid+"']['"+col.columnid+"']") +}else{ss.push("'"+escapeq(col.as||col.columnid)+"':p['"+tbid+"']")}query.selectColumns[escapeq(col.as||col.columnid)]=true;if(query.aliases[tbid]&&query.aliases[tbid].type=="table"){if(!alasql.databases[dbid].tables[query.aliases[tbid].tableid]){throw new Error("Table '"+tbid+"' does not exists in database")}var columns=alasql.databases[dbid].tables[query.aliases[tbid].tableid].columns;var xcolumns=alasql.databases[dbid].tables[query.aliases[tbid].tableid].xcolumns;if(xcolumns&&columns.length>0){var tcol=xcolumns[col.columnid];var coldef={columnid:col.as||col.columnid,dbtypeid:tcol.dbtypeid,dbsize:tcol.dbsize,dbpecision:tcol.dbprecision,dbenum:tcol.dbenum};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}else{var coldef={columnid:col.as||col.columnid};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef;query.dirtyColumns=true}}else{var coldef={columnid:col.as||col.columnid};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}}}else if(col instanceof yy.AggrValue){if(!self.group){self.group=[""]}if(!col.as)col.as=escapeq(col.toString());if(col.aggregatorid=="SUM"||col.aggregatorid=="MAX"||col.aggregatorid=="MIN"||col.aggregatorid=="FIRST"||col.aggregatorid=="LAST"||col.aggregatorid=="AVG"||col.aggregatorid=="ARRAY"||col.aggregatorid=="REDUCE"){ss.push("'"+escapeq(col.as)+"':"+n2u(col.expression.toJavaScript("p",query.defaultTableid,query.defcols)))}else if(col.aggregatorid=="COUNT"){ss.push("'"+escapeq(col.as)+"':1")}query.selectColumns[col.aggregatorid+"("+escapeq(col.expression.toString())+")"]=thtd;var coldef={columnid:col.as||col.columnid||col.toString()};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}else{ss.push("'"+escapeq(col.as||col.columnid||col.toString())+"':"+n2u(col.toJavaScript("p",query.defaultTableid,query.defcols)));query.selectColumns[escapeq(col.as||col.columnid||col.toString())]=true;var coldef={columnid:col.as||col.columnid||col.toString()};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}});s+=ss.join(",")+"};"+sp;return s};yy.Select.prototype.compileSelect2=function(query){var s=query.selectfns;return new Function("p,params,alasql","var y;"+s+"return r")};yy.Select.prototype.compileSelectGroup0=function(query){var self=this;self.columns.forEach(function(col,idx){if(col instanceof yy.Column&&col.columnid=="*"){}else{var colas;if(col instanceof yy.Column){colas=escapeq(col.columnid)}else{colas=escapeq(col.toString())}for(var i=0;irb)return 1;if(ra==rb)return 0;return-1}}var s="";var sk="";this.order.forEach(function(ord,idx){var dg="";if(ord.expression instanceof yy.NumValue){ord.expression=self.columns[ord.expression.value-1];ord.expression=new yy.Column({columnid:ord.expression.nick})}if(ord.expression instanceof yy.Column){var columnid=ord.expression.columnid;if(query.xcolumns[columnid]){var dbtypeid=query.xcolumns[columnid].dbtypeid;if(dbtypeid=="DATE"||dbtypeid=="DATETIME")dg=".valueOf()"}else{if(alasql.options.valueof)dg=".valueOf()"}if(ord.nocase)dg+=".toUpperCase()";s+="if((a['"+columnid+"']||'')"+dg+(ord.direction=="ASC"?">":"<")+"(b['"+columnid+"']||'')"+dg+")return 1;";s+="if((a['"+columnid+"']||'')"+dg+"==(b['"+columnid+"']||'')"+dg+"){"}else{dg=".valueOf()";if(ord.nocase)dg+=".toUpperCase()";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+(ord.direction=="ASC"?">(":"<(")+ord.toJavaScript("b","")+"||'')"+dg+")return 1;";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+"==("+ord.toJavaScript("b","")+"||'')"+dg+"){"}sk+="}"});s+="return 0;";s+=sk+"return -1";query.orderfns=s;return new Function("a,b","var y;"+s)}};var rollup=function(a,query){var rr=[];var mask=0;var glen=a.length;for(var g=0;g"||this.op=="!"){var s=this.left.toString()+this.op;if(typeof this.right!="string"&&typeof this.right!="number")s+="(";s+=this.right.toString();if(typeof this.right!="string"&&typeof this.right!="number")s+=")";return s}return this.left.toString()+" "+P(this.op)+" "+(this.allsome?this.allsome+" ":"")+this.right.toString()};yy.Op.prototype.findAggregator=function(query){if(this.left&&this.left.findAggregator)this.left.findAggregator(query);if(this.right&&this.right.findAggregator&&!this.allsome){this.right.findAggregator(query)}};yy.Op.prototype.toType=function(tableid){if(["-","*","/","%","^"].indexOf(this.op)>-1)return"number";if(this.op=="+"){if(this.left.toType(tableid)=="string"||this.right.toType(tableid)=="string")return"string";if(this.left.toType(tableid)=="number"||this.right.toType(tableid)=="number")return"number"}if(["AND","OR","NOT","=","==","===","!=","!==","!===",">",">=","<","<=","IN","NOT IN","LIKE","NOT LIKE"].indexOf(this.op)>-1)return"boolean";if(this.op=="BETWEEN"||this.op=="NOT BETWEEN"||this.op=="IS NULL"||this.op=="IS NOT NULL")return"boolean";if(this.allsome)return"boolean";if(!this.op)return this.left.toType();return"unknown"};yy.Op.prototype.toJavaScript=function(context,tableid,defcols){var op=this.op;if(this.op=="=")op="===";else if(this.op=="<>")op="!=";else if(this.op=="OR")op="||";if(this.op=="->"){if(typeof this.right=="string"){return this.left.toJavaScript(context,tableid,defcols)+'["'+this.right+'"]'}else if(typeof this.right=="number"){return this.left.toJavaScript(context,tableid,defcols)+"["+this.right+"]"}else if(this.right instanceof yy.FuncValue){ss=[];if(!this.right.args||this.right.args.length==0){}else{var ss=this.right.args.map(function(arg){return arg.toJavaScript(context,tableid,defcols)})}return this.left.toJavaScript(context,tableid,defcols)+"['"+this.right.funcid+"']("+ss.join(",")+")"}else{return this.left.toJavaScript(context,tableid,defcols)+"["+this.right.toJavaScript(context,tableid,defcols)+"]"}}if(this.op=="!"){if(typeof this.right=="string"){return"alasql.databases[alasql.useid].objects["+this.left.toJavaScript(context,tableid,defcols)+']["'+this.right+'"]'}}if(this.op=="IS"){return"((typeof "+this.left.toJavaScript(context,tableid,defcols)+"=='undefined') == "+"(typeof "+this.right.toJavaScript(context,tableid,defcols)+"=='undefined'))"}if(this.op=="=="){return"alasql.utils.deepEqual("+this.left.toJavaScript(context,tableid,defcols)+","+this.right.toJavaScript(context,tableid,defcols)+")"}if(this.op=="==="){return"(("+this.left.toJavaScript(context,tableid,defcols)+").valueOf()===("+this.right.toJavaScript(context,tableid,defcols)+".valueOf()))"}if(this.op=="!==="){return"!(("+this.left.toJavaScript(context,tableid,defcols)+").valueOf()===("+this.right.toJavaScript(context,tableid,defcols)+".valueOf()))"}if(this.op=="!=="){return"(!alasql.utils.deepEqual("+this.left.toJavaScript(context,tableid,defcols)+","+this.right.toJavaScript(context,tableid,defcols)+"))"}if(this.op=="LIKE"){var s="("+this.left.toJavaScript(context,tableid,defcols)+"+'')"+".toUpperCase().match(new RegExp('^'+("+this.right.toJavaScript(context,tableid,defcols)+").replace(/\\%/g,'.*').toUpperCase()+'$','g'))";return s}if(this.op=="NOT LIKE"){var s="!(("+this.left.toJavaScript(context,tableid,defcols)+"+'')"+".toUpperCase().match(new RegExp('^'+("+this.right.toJavaScript(context,tableid,defcols)+").replace(/\\%/g,'.*').toUpperCase()+'$','g')))";return s}if(this.op=="BETWEEN"){return"(("+this.right1.toJavaScript(context,tableid,defcols)+"<="+this.left.toJavaScript(context,tableid,defcols)+")&&"+"("+this.left.toJavaScript(context,tableid,defcols)+"<="+this.right2.toJavaScript(context,tableid,defcols)+"))"}if(this.op=="NOT BETWEEN"){return"!(("+this.right1.toJavaScript(context,tableid,defcols)+"<="+this.left.toJavaScript(context,tableid,defcols)+")&&"+"("+this.left.toJavaScript(context,tableid,defcols)+"<="+this.right2.toJavaScript(context,tableid,defcols)+"))"}if(this.op=="IN"){if(this.right instanceof yy.Select){var s="(";s+="alasql.utils.flatArray(this.queriesfn["+this.queriesidx+"](params,null,context))";s+=".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")>-1)";return s}else if(this.right instanceof Array){var s="(["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")>-1)";return s}else{var s="("+this.right.toJavaScript(context,tableid,defcols)+".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")>-1)";return s}}if(this.op=="NOT IN"){if(this.right instanceof yy.Select){var s="(";s+="alasql.utils.flatArray(this.queriesfn["+this.queriesidx+"](params,null,p))";s+=".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")<0)";return s}else if(this.right instanceof Array){var s="(["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")<0)";return s}else{var s="("+this.right.toJavaScript(context,tableid,defcols)+".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")==-1)";return s}}if(this.allsome=="ALL"){if(this.right instanceof yy.Select){var s="alasql.utils.flatArray(this.query.queriesfn["+this.queriesidx+"](params,null,p))";s+=".every(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else if(this.right instanceof Array){var s="["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].every(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else{throw new Error("Wrong NOT IN operator without SELECT part")}}if(this.allsome=="SOME"||this.allsome=="ANY"){if(this.right instanceof yy.Select){var s="alasql.utils.flatArray(this.query.queriesfn["+this.queriesidx+"](params,null,p))";s+=".some(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else if(this.right instanceof Array){var s="["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].some(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else{throw new Error("Wrong NOT IN operator without SELECT part")}}if(this.op=="AND"){if(this.left.reduced){if(this.right.reduced){return"true"}else{return this.right.toJavaScript(context,tableid,defcols)}}else if(this.right.reduced){return this.left.toJavaScript(context,tableid,defcols)}op="&&"}if(this.op=="^"){return"Math.pow("+this.left.toJavaScript(context,tableid,defcols)+","+this.right.toJavaScript(context,tableid,defcols)+")"}return"("+this.left.toJavaScript(context,tableid,defcols)+op+this.right.toJavaScript(context,tableid,defcols)+")"};yy.VarValue=function(params){return yy.extend(this,params)};yy.VarValue.prototype.toString=function(){return"@"+L(this.variable)};yy.VarValue.prototype.toType=function(){return"unknown"};yy.VarValue.prototype.toJavaScript=function(){return"alasql.vars['"+this.variable+"']"};yy.NumValue=function(params){return yy.extend(this,params)};yy.NumValue.prototype.toString=function(){return N(this.value.toString())};yy.NumValue.prototype.toType=function(){return"number"};yy.NumValue.prototype.toJavaScript=function(){return""+this.value};yy.StringValue=function(params){return yy.extend(this,params)};yy.StringValue.prototype.toString=function(){return"'"+S(this.value.toString())+"'"};yy.StringValue.prototype.toType=function(){return"string"};yy.StringValue.prototype.toJavaScript=function(){return"'"+escapeq(this.value)+"'"};yy.LogicValue=function(params){return yy.extend(this,params)};yy.LogicValue.prototype.toString=function(){return this.value?"TRUE":"FALSE"};yy.LogicValue.prototype.toType=function(){return"boolean"};yy.LogicValue.prototype.toJavaScript=function(){return this.value?"true":"false"};yy.NullValue=function(params){return yy.extend(this,params)};yy.NullValue.prototype.toString=function(){return"NULL"};yy.NullValue.prototype.toJavaScript=function(){return"undefined"};yy.ParamValue=function(params){return yy.extend(this,params)};yy.ParamValue.prototype.toString=function(){return"$"+this.param};yy.ParamValue.prototype.toJavaScript=function(){if(typeof this.param=="string")return"params['"+this.param+"']";else return"params["+this.param+"]"};yy.UniOp=function(params){return yy.extend(this,params)};yy.UniOp.prototype.toString=function(){if(this.op=="-")return this.op+this.right.toString();if(this.op=="+")return this.op+this.right.toString();if(this.op=="#")return this.op+this.right.toString();if(this.op=="NOT")return this.op+"("+this.right.toString()+")";else if(this.op==null)return"("+this.right.toString()+")"};yy.UniOp.prototype.findAggregator=function(query){if(this.right.findAggregator)this.right.findAggregator(query)};yy.UniOp.prototype.toType=function(tableid){if(this.op=="-")return"number";if(this.op=="+")return"number";if(this.op=="NOT")return"boolean"};yy.UniOp.prototype.toJavaScript=function(context,tableid,defcols){if(this.op=="-")return"(-("+this.right.toJavaScript(context,tableid,defcols)+"))";if(this.op=="+")return"("+this.right.toJavaScript(context,tableid,defcols)+")";if(this.op=="NOT")return"!("+this.right.toJavaScript(context,tableid,defcols)+")";if(this.op=="#"){if(this.right instanceof yy.Column){return"(alasql.databases[alasql.useid].objects['"+this.right.columnid+"'])"}else{return"(alasql.databases[alasql.useid].objects["+this.right.toJavaScript(context,tableid,defcols)+"])"}}else if(this.op==null)return"("+this.right.toJavaScript(context,tableid,defcols)+")"};yy.Column=function(params){return yy.extend(this,params)};yy.Column.prototype.toString=function(){var s;if(this.columnid==+this.columnid){s="["+this.columnid+"]"}else{s=this.columnid}if(this.tableid){if(+this.columnid==this.columnid){s=this.tableid+s}else{s=this.tableid+"."+s}if(this.databaseid){s=this.databaseid+"."+s}}return s};yy.Column.prototype.toJavaScript=function(context,tableid,defcols){var s="";if(!this.tableid&&tableid==""&&!defcols){if(this.columnid!="_"){s=context+"['"+this.columnid+"']"}else{if(context=="g"){s="g['_']"}else{s=context}}}else{if(context=="g"){s="g['"+this.nick+"']"}else if(this.tableid){if(this.columnid!="_"){s=context+"['"+this.tableid+"']['"+this.columnid+"']"}else{if(context=="g"){s="g['_']"}else{s=context+"['"+this.tableid+"']"}}}else if(defcols){var tbid=defcols[this.columnid];if(tbid=="-"){throw new Error('Cannot resolve column "'+this.columnid+'" because it exists in two source tables')}else if(tbid){if(this.columnid!="_"){s=context+"['"+tbid+"']['"+this.columnid+"']"}else{s=context+"['"+tbid+"']"}}else{if(this.columnid!="_"){s=context+"['"+(this.tableid||tableid)+"']['"+this.columnid+"']"}else{s=context+"['"+(this.tableid||tableid)+"']"}}}else if(tableid==-1){s=context+"['"+this.columnid+"']"}else{if(this.columnid!="_"){s=context+"['"+(this.tableid||tableid)+"']['"+this.columnid+"']"}else{s=context+"['"+(this.tableid||tableid)+"']"}}}return s};yy.AggrValue=function(params){return yy.extend(this,params)};yy.AggrValue.prototype.toString=function(){var s="";if(this.aggregatorid=="REDUCE")s+=L(this.funcid)+"(";else s+=this.aggregatorid+"(";if(this.distinct)s+=K("DISTINCT")+" ";if(this.expression)s+=this.expression.toString();s+=")";if(this.over)s+=" "+this.over.toString();return s};yy.AggrValue.prototype.findAggregator=function(query){var colas=escapeq(this.toString())+":"+query.selectGroup.length;var found=false;if(!found){if(!this.nick){this.nick=colas;var found=false;for(var i=0;i-1)return"number";if(["ARRAY"].indexOf(this.aggregatorid)>-1)return"array";if(["FIRST","LAST"].indexOf(this.aggregatorid)>-1)return this.expression.toType()};yy.AggrValue.prototype.toJavaScript=function(context,tableid,defcols){var colas=this.nick;if(typeof colas=="undefined")colas=this.toString();return"g['"+colas+"']"};yy.OrderExpression=function(params){return yy.extend(this,params)};yy.OrderExpression.prototype.toString=function(){var s=this.expression.toString();if(this.order)s+=" "+this.order.toString();if(this.nocase)s+=" "+K("COLLATE")+" "+K("NOCASE");return s};yy.GroupExpression=function(params){return yy.extend(this,params)};yy.GroupExpression.prototype.toString=function(){return this.type+"("+this.group.toString()+")"};yy.ColumnDef=function(params){return yy.extend(this,params)};yy.ColumnDef.prototype.toString=function(){var s=this.columnid;if(this.dbtypeid)s+=" "+this.dbtypeid;if(this.dbsize){s+="("+this.dbsize;if(this.dbprecision)s+=","+this.dbprecision;s+=")"}if(this.primarykey)s+=" PRIMARY KEY";if(this.notnull)s+=" NOT NULL";return s};yy.FromData=function(params){return yy.extend(this,params)};yy.FromData.prototype.toString=function(){if(this.data)return K("DATA")+"("+(Math.random()*1e16|0)+")";else return"?"};yy.FromData.prototype.toJavaScript=function(){};yy.Select.prototype.exec=function(params,cb){if(this.preparams)params=this.preparams.concat(params);var databaseid=alasql.useid;db=alasql.databases[databaseid];var sql=this.toString();var hh=hash(sql);var statement=this.compile(databaseid);if(!statement)return;statement.sql=sql;statement.dbversion=db.dbversion;if(db.sqlCacheSize>alasql.MAXSQLCACHESIZE){db.resetSqlCache()}db.sqlCacheSize++;db.sqlCache[hh]=statement;var res=alasql.res=statement(params,cb);return res};yy.Select.prototype.Select=function(){var self=this;var agrs=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments)}else if(arguments.length==1){if(arguments[0]instanceof Array){args=arguments[0]}else{args=[arguments[0]]}}else{throw new Error("Wrong number of arguments of Select() function")}self.columns=[];args.forEach(function(arg){if(typeof arg=="string"){self.columns.push(new yy.Column({columnid:arg}))}else if(typeof arg=="function"){var pari=0;if(self.preparams){pari=self.preparams.length}else{self.preparams=[]}self.preparams.push(arg);self.columns.push(new yy.Column({columnid:"*",func:arg,param:pari}))}else{}});return self};yy.Select.prototype.From=function(tableid){var self=this;if(!self.from)self.from=[];if(tableid instanceof Array){var pari=0;if(self.preparams){pari=self.preparams.length}else{self.preparams=[]}self.preparams.push(tableid);self.from.push(new yy.ParamValue({param:pari}))}else if(typeof tableid=="string"){self.from.push(new yy.Table({tableid:tableid}))}else{throw new Error("Unknown arguments in From() function")}return self};yy.Select.prototype.OrderBy=function(){var self=this;var agrs=[];self.order=[];if(arguments.length==0){args=["_"]}else if(arguments.length>1){args=Array.prototype.slice.call(arguments)}else if(arguments.length==1){if(arguments[0]instanceof Array){args=arguments[0]}else{args=[arguments[0]]}}else{throw new Error("Wrong number of arguments of Select() function")}if(args.length>0){args.forEach(function(arg){var expr=new yy.Column({columnid:arg});if(typeof arg=="function"){expr=arg}self.order.push(new yy.OrderExpression({expression:expr,direction:"ASC"}))})}return self};yy.Select.prototype.Top=function(topnum){var self=this;self.top=new yy.NumValue({value:topnum});return self};yy.Select.prototype.GroupBy=function(){var self=this;var agrs=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments)}else if(arguments.length==1){if(arguments[0]instanceof Array){args=arguments[0]}else{args=[arguments[0]]}}else{throw new Error("Wrong number of arguments of Select() function")}self.group=[];args.forEach(function(arg){var expr=new yy.Column({columnid:arg});self.group.push(expr)});return self};yy.Select.prototype.Where=function(expr){var self=this;if(typeof expr=="function"){self.where=expr}return self};yy.FuncValue=function(params){return yy.extend(this,params)};yy.FuncValue.prototype.toString=function(){var s="";if(alasql.fn[this.funcid])s+=this.funcid;else if(alasql.aggr[this.funcid])s+=this.funcid;else if(alasql.stdlib[this.funcid.toUpperCase()]||alasql.stdfn[this.funcid.toUpperCase()])s+=this.funcid.toUpperCase();s+="(";if(this.args&&this.args.length>0){s+=this.args.map(function(arg){return arg.toString()}).join(",")}s+=")";if(this.as)s+=" AS "+this.as.toString();return s};yy.FuncValue.prototype.findAggregator=function(query){if(this.args&&this.args.length>0){this.args.forEach(function(arg){if(arg.findAggregator)arg.findAggregator(query)})}};yy.FuncValue.prototype.toJavaScript=function(context,tableid,defcols){var s="";var funcid=this.funcid;if(alasql.fn[funcid]){if(this.newid)s+="new ";s+="alasql.fn."+this.funcid+"(";if(this.args&&this.args.length>0){s+=this.args.map(function(arg){return arg.toJavaScript(context,tableid,defcols)}).join(",")}s+=")"}else if(alasql.stdlib[funcid.toUpperCase()]){if(this.args&&this.args.length>0){s+=alasql.stdlib[funcid.toUpperCase()].apply(this,this.args.map(function(arg){return arg.toJavaScript(context,tableid)}))}else{s+=alasql.stdlib[funcid.toUpperCase()]()}}else if(alasql.stdfn[funcid.toUpperCase()]){if(this.newid)s+="new ";s+="alasql.stdfn."+this.funcid.toUpperCase()+"(";if(this.args&&this.args.length>0){s+=this.args.map(function(arg){return arg.toJavaScript(context,tableid,defcols)}).join(",")}s+=")"}else{}return s};var stdlib=alasql.stdlib={};var stdfn=alasql.stdfn={};stdlib.ABS=function(a){return"Math.abs("+a+")"};stdlib.CLONEDEEP=function(a){return"alasql.utils.cloneDeep("+a+")"};stdlib.IIF=function(a,b,c){if(arguments.length==3){return"(("+a+")?("+b+"):("+c+"))"}else{throw new Error("Number of arguments of IFF is not equals to 3")}};stdlib.IFNULL=function(a,b){return"("+a+"||"+b+")"};stdlib.INSTR=function(s,p){return"(("+s+").indexOf("+p+")+1)"};stdlib.LEN=stdlib.LENGTH=function(s){return und(s,"y.length")};stdlib.LOWER=stdlib.LCASE=function(s){return und(s,"y.toLowerCase()")};stdlib.MAX=stdlib.GREATEST=function(){return"Math.max("+Array.prototype.join.call(arguments,",")+")"};stdlib.MIN=stdlib.LEAST=function(){return"Math.min("+Array.prototype.join.call(arguments,",")+")"};stdlib.SUBSTRING=stdlib.MID=function(a,b,c){if(arguments.length==2)return und(a,"y.substr("+b+"-1)");else if(arguments.length==3)return und(a,"y.substr("+b+"-1,"+c+")")};stdlib.ISNULL=stdlib.NULLIF=function(a,b){return"("+a+"=="+b+"?undefined:"+a+")"};stdlib.POWER=function(a,b){return"Math.pow("+a+","+b+")"};stdlib.RANDOM=function(r){if(arguments.length==0){return"Math.random()"}else{return"(Math.random()*("+r+")|0)"}};stdlib.ROUND=function(s,d){if(arguments.length==2){return"Math.round("+s+"*Math.pow(10,"+d+"))/Math.pow(10,"+d+")"}else{return"Math.round("+s+")"}};stdlib.ROWNUM=function(){return"1"};stdlib.ROW_NUMBER=function(){return"1"};stdlib.SQRT=function(s){return"Math.sqrt("+s+")"};stdlib.TRIM=function(s){return und(s,"y.trim()")};stdlib.UPPER=stdlib.UCASE=function(s){return und(s,"y.toUpperCase()")};alasql.aggr.GROUP_CONCAT=function(v,s){if(typeof s=="undefined")return v;else return s+","+v};alasql.aggr.MEDIAN=function(v,s,acc){if(typeof acc.arr=="undefined"){acc.arr=[v]; +return v}else{acc.arr.push(v);var p=acc.arr.sort();return p[p.length/2|0]}};alasql.aggr.VAR=function(v,s,acc){if(typeof acc.arr=="undefined"){acc.arr=[v];acc.sum=v}else{acc.arr.push(v);acc.sum+=v}var N=acc.arr.length;var avg=acc.sum/N;var std=0;for(var i=0;i0){this.whens.forEach(function(w){if(w.when.findAggregator)w.when.findAggregator(query);if(w.then.findAggregator)w.then.findAggregator(query)})}if(this.elses&&this.elses.findAggregator)this.elses.findAggregator(query)};yy.CaseValue.prototype.toJavaScript=function(context,tableid,defcols){var s="((function("+context+",params,alasql){var r;";if(this.expression){s+="v="+this.expression.toJavaScript(context,tableid,defcols)+";";s+=(this.whens||[]).map(function(w){return" if(v=="+w.when.toJavaScript(context,tableid,defcols)+") {r="+w.then.toJavaScript(context,tableid,defcols)+"}"}).join(" else ");if(this.elses)s+=" else {r="+this.elses.toJavaScript(context,tableid,defcols)+"}"}else{s+=(this.whens||[]).map(function(w){return" if("+w.when.toJavaScript(context,tableid,defcols)+") {r="+w.then.toJavaScript(context,tableid,defcols)+"}"}).join(" else ");if(this.elses)s+=" else {r="+this.elses.toJavaScript(context,tableid,defcols)+"}"}s+=";return r;}).bind(this))("+context+",params,alasql)";return s};yy.Json=function(params){return yy.extend(this,params)};yy.Json.prototype.toString=function(){var s="";s+=JSONtoString(this.value);s+="";return s};var JSONtoString=alasql.utils.JSONtoString=function(obj){var s="";if(typeof obj=="string")s='"'+obj+'"';else if(typeof obj=="number")s=obj;else if(typeof obj=="boolean")s=obj;else if(typeof obj=="object"){if(obj instanceof Array){s+="["+obj.map(function(b){return JSONtoString(b)}).join(",")+"]"}else if(!obj.toJavaScript||obj instanceof yy.Json){s="{";var ss=[];for(var k in obj){var s1="";if(typeof k=="string")s1+='"'+k+'"';else if(typeof k=="number")s1+=k;else if(typeof k=="boolean")s1+=k;else{throw new Error("THis is not ES6... no expressions on left side yet")}s1+=":"+JSONtoString(obj[k]);ss.push(s1)}s+=ss.join(",")+"}"}else if(obj.toString){s=obj.toString()}else{throw new Error("1Can not show JSON object "+JSON.stringify(obj))}}else{throw new Error("2Can not show JSON object "+JSON.stringify(obj))}return s};function JSONtoJavaScript(obj,context,tableid,defcols){var s="";if(typeof obj=="string")s='"'+obj+'"';else if(typeof obj=="number")s="("+obj+")";else if(typeof obj=="boolean")s=obj;else if(typeof obj=="object"){if(obj instanceof Array){s+="["+obj.map(function(b){return JSONtoJavaScript(b,context,tableid,defcols)}).join(",")+"]"}else if(!obj.toJavaScript||obj instanceof yy.Json){s="{";var ss=[];for(var k in obj){var s1="";if(typeof k=="string")s1+='"'+k+'"';else if(typeof k=="number")s1+=k;else if(typeof k=="boolean")s1+=k;else{throw new Error("THis is not ES6... no expressions on left side yet")}s1+=":"+JSONtoJavaScript(obj[k],context,tableid,defcols);ss.push(s1)}s+=ss.join(",")+"}"}else if(obj.toJavaScript){s=obj.toJavaScript(context,tableid,defcols)}else{throw new Error("1Can not parse JSON object "+JSON.stringify(obj))}}else{throw new Error("2Can not parse JSON object "+JSON.stringify(obj))}return s}yy.Json.prototype.toJavaScript=function(context,tableid,defcols){return JSONtoJavaScript(this.value,context,tableid,defcols)};yy.Convert=function(params){return yy.extend(this,params)};yy.Convert.prototype.toString=function(){var s="CONVERT(";s+=this.dbtypeid;if(typeof this.dbsize!="undefined"){s+="("+this.dbsize;if(this.dbprecision)s+=","+dbprecision;s+=")"}s+=","+this.expression.toString();if(this.style)s+=","+this.style;s+=")";return s};yy.Convert.prototype.toJavaScript=function(context,tableid,defcols){return"alasql.stdfn.CONVERT("+this.expression.toJavaScript(context,tableid,defcols)+',{dbtypeid:"'+this.dbtypeid+'",dbsize:'+this.dbsize+",style:"+this.style+"})";throw new Error("There is not such type conversion for "+this.toString())};alasql.stdfn.CONVERT=function(value,args){var val=value;if(args.style){var t;if(/\d{8}/.test(val))t=new Date(+val.substr(0,4),+val.substr(4,2)-1,+val.substr(6,2));else t=new Date(val);if(args.style==1){val=("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)+"/"+("0"+t.getYear()).substr(-2)}else if(args.style==2){val=("0"+t.getYear()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getDate()).substr(-2)}else if(args.style==3){val=("0"+t.getDate()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getYear()).substr(-2)}else if(args.style==4){val=("0"+t.getDate()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getYear()).substr(-2)}else if(args.style==5){val=("0"+t.getDate()).substr(-2)+"-"+("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getYear()).substr(-2)}else if(args.style==6){val=("0"+t.getDate()).substr(-2)+" "+t.toString().substr(4,3).toLowerCase()+" "+("0"+t.getYear()).substr(-2)}else if(args.style==7){val=t.toString().substr(4,3)+" "+("0"+t.getDate()).substr(-2)+","+("0"+t.getYear()).substr(-2)}else if(args.style==8){val=("0"+t.getHours()).substr(-2)+":"+("0"+(t.getMinutes()+1)).substr(-2)+":"+("0"+t.getSeconds()).substr(-2)}else if(args.style==10){val=("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getDate()).substr(-2)+"-"+("0"+t.getYear()).substr(-2)}else if(args.style==11){val=("0"+t.getYear()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)}else if(args.style==12){val=("0"+t.getYear()).substr(-2)+("0"+(t.getMonth()+1)).substr(-2)+("0"+t.getDate()).substr(-2)}else if(args.style==101){val=("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)+"/"+t.getFullYear()}else if(args.style==102){val=t.getFullYear()+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getDate()).substr(-2)}else if(args.style==103){val=("0"+t.getDate()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+t.getFullYear()}else if(args.style==104){val=("0"+t.getDate()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+t.getFullYear()}else if(args.style==105){val=("0"+t.getDate()).substr(-2)+"-"+("0"+(t.getMonth()+1)).substr(-2)+"-"+t.getFullYear()}else if(args.style==106){val=("0"+t.getDate()).substr(-2)+" "+t.toString().substr(4,3).toLowerCase()+" "+t.getFullYear()}else if(args.style==107){val=t.toString().substr(4,3)+" "+("0"+t.getDate()).substr(-2)+","+t.getFullYear()}else if(args.style==108){val=("0"+t.getHours()).substr(-2)+":"+("0"+(t.getMinutes()+1)).substr(-2)+":"+("0"+t.getSeconds()).substr(-2)}else if(args.style==110){val=("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getDate()).substr(-2)+"-"+t.getFullYear()}else if(args.style==111){val=t.getFullYear()+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)}else if(args.style==112){val=t.getFullYear()+("0"+(t.getMonth()+1)).substr(-2)+("0"+t.getDate()).substr(-2)}else{throw new Error("The CONVERT style "+args.style+" is not realized yet.")}}var udbtypeid=args.dbtypeid.toUpperCase();if(args.dbtypeid=="Date"){return new Date(val)}else if(udbtypeid=="DATE"){var d=new Date(val);var s=d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2);return s}else if(udbtypeid=="DATETIME"){var d=new Date(val);var s=d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2);s+=" "+("0"+d.getHours()).substr(-2)+":"+("0"+d.getMinutes()).substr(-2)+":"+("0"+d.getSeconds()).substr(-2);s+="."+("00"+d.getMilliseconds()).substr(-3);return s}else if(["NUMBER","FLOAT"].indexOf(udbtypeid)>-1){return+val}else if(["MONEY"].indexOf(udbtypeid)>-1){var m=+val;return(m|0)+m*100%100/100}else if(["BOOLEAN"].indexOf(udbtypeid)>-1){return!!val}else if(["INT","INTEGER","SMALLINT","BIGINT","SERIAL","SMALLSERIAL","BIGSERIAL"].indexOf(args.dbtypeid.toUpperCase())>-1){return val|0}else if(["STRING","VARCHAR","NVARCHAR","CHARACTER VARIABLE"].indexOf(args.dbtypeid.toUpperCase())>-1){if(args.dbsize)return(""+val).substr(0,args.dbsize);else return""+val}else if(["CHAR","CHARACTER","NCHAR"].indexOf(udbtypeid)>-1){return(val+new Array(args.dbsize+1).join(" ")).substr(0,args.dbsize)}else if(["DECIMAL","NUMERIC"].indexOf(udbtypeid)>-1){var m=+val;var fxd=Math.pow(10,args.dbpecision);return(m|0)+m*fxd%fxd/fxd}else if(["JSON"].indexOf(udbtypeid)>-1){if(typeof val=="object")return val;try{return JSON.parse(val)}catch(err){throw new Error("Cannot convert string to JSON")}}return val};yy.ColumnDef=function(params){return yy.extend(this,params)};yy.ColumnDef.prototype.toString=function(){var s=this.columnid;if(this.dbtypeid)s+=" "+this.dbtypeid;if(this.dbsize){s+="("+this.dbsize;if(this.dbprecision)s+=","+this.dbprecision;s+=")"}if(this.primarykey)s+=" PRIMARY KEY";if(this.notnull)s+=" NOT NULL";return s};yy.CreateTable=function(params){return yy.extend(this,params)};yy.CreateTable.prototype.toString=function(){var s=K("CREATE");if(this.temporary)s+=" "+K("TEMPORARY");if(this.view)s+=" "+K("VIEW");else s+=" "+(this.class?K("CLASS"):K("TABLE"));if(this.ifnotexists)s+=" "+K("IF")+" "+K("NOT")+" "+K("EXISTS");s+=" "+this.table.toString();if(this.viewcolumns){s+="("+this.viewcolumns.map(function(vcol){return vcol.toString()}).join(",")+")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);else{var ss=this.columns.map(function(col){return col.toString()});s+=" ("+NL()+ID()+ss.join(","+NL()+ID())+")"}if(this.view&&this.select){s+=" AS "+this.select.toString()}return s};yy.CreateTable.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[this.table.databaseid||databaseid];var tableid=this.table.tableid;if(!tableid){throw new Error("Table name is not defined")}var columns=this.columns;var constraints=this.constraints||[];if(this.ifnotexists&&db.tables[tableid])return 0;if(db.tables[tableid]){throw new Error("Can not create table '"+tableid+"', because it already exists in the database '"+db.databaseid+"'")}var table=db.tables[tableid]=new alasql.Table;if(this.class){table.isclass=true}table.identities={};table.checkfn=[];var ss=[];if(this.columns){this.columns.forEach(function(col){var dbtypeid=col.dbtypeid;if(!alasql.fn[dbtypeid])dbtypeid=dbtypeid.toUpperCase();if(["SERIAL","SMALLSERIAL","BIGSERIAL"].indexOf(dbtypeid)>-1)col.identity={value:1,step:1};var newcol={columnid:col.columnid,dbtypeid:dbtypeid,dbsize:col.dbsize,dbprecision:col.dbprecision,notnull:col.notnull,identity:col.identity};if(col.identity){table.identities[col.columnid]={value:+col.identity.value,step:+col.identity.step}}if(col.check){table.checkfn.push(new Function("r","var y;return "+col.check.expression.toJavaScript("r","")))}if(col.default){ss.push("'"+col.columnid+"':"+col.default.toJavaScript("r",""))}if(col.primarykey){var pk=table.pk={};pk.columns=[col.columnid];pk.onrightfns="r['"+col.columnid+"']";pk.onrightfn=new Function("r","var y;return "+pk.onrightfns);pk.hh=hash(pk.onrightfns);table.uniqs[pk.hh]={}}if(col.unique){var uk={};if(typeof table.uk=="undefined")table.uk=[];table.uk.push(uk);uk.columns=[col.columnid];uk.onrightfns="r['"+col.columnid+"']";uk.onrightfn=new Function("r","var y;return "+uk.onrightfns);uk.hh=hash(uk.onrightfns);table.uniqs[uk.hh]={}}if(col.foreignkey){var fk=col.foreignkey.table;var fktable=alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];if(typeof fk.columnid=="undefined"){if(fktable.pk.columns&&fktable.pk.columns.length>0){fk.columnid=fktable.pk.columns[0]}else{throw new Error("FOREIGN KEY allowed only to tables with PRIMARY KEYs")}}var fkfn=function(r){var rr={};if(typeof r[col.columnid]=="undefined")return true;rr[fk.columnid]=r[col.columnid];var addr=fktable.pk.onrightfn(rr);if(!fktable.uniqs[fktable.pk.hh][addr]){throw new Error('Foreign key "'+r[col.columnid]+'" is not found in table '+fktable.tableid)}return true};table.checkfn.push(fkfn)}table.columns.push(newcol);table.xcolumns[newcol.columnid]=newcol})}table.defaultfns=ss.join(",");constraints.forEach(function(con){if(con.type=="PRIMARY KEY"){if(table.pk){throw new Error("Primary key already exists")}var pk=table.pk={};pk.columns=con.columns;pk.onrightfns=pk.columns.map(function(columnid){return"r['"+columnid+"']"}).join("+'`'+");pk.onrightfn=new Function("r","var y;return "+pk.onrightfns);pk.hh=hash(pk.onrightfns);table.uniqs[pk.hh]={}}else if(con.type=="CHECK"){table.checkfn.push(new Function("r","var y;return "+con.expression.toJavaScript("r","")))}else if(con.type=="UNIQUE"){var uk={};if(!table.uk)table.uk=[];table.uk.push(uk);uk.columns=con.columns;uk.onrightfns=uk.columns.map(function(columnid){return"r['"+columnid+"']"}).join("+'`'+");uk.onrightfn=new Function("r","var y;return "+uk.onrightfns);uk.hh=hash(uk.onrightfns);table.uniqs[uk.hh]={}}else if(con.type=="FOREIGN KEY"){var col=table.xcolumns[con.columns[0]];var fk=con.fktable;if(con.fkcolumns&&con.fkcolumns.length>0)fk.columnid=con.fkcolumns[0];var fktable=alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];if(typeof fk.columnid=="undefined"){fk.columnid=fktable.pk.columns[0]}var fkfn=function(r){var rr={};if(typeof r[col.columnid]=="undefined")return true;rr[fk.columnid]=r[col.columnid];var addr=fktable.pk.onrightfn(rr);if(!fktable.uniqs[fktable.pk.hh][addr]){throw new Error('Foreign key "'+r[col.columnid]+'" is not found in table '+fktable.tableid)}return true};table.checkfn.push(fkfn)}});if(this.view&&this.viewcolumns){var self=this;this.viewcolumns.forEach(function(vcol,idx){self.select.columns[idx].as=vcol.columnid})}if(db.engineid){return alasql.engines[db.engineid].createTable(this.table.databaseid||databaseid,tableid,this.ifnotexists,cb)}table.insert=function(r){var table=this;for(var columnid in table.identities){var ident=table.identities[columnid];r[columnid]=ident.value}if(table.checkfn&&table.checkfn.length>0){table.checkfn.forEach(function(checkfn){if(!checkfn(r)){throw new Error("Violation of CHECK constraint")}})}table.columns.forEach(function(column){if(column.notnull&&typeof r[column.columnid]=="undefined"){throw new Error("Wrong NULL value in NOT NULL column "+column.columnid)}});if(table.pk){var pk=table.pk;var addr=pk.onrightfn(r);if(typeof table.uniqs[pk.hh][addr]!="undefined"){throw new Error("Cannot insert record, because it already exists in primary key index")}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][ukaddr]!="undefined"){throw new Error("Cannot insert record, because it already exists in unique index")}})}table.data.push(r);for(var columnid in table.identities){var ident=table.identities[columnid];ident.value+=ident.step}if(table.pk){var pk=table.pk;var addr=pk.onrightfn(r);table.uniqs[pk.hh][addr]=r}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);table.uniqs[uk.hh][ukaddr]=r})}};table.delete=function(i,params,alasql){var table=this;var r=this.data[i];if(this.pk){var pk=this.pk;var addr=pk.onrightfn(r);if(typeof this.uniqs[pk.hh][addr]=="undefined"){throw new Error("Something wrong with primary key index on table")}else{this.uniqs[pk.hh][addr]=undefined}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][ukaddr]=="undefined"){throw new Error("Something wrong with unique index on table")}table.uniqs[uk.hh][ukaddr]=undefined})}};table.deleteall=function(){this.data.length=0;if(this.pk){this.uniqs[this.pk.hh]={}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){table.uniqs[uk.hh]={}})}};table.update=function(assignfn,i,params){var r=cloneDeep(this.data[i]);if(this.pk){var pk=this.pk;pk.pkaddr=pk.onrightfn(r,params);if(typeof this.uniqs[pk.hh][pk.pkaddr]=="undefined"){throw new Error("Something wrong with index on table")}else{}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){uk.ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][uk.ukaddr]=="undefined"){throw new Error("Something wrong with unique index on table")}})}assignfn(r,params,alasql);if(table.checkfn&&table.checkfn.length>0){table.checkfn.forEach(function(checkfn){if(!checkfn(r)){throw new Error("Violation of CHECK constraint")}})}table.columns.forEach(function(column){if(column.notnull&&typeof r[column.columnid]=="undefined"){throw new Error("Wrong NULL value in NOT NULL column "+column.columnid)}});if(this.pk){pk.newpkaddr=pk.onrightfn(r);if(typeof this.uniqs[pk.hh][pk.newpkaddr]!="undefined"&&pk.newpkaddr!=pk.pkaddr){throw new Error("Record already exists")}else{}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){uk.newukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][uk.newukaddr]!="undefined"&&uk.newukaddr!=uk.ukaddr){throw new Error("Record already exists")}})}if(this.pk){this.uniqs[pk.hh][pk.pkaddr]=undefined;this.uniqs[pk.hh][pk.newpkaddr]=r}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){table.uniqs[uk.hh][uk.ukaddr]=undefined;table.uniqs[uk.hh][uk.newukaddr]=r})}this.data[i]=r};if(this.view&&this.select){table.view=true;table.select=this.select.compile(this.table.databaseid||databaseid)}var res;if(!alasql.options.nocount)res=1;if(cb)res=cb(res);return res};alasql.fn.Date=Object;alasql.fn.Date=Date;alasql.fn.Number=Number;alasql.fn.String=String;alasql.fn.Boolean=Boolean;stdfn.EXTEND=alasql.utils.extend;stdfn.CHAR=String.fromCharCode.bind(String);stdfn.ASCII=function(a){return a.charCodeAt(0)};stdfn.COALESCE=function(){for(var i=0;i0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql",s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res;var db=alasql.databases[dbid];if(typeof sharp!="undefined"){var id=sharp}else{var id=db.counter++}var vertex={$id:id,$node:"VERTEX"};db.objects[vertex.$id]=vertex;res=vertex;if(namefn)namefn(vertex);if(setfn)setfn(vertex,params,alasql);if(cb)res=cb(res);return res};return statement};yy.CreateEdge=function(params){return yy.extend(this,params)};yy.CreateEdge.prototype.toString=function(){var s=K("CREATE")+" "+K("EDGE")+" ";if(this.class)s+=L(this.class)+" ";return s};yy.CreateEdge.prototype.toJavaScript=function(context,tableid,defcols){var s="this.queriesfn["+(this.queriesidx-1)+"](this.params,null,"+context+")";return s};yy.CreateEdge.prototype.compile=function(databaseid){var dbid=databaseid;var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());var tofn=new Function("params,alasql","var y;return "+this.to.toJavaScript());if(typeof this.name!="undefined"){var s="x.name="+this.name.toJavaScript();var namefn=new Function("x",s)}if(this.sets&&this.sets.length>0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql","var y;"+s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res=0;var db=alasql.databases[dbid];var edge={$id:db.counter++,$node:"EDGE"};var v1=fromfn(params,alasql);var v2=tofn(params,alasql);edge.$in=[v1.$id];edge.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(edge.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(edge.$id);db.objects[edge.$id]=edge;res=edge;if(namefn)namefn(edge);if(setfn)setfn(edge,params,alasql);if(cb)res=cb(res);return res};return statement};yy.CreateGraph=function(params){return yy.extend(this,params)};yy.CreateGraph.prototype.toString=function(){var s=K("CREATE")+" "+K("GRAPH")+" ";if(this.class)s+=L(this.class)+" ";return s};yy.CreateGraph.prototype.execute=function(databaseid,params,cb){var res=[];if(this.from){if(alasql.from[this.from.funcid]){this.graph=alasql.from[this.from.funcid.toUpperCase()](this.from.args[0].value);console.log(this.graph)}}this.graph.forEach(function(g){if(g.source){var e={};if(typeof g.as!="undefined")alasql.vars[g.as]=e;if(typeof g.prop!="undefined"){e.name=g.prop}if(typeof g.sharp!="undefined")e.$id=g.sharp;if(typeof g.name!="undefined")e.name=g.name;if(typeof g.class!="undefined")e.$class=g.class;var db=alasql.databases[databaseid];if(typeof e.$id=="undefined"){e.$id=db.counter++}e.$node="EDGE";if(typeof g.json!="undefined"){extend(e,new Function("params,alasql","var y;return "+g.json.toJavaScript())(params,alasql))}var v1;if(g.source.vars){var vo=alasql.vars[g.source.vars];if(typeof vo=="object")v1=vo;else v1=db.objects[vo]}else{var av1=g.source.sharp;if(typeof av1=="undefined")av1=g.source.prop;v1=alasql.databases[databaseid].objects[av1];if(typeof v1=="undefined"&&alasql.options.autovertex&&(typeof g.source.prop!="undefined"||typeof g.source.name!="undefined")){v1=findVertex(g.source.prop||g.source.name);if(typeof v1=="undefined"){v1=createVertex(g.source)}}}var v2;if(g.source.vars){var vo=alasql.vars[g.target.vars];if(typeof vo=="object")v2=vo;else v2=db.objects[vo]}else{var av2=g.target.sharp;if(typeof av2=="undefined")av2=g.target.prop;v2=alasql.databases[databaseid].objects[av2];if(typeof v2=="undefined"&&alasql.options.autovertex&&(typeof g.target.prop!="undefined"||typeof g.target.name!="undefined")){v2=findVertex(g.target.prop||g.target.name);if(typeof v2=="undefined"){v2=createVertex(g.target)}}}e.$in=[v1.$id];e.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(e.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(e.$id);db.objects[e.$id]=e;if(typeof e.$class!="undefined"){if(typeof alasql.databases[databaseid].tables[e.$class]=="undefined"){throw new Error("No such class. Pleace use CREATE CLASS")}else{alasql.databases[databaseid].tables[e.$class].data.push(e)}}res.push(e.$id)}else{createVertex(g)}});if(cb)res=cb(res);return res;function findVertex(name){var objects=alasql.databases[alasql.useid].objects;for(var k in objects){if(objects[k].name==name){return objects[k]}}return undefined}function createVertex(g){var v={};if(typeof g.as!="undefined")alasql.vars[g.as]=v;if(typeof g.prop!="undefined"){v.$id=g.prop;v.name=g.prop}if(typeof g.sharp!="undefined")v.$id=g.sharp;if(typeof g.name!="undefined")v.name=g.name;if(typeof g.class!="undefined")v.$class=g.class;var db=alasql.databases[databaseid];if(typeof v.$id=="undefined"){v.$id=db.counter++}v.$node="VERTEX";if(typeof g.json!="undefined"){extend(v,new Function("params,alasql","var y;return "+g.json.toJavaScript())(params,alasql))}db.objects[v.$id]=v;if(typeof v.$class!="undefined"){if(typeof alasql.databases[databaseid].tables[v.$class]=="undefined"){throw new Error("No such class. Pleace use CREATE CLASS")}else{alasql.databases[databaseid].tables[v.$class].data.push(v)}}res.push(v.$id);return v}};yy.CreateGraph.prototype.compile1=function(databaseid){var dbid=databaseid;var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());var tofn=new Function("params,alasql","var y;return "+this.to.toJavaScript());if(typeof this.name!="undefined"){var s="x.name="+this.name.toJavaScript();var namefn=new Function("x",s)}if(this.sets&&this.sets.length>0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql","var y;"+s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res=0;var db=alasql.databases[dbid];var edge={$id:db.counter++,$node:"EDGE"};var v1=fromfn(params,alasql);var v2=tofn(params,alasql);edge.$in=[v1.$id];edge.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(edge.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(edge.$id);db.objects[edge.$id]=edge;res=edge;if(namefn)namefn(edge);if(setfn)setfn(edge,params,alasql);if(cb)res=cb(res);return res};return statement};yy.AlterTable=function(params){return yy.extend(this,params)};yy.AlterTable.prototype.toString=function(){var s="ALTER TABLE "+this.table.toString();if(this.renameto)s+=" RENAME TO "+this.renameto;return s};yy.AlterTable.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[databaseid];db.dbversion=Date.now();if(this.renameto){var oldtableid=this.table.tableid;var newtableid=this.renameto;var res=1;if(db.tables[newtableid]){throw new Error("Can not rename a table '"+oldtableid+"' to '"+newtableid+"', because the table with this name already exists")}else if(newtableid==oldtableid){throw new Error("Can not rename a table '"+oldtableid+"' to itself")}else{db.tables[newtableid]=db.tables[oldtableid];delete db.tables[oldtableid];res=1}if(cb)cb(res);return res}else if(this.addcolumn){var db=alasql.databases[this.table.databaseid||databaseid];db.dbversion++;var tableid=this.table.tableid;var table=db.tables[tableid];var columnid=this.addcolumn.columnid;if(table.xcolumns[columnid]){throw new Error('Cannot add column "'+columnid+'", because it already exists in the table "'+tableid+'"')}var col={columnid:columnid,dbtypeid:this.dbtypeid,dbsize:this.dbsize,dbprecision:this.dbprecision,dbenum:this.dbenum,defaultfns:null};var defaultfn=function(){};table.columns.push(col);table.xcolumns[columnid]=col;for(var i=0,ilen=table.data.length;i0){for(var i=0,ilen=table.data.length;i0){for(var i=0,ilen=table.data.length;i=0){q+="(x="+values[idx].toJavaScript()+",x==undefined?undefined:+x)"}else if(alasql.fn[table.xcolumns[col.columnid].dbtypeid]){q+="(new "+table.xcolumns[col.columnid].dbtypeid+"(";q+=values[idx].toJavaScript();q+="))"}else{q+=values[idx].toJavaScript()}}else{q+=values[idx].toJavaScript()}ss.push(q)})}else{if(values instanceof Array&&table.columns&&table.columns.length>0){table.columns.forEach(function(col,idx){var q="'"+col.columnid+"':";if(["INT","FLOAT","NUMBER","MONEY"].indexOf(col.dbtypeid)>=0){q+="+"+values[idx].toJavaScript()}else if(alasql.fn[col.dbtypeid]){q+="(new "+col.dbtypeid+"(";q+=values[idx].toJavaScript();q+="))"}else{q+=values[idx].toJavaScript()}ss.push(q)})}else{sw=JSONtoJavaScript(values)}}if(db.tables[tableid].defaultfns){ss.unshift(db.tables[tableid].defaultfns)}if(sw){s+="a="+sw+";"}else{s+="a={"+ss.join(",")+"};"}if(db.tables[tableid].isclass){s+="var db=alasql.databases['"+databaseid+"'];";s+='a.$class="'+tableid+'";';s+="a.$id=db.counter++;";s+="db.objects[a.$id]=a;"}if(db.tables[tableid].insert){s+="var db=alasql.databases['"+databaseid+"'];";s+="db.tables['"+tableid+"'].insert(a);"}else{s+="aa.push(a);"}});s33=s3+s;if(db.tables[tableid].insert){}else{s+="alasql.databases['"+databaseid+"'].tables['"+tableid+"'].data="+"alasql.databases['"+databaseid+"'].tables['"+tableid+"'].data.concat(aa);"}if(db.tables[tableid].insert){if(db.tables[tableid].isclass){s+="return a.$id;"}else{s+="return "+self.values.length}}else{s+="return "+self.values.length}var insertfn=new Function("db, params, alasql","var y;"+s3+s).bind(this)}else if(this.select){selectfn=this.select.compile(databaseid);if(db.engineid&&alasql.engines[db.engineid].intoTable){var statement=function(params,cb){var aa=selectfn(params);var res=alasql.engines[db.engineid].intoTable(db.databaseid,tableid,aa,null,cb);return res};return statement}else{var insertfn=function(db,params,alasql){var res=selectfn(params);if(db.tables[tableid].insert){for(var i=0,ilen=res.length;i0){s+="("+this.args.map(function(arg){return arg.toString()}).join(", ")+")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);return s};yy.CreateDatabase.prototype.execute=function(databaseid,params,cb){var args;if(this.args&&this.args.length>0){args=this.args.map(function(arg){return new Function("params,alasql","var y;return "+arg.toJavaScript())(params,alasql)})}if(this.engineid){var res=alasql.engines[this.engineid].createDatabase(this.databaseid,this.args,this.ifnotexists,this.as,cb);return res}else{var dbid=this.databaseid;if(alasql.databases[dbid]){throw new Error("Database '"+dbid+"' already exists")}var a=new alasql.Database(dbid);var res=1;if(cb)return cb(res);return res}};yy.AttachDatabase=function(params){return yy.extend(this,params)};yy.AttachDatabase.prototype.toString=function(){var s=K("ATTACH");if(this.engineid)s+=" "+L(this.engineid);s+=" "+K("DATABASE")+" "+L(this.databaseid);if(args){s+="(";if(args.length>0){s+=args.map(function(arg){return arg.toString()}).join(", ")}s+=")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);return s};yy.AttachDatabase.prototype.execute=function(databaseid,params,cb){if(!alasql.engines[this.engineid]){throw new Error('Engine "'+this.engineid+'" is not defined.')}var res=alasql.engines[this.engineid].attachDatabase(this.databaseid,this.as,this.args,params,cb);return res};yy.DetachDatabase=function(params){return yy.extend(this,params)};yy.DetachDatabase.prototype.toString=function(){var s=K("DETACH");s+=" "+K("DATABASE")+" "+L(this.databaseid);return s};yy.DetachDatabase.prototype.execute=function(databaseid,params,cb){if(!alasql.databases[this.databaseid].engineid){throw new Error('Cannot detach database "'+this.engineid+'", because it was not attached.')}var res;var dbid=this.databaseid;if(dbid==alasql.DEFAULTDATABASEID){throw new Error("Drop of default database is prohibited")}if(!alasql.databases[dbid]){if(!this.ifexists){throw new Error("Database '"+dbid+"' does not exist")}else{res=0}}else{delete alasql.databases[dbid];if(dbid==alasql.useid){alasql.use()}res=1}if(cb)cb(res);return res};yy.UseDatabase=function(params){return yy.extend(this,params)};yy.UseDatabase.prototype.toString=function(){return K("USE")+" "+K("DATABASE")+" "+L(this.databaseid)};yy.UseDatabase.prototype.execute=function(databaseid,params,cb){var dbid=this.databaseid;if(!alasql.databases[dbid]){throw new Error("Database '"+dbid+"' does not exist")}alasql.use(dbid);var res=1;if(cb)cb(res);return res};yy.DropDatabase=function(params){return yy.extend(this,params)};yy.DropDatabase.prototype.toString=function(){var s=K("DROP");if(this.ifexists)s+=" "+K("IF")+" "+K("EXISTS");s+=" "+K("DATABASE")+" "+L(this.databaseid);return s};yy.DropDatabase.prototype.execute=function(databaseid,params,cb){if(this.engineid){return alasql.engines[this.engineid].dropDatabase(this.databaseid,this.ifexists,cb)}var res;var dbid=this.databaseid;if(dbid==alasql.DEFAULTDATABASEID){throw new Error("Drop of default database is prohibited")}if(!alasql.databases[dbid]){if(!this.ifexists){throw new Error("Database '"+dbid+"' does not exist")}else{res=0}}else{if(alasql.databases[dbid].engineid){throw new Error("Cannot drop database '"+dbid+"', because it is attached. Detach it.")}delete alasql.databases[dbid];if(dbid==alasql.useid){alasql.use()}res=1}if(cb)cb(res);return res};yy.Declare=function(params){return yy.extend(this,params)};yy.Declare.prototype.toString=function(){var s=K("DECLARE")+" ";if(this.declares&&this.declares.length>0){s=this.declares.map(function(declare){var s="";s+="@"+L(declare.variable)+" ";s+=declare.dbtypeid;if(this.dbsize)s+="("+N(this.dbsize);if(this.dbprecision)s+=","+N(this.dbprecision);s+=")";if(declare.expression)s+=" = "+declare.expression.toString();return s}).join(",")}return s};yy.Declare.prototype.execute=function(databaseid,params,cb){var res=1;if(this.declares&&this.declares.length>0){this.declares.map(function(declare){var dbtypeid=declare.dbtypeid;if(!alasql.fn[dbtypeid])dbtypeid=dbtypeid.toUpperCase();alasql.declares[declare.variable]={dbtypeid:dbtypeid,dbsize:declare.dbsize,dbprecision:declare.dbprecision};if(declare.expression){alasql.vars[declare.variable]=new Function("params,alasql","return "+declare.expression.toJavaScript("({})","",null))(params,alasql);if(alasql.declares[declare.variable]){alasql.vars[declare.variable]=alasql.stdfn.CONVERT(alasql.vars[declare.variable],alasql.declares[declare.variable])}}})}if(cb)res=cb(res);return res};yy.ShowDatabases=function(params){return yy.extend(this,params)};yy.ShowDatabases.prototype.toString=function(){var s=K("SHOW")+" "+K("DATABASES");if(this.like)s+="LIKE "+this.like.toString();return s};yy.ShowDatabases.prototype.execute=function(databaseid,params,cb){if(this.engineid){return alasql.engines[this.engineid].showDatabases(this.like,cb)}else{var self=this;var res=[];for(dbid in alasql.databases){res.push({databaseid:dbid})}if(self.like&&res&&res.length>0){res=res.filter(function(d){return d.databaseid.match(new RegExp(self.like.value.replace(/\%/g,".*"),"g"))})}if(cb)cb(res);return res}};yy.ShowTables=function(params){return yy.extend(this,params)};yy.ShowTables.prototype.toString=function(){var s=K("SHOW")+" "+K("TABLES");if(this.databaseid)s+=" FROM "+this.databaseid;if(this.like)s+=" "+K("LIKE")+" "+this.like.toString();return s};yy.ShowTables.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[this.databaseid||databaseid];var self=this;var res=[];for(tableid in db.tables){res.push({tableid:tableid})}if(self.like&&res&&res.length>0){res=res.filter(function(d){return d.tableid.match(new RegExp(self.like.value.replace(/\%/g,".*"),"g"))})}if(cb)cb(res);return res};yy.ShowColumns=function(params){return yy.extend(this,params)};yy.ShowColumns.prototype.toString=function(){var s=K("SHOW")+" "+K("COLUMNS");if(this.table.tableid)s+=" "+K("FROM")+" "+this.table.tableid;if(this.databaseid)s+=" "+K("FROM")+" "+this.databaseid;return s};yy.ShowColumns.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;if(table&&table.columns){var res=table.columns.map(function(col){return{columnid:col.columnid,dbtypeid:col.dbtypeid,dbsize:col.dbsize}});return res}else{return[]}};yy.ShowIndex=function(params){return yy.extend(this,params)};yy.ShowIndex.prototype.toString=function(){var s=K("SHOW")+" "+K("INDEX");if(this.table.tableid)s+=" "+K("FROM")+" "+this.table.tableid;if(this.databaseid)s+=" "+K("FROM")+" "+this.databaseid;return s};yy.ShowIndex.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;var res=[];if(table&&table.indices){for(var ind in table.indices){res.push({hh:ind,len:Object.keys(table.indices[ind]).length})}}return res};yy.ShowCreateTable=function(params){return yy.extend(this,params)};yy.ShowCreateTable.prototype.toString=function(){var s=K("SHOW")+" "+K("CREATE")+" "+K("TABLE")+" "+L(this.table.tableid);if(this.databaseid)s+=" "+K("FROM")+" "+L(this.databaseid);return s};yy.ShowCreateTable.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;if(table){var s=K("CREATE")+" "+K("TABLE")+" "+L(this.table.tableid)+" (";var ss=[];if(table.columns){table.columns.forEach(function(col){var a=L(col.columnid)+" "+K(col.dbtypeid);if(col.dbsize)a+="("+N(col.dbsize)+")";if(col.primarykey)a+=" "+K("PRIMARY")+" "+K("KEY");ss.push(a)});s+=ss.join(", ")}s+=")";return s}else{throw new Error('There is no such table "'+this.table.tableid+'"')}};yy.SetVariable=function(params){return yy.extend(this,params)};yy.SetVariable.prototype.toString=function(){var s=K("SET")+" ";if(typeof this.value!="undefined")s+=K(this.variable.toUpperCase())+" "+(this.value?"ON":"OFF");if(this.expression)s+=this.method+L(this.variable)+" = "+this.expression.toString();return s};yy.SetVariable.prototype.execute=function(databaseid,params,cb){if(typeof this.value!="undefined"){var val=this.value;if(val=="ON")val=true;else if(val=="OFF")val=false;alasql.options[this.variable]=val}else if(this.expression){if(this.exists){this.existsfn=this.exists.map(function(ex){var nq=ex.compile(databaseid);if(nq.query&&!nq.query.modifier)nq.query.modifier="RECORDSET";return nq})}if(this.queries){this.queriesfn=this.queries.map(function(q){var nq=q.compile(databaseid);if(nq.query&&!nq.query.modifier)nq.query.modifier="RECORDSET";return nq})}var res=new Function("params,alasql","return "+this.expression.toJavaScript("({})","",null)).bind(this)(params,alasql);if(alasql.declares[this.variable]){res=alasql.stdfn.CONVERT(res,alasql.declares[this.variable])}if(this.props&&this.props.length>0){if(this.method=="@"){var fs="alasql.vars['"+this.variable+"']"}else{var fs="params['"+this.variable+"']"}fs+=this.props.map(function(prop){if(typeof prop=="string"){return"['"+prop+"']"}else if(typeof prop=="number"){return"["+prop+"]"}else{return"["+prop.toJavaScript()+"]"}}).join();new Function("value,params,alasql","var y;"+fs+"=value")(res,params,alasql)}else{if(this.method=="@"){alasql.vars[this.variable]=res}else{params[this.variable]=res}}}var res=1;if(cb)res=cb(res);return res};alasql.test=function(name,times,fn){if(arguments.length==0){alasql.log(alasql.con.results);return}else if(arguments.length==1){var tm=Date.now();fn();alasql.con.log(Date.now()-tm);return}if(arguments.length==2){fn=times;times=1}var tm=Date.now();for(var i=0;i",sql);if(res instanceof Array){if(console.table){console.table(res)}else{console.log(JSONtoString(res))}}else{console.log(JSONtoString(res))}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}var s="";if(typeof sql=="string"&&alasql.options.logprompt){s+="
"+alasql.pretty(sql)+"
"}if(res instanceof Array){if(res.length==0){s+="

[ ]

"}else if(typeof res[0]!="object"||res[0]instanceof Array){for(var i=0,ilen=res.length;i"+loghtml(res[i])+"

"}}else{s+=loghtml(res)}}else{s+=loghtml(res)}el.innerHTML+=s}};alasql.clear=function(){var target=alasql.options.logtarget;if(typeof exports=="object"){target="console"}if(target=="console"||typeof exports=="object"){if(console.clear){console.clear()}else{}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}el.innerHTML=""}};alasql.write=function(s){var target=alasql.options.logtarget;if(typeof exports=="object"){target="console"}if(target=="console"||typeof exports=="object"){if(console.log){console.log(s)}else{}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}el.innerHTML+=s}};function loghtml(res){var s="";if(typeof res=="undefined"){s+="undefined"}else if(res instanceof Array){s+="";s+="";var cols=[];for(colid in res[0]){cols.push(colid)}s+="
#";cols.forEach(function(colid){s+=""+colid});for(var i=0,ilen=res.length;i"+(i+1);cols.forEach(function(colid){s+=" ";if(+res[i][colid]==+res[i][colid]){s+='
';if(typeof res[i][colid]=="undefined")s+="NULL";else s+=res[i][colid];s+="
"}else{if(typeof res[i][colid]=="undefined"){s+="NULL"}else if(typeof res[i][colid]=="string"){s+=res[i][colid]}else s+=JSONtoString(res[i][colid])}})}s+="
"}else{s+="

"+JSONtoString(res)+"

"}return s}function scrollTo(element,to,duration){if(duration<=0)return;var difference=to-element.scrollTop;var perTick=difference/duration*10;setTimeout(function(){if(element.scrollTop==to)return;element.scrollTop=element.scrollTop+perTick;scrollTo(element,to,duration-10)},10)}alasql.prompt=function(el,useidel,firstsql){if(typeof exports=="object"){throw new Error("The functionality of prompt is not realized for Node.js")}var prompti=0;if(typeof el=="string")el=document.getElementById(el);if(typeof useidel=="string")useidel=document.getElementById(useidel);useidel.textContent=alasql.useid;if(firstsql){alasql.prompthistory.push(firstsql);prompti=alasql.prompthistory.length;try{var tm=Date.now();alasql.log(firstsql);alasql.write('

'+(Date.now()-tm)+" ms

")}catch(err){alasql.write("

"+olduseid+"> "+sql+"

");alasql.write('

'+err+"

")}}var y=el.getBoundingClientRect().top+document.getElementsByTagName("body")[0].scrollTop;scrollTo(document.getElementsByTagName("body")[0],y,500);el.onkeydown=function(event){if(event.which==13){var sql=el.value;var olduseid=alasql.useid;el.value="";alasql.prompthistory.push(sql);prompti=alasql.prompthistory.length;try{var tm=Date.now();alasql.log(sql);alasql.write('

'+(Date.now()-tm)+" ms

")}catch(err){alasql.write("

"+olduseid+"> "+alasql.pretty(sql,false)+"

");alasql.write('

'+err+"

")}el.focus();useidel.textContent=alasql.useid;var y=el.getBoundingClientRect().top+document.getElementsByTagName("body")[0].scrollTop;scrollTo(document.getElementsByTagName("body")[0],y,500)}else if(event.which==38){prompti--;if(prompti<0)prompti=0;if(alasql.prompthistory[prompti]){el.value=alasql.prompthistory[prompti];event.preventDefault()}}else if(event.which==40){prompti++;if(prompti>=alasql.prompthistory.length){prompti=alasql.prompthistory.length;el.value=""}else if(alasql.prompthistory[prompti]){el.value=alasql.prompthistory[prompti];event.preventDefault()}}}};yy.BeginTransaction=function(params){return yy.extend(this,params)};yy.BeginTransaction.prototype.toString=function(){return K("BEGIN")+" "+K("TRANSACTION")};yy.BeginTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[alasql.useid].engineid].begin(databaseid,cb)}else{}if(cb)cb(res);return res};yy.CommitTransaction=function(params){return yy.extend(this,params)};yy.CommitTransaction.prototype.toString=function(){return K("COMMIT")+" "+K("TRANSACTION")};yy.CommitTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[alasql.useid].engineid].commit(databaseid,cb)}else{}if(cb)cb(res);return res};yy.RollbackTransaction=function(params){return yy.extend(this,params)};yy.RollbackTransaction.prototype.toString=function(){return K("ROLLBACK")+" "+K("TRANSACTION")};yy.RollbackTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[databaseid].engineid].rollback(databaseid,cb)}else{}if(cb)cb(res);return res};if(alasql.options.tsql){alasql.stdfn.OBJECT_ID=function(name,type){if(typeof type=="undefined")type="T";type=type.toUpperCase();var sname=name.split(".");var dbid=alasql.useid;var objname=sname[0];if(sname.length==2){dbid=sname[0];objname=sname[1]}var tables=alasql.databases[dbid].tables;dbid=alasql.databases[dbid].databaseid;for(var tableid in tables){if(tableid==objname){if(tables[tableid].view&&type=="V")return dbid+"."+tableid;if(!tables[tableid].view&&type=="T")return dbid+"."+tableid;return undefined}}return undefined}}if(alasql.options.mysql){}if(alasql.options.mysql||alasql.options.sqlite){alasql.from.INFORMATION_SCHEMA=function(filename,opts,cb,idx,query){if(filename=="VIEWS"||filename=="TABLES"){var res=[];for(var databaseid in alasql.databases){var tables=alasql.databases[databaseid].tables;for(var tableid in tables){if(tables[tableid].view&&filename=="VIEWS"||!tables[tableid].view&&filename=="TABLES"){res.push({TABLE_CATALOG:databaseid,TABLE_NAME:tableid})}}}if(cb)res=cb(res,idx,query);return res}throw new Error("Unknown INFORMATION_SCHEMA table")}}if(alasql.options.postgres){}if(alasql.options.oracle){}if(alasql.options.sqlite){}alasql.into.SQL=function(filename,opts,data,columns,cb){var res;if(typeof filename=="object"){opts=filename;filename=undefined}var opt={};alasql.utils.extend(opt,opts);if(typeof opt.tableid=="undefined"){throw new Error("Table for INSERT TO is not defined.")}var s="";if(columns.length==0){if(typeof data[0]=="object"){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}else{}}for(var i=0,ilen=data.length;i0){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}if(typeof filename=="object"){opts=filename;filename=undefined}var res=data.length;var s="";if(data.length>0){var key=columns[0].columnid;s+=data.map(function(d){return d[key]}).join("\n")}res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res};alasql.into.TAB=alasql.into.TSV=function(filename,opts,data,columns,cb){var opt={};alasql.utils.extend(opt,opts);opt.separator=" ";return alasql.into.CSV(filename,opt,data,columns,cb)};alasql.into.CSV=function(filename,opts,data,columns,cb){if(columns.length==0&&data.length>0){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}if(typeof filename=="object"){opts=filename;filename=undefined}var opt={};opt.separator=",";opt.quote='"';alasql.utils.extend(opt,opts);var res=data.length;var s="";if(opt.headers){s+=columns.map(function(col){return col.columnid}).join(opt.separator)+"\n"}data.forEach(function(d,idx){s+=columns.map(function(col){var s=d[col.columnid];s=(s+"").replace(new RegExp("\\"+opt.quote,"g"),'""');if((s+"").indexOf(opt.separator)>-1||(s+"").indexOf(opt.quote)>-1)s=opt.quote+s+opt.quote;return s}).join(opt.separator)+"\n"});res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res};alasql.into.XLS=function(filename,opts,data,columns,cb){if(typeof filename=="object"){opts=filename;filename=undefined}var sheets={};if(opts&&opts.sheets){sheets=opts.sheets}var sheet={};if(typeof sheets["Sheet1"]!="undefined"){sheet=sheets[0]}else{if(typeof opts!="undefined"){sheet=opts}}if(typeof sheet.sheetid=="undefined"){sheet.sheetid="Sheet1"}var s=toHTML();var res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res;function toHTML(){var s=' ";s+="";s+="";if(typeof sheet.caption!="undefined"){var caption=sheet.caption;if(typeof caption=="string"){caption={title:caption}}s+=""}if(typeof sheet.columns!="undefined"){columns=sheet.columns}else{if(columns.length==0&&data.length>0){if(typeof data[0]=="object"){if(data[0]instanceof Array){columns=data[0].map(function(d,columnidx){return{columnid:columnidx}})}else{columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}}}}columns.forEach(function(column,columnidx){if(typeof sheet.column!="undefined"){extend(column,sheet.column)}if(typeof column.width=="undefined"){if(sheet.column&&sheet.column.width!="undefined"){column.width=sheet.column.width}else{column.width="120px"}}if(typeof column.width=="number")column.width=column.width+"px";if(typeof column.columnid=="undefined")column.columnid=columnidx;if(typeof column.title=="undefined")column.title=""+column.columnid;if(sheet.headers&&sheet.headers instanceof Array)column.title=sheet.headers[idx]});s+="";columns.forEach(function(column){s+=''});s+="";if(sheet.headers){s+="";s+="";columns.forEach(function(column,columnidx){s+="";s+=""}s+="";if(data&&data.length>0){data.forEach(function(row,rowidx){if(rowidx>sheet.limit)return;s+=""});s+=""})}s+="";s+="
"});s+="
";s+="";s+="";return s}function style(a){var s=' style="';if(a&&typeof a.style!="undefined"){s+=a.style+";"}s+='" ';return s}};alasql.into.XLSXML=function(filename,opts,data,columns,cb){if(typeof filename=="object"){opts=filename;filename=undefined}var sheets={};if(opts&&opts.sheets){sheets=opts.sheets}else{sheets.Sheet1=opts}var res=alasql.utils.saveFile(filename,toXML());if(cb)res=cb(res);return res;function toXML(){var s1=' 0 ';var s2="";var s3=" ";var styles={};var stylesn=62;function hstyle(st){var s="";for(var key in st){s+="<"+key;for(var attr in st[key]){s+=" ";if(attr.substr(0,2)=="x:"){s+=attr}else{s+="ss:"}s+=attr+'="'+st[key][attr]+'"'}s+="/>"}var hh=hash(s);if(styles[hh]){}else{styles[hh]={styleid:stylesn};s2+='";stylesn++}return"s"+styles[hh].styleid}for(var sheetid in sheets){var sheet=sheets[sheetid];if(typeof sheet.columns!="undefined"){columns=sheet.columns}else{if(columns.length==0&&data.length>0){if(typeof data[0]=="object"){if(data[0]instanceof Array){columns=data[0].map(function(d,columnidx){return{columnid:columnidx}})}else{columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}}}}columns.forEach(function(column,columnidx){if(typeof sheet.column!="undefined"){extend(column,sheet.column)}if(typeof column.width=="undefined"){if(sheet.column&&typeof sheet.column.width!="undefined"){column.width=sheet.column.width}else{column.width=120}}if(typeof column.width=="number")column.width=column.width;if(typeof column.columnid=="undefined")column.columnid=columnidx;if(typeof column.title=="undefined")column.title=""+column.columnid;if(sheet.headers&&sheet.headers instanceof Array)column.title=sheet.headers[idx]});s3+=' ';columns.forEach(function(column,columnidx){s3+=''});if(sheet.headers){s3+='';columns.forEach(function(column,columnidx){s3+="';if(typeof column.title!="undefined"){if(typeof column.title=="function"){s3+=column.title(sheet,column,columnidx)}else{s3+=column.title}}s3+=""});s3+=""}if(data&&data.length>0){data.forEach(function(row,rowidx){if(rowidx>sheet.limit)return;var srow={};extend(srow,sheet.row);if(sheet.rows&&sheet.rows[rowidx]){extend(srow,sheet.rows[rowidx])}s3+="";columns.forEach(function(column,columnidx){var cell={};extend(cell,sheet.cell);extend(cell,srow.cell);if(typeof sheet.column!="undefined"){extend(cell,sheet.column.cell)}extend(cell,column.cell);if(sheet.cells&&sheet.cells[rowidx]&&sheet.cells[rowidx][columnidx]){extend(cell,sheet.cells[rowidx][columnidx])}var value=row[column.columnid];if(typeof cell.value=="function"){value=cell.value(value,sheet,row,column,cell,rowidx,columnidx)}var typeid=cell.typeid;if(typeof typeid=="function"){typeid=typeid(value,sheet,row,column,cell,rowidx,columnidx)}if(typeof typeid=="undefined"){if(typeof value=="number")typeid="number";else if(typeof value=="string")typeid="string";else if(typeof value=="boolean")typeid="boolean";else if(typeof value=="object"){if(value instanceof Date)typeid="date"}}var Type="String";if(typeid=="number")Type="Number";else if(typeid=="date")Type="Date";var typestyle="";if(typeid=="money"){typestyle='mso-number-format:"\\#\\,\\#\\#0\\\\ _р_\\.";white-space:normal;'}else if(typeid=="number"){typestyle=" "}else if(typeid=="date"){typestyle='mso-number-format:"Short Date";'}else{if(opts.types&&opts.types[typeid]&&opts.types[typeid].typestyle){typestyle=opts.types[typeid].typestyle}}typestyle=typestyle||'mso-number-format:"\\@";';s3+="";s3+='';var format=cell.format;if(typeof value=="undefined"){s3+=""}else if(typeof format!="undefined"){if(typeof format=="function"){s3+=format(value)}else if(typeof format=="string"){s3+=value}else{throw new Error("Unknown format type. Should be function or string")}}else{if(typeid=="number"||typeid=="date"){s3+=value.toString()}else if(typeid=="money"){s3+=(+value).toFixed(2)}else{s3+=value}}s3+=""});s3+=""})}s3+="
"}s3+="
";return s1+s2+s3}};alasql.into.XLSX=function(filename,opts,data,columns,cb){var res=1;if(deepEqual(columns,[{columnid:"_"}])){data=data.map(function(dat){return dat._});columns=undefined}else{}if(typeof exports=="object"){var XLSX=require("xlsx")}else{var XLSX=window.XLSX}if(typeof filename=="object"){opts=filename;filename=undefined}var wb={SheetNames:[],Sheets:{}};if(opts.sourcefilename){alasql.utils.loadBinaryFile(opts.sourcefilename,!!cb,function(data){wb=XLSX.read(data,{type:"binary"});doExport()})}else{doExport()}if(cb)res=cb(res);return res;function doExport(){if(typeof opts=="object"&&opts instanceof Array){if(data&&data.length>0){data.forEach(function(dat,idx){prepareSheet(opts[idx],dat,undefined,idx+1)})}}else{prepareSheet(opts,data,columns,{},1)}saveWorkbook(cb)}function prepareSheet(opts,data,columns,idx){var opt={sheetid:"Sheet"+idx,headers:true};alasql.utils.extend(opt,opts);if((!columns||columns.length==0)&&data.length>0){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}var cells={};if(wb.SheetNames.indexOf(opt.sheetid)>-1){cells=wb.Sheets[opt.sheetid]}else{wb.SheetNames.push(opt.sheetid);wb.Sheets[opt.sheetid]={};cells=wb.Sheets[opt.sheetid]}var range="A1";if(opt.range)range=opt.range;var col0=alasql.utils.xlscn(range.match(/[A-Z]+/)[0]);var row0=+range.match(/[0-9]+/)[0]-1;if(wb.Sheets[opt.sheetid]["!ref"]){var rangem=wb.Sheets[opt.sheetid]["!ref"];var colm=alasql.utils.xlscn(rangem.match(/[A-Z]+/)[0]);var rowm=+rangem.match(/[0-9]+/)[0]-1}else{var colm=1,rowm=1}var colmax=Math.max(col0+columns.length,colm);var rowmax=Math.max(row0+data.length+2,rowm);var i=row0+1;wb.Sheets[opt.sheetid]["!ref"]="A1:"+alasql.utils.xlsnc(colmax)+rowmax;if(opt.headers){columns.forEach(function(col,idx){cells[alasql.utils.xlsnc(col0+idx)+""+i]={v:col.columnid}});i++}for(var j=0;j>>8^CRC_TABLE[offset]}return crc^-1}function pack(items){var data=arguments,idx=0,buffer,bufferSize=0;items=items.split("");items.forEach(function(type){if(type=="v"){bufferSize+=2}else if(type=="V"||type=="l"){bufferSize+=4}});buffer=new Buffer(bufferSize);items.forEach(function(type,index){if(type=="v"){buffer.writeUInt16LE(data[index+1],idx);idx+=2}else if(type=="V"){buffer.writeUInt32LE(data[index+1],idx);idx+=4}else if(type=="l"){buffer.writeInt32LE(data[index+1],idx);idx+=4}});return buffer}function normalizeZipPath(zipPath){return zipPath.replace(/\\/g,"/").replace(/^\/|\/$/g,"")}this.addEntry=function(entry){entry.path=normalizeZipPath(entry.path);entries.push(entry)};this.addDir=function(zipPath,localPath){this.addEntry({path:zipPath,file:localPath,isFile:false})};this.addData=function(zipPath,data){if(!Buffer.isBuffer(data)){data=new Buffer(data)}this.addEntry({path:zipPath,data:data})};function buildZipBuffer(){var buffers=[];var length=0;function append(buf){if(typeof buf=="string"){buf=new Buffer(buf)}buffers.push(buf);length+=buf.length}entries.forEach(function(entry){var mtime,mdate;entry.extra=entry.extra||"";entry.comment=entry.comment||"";entry.cmethod=0;mtime=entry.mtime;mdate=entry.mdate;if(entry.mtime instanceof Date){mtime=entry.mtime.getHours();mtime=mtime<<6;mtime=mtime|entry.mtime.getMinutes();mtime=mtime<<5;mtime=mtime|entry.mtime.getSeconds()/2;mdate=entry.mtime.getFullYear()-1980;mdate=mdate<<4;mdate=mdate|entry.mtime.getMonth()+1;mdate=mdate<<5;mdate=mdate|entry.mtime.getDate()}var fileName=entry.path;if(!entry.isFile&&fileName.charAt(fileName.length-1)!="/"){entry.path=fileName=fileName+"/"}entry.offset=length;append(pack("VvvvvvlVVvv",67324752,20,2,entry.cmethod,mtime,mdate,entry.crc32,entry.csize,entry.size,fileName.length,entry.extra.length));append(fileName);append(entry.extra);append(entry.data);entry.mtime=mtime;entry.mdate=mdate;entry.eattr=entry.isFile?32:48});var startOffset=length;var centralDirSize=0;entries.forEach(function(entry){append(pack("VvvvvvvlVVvvvvvVV",33639248,20,20,2,entry.cmethod,entry.mtime,entry.mdate,entry.crc32,entry.csize,entry.size,entry.path.length,entry.extra.length,entry.comment.length,0,0,entry.eattr,entry.offset));append(entry.path);append(entry.extra);append(entry.comment);centralDirSize+=46+entry.path.length+entry.extra.length+entry.comment.length});var comment="";append(pack("VvvvvVVv",101010256,0,0,entries.length,entries.length,centralDirSize,startOffset,comment.length));append(comment);var buffer=Buffer.concat(buffers);return buffer}this.toBuffer=function(callback){var index=-1;function deflateNext(){var data;var entry=entries[++index];if(entry){entry.csize=entry.size=entry.crc32=0;data=entry.data=entry.data?entry.data:new Buffer(0);entry.mtime=new Date;if(entry.isFile!==false){entry.crc32=calculateCrc32(data);entry.isFile=true;entry.size=data.length;entry.csize=entry.size;deflateNext()}else{deflateNext()}}else{callback(buildZipBuffer())}}deflateNext()}};alasql.from.METEOR=function(filename,opts,cb,idx,query){var res=filename.find(opts).fetch();if(cb)res=cb(res,idx,query);return res};alasql.from.TABLETOP=function(key,opts,cb,idx,query){var res=[];var opt={headers:true,simpleSheet:true,key:key};alasql.utils.extend(opt,opts);opt.callback=function(data){res=data;if(cb)res=cb(res,idx,query)};Tabletop.init(opt);return res};alasql.from.HTML=function(selector,opts,cb,idx,query){var opt={};alasql.utils.extend(opt,opts);var sel=document.querySelector(selector);if(!sel&&sel.tagName!="TABLE"){throw new Error("Selected HTML element is not a TABLE")}var res=[];var headers=opt.headers;if(headers&&!(headers instanceof Array)){headers=[];var ths=sel.querySelector("thead tr").children;for(var i=0;i=N)return EOF;if(eol)return eol=false,EOL;var j=I;if(text.charCodeAt(j)===quoteCode){var i=j;while(i++/g,"");return document();function document(){return{declaration:declaration(),root:tag()}}function declaration(){var m=match(/^<\?xml\s*/);if(!m)return;var node={attributes:{}};while(!(eos()||is("?>"))){var attr=attribute();if(!attr)return node;node.attributes[attr.name]=attr.value}match(/\?>\s*/);return node}function tag(){var m=match(/^<([\w-:.]+)\s*/);if(!m)return;var node={name:m[1],attributes:{},children:[]};while(!(eos()||is(">")||is("?>")||is("/>"))){var attr=attribute();if(!attr)return node;node.attributes[attr.name]=attr.value}if(match(/^\s*\/>\s*/)){return node}match(/\??>\s*/);node.content=content();var child;while(child=tag()){node.children.push(child)}match(/^<\/[\w-:.]+>\s*/);return node}function content(){var m=match(/^([^<]*)/);if(m)return m[1];return""}function attribute(){var m=match(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(!m)return;return{name:m[1],value:strip(m[2])}}function strip(val){return val.replace(/^['"]|['"]$/g,"")}function match(re){var m=xml.match(re);if(!m)return;xml=xml.slice(m[0].length);return m}function eos(){return 0==xml.length}function is(prefix){return 0==xml.indexOf(prefix)}}alasql.from.GEXF=function(filename,opts,cb,idx,query){var res;alasql("SEARCH FROM XML("+filename+")",[],function(data){res=data;console.log(res);if(cb)res=cb(res)});return res};yy.Help=function(params){return yy.extend(this,params)};yy.Help.prototype.toString=function(){var s=K("HELP");if(this.subject)s+=" "+L(this.subject);return s};helpdocs=[{command:"ALTER TABLE table RENAME TO table"},{command:"ALTER TABLE table ADD COLUMN column coldef"},{command:"ALTER TABLE table MODIFY COLUMN column coldef"},{command:"ALTER TABLE table RENAME COLUMN column TO column"},{command:"ALTER TABLE table DROP column"},{command:"ATTACH engine DATABASE database"},{command:"ASSERT value"},{command:"BEGIN [TRANSACTION]"},{command:"COMMIT [TRANSACTION]"},{command:"CREATE [engine] DATABASE [IF NOT EXISTS] database"},{command:"CREATE TABLE [IF NOT EXISTS] table (column definitions)"},{command:"DELETE FROM table [WHERE expression]"},{command:"DETACH DATABASE database"},{command:"DROP [engine] DATABASE [IF EXISTS] database"},{command:"DROP TABLE [IF EXISTS] table"},{command:"INSERT INTO table VALUES value,..."},{command:"INSERT INTO table DEFAULT VALUES"},{command:"INSERT INTO table SELECT select"},{command:"HELP [subject]"},{command:"ROLLBACK [TRANSACTION]"},{command:"SELECT [modificator] columns [INTO table] [FROM table,...] [[mode] JOIN [ON] [USING]] [WHERE ] [GROUP BY] [HAVING] [ORDER BY] "},{command:"SET option value"},{command:"SHOW [engine] DATABASES"},{command:"SHOW TABLES"},{command:"SHOW CREATE TABLE table"},{command:"UPDATE table SET column1 = expression1, ... [WHERE expression]"},{command:"USE [DATABASE] database"},{command:"expression"},{command:'See also http://github/agershun/alasq for more information'}];yy.Help.prototype.execute=function(databaseid,params,cb){var ss=[];if(!this.subject){ss=helpdocs}else{ss.push('See also http://github/agershun/alasq for more information')}if(cb)ss=cb(ss);return ss};yy.Print=function(params){return yy.extend(this,params)};yy.Print.prototype.toString=function(){var s=K("PRINT");if(this.statement)s+=" "+this.statement.toString();return s};yy.Print.prototype.execute=function(databaseid,params,cb){var self=this;var res=1;alasql.precompile(this,databaseid,params);if(this.exprs&&this.exprs.length>0){var rs=this.exprs.map(function(expr){var exprfn=new Function("params,alasql,p","var y;return "+expr.toJavaScript("({})","",null)).bind(self);var r=exprfn(params,alasql);return JSONtoString(r)});console.log.apply(console,rs)}else if(this.select){var r=this.select.execute(databaseid,params);console.log(JSONtoString(r))}else{console.log()}if(cb)res=cb(res);return res};yy.Source=function(params){return yy.extend(this,params)};yy.Source.prototype.toString=function(){var s=K("SOURCE");if(this.url)s+=" "+S("'"+this.url+"'");return s};yy.Source.prototype.execute=function(databaseid,params,cb){var res;loadFile(this.url,!!cb,function(data){res=alasql(data);if(cb)res=cb(res);return res},function(err){throw err});return res};yy.Require=function(params){return yy.extend(this,params)};yy.Require.prototype.toString=function(){var s=K("REQUIRE");if(this.paths&&this.paths.length>0){s+=this.paths.map(function(path){return path.toString()}).join(",")}if(this.plugins&&this.plugins.length>0){s+=this.plugins.map(function(plugin){return plugin.toUpperCase() +}).join(",")}return s};yy.Require.prototype.execute=function(databaseid,params,cb){var self=this;var res=0;var ss="";if(this.paths&&this.paths.length>0){this.paths.forEach(function(path){loadFile(path.value,!!cb,function(data){res++;ss+=data;if(res0){this.plugins.forEach(function(plugin){if(!alasql.plugins[plugin]){loadFile(alasql.path+"/alasql-"+plugin.toLowerCase()+".js",!!cb,function(data){res++;ss+=data;if(res0){res=res.filter(function(d){return d.databaseid.match(relike)})}}if(cb)cb(res);return res};LS.createTable=function(databaseid,tableid,ifnotexists,cb){var lsdbid=alasql.databases[databaseid].lsdbid;var tb=LS.get(lsdbid+"."+tableid);var res=1;if(tb&&!ifnotexists){throw new Error('Table "'+tableid+'" alsready exists in localStorage database "'+lsdbid+'"')}var lsdb=LS.get(lsdbid);var table=alasql.databases[databaseid].tables[tableid];lsdb.tables[tableid]={columns:table.columns};LS.set(lsdbid,lsdb);LS.set(lsdbid+"."+tableid,[]);if(cb)cb(res);return res};LS.dropTable=function(databaseid,tableid,ifexists,cb){var res=1;var lsdbid=alasql.databases[databaseid].lsdbid;if(alasql.options.autocommit){var lsdb=LS.get(lsdbid)}else{var lsdb=alasql.databases[databaseid]}if(!ifexists&&!lsdb.tables[tableid]){throw new Error('Cannot drop table "'+tableid+'" in localStorage, because it does not exist')}delete lsdb.tables[tableid];LS.set(lsdbid,lsdb);localStorage.removeItem(lsdbid+"."+tableid);if(cb)cb(res);return res};LS.fromTable=function(databaseid,tableid,cb,idx,query){var lsdbid=alasql.databases[databaseid].lsdbid;var res=LS.get(lsdbid+"."+tableid);if(cb)res=cb(res,idx,query);return res};LS.intoTable=function(databaseid,tableid,value,columns,cb){var lsdbid=alasql.databases[databaseid].lsdbid;var res=value.length;var tb=LS.get(lsdbid+"."+tableid);if(!tb)tb=[];tb=tb.concat(value);LS.set(lsdbid+"."+tableid,tb);if(cb)cb(res);return res};LS.loadTableData=function(databaseid,tableid){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;db.tables[tableid].data=LS.get(lsdbid+"."+tableid)};LS.saveTableData=function(databaseid,tableid){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;LS.set(lsdbid+"."+tableid,db.tables[tableid].data);db.tables[tableid].data=null};LS.commit=function(databaseid,cb){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;var lsdb={databaseid:lsdbid,tables:{}};if(db.tables){for(var tbid in db.tables){lsdb.tables[tbid]={columns:db.tables[tbid].columns};LS.set(lsdbid+"."+tbid,db.tables[tbid].data)}}LS.set(lsdbid,lsdb);return 1};LS.begin=LS.commit;LS.rollback=function(databaseid,cb){var db=alasql.databases[databaseid];db.dbversion++;var lsdbid=alasql.databases[databaseid].lsdbid;var lsdb=LS.get(lsdbid);if(lsdb.tables){for(var tbid in lsdb.tables){var tb=new alasql.Table({columns:db.tables[tbid].columns});extend(tb,lsdb.tables[tbid]);lsdb.tables[tbid]=tb;if(!alasql.options.autocommit){lsdb.tables[tbid].data=LS.get(db.lsdbid+"."+tbid)}lsdb.tables[tbid].indexColumns()}}delete alasql.databases[databaseid];alasql.databases[databaseid]=new alasql.Database(databaseid);extend(alasql.databases[databaseid],lsdb);alasql.databases[databaseid].databaseid=databaseid;alasql.databases[databaseid].engineid="LOCALSTORAGE"};var SQLITE=alasql.engines.SQLITE=function(){};SQLITE.createDatabase=function(wdbid,args,ifnotexists,dbid,cb){throw new Error("Connot create SQLITE database in memory. Attach it.")};SQLITE.dropDatabase=function(databaseid){throw new Error("This is impossible to drop SQLite database. Detach it.")};SQLITE.attachDatabase=function(sqldbid,dbid,args,params,cb){var res=1;if(alasql.databases[dbid]){throw new Error('Unable to attach database as "'+dbid+'" because it already exists')}if(args[0]&&args[0]instanceof yy.StringValue||args[0]instanceof yy.ParamValue){if(args[0]instanceof yy.StringValue){var value=args[0].value}else if(args[0]instanceof yy.ParamValue){var value=params[args[0].param]}alasql.utils.loadBinaryFile(value,true,function(data){var db=new alasql.Database(dbid||sqldbid);db.engineid="SQLITE";db.sqldbid=sqldbid;var sqldb=db.sqldb=new SQL.Database(data);db.tables=[];var tables=sqldb.exec("SELECT * FROM sqlite_master WHERE type='table'")[0].values;tables.forEach(function(tbl){db.tables[tbl[1]]={};var columns=db.tables[tbl[1]].columns=[];var ast=alasql.parse(tbl[4]);var coldefs=ast.statements[0].columns;if(coldefs&&coldefs.length>0){coldefs.forEach(function(cd){columns.push(cd)})}});cb(1)},function(err){throw new Error('Cannot open SQLite database file "'+args[0].value+'"')});return res}else{throw new Error("Cannot attach SQLite database without a file")}return res};SQLITE.fromTable=function(databaseid,tableid,cb,idx,query){var data=alasql.databases[databaseid].sqldb.exec("SELECT * FROM "+tableid);var columns=query.sources[idx].columns=[];if(data[0].columns.length>0){data[0].columns.forEach(function(columnid){columns.push({columnid:columnid})})}var res=[];if(data[0].values.length>0){data[0].values.forEach(function(d){var r={};columns.forEach(function(col,idx){r[col.columnid]=d[idx]});res.push(r)})}if(cb)cb(res,idx,query)};SQLITE.intoTable=function(databaseid,tableid,value,columns,cb){var sqldb=alasql.databases[databaseid].sqldb;for(var i=0,ilen=value.length;i1){var sql="REQUIRE "+paths.map(function(p){return'"'+p+'"'}).join(",");alasql(sql,[],cb)}}else if(path===false){delete alasql.webworker;return}}} \ No newline at end of file diff --git a/dist/alasql.d.ts b/dist/alasql.d.ts new file mode 100644 index 0000000000..018beb2e4c --- /dev/null +++ b/dist/alasql.d.ts @@ -0,0 +1,54 @@ +// Type definitions for alasql.js v.0.1.8 +// Project: https://github.com/agershun/alasql +// Definitions by: Andrey Gershun +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +interface AlaSQLCallback { + (data?:any,err?:Error):void +} + +interface AlaSQLOptions { + errorlog: boolean; + valueof :boolean + dropifnotexists :boolean; // DROP database in any case + datetimeformat :string; // How to handle DATE and DATETIME types + casesensitive :boolean; // Table and column names are case sensitive and converted to lower-case + logtarget :string; // target for log. Values: 'console', 'output', 'id' of html tag + logprompt :boolean; // Print SQL at log + modifier :any; // values: RECORDSET, VALUE, ROW, COLUMN, MATRIX, TEXTSTRING, INDEX + columnlookup:number; // How many rows to lookup to define columns + autovertex:boolean;// Create vertex if not found + usedbo:boolean; // Use dbo as current database (for partial T-SQL comaptibility) + autocommit:boolean; // AUTOCOMMIT ON | OFF + cache:boolean; // Use cache + nocount:boolean;// for SET NOCOUNT OFF + nan:boolean;// Check for NaN and convert it to undefined + angularjs :boolean; + tsql:boolean; + mysql:boolean; + postgres:boolean; + oracle:boolean; + sqlite:boolean; + orientdb:boolean; +} + +// Compiled Statement +interface AlaSQLStatement { + (params?:any,cb?:AlaSQLCallback,scope?:any):any; +} + +// Abstract Syntax Tree +interface AlaSQLAST { + compile(databaseid:string):AlaSQLStatement; +} + +interface AlaSQL { + (sql:any,params?:any,cb?:AlaSQLCallback,scope?:any):any; + parse(sql):AlaSQLAST; + options:AlaSQLOptions; + error: Error; +} + +declare var alasql : AlaSQL; + diff --git a/dist/alasql.js b/dist/alasql.js index 32bd62480d..7fabc49980 100644 --- a/dist/alasql.js +++ b/dist/alasql.js @@ -1,3 +1,4 @@ +/*! AlaSQL v0.1.9 (c) 2014-2015 Andrey Gershun | alasql.org/license */ /* @module alasql @version 0.1.8 @@ -125,7 +126,7 @@ var alasql = function alasql(sql, params, cb, scope) { Current version of alasql @constant {string} */ -alasql.version = "0.1.8"; +alasql.version = "0.1.9"; /** Debug flag @@ -10526,36 +10527,46 @@ alasql.stdfn.CONVERT = function(value, args) { } }; + var udbtypeid = args.dbtypeid.toUpperCase(); + if(args.dbtypeid == 'Date') { return new Date(val); - } else if(args.dbtypeid.toUpperCase() == 'DATE') { + } else if(udbtypeid == 'DATE') { var d = new Date(val); var s = d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2); return s; - } else if(args.dbtypeid == 'DATETIME') { + } else if(udbtypeid == 'DATETIME') { var d = new Date(val); var s = d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2); s += " "+("0"+d.getHours()).substr(-2)+":"+("0"+d.getMinutes()).substr(-2)+":"+("0"+d.getSeconds()).substr(-2); s += '.'+("00"+d.getMilliseconds()).substr(-3) return s; - } else if(args.dbtypeid.toUpperCase() == 'STRING') { - return ""+val; - } else if(args.dbtypeid.toUpperCase() == 'NUMBER' || args.dbtypeid == 'FLOAT') { + } else if(['NUMBER','FLOAT'].indexOf(udbtypeid)>-1) { return +val; - } else if(args.dbtypeid.toUpperCase() == 'MONEY') { + } else if(['MONEY'].indexOf(udbtypeid)>-1) { var m = +val; return (m|0)+((m*100)%100)/100; - } else if(args.dbtypeid.toUpperCase() == 'BOOLEAN') { + } else if(['BOOLEAN'].indexOf(udbtypeid)>-1) { return !!val; - } else if(args.dbtypeid.toUpperCase() == 'INT') { + } else if(['INT','INTEGER','SMALLINT','BIGINT','SERIAL','SMALLSERIAL','BIGSERIAL'].indexOf(args.dbtypeid.toUpperCase())>-1) { return val|0; - } else if(args.dbtypeid.toUpperCase() == 'VARCHAR' || args.dbtypeid == 'NVARCHAR') { + } else if(['STRING','VARCHAR','NVARCHAR', 'CHARACTER VARIABLE'].indexOf(args.dbtypeid.toUpperCase())>-1) { if(args.dbsize) return (""+val).substr(0,args.dbsize); else return ""+val; - } else if(args.dbtypeid.toUpperCase() == 'CHAR' || args.dbtypeid == 'NCHAR') { + } else if(['CHAR','CHARACTER', 'NCHAR'].indexOf(udbtypeid)>-1) { return (val+(new Array(args.dbsize+1).join(" "))).substr(0,args.dbsize); //else return ""+val.substr(0,1); - } + } else if(['DECIMAL','NUMERIC'].indexOf(udbtypeid)>-1) { + var m = +val; + var fxd = Math.pow(10,args.dbpecision); + return (m|0)+((m*fxd)%fxd)/fxd; + } else if(['JSON'].indexOf(udbtypeid)>-1) { + if(typeof val == 'object') return val; + try { + return JSON.parse(val); + } catch(err) { throw new Error('Cannot convert string to JSON');}; + }; + return val; }; @@ -10650,6 +10661,10 @@ yy.CreateTable.prototype.execute = function (databaseid, params, cb) { this.columns.forEach(function(col) { var dbtypeid = col.dbtypeid; if(!alasql.fn[dbtypeid]) dbtypeid = dbtypeid.toUpperCase(); + + // Process SERIAL data type like Postgress + if(['SERIAL','SMALLSERIAL','BIGSERIAL'].indexOf(dbtypeid)>-1) col.identity = {value:1,step:1}; + var newcol = { columnid: col.columnid, dbtypeid: dbtypeid, diff --git a/dist/alasql.min.js b/dist/alasql.min.js index 42aac82a40..a1cc1d1dcb 100644 --- a/dist/alasql.min.js +++ b/dist/alasql.min.js @@ -1,10 +1,10 @@ -(function(root,factory){if(typeof define==="function"&&define.amd){define([],factory)}else if(typeof exports==="object"){module.exports=factory()}else{root.alasql=factory()}})(this,function(){var alasql=function alasql(sql,params,cb,scope){if(typeof importScripts!="function"&&alasql.webworker){var id=alasql.lastid++;alasql.buffer[id]=cb;alasql.webworker.postMessage({id:id,sql:sql,params:params})}else{if(arguments.length==0){return new yy.Select({columns:[new yy.Column({columnid:"*"})],from:[new yy.ParamValue({param:0})]})}else if(arguments.length==1&&typeof sql=="object"&&sql instanceof Array){var select=new yy.Select({columns:[new yy.Column({columnid:"*"})],from:[new yy.ParamValue({param:0})]});select.preparams=[sql];return select}else{if(typeof sql=="string"&&sql[0]=="#"&&typeof document=="object"){sql=document.querySelector(sql).textContent}else if(typeof sql=="object"&&sql instanceof HTMElement){sql=sql.textContent}else if(typeof sql=="function"){sql=sql.toString().slice(14,-3)}return alasql.exec(sql,params,cb,scope)}}};alasql.version="0.1.8";alasql.debug=undefined;getAlaSQLPath();function getAlaSQLPath(){alasql.path="";if(typeof importScripts==="function"){alasql.path=""}else if(typeof exports!="undefined"){alasql.path=__dirname}else if(typeof Meteor=="object"&&Meteor.isClient){alasql.path="/packages/dist/"}else if(typeof Meteor=="object"&&Meteor.isServer){alasql.path="assets/packages/dist/"}else if(typeof document!="undefined"){var sc=document.getElementsByTagName("script");for(var i=0;i1&&($$[$0-4].toUpperCase()=="MAX"||$$[$0-4].toUpperCase()=="MIN")){this.$=new yy.FuncValue({funcid:$$[$0-4],args:$$[$0-2]})}else{this.$=new yy.AggrValue({aggregatorid:$$[$0-4].toUpperCase(),expression:$$[$0-2].pop(),over:$$[$0]})}break;case 299:this.$=new yy.AggrValue({aggregatorid:$$[$0-5].toUpperCase(),expression:$$[$0-2],distinct:true,over:$$[$0]});break;case 300:this.$=new yy.AggrValue({aggregatorid:$$[$0-5].toUpperCase(),expression:$$[$0-2],over:$$[$0]});break;case 302:case 303:this.$=new yy.Over;yy.extend(this.$,$$[$0-1]);break;case 304:this.$=new yy.Over;yy.extend(this.$,$$[$0-2]);yy.extend(this.$,$$[$0-1]);break;case 305:this.$={partition:$$[$0]};break;case 306:this.$={order:$$[$0]};break;case 307:this.$="SUM";break;case 308:this.$="COUNT";break;case 309:this.$="MIN";break;case 310:case 486:this.$="MAX";break;case 311:this.$="AVG";break;case 312:this.$="FIRST";break;case 313:this.$="LAST";break;case 314:this.$="AGGR";break;case 315:this.$="ARRAY";break;case 316:var funcid=$$[$0-4];var exprlist=$$[$0-1];if(exprlist.length>1&&(funcid.toUpperCase()=="MIN"||funcid.toUpperCase()=="MAX")){this.$=new yy.FuncValue({funcid:funcid,args:exprlist})}else if(alasql.aggr[$$[$0-4]]){this.$=new yy.AggrValue({aggregatorid:"REDUCE",funcid:funcid,expression:exprlist.pop(),distinct:$$[$0-2]=="DISTINCT"})}else{this.$=new yy.FuncValue({funcid:funcid,args:exprlist})};break;case 317:this.$=new yy.FuncValue({funcid:$$[$0-2]});break;case 319:$$[$0-2].push($$[$0]);this.$=$$[$0-2];break;case 320:this.$=new yy.NumValue({value:+$$[$0]});break;case 321:this.$=new yy.LogicValue({value:true});break;case 322:this.$=new yy.LogicValue({value:false});break;case 323:this.$=new yy.StringValue({value:$$[$0].substr(1,$$[$0].length-2).replace(/(\\\')/g,"'").replace(/(\'\')/g,"'")});break;case 324:this.$=new yy.StringValue({value:$$[$0].substr(2,$$[$0].length-3).replace(/(\\\')/g,"'").replace(/(\'\')/g,"'")});break;case 325:this.$=new yy.NullValue({value:undefined});break;case 326:this.$=new yy.VarValue({variable:$$[$0]});break;case 327:if(!yy.exists)yy.exists=[];this.$=new yy.ExistsValue({value:$$[$0-1],existsidx:yy.exists.length});yy.exists.push($$[$0-1]);break;case 328:case 329:this.$=new yy.ParamValue({param:$$[$0]});break;case 330:if(typeof yy.question=="undefined")yy.question=0;this.$=new yy.ParamValue({param:yy.question++});break;case 331:if(typeof yy.question=="undefined")yy.question=0;this.$=new yy.ParamValue({param:yy.question++,array:true});break;case 332:this.$=new yy.CaseValue({expression:$$[$0-3],whens:$$[$0-2],elses:$$[$0-1]});break;case 333:this.$=new yy.CaseValue({whens:$$[$0-2],elses:$$[$0-1]});break;case 334:case 635:case 636:this.$=$$[$0-1];this.$.push($$[$0]);break;case 336:this.$={when:$$[$0-2],then:$$[$0]};break;case 339:this.$=new yy.Op({left:$$[$0-2],op:"LIKE",right:$$[$0]});break;case 340:this.$=new yy.Op({left:$$[$0-2],op:"NOT LIKE",right:$$[$0]});break;case 341:this.$=new yy.Op({left:$$[$0-2],op:"+",right:$$[$0]});break;case 342:this.$=new yy.Op({left:$$[$0-2],op:"-",right:$$[$0]});break;case 343:this.$=new yy.Op({left:$$[$0-2],op:"*",right:$$[$0]});break;case 344:this.$=new yy.Op({left:$$[$0-2],op:"/",right:$$[$0]});break;case 345:this.$=new yy.Op({left:$$[$0-2],op:"%",right:$$[$0]});break;case 346:this.$=new yy.Op({left:$$[$0-2],op:"^",right:$$[$0]});break;case 347:case 348:case 350:this.$=new yy.Op({left:$$[$0-2],op:"->",right:$$[$0]});break;case 349:this.$=new yy.Op({left:$$[$0-4],op:"->",right:$$[$0-1]});break;case 351:case 352:case 354:this.$=new yy.Op({left:$$[$0-2],op:"!",right:$$[$0]});break;case 353:this.$=new yy.Op({left:$$[$0-4],op:"!",right:$$[$0-1]});break;case 355:this.$=new yy.Op({left:$$[$0-2],op:">",right:$$[$0]});break;case 356:this.$=new yy.Op({left:$$[$0-2],op:">=",right:$$[$0]});break;case 357:this.$=new yy.Op({left:$$[$0-2],op:"<",right:$$[$0]});break;case 358:this.$=new yy.Op({left:$$[$0-2],op:"<=",right:$$[$0]});break;case 359:this.$=new yy.Op({left:$$[$0-2],op:"=",right:$$[$0]});break;case 360:this.$=new yy.Op({left:$$[$0-2],op:"==",right:$$[$0]});break;case 361:this.$=new yy.Op({left:$$[$0-2],op:"===",right:$$[$0]});break;case 362:this.$=new yy.Op({left:$$[$0-2],op:"!=",right:$$[$0]});break;case 363:this.$=new yy.Op({left:$$[$0-2],op:"!==",right:$$[$0]});break;case 364:this.$=new yy.Op({left:$$[$0-2],op:"!===",right:$$[$0]});break;case 365:if(!yy.queries)yy.queries=[];this.$=new yy.Op({left:$$[$0-5],op:$$[$0-4],allsome:$$[$0-3],right:$$[$0-1],queriesidx:yy.queries.length});yy.queries.push($$[$0-1]);break;case 366:this.$=new yy.Op({left:$$[$0-5],op:$$[$0-4],allsome:$$[$0-3],right:$$[$0-1]});break;case 367:if($$[$0-2].op=="BETWEEN1"){if($$[$0-2].left.op=="AND"){this.$=new yy.Op({left:$$[$0-2].left.left,op:"AND",right:new yy.Op({left:$$[$0-2].left.right,op:"BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})})}else{this.$=new yy.Op({left:$$[$0-2].left,op:"BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})}}else if($$[$0-2].op=="NOT BETWEEN1"){if($$[$0-2].left.op=="AND"){this.$=new yy.Op({left:$$[$0-2].left.left,op:"AND",right:new yy.Op({left:$$[$0-2].left.right,op:"NOT BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})})}else{this.$=new yy.Op({left:$$[$0-2].left,op:"NOT BETWEEN",right1:$$[$0-2].right,right2:$$[$0]})}}else{this.$=new yy.Op({left:$$[$0-2],op:"AND",right:$$[$0]})}break;case 368:this.$=new yy.Op({left:$$[$0-2],op:"OR",right:$$[$0]});break;case 369:this.$=new yy.UniOp({op:"NOT",right:$$[$0]});break;case 370:this.$=new yy.UniOp({op:"-",right:$$[$0]});break;case 371:this.$=new yy.UniOp({op:"+",right:$$[$0]});break;case 372:this.$=new yy.UniOp({op:"#",right:$$[$0]});break;case 373:this.$=new yy.UniOp({right:$$[$0-1]});break;case 374:if(!yy.queries)yy.queries=[];this.$=new yy.Op({left:$$[$0-4],op:"IN",right:$$[$0-1],queriesidx:yy.queries.length});yy.queries.push($$[$0-1]);break;case 375:if(!yy.queries)yy.queries=[];this.$=new yy.Op({left:$$[$0-5],op:"NOT IN",right:$$[$0-1],queriesidx:yy.queries.length});yy.queries.push($$[$0-1]);break;case 376:this.$=new yy.Op({left:$$[$0-4],op:"IN",right:$$[$0-1]});break;case 377:this.$=new yy.Op({left:$$[$0-5],op:"NOT IN",right:$$[$0-1]});break;case 378:this.$=new yy.Op({left:$$[$0-3],op:"IN",right:[]});break;case 379:this.$=new yy.Op({left:$$[$0-4],op:"NOT IN",right:[]});break;case 380:case 382:this.$=new yy.Op({left:$$[$0-2],op:"IN",right:$$[$0]});break;case 381:case 383:this.$=new yy.Op({left:$$[$0-3],op:"NOT IN",right:$$[$0]});break;case 384:this.$=new yy.Op({left:$$[$0-2],op:"BETWEEN1",right:$$[$0]});break;case 385:this.$=new yy.Op({left:$$[$0-2],op:"NOT BETWEEN1",right:$$[$0]});break;case 386:this.$=new yy.Op({op:"IS",left:$$[$0-2],right:$$[$0]});break;case 387:this.$=new yy.Convert({expression:$$[$0-2]});yy.extend(this.$,$$[$0]);break;case 388:case 389:this.$=$$[$0];break;case 390:this.$=$$[$0-1];break;case 397:this.$="ALL";break;case 398:this.$="SOME";break;case 399:this.$="ANY";break;case 400:this.$=new yy.Update({table:$$[$0-4],columns:$$[$0-2],where:$$[$0]});break;case 401:this.$=new yy.Update({table:$$[$0-2],columns:$$[$0]});break;case 404:this.$=new yy.SetColumn({column:$$[$0-2],expression:$$[$0]});break;case 405:this.$=new yy.SetColumn({variable:$$[$0-2],expression:$$[$0],method:$$[$0-3]});break;case 406:this.$=new yy.Delete({table:$$[$0-2],where:$$[$0]});break;case 407:this.$=new yy.Delete({table:$$[$0]});break;case 408:this.$=new yy.Insert({into:$$[$0-2],values:$$[$0]});break;case 409:this.$=new yy.Insert({into:$$[$0-2],"default":true});break;case 410:this.$=new yy.Insert({into:$$[$0-5],columns:$$[$0-3],values:$$[$0]});break;case 411:this.$=new yy.Insert({into:$$[$0-1],select:$$[$0]});break;case 412:this.$=new yy.Insert({into:$$[$0-4],columns:$$[$0-2],select:$$[$0]});break;case 415:this.$=[$$[$0-1]];break;case 418:this.$=$$[$0-4];$$[$0-4].push($$[$0-1]);break;case 419:case 420:case 422:case 430:this.$=$$[$0-2];$$[$0-2].push($$[$0]);break;case 431:this.$=new yy.CreateTable({table:$$[$0-4]});yy.extend(this.$,$$[$0-7]);yy.extend(this.$,$$[$0-6]);yy.extend(this.$,$$[$0-5]);yy.extend(this.$,$$[$0-2]);yy.extend(this.$,$$[$0]);break;case 432:this.$=new yy.CreateTable({table:$$[$0]});yy.extend(this.$,$$[$0-3]);yy.extend(this.$,$$[$0-2]);yy.extend(this.$,$$[$0-1]);break;case 434:this.$={"class":true};break;case 443:this.$={temporary:true};break;case 445:this.$={ifnotexists:true};break;case 446:this.$={columns:$$[$0-2],constraints:$$[$0]};break;case 447:this.$={columns:$$[$0]};break;case 448:this.$={as:$$[$0]};break;case 449:case 473:this.$=[$$[$0]];break;case 451:case 452:case 453:case 454:case 455:$$[$0].constraintid=$$[$0-1];this.$=$$[$0];break;case 458:this.$={type:"CHECK",expression:$$[$0-1]};break;case 459:this.$={type:"PRIMARY KEY",columns:$$[$0-1],clustered:($$[$0-3]+"").toUpperCase()};break;case 460:this.$={type:"FOREIGN KEY",columns:$$[$0-5],fktable:$$[$0-2],fkcolumns:$$[$0-1]};break;case 461:case 491:case 522:case 558:case 576:case 579:case 598:this.$=$$[$0-1];break;case 466:this.$={type:"UNIQUE",columns:$$[$0-1],clustered:($$[$0-3]+"").toUpperCase()};break;case 475:this.$=new yy.ColumnDef({columnid:$$[$0-2]});yy.extend(this.$,$$[$0-1]);yy.extend(this.$,$$[$0]);break;case 476:this.$=new yy.ColumnDef({columnid:$$[$0-1]});yy.extend(this.$,$$[$0]);break;case 477:this.$=new yy.ColumnDef({columnid:$$[$0],dbtypeid:""});break;case 478:this.$={dbtypeid:$$[$0-5],dbsize:$$[$0-3],dbprecision:+$$[$0-1]};break;case 479:this.$={dbtypeid:$$[$0-6]+($$[$0-5]?" "+$$[$0-5]:""),dbsize:$$[$0-3],dbprecision:+$$[$0-1]};break;case 480:this.$={dbtypeid:$$[$0-3],dbsize:$$[$0-1]};break;case 481:this.$={dbtypeid:$$[$0-4]+($$[$0-3]?" "+$$[$0-3]:""),dbsize:$$[$0-1]};break;case 482:this.$={dbtypeid:$$[$0]};break;case 483:this.$={dbtypeid:$$[$0-1]+($$[$0]?" "+$$[$0]:"")};break;case 484:this.$={dbtypeid:"ENUM",enumvalues:$$[$0-1]};break;case 485:case 678:this.$=+$$[$0];break;case 487:this.$=undefined;break;case 489:yy.extend($$[$0-1],$$[$0]);this.$=$$[$0-1];break;case 492:this.$={primarykey:true};break;case 493:case 494:this.$={foreignkey:{table:$$[$0-1],columnid:$$[$0]}};break;case 495:this.$={identity:{value:$$[$0-3],step:$$[$0-1]}};break;case 496:this.$={identity:{value:1,step:1}};break;case 497:this.$={"default":$$[$0]};break;case 498:this.$={"default":$$[$0-1]};break;case 499:this.$={"null":true};break;case 500:this.$={notnull:true};break;case 501:this.$={check:$$[$0]};break;case 502:this.$={unique:true};break;case 503:this.$=new yy.DropTable({table:$$[$0],type:$$[$0-2]});yy.extend(this.$,$$[$0-1]);break;case 505:this.$={ifexists:true};break;case 506:this.$=new yy.AlterTable({table:$$[$0-3],renameto:$$[$0]});break;case 507:this.$=new yy.AlterTable({table:$$[$0-3],addcolumn:$$[$0]});break;case 508:this.$=new yy.AlterTable({table:$$[$0-3],modifycolumn:$$[$0]});break;case 509:this.$=new yy.AlterTable({table:$$[$0-5],renamecolumn:$$[$0-2],to:$$[$0]});break;case 510:this.$=new yy.AlterTable({table:$$[$0-3],dropcolumn:$$[$0]});break;case 511:this.$=new yy.AlterTable({table:$$[$0-2],renameto:$$[$0]});break;case 512:this.$=new yy.AttachDatabase({databaseid:$$[$0],engineid:$$[$0-2].toUpperCase()});break;case 513:this.$=new yy.AttachDatabase({databaseid:$$[$0-3],engineid:$$[$0-5].toUpperCase(),args:$$[$0-1]});break;case 514:this.$=new yy.AttachDatabase({databaseid:$$[$0-2],engineid:$$[$0-4].toUpperCase(),as:$$[$0]});break;case 515:this.$=new yy.AttachDatabase({databaseid:$$[$0-5],engineid:$$[$0-7].toUpperCase(),as:$$[$0],args:$$[$0-3]});break;case 516:this.$=new yy.DetachDatabase({databaseid:$$[$0]});break;case 517:this.$=new yy.CreateDatabase({databaseid:$$[$0]});yy.extend(this.$,$$[$0]);break;case 518:this.$=new yy.CreateDatabase({engineid:$$[$0-4].toUpperCase(),databaseid:$$[$0-1],as:$$[$0]});yy.extend(this.$,$$[$0-2]);break;case 519:this.$=new yy.CreateDatabase({engineid:$$[$0-7].toUpperCase(),databaseid:$$[$0-4],args:$$[$0-2],as:$$[$0]});yy.extend(this.$,$$[$0-5]);break;case 520:this.$=new yy.CreateDatabase({engineid:$$[$0-4].toUpperCase(),as:$$[$0],args:[$$[$0-1]]});yy.extend(this.$,$$[$0-2]);break;case 521:this.$=undefined;break;case 523:case 524:this.$=new yy.UseDatabase({databaseid:$$[$0]});break;case 525:this.$=new yy.DropDatabase({databaseid:$$[$0]});yy.extend(this.$,$$[$0-1]);break;case 526:case 527:this.$=new yy.DropDatabase({databaseid:$$[$0],engineid:$$[$0-3].toUpperCase()});yy.extend(this.$,$$[$0-1]);break;case 528:this.$=new yy.CreateIndex({indexid:$$[$0-5],table:$$[$0-3],columns:$$[$0-1]});break;case 529:this.$=new yy.CreateIndex({indexid:$$[$0-5],table:$$[$0-3],columns:$$[$0-1],unique:true});break;case 530:this.$=new yy.DropIndex({indexid:$$[$0]});break;case 531:this.$=new yy.ShowDatabases;break;case 532:this.$=new yy.ShowDatabases({like:$$[$0]});break;case 533:this.$=new yy.ShowDatabases({engineid:$$[$0-1].toUpperCase()});break;case 534:this.$=new yy.ShowDatabases({engineid:$$[$0-3].toUpperCase(),like:$$[$0]});break;case 535:this.$=new yy.ShowTables;break;case 536:this.$=new yy.ShowTables({like:$$[$0]});break;case 537:this.$=new yy.ShowTables({databaseid:$$[$0]});break;case 538:this.$=new yy.ShowTables({like:$$[$0],databaseid:$$[$0-2]});break;case 539:this.$=new yy.ShowColumns({table:$$[$0]});break;case 540:this.$=new yy.ShowColumns({table:$$[$0-2],databaseid:$$[$0]});break;case 541:this.$=new yy.ShowIndex({table:$$[$0]});break;case 542:this.$=new yy.ShowIndex({table:$$[$0-2],databaseid:$$[$0]});break;case 543:this.$=new yy.ShowCreateTable({table:$$[$0]});break;case 544:this.$=new yy.ShowCreateTable({table:$$[$0-2],databaseid:$$[$0]});break;case 545:this.$=new yy.CreateTable({table:$$[$0-6],view:true,select:$$[$0-1],viewcolumns:$$[$0-4]});yy.extend(this.$,$$[$0-9]);yy.extend(this.$,$$[$0-7]);break;case 546:this.$=new yy.CreateTable({table:$$[$0-3],view:true,select:$$[$0-1]});yy.extend(this.$,$$[$0-6]);yy.extend(this.$,$$[$0-4]);break;case 550:this.$=new yy.DropTable({table:$$[$0],view:true});yy.extend(this.$,$$[$0-1]);break;case 551:this.$=new yy.Help({subject:$$[$0].value.toUpperCase()});break;case 552:this.$=new yy.Help;break;case 553:this.$=new yy.ExpressionStatement({expression:$$[$0]});break;case 554:this.$=new yy.Source({url:$$[$0].value});break;case 555:this.$=new yy.Assert({value:$$[$0]});break;case 556:this.$=new yy.Assert({value:$$[$0].value});break;case 557:this.$=new yy.Assert({value:$$[$0],message:$$[$0-2]});break;case 559:case 570:case 572:this.$=$$[$0].value;break;case 560:case 568:this.$=+$$[$0].value;break;case 561:this.$=!!$$[$0].value;break;case 569:this.$=""+$$[$0].value;break;case 575:this.$=$$[$0-1];break;case 577:case 580:this.$=$$[$0-2];break;case 578:this.$={};break;case 581:this.$=[];break;case 582:yy.extend($$[$0-2],$$[$0]);this.$=$$[$0-2];break;case 584:this.$={};this.$[$$[$0-2].substr(1,$$[$0-2].length-2)]=$$[$0];break;case 585:case 586:this.$={};this.$[$$[$0-2]]=$$[$0];break;case 589:this.$=new yy.SetVariable({variable:$$[$0-1].toLowerCase(),value:$$[$0]});break;case 590:this.$=new yy.SetVariable({variable:$$[$0-2],expression:$$[$0],method:$$[$0-3]});break;case 591:this.$=new yy.SetVariable({variable:$$[$0-3],props:$$[$0-2],expression:$$[$0],method:$$[$0-4]});break;case 592:this.$="@";break;case 593:this.$="$";break;case 599:this.$=true;break;case 600:this.$=false;break;case 601:this.$=new yy.CommitTransaction;break;case 602:this.$=new yy.RollbackTransaction;break;case 603:this.$=new yy.BeginTransaction;break;case 604:this.$=new yy.If({expression:$$[$0-2],thenstat:$$[$0-1],elsestat:$$[$0]});if($$[$0-1].exists)this.$.exists=$$[$0-1].exists;if($$[$0-1].queries)this.$.queries=$$[$0-1].queries;break;case 605:this.$=new yy.If({expression:$$[$0-1],thenstat:$$[$0]});if($$[$0].exists)this.$.exists=$$[$0].exists;if($$[$0].queries)this.$.queries=$$[$0].queries;break;case 606:this.$=$$[$0];break;case 607:this.$=new yy.While({expression:$$[$0-1],loopstat:$$[$0]});if($$[$0].exists)this.$.exists=$$[$0].exists;if($$[$0].queries)this.$.queries=$$[$0].queries;break;case 608:this.$=new yy.Continue;break;case 609:this.$=new yy.Break;break;case 610:this.$=new yy.BeginEnd({statements:$$[$0-1]});break;case 611:this.$=new yy.Print({exprs:$$[$0]});break;case 612:this.$=new yy.Print({select:$$[$0]});break;case 613:this.$=new yy.Require({paths:$$[$0]});break;case 614:this.$=new yy.Require({plugins:$$[$0]});break;case 615:case 616:this.$=$$[$0].toUpperCase();break;case 617:this.$=new yy.Echo({expr:$$[$0]});break;case 622:this.$=new yy.Declare({declares:$$[$0]});break;case 625:this.$={variable:$$[$0-1]};yy.extend(this.$,$$[$0]);break;case 626:this.$={variable:$$[$0-2]};yy.extend(this.$,$$[$0]);break;case 627:this.$={variable:$$[$0-3],expression:$$[$0]};yy.extend(this.$,$$[$0-2]);break;case 628:this.$={variable:$$[$0-4],expression:$$[$0]};yy.extend(this.$,$$[$0-2]);break;case 629:this.$=new yy.TruncateTable({table:$$[$0]});break;case 630:this.$=new yy.Merge;yy.extend(this.$,$$[$0-4]);yy.extend(this.$,$$[$0-3]);yy.extend(this.$,$$[$0-2]);yy.extend(this.$,{matches:$$[$0-1]});yy.extend(this.$,$$[$0]);break;case 631:case 632:this.$={into:$$[$0]};break;case 634:this.$={on:$$[$0]};break;case 639:this.$={matched:true,action:$$[$0]};break;case 640:this.$={matched:true,expr:$$[$0-2],action:$$[$0]};break;case 641:this.$={"delete":true};break;case 642:this.$={update:$$[$0]};break;case 643:case 644:this.$={matched:false,bytarget:true,action:$$[$0]};break;case 645:case 646:this.$={matched:false,bytarget:true,expr:$$[$0-2],action:$$[$0]};break;case 647:this.$={matched:false,bysource:true,action:$$[$0]};break;case 648:this.$={matched:false,bysource:true,expr:$$[$0-2],action:$$[$0]};break;case 649:this.$={insert:true,values:$$[$0]};break;case 650:this.$={insert:true,values:$$[$0],columns:$$[$0-3]};break;case 651:this.$={insert:true,defaultvalues:true};break;case 652:this.$={insert:true,defaultvalues:true,columns:$$[$0-3]};break;case 654:this.$={output:{columns:$$[$0]}};break;case 655:this.$={output:{columns:$$[$0-3],intovar:$$[$0],method:$$[$0-1]}};break;case 656:this.$={output:{columns:$$[$0-2],intotable:$$[$0]}};break;case 657:this.$={output:{columns:$$[$0-5],intotable:$$[$0-3],intocolumns:$$[$0-1]}};break;case 658:this.$=new yy.CreateVertex({"class":$$[$0-3],sharp:$$[$0-2],name:$$[$0-1]});yy.extend(this.$,$$[$0]);break;case 661:this.$={sets:$$[$0]};break;case 662:this.$={content:$$[$0]};break;case 663:this.$={select:$$[$0]};break;case 664:this.$=new yy.CreateEdge({from:$$[$0-3],to:$$[$0-1],name:$$[$0-5]});yy.extend(this.$,$$[$0]);break;case 665:this.$=new yy.CreateGraph({graph:$$[$0]});break;case 666:this.$=new yy.CreateGraph({from:$$[$0]});break;case 669:this.$=$$[$0-2];if($$[$0-1])this.$.json=new yy.Json({value:$$[$0-1]});if($$[$0])this.$.as=$$[$0];break;case 670:this.$={source:$$[$0-6],target:$$[$0]};if($$[$0-3])this.$.json=new yy.Json({value:$$[$0-3]});if($$[$0-2])this.$.as=$$[$0-2];yy.extend(this.$,$$[$0-4]);break;case 672:this.$={vars:$$[$0],method:$$[$0-1]};break;case 675:var s3=$$[$0-1];this.$={prop:$$[$0-3],sharp:$$[$0-2],name:typeof s3=="undefined"?undefined:s3.substr(1,s3.length-2),"class":$$[$0]};break;case 681:this.$=new yy.AddRule({left:$$[$0-2],right:$$[$0]});break;case 682:this.$=new yy.AddRule({right:$$[$0]});break;case 685:this.$=new yy.Term({termid:$$[$0]});break;case 686:this.$=new yy.Term({termid:$$[$0-3],args:$$[$0-1]});break;case 692:case 706:case 708:case 710:case 714:case 716:case 718:case 720:case 722:case 724:this.$=[];break;case 693:case 701:case 703:case 707:case 709:case 711:case 715:case 717:case 719:case 721:case 723:case 725:$$[$0-1].push($$[$0]);break;case 700:case 702:this.$=[$$[$0]];break}},table:[o([8,450,451],$V0,{6:1,7:2,10:3,11:4,15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,4:$V1,5:$V2,12:$V3,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),{1:[3]},{8:[1,97],9:98,450:$VE,451:$VF},o($VG,[2,5]),o($VG,[2,6]),o($VH,[2,9]),o($VG,$V0,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,10:101,4:$V1,5:$V2,13:[1,102],47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($VH,[2,11]),o($VH,[2,12]),o($VH,[2,13]),o($VH,[2,14]),o($VH,[2,15]),o($VH,[2,16]),o($VH,[2,17]),o($VH,[2,18]),o($VH,[2,19]),o($VH,[2,20]),o($VH,[2,21]),o($VH,[2,22]),o($VH,[2,23]),o($VH,[2,24]),o($VH,[2,25]),o($VH,[2,26]),o($VH,[2,27]),o($VH,[2,28]),o($VH,[2,29]),o($VH,[2,30]),o($VH,[2,31]),o($VH,[2,32]),o($VH,[2,33]),o($VH,[2,34]),o($VH,[2,35]),o($VH,[2,36]),o($VH,[2,37]),o($VH,[2,38]),o($VH,[2,39]),o($VH,[2,40]),o($VH,[2,41]),o($VH,[2,42]),o($VH,[2,43]),o($VH,[2,44]),o($VH,[2,45]),o($VH,[2,46]),o($VH,[2,47]),o($VH,[2,48]),o($VH,[2,49]),o($VH,[2,50]),o($VH,[2,51]),o($VH,[2,52]),o($VH,[2,53]),o($VH,[2,54]),o($VH,[2,55]),o($VH,[2,56]),o($VH,[2,57]),o($VH,[2,58]),o($VH,[2,59]),{304:[1,103]},{3:104,4:$V1,5:$V2},o($VI,[2,442],{3:106,299:110,4:$V1,5:$V2,109:$VJ,110:$VK,161:[1,108],167:[1,107],308:[1,113],352:[1,105],421:[1,109]}),{119:$VL,398:114,399:115},{157:[1,117]},{352:[1,118]},{3:120,4:$V1,5:$V2,105:[1,125],167:[1,121],304:[1,124],345:122,352:[1,119],357:[1,123]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:126,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vi1,[2,413],{292:181,172:[1,182]}),{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,172:[1,185],173:188,174:190,175:189,176:191,183:184,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1,402:183},{304:[1,195]},o($Vl1,[2,690],{73:196,84:197,85:[1,198]}),o($Vm1,[2,692],{82:199}),{3:203,4:$V1,5:$V2,164:[1,201],167:[1,204],298:[1,200],304:[1,205],352:[1,202]},{304:[1,206]},{3:209,4:$V1,5:$V2,66:207,68:208},o([264,450,451],$V0,{10:3,11:4,15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,7:211,4:$V1,5:$V2,12:$V3,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,384:[1,210],385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),{384:[1,212]},{384:[1,213]},{3:215,4:$V1,5:$V2,352:[1,214]},{3:217,4:$V1,5:$V2,173:216},o($VH,[2,552],{91:218,107:$VO,256:$Va1}),o($Vn1,[2,284]),{91:219,107:$VO,256:$Va1},{3:231,4:$V1,5:$V2,91:225,106:$VN,107:[1,222],116:$VQ,118:220,119:$Vo1,126:$VS,155:$VW,170:224,174:229,175:228,225:226,226:227,232:$Vp1,238:221,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:232,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,608]),o($VH,[2,609]),{3:147,4:$V1,5:$V2,36:234,51:144,70:$VM,72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:233,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:241,4:$V1,5:$V2,91:238,107:$VO,256:$Va1,393:236,394:237,395:239,396:$Vq1},{3:242,4:$V1,5:$V2,116:$Vr1,119:$Vs1,379:243},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:246,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{447:[1,247]},{3:93,4:$V1,5:$V2,446:249,448:248},{3:231,4:$V1,5:$V2,174:250},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:251,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vt1,$Vu1,{160:255,138:[1,254],159:[1,252],161:[1,253],169:$Vv1}),o($Vw1,[2,685],{70:[1,257]}),o($Vx1,[2,130],{123:[1,258],124:[1,259],164:[1,260],165:[1,261],166:[1,262],167:[1,263],168:[1,264]}),o($Vy1,[2,1]),o($Vy1,[2,2]),{1:[2,3]},o($VG,$V0,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,10:265,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($Vz1,[2,688]),o($Vz1,[2,689]),o($VG,[2,7]),{14:[1,266]},{3:217,4:$V1,5:$V2,173:267},{352:[1,268]},o($Vi1,$VA1,{301:269,130:$VB1}),{352:[1,271]},{3:272,4:$V1,5:$V2},{167:[1,273]},o([8,67,69,107,112,114,126,264,268,368,372,450,451],$VC1,{422:274,423:276,424:277,427:278,3:279,434:280,431:281,379:282,4:$V1,5:$V2,116:$Vr1,119:$Vs1,157:[1,275]}),{105:[1,286],300:283,304:[1,285],357:[1,284]},{91:288,107:$VO,157:[2,770],256:$Va1,420:287},o($VD1,[2,764],{414:289,3:290,4:$V1,5:$V2}),o($VI,[2,443]),o($VH,[2,622],{67:[1,291]}),o($VE1,[2,623]),{3:292,4:$V1,5:$V2},{3:217,4:$V1,5:$V2,173:293},{3:294,4:$V1,5:$V2},o($Vi1,$VF1,{346:295,130:$VG1}),{352:[1,297]},{3:298,4:$V1,5:$V2},o($Vi1,$VF1,{346:299,130:$VG1}),o($Vi1,$VF1,{346:300,130:$VG1}),o($VH1,[2,758]),o($VH1,[2,759]),o($VH,$V0,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,10:301,278:322,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,90:$VI1,97:$VJ1,98:$VK1,99:$VL1,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,120:$V8,128:$VR1,130:$V9,144:$VS1,145:$VT1,153:$VU1,154:$VV1,163:$Va,233:$Vb,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($Vn1,[2,263]),o($Vn1,[2,264]),o($Vn1,[2,265]),o($Vn1,[2,266]),o($Vn1,[2,267]),o($Vn1,[2,268]),o($Vn1,[2,269]),o($Vn1,[2,270]),o($Vn1,[2,271]),o($Vn1,[2,272]),o($Vn1,[2,273]),o($Vn1,[2,274]),o($Vn1,[2,275]),o($Vn1,[2,276]),o($Vn1,[2,277]),o($Vn1,[2,278]),{3:147,4:$V1,5:$V2,23:336,24:335,33:332,36:331,51:144,70:$VM,72:67,81:$V6,89:130,91:134,100:334,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,231:333,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,291:$Ve,298:[1,337],367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,282]),o($Vn1,[2,283]),{70:[1,338]},o([4,5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],$V82,{70:$V92,117:[1,340]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:341,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:342,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:343,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:344,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,258]),o([4,5,8,47,65,67,69,70,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,202,203,205,212,215,216,218,220,232,233,234,235,237,244,245,246,247,248,249,250,251,252,254,255,256,257,258,260,261,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,374,376,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451,452],[2,320]),o($Va2,[2,321]),o($Va2,[2,322]),o($Va2,$Vb2),o($Va2,[2,324]),o([4,5,8,47,65,67,69,70,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,257,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,374,376,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,325]),{3:346,4:$V1,5:$V2,106:[1,347],259:345},{3:348,4:$V1,5:$V2},o($Va2,[2,330]),o($Va2,[2,331]),{3:349,4:$V1,5:$V2,70:$Vc2,91:351,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:352,175:354,225:353,254:$V81,255:$V91,256:$Va1,260:$Vd1,367:355,372:$Vh1},{70:[1,356]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:357,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,262:358,265:359,266:$Vd2,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,361]},{70:[1,362]},o($Ve2,[2,563]),{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,369:363,370:366,371:368,372:$Vh1,375:364,376:[1,365]},{3:378,4:$V1,5:$V2,174:379},{70:[2,307]},{70:[2,308]},{70:[2,309]},{70:[2,310]},{70:[2,311]},{70:[2,312]},{70:[2,313]},{70:[2,314]},{70:[2,315]},{3:385,4:$V1,5:$V2,106:$Vg2,107:$Vh2,373:380,374:[1,381],377:382},{3:217,4:$V1,5:$V2,173:386},o($Vi1,[2,414]),{203:[1,388],403:387},{203:[2,631]},{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,183:389,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{36:390,72:67,81:$V6,158:92,163:$Va},o($Vi2,[2,730],{184:391,69:[1,392]}),o($Vj2,[2,163],{3:393,4:$V1,5:$V2,69:[1,394]}),o($Vj2,[2,166],{3:395,4:$V1,5:$V2,69:[1,396]}),o($Vj2,[2,167],{3:397,4:$V1,5:$V2,69:[1,398]}),o($Vj2,[2,170],{3:399,4:$V1,5:$V2,69:[1,400]}),o($Vj2,[2,173],{3:401,4:$V1,5:$V2,69:[1,402]}),o([4,5,8,65,67,69,71,93,104,136,142,143,157,180,182,194,195,196,197,198,199,200,201,202,203,205,218,264,268,450,451],$Vk2,{70:$V92,117:$Vl2}),o([4,5,8,65,67,69,71,93,104,136,142,143,180,182,194,195,196,197,198,199,200,201,202,203,205,218,264,268,450,451],[2,176]),{3:217,4:$V1,5:$V2,173:404},o($Vm2,$Vn2,{74:405,172:$Vo2}),o($Vl1,[2,691]),o($Vp2,[2,696],{86:407,164:[1,408]}),o([8,71,157,264,268,450,451],$Vn2,{367:168,74:409,92:410,3:411,118:433,132:443,134:444,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,172:$Vo2,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,368:$Vg1,372:$Vh1}),{304:[1,457]},{157:[1,458]},o($VH,[2,531],{90:[1,459]}),{352:[1,460]},{157:[1,461]},o($VH,[2,535],{90:[1,462],157:[1,463]}),{3:217,4:$V1,5:$V2,173:464},{36:465,67:[1,466],72:67,81:$V6,158:92,163:$Va},o($V43,[2,62]),{69:[1,467]},o($VH,[2,603]),{9:98,264:[1,468],450:$VE,451:$VF},o($VH,[2,601]),o($VH,[2,602]),{3:469,4:$V1,5:$V2},o($VH,[2,524]),{120:[1,470]},o([8,67,69,70,71,81,104,120,122,123,128,157,161,163,202,257,264,268,294,307,319,320,324,325,344,348,349,350,450,451],$Vk2,{117:$Vl2}),o($VH,[2,551]),o($VH,[2,554]),o($VH,[2,555]),o($VH,[2,556]),o($VH,$Vb2,{67:[1,471]}),{70:$Vc2,91:351,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:352,175:354,225:353,254:$V81,255:$V91,256:$Va1,260:$Vd1,367:355,372:$Vh1},o($V53,[2,291]),o($V53,[2,292]),o($V53,[2,293]),o($V53,[2,294]),o($V53,[2,295]),o($V53,[2,296]),o($V53,[2,297]),{70:$V92},o($VH,$V0,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,278:322,10:472,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,90:$VI1,97:$VJ1,98:$VK1,99:$VL1,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,120:$V8,128:$VR1,130:$V9,144:$VS1,145:$VT1,153:$VU1,154:$VV1,163:$Va,233:$Vb,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($VH,[2,611],{67:$V63}),o($VH,[2,612]),o($V73,[2,318],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VH,[2,613],{67:[1,475]}),o($VH,[2,614],{67:[1,476]}),o($VE1,[2,619]),o($VE1,[2,621]),o($VE1,[2,615]),o($VE1,[2,616]),{202:[1,478],378:477,382:[1,479]},{3:480,4:$V1,5:$V2},o($Vi1,[2,592]),o($Vi1,[2,593]),o($VH,[2,553],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:93,4:$V1,5:$V2,446:249,448:481},o($VH,[2,682],{67:$V93}),o($V73,[2,684]),o($VH,[2,687]),o($VH,[2,617],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Va3,$Vu1,{160:483,169:$Vv1}),o($Va3,$Vu1,{160:484,169:$Vv1}),o($Va3,$Vu1,{160:485,169:$Vv1}),o($Vb3,[2,726],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,162:486,148:487,221:488,100:489,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{70:[1,491],106:$VN,170:490},{3:93,4:$V1,5:$V2,446:249,448:492},o($Vx1,[2,131]),o($Vx1,[2,132]),o($Vx1,[2,133]),o($Vx1,[2,134]),o($Vx1,[2,135]),o($Vx1,[2,136]),o($Vx1,[2,137]),o($VG,[2,4]),o($VG,$V0,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,10:493,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),{344:[1,497],348:[1,494],349:[1,495],350:[1,496]},{3:498,4:$V1,5:$V2},{3:499,4:$V1,5:$V2},{128:[1,500]},o($Vc3,$VA1,{301:501,130:$VB1}),{202:[1,502]},{3:503,4:$V1,5:$V2},o($VH,[2,665],{67:$Vd3}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:505,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V73,[2,668]),o($Ve3,[2,772],{367:168,425:506,118:507,114:[2,776],119:$Vo1,368:$Vg1,372:$Vh1}),{114:[1,508]},o($Vf3,$Vg3,{70:[1,509]}),o($Vh3,[2,786],{435:510,439:511,112:[1,512]}),{114:[2,777]},{3:513,4:$V1,5:$V2},o($Vi1,$VA1,{301:514,130:$VB1}),o($Vi1,$VA1,{301:515,130:$VB1}),o($VH1,[2,433]),o($VH1,[2,434]),{157:[1,516]},{157:[2,771]},o($Vi3,[2,766],{415:517,418:518,112:[1,519]}),o($VD1,[2,765]),{119:$VL,399:520},{4:$Vj3,69:[1,522],236:521,338:$Vk3},o($VH,[2,407],{104:[1,525]}),o($VH,[2,516]),{3:526,4:$V1,5:$V2},{258:[1,527]},o($Vc3,$VF1,{346:528,130:$VG1}),o($VH,[2,530]),{3:217,4:$V1,5:$V2,173:529},{3:217,4:$V1,5:$V2,173:530},o($VG,[2,605],{387:531,268:[1,532]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:533,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:534,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:535,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:536,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:537,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:538,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:539,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:540,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:541,4:$V1,5:$V2,70:[1,543],106:$VN,170:542,174:544},{3:545,4:$V1,5:$V2,70:[1,547],106:$VN,170:546,174:548},o($Vl3,[2,391],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:549,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,[2,392],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:550,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,[2,393],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:551,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,[2,394],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:552,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),o($Vl3,$Vm3,{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:553,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:554,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:555,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vl3,[2,396],{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:556,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:557,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:558,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{138:[1,560],140:[1,562],279:559,286:[1,561]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:563,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:564,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:377,4:$V1,5:$V2,70:[1,565],89:568,119:$Vn3,174:569,176:567,281:566},{280:[1,571]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:572,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:573,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:574,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{4:$Vj3,236:575,338:$Vk3},{71:[1,576]},{71:[1,577]},{71:[1,578]},{71:[1,579],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[2,738]},{71:[2,739]},{109:$VJ,110:$VK},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:580,126:$VS,128:$VT,132:146,138:[1,582],153:$VU,154:$VV,155:$VW,159:[1,581],170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Va3,[2,742],{253:583,453:585,71:[1,584],138:[1,587],159:[1,586]}),{3:588,4:$V1,5:$V2,123:$Vo3,154:[1,590]},o([4,5,8,47,65,67,69,70,71,81,85,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,271,272,273,274,275,276,277,280,282,283,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,369],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,284:$V62}),o($Vp3,[2,370],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($Vp3,[2,371],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($Vn1,[2,372],{278:322}),o($Va2,[2,328]),o($Va2,[2,744]),o($Va2,[2,745]),o($Va2,[2,329]),o([4,5,8,47,65,67,69,70,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,202,203,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,326]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:591,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Ve2,[2,559]),o($Ve2,[2,560]),o($Ve2,[2,561]),o($Ve2,[2,562]),o($Ve2,[2,564]),{36:592,72:67,81:$V6,158:92,163:$Va},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,262:593,265:359,266:$Vd2,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{263:594,264:$Vq3,265:595,266:$Vd2,268:$Vr3},o($Vs3,[2,335]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:597,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:598,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{4:$Vj3,236:599,338:$Vk3},o($Ve2,[2,565]),{67:[1,601],376:[1,600]},o($Ve2,[2,581]),o($Vt3,[2,588]),o($Vu3,[2,566]),o($Vu3,[2,567]),o($Vu3,[2,568]),o($Vu3,[2,569]),o($Vu3,[2,570]),o($Vu3,[2,571]),o($Vu3,[2,572]),o($Vu3,[2,573]),o($Vu3,[2,574]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:602,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o([4,5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,374,376,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],$V82,{70:$V92,117:$Vv3}),o($Vw3,[2,285],{70:$V92}),o($Vn1,[2,286]),{67:[1,605],374:[1,604]},o($Ve2,[2,578]),o($Vx3,[2,583]),{126:[1,606]},{126:[1,607]},{126:[1,608]},{36:612,70:[1,611],72:67,81:$V6,123:[1,609],158:92,163:$Va,294:[1,610]},{202:[1,614],404:613},{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,183:615,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{203:[2,632]},{71:[1,616]},o($Vj2,[2,732],{185:617,3:618,4:$V1,5:$V2}),o($Vi2,[2,731]),o($Vj2,[2,161]),{3:619,4:$V1,5:$V2},o($Vj2,[2,164]),{3:620,4:$V1,5:$V2},o($Vj2,[2,168]),{3:621,4:$V1,5:$V2},o($Vj2,[2,171]),{3:622,4:$V1,5:$V2},o($Vj2,[2,174]),{3:623,4:$V1,5:$V2},{3:624,4:$V1,5:$V2},{122:[1,625]},o($Vy3,[2,150],{75:626,157:[1,627]}),{3:193,4:$V1,5:$V2,107:[1,632],116:$VQ,119:[1,633],126:$VS,155:$VW,173:628,174:629,175:630,176:631,260:$Vd1},{3:638,4:$V1,5:$V2,87:634,88:635,89:636,90:$Vz3},o($Vp2,[2,697]),o($VA3,[2,694],{83:639,156:640,157:[1,641]}),o($Vm1,[2,693],{127:642,153:$VB3,154:$VC3,155:$VD3}),o([4,5,8,65,67,69,71,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,172,244,245,246,247,248,249,250,251,252,264,268,368,372,450,451],[2,71],{70:[1,646]}),{94:[1,647]},{3:648,4:$V1,5:$V2},o($VE3,[2,75]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:649,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:650,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,92:652,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,101:651,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{70:[1,653]},{70:[1,654]},{70:[1,655]},o($VE3,[2,83]),o($VE3,[2,84]),o($VE3,[2,85]),o($VE3,[2,86]),o($VE3,[2,87]),o($VE3,[2,88]),{3:656,4:$V1,5:$V2},{3:657,4:$V1,5:$V2,108:[1,658]},o($VE3,[2,92]),o($VE3,[2,93]),o($VE3,[2,94]),{117:[1,659]},o($VE3,[2,96]),{3:660,4:$V1,5:$V2,70:$Vc2,91:351,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:352,175:354,225:353,254:$V81,255:$V91,256:$Va1,260:$Vd1,367:355,372:$Vh1},{119:[1,661]},{70:[1,662]},{119:[1,663]},o($VE3,[2,101]),{70:[1,664]},{3:665,4:$V1,5:$V2},{70:[1,666]},{70:[1,667]},{70:[1,668]},{70:[1,669]},{70:[1,670],138:[1,671]},{70:[1,672]},{70:[1,673]},{70:[1,674]},{70:[1,675]},{70:[1,676]},{70:[1,677]},{70:[1,678]},{70:[1,679]},{70:[1,680]},{70:[2,712]},{70:[2,713]},{3:217,4:$V1,5:$V2,173:681},{3:217,4:$V1,5:$V2,173:682},{91:683,107:$VO,256:$Va1},o($VH,[2,533],{90:[1,684]}),{3:217,4:$V1,5:$V2,173:685},{91:686,107:$VO,256:$Va1},{3:687,4:$V1,5:$V2},o($VH,[2,629]),o($VH,[2,60]),{3:209,4:$V1,5:$V2,68:688},{70:[1,689]},o($VH,[2,610]),o($VH,[2,523]),{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:690,288:691,289:693},{118:696,119:$Vo1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,607]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:697,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vl3,$Vm3,{223:127,174:128,224:129,89:130,222:131,170:132,225:133,91:134,226:135,175:136,176:137,227:138,228:139,229:140,118:141,230:142,51:144,132:146,3:147,367:168,100:698,4:$V1,5:$V2,70:$VM,106:$VN,107:$VO,112:$VP,116:$VQ,119:$VR,126:$VS,128:$VT,153:$VU,154:$VV,155:$VW,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,368:$Vg1,372:$Vh1}),{91:699,107:$VO,256:$Va1},{3:241,4:$V1,5:$V2,395:700,396:$Vq1},o($VH,[2,589]),o($VH,[2,599]),o($VH,[2,600]),{97:[1,703],99:[1,701],380:702},o($VH,[2,681],{67:$V93}),{3:93,4:$V1,5:$V2,446:704},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:705,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:706,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:707,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vb3,[2,129]),o($Vb3,[2,727],{67:$VH3}),o($VI3,[2,248]),o($VI3,[2,255],{278:322,3:710,91:712,4:$V1,5:$V2,69:[1,709],90:$VI1,97:$VJ1,98:$VK1,99:$V83,106:[1,711],107:$VO,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,256:$Va1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vt1,[2,728],{171:713,452:[1,714]}),{106:$VN,170:715},{67:$V93,71:[1,716]},o($VG,[2,8]),{122:[1,717],164:[1,718]},{164:[1,719]},{164:[1,720]},{164:[1,721]},o($VH,[2,512],{69:[1,723],70:[1,722]}),o($VH,[2,517]),{258:[1,724]},{3:725,4:$V1,5:$V2,91:726,107:$VO,256:$Va1},{3:217,4:$V1,5:$V2,173:727},{202:[1,728]},o([8,67,69,71,107,112,114,126,264,268,368,372,450,451],$VC1,{424:277,427:278,3:279,434:280,431:281,379:282,423:729,4:$V1,5:$V2,116:$Vr1,119:$Vs1}),o($VH,[2,666],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($V73,[2,774],{426:730,432:731,69:$VJ3}),o($Ve3,[2,773]),o([69,107,112,114,119,126,368,372],$VC1,{434:280,424:733,3:734,4:$V1,5:$V2}),o([67,69,71,107,112,114,126,368,372],$VC1,{423:276,424:277,427:278,3:279,434:280,431:281,379:282,422:735,4:$V1,5:$V2,116:$Vr1,119:$Vs1}),o($VK3,[2,788],{436:736,107:[1,737]}),o($Vh3,[2,787]),{3:738,4:$V1,5:$V2,106:[1,739]},o($VL3,[2,672]),{3:217,4:$V1,5:$V2,173:740},{3:217,4:$V1,5:$V2,173:741},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:742,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VM3,[2,768],{416:743,91:744,107:$VO,256:$Va1}),o($Vi3,[2,767]),{3:745,4:$V1,5:$V2},o($VE1,[2,624]),o($VE1,[2,625],{99:[1,746]}),{4:$Vj3,236:747,338:$Vk3},o([5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,257,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,482],{4:[1,749],70:[1,748]}),{70:[1,750]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:751,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,525]),o($Vc3,[2,505]),{3:752,4:$V1,5:$V2,91:753,107:$VO,256:$Va1},o($VH,[2,503]),o($VH,[2,550]),o($VH,[2,604]),o($VH,$V0,{15:5,16:7,17:8,18:9,19:10,20:11,21:12,22:13,23:14,24:15,25:16,26:17,27:18,28:19,29:20,30:21,31:22,32:23,33:24,34:25,35:26,36:27,37:28,38:29,39:30,40:31,41:32,42:33,43:34,44:35,45:36,46:37,48:39,49:40,50:41,51:42,52:43,53:44,54:45,55:46,56:47,57:48,58:49,59:50,60:51,61:52,62:53,63:54,64:55,72:67,446:88,158:92,3:93,10:754,4:$V1,5:$V2,47:$V4,65:$V5,81:$V6,99:$V7,120:$V8,130:$V9,163:$Va,233:$Vb,287:$Vc,290:$Vd,291:$Ve,298:$Vf,344:$Vg,347:$Vh,348:$Vi,351:$Vj,353:$Vk,355:$Vl,356:$Vm,364:$Vn,365:$Vo,366:$Vp,383:$Vq,385:$Vr,386:$Vs,388:$Vt,389:$Vu,390:$Vv,391:$Vw,392:$Vx,396:$Vy,397:$Vz,400:$VA,401:$VB,447:$VC,449:$VD}),o($VN3,[2,339],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,270:$VX1}),o($VN3,[2,340],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,270:$VX1}),o($Vp3,[2,341],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($Vp3,[2,342],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,154:$VV1}),o($VO3,[2,343],{278:322,97:$VJ1,98:$VK1,111:$VN1}),o($VO3,[2,344],{278:322,97:$VJ1,98:$VK1,111:$VN1}),o($VO3,[2,345],{278:322,97:$VJ1,98:$VK1,111:$VN1}),o([4,5,8,47,65,67,69,70,71,81,85,90,93,98,99,104,105,106,107,108,109,110,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,346],{278:322,97:$VJ1,111:$VN1}),o($Vw3,[2,347],{70:$V92}),o($Vn1,[2,348]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:755,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,350]),o($Vw3,[2,351],{70:$V92}),o($Vn1,[2,352]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:756,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,354]),o($VP3,[2,355],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,356],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,357],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,358],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o([4,5,8,47,65,81,99,114,115,120,130,144,145,163,233,264,268,271,272,273,274,275,276,277,282,283,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,383,385,386,388,389,390,391,392,396,397,400,401,447,449,450,451],$VQ3,{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,360],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,361],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,362],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,363],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VP3,[2,364],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),{70:[1,757]},{70:[2,397]},{70:[2,398]},{70:[2,399]},o($VR3,[2,367],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,284:$V62}),o([4,5,8,47,65,67,69,70,71,81,85,93,104,105,106,107,109,110,112,116,117,119,120,122,123,124,126,130,136,138,140,142,143,145,146,147,149,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,368],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62}),{3:147,4:$V1,5:$V2,36:758,51:144,70:$VM,71:[1,760],72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:759,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,380]),o($Vn1,[2,382]),o($Vn1,[2,388]),o($Vn1,[2,389]),{3:349,4:$V1,5:$V2,70:[1,761]},{3:377,4:$V1,5:$V2,70:[1,762],89:568,119:$Vn3,174:569,176:764,281:763},o($VR3,[2,384],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,284:$V62}),o($VR3,[2,385],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,284:$V62}),o([4,5,8,47,65,67,69,70,71,81,85,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,264,266,267,268,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,298,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,386],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,269:$VW1,270:$VX1}),o($Vn1,[2,387]),o($Vn1,[2,279]),o($Vn1,[2,280]),o($Vn1,[2,281]),o($Vn1,[2,373]),{67:$V63,71:[1,765]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:766,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:767,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:768,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Va2,[2,317]),o($Va3,[2,743]),o($Va3,[2,740]),o($Va3,[2,741]),o($Vn1,$VS3),o($VT3,[2,261]),o($Vn1,[2,257]),{71:[1,770],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,771]},{263:772,264:$Vq3,265:595,266:$Vd2,268:$Vr3},{264:[1,773]},o($Vs3,[2,334]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:774,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,775],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{69:[1,776],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{67:[1,777]},o($Ve2,[2,579]),{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:779,371:368,372:$Vh1,376:[1,778]},{71:[1,780],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:781,4:$V1,5:$V2,123:$Vo3},o($Ve2,[2,576]),{3:385,4:$V1,5:$V2,106:$Vg2,107:$Vh2,374:[1,782],377:783},{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:784,371:368,372:$Vh1},{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:785,371:368,372:$Vh1},{3:377,4:$V1,5:$V2,70:$Vf2,89:372,91:370,106:$VN,107:$VO,116:$VQ,118:367,119:$Vo1,126:$VS,155:$VW,170:369,174:375,175:374,225:371,226:373,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1,367:168,368:$Vg1,370:786,371:368,372:$Vh1},{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:787,367:168,368:$Vg1,372:$Vh1},{123:[1,791]},{3:638,4:$V1,5:$V2,89:793,204:792},o($VV3,[2,411]),{266:$VW3,405:794,407:795,408:796},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:798,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{202:[2,633]},o($Vj2,[2,159],{3:799,4:$V1,5:$V2,69:[1,800]}),o($Vj2,[2,160]),o($Vj2,[2,733]),o($Vj2,[2,162]),o($Vj2,[2,165]),o($Vj2,[2,169]),o($Vj2,[2,172]),o($Vj2,[2,175]),o([4,5,8,65,67,69,70,71,81,93,104,120,122,123,128,136,142,143,157,161,163,180,182,194,195,196,197,198,199,200,201,202,203,205,218,257,264,268,294,307,319,320,324,325,344,348,349,350,450,451],[2,177]),{3:801,4:$V1,5:$V2},o($VX3,[2,214],{76:802,104:[1,803]}),{3:193,4:$V1,5:$V2,70:[1,805],107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,177:804,183:806,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},o($Vm2,[2,142]),o($Vm2,[2,143]),o($Vm2,[2,144]),o($Vm2,[2,145]),o($Vm2,[2,146]),{3:349,4:$V1,5:$V2},o($Vl1,[2,66],{67:[1,807]}),o($VY3,[2,68]),o($VY3,[2,69]),{91:808,107:$VO,256:$Va1},o([8,65,67,71,93,99,104,136,142,143,157,172,180,182,194,195,196,197,198,199,200,201,205,218,264,268,450,451],$V82,{117:$Vv3}),o($VA3,[2,65]),o($VA3,[2,695]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:809,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,104]),o($VE3,[2,122]),o($VE3,[2,123]),o($VE3,[2,124]),{3:147,4:$V1,5:$V2,51:144,70:$VM,71:[2,704],89:130,91:134,100:235,103:810,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:811,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,812]},o($VE3,[2,74]),o([4,5,8,65,67,69,70,71,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,172,244,245,246,247,248,249,250,251,252,264,268,368,372,450,451],[2,76],{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o([4,5,8,65,67,69,70,71,90,93,99,104,105,106,107,109,110,112,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,155,157,159,161,172,244,245,246,247,248,249,250,251,252,264,268,368,372,450,451],[2,77],{278:322,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,813],90:$Vt2,92:814,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},o($VZ3,[2,700],{127:642,153:$VB3,154:$VC3,155:$VD3}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,92:816,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,102:815,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:817,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:818,4:$V1,5:$V2},o($VE3,[2,89]),o($VE3,[2,90]),o($VE3,[2,91]),o($VE3,[2,95]),o($VE3,[2,97]),{3:819,4:$V1,5:$V2},{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:820,288:691,289:693},{3:821,4:$V1,5:$V2},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:822,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,103]),o($VZ3,[2,706],{129:823}),o($VZ3,[2,708],{131:824}),o($VZ3,[2,710],{133:825}),o($VZ3,[2,714],{135:826}),o($V_3,$V$3,{137:827,152:828}),{70:[1,829]},o($VZ3,[2,716],{139:830}),o($VZ3,[2,718],{141:831}),o($V_3,$V$3,{152:828,137:832}),o($V_3,$V$3,{152:828,137:833}),o($V_3,$V$3,{152:828,137:834}),o($V_3,$V$3,{152:828,137:835}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,92:836,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:837,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V04,[2,720],{150:838}),o($VH,[2,543],{157:[1,839]}),o($VH,[2,539],{157:[1,840]}),o($VH,[2,532]),{91:841,107:$VO,256:$Va1},o($VH,[2,541],{157:[1,842]}),o($VH,[2,536]),o($VH,[2,537],{90:[1,843]}),o($V43,[2,61]),{36:844,72:67,81:$V6,158:92,163:$Va},o($VH,[2,401],{67:$V14,104:[1,845]}),o($V24,[2,402]),{99:[1,847]},{3:848,4:$V1,5:$V2},o($Vi1,[2,746]),o($Vi1,[2,747]),o($VH,[2,557]),o($V73,[2,319],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VP3,$VQ3,{278:322,90:$VI1,97:$VJ1,98:$VK1,108:$VM1,111:$VN1,113:$VO1,128:$VR1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,280:$V32,284:$V62}),o($VE1,[2,618]),o($VE1,[2,620]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:849,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{97:[1,851],99:[1,850]},{3:853,4:$V1,5:$V2,70:$V34,106:$V44,381:852},o($V73,[2,683]),o($Vb3,[2,126],{67:$VH3}),o($Vb3,[2,127],{67:$VH3}),o($Vb3,[2,128],{67:$VH3}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:856,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:857,4:$V1,5:$V2,91:859,106:[1,858],107:$VO,256:$Va1},o($VI3,[2,250]),o($VI3,[2,252]),o($VI3,[2,254]),o($Vt1,[2,138]),o($Vt1,[2,729]),{71:[1,860]},o($Vw1,[2,686]),{3:861,4:$V1,5:$V2},{3:862,4:$V1,5:$V2},{3:864,4:$V1,5:$V2,334:863},{3:864,4:$V1,5:$V2,334:865},{3:866,4:$V1,5:$V2},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:867,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:868,4:$V1,5:$V2},o($Vc3,[2,445]),o($VH,$V54,{354:869,69:$V64,70:[1,870]}),o($VH,$V54,{354:872,69:$V64}),{70:[1,873]},{3:217,4:$V1,5:$V2,173:874},o($V73,[2,667]),o($V73,[2,669]),o($V73,[2,775]),{116:$Vr1,119:$Vs1,379:875},o($V74,[2,778],{367:168,428:876,118:877,119:$Vo1,368:$Vg1,372:$Vh1}),o($Vf3,$Vg3),{67:$Vd3,71:[1,878]},o($V84,[2,790],{437:879,438:880,126:[1,881]}),o($VK3,[2,789]),o($Vh3,[2,677]),o($Vh3,[2,678]),o($VH,[2,432],{70:[1,882]}),{69:[1,884],70:[1,883]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,122:[1,885],128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($VV3,$V94,{72:67,158:92,417:886,36:889,81:$V6,120:$Va4,163:$Va,419:$Vb4}),o($VM3,[2,769]),o($Vi3,[2,659]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:890,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE1,[2,626],{99:[1,891]}),{106:$Vc4,247:$Vd4,337:892},o([4,5,8,47,65,67,69,71,81,85,90,93,97,98,99,104,105,106,107,108,109,110,111,112,113,114,115,116,117,119,120,122,123,124,126,128,130,136,138,140,142,143,144,145,146,147,149,153,154,155,157,159,161,163,172,180,182,194,195,196,197,198,199,200,201,205,212,215,216,218,233,244,245,246,247,248,249,250,251,252,256,257,264,266,267,268,269,270,271,272,273,274,275,276,277,280,282,283,284,285,287,290,291,294,298,307,319,320,324,325,344,347,348,351,353,355,356,364,365,366,368,372,383,385,386,388,389,390,391,392,396,397,400,401,413,419,447,449,450,451],[2,483],{70:[1,895]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:897,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,295:896,367:168,368:$Vg1,372:$Vh1},o($VH,[2,406],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VH,[2,526]),o($VH,[2,527]),o($VH,[2,606]),{71:[1,898],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,899],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:147,4:$V1,5:$V2,36:900,51:144,70:$VM,72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:901,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{71:[1,902]},{67:$V63,71:[1,903]},o($Vn1,[2,378]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:904,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,36:905,51:144,70:$VM,71:[1,907],72:67,81:$V6,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:906,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,158:92,163:$Va,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,381]),o($Vn1,[2,383]),o($Vn1,$Ve4,{239:908,240:$Vf4}),{71:[1,910],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,911],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{67:$V63,71:[1,912]},{3:913,4:$V1,5:$V2,154:[1,914]},o($Ve2,[2,558]),o($Vn1,[2,327]),{264:[1,915]},o($Vn1,[2,333]),{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,264:[2,337],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:916,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{4:$Vj3,236:917,338:$Vk3},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:918,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Ve2,[2,580]),o($Vt3,[2,587]),o($Vu3,[2,575]),o($VT3,$VS3),o($Ve2,[2,577]),o($Vx3,[2,582]),o($Vx3,[2,584]),o($Vx3,[2,585]),o($Vx3,[2,586]),o($VV3,[2,408],{67:$Vg4}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:897,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,295:921,367:168,368:$Vg1,372:$Vh1},o($Vh4,[2,416]),o($Vh4,[2,417]),o($VV3,[2,409]),{67:$Vi4,71:[1,922]},o($Vj4,[2,429]),o($VH,[2,653],{406:924,407:925,408:926,266:$VW3,413:[1,927]}),o($Vk4,[2,637]),o($Vk4,[2,638]),{128:[1,929],409:[1,928]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,266:[2,634],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Vj2,[2,157]),{3:930,4:$V1,5:$V2},o($VH,[2,511]),o($Vl4,[2,216],{77:931,205:[1,932]}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:933,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vy3,[2,147],{178:934,187:936,179:937,188:938,193:941,67:$Vm4,180:$Vn4,182:$Vo4,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4}),{3:193,4:$V1,5:$V2,36:390,70:$Vj1,72:67,81:$V6,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,158:92,163:$Va,173:188,174:190,175:189,176:191,177:950,183:806,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},o($Vj4,[2,155]),{3:638,4:$V1,5:$V2,88:951,89:636,90:$Vz3},o($VY3,[2,70]),o($VA3,[2,125],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{71:[1,952]},{67:$V63,71:[2,705]},{3:147,4:$V1,5:$V2,51:144,70:$VM,71:[2,698],89:130,91:134,95:953,96:954,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,215:[1,956],222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,78]),o($VZ3,[2,701],{127:642,153:$VB3,154:$VC3,155:$VD3}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,958],90:$Vt2,92:959,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},o($VZ3,[2,702],{127:642,153:$VB3,154:$VC3,155:$VD3}),{71:[1,960],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,961]},o($VE3,[2,98]),{67:$V14,71:[1,962]},o($VE3,[2,100]),{67:$V63,71:[1,963]},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,964],90:$Vt2,92:965,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,966],90:$Vt2,92:967,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,968],90:$Vt2,92:969,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,970],90:$Vt2,92:971,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{67:$Vx4,71:[1,972]},o($Vy4,[2,121],{367:168,3:411,118:433,132:443,134:444,92:974,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,368:$Vg1,372:$Vh1}),o($V_3,$V$3,{152:828,137:975}),{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,976],90:$Vt2,92:977,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:411,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,71:[1,978],90:$Vt2,92:979,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{67:$Vx4,71:[1,980]},{67:$Vx4,71:[1,981]},{67:$Vx4,71:[1,982]},{67:$Vx4,71:[1,983]},{71:[1,984],127:642,153:$VB3,154:$VC3,155:$VD3},{67:$VH3,71:[1,985]},{3:411,4:$V1,5:$V2,65:$Vq2,67:[1,986],69:$Vr2,70:$Vs2,90:$Vt2,92:987,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,118:433,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,132:443,134:444,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,367:168,368:$Vg1,372:$Vh1},{3:988,4:$V1,5:$V2},{3:989,4:$V1,5:$V2},o($VH,[2,534]),{3:990,4:$V1,5:$V2},{91:991,107:$VO,256:$Va1},{71:[1,992]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:993,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,288:994,289:693},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:995,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{99:[1,996]},o($VH,[2,590],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:997,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:853,4:$V1,5:$V2,70:$V34,106:$V44,381:998},o($Vz4,[2,595]),o($Vz4,[2,596]),o($Vz4,[2,597]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:999,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VI3,[2,247]),o($VI3,[2,249]),o($VI3,[2,251]),o($VI3,[2,253]),o($Vt1,[2,139]),o($VH,[2,506]),{122:[1,1e3]},o($VH,[2,507]),o($V73,[2,477],{236:1001,4:$Vj3,336:[1,1002],338:$Vk3}),o($VH,[2,508]),o($VH,[2,510]),{67:$V63,71:[1,1003]},o($VH,[2,514]),o($VH,[2,518]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:1004,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:1005,4:$V1,5:$V2},o($VH,[2,520]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1006,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,1007]},{3:1008,4:$V1,5:$V2},{69:$VJ3,114:[2,780],429:1009,432:1010},o($V74,[2,779]),o($V73,[2,671]),o($V84,[2,675]),o($V84,[2,791]),{3:1011,4:$V1,5:$V2},{3:864,4:$V1,5:$V2,69:[1,1014],302:1012,309:1013,334:1015},{3:638,4:$V1,5:$V2,89:793,204:1016},{36:1017,72:67,81:$V6,158:92,163:$Va},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1018,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VV3,[2,658]),{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:1019,288:691,289:693},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:1020,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VV3,[2,663]),o($VE1,[2,627],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1021,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{67:[1,1022],71:[1,1023]},o($Vy4,[2,485]),o($Vy4,[2,486]),{106:$Vc4,247:$Vd4,337:1024},{67:$VA4,71:[1,1025]},o($Vy4,[2,421],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vn1,[2,349]),o($Vn1,[2,353]),{71:[1,1027]},{67:$V63,71:[1,1028]},o($Vn1,[2,374]),o($Vn1,[2,376]),{71:[1,1029],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,1030]},{67:$V63,71:[1,1031]},o($Vn1,[2,379]),o($Vn1,[2,298]),{70:[1,1032]},o($Vn1,$Ve4,{239:1033,240:$Vf4}),o($Vn1,$Ve4,{239:1034,240:$Vf4}),o($Va2,[2,316]),o($VT3,[2,259]),o($Vn1,[2,256]),o($Vn1,[2,332]),o($Vs3,[2,336],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{67:[1,1036],71:[1,1035]},{67:[1,1038],71:[1,1037],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:913,4:$V1,5:$V2},{70:[1,1039],116:$VQ,118:1040,119:$Vo1,126:$VS,155:$VW,175:1041,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{67:$VA4,71:[1,1042]},{36:1044,72:67,81:$V6,123:[1,1043],158:92,163:$Va},{3:638,4:$V1,5:$V2,89:1045},o($VH,[2,630]),o($Vk4,[2,635]),o($Vk4,[2,636]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:489,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,148:1046,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,221:488,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{144:[1,1048],267:[1,1047]},{409:[1,1049]},o($Vj2,[2,158]),o($VB4,[2,235],{78:1050,93:[1,1051]}),{94:[1,1052]},o($VX3,[2,215],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vy3,[2,148],{188:938,193:941,187:1053,179:1054,180:$Vn4,182:$Vo4,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4}),{3:193,4:$V1,5:$V2,70:$Vj1,107:$Vk1,116:$VQ,118:187,119:$VR,126:$VS,155:$VW,173:188,174:190,175:189,176:191,183:1055,186:192,260:$Vd1,367:168,368:$Vg1,372:$Vh1},o($VC4,[2,181]),o($VC4,[2,182]),{3:193,4:$V1,5:$V2,70:[1,1060],116:$VQ,118:1058,119:$VR,126:$VS,155:$VW,173:1057,174:1061,175:1059,176:1062,189:1056,260:$Vd1,367:168,368:$Vg1,372:$Vh1},{181:[1,1063],195:$VD4},{181:[1,1065],195:$VE4},o($VF4,[2,198]),{180:[1,1069],182:[1,1068],193:1067,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4},o($VF4,[2,200]),{195:[1,1070]},{182:[1,1072],195:[1,1071]},{182:[1,1074],195:[1,1073]},{182:[1,1075]},{195:[1,1076]},{195:[1,1077]},{67:$Vm4,178:1078,179:937,180:$Vn4,182:$Vo4,187:936,188:938,193:941,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4},o($VY3,[2,67]),o($VE3,[2,80]),{67:$VG4,71:[1,1079]},{71:[1,1081]},o($VH4,[2,237]),{71:[2,699]},o($VH4,[2,239],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,215:[1,1082],216:[1,1083],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VE3,[2,79]),o($VZ3,[2,703],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,81]),o($VE3,[2,82]),o($VE3,[2,99]),o($VE3,[2,102]),o($VE3,[2,105]),o($VZ3,[2,707],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,106]),o($VZ3,[2,709],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,107]),o($VZ3,[2,711],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,108]),o($VZ3,[2,715],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,109]),o($V_3,[2,722],{151:1084}),o($V_3,[2,725],{127:642,153:$VB3,154:$VC3,155:$VD3}),{67:$Vx4,71:[1,1085]},o($VE3,[2,111]),o($VZ3,[2,717],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,112]),o($VZ3,[2,719],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,113]),o($VE3,[2,114]),o($VE3,[2,115]),o($VE3,[2,116]),o($VE3,[2,117]),o($VE3,[2,118]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:235,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,125:1086,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V04,[2,721],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VH,[2,544]),o($VH,[2,540]),o($VH,[2,542]),o($VH,[2,538]),o($V43,[2,63]),o($VH,[2,400],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($V24,[2,403]),o($V24,[2,404],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1087,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,591],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vz4,[2,594]),{71:[1,1088],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{3:1089,4:$V1,5:$V2},o($V73,[2,487],{335:1090,339:1091,340:1092,317:1100,128:$VI4,161:$VJ4,257:$VK4,294:$VL4,307:$VM4,319:$VN4,320:$VO4,324:$VP4,325:$VQ4}),o($V73,[2,476]),o($VH,[2,513],{69:[1,1103]}),{67:$V63,71:[1,1104]},o($VH,[2,522]),{67:$VG4,71:[1,1105]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1106,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VL3,[2,673]),{114:[1,1107]},{114:[2,781]},o($V84,[2,676]),{71:[1,1108]},{67:[1,1109],71:[2,447]},{36:1110,72:67,81:$V6,158:92,163:$Va},o($Vy4,[2,473]),{67:$Vi4,71:[1,1111]},o($VH,[2,762],{359:1112,360:1113,65:$VR4}),o($VV3,$V94,{72:67,158:92,278:322,36:889,417:1115,81:$V6,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,120:$Va4,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,163:$Va,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72,419:$Vb4}),o($VV3,[2,661],{67:$V14}),o($VV3,[2,662],{67:$V63}),o($VE1,[2,628],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{106:[1,1116]},o($VS4,[2,480]),{67:[1,1117],71:[1,1118]},o($VS4,[2,484]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1119,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,365]),o($Vn1,[2,366]),o($Vn1,[2,390]),o($Vn1,[2,375]),o($Vn1,[2,377]),{93:$VT4,241:1120,242:1121,243:[1,1122]},o($Vn1,[2,299]),o($Vn1,[2,300]),o($Vn1,[2,287]),{106:[1,1124]},o($Vn1,[2,289]),{106:[1,1125]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:897,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,295:1126,367:168,368:$Vg1,372:$Vh1},o($Vh4,[2,419]),o($Vh4,[2,420]),o($Vh4,[2,415]),{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:1127,367:168,368:$Vg1,372:$Vh1},o($VV3,[2,412]),o($Vj4,[2,430]),o($VH,[2,654],{67:$VH3,172:[1,1128]}),{287:$VU4,290:$VV4,410:1129},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1132,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{94:[1,1134],144:[1,1135],267:[1,1133]},o($VW4,[2,243],{79:1136,218:[1,1137]}),{94:[1,1138]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1139,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VC4,[2,179]),o($VC4,[2,180]),o($Vj4,[2,156]),o($VC4,[2,213],{190:1145,202:[1,1146],203:[1,1147]}),o($V_4,[2,184],{3:1148,4:$V1,5:$V2,69:[1,1149]}),o($V$4,[2,734],{191:1150,69:[1,1151]}),{3:1152,4:$V1,5:$V2,69:[1,1153]},{36:1154,72:67,81:$V6,158:92,163:$Va},o($V_4,[2,192],{3:1155,4:$V1,5:$V2,69:[1,1156]}),o($V_4,[2,195],{3:1157,4:$V1,5:$V2,69:[1,1158]}),{70:[1,1159]},o($VF4,[2,210]),{70:[1,1160]},o($VF4,[2,206]),o($VF4,[2,199]),{195:$VE4},{195:$VD4},o($VF4,[2,201]),o($VF4,[2,202]),{195:[1,1161]},o($VF4,[2,204]),{195:[1,1162]},{195:[1,1163]},o($VF4,[2,208]),o($VF4,[2,209]),{71:[1,1164],179:1054,180:$Vn4,182:$Vo4,187:1053,188:938,193:941,194:$Vp4,195:$Vq4,196:$Vr4,197:$Vs4,198:$Vt4,199:$Vu4,200:$Vv4,201:$Vw4},o($VE3,[2,72]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:1165,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VE3,[2,73]),o($VH4,[2,240]),{217:[1,1166]},o($Vy4,[2,120],{367:168,3:411,118:433,132:443,134:444,92:1167,4:$V1,5:$V2,65:$Vq2,69:$Vr2,70:$Vs2,90:$Vt2,93:$Vu2,97:$Vv2,98:$Vw2,99:$Vx2,104:$Vy2,105:$Vz2,106:$VA2,107:$VB2,108:$VC2,109:$VD2,110:$VE2,111:$VF2,112:$VG2,113:$VH2,114:$VI2,115:$VJ2,116:$VK2,117:$VL2,119:$VM2,120:$VN2,122:$VO2,123:$VP2,124:$VQ2,126:$VR2,128:$VS2,130:$VT2,136:$VU2,138:$VV2,140:$VW2,142:$VX2,143:$VY2,144:$VZ2,145:$V_2,146:$V$2,147:$V03,149:$V13,159:$V23,161:$V33,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,368:$Vg1,372:$Vh1}),o($VE3,[2,110]),{67:$V63,71:[1,1168]},o($V24,[2,405],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($Vz4,[2,598]),o($VH,[2,509]),o($V73,[2,475]),o($V73,[2,488],{317:1100,340:1169,128:$VI4,161:$VJ4,257:$VK4,294:$VL4,307:$VM4,319:$VN4,320:$VO4,324:$VP4,325:$VQ4}),o($V53,[2,490]),{321:[1,1170]},{321:[1,1171]},{3:217,4:$V1,5:$V2,173:1172},o($V53,[2,496],{70:[1,1173]}),{3:231,4:$V1,5:$V2,70:[1,1175],91:225,106:$VN,107:$VO,116:$VQ,126:$VS,155:$VW,170:224,174:229,175:228,225:226,226:227,232:$Vp1,238:1174,254:$V81,255:$V91,256:$Va1,257:$Vb1,260:$Vd1},o($V53,[2,499]),{257:[1,1176]},o($V53,[2,501]),o($V53,[2,502]),{70:[1,1177]},{3:1178,4:$V1,5:$V2},o($VH,$V54,{354:1179,69:$V64}),o($VH,[2,528]),{67:$VG4,71:[1,1180]},o([8,67,71,107,112,126,264,268,450,451],$VC1,{434:280,379:282,3:734,430:1181,424:1182,431:1183,4:$V1,5:$V2,116:$Vr1,119:$Vs1}),o($VH,[2,435],{303:1184,305:1185,306:1186,4:$V05,294:$V15,307:$V25}),o($V35,$V45,{3:864,310:1190,334:1191,311:1192,312:1193,4:$V1,5:$V2,318:$V55}),{71:[2,448]},{69:[1,1195]},o($VH,[2,546]),o($VH,[2,763]),{319:[1,1197],361:[1,1196]},o($VV3,[2,664]),{71:[1,1198]},{106:[1,1199]},o($VS4,[2,481]),o($Vy4,[2,422],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{71:[1,1200],93:$VT4,242:1201},{71:[1,1202]},{94:[1,1203]},{94:[1,1204]},{71:[1,1205]},{71:[1,1206]},{67:$VA4,71:[1,1207]},o($VV3,[2,410],{67:$Vg4}),{3:217,4:$V1,5:$V2,116:$Vr1,119:$Vs1,173:1209,379:1208},o($Vk4,[2,639]),o($Vk4,[2,641]),{120:[1,1210]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1211],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{291:$V65,411:1212},{365:[1,1215],412:[1,1214]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1216,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VA3,[2,226],{80:1217,136:[1,1218],142:[1,1220],143:[1,1219]}),{106:$VN,170:1221},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1222,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vl4,[2,224],{207:1223,67:$V75,212:[1,1225]}),o($V85,[2,218]),{120:[1,1226]},{70:[1,1227]},{70:[1,1228]},o($V85,[2,223],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VC4,[2,183]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1229,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:638,4:$V1,5:$V2,89:793,204:1230},o($V_4,[2,185]),{3:1231,4:$V1,5:$V2},o($V_4,[2,736],{192:1232,3:1233,4:$V1,5:$V2}),o($V$4,[2,735]),o($V_4,[2,188]),{3:1234,4:$V1,5:$V2},{71:[1,1235]},o($V_4,[2,193]),{3:1236,4:$V1,5:$V2},o($V_4,[2,196]),{3:1237,4:$V1,5:$V2},{36:1238,72:67,81:$V6,158:92,163:$Va},{36:1239,72:67,81:$V6,158:92,163:$Va},o($VF4,[2,203]),o($VF4,[2,205]),o($VF4,[2,207]),o($Vy3,[2,149]),o($VH4,[2,238]),o($VH4,[2,241],{215:[1,1240]}),o($V_3,[2,723],{127:642,153:$VB3,154:$VC3,155:$VD3}),o($VE3,[2,119]),o($V53,[2,489]),o($V53,[2,492]),{325:[1,1241]},o($V53,[2,756],{343:1242,341:1243,70:$V95}),{106:$VN,170:1245},o($V53,[2,497]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1246,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($V53,[2,500]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1247,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VH,[2,515]),o($VH,[2,519]),o($VH,[2,529]),o($V73,[2,670]),o($V73,[2,782]),o($V73,[2,783]),o($VH,[2,431]),o($VH,[2,436],{306:1248,4:$V05,294:$V15,307:$V25}),o($Va5,[2,438]),o($Va5,[2,439]),{99:[1,1249]},{99:[1,1250]},{67:[1,1251],71:[2,446]},o($Vy4,[2,474]),o($Vy4,[2,449]),{161:[1,1259],167:[1,1260],313:1252,314:1253,315:1254,316:1255,317:1256,319:$VN4,320:[1,1257],321:[1,1261],324:[1,1258]},{3:1262,4:$V1,5:$V2},{36:1263,72:67,81:$V6,158:92,163:$Va},{362:[1,1264]},{363:[1,1265]},o($VS4,[2,478]),{71:[1,1266]},o($Vn1,[2,302]),{71:[1,1267]},o($Vn1,[2,303]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1268,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,95:1269,100:957,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,214:955,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($Vn1,[2,288]),o($Vn1,[2,290]),o($Vh4,[2,418]),{3:1270,4:$V1,5:$V2},o($VH,[2,656],{70:[1,1271]}),{3:638,4:$V1,5:$V2,89:692,116:$VF3,119:$VG3,121:1272,288:691,289:693},{287:$VU4,290:$VV4,410:1273},o($Vk4,[2,643]),{70:[1,1275],123:[1,1274],294:[1,1276]},{144:[1,1278],267:[1,1277]},{144:[1,1280],267:[1,1279]},{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1281],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($VA3,[2,64]),{36:1282,72:67,81:$V6,138:[1,1283],158:92,163:$Va,213:[1,1284]},{36:1285,72:67,81:$V6,158:92,163:$Va,213:[1,1286]},{36:1287,72:67,81:$V6,158:92,163:$Va,213:[1,1288]},o($VW4,[2,245],{219:1289,220:[1,1290]}),o($VB4,[2,236],{67:$VG4}),o($Vl4,[2,217]),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,208:1291,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1292,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{70:[1,1293]},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1294,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1295,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},o($VC4,[2,211],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),o($VC4,[2,212],{67:$Vi4}),o($V_4,[2,186]),o($V_4,[2,187]),o($V_4,[2,737]),o($V_4,[2,189]),{3:1296,4:$V1,5:$V2,69:[1,1297]},o($V_4,[2,194]),o($V_4,[2,197]),{71:[1,1298]},{71:[1,1299]},o($VH4,[2,242]),{3:217,4:$V1,5:$V2,173:1300},o($V53,[2,494]),o($V53,[2,757]),{3:1301,4:$V1,5:$V2},{67:[1,1302]},{71:[1,1303],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},{71:[1,1304],90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Va5,[2,437]),{3:1305,4:$V1,5:$V2},{106:$VN,170:1306},o($V35,$V45,{312:1193,311:1307,318:$V55}),o($V73,[2,451]),o($V73,[2,452]),o($V73,[2,453]),o($V73,[2,454]),o($V73,[2,455]),{321:[1,1308]},{321:[1,1309]},{3:1311,4:$V1,5:$V2,70:[2,752],333:1310},{3:1312,4:$V1,5:$V2},{3:1313,4:$V1,5:$V2},o($V35,[2,457]),o($VH,[2,760],{358:1314,360:1315,65:$VR4}),o($VH,[2,547]),o($VH,[2,548],{318:[1,1316]}),o($VS4,[2,479]),o($Vn1,[2,304]),o([71,93],[2,305],{67:$V75}),{67:$VG4,71:[2,306]},o($VH,[2,655]),{3:638,4:$V1,5:$V2,89:793,204:1317},o($Vk4,[2,642],{67:$V14}),o($Vk4,[2,640]),{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:1318,367:168,368:$Vg1,372:$Vh1},{3:638,4:$V1,5:$V2,89:793,204:1319},{123:[1,1320]},{291:$V65,411:1321},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1322,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{291:$V65,411:1323},{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1324,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{291:$V65,411:1325},o($VA3,[2,227]),{36:1326,72:67,81:$V6,158:92,163:$Va,213:[1,1327]},{36:1328,72:67,81:$V6,158:92,163:$Va},o($VA3,[2,229]),{36:1329,72:67,81:$V6,158:92,163:$Va},o($VA3,[2,230]),{36:1330,72:67,81:$V6,158:92,163:$Va},o($VW4,[2,244]),{106:$VN,170:1331},o($V85,[2,219]),o($Vl4,[2,225],{278:322,90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72}),{3:147,4:$V1,5:$V2,51:144,70:$VM,89:130,91:134,100:1144,106:$VN,107:$VO,112:$VP,116:$VQ,118:141,119:$VR,126:$VS,128:$VT,132:146,153:$VU,154:$VV,155:$VW,170:132,174:128,175:136,176:137,206:1332,208:1140,209:$VX4,210:$VY4,211:$VZ4,222:131,223:127,224:129,225:133,226:135,227:138,228:139,229:140,230:142,232:$VX,233:$Vb,234:$VY,235:$VZ,237:$V_,244:$V$,245:$V01,246:$V11,247:$V21,248:$V31,249:$V41,250:$V51,251:$V61,252:$V71,254:$V81,255:$V91,256:$Va1,257:$Vb1,258:$Vc1,260:$Vd1,261:$Ve1,270:$Vf1,367:168,368:$Vg1,372:$Vh1},{67:$V75,71:[1,1333]},{67:$V75,71:[1,1334]},o($V_4,[2,190]),{3:1335,4:$V1,5:$V2},{3:1336,4:$V1,5:$V2,69:[1,1337]},{3:1338,4:$V1,5:$V2,69:[1,1339]},o($V53,[2,754],{342:1340,341:1341,70:$V95}),{71:[1,1342]},{106:$VN,170:1343},o($V53,[2,498]),o($V53,[2,458]),o($Va5,[2,440]),o($Va5,[2,441]),o($Vy4,[2,450]),{3:1345,4:$V1,5:$V2,70:[2,748],322:1344},{70:[1,1346]},{70:[1,1347]},{70:[2,753]},{70:[1,1348]},{70:[1,1349]},o($VH,[2,545]),o($VH,[2,761]),o($V35,$V45,{312:1193,311:1350,318:$V55}),{67:$Vi4,71:[1,1351]},o($Vk4,[2,649],{67:$Vg4}),{67:$Vi4,71:[1,1352]},o($Vk4,[2,651]),o($Vk4,[2,644]),{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1353],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Vk4,[2,647]),{90:$VI1,97:$VJ1,98:$VK1,99:$V83,108:$VM1,111:$VN1,113:$VO1,114:$VP1,115:$VQ1,128:$VR1,144:$VS1,145:$VT1,153:$VU1,154:$VV1,267:[1,1354],269:$VW1,270:$VX1,271:$VY1,272:$VZ1,273:$V_1,274:$V$1,275:$V02,276:$V12,277:$V22,278:322,280:$V32,282:$V42,283:$V52,284:$V62,285:$V72},o($Vk4,[2,645]),o($VA3,[2,228]),{36:1355,72:67,81:$V6,158:92,163:$Va},o($VA3,[2,231]),o($VA3,[2,233]),o($VA3,[2,234]),o($VW4,[2,246]),{67:$V75,71:[1,1356]},o($V85,[2,221]),o($V85,[2,222]),o($V_4,[2,191]),o($VC4,[2,151]),{3:1357,4:$V1,5:$V2},o($VC4,[2,153]),{3:1358,4:$V1,5:$V2},o($V53,[2,493]),o($V53,[2,755]),o($V53,[2,491]),{71:[1,1359]},{70:[1,1360]},{70:[2,749]},{3:1362,4:$V1,5:$V2,107:$Vb5,323:1361},{3:638,4:$V1,5:$V2,89:793,204:1364},{3:638,4:$V1,5:$V2,89:793,204:1365},{3:638,4:$V1,5:$V2,89:793,204:1366},o($VH,[2,549]),o($VH,[2,657]),{123:[1,1367],294:[1,1368]},{291:$V65,411:1369},{287:$VU4,290:$VV4,410:1370},o($VA3,[2,232]),o($V85,[2,220]),o($VC4,[2,152]),o($VC4,[2,154]),o($V53,[2,495]),{3:1362,4:$V1,5:$V2,107:$Vb5,323:1371},{67:$Vc5,71:[1,1372]},o($Vy4,[2,469]),o($Vy4,[2,470]),{67:$Vi4,71:[1,1374]},{67:$Vi4,71:[1,1375]},{67:$Vi4,71:[1,1376]},{70:$VU3,116:$VQ,118:789,119:$Vo1,126:$VS,155:$VW,175:790,260:$Vd1,293:1377,367:168,368:$Vg1,372:$Vh1},{123:[1,1378]},o($Vk4,[2,646]),o($Vk4,[2,648]),{67:$Vc5,71:[1,1379]},{325:[1,1380]},{3:1381,4:$V1,5:$V2,107:[1,1382]},o($V73,[2,466]),o($V73,[2,467]),o($V73,[2,468]),o($Vk4,[2,650],{67:$Vg4}),o($Vk4,[2,652]),o($V73,[2,459]),{3:217,4:$V1,5:$V2,173:1383},o($Vy4,[2,471]),o($Vy4,[2,472]),o($Vd5,[2,750],{326:1384,328:1385,70:[1,1386]}),o($V73,[2,462],{327:1387,329:1388,202:[1,1389]}),o($Vd5,[2,751]),{3:1362,4:$V1,5:$V2,107:$Vb5,323:1390},o($V73,[2,460]),{202:[1,1392],330:1391},{290:[1,1393]},{67:$Vc5,71:[1,1394]},o($V73,[2,463]),{287:[1,1395]},{331:[1,1396]},o($Vd5,[2,461]),{331:[1,1397]},{332:[1,1398]},{332:[1,1399]},{202:[2,464]},o($V73,[2,465])],defaultActions:{97:[2,3],171:[2,307],172:[2,308],173:[2,309],174:[2,310],175:[2,311],176:[2,312],177:[2,313],178:[2,314],179:[2,315],184:[2,631],281:[2,777],288:[2,771],335:[2,738],336:[2,739],389:[2,632],455:[2,712],456:[2,713],560:[2,397],561:[2,398],562:[2,399],615:[2,633],956:[2,699],1010:[2,781],1110:[2,448],1311:[2,753],1345:[2,749],1398:[2,464]},parseError:function parseError(str,hash){if(hash.recoverable){this.trace(str) }else{throw new Error(str)}},parse:function parse(input){var self=this,stack=[0],tstack=[],vstack=[null],lstack=[],table=this.table,yytext="",yylineno=0,yyleng=0,recovering=0,TERROR=2,EOF=1;var args=lstack.slice.call(arguments,1);var lexer=Object.create(this.lexer);var sharedState={yy:{}};for(var k in this.yy){if(Object.prototype.hasOwnProperty.call(this.yy,k)){sharedState.yy[k]=this.yy[k]}}lexer.setInput(input,sharedState.yy);sharedState.yy.lexer=lexer;sharedState.yy.parser=this;if(typeof lexer.yylloc=="undefined"){lexer.yylloc={}}var yyloc=lexer.yylloc;lstack.push(yyloc);var ranges=lexer.options&&lexer.options.ranges;if(typeof sharedState.yy.parseError==="function"){this.parseError=sharedState.yy.parseError}else{this.parseError=Object.getPrototypeOf(this).parseError}function popStack(n){stack.length=stack.length-2*n;vstack.length=vstack.length-n;lstack.length=lstack.length-n}_token_stack:function lex(){var token;token=lexer.lex()||EOF;if(typeof token!=="number"){token=self.symbols_[token]||token}return token}var symbol,preErrorSymbol,state,action,a,r,yyval={},p,len,newState,expected;while(true){state=stack[stack.length-1];if(this.defaultActions[state]){action=this.defaultActions[state]}else{if(symbol===null||typeof symbol=="undefined"){symbol=lex()}action=table[state]&&table[state][symbol]}if(typeof action==="undefined"||!action.length||!action[0]){var errStr="";expected=[];for(p in table[state]){if(this.terminals_[p]&&p>TERROR){expected.push("'"+this.terminals_[p]+"'")}}if(lexer.showPosition){errStr="Parse error on line "+(yylineno+1)+":\n"+lexer.showPosition()+"\nExpecting "+expected.join(", ")+", got '"+(this.terminals_[symbol]||symbol)+"'"}else{errStr="Parse error on line "+(yylineno+1)+": Unexpected "+(symbol==EOF?"end of input":"'"+(this.terminals_[symbol]||symbol)+"'")}this.parseError(errStr,{text:lexer.match,token:this.terminals_[symbol]||symbol,line:lexer.yylineno,loc:yyloc,expected:expected})}if(action[0]instanceof Array&&action.length>1){throw new Error("Parse Error: multiple actions possible at state: "+state+", token: "+symbol)}switch(action[0]){case 1:stack.push(symbol);vstack.push(lexer.yytext);lstack.push(lexer.yylloc);stack.push(action[1]);symbol=null;if(!preErrorSymbol){yyleng=lexer.yyleng;yytext=lexer.yytext;yylineno=lexer.yylineno;yyloc=lexer.yylloc;if(recovering>0){recovering--}}else{symbol=preErrorSymbol;preErrorSymbol=null}break;case 2:len=this.productions_[action[1]][1];yyval.$=vstack[vstack.length-len];yyval._$={first_line:lstack[lstack.length-(len||1)].first_line,last_line:lstack[lstack.length-1].last_line,first_column:lstack[lstack.length-(len||1)].first_column,last_column:lstack[lstack.length-1].last_column};if(ranges){yyval._$.range=[lstack[lstack.length-(len||1)].range[0],lstack[lstack.length-1].range[1]]}r=this.performAction.apply(yyval,[yytext,yyleng,yylineno,sharedState.yy,action[1],vstack,lstack].concat(args));if(typeof r!=="undefined"){return r}if(len){stack=stack.slice(0,-1*len*2);vstack=vstack.slice(0,-1*len);lstack=lstack.slice(0,-1*len)}stack.push(this.productions_[action[1]][0]);vstack.push(yyval.$);lstack.push(yyval._$);newState=table[stack[stack.length-2]][stack[stack.length-1]];stack.push(newState);break;case 3:return true}}return true}};var lexer=function(){var lexer={EOF:1,parseError:function parseError(str,hash){if(this.yy.parser){this.yy.parser.parseError(str,hash)}else{throw new Error(str)}},setInput:function(input,yy){this.yy=yy||this.yy||{};this._input=input;this._more=this._backtrack=this.done=false;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};if(this.options.ranges){this.yylloc.range=[0,0]}this.offset=0;return this},input:function(){var ch=this._input[0];this.yytext+=ch;this.yyleng++;this.offset++;this.match+=ch;this.matched+=ch;var lines=ch.match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno++;this.yylloc.last_line++}else{this.yylloc.last_column++}if(this.options.ranges){this.yylloc.range[1]++}this._input=this._input.slice(1);return ch},unput:function(ch){var len=ch.length;var lines=ch.split(/(?:\r\n?|\n)/g);this._input=ch+this._input;this.yytext=this.yytext.substr(0,this.yytext.length-len);this.offset-=len;var oldLines=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);if(lines.length-1){this.yylineno-=lines.length-1}var r=this.yylloc.range;this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:lines?(lines.length===oldLines.length?this.yylloc.first_column:0)+oldLines[oldLines.length-lines.length].length-lines[0].length:this.yylloc.first_column-len};if(this.options.ranges){this.yylloc.range=[r[0],r[0]+this.yyleng-len]}this.yyleng=this.yytext.length;return this},more:function(){this._more=true;return this},reject:function(){if(this.options.backtrack_lexer){this._backtrack=true}else{return 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})}return this},less:function(n){this.unput(this.match.slice(n))},pastInput:function(){var past=this.matched.substr(0,this.matched.length-this.match.length);return(past.length>20?"...":"")+past.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var next=this.match;if(next.length<20){next+=this._input.substr(0,20-next.length)}return(next.substr(0,20)+(next.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var pre=this.pastInput();var c=new Array(pre.length+1).join("-");return pre+this.upcomingInput()+"\n"+c+"^"},test_match:function(match,indexed_rule){var token,lines,backup;if(this.options.backtrack_lexer){backup={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};if(this.options.ranges){backup.yylloc.range=this.yylloc.range.slice(0)}}lines=match[0].match(/(?:\r\n?|\n).*/g);if(lines){this.yylineno+=lines.length}this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:lines?lines[lines.length-1].length-lines[lines.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+match[0].length};this.yytext+=match[0];this.match+=match[0];this.matches=match;this.yyleng=this.yytext.length;if(this.options.ranges){this.yylloc.range=[this.offset,this.offset+=this.yyleng]}this._more=false;this._backtrack=false;this._input=this._input.slice(match[0].length);this.matched+=match[0];token=this.performAction.call(this,this.yy,this,indexed_rule,this.conditionStack[this.conditionStack.length-1]);if(this.done&&this._input){this.done=false}if(token){return token}else if(this._backtrack){for(var k in backup){this[k]=backup[k]}return false}return false},next:function(){if(this.done){return this.EOF}if(!this._input){this.done=true}var token,match,tempMatch,index;if(!this._more){this.yytext="";this.match=""}var rules=this._currentRules();for(var i=0;imatch[0].length)){match=tempMatch;index=i;if(this.options.backtrack_lexer){token=this.test_match(tempMatch,rules[i]);if(token!==false){return token}else if(this._backtrack){match=false;continue}else{return false}}else if(!this.options.flex){break}}}if(match){token=this.test_match(match,rules[index]);if(token!==false){return token}return false}if(this._input===""){return this.EOF}else{return this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})}},lex:function lex(){var r=this.next();if(r){return r}else{return this.lex()}},begin:function begin(condition){this.conditionStack.push(condition)},popState:function popState(){var n=this.conditionStack.length-1;if(n>0){return this.conditionStack.pop()}else{return this.conditionStack[0]}},_currentRules:function _currentRules(){if(this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules}else{return this.conditions["INITIAL"].rules}},topState:function topState(n){n=this.conditionStack.length-1-Math.abs(n||0);if(n>=0){return this.conditionStack[n]}else{return"INITIAL"}},pushState:function pushState(condition){this.begin(condition)},stateStackSize:function stateStackSize(){return this.conditionStack.length},options:{"case-insensitive":true},performAction:function anonymous(yy,yy_,$avoiding_name_collisions,YY_START){var YYSTATE=YY_START;switch($avoiding_name_collisions){case 0:return 233;break;case 1:return 260;break;case 2:return 368;break;case 3:return 5;break;case 4:return 5;break;case 5:return 256;break;case 6:return 256;break;case 7:return 107;break;case 8:return 107;break;case 9:return;break;case 10:break;case 11:return 145;break;case 12:return 144;break;case 13:yy_.yytext="VALUE";return 163;break;case 14:yy_.yytext="ROW";return 163;break;case 15:yy_.yytext="COLUMN";return 163;break;case 16:yy_.yytext="MATRIX";return 163;break;case 17:yy_.yytext="INDEX";return 163;break;case 18:yy_.yytext="RECORDSET";return 163;break;case 19:yy_.yytext="TEXT";return 163;break;case 20:yy_.yytext="SELECT";return 163;break;case 21:return"ABSOLUTE";break;case 22:return 332;break;case 23:return 349;break;case 24:return 251;break;case 25:return 138;break;case 26:return 347;break;case 27:return 144;break;case 28:return 201;break;case 29:return 140;break;case 30:return 181;break;case 31:return 252;break;case 32:return 69;break;case 33:return 366;break;case 34:return 215;break;case 35:return 351;break;case 36:return 307;break;case 37:return 248;break;case 38:return 386;break;case 39:return 282;break;case 40:return 390;break;case 41:return 283;break;case 42:return 269;break;case 43:return 94;break;case 44:return 261;break;case 45:return 235;break;case 46:return 319;break;case 47:return 105;break;case 48:return"CLOSE";break;case 49:return 216;break;case 50:return 164;break;case 51:return 164;break;case 52:return 383;break;case 53:return 318;break;case 54:return 419;break;case 55:return 389;break;case 56:return 237;break;case 57:return 213;break;case 58:return 245;break;case 59:return 298;break;case 60:return 180;break;case 61:return 211;break;case 62:return 232;break;case 63:return"CURSOR";break;case 64:return 352;break;case 65:return 397;break;case 66:return 294;break;case 67:return 290;break;case 68:return"DELETED";break;case 69:return 215;break;case 70:return 353;break;case 71:return 159;break;case 72:return 344;break;case 73:return 396;break;case 74:return 110;break;case 75:return 264;break;case 76:return 338;break;case 77:return 268;break;case 78:return 143;break;case 79:return 258;break;case 80:return 12;break;case 81:return 255;break;case 82:return"FETCH";break;case 83:return 249;break;case 84:return 324;break;case 85:return 157;break;case 86:return 451;break;case 87:return 421;break;case 88:return 205;break;case 89:return 209;break;case 90:return 212;break;case 91:return 364;break;case 92:return 130;break;case 93:return 307;break;case 94:return 284;break;case 95:return 280;break;case 96:return 167;break;case 97:return 196;break;case 98:return 291;break;case 99:return"INSERTED";break;case 100:return 142;break;case 101:return 172;break;case 102:return 195;break;case 103:return 321;break;case 104:return 250;break;case 105:return"LET";break;case 106:return 197;break;case 107:return 90;break;case 108:return 218;break;case 109:return 409;break;case 110:return 165;break;case 111:return 247;break;case 112:return 401;break;case 113:return 246;break;case 114:return 143;break;case 115:return 350;break;case 116:return 194;break;case 117:return"NEXT";break;case 118:return 234;break;case 119:return 217;break;case 120:return 331;break;case 121:return 128;break;case 122:return 257;break;case 123:return 382;break;case 124:return 202;break;case 125:return 362;break;case 126:return 220;break;case 127:return"OPEN";break;case 128:return 363;break;case 129:return 145;break;case 130:return 93;break;case 131:return 182;break;case 132:return 240;break;case 133:return 146;break;case 134:return 243;break;case 135:return 452;break;case 136:return 14;break;case 137:return 320;break;case 138:return 391;break;case 139:return"PRIOR";break;case 140:return 13;break;case 141:return 361;break;case 142:return 168;break;case 143:return"REDUCE";break;case 144:return 325;break;case 145:return"RELATIVE";break;case 146:return 85;break;case 147:return 348;break;case 148:return 149;break;case 149:return 392;break;case 150:return"RESTORE";break;case 151:return 147;break;case 152:return 147;break;case 153:return 198;break;case 154:return 385;break;case 155:return 210;break;case 156:return 124;break;case 157:return 352;break;case 158:return 81;break;case 159:return 200;break;case 160:return 120;break;case 161:return 120;break;case 162:return 356;break;case 163:return 286;break;case 164:return 365;break;case 165:return"STRATEGY";break;case 166:return"STORE";break;case 167:return 244;break;case 168:return 304;break;case 169:return 304;break;case 170:return 412;break;case 171:return 308;break;case 172:return 308;break;case 173:return 166;break;case 174:return 267;break;case 175:return"TIMEOUT";break;case 176:return 122;break;case 177:return 169;break;case 178:return 384;break;case 179:return 384;break;case 180:return 254;break;case 181:return 400;break;case 182:return 136;break;case 183:return 161;break;case 184:return 287;break;case 185:return 355;break;case 186:return 203;break;case 187:return 123;break;case 188:return 109;break;case 189:return 357;break;case 190:return 266;break;case 191:return 104;break;case 192:return 388;break;case 193:return 65;break;case 194:return 384;break;case 195:return 106;break;case 196:return 106;break;case 197:return 97;break;case 198:return 112;break;case 199:return 153;break;case 200:return 270;break;case 201:return 154;break;case 202:return 108;break;case 203:return 113;break;case 204:return 277;break;case 205:return 274;break;case 206:return 276;break;case 207:return 273;break;case 208:return 271;break;case 209:return 114;break;case 210:return 272;break;case 211:return 275;break;case 212:return 115;break;case 213:return 99;break;case 214:return 275;break;case 215:return 70;break;case 216:return 71;break;case 217:return 119;break;case 218:return 372;break;case 219:return 374;break;case 220:return 376;break;case 221:return 447;break;case 222:return 449;break;case 223:return 117;break;case 224:return 67;break;case 225:return 285;break;case 226:return 126;break;case 227:return 450;break;case 228:return 116;break;case 229:return 155;break;case 230:return 111;break;case 231:return 98;break;case 232:return 4;break;case 233:return 8;break;case 234:return"INVALID";break}},rules:[/^(?:``([^\`])+``)/i,/^(?:\[\?\])/i,/^(?:@\[)/i,/^(?:\[([^\]])*?\])/i,/^(?:`([^\`])*?`)/i,/^(?:N(['](\\.|[^']|\\')*?['])+)/i,/^(?:X(['](\\.|[^']|\\')*?['])+)/i,/^(?:(['](\\.|[^']|\\')*?['])+)/i,/^(?:(["](\\.|[^"]|\\")*?["])+)/i,/^(?:--(.*?)($|\r\n|\r|\n))/i,/^(?:\s+)/i,/^(?:\|\|)/i,/^(?:&&)/i,/^(?:VALUE\s+OF\s+SELECT\b)/i,/^(?:ROW\s+OF\s+SELECT\b)/i,/^(?:COLUMN\s+OF\s+SELECT\b)/i,/^(?:MATRIX\s+OF\s+SELECT\b)/i,/^(?:INDEX\s+OF\s+SELECT\b)/i,/^(?:RECORDSET\s+OF\s+SELECT\b)/i,/^(?:TEXT\s+OF\s+SELECT\b)/i,/^(?:SELECT\b)/i,/^(?:ABSOLUTE\b)/i,/^(?:ACTION\b)/i,/^(?:ADD\b)/i,/^(?:AGGR\b)/i,/^(?:ALL\b)/i,/^(?:ALTER\b)/i,/^(?:AND\b)/i,/^(?:ANTI\b)/i,/^(?:ANY\b)/i,/^(?:APPLY\b)/i,/^(?:ARRAY\b)/i,/^(?:AS\b)/i,/^(?:ASSERT\b)/i,/^(?:ASC\b)/i,/^(?:ATTACH\b)/i,/^(?:AUTO(_)?INCREMENT\b)/i,/^(?:AVG\b)/i,/^(?:BEGIN\b)/i,/^(?:BETWEEN\b)/i,/^(?:BREAK\b)/i,/^(?:NOT\s+BETWEEN\b)/i,/^(?:NOT\s+LIKE\b)/i,/^(?:BY\b)/i,/^(?:CASE\b)/i,/^(?:CAST\b)/i,/^(?:CHECK\b)/i,/^(?:CLASS\b)/i,/^(?:CLOSE\b)/i,/^(?:COLLATE\b)/i,/^(?:COLUMN\b)/i,/^(?:COLUMNS\b)/i,/^(?:COMMIT\b)/i,/^(?:CONSTRAINT\b)/i,/^(?:CONTENT\b)/i,/^(?:CONTINUE\b)/i,/^(?:CONVERT\b)/i,/^(?:CORRESPONDING\b)/i,/^(?:COUNT\b)/i,/^(?:CREATE\b)/i,/^(?:CROSS\b)/i,/^(?:CUBE\b)/i,/^(?:CURRENT_TIMESTAMP\b)/i,/^(?:CURSOR\b)/i,/^(?:DATABASE(S)?)/i,/^(?:DECLARE\b)/i,/^(?:DEFAULT\b)/i,/^(?:DELETE\b)/i,/^(?:DELETED\b)/i,/^(?:DESC\b)/i,/^(?:DETACH\b)/i,/^(?:DISTINCT\b)/i,/^(?:DROP\b)/i,/^(?:ECHO\b)/i,/^(?:EDGE\b)/i,/^(?:END\b)/i,/^(?:ENUM\b)/i,/^(?:ELSE\b)/i,/^(?:EXCEPT\b)/i,/^(?:EXISTS\b)/i,/^(?:EXPLAIN\b)/i,/^(?:FALSE\b)/i,/^(?:FETCH\b)/i,/^(?:FIRST\b)/i,/^(?:FOREIGN\b)/i,/^(?:FROM\b)/i,/^(?:GO\b)/i,/^(?:GRAPH\b)/i,/^(?:GROUP\b)/i,/^(?:GROUPING\b)/i,/^(?:HAVING\b)/i,/^(?:HELP\b)/i,/^(?:IF\b)/i,/^(?:IDENTITY\b)/i,/^(?:IS\b)/i,/^(?:IN\b)/i,/^(?:INDEX\b)/i,/^(?:INNER\b)/i,/^(?:INSERT\b)/i,/^(?:INSERTED\b)/i,/^(?:INTERSECT\b)/i,/^(?:INTO\b)/i,/^(?:JOIN\b)/i,/^(?:KEY\b)/i,/^(?:LAST\b)/i,/^(?:LET\b)/i,/^(?:LEFT\b)/i,/^(?:LIKE\b)/i,/^(?:LIMIT\b)/i,/^(?:MATCHED\b)/i,/^(?:MATRIX\b)/i,/^(?:MAX\b)/i,/^(?:MERGE\b)/i,/^(?:MIN\b)/i,/^(?:MINUS\b)/i,/^(?:MODIFY\b)/i,/^(?:NATURAL\b)/i,/^(?:NEXT\b)/i,/^(?:NEW\b)/i,/^(?:NOCASE\b)/i,/^(?:NO\b)/i,/^(?:NOT\b)/i,/^(?:NULL\b)/i,/^(?:OFF\b)/i,/^(?:ON\b)/i,/^(?:ONLY\b)/i,/^(?:OFFSET\b)/i,/^(?:OPEN\b)/i,/^(?:OPTION\b)/i,/^(?:OR\b)/i,/^(?:ORDER\b)/i,/^(?:OUTER\b)/i,/^(?:OVER\b)/i,/^(?:PATH\b)/i,/^(?:PARTITION\b)/i,/^(?:PERCENT\b)/i,/^(?:PLAN\b)/i,/^(?:PRIMARY\b)/i,/^(?:PRINT\b)/i,/^(?:PRIOR\b)/i,/^(?:QUERY\b)/i,/^(?:READ\b)/i,/^(?:RECORDSET\b)/i,/^(?:REDUCE\b)/i,/^(?:REFERENCES\b)/i,/^(?:RELATIVE\b)/i,/^(?:REMOVE\b)/i,/^(?:RENAME\b)/i,/^(?:REPEAT\b)/i,/^(?:REQUIRE\b)/i,/^(?:RESTORE\b)/i,/^(?:RETURN\b)/i,/^(?:RETURNS\b)/i,/^(?:RIGHT\b)/i,/^(?:ROLLBACK\b)/i,/^(?:ROLLUP\b)/i,/^(?:ROW\b)/i,/^(?:SCHEMA(S)?)/i,/^(?:SEARCH\b)/i,/^(?:SEMI\b)/i,/^(?:SET\b)/i,/^(?:SETS\b)/i,/^(?:SHOW\b)/i,/^(?:SOME\b)/i,/^(?:SOURCE\b)/i,/^(?:STRATEGY\b)/i,/^(?:STORE\b)/i,/^(?:SUM\b)/i,/^(?:TABLE\b)/i,/^(?:TABLES\b)/i,/^(?:TARGET\b)/i,/^(?:TEMP\b)/i,/^(?:TEMPORARY\b)/i,/^(?:TEXTSTRING\b)/i,/^(?:THEN\b)/i,/^(?:TIMEOUT\b)/i,/^(?:TO\b)/i,/^(?:TOP\b)/i,/^(?:TRAN\b)/i,/^(?:TRANSACTION\b)/i,/^(?:TRUE\b)/i,/^(?:TRUNCATE\b)/i,/^(?:UNION\b)/i,/^(?:UNIQUE\b)/i,/^(?:UPDATE\b)/i,/^(?:USE\b)/i,/^(?:USING\b)/i,/^(?:VALUE(S)?)/i,/^(?:VERTEX\b)/i,/^(?:VIEW\b)/i,/^(?:WHEN\b)/i,/^(?:WHERE\b)/i,/^(?:WHILE\b)/i,/^(?:WITH\b)/i,/^(?:WORK\b)/i,/^(?:(\d*[.])?\d+[eE]\d+)/i,/^(?:(\d*[.])?\d+)/i,/^(?:->)/i,/^(?:#)/i,/^(?:\+)/i,/^(?:-)/i,/^(?:\*)/i,/^(?:\/)/i,/^(?:%)/i,/^(?:!===)/i,/^(?:===)/i,/^(?:!==)/i,/^(?:==)/i,/^(?:>=)/i,/^(?:>)/i,/^(?:<=)/i,/^(?:<>)/i,/^(?:<)/i,/^(?:=)/i,/^(?:!=)/i,/^(?:\()/i,/^(?:\))/i,/^(?:@)/i,/^(?:\{)/i,/^(?:\})/i,/^(?:\])/i,/^(?::-)/i,/^(?:\?-)/i,/^(?:\.)/i,/^(?:,)/i,/^(?:::)/i,/^(?::)/i,/^(?:;)/i,/^(?:\$)/i,/^(?:\?)/i,/^(?:!)/i,/^(?:\^)/i,/^(?:[a-zA-Z_][a-zA-Z_0-9]*)/i,/^(?:$)/i,/^(?:.)/i],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,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234],inclusive:true}}};return lexer}();parser.lexer=lexer;function Parser(){this.yy={}}Parser.prototype=parser;parser.Parser=Parser;return new Parser}();if(typeof require!=="undefined"&&typeof exports!=="undefined"){exports.parser=parser;exports.Parser=parser.Parser;exports.parse=function(){return parser.parse.apply(parser,arguments)};exports.main=function commonjsMain(args){if(!args[1]){console.log("Usage: "+args[0]+" FILE");process.exit(1)}var source=require("fs").readFileSync(require("path").normalize(args[1]),"utf8");return exports.parser.parse(source)};if(typeof module!=="undefined"&&require.main===module){exports.main(process.argv.slice(1))}}alasql.prettyflag=false;alasql.pretty=function(sql,flag){var pf=alasql.prettyflag;alasql.prettyflag=!flag;var s=alasql.parse(sql).toString();alasql.prettyflag=pf;return s};function K(s){if(alasql.prettyflag){return''+s.toUpperCase()+""}else{return s}}function P(s){if(alasql.prettyflag){return''+s+""}else{return s}}function L(s){if(alasql.prettyflag){return''+s+""}else{return s}}function N(s){if(alasql.prettyflag){return''+s+""}else{return s}}function S(s){if(alasql.prettyflag){return''+s+""}else{return s}}function NL(){if(alasql.prettyflag){return"
"}else{return" "}}function ID(){if(alasql.prettyflag){return"     "}else{return""}}var utils=alasql.utils={};function n2u(s){return"(y="+s+",y===y?y:undefined)"}function und(s,r){return"(y="+s+',typeof y=="undefined"?undefined:'+r+")"}function returnTrue(){return true}function returnUndefined(){}var escapeq=utils.escapeq=function(s){return s.replace(/\'/g,"\\'")};var escapeqq=utils.undoubleq=function(s){return s.replace(/(\')/g,"''")};var doubleq=utils.doubleq=function(s){return s.replace(/(\'\')/g,"\\'")};var doubleqq=utils.doubleqq=function(s){return s.replace(/\'/g,"'")};var cutbom=function(s){if(s[0]==String.fromCharCode(65279))s=s.substr(1);return s};var loadFile=utils.loadFile=function(path,asy,success,error){if(typeof exports=="object"||typeof Meteor!="undefined"&&Meteor.isServer){if(typeof Meteor!="undefined"){var fs=Npm.require("fs")}else{var fs=require("fs")}if(typeof path=="undefined"){var buff="";process.stdin.setEncoding("utf8");process.stdin.on("readable",function(){var chunk=process.stdin.read();if(chunk!==null){buff+=chunk.toString()}});process.stdin.on("end",function(){success(cutbom(buff))})}else{if(asy){fs.readFile(path,function(err,data){if(err){throw err}success(cutbom(data.toString()))})}else{var data=fs.readFileSync(path);success(cutbom(data.toString()))}}}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:false},function(fileEntry){fileEntry.file(function(file){var fileReader=new FileReader;fileReader.onloadend=function(e){success(cutbom(this.result))};fileReader.readAsText(file)})})})}else{if(typeof path=="string"){if(path.substr(0,1)=="#"&&typeof document!="undefined"){var data=document.querySelector(path).textContent;success(data)}else{var xhr=new XMLHttpRequest;xhr.onreadystatechange=function(){if(xhr.readyState===XMLHttpRequest.DONE){if(xhr.status===200){if(success)success(cutbom(xhr.responseText))}else{if(error)error(xhr)}}};xhr.open("GET",path,asy);xhr.send()}}else if(path instanceof Event){var files=path.target.files;var reader=new FileReader;var name=files[0].name;reader.onload=function(e){var data=e.target.result;success(cutbom(data))};reader.readAsText(files[0])}}};var loadBinaryFile=utils.loadBinaryFile=function(path,asy,success,error){if(typeof exports=="object"||typeof Meteor!="undefined"&&Meteor.isServer){if(typeof Meteor!="undefined"){var fs=Npm.require("fs")}else{var fs=require("fs")}if(asy){fs.readFile(path,function(err,data){if(err){throw err}var arr=new Array;for(var i=0;i!=data.length;++i)arr[i]=String.fromCharCode(data[i]);success(arr.join(""))})}else{var data=fs.readFileSync(path);var arr=new Array;for(var i=0;i!=data.length;++i)arr[i]=String.fromCharCode(data[i]);success(arr.join(""))}}else{if(typeof path=="string"){var xhr=new XMLHttpRequest;xhr.open("GET",path,asy);xhr.responseType="arraybuffer";xhr.onload=function(){var data=new Uint8Array(xhr.response);var arr=new Array;for(var i=0;i!=data.length;++i)arr[i]=String.fromCharCode(data[i]);success(arr.join(""))};xhr.send()}else if(path instanceof Event){var files=path.target.files;var reader=new FileReader;var name=files[0].name;reader.onload=function(e){var data=e.target.result;success(data)};reader.readAsBinaryString(files[0])}}};var removeFile=utils.removeFile=function(path,cb){if(typeof exports=="object"){var fs=require("fs");fs.remove(path,cb)}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:false},function(fileEntry){fileEntry.remove(cb);if(cb)cb()},function(){if(cb)cb()})})}else{throw new Error("You can remove files only in Node.js and Apache Cordova")}};var deleteFile=utils.deleteFile=function(path,cb){if(typeof exports=="object"){var fs=require("fs");fs.unlink(path,cb)}};var fileExists=utils.fileExists=function(path,cb){if(typeof exports=="object"){var fs=require("fs");fs.exists(path,cb)}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:false},function(fileEntry){cb(true)},function(){cb(false)})})}else{throw new Error("You can use exists() only in Node.js or Apach Cordova")}};var saveFile=utils.saveFile=function(path,data,cb){var res=1;if(typeof path=="undefined"){res=data;if(cb)res=cb(res)}else{if(typeof exports=="object"){var fs=require("fs");var data=fs.writeFileSync(path,data);if(cb)res=cb(res)}else if(typeof cordova=="object"){window.requestFileSystem(LocalFileSystem.PERSISTENT,0,function(fileSystem){fileSystem.root.getFile(path,{create:true},function(fileEntry){fileEntry.createWriter(function(fileWriter){fileWriter.onwriteend=function(){if(cb)res=cb(res)};fileWriter.write(data)})})})}else{if(isIE()==9){var ndata=data.replace(/\r\n/g,"&#A;&#D;");ndata=ndata.replace(/\n/g,"&#D;");ndata=ndata.replace(/\t/g," ");var testlink=window.open("about:blank","_blank");testlink.document.write(ndata);testlink.document.close();testlink.document.execCommand("SaveAs",false,path);testlink.close()}else{var blob=new Blob([data],{type:"text/plain;charset=utf-8"});saveAs(blob,path);if(cb)res=cb(res)}}}return res};function isIE(){var myNav=navigator.userAgent.toLowerCase();return myNav.indexOf("msie")!=-1?parseInt(myNav.split("msie")[1]):false}var hash=utils.hash=function hash(str){var h=0;if(str.length==0)return h;for(var i=0;i=26){i=(i/26|0)-1;addr=String.fromCharCode(65+i%26)+addr;if(i>26){i=(i/26|0)-1;addr=String.fromCharCode(65+i%26)+addr}}return addr};var xlscn=utils.xlscn=function(s){var n=s.charCodeAt(0)-65;if(s.length>1){n=(n+1)*26+s.charCodeAt(1)-65;if(s.length>2){n=(n+1)*26+s.charCodeAt(2)-65}}return n};var domEmptyChildren=utils.domEmptyChildren=function(container){var len=container.childNodes.length;while(len--){container.removeChild(container.lastChild)}};alasql.utils.uncomment=function uncomment(str){str=("__"+str+"__").split("");var quote=false,quoteSign,blockComment=false,lineComment=false;for(var i=0,l=str.length;ialasql.MAXSQLCACHESIZE){db.resetSqlCache()}db.sqlCacheSize++;db.sqlCache[hh]=statement}var res=alasql.res=statement(params,cb,scope);return res}else{alasql.precompile(ast.statements[0],alasql.useid,params);var res=alasql.res=ast.statements[0].execute(databaseid,params,cb,scope);return res}}else{if(cb){alasql.adrun(databaseid,ast,params,cb,scope)}else{return alasql.drun(databaseid,ast,params,cb,scope)}}};alasql.drun=function(databaseid,ast,params,cb,scope){var useid=alasql.useid;if(useid!=databaseid)alasql.use(databaseid);var res=[];for(var i=0,ilen=ast.statements.length;i0){if(selectors&&selectors[0]&&selectors[0].srchid=="PROP"&&selectors[0].args&&selectors[0].args[0]){if(selectors[0].args[0].toUpperCase()=="XML"){stope.mode="XML";selectors.shift()}else if(selectors[0].args[0].toUpperCase()=="HTML"){stope.mode="HTML";selectors.shift()}else if(selectors[0].args[0].toUpperCase()=="JSON"){stope.mode="JSON";selectors.shift()}}if(selectors.length>0&&selectors[0].srchid=="VALUE"){stope.value=true;selectors.shift()}}if(this.from instanceof yy.Column){var dbid=this.from.databaseid||databaseid;fromdata=alasql.databases[dbid].tables[this.from.columnid].data}else if(this.from instanceof yy.FuncValue&&alasql.from[this.from.funcid.toUpperCase()]){var args=this.from.args.map(function(arg){var as=arg.toJavaScript();var fn=new Function("params,alasql","var y;return "+as).bind(this);return fn(params,alasql)});fromdata=alasql.from[this.from.funcid.toUpperCase()].apply(this,args)}else if(typeof this.from=="undefined"){fromdata=alasql.databases[databaseid].objects}else{var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());fromdata=fromfn(params,alasql);if(typeof Mongo=="object"&&typeof Mongo.Collection!="object"&&fromdata instanceof Mongo.Collection){fromdata=fromdata.find().fetch()}}if(typeof selectors!="undefined"&&selectors.length>0){if(false){selectors.forEach(function(selector){if(selector.srchid=="TO"){alasql.vars[selector.args[0]]=[]}})}res=processSelector(selectors,0,fromdata)}else{res=fromdata}if(this.into){var a1,a2;if(typeof this.into.args[0]!="undefined"){a1=new Function("params,alasql","var y;return "+this.into.args[0].toJavaScript())(params,alasql)}if(typeof this.into.args[1]!="undefined"){a2=new Function("params,alasql","var y;return "+this.into.args[1].toJavaScript())(params,alasql)}res=alasql.into[this.into.funcid.toUpperCase()](a1,a2,res,[],cb)}else{if(stope.value&&res.length>0)res=res[0];if(cb)res=cb(res)}return res;function processSelector(selectors,sidx,value){var sel=selectors[sidx];var SECURITY_BREAK=1e5;if(sel.selid){if(sel.selid=="PATH"){var queue=[{node:value,stack:[]}];var visited={};var path=[];var objects=alasql.databases[alasql.useid].objects;while(queue.length>0){var q=queue.shift();var node=q.node;var stack=q.stack;var r=processSelector(sel.args,0,node);if(r.length>0){if(sidx+1+1>selectors.length){return stack}else{var rv=[];if(stack&&stack.length>0){stack.forEach(function(stv){rv=rv.concat(processSelector(selectors,sidx+1,stv))})}return rv}}else{if(typeof visited[node.$id]!="undefined"){continue}else{visited[node.$id]=true;if(node.$out&&node.$out.length>0){node.$out.forEach(function(edgeid){var edge=objects[edgeid];var stack2=stack.concat(edge);stack2.push(objects[edge.$out[0]]);queue.push({node:objects[edge.$out[0]],stack:stack2})})}}}}return[]}if(sel.selid=="NOT"){var nest=processSelector(sel.args,0,value);if(nest.length>0){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="DISTINCT"){if(typeof sel.args=="undefined"||sel.args.length==0){var nest=distinctArray(value)}else{var nest=processSelector(sel.args,0,value)}if(nest.length==0){return[]}else{var res=distinctArray(nest);if(sidx+1+1>selectors.length){return res}else{return processSelector(selectors,sidx+1,res)}}}else if(sel.selid=="AND"){var res=true;sel.args.forEach(function(se){res=res&&processSelector(se,0,value).length>0});if(!res){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="OR"){var res=false;sel.args.forEach(function(se){res=res||processSelector(se,0,value).length>0});if(!res){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="ALL"){var nest=processSelector(sel.args[0],0,value);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return nest}else{return processSelector(selectors,sidx+1,nest)}}}else if(sel.selid=="ANY"){var nest=processSelector(sel.args[0],0,value);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return[nest[0]]}else{return processSelector(selectors,sidx+1,[nest[0]])}}}else if(sel.selid=="UNIONALL"){var nest=[];sel.args.forEach(function(se){nest=nest.concat(processSelector(se,0,value))});if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return nest}else{return processSelector(selectors,sidx+1,nest)}}}else if(sel.selid=="UNION"){var nest=[];sel.args.forEach(function(se){nest=nest.concat(processSelector(se,0,value))});var nest=distinctArray(nest);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return nest}else{return processSelector(selectors,sidx+1,nest)}}}else if(sel.selid=="IF"){var nest=processSelector(sel.args,0,value);if(nest.length==0){return[]}else{if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,value)}}}else if(sel.selid=="REPEAT"){var lmin=sel.args[0].value;if(!sel.args[1]){var lmax=lmin}else{var lmax=sel.args[1].value}if(sel.args[2]){var lvar=sel.args[2].variable}else{var lvar}var lsel=sel.sels;var retval=[];if(lmin==0){if(sidx+1+1>selectors.length){retval=[value]}else{if(lvar)alasql.vars[lvar]=0;retval=retval.concat(processSelector(selectors,sidx+1,value))}}if(lmax>0){var nests=[{value:value,lvl:1}];var i=0;while(nests.length>0){var nest=nests[0];nests.shift();if(nest.lvl<=lmax){if(lvar)alasql.vars[lvar]=nest.lvl;var nest1=processSelector(sel.sels,0,nest.value);nest1.forEach(function(n){nests.push({value:n,lvl:nest.lvl+1})});if(nest.lvl>=lmin){if(sidx+1+1>selectors.length){retval=retval.concat(nest1)}else{nest1.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}}}i++;if(i>SECURITY_BREAK){throw new Error("Security brake. Number of iterations = "+i)}}}return retval}else if(sel.selid=="TO"){var oldv=alasql.vars[sel.args[0]];var newv=[];if(typeof oldv!="undefined"){newv=oldv.slice(0)}else{newv=[]}newv.push(value);if(sidx+1+1>selectors.length){return[value]}else{alasql.vars[sel.args[0]]=newv;var r1=processSelector(selectors,sidx+1,value);alasql.vars[sel.args[0]]=oldv;return r1}}else if(sel.selid=="ARRAY"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="SUM"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest.reduce(function(sum,current){return sum+current},0)}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="AVG"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest.reduce(function(sum,current){return sum+current},0)/nest.length}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="COUNT"){var nest=processSelector(sel.args,0,value);if(nest.length>0){var val=nest.length}else{return[]}if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="FIRST"){var nest=processSelector(sel.args,0,value);if(nest.length>0)var val=nest[0];else return[];if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="LAST"){var nest=processSelector(sel.args,0,value);if(nest.length>0)var val=nest[nest.length-1];else return[];if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="MIN"){var nest=processSelector(sel.args,0,value);if(nest.length==0)return[];var val=nest.reduce(function(min,current){return Math.min(min,current)},Infinity);if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="MAX"){var nest=processSelector(sel.args,0,value);if(nest.length==0)return[];var val=nest.reduce(function(max,current){return Math.max(max,current)},-Infinity);if(sidx+1+1>selectors.length){return[val]}else{return processSelector(selectors,sidx+1,val)}}else if(sel.selid=="PLUS"){var retval=[];var nests=processSelector(sel.args,0,value).slice();if(sidx+1+1>selectors.length){retval=retval.concat(nests)}else{nests.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}var i=0;while(nests.length>0){var nest=nests.shift();nest=processSelector(sel.args,0,nest);nests=nests.concat(nest);if(sidx+1+1>selectors.length){retval=retval.concat(nest)}else{nest.forEach(function(n){var rn=processSelector(selectors,sidx+1,n);retval=retval.concat(rn)})}i++;if(i>SECURITY_BREAK){throw new Error("Security brake. Number of iterations = "+i)}}return retval}else if(sel.selid=="STAR"){var retval=[];retval=processSelector(selectors,sidx+1,value);var nests=processSelector(sel.args,0,value).slice();if(sidx+1+1>selectors.length){retval=retval.concat(nests)}else{nests.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}var i=0;while(nests.length>0){var nest=nests[0];nests.shift();nest=processSelector(sel.args,0,nest);nests=nests.concat(nest);if(sidx+1+1>selectors.length){}else{nest.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}i++;if(i>SECURITY_BREAK){throw new Error("Security brake. Number of iterations = "+i)}}return retval}else if(sel.selid=="QUESTION"){var retval=[];retval=retval.concat(processSelector(selectors,sidx+1,value));var nest=processSelector(sel.args,0,value);if(sidx+1+1>selectors.length){}else{nest.forEach(function(n){retval=retval.concat(processSelector(selectors,sidx+1,n))})}return retval}else if(sel.selid=="WITH"){var nest=processSelector(sel.args,0,value);if(nest.length==0){return[]}else{var r={status:1,values:nest}}}else if(sel.selid=="ROOT"){if(sidx+1+1>selectors.length){return[value]}else{return processSelector(selectors,sidx+1,fromdata)}}else{throw new Error("Wrong selector "+sel.selid)}}else if(sel.srchid){var r=alasql.srch[sel.srchid.toUpperCase()](value,sel.args,stope,params)}else{throw new Error("Selector not found")}if(typeof r=="undefined"){r={status:1,values:[value]}}var res=[];if(r.status==1){var arr=r.values;if(sidx+1+1>selectors.length){res=arr}else{for(var i=0;i0){return{status:1,values:arr}}else{return{status:-1,values:[]}}}else{if(typeof val!="object"||val===null||typeof args!="object"||typeof val[args[0]]=="undefined"){return{status:-1,values:[]}}else{return{status:1,values:[val[args[0]]]}}}};alasql.srch.APROP=function(val,args,stope){if(typeof val!="object"||val===null||typeof args!="object"||typeof val[args[0]]=="undefined"){return{status:1,values:[undefined]}}else{return{status:1,values:[val[args[0]]]}}};alasql.srch.ORDERBY=function(val,args,stope){var res=val.sort(compileSearchOrder(args));return{status:1,values:res}};alasql.srch.EQ=function(val,args,stope,params){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);if(val==exprfn(val,alasql,params)){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.LIKE=function(val,args,stope,params){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);if(val.toUpperCase().match(new RegExp("^"+exprfn(val,alasql,params).toUpperCase().replace(/%/g,".*")+"$"),"g")){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.ATTR=function(val,args,stope){if(stope.mode=="XML"){if(typeof args=="undefined"){return{status:1,values:[val.attributes]}}else{if(typeof val=="object"&&typeof val.attributes=="object"&&typeof val.attributes[args[0]]!="undefined"){return{status:1,values:[val.attributes[args[0]]]}}else{return{status:-1,values:[]}}}}else{throw new Error("ATTR is not using in usual mode")}};alasql.srch.CONTENT=function(val,args,stope){if(stope.mode=="XML"){return{status:1,values:[val.content]}}else{throw new Error("ATTR is not using in usual mode")}};alasql.srch.SHARP=function(val,args,stope){var obj=alasql.databases[alasql.useid].objects[args[0]];if(typeof val!="undefined"&&val===obj){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.PARENT=function(val,args,stope){console.log("PARENT");return{status:-1,values:[]}};alasql.srch.CHILD=function(val,args,stope){if(typeof val=="object"){if(val instanceof Array){return{status:1,values:val}}else{if(stope.mode=="XML"){return{status:1,values:Object.keys(val.children).map(function(key){return val.children[key]})}}else{return{status:1,values:Object.keys(val).map(function(key){return val[key]})}}}}else{return{status:1,values:[]}}};alasql.srch.KEYS=function(val,args){if(typeof val=="object"&&val!==null){return{status:1,values:Object.keys(val)}}else{return{status:1,values:[]}}};alasql.srch.WHERE=function(val,args){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql","return "+exprs);if(exprfn(val,alasql)){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.NAME=function(val,args){if(val.name==args[0]){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.CLASS=function(val,args){if(val.$class==args){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.VERTEX=function(val,args){if(val.$node=="VERTEX"){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.INSTANCEOF=function(val,args){if(val instanceof alasql.fn[args[0]]){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.EDGE=function(val,args){if(val.$node=="EDGE"){return{status:1,values:[val]}}else{return{status:-1,values:[]}}};alasql.srch.EX=function(val,args,stope,params){var exprs=args[0].toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);return{status:1,values:[exprfn(val,alasql,params)]}};alasql.srch.RETURN=function(val,args,stope,params){var res={};if(args&&args.length>0){args.forEach(function(arg){var exprs=arg.toJavaScript("x","");var exprfn=new Function("x,alasql,params","return "+exprs);if(typeof arg.as=="undefined")arg.as=arg.toString();res[arg.as]=exprfn(val,alasql,params)})}return{status:1,values:[res]}};alasql.srch.REF=function(val,args){return{status:1,values:[alasql.databases[alasql.useid].objects[val]]}};alasql.srch.OUT=function(val,args){if(val.$out&&val.$out.length>0){var res=val.$out.map(function(v){return alasql.databases[alasql.useid].objects[v]});return{status:1,values:res}}else{return{status:-1,values:[]}}};alasql.srch.IN=function(val,args){if(val.$in&&val.$in.length>0){var res=val.$in.map(function(v){return alasql.databases[alasql.useid].objects[v]});return{status:1,values:res}}else{return{status:-1,values:[]}}};alasql.srch.AS=function(val,args){alasql.vars[args[0]]=val;return{status:1,values:[val]}};alasql.srch.AT=function(val,args){var v=alasql.vars[args[0]];return{status:1,values:[v]}};alasql.srch.CLONEDEEP=function(val,args){var z=cloneDeep(val);return{status:1,values:[z]}};alasql.srch.SET=function(val,args,stope,params){var s=args.map(function(st){if(st.method=="@"){return"alasql.vars['"+st.variable+"']="+st.expression.toJavaScript("x","")}else if(st.method=="$"){return"params['"+st.variable+"']="+st.expression.toJavaScript("x","")}else{return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}}).join(";");var setfn=new Function("x,params,alasql",s);setfn(val,params,alasql);return{status:1,values:[val]}};alasql.srch.ROW=function(val,args,stope,params){var s="var y;return [";s+=args.map(function(arg){return arg.toJavaScript("x","")}).join(",");s+="]";var setfn=new Function("x,params,alasql",s);var rv=setfn(val,params,alasql);return{status:1,values:[rv]}};alasql.srch.D3=function(val,args,stope,params){if(val.$node=="VERTEX"){}else if(val.$node=="EDGE"){val.source=val.$in[0];val.target=val.$out[0]}return{status:1,values:[val]}};compileSearchOrder=function(order){if(order){if(order&&order.length==1&&order[0].expression&&typeof order[0].expression=="function"){var func=order[0].expression;return function(a,b){var ra=func(a),rb=func(b);if(ra>rb)return 1;if(ra==rb)return 0;return-1}}var s="";var sk="";order.forEach(function(ord,idx){var dg="";if(ord.expression instanceof yy.NumValue){ord.expression=self.columns[ord.expression.value-1]}if(ord.expression instanceof yy.Column){var columnid=ord.expression.columnid;if(alasql.options.valueof)dg=".valueOf()";if(ord.nocase)dg+=".toUpperCase()";if(columnid=="_"){s+="if(a"+dg+(ord.direction=="ASC"?">":"<")+"b"+dg+")return 1;";s+="if(a"+dg+"==b"+dg+"){"}else{s+="if((a['"+columnid+"']||'')"+dg+(ord.direction=="ASC"?">":"<")+"(b['"+columnid+"']||'')"+dg+")return 1;";s+="if((a['"+columnid+"']||'')"+dg+"==(b['"+columnid+"']||'')"+dg+"){"}}else{dg=".valueOf()";if(ord.nocase)dg+=".toUpperCase()";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+(ord.direction=="ASC"?">(":"<(")+ord.toJavaScript("b","")+"||'')"+dg+")return 1;";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+"==("+ord.toJavaScript("b","")+"||'')"+dg+"){"}sk+="}"});s+="return 0;";s+=sk+"return -1";return new Function("a,b",s)}};function queryfn(query,oldscope,cb,A,B){var ms;query.sourceslen=query.sources.length;var slen=query.sourceslen;query.query=query;query.A=A;query.B=B;query.cb=cb;query.oldscope=oldscope;if(query.queriesfn){query.sourceslen+=query.queriesfn.length;slen+=query.queriesfn.length;query.queriesdata=[];query.queriesfn.forEach(function(q,idx){q.query.params=query.params;if(false){queryfn(q.query,query.oldscope,queryfn2,-idx-1,query)}else{queryfn2([],-idx-1,query)}})}var scope;if(!oldscope)scope={};else scope=cloneDeep(oldscope);query.scope=scope;var result;query.sources.forEach(function(source,idx){source.query=query;var rs=source.datafn(query,query.params,queryfn2,idx,alasql);if(typeof rs!=undefined){if((query.intofn||query.intoallfn)&&rs instanceof Array)rs=rs.length;result=rs}source.queriesdata=query.queriesdata});if(slen==0)result=queryfn3(query);return result}function queryfn2(data,idx,query){if(idx>=0){var source=query.sources[idx];source.data=data;if(typeof source.data=="function"){source.getfn=source.data;source.dontcache=source.getfn.dontcache;if(source.joinmode=="OUTER"||source.joinmode=="RIGHT"||source.joinmode=="ANTI"){source.dontcache=false}source.data={}}}else{query.queriesdata[-idx-1]=flatArray(data)}query.sourceslen--;if(query.sourceslen>0)return;return queryfn3(query)}function queryfn3(query){var scope=query.scope;preIndex(query);query.data=[];query.xgroups={};query.groups=[];var h=0;doJoin(query,scope,h);if(query.groupfn){query.data=[];if(query.groups.length==0){var g={};if(query.selectGroup.length>0){query.selectGroup.forEach(function(sg){if(sg.aggregatorid=="COUNT"||sg.aggregatorid=="SUM"){g[sg.nick]=0}else{g[sg.nick]=undefined}})}query.groups=[g]}for(var i=0,ilen=query.groups.length;i0){var removeKeys=query.removeKeys;var jlen=removeKeys.length;if(jlen>0){for(var i=0,ilen=query.data.length;i0){query.columns=query.columns.filter(function(column){var found=false;removeKeys.forEach(function(key){if(column.columnid==key)found=true});return!found})}}if(typeof query.removeLikeKeys!="undefined"&&query.removeLikeKeys.length>0){var removeLikeKeys=query.removeLikeKeys;for(var i=0,ilen=query.data.length;i0){query.columns=query.columns.filter(function(column){var found=false;removeLikeKeys.forEach(function(key){if(column.columnid.match(key))found=true});return!found})}}if(query.intoallfn){var res=query.intoallfn(query.columns,query.cb,query.params,query.alasql);return res}else if(query.intofn){for(var i=0,ilen=query.data.length;i0&&source.optimization=="ix"&&source.onleftfn&&source.onrightfn){if(source.databaseid&&alasql.databases[source.databaseid].tables[source.tableid]){if(!alasql.databases[source.databaseid].tables[source.tableid].indices)query.database.tables[source.tableid].indices={};var ixx=alasql.databases[source.databaseid].tables[source.tableid].indices[hash(source.onrightfns+"`"+source.srcwherefns)];if(!alasql.databases[source.databaseid].tables[source.tableid].dirty&&ixx){source.ix=ixx}}if(!source.ix){source.ix={};var scope={};var i=0;var ilen=source.data.length;var dataw;while((dataw=source.data[i])||source.getfn&&(dataw=source.getfn(i))||i=query.sources.length){if(query.wherefn(scope,query.params,alasql)){if(query.groupfn){query.groupfn(scope,query.params,alasql)}else{query.data.push(query.selectfn(scope,query.params,alasql))}}}else if(query.sources[h].applyselect){var source=query.sources[h];source.applyselect(query.params,function(data){if(data.length>0){for(var i=0;i0){s+=NL()+ID()+K("GROUP BY")+" "+this.group.map(function(grp){return grp.toString()}).join(", ")}if(this.having)s+=NL()+ID()+K("HAVING")+" "+this.having.toString();if(this.order&&this.order.length>0){s+=NL()+ID()+K("ORDER BY")+" "+this.order.map(function(ord){return ord.toString()}).join(", ")}if(this.limit)s+=NL()+ID()+K("LIMIT")+" "+this.limit.value;if(this.offset)s+=NL()+ID()+K("OFFSET")+" "+this.offset.value;if(this.union)s+=NL()+K("UNION")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.union.toString();if(this.unionall)s+=NL()+K("UNION ALL")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.unionall.toString();if(this.except)s+=NL()+K("EXCEPT")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.except.toString();if(this.intersect)s+=NL()+K("INTERSECT")+(this.corresponding?" "+K("CORRESPONDING"):"")+NL()+this.intersect.toString();return s};yy.Select.prototype.toJavaScript=function(context,tableid,defcols){var s="alasql.utils.flatArray(this.queriesfn["+(this.queriesidx-1)+"](this.params,null,"+context+"))[0]";return s};yy.Select.prototype.compile=function(databaseid){var db=alasql.databases[databaseid];var query=new Query;query.removeKeys=[];query.explain=this.explain;query.explaination=[];query.explid=1;query.modifier=this.modifier;query.database=db;this.compileWhereExists(query);this.compileQueries(query);query.defcols=this.compileDefCols(query,databaseid);query.fromfn=this.compileFrom(query);if(this.joins)this.compileJoins(query);query.rownums=[];this.compileSelectGroup0(query);if(this.group||query.selectGroup.length>0){query.selectgfns=this.compileSelectGroup1(query)}else{query.selectfns=this.compileSelect1(query)}this.compileRemoveColumns(query);if(this.where)this.compileWhereJoins(query);query.wherefn=this.compileWhere(query);if(this.group||query.selectGroup.length>0)query.groupfn=this.compileGroup(query);if(this.having)query.havingfn=this.compileHaving(query);if(this.group||query.selectGroup.length>0){query.selectgfn=this.compileSelectGroup2(query)}else{query.selectfn=this.compileSelect2(query)}query.distinct=this.distinct;if(this.order)query.orderfn=this.compileOrder(query);if(this.top){query.limit=this.top.value}else if(this.limit){query.limit=this.limit.value;if(this.offset){query.offset=this.offset.value}}query.percent=this.percent;query.corresponding=this.corresponding;if(this.union){query.unionfn=this.union.compile(databaseid);if(this.union.order){query.orderfn=this.union.compileOrder(query)}else{query.orderfn=null}}else if(this.unionall){query.unionallfn=this.unionall.compile(databaseid);if(this.unionall.order){query.orderfn=this.unionall.compileOrder(query)}else{query.orderfn=null}}else if(this.except){query.exceptfn=this.except.compile(databaseid);if(this.except.order){query.orderfn=this.except.compileOrder(query)}else{query.orderfn=null}}else if(this.intersect){query.intersectfn=this.intersect.compile(databaseid);if(this.intersect.order){query.intersectfn=this.intersect.compileOrder(query)}else{query.orderfn=null}}if(this.into){if(this.into instanceof yy.Table){if(alasql.options.autocommit&&alasql.databases[this.into.databaseid||databaseid].engineid){query.intoallfns='return alasql.engines["'+alasql.databases[this.into.databaseid||databaseid].engineid+'"]'+'.intoTable("'+(this.into.databaseid||databaseid)+'","'+this.into.tableid+'",this.data, columns, cb);'}else{query.intofns="alasql.databases['"+(this.into.databaseid||databaseid)+"'].tables"+"['"+this.into.tableid+"'].data.push(r);"}}else if(this.into instanceof yy.VarValue){query.intoallfns='alasql.vars["'+this.into.variable+'"]=this.data;res=this.data.length;if(cb)res=cb(res);return res;'}else if(this.into instanceof yy.FuncValue){var qs="return alasql.into['"+this.into.funcid.toUpperCase()+"'](";if(this.into.args&&this.into.args.length>0){qs+=this.into.args[0].toJavaScript()+",";if(this.into.args.length>1){qs+=this.into.args[1].toJavaScript()+","}else{qs+="undefined,"}}else{qs+="undefined, undefined,"}query.intoallfns=qs+"this.data,columns,cb)"}else if(this.into instanceof yy.ParamValue){query.intofns="params['"+this.into.param+"'].push(r)"}if(query.intofns){query.intofn=new Function("r,i,params,alasql","var y;"+query.intofns)}else if(query.intoallfns){query.intoallfn=new Function("columns,cb,params,alasql","var y;"+query.intoallfns)}}var statement=function(params,cb,oldscope){query.params=params;var res1=queryfn(query,oldscope,function(res){if(query.rownums.length>0){for(var i=0,ilen=res.length;i0){var allcol={};for(var i=0;i0){var key;if(columns&&columns.length>0)key=columns[0].columnid;else key=Object.keys(res[0])[0];res=res[0][key]}else{res=undefined}}if(modifier=="ROW"){if(res.length>0){var key;var a=[];for(var key in res[0]){a.push(res[0][key])}res=a}else{res=undefined}}if(modifier=="COLUMN"){var ar=[];if(res.length>0){var key;if(columns&&columns.length>0)key=columns[0].columnid;else key=Object.keys(res[0])[0];for(var i=0,ilen=res.length;i0){key=columns[0].columnid;val=columns[1].columnid}else{var okeys=Object.keys(res[0]);key=okeys[0];val=okeys[1]}for(var i=0,ilen=res.length;i0)key=columns[0].columnid;else key=Object.keys(res[0])[0];var s="";for(var i=0,ilen=res.length;i0){if(tq.args[0]){s+=tq.args[0].toJavaScript("query.oldscope")+","}else{s+="null,"}if(tq.args[1]){s+=tq.args[1].toJavaScript("query.oldscope")+","}else{s+="null,"}}else{s+="null,null,"}s+="cb,idx,query";s+=");/*if(cb)res=cb(res,idx,query);*/return res";source.datafn=new Function("query, params, cb, idx, alasql",s)}else if(tq instanceof yy.FromData){source.datafn=function(query,params,cb,idx,alasql){var res=tq.data;if(cb)res=cb(res,idx,query);return res}}else{throw new Error("Wrong table at FROM")}query.sources.push(source)});query.defaultTableid=query.sources[0].alias};alasql.prepareFromData=function(data,array){var res=data;if(typeof data=="string"){res=data.split(/\r?\n/);if(array){for(var i=0,ilen=res.length;i0){if(jn.args[0]){s+=jn.args[0].toJavaScript("query.oldscope")+","}else{s+="null,"}if(jn.args[1]){s+=jn.args[1].toJavaScript("query.oldscope")+","}else{s+="null,"}}else{s+="null,null,"}s+="cb,idx,query";s+=");/*if(cb)res=cb(res,idx,query);*/return res";source.datafn=new Function("query, params, cb, idx, alasql",s);query.aliases[source.alias]={type:"funcvalue"}}var alias=source.alias;if(jn.natural){if(jn.using||jn.on){throw new Error("NATURAL JOIN cannot have USING or ON clauses")}else{if(query.sources.length>0){var prevSource=query.sources[query.sources.length-1];var prevTable=alasql.databases[prevSource.databaseid].tables[prevSource.tableid];var table=alasql.databases[source.databaseid].tables[source.tableid];if(prevTable&&table){var c1=prevTable.columns.map(function(col){return col.columnid});var c2=table.columns.map(function(col){return col.columnid});jn.using=arrayIntersect(c1,c2).map(function(colid){return{columnid:colid}})}else{throw new Error("In this version of Alasql NATURAL JOIN "+"works for tables with predefined columns only")}}}}if(jn.using){var prevSource=query.sources[query.sources.length-1];source.onleftfns=jn.using.map(function(col){return"p['"+(prevSource.alias||prevSource.tableid)+"']['"+col.columnid+"']"}).join('+"`"+');source.onleftfn=new Function("p,params,alasql","var y;return "+source.onleftfns);source.onrightfns=jn.using.map(function(col){return"p['"+(source.alias||source.tableid)+"']['"+col.columnid+"']"}).join('+"`"+');source.onrightfn=new Function("p,params,alasql","var y;return "+source.onrightfns);source.optimization="ix"}else if(jn.on){if(jn.on instanceof yy.Op&&jn.on.op=="="&&!jn.on.allsome){source.optimization="ix";var lefts="";var rights="";var middles="";var middlef=false;var ls=jn.on.left.toJavaScript("p",query.defaultTableid,query.defcols);var rs=jn.on.right.toJavaScript("p",query.defaultTableid,query.defcols);if(ls.indexOf("p['"+alias+"']")>-1&&!(rs.indexOf("p['"+alias+"']")>-1)){if((ls.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){rights=ls}else{middlef=true}}else if(!(ls.indexOf("p['"+alias+"']")>-1)&&rs.indexOf("p['"+alias+"']")>-1){if((rs.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){lefts=ls}else{middlef=true}}else{middlef=true}if(rs.indexOf("p['"+alias+"']")>-1&&!(ls.indexOf("p['"+alias+"']")>-1)){if((rs.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){rights=rs}else{middlef=true}}else if(!(rs.indexOf("p['"+alias+"']")>-1)&&ls.indexOf("p['"+alias+"']")>-1){if((ls.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+alias+"']"})){lefts=rs}else{middlef=true}}else{middlef=true}if(middlef){rights="";lefts="";middles=jn.on.toJavaScript("p",query.defaultTableid,query.defcols);source.optimization="no"}source.onleftfns=lefts;source.onrightfns=rights;source.onmiddlefns=middles||"true";source.onleftfn=new Function("p,params,alasql","var y;return "+source.onleftfns);source.onrightfn=new Function("p,params,alasql","var y;return "+source.onrightfns);source.onmiddlefn=new Function("p,params,alasql","var y;return "+source.onmiddlefns)}else{source.optimization="no";source.onmiddlefns=jn.on.toJavaScript("p",query.defaultTableid,query.defcols);source.onmiddlefn=new Function("p,params,alasql","var y;return "+jn.on.toJavaScript("p",query.defaultTableid,query.defcols))}}query.sources.push(source)}})};yy.Select.prototype.compileWhere=function(query){if(this.where){if(typeof this.where=="function"){return this.where}else{s=this.where.toJavaScript("p",query.defaultTableid,query.defcols);query.wherefns=s;return new Function("p,params,alasql","var y;return "+s)}}else return function(){return true}};yy.Select.prototype.compileWhereJoins=function(query){return;optimizeWhereJoin(query,this.where.expression);query.sources.forEach(function(source){if(source.srcwherefns){source.srcwherefn=new Function("p,params,alasql","var y;return "+source.srcwherefns)}if(source.wxleftfns){source.wxleftfn=new Function("p,params,alasql","var y;return "+source.wxleftfns)}if(source.wxrightfns){source.wxrightfn=new Function("p,params,alasql","var y;return "+source.wxrightfns)}})};function optimizeWhereJoin(query,ast){if(!ast)return false;if(!(ast instanceof yy.Op))return;if(ast.op!="="&&ast.op!="AND")return;if(ast.allsome)return;var s=ast.toJavaScript("p",query.defaultTableid,query.defcols);var fsrc=[];query.sources.forEach(function(source,idx){if(source.tableid){if(s.indexOf("p['"+source.alias+"']")>-1)fsrc.push(source)}});if(fsrc.length==0){return}else if(fsrc.length==1){if(!(s.match(/p\[\'.*?\'\]/g)||[]).every(function(s){return s=="p['"+fsrc[0].alias+"']"})){return}var src=fsrc[0];src.srcwherefns=src.srcwherefns?src.srcwherefns+"&&"+s:s;if(ast instanceof yy.Op&&(ast.op=="="&&!ast.allsome)){if(ast.left instanceof yy.Column){var ls=ast.left.toJavaScript("p",query.defaultTableid,query.defcols);var rs=ast.right.toJavaScript("p",query.defaultTableid,query.defcols);if(rs.indexOf("p['"+fsrc[0].alias+"']")==-1){fsrc[0].wxleftfns=ls;fsrc[0].wxrightfns=rs}}if(ast.right instanceof yy.Column){var ls=ast.left.toJavaScript("p",query.defaultTableid,query.defcols);var rs=ast.right.toJavaScript("p",query.defaultTableid,query.defcols);if(ls.indexOf("p['"+fsrc[0].alias+"']")==-1){fsrc[0].wxleftfns=rs;fsrc[0].wxrightfns=ls}}}ast.reduced=true;return}else{if(ast.op="AND"){optimizeWhereJoin(query,ast.left);optimizeWhereJoin(query,ast.right)}}}yy.Select.prototype.compileGroup=function(query){var self=this;if(query.sources.length>0){var tableid=query.sources[0].alias}else{var tableid=""}var defcols=query.defcols;var allgroup=[[]];if(this.group){allgroup=decartes(this.group,query)}var allgroups=[];allgroup.forEach(function(a){allgroups=arrayUnion(allgroups,a)});query.allgroups=allgroups;if(false){allgroups.forEach(function(col2){if(query.selectColumns[colid]){}else{var tmpid="default";if(query.sources.length>0)tmpid=query.sources[0].alias;if(Object.keys(query.selectColumns).length!=0)query.removeKeys.push(colid);query.selectfns+="r['"+escapeq(colid)+"']="+new yy.Column({columnid:colid}).toJavaScript("p",tmpid)+";"}})}var s="";allgroup.forEach(function(agroup){s+="var acc,g=this.xgroups[";var rg=agroup.map(function(col2){var columnid=col2.split(" ")[0];var coljs=col2.split(" ")[1];if(columnid=="")return"1";else return coljs});if(rg.length==0)rg=["''"];s+=rg.join('+"`"+');s+="];if(!g) {this.groups.push((g=this.xgroups[";s+=rg.join('+"`"+');s+="] = {";s+=agroup.map(function(col2){var columnid=col2.split(" ")[0];var coljs=col2.split(" ")[1];if(columnid=="")return"";else return"'"+columnid+"':"+coljs+","}).join("");var neggroup=arrayDiff(allgroups,agroup);s+=neggroup.map(function(col2){var columnid=col2.split(" ")[0];var coljs=col2.split(" ")[1];return"'"+columnid+"':null,"}).join("");var aft="";s+=query.selectGroup.map(function(col,idx){var colexp=col.expression.toJavaScript("p",tableid,defcols);var colas=col.nick;if(col instanceof yy.AggrValue){if(col.distinct){aft+=",g['$$_VALUES_"+colas+"']={},g['$$_VALUES_"+colas+"']["+colexp+"]=true"}if(col.aggregatorid=="SUM"){return"'"+colas+"':("+colexp+")||0,"}else if(col.aggregatorid=="MIN"||col.aggregatorid=="MAX"||col.aggregatorid=="FIRST"||col.aggregatorid=="LAST"){return"'"+colas+"':"+colexp+","}else if(col.aggregatorid=="ARRAY"){return"'"+colas+"':["+colexp+"],"}else if(col.aggregatorid=="COUNT"){if(col.expression.columnid=="*"){return"'"+colas+"':1,"}else{return"'"+colas+"':(typeof "+colexp+' != "undefined")?1:0,'}}else if(col.aggregatorid=="AVG"){query.removeKeys.push("_SUM_"+colas);query.removeKeys.push("_COUNT_"+colas);return"'"+colas+"':"+colexp+",'_SUM_"+colas+"':("+colexp+")||0,'_COUNT_"+colas+"':(typeof "+colexp+' != "undefined")?1:0,'}else if(col.aggregatorid=="AGGR"){aft+=",g['"+colas+"']="+col.expression.toJavaScript("g",-1);return""}else if(col.aggregatorid=="REDUCE"){query.removeKeys.push("_REDUCE_"+colas);return"'"+colas+"':alasql.aggr['"+col.funcid+"']("+colexp+",undefined,(acc={})),"+"'__REDUCE__"+colas+"':acc,"}return""}else return""}).join("");s+="}"+aft+",g));} else {";s+=query.selectGroup.map(function(col,idx){var colas=col.nick;var colexp=col.expression.toJavaScript("p",tableid,defcols);if(col instanceof yy.AggrValue){if(col.distinct){var pre="if(typeof "+colexp+'!="undefined" && (!g[\'$$_VALUES_'+colas+"']["+colexp+"])) {";var post="g['$$_VALUES_"+colas+"']["+colexp+"]=true;}"}else{var pre="",post=""}if(col.aggregatorid=="SUM"){return pre+"g['"+colas+"']+=("+colexp+"||0);"+post}else if(col.aggregatorid=="COUNT"){if(col.expression.columnid=="*")return pre+"g['"+colas+"']++;"+post;else{return pre+"if(typeof "+colexp+'!="undefined") g[\''+colas+"']++;"+post}}else if(col.aggregatorid=="ARRAY"){return pre+"g['"+colas+"'].push("+colexp+");"+post}else if(col.aggregatorid=="MIN"){return pre+"g['"+colas+"']=Math.min(g['"+colas+"'],"+colexp+");"+post}else if(col.aggregatorid=="MAX"){return pre+"g['"+colas+"']=Math.max(g['"+colas+"'],"+colexp+");"+post}else if(col.aggregatorid=="FIRST"){return""}else if(col.aggregatorid=="LAST"){return pre+"g['"+colas+"']="+colexp+";"+post}else if(col.aggregatorid=="AVG"){return pre+"g['_SUM_"+colas+"']+=(y="+colexp+")||0;"+"g['_COUNT_"+colas+'\']+=(typeof y!="undefined")?1:0;'+"g['"+colas+"']=g['_SUM_"+colas+"']/g['_COUNT_"+colas+"'];"+post}else if(col.aggregatorid=="AGGR"){return pre+"g['"+colas+"']="+col.expression.toJavaScript("g",-1)+";"+post}else if(col.aggregatorid=="REDUCE"){return pre+"g['"+colas+"']=alasql.aggr."+col.funcid+"("+colexp+",g['"+colas+"'],g['__REDUCE__"+colas+"']);"+post}return""}else return""}).join("");s+="}"});return new Function("p,params,alasql",s)};function compileSelectStar(query,alias){var s="",sp="",ss=[];query.ixsources={};query.sources.forEach(function(source){query.ixsources[source.alias]=source});var columns;if(query.ixsources[alias]){var columns=query.ixsources[alias].columns}if(columns&&columns.length>0){columns.forEach(function(tcol){ss.push("'"+tcol.columnid+"':p['"+alias+"']['"+tcol.columnid+"']");query.selectColumns[escapeq(tcol.columnid)]=true;var coldef={columnid:tcol.columnid,dbtypeid:tcol.dbtypeid,dbsize:tcol.dbsize,dbprecision:tcol.dbprecision,dbenum:tcol.dbenum};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef})}else{sp+='var w=p["'+alias+'"];for(var k in w){r[k]=w[k]};';query.dirtyColumns=true}return{s:ss.join(","),sp:sp}}yy.Select.prototype.compileSelect1=function(query){var self=this;query.columns=[];query.xcolumns={};query.selectColumns={};query.dirtyColumns=false;var s="var r={";var sp="";var ss=[];this.columns.forEach(function(col){if(col instanceof yy.Column){if(col.columnid=="*"){if(col.func){sp+="r=params['"+col.param+"'](p['"+query.sources[0].alias+"'],p,params,alasql);"}else if(col.tableid){var ret=compileSelectStar(query,col.tableid);if(ret.s)ss=ss.concat(ret.s);sp+=ret.sp}else{for(var alias in query.aliases){var ret=compileSelectStar(query,alias);if(ret.s)ss=ss.concat(ret.s);sp+=ret.sp}}}else{var tbid=col.tableid;var dbid=col.databaseid||query.sources[0].databaseid||query.database.databaseid;if(!tbid)tbid=query.defcols[col.columnid];if(!tbid)tbid=query.defaultTableid;if(col.columnid!="_"){ss.push("'"+escapeq(col.as||col.columnid)+"':p['"+tbid+"']['"+col.columnid+"']") }else{ss.push("'"+escapeq(col.as||col.columnid)+"':p['"+tbid+"']")}query.selectColumns[escapeq(col.as||col.columnid)]=true;if(query.aliases[tbid]&&query.aliases[tbid].type=="table"){if(!alasql.databases[dbid].tables[query.aliases[tbid].tableid]){throw new Error("Table '"+tbid+"' does not exists in database")}var columns=alasql.databases[dbid].tables[query.aliases[tbid].tableid].columns;var xcolumns=alasql.databases[dbid].tables[query.aliases[tbid].tableid].xcolumns;if(xcolumns&&columns.length>0){var tcol=xcolumns[col.columnid];var coldef={columnid:col.as||col.columnid,dbtypeid:tcol.dbtypeid,dbsize:tcol.dbsize,dbpecision:tcol.dbprecision,dbenum:tcol.dbenum};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}else{var coldef={columnid:col.as||col.columnid};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef;query.dirtyColumns=true}}else{var coldef={columnid:col.as||col.columnid};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}}}else if(col instanceof yy.AggrValue){if(!self.group){self.group=[""]}if(!col.as)col.as=escapeq(col.toString());if(col.aggregatorid=="SUM"||col.aggregatorid=="MAX"||col.aggregatorid=="MIN"||col.aggregatorid=="FIRST"||col.aggregatorid=="LAST"||col.aggregatorid=="AVG"||col.aggregatorid=="ARRAY"||col.aggregatorid=="REDUCE"){ss.push("'"+escapeq(col.as)+"':"+n2u(col.expression.toJavaScript("p",query.defaultTableid,query.defcols)))}else if(col.aggregatorid=="COUNT"){ss.push("'"+escapeq(col.as)+"':1")}query.selectColumns[col.aggregatorid+"("+escapeq(col.expression.toString())+")"]=thtd;var coldef={columnid:col.as||col.columnid||col.toString()};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}else{ss.push("'"+escapeq(col.as||col.columnid||col.toString())+"':"+n2u(col.toJavaScript("p",query.defaultTableid,query.defcols)));query.selectColumns[escapeq(col.as||col.columnid||col.toString())]=true;var coldef={columnid:col.as||col.columnid||col.toString()};query.columns.push(coldef);query.xcolumns[coldef.columnid]=coldef}});s+=ss.join(",")+"};"+sp;return s};yy.Select.prototype.compileSelect2=function(query){var s=query.selectfns;return new Function("p,params,alasql","var y;"+s+"return r")};yy.Select.prototype.compileSelectGroup0=function(query){var self=this;self.columns.forEach(function(col,idx){if(col instanceof yy.Column&&col.columnid=="*"){}else{var colas;if(col instanceof yy.Column){colas=escapeq(col.columnid)}else{colas=escapeq(col.toString())}for(var i=0;irb)return 1;if(ra==rb)return 0;return-1}}var s="";var sk="";this.order.forEach(function(ord,idx){var dg="";if(ord.expression instanceof yy.NumValue){ord.expression=self.columns[ord.expression.value-1];ord.expression=new yy.Column({columnid:ord.expression.nick})}if(ord.expression instanceof yy.Column){var columnid=ord.expression.columnid;if(query.xcolumns[columnid]){var dbtypeid=query.xcolumns[columnid].dbtypeid;if(dbtypeid=="DATE"||dbtypeid=="DATETIME")dg=".valueOf()"}else{if(alasql.options.valueof)dg=".valueOf()"}if(ord.nocase)dg+=".toUpperCase()";s+="if((a['"+columnid+"']||'')"+dg+(ord.direction=="ASC"?">":"<")+"(b['"+columnid+"']||'')"+dg+")return 1;";s+="if((a['"+columnid+"']||'')"+dg+"==(b['"+columnid+"']||'')"+dg+"){"}else{dg=".valueOf()";if(ord.nocase)dg+=".toUpperCase()";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+(ord.direction=="ASC"?">(":"<(")+ord.toJavaScript("b","")+"||'')"+dg+")return 1;";s+="if(("+ord.toJavaScript("a","")+"||'')"+dg+"==("+ord.toJavaScript("b","")+"||'')"+dg+"){"}sk+="}"});s+="return 0;";s+=sk+"return -1";query.orderfns=s;return new Function("a,b","var y;"+s)}};var rollup=function(a,query){var rr=[];var mask=0;var glen=a.length;for(var g=0;g"||this.op=="!"){var s=this.left.toString()+this.op;if(typeof this.right!="string"&&typeof this.right!="number")s+="(";s+=this.right.toString();if(typeof this.right!="string"&&typeof this.right!="number")s+=")";return s}return this.left.toString()+" "+P(this.op)+" "+(this.allsome?this.allsome+" ":"")+this.right.toString()};yy.Op.prototype.findAggregator=function(query){if(this.left&&this.left.findAggregator)this.left.findAggregator(query);if(this.right&&this.right.findAggregator&&!this.allsome){this.right.findAggregator(query)}};yy.Op.prototype.toType=function(tableid){if(["-","*","/","%","^"].indexOf(this.op)>-1)return"number";if(this.op=="+"){if(this.left.toType(tableid)=="string"||this.right.toType(tableid)=="string")return"string";if(this.left.toType(tableid)=="number"||this.right.toType(tableid)=="number")return"number"}if(["AND","OR","NOT","=","==","===","!=","!==","!===",">",">=","<","<=","IN","NOT IN","LIKE","NOT LIKE"].indexOf(this.op)>-1)return"boolean";if(this.op=="BETWEEN"||this.op=="NOT BETWEEN"||this.op=="IS NULL"||this.op=="IS NOT NULL")return"boolean";if(this.allsome)return"boolean";if(!this.op)return this.left.toType();return"unknown"};yy.Op.prototype.toJavaScript=function(context,tableid,defcols){var op=this.op;if(this.op=="=")op="===";else if(this.op=="<>")op="!=";else if(this.op=="OR")op="||";if(this.op=="->"){if(typeof this.right=="string"){return this.left.toJavaScript(context,tableid,defcols)+'["'+this.right+'"]'}else if(typeof this.right=="number"){return this.left.toJavaScript(context,tableid,defcols)+"["+this.right+"]"}else if(this.right instanceof yy.FuncValue){ss=[];if(!this.right.args||this.right.args.length==0){}else{var ss=this.right.args.map(function(arg){return arg.toJavaScript(context,tableid,defcols)})}return this.left.toJavaScript(context,tableid,defcols)+"['"+this.right.funcid+"']("+ss.join(",")+")"}else{return this.left.toJavaScript(context,tableid,defcols)+"["+this.right.toJavaScript(context,tableid,defcols)+"]"}}if(this.op=="!"){if(typeof this.right=="string"){return"alasql.databases[alasql.useid].objects["+this.left.toJavaScript(context,tableid,defcols)+']["'+this.right+'"]'}}if(this.op=="IS"){return"((typeof "+this.left.toJavaScript(context,tableid,defcols)+"=='undefined') == "+"(typeof "+this.right.toJavaScript(context,tableid,defcols)+"=='undefined'))"}if(this.op=="=="){return"alasql.utils.deepEqual("+this.left.toJavaScript(context,tableid,defcols)+","+this.right.toJavaScript(context,tableid,defcols)+")"}if(this.op=="==="){return"(("+this.left.toJavaScript(context,tableid,defcols)+").valueOf()===("+this.right.toJavaScript(context,tableid,defcols)+".valueOf()))"}if(this.op=="!==="){return"!(("+this.left.toJavaScript(context,tableid,defcols)+").valueOf()===("+this.right.toJavaScript(context,tableid,defcols)+".valueOf()))"}if(this.op=="!=="){return"(!alasql.utils.deepEqual("+this.left.toJavaScript(context,tableid,defcols)+","+this.right.toJavaScript(context,tableid,defcols)+"))"}if(this.op=="LIKE"){var s="("+this.left.toJavaScript(context,tableid,defcols)+"+'')"+".toUpperCase().match(new RegExp('^'+("+this.right.toJavaScript(context,tableid,defcols)+").replace(/\\%/g,'.*').toUpperCase()+'$','g'))";return s}if(this.op=="NOT LIKE"){var s="!(("+this.left.toJavaScript(context,tableid,defcols)+"+'')"+".toUpperCase().match(new RegExp('^'+("+this.right.toJavaScript(context,tableid,defcols)+").replace(/\\%/g,'.*').toUpperCase()+'$','g')))";return s}if(this.op=="BETWEEN"){return"(("+this.right1.toJavaScript(context,tableid,defcols)+"<="+this.left.toJavaScript(context,tableid,defcols)+")&&"+"("+this.left.toJavaScript(context,tableid,defcols)+"<="+this.right2.toJavaScript(context,tableid,defcols)+"))"}if(this.op=="NOT BETWEEN"){return"!(("+this.right1.toJavaScript(context,tableid,defcols)+"<="+this.left.toJavaScript(context,tableid,defcols)+")&&"+"("+this.left.toJavaScript(context,tableid,defcols)+"<="+this.right2.toJavaScript(context,tableid,defcols)+"))"}if(this.op=="IN"){if(this.right instanceof yy.Select){var s="(";s+="alasql.utils.flatArray(this.queriesfn["+this.queriesidx+"](params,null,context))";s+=".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")>-1)";return s}else if(this.right instanceof Array){var s="(["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")>-1)";return s}else{var s="("+this.right.toJavaScript(context,tableid,defcols)+".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")>-1)";return s}}if(this.op=="NOT IN"){if(this.right instanceof yy.Select){var s="(";s+="alasql.utils.flatArray(this.queriesfn["+this.queriesidx+"](params,null,p))";s+=".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")<0)";return s}else if(this.right instanceof Array){var s="(["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")<0)";return s}else{var s="("+this.right.toJavaScript(context,tableid,defcols)+".indexOf(";s+=this.left.toJavaScript(context,tableid,defcols)+")==-1)";return s}}if(this.allsome=="ALL"){if(this.right instanceof yy.Select){var s="alasql.utils.flatArray(this.query.queriesfn["+this.queriesidx+"](params,null,p))";s+=".every(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else if(this.right instanceof Array){var s="["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].every(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else{throw new Error("Wrong NOT IN operator without SELECT part")}}if(this.allsome=="SOME"||this.allsome=="ANY"){if(this.right instanceof yy.Select){var s="alasql.utils.flatArray(this.query.queriesfn["+this.queriesidx+"](params,null,p))";s+=".some(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else if(this.right instanceof Array){var s="["+this.right.map(function(a){return a.toJavaScript(context,tableid,defcols)}).join(",")+"].some(function(b){return (";s+=this.left.toJavaScript(context,tableid,defcols)+")"+op+"b})";return s}else{throw new Error("Wrong NOT IN operator without SELECT part")}}if(this.op=="AND"){if(this.left.reduced){if(this.right.reduced){return"true"}else{return this.right.toJavaScript(context,tableid,defcols)}}else if(this.right.reduced){return this.left.toJavaScript(context,tableid,defcols)}op="&&"}if(this.op=="^"){return"Math.pow("+this.left.toJavaScript(context,tableid,defcols)+","+this.right.toJavaScript(context,tableid,defcols)+")"}return"("+this.left.toJavaScript(context,tableid,defcols)+op+this.right.toJavaScript(context,tableid,defcols)+")"};yy.VarValue=function(params){return yy.extend(this,params)};yy.VarValue.prototype.toString=function(){return"@"+L(this.variable)};yy.VarValue.prototype.toType=function(){return"unknown"};yy.VarValue.prototype.toJavaScript=function(){return"alasql.vars['"+this.variable+"']"};yy.NumValue=function(params){return yy.extend(this,params)};yy.NumValue.prototype.toString=function(){return N(this.value.toString())};yy.NumValue.prototype.toType=function(){return"number"};yy.NumValue.prototype.toJavaScript=function(){return""+this.value};yy.StringValue=function(params){return yy.extend(this,params)};yy.StringValue.prototype.toString=function(){return"'"+S(this.value.toString())+"'"};yy.StringValue.prototype.toType=function(){return"string"};yy.StringValue.prototype.toJavaScript=function(){return"'"+escapeq(this.value)+"'"};yy.LogicValue=function(params){return yy.extend(this,params)};yy.LogicValue.prototype.toString=function(){return this.value?"TRUE":"FALSE"};yy.LogicValue.prototype.toType=function(){return"boolean"};yy.LogicValue.prototype.toJavaScript=function(){return this.value?"true":"false"};yy.NullValue=function(params){return yy.extend(this,params)};yy.NullValue.prototype.toString=function(){return"NULL"};yy.NullValue.prototype.toJavaScript=function(){return"undefined"};yy.ParamValue=function(params){return yy.extend(this,params)};yy.ParamValue.prototype.toString=function(){return"$"+this.param};yy.ParamValue.prototype.toJavaScript=function(){if(typeof this.param=="string")return"params['"+this.param+"']";else return"params["+this.param+"]"};yy.UniOp=function(params){return yy.extend(this,params)};yy.UniOp.prototype.toString=function(){if(this.op=="-")return this.op+this.right.toString();if(this.op=="+")return this.op+this.right.toString();if(this.op=="#")return this.op+this.right.toString();if(this.op=="NOT")return this.op+"("+this.right.toString()+")";else if(this.op==null)return"("+this.right.toString()+")"};yy.UniOp.prototype.findAggregator=function(query){if(this.right.findAggregator)this.right.findAggregator(query)};yy.UniOp.prototype.toType=function(tableid){if(this.op=="-")return"number";if(this.op=="+")return"number";if(this.op=="NOT")return"boolean"};yy.UniOp.prototype.toJavaScript=function(context,tableid,defcols){if(this.op=="-")return"(-("+this.right.toJavaScript(context,tableid,defcols)+"))";if(this.op=="+")return"("+this.right.toJavaScript(context,tableid,defcols)+")";if(this.op=="NOT")return"!("+this.right.toJavaScript(context,tableid,defcols)+")";if(this.op=="#"){if(this.right instanceof yy.Column){return"(alasql.databases[alasql.useid].objects['"+this.right.columnid+"'])"}else{return"(alasql.databases[alasql.useid].objects["+this.right.toJavaScript(context,tableid,defcols)+"])"}}else if(this.op==null)return"("+this.right.toJavaScript(context,tableid,defcols)+")"};yy.Column=function(params){return yy.extend(this,params)};yy.Column.prototype.toString=function(){var s;if(this.columnid==+this.columnid){s="["+this.columnid+"]"}else{s=this.columnid}if(this.tableid){if(+this.columnid==this.columnid){s=this.tableid+s}else{s=this.tableid+"."+s}if(this.databaseid){s=this.databaseid+"."+s}}return s};yy.Column.prototype.toJavaScript=function(context,tableid,defcols){var s="";if(!this.tableid&&tableid==""&&!defcols){if(this.columnid!="_"){s=context+"['"+this.columnid+"']"}else{if(context=="g"){s="g['_']"}else{s=context}}}else{if(context=="g"){s="g['"+this.nick+"']"}else if(this.tableid){if(this.columnid!="_"){s=context+"['"+this.tableid+"']['"+this.columnid+"']"}else{if(context=="g"){s="g['_']"}else{s=context+"['"+this.tableid+"']"}}}else if(defcols){var tbid=defcols[this.columnid];if(tbid=="-"){throw new Error('Cannot resolve column "'+this.columnid+'" because it exists in two source tables')}else if(tbid){if(this.columnid!="_"){s=context+"['"+tbid+"']['"+this.columnid+"']"}else{s=context+"['"+tbid+"']"}}else{if(this.columnid!="_"){s=context+"['"+(this.tableid||tableid)+"']['"+this.columnid+"']"}else{s=context+"['"+(this.tableid||tableid)+"']"}}}else if(tableid==-1){s=context+"['"+this.columnid+"']"}else{if(this.columnid!="_"){s=context+"['"+(this.tableid||tableid)+"']['"+this.columnid+"']"}else{s=context+"['"+(this.tableid||tableid)+"']"}}}return s};yy.AggrValue=function(params){return yy.extend(this,params)};yy.AggrValue.prototype.toString=function(){var s="";if(this.aggregatorid=="REDUCE")s+=L(this.funcid)+"(";else s+=this.aggregatorid+"(";if(this.distinct)s+=K("DISTINCT")+" ";if(this.expression)s+=this.expression.toString();s+=")";if(this.over)s+=" "+this.over.toString();return s};yy.AggrValue.prototype.findAggregator=function(query){var colas=escapeq(this.toString())+":"+query.selectGroup.length;var found=false;if(!found){if(!this.nick){this.nick=colas;var found=false;for(var i=0;i-1)return"number";if(["ARRAY"].indexOf(this.aggregatorid)>-1)return"array";if(["FIRST","LAST"].indexOf(this.aggregatorid)>-1)return this.expression.toType()};yy.AggrValue.prototype.toJavaScript=function(context,tableid,defcols){var colas=this.nick;if(typeof colas=="undefined")colas=this.toString();return"g['"+colas+"']"};yy.OrderExpression=function(params){return yy.extend(this,params)};yy.OrderExpression.prototype.toString=function(){var s=this.expression.toString();if(this.order)s+=" "+this.order.toString();if(this.nocase)s+=" "+K("COLLATE")+" "+K("NOCASE");return s};yy.GroupExpression=function(params){return yy.extend(this,params)};yy.GroupExpression.prototype.toString=function(){return this.type+"("+this.group.toString()+")"};yy.ColumnDef=function(params){return yy.extend(this,params)};yy.ColumnDef.prototype.toString=function(){var s=this.columnid;if(this.dbtypeid)s+=" "+this.dbtypeid;if(this.dbsize){s+="("+this.dbsize;if(this.dbprecision)s+=","+this.dbprecision;s+=")"}if(this.primarykey)s+=" PRIMARY KEY";if(this.notnull)s+=" NOT NULL";return s};yy.FromData=function(params){return yy.extend(this,params)};yy.FromData.prototype.toString=function(){if(this.data)return K("DATA")+"("+(Math.random()*1e16|0)+")";else return"?"};yy.FromData.prototype.toJavaScript=function(){};yy.Select.prototype.exec=function(params,cb){if(this.preparams)params=this.preparams.concat(params);var databaseid=alasql.useid;db=alasql.databases[databaseid];var sql=this.toString();var hh=hash(sql);var statement=this.compile(databaseid);if(!statement)return;statement.sql=sql;statement.dbversion=db.dbversion;if(db.sqlCacheSize>alasql.MAXSQLCACHESIZE){db.resetSqlCache()}db.sqlCacheSize++;db.sqlCache[hh]=statement;var res=alasql.res=statement(params,cb);return res};yy.Select.prototype.Select=function(){var self=this;var agrs=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments)}else if(arguments.length==1){if(arguments[0]instanceof Array){args=arguments[0]}else{args=[arguments[0]]}}else{throw new Error("Wrong number of arguments of Select() function")}self.columns=[];args.forEach(function(arg){if(typeof arg=="string"){self.columns.push(new yy.Column({columnid:arg}))}else if(typeof arg=="function"){var pari=0;if(self.preparams){pari=self.preparams.length}else{self.preparams=[]}self.preparams.push(arg);self.columns.push(new yy.Column({columnid:"*",func:arg,param:pari}))}else{}});return self};yy.Select.prototype.From=function(tableid){var self=this;if(!self.from)self.from=[];if(tableid instanceof Array){var pari=0;if(self.preparams){pari=self.preparams.length}else{self.preparams=[]}self.preparams.push(tableid);self.from.push(new yy.ParamValue({param:pari}))}else if(typeof tableid=="string"){self.from.push(new yy.Table({tableid:tableid}))}else{throw new Error("Unknown arguments in From() function")}return self};yy.Select.prototype.OrderBy=function(){var self=this;var agrs=[];self.order=[];if(arguments.length==0){args=["_"]}else if(arguments.length>1){args=Array.prototype.slice.call(arguments)}else if(arguments.length==1){if(arguments[0]instanceof Array){args=arguments[0]}else{args=[arguments[0]]}}else{throw new Error("Wrong number of arguments of Select() function")}if(args.length>0){args.forEach(function(arg){var expr=new yy.Column({columnid:arg});if(typeof arg=="function"){expr=arg}self.order.push(new yy.OrderExpression({expression:expr,direction:"ASC"}))})}return self};yy.Select.prototype.Top=function(topnum){var self=this;self.top=new yy.NumValue({value:topnum});return self};yy.Select.prototype.GroupBy=function(){var self=this;var agrs=[];if(arguments.length>1){args=Array.prototype.slice.call(arguments)}else if(arguments.length==1){if(arguments[0]instanceof Array){args=arguments[0]}else{args=[arguments[0]]}}else{throw new Error("Wrong number of arguments of Select() function")}self.group=[];args.forEach(function(arg){var expr=new yy.Column({columnid:arg});self.group.push(expr)});return self};yy.Select.prototype.Where=function(expr){var self=this;if(typeof expr=="function"){self.where=expr}return self};yy.FuncValue=function(params){return yy.extend(this,params)};yy.FuncValue.prototype.toString=function(){var s="";if(alasql.fn[this.funcid])s+=this.funcid;else if(alasql.aggr[this.funcid])s+=this.funcid;else if(alasql.stdlib[this.funcid.toUpperCase()]||alasql.stdfn[this.funcid.toUpperCase()])s+=this.funcid.toUpperCase();s+="(";if(this.args&&this.args.length>0){s+=this.args.map(function(arg){return arg.toString()}).join(",")}s+=")";if(this.as)s+=" AS "+this.as.toString();return s};yy.FuncValue.prototype.findAggregator=function(query){if(this.args&&this.args.length>0){this.args.forEach(function(arg){if(arg.findAggregator)arg.findAggregator(query)})}};yy.FuncValue.prototype.toJavaScript=function(context,tableid,defcols){var s="";var funcid=this.funcid;if(alasql.fn[funcid]){if(this.newid)s+="new ";s+="alasql.fn."+this.funcid+"(";if(this.args&&this.args.length>0){s+=this.args.map(function(arg){return arg.toJavaScript(context,tableid,defcols)}).join(",")}s+=")"}else if(alasql.stdlib[funcid.toUpperCase()]){if(this.args&&this.args.length>0){s+=alasql.stdlib[funcid.toUpperCase()].apply(this,this.args.map(function(arg){return arg.toJavaScript(context,tableid)}))}else{s+=alasql.stdlib[funcid.toUpperCase()]()}}else if(alasql.stdfn[funcid.toUpperCase()]){if(this.newid)s+="new ";s+="alasql.stdfn."+this.funcid.toUpperCase()+"(";if(this.args&&this.args.length>0){s+=this.args.map(function(arg){return arg.toJavaScript(context,tableid,defcols)}).join(",")}s+=")"}else{}return s};var stdlib=alasql.stdlib={};var stdfn=alasql.stdfn={};stdlib.ABS=function(a){return"Math.abs("+a+")"};stdlib.CLONEDEEP=function(a){return"alasql.utils.cloneDeep("+a+")"};stdlib.IIF=function(a,b,c){if(arguments.length==3){return"(("+a+")?("+b+"):("+c+"))"}else{throw new Error("Number of arguments of IFF is not equals to 3")}};stdlib.IFNULL=function(a,b){return"("+a+"||"+b+")"};stdlib.INSTR=function(s,p){return"(("+s+").indexOf("+p+")+1)"};stdlib.LEN=stdlib.LENGTH=function(s){return und(s,"y.length")};stdlib.LOWER=stdlib.LCASE=function(s){return und(s,"y.toLowerCase()")};stdlib.MAX=stdlib.GREATEST=function(){return"Math.max("+Array.prototype.join.call(arguments,",")+")"};stdlib.MIN=stdlib.LEAST=function(){return"Math.min("+Array.prototype.join.call(arguments,",")+")"};stdlib.SUBSTRING=stdlib.MID=function(a,b,c){if(arguments.length==2)return und(a,"y.substr("+b+"-1)");else if(arguments.length==3)return und(a,"y.substr("+b+"-1,"+c+")")};stdlib.ISNULL=stdlib.NULLIF=function(a,b){return"("+a+"=="+b+"?undefined:"+a+")"};stdlib.POWER=function(a,b){return"Math.pow("+a+","+b+")"};stdlib.RANDOM=function(r){if(arguments.length==0){return"Math.random()"}else{return"(Math.random()*("+r+")|0)"}};stdlib.ROUND=function(s,d){if(arguments.length==2){return"Math.round("+s+"*Math.pow(10,"+d+"))/Math.pow(10,"+d+")"}else{return"Math.round("+s+")"}};stdlib.ROWNUM=function(){return"1"};stdlib.ROW_NUMBER=function(){return"1"};stdlib.SQRT=function(s){return"Math.sqrt("+s+")"};stdlib.TRIM=function(s){return und(s,"y.trim()")};stdlib.UPPER=stdlib.UCASE=function(s){return und(s,"y.toUpperCase()")};alasql.aggr.GROUP_CONCAT=function(v,s){if(typeof s=="undefined")return v;else return s+","+v};alasql.aggr.MEDIAN=function(v,s,acc){if(typeof acc.arr=="undefined"){acc.arr=[v]; -return v}else{acc.arr.push(v);var p=acc.arr.sort();return p[p.length/2|0]}};alasql.aggr.VAR=function(v,s,acc){if(typeof acc.arr=="undefined"){acc.arr=[v];acc.sum=v}else{acc.arr.push(v);acc.sum+=v}var N=acc.arr.length;var avg=acc.sum/N;var std=0;for(var i=0;i0){this.whens.forEach(function(w){if(w.when.findAggregator)w.when.findAggregator(query);if(w.then.findAggregator)w.then.findAggregator(query)})}if(this.elses&&this.elses.findAggregator)this.elses.findAggregator(query)};yy.CaseValue.prototype.toJavaScript=function(context,tableid,defcols){var s="((function("+context+",params,alasql){var r;";if(this.expression){s+="v="+this.expression.toJavaScript(context,tableid,defcols)+";";s+=(this.whens||[]).map(function(w){return" if(v=="+w.when.toJavaScript(context,tableid,defcols)+") {r="+w.then.toJavaScript(context,tableid,defcols)+"}"}).join(" else ");if(this.elses)s+=" else {r="+this.elses.toJavaScript(context,tableid,defcols)+"}"}else{s+=(this.whens||[]).map(function(w){return" if("+w.when.toJavaScript(context,tableid,defcols)+") {r="+w.then.toJavaScript(context,tableid,defcols)+"}"}).join(" else ");if(this.elses)s+=" else {r="+this.elses.toJavaScript(context,tableid,defcols)+"}"}s+=";return r;}).bind(this))("+context+",params,alasql)";return s};yy.Json=function(params){return yy.extend(this,params)};yy.Json.prototype.toString=function(){var s="";s+=JSONtoString(this.value);s+="";return s};var JSONtoString=alasql.utils.JSONtoString=function(obj){var s="";if(typeof obj=="string")s='"'+obj+'"';else if(typeof obj=="number")s=obj;else if(typeof obj=="boolean")s=obj;else if(typeof obj=="object"){if(obj instanceof Array){s+="["+obj.map(function(b){return JSONtoString(b)}).join(",")+"]"}else if(!obj.toJavaScript||obj instanceof yy.Json){s="{";var ss=[];for(var k in obj){var s1="";if(typeof k=="string")s1+='"'+k+'"';else if(typeof k=="number")s1+=k;else if(typeof k=="boolean")s1+=k;else{throw new Error("THis is not ES6... no expressions on left side yet")}s1+=":"+JSONtoString(obj[k]);ss.push(s1)}s+=ss.join(",")+"}"}else if(obj.toString){s=obj.toString()}else{throw new Error("1Can not show JSON object "+JSON.stringify(obj))}}else{throw new Error("2Can not show JSON object "+JSON.stringify(obj))}return s};function JSONtoJavaScript(obj,context,tableid,defcols){var s="";if(typeof obj=="string")s='"'+obj+'"';else if(typeof obj=="number")s="("+obj+")";else if(typeof obj=="boolean")s=obj;else if(typeof obj=="object"){if(obj instanceof Array){s+="["+obj.map(function(b){return JSONtoJavaScript(b,context,tableid,defcols)}).join(",")+"]"}else if(!obj.toJavaScript||obj instanceof yy.Json){s="{";var ss=[];for(var k in obj){var s1="";if(typeof k=="string")s1+='"'+k+'"';else if(typeof k=="number")s1+=k;else if(typeof k=="boolean")s1+=k;else{throw new Error("THis is not ES6... no expressions on left side yet")}s1+=":"+JSONtoJavaScript(obj[k],context,tableid,defcols);ss.push(s1)}s+=ss.join(",")+"}"}else if(obj.toJavaScript){s=obj.toJavaScript(context,tableid,defcols)}else{throw new Error("1Can not parse JSON object "+JSON.stringify(obj))}}else{throw new Error("2Can not parse JSON object "+JSON.stringify(obj))}return s}yy.Json.prototype.toJavaScript=function(context,tableid,defcols){return JSONtoJavaScript(this.value,context,tableid,defcols)};yy.Convert=function(params){return yy.extend(this,params)};yy.Convert.prototype.toString=function(){var s="CONVERT(";s+=this.dbtypeid;if(typeof this.dbsize!="undefined"){s+="("+this.dbsize;if(this.dbprecision)s+=","+dbprecision;s+=")"}s+=","+this.expression.toString();if(this.style)s+=","+this.style;s+=")";return s};yy.Convert.prototype.toJavaScript=function(context,tableid,defcols){return"alasql.stdfn.CONVERT("+this.expression.toJavaScript(context,tableid,defcols)+',{dbtypeid:"'+this.dbtypeid+'",dbsize:'+this.dbsize+",style:"+this.style+"})";throw new Error("There is not such type conversion for "+this.toString())};alasql.stdfn.CONVERT=function(value,args){var val=value;if(args.style){var t;if(/\d{8}/.test(val))t=new Date(+val.substr(0,4),+val.substr(4,2)-1,+val.substr(6,2));else t=new Date(val);if(args.style==1){val=("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)+"/"+("0"+t.getYear()).substr(-2)}else if(args.style==2){val=("0"+t.getYear()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getDate()).substr(-2)}else if(args.style==3){val=("0"+t.getDate()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getYear()).substr(-2)}else if(args.style==4){val=("0"+t.getDate()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getYear()).substr(-2)}else if(args.style==5){val=("0"+t.getDate()).substr(-2)+"-"+("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getYear()).substr(-2)}else if(args.style==6){val=("0"+t.getDate()).substr(-2)+" "+t.toString().substr(4,3).toLowerCase()+" "+("0"+t.getYear()).substr(-2)}else if(args.style==7){val=t.toString().substr(4,3)+" "+("0"+t.getDate()).substr(-2)+","+("0"+t.getYear()).substr(-2)}else if(args.style==8){val=("0"+t.getHours()).substr(-2)+":"+("0"+(t.getMinutes()+1)).substr(-2)+":"+("0"+t.getSeconds()).substr(-2)}else if(args.style==10){val=("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getDate()).substr(-2)+"-"+("0"+t.getYear()).substr(-2)}else if(args.style==11){val=("0"+t.getYear()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)}else if(args.style==12){val=("0"+t.getYear()).substr(-2)+("0"+(t.getMonth()+1)).substr(-2)+("0"+t.getDate()).substr(-2)}else if(args.style==101){val=("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)+"/"+t.getFullYear()}else if(args.style==102){val=t.getFullYear()+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getDate()).substr(-2)}else if(args.style==103){val=("0"+t.getDate()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+t.getFullYear()}else if(args.style==104){val=("0"+t.getDate()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+t.getFullYear()}else if(args.style==105){val=("0"+t.getDate()).substr(-2)+"-"+("0"+(t.getMonth()+1)).substr(-2)+"-"+t.getFullYear()}else if(args.style==106){val=("0"+t.getDate()).substr(-2)+" "+t.toString().substr(4,3).toLowerCase()+" "+t.getFullYear()}else if(args.style==107){val=t.toString().substr(4,3)+" "+("0"+t.getDate()).substr(-2)+","+t.getFullYear()}else if(args.style==108){val=("0"+t.getHours()).substr(-2)+":"+("0"+(t.getMinutes()+1)).substr(-2)+":"+("0"+t.getSeconds()).substr(-2)}else if(args.style==110){val=("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getDate()).substr(-2)+"-"+t.getFullYear()}else if(args.style==111){val=t.getFullYear()+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)}else if(args.style==112){val=t.getFullYear()+("0"+(t.getMonth()+1)).substr(-2)+("0"+t.getDate()).substr(-2)}else{throw new Error("The CONVERT style "+args.style+" is not realized yet.")}}if(args.dbtypeid=="Date"){return new Date(val)}else if(args.dbtypeid.toUpperCase()=="DATE"){var d=new Date(val);var s=d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2);return s}else if(args.dbtypeid=="DATETIME"){var d=new Date(val);var s=d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2);s+=" "+("0"+d.getHours()).substr(-2)+":"+("0"+d.getMinutes()).substr(-2)+":"+("0"+d.getSeconds()).substr(-2);s+="."+("00"+d.getMilliseconds()).substr(-3);return s}else if(args.dbtypeid.toUpperCase()=="STRING"){return""+val}else if(args.dbtypeid.toUpperCase()=="NUMBER"||args.dbtypeid=="FLOAT"){return+val}else if(args.dbtypeid.toUpperCase()=="MONEY"){var m=+val;return(m|0)+m*100%100/100}else if(args.dbtypeid.toUpperCase()=="BOOLEAN"){return!!val}else if(args.dbtypeid.toUpperCase()=="INT"){return val|0}else if(args.dbtypeid.toUpperCase()=="VARCHAR"||args.dbtypeid=="NVARCHAR"){if(args.dbsize)return(""+val).substr(0,args.dbsize);else return""+val}else if(args.dbtypeid.toUpperCase()=="CHAR"||args.dbtypeid=="NCHAR"){return(val+new Array(args.dbsize+1).join(" ")).substr(0,args.dbsize)}};yy.ColumnDef=function(params){return yy.extend(this,params)};yy.ColumnDef.prototype.toString=function(){var s=this.columnid;if(this.dbtypeid)s+=" "+this.dbtypeid;if(this.dbsize){s+="("+this.dbsize;if(this.dbprecision)s+=","+this.dbprecision;s+=")"}if(this.primarykey)s+=" PRIMARY KEY";if(this.notnull)s+=" NOT NULL";return s};yy.CreateTable=function(params){return yy.extend(this,params)};yy.CreateTable.prototype.toString=function(){var s=K("CREATE");if(this.temporary)s+=" "+K("TEMPORARY");if(this.view)s+=" "+K("VIEW");else s+=" "+(this.class?K("CLASS"):K("TABLE"));if(this.ifnotexists)s+=" "+K("IF")+" "+K("NOT")+" "+K("EXISTS");s+=" "+this.table.toString();if(this.viewcolumns){s+="("+this.viewcolumns.map(function(vcol){return vcol.toString()}).join(",")+")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);else{var ss=this.columns.map(function(col){return col.toString()});s+=" ("+NL()+ID()+ss.join(","+NL()+ID())+")"}if(this.view&&this.select){s+=" AS "+this.select.toString()}return s};yy.CreateTable.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[this.table.databaseid||databaseid];var tableid=this.table.tableid;if(!tableid){throw new Error("Table name is not defined")}var columns=this.columns;var constraints=this.constraints||[];if(this.ifnotexists&&db.tables[tableid])return 0;if(db.tables[tableid]){throw new Error("Can not create table '"+tableid+"', because it already exists in the database '"+db.databaseid+"'")}var table=db.tables[tableid]=new alasql.Table;if(this.class){table.isclass=true}table.identities={};table.checkfn=[];var ss=[];if(this.columns){this.columns.forEach(function(col){var dbtypeid=col.dbtypeid;if(!alasql.fn[dbtypeid])dbtypeid=dbtypeid.toUpperCase();var newcol={columnid:col.columnid,dbtypeid:dbtypeid,dbsize:col.dbsize,dbprecision:col.dbprecision,notnull:col.notnull,identity:col.identity};if(col.identity){table.identities[col.columnid]={value:+col.identity.value,step:+col.identity.step}}if(col.check){table.checkfn.push(new Function("r","var y;return "+col.check.expression.toJavaScript("r","")))}if(col.default){ss.push("'"+col.columnid+"':"+col.default.toJavaScript("r",""))}if(col.primarykey){var pk=table.pk={};pk.columns=[col.columnid];pk.onrightfns="r['"+col.columnid+"']";pk.onrightfn=new Function("r","var y;return "+pk.onrightfns);pk.hh=hash(pk.onrightfns);table.uniqs[pk.hh]={}}if(col.unique){var uk={};if(typeof table.uk=="undefined")table.uk=[];table.uk.push(uk);uk.columns=[col.columnid];uk.onrightfns="r['"+col.columnid+"']";uk.onrightfn=new Function("r","var y;return "+uk.onrightfns);uk.hh=hash(uk.onrightfns);table.uniqs[uk.hh]={}}if(col.foreignkey){var fk=col.foreignkey.table;var fktable=alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];if(typeof fk.columnid=="undefined"){if(fktable.pk.columns&&fktable.pk.columns.length>0){fk.columnid=fktable.pk.columns[0]}else{throw new Error("FOREIGN KEY allowed only to tables with PRIMARY KEYs")}}var fkfn=function(r){var rr={};if(typeof r[col.columnid]=="undefined")return true;rr[fk.columnid]=r[col.columnid];var addr=fktable.pk.onrightfn(rr);if(!fktable.uniqs[fktable.pk.hh][addr]){throw new Error('Foreign key "'+r[col.columnid]+'" is not found in table '+fktable.tableid)}return true};table.checkfn.push(fkfn)}table.columns.push(newcol);table.xcolumns[newcol.columnid]=newcol})}table.defaultfns=ss.join(",");constraints.forEach(function(con){if(con.type=="PRIMARY KEY"){if(table.pk){throw new Error("Primary key already exists")}var pk=table.pk={};pk.columns=con.columns;pk.onrightfns=pk.columns.map(function(columnid){return"r['"+columnid+"']"}).join("+'`'+");pk.onrightfn=new Function("r","var y;return "+pk.onrightfns);pk.hh=hash(pk.onrightfns);table.uniqs[pk.hh]={}}else if(con.type=="CHECK"){table.checkfn.push(new Function("r","var y;return "+con.expression.toJavaScript("r","")))}else if(con.type=="UNIQUE"){var uk={};if(!table.uk)table.uk=[];table.uk.push(uk);uk.columns=con.columns;uk.onrightfns=uk.columns.map(function(columnid){return"r['"+columnid+"']"}).join("+'`'+");uk.onrightfn=new Function("r","var y;return "+uk.onrightfns);uk.hh=hash(uk.onrightfns);table.uniqs[uk.hh]={}}else if(con.type=="FOREIGN KEY"){var col=table.xcolumns[con.columns[0]];var fk=con.fktable;if(con.fkcolumns&&con.fkcolumns.length>0)fk.columnid=con.fkcolumns[0];var fktable=alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];if(typeof fk.columnid=="undefined"){fk.columnid=fktable.pk.columns[0]}var fkfn=function(r){var rr={};if(typeof r[col.columnid]=="undefined")return true;rr[fk.columnid]=r[col.columnid];var addr=fktable.pk.onrightfn(rr);if(!fktable.uniqs[fktable.pk.hh][addr]){throw new Error('Foreign key "'+r[col.columnid]+'" is not found in table '+fktable.tableid)}return true};table.checkfn.push(fkfn)}});if(this.view&&this.viewcolumns){var self=this;this.viewcolumns.forEach(function(vcol,idx){self.select.columns[idx].as=vcol.columnid})}if(db.engineid){return alasql.engines[db.engineid].createTable(this.table.databaseid||databaseid,tableid,this.ifnotexists,cb)}table.insert=function(r){var table=this;for(var columnid in table.identities){var ident=table.identities[columnid];r[columnid]=ident.value}if(table.checkfn&&table.checkfn.length>0){table.checkfn.forEach(function(checkfn){if(!checkfn(r)){throw new Error("Violation of CHECK constraint")}})}table.columns.forEach(function(column){if(column.notnull&&typeof r[column.columnid]=="undefined"){throw new Error("Wrong NULL value in NOT NULL column "+column.columnid)}});if(table.pk){var pk=table.pk;var addr=pk.onrightfn(r);if(typeof table.uniqs[pk.hh][addr]!="undefined"){throw new Error("Cannot insert record, because it already exists in primary key index")}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][ukaddr]!="undefined"){throw new Error("Cannot insert record, because it already exists in unique index")}})}table.data.push(r);for(var columnid in table.identities){var ident=table.identities[columnid];ident.value+=ident.step}if(table.pk){var pk=table.pk;var addr=pk.onrightfn(r);table.uniqs[pk.hh][addr]=r}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);table.uniqs[uk.hh][ukaddr]=r})}};table.delete=function(i,params,alasql){var table=this;var r=this.data[i];if(this.pk){var pk=this.pk;var addr=pk.onrightfn(r);if(typeof this.uniqs[pk.hh][addr]=="undefined"){throw new Error("Something wrong with primary key index on table")}else{this.uniqs[pk.hh][addr]=undefined}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][ukaddr]=="undefined"){throw new Error("Something wrong with unique index on table")}table.uniqs[uk.hh][ukaddr]=undefined})}};table.deleteall=function(){this.data.length=0;if(this.pk){this.uniqs[this.pk.hh]={}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){table.uniqs[uk.hh]={}})}};table.update=function(assignfn,i,params){var r=cloneDeep(this.data[i]);if(this.pk){var pk=this.pk;pk.pkaddr=pk.onrightfn(r,params);if(typeof this.uniqs[pk.hh][pk.pkaddr]=="undefined"){throw new Error("Something wrong with index on table")}else{}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){uk.ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][uk.ukaddr]=="undefined"){throw new Error("Something wrong with unique index on table")}})}assignfn(r,params,alasql);if(table.checkfn&&table.checkfn.length>0){table.checkfn.forEach(function(checkfn){if(!checkfn(r)){throw new Error("Violation of CHECK constraint")}})}table.columns.forEach(function(column){if(column.notnull&&typeof r[column.columnid]=="undefined"){throw new Error("Wrong NULL value in NOT NULL column "+column.columnid)}});if(this.pk){pk.newpkaddr=pk.onrightfn(r);if(typeof this.uniqs[pk.hh][pk.newpkaddr]!="undefined"&&pk.newpkaddr!=pk.pkaddr){throw new Error("Record already exists")}else{}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){uk.newukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][uk.newukaddr]!="undefined"&&uk.newukaddr!=uk.ukaddr){throw new Error("Record already exists")}})}if(this.pk){this.uniqs[pk.hh][pk.pkaddr]=undefined;this.uniqs[pk.hh][pk.newpkaddr]=r}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){table.uniqs[uk.hh][uk.ukaddr]=undefined;table.uniqs[uk.hh][uk.newukaddr]=r})}this.data[i]=r};if(this.view&&this.select){table.view=true;table.select=this.select.compile(this.table.databaseid||databaseid)}var res;if(!alasql.options.nocount)res=1;if(cb)res=cb(res);return res};alasql.fn.Date=Object;alasql.fn.Date=Date;alasql.fn.Number=Number;alasql.fn.String=String;alasql.fn.Boolean=Boolean;stdfn.EXTEND=alasql.utils.extend;stdfn.CHAR=String.fromCharCode.bind(String);stdfn.ASCII=function(a){return a.charCodeAt(0)};stdfn.COALESCE=function(){for(var i=0;i0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql",s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res;var db=alasql.databases[dbid];if(typeof sharp!="undefined"){var id=sharp}else{var id=db.counter++}var vertex={$id:id,$node:"VERTEX"};db.objects[vertex.$id]=vertex;res=vertex;if(namefn)namefn(vertex);if(setfn)setfn(vertex,params,alasql);if(cb)res=cb(res);return res};return statement};yy.CreateEdge=function(params){return yy.extend(this,params)};yy.CreateEdge.prototype.toString=function(){var s=K("CREATE")+" "+K("EDGE")+" ";if(this.class)s+=L(this.class)+" ";return s};yy.CreateEdge.prototype.toJavaScript=function(context,tableid,defcols){var s="this.queriesfn["+(this.queriesidx-1)+"](this.params,null,"+context+")";return s};yy.CreateEdge.prototype.compile=function(databaseid){var dbid=databaseid;var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());var tofn=new Function("params,alasql","var y;return "+this.to.toJavaScript());if(typeof this.name!="undefined"){var s="x.name="+this.name.toJavaScript();var namefn=new Function("x",s)}if(this.sets&&this.sets.length>0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql","var y;"+s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res=0;var db=alasql.databases[dbid];var edge={$id:db.counter++,$node:"EDGE"};var v1=fromfn(params,alasql);var v2=tofn(params,alasql);edge.$in=[v1.$id];edge.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(edge.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(edge.$id);db.objects[edge.$id]=edge;res=edge;if(namefn)namefn(edge);if(setfn)setfn(edge,params,alasql);if(cb)res=cb(res);return res};return statement};yy.CreateGraph=function(params){return yy.extend(this,params)};yy.CreateGraph.prototype.toString=function(){var s=K("CREATE")+" "+K("GRAPH")+" ";if(this.class)s+=L(this.class)+" ";return s};yy.CreateGraph.prototype.execute=function(databaseid,params,cb){var res=[];if(this.from){if(alasql.from[this.from.funcid]){this.graph=alasql.from[this.from.funcid.toUpperCase()](this.from.args[0].value);console.log(this.graph)}}this.graph.forEach(function(g){if(g.source){var e={};if(typeof g.as!="undefined")alasql.vars[g.as]=e;if(typeof g.prop!="undefined"){e.name=g.prop}if(typeof g.sharp!="undefined")e.$id=g.sharp;if(typeof g.name!="undefined")e.name=g.name;if(typeof g.class!="undefined")e.$class=g.class;var db=alasql.databases[databaseid];if(typeof e.$id=="undefined"){e.$id=db.counter++}e.$node="EDGE";if(typeof g.json!="undefined"){extend(e,new Function("params,alasql","var y;return "+g.json.toJavaScript())(params,alasql))}var v1;if(g.source.vars){var vo=alasql.vars[g.source.vars];if(typeof vo=="object")v1=vo;else v1=db.objects[vo]}else{var av1=g.source.sharp;if(typeof av1=="undefined")av1=g.source.prop;v1=alasql.databases[databaseid].objects[av1];if(typeof v1=="undefined"&&alasql.options.autovertex&&(typeof g.source.prop!="undefined"||typeof g.source.name!="undefined")){v1=findVertex(g.source.prop||g.source.name);if(typeof v1=="undefined"){v1=createVertex(g.source)}}}var v2;if(g.source.vars){var vo=alasql.vars[g.target.vars];if(typeof vo=="object")v2=vo;else v2=db.objects[vo]}else{var av2=g.target.sharp;if(typeof av2=="undefined")av2=g.target.prop;v2=alasql.databases[databaseid].objects[av2];if(typeof v2=="undefined"&&alasql.options.autovertex&&(typeof g.target.prop!="undefined"||typeof g.target.name!="undefined")){v2=findVertex(g.target.prop||g.target.name);if(typeof v2=="undefined"){v2=createVertex(g.target)}}}e.$in=[v1.$id];e.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(e.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(e.$id);db.objects[e.$id]=e;if(typeof e.$class!="undefined"){if(typeof alasql.databases[databaseid].tables[e.$class]=="undefined"){throw new Error("No such class. Pleace use CREATE CLASS")}else{alasql.databases[databaseid].tables[e.$class].data.push(e)}}res.push(e.$id)}else{createVertex(g)}});if(cb)res=cb(res);return res;function findVertex(name){var objects=alasql.databases[alasql.useid].objects;for(var k in objects){if(objects[k].name==name){return objects[k]}}return undefined}function createVertex(g){var v={};if(typeof g.as!="undefined")alasql.vars[g.as]=v;if(typeof g.prop!="undefined"){v.$id=g.prop;v.name=g.prop}if(typeof g.sharp!="undefined")v.$id=g.sharp;if(typeof g.name!="undefined")v.name=g.name;if(typeof g.class!="undefined")v.$class=g.class;var db=alasql.databases[databaseid];if(typeof v.$id=="undefined"){v.$id=db.counter++}v.$node="VERTEX";if(typeof g.json!="undefined"){extend(v,new Function("params,alasql","var y;return "+g.json.toJavaScript())(params,alasql))}db.objects[v.$id]=v;if(typeof v.$class!="undefined"){if(typeof alasql.databases[databaseid].tables[v.$class]=="undefined"){throw new Error("No such class. Pleace use CREATE CLASS")}else{alasql.databases[databaseid].tables[v.$class].data.push(v)}}res.push(v.$id);return v}};yy.CreateGraph.prototype.compile1=function(databaseid){var dbid=databaseid;var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());var tofn=new Function("params,alasql","var y;return "+this.to.toJavaScript());if(typeof this.name!="undefined"){var s="x.name="+this.name.toJavaScript();var namefn=new Function("x",s)}if(this.sets&&this.sets.length>0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql","var y;"+s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res=0;var db=alasql.databases[dbid];var edge={$id:db.counter++,$node:"EDGE"};var v1=fromfn(params,alasql);var v2=tofn(params,alasql);edge.$in=[v1.$id];edge.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(edge.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(edge.$id);db.objects[edge.$id]=edge;res=edge;if(namefn)namefn(edge);if(setfn)setfn(edge,params,alasql);if(cb)res=cb(res);return res};return statement};yy.AlterTable=function(params){return yy.extend(this,params)};yy.AlterTable.prototype.toString=function(){var s="ALTER TABLE "+this.table.toString();if(this.renameto)s+=" RENAME TO "+this.renameto;return s};yy.AlterTable.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[databaseid];db.dbversion=Date.now();if(this.renameto){var oldtableid=this.table.tableid;var newtableid=this.renameto;var res=1;if(db.tables[newtableid]){throw new Error("Can not rename a table '"+oldtableid+"' to '"+newtableid+"', because the table with this name already exists")}else if(newtableid==oldtableid){throw new Error("Can not rename a table '"+oldtableid+"' to itself")}else{db.tables[newtableid]=db.tables[oldtableid];delete db.tables[oldtableid];res=1}if(cb)cb(res);return res}else if(this.addcolumn){var db=alasql.databases[this.table.databaseid||databaseid];db.dbversion++;var tableid=this.table.tableid;var table=db.tables[tableid];var columnid=this.addcolumn.columnid;if(table.xcolumns[columnid]){throw new Error('Cannot add column "'+columnid+'", because it already exists in the table "'+tableid+'"')}var col={columnid:columnid,dbtypeid:this.dbtypeid,dbsize:this.dbsize,dbprecision:this.dbprecision,dbenum:this.dbenum,defaultfns:null};var defaultfn=function(){};table.columns.push(col);table.xcolumns[columnid]=col;for(var i=0,ilen=table.data.length;i0){for(var i=0,ilen=table.data.length;i0){for(var i=0,ilen=table.data.length;i=0){q+="(x="+values[idx].toJavaScript()+",x==undefined?undefined:+x)"}else if(alasql.fn[table.xcolumns[col.columnid].dbtypeid]){q+="(new "+table.xcolumns[col.columnid].dbtypeid+"(";q+=values[idx].toJavaScript();q+="))"}else{q+=values[idx].toJavaScript()}}else{q+=values[idx].toJavaScript()}ss.push(q)})}else{if(values instanceof Array&&table.columns&&table.columns.length>0){table.columns.forEach(function(col,idx){var q="'"+col.columnid+"':";if(["INT","FLOAT","NUMBER","MONEY"].indexOf(col.dbtypeid)>=0){q+="+"+values[idx].toJavaScript()}else if(alasql.fn[col.dbtypeid]){q+="(new "+col.dbtypeid+"(";q+=values[idx].toJavaScript();q+="))"}else{q+=values[idx].toJavaScript()}ss.push(q)})}else{sw=JSONtoJavaScript(values)}}if(db.tables[tableid].defaultfns){ss.unshift(db.tables[tableid].defaultfns)}if(sw){s+="a="+sw+";"}else{s+="a={"+ss.join(",")+"};"}if(db.tables[tableid].isclass){s+="var db=alasql.databases['"+databaseid+"'];";s+='a.$class="'+tableid+'";';s+="a.$id=db.counter++;";s+="db.objects[a.$id]=a;"}if(db.tables[tableid].insert){s+="var db=alasql.databases['"+databaseid+"'];";s+="db.tables['"+tableid+"'].insert(a);"}else{s+="aa.push(a);"}});s33=s3+s;if(db.tables[tableid].insert){}else{s+="alasql.databases['"+databaseid+"'].tables['"+tableid+"'].data="+"alasql.databases['"+databaseid+"'].tables['"+tableid+"'].data.concat(aa);"}if(db.tables[tableid].insert){if(db.tables[tableid].isclass){s+="return a.$id;"}else{s+="return "+self.values.length}}else{s+="return "+self.values.length}var insertfn=new Function("db, params, alasql","var y;"+s3+s).bind(this)}else if(this.select){selectfn=this.select.compile(databaseid);if(db.engineid&&alasql.engines[db.engineid].intoTable){var statement=function(params,cb){var aa=selectfn(params);var res=alasql.engines[db.engineid].intoTable(db.databaseid,tableid,aa,null,cb);return res};return statement}else{var insertfn=function(db,params,alasql){var res=selectfn(params);if(db.tables[tableid].insert){for(var i=0,ilen=res.length;i0){s+="("+this.args.map(function(arg){return arg.toString()}).join(", ")+")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);return s};yy.CreateDatabase.prototype.execute=function(databaseid,params,cb){var args;if(this.args&&this.args.length>0){args=this.args.map(function(arg){return new Function("params,alasql","var y;return "+arg.toJavaScript())(params,alasql)})}if(this.engineid){var res=alasql.engines[this.engineid].createDatabase(this.databaseid,this.args,this.ifnotexists,this.as,cb);return res}else{var dbid=this.databaseid;if(alasql.databases[dbid]){throw new Error("Database '"+dbid+"' already exists")}var a=new alasql.Database(dbid);var res=1;if(cb)return cb(res);return res}};yy.AttachDatabase=function(params){return yy.extend(this,params)};yy.AttachDatabase.prototype.toString=function(){var s=K("ATTACH");if(this.engineid)s+=" "+L(this.engineid);s+=" "+K("DATABASE")+" "+L(this.databaseid);if(args){s+="(";if(args.length>0){s+=args.map(function(arg){return arg.toString()}).join(", ")}s+=")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);return s};yy.AttachDatabase.prototype.execute=function(databaseid,params,cb){if(!alasql.engines[this.engineid]){throw new Error('Engine "'+this.engineid+'" is not defined.')}var res=alasql.engines[this.engineid].attachDatabase(this.databaseid,this.as,this.args,params,cb);return res};yy.DetachDatabase=function(params){return yy.extend(this,params)};yy.DetachDatabase.prototype.toString=function(){var s=K("DETACH");s+=" "+K("DATABASE")+" "+L(this.databaseid);return s};yy.DetachDatabase.prototype.execute=function(databaseid,params,cb){if(!alasql.databases[this.databaseid].engineid){throw new Error('Cannot detach database "'+this.engineid+'", because it was not attached.')}var res;var dbid=this.databaseid;if(dbid==alasql.DEFAULTDATABASEID){throw new Error("Drop of default database is prohibited")}if(!alasql.databases[dbid]){if(!this.ifexists){throw new Error("Database '"+dbid+"' does not exist")}else{res=0}}else{delete alasql.databases[dbid];if(dbid==alasql.useid){alasql.use()}res=1}if(cb)cb(res);return res};yy.UseDatabase=function(params){return yy.extend(this,params)};yy.UseDatabase.prototype.toString=function(){return K("USE")+" "+K("DATABASE")+" "+L(this.databaseid)};yy.UseDatabase.prototype.execute=function(databaseid,params,cb){var dbid=this.databaseid;if(!alasql.databases[dbid]){throw new Error("Database '"+dbid+"' does not exist")}alasql.use(dbid);var res=1;if(cb)cb(res);return res};yy.DropDatabase=function(params){return yy.extend(this,params)};yy.DropDatabase.prototype.toString=function(){var s=K("DROP");if(this.ifexists)s+=" "+K("IF")+" "+K("EXISTS");s+=" "+K("DATABASE")+" "+L(this.databaseid);return s};yy.DropDatabase.prototype.execute=function(databaseid,params,cb){if(this.engineid){return alasql.engines[this.engineid].dropDatabase(this.databaseid,this.ifexists,cb)}var res;var dbid=this.databaseid;if(dbid==alasql.DEFAULTDATABASEID){throw new Error("Drop of default database is prohibited")}if(!alasql.databases[dbid]){if(!this.ifexists){throw new Error("Database '"+dbid+"' does not exist")}else{res=0}}else{if(alasql.databases[dbid].engineid){throw new Error("Cannot drop database '"+dbid+"', because it is attached. Detach it.")}delete alasql.databases[dbid];if(dbid==alasql.useid){alasql.use()}res=1}if(cb)cb(res);return res};yy.Declare=function(params){return yy.extend(this,params)};yy.Declare.prototype.toString=function(){var s=K("DECLARE")+" ";if(this.declares&&this.declares.length>0){s=this.declares.map(function(declare){var s="";s+="@"+L(declare.variable)+" ";s+=declare.dbtypeid;if(this.dbsize)s+="("+N(this.dbsize);if(this.dbprecision)s+=","+N(this.dbprecision);s+=")";if(declare.expression)s+=" = "+declare.expression.toString();return s}).join(",")}return s};yy.Declare.prototype.execute=function(databaseid,params,cb){var res=1;if(this.declares&&this.declares.length>0){this.declares.map(function(declare){var dbtypeid=declare.dbtypeid;if(!alasql.fn[dbtypeid])dbtypeid=dbtypeid.toUpperCase();alasql.declares[declare.variable]={dbtypeid:dbtypeid,dbsize:declare.dbsize,dbprecision:declare.dbprecision};if(declare.expression){alasql.vars[declare.variable]=new Function("params,alasql","return "+declare.expression.toJavaScript("({})","",null))(params,alasql);if(alasql.declares[declare.variable]){alasql.vars[declare.variable]=alasql.stdfn.CONVERT(alasql.vars[declare.variable],alasql.declares[declare.variable])}}})}if(cb)res=cb(res);return res};yy.ShowDatabases=function(params){return yy.extend(this,params)};yy.ShowDatabases.prototype.toString=function(){var s=K("SHOW")+" "+K("DATABASES");if(this.like)s+="LIKE "+this.like.toString();return s};yy.ShowDatabases.prototype.execute=function(databaseid,params,cb){if(this.engineid){return alasql.engines[this.engineid].showDatabases(this.like,cb)}else{var self=this;var res=[];for(dbid in alasql.databases){res.push({databaseid:dbid})}if(self.like&&res&&res.length>0){res=res.filter(function(d){return d.databaseid.match(new RegExp(self.like.value.replace(/\%/g,".*"),"g"))})}if(cb)cb(res);return res}};yy.ShowTables=function(params){return yy.extend(this,params)};yy.ShowTables.prototype.toString=function(){var s=K("SHOW")+" "+K("TABLES");if(this.databaseid)s+=" FROM "+this.databaseid;if(this.like)s+=" "+K("LIKE")+" "+this.like.toString();return s};yy.ShowTables.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[this.databaseid||databaseid];var self=this;var res=[];for(tableid in db.tables){res.push({tableid:tableid})}if(self.like&&res&&res.length>0){res=res.filter(function(d){return d.tableid.match(new RegExp(self.like.value.replace(/\%/g,".*"),"g"))})}if(cb)cb(res);return res};yy.ShowColumns=function(params){return yy.extend(this,params)};yy.ShowColumns.prototype.toString=function(){var s=K("SHOW")+" "+K("COLUMNS");if(this.table.tableid)s+=" "+K("FROM")+" "+this.table.tableid;if(this.databaseid)s+=" "+K("FROM")+" "+this.databaseid;return s};yy.ShowColumns.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;if(table&&table.columns){var res=table.columns.map(function(col){return{columnid:col.columnid,dbtypeid:col.dbtypeid,dbsize:col.dbsize}});return res}else{return[]}};yy.ShowIndex=function(params){return yy.extend(this,params)};yy.ShowIndex.prototype.toString=function(){var s=K("SHOW")+" "+K("INDEX");if(this.table.tableid)s+=" "+K("FROM")+" "+this.table.tableid;if(this.databaseid)s+=" "+K("FROM")+" "+this.databaseid;return s};yy.ShowIndex.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;var res=[];if(table&&table.indices){for(var ind in table.indices){res.push({hh:ind,len:Object.keys(table.indices[ind]).length})}}return res};yy.ShowCreateTable=function(params){return yy.extend(this,params)};yy.ShowCreateTable.prototype.toString=function(){var s=K("SHOW")+" "+K("CREATE")+" "+K("TABLE")+" "+L(this.table.tableid);if(this.databaseid)s+=" "+K("FROM")+" "+L(this.databaseid);return s};yy.ShowCreateTable.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;if(table){var s=K("CREATE")+" "+K("TABLE")+" "+L(this.table.tableid)+" (";var ss=[];if(table.columns){table.columns.forEach(function(col){var a=L(col.columnid)+" "+K(col.dbtypeid);if(col.dbsize)a+="("+N(col.dbsize)+")";if(col.primarykey)a+=" "+K("PRIMARY")+" "+K("KEY");ss.push(a)});s+=ss.join(", ")}s+=")";return s}else{throw new Error('There is no such table "'+this.table.tableid+'"')}};yy.SetVariable=function(params){return yy.extend(this,params)};yy.SetVariable.prototype.toString=function(){var s=K("SET")+" ";if(typeof this.value!="undefined")s+=K(this.variable.toUpperCase())+" "+(this.value?"ON":"OFF");if(this.expression)s+=this.method+L(this.variable)+" = "+this.expression.toString();return s};yy.SetVariable.prototype.execute=function(databaseid,params,cb){if(typeof this.value!="undefined"){var val=this.value;if(val=="ON")val=true;else if(val=="OFF")val=false;alasql.options[this.variable]=val}else if(this.expression){if(this.exists){this.existsfn=this.exists.map(function(ex){var nq=ex.compile(databaseid);if(nq.query&&!nq.query.modifier)nq.query.modifier="RECORDSET";return nq})}if(this.queries){this.queriesfn=this.queries.map(function(q){var nq=q.compile(databaseid);if(nq.query&&!nq.query.modifier)nq.query.modifier="RECORDSET";return nq})}var res=new Function("params,alasql","return "+this.expression.toJavaScript("({})","",null)).bind(this)(params,alasql);if(alasql.declares[this.variable]){res=alasql.stdfn.CONVERT(res,alasql.declares[this.variable])}if(this.props&&this.props.length>0){if(this.method=="@"){var fs="alasql.vars['"+this.variable+"']"}else{var fs="params['"+this.variable+"']"}fs+=this.props.map(function(prop){if(typeof prop=="string"){return"['"+prop+"']"}else if(typeof prop=="number"){return"["+prop+"]"}else{return"["+prop.toJavaScript()+"]"}}).join();new Function("value,params,alasql","var y;"+fs+"=value")(res,params,alasql)}else{if(this.method=="@"){alasql.vars[this.variable]=res}else{params[this.variable]=res}}}var res=1;if(cb)res=cb(res);return res};alasql.test=function(name,times,fn){if(arguments.length==0){alasql.log(alasql.con.results);return}else if(arguments.length==1){var tm=Date.now();fn();alasql.con.log(Date.now()-tm);return}if(arguments.length==2){fn=times;times=1}var tm=Date.now();for(var i=0;i",sql);if(res instanceof Array){if(console.table){console.table(res)}else{console.log(JSONtoString(res))}}else{console.log(JSONtoString(res))}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}var s="";if(typeof sql=="string"&&alasql.options.logprompt){s+="

"+alasql.pretty(sql)+"
"}if(res instanceof Array){if(res.length==0){s+="

[ ]

"}else if(typeof res[0]!="object"||res[0]instanceof Array){for(var i=0,ilen=res.length;i"+loghtml(res[i])+"

"}}else{s+=loghtml(res)}}else{s+=loghtml(res)}el.innerHTML+=s}};alasql.clear=function(){var target=alasql.options.logtarget;if(typeof exports=="object"){target="console"}if(target=="console"||typeof exports=="object"){if(console.clear){console.clear()}else{}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}el.innerHTML=""}};alasql.write=function(s){var target=alasql.options.logtarget;if(typeof exports=="object"){target="console"}if(target=="console"||typeof exports=="object"){if(console.log){console.log(s)}else{}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}el.innerHTML+=s}};function loghtml(res){var s="";if(typeof res=="undefined"){s+="undefined"}else if(res instanceof Array){s+="";s+="";var cols=[];for(colid in res[0]){cols.push(colid)}s+="
#";cols.forEach(function(colid){s+=""+colid});for(var i=0,ilen=res.length;i"+(i+1);cols.forEach(function(colid){s+=" ";if(+res[i][colid]==+res[i][colid]){s+='
';if(typeof res[i][colid]=="undefined")s+="NULL";else s+=res[i][colid];s+="
"}else{if(typeof res[i][colid]=="undefined"){s+="NULL"}else if(typeof res[i][colid]=="string"){s+=res[i][colid]}else s+=JSONtoString(res[i][colid])}})}s+="
"}else{s+="

"+JSONtoString(res)+"

"}return s}function scrollTo(element,to,duration){if(duration<=0)return;var difference=to-element.scrollTop;var perTick=difference/duration*10;setTimeout(function(){if(element.scrollTop==to)return;element.scrollTop=element.scrollTop+perTick;scrollTo(element,to,duration-10)},10)}alasql.prompt=function(el,useidel,firstsql){if(typeof exports=="object"){throw new Error("The functionality of prompt is not realized for Node.js")}var prompti=0;if(typeof el=="string")el=document.getElementById(el);if(typeof useidel=="string")useidel=document.getElementById(useidel);useidel.textContent=alasql.useid;if(firstsql){alasql.prompthistory.push(firstsql);prompti=alasql.prompthistory.length;try{var tm=Date.now();alasql.log(firstsql);alasql.write('

'+(Date.now()-tm)+" ms

")}catch(err){alasql.write("

"+olduseid+"> "+sql+"

");alasql.write('

'+err+"

")}}var y=el.getBoundingClientRect().top+document.getElementsByTagName("body")[0].scrollTop;scrollTo(document.getElementsByTagName("body")[0],y,500);el.onkeydown=function(event){if(event.which==13){var sql=el.value;var olduseid=alasql.useid;el.value="";alasql.prompthistory.push(sql);prompti=alasql.prompthistory.length;try{var tm=Date.now();alasql.log(sql);alasql.write('

'+(Date.now()-tm)+" ms

")}catch(err){alasql.write("

"+olduseid+"> "+alasql.pretty(sql,false)+"

");alasql.write('

'+err+"

")}el.focus();useidel.textContent=alasql.useid;var y=el.getBoundingClientRect().top+document.getElementsByTagName("body")[0].scrollTop;scrollTo(document.getElementsByTagName("body")[0],y,500)}else if(event.which==38){prompti--;if(prompti<0)prompti=0;if(alasql.prompthistory[prompti]){el.value=alasql.prompthistory[prompti];event.preventDefault()}}else if(event.which==40){prompti++;if(prompti>=alasql.prompthistory.length){prompti=alasql.prompthistory.length;el.value=""}else if(alasql.prompthistory[prompti]){el.value=alasql.prompthistory[prompti];event.preventDefault()}}}};yy.BeginTransaction=function(params){return yy.extend(this,params)};yy.BeginTransaction.prototype.toString=function(){return K("BEGIN")+" "+K("TRANSACTION")};yy.BeginTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[alasql.useid].engineid].begin(databaseid,cb)}else{}if(cb)cb(res);return res};yy.CommitTransaction=function(params){return yy.extend(this,params)};yy.CommitTransaction.prototype.toString=function(){return K("COMMIT")+" "+K("TRANSACTION")};yy.CommitTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[alasql.useid].engineid].commit(databaseid,cb)}else{}if(cb)cb(res);return res};yy.RollbackTransaction=function(params){return yy.extend(this,params)};yy.RollbackTransaction.prototype.toString=function(){return K("ROLLBACK")+" "+K("TRANSACTION")};yy.RollbackTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[databaseid].engineid].rollback(databaseid,cb)}else{}if(cb)cb(res);return res};if(alasql.options.tsql){alasql.stdfn.OBJECT_ID=function(name,type){if(typeof type=="undefined")type="T";type=type.toUpperCase();var sname=name.split(".");var dbid=alasql.useid;var objname=sname[0];if(sname.length==2){dbid=sname[0];objname=sname[1]}var tables=alasql.databases[dbid].tables;dbid=alasql.databases[dbid].databaseid;for(var tableid in tables){if(tableid==objname){if(tables[tableid].view&&type=="V")return dbid+"."+tableid;if(!tables[tableid].view&&type=="T")return dbid+"."+tableid;return undefined}}return undefined}}if(alasql.options.mysql){}if(alasql.options.mysql||alasql.options.sqlite){alasql.from.INFORMATION_SCHEMA=function(filename,opts,cb,idx,query){if(filename=="VIEWS"||filename=="TABLES"){var res=[];for(var databaseid in alasql.databases){var tables=alasql.databases[databaseid].tables;for(var tableid in tables){if(tables[tableid].view&&filename=="VIEWS"||!tables[tableid].view&&filename=="TABLES"){res.push({TABLE_CATALOG:databaseid,TABLE_NAME:tableid})}}}if(cb)res=cb(res,idx,query);return res}throw new Error("Unknown INFORMATION_SCHEMA table")}}if(alasql.options.postgres){}if(alasql.options.oracle){}if(alasql.options.sqlite){}alasql.into.SQL=function(filename,opts,data,columns,cb){var res;if(typeof filename=="object"){opts=filename;filename=undefined}var opt={};alasql.utils.extend(opt,opts);if(typeof opt.tableid=="undefined"){throw new Error("Table for INSERT TO is not defined.")}var s="";if(columns.length==0){if(typeof data[0]=="object"){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}else{}}for(var i=0,ilen=data.length;i0){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid} -})}if(typeof filename=="object"){opts=filename;filename=undefined}var res=data.length;var s="";if(data.length>0){var key=columns[0].columnid;s+=data.map(function(d){return d[key]}).join("\n")}res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res};alasql.into.TAB=alasql.into.TSV=function(filename,opts,data,columns,cb){var opt={};alasql.utils.extend(opt,opts);opt.separator=" ";return alasql.into.CSV(filename,opt,data,columns,cb)};alasql.into.CSV=function(filename,opts,data,columns,cb){if(columns.length==0&&data.length>0){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}if(typeof filename=="object"){opts=filename;filename=undefined}var opt={};opt.separator=",";opt.quote='"';alasql.utils.extend(opt,opts);var res=data.length;var s="";if(opt.headers){s+=columns.map(function(col){return col.columnid}).join(opt.separator)+"\n"}data.forEach(function(d,idx){s+=columns.map(function(col){var s=d[col.columnid];s=(s+"").replace(new RegExp("\\"+opt.quote,"g"),'""');if((s+"").indexOf(opt.separator)>-1||(s+"").indexOf(opt.quote)>-1)s=opt.quote+s+opt.quote;return s}).join(opt.separator)+"\n"});res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res};alasql.into.XLS=function(filename,opts,data,columns,cb){if(typeof filename=="object"){opts=filename;filename=undefined}var sheets={};if(opts&&opts.sheets){sheets=opts.sheets}var sheet={};if(typeof sheets["Sheet1"]!="undefined"){sheet=sheets[0]}else{if(typeof opts!="undefined"){sheet=opts}}if(typeof sheet.sheetid=="undefined"){sheet.sheetid="Sheet1"}var s=toHTML();var res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res;function toHTML(){var s=' ";s+="";s+="";if(typeof sheet.caption!="undefined"){var caption=sheet.caption;if(typeof caption=="string"){caption={title:caption}}s+=""}if(typeof sheet.columns!="undefined"){columns=sheet.columns}else{if(columns.length==0&&data.length>0){if(typeof data[0]=="object"){if(data[0]instanceof Array){columns=data[0].map(function(d,columnidx){return{columnid:columnidx}})}else{columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}}}}columns.forEach(function(column,columnidx){if(typeof sheet.column!="undefined"){extend(column,sheet.column)}if(typeof column.width=="undefined"){if(sheet.column&&sheet.column.width!="undefined"){column.width=sheet.column.width}else{column.width="120px"}}if(typeof column.width=="number")column.width=column.width+"px";if(typeof column.columnid=="undefined")column.columnid=columnidx;if(typeof column.title=="undefined")column.title=""+column.columnid;if(sheet.headers&&sheet.headers instanceof Array)column.title=sheet.headers[idx]});s+="";columns.forEach(function(column){s+=''});s+="";if(sheet.headers){s+="";s+="";columns.forEach(function(column,columnidx){s+="";s+=""}s+="";if(data&&data.length>0){data.forEach(function(row,rowidx){if(rowidx>sheet.limit)return;s+=""});s+=""})}s+="";s+="
"});s+="
";s+="";s+="";return s}function style(a){var s=' style="';if(a&&typeof a.style!="undefined"){s+=a.style+";"}s+='" ';return s}};alasql.into.XLSXML=function(filename,opts,data,columns,cb){if(typeof filename=="object"){opts=filename;filename=undefined}var sheets={};if(opts&&opts.sheets){sheets=opts.sheets}else{sheets.Sheet1=opts}var res=alasql.utils.saveFile(filename,toXML());if(cb)res=cb(res);return res;function toXML(){var s1=' 0 ';var s2="";var s3=" ";var styles={};var stylesn=62;function hstyle(st){var s="";for(var key in st){s+="<"+key;for(var attr in st[key]){s+=" ";if(attr.substr(0,2)=="x:"){s+=attr}else{s+="ss:"}s+=attr+'="'+st[key][attr]+'"'}s+="/>"}var hh=hash(s);if(styles[hh]){}else{styles[hh]={styleid:stylesn};s2+='";stylesn++}return"s"+styles[hh].styleid}for(var sheetid in sheets){var sheet=sheets[sheetid];if(typeof sheet.columns!="undefined"){columns=sheet.columns}else{if(columns.length==0&&data.length>0){if(typeof data[0]=="object"){if(data[0]instanceof Array){columns=data[0].map(function(d,columnidx){return{columnid:columnidx}})}else{columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}}}}columns.forEach(function(column,columnidx){if(typeof sheet.column!="undefined"){extend(column,sheet.column)}if(typeof column.width=="undefined"){if(sheet.column&&typeof sheet.column.width!="undefined"){column.width=sheet.column.width}else{column.width=120}}if(typeof column.width=="number")column.width=column.width;if(typeof column.columnid=="undefined")column.columnid=columnidx;if(typeof column.title=="undefined")column.title=""+column.columnid;if(sheet.headers&&sheet.headers instanceof Array)column.title=sheet.headers[idx]});s3+=' ';columns.forEach(function(column,columnidx){s3+=''});if(sheet.headers){s3+='';columns.forEach(function(column,columnidx){s3+="';if(typeof column.title!="undefined"){if(typeof column.title=="function"){s3+=column.title(sheet,column,columnidx)}else{s3+=column.title}}s3+=""});s3+=""}if(data&&data.length>0){data.forEach(function(row,rowidx){if(rowidx>sheet.limit)return;var srow={};extend(srow,sheet.row);if(sheet.rows&&sheet.rows[rowidx]){extend(srow,sheet.rows[rowidx])}s3+="";columns.forEach(function(column,columnidx){var cell={};extend(cell,sheet.cell);extend(cell,srow.cell);if(typeof sheet.column!="undefined"){extend(cell,sheet.column.cell)}extend(cell,column.cell);if(sheet.cells&&sheet.cells[rowidx]&&sheet.cells[rowidx][columnidx]){extend(cell,sheet.cells[rowidx][columnidx])}var value=row[column.columnid];if(typeof cell.value=="function"){value=cell.value(value,sheet,row,column,cell,rowidx,columnidx)}var typeid=cell.typeid;if(typeof typeid=="function"){typeid=typeid(value,sheet,row,column,cell,rowidx,columnidx)}if(typeof typeid=="undefined"){if(typeof value=="number")typeid="number";else if(typeof value=="string")typeid="string";else if(typeof value=="boolean")typeid="boolean";else if(typeof value=="object"){if(value instanceof Date)typeid="date"}}var Type="String";if(typeid=="number")Type="Number";else if(typeid=="date")Type="Date";var typestyle="";if(typeid=="money"){typestyle='mso-number-format:"\\#\\,\\#\\#0\\\\ _р_\\.";white-space:normal;'}else if(typeid=="number"){typestyle=" "}else if(typeid=="date"){typestyle='mso-number-format:"Short Date";'}else{if(opts.types&&opts.types[typeid]&&opts.types[typeid].typestyle){typestyle=opts.types[typeid].typestyle}}typestyle=typestyle||'mso-number-format:"\\@";';s3+="";s3+='';var format=cell.format;if(typeof value=="undefined"){s3+=""}else if(typeof format!="undefined"){if(typeof format=="function"){s3+=format(value)}else if(typeof format=="string"){s3+=value}else{throw new Error("Unknown format type. Should be function or string")}}else{if(typeid=="number"||typeid=="date"){s3+=value.toString()}else if(typeid=="money"){s3+=(+value).toFixed(2)}else{s3+=value}}s3+=""});s3+=""})}s3+="
"}s3+="
";return s1+s2+s3}};alasql.into.XLSX=function(filename,opts,data,columns,cb){var res=1;if(deepEqual(columns,[{columnid:"_"}])){data=data.map(function(dat){return dat._});columns=undefined}else{}if(typeof exports=="object"){var XLSX=require("xlsx")}else{var XLSX=window.XLSX}if(typeof filename=="object"){opts=filename;filename=undefined}var wb={SheetNames:[],Sheets:{}};if(opts.sourcefilename){alasql.utils.loadBinaryFile(opts.sourcefilename,!!cb,function(data){wb=XLSX.read(data,{type:"binary"});doExport()})}else{doExport()}if(cb)res=cb(res);return res;function doExport(){if(typeof opts=="object"&&opts instanceof Array){if(data&&data.length>0){data.forEach(function(dat,idx){prepareSheet(opts[idx],dat,undefined,idx+1)})}}else{prepareSheet(opts,data,columns,{},1)}saveWorkbook(cb)}function prepareSheet(opts,data,columns,idx){var opt={sheetid:"Sheet"+idx,headers:true};alasql.utils.extend(opt,opts);if((!columns||columns.length==0)&&data.length>0){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}var cells={};if(wb.SheetNames.indexOf(opt.sheetid)>-1){cells=wb.Sheets[opt.sheetid]}else{wb.SheetNames.push(opt.sheetid);wb.Sheets[opt.sheetid]={};cells=wb.Sheets[opt.sheetid]}var range="A1";if(opt.range)range=opt.range;var col0=alasql.utils.xlscn(range.match(/[A-Z]+/)[0]);var row0=+range.match(/[0-9]+/)[0]-1;if(wb.Sheets[opt.sheetid]["!ref"]){var rangem=wb.Sheets[opt.sheetid]["!ref"];var colm=alasql.utils.xlscn(rangem.match(/[A-Z]+/)[0]);var rowm=+rangem.match(/[0-9]+/)[0]-1}else{var colm=1,rowm=1}var colmax=Math.max(col0+columns.length,colm);var rowmax=Math.max(row0+data.length+2,rowm);var i=row0+1;wb.Sheets[opt.sheetid]["!ref"]="A1:"+alasql.utils.xlsnc(colmax)+rowmax;if(opt.headers){columns.forEach(function(col,idx){cells[alasql.utils.xlsnc(col0+idx)+""+i]={v:col.columnid}});i++}for(var j=0;j>>8^CRC_TABLE[offset]}return crc^-1}function pack(items){var data=arguments,idx=0,buffer,bufferSize=0;items=items.split("");items.forEach(function(type){if(type=="v"){bufferSize+=2}else if(type=="V"||type=="l"){bufferSize+=4}});buffer=new Buffer(bufferSize);items.forEach(function(type,index){if(type=="v"){buffer.writeUInt16LE(data[index+1],idx);idx+=2}else if(type=="V"){buffer.writeUInt32LE(data[index+1],idx);idx+=4}else if(type=="l"){buffer.writeInt32LE(data[index+1],idx);idx+=4}});return buffer}function normalizeZipPath(zipPath){return zipPath.replace(/\\/g,"/").replace(/^\/|\/$/g,"")}this.addEntry=function(entry){entry.path=normalizeZipPath(entry.path);entries.push(entry)};this.addDir=function(zipPath,localPath){this.addEntry({path:zipPath,file:localPath,isFile:false})};this.addData=function(zipPath,data){if(!Buffer.isBuffer(data)){data=new Buffer(data)}this.addEntry({path:zipPath,data:data})};function buildZipBuffer(){var buffers=[];var length=0;function append(buf){if(typeof buf=="string"){buf=new Buffer(buf)}buffers.push(buf);length+=buf.length}entries.forEach(function(entry){var mtime,mdate;entry.extra=entry.extra||"";entry.comment=entry.comment||"";entry.cmethod=0;mtime=entry.mtime;mdate=entry.mdate;if(entry.mtime instanceof Date){mtime=entry.mtime.getHours();mtime=mtime<<6;mtime=mtime|entry.mtime.getMinutes();mtime=mtime<<5;mtime=mtime|entry.mtime.getSeconds()/2;mdate=entry.mtime.getFullYear()-1980;mdate=mdate<<4;mdate=mdate|entry.mtime.getMonth()+1;mdate=mdate<<5;mdate=mdate|entry.mtime.getDate()}var fileName=entry.path;if(!entry.isFile&&fileName.charAt(fileName.length-1)!="/"){entry.path=fileName=fileName+"/"}entry.offset=length;append(pack("VvvvvvlVVvv",67324752,20,2,entry.cmethod,mtime,mdate,entry.crc32,entry.csize,entry.size,fileName.length,entry.extra.length));append(fileName);append(entry.extra);append(entry.data);entry.mtime=mtime;entry.mdate=mdate;entry.eattr=entry.isFile?32:48});var startOffset=length;var centralDirSize=0;entries.forEach(function(entry){append(pack("VvvvvvvlVVvvvvvVV",33639248,20,20,2,entry.cmethod,entry.mtime,entry.mdate,entry.crc32,entry.csize,entry.size,entry.path.length,entry.extra.length,entry.comment.length,0,0,entry.eattr,entry.offset));append(entry.path);append(entry.extra);append(entry.comment);centralDirSize+=46+entry.path.length+entry.extra.length+entry.comment.length});var comment="";append(pack("VvvvvVVv",101010256,0,0,entries.length,entries.length,centralDirSize,startOffset,comment.length));append(comment);var buffer=Buffer.concat(buffers);return buffer}this.toBuffer=function(callback){var index=-1;function deflateNext(){var data;var entry=entries[++index];if(entry){entry.csize=entry.size=entry.crc32=0;data=entry.data=entry.data?entry.data:new Buffer(0);entry.mtime=new Date;if(entry.isFile!==false){entry.crc32=calculateCrc32(data);entry.isFile=true;entry.size=data.length;entry.csize=entry.size;deflateNext()}else{deflateNext()}}else{callback(buildZipBuffer())}}deflateNext()}};alasql.from.METEOR=function(filename,opts,cb,idx,query){var res=filename.find(opts).fetch();if(cb)res=cb(res,idx,query);return res};alasql.from.TABLETOP=function(key,opts,cb,idx,query){var res=[];var opt={headers:true,simpleSheet:true,key:key};alasql.utils.extend(opt,opts);opt.callback=function(data){res=data;if(cb)res=cb(res,idx,query)};Tabletop.init(opt);return res};alasql.from.HTML=function(selector,opts,cb,idx,query){var opt={};alasql.utils.extend(opt,opts);var sel=document.querySelector(selector);if(!sel&&sel.tagName!="TABLE"){throw new Error("Selected HTML element is not a TABLE")}var res=[];var headers=opt.headers;if(headers&&!(headers instanceof Array)){headers=[];var ths=sel.querySelector("thead tr").children;for(var i=0;i=N)return EOF;if(eol)return eol=false,EOL;var j=I;if(text.charCodeAt(j)===quoteCode){var i=j;while(i++/g,"");return document();function document(){return{declaration:declaration(),root:tag()}}function declaration(){var m=match(/^<\?xml\s*/);if(!m)return;var node={attributes:{}};while(!(eos()||is("?>"))){var attr=attribute();if(!attr)return node;node.attributes[attr.name]=attr.value}match(/\?>\s*/);return node}function tag(){var m=match(/^<([\w-:.]+)\s*/);if(!m)return;var node={name:m[1],attributes:{},children:[]};while(!(eos()||is(">")||is("?>")||is("/>"))){var attr=attribute();if(!attr)return node;node.attributes[attr.name]=attr.value}if(match(/^\s*\/>\s*/)){return node}match(/\??>\s*/);node.content=content();var child;while(child=tag()){node.children.push(child)}match(/^<\/[\w-:.]+>\s*/);return node}function content(){var m=match(/^([^<]*)/);if(m)return m[1];return""}function attribute(){var m=match(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(!m)return;return{name:m[1],value:strip(m[2])}}function strip(val){return val.replace(/^['"]|['"]$/g,"")}function match(re){var m=xml.match(re);if(!m)return;xml=xml.slice(m[0].length);return m}function eos(){return 0==xml.length}function is(prefix){return 0==xml.indexOf(prefix)}}alasql.from.GEXF=function(filename,opts,cb,idx,query){var res;alasql("SEARCH FROM XML("+filename+")",[],function(data){res=data;console.log(res);if(cb)res=cb(res)});return res};yy.Help=function(params){return yy.extend(this,params)};yy.Help.prototype.toString=function(){var s=K("HELP");if(this.subject)s+=" "+L(this.subject);return s};helpdocs=[{command:"ALTER TABLE table RENAME TO table"},{command:"ALTER TABLE table ADD COLUMN column coldef"},{command:"ALTER TABLE table MODIFY COLUMN column coldef"},{command:"ALTER TABLE table RENAME COLUMN column TO column"},{command:"ALTER TABLE table DROP column"},{command:"ATTACH engine DATABASE database"},{command:"ASSERT value"},{command:"BEGIN [TRANSACTION]"},{command:"COMMIT [TRANSACTION]"},{command:"CREATE [engine] DATABASE [IF NOT EXISTS] database"},{command:"CREATE TABLE [IF NOT EXISTS] table (column definitions)"},{command:"DELETE FROM table [WHERE expression]"},{command:"DETACH DATABASE database"},{command:"DROP [engine] DATABASE [IF EXISTS] database"},{command:"DROP TABLE [IF EXISTS] table"},{command:"INSERT INTO table VALUES value,..."},{command:"INSERT INTO table DEFAULT VALUES"},{command:"INSERT INTO table SELECT select"},{command:"HELP [subject]"},{command:"ROLLBACK [TRANSACTION]"},{command:"SELECT [modificator] columns [INTO table] [FROM table,...] [[mode] JOIN [ON] [USING]] [WHERE ] [GROUP BY] [HAVING] [ORDER BY] "},{command:"SET option value"},{command:"SHOW [engine] DATABASES"},{command:"SHOW TABLES"},{command:"SHOW CREATE TABLE table"},{command:"UPDATE table SET column1 = expression1, ... [WHERE expression]"},{command:"USE [DATABASE] database"},{command:"expression"},{command:'See also http://github/agershun/alasq for more information'}];yy.Help.prototype.execute=function(databaseid,params,cb){var ss=[];if(!this.subject){ss=helpdocs}else{ss.push('See also http://github/agershun/alasq for more information')}if(cb)ss=cb(ss);return ss};yy.Print=function(params){return yy.extend(this,params)};yy.Print.prototype.toString=function(){var s=K("PRINT");if(this.statement)s+=" "+this.statement.toString();return s};yy.Print.prototype.execute=function(databaseid,params,cb){var self=this;var res=1;alasql.precompile(this,databaseid,params);if(this.exprs&&this.exprs.length>0){var rs=this.exprs.map(function(expr){var exprfn=new Function("params,alasql,p","var y;return "+expr.toJavaScript("({})","",null)).bind(self);var r=exprfn(params,alasql);return JSONtoString(r)});console.log.apply(console,rs)}else if(this.select){var r=this.select.execute(databaseid,params);console.log(JSONtoString(r))}else{console.log()}if(cb)res=cb(res);return res};yy.Source=function(params){return yy.extend(this,params)};yy.Source.prototype.toString=function(){var s=K("SOURCE");if(this.url)s+=" "+S("'"+this.url+"'");return s};yy.Source.prototype.execute=function(databaseid,params,cb){var res;loadFile(this.url,!!cb,function(data){res=alasql(data);if(cb)res=cb(res);return res},function(err){throw err});return res};yy.Require=function(params){return yy.extend(this,params)};yy.Require.prototype.toString=function(){var s=K("REQUIRE");if(this.paths&&this.paths.length>0){s+=this.paths.map(function(path){return path.toString()}).join(",")}if(this.plugins&&this.plugins.length>0){s+=this.plugins.map(function(plugin){return plugin.toUpperCase()}).join(",")}return s};yy.Require.prototype.execute=function(databaseid,params,cb){var self=this;var res=0;var ss="";if(this.paths&&this.paths.length>0){this.paths.forEach(function(path){loadFile(path.value,!!cb,function(data){res++;ss+=data;if(res0){this.plugins.forEach(function(plugin){if(!alasql.plugins[plugin]){loadFile(alasql.path+"/alasql-"+plugin.toLowerCase()+".js",!!cb,function(data){res++;ss+=data;if(res0){res=res.filter(function(d){return d.databaseid.match(relike)})}}if(cb)cb(res);return res};LS.createTable=function(databaseid,tableid,ifnotexists,cb){var lsdbid=alasql.databases[databaseid].lsdbid;var tb=LS.get(lsdbid+"."+tableid);var res=1;if(tb&&!ifnotexists){throw new Error('Table "'+tableid+'" alsready exists in localStorage database "'+lsdbid+'"')}var lsdb=LS.get(lsdbid);var table=alasql.databases[databaseid].tables[tableid];lsdb.tables[tableid]={columns:table.columns};LS.set(lsdbid,lsdb);LS.set(lsdbid+"."+tableid,[]);if(cb)cb(res);return res};LS.dropTable=function(databaseid,tableid,ifexists,cb){var res=1;var lsdbid=alasql.databases[databaseid].lsdbid;if(alasql.options.autocommit){var lsdb=LS.get(lsdbid)}else{var lsdb=alasql.databases[databaseid]}if(!ifexists&&!lsdb.tables[tableid]){throw new Error('Cannot drop table "'+tableid+'" in localStorage, because it does not exist')}delete lsdb.tables[tableid];LS.set(lsdbid,lsdb);localStorage.removeItem(lsdbid+"."+tableid);if(cb)cb(res);return res};LS.fromTable=function(databaseid,tableid,cb,idx,query){var lsdbid=alasql.databases[databaseid].lsdbid;var res=LS.get(lsdbid+"."+tableid);if(cb)res=cb(res,idx,query);return res};LS.intoTable=function(databaseid,tableid,value,columns,cb){var lsdbid=alasql.databases[databaseid].lsdbid;var res=value.length;var tb=LS.get(lsdbid+"."+tableid);if(!tb)tb=[];tb=tb.concat(value);LS.set(lsdbid+"."+tableid,tb);if(cb)cb(res);return res};LS.loadTableData=function(databaseid,tableid){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;db.tables[tableid].data=LS.get(lsdbid+"."+tableid)};LS.saveTableData=function(databaseid,tableid){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;LS.set(lsdbid+"."+tableid,db.tables[tableid].data);db.tables[tableid].data=null};LS.commit=function(databaseid,cb){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;var lsdb={databaseid:lsdbid,tables:{}};if(db.tables){for(var tbid in db.tables){lsdb.tables[tbid]={columns:db.tables[tbid].columns};LS.set(lsdbid+"."+tbid,db.tables[tbid].data)}}LS.set(lsdbid,lsdb);return 1};LS.begin=LS.commit;LS.rollback=function(databaseid,cb){var db=alasql.databases[databaseid];db.dbversion++;var lsdbid=alasql.databases[databaseid].lsdbid;var lsdb=LS.get(lsdbid);if(lsdb.tables){for(var tbid in lsdb.tables){var tb=new alasql.Table({columns:db.tables[tbid].columns});extend(tb,lsdb.tables[tbid]);lsdb.tables[tbid]=tb;if(!alasql.options.autocommit){lsdb.tables[tbid].data=LS.get(db.lsdbid+"."+tbid)}lsdb.tables[tbid].indexColumns()}}delete alasql.databases[databaseid];alasql.databases[databaseid]=new alasql.Database(databaseid);extend(alasql.databases[databaseid],lsdb);alasql.databases[databaseid].databaseid=databaseid;alasql.databases[databaseid].engineid="LOCALSTORAGE"};var SQLITE=alasql.engines.SQLITE=function(){};SQLITE.createDatabase=function(wdbid,args,ifnotexists,dbid,cb){throw new Error("Connot create SQLITE database in memory. Attach it.")};SQLITE.dropDatabase=function(databaseid){throw new Error("This is impossible to drop SQLite database. Detach it.")};SQLITE.attachDatabase=function(sqldbid,dbid,args,params,cb){var res=1;if(alasql.databases[dbid]){throw new Error('Unable to attach database as "'+dbid+'" because it already exists')}if(args[0]&&args[0]instanceof yy.StringValue||args[0]instanceof yy.ParamValue){if(args[0]instanceof yy.StringValue){var value=args[0].value}else if(args[0]instanceof yy.ParamValue){var value=params[args[0].param]}alasql.utils.loadBinaryFile(value,true,function(data){var db=new alasql.Database(dbid||sqldbid);db.engineid="SQLITE";db.sqldbid=sqldbid;var sqldb=db.sqldb=new SQL.Database(data);db.tables=[];var tables=sqldb.exec("SELECT * FROM sqlite_master WHERE type='table'")[0].values;tables.forEach(function(tbl){db.tables[tbl[1]]={};var columns=db.tables[tbl[1]].columns=[];var ast=alasql.parse(tbl[4]);var coldefs=ast.statements[0].columns;if(coldefs&&coldefs.length>0){coldefs.forEach(function(cd){columns.push(cd)})}});cb(1)},function(err){throw new Error('Cannot open SQLite database file "'+args[0].value+'"')});return res}else{throw new Error("Cannot attach SQLite database without a file")}return res};SQLITE.fromTable=function(databaseid,tableid,cb,idx,query){var data=alasql.databases[databaseid].sqldb.exec("SELECT * FROM "+tableid);var columns=query.sources[idx].columns=[];if(data[0].columns.length>0){data[0].columns.forEach(function(columnid){columns.push({columnid:columnid})})}var res=[];if(data[0].values.length>0){data[0].values.forEach(function(d){var r={};columns.forEach(function(col,idx){r[col.columnid]=d[idx]});res.push(r)})}if(cb)cb(res,idx,query)};SQLITE.intoTable=function(databaseid,tableid,value,columns,cb){var sqldb=alasql.databases[databaseid].sqldb;for(var i=0,ilen=value.length;i1){var sql="REQUIRE "+paths.map(function(p){return'"'+p+'"'}).join(",");alasql(sql,[],cb)}}else if(path===false){delete alasql.webworker;return}}} \ No newline at end of file +return v}else{acc.arr.push(v);var p=acc.arr.sort();return p[p.length/2|0]}};alasql.aggr.VAR=function(v,s,acc){if(typeof acc.arr=="undefined"){acc.arr=[v];acc.sum=v}else{acc.arr.push(v);acc.sum+=v}var N=acc.arr.length;var avg=acc.sum/N;var std=0;for(var i=0;i0){this.whens.forEach(function(w){if(w.when.findAggregator)w.when.findAggregator(query);if(w.then.findAggregator)w.then.findAggregator(query)})}if(this.elses&&this.elses.findAggregator)this.elses.findAggregator(query)};yy.CaseValue.prototype.toJavaScript=function(context,tableid,defcols){var s="((function("+context+",params,alasql){var r;";if(this.expression){s+="v="+this.expression.toJavaScript(context,tableid,defcols)+";";s+=(this.whens||[]).map(function(w){return" if(v=="+w.when.toJavaScript(context,tableid,defcols)+") {r="+w.then.toJavaScript(context,tableid,defcols)+"}"}).join(" else ");if(this.elses)s+=" else {r="+this.elses.toJavaScript(context,tableid,defcols)+"}"}else{s+=(this.whens||[]).map(function(w){return" if("+w.when.toJavaScript(context,tableid,defcols)+") {r="+w.then.toJavaScript(context,tableid,defcols)+"}"}).join(" else ");if(this.elses)s+=" else {r="+this.elses.toJavaScript(context,tableid,defcols)+"}"}s+=";return r;}).bind(this))("+context+",params,alasql)";return s};yy.Json=function(params){return yy.extend(this,params)};yy.Json.prototype.toString=function(){var s="";s+=JSONtoString(this.value);s+="";return s};var JSONtoString=alasql.utils.JSONtoString=function(obj){var s="";if(typeof obj=="string")s='"'+obj+'"';else if(typeof obj=="number")s=obj;else if(typeof obj=="boolean")s=obj;else if(typeof obj=="object"){if(obj instanceof Array){s+="["+obj.map(function(b){return JSONtoString(b)}).join(",")+"]"}else if(!obj.toJavaScript||obj instanceof yy.Json){s="{";var ss=[];for(var k in obj){var s1="";if(typeof k=="string")s1+='"'+k+'"';else if(typeof k=="number")s1+=k;else if(typeof k=="boolean")s1+=k;else{throw new Error("THis is not ES6... no expressions on left side yet")}s1+=":"+JSONtoString(obj[k]);ss.push(s1)}s+=ss.join(",")+"}"}else if(obj.toString){s=obj.toString()}else{throw new Error("1Can not show JSON object "+JSON.stringify(obj))}}else{throw new Error("2Can not show JSON object "+JSON.stringify(obj))}return s};function JSONtoJavaScript(obj,context,tableid,defcols){var s="";if(typeof obj=="string")s='"'+obj+'"';else if(typeof obj=="number")s="("+obj+")";else if(typeof obj=="boolean")s=obj;else if(typeof obj=="object"){if(obj instanceof Array){s+="["+obj.map(function(b){return JSONtoJavaScript(b,context,tableid,defcols)}).join(",")+"]"}else if(!obj.toJavaScript||obj instanceof yy.Json){s="{";var ss=[];for(var k in obj){var s1="";if(typeof k=="string")s1+='"'+k+'"';else if(typeof k=="number")s1+=k;else if(typeof k=="boolean")s1+=k;else{throw new Error("THis is not ES6... no expressions on left side yet")}s1+=":"+JSONtoJavaScript(obj[k],context,tableid,defcols);ss.push(s1)}s+=ss.join(",")+"}"}else if(obj.toJavaScript){s=obj.toJavaScript(context,tableid,defcols)}else{throw new Error("1Can not parse JSON object "+JSON.stringify(obj))}}else{throw new Error("2Can not parse JSON object "+JSON.stringify(obj))}return s}yy.Json.prototype.toJavaScript=function(context,tableid,defcols){return JSONtoJavaScript(this.value,context,tableid,defcols)};yy.Convert=function(params){return yy.extend(this,params)};yy.Convert.prototype.toString=function(){var s="CONVERT(";s+=this.dbtypeid;if(typeof this.dbsize!="undefined"){s+="("+this.dbsize;if(this.dbprecision)s+=","+dbprecision;s+=")"}s+=","+this.expression.toString();if(this.style)s+=","+this.style;s+=")";return s};yy.Convert.prototype.toJavaScript=function(context,tableid,defcols){return"alasql.stdfn.CONVERT("+this.expression.toJavaScript(context,tableid,defcols)+',{dbtypeid:"'+this.dbtypeid+'",dbsize:'+this.dbsize+",style:"+this.style+"})";throw new Error("There is not such type conversion for "+this.toString())};alasql.stdfn.CONVERT=function(value,args){var val=value;if(args.style){var t;if(/\d{8}/.test(val))t=new Date(+val.substr(0,4),+val.substr(4,2)-1,+val.substr(6,2));else t=new Date(val);if(args.style==1){val=("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)+"/"+("0"+t.getYear()).substr(-2)}else if(args.style==2){val=("0"+t.getYear()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getDate()).substr(-2)}else if(args.style==3){val=("0"+t.getDate()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getYear()).substr(-2)}else if(args.style==4){val=("0"+t.getDate()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getYear()).substr(-2)}else if(args.style==5){val=("0"+t.getDate()).substr(-2)+"-"+("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getYear()).substr(-2)}else if(args.style==6){val=("0"+t.getDate()).substr(-2)+" "+t.toString().substr(4,3).toLowerCase()+" "+("0"+t.getYear()).substr(-2)}else if(args.style==7){val=t.toString().substr(4,3)+" "+("0"+t.getDate()).substr(-2)+","+("0"+t.getYear()).substr(-2)}else if(args.style==8){val=("0"+t.getHours()).substr(-2)+":"+("0"+(t.getMinutes()+1)).substr(-2)+":"+("0"+t.getSeconds()).substr(-2)}else if(args.style==10){val=("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getDate()).substr(-2)+"-"+("0"+t.getYear()).substr(-2)}else if(args.style==11){val=("0"+t.getYear()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)}else if(args.style==12){val=("0"+t.getYear()).substr(-2)+("0"+(t.getMonth()+1)).substr(-2)+("0"+t.getDate()).substr(-2)}else if(args.style==101){val=("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)+"/"+t.getFullYear()}else if(args.style==102){val=t.getFullYear()+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+("0"+t.getDate()).substr(-2)}else if(args.style==103){val=("0"+t.getDate()).substr(-2)+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+t.getFullYear()}else if(args.style==104){val=("0"+t.getDate()).substr(-2)+"."+("0"+(t.getMonth()+1)).substr(-2)+"."+t.getFullYear()}else if(args.style==105){val=("0"+t.getDate()).substr(-2)+"-"+("0"+(t.getMonth()+1)).substr(-2)+"-"+t.getFullYear()}else if(args.style==106){val=("0"+t.getDate()).substr(-2)+" "+t.toString().substr(4,3).toLowerCase()+" "+t.getFullYear()}else if(args.style==107){val=t.toString().substr(4,3)+" "+("0"+t.getDate()).substr(-2)+","+t.getFullYear()}else if(args.style==108){val=("0"+t.getHours()).substr(-2)+":"+("0"+(t.getMinutes()+1)).substr(-2)+":"+("0"+t.getSeconds()).substr(-2)}else if(args.style==110){val=("0"+(t.getMonth()+1)).substr(-2)+"-"+("0"+t.getDate()).substr(-2)+"-"+t.getFullYear()}else if(args.style==111){val=t.getFullYear()+"/"+("0"+(t.getMonth()+1)).substr(-2)+"/"+("0"+t.getDate()).substr(-2)}else if(args.style==112){val=t.getFullYear()+("0"+(t.getMonth()+1)).substr(-2)+("0"+t.getDate()).substr(-2)}else{throw new Error("The CONVERT style "+args.style+" is not realized yet.")}}var udbtypeid=args.dbtypeid.toUpperCase();if(args.dbtypeid=="Date"){return new Date(val)}else if(udbtypeid=="DATE"){var d=new Date(val);var s=d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2);return s}else if(udbtypeid=="DATETIME"){var d=new Date(val);var s=d.getFullYear()+"."+("0"+(d.getMonth()+1)).substr(-2)+"."+("0"+d.getDate()).substr(-2);s+=" "+("0"+d.getHours()).substr(-2)+":"+("0"+d.getMinutes()).substr(-2)+":"+("0"+d.getSeconds()).substr(-2);s+="."+("00"+d.getMilliseconds()).substr(-3);return s}else if(["NUMBER","FLOAT"].indexOf(udbtypeid)>-1){return+val}else if(["MONEY"].indexOf(udbtypeid)>-1){var m=+val;return(m|0)+m*100%100/100}else if(["BOOLEAN"].indexOf(udbtypeid)>-1){return!!val}else if(["INT","INTEGER","SMALLINT","BIGINT","SERIAL","SMALLSERIAL","BIGSERIAL"].indexOf(args.dbtypeid.toUpperCase())>-1){return val|0}else if(["STRING","VARCHAR","NVARCHAR","CHARACTER VARIABLE"].indexOf(args.dbtypeid.toUpperCase())>-1){if(args.dbsize)return(""+val).substr(0,args.dbsize);else return""+val}else if(["CHAR","CHARACTER","NCHAR"].indexOf(udbtypeid)>-1){return(val+new Array(args.dbsize+1).join(" ")).substr(0,args.dbsize)}else if(["DECIMAL","NUMERIC"].indexOf(udbtypeid)>-1){var m=+val;var fxd=Math.pow(10,args.dbpecision);return(m|0)+m*fxd%fxd/fxd}else if(["JSON"].indexOf(udbtypeid)>-1){if(typeof val=="object")return val;try{return JSON.parse(val)}catch(err){throw new Error("Cannot convert string to JSON")}}return val};yy.ColumnDef=function(params){return yy.extend(this,params)};yy.ColumnDef.prototype.toString=function(){var s=this.columnid;if(this.dbtypeid)s+=" "+this.dbtypeid;if(this.dbsize){s+="("+this.dbsize;if(this.dbprecision)s+=","+this.dbprecision;s+=")"}if(this.primarykey)s+=" PRIMARY KEY";if(this.notnull)s+=" NOT NULL";return s};yy.CreateTable=function(params){return yy.extend(this,params)};yy.CreateTable.prototype.toString=function(){var s=K("CREATE");if(this.temporary)s+=" "+K("TEMPORARY");if(this.view)s+=" "+K("VIEW");else s+=" "+(this.class?K("CLASS"):K("TABLE"));if(this.ifnotexists)s+=" "+K("IF")+" "+K("NOT")+" "+K("EXISTS");s+=" "+this.table.toString();if(this.viewcolumns){s+="("+this.viewcolumns.map(function(vcol){return vcol.toString()}).join(",")+")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);else{var ss=this.columns.map(function(col){return col.toString()});s+=" ("+NL()+ID()+ss.join(","+NL()+ID())+")"}if(this.view&&this.select){s+=" AS "+this.select.toString()}return s};yy.CreateTable.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[this.table.databaseid||databaseid];var tableid=this.table.tableid;if(!tableid){throw new Error("Table name is not defined")}var columns=this.columns;var constraints=this.constraints||[];if(this.ifnotexists&&db.tables[tableid])return 0;if(db.tables[tableid]){throw new Error("Can not create table '"+tableid+"', because it already exists in the database '"+db.databaseid+"'")}var table=db.tables[tableid]=new alasql.Table;if(this.class){table.isclass=true}table.identities={};table.checkfn=[];var ss=[];if(this.columns){this.columns.forEach(function(col){var dbtypeid=col.dbtypeid;if(!alasql.fn[dbtypeid])dbtypeid=dbtypeid.toUpperCase();if(["SERIAL","SMALLSERIAL","BIGSERIAL"].indexOf(dbtypeid)>-1)col.identity={value:1,step:1};var newcol={columnid:col.columnid,dbtypeid:dbtypeid,dbsize:col.dbsize,dbprecision:col.dbprecision,notnull:col.notnull,identity:col.identity};if(col.identity){table.identities[col.columnid]={value:+col.identity.value,step:+col.identity.step}}if(col.check){table.checkfn.push(new Function("r","var y;return "+col.check.expression.toJavaScript("r","")))}if(col.default){ss.push("'"+col.columnid+"':"+col.default.toJavaScript("r",""))}if(col.primarykey){var pk=table.pk={};pk.columns=[col.columnid];pk.onrightfns="r['"+col.columnid+"']";pk.onrightfn=new Function("r","var y;return "+pk.onrightfns);pk.hh=hash(pk.onrightfns);table.uniqs[pk.hh]={}}if(col.unique){var uk={};if(typeof table.uk=="undefined")table.uk=[];table.uk.push(uk);uk.columns=[col.columnid];uk.onrightfns="r['"+col.columnid+"']";uk.onrightfn=new Function("r","var y;return "+uk.onrightfns);uk.hh=hash(uk.onrightfns);table.uniqs[uk.hh]={}}if(col.foreignkey){var fk=col.foreignkey.table;var fktable=alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];if(typeof fk.columnid=="undefined"){if(fktable.pk.columns&&fktable.pk.columns.length>0){fk.columnid=fktable.pk.columns[0]}else{throw new Error("FOREIGN KEY allowed only to tables with PRIMARY KEYs")}}var fkfn=function(r){var rr={};if(typeof r[col.columnid]=="undefined")return true;rr[fk.columnid]=r[col.columnid];var addr=fktable.pk.onrightfn(rr);if(!fktable.uniqs[fktable.pk.hh][addr]){throw new Error('Foreign key "'+r[col.columnid]+'" is not found in table '+fktable.tableid)}return true};table.checkfn.push(fkfn)}table.columns.push(newcol);table.xcolumns[newcol.columnid]=newcol})}table.defaultfns=ss.join(",");constraints.forEach(function(con){if(con.type=="PRIMARY KEY"){if(table.pk){throw new Error("Primary key already exists")}var pk=table.pk={};pk.columns=con.columns;pk.onrightfns=pk.columns.map(function(columnid){return"r['"+columnid+"']"}).join("+'`'+");pk.onrightfn=new Function("r","var y;return "+pk.onrightfns);pk.hh=hash(pk.onrightfns);table.uniqs[pk.hh]={}}else if(con.type=="CHECK"){table.checkfn.push(new Function("r","var y;return "+con.expression.toJavaScript("r","")))}else if(con.type=="UNIQUE"){var uk={};if(!table.uk)table.uk=[];table.uk.push(uk);uk.columns=con.columns;uk.onrightfns=uk.columns.map(function(columnid){return"r['"+columnid+"']"}).join("+'`'+");uk.onrightfn=new Function("r","var y;return "+uk.onrightfns);uk.hh=hash(uk.onrightfns);table.uniqs[uk.hh]={}}else if(con.type=="FOREIGN KEY"){var col=table.xcolumns[con.columns[0]];var fk=con.fktable;if(con.fkcolumns&&con.fkcolumns.length>0)fk.columnid=con.fkcolumns[0];var fktable=alasql.databases[fk.databaseid||alasql.useid].tables[fk.tableid];if(typeof fk.columnid=="undefined"){fk.columnid=fktable.pk.columns[0]}var fkfn=function(r){var rr={};if(typeof r[col.columnid]=="undefined")return true;rr[fk.columnid]=r[col.columnid];var addr=fktable.pk.onrightfn(rr);if(!fktable.uniqs[fktable.pk.hh][addr]){throw new Error('Foreign key "'+r[col.columnid]+'" is not found in table '+fktable.tableid)}return true};table.checkfn.push(fkfn)}});if(this.view&&this.viewcolumns){var self=this;this.viewcolumns.forEach(function(vcol,idx){self.select.columns[idx].as=vcol.columnid})}if(db.engineid){return alasql.engines[db.engineid].createTable(this.table.databaseid||databaseid,tableid,this.ifnotexists,cb)}table.insert=function(r){var table=this;for(var columnid in table.identities){var ident=table.identities[columnid];r[columnid]=ident.value}if(table.checkfn&&table.checkfn.length>0){table.checkfn.forEach(function(checkfn){if(!checkfn(r)){throw new Error("Violation of CHECK constraint")}})}table.columns.forEach(function(column){if(column.notnull&&typeof r[column.columnid]=="undefined"){throw new Error("Wrong NULL value in NOT NULL column "+column.columnid)}});if(table.pk){var pk=table.pk;var addr=pk.onrightfn(r);if(typeof table.uniqs[pk.hh][addr]!="undefined"){throw new Error("Cannot insert record, because it already exists in primary key index")}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][ukaddr]!="undefined"){throw new Error("Cannot insert record, because it already exists in unique index")}})}table.data.push(r);for(var columnid in table.identities){var ident=table.identities[columnid];ident.value+=ident.step}if(table.pk){var pk=table.pk;var addr=pk.onrightfn(r);table.uniqs[pk.hh][addr]=r}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);table.uniqs[uk.hh][ukaddr]=r})}};table.delete=function(i,params,alasql){var table=this;var r=this.data[i];if(this.pk){var pk=this.pk;var addr=pk.onrightfn(r);if(typeof this.uniqs[pk.hh][addr]=="undefined"){throw new Error("Something wrong with primary key index on table")}else{this.uniqs[pk.hh][addr]=undefined}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){var ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][ukaddr]=="undefined"){throw new Error("Something wrong with unique index on table")}table.uniqs[uk.hh][ukaddr]=undefined})}};table.deleteall=function(){this.data.length=0;if(this.pk){this.uniqs[this.pk.hh]={}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){table.uniqs[uk.hh]={}})}};table.update=function(assignfn,i,params){var r=cloneDeep(this.data[i]);if(this.pk){var pk=this.pk;pk.pkaddr=pk.onrightfn(r,params);if(typeof this.uniqs[pk.hh][pk.pkaddr]=="undefined"){throw new Error("Something wrong with index on table")}else{}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){uk.ukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][uk.ukaddr]=="undefined"){throw new Error("Something wrong with unique index on table")}})}assignfn(r,params,alasql);if(table.checkfn&&table.checkfn.length>0){table.checkfn.forEach(function(checkfn){if(!checkfn(r)){throw new Error("Violation of CHECK constraint")}})}table.columns.forEach(function(column){if(column.notnull&&typeof r[column.columnid]=="undefined"){throw new Error("Wrong NULL value in NOT NULL column "+column.columnid)}});if(this.pk){pk.newpkaddr=pk.onrightfn(r);if(typeof this.uniqs[pk.hh][pk.newpkaddr]!="undefined"&&pk.newpkaddr!=pk.pkaddr){throw new Error("Record already exists")}else{}}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){uk.newukaddr=uk.onrightfn(r);if(typeof table.uniqs[uk.hh][uk.newukaddr]!="undefined"&&uk.newukaddr!=uk.ukaddr){throw new Error("Record already exists")}})}if(this.pk){this.uniqs[pk.hh][pk.pkaddr]=undefined;this.uniqs[pk.hh][pk.newpkaddr]=r}if(table.uk&&table.uk.length){table.uk.forEach(function(uk){table.uniqs[uk.hh][uk.ukaddr]=undefined;table.uniqs[uk.hh][uk.newukaddr]=r})}this.data[i]=r};if(this.view&&this.select){table.view=true;table.select=this.select.compile(this.table.databaseid||databaseid)}var res;if(!alasql.options.nocount)res=1;if(cb)res=cb(res);return res};alasql.fn.Date=Object;alasql.fn.Date=Date;alasql.fn.Number=Number;alasql.fn.String=String;alasql.fn.Boolean=Boolean;stdfn.EXTEND=alasql.utils.extend;stdfn.CHAR=String.fromCharCode.bind(String);stdfn.ASCII=function(a){return a.charCodeAt(0)};stdfn.COALESCE=function(){for(var i=0;i0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql",s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res;var db=alasql.databases[dbid];if(typeof sharp!="undefined"){var id=sharp}else{var id=db.counter++}var vertex={$id:id,$node:"VERTEX"};db.objects[vertex.$id]=vertex;res=vertex;if(namefn)namefn(vertex);if(setfn)setfn(vertex,params,alasql);if(cb)res=cb(res);return res};return statement};yy.CreateEdge=function(params){return yy.extend(this,params)};yy.CreateEdge.prototype.toString=function(){var s=K("CREATE")+" "+K("EDGE")+" ";if(this.class)s+=L(this.class)+" ";return s};yy.CreateEdge.prototype.toJavaScript=function(context,tableid,defcols){var s="this.queriesfn["+(this.queriesidx-1)+"](this.params,null,"+context+")";return s};yy.CreateEdge.prototype.compile=function(databaseid){var dbid=databaseid;var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());var tofn=new Function("params,alasql","var y;return "+this.to.toJavaScript());if(typeof this.name!="undefined"){var s="x.name="+this.name.toJavaScript();var namefn=new Function("x",s)}if(this.sets&&this.sets.length>0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql","var y;"+s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res=0;var db=alasql.databases[dbid];var edge={$id:db.counter++,$node:"EDGE"};var v1=fromfn(params,alasql);var v2=tofn(params,alasql);edge.$in=[v1.$id];edge.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(edge.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(edge.$id);db.objects[edge.$id]=edge;res=edge;if(namefn)namefn(edge);if(setfn)setfn(edge,params,alasql);if(cb)res=cb(res);return res};return statement};yy.CreateGraph=function(params){return yy.extend(this,params)};yy.CreateGraph.prototype.toString=function(){var s=K("CREATE")+" "+K("GRAPH")+" ";if(this.class)s+=L(this.class)+" ";return s};yy.CreateGraph.prototype.execute=function(databaseid,params,cb){var res=[];if(this.from){if(alasql.from[this.from.funcid]){this.graph=alasql.from[this.from.funcid.toUpperCase()](this.from.args[0].value);console.log(this.graph)}}this.graph.forEach(function(g){if(g.source){var e={};if(typeof g.as!="undefined")alasql.vars[g.as]=e;if(typeof g.prop!="undefined"){e.name=g.prop}if(typeof g.sharp!="undefined")e.$id=g.sharp;if(typeof g.name!="undefined")e.name=g.name;if(typeof g.class!="undefined")e.$class=g.class;var db=alasql.databases[databaseid];if(typeof e.$id=="undefined"){e.$id=db.counter++}e.$node="EDGE";if(typeof g.json!="undefined"){extend(e,new Function("params,alasql","var y;return "+g.json.toJavaScript())(params,alasql))}var v1;if(g.source.vars){var vo=alasql.vars[g.source.vars];if(typeof vo=="object")v1=vo;else v1=db.objects[vo]}else{var av1=g.source.sharp;if(typeof av1=="undefined")av1=g.source.prop;v1=alasql.databases[databaseid].objects[av1];if(typeof v1=="undefined"&&alasql.options.autovertex&&(typeof g.source.prop!="undefined"||typeof g.source.name!="undefined")){v1=findVertex(g.source.prop||g.source.name);if(typeof v1=="undefined"){v1=createVertex(g.source)}}}var v2;if(g.source.vars){var vo=alasql.vars[g.target.vars];if(typeof vo=="object")v2=vo;else v2=db.objects[vo]}else{var av2=g.target.sharp;if(typeof av2=="undefined")av2=g.target.prop;v2=alasql.databases[databaseid].objects[av2];if(typeof v2=="undefined"&&alasql.options.autovertex&&(typeof g.target.prop!="undefined"||typeof g.target.name!="undefined")){v2=findVertex(g.target.prop||g.target.name);if(typeof v2=="undefined"){v2=createVertex(g.target)}}}e.$in=[v1.$id];e.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(e.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(e.$id);db.objects[e.$id]=e;if(typeof e.$class!="undefined"){if(typeof alasql.databases[databaseid].tables[e.$class]=="undefined"){throw new Error("No such class. Pleace use CREATE CLASS")}else{alasql.databases[databaseid].tables[e.$class].data.push(e)}}res.push(e.$id)}else{createVertex(g)}});if(cb)res=cb(res);return res;function findVertex(name){var objects=alasql.databases[alasql.useid].objects;for(var k in objects){if(objects[k].name==name){return objects[k]}}return undefined}function createVertex(g){var v={};if(typeof g.as!="undefined")alasql.vars[g.as]=v;if(typeof g.prop!="undefined"){v.$id=g.prop;v.name=g.prop}if(typeof g.sharp!="undefined")v.$id=g.sharp;if(typeof g.name!="undefined")v.name=g.name;if(typeof g.class!="undefined")v.$class=g.class;var db=alasql.databases[databaseid];if(typeof v.$id=="undefined"){v.$id=db.counter++}v.$node="VERTEX";if(typeof g.json!="undefined"){extend(v,new Function("params,alasql","var y;return "+g.json.toJavaScript())(params,alasql))}db.objects[v.$id]=v;if(typeof v.$class!="undefined"){if(typeof alasql.databases[databaseid].tables[v.$class]=="undefined"){throw new Error("No such class. Pleace use CREATE CLASS")}else{alasql.databases[databaseid].tables[v.$class].data.push(v)}}res.push(v.$id);return v}};yy.CreateGraph.prototype.compile1=function(databaseid){var dbid=databaseid;var fromfn=new Function("params,alasql","var y;return "+this.from.toJavaScript());var tofn=new Function("params,alasql","var y;return "+this.to.toJavaScript());if(typeof this.name!="undefined"){var s="x.name="+this.name.toJavaScript();var namefn=new Function("x",s)}if(this.sets&&this.sets.length>0){var s=this.sets.map(function(st){return"x['"+st.column.columnid+"']="+st.expression.toJavaScript("x","")}).join(";");var setfn=new Function("x,params,alasql","var y;"+s)}else if(this.content){}else if(this.select){}else{}var statement=function(params,cb){var res=0;var db=alasql.databases[dbid];var edge={$id:db.counter++,$node:"EDGE"};var v1=fromfn(params,alasql);var v2=tofn(params,alasql);edge.$in=[v1.$id];edge.$out=[v2.$id];if(typeof v1.$out=="undefined")v1.$out=[];v1.$out.push(edge.$id);if(typeof v2.$in=="undefined")v2.$in=[];v2.$in.push(edge.$id);db.objects[edge.$id]=edge;res=edge;if(namefn)namefn(edge);if(setfn)setfn(edge,params,alasql);if(cb)res=cb(res);return res};return statement};yy.AlterTable=function(params){return yy.extend(this,params)};yy.AlterTable.prototype.toString=function(){var s="ALTER TABLE "+this.table.toString();if(this.renameto)s+=" RENAME TO "+this.renameto;return s};yy.AlterTable.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[databaseid];db.dbversion=Date.now();if(this.renameto){var oldtableid=this.table.tableid;var newtableid=this.renameto;var res=1;if(db.tables[newtableid]){throw new Error("Can not rename a table '"+oldtableid+"' to '"+newtableid+"', because the table with this name already exists")}else if(newtableid==oldtableid){throw new Error("Can not rename a table '"+oldtableid+"' to itself")}else{db.tables[newtableid]=db.tables[oldtableid];delete db.tables[oldtableid];res=1}if(cb)cb(res);return res}else if(this.addcolumn){var db=alasql.databases[this.table.databaseid||databaseid];db.dbversion++;var tableid=this.table.tableid;var table=db.tables[tableid];var columnid=this.addcolumn.columnid;if(table.xcolumns[columnid]){throw new Error('Cannot add column "'+columnid+'", because it already exists in the table "'+tableid+'"')}var col={columnid:columnid,dbtypeid:this.dbtypeid,dbsize:this.dbsize,dbprecision:this.dbprecision,dbenum:this.dbenum,defaultfns:null};var defaultfn=function(){};table.columns.push(col);table.xcolumns[columnid]=col;for(var i=0,ilen=table.data.length;i0){for(var i=0,ilen=table.data.length;i0){for(var i=0,ilen=table.data.length;i=0){q+="(x="+values[idx].toJavaScript()+",x==undefined?undefined:+x)"}else if(alasql.fn[table.xcolumns[col.columnid].dbtypeid]){q+="(new "+table.xcolumns[col.columnid].dbtypeid+"(";q+=values[idx].toJavaScript();q+="))"}else{q+=values[idx].toJavaScript()}}else{q+=values[idx].toJavaScript()}ss.push(q)})}else{if(values instanceof Array&&table.columns&&table.columns.length>0){table.columns.forEach(function(col,idx){var q="'"+col.columnid+"':";if(["INT","FLOAT","NUMBER","MONEY"].indexOf(col.dbtypeid)>=0){q+="+"+values[idx].toJavaScript()}else if(alasql.fn[col.dbtypeid]){q+="(new "+col.dbtypeid+"(";q+=values[idx].toJavaScript();q+="))"}else{q+=values[idx].toJavaScript()}ss.push(q)})}else{sw=JSONtoJavaScript(values)}}if(db.tables[tableid].defaultfns){ss.unshift(db.tables[tableid].defaultfns)}if(sw){s+="a="+sw+";"}else{s+="a={"+ss.join(",")+"};"}if(db.tables[tableid].isclass){s+="var db=alasql.databases['"+databaseid+"'];";s+='a.$class="'+tableid+'";';s+="a.$id=db.counter++;";s+="db.objects[a.$id]=a;"}if(db.tables[tableid].insert){s+="var db=alasql.databases['"+databaseid+"'];";s+="db.tables['"+tableid+"'].insert(a);"}else{s+="aa.push(a);"}});s33=s3+s;if(db.tables[tableid].insert){}else{s+="alasql.databases['"+databaseid+"'].tables['"+tableid+"'].data="+"alasql.databases['"+databaseid+"'].tables['"+tableid+"'].data.concat(aa);"}if(db.tables[tableid].insert){if(db.tables[tableid].isclass){s+="return a.$id;"}else{s+="return "+self.values.length}}else{s+="return "+self.values.length}var insertfn=new Function("db, params, alasql","var y;"+s3+s).bind(this)}else if(this.select){selectfn=this.select.compile(databaseid);if(db.engineid&&alasql.engines[db.engineid].intoTable){var statement=function(params,cb){var aa=selectfn(params);var res=alasql.engines[db.engineid].intoTable(db.databaseid,tableid,aa,null,cb);return res};return statement}else{var insertfn=function(db,params,alasql){var res=selectfn(params);if(db.tables[tableid].insert){for(var i=0,ilen=res.length;i0){s+="("+this.args.map(function(arg){return arg.toString()}).join(", ")+")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);return s};yy.CreateDatabase.prototype.execute=function(databaseid,params,cb){var args;if(this.args&&this.args.length>0){args=this.args.map(function(arg){return new Function("params,alasql","var y;return "+arg.toJavaScript())(params,alasql)})}if(this.engineid){var res=alasql.engines[this.engineid].createDatabase(this.databaseid,this.args,this.ifnotexists,this.as,cb);return res}else{var dbid=this.databaseid;if(alasql.databases[dbid]){throw new Error("Database '"+dbid+"' already exists")}var a=new alasql.Database(dbid);var res=1;if(cb)return cb(res);return res}};yy.AttachDatabase=function(params){return yy.extend(this,params)};yy.AttachDatabase.prototype.toString=function(){var s=K("ATTACH");if(this.engineid)s+=" "+L(this.engineid);s+=" "+K("DATABASE")+" "+L(this.databaseid);if(args){s+="(";if(args.length>0){s+=args.map(function(arg){return arg.toString()}).join(", ")}s+=")"}if(this.as)s+=" "+K("AS")+" "+L(this.as);return s};yy.AttachDatabase.prototype.execute=function(databaseid,params,cb){if(!alasql.engines[this.engineid]){throw new Error('Engine "'+this.engineid+'" is not defined.')}var res=alasql.engines[this.engineid].attachDatabase(this.databaseid,this.as,this.args,params,cb);return res};yy.DetachDatabase=function(params){return yy.extend(this,params)};yy.DetachDatabase.prototype.toString=function(){var s=K("DETACH");s+=" "+K("DATABASE")+" "+L(this.databaseid);return s};yy.DetachDatabase.prototype.execute=function(databaseid,params,cb){if(!alasql.databases[this.databaseid].engineid){throw new Error('Cannot detach database "'+this.engineid+'", because it was not attached.')}var res;var dbid=this.databaseid;if(dbid==alasql.DEFAULTDATABASEID){throw new Error("Drop of default database is prohibited")}if(!alasql.databases[dbid]){if(!this.ifexists){throw new Error("Database '"+dbid+"' does not exist")}else{res=0}}else{delete alasql.databases[dbid];if(dbid==alasql.useid){alasql.use()}res=1}if(cb)cb(res);return res};yy.UseDatabase=function(params){return yy.extend(this,params)};yy.UseDatabase.prototype.toString=function(){return K("USE")+" "+K("DATABASE")+" "+L(this.databaseid)};yy.UseDatabase.prototype.execute=function(databaseid,params,cb){var dbid=this.databaseid;if(!alasql.databases[dbid]){throw new Error("Database '"+dbid+"' does not exist")}alasql.use(dbid);var res=1;if(cb)cb(res);return res};yy.DropDatabase=function(params){return yy.extend(this,params)};yy.DropDatabase.prototype.toString=function(){var s=K("DROP");if(this.ifexists)s+=" "+K("IF")+" "+K("EXISTS");s+=" "+K("DATABASE")+" "+L(this.databaseid);return s};yy.DropDatabase.prototype.execute=function(databaseid,params,cb){if(this.engineid){return alasql.engines[this.engineid].dropDatabase(this.databaseid,this.ifexists,cb)}var res;var dbid=this.databaseid;if(dbid==alasql.DEFAULTDATABASEID){throw new Error("Drop of default database is prohibited")}if(!alasql.databases[dbid]){if(!this.ifexists){throw new Error("Database '"+dbid+"' does not exist")}else{res=0}}else{if(alasql.databases[dbid].engineid){throw new Error("Cannot drop database '"+dbid+"', because it is attached. Detach it.")}delete alasql.databases[dbid];if(dbid==alasql.useid){alasql.use()}res=1}if(cb)cb(res);return res};yy.Declare=function(params){return yy.extend(this,params)};yy.Declare.prototype.toString=function(){var s=K("DECLARE")+" ";if(this.declares&&this.declares.length>0){s=this.declares.map(function(declare){var s="";s+="@"+L(declare.variable)+" ";s+=declare.dbtypeid;if(this.dbsize)s+="("+N(this.dbsize);if(this.dbprecision)s+=","+N(this.dbprecision);s+=")";if(declare.expression)s+=" = "+declare.expression.toString();return s}).join(",")}return s};yy.Declare.prototype.execute=function(databaseid,params,cb){var res=1;if(this.declares&&this.declares.length>0){this.declares.map(function(declare){var dbtypeid=declare.dbtypeid;if(!alasql.fn[dbtypeid])dbtypeid=dbtypeid.toUpperCase();alasql.declares[declare.variable]={dbtypeid:dbtypeid,dbsize:declare.dbsize,dbprecision:declare.dbprecision};if(declare.expression){alasql.vars[declare.variable]=new Function("params,alasql","return "+declare.expression.toJavaScript("({})","",null))(params,alasql);if(alasql.declares[declare.variable]){alasql.vars[declare.variable]=alasql.stdfn.CONVERT(alasql.vars[declare.variable],alasql.declares[declare.variable])}}})}if(cb)res=cb(res);return res};yy.ShowDatabases=function(params){return yy.extend(this,params)};yy.ShowDatabases.prototype.toString=function(){var s=K("SHOW")+" "+K("DATABASES");if(this.like)s+="LIKE "+this.like.toString();return s};yy.ShowDatabases.prototype.execute=function(databaseid,params,cb){if(this.engineid){return alasql.engines[this.engineid].showDatabases(this.like,cb)}else{var self=this;var res=[];for(dbid in alasql.databases){res.push({databaseid:dbid})}if(self.like&&res&&res.length>0){res=res.filter(function(d){return d.databaseid.match(new RegExp(self.like.value.replace(/\%/g,".*"),"g"))})}if(cb)cb(res);return res}};yy.ShowTables=function(params){return yy.extend(this,params)};yy.ShowTables.prototype.toString=function(){var s=K("SHOW")+" "+K("TABLES");if(this.databaseid)s+=" FROM "+this.databaseid;if(this.like)s+=" "+K("LIKE")+" "+this.like.toString();return s};yy.ShowTables.prototype.execute=function(databaseid,params,cb){var db=alasql.databases[this.databaseid||databaseid];var self=this;var res=[];for(tableid in db.tables){res.push({tableid:tableid})}if(self.like&&res&&res.length>0){res=res.filter(function(d){return d.tableid.match(new RegExp(self.like.value.replace(/\%/g,".*"),"g"))})}if(cb)cb(res);return res};yy.ShowColumns=function(params){return yy.extend(this,params)};yy.ShowColumns.prototype.toString=function(){var s=K("SHOW")+" "+K("COLUMNS");if(this.table.tableid)s+=" "+K("FROM")+" "+this.table.tableid;if(this.databaseid)s+=" "+K("FROM")+" "+this.databaseid;return s};yy.ShowColumns.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;if(table&&table.columns){var res=table.columns.map(function(col){return{columnid:col.columnid,dbtypeid:col.dbtypeid,dbsize:col.dbsize}});return res}else{return[]}};yy.ShowIndex=function(params){return yy.extend(this,params)};yy.ShowIndex.prototype.toString=function(){var s=K("SHOW")+" "+K("INDEX");if(this.table.tableid)s+=" "+K("FROM")+" "+this.table.tableid;if(this.databaseid)s+=" "+K("FROM")+" "+this.databaseid;return s};yy.ShowIndex.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;var res=[];if(table&&table.indices){for(var ind in table.indices){res.push({hh:ind,len:Object.keys(table.indices[ind]).length})}}return res};yy.ShowCreateTable=function(params){return yy.extend(this,params)};yy.ShowCreateTable.prototype.toString=function(){var s=K("SHOW")+" "+K("CREATE")+" "+K("TABLE")+" "+L(this.table.tableid);if(this.databaseid)s+=" "+K("FROM")+" "+L(this.databaseid);return s};yy.ShowCreateTable.prototype.execute=function(databaseid){var db=alasql.databases[this.databaseid||databaseid];var table=db.tables[this.table.tableid];var self=this;if(table){var s=K("CREATE")+" "+K("TABLE")+" "+L(this.table.tableid)+" (";var ss=[];if(table.columns){table.columns.forEach(function(col){var a=L(col.columnid)+" "+K(col.dbtypeid);if(col.dbsize)a+="("+N(col.dbsize)+")";if(col.primarykey)a+=" "+K("PRIMARY")+" "+K("KEY");ss.push(a)});s+=ss.join(", ")}s+=")";return s}else{throw new Error('There is no such table "'+this.table.tableid+'"')}};yy.SetVariable=function(params){return yy.extend(this,params)};yy.SetVariable.prototype.toString=function(){var s=K("SET")+" ";if(typeof this.value!="undefined")s+=K(this.variable.toUpperCase())+" "+(this.value?"ON":"OFF");if(this.expression)s+=this.method+L(this.variable)+" = "+this.expression.toString();return s};yy.SetVariable.prototype.execute=function(databaseid,params,cb){if(typeof this.value!="undefined"){var val=this.value;if(val=="ON")val=true;else if(val=="OFF")val=false;alasql.options[this.variable]=val}else if(this.expression){if(this.exists){this.existsfn=this.exists.map(function(ex){var nq=ex.compile(databaseid);if(nq.query&&!nq.query.modifier)nq.query.modifier="RECORDSET";return nq})}if(this.queries){this.queriesfn=this.queries.map(function(q){var nq=q.compile(databaseid);if(nq.query&&!nq.query.modifier)nq.query.modifier="RECORDSET";return nq})}var res=new Function("params,alasql","return "+this.expression.toJavaScript("({})","",null)).bind(this)(params,alasql);if(alasql.declares[this.variable]){res=alasql.stdfn.CONVERT(res,alasql.declares[this.variable])}if(this.props&&this.props.length>0){if(this.method=="@"){var fs="alasql.vars['"+this.variable+"']"}else{var fs="params['"+this.variable+"']"}fs+=this.props.map(function(prop){if(typeof prop=="string"){return"['"+prop+"']"}else if(typeof prop=="number"){return"["+prop+"]"}else{return"["+prop.toJavaScript()+"]"}}).join();new Function("value,params,alasql","var y;"+fs+"=value")(res,params,alasql)}else{if(this.method=="@"){alasql.vars[this.variable]=res}else{params[this.variable]=res}}}var res=1;if(cb)res=cb(res);return res};alasql.test=function(name,times,fn){if(arguments.length==0){alasql.log(alasql.con.results);return}else if(arguments.length==1){var tm=Date.now();fn();alasql.con.log(Date.now()-tm);return}if(arguments.length==2){fn=times;times=1}var tm=Date.now();for(var i=0;i",sql);if(res instanceof Array){if(console.table){console.table(res)}else{console.log(JSONtoString(res))}}else{console.log(JSONtoString(res))}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}var s="";if(typeof sql=="string"&&alasql.options.logprompt){s+="

"+alasql.pretty(sql)+"
"}if(res instanceof Array){if(res.length==0){s+="

[ ]

"}else if(typeof res[0]!="object"||res[0]instanceof Array){for(var i=0,ilen=res.length;i"+loghtml(res[i])+"

"}}else{s+=loghtml(res)}}else{s+=loghtml(res)}el.innerHTML+=s}};alasql.clear=function(){var target=alasql.options.logtarget;if(typeof exports=="object"){target="console"}if(target=="console"||typeof exports=="object"){if(console.clear){console.clear()}else{}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}el.innerHTML=""}};alasql.write=function(s){var target=alasql.options.logtarget;if(typeof exports=="object"){target="console"}if(target=="console"||typeof exports=="object"){if(console.log){console.log(s)}else{}}else{var el;if(target=="output"){el=document.getElementsByTagName("output")[0]}else{if(typeof target=="string"){el=document.getElementById(target)}else{el=target}}el.innerHTML+=s}};function loghtml(res){var s="";if(typeof res=="undefined"){s+="undefined"}else if(res instanceof Array){s+="";s+="";var cols=[];for(colid in res[0]){cols.push(colid)}s+="
#";cols.forEach(function(colid){s+=""+colid});for(var i=0,ilen=res.length;i"+(i+1);cols.forEach(function(colid){s+=" ";if(+res[i][colid]==+res[i][colid]){s+='
';if(typeof res[i][colid]=="undefined")s+="NULL";else s+=res[i][colid];s+="
"}else{if(typeof res[i][colid]=="undefined"){s+="NULL"}else if(typeof res[i][colid]=="string"){s+=res[i][colid]}else s+=JSONtoString(res[i][colid])}})}s+="
"}else{s+="

"+JSONtoString(res)+"

"}return s}function scrollTo(element,to,duration){if(duration<=0)return;var difference=to-element.scrollTop;var perTick=difference/duration*10;setTimeout(function(){if(element.scrollTop==to)return;element.scrollTop=element.scrollTop+perTick;scrollTo(element,to,duration-10)},10)}alasql.prompt=function(el,useidel,firstsql){if(typeof exports=="object"){throw new Error("The functionality of prompt is not realized for Node.js")}var prompti=0;if(typeof el=="string")el=document.getElementById(el);if(typeof useidel=="string")useidel=document.getElementById(useidel);useidel.textContent=alasql.useid;if(firstsql){alasql.prompthistory.push(firstsql);prompti=alasql.prompthistory.length;try{var tm=Date.now();alasql.log(firstsql);alasql.write('

'+(Date.now()-tm)+" ms

")}catch(err){alasql.write("

"+olduseid+"> "+sql+"

");alasql.write('

'+err+"

")}}var y=el.getBoundingClientRect().top+document.getElementsByTagName("body")[0].scrollTop;scrollTo(document.getElementsByTagName("body")[0],y,500);el.onkeydown=function(event){if(event.which==13){var sql=el.value;var olduseid=alasql.useid;el.value="";alasql.prompthistory.push(sql);prompti=alasql.prompthistory.length;try{var tm=Date.now();alasql.log(sql);alasql.write('

'+(Date.now()-tm)+" ms

")}catch(err){alasql.write("

"+olduseid+"> "+alasql.pretty(sql,false)+"

");alasql.write('

'+err+"

")}el.focus();useidel.textContent=alasql.useid;var y=el.getBoundingClientRect().top+document.getElementsByTagName("body")[0].scrollTop;scrollTo(document.getElementsByTagName("body")[0],y,500)}else if(event.which==38){prompti--;if(prompti<0)prompti=0;if(alasql.prompthistory[prompti]){el.value=alasql.prompthistory[prompti];event.preventDefault()}}else if(event.which==40){prompti++;if(prompti>=alasql.prompthistory.length){prompti=alasql.prompthistory.length;el.value=""}else if(alasql.prompthistory[prompti]){el.value=alasql.prompthistory[prompti];event.preventDefault()}}}};yy.BeginTransaction=function(params){return yy.extend(this,params)};yy.BeginTransaction.prototype.toString=function(){return K("BEGIN")+" "+K("TRANSACTION")};yy.BeginTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[alasql.useid].engineid].begin(databaseid,cb)}else{}if(cb)cb(res);return res};yy.CommitTransaction=function(params){return yy.extend(this,params)};yy.CommitTransaction.prototype.toString=function(){return K("COMMIT")+" "+K("TRANSACTION")};yy.CommitTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[alasql.useid].engineid].commit(databaseid,cb)}else{}if(cb)cb(res);return res};yy.RollbackTransaction=function(params){return yy.extend(this,params)};yy.RollbackTransaction.prototype.toString=function(){return K("ROLLBACK")+" "+K("TRANSACTION")};yy.RollbackTransaction.prototype.execute=function(databaseid,params,cb){var res=1;if(alasql.databases[databaseid].engineid){return alasql.engines[alasql.databases[databaseid].engineid].rollback(databaseid,cb)}else{}if(cb)cb(res);return res};if(alasql.options.tsql){alasql.stdfn.OBJECT_ID=function(name,type){if(typeof type=="undefined")type="T";type=type.toUpperCase();var sname=name.split(".");var dbid=alasql.useid;var objname=sname[0];if(sname.length==2){dbid=sname[0];objname=sname[1]}var tables=alasql.databases[dbid].tables;dbid=alasql.databases[dbid].databaseid;for(var tableid in tables){if(tableid==objname){if(tables[tableid].view&&type=="V")return dbid+"."+tableid;if(!tables[tableid].view&&type=="T")return dbid+"."+tableid;return undefined}}return undefined}}if(alasql.options.mysql){}if(alasql.options.mysql||alasql.options.sqlite){alasql.from.INFORMATION_SCHEMA=function(filename,opts,cb,idx,query){if(filename=="VIEWS"||filename=="TABLES"){var res=[];for(var databaseid in alasql.databases){var tables=alasql.databases[databaseid].tables;for(var tableid in tables){if(tables[tableid].view&&filename=="VIEWS"||!tables[tableid].view&&filename=="TABLES"){res.push({TABLE_CATALOG:databaseid,TABLE_NAME:tableid})}}}if(cb)res=cb(res,idx,query);return res}throw new Error("Unknown INFORMATION_SCHEMA table")}}if(alasql.options.postgres){}if(alasql.options.oracle){}if(alasql.options.sqlite){}alasql.into.SQL=function(filename,opts,data,columns,cb){var res;if(typeof filename=="object"){opts=filename;filename=undefined}var opt={};alasql.utils.extend(opt,opts);if(typeof opt.tableid=="undefined"){throw new Error("Table for INSERT TO is not defined.")}var s="";if(columns.length==0){if(typeof data[0]=="object"){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}else{}}for(var i=0,ilen=data.length;i0){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}if(typeof filename=="object"){opts=filename;filename=undefined}var res=data.length;var s="";if(data.length>0){var key=columns[0].columnid;s+=data.map(function(d){return d[key]}).join("\n")}res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res};alasql.into.TAB=alasql.into.TSV=function(filename,opts,data,columns,cb){var opt={};alasql.utils.extend(opt,opts);opt.separator=" ";return alasql.into.CSV(filename,opt,data,columns,cb)};alasql.into.CSV=function(filename,opts,data,columns,cb){if(columns.length==0&&data.length>0){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}if(typeof filename=="object"){opts=filename;filename=undefined}var opt={};opt.separator=",";opt.quote='"';alasql.utils.extend(opt,opts);var res=data.length;var s="";if(opt.headers){s+=columns.map(function(col){return col.columnid}).join(opt.separator)+"\n"}data.forEach(function(d,idx){s+=columns.map(function(col){var s=d[col.columnid];s=(s+"").replace(new RegExp("\\"+opt.quote,"g"),'""');if((s+"").indexOf(opt.separator)>-1||(s+"").indexOf(opt.quote)>-1)s=opt.quote+s+opt.quote;return s}).join(opt.separator)+"\n"});res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res};alasql.into.XLS=function(filename,opts,data,columns,cb){if(typeof filename=="object"){opts=filename;filename=undefined}var sheets={};if(opts&&opts.sheets){sheets=opts.sheets}var sheet={};if(typeof sheets["Sheet1"]!="undefined"){sheet=sheets[0]}else{if(typeof opts!="undefined"){sheet=opts}}if(typeof sheet.sheetid=="undefined"){sheet.sheetid="Sheet1"}var s=toHTML();var res=alasql.utils.saveFile(filename,s);if(cb)res=cb(res);return res;function toHTML(){var s=' ";s+="";s+="";if(typeof sheet.caption!="undefined"){var caption=sheet.caption;if(typeof caption=="string"){caption={title:caption}}s+=""}if(typeof sheet.columns!="undefined"){columns=sheet.columns}else{if(columns.length==0&&data.length>0){if(typeof data[0]=="object"){if(data[0]instanceof Array){columns=data[0].map(function(d,columnidx){return{columnid:columnidx}})}else{columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}}}}columns.forEach(function(column,columnidx){if(typeof sheet.column!="undefined"){extend(column,sheet.column)}if(typeof column.width=="undefined"){if(sheet.column&&sheet.column.width!="undefined"){column.width=sheet.column.width}else{column.width="120px"}}if(typeof column.width=="number")column.width=column.width+"px";if(typeof column.columnid=="undefined")column.columnid=columnidx;if(typeof column.title=="undefined")column.title=""+column.columnid;if(sheet.headers&&sheet.headers instanceof Array)column.title=sheet.headers[idx]});s+="";columns.forEach(function(column){s+=''});s+="";if(sheet.headers){s+="";s+="";columns.forEach(function(column,columnidx){s+="";s+=""}s+="";if(data&&data.length>0){data.forEach(function(row,rowidx){if(rowidx>sheet.limit)return;s+=""});s+=""})}s+="";s+="
"});s+="
";s+="";s+="";return s}function style(a){var s=' style="';if(a&&typeof a.style!="undefined"){s+=a.style+";"}s+='" ';return s}};alasql.into.XLSXML=function(filename,opts,data,columns,cb){if(typeof filename=="object"){opts=filename;filename=undefined}var sheets={};if(opts&&opts.sheets){sheets=opts.sheets}else{sheets.Sheet1=opts}var res=alasql.utils.saveFile(filename,toXML());if(cb)res=cb(res);return res;function toXML(){var s1=' 0 ';var s2="";var s3=" ";var styles={};var stylesn=62;function hstyle(st){var s="";for(var key in st){s+="<"+key;for(var attr in st[key]){s+=" ";if(attr.substr(0,2)=="x:"){s+=attr}else{s+="ss:"}s+=attr+'="'+st[key][attr]+'"'}s+="/>"}var hh=hash(s);if(styles[hh]){}else{styles[hh]={styleid:stylesn};s2+='";stylesn++}return"s"+styles[hh].styleid}for(var sheetid in sheets){var sheet=sheets[sheetid];if(typeof sheet.columns!="undefined"){columns=sheet.columns}else{if(columns.length==0&&data.length>0){if(typeof data[0]=="object"){if(data[0]instanceof Array){columns=data[0].map(function(d,columnidx){return{columnid:columnidx}})}else{columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}}}}columns.forEach(function(column,columnidx){if(typeof sheet.column!="undefined"){extend(column,sheet.column)}if(typeof column.width=="undefined"){if(sheet.column&&typeof sheet.column.width!="undefined"){column.width=sheet.column.width}else{column.width=120}}if(typeof column.width=="number")column.width=column.width;if(typeof column.columnid=="undefined")column.columnid=columnidx;if(typeof column.title=="undefined")column.title=""+column.columnid;if(sheet.headers&&sheet.headers instanceof Array)column.title=sheet.headers[idx]});s3+=' ';columns.forEach(function(column,columnidx){s3+=''});if(sheet.headers){s3+='';columns.forEach(function(column,columnidx){s3+="';if(typeof column.title!="undefined"){if(typeof column.title=="function"){s3+=column.title(sheet,column,columnidx)}else{s3+=column.title}}s3+=""});s3+=""}if(data&&data.length>0){data.forEach(function(row,rowidx){if(rowidx>sheet.limit)return;var srow={};extend(srow,sheet.row);if(sheet.rows&&sheet.rows[rowidx]){extend(srow,sheet.rows[rowidx])}s3+="";columns.forEach(function(column,columnidx){var cell={};extend(cell,sheet.cell);extend(cell,srow.cell);if(typeof sheet.column!="undefined"){extend(cell,sheet.column.cell)}extend(cell,column.cell);if(sheet.cells&&sheet.cells[rowidx]&&sheet.cells[rowidx][columnidx]){extend(cell,sheet.cells[rowidx][columnidx])}var value=row[column.columnid];if(typeof cell.value=="function"){value=cell.value(value,sheet,row,column,cell,rowidx,columnidx)}var typeid=cell.typeid;if(typeof typeid=="function"){typeid=typeid(value,sheet,row,column,cell,rowidx,columnidx)}if(typeof typeid=="undefined"){if(typeof value=="number")typeid="number";else if(typeof value=="string")typeid="string";else if(typeof value=="boolean")typeid="boolean";else if(typeof value=="object"){if(value instanceof Date)typeid="date"}}var Type="String";if(typeid=="number")Type="Number";else if(typeid=="date")Type="Date";var typestyle="";if(typeid=="money"){typestyle='mso-number-format:"\\#\\,\\#\\#0\\\\ _р_\\.";white-space:normal;'}else if(typeid=="number"){typestyle=" "}else if(typeid=="date"){typestyle='mso-number-format:"Short Date";'}else{if(opts.types&&opts.types[typeid]&&opts.types[typeid].typestyle){typestyle=opts.types[typeid].typestyle}}typestyle=typestyle||'mso-number-format:"\\@";';s3+="";s3+='';var format=cell.format;if(typeof value=="undefined"){s3+=""}else if(typeof format!="undefined"){if(typeof format=="function"){s3+=format(value)}else if(typeof format=="string"){s3+=value}else{throw new Error("Unknown format type. Should be function or string")}}else{if(typeid=="number"||typeid=="date"){s3+=value.toString()}else if(typeid=="money"){s3+=(+value).toFixed(2)}else{s3+=value}}s3+=""});s3+=""})}s3+="
"}s3+="
";return s1+s2+s3}};alasql.into.XLSX=function(filename,opts,data,columns,cb){var res=1;if(deepEqual(columns,[{columnid:"_"}])){data=data.map(function(dat){return dat._});columns=undefined}else{}if(typeof exports=="object"){var XLSX=require("xlsx")}else{var XLSX=window.XLSX}if(typeof filename=="object"){opts=filename;filename=undefined}var wb={SheetNames:[],Sheets:{}};if(opts.sourcefilename){alasql.utils.loadBinaryFile(opts.sourcefilename,!!cb,function(data){wb=XLSX.read(data,{type:"binary"});doExport()})}else{doExport()}if(cb)res=cb(res);return res;function doExport(){if(typeof opts=="object"&&opts instanceof Array){if(data&&data.length>0){data.forEach(function(dat,idx){prepareSheet(opts[idx],dat,undefined,idx+1)})}}else{prepareSheet(opts,data,columns,{},1)}saveWorkbook(cb)}function prepareSheet(opts,data,columns,idx){var opt={sheetid:"Sheet"+idx,headers:true};alasql.utils.extend(opt,opts);if((!columns||columns.length==0)&&data.length>0){columns=Object.keys(data[0]).map(function(columnid){return{columnid:columnid}})}var cells={};if(wb.SheetNames.indexOf(opt.sheetid)>-1){cells=wb.Sheets[opt.sheetid]}else{wb.SheetNames.push(opt.sheetid);wb.Sheets[opt.sheetid]={};cells=wb.Sheets[opt.sheetid]}var range="A1";if(opt.range)range=opt.range;var col0=alasql.utils.xlscn(range.match(/[A-Z]+/)[0]);var row0=+range.match(/[0-9]+/)[0]-1;if(wb.Sheets[opt.sheetid]["!ref"]){var rangem=wb.Sheets[opt.sheetid]["!ref"];var colm=alasql.utils.xlscn(rangem.match(/[A-Z]+/)[0]);var rowm=+rangem.match(/[0-9]+/)[0]-1}else{var colm=1,rowm=1}var colmax=Math.max(col0+columns.length,colm);var rowmax=Math.max(row0+data.length+2,rowm);var i=row0+1;wb.Sheets[opt.sheetid]["!ref"]="A1:"+alasql.utils.xlsnc(colmax)+rowmax;if(opt.headers){columns.forEach(function(col,idx){cells[alasql.utils.xlsnc(col0+idx)+""+i]={v:col.columnid}});i++}for(var j=0;j>>8^CRC_TABLE[offset]}return crc^-1}function pack(items){var data=arguments,idx=0,buffer,bufferSize=0;items=items.split("");items.forEach(function(type){if(type=="v"){bufferSize+=2}else if(type=="V"||type=="l"){bufferSize+=4}});buffer=new Buffer(bufferSize);items.forEach(function(type,index){if(type=="v"){buffer.writeUInt16LE(data[index+1],idx);idx+=2}else if(type=="V"){buffer.writeUInt32LE(data[index+1],idx);idx+=4}else if(type=="l"){buffer.writeInt32LE(data[index+1],idx);idx+=4}});return buffer}function normalizeZipPath(zipPath){return zipPath.replace(/\\/g,"/").replace(/^\/|\/$/g,"")}this.addEntry=function(entry){entry.path=normalizeZipPath(entry.path);entries.push(entry)};this.addDir=function(zipPath,localPath){this.addEntry({path:zipPath,file:localPath,isFile:false})};this.addData=function(zipPath,data){if(!Buffer.isBuffer(data)){data=new Buffer(data)}this.addEntry({path:zipPath,data:data})};function buildZipBuffer(){var buffers=[];var length=0;function append(buf){if(typeof buf=="string"){buf=new Buffer(buf)}buffers.push(buf);length+=buf.length}entries.forEach(function(entry){var mtime,mdate;entry.extra=entry.extra||"";entry.comment=entry.comment||"";entry.cmethod=0;mtime=entry.mtime;mdate=entry.mdate;if(entry.mtime instanceof Date){mtime=entry.mtime.getHours();mtime=mtime<<6;mtime=mtime|entry.mtime.getMinutes();mtime=mtime<<5;mtime=mtime|entry.mtime.getSeconds()/2;mdate=entry.mtime.getFullYear()-1980;mdate=mdate<<4;mdate=mdate|entry.mtime.getMonth()+1;mdate=mdate<<5;mdate=mdate|entry.mtime.getDate()}var fileName=entry.path;if(!entry.isFile&&fileName.charAt(fileName.length-1)!="/"){entry.path=fileName=fileName+"/"}entry.offset=length;append(pack("VvvvvvlVVvv",67324752,20,2,entry.cmethod,mtime,mdate,entry.crc32,entry.csize,entry.size,fileName.length,entry.extra.length));append(fileName);append(entry.extra);append(entry.data);entry.mtime=mtime;entry.mdate=mdate;entry.eattr=entry.isFile?32:48});var startOffset=length;var centralDirSize=0;entries.forEach(function(entry){append(pack("VvvvvvvlVVvvvvvVV",33639248,20,20,2,entry.cmethod,entry.mtime,entry.mdate,entry.crc32,entry.csize,entry.size,entry.path.length,entry.extra.length,entry.comment.length,0,0,entry.eattr,entry.offset));append(entry.path);append(entry.extra);append(entry.comment);centralDirSize+=46+entry.path.length+entry.extra.length+entry.comment.length});var comment="";append(pack("VvvvvVVv",101010256,0,0,entries.length,entries.length,centralDirSize,startOffset,comment.length));append(comment);var buffer=Buffer.concat(buffers);return buffer}this.toBuffer=function(callback){var index=-1;function deflateNext(){var data;var entry=entries[++index];if(entry){entry.csize=entry.size=entry.crc32=0;data=entry.data=entry.data?entry.data:new Buffer(0);entry.mtime=new Date;if(entry.isFile!==false){entry.crc32=calculateCrc32(data);entry.isFile=true;entry.size=data.length;entry.csize=entry.size;deflateNext()}else{deflateNext()}}else{callback(buildZipBuffer())}}deflateNext()}};alasql.from.METEOR=function(filename,opts,cb,idx,query){var res=filename.find(opts).fetch();if(cb)res=cb(res,idx,query);return res};alasql.from.TABLETOP=function(key,opts,cb,idx,query){var res=[];var opt={headers:true,simpleSheet:true,key:key};alasql.utils.extend(opt,opts);opt.callback=function(data){res=data;if(cb)res=cb(res,idx,query)};Tabletop.init(opt);return res};alasql.from.HTML=function(selector,opts,cb,idx,query){var opt={};alasql.utils.extend(opt,opts);var sel=document.querySelector(selector);if(!sel&&sel.tagName!="TABLE"){throw new Error("Selected HTML element is not a TABLE")}var res=[];var headers=opt.headers;if(headers&&!(headers instanceof Array)){headers=[];var ths=sel.querySelector("thead tr").children;for(var i=0;i=N)return EOF;if(eol)return eol=false,EOL;var j=I;if(text.charCodeAt(j)===quoteCode){var i=j;while(i++/g,"");return document();function document(){return{declaration:declaration(),root:tag()}}function declaration(){var m=match(/^<\?xml\s*/);if(!m)return;var node={attributes:{}};while(!(eos()||is("?>"))){var attr=attribute();if(!attr)return node;node.attributes[attr.name]=attr.value}match(/\?>\s*/);return node}function tag(){var m=match(/^<([\w-:.]+)\s*/);if(!m)return;var node={name:m[1],attributes:{},children:[]};while(!(eos()||is(">")||is("?>")||is("/>"))){var attr=attribute();if(!attr)return node;node.attributes[attr.name]=attr.value}if(match(/^\s*\/>\s*/)){return node}match(/\??>\s*/);node.content=content();var child;while(child=tag()){node.children.push(child)}match(/^<\/[\w-:.]+>\s*/);return node}function content(){var m=match(/^([^<]*)/);if(m)return m[1];return""}function attribute(){var m=match(/([\w:-]+)\s*=\s*("[^"]*"|'[^']*'|\w+)\s*/);if(!m)return;return{name:m[1],value:strip(m[2])}}function strip(val){return val.replace(/^['"]|['"]$/g,"")}function match(re){var m=xml.match(re);if(!m)return;xml=xml.slice(m[0].length);return m}function eos(){return 0==xml.length}function is(prefix){return 0==xml.indexOf(prefix)}}alasql.from.GEXF=function(filename,opts,cb,idx,query){var res;alasql("SEARCH FROM XML("+filename+")",[],function(data){res=data;console.log(res);if(cb)res=cb(res)});return res};yy.Help=function(params){return yy.extend(this,params)};yy.Help.prototype.toString=function(){var s=K("HELP");if(this.subject)s+=" "+L(this.subject);return s};helpdocs=[{command:"ALTER TABLE table RENAME TO table"},{command:"ALTER TABLE table ADD COLUMN column coldef"},{command:"ALTER TABLE table MODIFY COLUMN column coldef"},{command:"ALTER TABLE table RENAME COLUMN column TO column"},{command:"ALTER TABLE table DROP column"},{command:"ATTACH engine DATABASE database"},{command:"ASSERT value"},{command:"BEGIN [TRANSACTION]"},{command:"COMMIT [TRANSACTION]"},{command:"CREATE [engine] DATABASE [IF NOT EXISTS] database"},{command:"CREATE TABLE [IF NOT EXISTS] table (column definitions)"},{command:"DELETE FROM table [WHERE expression]"},{command:"DETACH DATABASE database"},{command:"DROP [engine] DATABASE [IF EXISTS] database"},{command:"DROP TABLE [IF EXISTS] table"},{command:"INSERT INTO table VALUES value,..."},{command:"INSERT INTO table DEFAULT VALUES"},{command:"INSERT INTO table SELECT select"},{command:"HELP [subject]"},{command:"ROLLBACK [TRANSACTION]"},{command:"SELECT [modificator] columns [INTO table] [FROM table,...] [[mode] JOIN [ON] [USING]] [WHERE ] [GROUP BY] [HAVING] [ORDER BY] "},{command:"SET option value"},{command:"SHOW [engine] DATABASES"},{command:"SHOW TABLES"},{command:"SHOW CREATE TABLE table"},{command:"UPDATE table SET column1 = expression1, ... [WHERE expression]"},{command:"USE [DATABASE] database"},{command:"expression"},{command:'See also http://github/agershun/alasq for more information'}];yy.Help.prototype.execute=function(databaseid,params,cb){var ss=[];if(!this.subject){ss=helpdocs}else{ss.push('See also http://github/agershun/alasq for more information')}if(cb)ss=cb(ss);return ss};yy.Print=function(params){return yy.extend(this,params)};yy.Print.prototype.toString=function(){var s=K("PRINT");if(this.statement)s+=" "+this.statement.toString();return s};yy.Print.prototype.execute=function(databaseid,params,cb){var self=this;var res=1;alasql.precompile(this,databaseid,params);if(this.exprs&&this.exprs.length>0){var rs=this.exprs.map(function(expr){var exprfn=new Function("params,alasql,p","var y;return "+expr.toJavaScript("({})","",null)).bind(self);var r=exprfn(params,alasql);return JSONtoString(r)});console.log.apply(console,rs)}else if(this.select){var r=this.select.execute(databaseid,params);console.log(JSONtoString(r))}else{console.log()}if(cb)res=cb(res);return res};yy.Source=function(params){return yy.extend(this,params)};yy.Source.prototype.toString=function(){var s=K("SOURCE");if(this.url)s+=" "+S("'"+this.url+"'");return s};yy.Source.prototype.execute=function(databaseid,params,cb){var res;loadFile(this.url,!!cb,function(data){res=alasql(data);if(cb)res=cb(res);return res},function(err){throw err});return res};yy.Require=function(params){return yy.extend(this,params)};yy.Require.prototype.toString=function(){var s=K("REQUIRE");if(this.paths&&this.paths.length>0){s+=this.paths.map(function(path){return path.toString()}).join(",")}if(this.plugins&&this.plugins.length>0){s+=this.plugins.map(function(plugin){return plugin.toUpperCase() +}).join(",")}return s};yy.Require.prototype.execute=function(databaseid,params,cb){var self=this;var res=0;var ss="";if(this.paths&&this.paths.length>0){this.paths.forEach(function(path){loadFile(path.value,!!cb,function(data){res++;ss+=data;if(res0){this.plugins.forEach(function(plugin){if(!alasql.plugins[plugin]){loadFile(alasql.path+"/alasql-"+plugin.toLowerCase()+".js",!!cb,function(data){res++;ss+=data;if(res0){res=res.filter(function(d){return d.databaseid.match(relike)})}}if(cb)cb(res);return res};LS.createTable=function(databaseid,tableid,ifnotexists,cb){var lsdbid=alasql.databases[databaseid].lsdbid;var tb=LS.get(lsdbid+"."+tableid);var res=1;if(tb&&!ifnotexists){throw new Error('Table "'+tableid+'" alsready exists in localStorage database "'+lsdbid+'"')}var lsdb=LS.get(lsdbid);var table=alasql.databases[databaseid].tables[tableid];lsdb.tables[tableid]={columns:table.columns};LS.set(lsdbid,lsdb);LS.set(lsdbid+"."+tableid,[]);if(cb)cb(res);return res};LS.dropTable=function(databaseid,tableid,ifexists,cb){var res=1;var lsdbid=alasql.databases[databaseid].lsdbid;if(alasql.options.autocommit){var lsdb=LS.get(lsdbid)}else{var lsdb=alasql.databases[databaseid]}if(!ifexists&&!lsdb.tables[tableid]){throw new Error('Cannot drop table "'+tableid+'" in localStorage, because it does not exist')}delete lsdb.tables[tableid];LS.set(lsdbid,lsdb);localStorage.removeItem(lsdbid+"."+tableid);if(cb)cb(res);return res};LS.fromTable=function(databaseid,tableid,cb,idx,query){var lsdbid=alasql.databases[databaseid].lsdbid;var res=LS.get(lsdbid+"."+tableid);if(cb)res=cb(res,idx,query);return res};LS.intoTable=function(databaseid,tableid,value,columns,cb){var lsdbid=alasql.databases[databaseid].lsdbid;var res=value.length;var tb=LS.get(lsdbid+"."+tableid);if(!tb)tb=[];tb=tb.concat(value);LS.set(lsdbid+"."+tableid,tb);if(cb)cb(res);return res};LS.loadTableData=function(databaseid,tableid){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;db.tables[tableid].data=LS.get(lsdbid+"."+tableid)};LS.saveTableData=function(databaseid,tableid){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;LS.set(lsdbid+"."+tableid,db.tables[tableid].data);db.tables[tableid].data=null};LS.commit=function(databaseid,cb){var db=alasql.databases[databaseid];var lsdbid=alasql.databases[databaseid].lsdbid;var lsdb={databaseid:lsdbid,tables:{}};if(db.tables){for(var tbid in db.tables){lsdb.tables[tbid]={columns:db.tables[tbid].columns};LS.set(lsdbid+"."+tbid,db.tables[tbid].data)}}LS.set(lsdbid,lsdb);return 1};LS.begin=LS.commit;LS.rollback=function(databaseid,cb){var db=alasql.databases[databaseid];db.dbversion++;var lsdbid=alasql.databases[databaseid].lsdbid;var lsdb=LS.get(lsdbid);if(lsdb.tables){for(var tbid in lsdb.tables){var tb=new alasql.Table({columns:db.tables[tbid].columns});extend(tb,lsdb.tables[tbid]);lsdb.tables[tbid]=tb;if(!alasql.options.autocommit){lsdb.tables[tbid].data=LS.get(db.lsdbid+"."+tbid)}lsdb.tables[tbid].indexColumns()}}delete alasql.databases[databaseid];alasql.databases[databaseid]=new alasql.Database(databaseid);extend(alasql.databases[databaseid],lsdb);alasql.databases[databaseid].databaseid=databaseid;alasql.databases[databaseid].engineid="LOCALSTORAGE"};var SQLITE=alasql.engines.SQLITE=function(){};SQLITE.createDatabase=function(wdbid,args,ifnotexists,dbid,cb){throw new Error("Connot create SQLITE database in memory. Attach it.")};SQLITE.dropDatabase=function(databaseid){throw new Error("This is impossible to drop SQLite database. Detach it.")};SQLITE.attachDatabase=function(sqldbid,dbid,args,params,cb){var res=1;if(alasql.databases[dbid]){throw new Error('Unable to attach database as "'+dbid+'" because it already exists')}if(args[0]&&args[0]instanceof yy.StringValue||args[0]instanceof yy.ParamValue){if(args[0]instanceof yy.StringValue){var value=args[0].value}else if(args[0]instanceof yy.ParamValue){var value=params[args[0].param]}alasql.utils.loadBinaryFile(value,true,function(data){var db=new alasql.Database(dbid||sqldbid);db.engineid="SQLITE";db.sqldbid=sqldbid;var sqldb=db.sqldb=new SQL.Database(data);db.tables=[];var tables=sqldb.exec("SELECT * FROM sqlite_master WHERE type='table'")[0].values;tables.forEach(function(tbl){db.tables[tbl[1]]={};var columns=db.tables[tbl[1]].columns=[];var ast=alasql.parse(tbl[4]);var coldefs=ast.statements[0].columns;if(coldefs&&coldefs.length>0){coldefs.forEach(function(cd){columns.push(cd)})}});cb(1)},function(err){throw new Error('Cannot open SQLite database file "'+args[0].value+'"')});return res}else{throw new Error("Cannot attach SQLite database without a file")}return res};SQLITE.fromTable=function(databaseid,tableid,cb,idx,query){var data=alasql.databases[databaseid].sqldb.exec("SELECT * FROM "+tableid);var columns=query.sources[idx].columns=[];if(data[0].columns.length>0){data[0].columns.forEach(function(columnid){columns.push({columnid:columnid})})}var res=[];if(data[0].values.length>0){data[0].values.forEach(function(d){var r={};columns.forEach(function(col,idx){r[col.columnid]=d[idx]});res.push(r)})}if(cb)cb(res,idx,query)};SQLITE.intoTable=function(databaseid,tableid,value,columns,cb){var sqldb=alasql.databases[databaseid].sqldb;for(var i=0,ilen=value.length;i1){var sql="REQUIRE "+paths.map(function(p){return'"'+p+'"'}).join(",");alasql(sql,[],cb)}}else if(path===false){delete alasql.webworker;return}}} \ No newline at end of file diff --git a/gulpfile.js b/gulpfile.js index cf00aec327..6b2458d0ed 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -196,6 +196,13 @@ gulp.task('copy-console-org', function(){ /************************/ +// Echo plugin +gulp.task('typescript', function(){ + gulp.src(['./src/typescript/alasql.d.ts']) + .pipe(gulp.dest('./dist')); +}); + + // Echo plugin gulp.task('plugin-plugins', function(){ gulp.src([ @@ -242,6 +249,7 @@ gulp.task('default', ['js-merge' /*, 'jison-compile', 'jison-lex-compile' */], f gulp.watch('./src/99worker*.js',function(){ gulp.run('js-merge-worker'); }); gulp.watch('./src/alasqlparser.jison',function(){ gulp.run('jison-compile'); }); + gulp.watch('./src/typescript/alasql.d.ts',function(){ gulp.run('typescript'); }); gulp.watch('./src/echo/*.js',function(){ gulp.run('plugin-plugins'); }); gulp.watch('./src/md/*.js',function(){ gulp.run('plugin-plugins'); }); gulp.watch('./src/prolog/*.js',function(){ gulp.run('plugin-prolog'); }); diff --git a/meteor/.versions b/meteor/.versions index 9533c83173..9456f5d983 100644 --- a/meteor/.versions +++ b/meteor/.versions @@ -1,4 +1,4 @@ -agershun:alasql@0.1.17 -local-test:agershun:alasql@0.1.17 +agershun:alasql@0.1.18 +local-test:agershun:alasql@0.1.18 meteor@1.1.6 underscore@1.0.3 diff --git a/meteor/README.md b/meteor/README.md deleted file mode 100644 index 36aba83a66..0000000000 --- a/meteor/README.md +++ /dev/null @@ -1,844 +0,0 @@ -# AlaSQL.js - JavaScript SQL database library for relational and graph data manipulation with support of localStorage, IndexedDB, and Excel - -AlaSQL - '[à la SQL](http://en.wiktionary.org/wiki/%C3%A0_la)' - is a lightweight JavaScript SQL database designed to work in browser, Node.js, and Apache Cordova. It supports traditional SQL with some NoSQL functionality. Current version of AlaSQL can work in memory and use file, IndexedDB, and localStorage as a persistent storage. - -## How to use? - -AlaSQL is easy to use! Just install ```agershun:alasql```packageto your project and call ```alasql()``` function with SQL statement inside: - -```js - alasql("CREATE TABLE cities (city string, population number)"); - alasql("INSERT INTO cities VALUES ('Rome',2863223), ('Paris',2249975),\ - ('Berlin',3517424), ('Madrid',3041579)"); - console.log( alasql("SELECT * FROM cities WHERE population < 3500000 ORDER BY population DESC") ); -``` - -Please use: -* [Issues](https://github.com/agershun/alasql/issues) to report bugs. -* [Feathub](http://feathub.com/agershun/alasql) to vote for new features -* [AlaSQL Forum](https://groups.google.com/d/forum/alasql) for discussions - -## Documentation - -* [AlaSQL Wiki](https://github.com/agershun/alasql/wiki) -* [AlaSQL User Manual](http://www.slideshare.net/AndreyGershun/alasql-manual-141220-1) -* [AlaSQL Coockbok](https://github.com/agershun/alasql/wiki/Data-manipulation) - Q&A, examples -* [StackOverflow AlaSQL Q&A](http://stackoverflow.com/questions/tagged/alasql) - -## Why AlaSQL? - -* AlaSQL was written with pure JavaScript and does not use WebSQL database. -* AlaSQL uses "good old" SQL with advanced funcionality like multiple JOINs, VIEWs, GROUPs, UNIONs, PRIMARY KEYs, ANY, ALL, IN, subqueries, ROLLUP(), CUBE() and GROUPING SETS(), CROSS APPLY, OUTER APPLY, WITH SELECT, views, functions, variables -* AlaSQL works with all modern versions of browsers Chrome, Firefox, IE, Safari, Opera, Node.js, and mobile iOS and Android, plus Apache Cordova. -* AlaSQL can to work directly with JavaScript objects and functions inside SQL, it can search JSON objects like JavaScript and NoSQL databases -* AlaSQL supports file, IndexedDB, and localStorage (with AUTOCOMMIT ON and AUTOCOMMIT OFF modes) -* Plus some [JavaScript sugar](#Sugar) -* AlaSQL is fast, because it uses some optimization methods. - -Check AlaSQL vs other JavaScript SQL databases and data processing libraries: -* [AlaSQL vs. WebSQL](http://jsperf.com/alasql-js-vs-websql/7) - for in-memory SELECT operations (see discussion at [issue #47](https://github.com/agershun/alasql/issues/47)) - * [AlaSQL vs. SQL.js](http://jsperf.com/sql-js-vs-alasql-js/4) - in-memory operations* [AlaSQL vs. Linq](http://jsperf.com/alasql-vs-linq-on-groupby) - test on 2^20 records - * AlaSQL vs. CrossFilter - [test 1](http://jsperf.com/alasql-vs-crossfilter), [test 2 on 8000 records](http://jsperf.com/alasql-vs-crossfilter-athletic-data) - * [AlaSQL vs. Lodash](http://jsperf.com/alasql-vs-lodash), [AlaSQL vs. Lodash vs. Underscore](http://jsperf.com/alasql-vs-lodash-sort/3) - * [AlaSQL vs. Human](http://jsperf.com/javascript-array-grouping/7) :) - based on SatckOverflow [question on grouping](http://stackoverflow.com/questions/6781722/fast-grouping-of-a-javascript-array). - -## What is new? - -### AlaSQL and Meteor Mongo collections - -Now you can use Meteor collections as agruments. To do it simply store alasql.min.js to the client/lib directory and then apply SQL to Meteor Collections: - -```js - Template.body.helpers({ - tasks: function () { - return alasql('SELECT * FROM ?',[Tasks]); - } - }); -``` - -Or you can use with find() options with special METEOR() from-function: -``` - return alasql('SELECT * FROM ?',[Tasks]); - return alasql('SELECT * FROM METEOR(?)',[Tasks]); - return alasql('SELECT * FROM METEOR(?,?)',[Tasks,{text:"Hello world!"}]); - return alasql('SELECT * FROM METEOR(?,{text:"Hello world!"})',[Tasks]); -``` - -### Search paths in graph - -Now you can search graphs with SEARCH operator: -```js - var res = alasql('CREATE GRAPH Pablo, Maxim, Alex, Napoleon, \ - Josephine, Kate, Julia {age:27}, Paloma, \ - #Pablo >loves> #Julia, #Maxim >> #Julia, #Alex >> #Kate, \ - #Kate >> #Julia, #Alex >> #Paloma, #Napoleon > "loves" > #Josephine, \ - #Josephine >"knows"> #Pablo'); - - var res = alasql('SEARCH PATH(#Pablo) name FROM #Napoleon '); - // returns ['loves','Josephine','knows','Pablo'] -``` -You can play with grpahs in AlaSQL in [this jsFiddle example](http://jsfiddle.net/fgzya692/1/). - -### Documents and graphs paradigms - -AlaSQL now is multi-paradigm database with support documents and graphs. Below you can find an example -how to create graph: -```js - alasql('CREATE GRAPH #Olga, #Helen, #Pablo, #Andrey, #Alice, \ - #Olga >> #Pablo, #Helen >> #Andrey, \ - #Pablo >> #Alice, #Andrey >> #Alice'); -``` -and search over it with SEARCH operator: -```js - // Whom loves Olga? - alasql('SEARCH / #Olga >> name'); - // ['Pablo'] - - // Whom loves Olga's love objects? - alasql('SEARCH / #Olga >> >> name'); - // ['Alice'] - - // Who loves lovers of Alice? - alasql('SEARCH / ANY(>> >> #Alice) name'); - // ['Olga','Helen'] - -``` -You also make searches over JSON object with SEARCH operator: -```js - var data = {a:{a:{a:{a:{b:10}}}},b:20}; - var res = alasql('SEARCH a b FROM ?',[data]); - var res = alasql('SEARCH (a)+ b FROM ?',[data]); - var res = alasql('SEARCH (a a)+ b FROM ?',[data]); - var res = alasql('SEARCH (a a a)+ b FROM ?',[data]); - var res = alasql('SEARCH (/)+ b FROM ?',[data]); - var res = alasql('SEARCH /+b FROM ?',[data]); - var res = alasql('SEARCH a* b FROM ?',[data]); - var res = alasql('SEARCH a+ b FROM ?',[data]); - var res = alasql('SEARCH a? b WHERE(b>20) FROM ?',[data]); -``` -Please see more examples in test300-test309.js. All these features will be documented soon. - -### Version upgrade from 0.0.51 to 0.1.0 - -AlaSQL now is 6 month old and it can change minor release number from 0.0 to 0.1. - -As we decided earlier, we will change version number to 0.1 after cleaning some -known bugs and problems (including [UNION CORRESPONDING](https://github.com/agershun/alasql/issues/75) issue and [IE9 file saving](https://github.com/agershun/alasql/issues/73)). - -The plans and priorities for development from version 0.1 to 0.2 will be: -* Wiki documentation -* Fixing bugs and clean the code -* Add graph- and document- database paradigm functionality -* Prepare to convert AlaSQL to modular structure (AlaSQL2) - -Other areas of future improvements (please add and vote for new features on [Feathub](http://feathub.com/agershun/alasql)): -* Better Apache Cordova and other mobile frameworks support -* Improve export to XLS and XLSX (adding colors and LibreOffice support) -* Support key-value external storages and NoSQL databases -* Add some missing SQL functionality (constraints, foreign keys, etc.) - -### AlaSQL export to Excel with colors (2) - -Now AlaSQL can save files to Excel and LibreOffice formats with colors and other -Excel formatting functions. This function also work in IE9. This is a code sample: - -```js - var mystyle = { - headers:true, - column: {style:{Font:{Bold:"1"}}}, - rows: {1:{style:{Font:{Color:"#FF0077"}}}}, - cells: {1:{1:{ - style: {Font:{Color:"#00FFFF"}} - }}} - }; - alasql('SELECT * INTO XLSXML("restest280b.xls",?) FROM ?',[mystyle,data]); -``` -See the working example in [jsFiddle](http://jsfiddle.net/95j0txwx/7/) - - -### AlaSQL export to Excel with colors (1) - -Now AlaSQL can export data to XLS format with coloring cells - -```js - var opts = { - headers: true, - sheetid: 'My Birds', - style:"background:#00ff00", - columns: [ - {columnid:'a',title:'Albatroses', - style:'background:red;font-size:20px', - cell:{style:'background:blue'} - }, - {columnid:'b',title:'Bird',cell:{ - style:function(value,sheet,row,column,rowidx,columnidx){ - return 'background'+(value==10?'brown':'white') - }}}, - { - columnid: 'b', cell:{value:function(value){ return value * value}} - } - ] - }; - - var res = alasql('SELECT * INTO XLS("restest257a.xls",?) FROM ?',[opts,data]); - -``` -Please, see the example with advanced color syntax [in jsFiddle](http://jsfiddle.net/agershun/95j0txwx/2/). - -### AlaSQL and Google Spreadsheets (with Tabletop) - -Now AlaSQL can read data (and make other manipulations like grouping, filtering, or saving to XLSX) directly from Google Spreadsheets. It uses wonderful [Tabletop library](https://github.com/jsoma/tabletop). - -```html - - -

- -``` - -You can try this example [in jsFiddle](http://jsfiddle.net/ezy7rhhd/2). - -### AlaSQL as a WebWorker - -AlaSQL can work as a webworker. Include alasql-worker.js and that is it: AlaSQL will work as a webworker. - -```html - - -``` -Try the example [at jsFiddle](http://jsfiddle.net/agershun/oxv4rzzc/). - -Another option - run alasql.worker() function: - -```html - - -``` -Try this example [in jsFiddle](http://jsfiddle.net/agershun/rjwp8u48/3/). - -Also you can use AlaSQL in webworker just simply load it as a script: - -```js - importScripts('alasql.min.js'); -``` - -### Read and write Excel, CSV, TAB, JSON, and text files to/from database - -Now AlaSQL can work with files in XLS, XSLX, CSV, TAB, TXT, and JSON format - -```js - alasql('select * into one from csv("mydata.csv")'); - alasql('select Country, Name from xlsx("cities.xlsx",{headers:true, range:"B1:E10"})\ - where Population > 100000', - [],function(data){ - console.log(data); - }); -``` -See [test168](test/test168.js) - [test169](test/test169.js) - -### d3.js + AlaSQL - -AlaSQL can be used with d3.js to create diagrams, like the example below. Here AlaSQL -read Excel file with Olympic Prizes, group and sort rows by one of the axes, and then -take top 10 records and create a list with axe values: - -```js - function graph(axe) { - alasql('SELECT TOP 10 '+axe+', SUM([Gold Medals]) AS Gold, \ - SUM([Silver Medals]) AS Silver, SUM([Bronze Medals]) AS Bronze \ - FROM XLSX("medals.xlsx",{headers:true}) \ - GROUP BY '+axe+' ORDER BY '+axe,[],function(data){ - - d3.select("body") - .append('ul') - .data(data) - .entry() - .append('li') - .text(function(d){return d[axe]}); - }); - } - - graph('Axe'); - -``` - -Try the [simple example](http://alasql.org/demo/005d3/) of AlaSQL + d3.js integration. - - -### Google Maps + AlaSQL -```js - alasql("SELECT * FROM CSV("https://cdn.rawgit.com/albertyw/avenews/master/old/data/average-latitude-longitude-countries.csv",{headers:true})', [], function(country){ - var mapOptions = { zoom : 3, center : new google.maps.LatLng(40, 0), - mapTypeId : google.maps.MapTypeId.ROADMAP - }; - var map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); - for (i = 0; i < country.length; i++) { - var opts = { - strokeColor : '#000000', - fillColor : ["red","green","blue","brown"][i%4], - fillOpacity : 0.35, - map : map, - center : new google.maps.LatLng(country[i].Latitude,country[i].Longitude), - radius : 100000 - }; - new google.maps.Circle(opts); - }); -``` -Check [this example](http://alasql.org/demo/009geo) and [this example](http://jsfiddle.net/agershun/1o2xq1yh/2/) of integrations AlaSQL and Google Maps. - -### ETL sample: CSV and IndexedDB database - -Upload CSV file with headers to IndexedDB database, and then save only asian countries -to Excel file: -```js - alasql('ATTACH INDEXEDDB DATABASE geo; \ - CREATE TABLE IF NOT EXISTS geo.country; \ - SELECT * INTO geo.country FROM CSV("country.csv",{headers:true}); \ - SELECT * INTO XLSX("asia.xlsx") FROM geo.country WHERE continent_name = "Asia"'); -``` -See [the example](http://alasql.org/demo/001csv/). - -### Read SQLite database files - -AlaSQL can work with SQLite data files on the top of with [SQL.js](https://github.com/kripken/sql.js) library: -```html - - - -``` - -See more detailed [the example](http://alasql.org/demo/004sqlite/). - -### Angular.js and AlaSQL.js - -You can use AlaSQL together with Angular.js framework: - -```js - $scope.exportData = function () { - alasql('SELECT * INTO XLSX("john.xlsx",{headers:true}) FROM ?',[$scope.items]); - }; -``` -See [simple example in jsFiddle](http://jsfiddle.net/agershun/00nfeq12/). - -Other examples of AlaSQL and Angular.js integration: - -* [Calculating average of array](http://jsfiddle.net/agershun/she06Lq3/2/) - -## Examples - -Try AlaSQL in console: -* AlaSQL Console [http://alasql.org/console](http://alasql.org/console) -* [Console source code](console/index.html) -* [Alacon](alacon.js) - command-line AlaSQL console (to run: ```alacon "sql-statement" params...```) -* [Alaserver](alaserver.js) - very simple AlaSQL-server (to run: ```alaserver```, then -type in browser "http://127.0.0.1:1337/?SELECT VALUE 2*2" ) - -Try AlaSQL in Fiddle: -* Simple examples: [sample 1](http://jsfiddle.net/38hj2uwy/10/), [sample 2](http://jsfiddle.net/38hj2uwy/6/), [sample 3](http://jsfiddle.net/6a06dqhc/3/), [sample 4](http://jsfiddle.net/606ksx2g/1/), [sample 5](http://jsfiddle.net/agershun/38hj2uwy/40/) -* [IndexedDB example](http://jsfiddle.net/agershun/1t2rrr78/) -* [AlaSQL Sandbox](http://jsfiddle.net/czqfyhat/2/) - [source](examples/sandbox.html) -* [Sieve of Eratosthenes](http://jsfiddle.net/agershun/1u05op11/) - [source](examples/prime.html) - -Other examples: -* [World database](http://alasql.org/console?source 'world.sql';select top 10 * from City) - [source](console/index.html) -* Mini-ETL: [upload CSV data to IndexedDB database](http://alasql.org/demo/001csv/) -* [More than 200 of AlaSQL tests](test) - -### What People Say about AlaSQL? - -* [What people around the world say about AlaSQL](PEOPLE.md) - -### Presentations - -* [AlaSQL.js - fast JavaScript in-memory SQL database](http://www.slideshare.net/AndreyGershun/alasqljsfast-javascript-inmemory-sql-database) -* [SQL and NoSQL in AlaSQL database](http://www.slideshare.net/AndreyGershun/sql-and-nosql-in-alasql) - -## Installation - -### In browser - -Include file: [alasql.js](./alasql.js) to the page. - -```html - - - -``` -Try this sample in [AlaSQL console](http://alasql.org/console?CREATE TABLE test (language INT, hello STRING);INSERT INTO test VALUES (1,'Hello!');INSERT INTO test VALUES (2,'Aloha!');INSERT INTO test VALUES (3,'Bonjour!');SELECT * FROM test WHERE language > 1) - -You can use alasql.js with define()/require() functions in browser as well, because it supports AMD and UMD: - -```js - require(['../../alasql.js'], function(alasql) { - var test1 = [{a:1,b:2,c:3},{a:4,b:5,c:6},{a:7,b:8,c:9}]; - console.table(alasql('SELECT a, b*c AS bc FROM ? AS t',[test1])); - }); -``` -Like in this sample you do not need to CREATE TABLE and INSERTS if you do not need constraints functionality. - -### In Node.js - -Use the following command for installation: -``` - npm install alasql -``` -Then require alasql.js file: - -```js - var alasql = require('alasql'); - - var db = new alasql.Database(); - - db.exec("CREATE TABLE test (one INT, two INT)"); - db.tables.test.data = [ // You can mix SQL and JavaScript - {one:3,two:4}, - {one:5,two:6}, - ]; - var res = db.exec("SELECT * FROM test ORDER BY two DESC"); - console.log(res[0].one); - -``` - -### Supported SQL statements - -* SELECT TOP number columns INTO table FROM tableid1 JOIN tableid2 ON oncond WHERE cond GROUP BY v1,v2 HAVING cond ORDER BY a,b, LIMIT number OFFSET number -* INSERT INTO table \[ (field1, field2) \] VALUES (value1, value2), (value3, value4), ... -* INSERT INTO table SELECT subquery -* UPDATE table SET field = value1, field = value2 WHERE condition -* DELETE FROM table WHERE condition -* CREATE TABLE \[IF NOT EXISTS\] table (columns type PRIMARY KEY, constraints) -* ALTER TABLE ADD COLUMN / DROP COLUMN -* DROP TABLE \[IF EXISTS\] table -* CREATE DATABASE, USE DATABASE, DROP DATABASE -* SHOW DATABASES / SHOW TABLES / SHOW COLUMNS / SHOW CREATE TABLE -* SOURCE 'url-file.sql' -* ASSERT json-object -* Expression (like SELECT expression) - -Try all these statements in [AlaSQL console](http://alasql.org/console?help) - -#### SELECT statement - -AlaSQL.js supports following subset of SELECT syntax: - -* SELECT column1, column2 AS alias3, FUNCTION(field4+field5) AS alias6, SUM(expression7) AS alias8, *, table2.* -* TOP number -* FROM table1, table2, (SELECT * FROM table3) alias -* LEFT / RIGHT / INNER / OUTER / ANTI / SEMI / CROSS / NATURAL JOIN table2 ON condition / USING columns -* WHERE condition -* GROUP BY column1, column2, ROLLUP(a,b), CUBE(c,d,e), GROUPING SETS(g,h) -* HAVING condition -* ORDER BY column1, column2 DESC, -* LIMIT number [OFFSET number] -* UNION / UNION ALL select / INTERSECT / EXCEPT - -Operators: - -* +, -, *, /, %, AND, OR, NOT, BETWEEN, NOT BETWEEN, EXISTS (Subquery), > ALL (subquery/array), > ANY/SOME (subquery / array), [NOT] IN (subquery / array), LIKE -* CAST (expression AS type) - -Aggregators: - -* SUM(), COUNT(), MIN(), MAX(), FIRST(), LAST(), AVG(), AGGR(), ARRAY(), REDUCE() - -GROUP BY Grouping functions: - -* ROLLUP(), CUBE(), GROUPING SETS() - -Functions: - -* ABS(), IIF(), IFNULL(), INSTR(), LOWER(), UPPER(), LCASE(), UCASE(), LEN(), LENGTH() -* GREATEST(), LEAST() - -SELECT modifiers (non-standard SQL): -* SELECT VALUE - get single value -* SELECT ROW - get first row as an array -* SELECT COLUMN - get first column as an array -* SELECT MATRIX - get all results as an array of arrays - -#### User-defined JavaScript functions - -You can use all benefits of SQL and JavaScript togeather by defining user functions. Just add new functions to alasql.fn object: - -```js - alasql.fn.double = function(x){return x*2}; - alasql.fn.sum10 = function(x,y) { return x+y*10; } - db.exec('SELECT a, double(a) AS b, sum10(a,b) FROM test1'); -``` - -User-defined functions are related to current database. You can define different functions in different databases. - -### alasql - -alasql is a main variable of module. You can use it immediatly as default database - -In browser: -```html - - -``` -Try this sample in [AlaSQL console](http://alasql.org/console?CREATE TABLE one (two INT)) - - -or in Node.js: -```js - var alasql = require('alasql'); - alasql('CREATE TABLE one (two INT)'); -``` - -Another approach is to create new database: - -```js - var mybase = new alasql.Database(); - mybase.exec('CREATE TABLE one (two INT)'); -``` -You can give a name to database and then access it from alasql: -```js - var mybase = new alasql.Database('mybase'); - console.log(alasql.databases.mybase); -``` - -Each database can be used with the following methods: - -```js - var db = new alasql.Database() - create new alasql-database - var res = db.exec("SELECT * FROM one") - executes SELECT query and returns array of objects -``` - -Usually, alasql.js works synchronously, but you can use callback. - -```js - db.exec('SELECT * FROM test', [], function(res){ - console.log(res); - }); -``` - -or you can use aexec() - promised version of exec (in this case you need to install [es6-promise](https://www.npmjs.org/package/es6-promise) module for Node.js) (this feature is experimental and may be removed in a future to reduce dependices): -```js - db.aexec('SELECT * FROM test').then(function(res){ - console.log(res); - }); -``` -You can use compile statements: -```js - var insert = db.compile('INSERT INTO one (1,2)'); - insert(); -``` - -You can use parameters in compiled and interpreted statements: - -```js - var insert1 = db.compile('INSERT INTO one (?,?)'); - var insert2 = db.compile('INSERT INTO one ($a,$b)'); - var insert3 = db.compile('INSERT INTO one (:a,:b)'); - - insert1([1,2]); - insert2({a:1,b:2}); - insert3({a:3,b:4}); - - db.exec('INSERT INTO one (?,?)',[5,6]); - -``` -You even can use param in FROM clause: - -```js - var years = [ - {yearid: 2012}, {yearid: 2013}, - {yearid: 2014}, {yearid: 2015}, - {yearid: 2016}, - ]; - - var res = alasql.queryArray('SELECT * FROM ? AS years ' + - 'WHERE yearid > ?', [years,2014]); - - // res == [2015,2016] -``` -You can use array of arrays to make a query. In this case use square brackets for column name, -like \[1\] or table\[2\] (remember, all arrays in JavaScript start with 0): -```js - var data = [ - [2014, 1, 1], [2015, 2, 1], - [2016, 3, 1], [2017, 4, 2], - [2018, 5, 3], [2019, 6, 3] - ]; - var res = alasql('SELECT SUM([1]) FROM ? d WHERE [0]>2016', [data]); -``` -Use alasql.queryArrayOfArrays() function to return array of arrays. In this case -you can specify array position of selected column with number or number in brackets: -```js - var res = alasql.queryArrayOfArrays( - 'SELECT [1] AS 0,[1]+[2] AS [1] FROM ? d WHERE [0]>2016', [data]); -``` -This feature can be used as filter for arrays. Compare: -```js - // Same filter - var res1 = alasql.queryArrayOfArrays('SELECT * FROM ? a WHERE [0]>2016', [data]); - var res2 = data.filter(function(a){return a[0]>2016}); - - // Complex filter with aggregating, grouping and sorting - var res = alasql.queryArrayOfArrays( - 'SELECT [2] AS 0, SUM([1]) AS 1 FROM ? a WHERE a[0]>? GROUP BY [0] ORDER BY [1]', - [data, 2016]); - -``` - -### Lower and Upper Case - -By default, AlaSQL is case-insensitive to all standard keywords (like SELECT) and standard functions (like ABS()). All database names, table names, column names, and user-defined functions are case sensitive. - -JavaScript is case-sensitive language, so use the same CaSe for AlaSQL and JavaScript data. - -Now you can use databases, tables, and columns with spaces inside square brackets: - -```sql - CREATE DATABASE [My Database]; -- BTW You can use comments in the SQL statements - USE [My Database]; /* or comments like this */ - CREATE TABLE [A.table] ([the-column] INT); - INSERT INTO [A.table] VALUES (1),(2); - SELECT [the-column] AS [AS] FROM [My Database]; -``` -Try this sample in [AlaSQL console](http://alasql.org/console?CREATE DATABASE [My Database];USE [My Database];CREATE TABLE [A.table] ([the-column] INT);INSERT INTO [A.table] VALUES (1),(2);SELECT [the-column] AS [AS] FROM [My Database]) - - -### JavaScript Sugar - -AlaSQL extends "good old" SQL to make it closer to JavaScript. The "sugar" includes: - -* Json objects - ``` {a:1,b:@[1,2,3]} -* Object propertires - ```obj->property->subproperty``` -* Object and arrays elements - ```obj->(a*1)``` -* JavaScript functions - ```obj->valueOf()``` -* SELECT VALUE, ROW, COLUMN, MATRIX to format results of query - -### Transactions - -There is a limited support of transactions (with tx.rollback() and tx.commit() functions): - -```js - db = new alasql.Database("mydb"); - db.transaction(function(tx) { - tx.exec('SELECT COUNT(*) FROM students'); - tx.rollback(); - }); - -``` -Warning: Sorry, transactions now are temporary unavailable due some complexities with realization. - -### SQL to JavaScript parser and compiler - -You can use AlaSQL to parse to AST and compile SQL statements: - -```js - // Parse to AST - var ast = alasql.parse("SELECT * FROM one"); - console.log(ast.toString()); // Print restored SQL statement - - // Compile to JavaScript function with or without parameters - var statement = alasql.compile("SELECT * FROM one WHERE a > ? AND b < ?"); - statement([1,5]); -``` - -AlaSQL uses wonderful [Jison](http://jison.org) parser to produce AST-tree. - - -### localStorage and DOM-storage -You can use browser localStorage and [DOM-storage](https://github.com/node-browser-compat/dom-storage) as a data storage. Here is a sample: -``` - alasql('CREATE localStorage DATABASE IF NOT EXISTS Atlas'); - alasql('ATTACH localStorage DATABASE Atlas AS MyAtlas'); - alasql('CREATE TABLE IF NOT EXISTS MyAtlas.City (city string, population number)'); - alasql('SELECT * INTO MyAtlas.City FROM ?',[[{city:'Vienna', population:1731000}, - {city:'Budapest', population:1728000}]]); - var res = alasql('SELECT * FROM MyAtlas.City'); - console.log(res); -``` -Try this sample in [jsFiddle](http://jsfiddle.net/agershun/x1gq3wf2/). Run this sample -two or three times, and AlaSQL store more and more data in localStorage. Here, "Atlas" is -the name of localStorage database, where "MyAtlas" is a memory AlaSQL database. - -You can use localStorage in two modes: SET AUTOCOMMIT ON to immediate save data -to localStorage after each statement or SET AUTOCOMMIT OFF. In this case you need -to use COMMIT statement to save all data from in-memory mirror to localStorage. - -### Work with CSV, TAB, TXT, and JSON files -You can use files in these formats directly from AlaSQL (in sync and async modes): -```js - var res1 = alasq("select * from txt('mytext.txt') where [0] like 'M%'"); - var res2 = alasq("select * from tab('mydata.tab') order by [1]"); - var res3 = alasq("select [3] as city,[4] as population from csv('cities.csv')"); - - alasq("select * from json('array.json')",[],function(res4){ - console.log(res4) - }); -``` -See [test157.js](test/test157.js) as an example. - -### JSON-objects - -You can use JSON objects in your databases (do not forget use == and !== operators for deep comparision of objects): -```sql - alasql> SELECT VALUE @{a:1,b:2} - - {a:1,b:2} - - alasql> SELECT VALUE @{a:1,b:2} == @{a:1,b:2} - - true - - alasql> SELECT VALUE @{a:1,b:2}->b - - 2 - - alasql> SELECT VALUE @{a:1,b:(2*2)}->b - - 4 - -``` -Try AlaSQL JSON objects in Console [sample](http://alasql.org/console?drop table if exists one;create table one;insert into one values @{a:@[1,2,3],c:{e:23}}, @{a:@[{b:@[1,2,3]}]};select * from one) - -### Alacon - command-line utility - -You can use AlaSQL from the command-line: -```sql - > alacon "SELECT VALUE 1+1" - 2 - > alacon "SELECT VALUE 1+?" 2 - 3 - > alacon "@{a:(1+?)}" 3 - 4 -``` - -### Alaserver - simple database server - -Yes, you can even use AlaSQL as a very simple server for tests. - -To run enter the command: -``` - alaserver [port] -``` -then type in browser something like "http://127.0.0.1:1337/?SELECT VALUE 2*2" - -Warning: Alaserver is not multi-thread, not concurent, and not secured. - - -### Performance - -According the preliminary performance tests alasql.js is faster than [sql.js]() in 5 to 10 times on more than 1000 records tables, and 2 to 3 times to [WebSQL]() on different queries. - -AlaSQL has four different optimization algorithm: -* Caching of compiled queries -* Joins: Preindexation of joined table -* Joins: Prefiltering of WHERE expressions - -Now optimization algorithm has some limitations and therefore "table1 JOIN table2 USING column1, column2" is faster than "table1 JOIN table2 ON table1.column1 = table2.column1 AND table1.column2 = table2.column2 ", but with one column it is ok. - -### Limitations - -It is Ok with select for 1000000 records or 2 join two tables by 10000 records in each. -Now you can use streamming functions to work with longer datasources (see [test/test143.js](test/test143.js). - -### Tests - -### Tests with Mocha -AlaSQL uses ```mocha``` for tests. Run mocha from command line in directory with tests: - -``` - > cd test - > mocha . -``` -or run [test/index.html](test/index.html) for tests in browser. - -### Tests with AlaSQL ASSERT from SQL - -Now you can use AlaSQL [ASSERT](wiki/Assert) operator to test results of previous operation: -```sql - CREATE TABLE one (a INT); - ASSERT 1; - INSERT INTO one VALUES (1),(2),(3); - ASSERT 3; - SELECT * FROM one ORDER BY a DESC; - ASSERT [{a:3},{a:2},{a:1}]; -``` - -### Warnings -AlaSQL project is very young and still in active development phase, therefore it may have some bugs. Please, wait a little bit before start to use it in production. I am going to add more tests and clean the code before relaese more stable version 0.1.0. Please, submit any bugs and suggestions in [Issues page](https://github.com/agershun/alasql/issues). - -You can check next version branches for new experimental features. - -### Known Bugs and Limitations - -1. ORDER BY clause on three or more UNIONS ( [See example in AlaSQL console](http://alasql.org/console?select 10 as a union all select 20 as a union all select 30 as a order by a desc) ) -2. Limited functionality for transactions (supports only for localStorage) - Sorry, transactions are limited, because AlaSQL started to use more complex approach for PRIMARY KEYS / FOREIGN KEYS. Transactions will be fully turned on again in one of the future version. - - -Probably, there are many of others. Please, [give me a chance](https://github.com/agershun/alasql/issues) to fix them. Thank you! - -### Future Plans - -Read my [to do](TODO.md) page - there are also the community generated feature requests here: - -[![Feature Requests](http://feathub.com/agershun/alasql?format=svg)](http://feathub.com/agershun/alasql) - -Take charge and vote on your favorite. - - - -### Similar and related projects - -* [AlaX](http://github.com/agershun/alax) - Export to Excel with colors and formats -* [WebSQLShim](http://github.com/agershun/WebSQLShim) - WebSQL shim over IndexedDB (work in progress) -* [AlaMDX](http://github.com/agershun/alamdx) - JavaScript MDX OLAP library (work in progresss) -* [Other similar projects](http://github.com/agershun/alasql/wiki/Similar-Projects.md) - list of databases on JavaScript - -### FileSaver - -AlaSQL includess [FileSaver.js](https://github.com/eligrey/FileSaver.js/) library inside for saving files locally in browsers. Unfortunately, it cannot save files in Safari 8.0. - -### Contributors - -* [Andrey Gershun](http://github.com/agershun) -* [Mathias Rangel Wulff](https://github.com/mathiasrw) -* [Aubert Grégoire](https://github.com/gregaubert) - -### Credits - -Many thanks to Zach Carter for [Jison](http://zaach.github.io/jison/) parser generator, to the author of FileSaver.js, Andrew Kent for his [SQL Parser](https://github.com/forward/sql-parser), -authors of [XLSX](https://github.com/SheetJS/js-xlsx) library, -and other people for useful tools, which make our work much easier. - -## License - -[MIT licence information](LICENSE). - -The MIT license on this repo covers all contents of the repo, but does not supercede the existing licenses for products used for this work, including the Chinook Database (covered by the Microsoft Public License) and other products. - -(c) 2014, Andrey Gershun (agershun@gmail.com), - diff --git a/meteor/package.js b/meteor/package.js index 0a08f612c3..cc12eaf49e 100644 --- a/meteor/package.js +++ b/meteor/package.js @@ -1,13 +1,13 @@ Package.describe({ name: 'agershun:alasql', - version: '0.1.18', + version: '0.1.19', // Brief, one-line summary of the package. summary: 'AlaSQL - JavaScript SQL database library', // URL to the Git repository containing the source code for this package. git: 'http://github.com/agershun/alasql.git', // By default, Meteor will default to using README.md for documentation. // To avoid submitting documentation, set this field to null. - documentation: 'README.md' + documentation: '../README.md' }); Package.onUse(function(api) { diff --git a/node_modules/es6-promise/CHANGELOG.md b/node_modules/es6-promise/CHANGELOG.md index 977b17c89e..e06b4967cf 100644 --- a/node_modules/es6-promise/CHANGELOG.md +++ b/node_modules/es6-promise/CHANGELOG.md @@ -1,43 +1,9 @@ -# master - -# 2.0.4 - -* Fix npm package - -# 2.0.3 - -* Fix useSetTimeout bug - -# 2.0.2 - -* Adding RSVP#rethrow -* add pre-built AMD link to README -* adding promise#fail - -# 2.0.1 -* misc IE fixes, including IE array detection -* upload passing builds to s3 -* async: use three args for addEventListener -* satisfy both 1.0 and 1.1 specs -* Run reduce tests only in node -* RSVP.resolve now simply uses the internal resolution procedure -* prevent multiple promise resolutions -* simplify thenable handling -* pre-allocate the deferred's shape -* Moved from Rake-based builds to Grunt -* Fix Promise subclassing bug -* Add RSVP.configure('onerror') -* Throw exception when RSVP.all is called without an array -* refactor RSVP.all to just use a promise directly -* Make `RSVP.denodeify` pass along `thisArg` -* add RSVP.reject -* Reject promise if resolver function throws an exception -* add travis build-status -* correctly test and fix self fulfillment -* remove promise coercion. -* Fix infinite recursion with deep self fulfilling promises -* doc fixes - -# 2.0.0 - -* No changelog beyond this point. Here be dragons. +# Master + +# 2.0.0 + +* re-sync with RSVP. Many large performance improvements and bugfixes. + +# 1.0.0 + +* first subset of RSVP diff --git a/node_modules/es6-promise/LICENSE b/node_modules/es6-promise/LICENSE index 35599e2a9c..954ec5992d 100644 --- a/node_modules/es6-promise/LICENSE +++ b/node_modules/es6-promise/LICENSE @@ -1,19 +1,19 @@ -Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/es6-promise/README.md b/node_modules/es6-promise/README.md index 09a5f4378e..ca8678e2b9 100644 --- a/node_modules/es6-promise/README.md +++ b/node_modules/es6-promise/README.md @@ -1,52 +1,61 @@ -# ES6-Promises (subset of [rsvp.js](https://github.com/tildeio/rsvp.js)) - -This is a polyfill of [ES6 Promises](https://github.com/domenic/promises-unwrapping). The implementation is a subset of [rsvp.js](https://github.com/tildeio/rsvp.js), if you're wanting extra features and more debugging options, check out the [full library](https://github.com/tildeio/rsvp.js). - -For API details and how to use promises, see the JavaScript Promises HTML5Rocks article. - -## Downloads - -* [promise](http://s3.amazonaws.com/es6-promises/promise-1.0.0.js) -* [promise-min](http://s3.amazonaws.com/es6-promises/promise-1.0.0.min.js) (~2k gzipped) - -## Node.js - -To install: - -```sh -npm install es6-promise -``` - -To use: - -```js -var Promise = require('es6-promise').Promise; -``` - -## Usage in IE<10 - -`catch` is a reserved word in IE<10, meaning `promise.catch(func)` throws a syntax error. To work around this, to a string to access the property: - -```js -promise['catch'](function(err) { - // ... -}); -``` - -Or use `.then` instead: - -```js -promise.then(undefined, function(err) { - // ... -}); -``` - -## Building & Testing - -This package uses the [grunt-microlib](https://github.com/thomasboyt/grunt-microlib) package for building. - -Custom tasks: - -* `grunt test` - Run Mocha tests through Node and PhantomJS. -* `grunt test:phantom` - Run Mocha tests through PhantomJS (browser build). -* `grunt test:node` - Run Mocha tests through Node (CommonJS build). \ No newline at end of file +# ES6-Promise (subset of [rsvp.js](https://github.com/tildeio/rsvp.js)) + +This is a polyfill of the [ES6 Promise](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-constructor). The implementation is a subset of [rsvp.js](https://github.com/tildeio/rsvp.js), if you're wanting extra features and more debugging options, check out the [full library](https://github.com/tildeio/rsvp.js). + +For API details and how to use promises, see the JavaScript Promises HTML5Rocks article. + +## Downloads + +* [es6-promise](https://raw.githubusercontent.com/jakearchibald/es6-promise/master/dist/es6-promise.js) +* [es6-promise-min](https://raw.githubusercontent.com/jakearchibald/es6-promise/master/dist/es6-promise-min.js) + +## Node.js + +To install: + +```sh +npm install es6-promise +``` + +To use: + +```js +var Promise = require('es6-promise').Promise; +``` + +## Usage in IE<9 + +`catch` is a reserved word in IE<9, meaning `promise.catch(func)` throws a syntax error. To work around this, you can use a string to access the property as shown in the following example. + +However, please remember that such technique is already provided by most common minifiers, making the resulting code safe for old browsers and production: + +```js +promise['catch'](function(err) { + // ... +}); +``` + +Or use `.then` instead: + +```js +promise.then(undefined, function(err) { + // ... +}); +``` + +## Auto-polyfill + +To polyfill the global environment (either in Node or in the browser via CommonJS) use the following code snippet: + +```js +require('es6-promise').polyfill(); +``` + +Notice that we don't assign the result of `polyfill()` to any variable. The `polyfill()` method will patch the global environment (in this case to the `Promise` name) when called. + +## Building & Testing + +* `npm run build` to build +* `npm test` to run tests +* `npm start` to run a build watcher, and webserver to test +* `npm run test:server` for a testem test runner and watching builder diff --git a/node_modules/es6-promise/dist/commonjs/main.js b/node_modules/es6-promise/dist/commonjs/main.js deleted file mode 100644 index 2fd7021107..0000000000 --- a/node_modules/es6-promise/dist/commonjs/main.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict"; -var Promise = require("./promise/promise").Promise; -var polyfill = require("./promise/polyfill").polyfill; -exports.Promise = Promise; -exports.polyfill = polyfill; \ No newline at end of file diff --git a/node_modules/es6-promise/dist/commonjs/promise/all.js b/node_modules/es6-promise/dist/commonjs/promise/all.js deleted file mode 100644 index 86ccd1e50f..0000000000 --- a/node_modules/es6-promise/dist/commonjs/promise/all.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; -/* global toString */ - -var isArray = require("./utils").isArray; -var isFunction = require("./utils").isFunction; - -/** - Returns a promise that is fulfilled when all the given promises have been - fulfilled, or rejected if any of them become rejected. The return promise - is fulfilled with an array that gives all the values in the order they were - passed in the `promises` array argument. - - Example: - - ```javascript - var promise1 = RSVP.resolve(1); - var promise2 = RSVP.resolve(2); - var promise3 = RSVP.resolve(3); - var promises = [ promise1, promise2, promise3 ]; - - RSVP.all(promises).then(function(array){ - // The array here would be [ 1, 2, 3 ]; - }); - ``` - - If any of the `promises` given to `RSVP.all` are rejected, the first promise - that is rejected will be given as an argument to the returned promises's - rejection handler. For example: - - Example: - - ```javascript - var promise1 = RSVP.resolve(1); - var promise2 = RSVP.reject(new Error("2")); - var promise3 = RSVP.reject(new Error("3")); - var promises = [ promise1, promise2, promise3 ]; - - RSVP.all(promises).then(function(array){ - // Code here never runs because there are rejected promises! - }, function(error) { - // error.message === "2" - }); - ``` - - @method all - @for RSVP - @param {Array} promises - @param {String} label - @return {Promise} promise that is fulfilled when all `promises` have been - fulfilled, or rejected if any of them become rejected. -*/ -function all(promises) { - /*jshint validthis:true */ - var Promise = this; - - if (!isArray(promises)) { - throw new TypeError('You must pass an array to all.'); - } - - return new Promise(function(resolve, reject) { - var results = [], remaining = promises.length, - promise; - - if (remaining === 0) { - resolve([]); - } - - function resolver(index) { - return function(value) { - resolveAll(index, value); - }; - } - - function resolveAll(index, value) { - results[index] = value; - if (--remaining === 0) { - resolve(results); - } - } - - for (var i = 0; i < promises.length; i++) { - promise = promises[i]; - - if (promise && isFunction(promise.then)) { - promise.then(resolver(i), reject); - } else { - resolveAll(i, promise); - } - } - }); -} - -exports.all = all; \ No newline at end of file diff --git a/node_modules/es6-promise/dist/commonjs/promise/asap.js b/node_modules/es6-promise/dist/commonjs/promise/asap.js deleted file mode 100644 index a57575d312..0000000000 --- a/node_modules/es6-promise/dist/commonjs/promise/asap.js +++ /dev/null @@ -1,61 +0,0 @@ -"use strict"; -var browserGlobal = (typeof window !== 'undefined') ? window : {}; -var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; -var local = (typeof global !== 'undefined') ? global : (this === undefined? window:this); - -// node -function useNextTick() { - return function() { - process.nextTick(flush); - }; -} - -function useMutationObserver() { - var iterations = 0; - var observer = new BrowserMutationObserver(flush); - var node = document.createTextNode(''); - observer.observe(node, { characterData: true }); - - return function() { - node.data = (iterations = ++iterations % 2); - }; -} - -function useSetTimeout() { - return function() { - local.setTimeout(flush, 1); - }; -} - -var queue = []; -function flush() { - for (var i = 0; i < queue.length; i++) { - var tuple = queue[i]; - var callback = tuple[0], arg = tuple[1]; - callback(arg); - } - queue = []; -} - -var scheduleFlush; - -// Decide what async method to use to triggering processing of queued callbacks: -if (typeof process !== 'undefined' && {}.toString.call(process) === '[object process]') { - scheduleFlush = useNextTick(); -} else if (BrowserMutationObserver) { - scheduleFlush = useMutationObserver(); -} else { - scheduleFlush = useSetTimeout(); -} - -function asap(callback, arg) { - var length = queue.push([callback, arg]); - if (length === 1) { - // If length is 1, that means that we need to schedule an async flush. - // If additional callbacks are queued before the queue is flushed, they - // will be processed by this flush that we are scheduling. - scheduleFlush(); - } -} - -exports.asap = asap; \ No newline at end of file diff --git a/node_modules/es6-promise/dist/commonjs/promise/config.js b/node_modules/es6-promise/dist/commonjs/promise/config.js deleted file mode 100644 index 1e73f4604b..0000000000 --- a/node_modules/es6-promise/dist/commonjs/promise/config.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -var config = { - instrument: false -}; - -function configure(name, value) { - if (arguments.length === 2) { - config[name] = value; - } else { - return config[name]; - } -} - -exports.config = config; -exports.configure = configure; \ No newline at end of file diff --git a/node_modules/es6-promise/dist/commonjs/promise/polyfill.js b/node_modules/es6-promise/dist/commonjs/promise/polyfill.js deleted file mode 100644 index da5c309981..0000000000 --- a/node_modules/es6-promise/dist/commonjs/promise/polyfill.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -/*global self*/ -var RSVPPromise = require("./promise").Promise; -var isFunction = require("./utils").isFunction; - -function polyfill() { - var local; - - if (typeof global !== 'undefined') { - local = global; - } else if (typeof window !== 'undefined' && window.document) { - local = window; - } else { - local = self; - } - - var es6PromiseSupport = - "Promise" in local && - // Some of these methods are missing from - // Firefox/Chrome experimental implementations - "resolve" in local.Promise && - "reject" in local.Promise && - "all" in local.Promise && - "race" in local.Promise && - // Older version of the spec had a resolver object - // as the arg rather than a function - (function() { - var resolve; - new local.Promise(function(r) { resolve = r; }); - return isFunction(resolve); - }()); - - if (!es6PromiseSupport) { - local.Promise = RSVPPromise; - } -} - -exports.polyfill = polyfill; \ No newline at end of file diff --git a/node_modules/es6-promise/dist/commonjs/promise/promise.js b/node_modules/es6-promise/dist/commonjs/promise/promise.js deleted file mode 100644 index 7fc04fa894..0000000000 --- a/node_modules/es6-promise/dist/commonjs/promise/promise.js +++ /dev/null @@ -1,211 +0,0 @@ -"use strict"; -var config = require("./config").config; -var configure = require("./config").configure; -var objectOrFunction = require("./utils").objectOrFunction; -var isFunction = require("./utils").isFunction; -var now = require("./utils").now; -var all = require("./all").all; -var race = require("./race").race; -var staticResolve = require("./resolve").resolve; -var staticReject = require("./reject").reject; -var asap = require("./asap").asap; - -var counter = 0; - -config.async = asap; // default async is asap; - -function Promise(resolver) { - if (!isFunction(resolver)) { - throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); - } - - if (!(this instanceof Promise)) { - throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); - } - - this._subscribers = []; - - invokeResolver(resolver, this); -} - -function invokeResolver(resolver, promise) { - function resolvePromise(value) { - resolve(promise, value); - } - - function rejectPromise(reason) { - reject(promise, reason); - } - - try { - resolver(resolvePromise, rejectPromise); - } catch(e) { - rejectPromise(e); - } -} - -function invokeCallback(settled, promise, callback, detail) { - var hasCallback = isFunction(callback), - value, error, succeeded, failed; - - if (hasCallback) { - try { - value = callback(detail); - succeeded = true; - } catch(e) { - failed = true; - error = e; - } - } else { - value = detail; - succeeded = true; - } - - if (handleThenable(promise, value)) { - return; - } else if (hasCallback && succeeded) { - resolve(promise, value); - } else if (failed) { - reject(promise, error); - } else if (settled === FULFILLED) { - resolve(promise, value); - } else if (settled === REJECTED) { - reject(promise, value); - } -} - -var PENDING = void 0; -var SEALED = 0; -var FULFILLED = 1; -var REJECTED = 2; - -function subscribe(parent, child, onFulfillment, onRejection) { - var subscribers = parent._subscribers; - var length = subscribers.length; - - subscribers[length] = child; - subscribers[length + FULFILLED] = onFulfillment; - subscribers[length + REJECTED] = onRejection; -} - -function publish(promise, settled) { - var child, callback, subscribers = promise._subscribers, detail = promise._detail; - - for (var i = 0; i < subscribers.length; i += 3) { - child = subscribers[i]; - callback = subscribers[i + settled]; - - invokeCallback(settled, child, callback, detail); - } - - promise._subscribers = null; -} - -Promise.prototype = { - constructor: Promise, - - _state: undefined, - _detail: undefined, - _subscribers: undefined, - - then: function(onFulfillment, onRejection) { - var promise = this; - - var thenPromise = new this.constructor(function() {}); - - if (this._state) { - var callbacks = arguments; - config.async(function invokePromiseCallback() { - invokeCallback(promise._state, thenPromise, callbacks[promise._state - 1], promise._detail); - }); - } else { - subscribe(this, thenPromise, onFulfillment, onRejection); - } - - return thenPromise; - }, - - 'catch': function(onRejection) { - return this.then(null, onRejection); - } -}; - -Promise.all = all; -Promise.race = race; -Promise.resolve = staticResolve; -Promise.reject = staticReject; - -function handleThenable(promise, value) { - var then = null, - resolved; - - try { - if (promise === value) { - throw new TypeError("A promises callback cannot return that same promise."); - } - - if (objectOrFunction(value)) { - then = value.then; - - if (isFunction(then)) { - then.call(value, function(val) { - if (resolved) { return true; } - resolved = true; - - if (value !== val) { - resolve(promise, val); - } else { - fulfill(promise, val); - } - }, function(val) { - if (resolved) { return true; } - resolved = true; - - reject(promise, val); - }); - - return true; - } - } - } catch (error) { - if (resolved) { return true; } - reject(promise, error); - return true; - } - - return false; -} - -function resolve(promise, value) { - if (promise === value) { - fulfill(promise, value); - } else if (!handleThenable(promise, value)) { - fulfill(promise, value); - } -} - -function fulfill(promise, value) { - if (promise._state !== PENDING) { return; } - promise._state = SEALED; - promise._detail = value; - - config.async(publishFulfillment, promise); -} - -function reject(promise, reason) { - if (promise._state !== PENDING) { return; } - promise._state = SEALED; - promise._detail = reason; - - config.async(publishRejection, promise); -} - -function publishFulfillment(promise) { - publish(promise, promise._state = FULFILLED); -} - -function publishRejection(promise) { - publish(promise, promise._state = REJECTED); -} - -exports.Promise = Promise; \ No newline at end of file diff --git a/node_modules/es6-promise/dist/commonjs/promise/race.js b/node_modules/es6-promise/dist/commonjs/promise/race.js deleted file mode 100644 index 9a21f873bd..0000000000 --- a/node_modules/es6-promise/dist/commonjs/promise/race.js +++ /dev/null @@ -1,89 +0,0 @@ -"use strict"; -/* global toString */ -var isArray = require("./utils").isArray; - -/** - `RSVP.race` allows you to watch a series of promises and act as soon as the - first promise given to the `promises` argument fulfills or rejects. - - Example: - - ```javascript - var promise1 = new RSVP.Promise(function(resolve, reject){ - setTimeout(function(){ - resolve("promise 1"); - }, 200); - }); - - var promise2 = new RSVP.Promise(function(resolve, reject){ - setTimeout(function(){ - resolve("promise 2"); - }, 100); - }); - - RSVP.race([promise1, promise2]).then(function(result){ - // result === "promise 2" because it was resolved before promise1 - // was resolved. - }); - ``` - - `RSVP.race` is deterministic in that only the state of the first completed - promise matters. For example, even if other promises given to the `promises` - array argument are resolved, but the first completed promise has become - rejected before the other promises became fulfilled, the returned promise - will become rejected: - - ```javascript - var promise1 = new RSVP.Promise(function(resolve, reject){ - setTimeout(function(){ - resolve("promise 1"); - }, 200); - }); - - var promise2 = new RSVP.Promise(function(resolve, reject){ - setTimeout(function(){ - reject(new Error("promise 2")); - }, 100); - }); - - RSVP.race([promise1, promise2]).then(function(result){ - // Code here never runs because there are rejected promises! - }, function(reason){ - // reason.message === "promise2" because promise 2 became rejected before - // promise 1 became fulfilled - }); - ``` - - @method race - @for RSVP - @param {Array} promises array of promises to observe - @param {String} label optional string for describing the promise returned. - Useful for tooling. - @return {Promise} a promise that becomes fulfilled with the value the first - completed promises is resolved with if the first completed promise was - fulfilled, or rejected with the reason that the first completed promise - was rejected with. -*/ -function race(promises) { - /*jshint validthis:true */ - var Promise = this; - - if (!isArray(promises)) { - throw new TypeError('You must pass an array to race.'); - } - return new Promise(function(resolve, reject) { - var results = [], promise; - - for (var i = 0; i < promises.length; i++) { - promise = promises[i]; - - if (promise && typeof promise.then === 'function') { - promise.then(resolve, reject); - } else { - resolve(promise); - } - } - }); -} - -exports.race = race; \ No newline at end of file diff --git a/node_modules/es6-promise/dist/commonjs/promise/reject.js b/node_modules/es6-promise/dist/commonjs/promise/reject.js deleted file mode 100644 index d8e90c517f..0000000000 --- a/node_modules/es6-promise/dist/commonjs/promise/reject.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; -/** - `RSVP.reject` returns a promise that will become rejected with the passed - `reason`. `RSVP.reject` is essentially shorthand for the following: - - ```javascript - var promise = new RSVP.Promise(function(resolve, reject){ - reject(new Error('WHOOPS')); - }); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - Instead of writing the above, your code now simply becomes the following: - - ```javascript - var promise = RSVP.reject(new Error('WHOOPS')); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - @method reject - @for RSVP - @param {Any} reason value that the returned promise will be rejected with. - @param {String} label optional string for identifying the returned promise. - Useful for tooling. - @return {Promise} a promise that will become rejected with the given - `reason`. -*/ -function reject(reason) { - /*jshint validthis:true */ - var Promise = this; - - return new Promise(function (resolve, reject) { - reject(reason); - }); -} - -exports.reject = reject; \ No newline at end of file diff --git a/node_modules/es6-promise/dist/commonjs/promise/resolve.js b/node_modules/es6-promise/dist/commonjs/promise/resolve.js deleted file mode 100644 index 930fd00d3c..0000000000 --- a/node_modules/es6-promise/dist/commonjs/promise/resolve.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -function resolve(value) { - /*jshint validthis:true */ - if (value && typeof value === 'object' && value.constructor === this) { - return value; - } - - var Promise = this; - - return new Promise(function(resolve) { - resolve(value); - }); -} - -exports.resolve = resolve; \ No newline at end of file diff --git a/node_modules/es6-promise/dist/commonjs/promise/utils.js b/node_modules/es6-promise/dist/commonjs/promise/utils.js deleted file mode 100644 index 7791c2b2b4..0000000000 --- a/node_modules/es6-promise/dist/commonjs/promise/utils.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -function objectOrFunction(x) { - return isFunction(x) || (typeof x === "object" && x !== null); -} - -function isFunction(x) { - return typeof x === "function"; -} - -function isArray(x) { - return Object.prototype.toString.call(x) === "[object Array]"; -} - -// Date.now is not available in browsers < IE9 -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now#Compatibility -var now = Date.now || function() { return new Date().getTime(); }; - - -exports.objectOrFunction = objectOrFunction; -exports.isFunction = isFunction; -exports.isArray = isArray; -exports.now = now; \ No newline at end of file diff --git a/node_modules/es6-promise/dist/es6-promise.js b/node_modules/es6-promise/dist/es6-promise.js new file mode 100644 index 0000000000..308f3acb2d --- /dev/null +++ b/node_modules/es6-promise/dist/es6-promise.js @@ -0,0 +1,957 @@ +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE + * @version 2.1.1 + */ + +(function() { + "use strict"; + function lib$es6$promise$utils$$objectOrFunction(x) { + return typeof x === 'function' || (typeof x === 'object' && x !== null); + } + + function lib$es6$promise$utils$$isFunction(x) { + return typeof x === 'function'; + } + + function lib$es6$promise$utils$$isMaybeThenable(x) { + return typeof x === 'object' && x !== null; + } + + var lib$es6$promise$utils$$_isArray; + if (!Array.isArray) { + lib$es6$promise$utils$$_isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } else { + lib$es6$promise$utils$$_isArray = Array.isArray; + } + + var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; + var lib$es6$promise$asap$$len = 0; + var lib$es6$promise$asap$$toString = {}.toString; + var lib$es6$promise$asap$$vertxNext; + function lib$es6$promise$asap$$asap(callback, arg) { + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; + lib$es6$promise$asap$$len += 2; + if (lib$es6$promise$asap$$len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + lib$es6$promise$asap$$scheduleFlush(); + } + } + + var lib$es6$promise$asap$$default = lib$es6$promise$asap$$asap; + + var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; + var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; + var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; + var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && + typeof importScripts !== 'undefined' && + typeof MessageChannel !== 'undefined'; + + // node + function lib$es6$promise$asap$$useNextTick() { + var nextTick = process.nextTick; + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // setImmediate should be used instead instead + var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); + if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { + nextTick = setImmediate; + } + return function() { + nextTick(lib$es6$promise$asap$$flush); + }; + } + + // vertx + function lib$es6$promise$asap$$useVertxTimer() { + return function() { + lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); + }; + } + + function lib$es6$promise$asap$$useMutationObserver() { + var iterations = 0; + var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function() { + node.data = (iterations = ++iterations % 2); + }; + } + + // web worker + function lib$es6$promise$asap$$useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = lib$es6$promise$asap$$flush; + return function () { + channel.port2.postMessage(0); + }; + } + + function lib$es6$promise$asap$$useSetTimeout() { + return function() { + setTimeout(lib$es6$promise$asap$$flush, 1); + }; + } + + var lib$es6$promise$asap$$queue = new Array(1000); + function lib$es6$promise$asap$$flush() { + for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { + var callback = lib$es6$promise$asap$$queue[i]; + var arg = lib$es6$promise$asap$$queue[i+1]; + + callback(arg); + + lib$es6$promise$asap$$queue[i] = undefined; + lib$es6$promise$asap$$queue[i+1] = undefined; + } + + lib$es6$promise$asap$$len = 0; + } + + function lib$es6$promise$asap$$attemptVertex() { + try { + var r = require; + var vertx = r('vertx'); + lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; + return lib$es6$promise$asap$$useVertxTimer(); + } catch(e) { + return lib$es6$promise$asap$$useSetTimeout(); + } + } + + var lib$es6$promise$asap$$scheduleFlush; + // Decide what async method to use to triggering processing of queued callbacks: + if (lib$es6$promise$asap$$isNode) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); + } else if (lib$es6$promise$asap$$BrowserMutationObserver) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); + } else if (lib$es6$promise$asap$$isWorker) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); + } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); + } else { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); + } + + function lib$es6$promise$$internal$$noop() {} + + var lib$es6$promise$$internal$$PENDING = void 0; + var lib$es6$promise$$internal$$FULFILLED = 1; + var lib$es6$promise$$internal$$REJECTED = 2; + + var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$selfFullfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function lib$es6$promise$$internal$$cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function lib$es6$promise$$internal$$getThen(promise) { + try { + return promise.then; + } catch(error) { + lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; + return lib$es6$promise$$internal$$GET_THEN_ERROR; + } + } + + function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch(e) { + return e; + } + } + + function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { + lib$es6$promise$asap$$default(function(promise) { + var sealed = false; + var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { + if (sealed) { return; } + sealed = true; + if (thenable !== value) { + lib$es6$promise$$internal$$resolve(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + }, function(reason) { + if (sealed) { return; } + sealed = true; + + lib$es6$promise$$internal$$reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + lib$es6$promise$$internal$$reject(promise, error); + } + }, promise); + } + + function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { + if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, thenable._result); + } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, thenable._result); + } else { + lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { + lib$es6$promise$$internal$$resolve(promise, value); + }, function(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } + } + + function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { + if (maybeThenable.constructor === promise.constructor) { + lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); + } else { + var then = lib$es6$promise$$internal$$getThen(maybeThenable); + + if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); + } else if (then === undefined) { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } else if (lib$es6$promise$utils$$isFunction(then)) { + lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); + } else { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } + } + } + + function lib$es6$promise$$internal$$resolve(promise, value) { + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); + } else if (lib$es6$promise$utils$$objectOrFunction(value)) { + lib$es6$promise$$internal$$handleMaybeThenable(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + } + + function lib$es6$promise$$internal$$publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + lib$es6$promise$$internal$$publish(promise); + } + + function lib$es6$promise$$internal$$fulfill(promise, value) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + + promise._result = value; + promise._state = lib$es6$promise$$internal$$FULFILLED; + + if (promise._subscribers.length !== 0) { + lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, promise); + } + } + + function lib$es6$promise$$internal$$reject(promise, reason) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + promise._state = lib$es6$promise$$internal$$REJECTED; + promise._result = reason; + + lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publishRejection, promise); + } + + function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { + var subscribers = parent._subscribers; + var length = subscribers.length; + + parent._onerror = null; + + subscribers[length] = child; + subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; + subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; + + if (length === 0 && parent._state) { + lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, parent); + } + } + + function lib$es6$promise$$internal$$publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { return; } + + var child, callback, detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function lib$es6$promise$$internal$$ErrorObject() { + this.error = null; + } + + var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$tryCatch(callback, detail) { + try { + return callback(detail); + } catch(e) { + lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; + return lib$es6$promise$$internal$$TRY_CATCH_ERROR; + } + } + + function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { + var hasCallback = lib$es6$promise$utils$$isFunction(callback), + value, error, succeeded, failed; + + if (hasCallback) { + value = lib$es6$promise$$internal$$tryCatch(callback, detail); + + if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value = null; + } else { + succeeded = true; + } + + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); + return; + } + + } else { + value = detail; + succeeded = true; + } + + if (promise._state !== lib$es6$promise$$internal$$PENDING) { + // noop + } else if (hasCallback && succeeded) { + lib$es6$promise$$internal$$resolve(promise, value); + } else if (failed) { + lib$es6$promise$$internal$$reject(promise, error); + } else if (settled === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, value); + } else if (settled === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } + } + + function lib$es6$promise$$internal$$initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value){ + lib$es6$promise$$internal$$resolve(promise, value); + }, function rejectPromise(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } catch(e) { + lib$es6$promise$$internal$$reject(promise, e); + } + } + + function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { + var enumerator = this; + + enumerator._instanceConstructor = Constructor; + enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (enumerator._validateInput(input)) { + enumerator._input = input; + enumerator.length = input.length; + enumerator._remaining = input.length; + + enumerator._init(); + + if (enumerator.length === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } else { + enumerator.length = enumerator.length || 0; + enumerator._enumerate(); + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } + } + } else { + lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); + } + } + + lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { + return lib$es6$promise$utils$$isArray(input); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { + return new Error('Array Methods must be provided an Array'); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { + this._result = new Array(this.length); + }; + + var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; + + lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { + var enumerator = this; + + var length = enumerator.length; + var promise = enumerator.promise; + var input = enumerator._input; + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + enumerator._eachEntry(input[i], i); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { + var enumerator = this; + var c = enumerator._instanceConstructor; + + if (lib$es6$promise$utils$$isMaybeThenable(entry)) { + if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { + entry._onerror = null; + enumerator._settledAt(entry._state, i, entry._result); + } else { + enumerator._willSettleAt(c.resolve(entry), i); + } + } else { + enumerator._remaining--; + enumerator._result[i] = entry; + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { + var enumerator = this; + var promise = enumerator.promise; + + if (promise._state === lib$es6$promise$$internal$$PENDING) { + enumerator._remaining--; + + if (state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } else { + enumerator._result[i] = value; + } + } + + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(promise, enumerator._result); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { + var enumerator = this; + + lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { + enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); + }, function(reason) { + enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); + }); + }; + function lib$es6$promise$promise$all$$all(entries) { + return new lib$es6$promise$enumerator$$default(this, entries).promise; + } + var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; + function lib$es6$promise$promise$race$$race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (!lib$es6$promise$utils$$isArray(entries)) { + lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); + return promise; + } + + var length = entries.length; + + function onFulfillment(value) { + lib$es6$promise$$internal$$resolve(promise, value); + } + + function onRejection(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + } + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); + } + + return promise; + } + var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; + function lib$es6$promise$promise$resolve$$resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$resolve(promise, object); + return promise; + } + var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; + function lib$es6$promise$promise$reject$$reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$reject(promise, reason); + return promise; + } + var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; + + var lib$es6$promise$promise$$counter = 0; + + function lib$es6$promise$promise$$needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function lib$es6$promise$promise$$needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise’s eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + var promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + var xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor + */ + function lib$es6$promise$promise$$Promise(resolver) { + this._id = lib$es6$promise$promise$$counter++; + this._state = undefined; + this._result = undefined; + this._subscribers = []; + + if (lib$es6$promise$$internal$$noop !== resolver) { + if (!lib$es6$promise$utils$$isFunction(resolver)) { + lib$es6$promise$promise$$needsResolver(); + } + + if (!(this instanceof lib$es6$promise$promise$$Promise)) { + lib$es6$promise$promise$$needsNew(); + } + + lib$es6$promise$$internal$$initializePromise(this, resolver); + } + } + + lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; + lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; + lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; + lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; + + lib$es6$promise$promise$$Promise.prototype = { + constructor: lib$es6$promise$promise$$Promise, + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + var result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + var author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + then: function(onFulfillment, onRejection) { + var parent = this; + var state = parent._state; + + if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { + return this; + } + + var child = new this.constructor(lib$es6$promise$$internal$$noop); + var result = parent._result; + + if (state) { + var callback = arguments[state - 1]; + lib$es6$promise$asap$$default(function(){ + lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); + }); + } else { + lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + }, + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + 'catch': function(onRejection) { + return this.then(null, onRejection); + } + }; + function lib$es6$promise$polyfill$$polyfill() { + var local; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { + return; + } + + local.Promise = lib$es6$promise$promise$$default; + } + var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; + + var lib$es6$promise$umd$$ES6Promise = { + 'Promise': lib$es6$promise$promise$$default, + 'polyfill': lib$es6$promise$polyfill$$default + }; + + /* global define:true module:true window: true */ + if (typeof define === 'function' && define['amd']) { + define(function() { return lib$es6$promise$umd$$ES6Promise; }); + } else if (typeof module !== 'undefined' && module['exports']) { + module['exports'] = lib$es6$promise$umd$$ES6Promise; + } else if (typeof this !== 'undefined') { + this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; + } + + lib$es6$promise$polyfill$$default(); +}).call(this); + diff --git a/node_modules/es6-promise/dist/es6-promise.min.js b/node_modules/es6-promise/dist/es6-promise.min.js new file mode 100644 index 0000000000..0552e12e17 --- /dev/null +++ b/node_modules/es6-promise/dist/es6-promise.min.js @@ -0,0 +1,9 @@ +/*! + * @overview es6-promise - a tiny implementation of Promises/A+. + * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) + * @license Licensed under MIT license + * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE + * @version 2.1.1 + */ + +(function(){"use strict";function lib$es6$promise$utils$$objectOrFunction(x){return typeof x==="function"||typeof x==="object"&&x!==null}function lib$es6$promise$utils$$isFunction(x){return typeof x==="function"}function lib$es6$promise$utils$$isMaybeThenable(x){return typeof x==="object"&&x!==null}var lib$es6$promise$utils$$_isArray;if(!Array.isArray){lib$es6$promise$utils$$_isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}}else{lib$es6$promise$utils$$_isArray=Array.isArray}var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;var lib$es6$promise$asap$$len=0;var lib$es6$promise$asap$$toString={}.toString;var lib$es6$promise$asap$$vertxNext;function lib$es6$promise$asap$$asap(callback,arg){lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;lib$es6$promise$asap$$len+=2;if(lib$es6$promise$asap$$len===2){lib$es6$promise$asap$$scheduleFlush()}}var lib$es6$promise$asap$$default=lib$es6$promise$asap$$asap;var lib$es6$promise$asap$$browserWindow=typeof window!=="undefined"?window:undefined;var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow||{};var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver||lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;var lib$es6$promise$asap$$isNode=typeof process!=="undefined"&&{}.toString.call(process)==="[object process]";var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function lib$es6$promise$asap$$useNextTick(){var nextTick=process.nextTick;var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);if(Array.isArray(version)&&version[1]==="0"&&version[2]==="10"){nextTick=setImmediate}return function(){nextTick(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useVertxTimer(){return function(){lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useMutationObserver(){var iterations=0;var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);var node=document.createTextNode("");observer.observe(node,{characterData:true});return function(){node.data=iterations=++iterations%2}}function lib$es6$promise$asap$$useMessageChannel(){var channel=new MessageChannel;channel.port1.onmessage=lib$es6$promise$asap$$flush;return function(){channel.port2.postMessage(0)}}function lib$es6$promise$asap$$useSetTimeout(){return function(){setTimeout(lib$es6$promise$asap$$flush,1)}}var lib$es6$promise$asap$$queue=new Array(1e3);function lib$es6$promise$asap$$flush(){for(var i=0;ie;e++){var g=c[e];if(".."===g)d.pop();else{if("."===g)continue;d.push(g)}}return d.join("/")}if(d._eak_seen=e,f[a])return f[a];if(f[a]={},!e[a])throw new Error("Could not find module "+a);for(var g,h=e[a],i=h.deps,j=h.callback,k=[],l=0,m=i.length;m>l;l++)"exports"===i[l]?k.push(g={}):k.push(b(c(i[l])));var n=j.apply(this,k);return f[a]=g||n}}(),a("promise/all",["./utils","exports"],function(a,b){"use strict";function c(a){var b=this;if(!d(a))throw new TypeError("You must pass an array to all.");return new b(function(b,c){function d(a){return function(b){f(a,b)}}function f(a,c){h[a]=c,0===--i&&b(h)}var g,h=[],i=a.length;0===i&&b([]);for(var j=0;j +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the 'Software'), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +// when used in node, this will actually load the util module we depend on +// versus loading the builtin util module as happens otherwise +// this is a bug in node module loading as far as I am concerned +var util = require('util/'); + +var pSlice = Array.prototype.slice; +var hasOwn = Object.prototype.hasOwnProperty; + +// 1. The assert module provides functions that throw +// AssertionError's when particular conditions are not met. The +// assert module must conform to the following interface. + +var assert = module.exports = ok; + +// 2. The AssertionError is defined in assert. +// new assert.AssertionError({ message: message, +// actual: actual, +// expected: expected }) + +assert.AssertionError = function AssertionError(options) { + this.name = 'AssertionError'; + this.actual = options.actual; + this.expected = options.expected; + this.operator = options.operator; + if (options.message) { + this.message = options.message; + this.generatedMessage = false; + } else { + this.message = getMessage(this); + this.generatedMessage = true; + } + var stackStartFunction = options.stackStartFunction || fail; + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, stackStartFunction); + } + else { + // non v8 browsers so we can have a stacktrace + var err = new Error(); + if (err.stack) { + var out = err.stack; + + // try to strip useless frames + var fn_name = stackStartFunction.name; + var idx = out.indexOf('\n' + fn_name); + if (idx >= 0) { + // once we have located the function frame + // we need to strip out everything before it (and its line) + var next_line = out.indexOf('\n', idx + 1); + out = out.substring(next_line + 1); + } + + this.stack = out; + } + } +}; + +// assert.AssertionError instanceof Error +util.inherits(assert.AssertionError, Error); + +function replacer(key, value) { + if (util.isUndefined(value)) { + return '' + value; + } + if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) { + return value.toString(); + } + if (util.isFunction(value) || util.isRegExp(value)) { + return value.toString(); + } + return value; +} + +function truncate(s, n) { + if (util.isString(s)) { + return s.length < n ? s : s.slice(0, n); + } else { + return s; + } +} + +function getMessage(self) { + return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + + self.operator + ' ' + + truncate(JSON.stringify(self.expected, replacer), 128); +} + +// At present only the three keys mentioned above are used and +// understood by the spec. Implementations or sub modules can pass +// other keys to the AssertionError's constructor - they will be +// ignored. + +// 3. All of the following functions must throw an AssertionError +// when a corresponding condition is not met, with a message that +// may be undefined if not provided. All assertion methods provide +// both the actual and expected values to the assertion error for +// display purposes. + +function fail(actual, expected, message, operator, stackStartFunction) { + throw new assert.AssertionError({ + message: message, + actual: actual, + expected: expected, + operator: operator, + stackStartFunction: stackStartFunction + }); +} + +// EXTENSION! allows for well behaved errors defined elsewhere. +assert.fail = fail; + +// 4. Pure assertion tests whether a value is truthy, as determined +// by !!guard. +// assert.ok(guard, message_opt); +// This statement is equivalent to assert.equal(true, !!guard, +// message_opt);. To test strictly for the value true, use +// assert.strictEqual(true, guard, message_opt);. + +function ok(value, message) { + if (!value) fail(value, true, message, '==', assert.ok); +} +assert.ok = ok; + +// 5. The equality assertion tests shallow, coercive equality with +// ==. +// assert.equal(actual, expected, message_opt); + +assert.equal = function equal(actual, expected, message) { + if (actual != expected) fail(actual, expected, message, '==', assert.equal); +}; + +// 6. The non-equality assertion tests for whether two objects are not equal +// with != assert.notEqual(actual, expected, message_opt); + +assert.notEqual = function notEqual(actual, expected, message) { + if (actual == expected) { + fail(actual, expected, message, '!=', assert.notEqual); + } +}; + +// 7. The equivalence assertion tests a deep equality relation. +// assert.deepEqual(actual, expected, message_opt); + +assert.deepEqual = function deepEqual(actual, expected, message) { + if (!_deepEqual(actual, expected)) { + fail(actual, expected, message, 'deepEqual', assert.deepEqual); + } +}; + +function _deepEqual(actual, expected) { + // 7.1. All identical values are equivalent, as determined by ===. + if (actual === expected) { + return true; + + } else if (util.isBuffer(actual) && util.isBuffer(expected)) { + if (actual.length != expected.length) return false; + + for (var i = 0; i < actual.length; i++) { + if (actual[i] !== expected[i]) return false; + } + + return true; + + // 7.2. If the expected value is a Date object, the actual value is + // equivalent if it is also a Date object that refers to the same time. + } else if (util.isDate(actual) && util.isDate(expected)) { + return actual.getTime() === expected.getTime(); + + // 7.3 If the expected value is a RegExp object, the actual value is + // equivalent if it is also a RegExp object with the same source and + // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). + } else if (util.isRegExp(actual) && util.isRegExp(expected)) { + return actual.source === expected.source && + actual.global === expected.global && + actual.multiline === expected.multiline && + actual.lastIndex === expected.lastIndex && + actual.ignoreCase === expected.ignoreCase; + + // 7.4. Other pairs that do not both pass typeof value == 'object', + // equivalence is determined by ==. + } else if (!util.isObject(actual) && !util.isObject(expected)) { + return actual == expected; + + // 7.5 For all other Object pairs, including Array objects, equivalence is + // determined by having the same number of owned properties (as verified + // with Object.prototype.hasOwnProperty.call), the same set of keys + // (although not necessarily the same order), equivalent values for every + // corresponding key, and an identical 'prototype' property. Note: this + // accounts for both named and indexed properties on Arrays. + } else { + return objEquiv(actual, expected); + } +} + +function isArguments(object) { + return Object.prototype.toString.call(object) == '[object Arguments]'; +} + +function objEquiv(a, b) { + if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) + return false; + // an identical 'prototype' property. + if (a.prototype !== b.prototype) return false; + //~~~I've managed to break Object.keys through screwy arguments passing. + // Converting to array solves the problem. + if (isArguments(a)) { + if (!isArguments(b)) { + return false; + } + a = pSlice.call(a); + b = pSlice.call(b); + return _deepEqual(a, b); + } + try { + var ka = objectKeys(a), + kb = objectKeys(b), + key, i; + } catch (e) {//happens when one is a string literal and the other isn't + return false; + } + // having the same number of owned properties (keys incorporates + // hasOwnProperty) + if (ka.length != kb.length) + return false; + //the same set of keys (although not necessarily the same order), + ka.sort(); + kb.sort(); + //~~~cheap key test + for (i = ka.length - 1; i >= 0; i--) { + if (ka[i] != kb[i]) + return false; + } + //equivalent values for every corresponding key, and + //~~~possibly expensive deep test + for (i = ka.length - 1; i >= 0; i--) { + key = ka[i]; + if (!_deepEqual(a[key], b[key])) return false; + } + return true; +} + +// 8. The non-equivalence assertion tests for any deep inequality. +// assert.notDeepEqual(actual, expected, message_opt); + +assert.notDeepEqual = function notDeepEqual(actual, expected, message) { + if (_deepEqual(actual, expected)) { + fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); + } +}; + +// 9. The strict equality assertion tests strict equality, as determined by ===. +// assert.strictEqual(actual, expected, message_opt); + +assert.strictEqual = function strictEqual(actual, expected, message) { + if (actual !== expected) { + fail(actual, expected, message, '===', assert.strictEqual); + } +}; + +// 10. The strict non-equality assertion tests for strict inequality, as +// determined by !==. assert.notStrictEqual(actual, expected, message_opt); + +assert.notStrictEqual = function notStrictEqual(actual, expected, message) { + if (actual === expected) { + fail(actual, expected, message, '!==', assert.notStrictEqual); + } +}; + +function expectedException(actual, expected) { + if (!actual || !expected) { + return false; + } + + if (Object.prototype.toString.call(expected) == '[object RegExp]') { + return expected.test(actual); + } else if (actual instanceof expected) { + return true; + } else if (expected.call({}, actual) === true) { + return true; + } + + return false; +} + +function _throws(shouldThrow, block, expected, message) { + var actual; + + if (util.isString(expected)) { + message = expected; + expected = null; + } + + try { + block(); + } catch (e) { + actual = e; + } + + message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + + (message ? ' ' + message : '.'); + + if (shouldThrow && !actual) { + fail(actual, expected, 'Missing expected exception' + message); + } + + if (!shouldThrow && expectedException(actual, expected)) { + fail(actual, expected, 'Got unwanted exception' + message); + } + + if ((shouldThrow && actual && expected && + !expectedException(actual, expected)) || (!shouldThrow && actual)) { + throw actual; + } +} + +// 11. Expected to throw an error: +// assert.throws(block, Error_opt, message_opt); + +assert.throws = function(block, /*optional*/error, /*optional*/message) { + _throws.apply(this, [true].concat(pSlice.call(arguments))); +}; + +// EXTENSION! This is annoying to write outside this module. +assert.doesNotThrow = function(block, /*optional*/message) { + _throws.apply(this, [false].concat(pSlice.call(arguments))); +}; + +assert.ifError = function(err) { if (err) {throw err;}}; + +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + if (hasOwn.call(obj, key)) keys.push(key); + } + return keys; +}; + +},{"util/":6}],3:[function(require,module,exports){ +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }); + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } +} + +},{}],4:[function(require,module,exports){ +// shim for using process in browser + +var process = module.exports = {}; + +process.nextTick = (function () { + var canSetImmediate = typeof window !== 'undefined' + && window.setImmediate; + var canMutationObserver = typeof window !== 'undefined' + && window.MutationObserver; + var canPost = typeof window !== 'undefined' + && window.postMessage && window.addEventListener + ; + + if (canSetImmediate) { + return function (f) { return window.setImmediate(f) }; + } + + var queue = []; + + if (canMutationObserver) { + var hiddenDiv = document.createElement("div"); + var observer = new MutationObserver(function () { + var queueList = queue.slice(); + queue.length = 0; + queueList.forEach(function (fn) { + fn(); + }); + }); + + observer.observe(hiddenDiv, { attributes: true }); + + return function nextTick(fn) { + if (!queue.length) { + hiddenDiv.setAttribute('yes', 'no'); + } + queue.push(fn); + }; + } + + if (canPost) { + window.addEventListener('message', function (ev) { + var source = ev.source; + if ((source === window || source === null) && ev.data === 'process-tick') { + ev.stopPropagation(); + if (queue.length > 0) { + var fn = queue.shift(); + fn(); + } + } + }, true); + + return function nextTick(fn) { + queue.push(fn); + window.postMessage('process-tick', '*'); + }; + } + + return function nextTick(fn) { + setTimeout(fn, 0); + }; +})(); + +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +// TODO(shtylman) +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; + +},{}],5:[function(require,module,exports){ +module.exports = function isBuffer(arg) { + return arg && typeof arg === 'object' + && typeof arg.copy === 'function' + && typeof arg.fill === 'function' + && typeof arg.readUInt8 === 'function'; +} +},{}],6:[function(require,module,exports){ +(function (process,global){ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var formatRegExp = /%[sdj%]/g; +exports.format = function(f) { + if (!isString(f)) { + var objects = []; + for (var i = 0; i < arguments.length; i++) { + objects.push(inspect(arguments[i])); + } + return objects.join(' '); + } + + var i = 1; + var args = arguments; + var len = args.length; + var str = String(f).replace(formatRegExp, function(x) { + if (x === '%%') return '%'; + if (i >= len) return x; + switch (x) { + case '%s': return String(args[i++]); + case '%d': return Number(args[i++]); + case '%j': + try { + return JSON.stringify(args[i++]); + } catch (_) { + return '[Circular]'; + } + default: + return x; + } + }); + for (var x = args[i]; i < len; x = args[++i]) { + if (isNull(x) || !isObject(x)) { + str += ' ' + x; + } else { + str += ' ' + inspect(x); + } + } + return str; +}; + + +// Mark that a method should not be used. +// Returns a modified function which warns once by default. +// If --no-deprecation is set, then it is a no-op. +exports.deprecate = function(fn, msg) { + // Allow for deprecating things in the process of starting up. + if (isUndefined(global.process)) { + return function() { + return exports.deprecate(fn, msg).apply(this, arguments); + }; + } + + if (process.noDeprecation === true) { + return fn; + } + + var warned = false; + function deprecated() { + if (!warned) { + if (process.throwDeprecation) { + throw new Error(msg); + } else if (process.traceDeprecation) { + console.trace(msg); + } else { + console.error(msg); + } + warned = true; + } + return fn.apply(this, arguments); + } + + return deprecated; +}; + + +var debugs = {}; +var debugEnviron; +exports.debuglog = function(set) { + if (isUndefined(debugEnviron)) + debugEnviron = process.env.NODE_DEBUG || ''; + set = set.toUpperCase(); + if (!debugs[set]) { + if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { + var pid = process.pid; + debugs[set] = function() { + var msg = exports.format.apply(exports, arguments); + console.error('%s %d: %s', set, pid, msg); + }; + } else { + debugs[set] = function() {}; + } + } + return debugs[set]; +}; + + +/** + * Echos the value of a value. Trys to print the value out + * in the best way possible given the different types. + * + * @param {Object} obj The object to print out. + * @param {Object} opts Optional options object that alters the output. + */ +/* legacy: obj, showHidden, depth, colors*/ +function inspect(obj, opts) { + // default options + var ctx = { + seen: [], + stylize: stylizeNoColor + }; + // legacy... + if (arguments.length >= 3) ctx.depth = arguments[2]; + if (arguments.length >= 4) ctx.colors = arguments[3]; + if (isBoolean(opts)) { + // legacy... + ctx.showHidden = opts; + } else if (opts) { + // got an "options" object + exports._extend(ctx, opts); + } + // set default options + if (isUndefined(ctx.showHidden)) ctx.showHidden = false; + if (isUndefined(ctx.depth)) ctx.depth = 2; + if (isUndefined(ctx.colors)) ctx.colors = false; + if (isUndefined(ctx.customInspect)) ctx.customInspect = true; + if (ctx.colors) ctx.stylize = stylizeWithColor; + return formatValue(ctx, obj, ctx.depth); +} +exports.inspect = inspect; + + +// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +inspect.colors = { + '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] +}; + +// Don't use 'blue' not visible on cmd.exe +inspect.styles = { + 'special': 'cyan', + 'number': 'yellow', + 'boolean': 'yellow', + 'undefined': 'grey', + 'null': 'bold', + 'string': 'green', + 'date': 'magenta', + // "name": intentionally not styling + 'regexp': 'red' +}; + + +function stylizeWithColor(str, styleType) { + var style = inspect.styles[styleType]; + + if (style) { + return '\u001b[' + inspect.colors[style][0] + 'm' + str + + '\u001b[' + inspect.colors[style][1] + 'm'; + } else { + return str; + } +} + + +function stylizeNoColor(str, styleType) { + return str; +} + + +function arrayToHash(array) { + var hash = {}; + + array.forEach(function(val, idx) { + hash[val] = true; + }); + + return hash; +} + + +function formatValue(ctx, value, recurseTimes) { + // Provide a hook for user-specified inspect functions. + // Check that value is an object with an inspect function on it + if (ctx.customInspect && + value && + isFunction(value.inspect) && + // Filter out the util module, it's inspect function is special + value.inspect !== exports.inspect && + // Also filter out any prototype objects using the circular check. + !(value.constructor && value.constructor.prototype === value)) { + var ret = value.inspect(recurseTimes, ctx); + if (!isString(ret)) { + ret = formatValue(ctx, ret, recurseTimes); + } + return ret; + } + + // Primitive types cannot have properties + var primitive = formatPrimitive(ctx, value); + if (primitive) { + return primitive; + } + + // Look up the keys of the object. + var keys = Object.keys(value); + var visibleKeys = arrayToHash(keys); + + if (ctx.showHidden) { + keys = Object.getOwnPropertyNames(value); + } + + // IE doesn't make error fields non-enumerable + // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx + if (isError(value) + && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { + return formatError(value); + } + + // Some type of object without properties can be shortcutted. + if (keys.length === 0) { + if (isFunction(value)) { + var name = value.name ? ': ' + value.name : ''; + return ctx.stylize('[Function' + name + ']', 'special'); + } + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } + if (isDate(value)) { + return ctx.stylize(Date.prototype.toString.call(value), 'date'); + } + if (isError(value)) { + return formatError(value); + } + } + + var base = '', array = false, braces = ['{', '}']; + + // Make Array say that they are Array + if (isArray(value)) { + array = true; + braces = ['[', ']']; + } + + // Make functions say that they are functions + if (isFunction(value)) { + var n = value.name ? ': ' + value.name : ''; + base = ' [Function' + n + ']'; + } + + // Make RegExps say that they are RegExps + if (isRegExp(value)) { + base = ' ' + RegExp.prototype.toString.call(value); + } + + // Make dates with properties first say the date + if (isDate(value)) { + base = ' ' + Date.prototype.toUTCString.call(value); + } + + // Make error with message first say the error + if (isError(value)) { + base = ' ' + formatError(value); + } + + if (keys.length === 0 && (!array || value.length == 0)) { + return braces[0] + base + braces[1]; + } + + if (recurseTimes < 0) { + if (isRegExp(value)) { + return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); + } else { + return ctx.stylize('[Object]', 'special'); + } + } + + ctx.seen.push(value); + + var output; + if (array) { + output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); + } else { + output = keys.map(function(key) { + return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); + }); + } + + ctx.seen.pop(); + + return reduceToSingleString(output, base, braces); +} + + +function formatPrimitive(ctx, value) { + if (isUndefined(value)) + return ctx.stylize('undefined', 'undefined'); + if (isString(value)) { + var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') + .replace(/'/g, "\\'") + .replace(/\\"/g, '"') + '\''; + return ctx.stylize(simple, 'string'); + } + if (isNumber(value)) + return ctx.stylize('' + value, 'number'); + if (isBoolean(value)) + return ctx.stylize('' + value, 'boolean'); + // For some reason typeof null is "object", so special case here. + if (isNull(value)) + return ctx.stylize('null', 'null'); +} + + +function formatError(value) { + return '[' + Error.prototype.toString.call(value) + ']'; +} + + +function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { + var output = []; + for (var i = 0, l = value.length; i < l; ++i) { + if (hasOwnProperty(value, String(i))) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + String(i), true)); + } else { + output.push(''); + } + } + keys.forEach(function(key) { + if (!key.match(/^\d+$/)) { + output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, + key, true)); + } + }); + return output; +} + + +function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { + var name, str, desc; + desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; + if (desc.get) { + if (desc.set) { + str = ctx.stylize('[Getter/Setter]', 'special'); + } else { + str = ctx.stylize('[Getter]', 'special'); + } + } else { + if (desc.set) { + str = ctx.stylize('[Setter]', 'special'); + } + } + if (!hasOwnProperty(visibleKeys, key)) { + name = '[' + key + ']'; + } + if (!str) { + if (ctx.seen.indexOf(desc.value) < 0) { + if (isNull(recurseTimes)) { + str = formatValue(ctx, desc.value, null); + } else { + str = formatValue(ctx, desc.value, recurseTimes - 1); + } + if (str.indexOf('\n') > -1) { + if (array) { + str = str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n').substr(2); + } else { + str = '\n' + str.split('\n').map(function(line) { + return ' ' + line; + }).join('\n'); + } + } + } else { + str = ctx.stylize('[Circular]', 'special'); + } + } + if (isUndefined(name)) { + if (array && key.match(/^\d+$/)) { + return str; + } + name = JSON.stringify('' + key); + if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { + name = name.substr(1, name.length - 2); + name = ctx.stylize(name, 'name'); + } else { + name = name.replace(/'/g, "\\'") + .replace(/\\"/g, '"') + .replace(/(^"|"$)/g, "'"); + name = ctx.stylize(name, 'string'); + } + } + + return name + ': ' + str; +} + + +function reduceToSingleString(output, base, braces) { + var numLinesEst = 0; + var length = output.reduce(function(prev, cur) { + numLinesEst++; + if (cur.indexOf('\n') >= 0) numLinesEst++; + return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; + }, 0); + + if (length > 60) { + return braces[0] + + (base === '' ? '' : base + '\n ') + + ' ' + + output.join(',\n ') + + ' ' + + braces[1]; + } + + return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +} + + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. +function isArray(ar) { + return Array.isArray(ar); +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return isObject(re) && objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return isObject(d) && objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return isObject(e) && + (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = require('./support/isBuffer'); + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + + +function pad(n) { + return n < 10 ? '0' + n.toString(10) : n.toString(10); +} + + +var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', + 'Oct', 'Nov', 'Dec']; + +// 26 Feb 16:19:34 +function timestamp() { + var d = new Date(); + var time = [pad(d.getHours()), + pad(d.getMinutes()), + pad(d.getSeconds())].join(':'); + return [d.getDate(), months[d.getMonth()], time].join(' '); +} + + +// log is just a thin wrapper to console.log that prepends a timestamp +exports.log = function() { + console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +}; + + +/** + * Inherit the prototype methods from one constructor into another. + * + * The Function.prototype.inherits from lang.js rewritten as a standalone + * function (not on Function.prototype). NOTE: If this file is to be loaded + * during bootstrapping this function needs to be rewritten using some native + * functions as prototype setup using normal JavaScript does not work as + * expected during bootstrapping (see mirror.js in r114903). + * + * @param {function} ctor Constructor function which needs to inherit the + * prototype. + * @param {function} superCtor Constructor function to inherit prototype from. + */ +exports.inherits = require('inherits'); + +exports._extend = function(origin, add) { + // Don't do anything if add isn't an object + if (!add || !isObject(add)) return origin; + + var keys = Object.keys(add); + var i = keys.length; + while (i--) { + origin[keys[i]] = add[keys[i]]; + } + return origin; +}; + +function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); +} + +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./support/isBuffer":5,"_process":4,"inherits":3}],7:[function(require,module,exports){ +require("./tests/2.1.2"); +require("./tests/2.1.3"); +require("./tests/2.2.1"); +require("./tests/2.2.2"); +require("./tests/2.2.3"); +require("./tests/2.2.4"); +require("./tests/2.2.5"); +require("./tests/2.2.6"); +require("./tests/2.2.7"); +require("./tests/2.3.1"); +require("./tests/2.3.2"); +require("./tests/2.3.3"); +require("./tests/2.3.4"); + +},{"./tests/2.1.2":8,"./tests/2.1.3":9,"./tests/2.2.1":10,"./tests/2.2.2":11,"./tests/2.2.3":12,"./tests/2.2.4":13,"./tests/2.2.5":14,"./tests/2.2.6":15,"./tests/2.2.7":16,"./tests/2.3.1":17,"./tests/2.3.2":18,"./tests/2.3.3":19,"./tests/2.3.4":20}],8:[function(require,module,exports){ +(function (global){ +"use strict"; + +var assert = require("assert"); +var testFulfilled = require("./helpers/testThreeCases").testFulfilled; + +var adapter = global.adapter; +var deferred = adapter.deferred; + +var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it + +describe("2.1.2.1: When fulfilled, a promise: must not transition to any other state.", function () { + testFulfilled(dummy, function (promise, done) { + var onFulfilledCalled = false; + + promise.then(function onFulfilled() { + onFulfilledCalled = true; + }, function onRejected() { + assert.strictEqual(onFulfilledCalled, false); + done(); + }); + + setTimeout(done, 100); + }); + + specify("trying to fulfill then immediately reject", function (done) { + var d = deferred(); + var onFulfilledCalled = false; + + d.promise.then(function onFulfilled() { + onFulfilledCalled = true; + }, function onRejected() { + assert.strictEqual(onFulfilledCalled, false); + done(); + }); + + d.resolve(dummy); + d.reject(dummy); + setTimeout(done, 100); + }); + + specify("trying to fulfill then reject, delayed", function (done) { + var d = deferred(); + var onFulfilledCalled = false; + + d.promise.then(function onFulfilled() { + onFulfilledCalled = true; + }, function onRejected() { + assert.strictEqual(onFulfilledCalled, false); + done(); + }); + + setTimeout(function () { + d.resolve(dummy); + d.reject(dummy); + }, 50); + setTimeout(done, 100); + }); + + specify("trying to fulfill immediately then reject delayed", function (done) { + var d = deferred(); + var onFulfilledCalled = false; + + d.promise.then(function onFulfilled() { + onFulfilledCalled = true; + }, function onRejected() { + assert.strictEqual(onFulfilledCalled, false); + done(); + }); + + d.resolve(dummy); + setTimeout(function () { + d.reject(dummy); + }, 50); + setTimeout(done, 100); + }); +}); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./helpers/testThreeCases":22,"assert":2}],9:[function(require,module,exports){ +(function (global){ +"use strict"; + +var assert = require("assert"); +var testRejected = require("./helpers/testThreeCases").testRejected; + +var adapter = global.adapter; +var deferred = adapter.deferred; + +var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it + +describe("2.1.3.1: When rejected, a promise: must not transition to any other state.", function () { + testRejected(dummy, function (promise, done) { + var onRejectedCalled = false; + + promise.then(function onFulfilled() { + assert.strictEqual(onRejectedCalled, false); + done(); + }, function onRejected() { + onRejectedCalled = true; + }); + + setTimeout(done, 100); + }); + + specify("trying to reject then immediately fulfill", function (done) { + var d = deferred(); + var onRejectedCalled = false; + + d.promise.then(function onFulfilled() { + assert.strictEqual(onRejectedCalled, false); + done(); + }, function onRejected() { + onRejectedCalled = true; + }); + + d.reject(dummy); + d.resolve(dummy); + setTimeout(done, 100); + }); + + specify("trying to reject then fulfill, delayed", function (done) { + var d = deferred(); + var onRejectedCalled = false; + + d.promise.then(function onFulfilled() { + assert.strictEqual(onRejectedCalled, false); + done(); + }, function onRejected() { + onRejectedCalled = true; + }); + + setTimeout(function () { + d.reject(dummy); + d.resolve(dummy); + }, 50); + setTimeout(done, 100); + }); + + specify("trying to reject immediately then fulfill delayed", function (done) { + var d = deferred(); + var onRejectedCalled = false; + + d.promise.then(function onFulfilled() { + assert.strictEqual(onRejectedCalled, false); + done(); + }, function onRejected() { + onRejectedCalled = true; + }); + + d.reject(dummy); + setTimeout(function () { + d.resolve(dummy); + }, 50); + setTimeout(done, 100); + }); +}); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./helpers/testThreeCases":22,"assert":2}],10:[function(require,module,exports){ +(function (global){ +"use strict"; + +var adapter = global.adapter; +var resolved = adapter.resolved; +var rejected = adapter.rejected; + +var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it + +describe("2.2.1: Both `onFulfilled` and `onRejected` are optional arguments.", function () { + describe("2.2.1.1: If `onFulfilled` is not a function, it must be ignored.", function () { + describe("applied to a directly-rejected promise", function () { + function testNonFunction(nonFunction, stringRepresentation) { + specify("`onFulfilled` is " + stringRepresentation, function (done) { + rejected(dummy).then(nonFunction, function () { + done(); + }); + }); + } + + testNonFunction(undefined, "`undefined`"); + testNonFunction(null, "`null`"); + testNonFunction(false, "`false`"); + testNonFunction(5, "`5`"); + testNonFunction({}, "an object"); + }); + + describe("applied to a promise rejected and then chained off of", function () { + function testNonFunction(nonFunction, stringRepresentation) { + specify("`onFulfilled` is " + stringRepresentation, function (done) { + rejected(dummy).then(function () { }, undefined).then(nonFunction, function () { + done(); + }); + }); + } + + testNonFunction(undefined, "`undefined`"); + testNonFunction(null, "`null`"); + testNonFunction(false, "`false`"); + testNonFunction(5, "`5`"); + testNonFunction({}, "an object"); + }); + }); + + describe("2.2.1.2: If `onRejected` is not a function, it must be ignored.", function () { + describe("applied to a directly-fulfilled promise", function () { + function testNonFunction(nonFunction, stringRepresentation) { + specify("`onRejected` is " + stringRepresentation, function (done) { + resolved(dummy).then(function () { + done(); + }, nonFunction); + }); + } + + testNonFunction(undefined, "`undefined`"); + testNonFunction(null, "`null`"); + testNonFunction(false, "`false`"); + testNonFunction(5, "`5`"); + testNonFunction({}, "an object"); + }); + + describe("applied to a promise fulfilled and then chained off of", function () { + function testNonFunction(nonFunction, stringRepresentation) { + specify("`onFulfilled` is " + stringRepresentation, function (done) { + resolved(dummy).then(undefined, function () { }).then(function () { + done(); + }, nonFunction); + }); + } + + testNonFunction(undefined, "`undefined`"); + testNonFunction(null, "`null`"); + testNonFunction(false, "`false`"); + testNonFunction(5, "`5`"); + testNonFunction({}, "an object"); + }); + }); +}); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],11:[function(require,module,exports){ +(function (global){ +"use strict"; + +var assert = require("assert"); +var testFulfilled = require("./helpers/testThreeCases").testFulfilled; + +var adapter = global.adapter; +var resolved = adapter.resolved; +var deferred = adapter.deferred; + +var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it +var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality + +describe("2.2.2: If `onFulfilled` is a function,", function () { + describe("2.2.2.1: it must be called after `promise` is fulfilled, with `promise`’s fulfillment value as its " + + "first argument.", function () { + testFulfilled(sentinel, function (promise, done) { + promise.then(function onFulfilled(value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + + describe("2.2.2.2: it must not be called before `promise` is fulfilled", function () { + specify("fulfilled after a delay", function (done) { + var d = deferred(); + var isFulfilled = false; + + d.promise.then(function onFulfilled() { + assert.strictEqual(isFulfilled, true); + done(); + }); + + setTimeout(function () { + d.resolve(dummy); + isFulfilled = true; + }, 50); + }); + + specify("never fulfilled", function (done) { + var d = deferred(); + var onFulfilledCalled = false; + + d.promise.then(function onFulfilled() { + onFulfilledCalled = true; + done(); + }); + + setTimeout(function () { + assert.strictEqual(onFulfilledCalled, false); + done(); + }, 150); + }); + }); + + describe("2.2.2.3: it must not be called more than once.", function () { + specify("already-fulfilled", function (done) { + var timesCalled = 0; + + resolved(dummy).then(function onFulfilled() { + assert.strictEqual(++timesCalled, 1); + done(); + }); + }); + + specify("trying to fulfill a pending promise more than once, immediately", function (done) { + var d = deferred(); + var timesCalled = 0; + + d.promise.then(function onFulfilled() { + assert.strictEqual(++timesCalled, 1); + done(); + }); + + d.resolve(dummy); + d.resolve(dummy); + }); + + specify("trying to fulfill a pending promise more than once, delayed", function (done) { + var d = deferred(); + var timesCalled = 0; + + d.promise.then(function onFulfilled() { + assert.strictEqual(++timesCalled, 1); + done(); + }); + + setTimeout(function () { + d.resolve(dummy); + d.resolve(dummy); + }, 50); + }); + + specify("trying to fulfill a pending promise more than once, immediately then delayed", function (done) { + var d = deferred(); + var timesCalled = 0; + + d.promise.then(function onFulfilled() { + assert.strictEqual(++timesCalled, 1); + done(); + }); + + d.resolve(dummy); + setTimeout(function () { + d.resolve(dummy); + }, 50); + }); + + specify("when multiple `then` calls are made, spaced apart in time", function (done) { + var d = deferred(); + var timesCalled = [0, 0, 0]; + + d.promise.then(function onFulfilled() { + assert.strictEqual(++timesCalled[0], 1); + }); + + setTimeout(function () { + d.promise.then(function onFulfilled() { + assert.strictEqual(++timesCalled[1], 1); + }); + }, 50); + + setTimeout(function () { + d.promise.then(function onFulfilled() { + assert.strictEqual(++timesCalled[2], 1); + done(); + }); + }, 100); + + setTimeout(function () { + d.resolve(dummy); + }, 150); + }); + + specify("when `then` is interleaved with fulfillment", function (done) { + var d = deferred(); + var timesCalled = [0, 0]; + + d.promise.then(function onFulfilled() { + assert.strictEqual(++timesCalled[0], 1); + }); + + d.resolve(dummy); + + d.promise.then(function onFulfilled() { + assert.strictEqual(++timesCalled[1], 1); + done(); + }); + }); + }); +}); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./helpers/testThreeCases":22,"assert":2}],12:[function(require,module,exports){ +(function (global){ +"use strict"; + +var assert = require("assert"); +var testRejected = require("./helpers/testThreeCases").testRejected; + +var adapter = global.adapter; +var rejected = adapter.rejected; +var deferred = adapter.deferred; + +var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it +var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality + +describe("2.2.3: If `onRejected` is a function,", function () { + describe("2.2.3.1: it must be called after `promise` is rejected, with `promise`’s rejection reason as its " + + "first argument.", function () { + testRejected(sentinel, function (promise, done) { + promise.then(null, function onRejected(reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + + describe("2.2.3.2: it must not be called before `promise` is rejected", function () { + specify("rejected after a delay", function (done) { + var d = deferred(); + var isRejected = false; + + d.promise.then(null, function onRejected() { + assert.strictEqual(isRejected, true); + done(); + }); + + setTimeout(function () { + d.reject(dummy); + isRejected = true; + }, 50); + }); + + specify("never rejected", function (done) { + var d = deferred(); + var onRejectedCalled = false; + + d.promise.then(null, function onRejected() { + onRejectedCalled = true; + done(); + }); + + setTimeout(function () { + assert.strictEqual(onRejectedCalled, false); + done(); + }, 150); + }); + }); + + describe("2.2.3.3: it must not be called more than once.", function () { + specify("already-rejected", function (done) { + var timesCalled = 0; + + rejected(dummy).then(null, function onRejected() { + assert.strictEqual(++timesCalled, 1); + done(); + }); + }); + + specify("trying to reject a pending promise more than once, immediately", function (done) { + var d = deferred(); + var timesCalled = 0; + + d.promise.then(null, function onRejected() { + assert.strictEqual(++timesCalled, 1); + done(); + }); + + d.reject(dummy); + d.reject(dummy); + }); + + specify("trying to reject a pending promise more than once, delayed", function (done) { + var d = deferred(); + var timesCalled = 0; + + d.promise.then(null, function onRejected() { + assert.strictEqual(++timesCalled, 1); + done(); + }); + + setTimeout(function () { + d.reject(dummy); + d.reject(dummy); + }, 50); + }); + + specify("trying to reject a pending promise more than once, immediately then delayed", function (done) { + var d = deferred(); + var timesCalled = 0; + + d.promise.then(null, function onRejected() { + assert.strictEqual(++timesCalled, 1); + done(); + }); + + d.reject(dummy); + setTimeout(function () { + d.reject(dummy); + }, 50); + }); + + specify("when multiple `then` calls are made, spaced apart in time", function (done) { + var d = deferred(); + var timesCalled = [0, 0, 0]; + + d.promise.then(null, function onRejected() { + assert.strictEqual(++timesCalled[0], 1); + }); + + setTimeout(function () { + d.promise.then(null, function onRejected() { + assert.strictEqual(++timesCalled[1], 1); + }); + }, 50); + + setTimeout(function () { + d.promise.then(null, function onRejected() { + assert.strictEqual(++timesCalled[2], 1); + done(); + }); + }, 100); + + setTimeout(function () { + d.reject(dummy); + }, 150); + }); + + specify("when `then` is interleaved with rejection", function (done) { + var d = deferred(); + var timesCalled = [0, 0]; + + d.promise.then(null, function onRejected() { + assert.strictEqual(++timesCalled[0], 1); + }); + + d.reject(dummy); + + d.promise.then(null, function onRejected() { + assert.strictEqual(++timesCalled[1], 1); + done(); + }); + }); + }); +}); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./helpers/testThreeCases":22,"assert":2}],13:[function(require,module,exports){ +(function (global){ +"use strict"; + +var assert = require("assert"); +var testFulfilled = require("./helpers/testThreeCases").testFulfilled; +var testRejected = require("./helpers/testThreeCases").testRejected; + +var adapter = global.adapter; +var resolved = adapter.resolved; +var rejected = adapter.rejected; +var deferred = adapter.deferred; + +var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it + +describe("2.2.4: `onFulfilled` or `onRejected` must not be called until the execution context stack contains only " + + "platform code.", function () { + describe("`then` returns before the promise becomes fulfilled or rejected", function () { + testFulfilled(dummy, function (promise, done) { + var thenHasReturned = false; + + promise.then(function onFulfilled() { + assert.strictEqual(thenHasReturned, true); + done(); + }); + + thenHasReturned = true; + }); + testRejected(dummy, function (promise, done) { + var thenHasReturned = false; + + promise.then(null, function onRejected() { + assert.strictEqual(thenHasReturned, true); + done(); + }); + + thenHasReturned = true; + }); + }); + + describe("Clean-stack execution ordering tests (fulfillment case)", function () { + specify("when `onFulfilled` is added immediately before the promise is fulfilled", + function () { + var d = deferred(); + var onFulfilledCalled = false; + + d.promise.then(function onFulfilled() { + onFulfilledCalled = true; + }); + + d.resolve(dummy); + + assert.strictEqual(onFulfilledCalled, false); + }); + + specify("when `onFulfilled` is added immediately after the promise is fulfilled", + function () { + var d = deferred(); + var onFulfilledCalled = false; + + d.resolve(dummy); + + d.promise.then(function onFulfilled() { + onFulfilledCalled = true; + }); + + assert.strictEqual(onFulfilledCalled, false); + }); + + specify("when one `onFulfilled` is added inside another `onFulfilled`", function (done) { + var promise = resolved(); + var firstOnFulfilledFinished = false; + + promise.then(function () { + promise.then(function () { + assert.strictEqual(firstOnFulfilledFinished, true); + done(); + }); + firstOnFulfilledFinished = true; + }); + }); + + specify("when `onFulfilled` is added inside an `onRejected`", function (done) { + var promise = rejected(); + var promise2 = resolved(); + var firstOnRejectedFinished = false; + + promise.then(null, function () { + promise2.then(function () { + assert.strictEqual(firstOnRejectedFinished, true); + done(); + }); + firstOnRejectedFinished = true; + }); + }); + + specify("when the promise is fulfilled asynchronously", function (done) { + var d = deferred(); + var firstStackFinished = false; + + setTimeout(function () { + d.resolve(dummy); + firstStackFinished = true; + }, 0); + + d.promise.then(function () { + assert.strictEqual(firstStackFinished, true); + done(); + }); + }); + }); + + describe("Clean-stack execution ordering tests (rejection case)", function () { + specify("when `onRejected` is added immediately before the promise is rejected", + function () { + var d = deferred(); + var onRejectedCalled = false; + + d.promise.then(null, function onRejected() { + onRejectedCalled = true; + }); + + d.reject(dummy); + + assert.strictEqual(onRejectedCalled, false); + }); + + specify("when `onRejected` is added immediately after the promise is rejected", + function () { + var d = deferred(); + var onRejectedCalled = false; + + d.reject(dummy); + + d.promise.then(null, function onRejected() { + onRejectedCalled = true; + }); + + assert.strictEqual(onRejectedCalled, false); + }); + + specify("when `onRejected` is added inside an `onFulfilled`", function (done) { + var promise = resolved(); + var promise2 = rejected(); + var firstOnFulfilledFinished = false; + + promise.then(function () { + promise2.then(null, function () { + assert.strictEqual(firstOnFulfilledFinished, true); + done(); + }); + firstOnFulfilledFinished = true; + }); + }); + + specify("when one `onRejected` is added inside another `onRejected`", function (done) { + var promise = rejected(); + var firstOnRejectedFinished = false; + + promise.then(null, function () { + promise.then(null, function () { + assert.strictEqual(firstOnRejectedFinished, true); + done(); + }); + firstOnRejectedFinished = true; + }); + }); + + specify("when the promise is rejected asynchronously", function (done) { + var d = deferred(); + var firstStackFinished = false; + + setTimeout(function () { + d.reject(dummy); + firstStackFinished = true; + }, 0); + + d.promise.then(null, function () { + assert.strictEqual(firstStackFinished, true); + done(); + }); + }); + }); +}); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./helpers/testThreeCases":22,"assert":2}],14:[function(require,module,exports){ +(function (global){ +/*jshint strict: false */ + +var assert = require("assert"); + +var adapter = global.adapter; +var resolved = adapter.resolved; +var rejected = adapter.rejected; + +var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it +function impimentsUseStrictCorrectly() { + "use strict"; + function test() { + /*jshint validthis:true */ + return !this; + } + return test(); +} +describe("2.2.5 `onFulfilled` and `onRejected` must be called as functions (i.e. with no `this` value).", function () { + if (impimentsUseStrictCorrectly()) { + describe("strict mode", function () { + specify("fulfilled", function (done) { + resolved(dummy).then(function onFulfilled() { + "use strict"; + + assert.strictEqual(this, undefined); + done(); + }); + }); + + specify("rejected", function (done) { + rejected(dummy).then(null, function onRejected() { + "use strict"; + + assert.strictEqual(this, undefined); + done(); + }); + }); + }); + } + describe("sloppy mode", function () { + specify("fulfilled", function (done) { + resolved(dummy).then(function onFulfilled() { + assert.strictEqual(this, global); + done(); + }); + }); + + specify("rejected", function (done) { + rejected(dummy).then(null, function onRejected() { + assert.strictEqual(this, global); + done(); + }); + }); + }); +}); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"assert":2}],15:[function(require,module,exports){ +"use strict"; + +var assert = require("assert"); +var sinon = require("sinon"); +var testFulfilled = require("./helpers/testThreeCases").testFulfilled; +var testRejected = require("./helpers/testThreeCases").testRejected; + +var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it +var other = { other: "other" }; // a value we don't want to be strict equal to +var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality +var sentinel2 = { sentinel2: "sentinel2" }; +var sentinel3 = { sentinel3: "sentinel3" }; + +function callbackAggregator(times, ultimateCallback) { + var soFar = 0; + return function () { + if (++soFar === times) { + ultimateCallback(); + } + }; +} + +describe("2.2.6: `then` may be called multiple times on the same promise.", function () { + describe("2.2.6.1: If/when `promise` is fulfilled, all respective `onFulfilled` callbacks must execute in the " + + "order of their originating calls to `then`.", function () { + describe("multiple boring fulfillment handlers", function () { + testFulfilled(sentinel, function (promise, done) { + var handler1 = sinon.stub().returns(other); + var handler2 = sinon.stub().returns(other); + var handler3 = sinon.stub().returns(other); + + var spy = sinon.spy(); + promise.then(handler1, spy); + promise.then(handler2, spy); + promise.then(handler3, spy); + + promise.then(function (value) { + assert.strictEqual(value, sentinel); + + sinon.assert.calledWith(handler1, sinon.match.same(sentinel)); + sinon.assert.calledWith(handler2, sinon.match.same(sentinel)); + sinon.assert.calledWith(handler3, sinon.match.same(sentinel)); + sinon.assert.notCalled(spy); + + done(); + }); + }); + }); + + describe("multiple fulfillment handlers, one of which throws", function () { + testFulfilled(sentinel, function (promise, done) { + var handler1 = sinon.stub().returns(other); + var handler2 = sinon.stub().throws(other); + var handler3 = sinon.stub().returns(other); + + var spy = sinon.spy(); + promise.then(handler1, spy); + promise.then(handler2, spy); + promise.then(handler3, spy); + + promise.then(function (value) { + assert.strictEqual(value, sentinel); + + sinon.assert.calledWith(handler1, sinon.match.same(sentinel)); + sinon.assert.calledWith(handler2, sinon.match.same(sentinel)); + sinon.assert.calledWith(handler3, sinon.match.same(sentinel)); + sinon.assert.notCalled(spy); + + done(); + }); + }); + }); + + describe("results in multiple branching chains with their own fulfillment values", function () { + testFulfilled(dummy, function (promise, done) { + var semiDone = callbackAggregator(3, done); + + promise.then(function () { + return sentinel; + }).then(function (value) { + assert.strictEqual(value, sentinel); + semiDone(); + }); + + promise.then(function () { + throw sentinel2; + }).then(null, function (reason) { + assert.strictEqual(reason, sentinel2); + semiDone(); + }); + + promise.then(function () { + return sentinel3; + }).then(function (value) { + assert.strictEqual(value, sentinel3); + semiDone(); + }); + }); + }); + + describe("`onFulfilled` handlers are called in the original order", function () { + testFulfilled(dummy, function (promise, done) { + var handler1 = sinon.spy(function handler1() {}); + var handler2 = sinon.spy(function handler2() {}); + var handler3 = sinon.spy(function handler3() {}); + + promise.then(handler1); + promise.then(handler2); + promise.then(handler3); + + promise.then(function () { + sinon.assert.callOrder(handler1, handler2, handler3); + done(); + }); + }); + + describe("even when one handler is added inside another handler", function () { + testFulfilled(dummy, function (promise, done) { + var handler1 = sinon.spy(function handler1() {}); + var handler2 = sinon.spy(function handler2() {}); + var handler3 = sinon.spy(function handler3() {}); + + promise.then(function () { + handler1(); + promise.then(handler3); + }); + promise.then(handler2); + + promise.then(function () { + // Give implementations a bit of extra time to flush their internal queue, if necessary. + setTimeout(function () { + sinon.assert.callOrder(handler1, handler2, handler3); + done(); + }, 15); + }); + }); + }); + }); + }); + + describe("2.2.6.2: If/when `promise` is rejected, all respective `onRejected` callbacks must execute in the " + + "order of their originating calls to `then`.", function () { + describe("multiple boring rejection handlers", function () { + testRejected(sentinel, function (promise, done) { + var handler1 = sinon.stub().returns(other); + var handler2 = sinon.stub().returns(other); + var handler3 = sinon.stub().returns(other); + + var spy = sinon.spy(); + promise.then(spy, handler1); + promise.then(spy, handler2); + promise.then(spy, handler3); + + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + + sinon.assert.calledWith(handler1, sinon.match.same(sentinel)); + sinon.assert.calledWith(handler2, sinon.match.same(sentinel)); + sinon.assert.calledWith(handler3, sinon.match.same(sentinel)); + sinon.assert.notCalled(spy); + + done(); + }); + }); + }); + + describe("multiple rejection handlers, one of which throws", function () { + testRejected(sentinel, function (promise, done) { + var handler1 = sinon.stub().returns(other); + var handler2 = sinon.stub().throws(other); + var handler3 = sinon.stub().returns(other); + + var spy = sinon.spy(); + promise.then(spy, handler1); + promise.then(spy, handler2); + promise.then(spy, handler3); + + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + + sinon.assert.calledWith(handler1, sinon.match.same(sentinel)); + sinon.assert.calledWith(handler2, sinon.match.same(sentinel)); + sinon.assert.calledWith(handler3, sinon.match.same(sentinel)); + sinon.assert.notCalled(spy); + + done(); + }); + }); + }); + + describe("results in multiple branching chains with their own fulfillment values", function () { + testRejected(sentinel, function (promise, done) { + var semiDone = callbackAggregator(3, done); + + promise.then(null, function () { + return sentinel; + }).then(function (value) { + assert.strictEqual(value, sentinel); + semiDone(); + }); + + promise.then(null, function () { + throw sentinel2; + }).then(null, function (reason) { + assert.strictEqual(reason, sentinel2); + semiDone(); + }); + + promise.then(null, function () { + return sentinel3; + }).then(function (value) { + assert.strictEqual(value, sentinel3); + semiDone(); + }); + }); + }); + + describe("`onRejected` handlers are called in the original order", function () { + testRejected(dummy, function (promise, done) { + var handler1 = sinon.spy(function handler1() {}); + var handler2 = sinon.spy(function handler2() {}); + var handler3 = sinon.spy(function handler3() {}); + + promise.then(null, handler1); + promise.then(null, handler2); + promise.then(null, handler3); + + promise.then(null, function () { + sinon.assert.callOrder(handler1, handler2, handler3); + done(); + }); + }); + + describe("even when one handler is added inside another handler", function () { + testRejected(dummy, function (promise, done) { + var handler1 = sinon.spy(function handler1() {}); + var handler2 = sinon.spy(function handler2() {}); + var handler3 = sinon.spy(function handler3() {}); + + promise.then(null, function () { + handler1(); + promise.then(null, handler3); + }); + promise.then(null, handler2); + + promise.then(null, function () { + // Give implementations a bit of extra time to flush their internal queue, if necessary. + setTimeout(function () { + sinon.assert.callOrder(handler1, handler2, handler3); + done(); + }, 15); + }); + }); + }); + }); + }); +}); + +},{"./helpers/testThreeCases":22,"assert":2,"sinon":24}],16:[function(require,module,exports){ +(function (global){ +"use strict"; + +var assert = require("assert"); +var testFulfilled = require("./helpers/testThreeCases").testFulfilled; +var testRejected = require("./helpers/testThreeCases").testRejected; +var reasons = require("./helpers/reasons"); + +var adapter = global.adapter; +var deferred = adapter.deferred; + +var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it +var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality +var other = { other: "other" }; // a value we don't want to be strict equal to + +describe("2.2.7: `then` must return a promise: `promise2 = promise1.then(onFulfilled, onRejected)`", function () { + specify("is a promise", function () { + var promise1 = deferred().promise; + var promise2 = promise1.then(); + + assert(typeof promise2 === "object" || typeof promise2 === "function"); + assert.notStrictEqual(promise2, null); + assert.strictEqual(typeof promise2.then, "function"); + }); + + describe("2.2.7.1: If either `onFulfilled` or `onRejected` returns a value `x`, run the Promise Resolution " + + "Procedure `[[Resolve]](promise2, x)`", function () { + specify("see separate 3.3 tests", function () { }); + }); + + describe("2.2.7.2: If either `onFulfilled` or `onRejected` throws an exception `e`, `promise2` must be rejected " + + "with `e` as the reason.", function () { + function testReason(expectedReason, stringRepresentation) { + describe("The reason is " + stringRepresentation, function () { + testFulfilled(dummy, function (promise1, done) { + var promise2 = promise1.then(function onFulfilled() { + throw expectedReason; + }); + + promise2.then(null, function onPromise2Rejected(actualReason) { + assert.strictEqual(actualReason, expectedReason); + done(); + }); + }); + testRejected(dummy, function (promise1, done) { + var promise2 = promise1.then(null, function onRejected() { + throw expectedReason; + }); + + promise2.then(null, function onPromise2Rejected(actualReason) { + assert.strictEqual(actualReason, expectedReason); + done(); + }); + }); + }); + } + + Object.keys(reasons).forEach(function (stringRepresentation) { + testReason(reasons[stringRepresentation], stringRepresentation); + }); + }); + + describe("2.2.7.3: If `onFulfilled` is not a function and `promise1` is fulfilled, `promise2` must be fulfilled " + + "with the same value.", function () { + + function testNonFunction(nonFunction, stringRepresentation) { + describe("`onFulfilled` is " + stringRepresentation, function () { + testFulfilled(sentinel, function (promise1, done) { + var promise2 = promise1.then(nonFunction); + + promise2.then(function onPromise2Fulfilled(value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + } + + testNonFunction(undefined, "`undefined`"); + testNonFunction(null, "`null`"); + testNonFunction(false, "`false`"); + testNonFunction(5, "`5`"); + testNonFunction({}, "an object"); + testNonFunction([function () { return other; }], "an array containing a function"); + }); + + describe("2.2.7.4: If `onRejected` is not a function and `promise1` is rejected, `promise2` must be rejected " + + "with the same reason.", function () { + + function testNonFunction(nonFunction, stringRepresentation) { + describe("`onRejected` is " + stringRepresentation, function () { + testRejected(sentinel, function (promise1, done) { + var promise2 = promise1.then(null, nonFunction); + + promise2.then(null, function onPromise2Rejected(reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + } + + testNonFunction(undefined, "`undefined`"); + testNonFunction(null, "`null`"); + testNonFunction(false, "`false`"); + testNonFunction(5, "`5`"); + testNonFunction({}, "an object"); + testNonFunction([function () { return other; }], "an array containing a function"); + }); +}); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./helpers/reasons":21,"./helpers/testThreeCases":22,"assert":2}],17:[function(require,module,exports){ +(function (global){ +"use strict"; + +var assert = require("assert"); + +var adapter = global.adapter; +var resolved = adapter.resolved; +var rejected = adapter.rejected; + +var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it + +describe("2.3.1: If `promise` and `x` refer to the same object, reject `promise` with a `TypeError' as the reason.", + function () { + specify("via return from a fulfilled promise", function (done) { + var promise = resolved(dummy).then(function () { + return promise; + }); + + promise.then(null, function (reason) { + assert(reason instanceof TypeError); + done(); + }); + }); + + specify("via return from a rejected promise", function (done) { + var promise = rejected(dummy).then(null, function () { + return promise; + }); + + promise.then(null, function (reason) { + assert(reason instanceof TypeError); + done(); + }); + }); +}); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"assert":2}],18:[function(require,module,exports){ +(function (global){ +"use strict"; + +var assert = require("assert"); + +var adapter = global.adapter; +var resolved = adapter.resolved; +var rejected = adapter.rejected; +var deferred = adapter.deferred; + +var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it +var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality + +function testPromiseResolution(xFactory, test) { + specify("via return from a fulfilled promise", function (done) { + var promise = resolved(dummy).then(function onBasePromiseFulfilled() { + return xFactory(); + }); + + test(promise, done); + }); + + specify("via return from a rejected promise", function (done) { + var promise = rejected(dummy).then(null, function onBasePromiseRejected() { + return xFactory(); + }); + + test(promise, done); + }); +} + +describe("2.3.2: If `x` is a promise, adopt its state", function () { + describe("2.3.2.1: If `x` is pending, `promise` must remain pending until `x` is fulfilled or rejected.", + function () { + function xFactory() { + return deferred().promise; + } + + testPromiseResolution(xFactory, function (promise, done) { + var wasFulfilled = false; + var wasRejected = false; + + promise.then( + function onPromiseFulfilled() { + wasFulfilled = true; + }, + function onPromiseRejected() { + wasRejected = true; + } + ); + + setTimeout(function () { + assert.strictEqual(wasFulfilled, false); + assert.strictEqual(wasRejected, false); + done(); + }, 100); + }); + }); + + describe("2.3.2.2: If/when `x` is fulfilled, fulfill `promise` with the same value.", function () { + describe("`x` is already-fulfilled", function () { + function xFactory() { + return resolved(sentinel); + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function onPromiseFulfilled(value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + + describe("`x` is eventually-fulfilled", function () { + var d = null; + + function xFactory() { + d = deferred(); + setTimeout(function () { + d.resolve(sentinel); + }, 50); + return d.promise; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function onPromiseFulfilled(value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + }); + + describe("2.3.2.3: If/when `x` is rejected, reject `promise` with the same reason.", function () { + describe("`x` is already-rejected", function () { + function xFactory() { + return rejected(sentinel); + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function onPromiseRejected(reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + + describe("`x` is eventually-rejected", function () { + var d = null; + + function xFactory() { + d = deferred(); + setTimeout(function () { + d.reject(sentinel); + }, 50); + return d.promise; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function onPromiseRejected(reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + }); +}); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"assert":2}],19:[function(require,module,exports){ +(function (global){ +"use strict"; + +var assert = require("assert"); +var thenables = require("./helpers/thenables"); +var reasons = require("./helpers/reasons"); + +var adapter = global.adapter; +var resolved = adapter.resolved; +var rejected = adapter.rejected; +var deferred = adapter.deferred; + +var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it +var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality +var other = { other: "other" }; // a value we don't want to be strict equal to +var sentinelArray = [sentinel]; // a sentinel fulfillment value to test when we need an array + +function testPromiseResolution(xFactory, test) { + specify("via return from a fulfilled promise", function (done) { + var promise = resolved(dummy).then(function onBasePromiseFulfilled() { + return xFactory(); + }); + + test(promise, done); + }); + + specify("via return from a rejected promise", function (done) { + var promise = rejected(dummy).then(null, function onBasePromiseRejected() { + return xFactory(); + }); + + test(promise, done); + }); +} + +function testCallingResolvePromise(yFactory, stringRepresentation, test) { + describe("`y` is " + stringRepresentation, function () { + describe("`then` calls `resolvePromise` synchronously", function () { + function xFactory() { + return { + then: function (resolvePromise) { + resolvePromise(yFactory()); + } + }; + } + + testPromiseResolution(xFactory, test); + }); + + describe("`then` calls `resolvePromise` asynchronously", function () { + function xFactory() { + return { + then: function (resolvePromise) { + setTimeout(function () { + resolvePromise(yFactory()); + }, 0); + } + }; + } + + testPromiseResolution(xFactory, test); + }); + }); +} + +function testCallingRejectPromise(r, stringRepresentation, test) { + describe("`r` is " + stringRepresentation, function () { + describe("`then` calls `rejectPromise` synchronously", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + rejectPromise(r); + } + }; + } + + testPromiseResolution(xFactory, test); + }); + + describe("`then` calls `rejectPromise` asynchronously", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + setTimeout(function () { + rejectPromise(r); + }, 0); + } + }; + } + + testPromiseResolution(xFactory, test); + }); + }); +} + +function testCallingResolvePromiseFulfillsWith(yFactory, stringRepresentation, fulfillmentValue) { + testCallingResolvePromise(yFactory, stringRepresentation, function (promise, done) { + promise.then(function onPromiseFulfilled(value) { + assert.strictEqual(value, fulfillmentValue); + done(); + }); + }); +} + +function testCallingResolvePromiseRejectsWith(yFactory, stringRepresentation, rejectionReason) { + testCallingResolvePromise(yFactory, stringRepresentation, function (promise, done) { + promise.then(null, function onPromiseRejected(reason) { + assert.strictEqual(reason, rejectionReason); + done(); + }); + }); +} + +function testCallingRejectPromiseRejectsWith(reason, stringRepresentation) { + testCallingRejectPromise(reason, stringRepresentation, function (promise, done) { + promise.then(null, function onPromiseRejected(rejectionReason) { + assert.strictEqual(rejectionReason, reason); + done(); + }); + }); +} + +describe("2.3.3: Otherwise, if `x` is an object or function,", function () { + describe("2.3.3.1: Let `then` be `x.then`", function () { + describe("`x` is an object with null prototype", function () { + var numberOfTimesThenWasRetrieved = null; + + beforeEach(function () { + numberOfTimesThenWasRetrieved = 0; + }); + + function xFactory() { + return Object.create(null, { + then: { + get: function () { + ++numberOfTimesThenWasRetrieved; + return function thenMethodForX(onFulfilled) { + onFulfilled(); + }; + } + } + }); + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function () { + assert.strictEqual(numberOfTimesThenWasRetrieved, 1); + done(); + }); + }); + }); + + describe("`x` is an object with normal Object.prototype", function () { + var numberOfTimesThenWasRetrieved = null; + + beforeEach(function () { + numberOfTimesThenWasRetrieved = 0; + }); + + function xFactory() { + return Object.create(Object.prototype, { + then: { + get: function () { + ++numberOfTimesThenWasRetrieved; + return function thenMethodForX(onFulfilled) { + onFulfilled(); + }; + } + } + }); + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function () { + assert.strictEqual(numberOfTimesThenWasRetrieved, 1); + done(); + }); + }); + }); + + describe("`x` is a function", function () { + var numberOfTimesThenWasRetrieved = null; + + beforeEach(function () { + numberOfTimesThenWasRetrieved = 0; + }); + + function xFactory() { + function x() { } + + Object.defineProperty(x, "then", { + get: function () { + ++numberOfTimesThenWasRetrieved; + return function thenMethodForX(onFulfilled) { + onFulfilled(); + }; + } + }); + + return x; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function () { + assert.strictEqual(numberOfTimesThenWasRetrieved, 1); + done(); + }); + }); + }); + }); + + describe("2.3.3.2: If retrieving the property `x.then` results in a thrown exception `e`, reject `promise` with " + + "`e` as the reason.", function () { + function testRejectionViaThrowingGetter(e, stringRepresentation) { + function xFactory() { + return Object.create(Object.prototype, { + then: { + get: function () { + throw e; + } + } + }); + } + + describe("`e` is " + stringRepresentation, function () { + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, e); + done(); + }); + }); + }); + } + + Object.keys(reasons).forEach(function (stringRepresentation) { + testRejectionViaThrowingGetter(reasons[stringRepresentation], stringRepresentation); + }); + }); + + describe("2.3.3.3: If `then` is a function, call it with `x` as `this`, first argument `resolvePromise`, and " + + "second argument `rejectPromise`", function () { + describe("Calls with `x` as `this` and two function arguments", function () { + function xFactory() { + var x = { + then: function (onFulfilled, onRejected) { + assert.strictEqual(this, x); + assert.strictEqual(typeof onFulfilled, "function"); + assert.strictEqual(typeof onRejected, "function"); + onFulfilled(); + } + }; + return x; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function () { + done(); + }); + }); + }); + + describe("Uses the original value of `then`", function () { + var numberOfTimesThenWasRetrieved = null; + + beforeEach(function () { + numberOfTimesThenWasRetrieved = 0; + }); + + function xFactory() { + return Object.create(Object.prototype, { + then: { + get: function () { + if (numberOfTimesThenWasRetrieved === 0) { + return function (onFulfilled) { + onFulfilled(); + }; + } + return null; + } + } + }); + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function () { + done(); + }); + }); + }); + + describe("2.3.3.3.1: If/when `resolvePromise` is called with value `y`, run `[[Resolve]](promise, y)`", + function () { + describe("`y` is not a thenable", function () { + testCallingResolvePromiseFulfillsWith(function () { return undefined; }, "`undefined`", undefined); + testCallingResolvePromiseFulfillsWith(function () { return null; }, "`null`", null); + testCallingResolvePromiseFulfillsWith(function () { return false; }, "`false`", false); + testCallingResolvePromiseFulfillsWith(function () { return 5; }, "`5`", 5); + testCallingResolvePromiseFulfillsWith(function () { return sentinel; }, "an object", sentinel); + testCallingResolvePromiseFulfillsWith(function () { return sentinelArray; }, "an array", sentinelArray); + }); + + describe("`y` is a thenable", function () { + Object.keys(thenables.fulfilled).forEach(function (stringRepresentation) { + function yFactory() { + return thenables.fulfilled[stringRepresentation](sentinel); + } + + testCallingResolvePromiseFulfillsWith(yFactory, stringRepresentation, sentinel); + }); + + Object.keys(thenables.rejected).forEach(function (stringRepresentation) { + function yFactory() { + return thenables.rejected[stringRepresentation](sentinel); + } + + testCallingResolvePromiseRejectsWith(yFactory, stringRepresentation, sentinel); + }); + }); + + describe("`y` is a thenable for a thenable", function () { + Object.keys(thenables.fulfilled).forEach(function (outerStringRepresentation) { + var outerThenableFactory = thenables.fulfilled[outerStringRepresentation]; + + Object.keys(thenables.fulfilled).forEach(function (innerStringRepresentation) { + var innerThenableFactory = thenables.fulfilled[innerStringRepresentation]; + + var stringRepresentation = outerStringRepresentation + " for " + innerStringRepresentation; + + function yFactory() { + return outerThenableFactory(innerThenableFactory(sentinel)); + } + + testCallingResolvePromiseFulfillsWith(yFactory, stringRepresentation, sentinel); + }); + + Object.keys(thenables.rejected).forEach(function (innerStringRepresentation) { + var innerThenableFactory = thenables.rejected[innerStringRepresentation]; + + var stringRepresentation = outerStringRepresentation + " for " + innerStringRepresentation; + + function yFactory() { + return outerThenableFactory(innerThenableFactory(sentinel)); + } + + testCallingResolvePromiseRejectsWith(yFactory, stringRepresentation, sentinel); + }); + }); + }); + }); + + describe("2.3.3.3.2: If/when `rejectPromise` is called with reason `r`, reject `promise` with `r`", + function () { + Object.keys(reasons).forEach(function (stringRepresentation) { + testCallingRejectPromiseRejectsWith(reasons[stringRepresentation], stringRepresentation); + }); + }); + + describe("2.3.3.3.3: If both `resolvePromise` and `rejectPromise` are called, or multiple calls to the same " + + "argument are made, the first call takes precedence, and any further calls are ignored.", + function () { + describe("calling `resolvePromise` then `rejectPromise`, both synchronously", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + resolvePromise(sentinel); + rejectPromise(other); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function (value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + + describe("calling `resolvePromise` synchronously then `rejectPromise` asynchronously", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + resolvePromise(sentinel); + + setTimeout(function () { + rejectPromise(other); + }, 0); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function (value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + + describe("calling `resolvePromise` then `rejectPromise`, both asynchronously", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + setTimeout(function () { + resolvePromise(sentinel); + }, 0); + + setTimeout(function () { + rejectPromise(other); + }, 0); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function (value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + + describe("calling `resolvePromise` with an asynchronously-fulfilled promise, then calling " + + "`rejectPromise`, both synchronously", function () { + function xFactory() { + var d = deferred(); + setTimeout(function () { + d.resolve(sentinel); + }, 50); + + return { + then: function (resolvePromise, rejectPromise) { + resolvePromise(d.promise); + rejectPromise(other); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function (value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + + describe("calling `resolvePromise` with an asynchronously-rejected promise, then calling " + + "`rejectPromise`, both synchronously", function () { + function xFactory() { + var d = deferred(); + setTimeout(function () { + d.reject(sentinel); + }, 50); + + return { + then: function (resolvePromise, rejectPromise) { + resolvePromise(d.promise); + rejectPromise(other); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + + describe("calling `rejectPromise` then `resolvePromise`, both synchronously", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + rejectPromise(sentinel); + resolvePromise(other); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + + describe("calling `rejectPromise` synchronously then `resolvePromise` asynchronously", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + rejectPromise(sentinel); + + setTimeout(function () { + resolvePromise(other); + }, 0); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + + describe("calling `rejectPromise` then `resolvePromise`, both asynchronously", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + setTimeout(function () { + rejectPromise(sentinel); + }, 0); + + setTimeout(function () { + resolvePromise(other); + }, 0); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + + describe("calling `resolvePromise` twice synchronously", function () { + function xFactory() { + return { + then: function (resolvePromise) { + resolvePromise(sentinel); + resolvePromise(other); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function (value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + + describe("calling `resolvePromise` twice, first synchronously then asynchronously", function () { + function xFactory() { + return { + then: function (resolvePromise) { + resolvePromise(sentinel); + + setTimeout(function () { + resolvePromise(other); + }, 0); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function (value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + + describe("calling `resolvePromise` twice, both times asynchronously", function () { + function xFactory() { + return { + then: function (resolvePromise) { + setTimeout(function () { + resolvePromise(sentinel); + }, 0); + + setTimeout(function () { + resolvePromise(other); + }, 0); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function (value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + + describe("calling `resolvePromise` with an asynchronously-fulfilled promise, then calling it again, both " + + "times synchronously", function () { + function xFactory() { + var d = deferred(); + setTimeout(function () { + d.resolve(sentinel); + }, 50); + + return { + then: function (resolvePromise) { + resolvePromise(d.promise); + resolvePromise(other); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function (value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + + describe("calling `resolvePromise` with an asynchronously-rejected promise, then calling it again, both " + + "times synchronously", function () { + function xFactory() { + var d = deferred(); + setTimeout(function () { + d.reject(sentinel); + }, 50); + + return { + then: function (resolvePromise) { + resolvePromise(d.promise); + resolvePromise(other); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + + describe("calling `rejectPromise` twice synchronously", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + rejectPromise(sentinel); + rejectPromise(other); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + + describe("calling `rejectPromise` twice, first synchronously then asynchronously", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + rejectPromise(sentinel); + + setTimeout(function () { + rejectPromise(other); + }, 0); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + + describe("calling `rejectPromise` twice, both times asynchronously", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + setTimeout(function () { + rejectPromise(sentinel); + }, 0); + + setTimeout(function () { + rejectPromise(other); + }, 0); + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + + describe("saving and abusing `resolvePromise` and `rejectPromise`", function () { + var savedResolvePromise, savedRejectPromise; + + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + savedResolvePromise = resolvePromise; + savedRejectPromise = rejectPromise; + } + }; + } + + beforeEach(function () { + savedResolvePromise = null; + savedRejectPromise = null; + }); + + testPromiseResolution(xFactory, function (promise, done) { + var timesFulfilled = 0; + var timesRejected = 0; + + promise.then( + function () { + ++timesFulfilled; + }, + function () { + ++timesRejected; + } + ); + + if (savedResolvePromise && savedRejectPromise) { + savedResolvePromise(dummy); + savedResolvePromise(dummy); + savedRejectPromise(dummy); + savedRejectPromise(dummy); + } + + setTimeout(function () { + savedResolvePromise(dummy); + savedResolvePromise(dummy); + savedRejectPromise(dummy); + savedRejectPromise(dummy); + }, 50); + + setTimeout(function () { + assert.strictEqual(timesFulfilled, 1); + assert.strictEqual(timesRejected, 0); + done(); + }, 100); + }); + }); + }); + + describe("2.3.3.3.4: If calling `then` throws an exception `e`,", function () { + describe("2.3.3.3.4.1: If `resolvePromise` or `rejectPromise` have been called, ignore it.", function () { + describe("`resolvePromise` was called with a non-thenable", function () { + function xFactory() { + return { + then: function (resolvePromise) { + resolvePromise(sentinel); + throw other; + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function (value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + + describe("`resolvePromise` was called with an asynchronously-fulfilled promise", function () { + function xFactory() { + var d = deferred(); + setTimeout(function () { + d.resolve(sentinel); + }, 50); + + return { + then: function (resolvePromise) { + resolvePromise(d.promise); + throw other; + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function (value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + + describe("`resolvePromise` was called with an asynchronously-rejected promise", function () { + function xFactory() { + var d = deferred(); + setTimeout(function () { + d.reject(sentinel); + }, 50); + + return { + then: function (resolvePromise) { + resolvePromise(d.promise); + throw other; + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + + describe("`rejectPromise` was called", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + rejectPromise(sentinel); + throw other; + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + + describe("`resolvePromise` then `rejectPromise` were called", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + resolvePromise(sentinel); + rejectPromise(other); + throw other; + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function (value) { + assert.strictEqual(value, sentinel); + done(); + }); + }); + }); + + describe("`rejectPromise` then `resolvePromise` were called", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + rejectPromise(sentinel); + resolvePromise(other); + throw other; + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + }); + + describe("2.3.3.3.4.2: Otherwise, reject `promise` with `e` as the reason.", function () { + describe("straightforward case", function () { + function xFactory() { + return { + then: function () { + throw sentinel; + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + + describe("`resolvePromise` is called asynchronously before the `throw`", function () { + function xFactory() { + return { + then: function (resolvePromise) { + setTimeout(function () { + resolvePromise(other); + }, 0); + throw sentinel; + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + + describe("`rejectPromise` is called asynchronously before the `throw`", function () { + function xFactory() { + return { + then: function (resolvePromise, rejectPromise) { + setTimeout(function () { + rejectPromise(other); + }, 0); + throw sentinel; + } + }; + } + + testPromiseResolution(xFactory, function (promise, done) { + promise.then(null, function (reason) { + assert.strictEqual(reason, sentinel); + done(); + }); + }); + }); + }); + }); + }); + + describe("2.3.3.4: If `then` is not a function, fulfill promise with `x`", function () { + function testFulfillViaNonFunction(then, stringRepresentation) { + var x = null; + + beforeEach(function () { + x = { then: then }; + }); + + function xFactory() { + return x; + } + + describe("`then` is " + stringRepresentation, function () { + testPromiseResolution(xFactory, function (promise, done) { + promise.then(function (value) { + assert.strictEqual(value, x); + done(); + }); + }); + }); + } + + testFulfillViaNonFunction(5, "`5`"); + testFulfillViaNonFunction({}, "an object"); + testFulfillViaNonFunction([function () { }], "an array containing a function"); + testFulfillViaNonFunction(/a-b/i, "a regular expression"); + testFulfillViaNonFunction(Object.create(Function.prototype), "an object inheriting from `Function.prototype`"); + }); +}); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./helpers/reasons":21,"./helpers/thenables":23,"assert":2}],20:[function(require,module,exports){ +"use strict"; + +var assert = require("assert"); +var testFulfilled = require("./helpers/testThreeCases").testFulfilled; +var testRejected = require("./helpers/testThreeCases").testRejected; + +var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it + +describe("2.3.4: If `x` is not an object or function, fulfill `promise` with `x`", function () { + function testValue(expectedValue, stringRepresentation, beforeEachHook, afterEachHook) { + describe("The value is " + stringRepresentation, function () { + if (typeof beforeEachHook === "function") { + beforeEach(beforeEachHook); + } + if (typeof afterEachHook === "function") { + afterEach(afterEachHook); + } + + testFulfilled(dummy, function (promise1, done) { + var promise2 = promise1.then(function onFulfilled() { + return expectedValue; + }); + + promise2.then(function onPromise2Fulfilled(actualValue) { + assert.strictEqual(actualValue, expectedValue); + done(); + }); + }); + testRejected(dummy, function (promise1, done) { + var promise2 = promise1.then(null, function onRejected() { + return expectedValue; + }); + + promise2.then(function onPromise2Fulfilled(actualValue) { + assert.strictEqual(actualValue, expectedValue); + done(); + }); + }); + }); + } + + testValue(undefined, "`undefined`"); + testValue(null, "`null`"); + testValue(false, "`false`"); + testValue(true, "`true`"); + testValue(0, "`0`"); + + testValue( + true, + "`true` with `Boolean.prototype` modified to have a `then` method", + function () { + Boolean.prototype.then = function () {}; + }, + function () { + delete Boolean.prototype.then; + } + ); + + testValue( + 1, + "`1` with `Number.prototype` modified to have a `then` method", + function () { + Number.prototype.then = function () {}; + }, + function () { + delete Number.prototype.then; + } + ); +}); + +},{"./helpers/testThreeCases":22,"assert":2}],21:[function(require,module,exports){ +(function (global){ +"use strict"; + +// This module exports some valid rejection reason factories, keyed by human-readable versions of their names. + +var adapter = global.adapter; +var resolved = adapter.resolved; +var rejected = adapter.rejected; + +var dummy = { dummy: "dummy" }; + +exports["`undefined`"] = function () { + return undefined; +}; + +exports["`null`"] = function () { + return null; +}; + +exports["`false`"] = function () { + return false; +}; + +exports["`0`"] = function () { + return 0; +}; + +exports["an error"] = function () { + return new Error(); +}; + +exports["an error without a stack"] = function () { + var error = new Error(); + delete error.stack; + + return error; +}; + +exports["a date"] = function () { + return new Date(); +}; + +exports["an object"] = function () { + return {}; +}; + +exports["an always-pending thenable"] = function () { + return { then: function () { } }; +}; + +exports["a fulfilled promise"] = function () { + return resolved(dummy); +}; + +exports["a rejected promise"] = function () { + return rejected(dummy); +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],22:[function(require,module,exports){ +(function (global){ +"use strict"; + +var adapter = global.adapter; +var resolved = adapter.resolved; +var rejected = adapter.rejected; +var deferred = adapter.deferred; + +exports.testFulfilled = function (value, test) { + specify("already-fulfilled", function (done) { + test(resolved(value), done); + }); + + specify("immediately-fulfilled", function (done) { + var d = deferred(); + test(d.promise, done); + d.resolve(value); + }); + + specify("eventually-fulfilled", function (done) { + var d = deferred(); + test(d.promise, done); + setTimeout(function () { + d.resolve(value); + }, 50); + }); +}; + +exports.testRejected = function (reason, test) { + specify("already-rejected", function (done) { + test(rejected(reason), done); + }); + + specify("immediately-rejected", function (done) { + var d = deferred(); + test(d.promise, done); + d.reject(reason); + }); + + specify("eventually-rejected", function (done) { + var d = deferred(); + test(d.promise, done); + setTimeout(function () { + d.reject(reason); + }, 50); + }); +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],23:[function(require,module,exports){ +(function (global){ +"use strict"; + +var adapter = global.adapter; +var resolved = adapter.resolved; +var rejected = adapter.rejected; +var deferred = adapter.deferred; + +var other = { other: "other" }; // a value we don't want to be strict equal to + +exports.fulfilled = { + "a synchronously-fulfilled custom thenable": function (value) { + return { + then: function (onFulfilled) { + onFulfilled(value); + } + }; + }, + + "an asynchronously-fulfilled custom thenable": function (value) { + return { + then: function (onFulfilled) { + setTimeout(function () { + onFulfilled(value); + }, 0); + } + }; + }, + + "a synchronously-fulfilled one-time thenable": function (value) { + var numberOfTimesThenRetrieved = 0; + return Object.create(null, { + then: { + get: function () { + if (numberOfTimesThenRetrieved === 0) { + ++numberOfTimesThenRetrieved; + return function (onFulfilled) { + onFulfilled(value); + }; + } + return null; + } + } + }); + }, + + "a thenable that tries to fulfill twice": function (value) { + return { + then: function (onFulfilled) { + onFulfilled(value); + onFulfilled(other); + } + }; + }, + + "a thenable that fulfills but then throws": function (value) { + return { + then: function (onFulfilled) { + onFulfilled(value); + throw other; + } + }; + }, + + "an already-fulfilled promise": function (value) { + return resolved(value); + }, + + "an eventually-fulfilled promise": function (value) { + var d = deferred(); + setTimeout(function () { + d.resolve(value); + }, 50); + return d.promise; + } +}; + +exports.rejected = { + "a synchronously-rejected custom thenable": function (reason) { + return { + then: function (onFulfilled, onRejected) { + onRejected(reason); + } + }; + }, + + "an asynchronously-rejected custom thenable": function (reason) { + return { + then: function (onFulfilled, onRejected) { + setTimeout(function () { + onRejected(reason); + }, 0); + } + }; + }, + + "a synchronously-rejected one-time thenable": function (reason) { + var numberOfTimesThenRetrieved = 0; + return Object.create(null, { + then: { + get: function () { + if (numberOfTimesThenRetrieved === 0) { + ++numberOfTimesThenRetrieved; + return function (onFulfilled, onRejected) { + onRejected(reason); + }; + } + return null; + } + } + }); + }, + + "a thenable that immediately throws in `then`": function (reason) { + return { + then: function () { + throw reason; + } + }; + }, + + "an object with a throwing `then` accessor": function (reason) { + return Object.create(null, { + then: { + get: function () { + throw reason; + } + } + }); + }, + + "an already-rejected promise": function (reason) { + return rejected(reason); + }, + + "an eventually-rejected promise": function (reason) { + var d = deferred(); + setTimeout(function () { + d.reject(reason); + }, 50); + return d.promise; + } +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],24:[function(require,module,exports){ +/** + * Sinon core utilities. For internal use only. + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +var sinon = (function () { + var sinon; + var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + sinon = module.exports = require("./sinon/util/core"); + require("./sinon/extend"); + require("./sinon/typeOf"); + require("./sinon/times_in_words"); + require("./sinon/spy"); + require("./sinon/call"); + require("./sinon/behavior"); + require("./sinon/stub"); + require("./sinon/mock"); + require("./sinon/collection"); + require("./sinon/assert"); + require("./sinon/sandbox"); + require("./sinon/test"); + require("./sinon/test_case"); + require("./sinon/match"); + require("./sinon/format"); + require("./sinon/log_error"); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + sinon = module.exports; + } else { + sinon = {}; + } + + return sinon; +}()); + +},{"./sinon/assert":25,"./sinon/behavior":26,"./sinon/call":27,"./sinon/collection":28,"./sinon/extend":29,"./sinon/format":30,"./sinon/log_error":31,"./sinon/match":32,"./sinon/mock":33,"./sinon/sandbox":34,"./sinon/spy":35,"./sinon/stub":36,"./sinon/test":37,"./sinon/test_case":38,"./sinon/times_in_words":39,"./sinon/typeOf":40,"./sinon/util/core":41}],25:[function(require,module,exports){ +(function (global){ +/** + * @depend times_in_words.js + * @depend util/core.js + * @depend match.js + * @depend format.js + */ +/** + * Assertions matching the test spy retrieval interface. + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +(function (sinon, global) { + var slice = Array.prototype.slice; + + function makeApi(sinon) { + var assert; + + function verifyIsStub() { + var method; + + for (var i = 0, l = arguments.length; i < l; ++i) { + method = arguments[i]; + + if (!method) { + assert.fail("fake is not a spy"); + } + + if (method.proxy) { + verifyIsStub(method.proxy); + } else { + if (typeof method != "function") { + assert.fail(method + " is not a function"); + } + + if (typeof method.getCall != "function") { + assert.fail(method + " is not stubbed"); + } + } + + } + } + + function failAssertion(object, msg) { + object = object || global; + var failMethod = object.fail || assert.fail; + failMethod.call(object, msg); + } + + function mirrorPropAsAssertion(name, method, message) { + if (arguments.length == 2) { + message = method; + method = name; + } + + assert[name] = function (fake) { + verifyIsStub(fake); + + var args = slice.call(arguments, 1); + var failed = false; + + if (typeof method == "function") { + failed = !method(fake); + } else { + failed = typeof fake[method] == "function" ? + !fake[method].apply(fake, args) : !fake[method]; + } + + if (failed) { + failAssertion(this, (fake.printf || fake.proxy.printf).apply(fake, [message].concat(args))); + } else { + assert.pass(name); + } + }; + } + + function exposedName(prefix, prop) { + return !prefix || /^fail/.test(prop) ? prop : + prefix + prop.slice(0, 1).toUpperCase() + prop.slice(1); + } + + assert = { + failException: "AssertError", + + fail: function fail(message) { + var error = new Error(message); + error.name = this.failException || assert.failException; + + throw error; + }, + + pass: function pass(assertion) {}, + + callOrder: function assertCallOrder() { + verifyIsStub.apply(null, arguments); + var expected = "", actual = ""; + + if (!sinon.calledInOrder(arguments)) { + try { + expected = [].join.call(arguments, ", "); + var calls = slice.call(arguments); + var i = calls.length; + while (i) { + if (!calls[--i].called) { + calls.splice(i, 1); + } + } + actual = sinon.orderByFirstCall(calls).join(", "); + } catch (e) { + // If this fails, we'll just fall back to the blank string + } + + failAssertion(this, "expected " + expected + " to be " + + "called in order but were called as " + actual); + } else { + assert.pass("callOrder"); + } + }, + + callCount: function assertCallCount(method, count) { + verifyIsStub(method); + + if (method.callCount != count) { + var msg = "expected %n to be called " + sinon.timesInWords(count) + + " but was called %c%C"; + failAssertion(this, method.printf(msg)); + } else { + assert.pass("callCount"); + } + }, + + expose: function expose(target, options) { + if (!target) { + throw new TypeError("target is null or undefined"); + } + + var o = options || {}; + var prefix = typeof o.prefix == "undefined" && "assert" || o.prefix; + var includeFail = typeof o.includeFail == "undefined" || !!o.includeFail; + + for (var method in this) { + if (method != "expose" && (includeFail || !/^(fail)/.test(method))) { + target[exposedName(prefix, method)] = this[method]; + } + } + + return target; + }, + + match: function match(actual, expectation) { + var matcher = sinon.match(expectation); + if (matcher.test(actual)) { + assert.pass("match"); + } else { + var formatted = [ + "expected value to match", + " expected = " + sinon.format(expectation), + " actual = " + sinon.format(actual) + ] + failAssertion(this, formatted.join("\n")); + } + } + }; + + mirrorPropAsAssertion("called", "expected %n to have been called at least once but was never called"); + mirrorPropAsAssertion("notCalled", function (spy) { return !spy.called; }, + "expected %n to not have been called but was called %c%C"); + mirrorPropAsAssertion("calledOnce", "expected %n to be called once but was called %c%C"); + mirrorPropAsAssertion("calledTwice", "expected %n to be called twice but was called %c%C"); + mirrorPropAsAssertion("calledThrice", "expected %n to be called thrice but was called %c%C"); + mirrorPropAsAssertion("calledOn", "expected %n to be called with %1 as this but was called with %t"); + mirrorPropAsAssertion("alwaysCalledOn", "expected %n to always be called with %1 as this but was called with %t"); + mirrorPropAsAssertion("calledWithNew", "expected %n to be called with new"); + mirrorPropAsAssertion("alwaysCalledWithNew", "expected %n to always be called with new"); + mirrorPropAsAssertion("calledWith", "expected %n to be called with arguments %*%C"); + mirrorPropAsAssertion("calledWithMatch", "expected %n to be called with match %*%C"); + mirrorPropAsAssertion("alwaysCalledWith", "expected %n to always be called with arguments %*%C"); + mirrorPropAsAssertion("alwaysCalledWithMatch", "expected %n to always be called with match %*%C"); + mirrorPropAsAssertion("calledWithExactly", "expected %n to be called with exact arguments %*%C"); + mirrorPropAsAssertion("alwaysCalledWithExactly", "expected %n to always be called with exact arguments %*%C"); + mirrorPropAsAssertion("neverCalledWith", "expected %n to never be called with arguments %*%C"); + mirrorPropAsAssertion("neverCalledWithMatch", "expected %n to never be called with match %*%C"); + mirrorPropAsAssertion("threw", "%n did not throw exception%C"); + mirrorPropAsAssertion("alwaysThrew", "%n did not always throw exception%C"); + + sinon.assert = assert; + return assert; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + require("./match"); + require("./format"); + module.exports = makeApi(sinon); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } + +}(typeof sinon == "object" && sinon || null, typeof window != "undefined" ? window : (typeof self != "undefined") ? self : global)); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./format":30,"./match":32,"./util/core":41}],26:[function(require,module,exports){ +(function (process){ +/** + * @depend util/core.js + * @depend extend.js + */ +/** + * Stub behavior + * + * @author Christian Johansen (christian@cjohansen.no) + * @author Tim Fischbach (mail@timfischbach.de) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +(function (sinon) { + var slice = Array.prototype.slice; + var join = Array.prototype.join; + var useLeftMostCallback = -1; + var useRightMostCallback = -2; + + var nextTick = (function () { + if (typeof process === "object" && typeof process.nextTick === "function") { + return process.nextTick; + } else if (typeof setImmediate === "function") { + return setImmediate; + } else { + return function (callback) { + setTimeout(callback, 0); + }; + } + })(); + + function throwsException(error, message) { + if (typeof error == "string") { + this.exception = new Error(message || ""); + this.exception.name = error; + } else if (!error) { + this.exception = new Error("Error"); + } else { + this.exception = error; + } + + return this; + } + + function getCallback(behavior, args) { + var callArgAt = behavior.callArgAt; + + if (callArgAt >= 0) { + return args[callArgAt]; + } + + var argumentList; + + if (callArgAt === useLeftMostCallback) { + argumentList = args; + } + + if (callArgAt === useRightMostCallback) { + argumentList = slice.call(args).reverse(); + } + + var callArgProp = behavior.callArgProp; + + for (var i = 0, l = argumentList.length; i < l; ++i) { + if (!callArgProp && typeof argumentList[i] == "function") { + return argumentList[i]; + } + + if (callArgProp && argumentList[i] && + typeof argumentList[i][callArgProp] == "function") { + return argumentList[i][callArgProp]; + } + } + + return null; + } + + function makeApi(sinon) { + function getCallbackError(behavior, func, args) { + if (behavior.callArgAt < 0) { + var msg; + + if (behavior.callArgProp) { + msg = sinon.functionName(behavior.stub) + + " expected to yield to '" + behavior.callArgProp + + "', but no object with such a property was passed."; + } else { + msg = sinon.functionName(behavior.stub) + + " expected to yield, but no callback was passed."; + } + + if (args.length > 0) { + msg += " Received [" + join.call(args, ", ") + "]"; + } + + return msg; + } + + return "argument at index " + behavior.callArgAt + " is not a function: " + func; + } + + function callCallback(behavior, args) { + if (typeof behavior.callArgAt == "number") { + var func = getCallback(behavior, args); + + if (typeof func != "function") { + throw new TypeError(getCallbackError(behavior, func, args)); + } + + if (behavior.callbackAsync) { + nextTick(function () { + func.apply(behavior.callbackContext, behavior.callbackArguments); + }); + } else { + func.apply(behavior.callbackContext, behavior.callbackArguments); + } + } + } + + var proto = { + create: function create(stub) { + var behavior = sinon.extend({}, sinon.behavior); + delete behavior.create; + behavior.stub = stub; + + return behavior; + }, + + isPresent: function isPresent() { + return (typeof this.callArgAt == "number" || + this.exception || + typeof this.returnArgAt == "number" || + this.returnThis || + this.returnValueDefined); + }, + + invoke: function invoke(context, args) { + callCallback(this, args); + + if (this.exception) { + throw this.exception; + } else if (typeof this.returnArgAt == "number") { + return args[this.returnArgAt]; + } else if (this.returnThis) { + return context; + } + + return this.returnValue; + }, + + onCall: function onCall(index) { + return this.stub.onCall(index); + }, + + onFirstCall: function onFirstCall() { + return this.stub.onFirstCall(); + }, + + onSecondCall: function onSecondCall() { + return this.stub.onSecondCall(); + }, + + onThirdCall: function onThirdCall() { + return this.stub.onThirdCall(); + }, + + withArgs: function withArgs(/* arguments */) { + throw new Error("Defining a stub by invoking \"stub.onCall(...).withArgs(...)\" is not supported. " + + "Use \"stub.withArgs(...).onCall(...)\" to define sequential behavior for calls with certain arguments."); + }, + + callsArg: function callsArg(pos) { + if (typeof pos != "number") { + throw new TypeError("argument index is not number"); + } + + this.callArgAt = pos; + this.callbackArguments = []; + this.callbackContext = undefined; + this.callArgProp = undefined; + this.callbackAsync = false; + + return this; + }, + + callsArgOn: function callsArgOn(pos, context) { + if (typeof pos != "number") { + throw new TypeError("argument index is not number"); + } + if (typeof context != "object") { + throw new TypeError("argument context is not an object"); + } + + this.callArgAt = pos; + this.callbackArguments = []; + this.callbackContext = context; + this.callArgProp = undefined; + this.callbackAsync = false; + + return this; + }, + + callsArgWith: function callsArgWith(pos) { + if (typeof pos != "number") { + throw new TypeError("argument index is not number"); + } + + this.callArgAt = pos; + this.callbackArguments = slice.call(arguments, 1); + this.callbackContext = undefined; + this.callArgProp = undefined; + this.callbackAsync = false; + + return this; + }, + + callsArgOnWith: function callsArgWith(pos, context) { + if (typeof pos != "number") { + throw new TypeError("argument index is not number"); + } + if (typeof context != "object") { + throw new TypeError("argument context is not an object"); + } + + this.callArgAt = pos; + this.callbackArguments = slice.call(arguments, 2); + this.callbackContext = context; + this.callArgProp = undefined; + this.callbackAsync = false; + + return this; + }, + + yields: function () { + this.callArgAt = useLeftMostCallback; + this.callbackArguments = slice.call(arguments, 0); + this.callbackContext = undefined; + this.callArgProp = undefined; + this.callbackAsync = false; + + return this; + }, + + yieldsRight: function () { + this.callArgAt = useRightMostCallback; + this.callbackArguments = slice.call(arguments, 0); + this.callbackContext = undefined; + this.callArgProp = undefined; + this.callbackAsync = false; + + return this; + }, + + yieldsOn: function (context) { + if (typeof context != "object") { + throw new TypeError("argument context is not an object"); + } + + this.callArgAt = useLeftMostCallback; + this.callbackArguments = slice.call(arguments, 1); + this.callbackContext = context; + this.callArgProp = undefined; + this.callbackAsync = false; + + return this; + }, + + yieldsTo: function (prop) { + this.callArgAt = useLeftMostCallback; + this.callbackArguments = slice.call(arguments, 1); + this.callbackContext = undefined; + this.callArgProp = prop; + this.callbackAsync = false; + + return this; + }, + + yieldsToOn: function (prop, context) { + if (typeof context != "object") { + throw new TypeError("argument context is not an object"); + } + + this.callArgAt = useLeftMostCallback; + this.callbackArguments = slice.call(arguments, 2); + this.callbackContext = context; + this.callArgProp = prop; + this.callbackAsync = false; + + return this; + }, + + throws: throwsException, + throwsException: throwsException, + + returns: function returns(value) { + this.returnValue = value; + this.returnValueDefined = true; + + return this; + }, + + returnsArg: function returnsArg(pos) { + if (typeof pos != "number") { + throw new TypeError("argument index is not number"); + } + + this.returnArgAt = pos; + + return this; + }, + + returnsThis: function returnsThis() { + this.returnThis = true; + + return this; + } + }; + + // create asynchronous versions of callsArg* and yields* methods + for (var method in proto) { + // need to avoid creating anotherasync versions of the newly added async methods + if (proto.hasOwnProperty(method) && + method.match(/^(callsArg|yields)/) && + !method.match(/Async/)) { + proto[method + "Async"] = (function (syncFnName) { + return function () { + var result = this[syncFnName].apply(this, arguments); + this.callbackAsync = true; + return result; + }; + })(method); + } + } + + sinon.behavior = proto; + return proto; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + require("./extend"); + module.exports = makeApi(sinon); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}(typeof sinon == "object" && sinon || null)); + +}).call(this,require('_process')) +},{"./extend":29,"./util/core":41,"_process":4}],27:[function(require,module,exports){ +/** + * @depend util/core.js + * @depend match.js + * @depend format.js + */ +/** + * Spy calls + * + * @author Christian Johansen (christian@cjohansen.no) + * @author Maximilian Antoni (mail@maxantoni.de) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + * Copyright (c) 2013 Maximilian Antoni + */ +"use strict"; + +(function (sinon) { + function makeApi(sinon) { + function throwYieldError(proxy, text, args) { + var msg = sinon.functionName(proxy) + text; + if (args.length) { + msg += " Received [" + slice.call(args).join(", ") + "]"; + } + throw new Error(msg); + } + + var slice = Array.prototype.slice; + + var callProto = { + calledOn: function calledOn(thisValue) { + if (sinon.match && sinon.match.isMatcher(thisValue)) { + return thisValue.test(this.thisValue); + } + return this.thisValue === thisValue; + }, + + calledWith: function calledWith() { + var l = arguments.length; + if (l > this.args.length) { + return false; + } + for (var i = 0; i < l; i += 1) { + if (!sinon.deepEqual(arguments[i], this.args[i])) { + return false; + } + } + + return true; + }, + + calledWithMatch: function calledWithMatch() { + var l = arguments.length; + if (l > this.args.length) { + return false; + } + for (var i = 0; i < l; i += 1) { + var actual = this.args[i]; + var expectation = arguments[i]; + if (!sinon.match || !sinon.match(expectation).test(actual)) { + return false; + } + } + return true; + }, + + calledWithExactly: function calledWithExactly() { + return arguments.length == this.args.length && + this.calledWith.apply(this, arguments); + }, + + notCalledWith: function notCalledWith() { + return !this.calledWith.apply(this, arguments); + }, + + notCalledWithMatch: function notCalledWithMatch() { + return !this.calledWithMatch.apply(this, arguments); + }, + + returned: function returned(value) { + return sinon.deepEqual(value, this.returnValue); + }, + + threw: function threw(error) { + if (typeof error === "undefined" || !this.exception) { + return !!this.exception; + } + + return this.exception === error || this.exception.name === error; + }, + + calledWithNew: function calledWithNew() { + return this.proxy.prototype && this.thisValue instanceof this.proxy; + }, + + calledBefore: function (other) { + return this.callId < other.callId; + }, + + calledAfter: function (other) { + return this.callId > other.callId; + }, + + callArg: function (pos) { + this.args[pos](); + }, + + callArgOn: function (pos, thisValue) { + this.args[pos].apply(thisValue); + }, + + callArgWith: function (pos) { + this.callArgOnWith.apply(this, [pos, null].concat(slice.call(arguments, 1))); + }, + + callArgOnWith: function (pos, thisValue) { + var args = slice.call(arguments, 2); + this.args[pos].apply(thisValue, args); + }, + + yield: function () { + this.yieldOn.apply(this, [null].concat(slice.call(arguments, 0))); + }, + + yieldOn: function (thisValue) { + var args = this.args; + for (var i = 0, l = args.length; i < l; ++i) { + if (typeof args[i] === "function") { + args[i].apply(thisValue, slice.call(arguments, 1)); + return; + } + } + throwYieldError(this.proxy, " cannot yield since no callback was passed.", args); + }, + + yieldTo: function (prop) { + this.yieldToOn.apply(this, [prop, null].concat(slice.call(arguments, 1))); + }, + + yieldToOn: function (prop, thisValue) { + var args = this.args; + for (var i = 0, l = args.length; i < l; ++i) { + if (args[i] && typeof args[i][prop] === "function") { + args[i][prop].apply(thisValue, slice.call(arguments, 2)); + return; + } + } + throwYieldError(this.proxy, " cannot yield to '" + prop + + "' since no callback was passed.", args); + }, + + toString: function () { + var callStr = this.proxy.toString() + "("; + var args = []; + + for (var i = 0, l = this.args.length; i < l; ++i) { + args.push(sinon.format(this.args[i])); + } + + callStr = callStr + args.join(", ") + ")"; + + if (typeof this.returnValue != "undefined") { + callStr += " => " + sinon.format(this.returnValue); + } + + if (this.exception) { + callStr += " !" + this.exception.name; + + if (this.exception.message) { + callStr += "(" + this.exception.message + ")"; + } + } + + return callStr; + } + }; + + callProto.invokeCallback = callProto.yield; + + function createSpyCall(spy, thisValue, args, returnValue, exception, id) { + if (typeof id !== "number") { + throw new TypeError("Call id is not a number"); + } + var proxyCall = sinon.create(callProto); + proxyCall.proxy = spy; + proxyCall.thisValue = thisValue; + proxyCall.args = args; + proxyCall.returnValue = returnValue; + proxyCall.exception = exception; + proxyCall.callId = id; + + return proxyCall; + } + createSpyCall.toString = callProto.toString; // used by mocks + + sinon.spyCall = createSpyCall; + return createSpyCall; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + require("./match"); + require("./format"); + module.exports = makeApi(sinon); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}(typeof sinon == "object" && sinon || null)); + +},{"./format":30,"./match":32,"./util/core":41}],28:[function(require,module,exports){ +/** + * @depend util/core.js + * @depend spy.js + * @depend stub.js + * @depend mock.js + */ +/** + * Collections of stubs, spies and mocks. + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +(function (sinon) { + var push = [].push; + var hasOwnProperty = Object.prototype.hasOwnProperty; + + function getFakes(fakeCollection) { + if (!fakeCollection.fakes) { + fakeCollection.fakes = []; + } + + return fakeCollection.fakes; + } + + function each(fakeCollection, method) { + var fakes = getFakes(fakeCollection); + + for (var i = 0, l = fakes.length; i < l; i += 1) { + if (typeof fakes[i][method] == "function") { + fakes[i][method](); + } + } + } + + function compact(fakeCollection) { + var fakes = getFakes(fakeCollection); + var i = 0; + while (i < fakes.length) { + fakes.splice(i, 1); + } + } + + function makeApi(sinon) { + var collection = { + verify: function resolve() { + each(this, "verify"); + }, + + restore: function restore() { + each(this, "restore"); + compact(this); + }, + + reset: function restore() { + each(this, "reset"); + }, + + verifyAndRestore: function verifyAndRestore() { + var exception; + + try { + this.verify(); + } catch (e) { + exception = e; + } + + this.restore(); + + if (exception) { + throw exception; + } + }, + + add: function add(fake) { + push.call(getFakes(this), fake); + return fake; + }, + + spy: function spy() { + return this.add(sinon.spy.apply(sinon, arguments)); + }, + + stub: function stub(object, property, value) { + if (property) { + var original = object[property]; + + if (typeof original != "function") { + if (!hasOwnProperty.call(object, property)) { + throw new TypeError("Cannot stub non-existent own property " + property); + } + + object[property] = value; + + return this.add({ + restore: function () { + object[property] = original; + } + }); + } + } + if (!property && !!object && typeof object == "object") { + var stubbedObj = sinon.stub.apply(sinon, arguments); + + for (var prop in stubbedObj) { + if (typeof stubbedObj[prop] === "function") { + this.add(stubbedObj[prop]); + } + } + + return stubbedObj; + } + + return this.add(sinon.stub.apply(sinon, arguments)); + }, + + mock: function mock() { + return this.add(sinon.mock.apply(sinon, arguments)); + }, + + inject: function inject(obj) { + var col = this; + + obj.spy = function () { + return col.spy.apply(col, arguments); + }; + + obj.stub = function () { + return col.stub.apply(col, arguments); + }; + + obj.mock = function () { + return col.mock.apply(col, arguments); + }; + + return obj; + } + }; + + sinon.collection = collection; + return collection; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + require("./mock"); + require("./spy"); + require("./stub"); + module.exports = makeApi(sinon); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}(typeof sinon == "object" && sinon || null)); + +},{"./mock":33,"./spy":35,"./stub":36,"./util/core":41}],29:[function(require,module,exports){ +/** + * @depend util/core.js + */ +"use strict"; + +(function (sinon) { + function makeApi(sinon) { + + // Adapted from https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug + var hasDontEnumBug = (function () { + var obj = { + constructor: function () { + return "0"; + }, + toString: function () { + return "1"; + }, + valueOf: function () { + return "2"; + }, + toLocaleString: function () { + return "3"; + }, + prototype: function () { + return "4"; + }, + isPrototypeOf: function () { + return "5"; + }, + propertyIsEnumerable: function () { + return "6"; + }, + hasOwnProperty: function () { + return "7"; + }, + length: function () { + return "8"; + }, + unique: function () { + return "9" + } + }; + + var result = []; + for (var prop in obj) { + result.push(obj[prop]()); + } + return result.join("") !== "0123456789"; + })(); + + /* Public: Extend target in place with all (own) properties from sources in-order. Thus, last source will + * override properties in previous sources. + * + * target - The Object to extend + * sources - Objects to copy properties from. + * + * Returns the extended target + */ + function extend(target /*, sources */) { + var sources = Array.prototype.slice.call(arguments, 1), + source, i, prop; + + for (i = 0; i < sources.length; i++) { + source = sources[i]; + + for (prop in source) { + if (source.hasOwnProperty(prop)) { + target[prop] = source[prop]; + } + } + + // Make sure we copy (own) toString method even when in JScript with DontEnum bug + // See https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug + if (hasDontEnumBug && source.hasOwnProperty("toString") && source.toString !== target.toString) { + target.toString = source.toString; + } + } + + return target; + }; + + sinon.extend = extend; + return sinon.extend; + } + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + module.exports = makeApi(sinon); + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}(typeof sinon == "object" && sinon || null)); + +},{"./util/core":41}],30:[function(require,module,exports){ +/** + * @depend util/core.js + */ +/** + * Format functions + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2014 Christian Johansen + */ +"use strict"; + +(function (sinon, formatio) { + function makeApi(sinon) { + function valueFormatter(value) { + return "" + value; + } + + function getFormatioFormatter() { + var formatter = formatio.configure({ + quoteStrings: false, + limitChildrenCount: 250 + }); + + function format() { + return formatter.ascii.apply(formatter, arguments); + }; + + return format; + } + + function getNodeFormatter(value) { + function format(value) { + return typeof value == "object" && value.toString === Object.prototype.toString ? util.inspect(value) : value; + }; + + try { + var util = require("util"); + } catch (e) { + /* Node, but no util module - would be very old, but better safe than sorry */ + } + + return util ? format : valueFormatter; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function", + formatter; + + if (isNode) { + try { + formatio = require("formatio"); + } catch (e) {} + } + + if (formatio) { + formatter = getFormatioFormatter() + } else if (isNode) { + formatter = getNodeFormatter(); + } else { + formatter = valueFormatter; + } + + sinon.format = formatter; + return sinon.format; + } + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + module.exports = makeApi(sinon); + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}( + (typeof sinon == "object" && sinon || null), + (typeof formatio == "object" && formatio) +)); + +},{"./util/core":41,"formatio":48,"util":6}],31:[function(require,module,exports){ +/** + * @depend util/core.js + */ +/** + * Logs errors + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2014 Christian Johansen + */ +"use strict"; + +(function (sinon) { + // cache a reference to setTimeout, so that our reference won't be stubbed out + // when using fake timers and errors will still get logged + // https://github.com/cjohansen/Sinon.JS/issues/381 + var realSetTimeout = setTimeout; + + function makeApi(sinon) { + + function log() {} + + function logError(label, err) { + var msg = label + " threw exception: "; + + sinon.log(msg + "[" + err.name + "] " + err.message); + + if (err.stack) { + sinon.log(err.stack); + } + + logError.setTimeout(function () { + err.message = msg + err.message; + throw err; + }, 0); + }; + + // wrap realSetTimeout with something we can stub in tests + logError.setTimeout = function (func, timeout) { + realSetTimeout(func, timeout); + } + + var exports = {}; + exports.log = sinon.log = log; + exports.logError = sinon.logError = logError; + + return exports; + } + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + module.exports = makeApi(sinon); + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}(typeof sinon == "object" && sinon || null)); + +},{"./util/core":41}],32:[function(require,module,exports){ +/** + * @depend util/core.js + * @depend typeOf.js + */ +/*jslint eqeqeq: false, onevar: false, plusplus: false*/ +/*global module, require, sinon*/ +/** + * Match functions + * + * @author Maximilian Antoni (mail@maxantoni.de) + * @license BSD + * + * Copyright (c) 2012 Maximilian Antoni + */ +"use strict"; + +(function (sinon) { + function makeApi(sinon) { + function assertType(value, type, name) { + var actual = sinon.typeOf(value); + if (actual !== type) { + throw new TypeError("Expected type of " + name + " to be " + + type + ", but was " + actual); + } + } + + var matcher = { + toString: function () { + return this.message; + } + }; + + function isMatcher(object) { + return matcher.isPrototypeOf(object); + } + + function matchObject(expectation, actual) { + if (actual === null || actual === undefined) { + return false; + } + for (var key in expectation) { + if (expectation.hasOwnProperty(key)) { + var exp = expectation[key]; + var act = actual[key]; + if (match.isMatcher(exp)) { + if (!exp.test(act)) { + return false; + } + } else if (sinon.typeOf(exp) === "object") { + if (!matchObject(exp, act)) { + return false; + } + } else if (!sinon.deepEqual(exp, act)) { + return false; + } + } + } + return true; + } + + matcher.or = function (m2) { + if (!arguments.length) { + throw new TypeError("Matcher expected"); + } else if (!isMatcher(m2)) { + m2 = match(m2); + } + var m1 = this; + var or = sinon.create(matcher); + or.test = function (actual) { + return m1.test(actual) || m2.test(actual); + }; + or.message = m1.message + ".or(" + m2.message + ")"; + return or; + }; + + matcher.and = function (m2) { + if (!arguments.length) { + throw new TypeError("Matcher expected"); + } else if (!isMatcher(m2)) { + m2 = match(m2); + } + var m1 = this; + var and = sinon.create(matcher); + and.test = function (actual) { + return m1.test(actual) && m2.test(actual); + }; + and.message = m1.message + ".and(" + m2.message + ")"; + return and; + }; + + var match = function (expectation, message) { + var m = sinon.create(matcher); + var type = sinon.typeOf(expectation); + switch (type) { + case "object": + if (typeof expectation.test === "function") { + m.test = function (actual) { + return expectation.test(actual) === true; + }; + m.message = "match(" + sinon.functionName(expectation.test) + ")"; + return m; + } + var str = []; + for (var key in expectation) { + if (expectation.hasOwnProperty(key)) { + str.push(key + ": " + expectation[key]); + } + } + m.test = function (actual) { + return matchObject(expectation, actual); + }; + m.message = "match(" + str.join(", ") + ")"; + break; + case "number": + m.test = function (actual) { + return expectation == actual; + }; + break; + case "string": + m.test = function (actual) { + if (typeof actual !== "string") { + return false; + } + return actual.indexOf(expectation) !== -1; + }; + m.message = "match(\"" + expectation + "\")"; + break; + case "regexp": + m.test = function (actual) { + if (typeof actual !== "string") { + return false; + } + return expectation.test(actual); + }; + break; + case "function": + m.test = expectation; + if (message) { + m.message = message; + } else { + m.message = "match(" + sinon.functionName(expectation) + ")"; + } + break; + default: + m.test = function (actual) { + return sinon.deepEqual(expectation, actual); + }; + } + if (!m.message) { + m.message = "match(" + expectation + ")"; + } + return m; + }; + + match.isMatcher = isMatcher; + + match.any = match(function () { + return true; + }, "any"); + + match.defined = match(function (actual) { + return actual !== null && actual !== undefined; + }, "defined"); + + match.truthy = match(function (actual) { + return !!actual; + }, "truthy"); + + match.falsy = match(function (actual) { + return !actual; + }, "falsy"); + + match.same = function (expectation) { + return match(function (actual) { + return expectation === actual; + }, "same(" + expectation + ")"); + }; + + match.typeOf = function (type) { + assertType(type, "string", "type"); + return match(function (actual) { + return sinon.typeOf(actual) === type; + }, "typeOf(\"" + type + "\")"); + }; + + match.instanceOf = function (type) { + assertType(type, "function", "type"); + return match(function (actual) { + return actual instanceof type; + }, "instanceOf(" + sinon.functionName(type) + ")"); + }; + + function createPropertyMatcher(propertyTest, messagePrefix) { + return function (property, value) { + assertType(property, "string", "property"); + var onlyProperty = arguments.length === 1; + var message = messagePrefix + "(\"" + property + "\""; + if (!onlyProperty) { + message += ", " + value; + } + message += ")"; + return match(function (actual) { + if (actual === undefined || actual === null || + !propertyTest(actual, property)) { + return false; + } + return onlyProperty || sinon.deepEqual(value, actual[property]); + }, message); + }; + } + + match.has = createPropertyMatcher(function (actual, property) { + if (typeof actual === "object") { + return property in actual; + } + return actual[property] !== undefined; + }, "has"); + + match.hasOwn = createPropertyMatcher(function (actual, property) { + return actual.hasOwnProperty(property); + }, "hasOwn"); + + match.bool = match.typeOf("boolean"); + match.number = match.typeOf("number"); + match.string = match.typeOf("string"); + match.object = match.typeOf("object"); + match.func = match.typeOf("function"); + match.array = match.typeOf("array"); + match.regexp = match.typeOf("regexp"); + match.date = match.typeOf("date"); + + sinon.match = match; + return match; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + require("./typeOf"); + module.exports = makeApi(sinon); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}(typeof sinon == "object" && sinon || null)); + +},{"./typeOf":40,"./util/core":41}],33:[function(require,module,exports){ +/** + * @depend times_in_words.js + * @depend util/core.js + * @depend call.js + * @depend extend.js + * @depend match.js + * @depend spy.js + * @depend stub.js + * @depend format.js + */ +/** + * Mock functions. + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +(function (sinon) { + function makeApi(sinon) { + var push = [].push; + var match = sinon.match; + + function mock(object) { + if (!object) { + return sinon.expectation.create("Anonymous mock"); + } + + return mock.create(object); + } + + function each(collection, callback) { + if (!collection) { + return; + } + + for (var i = 0, l = collection.length; i < l; i += 1) { + callback(collection[i]); + } + } + + sinon.extend(mock, { + create: function create(object) { + if (!object) { + throw new TypeError("object is null"); + } + + var mockObject = sinon.extend({}, mock); + mockObject.object = object; + delete mockObject.create; + + return mockObject; + }, + + expects: function expects(method) { + if (!method) { + throw new TypeError("method is falsy"); + } + + if (!this.expectations) { + this.expectations = {}; + this.proxies = []; + } + + if (!this.expectations[method]) { + this.expectations[method] = []; + var mockObject = this; + + sinon.wrapMethod(this.object, method, function () { + return mockObject.invokeMethod(method, this, arguments); + }); + + push.call(this.proxies, method); + } + + var expectation = sinon.expectation.create(method); + push.call(this.expectations[method], expectation); + + return expectation; + }, + + restore: function restore() { + var object = this.object; + + each(this.proxies, function (proxy) { + if (typeof object[proxy].restore == "function") { + object[proxy].restore(); + } + }); + }, + + verify: function verify() { + var expectations = this.expectations || {}; + var messages = [], met = []; + + each(this.proxies, function (proxy) { + each(expectations[proxy], function (expectation) { + if (!expectation.met()) { + push.call(messages, expectation.toString()); + } else { + push.call(met, expectation.toString()); + } + }); + }); + + this.restore(); + + if (messages.length > 0) { + sinon.expectation.fail(messages.concat(met).join("\n")); + } else if (met.length > 0) { + sinon.expectation.pass(messages.concat(met).join("\n")); + } + + return true; + }, + + invokeMethod: function invokeMethod(method, thisValue, args) { + var expectations = this.expectations && this.expectations[method]; + var length = expectations && expectations.length || 0, i; + + for (i = 0; i < length; i += 1) { + if (!expectations[i].met() && + expectations[i].allowsCall(thisValue, args)) { + return expectations[i].apply(thisValue, args); + } + } + + var messages = [], available, exhausted = 0; + + for (i = 0; i < length; i += 1) { + if (expectations[i].allowsCall(thisValue, args)) { + available = available || expectations[i]; + } else { + exhausted += 1; + } + push.call(messages, " " + expectations[i].toString()); + } + + if (exhausted === 0) { + return available.apply(thisValue, args); + } + + messages.unshift("Unexpected call: " + sinon.spyCall.toString.call({ + proxy: method, + args: args + })); + + sinon.expectation.fail(messages.join("\n")); + } + }); + + var times = sinon.timesInWords; + var slice = Array.prototype.slice; + + function callCountInWords(callCount) { + if (callCount == 0) { + return "never called"; + } else { + return "called " + times(callCount); + } + } + + function expectedCallCountInWords(expectation) { + var min = expectation.minCalls; + var max = expectation.maxCalls; + + if (typeof min == "number" && typeof max == "number") { + var str = times(min); + + if (min != max) { + str = "at least " + str + " and at most " + times(max); + } + + return str; + } + + if (typeof min == "number") { + return "at least " + times(min); + } + + return "at most " + times(max); + } + + function receivedMinCalls(expectation) { + var hasMinLimit = typeof expectation.minCalls == "number"; + return !hasMinLimit || expectation.callCount >= expectation.minCalls; + } + + function receivedMaxCalls(expectation) { + if (typeof expectation.maxCalls != "number") { + return false; + } + + return expectation.callCount == expectation.maxCalls; + } + + function verifyMatcher(possibleMatcher, arg) { + if (match && match.isMatcher(possibleMatcher)) { + return possibleMatcher.test(arg); + } else { + return true; + } + } + + sinon.expectation = { + minCalls: 1, + maxCalls: 1, + + create: function create(methodName) { + var expectation = sinon.extend(sinon.stub.create(), sinon.expectation); + delete expectation.create; + expectation.method = methodName; + + return expectation; + }, + + invoke: function invoke(func, thisValue, args) { + this.verifyCallAllowed(thisValue, args); + + return sinon.spy.invoke.apply(this, arguments); + }, + + atLeast: function atLeast(num) { + if (typeof num != "number") { + throw new TypeError("'" + num + "' is not number"); + } + + if (!this.limitsSet) { + this.maxCalls = null; + this.limitsSet = true; + } + + this.minCalls = num; + + return this; + }, + + atMost: function atMost(num) { + if (typeof num != "number") { + throw new TypeError("'" + num + "' is not number"); + } + + if (!this.limitsSet) { + this.minCalls = null; + this.limitsSet = true; + } + + this.maxCalls = num; + + return this; + }, + + never: function never() { + return this.exactly(0); + }, + + once: function once() { + return this.exactly(1); + }, + + twice: function twice() { + return this.exactly(2); + }, + + thrice: function thrice() { + return this.exactly(3); + }, + + exactly: function exactly(num) { + if (typeof num != "number") { + throw new TypeError("'" + num + "' is not a number"); + } + + this.atLeast(num); + return this.atMost(num); + }, + + met: function met() { + return !this.failed && receivedMinCalls(this); + }, + + verifyCallAllowed: function verifyCallAllowed(thisValue, args) { + if (receivedMaxCalls(this)) { + this.failed = true; + sinon.expectation.fail(this.method + " already called " + times(this.maxCalls)); + } + + if ("expectedThis" in this && this.expectedThis !== thisValue) { + sinon.expectation.fail(this.method + " called with " + thisValue + " as thisValue, expected " + + this.expectedThis); + } + + if (!("expectedArguments" in this)) { + return; + } + + if (!args) { + sinon.expectation.fail(this.method + " received no arguments, expected " + + sinon.format(this.expectedArguments)); + } + + if (args.length < this.expectedArguments.length) { + sinon.expectation.fail(this.method + " received too few arguments (" + sinon.format(args) + + "), expected " + sinon.format(this.expectedArguments)); + } + + if (this.expectsExactArgCount && + args.length != this.expectedArguments.length) { + sinon.expectation.fail(this.method + " received too many arguments (" + sinon.format(args) + + "), expected " + sinon.format(this.expectedArguments)); + } + + for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) { + + if (!verifyMatcher(this.expectedArguments[i], args[i])) { + sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) + + ", didn't match " + this.expectedArguments.toString()); + } + + if (!sinon.deepEqual(this.expectedArguments[i], args[i])) { + sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) + + ", expected " + sinon.format(this.expectedArguments)); + } + } + }, + + allowsCall: function allowsCall(thisValue, args) { + if (this.met() && receivedMaxCalls(this)) { + return false; + } + + if ("expectedThis" in this && this.expectedThis !== thisValue) { + return false; + } + + if (!("expectedArguments" in this)) { + return true; + } + + args = args || []; + + if (args.length < this.expectedArguments.length) { + return false; + } + + if (this.expectsExactArgCount && + args.length != this.expectedArguments.length) { + return false; + } + + for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) { + if (!verifyMatcher(this.expectedArguments[i], args[i])) { + return false; + } + + if (!sinon.deepEqual(this.expectedArguments[i], args[i])) { + return false; + } + } + + return true; + }, + + withArgs: function withArgs() { + this.expectedArguments = slice.call(arguments); + return this; + }, + + withExactArgs: function withExactArgs() { + this.withArgs.apply(this, arguments); + this.expectsExactArgCount = true; + return this; + }, + + on: function on(thisValue) { + this.expectedThis = thisValue; + return this; + }, + + toString: function () { + var args = (this.expectedArguments || []).slice(); + + if (!this.expectsExactArgCount) { + push.call(args, "[...]"); + } + + var callStr = sinon.spyCall.toString.call({ + proxy: this.method || "anonymous mock expectation", + args: args + }); + + var message = callStr.replace(", [...", "[, ...") + " " + + expectedCallCountInWords(this); + + if (this.met()) { + return "Expectation met: " + message; + } + + return "Expected " + message + " (" + + callCountInWords(this.callCount) + ")"; + }, + + verify: function verify() { + if (!this.met()) { + sinon.expectation.fail(this.toString()); + } else { + sinon.expectation.pass(this.toString()); + } + + return true; + }, + + pass: function pass(message) { + sinon.assert.pass(message); + }, + + fail: function fail(message) { + var exception = new Error(message); + exception.name = "ExpectationError"; + + throw exception; + } + }; + + sinon.mock = mock; + return mock; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + require("./times_in_words"); + require("./call"); + require("./extend"); + require("./match"); + require("./spy"); + require("./stub"); + require("./format"); + + module.exports = makeApi(sinon); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}(typeof sinon == "object" && sinon || null)); + +},{"./call":27,"./extend":29,"./format":30,"./match":32,"./spy":35,"./stub":36,"./times_in_words":39,"./util/core":41}],34:[function(require,module,exports){ +/** + * @depend util/core.js + * @depend extend.js + * @depend collection.js + * @depend util/fake_timers.js + * @depend util/fake_server_with_clock.js + */ +/** + * Manages fake collections as well as fake utilities such as Sinon's + * timers and fake XHR implementation in one convenient object. + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +(function () { + function makeApi(sinon) { + var push = [].push; + + function exposeValue(sandbox, config, key, value) { + if (!value) { + return; + } + + if (config.injectInto && !(key in config.injectInto)) { + config.injectInto[key] = value; + sandbox.injectedKeys.push(key); + } else { + push.call(sandbox.args, value); + } + } + + function prepareSandboxFromConfig(config) { + var sandbox = sinon.create(sinon.sandbox); + + if (config.useFakeServer) { + if (typeof config.useFakeServer == "object") { + sandbox.serverPrototype = config.useFakeServer; + } + + sandbox.useFakeServer(); + } + + if (config.useFakeTimers) { + if (typeof config.useFakeTimers == "object") { + sandbox.useFakeTimers.apply(sandbox, config.useFakeTimers); + } else { + sandbox.useFakeTimers(); + } + } + + return sandbox; + } + + sinon.sandbox = sinon.extend(sinon.create(sinon.collection), { + useFakeTimers: function useFakeTimers() { + this.clock = sinon.useFakeTimers.apply(sinon, arguments); + + return this.add(this.clock); + }, + + serverPrototype: sinon.fakeServer, + + useFakeServer: function useFakeServer() { + var proto = this.serverPrototype || sinon.fakeServer; + + if (!proto || !proto.create) { + return null; + } + + this.server = proto.create(); + return this.add(this.server); + }, + + inject: function (obj) { + sinon.collection.inject.call(this, obj); + + if (this.clock) { + obj.clock = this.clock; + } + + if (this.server) { + obj.server = this.server; + obj.requests = this.server.requests; + } + + obj.match = sinon.match; + + return obj; + }, + + restore: function () { + sinon.collection.restore.apply(this, arguments); + this.restoreContext(); + }, + + restoreContext: function () { + if (this.injectedKeys) { + for (var i = 0, j = this.injectedKeys.length; i < j; i++) { + delete this.injectInto[this.injectedKeys[i]]; + } + this.injectedKeys = []; + } + }, + + create: function (config) { + if (!config) { + return sinon.create(sinon.sandbox); + } + + var sandbox = prepareSandboxFromConfig(config); + sandbox.args = sandbox.args || []; + sandbox.injectedKeys = []; + sandbox.injectInto = config.injectInto; + var prop, value, exposed = sandbox.inject({}); + + if (config.properties) { + for (var i = 0, l = config.properties.length; i < l; i++) { + prop = config.properties[i]; + value = exposed[prop] || prop == "sandbox" && sandbox; + exposeValue(sandbox, config, prop, value); + } + } else { + exposeValue(sandbox, config, "sandbox", value); + } + + return sandbox; + }, + + match: sinon.match + }); + + sinon.sandbox.useFakeXMLHttpRequest = sinon.sandbox.useFakeServer; + + return sinon.sandbox; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + require("./extend"); + require("./util/fake_server_with_clock"); + require("./util/fake_timers"); + require("./collection"); + module.exports = makeApi(sinon); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}()); + +},{"./collection":28,"./extend":29,"./util/core":41,"./util/fake_server_with_clock":44,"./util/fake_timers":45}],35:[function(require,module,exports){ +/** + * @depend times_in_words.js + * @depend util/core.js + * @depend extend.js + * @depend call.js + * @depend format.js + */ +/** + * Spy functions + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +(function (sinon) { + + function makeApi(sinon) { + var push = Array.prototype.push; + var slice = Array.prototype.slice; + var callId = 0; + + function spy(object, property, types) { + if (!property && typeof object == "function") { + return spy.create(object); + } + + if (!object && !property) { + return spy.create(function () { }); + } + + if (types) { + var methodDesc = sinon.getPropertyDescriptor(object, property); + for (var i = 0; i < types.length; i++) { + methodDesc[types[i]] = spy.create(methodDesc[types[i]]); + } + return sinon.wrapMethod(object, property, methodDesc); + } else { + var method = object[property]; + return sinon.wrapMethod(object, property, spy.create(method)); + } + } + + function matchingFake(fakes, args, strict) { + if (!fakes) { + return; + } + + for (var i = 0, l = fakes.length; i < l; i++) { + if (fakes[i].matches(args, strict)) { + return fakes[i]; + } + } + } + + function incrementCallCount() { + this.called = true; + this.callCount += 1; + this.notCalled = false; + this.calledOnce = this.callCount == 1; + this.calledTwice = this.callCount == 2; + this.calledThrice = this.callCount == 3; + } + + function createCallProperties() { + this.firstCall = this.getCall(0); + this.secondCall = this.getCall(1); + this.thirdCall = this.getCall(2); + this.lastCall = this.getCall(this.callCount - 1); + } + + var vars = "a,b,c,d,e,f,g,h,i,j,k,l"; + function createProxy(func, proxyLength) { + // Retain the function length: + var p; + if (proxyLength) { + eval("p = (function proxy(" + vars.substring(0, proxyLength * 2 - 1) + + ") { return p.invoke(func, this, slice.call(arguments)); });"); + } else { + p = function proxy() { + return p.invoke(func, this, slice.call(arguments)); + }; + } + return p; + } + + var uuid = 0; + + // Public API + var spyApi = { + reset: function () { + if (this.invoking) { + var err = new Error("Cannot reset Sinon function while invoking it. " + + "Move the call to .reset outside of the callback."); + err.name = "InvalidResetException"; + throw err; + } + + this.called = false; + this.notCalled = true; + this.calledOnce = false; + this.calledTwice = false; + this.calledThrice = false; + this.callCount = 0; + this.firstCall = null; + this.secondCall = null; + this.thirdCall = null; + this.lastCall = null; + this.args = []; + this.returnValues = []; + this.thisValues = []; + this.exceptions = []; + this.callIds = []; + if (this.fakes) { + for (var i = 0; i < this.fakes.length; i++) { + this.fakes[i].reset(); + } + } + + return this; + }, + + create: function create(func, spyLength) { + var name; + + if (typeof func != "function") { + func = function () { }; + } else { + name = sinon.functionName(func); + } + + if (!spyLength) { + spyLength = func.length; + } + + var proxy = createProxy(func, spyLength); + + sinon.extend(proxy, spy); + delete proxy.create; + sinon.extend(proxy, func); + + proxy.reset(); + proxy.prototype = func.prototype; + proxy.displayName = name || "spy"; + proxy.toString = sinon.functionToString; + proxy.instantiateFake = sinon.spy.create; + proxy.id = "spy#" + uuid++; + + return proxy; + }, + + invoke: function invoke(func, thisValue, args) { + var matching = matchingFake(this.fakes, args); + var exception, returnValue; + + incrementCallCount.call(this); + push.call(this.thisValues, thisValue); + push.call(this.args, args); + push.call(this.callIds, callId++); + + // Make call properties available from within the spied function: + createCallProperties.call(this); + + try { + this.invoking = true; + + if (matching) { + returnValue = matching.invoke(func, thisValue, args); + } else { + returnValue = (this.func || func).apply(thisValue, args); + } + + var thisCall = this.getCall(this.callCount - 1); + if (thisCall.calledWithNew() && typeof returnValue !== "object") { + returnValue = thisValue; + } + } catch (e) { + exception = e; + } finally { + delete this.invoking; + } + + push.call(this.exceptions, exception); + push.call(this.returnValues, returnValue); + + // Make return value and exception available in the calls: + createCallProperties.call(this); + + if (exception !== undefined) { + throw exception; + } + + return returnValue; + }, + + named: function named(name) { + this.displayName = name; + return this; + }, + + getCall: function getCall(i) { + if (i < 0 || i >= this.callCount) { + return null; + } + + return sinon.spyCall(this, this.thisValues[i], this.args[i], + this.returnValues[i], this.exceptions[i], + this.callIds[i]); + }, + + getCalls: function () { + var calls = []; + var i; + + for (i = 0; i < this.callCount; i++) { + calls.push(this.getCall(i)); + } + + return calls; + }, + + calledBefore: function calledBefore(spyFn) { + if (!this.called) { + return false; + } + + if (!spyFn.called) { + return true; + } + + return this.callIds[0] < spyFn.callIds[spyFn.callIds.length - 1]; + }, + + calledAfter: function calledAfter(spyFn) { + if (!this.called || !spyFn.called) { + return false; + } + + return this.callIds[this.callCount - 1] > spyFn.callIds[spyFn.callCount - 1]; + }, + + withArgs: function () { + var args = slice.call(arguments); + + if (this.fakes) { + var match = matchingFake(this.fakes, args, true); + + if (match) { + return match; + } + } else { + this.fakes = []; + } + + var original = this; + var fake = this.instantiateFake(); + fake.matchingAguments = args; + fake.parent = this; + push.call(this.fakes, fake); + + fake.withArgs = function () { + return original.withArgs.apply(original, arguments); + }; + + for (var i = 0; i < this.args.length; i++) { + if (fake.matches(this.args[i])) { + incrementCallCount.call(fake); + push.call(fake.thisValues, this.thisValues[i]); + push.call(fake.args, this.args[i]); + push.call(fake.returnValues, this.returnValues[i]); + push.call(fake.exceptions, this.exceptions[i]); + push.call(fake.callIds, this.callIds[i]); + } + } + createCallProperties.call(fake); + + return fake; + }, + + matches: function (args, strict) { + var margs = this.matchingAguments; + + if (margs.length <= args.length && + sinon.deepEqual(margs, args.slice(0, margs.length))) { + return !strict || margs.length == args.length; + } + }, + + printf: function (format) { + var spy = this; + var args = slice.call(arguments, 1); + var formatter; + + return (format || "").replace(/%(.)/g, function (match, specifyer) { + formatter = spyApi.formatters[specifyer]; + + if (typeof formatter == "function") { + return formatter.call(null, spy, args); + } else if (!isNaN(parseInt(specifyer, 10))) { + return sinon.format(args[specifyer - 1]); + } + + return "%" + specifyer; + }); + } + }; + + function delegateToCalls(method, matchAny, actual, notCalled) { + spyApi[method] = function () { + if (!this.called) { + if (notCalled) { + return notCalled.apply(this, arguments); + } + return false; + } + + var currentCall; + var matches = 0; + + for (var i = 0, l = this.callCount; i < l; i += 1) { + currentCall = this.getCall(i); + + if (currentCall[actual || method].apply(currentCall, arguments)) { + matches += 1; + + if (matchAny) { + return true; + } + } + } + + return matches === this.callCount; + }; + } + + delegateToCalls("calledOn", true); + delegateToCalls("alwaysCalledOn", false, "calledOn"); + delegateToCalls("calledWith", true); + delegateToCalls("calledWithMatch", true); + delegateToCalls("alwaysCalledWith", false, "calledWith"); + delegateToCalls("alwaysCalledWithMatch", false, "calledWithMatch"); + delegateToCalls("calledWithExactly", true); + delegateToCalls("alwaysCalledWithExactly", false, "calledWithExactly"); + delegateToCalls("neverCalledWith", false, "notCalledWith", + function () { return true; }); + delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch", + function () { return true; }); + delegateToCalls("threw", true); + delegateToCalls("alwaysThrew", false, "threw"); + delegateToCalls("returned", true); + delegateToCalls("alwaysReturned", false, "returned"); + delegateToCalls("calledWithNew", true); + delegateToCalls("alwaysCalledWithNew", false, "calledWithNew"); + delegateToCalls("callArg", false, "callArgWith", function () { + throw new Error(this.toString() + " cannot call arg since it was not yet invoked."); + }); + spyApi.callArgWith = spyApi.callArg; + delegateToCalls("callArgOn", false, "callArgOnWith", function () { + throw new Error(this.toString() + " cannot call arg since it was not yet invoked."); + }); + spyApi.callArgOnWith = spyApi.callArgOn; + delegateToCalls("yield", false, "yield", function () { + throw new Error(this.toString() + " cannot yield since it was not yet invoked."); + }); + // "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode. + spyApi.invokeCallback = spyApi.yield; + delegateToCalls("yieldOn", false, "yieldOn", function () { + throw new Error(this.toString() + " cannot yield since it was not yet invoked."); + }); + delegateToCalls("yieldTo", false, "yieldTo", function (property) { + throw new Error(this.toString() + " cannot yield to '" + property + + "' since it was not yet invoked."); + }); + delegateToCalls("yieldToOn", false, "yieldToOn", function (property) { + throw new Error(this.toString() + " cannot yield to '" + property + + "' since it was not yet invoked."); + }); + + spyApi.formatters = { + c: function (spy) { + return sinon.timesInWords(spy.callCount); + }, + + n: function (spy) { + return spy.toString(); + }, + + C: function (spy) { + var calls = []; + + for (var i = 0, l = spy.callCount; i < l; ++i) { + var stringifiedCall = " " + spy.getCall(i).toString(); + if (/\n/.test(calls[i - 1])) { + stringifiedCall = "\n" + stringifiedCall; + } + push.call(calls, stringifiedCall); + } + + return calls.length > 0 ? "\n" + calls.join("\n") : ""; + }, + + t: function (spy) { + var objects = []; + + for (var i = 0, l = spy.callCount; i < l; ++i) { + push.call(objects, sinon.format(spy.thisValues[i])); + } + + return objects.join(", "); + }, + + "*": function (spy, args) { + var formatted = []; + + for (var i = 0, l = args.length; i < l; ++i) { + push.call(formatted, sinon.format(args[i])); + } + + return formatted.join(", "); + } + }; + + sinon.extend(spy, spyApi); + + spy.spyCall = sinon.spyCall; + sinon.spy = spy; + + return spy; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + require("./call"); + require("./extend"); + require("./times_in_words"); + require("./format"); + module.exports = makeApi(sinon); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}(typeof sinon == "object" && sinon || null)); + +},{"./call":27,"./extend":29,"./format":30,"./times_in_words":39,"./util/core":41}],36:[function(require,module,exports){ +/** + * @depend util/core.js + * @depend extend.js + * @depend spy.js + * @depend behavior.js + */ +/** + * Stub functions + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +(function (sinon) { + function makeApi(sinon) { + function stub(object, property, func) { + if (!!func && typeof func != "function" && typeof func != "object") { + throw new TypeError("Custom stub should be a function or a property descriptor"); + } + + var wrapper; + + if (func) { + if (typeof func == "function") { + wrapper = sinon.spy && sinon.spy.create ? sinon.spy.create(func) : func; + } else { + wrapper = func; + if (sinon.spy && sinon.spy.create) { + var types = sinon.objectKeys(wrapper); + for (var i = 0; i < types.length; i++) { + wrapper[types[i]] = sinon.spy.create(wrapper[types[i]]); + } + } + } + } else { + var stubLength = 0; + if (typeof object == "object" && typeof object[property] == "function") { + stubLength = object[property].length; + } + wrapper = stub.create(stubLength); + } + + if (!object && typeof property === "undefined") { + return sinon.stub.create(); + } + + if (typeof property === "undefined" && typeof object == "object") { + for (var prop in object) { + if (typeof object[prop] === "function") { + stub(object, prop); + } + } + + return object; + } + + return sinon.wrapMethod(object, property, wrapper); + } + + function getDefaultBehavior(stub) { + return stub.defaultBehavior || getParentBehaviour(stub) || sinon.behavior.create(stub); + } + + function getParentBehaviour(stub) { + return (stub.parent && getCurrentBehavior(stub.parent)); + } + + function getCurrentBehavior(stub) { + var behavior = stub.behaviors[stub.callCount - 1]; + return behavior && behavior.isPresent() ? behavior : getDefaultBehavior(stub); + } + + var uuid = 0; + + var proto = { + create: function create(stubLength) { + var functionStub = function () { + return getCurrentBehavior(functionStub).invoke(this, arguments); + }; + + functionStub.id = "stub#" + uuid++; + var orig = functionStub; + functionStub = sinon.spy.create(functionStub, stubLength); + functionStub.func = orig; + + sinon.extend(functionStub, stub); + functionStub.instantiateFake = sinon.stub.create; + functionStub.displayName = "stub"; + functionStub.toString = sinon.functionToString; + + functionStub.defaultBehavior = null; + functionStub.behaviors = []; + + return functionStub; + }, + + resetBehavior: function () { + var i; + + this.defaultBehavior = null; + this.behaviors = []; + + delete this.returnValue; + delete this.returnArgAt; + this.returnThis = false; + + if (this.fakes) { + for (i = 0; i < this.fakes.length; i++) { + this.fakes[i].resetBehavior(); + } + } + }, + + onCall: function onCall(index) { + if (!this.behaviors[index]) { + this.behaviors[index] = sinon.behavior.create(this); + } + + return this.behaviors[index]; + }, + + onFirstCall: function onFirstCall() { + return this.onCall(0); + }, + + onSecondCall: function onSecondCall() { + return this.onCall(1); + }, + + onThirdCall: function onThirdCall() { + return this.onCall(2); + } + }; + + for (var method in sinon.behavior) { + if (sinon.behavior.hasOwnProperty(method) && + !proto.hasOwnProperty(method) && + method != "create" && + method != "withArgs" && + method != "invoke") { + proto[method] = (function (behaviorMethod) { + return function () { + this.defaultBehavior = this.defaultBehavior || sinon.behavior.create(this); + this.defaultBehavior[behaviorMethod].apply(this.defaultBehavior, arguments); + return this; + }; + }(method)); + } + } + + sinon.extend(stub, proto); + sinon.stub = stub; + + return stub; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + require("./behavior"); + require("./spy"); + require("./extend"); + module.exports = makeApi(sinon); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}(typeof sinon == "object" && sinon || null)); + +},{"./behavior":26,"./extend":29,"./spy":35,"./util/core":41}],37:[function(require,module,exports){ +/** + * @depend util/core.js + * @depend sandbox.js + */ +/** + * Test function, sandboxes fakes + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +(function (sinon) { + function makeApi(sinon) { + var slice = Array.prototype.slice; + + function test(callback) { + var type = typeof callback; + + if (type != "function") { + throw new TypeError("sinon.test needs to wrap a test function, got " + type); + } + + function sinonSandboxedTest() { + var config = sinon.getConfig(sinon.config); + config.injectInto = config.injectIntoThis && this || config.injectInto; + var sandbox = sinon.sandbox.create(config); + var args = slice.call(arguments); + var oldDone = args.length && args[args.length - 1]; + var exception, result; + + if (typeof oldDone == "function") { + args[args.length - 1] = function sinonDone(result) { + if (result) { + sandbox.restore(); + throw exception; + } else { + sandbox.verifyAndRestore(); + } + oldDone(result); + }; + } + + try { + result = callback.apply(this, args.concat(sandbox.args)); + } catch (e) { + exception = e; + } + + if (typeof oldDone != "function") { + if (typeof exception !== "undefined") { + sandbox.restore(); + throw exception; + } else { + sandbox.verifyAndRestore(); + } + } + + return result; + } + + if (callback.length) { + return function sinonAsyncSandboxedTest(callback) { + return sinonSandboxedTest.apply(this, arguments); + }; + } + + return sinonSandboxedTest; + } + + test.config = { + injectIntoThis: true, + injectInto: null, + properties: ["spy", "stub", "mock", "clock", "server", "requests"], + useFakeTimers: true, + useFakeServer: true + }; + + sinon.test = test; + return test; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + require("./sandbox"); + module.exports = makeApi(sinon); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (sinon) { + makeApi(sinon); + } +}(typeof sinon == "object" && sinon || null)); + +},{"./sandbox":34,"./util/core":41}],38:[function(require,module,exports){ +/** + * @depend util/core.js + * @depend test.js + */ +/** + * Test case, sandboxes all test functions + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +(function (sinon) { + function createTest(property, setUp, tearDown) { + return function () { + if (setUp) { + setUp.apply(this, arguments); + } + + var exception, result; + + try { + result = property.apply(this, arguments); + } catch (e) { + exception = e; + } + + if (tearDown) { + tearDown.apply(this, arguments); + } + + if (exception) { + throw exception; + } + + return result; + }; + } + + function makeApi(sinon) { + function testCase(tests, prefix) { + /*jsl:ignore*/ + if (!tests || typeof tests != "object") { + throw new TypeError("sinon.testCase needs an object with test functions"); + } + /*jsl:end*/ + + prefix = prefix || "test"; + var rPrefix = new RegExp("^" + prefix); + var methods = {}, testName, property, method; + var setUp = tests.setUp; + var tearDown = tests.tearDown; + + for (testName in tests) { + if (tests.hasOwnProperty(testName)) { + property = tests[testName]; + + if (/^(setUp|tearDown)$/.test(testName)) { + continue; + } + + if (typeof property == "function" && rPrefix.test(testName)) { + method = property; + + if (setUp || tearDown) { + method = createTest(property, setUp, tearDown); + } + + methods[testName] = sinon.test(method); + } else { + methods[testName] = tests[testName]; + } + } + } + + return methods; + } + + sinon.testCase = testCase; + return testCase; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + require("./test"); + module.exports = makeApi(sinon); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}(typeof sinon == "object" && sinon || null)); + +},{"./test":37,"./util/core":41}],39:[function(require,module,exports){ +/** + * @depend util/core.js + */ +"use strict"; + +(function (sinon) { + function makeApi(sinon) { + + function timesInWords(count) { + switch (count) { + case 1: + return "once"; + case 2: + return "twice"; + case 3: + return "thrice"; + default: + return (count || 0) + " times"; + } + } + + sinon.timesInWords = timesInWords; + return sinon.timesInWords; + } + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + module.exports = makeApi(sinon); + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}(typeof sinon == "object" && sinon || null)); + +},{"./util/core":41}],40:[function(require,module,exports){ +/** + * @depend util/core.js + */ +/** + * Format functions + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2014 Christian Johansen + */ +"use strict"; + +(function (sinon, formatio) { + function makeApi(sinon) { + function typeOf(value) { + if (value === null) { + return "null"; + } else if (value === undefined) { + return "undefined"; + } + var string = Object.prototype.toString.call(value); + return string.substring(8, string.length - 1).toLowerCase(); + }; + + sinon.typeOf = typeOf; + return sinon.typeOf; + } + + function loadDependencies(require, exports, module) { + var sinon = require("./util/core"); + module.exports = makeApi(sinon); + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}( + (typeof sinon == "object" && sinon || null), + (typeof formatio == "object" && formatio) +)); + +},{"./util/core":41}],41:[function(require,module,exports){ +/** + * @depend ../../sinon.js + */ +/** + * Sinon core utilities. For internal use only. + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +(function (sinon) { + var div = typeof document != "undefined" && document.createElement("div"); + var hasOwn = Object.prototype.hasOwnProperty; + + function isDOMNode(obj) { + var success = false; + + try { + obj.appendChild(div); + success = div.parentNode == obj; + } catch (e) { + return false; + } finally { + try { + obj.removeChild(div); + } catch (e) { + // Remove failed, not much we can do about that + } + } + + return success; + } + + function isElement(obj) { + return div && obj && obj.nodeType === 1 && isDOMNode(obj); + } + + function isFunction(obj) { + return typeof obj === "function" || !!(obj && obj.constructor && obj.call && obj.apply); + } + + function isReallyNaN(val) { + return typeof val === "number" && isNaN(val); + } + + function mirrorProperties(target, source) { + for (var prop in source) { + if (!hasOwn.call(target, prop)) { + target[prop] = source[prop]; + } + } + } + + function isRestorable(obj) { + return typeof obj === "function" && typeof obj.restore === "function" && obj.restore.sinon; + } + + // Cheap way to detect if we have ES5 support. + var hasES5Support = "keys" in Object; + + function makeApi(sinon) { + sinon.wrapMethod = function wrapMethod(object, property, method) { + if (!object) { + throw new TypeError("Should wrap property of object"); + } + + if (typeof method != "function" && typeof method != "object") { + throw new TypeError("Method wrapper should be a function or a property descriptor"); + } + + function checkWrappedMethod(wrappedMethod) { + if (!isFunction(wrappedMethod)) { + error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " + + property + " as function"); + } else if (wrappedMethod.restore && wrappedMethod.restore.sinon) { + error = new TypeError("Attempted to wrap " + property + " which is already wrapped"); + } else if (wrappedMethod.calledBefore) { + var verb = !!wrappedMethod.returns ? "stubbed" : "spied on"; + error = new TypeError("Attempted to wrap " + property + " which is already " + verb); + } + + if (error) { + if (wrappedMethod && wrappedMethod.stackTrace) { + error.stack += "\n--------------\n" + wrappedMethod.stackTrace; + } + throw error; + } + } + + var error, wrappedMethod; + + // IE 8 does not support hasOwnProperty on the window object and Firefox has a problem + // when using hasOwn.call on objects from other frames. + var owned = object.hasOwnProperty ? object.hasOwnProperty(property) : hasOwn.call(object, property); + + if (hasES5Support) { + var methodDesc = (typeof method == "function") ? {value: method} : method, + wrappedMethodDesc = sinon.getPropertyDescriptor(object, property), + i; + + if (!wrappedMethodDesc) { + error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " + + property + " as function"); + } else if (wrappedMethodDesc.restore && wrappedMethodDesc.restore.sinon) { + error = new TypeError("Attempted to wrap " + property + " which is already wrapped"); + } + if (error) { + if (wrappedMethodDesc && wrappedMethodDesc.stackTrace) { + error.stack += "\n--------------\n" + wrappedMethodDesc.stackTrace; + } + throw error; + } + + var types = sinon.objectKeys(methodDesc); + for (i = 0; i < types.length; i++) { + wrappedMethod = wrappedMethodDesc[types[i]]; + checkWrappedMethod(wrappedMethod); + } + + mirrorProperties(methodDesc, wrappedMethodDesc); + for (i = 0; i < types.length; i++) { + mirrorProperties(methodDesc[types[i]], wrappedMethodDesc[types[i]]); + } + Object.defineProperty(object, property, methodDesc); + } else { + wrappedMethod = object[property]; + checkWrappedMethod(wrappedMethod); + object[property] = method; + method.displayName = property; + } + + method.displayName = property; + + // Set up a stack trace which can be used later to find what line of + // code the original method was created on. + method.stackTrace = (new Error("Stack Trace for original")).stack; + + method.restore = function () { + // For prototype properties try to reset by delete first. + // If this fails (ex: localStorage on mobile safari) then force a reset + // via direct assignment. + if (!owned) { + try { + delete object[property]; + } catch (e) {} + // For native code functions `delete` fails without throwing an error + // on Chrome < 43, PhantomJS, etc. + // Use strict equality comparison to check failures then force a reset + // via direct assignment. + if (object[property] === method) { + object[property] = wrappedMethod; + } + } else if (hasES5Support) { + Object.defineProperty(object, property, wrappedMethodDesc); + } + + if (!hasES5Support && object[property] === method) { + object[property] = wrappedMethod; + } + }; + + method.restore.sinon = true; + + if (!hasES5Support) { + mirrorProperties(method, wrappedMethod); + } + + return method; + }; + + sinon.create = function create(proto) { + var F = function () {}; + F.prototype = proto; + return new F(); + }; + + sinon.deepEqual = function deepEqual(a, b) { + if (sinon.match && sinon.match.isMatcher(a)) { + return a.test(b); + } + + if (typeof a != "object" || typeof b != "object") { + if (isReallyNaN(a) && isReallyNaN(b)) { + return true; + } else { + return a === b; + } + } + + if (isElement(a) || isElement(b)) { + return a === b; + } + + if (a === b) { + return true; + } + + if ((a === null && b !== null) || (a !== null && b === null)) { + return false; + } + + if (a instanceof RegExp && b instanceof RegExp) { + return (a.source === b.source) && (a.global === b.global) && + (a.ignoreCase === b.ignoreCase) && (a.multiline === b.multiline); + } + + var aString = Object.prototype.toString.call(a); + if (aString != Object.prototype.toString.call(b)) { + return false; + } + + if (aString == "[object Date]") { + return a.valueOf() === b.valueOf(); + } + + var prop, aLength = 0, bLength = 0; + + if (aString == "[object Array]" && a.length !== b.length) { + return false; + } + + for (prop in a) { + aLength += 1; + + if (!(prop in b)) { + return false; + } + + if (!deepEqual(a[prop], b[prop])) { + return false; + } + } + + for (prop in b) { + bLength += 1; + } + + return aLength == bLength; + }; + + sinon.functionName = function functionName(func) { + var name = func.displayName || func.name; + + // Use function decomposition as a last resort to get function + // name. Does not rely on function decomposition to work - if it + // doesn't debugging will be slightly less informative + // (i.e. toString will say 'spy' rather than 'myFunc'). + if (!name) { + var matches = func.toString().match(/function ([^\s\(]+)/); + name = matches && matches[1]; + } + + return name; + }; + + sinon.functionToString = function toString() { + if (this.getCall && this.callCount) { + var thisValue, prop, i = this.callCount; + + while (i--) { + thisValue = this.getCall(i).thisValue; + + for (prop in thisValue) { + if (thisValue[prop] === this) { + return prop; + } + } + } + } + + return this.displayName || "sinon fake"; + }; + + sinon.objectKeys = function objectKeys(obj) { + if (obj !== Object(obj)) { + throw new TypeError("sinon.objectKeys called on a non-object"); + } + + var keys = []; + var key; + for (key in obj) { + if (hasOwn.call(obj, key)) { + keys.push(key); + } + } + + return keys; + }; + + sinon.getPropertyDescriptor = function getPropertyDescriptor(object, property) { + var proto = object, descriptor; + while (proto && !(descriptor = Object.getOwnPropertyDescriptor(proto, property))) { + proto = Object.getPrototypeOf(proto); + } + return descriptor; + } + + sinon.getConfig = function (custom) { + var config = {}; + custom = custom || {}; + var defaults = sinon.defaultConfig; + + for (var prop in defaults) { + if (defaults.hasOwnProperty(prop)) { + config[prop] = custom.hasOwnProperty(prop) ? custom[prop] : defaults[prop]; + } + } + + return config; + }; + + sinon.defaultConfig = { + injectIntoThis: true, + injectInto: null, + properties: ["spy", "stub", "mock", "clock", "server", "requests"], + useFakeTimers: true, + useFakeServer: true + }; + + sinon.timesInWords = function timesInWords(count) { + return count == 1 && "once" || + count == 2 && "twice" || + count == 3 && "thrice" || + (count || 0) + " times"; + }; + + sinon.calledInOrder = function (spies) { + for (var i = 1, l = spies.length; i < l; i++) { + if (!spies[i - 1].calledBefore(spies[i]) || !spies[i].called) { + return false; + } + } + + return true; + }; + + sinon.orderByFirstCall = function (spies) { + return spies.sort(function (a, b) { + // uuid, won't ever be equal + var aCall = a.getCall(0); + var bCall = b.getCall(0); + var aId = aCall && aCall.callId || -1; + var bId = bCall && bCall.callId || -1; + + return aId < bId ? -1 : 1; + }); + }; + + sinon.createStubInstance = function (constructor) { + if (typeof constructor !== "function") { + throw new TypeError("The constructor should be a function."); + } + return sinon.stub(sinon.create(constructor.prototype)); + }; + + sinon.restore = function (object) { + if (object !== null && typeof object === "object") { + for (var prop in object) { + if (isRestorable(object[prop])) { + object[prop].restore(); + } + } + } else if (isRestorable(object)) { + object.restore(); + } + }; + + return sinon; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports) { + makeApi(exports); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports); + } else if (!sinon) { + return; + } else { + makeApi(sinon); + } +}(typeof sinon == "object" && sinon || null)); + +},{}],42:[function(require,module,exports){ +/** + * Minimal Event interface implementation + * + * Original implementation by Sven Fuchs: https://gist.github.com/995028 + * Modifications and tests by Christian Johansen. + * + * @author Sven Fuchs (svenfuchs@artweb-design.de) + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2011 Sven Fuchs, Christian Johansen + */ +"use strict"; + +if (typeof sinon == "undefined") { + this.sinon = {}; +} + +(function () { + var push = [].push; + + function makeApi(sinon) { + sinon.Event = function Event(type, bubbles, cancelable, target) { + this.initEvent(type, bubbles, cancelable, target); + }; + + sinon.Event.prototype = { + initEvent: function (type, bubbles, cancelable, target) { + this.type = type; + this.bubbles = bubbles; + this.cancelable = cancelable; + this.target = target; + }, + + stopPropagation: function () {}, + + preventDefault: function () { + this.defaultPrevented = true; + } + }; + + sinon.ProgressEvent = function ProgressEvent(type, progressEventRaw, target) { + this.initEvent(type, false, false, target); + this.loaded = progressEventRaw.loaded || null; + this.total = progressEventRaw.total || null; + this.lengthComputable = !!progressEventRaw.total; + }; + + sinon.ProgressEvent.prototype = new sinon.Event(); + + sinon.ProgressEvent.prototype.constructor = sinon.ProgressEvent; + + sinon.CustomEvent = function CustomEvent(type, customData, target) { + this.initEvent(type, false, false, target); + this.detail = customData.detail || null; + }; + + sinon.CustomEvent.prototype = new sinon.Event(); + + sinon.CustomEvent.prototype.constructor = sinon.CustomEvent; + + sinon.EventTarget = { + addEventListener: function addEventListener(event, listener) { + this.eventListeners = this.eventListeners || {}; + this.eventListeners[event] = this.eventListeners[event] || []; + push.call(this.eventListeners[event], listener); + }, + + removeEventListener: function removeEventListener(event, listener) { + var listeners = this.eventListeners && this.eventListeners[event] || []; + + for (var i = 0, l = listeners.length; i < l; ++i) { + if (listeners[i] == listener) { + return listeners.splice(i, 1); + } + } + }, + + dispatchEvent: function dispatchEvent(event) { + var type = event.type; + var listeners = this.eventListeners && this.eventListeners[type] || []; + + for (var i = 0; i < listeners.length; i++) { + if (typeof listeners[i] == "function") { + listeners[i].call(this, event); + } else { + listeners[i].handleEvent(event); + } + } + + return !!event.defaultPrevented; + } + }; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require) { + var sinon = require("./core"); + makeApi(sinon); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require); + } else { + makeApi(sinon); + } +}()); + +},{"./core":41}],43:[function(require,module,exports){ +/** + * @depend fake_xdomain_request.js + * @depend fake_xml_http_request.js + * @depend ../format.js + * @depend ../log_error.js + */ +/** + * The Sinon "server" mimics a web server that receives requests from + * sinon.FakeXMLHttpRequest and provides an API to respond to those requests, + * both synchronously and asynchronously. To respond synchronuously, canned + * answers have to be provided upfront. + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +if (typeof sinon == "undefined") { + var sinon = {}; +} + +(function () { + var push = [].push; + function F() {} + + function create(proto) { + F.prototype = proto; + return new F(); + } + + function responseArray(handler) { + var response = handler; + + if (Object.prototype.toString.call(handler) != "[object Array]") { + response = [200, {}, handler]; + } + + if (typeof response[2] != "string") { + throw new TypeError("Fake server response body should be string, but was " + + typeof response[2]); + } + + return response; + } + + var wloc = typeof window !== "undefined" ? window.location : {}; + var rCurrLoc = new RegExp("^" + wloc.protocol + "//" + wloc.host); + + function matchOne(response, reqMethod, reqUrl) { + var rmeth = response.method; + var matchMethod = !rmeth || rmeth.toLowerCase() == reqMethod.toLowerCase(); + var url = response.url; + var matchUrl = !url || url == reqUrl || (typeof url.test == "function" && url.test(reqUrl)); + + return matchMethod && matchUrl; + } + + function match(response, request) { + var requestUrl = request.url; + + if (!/^https?:\/\//.test(requestUrl) || rCurrLoc.test(requestUrl)) { + requestUrl = requestUrl.replace(rCurrLoc, ""); + } + + if (matchOne(response, this.getHTTPMethod(request), requestUrl)) { + if (typeof response.response == "function") { + var ru = response.url; + var args = [request].concat(ru && typeof ru.exec == "function" ? ru.exec(requestUrl).slice(1) : []); + return response.response.apply(response, args); + } + + return true; + } + + return false; + } + + function makeApi(sinon) { + sinon.fakeServer = { + create: function () { + var server = create(this); + if (!sinon.xhr.supportsCORS) { + this.xhr = sinon.useFakeXDomainRequest(); + } else { + this.xhr = sinon.useFakeXMLHttpRequest(); + } + server.requests = []; + + this.xhr.onCreate = function (xhrObj) { + server.addRequest(xhrObj); + }; + + return server; + }, + + addRequest: function addRequest(xhrObj) { + var server = this; + push.call(this.requests, xhrObj); + + xhrObj.onSend = function () { + server.handleRequest(this); + + if (server.respondImmediately) { + server.respond(); + } else if (server.autoRespond && !server.responding) { + setTimeout(function () { + server.responding = false; + server.respond(); + }, server.autoRespondAfter || 10); + + server.responding = true; + } + }; + }, + + getHTTPMethod: function getHTTPMethod(request) { + if (this.fakeHTTPMethods && /post/i.test(request.method)) { + var matches = (request.requestBody || "").match(/_method=([^\b;]+)/); + return !!matches ? matches[1] : request.method; + } + + return request.method; + }, + + handleRequest: function handleRequest(xhr) { + if (xhr.async) { + if (!this.queue) { + this.queue = []; + } + + push.call(this.queue, xhr); + } else { + this.processRequest(xhr); + } + }, + + log: function log(response, request) { + var str; + + str = "Request:\n" + sinon.format(request) + "\n\n"; + str += "Response:\n" + sinon.format(response) + "\n\n"; + + sinon.log(str); + }, + + respondWith: function respondWith(method, url, body) { + if (arguments.length == 1 && typeof method != "function") { + this.response = responseArray(method); + return; + } + + if (!this.responses) { this.responses = []; } + + if (arguments.length == 1) { + body = method; + url = method = null; + } + + if (arguments.length == 2) { + body = url; + url = method; + method = null; + } + + push.call(this.responses, { + method: method, + url: url, + response: typeof body == "function" ? body : responseArray(body) + }); + }, + + respond: function respond() { + if (arguments.length > 0) { + this.respondWith.apply(this, arguments); + } + + var queue = this.queue || []; + var requests = queue.splice(0, queue.length); + var request; + + while (request = requests.shift()) { + this.processRequest(request); + } + }, + + processRequest: function processRequest(request) { + try { + if (request.aborted) { + return; + } + + var response = this.response || [404, {}, ""]; + + if (this.responses) { + for (var l = this.responses.length, i = l - 1; i >= 0; i--) { + if (match.call(this, this.responses[i], request)) { + response = this.responses[i].response; + break; + } + } + } + + if (request.readyState != 4) { + this.log(response, request); + + request.respond(response[0], response[1], response[2]); + } + } catch (e) { + sinon.logError("Fake server request processing", e); + } + }, + + restore: function restore() { + return this.xhr.restore && this.xhr.restore.apply(this.xhr, arguments); + } + }; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + var sinon = require("./core"); + require("./fake_xdomain_request"); + require("./fake_xml_http_request"); + require("../format"); + makeApi(sinon); + module.exports = sinon; + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else { + makeApi(sinon); + } +}()); + +},{"../format":30,"./core":41,"./fake_xdomain_request":46,"./fake_xml_http_request":47}],44:[function(require,module,exports){ +/** + * @depend fake_server.js + * @depend fake_timers.js + */ +/** + * Add-on for sinon.fakeServer that automatically handles a fake timer along with + * the FakeXMLHttpRequest. The direct inspiration for this add-on is jQuery + * 1.3.x, which does not use xhr object's onreadystatehandler at all - instead, + * it polls the object for completion with setInterval. Dispite the direct + * motivation, there is nothing jQuery-specific in this file, so it can be used + * in any environment where the ajax implementation depends on setInterval or + * setTimeout. + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +(function () { + function makeApi(sinon) { + function Server() {} + Server.prototype = sinon.fakeServer; + + sinon.fakeServerWithClock = new Server(); + + sinon.fakeServerWithClock.addRequest = function addRequest(xhr) { + if (xhr.async) { + if (typeof setTimeout.clock == "object") { + this.clock = setTimeout.clock; + } else { + this.clock = sinon.useFakeTimers(); + this.resetClock = true; + } + + if (!this.longestTimeout) { + var clockSetTimeout = this.clock.setTimeout; + var clockSetInterval = this.clock.setInterval; + var server = this; + + this.clock.setTimeout = function (fn, timeout) { + server.longestTimeout = Math.max(timeout, server.longestTimeout || 0); + + return clockSetTimeout.apply(this, arguments); + }; + + this.clock.setInterval = function (fn, timeout) { + server.longestTimeout = Math.max(timeout, server.longestTimeout || 0); + + return clockSetInterval.apply(this, arguments); + }; + } + } + + return sinon.fakeServer.addRequest.call(this, xhr); + }; + + sinon.fakeServerWithClock.respond = function respond() { + var returnVal = sinon.fakeServer.respond.apply(this, arguments); + + if (this.clock) { + this.clock.tick(this.longestTimeout || 0); + this.longestTimeout = 0; + + if (this.resetClock) { + this.clock.restore(); + this.resetClock = false; + } + } + + return returnVal; + }; + + sinon.fakeServerWithClock.restore = function restore() { + if (this.clock) { + this.clock.restore(); + } + + return sinon.fakeServer.restore.apply(this, arguments); + }; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require) { + var sinon = require("./core"); + require("./fake_server"); + require("./fake_timers"); + makeApi(sinon); + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require); + } else { + makeApi(sinon); + } +}()); + +},{"./core":41,"./fake_server":43,"./fake_timers":45}],45:[function(require,module,exports){ +(function (global){ +/*global lolex */ + +/** + * Fake timer API + * setTimeout + * setInterval + * clearTimeout + * clearInterval + * tick + * reset + * Date + * + * Inspired by jsUnitMockTimeOut from JsUnit + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +if (typeof sinon == "undefined") { + var sinon = {}; +} + +(function (global) { + function makeApi(sinon, lol) { + var llx = typeof lolex !== "undefined" ? lolex : lol; + + sinon.useFakeTimers = function () { + var now, methods = Array.prototype.slice.call(arguments); + + if (typeof methods[0] === "string") { + now = 0; + } else { + now = methods.shift(); + } + + var clock = llx.install(now || 0, methods); + clock.restore = clock.uninstall; + return clock; + }; + + sinon.clock = { + create: function (now) { + return llx.createClock(now); + } + }; + + sinon.timers = { + setTimeout: setTimeout, + clearTimeout: clearTimeout, + setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined), + clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate : undefined), + setInterval: setInterval, + clearInterval: clearInterval, + Date: Date + }; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, epxorts, module, lolex) { + var sinon = require("./core"); + makeApi(sinon, lolex); + module.exports = sinon; + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module, require("lolex")); + } else { + makeApi(sinon); + } +}(typeof global != "undefined" && typeof global !== "function" ? global : this)); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./core":41,"lolex":50}],46:[function(require,module,exports){ +/** + * @depend core.js + * @depend ../extend.js + * @depend event.js + * @depend ../log_error.js + */ +/** + * Fake XDomainRequest object + */ +"use strict"; + +if (typeof sinon == "undefined") { + this.sinon = {}; +} + +// wrapper for global +(function (global) { + var xdr = { XDomainRequest: global.XDomainRequest }; + xdr.GlobalXDomainRequest = global.XDomainRequest; + xdr.supportsXDR = typeof xdr.GlobalXDomainRequest != "undefined"; + xdr.workingXDR = xdr.supportsXDR ? xdr.GlobalXDomainRequest : false; + + function makeApi(sinon) { + sinon.xdr = xdr; + + function FakeXDomainRequest() { + this.readyState = FakeXDomainRequest.UNSENT; + this.requestBody = null; + this.requestHeaders = {}; + this.status = 0; + this.timeout = null; + + if (typeof FakeXDomainRequest.onCreate == "function") { + FakeXDomainRequest.onCreate(this); + } + } + + function verifyState(xdr) { + if (xdr.readyState !== FakeXDomainRequest.OPENED) { + throw new Error("INVALID_STATE_ERR"); + } + + if (xdr.sendFlag) { + throw new Error("INVALID_STATE_ERR"); + } + } + + function verifyRequestSent(xdr) { + if (xdr.readyState == FakeXDomainRequest.UNSENT) { + throw new Error("Request not sent"); + } + if (xdr.readyState == FakeXDomainRequest.DONE) { + throw new Error("Request done"); + } + } + + function verifyResponseBodyType(body) { + if (typeof body != "string") { + var error = new Error("Attempted to respond to fake XDomainRequest with " + + body + ", which is not a string."); + error.name = "InvalidBodyException"; + throw error; + } + } + + sinon.extend(FakeXDomainRequest.prototype, sinon.EventTarget, { + open: function open(method, url) { + this.method = method; + this.url = url; + + this.responseText = null; + this.sendFlag = false; + + this.readyStateChange(FakeXDomainRequest.OPENED); + }, + + readyStateChange: function readyStateChange(state) { + this.readyState = state; + var eventName = ""; + switch (this.readyState) { + case FakeXDomainRequest.UNSENT: + break; + case FakeXDomainRequest.OPENED: + break; + case FakeXDomainRequest.LOADING: + if (this.sendFlag) { + //raise the progress event + eventName = "onprogress"; + } + break; + case FakeXDomainRequest.DONE: + if (this.isTimeout) { + eventName = "ontimeout" + } else if (this.errorFlag || (this.status < 200 || this.status > 299)) { + eventName = "onerror"; + } else { + eventName = "onload" + } + break; + } + + // raising event (if defined) + if (eventName) { + if (typeof this[eventName] == "function") { + try { + this[eventName](); + } catch (e) { + sinon.logError("Fake XHR " + eventName + " handler", e); + } + } + } + }, + + send: function send(data) { + verifyState(this); + + if (!/^(get|head)$/i.test(this.method)) { + this.requestBody = data; + } + this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8"; + + this.errorFlag = false; + this.sendFlag = true; + this.readyStateChange(FakeXDomainRequest.OPENED); + + if (typeof this.onSend == "function") { + this.onSend(this); + } + }, + + abort: function abort() { + this.aborted = true; + this.responseText = null; + this.errorFlag = true; + + if (this.readyState > sinon.FakeXDomainRequest.UNSENT && this.sendFlag) { + this.readyStateChange(sinon.FakeXDomainRequest.DONE); + this.sendFlag = false; + } + }, + + setResponseBody: function setResponseBody(body) { + verifyRequestSent(this); + verifyResponseBodyType(body); + + var chunkSize = this.chunkSize || 10; + var index = 0; + this.responseText = ""; + + do { + this.readyStateChange(FakeXDomainRequest.LOADING); + this.responseText += body.substring(index, index + chunkSize); + index += chunkSize; + } while (index < body.length); + + this.readyStateChange(FakeXDomainRequest.DONE); + }, + + respond: function respond(status, contentType, body) { + // content-type ignored, since XDomainRequest does not carry this + // we keep the same syntax for respond(...) as for FakeXMLHttpRequest to ease + // test integration across browsers + this.status = typeof status == "number" ? status : 200; + this.setResponseBody(body || ""); + }, + + simulatetimeout: function simulatetimeout() { + this.status = 0; + this.isTimeout = true; + // Access to this should actually throw an error + this.responseText = undefined; + this.readyStateChange(FakeXDomainRequest.DONE); + } + }); + + sinon.extend(FakeXDomainRequest, { + UNSENT: 0, + OPENED: 1, + LOADING: 3, + DONE: 4 + }); + + sinon.useFakeXDomainRequest = function useFakeXDomainRequest() { + sinon.FakeXDomainRequest.restore = function restore(keepOnCreate) { + if (xdr.supportsXDR) { + global.XDomainRequest = xdr.GlobalXDomainRequest; + } + + delete sinon.FakeXDomainRequest.restore; + + if (keepOnCreate !== true) { + delete sinon.FakeXDomainRequest.onCreate; + } + }; + if (xdr.supportsXDR) { + global.XDomainRequest = sinon.FakeXDomainRequest; + } + return sinon.FakeXDomainRequest; + }; + + sinon.FakeXDomainRequest = FakeXDomainRequest; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + var sinon = require("./core"); + require("../extend"); + require("./event"); + require("../log_error"); + makeApi(sinon); + module.exports = sinon; + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else { + makeApi(sinon); + } +})(this); + +},{"../extend":29,"../log_error":31,"./core":41,"./event":42}],47:[function(require,module,exports){ +(function (global){ +/** + * @depend core.js + * @depend ../extend.js + * @depend event.js + * @depend ../log_error.js + */ +/** + * Fake XMLHttpRequest object + * + * @author Christian Johansen (christian@cjohansen.no) + * @license BSD + * + * Copyright (c) 2010-2013 Christian Johansen + */ +"use strict"; + +(function (global) { + + var supportsProgress = typeof ProgressEvent !== "undefined"; + var supportsCustomEvent = typeof CustomEvent !== "undefined"; + var sinonXhr = { XMLHttpRequest: global.XMLHttpRequest }; + sinonXhr.GlobalXMLHttpRequest = global.XMLHttpRequest; + sinonXhr.GlobalActiveXObject = global.ActiveXObject; + sinonXhr.supportsActiveX = typeof sinonXhr.GlobalActiveXObject != "undefined"; + sinonXhr.supportsXHR = typeof sinonXhr.GlobalXMLHttpRequest != "undefined"; + sinonXhr.workingXHR = sinonXhr.supportsXHR ? sinonXhr.GlobalXMLHttpRequest : sinonXhr.supportsActiveX + ? function () { return new sinonXhr.GlobalActiveXObject("MSXML2.XMLHTTP.3.0") } : false; + sinonXhr.supportsCORS = sinonXhr.supportsXHR && "withCredentials" in (new sinonXhr.GlobalXMLHttpRequest()); + + /*jsl:ignore*/ + var unsafeHeaders = { + "Accept-Charset": true, + "Accept-Encoding": true, + Connection: true, + "Content-Length": true, + Cookie: true, + Cookie2: true, + "Content-Transfer-Encoding": true, + Date: true, + Expect: true, + Host: true, + "Keep-Alive": true, + Referer: true, + TE: true, + Trailer: true, + "Transfer-Encoding": true, + Upgrade: true, + "User-Agent": true, + Via: true + }; + /*jsl:end*/ + + function FakeXMLHttpRequest() { + this.readyState = FakeXMLHttpRequest.UNSENT; + this.requestHeaders = {}; + this.requestBody = null; + this.status = 0; + this.statusText = ""; + this.upload = new UploadProgress(); + if (sinonXhr.supportsCORS) { + this.withCredentials = false; + } + + var xhr = this; + var events = ["loadstart", "load", "abort", "loadend"]; + + function addEventListener(eventName) { + xhr.addEventListener(eventName, function (event) { + var listener = xhr["on" + eventName]; + + if (listener && typeof listener == "function") { + listener.call(this, event); + } + }); + } + + for (var i = events.length - 1; i >= 0; i--) { + addEventListener(events[i]); + } + + if (typeof FakeXMLHttpRequest.onCreate == "function") { + FakeXMLHttpRequest.onCreate(this); + } + } + + // An upload object is created for each + // FakeXMLHttpRequest and allows upload + // events to be simulated using uploadProgress + // and uploadError. + function UploadProgress() { + this.eventListeners = { + progress: [], + load: [], + abort: [], + error: [] + } + } + + UploadProgress.prototype.addEventListener = function addEventListener(event, listener) { + this.eventListeners[event].push(listener); + }; + + UploadProgress.prototype.removeEventListener = function removeEventListener(event, listener) { + var listeners = this.eventListeners[event] || []; + + for (var i = 0, l = listeners.length; i < l; ++i) { + if (listeners[i] == listener) { + return listeners.splice(i, 1); + } + } + }; + + UploadProgress.prototype.dispatchEvent = function dispatchEvent(event) { + var listeners = this.eventListeners[event.type] || []; + + for (var i = 0, listener; (listener = listeners[i]) != null; i++) { + listener(event); + } + }; + + function verifyState(xhr) { + if (xhr.readyState !== FakeXMLHttpRequest.OPENED) { + throw new Error("INVALID_STATE_ERR"); + } + + if (xhr.sendFlag) { + throw new Error("INVALID_STATE_ERR"); + } + } + + function getHeader(headers, header) { + header = header.toLowerCase(); + + for (var h in headers) { + if (h.toLowerCase() == header) { + return h; + } + } + + return null; + } + + // filtering to enable a white-list version of Sinon FakeXhr, + // where whitelisted requests are passed through to real XHR + function each(collection, callback) { + if (!collection) { + return; + } + + for (var i = 0, l = collection.length; i < l; i += 1) { + callback(collection[i]); + } + } + function some(collection, callback) { + for (var index = 0; index < collection.length; index++) { + if (callback(collection[index]) === true) { + return true; + } + } + return false; + } + // largest arity in XHR is 5 - XHR#open + var apply = function (obj, method, args) { + switch (args.length) { + case 0: return obj[method](); + case 1: return obj[method](args[0]); + case 2: return obj[method](args[0], args[1]); + case 3: return obj[method](args[0], args[1], args[2]); + case 4: return obj[method](args[0], args[1], args[2], args[3]); + case 5: return obj[method](args[0], args[1], args[2], args[3], args[4]); + } + }; + + FakeXMLHttpRequest.filters = []; + FakeXMLHttpRequest.addFilter = function addFilter(fn) { + this.filters.push(fn) + }; + var IE6Re = /MSIE 6/; + FakeXMLHttpRequest.defake = function defake(fakeXhr, xhrArgs) { + var xhr = new sinonXhr.workingXHR(); + each([ + "open", + "setRequestHeader", + "send", + "abort", + "getResponseHeader", + "getAllResponseHeaders", + "addEventListener", + "overrideMimeType", + "removeEventListener" + ], function (method) { + fakeXhr[method] = function () { + return apply(xhr, method, arguments); + }; + }); + + var copyAttrs = function (args) { + each(args, function (attr) { + try { + fakeXhr[attr] = xhr[attr] + } catch (e) { + if (!IE6Re.test(navigator.userAgent)) { + throw e; + } + } + }); + }; + + var stateChange = function stateChange() { + fakeXhr.readyState = xhr.readyState; + if (xhr.readyState >= FakeXMLHttpRequest.HEADERS_RECEIVED) { + copyAttrs(["status", "statusText"]); + } + if (xhr.readyState >= FakeXMLHttpRequest.LOADING) { + copyAttrs(["responseText", "response"]); + } + if (xhr.readyState === FakeXMLHttpRequest.DONE) { + copyAttrs(["responseXML"]); + } + if (fakeXhr.onreadystatechange) { + fakeXhr.onreadystatechange.call(fakeXhr, { target: fakeXhr }); + } + }; + + if (xhr.addEventListener) { + for (var event in fakeXhr.eventListeners) { + if (fakeXhr.eventListeners.hasOwnProperty(event)) { + each(fakeXhr.eventListeners[event], function (handler) { + xhr.addEventListener(event, handler); + }); + } + } + xhr.addEventListener("readystatechange", stateChange); + } else { + xhr.onreadystatechange = stateChange; + } + apply(xhr, "open", xhrArgs); + }; + FakeXMLHttpRequest.useFilters = false; + + function verifyRequestOpened(xhr) { + if (xhr.readyState != FakeXMLHttpRequest.OPENED) { + throw new Error("INVALID_STATE_ERR - " + xhr.readyState); + } + } + + function verifyRequestSent(xhr) { + if (xhr.readyState == FakeXMLHttpRequest.DONE) { + throw new Error("Request done"); + } + } + + function verifyHeadersReceived(xhr) { + if (xhr.async && xhr.readyState != FakeXMLHttpRequest.HEADERS_RECEIVED) { + throw new Error("No headers received"); + } + } + + function verifyResponseBodyType(body) { + if (typeof body != "string") { + var error = new Error("Attempted to respond to fake XMLHttpRequest with " + + body + ", which is not a string."); + error.name = "InvalidBodyException"; + throw error; + } + } + + FakeXMLHttpRequest.parseXML = function parseXML(text) { + var xmlDoc; + + if (typeof DOMParser != "undefined") { + var parser = new DOMParser(); + xmlDoc = parser.parseFromString(text, "text/xml"); + } else { + xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); + xmlDoc.async = "false"; + xmlDoc.loadXML(text); + } + + return xmlDoc; + }; + + FakeXMLHttpRequest.statusCodes = { + 100: "Continue", + 101: "Switching Protocols", + 200: "OK", + 201: "Created", + 202: "Accepted", + 203: "Non-Authoritative Information", + 204: "No Content", + 205: "Reset Content", + 206: "Partial Content", + 207: "Multi-Status", + 300: "Multiple Choice", + 301: "Moved Permanently", + 302: "Found", + 303: "See Other", + 304: "Not Modified", + 305: "Use Proxy", + 307: "Temporary Redirect", + 400: "Bad Request", + 401: "Unauthorized", + 402: "Payment Required", + 403: "Forbidden", + 404: "Not Found", + 405: "Method Not Allowed", + 406: "Not Acceptable", + 407: "Proxy Authentication Required", + 408: "Request Timeout", + 409: "Conflict", + 410: "Gone", + 411: "Length Required", + 412: "Precondition Failed", + 413: "Request Entity Too Large", + 414: "Request-URI Too Long", + 415: "Unsupported Media Type", + 416: "Requested Range Not Satisfiable", + 417: "Expectation Failed", + 422: "Unprocessable Entity", + 500: "Internal Server Error", + 501: "Not Implemented", + 502: "Bad Gateway", + 503: "Service Unavailable", + 504: "Gateway Timeout", + 505: "HTTP Version Not Supported" + }; + + function makeApi(sinon) { + sinon.xhr = sinonXhr; + + sinon.extend(FakeXMLHttpRequest.prototype, sinon.EventTarget, { + async: true, + + open: function open(method, url, async, username, password) { + this.method = method; + this.url = url; + this.async = typeof async == "boolean" ? async : true; + this.username = username; + this.password = password; + this.responseText = null; + this.responseXML = null; + this.requestHeaders = {}; + this.sendFlag = false; + + if (FakeXMLHttpRequest.useFilters === true) { + var xhrArgs = arguments; + var defake = some(FakeXMLHttpRequest.filters, function (filter) { + return filter.apply(this, xhrArgs) + }); + if (defake) { + return FakeXMLHttpRequest.defake(this, arguments); + } + } + this.readyStateChange(FakeXMLHttpRequest.OPENED); + }, + + readyStateChange: function readyStateChange(state) { + this.readyState = state; + + if (typeof this.onreadystatechange == "function") { + try { + this.onreadystatechange(); + } catch (e) { + sinon.logError("Fake XHR onreadystatechange handler", e); + } + } + + this.dispatchEvent(new sinon.Event("readystatechange")); + + switch (this.readyState) { + case FakeXMLHttpRequest.DONE: + this.dispatchEvent(new sinon.Event("load", false, false, this)); + this.dispatchEvent(new sinon.Event("loadend", false, false, this)); + this.upload.dispatchEvent(new sinon.Event("load", false, false, this)); + if (supportsProgress) { + this.upload.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100})); + this.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100})); + } + break; + } + }, + + setRequestHeader: function setRequestHeader(header, value) { + verifyState(this); + + if (unsafeHeaders[header] || /^(Sec-|Proxy-)/.test(header)) { + throw new Error("Refused to set unsafe header \"" + header + "\""); + } + + if (this.requestHeaders[header]) { + this.requestHeaders[header] += "," + value; + } else { + this.requestHeaders[header] = value; + } + }, + + // Helps testing + setResponseHeaders: function setResponseHeaders(headers) { + verifyRequestOpened(this); + this.responseHeaders = {}; + + for (var header in headers) { + if (headers.hasOwnProperty(header)) { + this.responseHeaders[header] = headers[header]; + } + } + + if (this.async) { + this.readyStateChange(FakeXMLHttpRequest.HEADERS_RECEIVED); + } else { + this.readyState = FakeXMLHttpRequest.HEADERS_RECEIVED; + } + }, + + // Currently treats ALL data as a DOMString (i.e. no Document) + send: function send(data) { + verifyState(this); + + if (!/^(get|head)$/i.test(this.method)) { + var contentType = getHeader(this.requestHeaders, "Content-Type"); + if (this.requestHeaders[contentType]) { + var value = this.requestHeaders[contentType].split(";"); + this.requestHeaders[contentType] = value[0] + ";charset=utf-8"; + } else if (!(data instanceof FormData)) { + this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8"; + } + + this.requestBody = data; + } + + this.errorFlag = false; + this.sendFlag = this.async; + this.readyStateChange(FakeXMLHttpRequest.OPENED); + + if (typeof this.onSend == "function") { + this.onSend(this); + } + + this.dispatchEvent(new sinon.Event("loadstart", false, false, this)); + }, + + abort: function abort() { + this.aborted = true; + this.responseText = null; + this.errorFlag = true; + this.requestHeaders = {}; + + if (this.readyState > FakeXMLHttpRequest.UNSENT && this.sendFlag) { + this.readyStateChange(FakeXMLHttpRequest.DONE); + this.sendFlag = false; + } + + this.readyState = FakeXMLHttpRequest.UNSENT; + + this.dispatchEvent(new sinon.Event("abort", false, false, this)); + + this.upload.dispatchEvent(new sinon.Event("abort", false, false, this)); + + if (typeof this.onerror === "function") { + this.onerror(); + } + }, + + getResponseHeader: function getResponseHeader(header) { + if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) { + return null; + } + + if (/^Set-Cookie2?$/i.test(header)) { + return null; + } + + header = getHeader(this.responseHeaders, header); + + return this.responseHeaders[header] || null; + }, + + getAllResponseHeaders: function getAllResponseHeaders() { + if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) { + return ""; + } + + var headers = ""; + + for (var header in this.responseHeaders) { + if (this.responseHeaders.hasOwnProperty(header) && + !/^Set-Cookie2?$/i.test(header)) { + headers += header + ": " + this.responseHeaders[header] + "\r\n"; + } + } + + return headers; + }, + + setResponseBody: function setResponseBody(body) { + verifyRequestSent(this); + verifyHeadersReceived(this); + verifyResponseBodyType(body); + + var chunkSize = this.chunkSize || 10; + var index = 0; + this.responseText = ""; + + do { + if (this.async) { + this.readyStateChange(FakeXMLHttpRequest.LOADING); + } + + this.responseText += body.substring(index, index + chunkSize); + index += chunkSize; + } while (index < body.length); + + var type = this.getResponseHeader("Content-Type"); + + if (this.responseText && + (!type || /(text\/xml)|(application\/xml)|(\+xml)/.test(type))) { + try { + this.responseXML = FakeXMLHttpRequest.parseXML(this.responseText); + } catch (e) { + // Unable to parse XML - no biggie + } + } + + this.readyStateChange(FakeXMLHttpRequest.DONE); + }, + + respond: function respond(status, headers, body) { + this.status = typeof status == "number" ? status : 200; + this.statusText = FakeXMLHttpRequest.statusCodes[this.status]; + this.setResponseHeaders(headers || {}); + this.setResponseBody(body || ""); + }, + + uploadProgress: function uploadProgress(progressEventRaw) { + if (supportsProgress) { + this.upload.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw)); + } + }, + + downloadProgress: function downloadProgress(progressEventRaw) { + if (supportsProgress) { + this.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw)); + } + }, + + uploadError: function uploadError(error) { + if (supportsCustomEvent) { + this.upload.dispatchEvent(new sinon.CustomEvent("error", {detail: error})); + } + } + }); + + sinon.extend(FakeXMLHttpRequest, { + UNSENT: 0, + OPENED: 1, + HEADERS_RECEIVED: 2, + LOADING: 3, + DONE: 4 + }); + + sinon.useFakeXMLHttpRequest = function () { + FakeXMLHttpRequest.restore = function restore(keepOnCreate) { + if (sinonXhr.supportsXHR) { + global.XMLHttpRequest = sinonXhr.GlobalXMLHttpRequest; + } + + if (sinonXhr.supportsActiveX) { + global.ActiveXObject = sinonXhr.GlobalActiveXObject; + } + + delete FakeXMLHttpRequest.restore; + + if (keepOnCreate !== true) { + delete FakeXMLHttpRequest.onCreate; + } + }; + if (sinonXhr.supportsXHR) { + global.XMLHttpRequest = FakeXMLHttpRequest; + } + + if (sinonXhr.supportsActiveX) { + global.ActiveXObject = function ActiveXObject(objId) { + if (objId == "Microsoft.XMLHTTP" || /^Msxml2\.XMLHTTP/i.test(objId)) { + + return new FakeXMLHttpRequest(); + } + + return new sinonXhr.GlobalActiveXObject(objId); + }; + } + + return FakeXMLHttpRequest; + }; + + sinon.FakeXMLHttpRequest = FakeXMLHttpRequest; + } + + var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; + var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; + + function loadDependencies(require, exports, module) { + var sinon = require("./core"); + require("../extend"); + require("./event"); + require("../log_error"); + makeApi(sinon); + module.exports = sinon; + } + + if (isAMD) { + define(loadDependencies); + } else if (isNode) { + loadDependencies(require, module.exports, module); + } else if (typeof sinon === "undefined") { + return; + } else { + makeApi(sinon); + } + +})(typeof global !== "undefined" ? global : this); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"../extend":29,"../log_error":31,"./core":41,"./event":42}],48:[function(require,module,exports){ +(function (global){ +((typeof define === "function" && define.amd && function (m) { + define("formatio", ["samsam"], m); +}) || (typeof module === "object" && function (m) { + module.exports = m(require("samsam")); +}) || function (m) { this.formatio = m(this.samsam); } +)(function (samsam) { + "use strict"; + + var formatio = { + excludeConstructors: ["Object", /^.$/], + quoteStrings: true, + limitChildrenCount: 0 + }; + + var hasOwn = Object.prototype.hasOwnProperty; + + var specialObjects = []; + if (typeof global !== "undefined") { + specialObjects.push({ object: global, value: "[object global]" }); + } + if (typeof document !== "undefined") { + specialObjects.push({ + object: document, + value: "[object HTMLDocument]" + }); + } + if (typeof window !== "undefined") { + specialObjects.push({ object: window, value: "[object Window]" }); + } + + function functionName(func) { + if (!func) { return ""; } + if (func.displayName) { return func.displayName; } + if (func.name) { return func.name; } + var matches = func.toString().match(/function\s+([^\(]+)/m); + return (matches && matches[1]) || ""; + } + + function constructorName(f, object) { + var name = functionName(object && object.constructor); + var excludes = f.excludeConstructors || + formatio.excludeConstructors || []; + + var i, l; + for (i = 0, l = excludes.length; i < l; ++i) { + if (typeof excludes[i] === "string" && excludes[i] === name) { + return ""; + } else if (excludes[i].test && excludes[i].test(name)) { + return ""; + } + } + + return name; + } + + function isCircular(object, objects) { + if (typeof object !== "object") { return false; } + var i, l; + for (i = 0, l = objects.length; i < l; ++i) { + if (objects[i] === object) { return true; } + } + return false; + } + + function ascii(f, object, processed, indent) { + if (typeof object === "string") { + var qs = f.quoteStrings; + var quote = typeof qs !== "boolean" || qs; + return processed || quote ? '"' + object + '"' : object; + } + + if (typeof object === "function" && !(object instanceof RegExp)) { + return ascii.func(object); + } + + processed = processed || []; + + if (isCircular(object, processed)) { return "[Circular]"; } + + if (Object.prototype.toString.call(object) === "[object Array]") { + return ascii.array.call(f, object, processed); + } + + if (!object) { return String((1/object) === -Infinity ? "-0" : object); } + if (samsam.isElement(object)) { return ascii.element(object); } + + if (typeof object.toString === "function" && + object.toString !== Object.prototype.toString) { + return object.toString(); + } + + var i, l; + for (i = 0, l = specialObjects.length; i < l; i++) { + if (object === specialObjects[i].object) { + return specialObjects[i].value; + } + } + + return ascii.object.call(f, object, processed, indent); + } + + ascii.func = function (func) { + return "function " + functionName(func) + "() {}"; + }; + + ascii.array = function (array, processed) { + processed = processed || []; + processed.push(array); + var pieces = []; + var i, l; + l = (this.limitChildrenCount > 0) ? + Math.min(this.limitChildrenCount, array.length) : array.length; + + for (i = 0; i < l; ++i) { + pieces.push(ascii(this, array[i], processed)); + } + + if(l < array.length) + pieces.push("[... " + (array.length - l) + " more elements]"); + + return "[" + pieces.join(", ") + "]"; + }; + + ascii.object = function (object, processed, indent) { + processed = processed || []; + processed.push(object); + indent = indent || 0; + var pieces = [], properties = samsam.keys(object).sort(); + var length = 3; + var prop, str, obj, i, k, l; + l = (this.limitChildrenCount > 0) ? + Math.min(this.limitChildrenCount, properties.length) : properties.length; + + for (i = 0; i < l; ++i) { + prop = properties[i]; + obj = object[prop]; + + if (isCircular(obj, processed)) { + str = "[Circular]"; + } else { + str = ascii(this, obj, processed, indent + 2); + } + + str = (/\s/.test(prop) ? '"' + prop + '"' : prop) + ": " + str; + length += str.length; + pieces.push(str); + } + + var cons = constructorName(this, object); + var prefix = cons ? "[" + cons + "] " : ""; + var is = ""; + for (i = 0, k = indent; i < k; ++i) { is += " "; } + + if(l < properties.length) + pieces.push("[... " + (properties.length - l) + " more elements]"); + + if (length + indent > 80) { + return prefix + "{\n " + is + pieces.join(",\n " + is) + "\n" + + is + "}"; + } + return prefix + "{ " + pieces.join(", ") + " }"; + }; + + ascii.element = function (element) { + var tagName = element.tagName.toLowerCase(); + var attrs = element.attributes, attr, pairs = [], attrName, i, l, val; + + for (i = 0, l = attrs.length; i < l; ++i) { + attr = attrs.item(i); + attrName = attr.nodeName.toLowerCase().replace("html:", ""); + val = attr.nodeValue; + if (attrName !== "contenteditable" || val !== "inherit") { + if (!!val) { pairs.push(attrName + "=\"" + val + "\""); } + } + } + + var formatted = "<" + tagName + (pairs.length > 0 ? " " : ""); + var content = element.innerHTML; + + if (content.length > 20) { + content = content.substr(0, 20) + "[...]"; + } + + var res = formatted + pairs.join(" ") + ">" + content + + ""; + + return res.replace(/ contentEditable="inherit"/, ""); + }; + + function Formatio(options) { + for (var opt in options) { + this[opt] = options[opt]; + } + } + + Formatio.prototype = { + functionName: functionName, + + configure: function (options) { + return new Formatio(options); + }, + + constructorName: function (object) { + return constructorName(this, object); + }, + + ascii: function (object, processed, indent) { + return ascii(this, object, processed, indent); + } + }; + + return Formatio.prototype; +}); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"samsam":49}],49:[function(require,module,exports){ +((typeof define === "function" && define.amd && function (m) { define("samsam", m); }) || + (typeof module === "object" && + function (m) { module.exports = m(); }) || // Node + function (m) { this.samsam = m(); } // Browser globals +)(function () { + var o = Object.prototype; + var div = typeof document !== "undefined" && document.createElement("div"); + + function isNaN(value) { + // Unlike global isNaN, this avoids type coercion + // typeof check avoids IE host object issues, hat tip to + // lodash + var val = value; // JsLint thinks value !== value is "weird" + return typeof value === "number" && value !== val; + } + + function getClass(value) { + // Returns the internal [[Class]] by calling Object.prototype.toString + // with the provided value as this. Return value is a string, naming the + // internal class, e.g. "Array" + return o.toString.call(value).split(/[ \]]/)[1]; + } + + /** + * @name samsam.isArguments + * @param Object object + * + * Returns ``true`` if ``object`` is an ``arguments`` object, + * ``false`` otherwise. + */ + function isArguments(object) { + if (getClass(object) === 'Arguments') { return true; } + if (typeof object !== "object" || typeof object.length !== "number" || + getClass(object) === "Array") { + return false; + } + if (typeof object.callee == "function") { return true; } + try { + object[object.length] = 6; + delete object[object.length]; + } catch (e) { + return true; + } + return false; + } + + /** + * @name samsam.isElement + * @param Object object + * + * Returns ``true`` if ``object`` is a DOM element node. Unlike + * Underscore.js/lodash, this function will return ``false`` if ``object`` + * is an *element-like* object, i.e. a regular object with a ``nodeType`` + * property that holds the value ``1``. + */ + function isElement(object) { + if (!object || object.nodeType !== 1 || !div) { return false; } + try { + object.appendChild(div); + object.removeChild(div); + } catch (e) { + return false; + } + return true; + } + + /** + * @name samsam.keys + * @param Object object + * + * Return an array of own property names. + */ + function keys(object) { + var ks = [], prop; + for (prop in object) { + if (o.hasOwnProperty.call(object, prop)) { ks.push(prop); } + } + return ks; + } + + /** + * @name samsam.isDate + * @param Object value + * + * Returns true if the object is a ``Date``, or *date-like*. Duck typing + * of date objects work by checking that the object has a ``getTime`` + * function whose return value equals the return value from the object's + * ``valueOf``. + */ + function isDate(value) { + return typeof value.getTime == "function" && + value.getTime() == value.valueOf(); + } + + /** + * @name samsam.isNegZero + * @param Object value + * + * Returns ``true`` if ``value`` is ``-0``. + */ + function isNegZero(value) { + return value === 0 && 1 / value === -Infinity; + } + + /** + * @name samsam.equal + * @param Object obj1 + * @param Object obj2 + * + * Returns ``true`` if two objects are strictly equal. Compared to + * ``===`` there are two exceptions: + * + * - NaN is considered equal to NaN + * - -0 and +0 are not considered equal + */ + function identical(obj1, obj2) { + if (obj1 === obj2 || (isNaN(obj1) && isNaN(obj2))) { + return obj1 !== 0 || isNegZero(obj1) === isNegZero(obj2); + } + } + + + /** + * @name samsam.deepEqual + * @param Object obj1 + * @param Object obj2 + * + * Deep equal comparison. Two values are "deep equal" if: + * + * - They are equal, according to samsam.identical + * - They are both date objects representing the same time + * - They are both arrays containing elements that are all deepEqual + * - They are objects with the same set of properties, and each property + * in ``obj1`` is deepEqual to the corresponding property in ``obj2`` + * + * Supports cyclic objects. + */ + function deepEqualCyclic(obj1, obj2) { + + // used for cyclic comparison + // contain already visited objects + var objects1 = [], + objects2 = [], + // contain pathes (position in the object structure) + // of the already visited objects + // indexes same as in objects arrays + paths1 = [], + paths2 = [], + // contains combinations of already compared objects + // in the manner: { "$1['ref']$2['ref']": true } + compared = {}; + + /** + * used to check, if the value of a property is an object + * (cyclic logic is only needed for objects) + * only needed for cyclic logic + */ + function isObject(value) { + + if (typeof value === 'object' && value !== null && + !(value instanceof Boolean) && + !(value instanceof Date) && + !(value instanceof Number) && + !(value instanceof RegExp) && + !(value instanceof String)) { + + return true; + } + + return false; + } + + /** + * returns the index of the given object in the + * given objects array, -1 if not contained + * only needed for cyclic logic + */ + function getIndex(objects, obj) { + + var i; + for (i = 0; i < objects.length; i++) { + if (objects[i] === obj) { + return i; + } + } + + return -1; + } + + // does the recursion for the deep equal check + return (function deepEqual(obj1, obj2, path1, path2) { + var type1 = typeof obj1; + var type2 = typeof obj2; + + // == null also matches undefined + if (obj1 === obj2 || + isNaN(obj1) || isNaN(obj2) || + obj1 == null || obj2 == null || + type1 !== "object" || type2 !== "object") { + + return identical(obj1, obj2); + } + + // Elements are only equal if identical(expected, actual) + if (isElement(obj1) || isElement(obj2)) { return false; } + + var isDate1 = isDate(obj1), isDate2 = isDate(obj2); + if (isDate1 || isDate2) { + if (!isDate1 || !isDate2 || obj1.getTime() !== obj2.getTime()) { + return false; + } + } + + if (obj1 instanceof RegExp && obj2 instanceof RegExp) { + if (obj1.toString() !== obj2.toString()) { return false; } + } + + var class1 = getClass(obj1); + var class2 = getClass(obj2); + var keys1 = keys(obj1); + var keys2 = keys(obj2); + + if (isArguments(obj1) || isArguments(obj2)) { + if (obj1.length !== obj2.length) { return false; } + } else { + if (type1 !== type2 || class1 !== class2 || + keys1.length !== keys2.length) { + return false; + } + } + + var key, i, l, + // following vars are used for the cyclic logic + value1, value2, + isObject1, isObject2, + index1, index2, + newPath1, newPath2; + + for (i = 0, l = keys1.length; i < l; i++) { + key = keys1[i]; + if (!o.hasOwnProperty.call(obj2, key)) { + return false; + } + + // Start of the cyclic logic + + value1 = obj1[key]; + value2 = obj2[key]; + + isObject1 = isObject(value1); + isObject2 = isObject(value2); + + // determine, if the objects were already visited + // (it's faster to check for isObject first, than to + // get -1 from getIndex for non objects) + index1 = isObject1 ? getIndex(objects1, value1) : -1; + index2 = isObject2 ? getIndex(objects2, value2) : -1; + + // determine the new pathes of the objects + // - for non cyclic objects the current path will be extended + // by current property name + // - for cyclic objects the stored path is taken + newPath1 = index1 !== -1 + ? paths1[index1] + : path1 + '[' + JSON.stringify(key) + ']'; + newPath2 = index2 !== -1 + ? paths2[index2] + : path2 + '[' + JSON.stringify(key) + ']'; + + // stop recursion if current objects are already compared + if (compared[newPath1 + newPath2]) { + return true; + } + + // remember the current objects and their pathes + if (index1 === -1 && isObject1) { + objects1.push(value1); + paths1.push(newPath1); + } + if (index2 === -1 && isObject2) { + objects2.push(value2); + paths2.push(newPath2); + } + + // remember that the current objects are already compared + if (isObject1 && isObject2) { + compared[newPath1 + newPath2] = true; + } + + // End of cyclic logic + + // neither value1 nor value2 is a cycle + // continue with next level + if (!deepEqual(value1, value2, newPath1, newPath2)) { + return false; + } + } + + return true; + + }(obj1, obj2, '$1', '$2')); + } + + var match; + + function arrayContains(array, subset) { + if (subset.length === 0) { return true; } + var i, l, j, k; + for (i = 0, l = array.length; i < l; ++i) { + if (match(array[i], subset[0])) { + for (j = 0, k = subset.length; j < k; ++j) { + if (!match(array[i + j], subset[j])) { return false; } + } + return true; + } + } + return false; + } + + /** + * @name samsam.match + * @param Object object + * @param Object matcher + * + * Compare arbitrary value ``object`` with matcher. + */ + match = function match(object, matcher) { + if (matcher && typeof matcher.test === "function") { + return matcher.test(object); + } + + if (typeof matcher === "function") { + return matcher(object) === true; + } + + if (typeof matcher === "string") { + matcher = matcher.toLowerCase(); + var notNull = typeof object === "string" || !!object; + return notNull && + (String(object)).toLowerCase().indexOf(matcher) >= 0; + } + + if (typeof matcher === "number") { + return matcher === object; + } + + if (typeof matcher === "boolean") { + return matcher === object; + } + + if (typeof(matcher) === "undefined") { + return typeof(object) === "undefined"; + } + + if (matcher === null) { + return object === null; + } + + if (getClass(object) === "Array" && getClass(matcher) === "Array") { + return arrayContains(object, matcher); + } + + if (matcher && typeof matcher === "object") { + if (matcher === object) { + return true; + } + var prop; + for (prop in matcher) { + var value = object[prop]; + if (typeof value === "undefined" && + typeof object.getAttribute === "function") { + value = object.getAttribute(prop); + } + if (matcher[prop] === null || typeof matcher[prop] === 'undefined') { + if (value !== matcher[prop]) { + return false; + } + } else if (typeof value === "undefined" || !match(value, matcher[prop])) { + return false; + } + } + return true; + } + + throw new Error("Matcher was not a string, a number, a " + + "function, a boolean or an object"); + }; + + return { + isArguments: isArguments, + isElement: isElement, + isDate: isDate, + isNegZero: isNegZero, + identical: identical, + deepEqual: deepEqualCyclic, + match: match, + keys: keys + }; +}); + +},{}],50:[function(require,module,exports){ +(function (global){ +/*jslint eqeqeq: false, plusplus: false, evil: true, onevar: false, browser: true, forin: false*/ +/*global global*/ +/** + * @author Christian Johansen (christian@cjohansen.no) and contributors + * @license BSD + * + * Copyright (c) 2010-2014 Christian Johansen + */ +"use strict"; + +// node expects setTimeout/setInterval to return a fn object w/ .ref()/.unref() +// browsers, a number. +// see https://github.com/cjohansen/Sinon.JS/pull/436 +var timeoutResult = setTimeout(function() {}, 0); +var addTimerReturnsObject = typeof timeoutResult === "object"; +clearTimeout(timeoutResult); + +var NativeDate = Date; +var id = 1; + +/** + * Parse strings like "01:10:00" (meaning 1 hour, 10 minutes, 0 seconds) into + * number of milliseconds. This is used to support human-readable strings passed + * to clock.tick() + */ +function parseTime(str) { + if (!str) { + return 0; + } + + var strings = str.split(":"); + var l = strings.length, i = l; + var ms = 0, parsed; + + if (l > 3 || !/^(\d\d:){0,2}\d\d?$/.test(str)) { + throw new Error("tick only understands numbers and 'h:m:s'"); + } + + while (i--) { + parsed = parseInt(strings[i], 10); + + if (parsed >= 60) { + throw new Error("Invalid time " + str); + } + + ms += parsed * Math.pow(60, (l - i - 1)); + } + + return ms * 1000; +} + +/** + * Used to grok the `now` parameter to createClock. + */ +function getEpoch(epoch) { + if (!epoch) { return 0; } + if (typeof epoch.getTime === "function") { return epoch.getTime(); } + if (typeof epoch === "number") { return epoch; } + throw new TypeError("now should be milliseconds since UNIX epoch"); +} + +function inRange(from, to, timer) { + return timer && timer.callAt >= from && timer.callAt <= to; +} + +function mirrorDateProperties(target, source) { + if (source.now) { + target.now = function now() { + return target.clock.now; + }; + } else { + delete target.now; + } + + if (source.toSource) { + target.toSource = function toSource() { + return source.toSource(); + }; + } else { + delete target.toSource; + } + + target.toString = function toString() { + return source.toString(); + }; + + target.prototype = source.prototype; + target.parse = source.parse; + target.UTC = source.UTC; + target.prototype.toUTCString = source.prototype.toUTCString; + + for (var prop in source) { + if (source.hasOwnProperty(prop)) { + target[prop] = source[prop]; + } + } + + return target; +} + +function createDate() { + function ClockDate(year, month, date, hour, minute, second, ms) { + // Defensive and verbose to avoid potential harm in passing + // explicit undefined when user does not pass argument + switch (arguments.length) { + case 0: + return new NativeDate(ClockDate.clock.now); + case 1: + return new NativeDate(year); + case 2: + return new NativeDate(year, month); + case 3: + return new NativeDate(year, month, date); + case 4: + return new NativeDate(year, month, date, hour); + case 5: + return new NativeDate(year, month, date, hour, minute); + case 6: + return new NativeDate(year, month, date, hour, minute, second); + default: + return new NativeDate(year, month, date, hour, minute, second, ms); + } + } + + return mirrorDateProperties(ClockDate, NativeDate); +} + +function addTimer(clock, timer) { + if (typeof timer.func === "undefined") { + throw new Error("Callback must be provided to timer calls"); + } + + if (!clock.timers) { + clock.timers = {}; + } + + timer.id = id++; + timer.createdAt = clock.now; + timer.callAt = clock.now + (timer.delay || 0); + + clock.timers[timer.id] = timer; + + if (addTimerReturnsObject) { + return { + id: timer.id, + ref: function() {}, + unref: function() {} + }; + } + else { + return timer.id; + } +} + +function firstTimerInRange(clock, from, to) { + var timers = clock.timers, timer = null; + + for (var id in timers) { + if (!inRange(from, to, timers[id])) { + continue; + } + + if (!timer || ~compareTimers(timer, timers[id])) { + timer = timers[id]; + } + } + + return timer; +} + +function compareTimers(a, b) { + // Sort first by absolute timing + if (a.callAt < b.callAt) { + return -1; + } + if (a.callAt > b.callAt) { + return 1; + } + + // Sort next by immediate, immediate timers take precedence + if (a.immediate && !b.immediate) { + return -1; + } + if (!a.immediate && b.immediate) { + return 1; + } + + // Sort next by creation time, earlier-created timers take precedence + if (a.createdAt < b.createdAt) { + return -1; + } + if (a.createdAt > b.createdAt) { + return 1; + } + + // Sort next by id, lower-id timers take precedence + if (a.id < b.id) { + return -1; + } + if (a.id > b.id) { + return 1; + } + + // As timer ids are unique, no fallback `0` is necessary +} + +function callTimer(clock, timer) { + if (typeof timer.interval == "number") { + clock.timers[timer.id].callAt += timer.interval; + } else { + delete clock.timers[timer.id]; + } + + try { + if (typeof timer.func == "function") { + timer.func.apply(null, timer.args); + } else { + eval(timer.func); + } + } catch (e) { + var exception = e; + } + + if (!clock.timers[timer.id]) { + if (exception) { + throw exception; + } + return; + } + + if (exception) { + throw exception; + } +} + +function uninstall(clock, target) { + var method; + + for (var i = 0, l = clock.methods.length; i < l; i++) { + method = clock.methods[i]; + + if (target[method].hadOwnProperty) { + target[method] = clock["_" + method]; + } else { + try { + delete target[method]; + } catch (e) {} + } + } + + // Prevent multiple executions which will completely remove these props + clock.methods = []; +} + +function hijackMethod(target, method, clock) { + clock[method].hadOwnProperty = Object.prototype.hasOwnProperty.call(target, method); + clock["_" + method] = target[method]; + + if (method == "Date") { + var date = mirrorDateProperties(clock[method], target[method]); + target[method] = date; + } else { + target[method] = function () { + return clock[method].apply(clock, arguments); + }; + + for (var prop in clock[method]) { + if (clock[method].hasOwnProperty(prop)) { + target[method][prop] = clock[method][prop]; + } + } + } + + target[method].clock = clock; +} + +var timers = { + setTimeout: setTimeout, + clearTimeout: clearTimeout, + setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined), + clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate: undefined), + setInterval: setInterval, + clearInterval: clearInterval, + Date: Date +}; + +var keys = Object.keys || function (obj) { + var ks = []; + for (var key in obj) { + ks.push(key); + } + return ks; +}; + +exports.timers = timers; + +var createClock = exports.createClock = function (now) { + var clock = { + now: getEpoch(now), + timeouts: {}, + Date: createDate() + }; + + clock.Date.clock = clock; + + clock.setTimeout = function setTimeout(func, timeout) { + return addTimer(clock, { + func: func, + args: Array.prototype.slice.call(arguments, 2), + delay: timeout + }); + }; + + clock.clearTimeout = function clearTimeout(timerId) { + if (!timerId) { + // null appears to be allowed in most browsers, and appears to be + // relied upon by some libraries, like Bootstrap carousel + return; + } + if (!clock.timers) { + clock.timers = []; + } + // in Node, timerId is an object with .ref()/.unref(), and + // its .id field is the actual timer id. + if (typeof timerId === "object") { + timerId = timerId.id + } + if (timerId in clock.timers) { + delete clock.timers[timerId]; + } + }; + + clock.setInterval = function setInterval(func, timeout) { + return addTimer(clock, { + func: func, + args: Array.prototype.slice.call(arguments, 2), + delay: timeout, + interval: timeout + }); + }; + + clock.clearInterval = function clearInterval(timerId) { + clock.clearTimeout(timerId); + }; + + clock.setImmediate = function setImmediate(func) { + return addTimer(clock, { + func: func, + args: Array.prototype.slice.call(arguments, 1), + immediate: true + }); + }; + + clock.clearImmediate = function clearImmediate(timerId) { + clock.clearTimeout(timerId); + }; + + clock.tick = function tick(ms) { + ms = typeof ms == "number" ? ms : parseTime(ms); + var tickFrom = clock.now, tickTo = clock.now + ms, previous = clock.now; + var timer = firstTimerInRange(clock, tickFrom, tickTo); + + var firstException; + while (timer && tickFrom <= tickTo) { + if (clock.timers[timer.id]) { + tickFrom = clock.now = timer.callAt; + try { + callTimer(clock, timer); + } catch (e) { + firstException = firstException || e; + } + } + + timer = firstTimerInRange(clock, previous, tickTo); + previous = tickFrom; + } + + clock.now = tickTo; + + if (firstException) { + throw firstException; + } + + return clock.now; + }; + + clock.reset = function reset() { + clock.timers = {}; + }; + + return clock; +}; + +exports.install = function install(target, now, toFake) { + if (typeof target === "number") { + toFake = now; + now = target; + target = null; + } + + if (!target) { + target = global; + } + + var clock = createClock(now); + + clock.uninstall = function () { + uninstall(clock, target); + }; + + clock.methods = toFake || []; + + if (clock.methods.length === 0) { + clock.methods = keys(timers); + } + + for (var i = 0, l = clock.methods.length; i < l; i++) { + hijackMethod(target, clock.methods[i], clock); + } + + return clock; +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],51:[function(require,module,exports){ +(function (process,global){ +(function() { + "use strict"; + function lib$es6$promise$utils$$objectOrFunction(x) { + return typeof x === 'function' || (typeof x === 'object' && x !== null); + } + + function lib$es6$promise$utils$$isFunction(x) { + return typeof x === 'function'; + } + + function lib$es6$promise$utils$$isMaybeThenable(x) { + return typeof x === 'object' && x !== null; + } + + var lib$es6$promise$utils$$_isArray; + if (!Array.isArray) { + lib$es6$promise$utils$$_isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } else { + lib$es6$promise$utils$$_isArray = Array.isArray; + } + + var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; + var lib$es6$promise$asap$$len = 0; + var lib$es6$promise$asap$$toString = {}.toString; + var lib$es6$promise$asap$$vertxNext; + function lib$es6$promise$asap$$asap(callback, arg) { + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; + lib$es6$promise$asap$$len += 2; + if (lib$es6$promise$asap$$len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + lib$es6$promise$asap$$scheduleFlush(); + } + } + + var lib$es6$promise$asap$$default = lib$es6$promise$asap$$asap; + + var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; + var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; + var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; + var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && + typeof importScripts !== 'undefined' && + typeof MessageChannel !== 'undefined'; + + // node + function lib$es6$promise$asap$$useNextTick() { + var nextTick = process.nextTick; + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // setImmediate should be used instead instead + var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); + if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { + nextTick = setImmediate; + } + return function() { + nextTick(lib$es6$promise$asap$$flush); + }; + } + + // vertx + function lib$es6$promise$asap$$useVertxTimer() { + return function() { + lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); + }; + } + + function lib$es6$promise$asap$$useMutationObserver() { + var iterations = 0; + var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function() { + node.data = (iterations = ++iterations % 2); + }; + } + + // web worker + function lib$es6$promise$asap$$useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = lib$es6$promise$asap$$flush; + return function () { + channel.port2.postMessage(0); + }; + } + + function lib$es6$promise$asap$$useSetTimeout() { + return function() { + setTimeout(lib$es6$promise$asap$$flush, 1); + }; + } + + var lib$es6$promise$asap$$queue = new Array(1000); + function lib$es6$promise$asap$$flush() { + for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { + var callback = lib$es6$promise$asap$$queue[i]; + var arg = lib$es6$promise$asap$$queue[i+1]; + + callback(arg); + + lib$es6$promise$asap$$queue[i] = undefined; + lib$es6$promise$asap$$queue[i+1] = undefined; + } + + lib$es6$promise$asap$$len = 0; + } + + function lib$es6$promise$asap$$attemptVertex() { + try { + var r = require; + var vertx = r('vertx'); + lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; + return lib$es6$promise$asap$$useVertxTimer(); + } catch(e) { + return lib$es6$promise$asap$$useSetTimeout(); + } + } + + var lib$es6$promise$asap$$scheduleFlush; + // Decide what async method to use to triggering processing of queued callbacks: + if (lib$es6$promise$asap$$isNode) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); + } else if (lib$es6$promise$asap$$BrowserMutationObserver) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); + } else if (lib$es6$promise$asap$$isWorker) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); + } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); + } else { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); + } + + function lib$es6$promise$$internal$$noop() {} + + var lib$es6$promise$$internal$$PENDING = void 0; + var lib$es6$promise$$internal$$FULFILLED = 1; + var lib$es6$promise$$internal$$REJECTED = 2; + + var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$selfFullfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function lib$es6$promise$$internal$$cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function lib$es6$promise$$internal$$getThen(promise) { + try { + return promise.then; + } catch(error) { + lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; + return lib$es6$promise$$internal$$GET_THEN_ERROR; + } + } + + function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch(e) { + return e; + } + } + + function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { + lib$es6$promise$asap$$default(function(promise) { + var sealed = false; + var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { + if (sealed) { return; } + sealed = true; + if (thenable !== value) { + lib$es6$promise$$internal$$resolve(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + }, function(reason) { + if (sealed) { return; } + sealed = true; + + lib$es6$promise$$internal$$reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + lib$es6$promise$$internal$$reject(promise, error); + } + }, promise); + } + + function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { + if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, thenable._result); + } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, thenable._result); + } else { + lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { + lib$es6$promise$$internal$$resolve(promise, value); + }, function(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } + } + + function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { + if (maybeThenable.constructor === promise.constructor) { + lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); + } else { + var then = lib$es6$promise$$internal$$getThen(maybeThenable); + + if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); + } else if (then === undefined) { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } else if (lib$es6$promise$utils$$isFunction(then)) { + lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); + } else { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } + } + } + + function lib$es6$promise$$internal$$resolve(promise, value) { + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); + } else if (lib$es6$promise$utils$$objectOrFunction(value)) { + lib$es6$promise$$internal$$handleMaybeThenable(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + } + + function lib$es6$promise$$internal$$publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + lib$es6$promise$$internal$$publish(promise); + } + + function lib$es6$promise$$internal$$fulfill(promise, value) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + + promise._result = value; + promise._state = lib$es6$promise$$internal$$FULFILLED; + + if (promise._subscribers.length !== 0) { + lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, promise); + } + } + + function lib$es6$promise$$internal$$reject(promise, reason) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + promise._state = lib$es6$promise$$internal$$REJECTED; + promise._result = reason; + + lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publishRejection, promise); + } + + function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { + var subscribers = parent._subscribers; + var length = subscribers.length; + + parent._onerror = null; + + subscribers[length] = child; + subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; + subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; + + if (length === 0 && parent._state) { + lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, parent); + } + } + + function lib$es6$promise$$internal$$publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { return; } + + var child, callback, detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function lib$es6$promise$$internal$$ErrorObject() { + this.error = null; + } + + var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$tryCatch(callback, detail) { + try { + return callback(detail); + } catch(e) { + lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; + return lib$es6$promise$$internal$$TRY_CATCH_ERROR; + } + } + + function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { + var hasCallback = lib$es6$promise$utils$$isFunction(callback), + value, error, succeeded, failed; + + if (hasCallback) { + value = lib$es6$promise$$internal$$tryCatch(callback, detail); + + if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value = null; + } else { + succeeded = true; + } + + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); + return; + } + + } else { + value = detail; + succeeded = true; + } + + if (promise._state !== lib$es6$promise$$internal$$PENDING) { + // noop + } else if (hasCallback && succeeded) { + lib$es6$promise$$internal$$resolve(promise, value); + } else if (failed) { + lib$es6$promise$$internal$$reject(promise, error); + } else if (settled === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, value); + } else if (settled === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } + } + + function lib$es6$promise$$internal$$initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value){ + lib$es6$promise$$internal$$resolve(promise, value); + }, function rejectPromise(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } catch(e) { + lib$es6$promise$$internal$$reject(promise, e); + } + } + + function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { + var enumerator = this; + + enumerator._instanceConstructor = Constructor; + enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (enumerator._validateInput(input)) { + enumerator._input = input; + enumerator.length = input.length; + enumerator._remaining = input.length; + + enumerator._init(); + + if (enumerator.length === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } else { + enumerator.length = enumerator.length || 0; + enumerator._enumerate(); + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } + } + } else { + lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); + } + } + + lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { + return lib$es6$promise$utils$$isArray(input); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { + return new Error('Array Methods must be provided an Array'); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { + this._result = new Array(this.length); + }; + + var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; + + lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { + var enumerator = this; + + var length = enumerator.length; + var promise = enumerator.promise; + var input = enumerator._input; + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + enumerator._eachEntry(input[i], i); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { + var enumerator = this; + var c = enumerator._instanceConstructor; + + if (lib$es6$promise$utils$$isMaybeThenable(entry)) { + if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { + entry._onerror = null; + enumerator._settledAt(entry._state, i, entry._result); + } else { + enumerator._willSettleAt(c.resolve(entry), i); + } + } else { + enumerator._remaining--; + enumerator._result[i] = entry; + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { + var enumerator = this; + var promise = enumerator.promise; + + if (promise._state === lib$es6$promise$$internal$$PENDING) { + enumerator._remaining--; + + if (state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } else { + enumerator._result[i] = value; + } + } + + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(promise, enumerator._result); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { + var enumerator = this; + + lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { + enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); + }, function(reason) { + enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); + }); + }; + function lib$es6$promise$promise$all$$all(entries) { + return new lib$es6$promise$enumerator$$default(this, entries).promise; + } + var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; + function lib$es6$promise$promise$race$$race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (!lib$es6$promise$utils$$isArray(entries)) { + lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); + return promise; + } + + var length = entries.length; + + function onFulfillment(value) { + lib$es6$promise$$internal$$resolve(promise, value); + } + + function onRejection(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + } + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); + } + + return promise; + } + var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; + function lib$es6$promise$promise$resolve$$resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$resolve(promise, object); + return promise; + } + var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; + function lib$es6$promise$promise$reject$$reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$reject(promise, reason); + return promise; + } + var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; + + var lib$es6$promise$promise$$counter = 0; + + function lib$es6$promise$promise$$needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function lib$es6$promise$promise$$needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise’s eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + var promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + var xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor + */ + function lib$es6$promise$promise$$Promise(resolver) { + this._id = lib$es6$promise$promise$$counter++; + this._state = undefined; + this._result = undefined; + this._subscribers = []; + + if (lib$es6$promise$$internal$$noop !== resolver) { + if (!lib$es6$promise$utils$$isFunction(resolver)) { + lib$es6$promise$promise$$needsResolver(); + } + + if (!(this instanceof lib$es6$promise$promise$$Promise)) { + lib$es6$promise$promise$$needsNew(); + } + + lib$es6$promise$$internal$$initializePromise(this, resolver); + } + } + + lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; + lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; + lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; + lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; + + lib$es6$promise$promise$$Promise.prototype = { + constructor: lib$es6$promise$promise$$Promise, + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + var result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + var author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + then: function(onFulfillment, onRejection) { + var parent = this; + var state = parent._state; + + if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { + return this; + } + + var child = new this.constructor(lib$es6$promise$$internal$$noop); + var result = parent._result; + + if (state) { + var callback = arguments[state - 1]; + lib$es6$promise$asap$$default(function(){ + lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); + }); + } else { + lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + }, + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + 'catch': function(onRejection) { + return this.then(null, onRejection); + } + }; + function lib$es6$promise$polyfill$$polyfill() { + var local; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { + return; + } + + local.Promise = lib$es6$promise$promise$$default; + } + var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; + + var lib$es6$promise$umd$$ES6Promise = { + 'Promise': lib$es6$promise$promise$$default, + 'polyfill': lib$es6$promise$polyfill$$default + }; + + /* global define:true module:true window: true */ + if (typeof define === 'function' && define['amd']) { + define(function() { return lib$es6$promise$umd$$ES6Promise; }); + } else if (typeof module !== 'undefined' && module['exports']) { + module['exports'] = lib$es6$promise$umd$$ES6Promise; + } else if (typeof this !== 'undefined') { + this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; + } + + lib$es6$promise$polyfill$$default(); +}).call(this); + +//# sourceMappingURL=es6-promise.js.map +}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"_process":4}],52:[function(require,module,exports){ +(function (global){ +/*global describe, specify, it, assert */ + +if (typeof Object.getPrototypeOf !== "function") { + Object.getPrototypeOf = "".__proto__ === String.prototype + ? function (object) { + return object.__proto__; + } + : function (object) { + // May break if the constructor has been tampered with + return object.constructor.prototype; + }; +} + +function keysOf(object) { + var results = []; + + for (var key in object) { + if (object.hasOwnProperty(key)) { + results.push(key); + } + } + + return results; +} + +var g = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : this; +var Promise = g.adapter.Promise; +var assert = require('assert'); + +function objectEquals(obj1, obj2) { + for (var i in obj1) { + if (obj1.hasOwnProperty(i)) { + if (!obj2.hasOwnProperty(i)) return false; + if (obj1[i] != obj2[i]) return false; + } + } + for (var i in obj2) { + if (obj2.hasOwnProperty(i)) { + if (!obj1.hasOwnProperty(i)) return false; + if (obj1[i] != obj2[i]) return false; + } + } + return true; +} + +describe("extensions", function() { + describe("Promise constructor", function() { + it('should exist and have length 1', function() { + assert(Promise); + assert.equal(Promise.length, 1); + }); + + it('should fulfill if `resolve` is called with a value', function(done) { + var promise = new Promise(function(resolve) { resolve('value'); }); + + promise.then(function(value) { + assert.equal(value, 'value'); + done(); + }); + }); + + it('should reject if `reject` is called with a reason', function(done) { + var promise = new Promise(function(resolve, reject) { reject('reason'); }); + + promise.then(function() { + assert(false); + done(); + }, function(reason) { + assert.equal(reason, 'reason'); + done(); + }); + }); + + it('should be a constructor', function() { + var promise = new Promise(function() {}); + + assert.equal(Object.getPrototypeOf(promise), Promise.prototype, '[[Prototype]] equals Promise.prototype'); + assert.equal(promise.constructor, Promise, 'constructor property of instances is set correctly'); + assert.equal(Promise.prototype.constructor, Promise, 'constructor property of prototype is set correctly'); + }); + + it('should NOT work without `new`', function() { + assert.throws(function(){ + Promise(function(resolve) { resolve('value'); }); + }, TypeError) + }); + + it('should throw a `TypeError` if not given a function', function() { + assert.throws(function () { + new Promise(); + }, TypeError); + + assert.throws(function () { + new Promise({}); + }, TypeError); + + assert.throws(function () { + new Promise('boo!'); + }, TypeError); + }); + + it('should reject on resolver exception', function(done) { + new Promise(function() { + throw 'error'; + }).then(null, function(e) { + assert.equal(e, 'error'); + done(); + }); + }); + + it('should not resolve multiple times', function(done) { + var resolver, rejector, fulfilled = 0, rejected = 0; + var thenable = { + then: function(resolve, reject) { + resolver = resolve; + rejector = reject; + } + }; + + var promise = new Promise(function(resolve) { + resolve(1); + }); + + promise.then(function(value){ + return thenable; + }).then(function(value){ + fulfilled++; + }, function(reason) { + rejected++; + }); + + setTimeout(function() { + resolver(1); + resolver(1); + rejector(1); + rejector(1); + + setTimeout(function() { + assert.equal(fulfilled, 1); + assert.equal(rejected, 0); + done(); + }, 20); + }, 20); + + }); + + describe('assimilation', function() { + it('should assimilate if `resolve` is called with a fulfilled promise', function(done) { + var originalPromise = new Promise(function(resolve) { resolve('original value'); }); + var promise = new Promise(function(resolve) { resolve(originalPromise); }); + + promise.then(function(value) { + assert.equal(value, 'original value'); + done(); + }); + }); + + it('should assimilate if `resolve` is called with a rejected promise', function(done) { + var originalPromise = new Promise(function(resolve, reject) { reject('original reason'); }); + var promise = new Promise(function(resolve) { resolve(originalPromise); }); + + promise.then(function() { + assert(false); + done(); + }, function(reason) { + assert.equal(reason, 'original reason'); + done(); + }); + }); + + it('should assimilate if `resolve` is called with a fulfilled thenable', function(done) { + var originalThenable = { + then: function (onFulfilled) { + setTimeout(function() { onFulfilled('original value'); }, 0); + } + }; + var promise = new Promise(function(resolve) { resolve(originalThenable); }); + + promise.then(function(value) { + assert.equal(value, 'original value'); + done(); + }); + }); + + it('should assimilate if `resolve` is called with a rejected thenable', function(done) { + var originalThenable = { + then: function (onFulfilled, onRejected) { + setTimeout(function() { onRejected('original reason'); }, 0); + } + }; + var promise = new Promise(function(resolve) { resolve(originalThenable); }); + + promise.then(function() { + assert(false); + done(); + }, function(reason) { + assert.equal(reason, 'original reason'); + done(); + }); + }); + + + it('should assimilate two levels deep, for fulfillment of self fulfilling promises', function(done) { + var originalPromise, promise; + originalPromise = new Promise(function(resolve) { + setTimeout(function() { + resolve(originalPromise); + }, 0) + }); + + promise = new Promise(function(resolve) { + setTimeout(function() { + resolve(originalPromise); + }, 0); + }); + + promise.then(function(value) { + assert(false); + done(); + })['catch'](function(reason) { + assert.equal(reason.message, "You cannot resolve a promise with itself"); + assert(reason instanceof TypeError); + done(); + }); + }); + + it('should assimilate two levels deep, for fulfillment', function(done) { + var originalPromise = new Promise(function(resolve) { resolve('original value'); }); + var nextPromise = new Promise(function(resolve) { resolve(originalPromise); }); + var promise = new Promise(function(resolve) { resolve(nextPromise); }); + + promise.then(function(value) { + assert.equal(value, 'original value'); + done(); + }); + }); + + it('should assimilate two levels deep, for rejection', function(done) { + var originalPromise = new Promise(function(resolve, reject) { reject('original reason'); }); + var nextPromise = new Promise(function(resolve) { resolve(originalPromise); }); + var promise = new Promise(function(resolve) { resolve(nextPromise); }); + + promise.then(function() { + assert(false); + done(); + }, function(reason) { + assert.equal(reason, 'original reason'); + done(); + }); + }); + + it('should assimilate three levels deep, mixing thenables and promises (fulfilled case)', function(done) { + var originalPromise = new Promise(function(resolve) { resolve('original value'); }); + var intermediateThenable = { + then: function (onFulfilled) { + setTimeout(function() { onFulfilled(originalPromise); }, 0); + } + }; + var promise = new Promise(function(resolve) { resolve(intermediateThenable); }); + + promise.then(function(value) { + assert.equal(value, 'original value'); + done(); + }); + }); + + it('should assimilate three levels deep, mixing thenables and promises (rejected case)', function(done) { + var originalPromise = new Promise(function(resolve, reject) { reject('original reason'); }); + var intermediateThenable = { + then: function (onFulfilled) { + setTimeout(function() { onFulfilled(originalPromise); }, 0); + } + }; + var promise = new Promise(function(resolve) { resolve(intermediateThenable); }); + + promise.then(function() { + assert(false); + done(); + }, function(reason) { + assert.equal(reason, 'original reason'); + done(); + }); + }); + }); + }); + + describe("Promise.all", function() { + testAll(function(){ + return Promise.all.apply(Promise, arguments); + }); + }); + + function testAll(all) { + it('should exist', function() { + assert(all); + }); + + it('throws when not passed an array', function(done) { + var nothing = assertRejection(all()); + var string = assertRejection(all('')); + var object = assertRejection(all({})); + + Promise.all([ + nothing, + string, + object + ]).then(function(){ done(); }); + }); + + specify('fulfilled only after all of the other promises are fulfilled', function(done) { + var firstResolved, secondResolved, firstResolver, secondResolver; + + var first = new Promise(function(resolve) { + firstResolver = resolve; + }); + first.then(function() { + firstResolved = true; + }); + + var second = new Promise(function(resolve) { + secondResolver = resolve; + }); + second.then(function() { + secondResolved = true; + }); + + setTimeout(function() { + firstResolver(true); + }, 0); + + setTimeout(function() { + secondResolver(true); + }, 0); + + all([first, second]).then(function() { + assert(firstResolved); + assert(secondResolved); + done(); + }); + }); + + specify('rejected as soon as a promise is rejected', function(done) { + var firstResolver, secondResolver; + + var first = new Promise(function(resolve, reject) { + firstResolver = { resolve: resolve, reject: reject }; + }); + + var second = new Promise(function(resolve, reject) { + secondResolver = { resolve: resolve, reject: reject }; + }); + + setTimeout(function() { + firstResolver.reject({}); + }, 0); + + var firstWasRejected, secondCompleted; + + first['catch'](function(){ + firstWasRejected = true; + }); + + second.then(function(){ + secondCompleted = true; + }, function() { + secondCompleted = true; + }); + + all([first, second]).then(function() { + assert(false); + }, function() { + assert(firstWasRejected); + assert(!secondCompleted); + done(); + }); + }); + + specify('passes the resolved values of each promise to the callback in the correct order', function(done) { + var firstResolver, secondResolver, thirdResolver; + + var first = new Promise(function(resolve, reject) { + firstResolver = { resolve: resolve, reject: reject }; + }); + + var second = new Promise(function(resolve, reject) { + secondResolver = { resolve: resolve, reject: reject }; + }); + + var third = new Promise(function(resolve, reject) { + thirdResolver = { resolve: resolve, reject: reject }; + }); + + thirdResolver.resolve(3); + firstResolver.resolve(1); + secondResolver.resolve(2); + + all([first, second, third]).then(function(results) { + assert(results.length === 3); + assert(results[0] === 1); + assert(results[1] === 2); + assert(results[2] === 3); + done(); + }); + }); + + specify('resolves an empty array passed to all()', function(done) { + all([]).then(function(results) { + assert(results.length === 0); + done(); + }); + }); + + specify('works with null', function(done) { + all([null]).then(function(results) { + assert.equal(results[0], null); + done(); + }); + }); + + specify('works with a mix of promises and thenables and non-promises', function(done) { + var promise = new Promise(function(resolve) { resolve(1); }); + var syncThenable = { then: function (onFulfilled) { onFulfilled(2); } }; + var asyncThenable = { then: function (onFulfilled) { setTimeout(function() { onFulfilled(3); }, 0); } }; + var nonPromise = 4; + + all([promise, syncThenable, asyncThenable, nonPromise]).then(function(results) { + assert(objectEquals(results, [1, 2, 3, 4])); + done(); + })['catch'](done); + }); + } + + describe("reject", function(){ + specify("it should exist", function(){ + assert(Promise.reject); + }); + + describe('it rejects', function(){ + var reason = 'the reason', + promise = Promise.reject(reason); + + promise.then(function(){ + assert(false, 'should not fulfill'); + }, function(actualReason){ + assert.equal(reason, actualReason); + }); + }); + }); + + function assertRejection(promise) { + return promise.then(function(){ + assert(false, 'expected rejection, but got fulfillment'); + }, function(reason){ + assert(reason instanceof Error); + }); + } + + describe('race', function() { + it("should exist", function() { + assert(Promise.race); + }); + + it("throws when not passed an array", function(done) { + var nothing = assertRejection(Promise.race()); + var string = assertRejection(Promise.race('')); + var object = assertRejection(Promise.race({})); + + Promise.all([ + nothing, + string, + object + ]).then(function(){ done(); }); + }); + + specify('fulfilled after one of the other promises are fulfilled', function(done) { + var firstResolved, secondResolved, firstResolver, secondResolver; + + var first = new Promise(function(resolve) { + firstResolver = resolve; + }); + first.then(function() { + firstResolved = true; + }); + + var second = new Promise(function(resolve) { + secondResolver = resolve; + }); + second.then(function() { + secondResolved = true; + }); + + setTimeout(function() { + firstResolver(true); + }, 100); + + setTimeout(function() { + secondResolver(true); + }, 0); + + Promise.race([first, second]).then(function() { + assert(secondResolved); + assert.equal(firstResolved, undefined); + done(); + }); + }); + + specify('the race begins on nextTurn and prioritized by array entry', function(done) { + var firstResolver, secondResolver, nonPromise = 5; + + var first = new Promise(function(resolve, reject) { + resolve(true); + }); + + var second = new Promise(function(resolve, reject) { + resolve(false); + }); + + Promise.race([first, second, nonPromise]).then(function(value) { + assert.equal(value, true); + done(); + }); + }); + + specify('rejected as soon as a promise is rejected', function(done) { + var firstResolver, secondResolver; + + var first = new Promise(function(resolve, reject) { + firstResolver = { resolve: resolve, reject: reject }; + }); + + var second = new Promise(function(resolve, reject) { + secondResolver = { resolve: resolve, reject: reject }; + }); + + setTimeout(function() { + firstResolver.reject({}); + }, 0); + + var firstWasRejected, secondCompleted; + + first['catch'](function(){ + firstWasRejected = true; + }); + + second.then(function(){ + secondCompleted = true; + }, function() { + secondCompleted = true; + }); + + Promise.race([first, second]).then(function() { + assert(false); + }, function() { + assert(firstWasRejected); + assert(!secondCompleted); + done(); + }); + }); + + specify('resolves an empty array to forever pending Promise', function(done) { + var foreverPendingPromise = Promise.race([]), + wasSettled = false; + + foreverPendingPromise.then(function() { + wasSettled = true; + }, function() { + wasSettled = true; + }); + + setTimeout(function() { + assert(!wasSettled); + done(); + }, 100); + }); + + specify('works with a mix of promises and thenables', function(done) { + var promise = new Promise(function(resolve) { setTimeout(function() { resolve(1); }, 10); }), + syncThenable = { then: function (onFulfilled) { onFulfilled(2); } }; + + Promise.race([promise, syncThenable]).then(function(result) { + assert(result, 2); + done(); + }); + }); + + specify('works with a mix of thenables and non-promises', function (done) { + var asyncThenable = { then: function (onFulfilled) { setTimeout(function() { onFulfilled(3); }, 0); } }, + nonPromise = 4; + + Promise.race([asyncThenable, nonPromise]).then(function(result) { + assert(result, 4); + done(); + }); + }); + }); + + describe("resolve", function(){ + specify("it should exist", function(){ + assert(Promise.resolve); + }); + + describe("1. If x is a promise, adopt its state ", function(){ + specify("1.1 If x is pending, promise must remain pending until x is fulfilled or rejected.", function(done){ + var expectedValue, resolver, thenable, wrapped; + + expectedValue = 'the value'; + thenable = { + then: function(resolve, reject){ + resolver = resolve; + } + }; + + wrapped = Promise.resolve(thenable); + + wrapped.then(function(value){ + assert(value === expectedValue); + done(); + }); + + setTimeout(function(){ + resolver(expectedValue); + }, 10); + }); + + specify("1.2 If/when x is fulfilled, fulfill promise with the same value.", function(done){ + var expectedValue, thenable, wrapped; + + expectedValue = 'the value'; + thenable = { + then: function(resolve, reject){ + resolve(expectedValue); + } + }; + + wrapped = Promise.resolve(thenable); + + wrapped.then(function(value){ + assert(value === expectedValue); + done(); + }) + }); + + specify("1.3 If/when x is rejected, reject promise with the same reason.", function(done){ + var expectedError, thenable, wrapped; + + expectedError = new Error(); + thenable = { + then: function(resolve, reject){ + reject(expectedError); + } + }; + + wrapped = Promise.resolve(thenable); + + wrapped.then(null, function(error){ + assert(error === expectedError); + done(); + }); + }); + }); + + describe("2. Otherwise, if x is an object or function,", function(){ + specify("2.1 Let then x.then", function(done){ + var accessCount, resolver, wrapped, thenable; + + accessCount = 0; + thenable = { }; + + // we likely don't need to test this, if the browser doesn't support it + if (typeof Object.defineProperty !== "function") { done(); return; } + + Object.defineProperty(thenable, 'then', { + get: function(){ + accessCount++; + + if (accessCount > 1) { + throw new Error(); + } + + return function(){ }; + } + }); + + assert(accessCount === 0); + + wrapped = Promise.resolve(thenable); + + assert(accessCount === 1); + + done(); + }); + + specify("2.2 If retrieving the property x.then results in a thrown exception e, reject promise with e as the reason.", function(done){ + var wrapped, thenable, expectedError; + + expectedError = new Error(); + thenable = { }; + + // we likely don't need to test this, if the browser doesn't support it + if (typeof Object.defineProperty !== "function") { done(); return; } + + Object.defineProperty(thenable, 'then', { + get: function(){ + throw expectedError; + } + }); + + wrapped = Promise.resolve(thenable); + + wrapped.then(null, function(error){ + assert(error === expectedError, 'incorrect exception was thrown'); + done(); + }); + }); + + describe('2.3. If then is a function, call it with x as this, first argument resolvePromise, and second argument rejectPromise, where', function(){ + specify('2.3.1 If/when resolvePromise is called with a value y, run Resolve(promise, y)', function(done){ + var expectedSuccess, resolver, rejector, thenable, wrapped, calledThis; + + thenable = { + then: function(resolve, reject){ + calledThis = this; + resolver = resolve; + rejector = reject; + } + }; + + expectedSuccess = 'success'; + wrapped = Promise.resolve(thenable); + + wrapped.then(function(success){ + assert(calledThis === thenable, 'this must be the thenable'); + assert(success === expectedSuccess, 'rejected promise with x'); + done(); + }); + + setTimeout(function() { + resolver(expectedSuccess); + }, 20); + }); + + specify('2.3.2 If/when rejectPromise is called with a reason r, reject promise with r.', function(done){ + var expectedError, resolver, rejector, thenable, wrapped, calledThis; + + thenable = { + then: function(resolve, reject){ + calledThis = this; + resolver = resolve; + rejector = reject; + } + }; + + expectedError = new Error(); + + wrapped = Promise.resolve(thenable); + + wrapped.then(null, function(error){ + assert(error === expectedError, 'rejected promise with x'); + done(); + }); + + setTimeout(function() { + rejector(expectedError); + }, 20); + }); + + specify("2.3.3 If both resolvePromise and rejectPromise are called, or multiple calls to the same argument are made, the first call takes precedence, and any further calls are ignored", function(done){ + var expectedError, expectedSuccess, resolver, rejector, thenable, wrapped, calledThis, + calledRejected, calledResolved; + + calledRejected = 0; + calledResolved = 0; + + thenable = { + then: function(resolve, reject){ + calledThis = this; + resolver = resolve; + rejector = reject; + } + }; + + expectedError = new Error(); + + wrapped = Promise.resolve(thenable); + + wrapped.then(function(){ + calledResolved++; + }, function(error){ + calledRejected++; + assert(calledResolved === 0, 'never resolved'); + assert(calledRejected === 1, 'rejected only once'); + assert(error === expectedError, 'rejected promise with x'); + }); + + setTimeout(function() { + rejector(expectedError); + rejector(expectedError); + + rejector('foo'); + + resolver('bar'); + resolver('baz'); + }, 20); + + setTimeout(function(){ + assert(calledRejected === 1, 'only rejected once'); + assert(calledResolved === 0, 'never resolved'); + done(); + }, 50); + }); + + describe("2.3.4 If calling then throws an exception e", function(){ + specify("2.3.4.1 If resolvePromise or rejectPromise have been called, ignore it.", function(done){ + var expectedSuccess, resolver, rejector, thenable, wrapped, calledThis, + calledRejected, calledResolved; + + expectedSuccess = 'success'; + + thenable = { + then: function(resolve, reject){ + resolve(expectedSuccess); + throw expectedError; + } + }; + + wrapped = Promise.resolve(thenable); + + wrapped.then(function(success){ + assert(success === expectedSuccess, 'resolved not errored'); + done(); + }); + }); + + specify("2.3.4.2 Otherwise, reject promise with e as the reason.", function(done) { + var expectedError, resolver, rejector, thenable, wrapped, calledThis, callCount; + + expectedError = new Error(); + callCount = 0; + + thenable = { then: function() { throw expectedError; } }; + + wrapped = Promise.resolve(thenable); + + wrapped.then(null, function(error){ + callCount++; + assert(expectedError === error, 'expected the correct error to be rejected'); + done(); + }); + + assert(callCount === 0, 'expected async, was sync'); + }); + }); + }); + + specify("2.4 If then is not a function, fulfill promise with x", function(done){ + var expectedError, resolver, rejector, thenable, wrapped, calledThis, callCount; + + thenable = { then: 3 }; + callCount = 0; + wrapped = Promise.resolve(thenable); + + wrapped.then(function(success){ + callCount++; + assert(thenable === success, 'fulfilled promise with x'); + done(); + }); + + assert(callCount === 0, 'expected async, was sync'); + }); + }); + + describe("3. If x is not an object or function, ", function(){ + specify("fulfill promise with x.", function(done){ + var thenable, callCount, wrapped; + + thenable = null; + callCount = 0; + wrapped = Promise.resolve(thenable); + + wrapped.then(function(success){ + callCount++; + assert(success === thenable, 'fulfilled promise with x'); + done(); + }, function(a){ + assert(false, 'should not also reject'); + }); + + assert(callCount === 0, 'expected async, was sync'); + }); + }); + }); + + if (typeof Worker !== 'undefined') { + describe('web worker', function () { + it('should work', function (done) { + this.timeout(2000); + var worker = new Worker('worker.js'); + worker.addEventListener('error', function(reason) { + done(new Error("Test failed:" + reason)); + }); + worker.addEventListener('message', function (e) { + worker.terminate(); + assert.equal(e.data, 'pong'); + done(); + }); + worker.postMessage('ping'); + }); + }); + } +}); + +// thanks to @wizardwerdna for the test case -> https://github.com/tildeio/rsvp.js/issues/66 +// Only run these tests in node (phantomjs cannot handle them) +if (typeof module !== 'undefined' && module.exports) { + + describe("using reduce to sum integers using promises", function(){ + it("should build the promise pipeline without error", function(){ + var array, iters, pZero, i; + + array = []; + iters = 1000; + + for (i=1; i<=iters; i++) { + array.push(i); + } + + pZero = Promise.resolve(0); + + array.reduce(function(promise, nextVal) { + return promise.then(function(currentVal) { + return Promise.resolve(currentVal + nextVal); + }); + }, pZero); + }); + + it("should get correct answer without blowing the nextTick stack", function(done){ + var pZero, array, iters, result, i; + + pZero = Promise.resolve(0); + + array = []; + iters = 1000; + + for (i=1; i<=iters; i++) { + array.push(i); + } + + result = array.reduce(function(promise, nextVal) { + return promise.then(function(currentVal) { + return Promise.resolve(currentVal + nextVal); + }); + }, pZero); + + result.then(function(value){ + assert.equal(value, (iters*(iters+1)/2)); + done(); + }); + }); + }); +} + +// Kudos to @Octane at https://github.com/getify/native-promise-only/issues/5 for this, and @getify for pinging me. +describe("Thenables should not be able to run code during assimilation", function () { + specify("resolving to a thenable", function () { + var thenCalled = false; + var thenable = { + then: function () { + thenCalled = true; + } + }; + + Promise.resolve(thenable); + assert.strictEqual(thenCalled, false); + }); + + specify("resolving to an evil promise", function () { + var thenCalled = false; + var evilPromise = Promise.resolve(); + evilPromise.then = function () { + thenCalled = true; + }; + + Promise.resolve(evilPromise); + assert.strictEqual(thenCalled, false); + }); +}); + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"assert":2}],53:[function(require,module,exports){ +(function (global){ +var assert = require('assert'); +var g = typeof window !== 'undefined' ? + window : typeof global !== 'undefined' ? global : this; + +var Promise = g.ES6Promise || require('./es6-promise').Promise; + +function defer() { + var deferred = {}; + + deferred.promise = new Promise(function(resolve, reject) { + deferred.resolve = resolve; + deferred.reject = reject; + }); + + return deferred; +} +var resolve = Promise.resolve; +var reject = Promise.reject; + + +module.exports = g.adapter = { + resolved: function(a) { return Promise.resolve(a); }, + rejected: function(a) { return Promise.reject(a); }, + deferred: defer, + Promise: Promise +}; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./es6-promise":51,"assert":2}]},{},[1]); diff --git a/node_modules/es6-promise/dist/test/es6-promise.js b/node_modules/es6-promise/dist/test/es6-promise.js new file mode 100644 index 0000000000..5b096d6e6e --- /dev/null +++ b/node_modules/es6-promise/dist/test/es6-promise.js @@ -0,0 +1,950 @@ +(function() { + "use strict"; + function lib$es6$promise$utils$$objectOrFunction(x) { + return typeof x === 'function' || (typeof x === 'object' && x !== null); + } + + function lib$es6$promise$utils$$isFunction(x) { + return typeof x === 'function'; + } + + function lib$es6$promise$utils$$isMaybeThenable(x) { + return typeof x === 'object' && x !== null; + } + + var lib$es6$promise$utils$$_isArray; + if (!Array.isArray) { + lib$es6$promise$utils$$_isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; + } else { + lib$es6$promise$utils$$_isArray = Array.isArray; + } + + var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; + var lib$es6$promise$asap$$len = 0; + var lib$es6$promise$asap$$toString = {}.toString; + var lib$es6$promise$asap$$vertxNext; + function lib$es6$promise$asap$$asap(callback, arg) { + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; + lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; + lib$es6$promise$asap$$len += 2; + if (lib$es6$promise$asap$$len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + lib$es6$promise$asap$$scheduleFlush(); + } + } + + var lib$es6$promise$asap$$default = lib$es6$promise$asap$$asap; + + var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; + var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; + var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; + var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + + // test for web worker but not in IE10 + var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && + typeof importScripts !== 'undefined' && + typeof MessageChannel !== 'undefined'; + + // node + function lib$es6$promise$asap$$useNextTick() { + var nextTick = process.nextTick; + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // setImmediate should be used instead instead + var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); + if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { + nextTick = setImmediate; + } + return function() { + nextTick(lib$es6$promise$asap$$flush); + }; + } + + // vertx + function lib$es6$promise$asap$$useVertxTimer() { + return function() { + lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); + }; + } + + function lib$es6$promise$asap$$useMutationObserver() { + var iterations = 0; + var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function() { + node.data = (iterations = ++iterations % 2); + }; + } + + // web worker + function lib$es6$promise$asap$$useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = lib$es6$promise$asap$$flush; + return function () { + channel.port2.postMessage(0); + }; + } + + function lib$es6$promise$asap$$useSetTimeout() { + return function() { + setTimeout(lib$es6$promise$asap$$flush, 1); + }; + } + + var lib$es6$promise$asap$$queue = new Array(1000); + function lib$es6$promise$asap$$flush() { + for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { + var callback = lib$es6$promise$asap$$queue[i]; + var arg = lib$es6$promise$asap$$queue[i+1]; + + callback(arg); + + lib$es6$promise$asap$$queue[i] = undefined; + lib$es6$promise$asap$$queue[i+1] = undefined; + } + + lib$es6$promise$asap$$len = 0; + } + + function lib$es6$promise$asap$$attemptVertex() { + try { + var r = require; + var vertx = r('vertx'); + lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; + return lib$es6$promise$asap$$useVertxTimer(); + } catch(e) { + return lib$es6$promise$asap$$useSetTimeout(); + } + } + + var lib$es6$promise$asap$$scheduleFlush; + // Decide what async method to use to triggering processing of queued callbacks: + if (lib$es6$promise$asap$$isNode) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); + } else if (lib$es6$promise$asap$$BrowserMutationObserver) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); + } else if (lib$es6$promise$asap$$isWorker) { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); + } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); + } else { + lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); + } + + function lib$es6$promise$$internal$$noop() {} + + var lib$es6$promise$$internal$$PENDING = void 0; + var lib$es6$promise$$internal$$FULFILLED = 1; + var lib$es6$promise$$internal$$REJECTED = 2; + + var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$selfFullfillment() { + return new TypeError("You cannot resolve a promise with itself"); + } + + function lib$es6$promise$$internal$$cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); + } + + function lib$es6$promise$$internal$$getThen(promise) { + try { + return promise.then; + } catch(error) { + lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; + return lib$es6$promise$$internal$$GET_THEN_ERROR; + } + } + + function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch(e) { + return e; + } + } + + function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { + lib$es6$promise$asap$$default(function(promise) { + var sealed = false; + var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { + if (sealed) { return; } + sealed = true; + if (thenable !== value) { + lib$es6$promise$$internal$$resolve(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + }, function(reason) { + if (sealed) { return; } + sealed = true; + + lib$es6$promise$$internal$$reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + lib$es6$promise$$internal$$reject(promise, error); + } + }, promise); + } + + function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { + if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, thenable._result); + } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, thenable._result); + } else { + lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { + lib$es6$promise$$internal$$resolve(promise, value); + }, function(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } + } + + function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { + if (maybeThenable.constructor === promise.constructor) { + lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); + } else { + var then = lib$es6$promise$$internal$$getThen(maybeThenable); + + if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); + } else if (then === undefined) { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } else if (lib$es6$promise$utils$$isFunction(then)) { + lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); + } else { + lib$es6$promise$$internal$$fulfill(promise, maybeThenable); + } + } + } + + function lib$es6$promise$$internal$$resolve(promise, value) { + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); + } else if (lib$es6$promise$utils$$objectOrFunction(value)) { + lib$es6$promise$$internal$$handleMaybeThenable(promise, value); + } else { + lib$es6$promise$$internal$$fulfill(promise, value); + } + } + + function lib$es6$promise$$internal$$publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + lib$es6$promise$$internal$$publish(promise); + } + + function lib$es6$promise$$internal$$fulfill(promise, value) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + + promise._result = value; + promise._state = lib$es6$promise$$internal$$FULFILLED; + + if (promise._subscribers.length !== 0) { + lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, promise); + } + } + + function lib$es6$promise$$internal$$reject(promise, reason) { + if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } + promise._state = lib$es6$promise$$internal$$REJECTED; + promise._result = reason; + + lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publishRejection, promise); + } + + function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { + var subscribers = parent._subscribers; + var length = subscribers.length; + + parent._onerror = null; + + subscribers[length] = child; + subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; + subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; + + if (length === 0 && parent._state) { + lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, parent); + } + } + + function lib$es6$promise$$internal$$publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { return; } + + var child, callback, detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; + } + + function lib$es6$promise$$internal$$ErrorObject() { + this.error = null; + } + + var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); + + function lib$es6$promise$$internal$$tryCatch(callback, detail) { + try { + return callback(detail); + } catch(e) { + lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; + return lib$es6$promise$$internal$$TRY_CATCH_ERROR; + } + } + + function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { + var hasCallback = lib$es6$promise$utils$$isFunction(callback), + value, error, succeeded, failed; + + if (hasCallback) { + value = lib$es6$promise$$internal$$tryCatch(callback, detail); + + if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value = null; + } else { + succeeded = true; + } + + if (promise === value) { + lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); + return; + } + + } else { + value = detail; + succeeded = true; + } + + if (promise._state !== lib$es6$promise$$internal$$PENDING) { + // noop + } else if (hasCallback && succeeded) { + lib$es6$promise$$internal$$resolve(promise, value); + } else if (failed) { + lib$es6$promise$$internal$$reject(promise, error); + } else if (settled === lib$es6$promise$$internal$$FULFILLED) { + lib$es6$promise$$internal$$fulfill(promise, value); + } else if (settled === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } + } + + function lib$es6$promise$$internal$$initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value){ + lib$es6$promise$$internal$$resolve(promise, value); + }, function rejectPromise(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + }); + } catch(e) { + lib$es6$promise$$internal$$reject(promise, e); + } + } + + function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { + var enumerator = this; + + enumerator._instanceConstructor = Constructor; + enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (enumerator._validateInput(input)) { + enumerator._input = input; + enumerator.length = input.length; + enumerator._remaining = input.length; + + enumerator._init(); + + if (enumerator.length === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } else { + enumerator.length = enumerator.length || 0; + enumerator._enumerate(); + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); + } + } + } else { + lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); + } + } + + lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { + return lib$es6$promise$utils$$isArray(input); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { + return new Error('Array Methods must be provided an Array'); + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { + this._result = new Array(this.length); + }; + + var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; + + lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { + var enumerator = this; + + var length = enumerator.length; + var promise = enumerator.promise; + var input = enumerator._input; + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + enumerator._eachEntry(input[i], i); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { + var enumerator = this; + var c = enumerator._instanceConstructor; + + if (lib$es6$promise$utils$$isMaybeThenable(entry)) { + if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { + entry._onerror = null; + enumerator._settledAt(entry._state, i, entry._result); + } else { + enumerator._willSettleAt(c.resolve(entry), i); + } + } else { + enumerator._remaining--; + enumerator._result[i] = entry; + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { + var enumerator = this; + var promise = enumerator.promise; + + if (promise._state === lib$es6$promise$$internal$$PENDING) { + enumerator._remaining--; + + if (state === lib$es6$promise$$internal$$REJECTED) { + lib$es6$promise$$internal$$reject(promise, value); + } else { + enumerator._result[i] = value; + } + } + + if (enumerator._remaining === 0) { + lib$es6$promise$$internal$$fulfill(promise, enumerator._result); + } + }; + + lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { + var enumerator = this; + + lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { + enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); + }, function(reason) { + enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); + }); + }; + function lib$es6$promise$promise$all$$all(entries) { + return new lib$es6$promise$enumerator$$default(this, entries).promise; + } + var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; + function lib$es6$promise$promise$race$$race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + + if (!lib$es6$promise$utils$$isArray(entries)) { + lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); + return promise; + } + + var length = entries.length; + + function onFulfillment(value) { + lib$es6$promise$$internal$$resolve(promise, value); + } + + function onRejection(reason) { + lib$es6$promise$$internal$$reject(promise, reason); + } + + for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { + lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); + } + + return promise; + } + var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; + function lib$es6$promise$promise$resolve$$resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$resolve(promise, object); + return promise; + } + var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; + function lib$es6$promise$promise$reject$$reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(lib$es6$promise$$internal$$noop); + lib$es6$promise$$internal$$reject(promise, reason); + return promise; + } + var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; + + var lib$es6$promise$promise$$counter = 0; + + function lib$es6$promise$promise$$needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); + } + + function lib$es6$promise$promise$$needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); + } + + var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; + /** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise’s eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + var promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + var xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor + */ + function lib$es6$promise$promise$$Promise(resolver) { + this._id = lib$es6$promise$promise$$counter++; + this._state = undefined; + this._result = undefined; + this._subscribers = []; + + if (lib$es6$promise$$internal$$noop !== resolver) { + if (!lib$es6$promise$utils$$isFunction(resolver)) { + lib$es6$promise$promise$$needsResolver(); + } + + if (!(this instanceof lib$es6$promise$promise$$Promise)) { + lib$es6$promise$promise$$needsNew(); + } + + lib$es6$promise$$internal$$initializePromise(this, resolver); + } + } + + lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; + lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; + lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; + lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; + + lib$es6$promise$promise$$Promise.prototype = { + constructor: lib$es6$promise$promise$$Promise, + + /** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + var result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + var author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} + */ + then: function(onFulfillment, onRejection) { + var parent = this; + var state = parent._state; + + if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { + return this; + } + + var child = new this.constructor(lib$es6$promise$$internal$$noop); + var result = parent._result; + + if (state) { + var callback = arguments[state - 1]; + lib$es6$promise$asap$$default(function(){ + lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); + }); + } else { + lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + }, + + /** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} + */ + 'catch': function(onRejection) { + return this.then(null, onRejection); + } + }; + function lib$es6$promise$polyfill$$polyfill() { + var local; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { + return; + } + + local.Promise = lib$es6$promise$promise$$default; + } + var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; + + var lib$es6$promise$umd$$ES6Promise = { + 'Promise': lib$es6$promise$promise$$default, + 'polyfill': lib$es6$promise$polyfill$$default + }; + + /* global define:true module:true window: true */ + if (typeof define === 'function' && define['amd']) { + define(function() { return lib$es6$promise$umd$$ES6Promise; }); + } else if (typeof module !== 'undefined' && module['exports']) { + module['exports'] = lib$es6$promise$umd$$ES6Promise; + } else if (typeof this !== 'undefined') { + this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; + } + + lib$es6$promise$polyfill$$default(); +}).call(this); + +//# sourceMappingURL=es6-promise.js.map \ No newline at end of file diff --git a/node_modules/es6-promise/dist/test/es6-promise.min.js b/node_modules/es6-promise/dist/test/es6-promise.min.js new file mode 100644 index 0000000000..34a1f52b8c --- /dev/null +++ b/node_modules/es6-promise/dist/test/es6-promise.min.js @@ -0,0 +1 @@ +(function(){"use strict";function lib$es6$promise$utils$$objectOrFunction(x){return typeof x==="function"||typeof x==="object"&&x!==null}function lib$es6$promise$utils$$isFunction(x){return typeof x==="function"}function lib$es6$promise$utils$$isMaybeThenable(x){return typeof x==="object"&&x!==null}var lib$es6$promise$utils$$_isArray;if(!Array.isArray){lib$es6$promise$utils$$_isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}}else{lib$es6$promise$utils$$_isArray=Array.isArray}var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;var lib$es6$promise$asap$$len=0;var lib$es6$promise$asap$$toString={}.toString;var lib$es6$promise$asap$$vertxNext;function lib$es6$promise$asap$$asap(callback,arg){lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;lib$es6$promise$asap$$len+=2;if(lib$es6$promise$asap$$len===2){lib$es6$promise$asap$$scheduleFlush()}}var lib$es6$promise$asap$$default=lib$es6$promise$asap$$asap;var lib$es6$promise$asap$$browserWindow=typeof window!=="undefined"?window:undefined;var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow||{};var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver||lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;var lib$es6$promise$asap$$isNode=typeof process!=="undefined"&&{}.toString.call(process)==="[object process]";var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function lib$es6$promise$asap$$useNextTick(){var nextTick=process.nextTick;var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);if(Array.isArray(version)&&version[1]==="0"&&version[2]==="10"){nextTick=setImmediate}return function(){nextTick(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useVertxTimer(){return function(){lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useMutationObserver(){var iterations=0;var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);var node=document.createTextNode("");observer.observe(node,{characterData:true});return function(){node.data=iterations=++iterations%2}}function lib$es6$promise$asap$$useMessageChannel(){var channel=new MessageChannel;channel.port1.onmessage=lib$es6$promise$asap$$flush;return function(){channel.port2.postMessage(0)}}function lib$es6$promise$asap$$useSetTimeout(){return function(){setTimeout(lib$es6$promise$asap$$flush,1)}}var lib$es6$promise$asap$$queue=new Array(1e3);function lib$es6$promise$asap$$flush(){for(var i=0;i + + + rsvp.js Tests + + + +
+ + + + + + + + diff --git a/node_modules/es6-promise/dist/test/json3.js b/node_modules/es6-promise/dist/test/json3.js new file mode 100644 index 0000000000..4817c9e792 --- /dev/null +++ b/node_modules/es6-promise/dist/test/json3.js @@ -0,0 +1,902 @@ +/*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */ +;(function () { + // Detect the `define` function exposed by asynchronous module loaders. The + // strict `define` check is necessary for compatibility with `r.js`. + var isLoader = typeof define === "function" && define.amd; + + // A set of types used to distinguish objects from primitives. + var objectTypes = { + "function": true, + "object": true + }; + + // Detect the `exports` object exposed by CommonJS implementations. + var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; + + // Use the `global` object exposed by Node (including Browserify via + // `insert-module-globals`), Narwhal, and Ringo as the default context, + // and the `window` object in browsers. Rhino exports a `global` function + // instead. + var root = objectTypes[typeof window] && window || this, + freeGlobal = freeExports && objectTypes[typeof module] && module && !module.nodeType && typeof global == "object" && global; + + if (freeGlobal && (freeGlobal["global"] === freeGlobal || freeGlobal["window"] === freeGlobal || freeGlobal["self"] === freeGlobal)) { + root = freeGlobal; + } + + // Public: Initializes JSON 3 using the given `context` object, attaching the + // `stringify` and `parse` functions to the specified `exports` object. + function runInContext(context, exports) { + context || (context = root["Object"]()); + exports || (exports = root["Object"]()); + + // Native constructor aliases. + var Number = context["Number"] || root["Number"], + String = context["String"] || root["String"], + Object = context["Object"] || root["Object"], + Date = context["Date"] || root["Date"], + SyntaxError = context["SyntaxError"] || root["SyntaxError"], + TypeError = context["TypeError"] || root["TypeError"], + Math = context["Math"] || root["Math"], + nativeJSON = context["JSON"] || root["JSON"]; + + // Delegate to the native `stringify` and `parse` implementations. + if (typeof nativeJSON == "object" && nativeJSON) { + exports.stringify = nativeJSON.stringify; + exports.parse = nativeJSON.parse; + } + + // Convenience aliases. + var objectProto = Object.prototype, + getClass = objectProto.toString, + isProperty, forEach, undef; + + // Test the `Date#getUTC*` methods. Based on work by @Yaffle. + var isExtended = new Date(-3509827334573292); + try { + // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical + // results for certain dates in Opera >= 10.53. + isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && + // Safari < 2.0.2 stores the internal millisecond time value correctly, + // but clips the values returned by the date methods to the range of + // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]). + isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; + } catch (exception) {} + + // Internal: Determines whether the native `JSON.stringify` and `parse` + // implementations are spec-compliant. Based on work by Ken Snyder. + function has(name) { + if (has[name] !== undef) { + // Return cached feature test result. + return has[name]; + } + var isSupported; + if (name == "bug-string-char-index") { + // IE <= 7 doesn't support accessing string characters using square + // bracket notation. IE 8 only supports this for primitives. + isSupported = "a"[0] != "a"; + } else if (name == "json") { + // Indicates whether both `JSON.stringify` and `JSON.parse` are + // supported. + isSupported = has("json-stringify") && has("json-parse"); + } else { + var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'; + // Test `JSON.stringify`. + if (name == "json-stringify") { + var stringify = exports.stringify, stringifySupported = typeof stringify == "function" && isExtended; + if (stringifySupported) { + // A test function object with a custom `toJSON` method. + (value = function () { + return 1; + }).toJSON = value; + try { + stringifySupported = + // Firefox 3.1b1 and b2 serialize string, number, and boolean + // primitives as object literals. + stringify(0) === "0" && + // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object + // literals. + stringify(new Number()) === "0" && + stringify(new String()) == '""' && + // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or + // does not define a canonical JSON representation (this applies to + // objects with `toJSON` properties as well, *unless* they are nested + // within an object or array). + stringify(getClass) === undef && + // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and + // FF 3.1b3 pass this test. + stringify(undef) === undef && + // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, + // respectively, if the value is omitted entirely. + stringify() === undef && + // FF 3.1b1, 2 throw an error if the given value is not a number, + // string, array, object, Boolean, or `null` literal. This applies to + // objects with custom `toJSON` methods as well, unless they are nested + // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` + // methods entirely. + stringify(value) === "1" && + stringify([value]) == "[1]" && + // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of + // `"[null]"`. + stringify([undef]) == "[null]" && + // YUI 3.0.0b1 fails to serialize `null` literals. + stringify(null) == "null" && + // FF 3.1b1, 2 halts serialization if an array contains a function: + // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 + // elides non-JSON values from objects and arrays, unless they + // define custom `toJSON` methods. + stringify([undef, getClass, null]) == "[null,null,null]" && + // Simple serialization test. FF 3.1b1 uses Unicode escape sequences + // where character escape codes are expected (e.g., `\b` => `\u0008`). + stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized && + // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. + stringify(null, value) === "1" && + stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" && + // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly + // serialize extended years. + stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && + // The milliseconds are optional in ES 5, but required in 5.1. + stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && + // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative + // four-digit years instead of six-digit years. Credits: @Yaffle. + stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && + // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond + // values less than 1000. Credits: @Yaffle. + stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; + } catch (exception) { + stringifySupported = false; + } + } + isSupported = stringifySupported; + } + // Test `JSON.parse`. + if (name == "json-parse") { + var parse = exports.parse; + if (typeof parse == "function") { + try { + // FF 3.1b1, b2 will throw an exception if a bare literal is provided. + // Conforming implementations should also coerce the initial argument to + // a string prior to parsing. + if (parse("0") === 0 && !parse(false)) { + // Simple parsing test. + value = parse(serialized); + var parseSupported = value["a"].length == 5 && value["a"][0] === 1; + if (parseSupported) { + try { + // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. + parseSupported = !parse('"\t"'); + } catch (exception) {} + if (parseSupported) { + try { + // FF 4.0 and 4.0.1 allow leading `+` signs and leading + // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow + // certain octal literals. + parseSupported = parse("01") !== 1; + } catch (exception) {} + } + if (parseSupported) { + try { + // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal + // points. These environments, along with FF 3.1b1 and 2, + // also allow trailing commas in JSON objects and arrays. + parseSupported = parse("1.") !== 1; + } catch (exception) {} + } + } + } + } catch (exception) { + parseSupported = false; + } + } + isSupported = parseSupported; + } + } + return has[name] = !!isSupported; + } + + if (!has("json")) { + // Common `[[Class]]` name aliases. + var functionClass = "[object Function]", + dateClass = "[object Date]", + numberClass = "[object Number]", + stringClass = "[object String]", + arrayClass = "[object Array]", + booleanClass = "[object Boolean]"; + + // Detect incomplete support for accessing string characters by index. + var charIndexBuggy = has("bug-string-char-index"); + + // Define additional utility methods if the `Date` methods are buggy. + if (!isExtended) { + var floor = Math.floor; + // A mapping between the months of the year and the number of days between + // January 1st and the first of the respective month. + var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; + // Internal: Calculates the number of days between the Unix epoch and the + // first day of the given month. + var getDay = function (year, month) { + return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); + }; + } + + // Internal: Determines if a property is a direct property of the given + // object. Delegates to the native `Object#hasOwnProperty` method. + if (!(isProperty = objectProto.hasOwnProperty)) { + isProperty = function (property) { + var members = {}, constructor; + if ((members.__proto__ = null, members.__proto__ = { + // The *proto* property cannot be set multiple times in recent + // versions of Firefox and SeaMonkey. + "toString": 1 + }, members).toString != getClass) { + // Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but + // supports the mutable *proto* property. + isProperty = function (property) { + // Capture and break the object's prototype chain (see section 8.6.2 + // of the ES 5.1 spec). The parenthesized expression prevents an + // unsafe transformation by the Closure Compiler. + var original = this.__proto__, result = property in (this.__proto__ = null, this); + // Restore the original prototype chain. + this.__proto__ = original; + return result; + }; + } else { + // Capture a reference to the top-level `Object` constructor. + constructor = members.constructor; + // Use the `constructor` property to simulate `Object#hasOwnProperty` in + // other environments. + isProperty = function (property) { + var parent = (this.constructor || constructor).prototype; + return property in this && !(property in parent && this[property] === parent[property]); + }; + } + members = null; + return isProperty.call(this, property); + }; + } + + // Internal: Normalizes the `for...in` iteration algorithm across + // environments. Each enumerated key is yielded to a `callback` function. + forEach = function (object, callback) { + var size = 0, Properties, members, property; + + // Tests for bugs in the current environment's `for...in` algorithm. The + // `valueOf` property inherits the non-enumerable flag from + // `Object.prototype` in older versions of IE, Netscape, and Mozilla. + (Properties = function () { + this.valueOf = 0; + }).prototype.valueOf = 0; + + // Iterate over a new instance of the `Properties` class. + members = new Properties(); + for (property in members) { + // Ignore all properties inherited from `Object.prototype`. + if (isProperty.call(members, property)) { + size++; + } + } + Properties = members = null; + + // Normalize the iteration algorithm. + if (!size) { + // A list of non-enumerable properties inherited from `Object.prototype`. + members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; + // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable + // properties. + forEach = function (object, callback) { + var isFunction = getClass.call(object) == functionClass, property, length; + var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[typeof object.hasOwnProperty] && object.hasOwnProperty || isProperty; + for (property in object) { + // Gecko <= 1.0 enumerates the `prototype` property of functions under + // certain conditions; IE does not. + if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { + callback(property); + } + } + // Manually invoke the callback for each non-enumerable property. + for (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property)); + }; + } else if (size == 2) { + // Safari <= 2.0.4 enumerates shadowed properties twice. + forEach = function (object, callback) { + // Create a set of iterated properties. + var members = {}, isFunction = getClass.call(object) == functionClass, property; + for (property in object) { + // Store each property name to prevent double enumeration. The + // `prototype` property of functions is not enumerated due to cross- + // environment inconsistencies. + if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) { + callback(property); + } + } + }; + } else { + // No bugs detected; use the standard `for...in` algorithm. + forEach = function (object, callback) { + var isFunction = getClass.call(object) == functionClass, property, isConstructor; + for (property in object) { + if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { + callback(property); + } + } + // Manually invoke the callback for the `constructor` property due to + // cross-environment inconsistencies. + if (isConstructor || isProperty.call(object, (property = "constructor"))) { + callback(property); + } + }; + } + return forEach(object, callback); + }; + + // Public: Serializes a JavaScript `value` as a JSON string. The optional + // `filter` argument may specify either a function that alters how object and + // array members are serialized, or an array of strings and numbers that + // indicates which properties should be serialized. The optional `width` + // argument may be either a string or number that specifies the indentation + // level of the output. + if (!has("json-stringify")) { + // Internal: A map of control characters and their escaped equivalents. + var Escapes = { + 92: "\\\\", + 34: '\\"', + 8: "\\b", + 12: "\\f", + 10: "\\n", + 13: "\\r", + 9: "\\t" + }; + + // Internal: Converts `value` into a zero-padded string such that its + // length is at least equal to `width`. The `width` must be <= 6. + var leadingZeroes = "000000"; + var toPaddedString = function (width, value) { + // The `|| 0` expression is necessary to work around a bug in + // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. + return (leadingZeroes + (value || 0)).slice(-width); + }; + + // Internal: Double-quotes a string `value`, replacing all ASCII control + // characters (characters with code unit values between 0 and 31) with + // their escaped equivalents. This is an implementation of the + // `Quote(value)` operation defined in ES 5.1 section 15.12.3. + var unicodePrefix = "\\u00"; + var quote = function (value) { + var result = '"', index = 0, length = value.length, useCharIndex = !charIndexBuggy || length > 10; + var symbols = useCharIndex && (charIndexBuggy ? value.split("") : value); + for (; index < length; index++) { + var charCode = value.charCodeAt(index); + // If the character is a control character, append its Unicode or + // shorthand escape sequence; otherwise, append the character as-is. + switch (charCode) { + case 8: case 9: case 10: case 12: case 13: case 34: case 92: + result += Escapes[charCode]; + break; + default: + if (charCode < 32) { + result += unicodePrefix + toPaddedString(2, charCode.toString(16)); + break; + } + result += useCharIndex ? symbols[index] : value.charAt(index); + } + } + return result + '"'; + }; + + // Internal: Recursively serializes an object. Implements the + // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. + var serialize = function (property, object, callback, properties, whitespace, indentation, stack) { + var value, className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, result; + try { + // Necessary for host object support. + value = object[property]; + } catch (exception) {} + if (typeof value == "object" && value) { + className = getClass.call(value); + if (className == dateClass && !isProperty.call(value, "toJSON")) { + if (value > -1 / 0 && value < 1 / 0) { + // Dates are serialized according to the `Date#toJSON` method + // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 + // for the ISO 8601 date time string format. + if (getDay) { + // Manually compute the year, month, date, hours, minutes, + // seconds, and milliseconds if the `getUTC*` methods are + // buggy. Adapted from @Yaffle's `date-shim` project. + date = floor(value / 864e5); + for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++); + for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++); + date = 1 + date - getDay(year, month); + // The `time` value specifies the time within the day (see ES + // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used + // to compute `A modulo B`, as the `%` operator does not + // correspond to the `modulo` operation for negative numbers. + time = (value % 864e5 + 864e5) % 864e5; + // The hours, minutes, seconds, and milliseconds are obtained by + // decomposing the time within the day. See section 15.9.1.10. + hours = floor(time / 36e5) % 24; + minutes = floor(time / 6e4) % 60; + seconds = floor(time / 1e3) % 60; + milliseconds = time % 1e3; + } else { + year = value.getUTCFullYear(); + month = value.getUTCMonth(); + date = value.getUTCDate(); + hours = value.getUTCHours(); + minutes = value.getUTCMinutes(); + seconds = value.getUTCSeconds(); + milliseconds = value.getUTCMilliseconds(); + } + // Serialize extended years correctly. + value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + + "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + + // Months, dates, hours, minutes, and seconds should have two + // digits; milliseconds should have three. + "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + + // Milliseconds are optional in ES 5.0, but required in 5.1. + "." + toPaddedString(3, milliseconds) + "Z"; + } else { + value = null; + } + } else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) { + // Prototype <= 1.6.1 adds non-standard `toJSON` methods to the + // `Number`, `String`, `Date`, and `Array` prototypes. JSON 3 + // ignores all `toJSON` methods on these objects unless they are + // defined directly on an instance. + value = value.toJSON(property); + } + } + if (callback) { + // If a replacement function was provided, call it to obtain the value + // for serialization. + value = callback.call(object, property, value); + } + if (value === null) { + return "null"; + } + className = getClass.call(value); + if (className == booleanClass) { + // Booleans are represented literally. + return "" + value; + } else if (className == numberClass) { + // JSON numbers must be finite. `Infinity` and `NaN` are serialized as + // `"null"`. + return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; + } else if (className == stringClass) { + // Strings are double-quoted and escaped. + return quote("" + value); + } + // Recursively serialize objects and arrays. + if (typeof value == "object") { + // Check for cyclic structures. This is a linear search; performance + // is inversely proportional to the number of unique nested objects. + for (length = stack.length; length--;) { + if (stack[length] === value) { + // Cyclic structures cannot be serialized by `JSON.stringify`. + throw TypeError(); + } + } + // Add the object to the stack of traversed objects. + stack.push(value); + results = []; + // Save the current indentation level and indent one additional level. + prefix = indentation; + indentation += whitespace; + if (className == arrayClass) { + // Recursively serialize array elements. + for (index = 0, length = value.length; index < length; index++) { + element = serialize(index, value, callback, properties, whitespace, indentation, stack); + results.push(element === undef ? "null" : element); + } + result = results.length ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]"; + } else { + // Recursively serialize object members. Members are selected from + // either a user-specified list of property names, or the object + // itself. + forEach(properties || value, function (property) { + var element = serialize(property, value, callback, properties, whitespace, indentation, stack); + if (element !== undef) { + // According to ES 5.1 section 15.12.3: "If `gap` {whitespace} + // is not the empty string, let `member` {quote(property) + ":"} + // be the concatenation of `member` and the `space` character." + // The "`space` character" refers to the literal space + // character, not the `space` {width} argument provided to + // `JSON.stringify`. + results.push(quote(property) + ":" + (whitespace ? " " : "") + element); + } + }); + result = results.length ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}"; + } + // Remove the object from the traversed object stack. + stack.pop(); + return result; + } + }; + + // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. + exports.stringify = function (source, filter, width) { + var whitespace, callback, properties, className; + if (objectTypes[typeof filter] && filter) { + if ((className = getClass.call(filter)) == functionClass) { + callback = filter; + } else if (className == arrayClass) { + // Convert the property names array into a makeshift set. + properties = {}; + for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((className = getClass.call(value)), className == stringClass || className == numberClass) && (properties[value] = 1)); + } + } + if (width) { + if ((className = getClass.call(width)) == numberClass) { + // Convert the `width` to an integer and create a string containing + // `width` number of space characters. + if ((width -= width % 1) > 0) { + for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " "); + } + } else if (className == stringClass) { + whitespace = width.length <= 10 ? width : width.slice(0, 10); + } + } + // Opera <= 7.54u2 discards the values associated with empty string keys + // (`""`) only if they are used directly within an object member list + // (e.g., `!("" in { "": 1})`). + return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); + }; + } + + // Public: Parses a JSON source string. + if (!has("json-parse")) { + var fromCharCode = String.fromCharCode; + + // Internal: A map of escaped control characters and their unescaped + // equivalents. + var Unescapes = { + 92: "\\", + 34: '"', + 47: "/", + 98: "\b", + 116: "\t", + 110: "\n", + 102: "\f", + 114: "\r" + }; + + // Internal: Stores the parser state. + var Index, Source; + + // Internal: Resets the parser state and throws a `SyntaxError`. + var abort = function () { + Index = Source = null; + throw SyntaxError(); + }; + + // Internal: Returns the next token, or `"$"` if the parser has reached + // the end of the source string. A token may be a string, number, `null` + // literal, or Boolean literal. + var lex = function () { + var source = Source, length = source.length, value, begin, position, isSigned, charCode; + while (Index < length) { + charCode = source.charCodeAt(Index); + switch (charCode) { + case 9: case 10: case 13: case 32: + // Skip whitespace tokens, including tabs, carriage returns, line + // feeds, and space characters. + Index++; + break; + case 123: case 125: case 91: case 93: case 58: case 44: + // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at + // the current position. + value = charIndexBuggy ? source.charAt(Index) : source[Index]; + Index++; + return value; + case 34: + // `"` delimits a JSON string; advance to the next character and + // begin parsing the string. String tokens are prefixed with the + // sentinel `@` character to distinguish them from punctuators and + // end-of-string tokens. + for (value = "@", Index++; Index < length;) { + charCode = source.charCodeAt(Index); + if (charCode < 32) { + // Unescaped ASCII control characters (those with a code unit + // less than the space character) are not permitted. + abort(); + } else if (charCode == 92) { + // A reverse solidus (`\`) marks the beginning of an escaped + // control character (including `"`, `\`, and `/`) or Unicode + // escape sequence. + charCode = source.charCodeAt(++Index); + switch (charCode) { + case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114: + // Revive escaped control characters. + value += Unescapes[charCode]; + Index++; + break; + case 117: + // `\u` marks the beginning of a Unicode escape sequence. + // Advance to the first character and validate the + // four-digit code point. + begin = ++Index; + for (position = Index + 4; Index < position; Index++) { + charCode = source.charCodeAt(Index); + // A valid sequence comprises four hexdigits (case- + // insensitive) that form a single hexadecimal value. + if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { + // Invalid Unicode escape sequence. + abort(); + } + } + // Revive the escaped character. + value += fromCharCode("0x" + source.slice(begin, Index)); + break; + default: + // Invalid escape sequence. + abort(); + } + } else { + if (charCode == 34) { + // An unescaped double-quote character marks the end of the + // string. + break; + } + charCode = source.charCodeAt(Index); + begin = Index; + // Optimize for the common case where a string is valid. + while (charCode >= 32 && charCode != 92 && charCode != 34) { + charCode = source.charCodeAt(++Index); + } + // Append the string as-is. + value += source.slice(begin, Index); + } + } + if (source.charCodeAt(Index) == 34) { + // Advance to the next character and return the revived string. + Index++; + return value; + } + // Unterminated string. + abort(); + default: + // Parse numbers and literals. + begin = Index; + // Advance past the negative sign, if one is specified. + if (charCode == 45) { + isSigned = true; + charCode = source.charCodeAt(++Index); + } + // Parse an integer or floating-point value. + if (charCode >= 48 && charCode <= 57) { + // Leading zeroes are interpreted as octal literals. + if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) { + // Illegal octal literal. + abort(); + } + isSigned = false; + // Parse the integer component. + for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++); + // Floats cannot contain a leading decimal point; however, this + // case is already accounted for by the parser. + if (source.charCodeAt(Index) == 46) { + position = ++Index; + // Parse the decimal component. + for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); + if (position == Index) { + // Illegal trailing decimal. + abort(); + } + Index = position; + } + // Parse exponents. The `e` denoting the exponent is + // case-insensitive. + charCode = source.charCodeAt(Index); + if (charCode == 101 || charCode == 69) { + charCode = source.charCodeAt(++Index); + // Skip past the sign following the exponent, if one is + // specified. + if (charCode == 43 || charCode == 45) { + Index++; + } + // Parse the exponential component. + for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); + if (position == Index) { + // Illegal empty exponent. + abort(); + } + Index = position; + } + // Coerce the parsed value to a JavaScript number. + return +source.slice(begin, Index); + } + // A negative sign may only precede numbers. + if (isSigned) { + abort(); + } + // `true`, `false`, and `null` literals. + if (source.slice(Index, Index + 4) == "true") { + Index += 4; + return true; + } else if (source.slice(Index, Index + 5) == "false") { + Index += 5; + return false; + } else if (source.slice(Index, Index + 4) == "null") { + Index += 4; + return null; + } + // Unrecognized token. + abort(); + } + } + // Return the sentinel `$` character if the parser has reached the end + // of the source string. + return "$"; + }; + + // Internal: Parses a JSON `value` token. + var get = function (value) { + var results, hasMembers; + if (value == "$") { + // Unexpected end of input. + abort(); + } + if (typeof value == "string") { + if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { + // Remove the sentinel `@` character. + return value.slice(1); + } + // Parse object and array literals. + if (value == "[") { + // Parses a JSON array, returning a new JavaScript array. + results = []; + for (;; hasMembers || (hasMembers = true)) { + value = lex(); + // A closing square bracket marks the end of the array literal. + if (value == "]") { + break; + } + // If the array literal contains elements, the current token + // should be a comma separating the previous element from the + // next. + if (hasMembers) { + if (value == ",") { + value = lex(); + if (value == "]") { + // Unexpected trailing `,` in array literal. + abort(); + } + } else { + // A `,` must separate each array element. + abort(); + } + } + // Elisions and leading commas are not permitted. + if (value == ",") { + abort(); + } + results.push(get(value)); + } + return results; + } else if (value == "{") { + // Parses a JSON object, returning a new JavaScript object. + results = {}; + for (;; hasMembers || (hasMembers = true)) { + value = lex(); + // A closing curly brace marks the end of the object literal. + if (value == "}") { + break; + } + // If the object literal contains members, the current token + // should be a comma separator. + if (hasMembers) { + if (value == ",") { + value = lex(); + if (value == "}") { + // Unexpected trailing `,` in object literal. + abort(); + } + } else { + // A `,` must separate each object member. + abort(); + } + } + // Leading commas are not permitted, object property names must be + // double-quoted strings, and a `:` must separate each property + // name and value. + if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { + abort(); + } + results[value.slice(1)] = get(lex()); + } + return results; + } + // Unexpected token encountered. + abort(); + } + return value; + }; + + // Internal: Updates a traversed object member. + var update = function (source, property, callback) { + var element = walk(source, property, callback); + if (element === undef) { + delete source[property]; + } else { + source[property] = element; + } + }; + + // Internal: Recursively traverses a parsed JSON object, invoking the + // `callback` function for each value. This is an implementation of the + // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. + var walk = function (source, property, callback) { + var value = source[property], length; + if (typeof value == "object" && value) { + // `forEach` can't be used to traverse an array in Opera <= 8.54 + // because its `Object#hasOwnProperty` implementation returns `false` + // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). + if (getClass.call(value) == arrayClass) { + for (length = value.length; length--;) { + update(value, length, callback); + } + } else { + forEach(value, function (property) { + update(value, property, callback); + }); + } + } + return callback.call(source, property, value); + }; + + // Public: `JSON.parse`. See ES 5.1 section 15.12.2. + exports.parse = function (source, callback) { + var result, value; + Index = 0; + Source = "" + source; + result = get(lex()); + // If a JSON string contains multiple tokens, it is invalid. + if (lex() != "$") { + abort(); + } + // Reset the parser state. + Index = Source = null; + return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; + }; + } + } + + exports["runInContext"] = runInContext; + return exports; + } + + if (freeExports && !isLoader) { + // Export for CommonJS environments. + runInContext(root, freeExports); + } else { + // Export for web browsers and JavaScript engines. + var nativeJSON = root.JSON, + previousJSON = root["JSON3"], + isRestored = false; + + var JSON3 = runInContext(root, (root["JSON3"] = { + // Public: Restores the original value of the global `JSON` object and + // returns a reference to the `JSON3` object. + "noConflict": function () { + if (!isRestored) { + isRestored = true; + root.JSON = nativeJSON; + root["JSON3"] = previousJSON; + nativeJSON = previousJSON = null; + } + return JSON3; + } + })); + + root.JSON = { + "parse": JSON3.parse, + "stringify": JSON3.stringify + }; + } + + // Export for asynchronous module loaders. + if (isLoader) { + define(function () { + return JSON3; + }); + } +}).call(this); diff --git a/node_modules/es6-promise/dist/test/mocha.css b/node_modules/es6-promise/dist/test/mocha.css new file mode 100644 index 0000000000..42b9798fa4 --- /dev/null +++ b/node_modules/es6-promise/dist/test/mocha.css @@ -0,0 +1,270 @@ +@charset "utf-8"; + +body { + margin:0; +} + +#mocha { + font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif; + margin: 60px 50px; +} + +#mocha ul, +#mocha li { + margin: 0; + padding: 0; +} + +#mocha ul { + list-style: none; +} + +#mocha h1, +#mocha h2 { + margin: 0; +} + +#mocha h1 { + margin-top: 15px; + font-size: 1em; + font-weight: 200; +} + +#mocha h1 a { + text-decoration: none; + color: inherit; +} + +#mocha h1 a:hover { + text-decoration: underline; +} + +#mocha .suite .suite h1 { + margin-top: 0; + font-size: .8em; +} + +#mocha .hidden { + display: none; +} + +#mocha h2 { + font-size: 12px; + font-weight: normal; + cursor: pointer; +} + +#mocha .suite { + margin-left: 15px; +} + +#mocha .test { + margin-left: 15px; + overflow: hidden; +} + +#mocha .test.pending:hover h2::after { + content: '(pending)'; + font-family: arial, sans-serif; +} + +#mocha .test.pass.medium .duration { + background: #c09853; +} + +#mocha .test.pass.slow .duration { + background: #b94a48; +} + +#mocha .test.pass::before { + content: '✓'; + font-size: 12px; + display: block; + float: left; + margin-right: 5px; + color: #00d6b2; +} + +#mocha .test.pass .duration { + font-size: 9px; + margin-left: 5px; + padding: 2px 5px; + color: #fff; + -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2); + -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2); + box-shadow: inset 0 1px 1px rgba(0,0,0,.2); + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + -ms-border-radius: 5px; + -o-border-radius: 5px; + border-radius: 5px; +} + +#mocha .test.pass.fast .duration { + display: none; +} + +#mocha .test.pending { + color: #0b97c4; +} + +#mocha .test.pending::before { + content: '◦'; + color: #0b97c4; +} + +#mocha .test.fail { + color: #c00; +} + +#mocha .test.fail pre { + color: black; +} + +#mocha .test.fail::before { + content: '✖'; + font-size: 12px; + display: block; + float: left; + margin-right: 5px; + color: #c00; +} + +#mocha .test pre.error { + color: #c00; + max-height: 300px; + overflow: auto; +} + +/** + * (1): approximate for browsers not supporting calc + * (2): 42 = 2*15 + 2*10 + 2*1 (padding + margin + border) + * ^^ seriously + */ +#mocha .test pre { + display: block; + float: left; + clear: left; + font: 12px/1.5 monaco, monospace; + margin: 5px; + padding: 15px; + border: 1px solid #eee; + max-width: 85%; /*(1)*/ + max-width: calc(100% - 42px); /*(2)*/ + word-wrap: break-word; + border-bottom-color: #ddd; + -webkit-border-radius: 3px; + -webkit-box-shadow: 0 1px 3px #eee; + -moz-border-radius: 3px; + -moz-box-shadow: 0 1px 3px #eee; + border-radius: 3px; +} + +#mocha .test h2 { + position: relative; +} + +#mocha .test a.replay { + position: absolute; + top: 3px; + right: 0; + text-decoration: none; + vertical-align: middle; + display: block; + width: 15px; + height: 15px; + line-height: 15px; + text-align: center; + background: #eee; + font-size: 15px; + -moz-border-radius: 15px; + border-radius: 15px; + -webkit-transition: opacity 200ms; + -moz-transition: opacity 200ms; + transition: opacity 200ms; + opacity: 0.3; + color: #888; +} + +#mocha .test:hover a.replay { + opacity: 1; +} + +#mocha-report.pass .test.fail { + display: none; +} + +#mocha-report.fail .test.pass { + display: none; +} + +#mocha-report.pending .test.pass, +#mocha-report.pending .test.fail { + display: none; +} +#mocha-report.pending .test.pass.pending { + display: block; +} + +#mocha-error { + color: #c00; + font-size: 1.5em; + font-weight: 100; + letter-spacing: 1px; +} + +#mocha-stats { + position: fixed; + top: 15px; + right: 10px; + font-size: 12px; + margin: 0; + color: #888; + z-index: 1; +} + +#mocha-stats .progress { + float: right; + padding-top: 0; +} + +#mocha-stats em { + color: black; +} + +#mocha-stats a { + text-decoration: none; + color: inherit; +} + +#mocha-stats a:hover { + border-bottom: 1px solid #eee; +} + +#mocha-stats li { + display: inline-block; + margin: 0 5px; + list-style: none; + padding-top: 11px; +} + +#mocha-stats canvas { + width: 40px; + height: 40px; +} + +#mocha code .comment { color: #ddd; } +#mocha code .init { color: #2f6fad; } +#mocha code .string { color: #5890ad; } +#mocha code .keyword { color: #8a6343; } +#mocha code .number { color: #2f6fad; } + +@media screen and (max-device-width: 480px) { + #mocha { + margin: 60px 0px; + } + + #mocha #stats { + position: absolute; + } +} diff --git a/node_modules/es6-promise/dist/test/mocha.js b/node_modules/es6-promise/dist/test/mocha.js new file mode 100644 index 0000000000..e8bee79b28 --- /dev/null +++ b/node_modules/es6-promise/dist/test/mocha.js @@ -0,0 +1,6095 @@ +;(function(){ + +// CommonJS require() + +function require(p){ + var path = require.resolve(p) + , mod = require.modules[path]; + if (!mod) throw new Error('failed to require "' + p + '"'); + if (!mod.exports) { + mod.exports = {}; + mod.call(mod.exports, mod, mod.exports, require.relative(path)); + } + return mod.exports; + } + +require.modules = {}; + +require.resolve = function (path){ + var orig = path + , reg = path + '.js' + , index = path + '/index.js'; + return require.modules[reg] && reg + || require.modules[index] && index + || orig; + }; + +require.register = function (path, fn){ + require.modules[path] = fn; + }; + +require.relative = function (parent) { + return function(p){ + if ('.' != p.charAt(0)) return require(p); + + var path = parent.split('/') + , segs = p.split('/'); + path.pop(); + + for (var i = 0; i < segs.length; i++) { + var seg = segs[i]; + if ('..' == seg) path.pop(); + else if ('.' != seg) path.push(seg); + } + + return require(path.join('/')); + }; + }; + + +require.register("browser/debug.js", function(module, exports, require){ + +module.exports = function(type){ + return function(){ + } +}; + +}); // module: browser/debug.js + +require.register("browser/diff.js", function(module, exports, require){ +/* See LICENSE file for terms of use */ + +/* + * Text diff implementation. + * + * This library supports the following APIS: + * JsDiff.diffChars: Character by character diff + * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace + * JsDiff.diffLines: Line based diff + * + * JsDiff.diffCss: Diff targeted at CSS content + * + * These methods are based on the implementation proposed in + * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986). + * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927 + */ +var JsDiff = (function() { + /*jshint maxparams: 5*/ + function clonePath(path) { + return { newPos: path.newPos, components: path.components.slice(0) }; + } + function removeEmpty(array) { + var ret = []; + for (var i = 0; i < array.length; i++) { + if (array[i]) { + ret.push(array[i]); + } + } + return ret; + } + function escapeHTML(s) { + var n = s; + n = n.replace(/&/g, '&'); + n = n.replace(//g, '>'); + n = n.replace(/"/g, '"'); + + return n; + } + + var Diff = function(ignoreWhitespace) { + this.ignoreWhitespace = ignoreWhitespace; + }; + Diff.prototype = { + diff: function(oldString, newString) { + // Handle the identity case (this is due to unrolling editLength == 0 + if (newString === oldString) { + return [{ value: newString }]; + } + if (!newString) { + return [{ value: oldString, removed: true }]; + } + if (!oldString) { + return [{ value: newString, added: true }]; + } + + newString = this.tokenize(newString); + oldString = this.tokenize(oldString); + + var newLen = newString.length, oldLen = oldString.length; + var maxEditLength = newLen + oldLen; + var bestPath = [{ newPos: -1, components: [] }]; + + // Seed editLength = 0 + var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); + if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) { + return bestPath[0].components; + } + + for (var editLength = 1; editLength <= maxEditLength; editLength++) { + for (var diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) { + var basePath; + var addPath = bestPath[diagonalPath-1], + removePath = bestPath[diagonalPath+1]; + oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; + if (addPath) { + // No one else is going to attempt to use this value, clear it + bestPath[diagonalPath-1] = undefined; + } + + var canAdd = addPath && addPath.newPos+1 < newLen; + var canRemove = removePath && 0 <= oldPos && oldPos < oldLen; + if (!canAdd && !canRemove) { + bestPath[diagonalPath] = undefined; + continue; + } + + // Select the diagonal that we want to branch from. We select the prior + // path whose position in the new string is the farthest from the origin + // and does not pass the bounds of the diff graph + if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) { + basePath = clonePath(removePath); + this.pushComponent(basePath.components, oldString[oldPos], undefined, true); + } else { + basePath = clonePath(addPath); + basePath.newPos++; + this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined); + } + + var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath); + + if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) { + return basePath.components; + } else { + bestPath[diagonalPath] = basePath; + } + } + } + }, + + pushComponent: function(components, value, added, removed) { + var last = components[components.length-1]; + if (last && last.added === added && last.removed === removed) { + // We need to clone here as the component clone operation is just + // as shallow array clone + components[components.length-1] = + {value: this.join(last.value, value), added: added, removed: removed }; + } else { + components.push({value: value, added: added, removed: removed }); + } + }, + extractCommon: function(basePath, newString, oldString, diagonalPath) { + var newLen = newString.length, + oldLen = oldString.length, + newPos = basePath.newPos, + oldPos = newPos - diagonalPath; + while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) { + newPos++; + oldPos++; + + this.pushComponent(basePath.components, newString[newPos], undefined, undefined); + } + basePath.newPos = newPos; + return oldPos; + }, + + equals: function(left, right) { + var reWhitespace = /\S/; + if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) { + return true; + } else { + return left === right; + } + }, + join: function(left, right) { + return left + right; + }, + tokenize: function(value) { + return value; + } + }; + + var CharDiff = new Diff(); + + var WordDiff = new Diff(true); + var WordWithSpaceDiff = new Diff(); + WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) { + return removeEmpty(value.split(/(\s+|\b)/)); + }; + + var CssDiff = new Diff(true); + CssDiff.tokenize = function(value) { + return removeEmpty(value.split(/([{}:;,]|\s+)/)); + }; + + var LineDiff = new Diff(); + LineDiff.tokenize = function(value) { + var retLines = [], + lines = value.split(/^/m); + + for(var i = 0; i < lines.length; i++) { + var line = lines[i], + lastLine = lines[i - 1]; + + // Merge lines that may contain windows new lines + if (line == '\n' && lastLine && lastLine[lastLine.length - 1] === '\r') { + retLines[retLines.length - 1] += '\n'; + } else if (line) { + retLines.push(line); + } + } + + return retLines; + }; + + return { + Diff: Diff, + + diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); }, + diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); }, + diffWordsWithSpace: function(oldStr, newStr) { return WordWithSpaceDiff.diff(oldStr, newStr); }, + diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); }, + + diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); }, + + createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) { + var ret = []; + + ret.push('Index: ' + fileName); + ret.push('==================================================================='); + ret.push('--- ' + fileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader)); + ret.push('+++ ' + fileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader)); + + var diff = LineDiff.diff(oldStr, newStr); + if (!diff[diff.length-1].value) { + diff.pop(); // Remove trailing newline add + } + diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier + + function contextLines(lines) { + return lines.map(function(entry) { return ' ' + entry; }); + } + function eofNL(curRange, i, current) { + var last = diff[diff.length-2], + isLast = i === diff.length-2, + isLastOfType = i === diff.length-3 && (current.added !== last.added || current.removed !== last.removed); + + // Figure out if this is the last line for the given file and missing NL + if (!/\n$/.test(current.value) && (isLast || isLastOfType)) { + curRange.push('\\ No newline at end of file'); + } + } + + var oldRangeStart = 0, newRangeStart = 0, curRange = [], + oldLine = 1, newLine = 1; + for (var i = 0; i < diff.length; i++) { + var current = diff[i], + lines = current.lines || current.value.replace(/\n$/, '').split('\n'); + current.lines = lines; + + if (current.added || current.removed) { + if (!oldRangeStart) { + var prev = diff[i-1]; + oldRangeStart = oldLine; + newRangeStart = newLine; + + if (prev) { + curRange = contextLines(prev.lines.slice(-4)); + oldRangeStart -= curRange.length; + newRangeStart -= curRange.length; + } + } + curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?'+':'-') + entry; })); + eofNL(curRange, i, current); + + if (current.added) { + newLine += lines.length; + } else { + oldLine += lines.length; + } + } else { + if (oldRangeStart) { + // Close out any changes that have been output (or join overlapping) + if (lines.length <= 8 && i < diff.length-2) { + // Overlapping + curRange.push.apply(curRange, contextLines(lines)); + } else { + // end the range and output + var contextSize = Math.min(lines.length, 4); + ret.push( + '@@ -' + oldRangeStart + ',' + (oldLine-oldRangeStart+contextSize) + + ' +' + newRangeStart + ',' + (newLine-newRangeStart+contextSize) + + ' @@'); + ret.push.apply(ret, curRange); + ret.push.apply(ret, contextLines(lines.slice(0, contextSize))); + if (lines.length <= 4) { + eofNL(ret, i, current); + } + + oldRangeStart = 0; newRangeStart = 0; curRange = []; + } + } + oldLine += lines.length; + newLine += lines.length; + } + } + + return ret.join('\n') + '\n'; + }, + + applyPatch: function(oldStr, uniDiff) { + var diffstr = uniDiff.split('\n'); + var diff = []; + var remEOFNL = false, + addEOFNL = false; + + for (var i = (diffstr[0][0]==='I'?4:0); i < diffstr.length; i++) { + if(diffstr[i][0] === '@') { + var meh = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/); + diff.unshift({ + start:meh[3], + oldlength:meh[2], + oldlines:[], + newlength:meh[4], + newlines:[] + }); + } else if(diffstr[i][0] === '+') { + diff[0].newlines.push(diffstr[i].substr(1)); + } else if(diffstr[i][0] === '-') { + diff[0].oldlines.push(diffstr[i].substr(1)); + } else if(diffstr[i][0] === ' ') { + diff[0].newlines.push(diffstr[i].substr(1)); + diff[0].oldlines.push(diffstr[i].substr(1)); + } else if(diffstr[i][0] === '\\') { + if (diffstr[i-1][0] === '+') { + remEOFNL = true; + } else if(diffstr[i-1][0] === '-') { + addEOFNL = true; + } + } + } + + var str = oldStr.split('\n'); + for (var i = diff.length - 1; i >= 0; i--) { + var d = diff[i]; + for (var j = 0; j < d.oldlength; j++) { + if(str[d.start-1+j] !== d.oldlines[j]) { + return false; + } + } + Array.prototype.splice.apply(str,[d.start-1,+d.oldlength].concat(d.newlines)); + } + + if (remEOFNL) { + while (!str[str.length-1]) { + str.pop(); + } + } else if (addEOFNL) { + str.push(''); + } + return str.join('\n'); + }, + + convertChangesToXML: function(changes){ + var ret = []; + for ( var i = 0; i < changes.length; i++) { + var change = changes[i]; + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } + + ret.push(escapeHTML(change.value)); + + if (change.added) { + ret.push(''); + } else if (change.removed) { + ret.push(''); + } + } + return ret.join(''); + }, + + // See: http://code.google.com/p/google-diff-match-patch/wiki/API + convertChangesToDMP: function(changes){ + var ret = [], change; + for ( var i = 0; i < changes.length; i++) { + change = changes[i]; + ret.push([(change.added ? 1 : change.removed ? -1 : 0), change.value]); + } + return ret; + } + }; +})(); + +if (typeof module !== 'undefined') { + module.exports = JsDiff; +} + +}); // module: browser/diff.js + +require.register("browser/escape-string-regexp.js", function(module, exports, require){ +'use strict'; + +var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; + +module.exports = function (str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + + return str.replace(matchOperatorsRe, '\\$&'); +}; + +}); // module: browser/escape-string-regexp.js + +require.register("browser/events.js", function(module, exports, require){ + +/** + * Module exports. + */ + +exports.EventEmitter = EventEmitter; + +/** + * Check if `obj` is an array. + */ + +function isArray(obj) { + return '[object Array]' == {}.toString.call(obj); +} + +/** + * Event emitter constructor. + * + * @api public + */ + +function EventEmitter(){}; + +/** + * Adds a listener. + * + * @api public + */ + +EventEmitter.prototype.on = function (name, fn) { + if (!this.$events) { + this.$events = {}; + } + + if (!this.$events[name]) { + this.$events[name] = fn; + } else if (isArray(this.$events[name])) { + this.$events[name].push(fn); + } else { + this.$events[name] = [this.$events[name], fn]; + } + + return this; +}; + +EventEmitter.prototype.addListener = EventEmitter.prototype.on; + +/** + * Adds a volatile listener. + * + * @api public + */ + +EventEmitter.prototype.once = function (name, fn) { + var self = this; + + function on () { + self.removeListener(name, on); + fn.apply(this, arguments); + }; + + on.listener = fn; + this.on(name, on); + + return this; +}; + +/** + * Removes a listener. + * + * @api public + */ + +EventEmitter.prototype.removeListener = function (name, fn) { + if (this.$events && this.$events[name]) { + var list = this.$events[name]; + + if (isArray(list)) { + var pos = -1; + + for (var i = 0, l = list.length; i < l; i++) { + if (list[i] === fn || (list[i].listener && list[i].listener === fn)) { + pos = i; + break; + } + } + + if (pos < 0) { + return this; + } + + list.splice(pos, 1); + + if (!list.length) { + delete this.$events[name]; + } + } else if (list === fn || (list.listener && list.listener === fn)) { + delete this.$events[name]; + } + } + + return this; +}; + +/** + * Removes all listeners for an event. + * + * @api public + */ + +EventEmitter.prototype.removeAllListeners = function (name) { + if (name === undefined) { + this.$events = {}; + return this; + } + + if (this.$events && this.$events[name]) { + this.$events[name] = null; + } + + return this; +}; + +/** + * Gets all listeners for a certain event. + * + * @api public + */ + +EventEmitter.prototype.listeners = function (name) { + if (!this.$events) { + this.$events = {}; + } + + if (!this.$events[name]) { + this.$events[name] = []; + } + + if (!isArray(this.$events[name])) { + this.$events[name] = [this.$events[name]]; + } + + return this.$events[name]; +}; + +/** + * Emits an event. + * + * @api public + */ + +EventEmitter.prototype.emit = function (name) { + if (!this.$events) { + return false; + } + + var handler = this.$events[name]; + + if (!handler) { + return false; + } + + var args = [].slice.call(arguments, 1); + + if ('function' == typeof handler) { + handler.apply(this, args); + } else if (isArray(handler)) { + var listeners = handler.slice(); + + for (var i = 0, l = listeners.length; i < l; i++) { + listeners[i].apply(this, args); + } + } else { + return false; + } + + return true; +}; +}); // module: browser/events.js + +require.register("browser/fs.js", function(module, exports, require){ + +}); // module: browser/fs.js + +require.register("browser/glob.js", function(module, exports, require){ + +}); // module: browser/glob.js + +require.register("browser/path.js", function(module, exports, require){ + +}); // module: browser/path.js + +require.register("browser/progress.js", function(module, exports, require){ +/** + * Expose `Progress`. + */ + +module.exports = Progress; + +/** + * Initialize a new `Progress` indicator. + */ + +function Progress() { + this.percent = 0; + this.size(0); + this.fontSize(11); + this.font('helvetica, arial, sans-serif'); +} + +/** + * Set progress size to `n`. + * + * @param {Number} n + * @return {Progress} for chaining + * @api public + */ + +Progress.prototype.size = function(n){ + this._size = n; + return this; +}; + +/** + * Set text to `str`. + * + * @param {String} str + * @return {Progress} for chaining + * @api public + */ + +Progress.prototype.text = function(str){ + this._text = str; + return this; +}; + +/** + * Set font size to `n`. + * + * @param {Number} n + * @return {Progress} for chaining + * @api public + */ + +Progress.prototype.fontSize = function(n){ + this._fontSize = n; + return this; +}; + +/** + * Set font `family`. + * + * @param {String} family + * @return {Progress} for chaining + */ + +Progress.prototype.font = function(family){ + this._font = family; + return this; +}; + +/** + * Update percentage to `n`. + * + * @param {Number} n + * @return {Progress} for chaining + */ + +Progress.prototype.update = function(n){ + this.percent = n; + return this; +}; + +/** + * Draw on `ctx`. + * + * @param {CanvasRenderingContext2d} ctx + * @return {Progress} for chaining + */ + +Progress.prototype.draw = function(ctx){ + try { + var percent = Math.min(this.percent, 100) + , size = this._size + , half = size / 2 + , x = half + , y = half + , rad = half - 1 + , fontSize = this._fontSize; + + ctx.font = fontSize + 'px ' + this._font; + + var angle = Math.PI * 2 * (percent / 100); + ctx.clearRect(0, 0, size, size); + + // outer circle + ctx.strokeStyle = '#9f9f9f'; + ctx.beginPath(); + ctx.arc(x, y, rad, 0, angle, false); + ctx.stroke(); + + // inner circle + ctx.strokeStyle = '#eee'; + ctx.beginPath(); + ctx.arc(x, y, rad - 1, 0, angle, true); + ctx.stroke(); + + // text + var text = this._text || (percent | 0) + '%' + , w = ctx.measureText(text).width; + + ctx.fillText( + text + , x - w / 2 + 1 + , y + fontSize / 2 - 1); + } catch (ex) {} //don't fail if we can't render progress + return this; +}; + +}); // module: browser/progress.js + +require.register("browser/tty.js", function(module, exports, require){ + +exports.isatty = function(){ + return true; +}; + +exports.getWindowSize = function(){ + if ('innerHeight' in global) { + return [global.innerHeight, global.innerWidth]; + } else { + // In a Web Worker, the DOM Window is not available. + return [640, 480]; + } +}; + +}); // module: browser/tty.js + +require.register("context.js", function(module, exports, require){ + +/** + * Expose `Context`. + */ + +module.exports = Context; + +/** + * Initialize a new `Context`. + * + * @api private + */ + +function Context(){} + +/** + * Set or get the context `Runnable` to `runnable`. + * + * @param {Runnable} runnable + * @return {Context} + * @api private + */ + +Context.prototype.runnable = function(runnable){ + if (0 == arguments.length) return this._runnable; + this.test = this._runnable = runnable; + return this; +}; + +/** + * Set test timeout `ms`. + * + * @param {Number} ms + * @return {Context} self + * @api private + */ + +Context.prototype.timeout = function(ms){ + if (arguments.length === 0) return this.runnable().timeout(); + this.runnable().timeout(ms); + return this; +}; + +/** + * Set test timeout `enabled`. + * + * @param {Boolean} enabled + * @return {Context} self + * @api private + */ + +Context.prototype.enableTimeouts = function (enabled) { + this.runnable().enableTimeouts(enabled); + return this; +}; + + +/** + * Set test slowness threshold `ms`. + * + * @param {Number} ms + * @return {Context} self + * @api private + */ + +Context.prototype.slow = function(ms){ + this.runnable().slow(ms); + return this; +}; + +/** + * Inspect the context void of `._runnable`. + * + * @return {String} + * @api private + */ + +Context.prototype.inspect = function(){ + return JSON.stringify(this, function(key, val){ + if ('_runnable' == key) return; + if ('test' == key) return; + return val; + }, 2); +}; + +}); // module: context.js + +require.register("hook.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Runnable = require('./runnable'); + +/** + * Expose `Hook`. + */ + +module.exports = Hook; + +/** + * Initialize a new `Hook` with the given `title` and callback `fn`. + * + * @param {String} title + * @param {Function} fn + * @api private + */ + +function Hook(title, fn) { + Runnable.call(this, title, fn); + this.type = 'hook'; +} + +/** + * Inherit from `Runnable.prototype`. + */ + +function F(){}; +F.prototype = Runnable.prototype; +Hook.prototype = new F; +Hook.prototype.constructor = Hook; + + +/** + * Get or set the test `err`. + * + * @param {Error} err + * @return {Error} + * @api public + */ + +Hook.prototype.error = function(err){ + if (0 == arguments.length) { + var err = this._error; + this._error = null; + return err; + } + + this._error = err; +}; + +}); // module: hook.js + +require.register("interfaces/bdd.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Suite = require('../suite') + , Test = require('../test') + , utils = require('../utils') + , escapeRe = require('browser/escape-string-regexp'); + +/** + * BDD-style interface: + * + * describe('Array', function(){ + * describe('#indexOf()', function(){ + * it('should return -1 when not present', function(){ + * + * }); + * + * it('should return the index when present', function(){ + * + * }); + * }); + * }); + * + */ + +module.exports = function(suite){ + var suites = [suite]; + + suite.on('pre-require', function(context, file, mocha){ + + /** + * Execute before running tests. + */ + + context.before = function(name, fn){ + suites[0].beforeAll(name, fn); + }; + + /** + * Execute after running tests. + */ + + context.after = function(name, fn){ + suites[0].afterAll(name, fn); + }; + + /** + * Execute before each test case. + */ + + context.beforeEach = function(name, fn){ + suites[0].beforeEach(name, fn); + }; + + /** + * Execute after each test case. + */ + + context.afterEach = function(name, fn){ + suites[0].afterEach(name, fn); + }; + + /** + * Describe a "suite" with the given `title` + * and callback `fn` containing nested suites + * and/or tests. + */ + + context.describe = context.context = function(title, fn){ + var suite = Suite.create(suites[0], title); + suite.file = file; + suites.unshift(suite); + fn.call(suite); + suites.shift(); + return suite; + }; + + /** + * Pending describe. + */ + + context.xdescribe = + context.xcontext = + context.describe.skip = function(title, fn){ + var suite = Suite.create(suites[0], title); + suite.pending = true; + suites.unshift(suite); + fn.call(suite); + suites.shift(); + }; + + /** + * Exclusive suite. + */ + + context.describe.only = function(title, fn){ + var suite = context.describe(title, fn); + mocha.grep(suite.fullTitle()); + return suite; + }; + + /** + * Describe a specification or test-case + * with the given `title` and callback `fn` + * acting as a thunk. + */ + + context.it = context.specify = function(title, fn){ + var suite = suites[0]; + if (suite.pending) fn = null; + var test = new Test(title, fn); + test.file = file; + suite.addTest(test); + return test; + }; + + /** + * Exclusive test-case. + */ + + context.it.only = function(title, fn){ + var test = context.it(title, fn); + var reString = '^' + escapeRe(test.fullTitle()) + '$'; + mocha.grep(new RegExp(reString)); + return test; + }; + + /** + * Pending test case. + */ + + context.xit = + context.xspecify = + context.it.skip = function(title){ + context.it(title); + }; + }); +}; + +}); // module: interfaces/bdd.js + +require.register("interfaces/exports.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Suite = require('../suite') + , Test = require('../test'); + +/** + * TDD-style interface: + * + * exports.Array = { + * '#indexOf()': { + * 'should return -1 when the value is not present': function(){ + * + * }, + * + * 'should return the correct index when the value is present': function(){ + * + * } + * } + * }; + * + */ + +module.exports = function(suite){ + var suites = [suite]; + + suite.on('require', visit); + + function visit(obj, file) { + var suite; + for (var key in obj) { + if ('function' == typeof obj[key]) { + var fn = obj[key]; + switch (key) { + case 'before': + suites[0].beforeAll(fn); + break; + case 'after': + suites[0].afterAll(fn); + break; + case 'beforeEach': + suites[0].beforeEach(fn); + break; + case 'afterEach': + suites[0].afterEach(fn); + break; + default: + var test = new Test(key, fn); + test.file = file; + suites[0].addTest(test); + } + } else { + suite = Suite.create(suites[0], key); + suites.unshift(suite); + visit(obj[key]); + suites.shift(); + } + } + } +}; + +}); // module: interfaces/exports.js + +require.register("interfaces/index.js", function(module, exports, require){ + +exports.bdd = require('./bdd'); +exports.tdd = require('./tdd'); +exports.qunit = require('./qunit'); +exports.exports = require('./exports'); + +}); // module: interfaces/index.js + +require.register("interfaces/qunit.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Suite = require('../suite') + , Test = require('../test') + , escapeRe = require('browser/escape-string-regexp') + , utils = require('../utils'); + +/** + * QUnit-style interface: + * + * suite('Array'); + * + * test('#length', function(){ + * var arr = [1,2,3]; + * ok(arr.length == 3); + * }); + * + * test('#indexOf()', function(){ + * var arr = [1,2,3]; + * ok(arr.indexOf(1) == 0); + * ok(arr.indexOf(2) == 1); + * ok(arr.indexOf(3) == 2); + * }); + * + * suite('String'); + * + * test('#length', function(){ + * ok('foo'.length == 3); + * }); + * + */ + +module.exports = function(suite){ + var suites = [suite]; + + suite.on('pre-require', function(context, file, mocha){ + + /** + * Execute before running tests. + */ + + context.before = function(name, fn){ + suites[0].beforeAll(name, fn); + }; + + /** + * Execute after running tests. + */ + + context.after = function(name, fn){ + suites[0].afterAll(name, fn); + }; + + /** + * Execute before each test case. + */ + + context.beforeEach = function(name, fn){ + suites[0].beforeEach(name, fn); + }; + + /** + * Execute after each test case. + */ + + context.afterEach = function(name, fn){ + suites[0].afterEach(name, fn); + }; + + /** + * Describe a "suite" with the given `title`. + */ + + context.suite = function(title){ + if (suites.length > 1) suites.shift(); + var suite = Suite.create(suites[0], title); + suite.file = file; + suites.unshift(suite); + return suite; + }; + + /** + * Exclusive test-case. + */ + + context.suite.only = function(title, fn){ + var suite = context.suite(title, fn); + mocha.grep(suite.fullTitle()); + }; + + /** + * Describe a specification or test-case + * with the given `title` and callback `fn` + * acting as a thunk. + */ + + context.test = function(title, fn){ + var test = new Test(title, fn); + test.file = file; + suites[0].addTest(test); + return test; + }; + + /** + * Exclusive test-case. + */ + + context.test.only = function(title, fn){ + var test = context.test(title, fn); + var reString = '^' + escapeRe(test.fullTitle()) + '$'; + mocha.grep(new RegExp(reString)); + }; + + /** + * Pending test case. + */ + + context.test.skip = function(title){ + context.test(title); + }; + }); +}; + +}); // module: interfaces/qunit.js + +require.register("interfaces/tdd.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Suite = require('../suite') + , Test = require('../test') + , escapeRe = require('browser/escape-string-regexp') + , utils = require('../utils'); + +/** + * TDD-style interface: + * + * suite('Array', function(){ + * suite('#indexOf()', function(){ + * suiteSetup(function(){ + * + * }); + * + * test('should return -1 when not present', function(){ + * + * }); + * + * test('should return the index when present', function(){ + * + * }); + * + * suiteTeardown(function(){ + * + * }); + * }); + * }); + * + */ + +module.exports = function(suite){ + var suites = [suite]; + + suite.on('pre-require', function(context, file, mocha){ + + /** + * Execute before each test case. + */ + + context.setup = function(name, fn){ + suites[0].beforeEach(name, fn); + }; + + /** + * Execute after each test case. + */ + + context.teardown = function(name, fn){ + suites[0].afterEach(name, fn); + }; + + /** + * Execute before the suite. + */ + + context.suiteSetup = function(name, fn){ + suites[0].beforeAll(name, fn); + }; + + /** + * Execute after the suite. + */ + + context.suiteTeardown = function(name, fn){ + suites[0].afterAll(name, fn); + }; + + /** + * Describe a "suite" with the given `title` + * and callback `fn` containing nested suites + * and/or tests. + */ + + context.suite = function(title, fn){ + var suite = Suite.create(suites[0], title); + suite.file = file; + suites.unshift(suite); + fn.call(suite); + suites.shift(); + return suite; + }; + + /** + * Pending suite. + */ + context.suite.skip = function(title, fn) { + var suite = Suite.create(suites[0], title); + suite.pending = true; + suites.unshift(suite); + fn.call(suite); + suites.shift(); + }; + + /** + * Exclusive test-case. + */ + + context.suite.only = function(title, fn){ + var suite = context.suite(title, fn); + mocha.grep(suite.fullTitle()); + }; + + /** + * Describe a specification or test-case + * with the given `title` and callback `fn` + * acting as a thunk. + */ + + context.test = function(title, fn){ + var suite = suites[0]; + if (suite.pending) fn = null; + var test = new Test(title, fn); + test.file = file; + suite.addTest(test); + return test; + }; + + /** + * Exclusive test-case. + */ + + context.test.only = function(title, fn){ + var test = context.test(title, fn); + var reString = '^' + escapeRe(test.fullTitle()) + '$'; + mocha.grep(new RegExp(reString)); + }; + + /** + * Pending test case. + */ + + context.test.skip = function(title){ + context.test(title); + }; + }); +}; + +}); // module: interfaces/tdd.js + +require.register("mocha.js", function(module, exports, require){ +/*! + * mocha + * Copyright(c) 2011 TJ Holowaychuk + * MIT Licensed + */ + +/** + * Module dependencies. + */ + +var path = require('browser/path') + , escapeRe = require('browser/escape-string-regexp') + , utils = require('./utils'); + +/** + * Expose `Mocha`. + */ + +exports = module.exports = Mocha; + +/** + * To require local UIs and reporters when running in node. + */ + +if (typeof process !== 'undefined' && typeof process.cwd === 'function') { + var join = path.join + , cwd = process.cwd(); + module.paths.push(cwd, join(cwd, 'node_modules')); +} + +/** + * Expose internals. + */ + +exports.utils = utils; +exports.interfaces = require('./interfaces'); +exports.reporters = require('./reporters'); +exports.Runnable = require('./runnable'); +exports.Context = require('./context'); +exports.Runner = require('./runner'); +exports.Suite = require('./suite'); +exports.Hook = require('./hook'); +exports.Test = require('./test'); + +/** + * Return image `name` path. + * + * @param {String} name + * @return {String} + * @api private + */ + +function image(name) { + return __dirname + '/../images/' + name + '.png'; +} + +/** + * Setup mocha with `options`. + * + * Options: + * + * - `ui` name "bdd", "tdd", "exports" etc + * - `reporter` reporter instance, defaults to `mocha.reporters.spec` + * - `globals` array of accepted globals + * - `timeout` timeout in milliseconds + * - `bail` bail on the first test failure + * - `slow` milliseconds to wait before considering a test slow + * - `ignoreLeaks` ignore global leaks + * - `grep` string or regexp to filter tests with + * + * @param {Object} options + * @api public + */ + +function Mocha(options) { + options = options || {}; + this.files = []; + this.options = options; + this.grep(options.grep); + this.suite = new exports.Suite('', new exports.Context); + this.ui(options.ui); + this.bail(options.bail); + this.reporter(options.reporter); + if (null != options.timeout) this.timeout(options.timeout); + this.useColors(options.useColors) + if (options.enableTimeouts !== null) this.enableTimeouts(options.enableTimeouts); + if (options.slow) this.slow(options.slow); + + this.suite.on('pre-require', function (context) { + exports.afterEach = context.afterEach || context.teardown; + exports.after = context.after || context.suiteTeardown; + exports.beforeEach = context.beforeEach || context.setup; + exports.before = context.before || context.suiteSetup; + exports.describe = context.describe || context.suite; + exports.it = context.it || context.test; + exports.setup = context.setup || context.beforeEach; + exports.suiteSetup = context.suiteSetup || context.before; + exports.suiteTeardown = context.suiteTeardown || context.after; + exports.suite = context.suite || context.describe; + exports.teardown = context.teardown || context.afterEach; + exports.test = context.test || context.it; + }); +} + +/** + * Enable or disable bailing on the first failure. + * + * @param {Boolean} [bail] + * @api public + */ + +Mocha.prototype.bail = function(bail){ + if (0 == arguments.length) bail = true; + this.suite.bail(bail); + return this; +}; + +/** + * Add test `file`. + * + * @param {String} file + * @api public + */ + +Mocha.prototype.addFile = function(file){ + this.files.push(file); + return this; +}; + +/** + * Set reporter to `reporter`, defaults to "spec". + * + * @param {String|Function} reporter name or constructor + * @api public + */ + +Mocha.prototype.reporter = function(reporter){ + if ('function' == typeof reporter) { + this._reporter = reporter; + } else { + reporter = reporter || 'spec'; + var _reporter; + try { _reporter = require('./reporters/' + reporter); } catch (err) {}; + if (!_reporter) try { _reporter = require(reporter); } catch (err) {}; + if (!_reporter && reporter === 'teamcity') + console.warn('The Teamcity reporter was moved to a package named ' + + 'mocha-teamcity-reporter ' + + '(https://npmjs.org/package/mocha-teamcity-reporter).'); + if (!_reporter) throw new Error('invalid reporter "' + reporter + '"'); + this._reporter = _reporter; + } + return this; +}; + +/** + * Set test UI `name`, defaults to "bdd". + * + * @param {String} bdd + * @api public + */ + +Mocha.prototype.ui = function(name){ + name = name || 'bdd'; + this._ui = exports.interfaces[name]; + if (!this._ui) try { this._ui = require(name); } catch (err) {}; + if (!this._ui) throw new Error('invalid interface "' + name + '"'); + this._ui = this._ui(this.suite); + return this; +}; + +/** + * Load registered files. + * + * @api private + */ + +Mocha.prototype.loadFiles = function(fn){ + var self = this; + var suite = this.suite; + var pending = this.files.length; + this.files.forEach(function(file){ + file = path.resolve(file); + suite.emit('pre-require', global, file, self); + suite.emit('require', require(file), file, self); + suite.emit('post-require', global, file, self); + --pending || (fn && fn()); + }); +}; + +/** + * Enable growl support. + * + * @api private + */ + +Mocha.prototype._growl = function(runner, reporter) { + var notify = require('growl'); + + runner.on('end', function(){ + var stats = reporter.stats; + if (stats.failures) { + var msg = stats.failures + ' of ' + runner.total + ' tests failed'; + notify(msg, { name: 'mocha', title: 'Failed', image: image('error') }); + } else { + notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', { + name: 'mocha' + , title: 'Passed' + , image: image('ok') + }); + } + }); +}; + +/** + * Add regexp to grep, if `re` is a string it is escaped. + * + * @param {RegExp|String} re + * @return {Mocha} + * @api public + */ + +Mocha.prototype.grep = function(re){ + this.options.grep = 'string' == typeof re + ? new RegExp(escapeRe(re)) + : re; + return this; +}; + +/** + * Invert `.grep()` matches. + * + * @return {Mocha} + * @api public + */ + +Mocha.prototype.invert = function(){ + this.options.invert = true; + return this; +}; + +/** + * Ignore global leaks. + * + * @param {Boolean} ignore + * @return {Mocha} + * @api public + */ + +Mocha.prototype.ignoreLeaks = function(ignore){ + this.options.ignoreLeaks = !!ignore; + return this; +}; + +/** + * Enable global leak checking. + * + * @return {Mocha} + * @api public + */ + +Mocha.prototype.checkLeaks = function(){ + this.options.ignoreLeaks = false; + return this; +}; + +/** + * Enable growl support. + * + * @return {Mocha} + * @api public + */ + +Mocha.prototype.growl = function(){ + this.options.growl = true; + return this; +}; + +/** + * Ignore `globals` array or string. + * + * @param {Array|String} globals + * @return {Mocha} + * @api public + */ + +Mocha.prototype.globals = function(globals){ + this.options.globals = (this.options.globals || []).concat(globals); + return this; +}; + +/** + * Emit color output. + * + * @param {Boolean} colors + * @return {Mocha} + * @api public + */ + +Mocha.prototype.useColors = function(colors){ + this.options.useColors = arguments.length && colors != undefined + ? colors + : true; + return this; +}; + +/** + * Use inline diffs rather than +/-. + * + * @param {Boolean} inlineDiffs + * @return {Mocha} + * @api public + */ + +Mocha.prototype.useInlineDiffs = function(inlineDiffs) { + this.options.useInlineDiffs = arguments.length && inlineDiffs != undefined + ? inlineDiffs + : false; + return this; +}; + +/** + * Set the timeout in milliseconds. + * + * @param {Number} timeout + * @return {Mocha} + * @api public + */ + +Mocha.prototype.timeout = function(timeout){ + this.suite.timeout(timeout); + return this; +}; + +/** + * Set slowness threshold in milliseconds. + * + * @param {Number} slow + * @return {Mocha} + * @api public + */ + +Mocha.prototype.slow = function(slow){ + this.suite.slow(slow); + return this; +}; + +/** + * Enable timeouts. + * + * @param {Boolean} enabled + * @return {Mocha} + * @api public + */ + +Mocha.prototype.enableTimeouts = function(enabled) { + this.suite.enableTimeouts(arguments.length && enabled !== undefined + ? enabled + : true); + return this +}; + +/** + * Makes all tests async (accepting a callback) + * + * @return {Mocha} + * @api public + */ + +Mocha.prototype.asyncOnly = function(){ + this.options.asyncOnly = true; + return this; +}; + +/** + * Disable syntax highlighting (in browser). + * @returns {Mocha} + * @api public + */ +Mocha.prototype.noHighlighting = function() { + this.options.noHighlighting = true; + return this; +}; + +/** + * Run tests and invoke `fn()` when complete. + * + * @param {Function} fn + * @return {Runner} + * @api public + */ + +Mocha.prototype.run = function(fn){ + if (this.files.length) this.loadFiles(); + var suite = this.suite; + var options = this.options; + options.files = this.files; + var runner = new exports.Runner(suite); + var reporter = new this._reporter(runner, options); + runner.ignoreLeaks = false !== options.ignoreLeaks; + runner.asyncOnly = options.asyncOnly; + if (options.grep) runner.grep(options.grep, options.invert); + if (options.globals) runner.globals(options.globals); + if (options.growl) this._growl(runner, reporter); + exports.reporters.Base.useColors = options.useColors; + exports.reporters.Base.inlineDiffs = options.useInlineDiffs; + return runner.run(fn); +}; + +}); // module: mocha.js + +require.register("ms.js", function(module, exports, require){ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} options + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options){ + options = options || {}; + if ('string' == typeof val) return parse(val); + return options['long'] ? longFormat(val) : shortFormat(val); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + var match = /^((?:\d+)?\.?\d+) *(ms|seconds?|s|minutes?|m|hours?|h|days?|d|years?|y)?$/i.exec(str); + if (!match) return; + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'y': + return n * y; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 's': + return n * s; + case 'ms': + return n; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function shortFormat(ms) { + if (ms >= d) return Math.round(ms / d) + 'd'; + if (ms >= h) return Math.round(ms / h) + 'h'; + if (ms >= m) return Math.round(ms / m) + 'm'; + if (ms >= s) return Math.round(ms / s) + 's'; + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function longFormat(ms) { + return plural(ms, d, 'day') + || plural(ms, h, 'hour') + || plural(ms, m, 'minute') + || plural(ms, s, 'second') + || ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, n, name) { + if (ms < n) return; + if (ms < n * 1.5) return Math.floor(ms / n) + ' ' + name; + return Math.ceil(ms / n) + ' ' + name + 's'; +} + +}); // module: ms.js + +require.register("reporters/base.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var tty = require('browser/tty') + , diff = require('browser/diff') + , ms = require('../ms') + , utils = require('../utils'); + +/** + * Save timer references to avoid Sinon interfering (see GH-237). + */ + +var Date = global.Date + , setTimeout = global.setTimeout + , setInterval = global.setInterval + , clearTimeout = global.clearTimeout + , clearInterval = global.clearInterval; + +/** + * Check if both stdio streams are associated with a tty. + */ + +var isatty = tty.isatty(1) && tty.isatty(2); + +/** + * Expose `Base`. + */ + +exports = module.exports = Base; + +/** + * Enable coloring by default. + */ + +exports.useColors = isatty || (process.env.MOCHA_COLORS !== undefined); + +/** + * Inline diffs instead of +/- + */ + +exports.inlineDiffs = false; + +/** + * Default color map. + */ + +exports.colors = { + 'pass': 90 + , 'fail': 31 + , 'bright pass': 92 + , 'bright fail': 91 + , 'bright yellow': 93 + , 'pending': 36 + , 'suite': 0 + , 'error title': 0 + , 'error message': 31 + , 'error stack': 90 + , 'checkmark': 32 + , 'fast': 90 + , 'medium': 33 + , 'slow': 31 + , 'green': 32 + , 'light': 90 + , 'diff gutter': 90 + , 'diff added': 42 + , 'diff removed': 41 +}; + +/** + * Default symbol map. + */ + +exports.symbols = { + ok: '✓', + err: '✖', + dot: '․' +}; + +// With node.js on Windows: use symbols available in terminal default fonts +if ('win32' == process.platform) { + exports.symbols.ok = '\u221A'; + exports.symbols.err = '\u00D7'; + exports.symbols.dot = '.'; +} + +/** + * Color `str` with the given `type`, + * allowing colors to be disabled, + * as well as user-defined color + * schemes. + * + * @param {String} type + * @param {String} str + * @return {String} + * @api private + */ + +var color = exports.color = function(type, str) { + if (!exports.useColors) return str; + return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m'; +}; + +/** + * Expose term window size, with some + * defaults for when stderr is not a tty. + */ + +exports.window = { + width: isatty + ? process.stdout.getWindowSize + ? process.stdout.getWindowSize(1)[0] + : tty.getWindowSize()[1] + : 75 +}; + +/** + * Expose some basic cursor interactions + * that are common among reporters. + */ + +exports.cursor = { + hide: function(){ + isatty && process.stdout.write('\u001b[?25l'); + }, + + show: function(){ + isatty && process.stdout.write('\u001b[?25h'); + }, + + deleteLine: function(){ + isatty && process.stdout.write('\u001b[2K'); + }, + + beginningOfLine: function(){ + isatty && process.stdout.write('\u001b[0G'); + }, + + CR: function(){ + if (isatty) { + exports.cursor.deleteLine(); + exports.cursor.beginningOfLine(); + } else { + process.stdout.write('\r'); + } + } +}; + +/** + * Outut the given `failures` as a list. + * + * @param {Array} failures + * @api public + */ + +exports.list = function(failures){ + console.error(); + failures.forEach(function(test, i){ + // format + var fmt = color('error title', ' %s) %s:\n') + + color('error message', ' %s') + + color('error stack', '\n%s\n'); + + // msg + var err = test.err + , message = err.message || '' + , stack = err.stack || message + , index = stack.indexOf(message) + message.length + , msg = stack.slice(0, index) + , actual = err.actual + , expected = err.expected + , escape = true; + + // uncaught + if (err.uncaught) { + msg = 'Uncaught ' + msg; + } + + // explicitly show diff + if (err.showDiff && sameType(actual, expected)) { + escape = false; + err.actual = actual = utils.stringify(actual); + err.expected = expected = utils.stringify(expected); + } + + // actual / expected diff + if (err.showDiff && 'string' == typeof actual && 'string' == typeof expected) { + fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n'); + var match = message.match(/^([^:]+): expected/); + msg = '\n ' + color('error message', match ? match[1] : msg); + + if (exports.inlineDiffs) { + msg += inlineDiff(err, escape); + } else { + msg += unifiedDiff(err, escape); + } + } + + // indent stack trace without msg + stack = stack.slice(index ? index + 1 : index) + .replace(/^/gm, ' '); + + console.error(fmt, (i + 1), test.fullTitle(), msg, stack); + }); +}; + +/** + * Initialize a new `Base` reporter. + * + * All other reporters generally + * inherit from this reporter, providing + * stats such as test duration, number + * of tests passed / failed etc. + * + * @param {Runner} runner + * @api public + */ + +function Base(runner) { + var self = this + , stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 } + , failures = this.failures = []; + + if (!runner) return; + this.runner = runner; + + runner.stats = stats; + + runner.on('start', function(){ + stats.start = new Date; + }); + + runner.on('suite', function(suite){ + stats.suites = stats.suites || 0; + suite.root || stats.suites++; + }); + + runner.on('test end', function(test){ + stats.tests = stats.tests || 0; + stats.tests++; + }); + + runner.on('pass', function(test){ + stats.passes = stats.passes || 0; + + var medium = test.slow() / 2; + test.speed = test.duration > test.slow() + ? 'slow' + : test.duration > medium + ? 'medium' + : 'fast'; + + stats.passes++; + }); + + runner.on('fail', function(test, err){ + stats.failures = stats.failures || 0; + stats.failures++; + test.err = err; + failures.push(test); + }); + + runner.on('end', function(){ + stats.end = new Date; + stats.duration = new Date - stats.start; + }); + + runner.on('pending', function(){ + stats.pending++; + }); +} + +/** + * Output common epilogue used by many of + * the bundled reporters. + * + * @api public + */ + +Base.prototype.epilogue = function(){ + var stats = this.stats; + var tests; + var fmt; + + console.log(); + + // passes + fmt = color('bright pass', ' ') + + color('green', ' %d passing') + + color('light', ' (%s)'); + + console.log(fmt, + stats.passes || 0, + ms(stats.duration)); + + // pending + if (stats.pending) { + fmt = color('pending', ' ') + + color('pending', ' %d pending'); + + console.log(fmt, stats.pending); + } + + // failures + if (stats.failures) { + fmt = color('fail', ' %d failing'); + + console.error(fmt, + stats.failures); + + Base.list(this.failures); + console.error(); + } + + console.log(); +}; + +/** + * Pad the given `str` to `len`. + * + * @param {String} str + * @param {String} len + * @return {String} + * @api private + */ + +function pad(str, len) { + str = String(str); + return Array(len - str.length + 1).join(' ') + str; +} + + +/** + * Returns an inline diff between 2 strings with coloured ANSI output + * + * @param {Error} Error with actual/expected + * @return {String} Diff + * @api private + */ + +function inlineDiff(err, escape) { + var msg = errorDiff(err, 'WordsWithSpace', escape); + + // linenos + var lines = msg.split('\n'); + if (lines.length > 4) { + var width = String(lines.length).length; + msg = lines.map(function(str, i){ + return pad(++i, width) + ' |' + ' ' + str; + }).join('\n'); + } + + // legend + msg = '\n' + + color('diff removed', 'actual') + + ' ' + + color('diff added', 'expected') + + '\n\n' + + msg + + '\n'; + + // indent + msg = msg.replace(/^/gm, ' '); + return msg; +} + +/** + * Returns a unified diff between 2 strings + * + * @param {Error} Error with actual/expected + * @return {String} Diff + * @api private + */ + +function unifiedDiff(err, escape) { + var indent = ' '; + function cleanUp(line) { + if (escape) { + line = escapeInvisibles(line); + } + if (line[0] === '+') return indent + colorLines('diff added', line); + if (line[0] === '-') return indent + colorLines('diff removed', line); + if (line.match(/\@\@/)) return null; + if (line.match(/\\ No newline/)) return null; + else return indent + line; + } + function notBlank(line) { + return line != null; + } + msg = diff.createPatch('string', err.actual, err.expected); + var lines = msg.split('\n').splice(4); + return '\n ' + + colorLines('diff added', '+ expected') + ' ' + + colorLines('diff removed', '- actual') + + '\n\n' + + lines.map(cleanUp).filter(notBlank).join('\n'); +} + +/** + * Return a character diff for `err`. + * + * @param {Error} err + * @return {String} + * @api private + */ + +function errorDiff(err, type, escape) { + var actual = escape ? escapeInvisibles(err.actual) : err.actual; + var expected = escape ? escapeInvisibles(err.expected) : err.expected; + return diff['diff' + type](actual, expected).map(function(str){ + if (str.added) return colorLines('diff added', str.value); + if (str.removed) return colorLines('diff removed', str.value); + return str.value; + }).join(''); +} + +/** + * Returns a string with all invisible characters in plain text + * + * @param {String} line + * @return {String} + * @api private + */ +function escapeInvisibles(line) { + return line.replace(/\t/g, '') + .replace(/\r/g, '') + .replace(/\n/g, '\n'); +} + +/** + * Color lines for `str`, using the color `name`. + * + * @param {String} name + * @param {String} str + * @return {String} + * @api private + */ + +function colorLines(name, str) { + return str.split('\n').map(function(str){ + return color(name, str); + }).join('\n'); +} + +/** + * Check that a / b have the same type. + * + * @param {Object} a + * @param {Object} b + * @return {Boolean} + * @api private + */ + +function sameType(a, b) { + a = Object.prototype.toString.call(a); + b = Object.prototype.toString.call(b); + return a == b; +} + +}); // module: reporters/base.js + +require.register("reporters/doc.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Base = require('./base') + , utils = require('../utils'); + +/** + * Expose `Doc`. + */ + +exports = module.exports = Doc; + +/** + * Initialize a new `Doc` reporter. + * + * @param {Runner} runner + * @api public + */ + +function Doc(runner) { + Base.call(this, runner); + + var self = this + , stats = this.stats + , total = runner.total + , indents = 2; + + function indent() { + return Array(indents).join(' '); + } + + runner.on('suite', function(suite){ + if (suite.root) return; + ++indents; + console.log('%s
', indent()); + ++indents; + console.log('%s

%s

', indent(), utils.escape(suite.title)); + console.log('%s
', indent()); + }); + + runner.on('suite end', function(suite){ + if (suite.root) return; + console.log('%s
', indent()); + --indents; + console.log('%s
', indent()); + --indents; + }); + + runner.on('pass', function(test){ + console.log('%s
%s
', indent(), utils.escape(test.title)); + var code = utils.escape(utils.clean(test.fn.toString())); + console.log('%s
%s
', indent(), code); + }); + + runner.on('fail', function(test, err){ + console.log('%s
%s
', indent(), utils.escape(test.title)); + var code = utils.escape(utils.clean(test.fn.toString())); + console.log('%s
%s
', indent(), code); + console.log('%s
%s
', indent(), utils.escape(err)); + }); +} + +}); // module: reporters/doc.js + +require.register("reporters/dot.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Base = require('./base') + , color = Base.color; + +/** + * Expose `Dot`. + */ + +exports = module.exports = Dot; + +/** + * Initialize a new `Dot` matrix test reporter. + * + * @param {Runner} runner + * @api public + */ + +function Dot(runner) { + Base.call(this, runner); + + var self = this + , stats = this.stats + , width = Base.window.width * .75 | 0 + , n = -1; + + runner.on('start', function(){ + process.stdout.write('\n '); + }); + + runner.on('pending', function(test){ + if (++n % width == 0) process.stdout.write('\n '); + process.stdout.write(color('pending', Base.symbols.dot)); + }); + + runner.on('pass', function(test){ + if (++n % width == 0) process.stdout.write('\n '); + if ('slow' == test.speed) { + process.stdout.write(color('bright yellow', Base.symbols.dot)); + } else { + process.stdout.write(color(test.speed, Base.symbols.dot)); + } + }); + + runner.on('fail', function(test, err){ + if (++n % width == 0) process.stdout.write('\n '); + process.stdout.write(color('fail', Base.symbols.dot)); + }); + + runner.on('end', function(){ + console.log(); + self.epilogue(); + }); +} + +/** + * Inherit from `Base.prototype`. + */ + +function F(){}; +F.prototype = Base.prototype; +Dot.prototype = new F; +Dot.prototype.constructor = Dot; + + +}); // module: reporters/dot.js + +require.register("reporters/html-cov.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var JSONCov = require('./json-cov') + , fs = require('browser/fs'); + +/** + * Expose `HTMLCov`. + */ + +exports = module.exports = HTMLCov; + +/** + * Initialize a new `JsCoverage` reporter. + * + * @param {Runner} runner + * @api public + */ + +function HTMLCov(runner) { + var jade = require('jade') + , file = __dirname + '/templates/coverage.jade' + , str = fs.readFileSync(file, 'utf8') + , fn = jade.compile(str, { filename: file }) + , self = this; + + JSONCov.call(this, runner, false); + + runner.on('end', function(){ + process.stdout.write(fn({ + cov: self.cov + , coverageClass: coverageClass + })); + }); +} + +/** + * Return coverage class for `n`. + * + * @return {String} + * @api private + */ + +function coverageClass(n) { + if (n >= 75) return 'high'; + if (n >= 50) return 'medium'; + if (n >= 25) return 'low'; + return 'terrible'; +} +}); // module: reporters/html-cov.js + +require.register("reporters/html.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Base = require('./base') + , utils = require('../utils') + , Progress = require('../browser/progress') + , escape = utils.escape; + +/** + * Save timer references to avoid Sinon interfering (see GH-237). + */ + +var Date = global.Date + , setTimeout = global.setTimeout + , setInterval = global.setInterval + , clearTimeout = global.clearTimeout + , clearInterval = global.clearInterval; + +/** + * Expose `HTML`. + */ + +exports = module.exports = HTML; + +/** + * Stats template. + */ + +var statsTemplate = ''; + +/** + * Initialize a new `HTML` reporter. + * + * @param {Runner} runner + * @api public + */ + +function HTML(runner) { + Base.call(this, runner); + + var self = this + , stats = this.stats + , total = runner.total + , stat = fragment(statsTemplate) + , items = stat.getElementsByTagName('li') + , passes = items[1].getElementsByTagName('em')[0] + , passesLink = items[1].getElementsByTagName('a')[0] + , failures = items[2].getElementsByTagName('em')[0] + , failuresLink = items[2].getElementsByTagName('a')[0] + , duration = items[3].getElementsByTagName('em')[0] + , canvas = stat.getElementsByTagName('canvas')[0] + , report = fragment('
    ') + , stack = [report] + , progress + , ctx + , root = document.getElementById('mocha'); + + if (canvas.getContext) { + var ratio = window.devicePixelRatio || 1; + canvas.style.width = canvas.width; + canvas.style.height = canvas.height; + canvas.width *= ratio; + canvas.height *= ratio; + ctx = canvas.getContext('2d'); + ctx.scale(ratio, ratio); + progress = new Progress; + } + + if (!root) return error('#mocha div missing, add it to your document'); + + // pass toggle + on(passesLink, 'click', function(){ + unhide(); + var name = /pass/.test(report.className) ? '' : ' pass'; + report.className = report.className.replace(/fail|pass/g, '') + name; + if (report.className.trim()) hideSuitesWithout('test pass'); + }); + + // failure toggle + on(failuresLink, 'click', function(){ + unhide(); + var name = /fail/.test(report.className) ? '' : ' fail'; + report.className = report.className.replace(/fail|pass/g, '') + name; + if (report.className.trim()) hideSuitesWithout('test fail'); + }); + + root.appendChild(stat); + root.appendChild(report); + + if (progress) progress.size(40); + + runner.on('suite', function(suite){ + if (suite.root) return; + + // suite + var url = self.suiteURL(suite); + var el = fragment('
  • %s

  • ', url, escape(suite.title)); + + // container + stack[0].appendChild(el); + stack.unshift(document.createElement('ul')); + el.appendChild(stack[0]); + }); + + runner.on('suite end', function(suite){ + if (suite.root) return; + stack.shift(); + }); + + runner.on('fail', function(test, err){ + if ('hook' == test.type) runner.emit('test end', test); + }); + + runner.on('test end', function(test){ + // TODO: add to stats + var percent = stats.tests / this.total * 100 | 0; + if (progress) progress.update(percent).draw(ctx); + + // update stats + var ms = new Date - stats.start; + text(passes, stats.passes); + text(failures, stats.failures); + text(duration, (ms / 1000).toFixed(2)); + + // test + if ('passed' == test.state) { + var url = self.testURL(test); + var el = fragment('
  • %e%ems

  • ', test.speed, test.title, test.duration, url); + } else if (test.pending) { + var el = fragment('
  • %e

  • ', test.title); + } else { + var el = fragment('
  • %e

  • ', test.title, encodeURIComponent(test.fullTitle())); + var str = test.err.stack || test.err.toString(); + + // FF / Opera do not add the message + if (!~str.indexOf(test.err.message)) { + str = test.err.message + '\n' + str; + } + + // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we + // check for the result of the stringifying. + if ('[object Error]' == str) str = test.err.message; + + // Safari doesn't give you a stack. Let's at least provide a source line. + if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) { + str += "\n(" + test.err.sourceURL + ":" + test.err.line + ")"; + } + + el.appendChild(fragment('
    %e
    ', str)); + } + + // toggle code + // TODO: defer + if (!test.pending) { + var h2 = el.getElementsByTagName('h2')[0]; + + on(h2, 'click', function(){ + pre.style.display = 'none' == pre.style.display + ? 'block' + : 'none'; + }); + + var pre = fragment('
    %e
    ', utils.clean(test.fn.toString())); + el.appendChild(pre); + pre.style.display = 'none'; + } + + // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack. + if (stack[0]) stack[0].appendChild(el); + }); +} + +/** + * Provide suite URL + * + * @param {Object} [suite] + */ + +HTML.prototype.suiteURL = function(suite){ + return '?grep=' + encodeURIComponent(suite.fullTitle()); +}; + +/** + * Provide test URL + * + * @param {Object} [test] + */ + +HTML.prototype.testURL = function(test){ + return '?grep=' + encodeURIComponent(test.fullTitle()); +}; + +/** + * Display error `msg`. + */ + +function error(msg) { + document.body.appendChild(fragment('
    %s
    ', msg)); +} + +/** + * Return a DOM fragment from `html`. + */ + +function fragment(html) { + var args = arguments + , div = document.createElement('div') + , i = 1; + + div.innerHTML = html.replace(/%([se])/g, function(_, type){ + switch (type) { + case 's': return String(args[i++]); + case 'e': return escape(args[i++]); + } + }); + + return div.firstChild; +} + +/** + * Check for suites that do not have elements + * with `classname`, and hide them. + */ + +function hideSuitesWithout(classname) { + var suites = document.getElementsByClassName('suite'); + for (var i = 0; i < suites.length; i++) { + var els = suites[i].getElementsByClassName(classname); + if (0 == els.length) suites[i].className += ' hidden'; + } +} + +/** + * Unhide .hidden suites. + */ + +function unhide() { + var els = document.getElementsByClassName('suite hidden'); + for (var i = 0; i < els.length; ++i) { + els[i].className = els[i].className.replace('suite hidden', 'suite'); + } +} + +/** + * Set `el` text to `str`. + */ + +function text(el, str) { + if (el.textContent) { + el.textContent = str; + } else { + el.innerText = str; + } +} + +/** + * Listen on `event` with callback `fn`. + */ + +function on(el, event, fn) { + if (el.addEventListener) { + el.addEventListener(event, fn, false); + } else { + el.attachEvent('on' + event, fn); + } +} + +}); // module: reporters/html.js + +require.register("reporters/index.js", function(module, exports, require){ + +exports.Base = require('./base'); +exports.Dot = require('./dot'); +exports.Doc = require('./doc'); +exports.TAP = require('./tap'); +exports.JSON = require('./json'); +exports.HTML = require('./html'); +exports.List = require('./list'); +exports.Min = require('./min'); +exports.Spec = require('./spec'); +exports.Nyan = require('./nyan'); +exports.XUnit = require('./xunit'); +exports.Markdown = require('./markdown'); +exports.Progress = require('./progress'); +exports.Landing = require('./landing'); +exports.JSONCov = require('./json-cov'); +exports.HTMLCov = require('./html-cov'); +exports.JSONStream = require('./json-stream'); + +}); // module: reporters/index.js + +require.register("reporters/json-cov.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Base = require('./base'); + +/** + * Expose `JSONCov`. + */ + +exports = module.exports = JSONCov; + +/** + * Initialize a new `JsCoverage` reporter. + * + * @param {Runner} runner + * @param {Boolean} output + * @api public + */ + +function JSONCov(runner, output) { + var self = this + , output = 1 == arguments.length ? true : output; + + Base.call(this, runner); + + var tests = [] + , failures = [] + , passes = []; + + runner.on('test end', function(test){ + tests.push(test); + }); + + runner.on('pass', function(test){ + passes.push(test); + }); + + runner.on('fail', function(test){ + failures.push(test); + }); + + runner.on('end', function(){ + var cov = global._$jscoverage || {}; + var result = self.cov = map(cov); + result.stats = self.stats; + result.tests = tests.map(clean); + result.failures = failures.map(clean); + result.passes = passes.map(clean); + if (!output) return; + process.stdout.write(JSON.stringify(result, null, 2 )); + }); +} + +/** + * Map jscoverage data to a JSON structure + * suitable for reporting. + * + * @param {Object} cov + * @return {Object} + * @api private + */ + +function map(cov) { + var ret = { + instrumentation: 'node-jscoverage' + , sloc: 0 + , hits: 0 + , misses: 0 + , coverage: 0 + , files: [] + }; + + for (var filename in cov) { + var data = coverage(filename, cov[filename]); + ret.files.push(data); + ret.hits += data.hits; + ret.misses += data.misses; + ret.sloc += data.sloc; + } + + ret.files.sort(function(a, b) { + return a.filename.localeCompare(b.filename); + }); + + if (ret.sloc > 0) { + ret.coverage = (ret.hits / ret.sloc) * 100; + } + + return ret; +} + +/** + * Map jscoverage data for a single source file + * to a JSON structure suitable for reporting. + * + * @param {String} filename name of the source file + * @param {Object} data jscoverage coverage data + * @return {Object} + * @api private + */ + +function coverage(filename, data) { + var ret = { + filename: filename, + coverage: 0, + hits: 0, + misses: 0, + sloc: 0, + source: {} + }; + + data.source.forEach(function(line, num){ + num++; + + if (data[num] === 0) { + ret.misses++; + ret.sloc++; + } else if (data[num] !== undefined) { + ret.hits++; + ret.sloc++; + } + + ret.source[num] = { + source: line + , coverage: data[num] === undefined + ? '' + : data[num] + }; + }); + + ret.coverage = ret.hits / ret.sloc * 100; + + return ret; +} + +/** + * Return a plain-object representation of `test` + * free of cyclic properties etc. + * + * @param {Object} test + * @return {Object} + * @api private + */ + +function clean(test) { + return { + title: test.title + , fullTitle: test.fullTitle() + , duration: test.duration + } +} + +}); // module: reporters/json-cov.js + +require.register("reporters/json-stream.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Base = require('./base') + , color = Base.color; + +/** + * Expose `List`. + */ + +exports = module.exports = List; + +/** + * Initialize a new `List` test reporter. + * + * @param {Runner} runner + * @api public + */ + +function List(runner) { + Base.call(this, runner); + + var self = this + , stats = this.stats + , total = runner.total; + + runner.on('start', function(){ + console.log(JSON.stringify(['start', { total: total }])); + }); + + runner.on('pass', function(test){ + console.log(JSON.stringify(['pass', clean(test)])); + }); + + runner.on('fail', function(test, err){ + console.log(JSON.stringify(['fail', clean(test)])); + }); + + runner.on('end', function(){ + process.stdout.write(JSON.stringify(['end', self.stats])); + }); +} + +/** + * Return a plain-object representation of `test` + * free of cyclic properties etc. + * + * @param {Object} test + * @return {Object} + * @api private + */ + +function clean(test) { + return { + title: test.title + , fullTitle: test.fullTitle() + , duration: test.duration + } +} +}); // module: reporters/json-stream.js + +require.register("reporters/json.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Base = require('./base') + , cursor = Base.cursor + , color = Base.color; + +/** + * Expose `JSON`. + */ + +exports = module.exports = JSONReporter; + +/** + * Initialize a new `JSON` reporter. + * + * @param {Runner} runner + * @api public + */ + +function JSONReporter(runner) { + var self = this; + Base.call(this, runner); + + var tests = [] + , pending = [] + , failures = [] + , passes = []; + + runner.on('test end', function(test){ + tests.push(test); + }); + + runner.on('pass', function(test){ + passes.push(test); + }); + + runner.on('fail', function(test){ + failures.push(test); + }); + + runner.on('pending', function(test){ + pending.push(test); + }); + + runner.on('end', function(){ + var obj = { + stats: self.stats, + tests: tests.map(clean), + pending: pending.map(clean), + failures: failures.map(clean), + passes: passes.map(clean) + }; + + runner.testResults = obj; + + process.stdout.write(JSON.stringify(obj, null, 2)); + }); +} + +/** + * Return a plain-object representation of `test` + * free of cyclic properties etc. + * + * @param {Object} test + * @return {Object} + * @api private + */ + +function clean(test) { + return { + title: test.title, + fullTitle: test.fullTitle(), + duration: test.duration, + err: errorJSON(test.err || {}) + } +} + +/** + * Transform `error` into a JSON object. + * @param {Error} err + * @return {Object} + */ + +function errorJSON(err) { + var res = {}; + Object.getOwnPropertyNames(err).forEach(function(key) { + res[key] = err[key]; + }, err); + return res; +} + +}); // module: reporters/json.js + +require.register("reporters/landing.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Base = require('./base') + , cursor = Base.cursor + , color = Base.color; + +/** + * Expose `Landing`. + */ + +exports = module.exports = Landing; + +/** + * Airplane color. + */ + +Base.colors.plane = 0; + +/** + * Airplane crash color. + */ + +Base.colors['plane crash'] = 31; + +/** + * Runway color. + */ + +Base.colors.runway = 90; + +/** + * Initialize a new `Landing` reporter. + * + * @param {Runner} runner + * @api public + */ + +function Landing(runner) { + Base.call(this, runner); + + var self = this + , stats = this.stats + , width = Base.window.width * .75 | 0 + , total = runner.total + , stream = process.stdout + , plane = color('plane', '✈') + , crashed = -1 + , n = 0; + + function runway() { + var buf = Array(width).join('-'); + return ' ' + color('runway', buf); + } + + runner.on('start', function(){ + stream.write('\n '); + cursor.hide(); + }); + + runner.on('test end', function(test){ + // check if the plane crashed + var col = -1 == crashed + ? width * ++n / total | 0 + : crashed; + + // show the crash + if ('failed' == test.state) { + plane = color('plane crash', '✈'); + crashed = col; + } + + // render landing strip + stream.write('\u001b[4F\n\n'); + stream.write(runway()); + stream.write('\n '); + stream.write(color('runway', Array(col).join('⋅'))); + stream.write(plane) + stream.write(color('runway', Array(width - col).join('⋅') + '\n')); + stream.write(runway()); + stream.write('\u001b[0m'); + }); + + runner.on('end', function(){ + cursor.show(); + console.log(); + self.epilogue(); + }); +} + +/** + * Inherit from `Base.prototype`. + */ + +function F(){}; +F.prototype = Base.prototype; +Landing.prototype = new F; +Landing.prototype.constructor = Landing; + +}); // module: reporters/landing.js + +require.register("reporters/list.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Base = require('./base') + , cursor = Base.cursor + , color = Base.color; + +/** + * Expose `List`. + */ + +exports = module.exports = List; + +/** + * Initialize a new `List` test reporter. + * + * @param {Runner} runner + * @api public + */ + +function List(runner) { + Base.call(this, runner); + + var self = this + , stats = this.stats + , n = 0; + + runner.on('start', function(){ + console.log(); + }); + + runner.on('test', function(test){ + process.stdout.write(color('pass', ' ' + test.fullTitle() + ': ')); + }); + + runner.on('pending', function(test){ + var fmt = color('checkmark', ' -') + + color('pending', ' %s'); + console.log(fmt, test.fullTitle()); + }); + + runner.on('pass', function(test){ + var fmt = color('checkmark', ' '+Base.symbols.dot) + + color('pass', ' %s: ') + + color(test.speed, '%dms'); + cursor.CR(); + console.log(fmt, test.fullTitle(), test.duration); + }); + + runner.on('fail', function(test, err){ + cursor.CR(); + console.log(color('fail', ' %d) %s'), ++n, test.fullTitle()); + }); + + runner.on('end', self.epilogue.bind(self)); +} + +/** + * Inherit from `Base.prototype`. + */ + +function F(){}; +F.prototype = Base.prototype; +List.prototype = new F; +List.prototype.constructor = List; + + +}); // module: reporters/list.js + +require.register("reporters/markdown.js", function(module, exports, require){ +/** + * Module dependencies. + */ + +var Base = require('./base') + , utils = require('../utils'); + +/** + * Expose `Markdown`. + */ + +exports = module.exports = Markdown; + +/** + * Initialize a new `Markdown` reporter. + * + * @param {Runner} runner + * @api public + */ + +function Markdown(runner) { + Base.call(this, runner); + + var self = this + , stats = this.stats + , level = 0 + , buf = ''; + + function title(str) { + return Array(level).join('#') + ' ' + str; + } + + function indent() { + return Array(level).join(' '); + } + + function mapTOC(suite, obj) { + var ret = obj; + obj = obj[suite.title] = obj[suite.title] || { suite: suite }; + suite.suites.forEach(function(suite){ + mapTOC(suite, obj); + }); + return ret; + } + + function stringifyTOC(obj, level) { + ++level; + var buf = ''; + var link; + for (var key in obj) { + if ('suite' == key) continue; + if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n'; + if (key) buf += Array(level).join(' ') + link; + buf += stringifyTOC(obj[key], level); + } + --level; + return buf; + } + + function generateTOC(suite) { + var obj = mapTOC(suite, {}); + return stringifyTOC(obj, 0); + } + + generateTOC(runner.suite); + + runner.on('suite', function(suite){ + ++level; + var slug = utils.slug(suite.fullTitle()); + buf += '' + '\n'; + buf += title(suite.title) + '\n'; + }); + + runner.on('suite end', function(suite){ + --level; + }); + + runner.on('pass', function(test){ + var code = utils.clean(test.fn.toString()); + buf += test.title + '.\n'; + buf += '\n```js\n'; + buf += code + '\n'; + buf += '```\n\n'; + }); + + runner.on('end', function(){ + process.stdout.write('# TOC\n'); + process.stdout.write(generateTOC(runner.suite)); + process.stdout.write(buf); + }); +} +}); // module: reporters/markdown.js + +require.register("reporters/min.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Base = require('./base'); + +/** + * Expose `Min`. + */ + +exports = module.exports = Min; + +/** + * Initialize a new `Min` minimal test reporter (best used with --watch). + * + * @param {Runner} runner + * @api public + */ + +function Min(runner) { + Base.call(this, runner); + + runner.on('start', function(){ + // clear screen + process.stdout.write('\u001b[2J'); + // set cursor position + process.stdout.write('\u001b[1;3H'); + }); + + runner.on('end', this.epilogue.bind(this)); +} + +/** + * Inherit from `Base.prototype`. + */ + +function F(){}; +F.prototype = Base.prototype; +Min.prototype = new F; +Min.prototype.constructor = Min; + + +}); // module: reporters/min.js + +require.register("reporters/nyan.js", function(module, exports, require){ +/** + * Module dependencies. + */ + +var Base = require('./base') + , color = Base.color; + +/** + * Expose `Dot`. + */ + +exports = module.exports = NyanCat; + +/** + * Initialize a new `Dot` matrix test reporter. + * + * @param {Runner} runner + * @api public + */ + +function NyanCat(runner) { + Base.call(this, runner); + var self = this + , stats = this.stats + , width = Base.window.width * .75 | 0 + , rainbowColors = this.rainbowColors = self.generateColors() + , colorIndex = this.colorIndex = 0 + , numerOfLines = this.numberOfLines = 4 + , trajectories = this.trajectories = [[], [], [], []] + , nyanCatWidth = this.nyanCatWidth = 11 + , trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth) + , scoreboardWidth = this.scoreboardWidth = 5 + , tick = this.tick = 0 + , n = 0; + + runner.on('start', function(){ + Base.cursor.hide(); + self.draw(); + }); + + runner.on('pending', function(test){ + self.draw(); + }); + + runner.on('pass', function(test){ + self.draw(); + }); + + runner.on('fail', function(test, err){ + self.draw(); + }); + + runner.on('end', function(){ + Base.cursor.show(); + for (var i = 0; i < self.numberOfLines; i++) write('\n'); + self.epilogue(); + }); +} + +/** + * Draw the nyan cat + * + * @api private + */ + +NyanCat.prototype.draw = function(){ + this.appendRainbow(); + this.drawScoreboard(); + this.drawRainbow(); + this.drawNyanCat(); + this.tick = !this.tick; +}; + +/** + * Draw the "scoreboard" showing the number + * of passes, failures and pending tests. + * + * @api private + */ + +NyanCat.prototype.drawScoreboard = function(){ + var stats = this.stats; + var colors = Base.colors; + + function draw(color, n) { + write(' '); + write('\u001b[' + color + 'm' + n + '\u001b[0m'); + write('\n'); + } + + draw(colors.green, stats.passes); + draw(colors.fail, stats.failures); + draw(colors.pending, stats.pending); + write('\n'); + + this.cursorUp(this.numberOfLines); +}; + +/** + * Append the rainbow. + * + * @api private + */ + +NyanCat.prototype.appendRainbow = function(){ + var segment = this.tick ? '_' : '-'; + var rainbowified = this.rainbowify(segment); + + for (var index = 0; index < this.numberOfLines; index++) { + var trajectory = this.trajectories[index]; + if (trajectory.length >= this.trajectoryWidthMax) trajectory.shift(); + trajectory.push(rainbowified); + } +}; + +/** + * Draw the rainbow. + * + * @api private + */ + +NyanCat.prototype.drawRainbow = function(){ + var self = this; + + this.trajectories.forEach(function(line, index) { + write('\u001b[' + self.scoreboardWidth + 'C'); + write(line.join('')); + write('\n'); + }); + + this.cursorUp(this.numberOfLines); +}; + +/** + * Draw the nyan cat + * + * @api private + */ + +NyanCat.prototype.drawNyanCat = function() { + var self = this; + var startWidth = this.scoreboardWidth + this.trajectories[0].length; + var color = '\u001b[' + startWidth + 'C'; + var padding = ''; + + write(color); + write('_,------,'); + write('\n'); + + write(color); + padding = self.tick ? ' ' : ' '; + write('_|' + padding + '/\\_/\\ '); + write('\n'); + + write(color); + padding = self.tick ? '_' : '__'; + var tail = self.tick ? '~' : '^'; + var face; + write(tail + '|' + padding + this.face() + ' '); + write('\n'); + + write(color); + padding = self.tick ? ' ' : ' '; + write(padding + '"" "" '); + write('\n'); + + this.cursorUp(this.numberOfLines); +}; + +/** + * Draw nyan cat face. + * + * @return {String} + * @api private + */ + +NyanCat.prototype.face = function() { + var stats = this.stats; + if (stats.failures) { + return '( x .x)'; + } else if (stats.pending) { + return '( o .o)'; + } else if(stats.passes) { + return '( ^ .^)'; + } else { + return '( - .-)'; + } +}; + +/** + * Move cursor up `n`. + * + * @param {Number} n + * @api private + */ + +NyanCat.prototype.cursorUp = function(n) { + write('\u001b[' + n + 'A'); +}; + +/** + * Move cursor down `n`. + * + * @param {Number} n + * @api private + */ + +NyanCat.prototype.cursorDown = function(n) { + write('\u001b[' + n + 'B'); +}; + +/** + * Generate rainbow colors. + * + * @return {Array} + * @api private + */ + +NyanCat.prototype.generateColors = function(){ + var colors = []; + + for (var i = 0; i < (6 * 7); i++) { + var pi3 = Math.floor(Math.PI / 3); + var n = (i * (1.0 / 6)); + var r = Math.floor(3 * Math.sin(n) + 3); + var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3); + var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3); + colors.push(36 * r + 6 * g + b + 16); + } + + return colors; +}; + +/** + * Apply rainbow to the given `str`. + * + * @param {String} str + * @return {String} + * @api private + */ + +NyanCat.prototype.rainbowify = function(str){ + var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length]; + this.colorIndex += 1; + return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m'; +}; + +/** + * Stdout helper. + */ + +function write(string) { + process.stdout.write(string); +} + +/** + * Inherit from `Base.prototype`. + */ + +function F(){}; +F.prototype = Base.prototype; +NyanCat.prototype = new F; +NyanCat.prototype.constructor = NyanCat; + + +}); // module: reporters/nyan.js + +require.register("reporters/progress.js", function(module, exports, require){ +/** + * Module dependencies. + */ + +var Base = require('./base') + , cursor = Base.cursor + , color = Base.color; + +/** + * Expose `Progress`. + */ + +exports = module.exports = Progress; + +/** + * General progress bar color. + */ + +Base.colors.progress = 90; + +/** + * Initialize a new `Progress` bar test reporter. + * + * @param {Runner} runner + * @param {Object} options + * @api public + */ + +function Progress(runner, options) { + Base.call(this, runner); + + var self = this + , options = options || {} + , stats = this.stats + , width = Base.window.width * .50 | 0 + , total = runner.total + , complete = 0 + , max = Math.max + , lastN = -1; + + // default chars + options.open = options.open || '['; + options.complete = options.complete || '▬'; + options.incomplete = options.incomplete || Base.symbols.dot; + options.close = options.close || ']'; + options.verbose = false; + + // tests started + runner.on('start', function(){ + console.log(); + cursor.hide(); + }); + + // tests complete + runner.on('test end', function(){ + complete++; + var incomplete = total - complete + , percent = complete / total + , n = width * percent | 0 + , i = width - n; + + if (lastN === n && !options.verbose) { + // Don't re-render the line if it hasn't changed + return; + } + lastN = n; + + cursor.CR(); + process.stdout.write('\u001b[J'); + process.stdout.write(color('progress', ' ' + options.open)); + process.stdout.write(Array(n).join(options.complete)); + process.stdout.write(Array(i).join(options.incomplete)); + process.stdout.write(color('progress', options.close)); + if (options.verbose) { + process.stdout.write(color('progress', ' ' + complete + ' of ' + total)); + } + }); + + // tests are complete, output some stats + // and the failures if any + runner.on('end', function(){ + cursor.show(); + console.log(); + self.epilogue(); + }); +} + +/** + * Inherit from `Base.prototype`. + */ + +function F(){}; +F.prototype = Base.prototype; +Progress.prototype = new F; +Progress.prototype.constructor = Progress; + + +}); // module: reporters/progress.js + +require.register("reporters/spec.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Base = require('./base') + , cursor = Base.cursor + , color = Base.color; + +/** + * Expose `Spec`. + */ + +exports = module.exports = Spec; + +/** + * Initialize a new `Spec` test reporter. + * + * @param {Runner} runner + * @api public + */ + +function Spec(runner) { + Base.call(this, runner); + + var self = this + , stats = this.stats + , indents = 0 + , n = 0; + + function indent() { + return Array(indents).join(' ') + } + + runner.on('start', function(){ + console.log(); + }); + + runner.on('suite', function(suite){ + ++indents; + console.log(color('suite', '%s%s'), indent(), suite.title); + }); + + runner.on('suite end', function(suite){ + --indents; + if (1 == indents) console.log(); + }); + + runner.on('pending', function(test){ + var fmt = indent() + color('pending', ' - %s'); + console.log(fmt, test.title); + }); + + runner.on('pass', function(test){ + if ('fast' == test.speed) { + var fmt = indent() + + color('checkmark', ' ' + Base.symbols.ok) + + color('pass', ' %s '); + cursor.CR(); + console.log(fmt, test.title); + } else { + var fmt = indent() + + color('checkmark', ' ' + Base.symbols.ok) + + color('pass', ' %s ') + + color(test.speed, '(%dms)'); + cursor.CR(); + console.log(fmt, test.title, test.duration); + } + }); + + runner.on('fail', function(test, err){ + cursor.CR(); + console.log(indent() + color('fail', ' %d) %s'), ++n, test.title); + }); + + runner.on('end', self.epilogue.bind(self)); +} + +/** + * Inherit from `Base.prototype`. + */ + +function F(){}; +F.prototype = Base.prototype; +Spec.prototype = new F; +Spec.prototype.constructor = Spec; + + +}); // module: reporters/spec.js + +require.register("reporters/tap.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Base = require('./base') + , cursor = Base.cursor + , color = Base.color; + +/** + * Expose `TAP`. + */ + +exports = module.exports = TAP; + +/** + * Initialize a new `TAP` reporter. + * + * @param {Runner} runner + * @api public + */ + +function TAP(runner) { + Base.call(this, runner); + + var self = this + , stats = this.stats + , n = 1 + , passes = 0 + , failures = 0; + + runner.on('start', function(){ + var total = runner.grepTotal(runner.suite); + console.log('%d..%d', 1, total); + }); + + runner.on('test end', function(){ + ++n; + }); + + runner.on('pending', function(test){ + console.log('ok %d %s # SKIP -', n, title(test)); + }); + + runner.on('pass', function(test){ + passes++; + console.log('ok %d %s', n, title(test)); + }); + + runner.on('fail', function(test, err){ + failures++; + console.log('not ok %d %s', n, title(test)); + if (err.stack) console.log(err.stack.replace(/^/gm, ' ')); + }); + + runner.on('end', function(){ + console.log('# tests ' + (passes + failures)); + console.log('# pass ' + passes); + console.log('# fail ' + failures); + }); +} + +/** + * Return a TAP-safe title of `test` + * + * @param {Object} test + * @return {String} + * @api private + */ + +function title(test) { + return test.fullTitle().replace(/#/g, ''); +} + +}); // module: reporters/tap.js + +require.register("reporters/xunit.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Base = require('./base') + , utils = require('../utils') + , escape = utils.escape; + +/** + * Save timer references to avoid Sinon interfering (see GH-237). + */ + +var Date = global.Date + , setTimeout = global.setTimeout + , setInterval = global.setInterval + , clearTimeout = global.clearTimeout + , clearInterval = global.clearInterval; + +/** + * Expose `XUnit`. + */ + +exports = module.exports = XUnit; + +/** + * Initialize a new `XUnit` reporter. + * + * @param {Runner} runner + * @api public + */ + +function XUnit(runner) { + Base.call(this, runner); + var stats = this.stats + , tests = [] + , self = this; + + runner.on('pending', function(test){ + tests.push(test); + }); + + runner.on('pass', function(test){ + tests.push(test); + }); + + runner.on('fail', function(test){ + tests.push(test); + }); + + runner.on('end', function(){ + console.log(tag('testsuite', { + name: 'Mocha Tests' + , tests: stats.tests + , failures: stats.failures + , errors: stats.failures + , skipped: stats.tests - stats.failures - stats.passes + , timestamp: (new Date).toUTCString() + , time: (stats.duration / 1000) || 0 + }, false)); + + tests.forEach(test); + console.log(''); + }); +} + +/** + * Inherit from `Base.prototype`. + */ + +function F(){}; +F.prototype = Base.prototype; +XUnit.prototype = new F; +XUnit.prototype.constructor = XUnit; + + +/** + * Output tag for the given `test.` + */ + +function test(test) { + var attrs = { + classname: test.parent.fullTitle() + , name: test.title + , time: (test.duration / 1000) || 0 + }; + + if ('failed' == test.state) { + var err = test.err; + console.log(tag('testcase', attrs, false, tag('failure', {}, false, cdata(escape(err.message) + "\n" + err.stack)))); + } else if (test.pending) { + console.log(tag('testcase', attrs, false, tag('skipped', {}, true))); + } else { + console.log(tag('testcase', attrs, true) ); + } +} + +/** + * HTML tag helper. + */ + +function tag(name, attrs, close, content) { + var end = close ? '/>' : '>' + , pairs = [] + , tag; + + for (var key in attrs) { + pairs.push(key + '="' + escape(attrs[key]) + '"'); + } + + tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end; + if (content) tag += content + ''; +} + +}); // module: reporters/xunit.js + +require.register("runnable.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var EventEmitter = require('browser/events').EventEmitter + , debug = require('browser/debug')('mocha:runnable') + , milliseconds = require('./ms'); + +/** + * Save timer references to avoid Sinon interfering (see GH-237). + */ + +var Date = global.Date + , setTimeout = global.setTimeout + , setInterval = global.setInterval + , clearTimeout = global.clearTimeout + , clearInterval = global.clearInterval; + +/** + * Object#toString(). + */ + +var toString = Object.prototype.toString; + +/** + * Expose `Runnable`. + */ + +module.exports = Runnable; + +/** + * Initialize a new `Runnable` with the given `title` and callback `fn`. + * + * @param {String} title + * @param {Function} fn + * @api private + */ + +function Runnable(title, fn) { + this.title = title; + this.fn = fn; + this.async = fn && fn.length; + this.sync = ! this.async; + this._timeout = 2000; + this._slow = 75; + this._enableTimeouts = true; + this.timedOut = false; +} + +/** + * Inherit from `EventEmitter.prototype`. + */ + +function F(){}; +F.prototype = EventEmitter.prototype; +Runnable.prototype = new F; +Runnable.prototype.constructor = Runnable; + + +/** + * Set & get timeout `ms`. + * + * @param {Number|String} ms + * @return {Runnable|Number} ms or self + * @api private + */ + +Runnable.prototype.timeout = function(ms){ + if (0 == arguments.length) return this._timeout; + if (ms === 0) this._enableTimeouts = false; + if ('string' == typeof ms) ms = milliseconds(ms); + debug('timeout %d', ms); + this._timeout = ms; + if (this.timer) this.resetTimeout(); + return this; +}; + +/** + * Set & get slow `ms`. + * + * @param {Number|String} ms + * @return {Runnable|Number} ms or self + * @api private + */ + +Runnable.prototype.slow = function(ms){ + if (0 === arguments.length) return this._slow; + if ('string' == typeof ms) ms = milliseconds(ms); + debug('timeout %d', ms); + this._slow = ms; + return this; +}; + +/** + * Set and & get timeout `enabled`. + * + * @param {Boolean} enabled + * @return {Runnable|Boolean} enabled or self + * @api private + */ + +Runnable.prototype.enableTimeouts = function(enabled){ + if (arguments.length === 0) return this._enableTimeouts; + debug('enableTimeouts %s', enabled); + this._enableTimeouts = enabled; + return this; +}; + +/** + * Return the full title generated by recursively + * concatenating the parent's full title. + * + * @return {String} + * @api public + */ + +Runnable.prototype.fullTitle = function(){ + return this.parent.fullTitle() + ' ' + this.title; +}; + +/** + * Clear the timeout. + * + * @api private + */ + +Runnable.prototype.clearTimeout = function(){ + clearTimeout(this.timer); +}; + +/** + * Inspect the runnable void of private properties. + * + * @return {String} + * @api private + */ + +Runnable.prototype.inspect = function(){ + return JSON.stringify(this, function(key, val){ + if ('_' == key[0]) return; + if ('parent' == key) return '#'; + if ('ctx' == key) return '#'; + return val; + }, 2); +}; + +/** + * Reset the timeout. + * + * @api private + */ + +Runnable.prototype.resetTimeout = function(){ + var self = this; + var ms = this.timeout() || 1e9; + + if (!this._enableTimeouts) return; + this.clearTimeout(); + this.timer = setTimeout(function(){ + if (!self._enableTimeouts) return; + self.callback(new Error('timeout of ' + ms + 'ms exceeded')); + self.timedOut = true; + }, ms); +}; + +/** + * Whitelist these globals for this test run + * + * @api private + */ +Runnable.prototype.globals = function(arr){ + var self = this; + this._allowedGlobals = arr; +}; + +/** + * Run the test and invoke `fn(err)`. + * + * @param {Function} fn + * @api private + */ + +Runnable.prototype.run = function(fn){ + var self = this + , start = new Date + , ctx = this.ctx + , finished + , emitted; + + // Some times the ctx exists but it is not runnable + if (ctx && ctx.runnable) ctx.runnable(this); + + // called multiple times + function multiple(err) { + if (emitted) return; + emitted = true; + self.emit('error', err || new Error('done() called multiple times')); + } + + // finished + function done(err) { + var ms = self.timeout(); + if (self.timedOut) return; + if (finished) return multiple(err); + self.clearTimeout(); + self.duration = new Date - start; + finished = true; + if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded'); + fn(err); + } + + // for .resetTimeout() + this.callback = done; + + // explicit async with `done` argument + if (this.async) { + this.resetTimeout(); + + try { + this.fn.call(ctx, function(err){ + if (err instanceof Error || toString.call(err) === "[object Error]") return done(err); + if (null != err) { + if (Object.prototype.toString.call(err) === '[object Object]') { + return done(new Error('done() invoked with non-Error: ' + JSON.stringify(err))); + } else { + return done(new Error('done() invoked with non-Error: ' + err)); + } + } + done(); + }); + } catch (err) { + done(err); + } + return; + } + + if (this.asyncOnly) { + return done(new Error('--async-only option in use without declaring `done()`')); + } + + // sync or promise-returning + try { + if (this.pending) { + done(); + } else { + callFn(this.fn); + } + } catch (err) { + done(err); + } + + function callFn(fn) { + var result = fn.call(ctx); + if (result && typeof result.then === 'function') { + self.resetTimeout(); + result + .then(function() { + done() + }, + function(reason) { + done(reason || new Error('Promise rejected with no or falsy reason')) + }); + } else { + done(); + } + } +}; + +}); // module: runnable.js + +require.register("runner.js", function(module, exports, require){ +/** + * Module dependencies. + */ + +var EventEmitter = require('browser/events').EventEmitter + , debug = require('browser/debug')('mocha:runner') + , Test = require('./test') + , utils = require('./utils') + , filter = utils.filter + , keys = utils.keys; + +/** + * Non-enumerable globals. + */ + +var globals = [ + 'setTimeout', + 'clearTimeout', + 'setInterval', + 'clearInterval', + 'XMLHttpRequest', + 'Date' +]; + +/** + * Expose `Runner`. + */ + +module.exports = Runner; + +/** + * Initialize a `Runner` for the given `suite`. + * + * Events: + * + * - `start` execution started + * - `end` execution complete + * - `suite` (suite) test suite execution started + * - `suite end` (suite) all tests (and sub-suites) have finished + * - `test` (test) test execution started + * - `test end` (test) test completed + * - `hook` (hook) hook execution started + * - `hook end` (hook) hook complete + * - `pass` (test) test passed + * - `fail` (test, err) test failed + * - `pending` (test) test pending + * + * @api public + */ + +function Runner(suite) { + var self = this; + this._globals = []; + this._abort = false; + this.suite = suite; + this.total = suite.total(); + this.failures = 0; + this.on('test end', function(test){ self.checkGlobals(test); }); + this.on('hook end', function(hook){ self.checkGlobals(hook); }); + this.grep(/.*/); + this.globals(this.globalProps().concat(extraGlobals())); +} + +/** + * Wrapper for setImmediate, process.nextTick, or browser polyfill. + * + * @param {Function} fn + * @api private + */ + +Runner.immediately = global.setImmediate || process.nextTick; + +/** + * Inherit from `EventEmitter.prototype`. + */ + +function F(){}; +F.prototype = EventEmitter.prototype; +Runner.prototype = new F; +Runner.prototype.constructor = Runner; + + +/** + * Run tests with full titles matching `re`. Updates runner.total + * with number of tests matched. + * + * @param {RegExp} re + * @param {Boolean} invert + * @return {Runner} for chaining + * @api public + */ + +Runner.prototype.grep = function(re, invert){ + debug('grep %s', re); + this._grep = re; + this._invert = invert; + this.total = this.grepTotal(this.suite); + return this; +}; + +/** + * Returns the number of tests matching the grep search for the + * given suite. + * + * @param {Suite} suite + * @return {Number} + * @api public + */ + +Runner.prototype.grepTotal = function(suite) { + var self = this; + var total = 0; + + suite.eachTest(function(test){ + var match = self._grep.test(test.fullTitle()); + if (self._invert) match = !match; + if (match) total++; + }); + + return total; +}; + +/** + * Return a list of global properties. + * + * @return {Array} + * @api private + */ + +Runner.prototype.globalProps = function() { + var props = utils.keys(global); + + // non-enumerables + for (var i = 0; i < globals.length; ++i) { + if (~utils.indexOf(props, globals[i])) continue; + props.push(globals[i]); + } + + return props; +}; + +/** + * Allow the given `arr` of globals. + * + * @param {Array} arr + * @return {Runner} for chaining + * @api public + */ + +Runner.prototype.globals = function(arr){ + if (0 == arguments.length) return this._globals; + debug('globals %j', arr); + this._globals = this._globals.concat(arr); + return this; +}; + +/** + * Check for global variable leaks. + * + * @api private + */ + +Runner.prototype.checkGlobals = function(test){ + if (this.ignoreLeaks) return; + var ok = this._globals; + + var globals = this.globalProps(); + var leaks; + + if (test) { + ok = ok.concat(test._allowedGlobals || []); + } + + if(this.prevGlobalsLength == globals.length) return; + this.prevGlobalsLength = globals.length; + + leaks = filterLeaks(ok, globals); + this._globals = this._globals.concat(leaks); + + if (leaks.length > 1) { + this.fail(test, new Error('global leaks detected: ' + leaks.join(', ') + '')); + } else if (leaks.length) { + this.fail(test, new Error('global leak detected: ' + leaks[0])); + } +}; + +/** + * Fail the given `test`. + * + * @param {Test} test + * @param {Error} err + * @api private + */ + +Runner.prototype.fail = function(test, err){ + ++this.failures; + test.state = 'failed'; + + if ('string' == typeof err) { + err = new Error('the string "' + err + '" was thrown, throw an Error :)'); + } + + this.emit('fail', test, err); +}; + +/** + * Fail the given `hook` with `err`. + * + * Hook failures work in the following pattern: + * - If bail, then exit + * - Failed `before` hook skips all tests in a suite and subsuites, + * but jumps to corresponding `after` hook + * - Failed `before each` hook skips remaining tests in a + * suite and jumps to corresponding `after each` hook, + * which is run only once + * - Failed `after` hook does not alter + * execution order + * - Failed `after each` hook skips remaining tests in a + * suite and subsuites, but executes other `after each` + * hooks + * + * @param {Hook} hook + * @param {Error} err + * @api private + */ + +Runner.prototype.failHook = function(hook, err){ + this.fail(hook, err); + if (this.suite.bail()) { + this.emit('end'); + } +}; + +/** + * Run hook `name` callbacks and then invoke `fn()`. + * + * @param {String} name + * @param {Function} function + * @api private + */ + +Runner.prototype.hook = function(name, fn){ + var suite = this.suite + , hooks = suite['_' + name] + , self = this + , timer; + + function next(i) { + var hook = hooks[i]; + if (!hook) return fn(); + if (self.failures && suite.bail()) return fn(); + self.currentRunnable = hook; + + hook.ctx.currentTest = self.test; + + self.emit('hook', hook); + + hook.on('error', function(err){ + self.failHook(hook, err); + }); + + hook.run(function(err){ + hook.removeAllListeners('error'); + var testError = hook.error(); + if (testError) self.fail(self.test, testError); + if (err) { + self.failHook(hook, err); + + // stop executing hooks, notify callee of hook err + return fn(err); + } + self.emit('hook end', hook); + delete hook.ctx.currentTest; + next(++i); + }); + } + + Runner.immediately(function(){ + next(0); + }); +}; + +/** + * Run hook `name` for the given array of `suites` + * in order, and callback `fn(err, errSuite)`. + * + * @param {String} name + * @param {Array} suites + * @param {Function} fn + * @api private + */ + +Runner.prototype.hooks = function(name, suites, fn){ + var self = this + , orig = this.suite; + + function next(suite) { + self.suite = suite; + + if (!suite) { + self.suite = orig; + return fn(); + } + + self.hook(name, function(err){ + if (err) { + var errSuite = self.suite; + self.suite = orig; + return fn(err, errSuite); + } + + next(suites.pop()); + }); + } + + next(suites.pop()); +}; + +/** + * Run hooks from the top level down. + * + * @param {String} name + * @param {Function} fn + * @api private + */ + +Runner.prototype.hookUp = function(name, fn){ + var suites = [this.suite].concat(this.parents()).reverse(); + this.hooks(name, suites, fn); +}; + +/** + * Run hooks from the bottom up. + * + * @param {String} name + * @param {Function} fn + * @api private + */ + +Runner.prototype.hookDown = function(name, fn){ + var suites = [this.suite].concat(this.parents()); + this.hooks(name, suites, fn); +}; + +/** + * Return an array of parent Suites from + * closest to furthest. + * + * @return {Array} + * @api private + */ + +Runner.prototype.parents = function(){ + var suite = this.suite + , suites = []; + while (suite = suite.parent) suites.push(suite); + return suites; +}; + +/** + * Run the current test and callback `fn(err)`. + * + * @param {Function} fn + * @api private + */ + +Runner.prototype.runTest = function(fn){ + var test = this.test + , self = this; + + if (this.asyncOnly) test.asyncOnly = true; + + try { + test.on('error', function(err){ + self.fail(test, err); + }); + test.run(fn); + } catch (err) { + fn(err); + } +}; + +/** + * Run tests in the given `suite` and invoke + * the callback `fn()` when complete. + * + * @param {Suite} suite + * @param {Function} fn + * @api private + */ + +Runner.prototype.runTests = function(suite, fn){ + var self = this + , tests = suite.tests.slice() + , test; + + + function hookErr(err, errSuite, after) { + // before/after Each hook for errSuite failed: + var orig = self.suite; + + // for failed 'after each' hook start from errSuite parent, + // otherwise start from errSuite itself + self.suite = after ? errSuite.parent : errSuite; + + if (self.suite) { + // call hookUp afterEach + self.hookUp('afterEach', function(err2, errSuite2) { + self.suite = orig; + // some hooks may fail even now + if (err2) return hookErr(err2, errSuite2, true); + // report error suite + fn(errSuite); + }); + } else { + // there is no need calling other 'after each' hooks + self.suite = orig; + fn(errSuite); + } + } + + function next(err, errSuite) { + // if we bail after first err + if (self.failures && suite._bail) return fn(); + + if (self._abort) return fn(); + + if (err) return hookErr(err, errSuite, true); + + // next test + test = tests.shift(); + + // all done + if (!test) return fn(); + + // grep + var match = self._grep.test(test.fullTitle()); + if (self._invert) match = !match; + if (!match) return next(); + + // pending + if (test.pending) { + self.emit('pending', test); + self.emit('test end', test); + return next(); + } + + // execute test and hook(s) + self.emit('test', self.test = test); + self.hookDown('beforeEach', function(err, errSuite){ + + if (err) return hookErr(err, errSuite, false); + + self.currentRunnable = self.test; + self.runTest(function(err){ + test = self.test; + + if (err) { + self.fail(test, err); + self.emit('test end', test); + return self.hookUp('afterEach', next); + } + + test.state = 'passed'; + self.emit('pass', test); + self.emit('test end', test); + self.hookUp('afterEach', next); + }); + }); + } + + this.next = next; + next(); +}; + +/** + * Run the given `suite` and invoke the + * callback `fn()` when complete. + * + * @param {Suite} suite + * @param {Function} fn + * @api private + */ + +Runner.prototype.runSuite = function(suite, fn){ + var total = this.grepTotal(suite) + , self = this + , i = 0; + + debug('run suite %s', suite.fullTitle()); + + if (!total) return fn(); + + this.emit('suite', this.suite = suite); + + function next(errSuite) { + if (errSuite) { + // current suite failed on a hook from errSuite + if (errSuite == suite) { + // if errSuite is current suite + // continue to the next sibling suite + return done(); + } else { + // errSuite is among the parents of current suite + // stop execution of errSuite and all sub-suites + return done(errSuite); + } + } + + if (self._abort) return done(); + + var curr = suite.suites[i++]; + if (!curr) return done(); + self.runSuite(curr, next); + } + + function done(errSuite) { + self.suite = suite; + self.hook('afterAll', function(){ + self.emit('suite end', suite); + fn(errSuite); + }); + } + + this.hook('beforeAll', function(err){ + if (err) return done(); + self.runTests(suite, next); + }); +}; + +/** + * Handle uncaught exceptions. + * + * @param {Error} err + * @api private + */ + +Runner.prototype.uncaught = function(err){ + if (err) { + debug('uncaught exception %s', err !== function () { + return this; + }.call(err) ? err : ( err.message || err )); + } else { + debug('uncaught undefined exception'); + err = new Error('Caught undefined error, did you throw without specifying what?'); + } + err.uncaught = true; + + var runnable = this.currentRunnable; + if (!runnable) return; + + var wasAlreadyDone = runnable.state; + this.fail(runnable, err); + + runnable.clearTimeout(); + + if (wasAlreadyDone) return; + + // recover from test + if ('test' == runnable.type) { + this.emit('test end', runnable); + this.hookUp('afterEach', this.next); + return; + } + + // bail on hooks + this.emit('end'); +}; + +/** + * Run the root suite and invoke `fn(failures)` + * on completion. + * + * @param {Function} fn + * @return {Runner} for chaining + * @api public + */ + +Runner.prototype.run = function(fn){ + var self = this + , fn = fn || function(){}; + + function uncaught(err){ + self.uncaught(err); + } + + debug('start'); + + // callback + this.on('end', function(){ + debug('end'); + process.removeListener('uncaughtException', uncaught); + fn(self.failures); + }); + + // run suites + this.emit('start'); + this.runSuite(this.suite, function(){ + debug('finished running'); + self.emit('end'); + }); + + // uncaught exception + process.on('uncaughtException', uncaught); + + return this; +}; + +/** + * Cleanly abort execution + * + * @return {Runner} for chaining + * @api public + */ +Runner.prototype.abort = function(){ + debug('aborting'); + this._abort = true; +}; + +/** + * Filter leaks with the given globals flagged as `ok`. + * + * @param {Array} ok + * @param {Array} globals + * @return {Array} + * @api private + */ + +function filterLeaks(ok, globals) { + return filter(globals, function(key){ + // Firefox and Chrome exposes iframes as index inside the window object + if (/^d+/.test(key)) return false; + + // in firefox + // if runner runs in an iframe, this iframe's window.getInterface method not init at first + // it is assigned in some seconds + if (global.navigator && /^getInterface/.test(key)) return false; + + // an iframe could be approached by window[iframeIndex] + // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak + if (global.navigator && /^\d+/.test(key)) return false; + + // Opera and IE expose global variables for HTML element IDs (issue #243) + if (/^mocha-/.test(key)) return false; + + var matched = filter(ok, function(ok){ + if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]); + return key == ok; + }); + return matched.length == 0 && (!global.navigator || 'onerror' !== key); + }); +} + +/** + * Array of globals dependent on the environment. + * + * @return {Array} + * @api private + */ + + function extraGlobals() { + if (typeof(process) === 'object' && + typeof(process.version) === 'string') { + + var nodeVersion = process.version.split('.').reduce(function(a, v) { + return a << 8 | v; + }); + + // 'errno' was renamed to process._errno in v0.9.11. + + if (nodeVersion < 0x00090B) { + return ['errno']; + } + } + + return []; + } + +}); // module: runner.js + +require.register("suite.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var EventEmitter = require('browser/events').EventEmitter + , debug = require('browser/debug')('mocha:suite') + , milliseconds = require('./ms') + , utils = require('./utils') + , Hook = require('./hook'); + +/** + * Expose `Suite`. + */ + +exports = module.exports = Suite; + +/** + * Create a new `Suite` with the given `title` + * and parent `Suite`. When a suite with the + * same title is already present, that suite + * is returned to provide nicer reporter + * and more flexible meta-testing. + * + * @param {Suite} parent + * @param {String} title + * @return {Suite} + * @api public + */ + +exports.create = function(parent, title){ + var suite = new Suite(title, parent.ctx); + suite.parent = parent; + if (parent.pending) suite.pending = true; + title = suite.fullTitle(); + parent.addSuite(suite); + return suite; +}; + +/** + * Initialize a new `Suite` with the given + * `title` and `ctx`. + * + * @param {String} title + * @param {Context} ctx + * @api private + */ + +function Suite(title, parentContext) { + this.title = title; + var context = function() {}; + context.prototype = parentContext; + this.ctx = new context(); + this.suites = []; + this.tests = []; + this.pending = false; + this._beforeEach = []; + this._beforeAll = []; + this._afterEach = []; + this._afterAll = []; + this.root = !title; + this._timeout = 2000; + this._enableTimeouts = true; + this._slow = 75; + this._bail = false; +} + +/** + * Inherit from `EventEmitter.prototype`. + */ + +function F(){}; +F.prototype = EventEmitter.prototype; +Suite.prototype = new F; +Suite.prototype.constructor = Suite; + + +/** + * Return a clone of this `Suite`. + * + * @return {Suite} + * @api private + */ + +Suite.prototype.clone = function(){ + var suite = new Suite(this.title); + debug('clone'); + suite.ctx = this.ctx; + suite.timeout(this.timeout()); + suite.enableTimeouts(this.enableTimeouts()); + suite.slow(this.slow()); + suite.bail(this.bail()); + return suite; +}; + +/** + * Set timeout `ms` or short-hand such as "2s". + * + * @param {Number|String} ms + * @return {Suite|Number} for chaining + * @api private + */ + +Suite.prototype.timeout = function(ms){ + if (0 == arguments.length) return this._timeout; + if (ms === 0) this._enableTimeouts = false; + if ('string' == typeof ms) ms = milliseconds(ms); + debug('timeout %d', ms); + this._timeout = parseInt(ms, 10); + return this; +}; + +/** + * Set timeout `enabled`. + * + * @param {Boolean} enabled + * @return {Suite|Boolean} self or enabled + * @api private + */ + +Suite.prototype.enableTimeouts = function(enabled){ + if (arguments.length === 0) return this._enableTimeouts; + debug('enableTimeouts %s', enabled); + this._enableTimeouts = enabled; + return this; +}; + +/** + * Set slow `ms` or short-hand such as "2s". + * + * @param {Number|String} ms + * @return {Suite|Number} for chaining + * @api private + */ + +Suite.prototype.slow = function(ms){ + if (0 === arguments.length) return this._slow; + if ('string' == typeof ms) ms = milliseconds(ms); + debug('slow %d', ms); + this._slow = ms; + return this; +}; + +/** + * Sets whether to bail after first error. + * + * @parma {Boolean} bail + * @return {Suite|Number} for chaining + * @api private + */ + +Suite.prototype.bail = function(bail){ + if (0 == arguments.length) return this._bail; + debug('bail %s', bail); + this._bail = bail; + return this; +}; + +/** + * Run `fn(test[, done])` before running tests. + * + * @param {Function} fn + * @return {Suite} for chaining + * @api private + */ + +Suite.prototype.beforeAll = function(title, fn){ + if (this.pending) return this; + if ('function' === typeof title) { + fn = title; + title = fn.name; + } + title = '"before all" hook' + (title ? ': ' + title : ''); + + var hook = new Hook(title, fn); + hook.parent = this; + hook.timeout(this.timeout()); + hook.enableTimeouts(this.enableTimeouts()); + hook.slow(this.slow()); + hook.ctx = this.ctx; + this._beforeAll.push(hook); + this.emit('beforeAll', hook); + return this; +}; + +/** + * Run `fn(test[, done])` after running tests. + * + * @param {Function} fn + * @return {Suite} for chaining + * @api private + */ + +Suite.prototype.afterAll = function(title, fn){ + if (this.pending) return this; + if ('function' === typeof title) { + fn = title; + title = fn.name; + } + title = '"after all" hook' + (title ? ': ' + title : ''); + + var hook = new Hook(title, fn); + hook.parent = this; + hook.timeout(this.timeout()); + hook.enableTimeouts(this.enableTimeouts()); + hook.slow(this.slow()); + hook.ctx = this.ctx; + this._afterAll.push(hook); + this.emit('afterAll', hook); + return this; +}; + +/** + * Run `fn(test[, done])` before each test case. + * + * @param {Function} fn + * @return {Suite} for chaining + * @api private + */ + +Suite.prototype.beforeEach = function(title, fn){ + if (this.pending) return this; + if ('function' === typeof title) { + fn = title; + title = fn.name; + } + title = '"before each" hook' + (title ? ': ' + title : ''); + + var hook = new Hook(title, fn); + hook.parent = this; + hook.timeout(this.timeout()); + hook.enableTimeouts(this.enableTimeouts()); + hook.slow(this.slow()); + hook.ctx = this.ctx; + this._beforeEach.push(hook); + this.emit('beforeEach', hook); + return this; +}; + +/** + * Run `fn(test[, done])` after each test case. + * + * @param {Function} fn + * @return {Suite} for chaining + * @api private + */ + +Suite.prototype.afterEach = function(title, fn){ + if (this.pending) return this; + if ('function' === typeof title) { + fn = title; + title = fn.name; + } + title = '"after each" hook' + (title ? ': ' + title : ''); + + var hook = new Hook(title, fn); + hook.parent = this; + hook.timeout(this.timeout()); + hook.enableTimeouts(this.enableTimeouts()); + hook.slow(this.slow()); + hook.ctx = this.ctx; + this._afterEach.push(hook); + this.emit('afterEach', hook); + return this; +}; + +/** + * Add a test `suite`. + * + * @param {Suite} suite + * @return {Suite} for chaining + * @api private + */ + +Suite.prototype.addSuite = function(suite){ + suite.parent = this; + suite.timeout(this.timeout()); + suite.enableTimeouts(this.enableTimeouts()); + suite.slow(this.slow()); + suite.bail(this.bail()); + this.suites.push(suite); + this.emit('suite', suite); + return this; +}; + +/** + * Add a `test` to this suite. + * + * @param {Test} test + * @return {Suite} for chaining + * @api private + */ + +Suite.prototype.addTest = function(test){ + test.parent = this; + test.timeout(this.timeout()); + test.enableTimeouts(this.enableTimeouts()); + test.slow(this.slow()); + test.ctx = this.ctx; + this.tests.push(test); + this.emit('test', test); + return this; +}; + +/** + * Return the full title generated by recursively + * concatenating the parent's full title. + * + * @return {String} + * @api public + */ + +Suite.prototype.fullTitle = function(){ + if (this.parent) { + var full = this.parent.fullTitle(); + if (full) return full + ' ' + this.title; + } + return this.title; +}; + +/** + * Return the total number of tests. + * + * @return {Number} + * @api public + */ + +Suite.prototype.total = function(){ + return utils.reduce(this.suites, function(sum, suite){ + return sum + suite.total(); + }, 0) + this.tests.length; +}; + +/** + * Iterates through each suite recursively to find + * all tests. Applies a function in the format + * `fn(test)`. + * + * @param {Function} fn + * @return {Suite} + * @api private + */ + +Suite.prototype.eachTest = function(fn){ + utils.forEach(this.tests, fn); + utils.forEach(this.suites, function(suite){ + suite.eachTest(fn); + }); + return this; +}; + +}); // module: suite.js + +require.register("test.js", function(module, exports, require){ + +/** + * Module dependencies. + */ + +var Runnable = require('./runnable'); + +/** + * Expose `Test`. + */ + +module.exports = Test; + +/** + * Initialize a new `Test` with the given `title` and callback `fn`. + * + * @param {String} title + * @param {Function} fn + * @api private + */ + +function Test(title, fn) { + Runnable.call(this, title, fn); + this.pending = !fn; + this.type = 'test'; +} + +/** + * Inherit from `Runnable.prototype`. + */ + +function F(){}; +F.prototype = Runnable.prototype; +Test.prototype = new F; +Test.prototype.constructor = Test; + + +}); // module: test.js + +require.register("utils.js", function(module, exports, require){ +/** + * Module dependencies. + */ + +var fs = require('browser/fs') + , path = require('browser/path') + , basename = path.basename + , exists = fs.existsSync || path.existsSync + , glob = require('browser/glob') + , join = path.join + , debug = require('browser/debug')('mocha:watch'); + +/** + * Ignored directories. + */ + +var ignore = ['node_modules', '.git']; + +/** + * Escape special characters in the given string of html. + * + * @param {String} html + * @return {String} + * @api private + */ + +exports.escape = function(html){ + return String(html) + .replace(/&/g, '&') + .replace(/"/g, '"') + .replace(//g, '>'); +}; + +/** + * Array#forEach (<=IE8) + * + * @param {Array} array + * @param {Function} fn + * @param {Object} scope + * @api private + */ + +exports.forEach = function(arr, fn, scope){ + for (var i = 0, l = arr.length; i < l; i++) + fn.call(scope, arr[i], i); +}; + +/** + * Array#map (<=IE8) + * + * @param {Array} array + * @param {Function} fn + * @param {Object} scope + * @api private + */ + +exports.map = function(arr, fn, scope){ + var result = []; + for (var i = 0, l = arr.length; i < l; i++) + result.push(fn.call(scope, arr[i], i)); + return result; +}; + +/** + * Array#indexOf (<=IE8) + * + * @parma {Array} arr + * @param {Object} obj to find index of + * @param {Number} start + * @api private + */ + +exports.indexOf = function(arr, obj, start){ + for (var i = start || 0, l = arr.length; i < l; i++) { + if (arr[i] === obj) + return i; + } + return -1; +}; + +/** + * Array#reduce (<=IE8) + * + * @param {Array} array + * @param {Function} fn + * @param {Object} initial value + * @api private + */ + +exports.reduce = function(arr, fn, val){ + var rval = val; + + for (var i = 0, l = arr.length; i < l; i++) { + rval = fn(rval, arr[i], i, arr); + } + + return rval; +}; + +/** + * Array#filter (<=IE8) + * + * @param {Array} array + * @param {Function} fn + * @api private + */ + +exports.filter = function(arr, fn){ + var ret = []; + + for (var i = 0, l = arr.length; i < l; i++) { + var val = arr[i]; + if (fn(val, i, arr)) ret.push(val); + } + + return ret; +}; + +/** + * Object.keys (<=IE8) + * + * @param {Object} obj + * @return {Array} keys + * @api private + */ + +exports.keys = Object.keys || function(obj) { + var keys = [] + , has = Object.prototype.hasOwnProperty // for `window` on <=IE8 + + for (var key in obj) { + if (has.call(obj, key)) { + keys.push(key); + } + } + + return keys; +}; + +/** + * Watch the given `files` for changes + * and invoke `fn(file)` on modification. + * + * @param {Array} files + * @param {Function} fn + * @api private + */ + +exports.watch = function(files, fn){ + var options = { interval: 100 }; + files.forEach(function(file){ + debug('file %s', file); + fs.watchFile(file, options, function(curr, prev){ + if (prev.mtime < curr.mtime) fn(file); + }); + }); +}; + +/** + * Ignored files. + */ + +function ignored(path){ + return !~ignore.indexOf(path); +} + +/** + * Lookup files in the given `dir`. + * + * @return {Array} + * @api private + */ + +exports.files = function(dir, ext, ret){ + ret = ret || []; + ext = ext || ['js']; + + var re = new RegExp('\\.(' + ext.join('|') + ')$'); + + fs.readdirSync(dir) + .filter(ignored) + .forEach(function(path){ + path = join(dir, path); + if (fs.statSync(path).isDirectory()) { + exports.files(path, ext, ret); + } else if (path.match(re)) { + ret.push(path); + } + }); + + return ret; +}; + +/** + * Compute a slug from the given `str`. + * + * @param {String} str + * @return {String} + * @api private + */ + +exports.slug = function(str){ + return str + .toLowerCase() + .replace(/ +/g, '-') + .replace(/[^-\w]/g, ''); +}; + +/** + * Strip the function definition from `str`, + * and re-indent for pre whitespace. + */ + +exports.clean = function(str) { + str = str + .replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, '') + .replace(/^function *\(.*\) *{|\(.*\) *=> *{?/, '') + .replace(/\s+\}$/, ''); + + var spaces = str.match(/^\n?( *)/)[1].length + , tabs = str.match(/^\n?(\t*)/)[1].length + , re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm'); + + str = str.replace(re, ''); + + return exports.trim(str); +}; + +/** + * Trim the given `str`. + * + * @param {String} str + * @return {String} + * @api private + */ + +exports.trim = function(str){ + return str.replace(/^\s+|\s+$/g, ''); +}; + +/** + * Parse the given `qs`. + * + * @param {String} qs + * @return {Object} + * @api private + */ + +exports.parseQuery = function(qs){ + return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair){ + var i = pair.indexOf('=') + , key = pair.slice(0, i) + , val = pair.slice(++i); + + obj[key] = decodeURIComponent(val); + return obj; + }, {}); +}; + +/** + * Highlight the given string of `js`. + * + * @param {String} js + * @return {String} + * @api private + */ + +function highlight(js) { + return js + .replace(//g, '>') + .replace(/\/\/(.*)/gm, '//$1') + .replace(/('.*?')/gm, '$1') + .replace(/(\d+\.\d+)/gm, '$1') + .replace(/(\d+)/gm, '$1') + .replace(/\bnew[ \t]+(\w+)/gm, 'new $1') + .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '$1') +} + +/** + * Highlight the contents of tag `name`. + * + * @param {String} name + * @api private + */ + +exports.highlightTags = function(name) { + var code = document.getElementById('mocha').getElementsByTagName(name); + for (var i = 0, len = code.length; i < len; ++i) { + code[i].innerHTML = highlight(code[i].innerHTML); + } +}; + + +/** + * Stringify `obj`. + * + * @param {Object} obj + * @return {String} + * @api private + */ + +exports.stringify = function(obj) { + if (obj instanceof RegExp) return obj.toString(); + return JSON.stringify(exports.canonicalize(obj), null, 2).replace(/,(\n|$)/g, '$1'); +}; + +/** + * Return a new object that has the keys in sorted order. + * @param {Object} obj + * @param {Array} [stack] + * @return {Object} + * @api private + */ + +exports.canonicalize = function(obj, stack) { + stack = stack || []; + + if (exports.indexOf(stack, obj) !== -1) return '[Circular]'; + + var canonicalizedObj; + + if ({}.toString.call(obj) === '[object Array]') { + stack.push(obj); + canonicalizedObj = exports.map(obj, function (item) { + return exports.canonicalize(item, stack); + }); + stack.pop(); + } else if (typeof obj === 'object' && obj !== null) { + stack.push(obj); + canonicalizedObj = {}; + exports.forEach(exports.keys(obj).sort(), function (key) { + canonicalizedObj[key] = exports.canonicalize(obj[key], stack); + }); + stack.pop(); + } else { + canonicalizedObj = obj; + } + + return canonicalizedObj; + }; + +/** + * Lookup file names at the given `path`. + */ +exports.lookupFiles = function lookupFiles(path, extensions, recursive) { + var files = []; + var re = new RegExp('\\.(' + extensions.join('|') + ')$'); + + if (!exists(path)) { + if (exists(path + '.js')) { + path += '.js'; + } else { + files = glob.sync(path); + if (!files.length) throw new Error("cannot resolve path (or pattern) '" + path + "'"); + return files; + } + } + + try { + var stat = fs.statSync(path); + if (stat.isFile()) return path; + } + catch (ignored) { + return; + } + + fs.readdirSync(path).forEach(function(file){ + file = join(path, file); + try { + var stat = fs.statSync(file); + if (stat.isDirectory()) { + if (recursive) { + files = files.concat(lookupFiles(file, extensions, recursive)); + } + return; + } + } + catch (ignored) { + return; + } + if (!stat.isFile() || !re.test(file) || basename(file)[0] === '.') return; + files.push(file); + }); + + return files; +}; + +}); // module: utils.js +// The global object is "self" in Web Workers. +var global = (function() { return this; })(); + +/** + * Save timer references to avoid Sinon interfering (see GH-237). + */ + +var Date = global.Date; +var setTimeout = global.setTimeout; +var setInterval = global.setInterval; +var clearTimeout = global.clearTimeout; +var clearInterval = global.clearInterval; + +/** + * Node shims. + * + * These are meant only to allow + * mocha.js to run untouched, not + * to allow running node code in + * the browser. + */ + +var process = {}; +process.exit = function(status){}; +process.stdout = {}; + +var uncaughtExceptionHandlers = []; + +var originalOnerrorHandler = global.onerror; + +/** + * Remove uncaughtException listener. + * Revert to original onerror handler if previously defined. + */ + +process.removeListener = function(e, fn){ + if ('uncaughtException' == e) { + if (originalOnerrorHandler) { + global.onerror = originalOnerrorHandler; + } else { + global.onerror = function() {}; + } + var i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn); + if (i != -1) { uncaughtExceptionHandlers.splice(i, 1); } + } +}; + +/** + * Implements uncaughtException listener. + */ + +process.on = function(e, fn){ + if ('uncaughtException' == e) { + global.onerror = function(err, url, line){ + fn(new Error(err + ' (' + url + ':' + line + ')')); + return true; + }; + uncaughtExceptionHandlers.push(fn); + } +}; + +/** + * Expose mocha. + */ + +var Mocha = global.Mocha = require('mocha'), + mocha = global.mocha = new Mocha({ reporter: 'html' }); + +// The BDD UI is registered by default, but no UI will be functional in the +// browser without an explicit call to the overridden `mocha.ui` (see below). +// Ensure that this default UI does not expose its methods to the global scope. +mocha.suite.removeAllListeners('pre-require'); + +var immediateQueue = [] + , immediateTimeout; + +function timeslice() { + var immediateStart = new Date().getTime(); + while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) { + immediateQueue.shift()(); + } + if (immediateQueue.length) { + immediateTimeout = setTimeout(timeslice, 0); + } else { + immediateTimeout = null; + } +} + +/** + * High-performance override of Runner.immediately. + */ + +Mocha.Runner.immediately = function(callback) { + immediateQueue.push(callback); + if (!immediateTimeout) { + immediateTimeout = setTimeout(timeslice, 0); + } +}; + +/** + * Function to allow assertion libraries to throw errors directly into mocha. + * This is useful when running tests in a browser because window.onerror will + * only receive the 'message' attribute of the Error. + */ +mocha.throwError = function(err) { + Mocha.utils.forEach(uncaughtExceptionHandlers, function (fn) { + fn(err); + }); + throw err; +}; + +/** + * Override ui to ensure that the ui functions are initialized. + * Normally this would happen in Mocha.prototype.loadFiles. + */ + +mocha.ui = function(ui){ + Mocha.prototype.ui.call(this, ui); + this.suite.emit('pre-require', global, null, this); + return this; +}; + +/** + * Setup mocha with the given setting options. + */ + +mocha.setup = function(opts){ + if ('string' == typeof opts) opts = { ui: opts }; + for (var opt in opts) this[opt](opts[opt]); + return this; +}; + +/** + * Run mocha, returning the Runner. + */ + +mocha.run = function(fn){ + var options = mocha.options; + mocha.globals('location'); + + var query = Mocha.utils.parseQuery(global.location.search || ''); + if (query.grep) mocha.grep(query.grep); + if (query.invert) mocha.invert(); + + return Mocha.prototype.run.call(mocha, function(err){ + // The DOM Document is not available in Web Workers. + var document = global.document; + if (document && document.getElementById('mocha') && options.noHighlighting !== true) { + Mocha.utils.highlightTags('code'); + } + if (fn) fn(err); + }); +}; + +/** + * Expose the process shim. + */ + +Mocha.process = process; +})(); \ No newline at end of file diff --git a/node_modules/es6-promise/dist/test/worker.js b/node_modules/es6-promise/dist/test/worker.js new file mode 100644 index 0000000000..7ad9f8a23b --- /dev/null +++ b/node_modules/es6-promise/dist/test/worker.js @@ -0,0 +1,16 @@ +importScripts('es6-promise.js'); +new ES6Promise.Promise(function(resolve, reject) { + self.onmessage = function (e) { + if (e.data === 'ping') { + resolve('pong'); + } else { + reject(new Error('wrong message')); + } + }; +}).then(function (result) { + self.postMessage(result); +}, function (err){ + setTimeout(function () { + throw err; + }); +}); diff --git a/node_modules/es6-promise/lib/es6-promise.umd.js b/node_modules/es6-promise/lib/es6-promise.umd.js new file mode 100644 index 0000000000..5984f7056b --- /dev/null +++ b/node_modules/es6-promise/lib/es6-promise.umd.js @@ -0,0 +1,18 @@ +import Promise from './es6-promise/promise'; +import polyfill from './es6-promise/polyfill'; + +var ES6Promise = { + 'Promise': Promise, + 'polyfill': polyfill +}; + +/* global define:true module:true window: true */ +if (typeof define === 'function' && define['amd']) { + define(function() { return ES6Promise; }); +} else if (typeof module !== 'undefined' && module['exports']) { + module['exports'] = ES6Promise; +} else if (typeof this !== 'undefined') { + this['ES6Promise'] = ES6Promise; +} + +polyfill(); diff --git a/node_modules/es6-promise/lib/es6-promise/-internal.js b/node_modules/es6-promise/lib/es6-promise/-internal.js new file mode 100644 index 0000000000..daee2c3848 --- /dev/null +++ b/node_modules/es6-promise/lib/es6-promise/-internal.js @@ -0,0 +1,250 @@ +import { + objectOrFunction, + isFunction +} from './utils'; + +import asap from './asap'; + +function noop() {} + +var PENDING = void 0; +var FULFILLED = 1; +var REJECTED = 2; + +var GET_THEN_ERROR = new ErrorObject(); + +function selfFullfillment() { + return new TypeError("You cannot resolve a promise with itself"); +} + +function cannotReturnOwn() { + return new TypeError('A promises callback cannot return that same promise.'); +} + +function getThen(promise) { + try { + return promise.then; + } catch(error) { + GET_THEN_ERROR.error = error; + return GET_THEN_ERROR; + } +} + +function tryThen(then, value, fulfillmentHandler, rejectionHandler) { + try { + then.call(value, fulfillmentHandler, rejectionHandler); + } catch(e) { + return e; + } +} + +function handleForeignThenable(promise, thenable, then) { + asap(function(promise) { + var sealed = false; + var error = tryThen(then, thenable, function(value) { + if (sealed) { return; } + sealed = true; + if (thenable !== value) { + resolve(promise, value); + } else { + fulfill(promise, value); + } + }, function(reason) { + if (sealed) { return; } + sealed = true; + + reject(promise, reason); + }, 'Settle: ' + (promise._label || ' unknown promise')); + + if (!sealed && error) { + sealed = true; + reject(promise, error); + } + }, promise); +} + +function handleOwnThenable(promise, thenable) { + if (thenable._state === FULFILLED) { + fulfill(promise, thenable._result); + } else if (thenable._state === REJECTED) { + reject(promise, thenable._result); + } else { + subscribe(thenable, undefined, function(value) { + resolve(promise, value); + }, function(reason) { + reject(promise, reason); + }); + } +} + +function handleMaybeThenable(promise, maybeThenable) { + if (maybeThenable.constructor === promise.constructor) { + handleOwnThenable(promise, maybeThenable); + } else { + var then = getThen(maybeThenable); + + if (then === GET_THEN_ERROR) { + reject(promise, GET_THEN_ERROR.error); + } else if (then === undefined) { + fulfill(promise, maybeThenable); + } else if (isFunction(then)) { + handleForeignThenable(promise, maybeThenable, then); + } else { + fulfill(promise, maybeThenable); + } + } +} + +function resolve(promise, value) { + if (promise === value) { + reject(promise, selfFullfillment()); + } else if (objectOrFunction(value)) { + handleMaybeThenable(promise, value); + } else { + fulfill(promise, value); + } +} + +function publishRejection(promise) { + if (promise._onerror) { + promise._onerror(promise._result); + } + + publish(promise); +} + +function fulfill(promise, value) { + if (promise._state !== PENDING) { return; } + + promise._result = value; + promise._state = FULFILLED; + + if (promise._subscribers.length !== 0) { + asap(publish, promise); + } +} + +function reject(promise, reason) { + if (promise._state !== PENDING) { return; } + promise._state = REJECTED; + promise._result = reason; + + asap(publishRejection, promise); +} + +function subscribe(parent, child, onFulfillment, onRejection) { + var subscribers = parent._subscribers; + var length = subscribers.length; + + parent._onerror = null; + + subscribers[length] = child; + subscribers[length + FULFILLED] = onFulfillment; + subscribers[length + REJECTED] = onRejection; + + if (length === 0 && parent._state) { + asap(publish, parent); + } +} + +function publish(promise) { + var subscribers = promise._subscribers; + var settled = promise._state; + + if (subscribers.length === 0) { return; } + + var child, callback, detail = promise._result; + + for (var i = 0; i < subscribers.length; i += 3) { + child = subscribers[i]; + callback = subscribers[i + settled]; + + if (child) { + invokeCallback(settled, child, callback, detail); + } else { + callback(detail); + } + } + + promise._subscribers.length = 0; +} + +function ErrorObject() { + this.error = null; +} + +var TRY_CATCH_ERROR = new ErrorObject(); + +function tryCatch(callback, detail) { + try { + return callback(detail); + } catch(e) { + TRY_CATCH_ERROR.error = e; + return TRY_CATCH_ERROR; + } +} + +function invokeCallback(settled, promise, callback, detail) { + var hasCallback = isFunction(callback), + value, error, succeeded, failed; + + if (hasCallback) { + value = tryCatch(callback, detail); + + if (value === TRY_CATCH_ERROR) { + failed = true; + error = value.error; + value = null; + } else { + succeeded = true; + } + + if (promise === value) { + reject(promise, cannotReturnOwn()); + return; + } + + } else { + value = detail; + succeeded = true; + } + + if (promise._state !== PENDING) { + // noop + } else if (hasCallback && succeeded) { + resolve(promise, value); + } else if (failed) { + reject(promise, error); + } else if (settled === FULFILLED) { + fulfill(promise, value); + } else if (settled === REJECTED) { + reject(promise, value); + } +} + +function initializePromise(promise, resolver) { + try { + resolver(function resolvePromise(value){ + resolve(promise, value); + }, function rejectPromise(reason) { + reject(promise, reason); + }); + } catch(e) { + reject(promise, e); + } +} + +export { + noop, + resolve, + reject, + fulfill, + subscribe, + publish, + publishRejection, + initializePromise, + invokeCallback, + FULFILLED, + REJECTED, + PENDING +}; diff --git a/node_modules/es6-promise/lib/es6-promise/asap.js b/node_modules/es6-promise/lib/es6-promise/asap.js new file mode 100644 index 0000000000..4f7dcee2dd --- /dev/null +++ b/node_modules/es6-promise/lib/es6-promise/asap.js @@ -0,0 +1,111 @@ +var len = 0; +var toString = {}.toString; +var vertxNext; +export default function asap(callback, arg) { + queue[len] = callback; + queue[len + 1] = arg; + len += 2; + if (len === 2) { + // If len is 2, that means that we need to schedule an async flush. + // If additional callbacks are queued before the queue is flushed, they + // will be processed by this flush that we are scheduling. + scheduleFlush(); + } +} + +var browserWindow = (typeof window !== 'undefined') ? window : undefined; +var browserGlobal = browserWindow || {}; +var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; +var isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; + +// test for web worker but not in IE10 +var isWorker = typeof Uint8ClampedArray !== 'undefined' && + typeof importScripts !== 'undefined' && + typeof MessageChannel !== 'undefined'; + +// node +function useNextTick() { + var nextTick = process.nextTick; + // node version 0.10.x displays a deprecation warning when nextTick is used recursively + // setImmediate should be used instead instead + var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); + if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { + nextTick = setImmediate; + } + return function() { + nextTick(flush); + }; +} + +// vertx +function useVertxTimer() { + return function() { + vertxNext(flush); + }; +} + +function useMutationObserver() { + var iterations = 0; + var observer = new BrowserMutationObserver(flush); + var node = document.createTextNode(''); + observer.observe(node, { characterData: true }); + + return function() { + node.data = (iterations = ++iterations % 2); + }; +} + +// web worker +function useMessageChannel() { + var channel = new MessageChannel(); + channel.port1.onmessage = flush; + return function () { + channel.port2.postMessage(0); + }; +} + +function useSetTimeout() { + return function() { + setTimeout(flush, 1); + }; +} + +var queue = new Array(1000); +function flush() { + for (var i = 0; i < len; i+=2) { + var callback = queue[i]; + var arg = queue[i+1]; + + callback(arg); + + queue[i] = undefined; + queue[i+1] = undefined; + } + + len = 0; +} + +function attemptVertex() { + try { + var r = require; + var vertx = r('vertx'); + vertxNext = vertx.runOnLoop || vertx.runOnContext; + return useVertxTimer(); + } catch(e) { + return useSetTimeout(); + } +} + +var scheduleFlush; +// Decide what async method to use to triggering processing of queued callbacks: +if (isNode) { + scheduleFlush = useNextTick(); +} else if (BrowserMutationObserver) { + scheduleFlush = useMutationObserver(); +} else if (isWorker) { + scheduleFlush = useMessageChannel(); +} else if (browserWindow === undefined && typeof require === 'function') { + scheduleFlush = attemptVertex(); +} else { + scheduleFlush = useSetTimeout(); +} diff --git a/node_modules/es6-promise/lib/es6-promise/enumerator.js b/node_modules/es6-promise/lib/es6-promise/enumerator.js new file mode 100644 index 0000000000..03fdf8c19b --- /dev/null +++ b/node_modules/es6-promise/lib/es6-promise/enumerator.js @@ -0,0 +1,113 @@ +import { + isArray, + isMaybeThenable +} from './utils'; + +import { + noop, + reject, + fulfill, + subscribe, + FULFILLED, + REJECTED, + PENDING +} from './-internal'; + +function Enumerator(Constructor, input) { + var enumerator = this; + + enumerator._instanceConstructor = Constructor; + enumerator.promise = new Constructor(noop); + + if (enumerator._validateInput(input)) { + enumerator._input = input; + enumerator.length = input.length; + enumerator._remaining = input.length; + + enumerator._init(); + + if (enumerator.length === 0) { + fulfill(enumerator.promise, enumerator._result); + } else { + enumerator.length = enumerator.length || 0; + enumerator._enumerate(); + if (enumerator._remaining === 0) { + fulfill(enumerator.promise, enumerator._result); + } + } + } else { + reject(enumerator.promise, enumerator._validationError()); + } +} + +Enumerator.prototype._validateInput = function(input) { + return isArray(input); +}; + +Enumerator.prototype._validationError = function() { + return new Error('Array Methods must be provided an Array'); +}; + +Enumerator.prototype._init = function() { + this._result = new Array(this.length); +}; + +export default Enumerator; + +Enumerator.prototype._enumerate = function() { + var enumerator = this; + + var length = enumerator.length; + var promise = enumerator.promise; + var input = enumerator._input; + + for (var i = 0; promise._state === PENDING && i < length; i++) { + enumerator._eachEntry(input[i], i); + } +}; + +Enumerator.prototype._eachEntry = function(entry, i) { + var enumerator = this; + var c = enumerator._instanceConstructor; + + if (isMaybeThenable(entry)) { + if (entry.constructor === c && entry._state !== PENDING) { + entry._onerror = null; + enumerator._settledAt(entry._state, i, entry._result); + } else { + enumerator._willSettleAt(c.resolve(entry), i); + } + } else { + enumerator._remaining--; + enumerator._result[i] = entry; + } +}; + +Enumerator.prototype._settledAt = function(state, i, value) { + var enumerator = this; + var promise = enumerator.promise; + + if (promise._state === PENDING) { + enumerator._remaining--; + + if (state === REJECTED) { + reject(promise, value); + } else { + enumerator._result[i] = value; + } + } + + if (enumerator._remaining === 0) { + fulfill(promise, enumerator._result); + } +}; + +Enumerator.prototype._willSettleAt = function(promise, i) { + var enumerator = this; + + subscribe(promise, undefined, function(value) { + enumerator._settledAt(FULFILLED, i, value); + }, function(reason) { + enumerator._settledAt(REJECTED, i, reason); + }); +}; diff --git a/node_modules/es6-promise/lib/es6-promise/polyfill.js b/node_modules/es6-promise/lib/es6-promise/polyfill.js new file mode 100644 index 0000000000..6696dfc6a1 --- /dev/null +++ b/node_modules/es6-promise/lib/es6-promise/polyfill.js @@ -0,0 +1,26 @@ +/*global self*/ +import Promise from './promise'; + +export default function polyfill() { + var local; + + if (typeof global !== 'undefined') { + local = global; + } else if (typeof self !== 'undefined') { + local = self; + } else { + try { + local = Function('return this')(); + } catch (e) { + throw new Error('polyfill failed because global object is unavailable in this environment'); + } + } + + var P = local.Promise; + + if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { + return; + } + + local.Promise = Promise; +} diff --git a/node_modules/es6-promise/lib/es6-promise/promise.js b/node_modules/es6-promise/lib/es6-promise/promise.js new file mode 100644 index 0000000000..78fe2ca00c --- /dev/null +++ b/node_modules/es6-promise/lib/es6-promise/promise.js @@ -0,0 +1,408 @@ +import { + isFunction +} from './utils'; + +import { + noop, + subscribe, + initializePromise, + invokeCallback, + FULFILLED, + REJECTED +} from './-internal'; + +import asap from './asap'; + +import all from './promise/all'; +import race from './promise/race'; +import Resolve from './promise/resolve'; +import Reject from './promise/reject'; + +var counter = 0; + +function needsResolver() { + throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); +} + +function needsNew() { + throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); +} + +export default Promise; +/** + Promise objects represent the eventual result of an asynchronous operation. The + primary way of interacting with a promise is through its `then` method, which + registers callbacks to receive either a promise’s eventual value or the reason + why the promise cannot be fulfilled. + + Terminology + ----------- + + - `promise` is an object or function with a `then` method whose behavior conforms to this specification. + - `thenable` is an object or function that defines a `then` method. + - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). + - `exception` is a value that is thrown using the throw statement. + - `reason` is a value that indicates why a promise was rejected. + - `settled` the final resting state of a promise, fulfilled or rejected. + + A promise can be in one of three states: pending, fulfilled, or rejected. + + Promises that are fulfilled have a fulfillment value and are in the fulfilled + state. Promises that are rejected have a rejection reason and are in the + rejected state. A fulfillment value is never a thenable. + + Promises can also be said to *resolve* a value. If this value is also a + promise, then the original promise's settled state will match the value's + settled state. So a promise that *resolves* a promise that rejects will + itself reject, and a promise that *resolves* a promise that fulfills will + itself fulfill. + + + Basic Usage: + ------------ + + ```js + var promise = new Promise(function(resolve, reject) { + // on success + resolve(value); + + // on failure + reject(reason); + }); + + promise.then(function(value) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Advanced Usage: + --------------- + + Promises shine when abstracting away asynchronous interactions such as + `XMLHttpRequest`s. + + ```js + function getJSON(url) { + return new Promise(function(resolve, reject){ + var xhr = new XMLHttpRequest(); + + xhr.open('GET', url); + xhr.onreadystatechange = handler; + xhr.responseType = 'json'; + xhr.setRequestHeader('Accept', 'application/json'); + xhr.send(); + + function handler() { + if (this.readyState === this.DONE) { + if (this.status === 200) { + resolve(this.response); + } else { + reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); + } + } + }; + }); + } + + getJSON('/posts.json').then(function(json) { + // on fulfillment + }, function(reason) { + // on rejection + }); + ``` + + Unlike callbacks, promises are great composable primitives. + + ```js + Promise.all([ + getJSON('/posts'), + getJSON('/comments') + ]).then(function(values){ + values[0] // => postsJSON + values[1] // => commentsJSON + + return values; + }); + ``` + + @class Promise + @param {function} resolver + Useful for tooling. + @constructor +*/ +function Promise(resolver) { + this._id = counter++; + this._state = undefined; + this._result = undefined; + this._subscribers = []; + + if (noop !== resolver) { + if (!isFunction(resolver)) { + needsResolver(); + } + + if (!(this instanceof Promise)) { + needsNew(); + } + + initializePromise(this, resolver); + } +} + +Promise.all = all; +Promise.race = race; +Promise.resolve = Resolve; +Promise.reject = Reject; + +Promise.prototype = { + constructor: Promise, + +/** + The primary way of interacting with a promise is through its `then` method, + which registers callbacks to receive either a promise's eventual value or the + reason why the promise cannot be fulfilled. + + ```js + findUser().then(function(user){ + // user is available + }, function(reason){ + // user is unavailable, and you are given the reason why + }); + ``` + + Chaining + -------- + + The return value of `then` is itself a promise. This second, 'downstream' + promise is resolved with the return value of the first promise's fulfillment + or rejection handler, or rejected if the handler throws an exception. + + ```js + findUser().then(function (user) { + return user.name; + }, function (reason) { + return 'default name'; + }).then(function (userName) { + // If `findUser` fulfilled, `userName` will be the user's name, otherwise it + // will be `'default name'` + }); + + findUser().then(function (user) { + throw new Error('Found user, but still unhappy'); + }, function (reason) { + throw new Error('`findUser` rejected and we're unhappy'); + }).then(function (value) { + // never reached + }, function (reason) { + // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. + // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. + }); + ``` + If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. + + ```js + findUser().then(function (user) { + throw new PedagogicalException('Upstream error'); + }).then(function (value) { + // never reached + }).then(function (value) { + // never reached + }, function (reason) { + // The `PedgagocialException` is propagated all the way down to here + }); + ``` + + Assimilation + ------------ + + Sometimes the value you want to propagate to a downstream promise can only be + retrieved asynchronously. This can be achieved by returning a promise in the + fulfillment or rejection handler. The downstream promise will then be pending + until the returned promise is settled. This is called *assimilation*. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // The user's comments are now available + }); + ``` + + If the assimliated promise rejects, then the downstream promise will also reject. + + ```js + findUser().then(function (user) { + return findCommentsByAuthor(user); + }).then(function (comments) { + // If `findCommentsByAuthor` fulfills, we'll have the value here + }, function (reason) { + // If `findCommentsByAuthor` rejects, we'll have the reason here + }); + ``` + + Simple Example + -------------- + + Synchronous Example + + ```javascript + var result; + + try { + result = findResult(); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + findResult(function(result, err){ + if (err) { + // failure + } else { + // success + } + }); + ``` + + Promise Example; + + ```javascript + findResult().then(function(result){ + // success + }, function(reason){ + // failure + }); + ``` + + Advanced Example + -------------- + + Synchronous Example + + ```javascript + var author, books; + + try { + author = findAuthor(); + books = findBooksByAuthor(author); + // success + } catch(reason) { + // failure + } + ``` + + Errback Example + + ```js + + function foundBooks(books) { + + } + + function failure(reason) { + + } + + findAuthor(function(author, err){ + if (err) { + failure(err); + // failure + } else { + try { + findBoooksByAuthor(author, function(books, err) { + if (err) { + failure(err); + } else { + try { + foundBooks(books); + } catch(reason) { + failure(reason); + } + } + }); + } catch(error) { + failure(err); + } + // success + } + }); + ``` + + Promise Example; + + ```javascript + findAuthor(). + then(findBooksByAuthor). + then(function(books){ + // found books + }).catch(function(reason){ + // something went wrong + }); + ``` + + @method then + @param {Function} onFulfilled + @param {Function} onRejected + Useful for tooling. + @return {Promise} +*/ + then: function(onFulfillment, onRejection) { + var parent = this; + var state = parent._state; + + if (state === FULFILLED && !onFulfillment || state === REJECTED && !onRejection) { + return this; + } + + var child = new this.constructor(noop); + var result = parent._result; + + if (state) { + var callback = arguments[state - 1]; + asap(function(){ + invokeCallback(state, child, callback, result); + }); + } else { + subscribe(parent, child, onFulfillment, onRejection); + } + + return child; + }, + +/** + `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same + as the catch block of a try/catch statement. + + ```js + function findAuthor(){ + throw new Error('couldn't find that author'); + } + + // synchronous + try { + findAuthor(); + } catch(reason) { + // something went wrong + } + + // async with promises + findAuthor().catch(function(reason){ + // something went wrong + }); + ``` + + @method catch + @param {Function} onRejection + Useful for tooling. + @return {Promise} +*/ + 'catch': function(onRejection) { + return this.then(null, onRejection); + } +}; diff --git a/node_modules/es6-promise/lib/es6-promise/promise/all.js b/node_modules/es6-promise/lib/es6-promise/promise/all.js new file mode 100644 index 0000000000..03033f0dc7 --- /dev/null +++ b/node_modules/es6-promise/lib/es6-promise/promise/all.js @@ -0,0 +1,52 @@ +import Enumerator from '../enumerator'; + +/** + `Promise.all` accepts an array of promises, and returns a new promise which + is fulfilled with an array of fulfillment values for the passed promises, or + rejected with the reason of the first passed promise to be rejected. It casts all + elements of the passed iterable to promises as it runs this algorithm. + + Example: + + ```javascript + var promise1 = resolve(1); + var promise2 = resolve(2); + var promise3 = resolve(3); + var promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // The array here would be [ 1, 2, 3 ]; + }); + ``` + + If any of the `promises` given to `all` are rejected, the first promise + that is rejected will be given as an argument to the returned promises's + rejection handler. For example: + + Example: + + ```javascript + var promise1 = resolve(1); + var promise2 = reject(new Error("2")); + var promise3 = reject(new Error("3")); + var promises = [ promise1, promise2, promise3 ]; + + Promise.all(promises).then(function(array){ + // Code here never runs because there are rejected promises! + }, function(error) { + // error.message === "2" + }); + ``` + + @method all + @static + @param {Array} entries array of promises + @param {String} label optional string for labeling the promise. + Useful for tooling. + @return {Promise} promise that is fulfilled when all `promises` have been + fulfilled, or rejected if any of them become rejected. + @static +*/ +export default function all(entries) { + return new Enumerator(this, entries).promise; +} diff --git a/node_modules/es6-promise/lib/es6-promise/promise/race.js b/node_modules/es6-promise/lib/es6-promise/promise/race.js new file mode 100644 index 0000000000..0d7ff1332a --- /dev/null +++ b/node_modules/es6-promise/lib/es6-promise/promise/race.js @@ -0,0 +1,104 @@ +import { + isArray +} from "../utils"; + +import { + noop, + resolve, + reject, + subscribe, + PENDING +} from '../-internal'; + +/** + `Promise.race` returns a new promise which is settled in the same way as the + first passed promise to settle. + + Example: + + ```javascript + var promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + var promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 2'); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // result === 'promise 2' because it was resolved before promise1 + // was resolved. + }); + ``` + + `Promise.race` is deterministic in that only the state of the first + settled promise matters. For example, even if other promises given to the + `promises` array argument are resolved, but the first settled promise has + become rejected before the other promises became fulfilled, the returned + promise will become rejected: + + ```javascript + var promise1 = new Promise(function(resolve, reject){ + setTimeout(function(){ + resolve('promise 1'); + }, 200); + }); + + var promise2 = new Promise(function(resolve, reject){ + setTimeout(function(){ + reject(new Error('promise 2')); + }, 100); + }); + + Promise.race([promise1, promise2]).then(function(result){ + // Code here never runs + }, function(reason){ + // reason.message === 'promise 2' because promise 2 became rejected before + // promise 1 became fulfilled + }); + ``` + + An example real-world use case is implementing timeouts: + + ```javascript + Promise.race([ajax('foo.json'), timeout(5000)]) + ``` + + @method race + @static + @param {Array} promises array of promises to observe + Useful for tooling. + @return {Promise} a promise which settles in the same way as the first passed + promise to settle. +*/ +export default function race(entries) { + /*jshint validthis:true */ + var Constructor = this; + + var promise = new Constructor(noop); + + if (!isArray(entries)) { + reject(promise, new TypeError('You must pass an array to race.')); + return promise; + } + + var length = entries.length; + + function onFulfillment(value) { + resolve(promise, value); + } + + function onRejection(reason) { + reject(promise, reason); + } + + for (var i = 0; promise._state === PENDING && i < length; i++) { + subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); + } + + return promise; +} diff --git a/node_modules/es6-promise/lib/es6-promise/promise/reject.js b/node_modules/es6-promise/lib/es6-promise/promise/reject.js new file mode 100644 index 0000000000..63b86cba10 --- /dev/null +++ b/node_modules/es6-promise/lib/es6-promise/promise/reject.js @@ -0,0 +1,46 @@ +import { + noop, + reject as _reject +} from '../-internal'; + +/** + `Promise.reject` returns a promise rejected with the passed `reason`. + It is shorthand for the following: + + ```javascript + var promise = new Promise(function(resolve, reject){ + reject(new Error('WHOOPS')); + }); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + var promise = Promise.reject(new Error('WHOOPS')); + + promise.then(function(value){ + // Code here doesn't run because the promise is rejected! + }, function(reason){ + // reason.message === 'WHOOPS' + }); + ``` + + @method reject + @static + @param {Any} reason value that the returned promise will be rejected with. + Useful for tooling. + @return {Promise} a promise rejected with the given `reason`. +*/ +export default function reject(reason) { + /*jshint validthis:true */ + var Constructor = this; + var promise = new Constructor(noop); + _reject(promise, reason); + return promise; +} diff --git a/node_modules/es6-promise/lib/es6-promise/promise/resolve.js b/node_modules/es6-promise/lib/es6-promise/promise/resolve.js new file mode 100644 index 0000000000..201a545d6a --- /dev/null +++ b/node_modules/es6-promise/lib/es6-promise/promise/resolve.js @@ -0,0 +1,48 @@ +import { + noop, + resolve as _resolve +} from '../-internal'; + +/** + `Promise.resolve` returns a promise that will become resolved with the + passed `value`. It is shorthand for the following: + + ```javascript + var promise = new Promise(function(resolve, reject){ + resolve(1); + }); + + promise.then(function(value){ + // value === 1 + }); + ``` + + Instead of writing the above, your code now simply becomes the following: + + ```javascript + var promise = Promise.resolve(1); + + promise.then(function(value){ + // value === 1 + }); + ``` + + @method resolve + @static + @param {Any} value value that the returned promise will be resolved with + Useful for tooling. + @return {Promise} a promise that will become fulfilled with the given + `value` +*/ +export default function resolve(object) { + /*jshint validthis:true */ + var Constructor = this; + + if (object && typeof object === 'object' && object.constructor === Constructor) { + return object; + } + + var promise = new Constructor(noop); + _resolve(promise, object); + return promise; +} diff --git a/node_modules/es6-promise/lib/es6-promise/utils.js b/node_modules/es6-promise/lib/es6-promise/utils.js new file mode 100644 index 0000000000..31ec6f9c5f --- /dev/null +++ b/node_modules/es6-promise/lib/es6-promise/utils.js @@ -0,0 +1,22 @@ +export function objectOrFunction(x) { + return typeof x === 'function' || (typeof x === 'object' && x !== null); +} + +export function isFunction(x) { + return typeof x === 'function'; +} + +export function isMaybeThenable(x) { + return typeof x === 'object' && x !== null; +} + +var _isArray; +if (!Array.isArray) { + _isArray = function (x) { + return Object.prototype.toString.call(x) === '[object Array]'; + }; +} else { + _isArray = Array.isArray; +} + +export var isArray = _isArray; diff --git a/node_modules/es6-promise/package.json b/node_modules/es6-promise/package.json index 427aab74ca..339d673878 100644 --- a/node_modules/es6-promise/package.json +++ b/node_modules/es6-promise/package.json @@ -1,76 +1,89 @@ -{ - "name": "es6-promise", - "namespace": "Promise", - "version": "1.0.0", - "description": "A polyfill for ES6-style Promises, tracking rsvp", - "main": "dist/commonjs/main.js", - "directories": { - "lib": "lib" - }, - "devDependencies": { - "brfs": "0.0.8", - "grunt": "~0.4.2", - "grunt-browserify": "~1.2.11", - "grunt-cli": "~0.1.11", - "grunt-contrib-clean": "~0.5.0", - "grunt-contrib-concat": "~0.3.0", - "grunt-contrib-connect": "~0.5.0", - "grunt-contrib-jshint": "~0.7.0", - "grunt-contrib-uglify": "~0.2.4", - "grunt-contrib-watch": "~0.5.3", - "grunt-es6-module-transpiler": "~0.6.0", - "grunt-mocha-phantomjs": "~0.3.1", - "grunt-mocha-test": "~0.5.0", - "grunt-s3": "~0.2.0-alpha.2", - "jshint": "~0.9", - "load-grunt-config": "~0.5.0", - "load-grunt-tasks": "~0.2.0", - "mocha-phantomjs": "~3.1.6", - "promises-aplus-tests": "git://github.com/stefanpenner/promises-tests.git", - "connect-redirection": "0.0.1", - "grunt-contrib-yuidoc": "~0.5.0" - }, - "scripts": { - "test": "grunt test", - "lint": "jshint lib", - "prepublish": "grunt build" - }, - "repository": { - "type": "git", - "url": "git://github.com/jakearchibald/ES6-Promises.git" - }, - "bugs": { - "url": "https://github.com/jakearchibald/ES6-Promises/issues" - }, - "keywords": [ - "promises", - "futures", - "events" - ], - "author": { - "name": "Tilde, Inc.", - "url": "Conversion to ES6 API by Jake Archibald" - }, - "license": "MIT", - "homepage": "https://github.com/jakearchibald/ES6-Promises", - "_id": "es6-promise@1.0.0", - "dist": { - "shasum": "f90d3629faa7c26166ae4df77c89bacdeb8dca7f", - "tarball": "http://registry.npmjs.org/es6-promise/-/es6-promise-1.0.0.tgz" - }, - "_from": "es6-promise@", - "_npmVersion": "1.3.24", - "_npmUser": { - "name": "jaffathecake", - "email": "jaffathecake@gmail.com" - }, - "maintainers": [ - { - "name": "jaffathecake", - "email": "jaffathecake@gmail.com" - } - ], - "_shasum": "f90d3629faa7c26166ae4df77c89bacdeb8dca7f", - "_resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-1.0.0.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "es6-promise", + "namespace": "es6-promise", + "version": "2.1.1", + "description": "A lightweight library that provides tools for organizing asynchronous code", + "main": "dist/es6-promise.js", + "directories": { + "lib": "lib" + }, + "files": [ + "dist", + "lib" + ], + "devDependencies": { + "bower": "^1.3.9", + "brfs": "0.0.8", + "broccoli-es3-safe-recast": "0.0.8", + "broccoli-es6-module-transpiler": "^0.5.0", + "broccoli-jshint": "^0.5.1", + "broccoli-merge-trees": "^0.1.4", + "broccoli-replace": "^0.2.0", + "broccoli-stew": "0.0.6", + "broccoli-uglify-js": "^0.1.3", + "broccoli-watchify": "^0.2.0", + "ember-cli": "^0.2.2", + "ember-publisher": "0.0.7", + "git-repo-version": "0.0.2", + "json3": "^3.3.2", + "minimatch": "^2.0.1", + "mocha": "^1.20.1", + "promises-aplus-tests-phantom": "^2.1.0-revise", + "release-it": "0.0.10" + }, + "scripts": { + "build": "ember build", + "start": "ember s", + "test": "ember test", + "test:server": "ember test --server", + "test:node": "ember build && mocha ./dist/test/browserify", + "lint": "jshint lib", + "prepublish": "ember build --environment production", + "dry-run-release": "ember build --environment production && release-it --dry-run --non-interactive" + }, + "repository": { + "type": "git", + "url": "git://github.com/jakearchibald/ES6-Promises.git" + }, + "bugs": { + "url": "https://github.com/jakearchibald/ES6-Promises/issues" + }, + "browser": { + "vertx": false + }, + "keywords": [ + "promises", + "futures" + ], + "author": { + "name": "Yehuda Katz, Tom Dale, Stefan Penner and contributors", + "url": "Conversion to ES6 API by Jake Archibald" + }, + "license": "MIT", + "spm": { + "main": "dist/es6-promise.js" + }, + "gitHead": "02cf697c50856f0cd3785f425a2cf819af0e521c", + "homepage": "https://github.com/jakearchibald/ES6-Promises", + "_id": "es6-promise@2.1.1", + "_shasum": "03e8f3c7297928e5478d6ab1d0643251507bdedd", + "_from": "es6-promise@2.1.1", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.1", + "_npmUser": { + "name": "jaffathecake", + "email": "jaffathecake@gmail.com" + }, + "maintainers": [ + { + "name": "jaffathecake", + "email": "jaffathecake@gmail.com" + } + ], + "dist": { + "shasum": "03e8f3c7297928e5478d6ab1d0643251507bdedd", + "tarball": "http://registry.npmjs.org/es6-promise/-/es6-promise-2.1.1.tgz" + }, + "_resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-2.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/index.js b/node_modules/gulp-changed/index.js index 62f61f9436..fcc81f5a07 100644 --- a/node_modules/gulp-changed/index.js +++ b/node_modules/gulp-changed/index.js @@ -40,6 +40,11 @@ function compareLastModifiedTime(stream, cb, sourceFile, targetPath) { // only push through files with different SHA1 than the destination files function compareSha1Digest(stream, cb, sourceFile, targetPath) { fs.readFile(targetPath, function (err, targetData) { + if (sourceFile.isNull()) { + cb(null, sourceFile); + return; + } + if (!fsOperationFailed(stream, sourceFile, err)) { var sourceDigest = sha1(sourceFile.contents); var targetDigest = sha1(targetData); @@ -63,12 +68,8 @@ module.exports = function (dest, opts) { } return through.obj(function (file, enc, cb) { - if (file.isNull()) { - cb(null, file); - return; - } - - var newPath = path.resolve(opts.cwd, dest, file.relative); + var dest2 = typeof dest === 'function' ? dest(file) : dest; + var newPath = path.resolve(opts.cwd, dest2, file.relative); if (opts.extension) { newPath = gutil.replaceExtension(newPath, opts.extension); diff --git a/node_modules/gulp-changed/node_modules/gulp-util/.npmignore b/node_modules/gulp-changed/node_modules/gulp-util/.npmignore deleted file mode 100644 index f9f39fd61c..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/.npmignore +++ /dev/null @@ -1,7 +0,0 @@ -.DS_Store -*.log -node_modules -build -*.node -components -test \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/.travis.yml b/node_modules/gulp-changed/node_modules/gulp-util/.travis.yml deleted file mode 100644 index 8703594c0d..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - "0.10" -after_script: - - npm run coveralls \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/LICENSE b/node_modules/gulp-changed/node_modules/gulp-util/LICENSE old mode 100644 new mode 100755 index acf1727d4f..7cbe012c64 --- a/node_modules/gulp-changed/node_modules/gulp-util/LICENSE +++ b/node_modules/gulp-changed/node_modules/gulp-util/LICENSE @@ -1,20 +1,20 @@ -Copyright (c) 2014 Fractal - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +Copyright (c) 2014 Fractal + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/gulp-util/README.md b/node_modules/gulp-changed/node_modules/gulp-util/README.md index 486ad4a557..39aa1aeb8c 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/README.md +++ b/node_modules/gulp-changed/node_modules/gulp-util/README.md @@ -1,141 +1,146 @@ -# gulp-util [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status][depstat-image]][depstat-url] - -## Information - - - - - - - - - - - - - -
    Packagegulp-util
    DescriptionUtility functions for gulp plugins
    Node Version>= 0.9
    - -## Usage - -```javascript -var gutil = require('gulp-util'); - -gutil.log('stuff happened', 'Really it did', gutil.colors.cyan('123')); -gutil.beep(); - -gutil.replaceExtension('file.coffee', '.js'); // file.js - -var opt = { - name: 'todd', - file: someGulpFile -}; -gutil.template('test <%= name %> <%= file.path %>', opt) // test todd /js/hi.js -``` - -### log(msg...) - -Logs stuff. Already prefixed with [gulp] and all that. Use the right colors for values. If you pass in multiple arguments it will join them by a space. - -``` -values (files, module names, etc.) = magenta -numbers (times, counts, etc) = cyan -``` - -### replaceExtension(path, newExtension) - -Replaces a file extension in a path. Returns the new path. - -### isStream(obj) - -Returns true or false if an object is a stream. - -### isBuffer(obj) - -Returns true or false if an object is a Buffer. - -### template(string[, data]) - -This is a lodash.template function wrapper. You must pass in a valid gulp file object so it is available to the user or it will error. You can not configure any of the delimiters. Look at the [lodash docs](http://lodash.com/docs#template) for more info. - -## new File(obj) - -This is just [vinyl](https://github.com/wearefractal/vinyl) - -```javascript -var file = new gutil.File({ - base: path.join(__dirname, './fixtures/'), - cwd: __dirname, - path: path.join(__dirname, './fixtures/test.coffee') -}); -``` - -## noop() - -Returns a stream that does nothing but pass data straight through. - -```javascript -// gulp should be called like this : -// $ gulp --type production -gulp.task('scripts', function() { - gulp.src('src/**/*.js') - .pipe(concat('script.js')) - .pipe(gutil.env.type === 'production' ? uglify() : gutil.noop()) - .pipe(gulp.dest('dist/'); -}); -``` - -## buffer(cb) - -This is similar to es.wait but instead of buffering text into one string it buffers anything into an array (so very useful for file objects). - -Returns a stream that can be piped to. - -The stream will emit one data event after the stream piped to it has ended. The data will be the same array passed to the callback. - -Callback is optional and receives two arguments: error and data - -```javascript -gulp.src('stuff/*.js') - .pipe(gutil.buffer(function(err, files){ - - }); -``` - -## new PluginError(pluginName, message[, options]) - -- pluginName should be the module name of your plugin -- message can be a string or an existing error -- By default the stack will not be shown. Set `options.showStack` to true if you think the stack is important for your error. -- If you pass an error in as the message the stack will be pulled from that, otherwise one will be created. -- Note that if you pass in a custom stack string you need to include the message along with that. -- Error properties will be included in `err.toString()`. Can be omitted by including `{showProperties: false}` in the options. - -These are all acceptable forms of instantiation: - -```javascript -var err = new gutil.PluginError('test', { - message: 'something broke' -}); - -var err = new gutil.PluginError({ - plugin: 'test', - message: 'something broke' -}); - -var err = new gutil.PluginError('test', 'something broke'); - -var err = new gutil.PluginError('test', 'something broke', {showStack: true}); - -var existingError = new Error('OMG'); -var err = new gutil.PluginError('test', existingError, {showStack: true}); -``` - -[npm-url]: https://npmjs.org/package/gulp-util -[npm-image]: https://badge.fury.io/js/gulp-util.svg -[travis-url]: https://travis-ci.org/gulpjs/gulp-util -[travis-image]: https://travis-ci.org/gulpjs/gulp-util.svg?branch=master -[coveralls-url]: https://coveralls.io/r/gulpjs/gulp-util -[coveralls-image]: https://coveralls.io/repos/gulpjs/gulp-util/badge.png -[depstat-url]: https://david-dm.org/gulpjs/gulp-util -[depstat-image]: https://david-dm.org/gulpjs/gulp-util.svg +# gulp-util [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status][depstat-image]][depstat-url] + +## Information + + + + + + + + + + + + + +
    Packagegulp-util
    DescriptionUtility functions for gulp plugins
    Node Version>= 0.9
    + +## Usage + +```javascript +var gutil = require('gulp-util'); + +gutil.log('stuff happened', 'Really it did', gutil.colors.magenta('123')); +gutil.beep(); + +gutil.replaceExtension('file.coffee', '.js'); // file.js + +var opt = { + name: 'todd', + file: someGulpFile +}; +gutil.template('test <%= name %> <%= file.path %>', opt) // test todd /js/hi.js +``` + +### log(msg...) + +Logs stuff. Already prefixed with [gulp] and all that. If you pass in multiple arguments it will join them by a space. + +The default gulp coloring using gutil.colors.: +``` +values (files, module names, etc.) = cyan +numbers (times, counts, etc) = magenta +``` + +### colors + +Is an instance of [chalk](https://github.com/sindresorhus/chalk). + +### replaceExtension(path, newExtension) + +Replaces a file extension in a path. Returns the new path. + +### isStream(obj) + +Returns true or false if an object is a stream. + +### isBuffer(obj) + +Returns true or false if an object is a Buffer. + +### template(string[, data]) + +This is a lodash.template function wrapper. You must pass in a valid gulp file object so it is available to the user or it will error. You can not configure any of the delimiters. Look at the [lodash docs](http://lodash.com/docs#template) for more info. + +## new File(obj) + +This is just [vinyl](https://github.com/wearefractal/vinyl) + +```javascript +var file = new gutil.File({ + base: path.join(__dirname, './fixtures/'), + cwd: __dirname, + path: path.join(__dirname, './fixtures/test.coffee') +}); +``` + +## noop() + +Returns a stream that does nothing but pass data straight through. + +```javascript +// gulp should be called like this : +// $ gulp --type production +gulp.task('scripts', function() { + gulp.src('src/**/*.js') + .pipe(concat('script.js')) + .pipe(gutil.env.type === 'production' ? uglify() : gutil.noop()) + .pipe(gulp.dest('dist/')); +}); +``` + +## buffer(cb) + +This is similar to es.wait but instead of buffering text into one string it buffers anything into an array (so very useful for file objects). + +Returns a stream that can be piped to. + +The stream will emit one data event after the stream piped to it has ended. The data will be the same array passed to the callback. + +Callback is optional and receives two arguments: error and data + +```javascript +gulp.src('stuff/*.js') + .pipe(gutil.buffer(function(err, files) { + + })); +``` + +## new PluginError(pluginName, message[, options]) + +- pluginName should be the module name of your plugin +- message can be a string or an existing error +- By default the stack will not be shown. Set `options.showStack` to true if you think the stack is important for your error. +- If you pass an error in as the message the stack will be pulled from that, otherwise one will be created. +- Note that if you pass in a custom stack string you need to include the message along with that. +- Error properties will be included in `err.toString()`. Can be omitted by including `{showProperties: false}` in the options. + +These are all acceptable forms of instantiation: + +```javascript +var err = new gutil.PluginError('test', { + message: 'something broke' +}); + +var err = new gutil.PluginError({ + plugin: 'test', + message: 'something broke' +}); + +var err = new gutil.PluginError('test', 'something broke'); + +var err = new gutil.PluginError('test', 'something broke', {showStack: true}); + +var existingError = new Error('OMG'); +var err = new gutil.PluginError('test', existingError, {showStack: true}); +``` + +[npm-url]: https://www.npmjs.com/package/gulp-util +[npm-image]: https://badge.fury.io/js/gulp-util.svg +[travis-url]: https://travis-ci.org/gulpjs/gulp-util +[travis-image]: https://img.shields.io/travis/gulpjs/gulp-util.svg?branch=master +[coveralls-url]: https://coveralls.io/r/gulpjs/gulp-util +[coveralls-image]: https://img.shields.io/coveralls/gulpjs/gulp-util.svg +[depstat-url]: https://david-dm.org/gulpjs/gulp-util +[depstat-image]: https://david-dm.org/gulpjs/gulp-util.svg diff --git a/node_modules/gulp-changed/node_modules/gulp-util/index.js b/node_modules/gulp-changed/node_modules/gulp-util/index.js index 6746ee4be2..199713c94b 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/index.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/index.js @@ -1,18 +1,18 @@ module.exports = { - File: require('./lib/File'), - replaceExtension: require('./lib/replaceExtension'), - colors: require('./lib/colors'), - date: require('./lib/date'), + File: require('vinyl'), + replaceExtension: require('replace-ext'), + colors: require('chalk'), + date: require('dateformat'), log: require('./lib/log'), template: require('./lib/template'), env: require('./lib/env'), - beep: require('./lib/beep'), + beep: require('beeper'), noop: require('./lib/noop'), isStream: require('./lib/isStream'), isBuffer: require('./lib/isBuffer'), isNull: require('./lib/isNull'), - linefeed: require('./lib/linefeed'), + linefeed: '\n', combine: require('./lib/combine'), buffer: require('./lib/buffer'), PluginError: require('./lib/PluginError') -}; \ No newline at end of file +}; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/lib/File.js b/node_modules/gulp-changed/node_modules/gulp-util/lib/File.js deleted file mode 100644 index 690a508a62..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/lib/File.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('vinyl'); \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/lib/PluginError.js b/node_modules/gulp-changed/node_modules/gulp-util/lib/PluginError.js index 0cdabd32fb..d60159ab1e 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/lib/PluginError.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/lib/PluginError.js @@ -1,13 +1,15 @@ var util = require('util'); -var colors = require('./colors'); -var _ = require('lodash'); +var arrayDiffer = require('array-differ'); +var arrayUniq = require('array-uniq'); +var chalk = require('chalk'); +var objectAssign = require('object-assign'); var nonEnumberableProperties = ['name', 'message', 'stack']; var propertiesNotToDisplay = nonEnumberableProperties.concat(['plugin', 'showStack', 'showProperties', '__safety', '_stack']); // wow what a clusterfuck var parseOptions = function(plugin, message, opt) { - if (!opt) opt = {}; + opt = opt || {}; if (typeof plugin === 'object') { opt = plugin; } else { @@ -21,12 +23,10 @@ var parseOptions = function(plugin, message, opt) { opt.plugin = plugin; } - _.defaults(opt, { + return objectAssign({ showStack: false, showProperties: true - }) - - return opt; + }, opt); }; function PluginError(plugin, message, opt) { @@ -35,14 +35,15 @@ function PluginError(plugin, message, opt) { Error.call(this); var options = parseOptions(plugin, message, opt); + var self = this; // if options has an error, grab details from it if (options.error) { // These properties are not enumerable, so we have to add them explicitly. - _.uniq(Object.keys(options.error).concat(nonEnumberableProperties)) + arrayUniq(Object.keys(options.error).concat(nonEnumberableProperties)) .forEach(function(prop) { - this[prop] = options.error[prop]; - }, this); + self[prop] = options.error[prop]; + }); } var properties = ['name', 'message', 'fileName', 'lineNumber', 'stack', 'showStack', 'showProperties', 'plugin']; @@ -86,22 +87,31 @@ PluginError.prototype._messageWithDetails = function() { }; PluginError.prototype._messageDetails = function() { - var properties; - if (this.showProperties) { - var properties = _(Object.keys(this)) - .filter(function(prop) { return propertiesNotToDisplay.indexOf(prop) === -1; }) - .map(function(prop) { return '\n ' + prop + ': ' + this[prop]; }, this) - .reduce(function(properties, next) { return properties + next; }); + if (!this.showProperties) { + return ''; + } + + var properties = arrayDiffer(Object.keys(this), propertiesNotToDisplay); + + if (properties.length === 0) { + return ''; } - return properties === undefined ? '' : ('Details:' + properties) + + var self = this; + properties = properties.map(function stringifyProperty(prop) { + return ' ' + prop + ': ' + self[prop]; + }); + + return 'Details:\n' + properties.join('\n'); }; PluginError.prototype.toString = function () { - var sig = colors.red(this.name) + ' in plugin \'' + colors.cyan(this.plugin) + '\''; + var sig = chalk.red(this.name) + ' in plugin \'' + chalk.cyan(this.plugin) + '\''; var detailsWithStack = function(stack) { return this._messageWithDetails() + '\nStack:\n' + stack; }.bind(this); + var msg; if (this.showStack) { if (this.__safety) { // There is no wrapped error, use the stack captured in the PluginError ctor msg = this.__safety.stack; @@ -114,7 +124,7 @@ PluginError.prototype.toString = function () { msg = this._messageWithDetails(); } - return sig+'\n'+msg; + return sig + '\n' + msg; }; module.exports = PluginError; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/lib/beep.js b/node_modules/gulp-changed/node_modules/gulp-util/lib/beep.js deleted file mode 100644 index 5473d75481..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/lib/beep.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function() { - process.stdout.write('\x07'); -}; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/lib/buffer.js b/node_modules/gulp-changed/node_modules/gulp-util/lib/buffer.js index 4cb064acae..26c940db17 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/lib/buffer.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/lib/buffer.js @@ -12,4 +12,4 @@ module.exports = function(fn) { cb(); }; return through.obj(push, end); -}; \ No newline at end of file +}; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/lib/colors.js b/node_modules/gulp-changed/node_modules/gulp-util/lib/colors.js deleted file mode 100644 index bc8049406d..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/lib/colors.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('chalk'); \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/lib/date.js b/node_modules/gulp-changed/node_modules/gulp-util/lib/date.js deleted file mode 100644 index 935793cc68..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/lib/date.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('dateformat'); \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/lib/env.js b/node_modules/gulp-changed/node_modules/gulp-util/lib/env.js index ea1e03e4af..ee17c0e30b 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/lib/env.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/lib/env.js @@ -1,4 +1,4 @@ var parseArgs = require('minimist'); var argv = parseArgs(process.argv.slice(2)); -module.exports = argv; \ No newline at end of file +module.exports = argv; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/lib/isBuffer.js b/node_modules/gulp-changed/node_modules/gulp-util/lib/isBuffer.js index 0e23782c41..7c52f78c91 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/lib/isBuffer.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/lib/isBuffer.js @@ -4,4 +4,4 @@ var Buffer = buf.Buffer; // could use Buffer.isBuffer but this is the same exact thing... module.exports = function(o) { return typeof o === 'object' && o instanceof Buffer; -}; \ No newline at end of file +}; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/lib/isNull.js b/node_modules/gulp-changed/node_modules/gulp-util/lib/isNull.js index 403bb30e87..7f22c63ae8 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/lib/isNull.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/lib/isNull.js @@ -1,3 +1,3 @@ module.exports = function(v) { return v === null; -}; \ No newline at end of file +}; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/lib/isStream.js b/node_modules/gulp-changed/node_modules/gulp-util/lib/isStream.js index 9ce0929b03..6b54e123bb 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/lib/isStream.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/lib/isStream.js @@ -2,4 +2,4 @@ var Stream = require('stream').Stream; module.exports = function(o) { return !!o && o instanceof Stream; -}; \ No newline at end of file +}; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/lib/linefeed.js b/node_modules/gulp-changed/node_modules/gulp-util/lib/linefeed.js deleted file mode 100644 index 5b0dfa4b1c..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/lib/linefeed.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = '\n'; \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/lib/log.js b/node_modules/gulp-changed/node_modules/gulp-util/lib/log.js index e33d15ed96..3986b69bdb 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/lib/log.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/lib/log.js @@ -1,8 +1,8 @@ -var colors = require('./colors'); -var date = require('./date'); +var chalk = require('chalk'); +var dateformat = require('dateformat'); module.exports = function(){ - var time = '['+colors.grey(date(new Date(), 'HH:MM:ss'))+']'; + var time = '['+chalk.grey(dateformat(new Date(), 'HH:MM:ss'))+']'; var args = Array.prototype.slice.call(arguments); args.unshift(time); console.log.apply(console, args); diff --git a/node_modules/gulp-changed/node_modules/gulp-util/lib/template.js b/node_modules/gulp-changed/node_modules/gulp-util/lib/template.js index c467820f36..4500bcca3e 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/lib/template.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/lib/template.js @@ -1,14 +1,16 @@ var template = require('lodash.template'); +var reEscape = require('lodash._reescape'); +var reEvaluate = require('lodash._reevaluate'); var reInterpolate = require('lodash._reinterpolate'); var forcedSettings = { - escape: /<%-([\s\S]+?)%>/g, - evaluate: /<%([\s\S]+?)%>/g, + escape: reEscape, + evaluate: reEvaluate, interpolate: reInterpolate }; module.exports = function(tmpl, data){ - var fn = template(tmpl, null, forcedSettings); + var fn = template(tmpl, forcedSettings); var wrapped = function(o) { if (typeof o === 'undefined' || typeof o.file === 'undefined') throw new Error('Failed to provide the current file as "file" to the template'); diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/.bin/dateformat b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/.bin/dateformat new file mode 120000 index 0000000000..bb9cf7b16c --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/.bin/dateformat @@ -0,0 +1 @@ +../dateformat/bin/cli.js \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-differ/index.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-differ/index.js new file mode 100644 index 0000000000..fbe2ed2c81 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-differ/index.js @@ -0,0 +1,7 @@ +'use strict'; +module.exports = function (arr) { + var rest = [].concat.apply([], [].slice.call(arguments, 1)); + return arr.filter(function (el) { + return rest.indexOf(el) === -1; + }); +}; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-differ/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-differ/package.json new file mode 100644 index 0000000000..bc4f4f21f3 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-differ/package.json @@ -0,0 +1,61 @@ +{ + "name": "array-differ", + "version": "1.0.0", + "description": "Create an array with values that are present in the first input array but not additional ones", + "license": "MIT", + "repository": { + "type": "git", + "url": "git://github.com/sindresorhus/array-differ" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "array", + "difference", + "diff", + "differ", + "filter", + "exclude" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "e91802976c4710eef8dea2090d48e48525cf41b1", + "bugs": { + "url": "https://github.com/sindresorhus/array-differ/issues" + }, + "homepage": "https://github.com/sindresorhus/array-differ", + "_id": "array-differ@1.0.0", + "_shasum": "eff52e3758249d33be402b8bb8e564bb2b5d4031", + "_from": "array-differ@>=1.0.0 <2.0.0", + "_npmVersion": "1.4.14", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "eff52e3758249d33be402b8bb8e564bb2b5d4031", + "tarball": "http://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-differ/readme.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-differ/readme.md new file mode 100644 index 0000000000..68f5d36074 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-differ/readme.md @@ -0,0 +1,41 @@ +# array-differ [![Build Status](https://travis-ci.org/sindresorhus/array-differ.svg?branch=master)](https://travis-ci.org/sindresorhus/array-differ) + +> Create an array with values that are present in the first input array but not additional ones + + +## Install + +```sh +$ npm install --save array-differ +``` + + +## Usage + +```js +var arrayDiffer = require('array-differ'); + +arrayDiffer([2, 3, 4], [3, 50]); +//=> [2, 4] +``` + +## API + +### arrayDiffer(input, values, [values, ...]) + +Returns the new array. + +#### input + +Type: `array` + +#### values + +Type: `array` + +Arrays of values to exclude. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-uniq/index.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-uniq/index.js new file mode 100644 index 0000000000..40f81b8a08 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-uniq/index.js @@ -0,0 +1,60 @@ +'use strict'; + +// there's 3 implementations written in increasing order of efficiency + +// 1 - no Set type is defined +function uniqNoSet(arr) { + var ret = []; + + for (var i = 0; i < arr.length; i++) { + if (ret.indexOf(arr[i]) === -1) { + ret.push(arr[i]); + } + } + + return ret; +} + +// 2 - a simple Set type is defined +function uniqSet(arr) { + var seen = new Set(); + return arr.filter(function (el) { + if (!seen.has(el)) { + seen.add(el); + return true; + } + }); +} + +// 3 - a standard Set type is defined and it has a forEach method +function uniqSetWithForEach(arr) { + var ret = []; + + (new Set(arr)).forEach(function (el) { + ret.push(el); + }); + + return ret; +} + +// V8 currently has a broken implementation +// https://github.com/joyent/node/issues/8449 +function doesForEachActuallyWork() { + var ret = false; + + (new Set([true])).forEach(function (el) { + ret = el; + }); + + return ret === true; +} + +if ('Set' in global) { + if (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) { + module.exports = uniqSetWithForEach; + } else { + module.exports = uniqSet; + } +} else { + module.exports = uniqNoSet; +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-uniq/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-uniq/package.json new file mode 100644 index 0000000000..87427915a4 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-uniq/package.json @@ -0,0 +1,66 @@ +{ + "name": "array-uniq", + "version": "1.0.2", + "description": "Create an array without duplicates", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/array-uniq" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "array", + "arr", + "set", + "uniq", + "unique", + "es6", + "duplicate", + "remove" + ], + "devDependencies": { + "es6-set": "^0.1.0", + "mocha": "*", + "require-uncached": "^1.0.2" + }, + "gitHead": "d5e311f37692dfd25ec216490df10632ce5f69f3", + "bugs": { + "url": "https://github.com/sindresorhus/array-uniq/issues" + }, + "homepage": "https://github.com/sindresorhus/array-uniq", + "_id": "array-uniq@1.0.2", + "_shasum": "5fcc373920775723cfd64d65c64bef53bf9eba6d", + "_from": "array-uniq@>=1.0.2 <2.0.0", + "_npmVersion": "2.1.5", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "5fcc373920775723cfd64d65c64bef53bf9eba6d", + "tarball": "http://registry.npmjs.org/array-uniq/-/array-uniq-1.0.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-uniq/readme.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-uniq/readme.md new file mode 100644 index 0000000000..5183d07ec1 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/array-uniq/readme.md @@ -0,0 +1,30 @@ +# array-uniq [![Build Status](https://travis-ci.org/sindresorhus/array-uniq.svg?branch=master)](https://travis-ci.org/sindresorhus/array-uniq) + +> Create an array without duplicates + +It's already pretty fast, but will be much faster when [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) becomes available in V8 (especially with large arrays). + + +## Install + +```sh +$ npm install --save array-uniq +``` + + +## Usage + +```js +var arrayUniq = require('array-uniq'); + +arrayUniq([1, 1, 2, 3, 3]); +//=> [1, 2, 3] + +arrayUniq(['foo', 'foo', 'bar', 'foo']); +//=> ['foo', 'bar'] +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/beeper/index.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/beeper/index.js new file mode 100644 index 0000000000..9c4ba28b5c --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/beeper/index.js @@ -0,0 +1,45 @@ +'use strict'; + +var BEEP_DELAY = 500; + +if (!process.stdout.isTTY || + process.argv.indexOf('--no-beep') !== -1 || + process.argv.indexOf('--beep=false') !== -1) { + module.exports = function () {}; + return; +} + +function beep() { + process.stdout.write('\u0007'); +} + +function melodicalBeep(val) { + if (val.length === 0) { + return; + } + + setTimeout(function () { + if (val.shift() === '*') { + beep(); + } + + melodicalBeep(val); + }, BEEP_DELAY); +} + +module.exports = function (val) { + if (val == null) { + beep(); + } else if (typeof val === 'number') { + beep(); + val--; + + while (val--) { + setTimeout(beep, BEEP_DELAY * val); + } + } else if (typeof val === 'string') { + melodicalBeep(val.split('')); + } else { + throw new TypeError('Not an accepted type'); + } +}; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/beeper/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/beeper/package.json new file mode 100644 index 0000000000..cd1604cb1a --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/beeper/package.json @@ -0,0 +1,67 @@ +{ + "name": "beeper", + "version": "1.0.0", + "description": "Make your terminal beep", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/beeper" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "node test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "beep", + "beeper", + "boop", + "terminal", + "term", + "cli", + "console", + "ding", + "ping", + "alert", + "gulpfriendly" + ], + "devDependencies": { + "ava": "0.0.4" + }, + "gitHead": "89534b940dfb61ed6ca5df76bf8faa4b90448f4f", + "bugs": { + "url": "https://github.com/sindresorhus/beeper/issues" + }, + "homepage": "https://github.com/sindresorhus/beeper", + "_id": "beeper@1.0.0", + "_shasum": "1ad2a27a9c7e545234119180afed61f80daaf02c", + "_from": "beeper@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.5", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "1ad2a27a9c7e545234119180afed61f80daaf02c", + "tarball": "http://registry.npmjs.org/beeper/-/beeper-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/beeper/-/beeper-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/beeper/readme.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/beeper/readme.md new file mode 100644 index 0000000000..86cf9fa358 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/beeper/readme.md @@ -0,0 +1,53 @@ +# beeper [![Build Status](https://travis-ci.org/sindresorhus/beeper.svg?branch=master)](https://travis-ci.org/sindresorhus/beeper) + +> Make your terminal beep + +Useful as an attention grabber e.g. when an error happens. + + +## Install + +```sh +$ npm install --save beeper +``` + + +## Usage + +```js +var beeper = require('beeper'); + +beeper(); +// beep one time + +beeper(3); +// beep three times + +beeper('****-*-*'); +// beep, beep, beep, beep, pause, beep, pause, beep +``` + + +## API + +It will not beep if stdout is not TTY or if the user supplies the `--no-beep` flag. + +### beeper([count|melody]) + +#### count + +Type: `number` +Default: `1` + +How many times you want it to beep. + +#### melody + +Type: `string` + +Construct your own melody by supplying a string of `*` for beep `-` for pause. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/index.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/index.js index ac1f16820d..4138a64dd9 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/index.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/index.js @@ -5,13 +5,23 @@ var stripAnsi = require('strip-ansi'); var hasAnsi = require('has-ansi'); var supportsColor = require('supports-color'); var defineProps = Object.defineProperties; -var chalk = module.exports; + +function Chalk(options) { + // detect mode if not set manually + this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled; +} + +// use bright blue on Windows as the normal blue color is illegible +if (process.platform === 'win32') { + ansiStyles.blue.open = '\u001b[94m'; +} function build(_styles) { var builder = function builder() { return applyStyle.apply(builder, arguments); }; builder._styles = _styles; + builder.enabled = this.enabled; // __proto__ is used because we must return a function, but there is // no way to create a function with a different prototype. builder.__proto__ = proto; @@ -21,14 +31,12 @@ function build(_styles) { var styles = (function () { var ret = {}; - ansiStyles.grey = ansiStyles.gray; - Object.keys(ansiStyles).forEach(function (key) { ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); ret[key] = { get: function () { - return build(this._styles.concat(key)); + return build.call(this, this._styles.concat(key)); } }; }); @@ -50,14 +58,15 @@ function applyStyle() { } } - if (!chalk.enabled || !str) { + if (!this.enabled || !str) { return str; } - /*jshint validthis: true*/ + /*jshint validthis: true */ var nestedStyles = this._styles; - for (var i = 0; i < nestedStyles.length; i++) { + var i = nestedStyles.length; + while (i--) { var code = ansiStyles[nestedStyles[i]]; // Replace any instances already present with a re-opening code // otherwise only the part of the string until said closing code @@ -74,7 +83,7 @@ function init() { Object.keys(styles).forEach(function (name) { ret[name] = { get: function () { - return build([name]); + return build.call(this, [name]); } }; }); @@ -82,14 +91,10 @@ function init() { return ret; } -defineProps(chalk, init()); - -chalk.styles = ansiStyles; -chalk.hasColor = hasAnsi; -chalk.stripColor = stripAnsi; -chalk.supportsColor = supportsColor; +defineProps(Chalk.prototype, init()); -// detect mode if not set manually -if (chalk.enabled === undefined) { - chalk.enabled = chalk.supportsColor; -} +module.exports = new Chalk(); +module.exports.styles = ansiStyles; +module.exports.hasColor = hasAnsi; +module.exports.stripColor = stripAnsi; +module.exports.supportsColor = supportsColor; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/license b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/license new file mode 100644 index 0000000000..654d0bfe94 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/has-ansi b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/has-ansi deleted file mode 100644 index c1e7413f1f..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/has-ansi +++ /dev/null @@ -1 +0,0 @@ -../has-ansi/cli.js \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/has-ansi b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/has-ansi new file mode 120000 index 0000000000..c1e7413f1f --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/has-ansi @@ -0,0 +1 @@ +../has-ansi/cli.js \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/strip-ansi b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/strip-ansi deleted file mode 100644 index b65c9f81df..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/strip-ansi +++ /dev/null @@ -1 +0,0 @@ -../strip-ansi/cli.js \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/strip-ansi b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/strip-ansi new file mode 120000 index 0000000000..b65c9f81df --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/strip-ansi @@ -0,0 +1 @@ +../strip-ansi/cli.js \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/supports-color b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/supports-color deleted file mode 100644 index af0f05efe8..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/supports-color +++ /dev/null @@ -1 +0,0 @@ -../supports-color/cli.js \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/supports-color b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/supports-color new file mode 120000 index 0000000000..af0f05efe8 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/supports-color @@ -0,0 +1 @@ +../supports-color/cli.js \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/index.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/index.js index 2d8b4726da..caf9e119eb 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/index.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/index.js @@ -1,40 +1,56 @@ 'use strict'; -var styles = module.exports; -var codes = { - reset: [0, 0], +var styles = module.exports = { + modifiers: { + reset: [0, 0], + bold: [1, 22], // 21 isn't widely supported and 22 does the same thing + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + colors: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39] + }, + bgColors: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49] + } +}; - bold: [1, 22], // 21 isn't widely supported and 22 does the same thing - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29], +// fix humans +styles.colors.grey = styles.colors.gray; - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - gray: [90, 39], +Object.keys(styles).forEach(function (groupName) { + var group = styles[groupName]; - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49] -}; + Object.keys(group).forEach(function (styleName) { + var style = group[styleName]; + + styles[styleName] = group[styleName] = { + open: '\u001b[' + style[0] + 'm', + close: '\u001b[' + style[1] + 'm' + }; + }); -Object.keys(codes).forEach(function (key) { - var val = codes[key]; - var style = styles[key] = {}; - style.open = '\u001b[' + val[0] + 'm'; - style.close = '\u001b[' + val[1] + 'm'; + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); }); diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/license b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/license new file mode 100644 index 0000000000..654d0bfe94 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/package.json index 57bd2e28ac..e670f250a7 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/package.json +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/package.json @@ -1,74 +1,80 @@ -{ - "name": "ansi-styles", - "version": "1.1.0", - "description": "ANSI escape codes for styling strings in the terminal", - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/ansi-styles" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js" - ], - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "devDependencies": { - "mocha": "*" - }, - "bugs": { - "url": "https://github.com/sindresorhus/ansi-styles/issues" - }, - "homepage": "https://github.com/sindresorhus/ansi-styles", - "_id": "ansi-styles@1.1.0", - "_shasum": "eaecbf66cd706882760b2f4691582b8f55d7a7de", - "_from": "ansi-styles@^1.1.0", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "dist": { - "shasum": "eaecbf66cd706882760b2f4691582b8f55d7a7de", - "tarball": "http://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "ansi-styles", + "version": "2.0.1", + "description": "ANSI escape codes for styling strings in the terminal", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/ansi-styles" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "da6541334e1681cb803f891fab8abf4313cc4bc1", + "bugs": { + "url": "https://github.com/sindresorhus/ansi-styles/issues" + }, + "homepage": "https://github.com/sindresorhus/ansi-styles", + "_id": "ansi-styles@2.0.1", + "_shasum": "b033f57f93e2d28adeb8bc11138fa13da0fd20a3", + "_from": "ansi-styles@>=2.0.1 <3.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "b033f57f93e2d28adeb8bc11138fa13da0fd20a3", + "tarball": "http://registry.npmjs.org/ansi-styles/-/ansi-styles-2.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/readme.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/readme.md index cd7415389c..89ec6a7c1e 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/readme.md +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/readme.md @@ -1,70 +1,86 @@ -# ansi-styles [![Build Status](https://travis-ci.org/sindresorhus/ansi-styles.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-styles) - -> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal - -You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings. - -![screenshot](screenshot.png) - - -## Install - -```sh -$ npm install --save ansi-styles -``` - - -## Usage - -```js -var ansi = require('ansi-styles'); - -console.log(ansi.green.open + 'Hello world!' + ansi.green.close); -``` - - -## API - -Each style has an `open` and `close` property. - - -## Styles - -### General - -- `reset` -- `bold` -- `dim` -- `italic` *(not widely supported)* -- `underline` -- `inverse` -- `hidden` -- `strikethrough` *(not widely supported)* - -### Text colors - -- `black` -- `red` -- `green` -- `yellow` -- `blue` -- `magenta` -- `cyan` -- `white` -- `gray` - -### Background colors - -- `bgBlack` -- `bgRed` -- `bgGreen` -- `bgYellow` -- `bgBlue` -- `bgMagenta` -- `bgCyan` -- `bgWhite` - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# ansi-styles [![Build Status](https://travis-ci.org/sindresorhus/ansi-styles.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-styles) + +> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal + +You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings. + +![](screenshot.png) + + +## Install + +```sh +$ npm install --save ansi-styles +``` + + +## Usage + +```js +var ansi = require('ansi-styles'); + +console.log(ansi.green.open + 'Hello world!' + ansi.green.close); +``` + + +## API + +Each style has an `open` and `close` property. + + +## Styles + +### Modifiers + +- `reset` +- `bold` +- `dim` +- `italic` *(not widely supported)* +- `underline` +- `inverse` +- `hidden` +- `strikethrough` *(not widely supported)* + +### Colors + +- `black` +- `red` +- `green` +- `yellow` +- `blue` +- `magenta` +- `cyan` +- `white` +- `gray` + +### Background colors + +- `bgBlack` +- `bgRed` +- `bgGreen` +- `bgYellow` +- `bgBlue` +- `bgMagenta` +- `bgCyan` +- `bgWhite` + + +## Advanced usage + +By default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. + +- `ansi.modifiers` +- `ansi.colors` +- `ansi.bgColors` + + +###### Example + +```js +console.log(ansi.colors.green.open); +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/license b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/license new file mode 100644 index 0000000000..654d0bfe94 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/package.json index 0f92f75c73..749f5ded2a 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/package.json +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/package.json @@ -1,69 +1,70 @@ -{ - "name": "escape-string-regexp", - "version": "1.0.2", - "description": "Escape RegExp special characters", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/sindresorhus/escape-string-regexp" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.8.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js" - ], - "keywords": [ - "regex", - "regexp", - "re", - "regular", - "expression", - "escape", - "string", - "str", - "special", - "characters" - ], - "devDependencies": { - "mocha": "*" - }, - "gitHead": "0587ee0ee03ea3fcbfa3c15cf67b47f214e20987", - "bugs": { - "url": "https://github.com/sindresorhus/escape-string-regexp/issues" - }, - "homepage": "https://github.com/sindresorhus/escape-string-regexp", - "_id": "escape-string-regexp@1.0.2", - "_shasum": "4dbc2fe674e71949caf3fb2695ce7f2dc1d9a8d1", - "_from": "escape-string-regexp@^1.0.0", - "_npmVersion": "1.4.23", - "_npmUser": { - "name": "jbnicolai", - "email": "jappelman@xebia.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - { - "name": "jbnicolai", - "email": "jappelman@xebia.com" - } - ], - "dist": { - "shasum": "4dbc2fe674e71949caf3fb2695ce7f2dc1d9a8d1", - "tarball": "http://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "escape-string-regexp", + "version": "1.0.3", + "description": "Escape RegExp special characters", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/escape-string-regexp" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.8.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "regex", + "regexp", + "re", + "regular", + "expression", + "escape", + "string", + "str", + "special", + "characters" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "1e446e6b4449b5f1f8868cd31bf8fd25ee37fb4b", + "bugs": { + "url": "https://github.com/sindresorhus/escape-string-regexp/issues" + }, + "homepage": "https://github.com/sindresorhus/escape-string-regexp", + "_id": "escape-string-regexp@1.0.3", + "_shasum": "9e2d8b25bc2555c3336723750e03f099c2735bb5", + "_from": "escape-string-regexp@>=1.0.2 <2.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "9e2d8b25bc2555c3336723750e03f099c2735bb5", + "tarball": "http://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/readme.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/readme.md index 000b53755a..808a963a86 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/readme.md +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/readme.md @@ -1,27 +1,27 @@ -# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp) - -> Escape RegExp special characters - - -## Install - -```sh -$ npm install --save escape-string-regexp -``` - - -## Usage - -```js -var escapeStringRegexp = require('escape-string-regexp'); - -var escapedString = escapeStringRegexp('how much $ for a unicorn?'); -//=> how much \$ for a unicorn\? - -new RegExp(escapedString); -``` - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp) + +> Escape RegExp special characters + + +## Install + +```sh +$ npm install --save escape-string-regexp +``` + + +## Usage + +```js +var escapeStringRegexp = require('escape-string-regexp'); + +var escapedString = escapeStringRegexp('how much $ for a unicorn?'); +//=> how much \$ for a unicorn\? + +new RegExp(escapedString); +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/cli.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/cli.js old mode 100644 new mode 100755 index e0956fcc72..0386a82423 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/cli.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/cli.js @@ -1,29 +1,21 @@ #!/usr/bin/env node 'use strict'; +var stdin = require('get-stdin'); var pkg = require('./package.json'); var hasAnsi = require('./'); -var input = process.argv[2]; - -function stdin(cb) { - var ret = ''; - process.stdin.setEncoding('utf8'); - process.stdin.on('data', function (data) { - ret += data; - }); - process.stdin.on('end', function () { - cb(ret); - }); -} +var argv = process.argv.slice(2); +var input = argv[0]; function help() { console.log([ - pkg.description, '', - 'Usage', - ' $ has-ansi ', - ' $ echo | has-ansi', + ' ' + pkg.description, + '', + ' Usage', + ' has-ansi ', + ' echo | has-ansi', '', - 'Exits with code 0 if input has ANSI escape codes and 1 if not' + ' Exits with code 0 if input has ANSI escape codes and 1 if not' ].join('\n')); } @@ -31,12 +23,12 @@ function init(data) { process.exit(hasAnsi(data) ? 0 : 1); } -if (process.argv.indexOf('--help') !== -1) { +if (argv.indexOf('--help') !== -1) { help(); return; } -if (process.argv.indexOf('--version') !== -1) { +if (argv.indexOf('--version') !== -1) { console.log(pkg.version); return; } diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/license b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/license new file mode 100644 index 0000000000..654d0bfe94 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js index 783c5c7bb6..2fcdd1e472 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js @@ -1,4 +1,4 @@ 'use strict'; module.exports = function () { - return /\u001b\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]/g; + return /(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/g; }; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/license b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/license new file mode 100644 index 0000000000..654d0bfe94 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json index 4bb4051d59..8d7033012c 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json @@ -1,79 +1,86 @@ -{ - "name": "ansi-regex", - "version": "0.2.1", - "description": "Regular expression for matching ANSI escape codes", - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/ansi-regex" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js" - ], - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "devDependencies": { - "mocha": "*" - }, - "bugs": { - "url": "https://github.com/sindresorhus/ansi-regex/issues" - }, - "homepage": "https://github.com/sindresorhus/ansi-regex", - "_id": "ansi-regex@0.2.1", - "_shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9", - "_from": "ansi-regex@^0.2.0", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "dist": { - "shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9", - "tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "ansi-regex", + "version": "1.1.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/ansi-regex" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha test/test.js", + "view-supported": "node test/viewCodes.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "47fb974630af70998157b30fad6eb5e5bd7c7cd6", + "bugs": { + "url": "https://github.com/sindresorhus/ansi-regex/issues" + }, + "homepage": "https://github.com/sindresorhus/ansi-regex", + "_id": "ansi-regex@1.1.1", + "_shasum": "41c847194646375e6a1a5d10c3ca054ef9fc980d", + "_from": "ansi-regex@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "41c847194646375e6a1a5d10c3ca054ef9fc980d", + "tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md index 95837d0c5c..ae876e7292 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md @@ -1,33 +1,33 @@ -# ansi-regex [![Build Status](https://travis-ci.org/sindresorhus/ansi-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-regex) - -> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -```sh -$ npm install --save ansi-regex -``` - - -## Usage - -```js -var ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001b[4mcake\u001b[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001b[4mcake\u001b[0m'.match(ansiRegex()); -//=> ['\u001b[4m', '\u001b[0m'] -``` - -*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.* - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# ansi-regex [![Build Status](https://travis-ci.org/sindresorhus/ansi-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-regex) + +> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +```sh +$ npm install --save ansi-regex +``` + + +## Usage + +```js +var ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001b[4mcake\u001b[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001b[4mcake\u001b[0m'.match(ansiRegex()); +//=> ['\u001b[4m', '\u001b[0m'] +``` + +*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.* + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/index.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/index.js new file mode 100644 index 0000000000..0f1aeb3df4 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/index.js @@ -0,0 +1,49 @@ +'use strict'; + +module.exports = function (cb) { + var stdin = process.stdin; + var ret = ''; + + if (stdin.isTTY) { + setImmediate(cb, ''); + return; + } + + stdin.setEncoding('utf8'); + + stdin.on('readable', function () { + var chunk; + + while (chunk = stdin.read()) { + ret += chunk; + } + }); + + stdin.on('end', function () { + cb(ret); + }); +}; + +module.exports.buffer = function (cb) { + var stdin = process.stdin; + var ret = []; + var len = 0; + + if (stdin.isTTY) { + setImmediate(cb, new Buffer('')); + return; + } + + stdin.on('readable', function () { + var chunk; + + while (chunk = stdin.read()) { + ret.push(chunk); + len += chunk.length; + } + }); + + stdin.on('end', function () { + cb(Buffer.concat(ret, len)); + }); +}; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/package.json new file mode 100644 index 0000000000..e0e5c64a0f --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/package.json @@ -0,0 +1,64 @@ +{ + "name": "get-stdin", + "version": "4.0.1", + "description": "Easier stdin", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/get-stdin" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "node test.js && node test-buffer.js && echo unicorns | node test-real.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "std", + "stdin", + "stdio", + "concat", + "buffer", + "stream", + "process", + "stream" + ], + "devDependencies": { + "ava": "0.0.4", + "buffer-equal": "0.0.1" + }, + "gitHead": "65c744975229b25d6cc5c7546f49b6ad9099553f", + "bugs": { + "url": "https://github.com/sindresorhus/get-stdin/issues" + }, + "homepage": "https://github.com/sindresorhus/get-stdin", + "_id": "get-stdin@4.0.1", + "_shasum": "b968c6b0a04384324902e8bf1a5df32579a450fe", + "_from": "get-stdin@>=4.0.1 <5.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "b968c6b0a04384324902e8bf1a5df32579a450fe", + "tarball": "http://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/readme.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/readme.md new file mode 100644 index 0000000000..bc1d32a8ad --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/readme.md @@ -0,0 +1,44 @@ +# get-stdin [![Build Status](https://travis-ci.org/sindresorhus/get-stdin.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stdin) + +> Easier stdin + + +## Install + +```sh +$ npm install --save get-stdin +``` + + +## Usage + +```js +// example.js +var stdin = require('get-stdin'); + +stdin(function (data) { + console.log(data); + //=> unicorns +}); +``` + +```sh +$ echo unicorns | node example.js +unicorns +``` + + +## API + +### stdin(callback) + +Get `stdin` as a string. + +### stdin.buffer(callback) + +Get `stdin` as a buffer. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/package.json index 0b007875fc..43582f8708 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/package.json +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/package.json @@ -1,85 +1,92 @@ -{ - "name": "has-ansi", - "version": "0.1.0", - "description": "Check if a string has ANSI escape codes", - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/has-ansi" - }, - "bin": { - "has-ansi": "cli.js" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js", - "cli.js" - ], - "keywords": [ - "cli", - "bin", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "string", - "tty", - "escape", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern", - "has" - ], - "dependencies": { - "ansi-regex": "^0.2.0" - }, - "devDependencies": { - "mocha": "*" - }, - "bugs": { - "url": "https://github.com/sindresorhus/has-ansi/issues" - }, - "homepage": "https://github.com/sindresorhus/has-ansi", - "_id": "has-ansi@0.1.0", - "_shasum": "84f265aae8c0e6a88a12d7022894b7568894c62e", - "_from": "has-ansi@^0.1.0", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "dist": { - "shasum": "84f265aae8c0e6a88a12d7022894b7568894c62e", - "tarball": "http://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "has-ansi", + "version": "1.0.3", + "description": "Check if a string has ANSI escape codes", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/has-ansi" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "bin": { + "has-ansi": "cli.js" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js", + "cli.js" + ], + "keywords": [ + "cli", + "bin", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern", + "has" + ], + "dependencies": { + "ansi-regex": "^1.1.0", + "get-stdin": "^4.0.1" + }, + "devDependencies": { + "mocha": "*" + }, + "gitHead": "416428ed16f8e9718aec54cea083173af6019917", + "bugs": { + "url": "https://github.com/sindresorhus/has-ansi/issues" + }, + "homepage": "https://github.com/sindresorhus/has-ansi", + "_id": "has-ansi@1.0.3", + "_shasum": "c0b5b1615d9e382b0ff67169d967b425e48ca538", + "_from": "has-ansi@>=1.0.3 <2.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "c0b5b1615d9e382b0ff67169d967b425e48ca538", + "tarball": "http://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/readme.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/readme.md index aaaef959f2..0fa149a82a 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/readme.md +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/readme.md @@ -1,45 +1,45 @@ -# has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi) - -> Check if a string has [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -```sh -$ npm install --save has-ansi -``` - - -## Usage - -```js -var hasAnsi = require('has-ansi'); - -hasAnsi('\u001b[4mcake\u001b[0m'); -//=> true - -hasAnsi('cake'); -//=> false -``` - - -## CLI - -```sh -$ npm install --global has-ansi -``` - -``` -$ has-ansi --help - -Usage - $ has-ansi - $ echo | has-ansi - -Exits with code 0 if input has ANSI escape codes and 1 if not -``` - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi) + +> Check if a string has [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +```sh +$ npm install --save has-ansi +``` + + +## Usage + +```js +var hasAnsi = require('has-ansi'); + +hasAnsi('\u001b[4mcake\u001b[0m'); +//=> true + +hasAnsi('cake'); +//=> false +``` + + +## CLI + +```sh +$ npm install --global has-ansi +``` + +``` +$ has-ansi --help + + Usage + has-ansi + echo | has-ansi + + Exits with code 0 if input has ANSI escape codes and 1 if not +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/cli.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/cli.js old mode 100644 new mode 100755 index 602ae00e8f..b83f63b907 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/cli.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/cli.js @@ -2,38 +2,46 @@ 'use strict'; var fs = require('fs'); var pkg = require('./package.json'); -var strip = require('./'); -var input = process.argv[2]; +var stripAnsi = require('./'); +var argv = process.argv.slice(2); +var input = argv[0]; function help() { console.log([ - pkg.description, '', - 'Usage', - ' $ strip-ansi > ', - ' $ cat | strip-ansi > ', + ' ' + pkg.description, '', - 'Example', - ' $ strip-ansi unicorn.txt > unicorn-stripped.txt' + ' Usage', + ' strip-ansi > ', + ' cat | strip-ansi > ', + '', + ' Example', + ' strip-ansi unicorn.txt > unicorn-stripped.txt' ].join('\n')); } -if (process.argv.indexOf('--help') !== -1) { +function init(data) { + process.stdout.write(stripAnsi(data)); +} + +if (argv.indexOf('--help') !== -1) { help(); return; } -if (process.argv.indexOf('--version') !== -1) { +if (argv.indexOf('--version') !== -1) { console.log(pkg.version); return; } -if (input) { - process.stdout.write(strip(fs.readFileSync(input, 'utf8'))); +if (!input && process.stdin.isTTY) { + help(); return; } -process.stdin.setEncoding('utf8'); -process.stdin.on('data', function (data) { - process.stdout.write(strip(data)); -}); +if (input) { + init(fs.readFileSync(input, 'utf8')); +} else { + process.stdin.setEncoding('utf8'); + process.stdin.on('data', init); +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js index 783c5c7bb6..2fcdd1e472 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js @@ -1,4 +1,4 @@ 'use strict'; module.exports = function () { - return /\u001b\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]/g; + return /(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/g; }; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/license b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/license new file mode 100644 index 0000000000..654d0bfe94 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json index 3968113375..8d7033012c 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json @@ -1,79 +1,86 @@ -{ - "name": "ansi-regex", - "version": "0.2.1", - "description": "Regular expression for matching ANSI escape codes", - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/ansi-regex" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js" - ], - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "devDependencies": { - "mocha": "*" - }, - "bugs": { - "url": "https://github.com/sindresorhus/ansi-regex/issues" - }, - "homepage": "https://github.com/sindresorhus/ansi-regex", - "_id": "ansi-regex@0.2.1", - "_shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9", - "_from": "ansi-regex@^0.2.1", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "dist": { - "shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9", - "tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "ansi-regex", + "version": "1.1.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/ansi-regex" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha test/test.js", + "view-supported": "node test/viewCodes.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "47fb974630af70998157b30fad6eb5e5bd7c7cd6", + "bugs": { + "url": "https://github.com/sindresorhus/ansi-regex/issues" + }, + "homepage": "https://github.com/sindresorhus/ansi-regex", + "_id": "ansi-regex@1.1.1", + "_shasum": "41c847194646375e6a1a5d10c3ca054ef9fc980d", + "_from": "ansi-regex@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "41c847194646375e6a1a5d10c3ca054ef9fc980d", + "tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md index 95837d0c5c..ae876e7292 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md @@ -1,33 +1,33 @@ -# ansi-regex [![Build Status](https://travis-ci.org/sindresorhus/ansi-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-regex) - -> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -```sh -$ npm install --save ansi-regex -``` - - -## Usage - -```js -var ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001b[4mcake\u001b[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001b[4mcake\u001b[0m'.match(ansiRegex()); -//=> ['\u001b[4m', '\u001b[0m'] -``` - -*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.* - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# ansi-regex [![Build Status](https://travis-ci.org/sindresorhus/ansi-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-regex) + +> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +```sh +$ npm install --save ansi-regex +``` + + +## Usage + +```js +var ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001b[4mcake\u001b[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001b[4mcake\u001b[0m'.match(ansiRegex()); +//=> ['\u001b[4m', '\u001b[0m'] +``` + +*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.* + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/package.json index 9f7b3e85b9..44c71ffb20 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/package.json +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/package.json @@ -1,84 +1,89 @@ -{ - "name": "strip-ansi", - "version": "0.3.0", - "description": "Strip ANSI escape codes", - "license": "MIT", - "bin": { - "strip-ansi": "cli.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/strip-ansi" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js", - "cli.js" - ], - "keywords": [ - "strip", - "trim", - "remove", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-regex": "^0.2.1" - }, - "devDependencies": { - "mocha": "*" - }, - "bugs": { - "url": "https://github.com/sindresorhus/strip-ansi/issues" - }, - "homepage": "https://github.com/sindresorhus/strip-ansi", - "_id": "strip-ansi@0.3.0", - "_shasum": "25f48ea22ca79187f3174a4db8759347bb126220", - "_from": "strip-ansi@^0.3.0", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "dist": { - "shasum": "25f48ea22ca79187f3174a4db8759347bb126220", - "tarball": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "strip-ansi", + "version": "2.0.1", + "description": "Strip ANSI escape codes", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/strip-ansi" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "bin": { + "strip-ansi": "cli.js" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js", + "cli.js" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^1.0.0" + }, + "devDependencies": { + "mocha": "*" + }, + "gitHead": "1eff0936c01f89efa312d9d51deed137259871a1", + "bugs": { + "url": "https://github.com/sindresorhus/strip-ansi/issues" + }, + "homepage": "https://github.com/sindresorhus/strip-ansi", + "_id": "strip-ansi@2.0.1", + "_shasum": "df62c1aa94ed2f114e1d0f21fd1d50482b79a60e", + "_from": "strip-ansi@>=2.0.1 <3.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "dist": { + "shasum": "df62c1aa94ed2f114e1d0f21fd1d50482b79a60e", + "tarball": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/readme.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/readme.md index f16759a3ca..53ec26436c 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/readme.md +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/readme.md @@ -1,43 +1,43 @@ -# strip-ansi [![Build Status](https://travis-ci.org/sindresorhus/strip-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-ansi) - -> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -```sh -$ npm install --save strip-ansi -``` - - -## Usage - -```js -var stripAnsi = require('strip-ansi'); - -stripAnsi('\x1b[4mcake\x1b[0m'); -//=> 'cake' -``` - - -## CLI - -```sh -$ npm install --global strip-ansi -``` - -```sh -$ strip-ansi --help - -Usage - $ strip-ansi > - $ cat | strip-ansi > - -Example - $ strip-ansi unicorn.txt > unicorn-stripped.txt -``` - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# strip-ansi [![Build Status](https://travis-ci.org/sindresorhus/strip-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-ansi) + +> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +```sh +$ npm install --save strip-ansi +``` + + +## Usage + +```js +var stripAnsi = require('strip-ansi'); + +stripAnsi('\u001b[4mcake\u001b[0m'); +//=> 'cake' +``` + + +## CLI + +```sh +$ npm install --global strip-ansi +``` + +```sh +$ strip-ansi --help + + Usage + strip-ansi > + cat | strip-ansi > + + Example + strip-ansi unicorn.txt > unicorn-stripped.txt +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/cli.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/cli.js old mode 100644 new mode 100755 index 0617971e6f..e746987666 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/cli.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/cli.js @@ -2,25 +2,26 @@ 'use strict'; var pkg = require('./package.json'); var supportsColor = require('./'); -var input = process.argv[2]; +var argv = process.argv.slice(2); function help() { console.log([ - pkg.description, '', - 'Usage', - ' $ supports-color', + ' ' + pkg.description, '', - 'Exits with code 0 if color is supported and 1 if not' + ' Usage', + ' supports-color', + '', + ' Exits with code 0 if color is supported and 1 if not' ].join('\n')); } -if (!input || process.argv.indexOf('--help') !== -1) { +if (argv.indexOf('--help') !== -1) { help(); return; } -if (process.argv.indexOf('--version') !== -1) { +if (argv.indexOf('--version') !== -1) { console.log(pkg.version); return; } diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/index.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/index.js index 092d0baef6..a17196485d 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/index.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/index.js @@ -1,10 +1,21 @@ 'use strict'; +var argv = process.argv; + module.exports = (function () { - if (process.argv.indexOf('--no-color') !== -1) { + if ('FORCE_COLOR' in process.env) { + return true; + } + + if (argv.indexOf('--no-color') !== -1 || + argv.indexOf('--no-colors') !== -1 || + argv.indexOf('--color=false') !== -1) { return false; } - if (process.argv.indexOf('--color') !== -1) { + if (argv.indexOf('--color') !== -1 || + argv.indexOf('--colors') !== -1 || + argv.indexOf('--color=true') !== -1 || + argv.indexOf('--color=always') !== -1) { return true; } diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/license b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/license new file mode 100644 index 0000000000..654d0bfe94 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/package.json index a870398a5a..0a52c0d1ed 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/package.json +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/package.json @@ -1,78 +1,85 @@ -{ - "name": "supports-color", - "version": "0.2.0", - "description": "Detect whether a terminal supports color", - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/supports-color" - }, - "bin": { - "supports-color": "cli.js" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js", - "cli.js" - ], - "keywords": [ - "cli", - "bin", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "ansi", - "styles", - "tty", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "support", - "supports", - "capability", - "detect" - ], - "devDependencies": { - "mocha": "*" - }, - "bugs": { - "url": "https://github.com/sindresorhus/supports-color/issues" - }, - "homepage": "https://github.com/sindresorhus/supports-color", - "_id": "supports-color@0.2.0", - "_shasum": "d92de2694eb3f67323973d7ae3d8b55b4c22190a", - "_from": "supports-color@^0.2.0", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "dist": { - "shasum": "d92de2694eb3f67323973d7ae3d8b55b4c22190a", - "tarball": "http://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "supports-color", + "version": "1.3.1", + "description": "Detect whether a terminal supports color", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/supports-color" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "bin": { + "supports-color": "cli.js" + }, + "engines": { + "node": ">=0.8.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js", + "cli.js" + ], + "keywords": [ + "cli", + "bin", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "ansi", + "styles", + "tty", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "support", + "supports", + "capability", + "detect" + ], + "devDependencies": { + "mocha": "*", + "require-uncached": "^1.0.2" + }, + "gitHead": "09f1b4c336cee7269b4c8b3a8880054a23fcb35e", + "bugs": { + "url": "https://github.com/sindresorhus/supports-color/issues" + }, + "homepage": "https://github.com/sindresorhus/supports-color", + "_id": "supports-color@1.3.1", + "_shasum": "15758df09d8ff3b4acc307539fabe27095e1042d", + "_from": "supports-color@>=1.3.0 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "dist": { + "shasum": "15758df09d8ff3b4acc307539fabe27095e1042d", + "tarball": "http://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/readme.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/readme.md index 1f1c32fffd..fe6016f9d0 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/readme.md +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/readme.md @@ -1,44 +1,46 @@ -# supports-color [![Build Status](https://travis-ci.org/sindresorhus/supports-color.svg?branch=master)](https://travis-ci.org/sindresorhus/supports-color) - -> Detect whether a terminal supports color - - -## Install - -```sh -$ npm install --save supports-color -``` - - -## Usage - -```js -var supportsColor = require('supports-color'); - -if (supportsColor) { - console.log('Terminal supports color'); -} -``` - -It obeys the `--color` and `--no-color` CLI flags. - - -## CLI - -```sh -$ npm install --global supports-color -``` - -```sh -$ supports-color --help - -Usage - $ supports-color - -# Exits with code 0 if color is supported and 1 if not -``` - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# supports-color [![Build Status](https://travis-ci.org/sindresorhus/supports-color.svg?branch=master)](https://travis-ci.org/sindresorhus/supports-color) + +> Detect whether a terminal supports color + + +## Install + +``` +$ npm install --save supports-color +``` + + +## Usage + +```js +var supportsColor = require('supports-color'); + +if (supportsColor) { + console.log('Terminal supports color'); +} +``` + +It obeys the `--color` and `--no-color` CLI flags. + +For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`. + + +## CLI + +``` +$ npm install --global supports-color +``` + +``` +$ supports-color --help + + Usage + supports-color + + Exits with code 0 if color is supported and 1 if not +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/package.json index da63134db9..93055c07c0 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/package.json +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/package.json @@ -1,82 +1,83 @@ -{ - "name": "chalk", - "version": "0.5.1", - "description": "Terminal string styling done right. Created because the `colors` module does some really horrible things.", - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/chalk" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - { - "name": "jbnicolai", - "email": "jappelman@xebia.com" - } - ], - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha", - "bench": "matcha benchmark.js" - }, - "files": [ - "index.js" - ], - "keywords": [ - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "ansi", - "styles", - "tty", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-styles": "^1.1.0", - "escape-string-regexp": "^1.0.0", - "has-ansi": "^0.1.0", - "strip-ansi": "^0.3.0", - "supports-color": "^0.2.0" - }, - "devDependencies": { - "matcha": "^0.5.0", - "mocha": "*" - }, - "gitHead": "994758f01293f1fdcf63282e9917cb9f2cfbdaac", - "bugs": { - "url": "https://github.com/sindresorhus/chalk/issues" - }, - "homepage": "https://github.com/sindresorhus/chalk", - "_id": "chalk@0.5.1", - "_shasum": "663b3a648b68b55d04690d49167aa837858f2174", - "_from": "chalk@^0.5.0", - "_npmVersion": "1.4.14", - "_npmUser": { - "name": "jbnicolai", - "email": "jappelman@xebia.com" - }, - "dist": { - "shasum": "663b3a648b68b55d04690d49167aa837858f2174", - "tarball": "http://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "chalk", + "version": "1.0.0", + "description": "Terminal string styling done right. Much color.", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/chalk" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha", + "bench": "matcha benchmark.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "ansi", + "styles", + "tty", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-styles": "^2.0.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^1.0.3", + "strip-ansi": "^2.0.1", + "supports-color": "^1.3.0" + }, + "devDependencies": { + "matcha": "^0.6.0", + "mocha": "*" + }, + "gitHead": "8864d3563313ed15574a38dd5c9d5966080c46ce", + "bugs": { + "url": "https://github.com/sindresorhus/chalk/issues" + }, + "homepage": "https://github.com/sindresorhus/chalk", + "_id": "chalk@1.0.0", + "_shasum": "b3cf4ed0ff5397c99c75b8f679db2f52831f96dc", + "_from": "chalk@>=1.0.0 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "dist": { + "shasum": "b3cf4ed0ff5397c99c75b8f679db2f52831f96dc", + "tarball": "http://registry.npmjs.org/chalk/-/chalk-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/chalk/-/chalk-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/readme.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/readme.md index 8151530601..43c7064335 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/readme.md +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/chalk/readme.md @@ -1,175 +1,197 @@ -# chalk - -> Terminal string styling done right - -[![Build Status](https://travis-ci.org/sindresorhus/chalk.svg?branch=master)](https://travis-ci.org/sindresorhus/chalk) -![](http://img.shields.io/badge/unicorn-approved-ff69b4.svg) - -[colors.js](https://github.com/Marak/colors.js) is currently the most popular string styling module, but it has serious deficiencies like extending String.prototype which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough. - -**Chalk is a clean and focused alternative.** - -![screenshot](https://github.com/sindresorhus/ansi-styles/raw/master/screenshot.png) - - -## Why - -- Highly performant -- Doesn't extend String.prototype -- Expressive API -- Ability to nest styles -- Clean and focused -- Auto-detects color support -- Actively maintained -- [Used by 1000+ modules](https://npmjs.org/browse/depended/chalk) - - -## Install - -```sh -$ npm install --save chalk -``` - - -## Usage - -Chalk comes with an easy to use composable API where you just chain and nest the styles you want. - -```js -var chalk = require('chalk'); - -// style a string -console.log( chalk.blue('Hello world!') ); - -// combine styled and normal strings -console.log( chalk.blue('Hello'), 'World' + chalk.red('!') ); - -// compose multiple styles using the chainable API -console.log( chalk.blue.bgRed.bold('Hello world!') ); - -// pass in multiple arguments -console.log( chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz') ); - -// nest styles -console.log( chalk.red('Hello', chalk.underline.bgBlue('world') + '!') ); - -// nest styles of the same type even (color, underline, background) -console.log( chalk.green('I am a green line ' + chalk.blue('with a blue substring') + ' that becomes green again!') ); -``` - -Easily define your own themes. - -```js -var chalk = require('chalk'); -var error = chalk.bold.red; -console.log(error('Error!')); -``` - -Take advantage of console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data). - -```js -var name = 'Sindre'; -console.log(chalk.green('Hello %s'), name); -//=> Hello Sindre -``` - - -## API - -### chalk.` - - -
    -

    Code coverage report for All files

    -

    - - Statements: 100% (111 / 111)      - - - Branches: 100% (84 / 84)      - - - Functions: 100% (20 / 20)      - - - Lines: 100% (102 / 102)      - - Ignored: none      -

    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FileStatementsBranchesFunctionsLines
    vinyl/100%(89 / 89)100%(76 / 76)100%(15 / 15)100%(82 / 82)
    vinyl/lib/100%(22 / 22)100%(8 / 8)100%(5 / 5)100%(20 / 20)
    -
    -
    - - - - - - - - diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/prettify.css b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/prettify.css deleted file mode 100644 index 5181e157c9..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/prettify.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/prettify.js deleted file mode 100644 index ef51e03866..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/prettify.js +++ /dev/null @@ -1 +0,0 @@ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/index.html b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/index.html deleted file mode 100644 index e4f84d2346..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/index.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - Code coverage report for vinyl/ - - - - - - - -
    -

    Code coverage report for vinyl/

    -

    - - Statements: 100% (89 / 89)      - - - Branches: 100% (76 / 76)      - - - Functions: 100% (15 / 15)      - - - Lines: 100% (82 / 82)      - - Ignored: none      -

    -
    All files » vinyl/
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FileStatementsBranchesFunctionsLines
    index.js100%(89 / 89)100%(76 / 76)100%(15 / 15)100%(82 / 82)
    -
    -
    - - - - - - - - diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/index.js.html b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/index.js.html deleted file mode 100644 index f47d9b3794..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/index.js.html +++ /dev/null @@ -1,847 +0,0 @@ - - - - Code coverage report for vinyl/index.js - - - - - - - -
    -

    Code coverage report for vinyl/index.js

    -

    - - Statements: 100% (89 / 89)      - - - Branches: 100% (76 / 76)      - - - Functions: 100% (15 / 15)      - - - Lines: 100% (82 / 82)      - - Ignored: none      -

    -
    All files » vinyl/ » index.js
    -
    -
    -
    
    -
    -
    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 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -1761 -1 -1 -1 -1 -1 -1 -1 -1 -  -1 -73 -  -  -73 -73 -  -  -73 -73 -  -  -  -73 -  -  -73 -  -  -1 -26 -  -  -1 -29 -  -  -1 -6 -  -  -  -1 -3 -  -  -1 -14 -2 -  -  -  -12 -7 -  -  -  -  -5 -5 -  -  -  -14 -14 -1 -1 -13 -6 -  -  -14 -  -  -  -  -  -  -  -  -14 -  -75 -  -  -70 -  -5 -  -14 -  -  -1 -6 -6 -  -6 -2 -  -4 -2 -1 -  -1 -  -2 -  -  -  -2 -2 -  -  -1 -6 -  -  -6 -  -6 -4 -  -  -6 -3 -  -  -6 -1 -  -  -6 -  -  -  -  -1 -  -99 -  -  -78 -1 -  -77 -  -  -  -  -1 -  -7 -6 -5 -  -  -1 -  -  -  -1 -  -46 -  -  -9 -  -  -8 -5 -  -  -  -  -1 - 
    var path = require('path');
    -var clone = require('lodash').clone;
    -var cloneStats = require('clone-stats');
    -var cloneBuffer = require('./lib/cloneBuffer');
    -var isBuffer = require('./lib/isBuffer');
    -var isStream = require('./lib/isStream');
    -var isNull = require('./lib/isNull');
    -var inspectStream = require('./lib/inspectStream');
    -var Stream = require('stream');
    - 
    -function File(file) {
    -  if (!file) file = {};
    - 
    -  // record path change
    -  var history = file.path ? [file.path] : file.history;
    -  this.history = history || [];
    - 
    -  // TODO: should this be moved to vinyl-fs?
    -  this.cwd = file.cwd || process.cwd();
    -  this.base = file.base || this.cwd;
    - 
    -  // stat = fs stats object
    -  // TODO: should this be moved to vinyl-fs?
    -  this.stat = file.stat || null;
    - 
    -  // contents = stream, buffer, or null if not read
    -  this.contents = file.contents || null;
    -}
    - 
    -File.prototype.isBuffer = function() {
    -  return isBuffer(this.contents);
    -};
    - 
    -File.prototype.isStream = function() {
    -  return isStream(this.contents);
    -};
    - 
    -File.prototype.isNull = function() {
    -  return isNull(this.contents);
    -};
    - 
    -// TODO: should this be moved to vinyl-fs?
    -File.prototype.isDirectory = function() {
    -  return this.isNull() && this.stat && this.stat.isDirectory();
    -};
    - 
    -File.prototype.clone = function(opt) {
    -  if (typeof opt === 'boolean') {
    -    opt = {
    -      deep: opt,
    -      contents: true
    -    };
    -  } else if (!opt) {
    -    opt = {
    -      deep: false,
    -      contents: true
    -    };
    -  } else {
    -    opt.deep = opt.deep === true;
    -    opt.contents = opt.contents !== false;
    -  }
    - 
    -  // clone our file contents
    -  var contents;
    -  if (this.isStream()) {
    -    contents = this.contents.pipe(new Stream.PassThrough());
    -    this.contents = this.contents.pipe(new Stream.PassThrough());
    -  } else if (this.isBuffer()) {
    -    contents = opt.contents ? cloneBuffer(this.contents) : this.contents;
    -  }
    - 
    -  var file = new File({
    -    cwd: this.cwd,
    -    base: this.base,
    -    stat: (this.stat ? cloneStats(this.stat) : null),
    -    history: this.history.slice(),
    -    contents: contents
    -  });
    - 
    -  // clone our custom properties
    -  Object.keys(this).forEach(function(key) {
    -    // ignore built-in fields
    -    if (key === '_contents' || key === 'stat' ||
    -      key === 'history' || key === 'path' ||
    -      key === 'base' || key === 'cwd') {
    -      return;
    -    }
    -    file[key] = opt.deep ? clone(this[key], true) : this[key];
    -  }, this);
    -  return file;
    -};
    - 
    -File.prototype.pipe = function(stream, opt) {
    -  if (!opt) opt = {};
    -  if (typeof opt.end === 'undefined') opt.end = true;
    - 
    -  if (this.isStream()) {
    -    return this.contents.pipe(stream, opt);
    -  }
    -  if (this.isBuffer()) {
    -    if (opt.end) {
    -      stream.end(this.contents);
    -    } else {
    -      stream.write(this.contents);
    -    }
    -    return stream;
    -  }
    - 
    -  // isNull
    -  if (opt.end) stream.end();
    -  return stream;
    -};
    - 
    -File.prototype.inspect = function() {
    -  var inspect = [];
    - 
    -  // use relative path if possible
    -  var filePath = (this.base && this.path) ? this.relative : this.path;
    - 
    -  if (filePath) {
    -    inspect.push('"'+filePath+'"');
    -  }
    - 
    -  if (this.isBuffer()) {
    -    inspect.push(this.contents.inspect());
    -  }
    - 
    -  if (this.isStream()) {
    -    inspect.push(inspectStream(this.contents));
    -  }
    - 
    -  return '<File '+inspect.join(' ')+'>';
    -};
    - 
    -// virtual attributes
    -// or stuff with extra logic
    -Object.defineProperty(File.prototype, 'contents', {
    -  get: function() {
    -    return this._contents;
    -  },
    -  set: function(val) {
    -    if (!isBuffer(val) && !isStream(val) && !isNull(val)) {
    -      throw new Error('File.contents can only be a Buffer, a Stream, or null.');
    -    }
    -    this._contents = val;
    -  }
    -});
    - 
    -// TODO: should this be moved to vinyl-fs?
    -Object.defineProperty(File.prototype, 'relative', {
    -  get: function() {
    -    if (!this.base) throw new Error('No base specified! Can not get relative.');
    -    if (!this.path) throw new Error('No path specified! Can not get relative.');
    -    return path.relative(this.base, this.path);
    -  },
    -  set: function() {
    -    throw new Error('File.relative is generated from the base and path attributes. Do not modify it.');
    -  }
    -});
    - 
    -Object.defineProperty(File.prototype, 'path', {
    -  get: function() {
    -    return this.history[this.history.length - 1];
    -  },
    -  set: function(path) {
    -    if (typeof path !== 'string') throw new Error('path should be string');
    - 
    -    // record history only when path changed
    -    if (path && path !== this.path) {
    -      this.history.push(path);
    -    }
    -  }
    -});
    - 
    -module.exports = File;
    - 
    - -
    - - - - - - - - diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/cloneBuffer.js.html b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/cloneBuffer.js.html deleted file mode 100644 index db5a686f37..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/cloneBuffer.js.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - Code coverage report for vinyl/lib/cloneBuffer.js - - - - - - - -
    -

    Code coverage report for vinyl/lib/cloneBuffer.js

    -

    - - Statements: 100% (5 / 5)      - - - Branches: 100% (0 / 0)      - - - Functions: 100% (1 / 1)      - - - Lines: 100% (5 / 5)      - - Ignored: none      -

    -
    All files » vinyl/lib/ » cloneBuffer.js
    -
    -
    -
    
    -
    -
    1 -2 -3 -4 -5 -6 -7 -81 -  -1 -7 -7 -7 -  - 
    var Buffer = require('buffer').Buffer;
    - 
    -module.exports = function(buf) {
    -  var out = new Buffer(buf.length);
    -  buf.copy(out);
    -  return out;
    -};
    - 
    - -
    - - - - - - - - diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/index.html b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/index.html deleted file mode 100644 index e5389556fa..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/index.html +++ /dev/null @@ -1,402 +0,0 @@ - - - - Code coverage report for vinyl/lib/ - - - - - - - -
    -

    Code coverage report for vinyl/lib/

    -

    - - Statements: 100% (22 / 22)      - - - Branches: 100% (8 / 8)      - - - Functions: 100% (5 / 5)      - - - Lines: 100% (20 / 20)      - - Ignored: none      -

    -
    All files » vinyl/lib/
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FileStatementsBranchesFunctionsLines
    cloneBuffer.js100%(5 / 5)100%(0 / 0)100%(1 / 1)100%(5 / 5)
    inspectStream.js100%(8 / 8)100%(4 / 4)100%(1 / 1)100%(6 / 6)
    isBuffer.js100%(4 / 4)100%(2 / 2)100%(1 / 1)100%(4 / 4)
    isNull.js100%(2 / 2)100%(0 / 0)100%(1 / 1)100%(2 / 2)
    isStream.js100%(3 / 3)100%(2 / 2)100%(1 / 1)100%(3 / 3)
    -
    -
    - - - - - - - - diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/inspectStream.js.html b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/inspectStream.js.html deleted file mode 100644 index 4cc79c7d8b..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/inspectStream.js.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - Code coverage report for vinyl/lib/inspectStream.js - - - - - - - -
    -

    Code coverage report for vinyl/lib/inspectStream.js

    -

    - - Statements: 100% (8 / 8)      - - - Branches: 100% (4 / 4)      - - - Functions: 100% (1 / 1)      - - - Lines: 100% (6 / 6)      - - Ignored: none      -

    -
    All files » vinyl/lib/ » inspectStream.js
    -
    -
    -
    
    -
    -
    1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -121 -  -1 -9 -  -7 -  -7 -  -7 -  - 
    var isStream = require('./isStream');
    - 
    -module.exports = function(stream) {
    -  if (!isStream(stream)) return;
    - 
    -  var streamType = stream.constructor.name;
    -  // avoid StreamStream
    -  if (streamType === 'Stream') streamType = '';
    - 
    -  return '<'+streamType+'Stream>';
    -};
    - 
    - -
    - - - - - - - - diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isBuffer.js.html b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isBuffer.js.html deleted file mode 100644 index b8d03cf3c7..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isBuffer.js.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - Code coverage report for vinyl/lib/isBuffer.js - - - - - - - -
    -

    Code coverage report for vinyl/lib/isBuffer.js

    -

    - - Statements: 100% (4 / 4)      - - - Branches: 100% (2 / 2)      - - - Functions: 100% (1 / 1)      - - - Lines: 100% (4 / 4)      - - Ignored: none      -

    -
    All files » vinyl/lib/ » isBuffer.js
    -
    -
    -
    
    -
    -
    1 -2 -3 -4 -5 -6 -71 -1 -  -  -1 -108 - 
    var buf = require('buffer');
    -var Buffer = buf.Buffer;
    - 
    -// could use Buffer.isBuffer but this is the same exact thing...
    -module.exports = function(o) {
    -  return typeof o === 'object' && o instanceof Buffer;
    -};
    - -
    - - - - - - - - diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isNull.js.html b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isNull.js.html deleted file mode 100644 index 7db9769a84..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isNull.js.html +++ /dev/null @@ -1,331 +0,0 @@ - - - - Code coverage report for vinyl/lib/isNull.js - - - - - - - -
    -

    Code coverage report for vinyl/lib/isNull.js

    -

    - - Statements: 100% (2 / 2)      - - - Branches: 100% (0 / 0)      - - - Functions: 100% (1 / 1)      - - - Lines: 100% (2 / 2)      - - Ignored: none      -

    -
    All files » vinyl/lib/ » isNull.js
    -
    -
    -
    
    -
    -
    1 -2 -3 -41 -57 -  - 
    module.exports = function(v) {
    -  return v === null;
    -};
    - 
    - -
    - - - - - - - - diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isStream.js.html b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isStream.js.html deleted file mode 100644 index 6a28a3dec5..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isStream.js.html +++ /dev/null @@ -1,334 +0,0 @@ - - - - Code coverage report for vinyl/lib/isStream.js - - - - - - - -
    -

    Code coverage report for vinyl/lib/isStream.js

    -

    - - Statements: 100% (3 / 3)      - - - Branches: 100% (2 / 2)      - - - Functions: 100% (1 / 1)      - - - Lines: 100% (3 / 3)      - - Ignored: none      -

    -
    All files » vinyl/lib/ » isStream.js
    -
    -
    -
    
    -
    -
    1 -2 -3 -4 -51 -  -1 -99 - 
    var Stream = require('stream').Stream;
    - 
    -module.exports = function(o) {
    -  return !!o && o instanceof Stream;
    -};
    - -
    - - - - - - - - diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov.info b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov.info deleted file mode 100644 index a4ec23afaf..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/coverage/lcov.info +++ /dev/null @@ -1,280 +0,0 @@ -TN: -SF:/Users/contra/Projects/vinyl/index.js -FN:11,File -FN:30,(anonymous_2) -FN:34,(anonymous_3) -FN:38,(anonymous_4) -FN:43,(anonymous_5) -FN:47,(anonymous_6) -FN:81,(anonymous_7) -FN:93,(anonymous_8) -FN:114,(anonymous_9) -FN:138,(anonymous_10) -FN:141,(anonymous_11) -FN:151,(anonymous_12) -FN:156,(anonymous_13) -FN:162,(anonymous_14) -FN:165,(anonymous_15) -FNF:15 -FNH:15 -FNDA:73,File -FNDA:26,(anonymous_2) -FNDA:29,(anonymous_3) -FNDA:6,(anonymous_4) -FNDA:3,(anonymous_5) -FNDA:14,(anonymous_6) -FNDA:75,(anonymous_7) -FNDA:6,(anonymous_8) -FNDA:6,(anonymous_9) -FNDA:99,(anonymous_10) -FNDA:78,(anonymous_11) -FNDA:7,(anonymous_12) -FNDA:1,(anonymous_13) -FNDA:46,(anonymous_14) -FNDA:9,(anonymous_15) -DA:1,1 -DA:2,1 -DA:3,1 -DA:4,1 -DA:5,1 -DA:6,1 -DA:7,1 -DA:8,1 -DA:9,1 -DA:11,1 -DA:12,73 -DA:15,73 -DA:16,73 -DA:19,73 -DA:20,73 -DA:24,73 -DA:27,73 -DA:30,1 -DA:31,26 -DA:34,1 -DA:35,29 -DA:38,1 -DA:39,6 -DA:43,1 -DA:44,3 -DA:47,1 -DA:48,14 -DA:49,2 -DA:53,12 -DA:54,7 -DA:59,5 -DA:60,5 -DA:64,14 -DA:65,14 -DA:66,1 -DA:67,1 -DA:68,13 -DA:69,6 -DA:72,14 -DA:81,14 -DA:83,75 -DA:86,70 -DA:88,5 -DA:90,14 -DA:93,1 -DA:94,6 -DA:95,6 -DA:97,6 -DA:98,2 -DA:100,4 -DA:101,2 -DA:102,1 -DA:104,1 -DA:106,2 -DA:110,2 -DA:111,2 -DA:114,1 -DA:115,6 -DA:118,6 -DA:120,6 -DA:121,4 -DA:124,6 -DA:125,3 -DA:128,6 -DA:129,1 -DA:132,6 -DA:137,1 -DA:139,99 -DA:142,78 -DA:143,1 -DA:145,77 -DA:150,1 -DA:152,7 -DA:153,6 -DA:154,5 -DA:157,1 -DA:161,1 -DA:163,46 -DA:166,9 -DA:169,8 -DA:170,5 -DA:175,1 -LF:82 -LH:82 -BRDA:12,1,0,14 -BRDA:12,1,1,59 -BRDA:15,2,0,25 -BRDA:15,2,1,48 -BRDA:16,3,0,73 -BRDA:16,3,1,33 -BRDA:19,4,0,73 -BRDA:19,4,1,32 -BRDA:20,5,0,73 -BRDA:20,5,1,39 -BRDA:24,6,0,73 -BRDA:24,6,1,65 -BRDA:27,7,0,73 -BRDA:27,7,1,44 -BRDA:44,8,0,3 -BRDA:44,8,1,1 -BRDA:44,8,2,1 -BRDA:48,9,0,2 -BRDA:48,9,1,12 -BRDA:53,10,0,7 -BRDA:53,10,1,5 -BRDA:65,11,0,1 -BRDA:65,11,1,13 -BRDA:68,12,0,6 -BRDA:68,12,1,7 -BRDA:69,13,0,5 -BRDA:69,13,1,1 -BRDA:75,14,0,2 -BRDA:75,14,1,12 -BRDA:83,15,0,70 -BRDA:83,15,1,5 -BRDA:83,16,0,75 -BRDA:83,16,1,61 -BRDA:83,16,2,47 -BRDA:83,16,3,33 -BRDA:83,16,4,33 -BRDA:83,16,5,19 -BRDA:88,17,0,2 -BRDA:88,17,1,3 -BRDA:94,18,0,3 -BRDA:94,18,1,3 -BRDA:95,19,0,3 -BRDA:95,19,1,3 -BRDA:97,20,0,2 -BRDA:97,20,1,4 -BRDA:100,21,0,2 -BRDA:100,21,1,2 -BRDA:101,22,0,1 -BRDA:101,22,1,1 -BRDA:110,23,0,1 -BRDA:110,23,1,1 -BRDA:118,24,0,3 -BRDA:118,24,1,3 -BRDA:118,25,0,6 -BRDA:118,25,1,5 -BRDA:120,26,0,4 -BRDA:120,26,1,2 -BRDA:124,27,0,3 -BRDA:124,27,1,3 -BRDA:128,28,0,1 -BRDA:128,28,1,5 -BRDA:142,29,0,1 -BRDA:142,29,1,77 -BRDA:142,30,0,78 -BRDA:142,30,1,57 -BRDA:142,30,2,46 -BRDA:152,31,0,1 -BRDA:152,31,1,6 -BRDA:153,32,0,1 -BRDA:153,32,1,5 -BRDA:166,33,0,1 -BRDA:166,33,1,8 -BRDA:169,34,0,5 -BRDA:169,34,1,3 -BRDA:169,35,0,8 -BRDA:169,35,1,7 -BRF:76 -BRH:76 -end_of_record -TN: -SF:/Users/contra/Projects/vinyl/lib/cloneBuffer.js -FN:3,(anonymous_1) -FNF:1 -FNH:1 -FNDA:7,(anonymous_1) -DA:1,1 -DA:3,1 -DA:4,7 -DA:5,7 -DA:6,7 -LF:5 -LH:5 -BRF:0 -BRH:0 -end_of_record -TN: -SF:/Users/contra/Projects/vinyl/lib/isBuffer.js -FN:5,(anonymous_1) -FNF:1 -FNH:1 -FNDA:108,(anonymous_1) -DA:1,1 -DA:2,1 -DA:5,1 -DA:6,108 -LF:4 -LH:4 -BRDA:6,1,0,108 -BRDA:6,1,1,107 -BRF:2 -BRH:2 -end_of_record -TN: -SF:/Users/contra/Projects/vinyl/lib/isStream.js -FN:3,(anonymous_1) -FNF:1 -FNH:1 -FNDA:99,(anonymous_1) -DA:1,1 -DA:3,1 -DA:4,99 -LF:3 -LH:3 -BRDA:4,1,0,99 -BRDA:4,1,1,40 -BRF:2 -BRH:2 -end_of_record -TN: -SF:/Users/contra/Projects/vinyl/lib/isNull.js -FN:1,(anonymous_1) -FNF:1 -FNH:1 -FNDA:57,(anonymous_1) -DA:1,1 -DA:2,57 -LF:2 -LH:2 -BRF:0 -BRH:0 -end_of_record -TN: -SF:/Users/contra/Projects/vinyl/lib/inspectStream.js -FN:3,(anonymous_1) -FNF:1 -FNH:1 -FNDA:9,(anonymous_1) -DA:1,1 -DA:3,1 -DA:4,9 -DA:6,7 -DA:8,7 -DA:10,7 -LF:6 -LH:6 -BRDA:4,1,0,2 -BRDA:4,1,1,7 -BRDA:8,2,0,1 -BRDA:8,2,1,6 -BRF:4 -BRH:4 -end_of_record diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/index.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/index.js index 09913c3a96..9aa47b78f1 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/index.js +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/index.js @@ -1,5 +1,5 @@ var path = require('path'); -var clone = require('lodash').clone; +var clone = require('clone'); var cloneStats = require('clone-stats'); var cloneBuffer = require('./lib/cloneBuffer'); var isBuffer = require('./lib/isBuffer'); diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/LICENSE.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/LICENSE.md index a23ecfb40b..146cb32a7d 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/LICENSE.md +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/LICENSE.md @@ -1,21 +1,21 @@ -## The MIT License (MIT) ## - -Copyright (c) 2014 Hugh Kennedy - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +## The MIT License (MIT) ## + +Copyright (c) 2014 Hugh Kennedy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/README.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/README.md index 35dfb2ad2e..8b12b6fa5e 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/README.md +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/README.md @@ -1,17 +1,17 @@ -# clone-stats [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/clone-stats&title=clone-stats&description=hughsk/clone-stats%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) # - -Safely clone node's -[`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) instances without -losing their class methods, i.e. `stat.isDirectory()` and co. - -## Usage ## - -[![clone-stats](https://nodei.co/npm/clone-stats.png?mini=true)](https://nodei.co/npm/clone-stats) - -### `copy = require('clone-stats')(stat)` ### - -Returns a clone of the original `fs.Stats` instance (`stat`). - -## License ## - -MIT. See [LICENSE.md](http://github.com/hughsk/clone-stats/blob/master/LICENSE.md) for details. +# clone-stats [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/clone-stats&title=clone-stats&description=hughsk/clone-stats%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) # + +Safely clone node's +[`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) instances without +losing their class methods, i.e. `stat.isDirectory()` and co. + +## Usage ## + +[![clone-stats](https://nodei.co/npm/clone-stats.png?mini=true)](https://nodei.co/npm/clone-stats) + +### `copy = require('clone-stats')(stat)` ### + +Returns a clone of the original `fs.Stats` instance (`stat`). + +## License ## + +MIT. See [LICENSE.md](http://github.com/hughsk/clone-stats/blob/master/LICENSE.md) for details. diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/package.json index e8d355860c..76699ca0f0 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/package.json +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/package.json @@ -1,57 +1,57 @@ -{ - "name": "clone-stats", - "description": "Safely clone node's fs.Stats instances without losing their class methods", - "version": "0.0.1", - "main": "index.js", - "browser": "index.js", - "dependencies": {}, - "devDependencies": { - "tape": "~2.3.2" - }, - "scripts": { - "test": "node test" - }, - "author": { - "name": "Hugh Kennedy", - "email": "hughskennedy@gmail.com", - "url": "http://hughsk.io/" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/hughsk/clone-stats" - }, - "bugs": { - "url": "https://github.com/hughsk/clone-stats/issues" - }, - "homepage": "https://github.com/hughsk/clone-stats", - "keywords": [ - "stats", - "fs", - "clone", - "copy", - "prototype" - ], - "readme": "# clone-stats [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/clone-stats&title=clone-stats&description=hughsk/clone-stats%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) #\n\nSafely clone node's\n[`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) instances without\nlosing their class methods, i.e. `stat.isDirectory()` and co.\n\n## Usage ##\n\n[![clone-stats](https://nodei.co/npm/clone-stats.png?mini=true)](https://nodei.co/npm/clone-stats)\n\n### `copy = require('clone-stats')(stat)` ###\n\nReturns a clone of the original `fs.Stats` instance (`stat`).\n\n## License ##\n\nMIT. See [LICENSE.md](http://github.com/hughsk/clone-stats/blob/master/LICENSE.md) for details.\n", - "readmeFilename": "README.md", - "_id": "clone-stats@0.0.1", - "dist": { - "shasum": "b88f94a82cf38b8791d58046ea4029ad88ca99d1", - "tarball": "http://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz" - }, - "_from": "clone-stats@^0.0.1", - "_npmVersion": "1.3.22", - "_npmUser": { - "name": "hughsk", - "email": "hughskennedy@gmail.com" - }, - "maintainers": [ - { - "name": "hughsk", - "email": "hughskennedy@gmail.com" - } - ], - "directories": {}, - "_shasum": "b88f94a82cf38b8791d58046ea4029ad88ca99d1", - "_resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz" -} +{ + "name": "clone-stats", + "description": "Safely clone node's fs.Stats instances without losing their class methods", + "version": "0.0.1", + "main": "index.js", + "browser": "index.js", + "dependencies": {}, + "devDependencies": { + "tape": "~2.3.2" + }, + "scripts": { + "test": "node test" + }, + "author": { + "name": "Hugh Kennedy", + "email": "hughskennedy@gmail.com", + "url": "http://hughsk.io/" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git://github.com/hughsk/clone-stats" + }, + "bugs": { + "url": "https://github.com/hughsk/clone-stats/issues" + }, + "homepage": "https://github.com/hughsk/clone-stats", + "keywords": [ + "stats", + "fs", + "clone", + "copy", + "prototype" + ], + "readme": "# clone-stats [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/clone-stats&title=clone-stats&description=hughsk/clone-stats%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) #\n\nSafely clone node's\n[`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) instances without\nlosing their class methods, i.e. `stat.isDirectory()` and co.\n\n## Usage ##\n\n[![clone-stats](https://nodei.co/npm/clone-stats.png?mini=true)](https://nodei.co/npm/clone-stats)\n\n### `copy = require('clone-stats')(stat)` ###\n\nReturns a clone of the original `fs.Stats` instance (`stat`).\n\n## License ##\n\nMIT. See [LICENSE.md](http://github.com/hughsk/clone-stats/blob/master/LICENSE.md) for details.\n", + "readmeFilename": "README.md", + "_id": "clone-stats@0.0.1", + "dist": { + "shasum": "b88f94a82cf38b8791d58046ea4029ad88ca99d1", + "tarball": "http://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz" + }, + "_from": "clone-stats@>=0.0.1 <0.0.2", + "_npmVersion": "1.3.22", + "_npmUser": { + "name": "hughsk", + "email": "hughskennedy@gmail.com" + }, + "maintainers": [ + { + "name": "hughsk", + "email": "hughskennedy@gmail.com" + } + ], + "directories": {}, + "_shasum": "b88f94a82cf38b8791d58046ea4029ad88ca99d1", + "_resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/.npmignore b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/.npmignore new file mode 100644 index 0000000000..c2658d7d1b --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/.npmignore @@ -0,0 +1 @@ +node_modules/ diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/.travis.yml b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/.travis.yml new file mode 100644 index 0000000000..58f23716ae --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - 0.6 + - 0.8 + - 0.10 diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/LICENSE b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/LICENSE new file mode 100644 index 0000000000..fc808cce89 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/LICENSE @@ -0,0 +1,18 @@ +Copyright © 2011-2014 Paul Vorbach + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/README.md b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/README.md new file mode 100644 index 0000000000..d7231cfca7 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/README.md @@ -0,0 +1,126 @@ +# clone + +[![build status](https://secure.travis-ci.org/pvorb/node-clone.png)](http://travis-ci.org/pvorb/node-clone) + +offers foolproof _deep cloning_ of variables in JavaScript. + + +## Installation + + npm install clone + +or + + ender build clone + + +## Example + +~~~ javascript +var clone = require('clone'); + +var a, b; + +a = { foo: { bar: 'baz' } }; // initial value of a + +b = clone(a); // clone a -> b +a.foo.bar = 'foo'; // change a + +console.log(a); // show a +console.log(b); // show b +~~~ + +This will print: + +~~~ javascript +{ foo: { bar: 'foo' } } +{ foo: { bar: 'baz' } } +~~~ + +**clone** masters cloning simple objects (even with custom prototype), arrays, +Date objects, and RegExp objects. Everything is cloned recursively, so that you +can clone dates in arrays in objects, for example. + + +## API + +`clone(val, circular, depth)` + + * `val` -- the value that you want to clone, any type allowed + * `circular` -- boolean + + Call `clone` with `circular` set to `false` if you are certain that `obj` + contains no circular references. This will give better performance if needed. + There is no error if `undefined` or `null` is passed as `obj`. + * `depth` -- depth to which the object is to be cloned (optional, + defaults to infinity) + +`clone.clonePrototype(obj)` + + * `obj` -- the object that you want to clone + +Does a prototype clone as +[described by Oran Looney](http://oranlooney.com/functional-javascript/). + + +## Circular References + +~~~ javascript +var a, b; + +a = { hello: 'world' }; + +a.myself = a; +b = clone(a); + +console.log(b); +~~~ + +This will print: + +~~~ javascript +{ hello: "world", myself: [Circular] } +~~~ + +So, `b.myself` points to `b`, not `a`. Neat! + + +## Test + + npm test + + +## Caveat + +Some special objects like a socket or `process.stdout`/`stderr` are known to not +be cloneable. If you find other objects that cannot be cloned, please [open an +issue](https://github.com/pvorb/node-clone/issues/new). + + +## Bugs and Issues + +If you encounter any bugs or issues, feel free to [open an issue at +github](https://github.com/pvorb/node-clone/issues) or send me an email to +. I also always like to hear from you, if you’re using my code. + +## License + +Copyright © 2011-2014 [Paul Vorbach](http://paul.vorba.ch/) and +[contributors](https://github.com/pvorb/node-clone/graphs/contributors). + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/clone.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/clone.js new file mode 100644 index 0000000000..f8fa3159a7 --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/clone.js @@ -0,0 +1,144 @@ +'use strict'; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + +// shim for Node's 'util' package +// DO NOT REMOVE THIS! It is required for compatibility with EnderJS (http://enderjs.com/). +var util = { + isArray: function (ar) { + return Array.isArray(ar) || (typeof ar === 'object' && objectToString(ar) === '[object Array]'); + }, + isDate: function (d) { + return typeof d === 'object' && objectToString(d) === '[object Date]'; + }, + isRegExp: function (re) { + return typeof re === 'object' && objectToString(re) === '[object RegExp]'; + }, + getRegExpFlags: function (re) { + var flags = ''; + re.global && (flags += 'g'); + re.ignoreCase && (flags += 'i'); + re.multiline && (flags += 'm'); + return flags; + } +}; + + +if (typeof module === 'object') + module.exports = clone; + +/** + * Clones (copies) an Object using deep copying. + * + * This function supports circular references by default, but if you are certain + * there are no circular references in your object, you can save some CPU time + * by calling clone(obj, false). + * + * Caution: if `circular` is false and `parent` contains circular references, + * your program may enter an infinite loop and crash. + * + * @param `parent` - the object to be cloned + * @param `circular` - set to true if the object to be cloned may contain + * circular references. (optional - true by default) + * @param `depth` - set to a number if the object is only to be cloned to + * a particular depth. (optional - defaults to Infinity) + * @param `prototype` - sets the prototype to be used when cloning an object. + * (optional - defaults to parent prototype). +*/ + +function clone(parent, circular, depth, prototype) { + // maintain two arrays for circular references, where corresponding parents + // and children have the same index + var allParents = []; + var allChildren = []; + + var useBuffer = typeof Buffer != 'undefined'; + + if (typeof circular == 'undefined') + circular = true; + + if (typeof depth == 'undefined') + depth = Infinity; + + // recurse this function so we don't reset allParents and allChildren + function _clone(parent, depth) { + // cloning null always returns null + if (parent === null) + return null; + + if (depth == 0) + return parent; + + var child; + var proto; + if (typeof parent != 'object') { + return parent; + } + + if (util.isArray(parent)) { + child = []; + } else if (util.isRegExp(parent)) { + child = new RegExp(parent.source, util.getRegExpFlags(parent)); + if (parent.lastIndex) child.lastIndex = parent.lastIndex; + } else if (util.isDate(parent)) { + child = new Date(parent.getTime()); + } else if (useBuffer && Buffer.isBuffer(parent)) { + child = new Buffer(parent.length); + parent.copy(child); + return child; + } else { + if (typeof prototype == 'undefined') { + proto = Object.getPrototypeOf(parent); + child = Object.create(proto); + } + else { + child = Object.create(prototype); + proto = prototype; + } + } + + if (circular) { + var index = allParents.indexOf(parent); + + if (index != -1) { + return allChildren[index]; + } + allParents.push(parent); + allChildren.push(child); + } + + for (var i in parent) { + var attrs; + if (proto) { + attrs = Object.getOwnPropertyDescriptor(proto, i); + } + + if (attrs && attrs.set == null) { + continue; + } + child[i] = _clone(parent[i], depth - 1); + } + + return child; + } + + return _clone(parent, depth); +} + +/** + * Simple flat clone using prototype, accepts only objects, usefull for property + * override on FLAT configuration object (no nested props). + * + * USE WITH CAUTION! This may not behave as you wish if you do not know how this + * works. + */ +clone.clonePrototype = function(parent) { + if (parent === null) + return null; + + var c = function () {}; + c.prototype = parent; + return new c(); +}; diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/package.json new file mode 100644 index 0000000000..94633177fe --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/package.json @@ -0,0 +1,127 @@ +{ + "name": "clone", + "description": "deep cloning of objects and arrays", + "tags": [ + "clone", + "object", + "array", + "function", + "date" + ], + "version": "0.2.0", + "repository": { + "type": "git", + "url": "git://github.com/pvorb/node-clone.git" + }, + "bugs": { + "url": "https://github.com/pvorb/node-clone/issues" + }, + "main": "clone.js", + "author": { + "name": "Paul Vorbach", + "email": "paul@vorba.ch", + "url": "http://paul.vorba.ch/" + }, + "contributors": [ + { + "name": "Blake Miner", + "email": "miner.blake@gmail.com", + "url": "http://www.blakeminer.com/" + }, + { + "name": "Tian You", + "email": "axqd001@gmail.com", + "url": "http://blog.axqd.net/" + }, + { + "name": "George Stagas", + "email": "gstagas@gmail.com", + "url": "http://stagas.com/" + }, + { + "name": "Tobiasz Cudnik", + "email": "tobiasz.cudnik@gmail.com", + "url": "https://github.com/TobiaszCudnik" + }, + { + "name": "Pavel Lang", + "email": "langpavel@phpskelet.org", + "url": "https://github.com/langpavel" + }, + { + "name": "Dan MacTough", + "url": "http://yabfog.com/" + }, + { + "name": "w1nk", + "url": "https://github.com/w1nk" + }, + { + "name": "Hugh Kennedy", + "url": "http://twitter.com/hughskennedy" + }, + { + "name": "Dustin Diaz", + "url": "http://dustindiaz.com" + }, + { + "name": "Ilya Shaisultanov", + "url": "https://github.com/diversario" + }, + { + "name": "Nathan MacInnes", + "email": "nathan@macinn.es", + "url": "http://macinn.es/" + }, + { + "name": "Benjamin E. Coe", + "email": "ben@npmjs.com", + "url": "https://twitter.com/benjamincoe" + }, + { + "name": "Nathan Zadoks", + "url": "https://github.com/nathan7" + }, + { + "name": "Róbert Oroszi", + "email": "robert+gh@oroszi.net", + "url": "https://github.com/oroce" + } + ], + "license": "MIT", + "engines": { + "node": "*" + }, + "dependencies": {}, + "devDependencies": { + "underscore": "*", + "nodeunit": "*" + }, + "optionalDependencies": {}, + "scripts": { + "test": "nodeunit test.js" + }, + "gitHead": "bb11a43363a0f69e8ac014cb5376ce215ea1f8fd", + "homepage": "https://github.com/pvorb/node-clone", + "_id": "clone@0.2.0", + "_shasum": "c6126a90ad4f72dbf5acdb243cc37724fe93fc1f", + "_from": "clone@>=0.2.0 <0.3.0", + "_npmVersion": "1.4.14", + "_npmUser": { + "name": "pvorb", + "email": "paul@vorba.ch" + }, + "maintainers": [ + { + "name": "pvorb", + "email": "paul@vorb.de" + } + ], + "dist": { + "shasum": "c6126a90ad4f72dbf5acdb243cc37724fe93fc1f", + "tarball": "http://registry.npmjs.org/clone/-/clone-0.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/test.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/test.js new file mode 100644 index 0000000000..cb3d16631a --- /dev/null +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/test.js @@ -0,0 +1,289 @@ +if(module.parent === null) { + console.log('Run this test file with nodeunit:'); + console.log('$ nodeunit test.js'); +} + + +var clone = require('./'); +var util = require('util'); +var _ = require('underscore'); + + + +exports["clone string"] = function(test) { + test.expect(2); // how many tests? + + var a = "foo"; + test.strictEqual(clone(a), a); + a = ""; + test.strictEqual(clone(a), a); + + test.done(); +}; + + + +exports["clone number"] = function(test) { + test.expect(5); // how many tests? + + var a = 0; + test.strictEqual(clone(a), a); + a = 1; + test.strictEqual(clone(a), a); + a = -1000; + test.strictEqual(clone(a), a); + a = 3.1415927; + test.strictEqual(clone(a), a); + a = -3.1415927; + test.strictEqual(clone(a), a); + + test.done(); +}; + + + +exports["clone date"] = function(test) { + test.expect(3); // how many tests? + + var a = new Date; + var c = clone(a); + test.ok(a instanceof Date); + test.ok(c instanceof Date); + test.equal(c.getTime(), a.getTime()); + + test.done(); +}; + + + +exports["clone object"] = function(test) { + test.expect(2); // how many tests? + + var a = { foo: { bar: "baz" } }; + var b = clone(a); + + test.ok(_(a).isEqual(b), "underscore equal"); + test.deepEqual(b, a); + + test.done(); +}; + + + +exports["clone array"] = function(test) { + test.expect(2); // how many tests? + + var a = [ + { foo: "bar" }, + "baz" + ]; + var b = clone(a); + + test.ok(_(a).isEqual(b), "underscore equal"); + test.deepEqual(b, a); + + test.done(); +}; + +exports["clone buffer"] = function(test) { + test.expect(1); + + var a = new Buffer("this is a test buffer"); + var b = clone(a); + + // no underscore equal since it has no concept of Buffers + test.deepEqual(b, a); + test.done(); +}; + + + +exports["clone regexp"] = function(test) { + test.expect(5); + + var a = /abc123/gi; + var b = clone(a); + + test.deepEqual(b, a); + + var c = /a/g; + test.ok(c.lastIndex === 0); + + c.exec('123a456a'); + test.ok(c.lastIndex === 4); + + var d = clone(c); + test.ok(d.global); + test.ok(d.lastIndex === 4); + + test.done(); +}; + + +exports["clone object containing array"] = function(test) { + test.expect(2); // how many tests? + + var a = { + arr1: [ { a: '1234', b: '2345' } ], + arr2: [ { c: '345', d: '456' } ] + }; + var b = clone(a); + + test.ok(_(a).isEqual(b), "underscore equal"); + test.deepEqual(b, a); + + test.done(); +}; + + + +exports["clone object with circular reference"] = function(test) { + test.expect(8); // how many tests? + + var _ = test.ok; + var c = [1, "foo", {'hello': 'bar'}, function() {}, false, [2]]; + var b = [c, 2, 3, 4]; + var a = {'b': b, 'c': c}; + a.loop = a; + a.loop2 = a; + c.loop = c; + c.aloop = a; + var aCopy = clone(a); + _(a != aCopy); + _(a.c != aCopy.c); + _(aCopy.c == aCopy.b[0]); + _(aCopy.c.loop.loop.aloop == aCopy); + _(aCopy.c[0] == a.c[0]); + + //console.log(util.inspect(aCopy, true, null) ); + //console.log("------------------------------------------------------------"); + //console.log(util.inspect(a, true, null) ); + _(eq(a, aCopy)); + aCopy.c[0] = 2; + _(!eq(a, aCopy)); + aCopy.c = "2"; + _(!eq(a, aCopy)); + //console.log("------------------------------------------------------------"); + //console.log(util.inspect(aCopy, true, null) ); + + function eq(x, y) { + return util.inspect(x, true, null) === util.inspect(y, true, null); + } + + test.done(); +}; + + + +exports['clonePrototype'] = function(test) { + test.expect(3); // how many tests? + + var a = { + a: "aaa", + x: 123, + y: 45.65 + }; + var b = clone.clonePrototype(a); + + test.strictEqual(b.a, a.a); + test.strictEqual(b.x, a.x); + test.strictEqual(b.y, a.y); + + test.done(); +} + +exports['cloneWithinNewVMContext'] = function(test) { + test.expect(3); + var vm = require('vm'); + var ctx = vm.createContext({ clone: clone }); + var script = "clone( {array: [1, 2, 3], date: new Date(), regex: /^foo$/ig} );"; + var results = vm.runInContext(script, ctx); + test.ok(results.array instanceof Array); + test.ok(results.date instanceof Date); + test.ok(results.regex instanceof RegExp); + test.done(); +} + +exports['cloneObjectWithNoConstructor'] = function(test) { + test.expect(3); + var n = null; + var a = { foo: 'bar' }; + a.__proto__ = n; + test.ok(typeof a === 'object'); + test.ok(typeof a !== null); + var b = clone(a); + test.ok(a.foo, b.foo); + test.done(); +} + +exports['clone object with depth argument'] = function (test) { + test.expect(6); + var a = { + foo: { + bar : { + baz : 'qux' + } + } + }; + var b = clone(a, false, 1); + test.deepEqual(b, a); + test.notEqual(b, a); + test.strictEqual(b.foo, a.foo); + + b = clone(a, true, 2); + test.deepEqual(b, a); + test.notEqual(b.foo, a.foo); + test.strictEqual(b.foo.bar, a.foo.bar); + test.done(); +} + +exports['maintain prototype chain in clones'] = function (test) { + test.expect(1); + function Constructor() {} + var a = new Constructor(); + var b = clone(a); + test.strictEqual(Object.getPrototypeOf(a), Object.getPrototypeOf(b)); + test.done(); +} + +exports['parent prototype is overriden with prototype provided'] = function (test) { + test.expect(1); + function Constructor() {} + var a = new Constructor(); + var b = clone(a, true, Infinity, null); + test.strictEqual(b.__defineSetter__, undefined); + test.done(); +} + +exports['clone object with null children'] = function(test) { + test.expect(1); + var a = { + foo: { + bar: null, + baz: { + qux: false + } + } + }; + var b = clone(a); + test.deepEqual(b, a); + test.done(); +} + +exports['clone instance with getter'] = function(test) { + test.expect(1); + function Ctor() {}; + Object.defineProperty(Ctor.prototype, 'prop', { + configurable: true, + enumerable: true, + get: function() { + return 'value'; + } + }); + + var a = new Ctor(); + var b = clone(a); + + test.strictEqual(b.prop, 'value'); + test.done(); +}; \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/package.json b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/package.json index 6d9a433b49..c94ac8ef65 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/package.json +++ b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/package.json @@ -1,70 +1,75 @@ -{ - "name": "vinyl", - "description": "A virtual file format", - "version": "0.4.3", - "homepage": "http://github.com/wearefractal/vinyl", - "repository": { - "type": "git", - "url": "git://github.com/wearefractal/vinyl.git" - }, - "author": { - "name": "Fractal", - "email": "contact@wearefractal.com", - "url": "http://wearefractal.com/" - }, - "main": "./index.js", - "dependencies": { - "clone-stats": "^0.0.1", - "lodash": "^2.4.1" - }, - "devDependencies": { - "mocha": "^1.17.0", - "should": "^4.0.4", - "mocha-lcov-reporter": "^0.0.1", - "coveralls": "^2.6.1", - "istanbul": "^0.3.0", - "rimraf": "^2.2.5", - "jshint": "^2.4.1", - "buffer-equal": "0.0.1", - "lodash.templatesettings": "^2.4.1", - "event-stream": "^3.1.0" - }, - "scripts": { - "test": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter spec && jshint .", - "coveralls": "istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage" - }, - "engines": { - "node": ">= 0.9" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/wearefractal/vinyl/raw/master/LICENSE" - } - ], - "gitHead": "6eae432519b007c313a8df83b093adfb97a2944c", - "bugs": { - "url": "https://github.com/wearefractal/vinyl/issues" - }, - "_id": "vinyl@0.4.3", - "_shasum": "19f61a1b28e72b4c50697889dbe91d7503943ecf", - "_from": "vinyl@^0.4.0", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "fractal", - "email": "contact@wearefractal.com" - }, - "maintainers": [ - { - "name": "fractal", - "email": "contact@wearefractal.com" - } - ], - "dist": { - "shasum": "19f61a1b28e72b4c50697889dbe91d7503943ecf", - "tarball": "http://registry.npmjs.org/vinyl/-/vinyl-0.4.3.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.3.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "vinyl", + "description": "A virtual file format", + "version": "0.4.6", + "homepage": "http://github.com/wearefractal/vinyl", + "repository": { + "type": "git", + "url": "git://github.com/wearefractal/vinyl.git" + }, + "author": { + "name": "Fractal", + "email": "contact@wearefractal.com", + "url": "http://wearefractal.com/" + }, + "main": "./index.js", + "files": [ + "index.js", + "lib" + ], + "dependencies": { + "clone": "^0.2.0", + "clone-stats": "^0.0.1" + }, + "devDependencies": { + "mocha": "^2.0.0", + "should": "^4.0.4", + "mocha-lcov-reporter": "^0.0.1", + "coveralls": "^2.6.1", + "istanbul": "^0.3.0", + "rimraf": "^2.2.5", + "jshint": "^2.4.1", + "buffer-equal": "0.0.1", + "lodash.templatesettings": "^2.4.1", + "event-stream": "^3.1.0" + }, + "scripts": { + "test": "mocha --reporter spec && jshint lib", + "coveralls": "istanbul cover _mocha -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage" + }, + "engines": { + "node": ">= 0.9" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/wearefractal/vinyl/raw/master/LICENSE" + } + ], + "gitHead": "8255a5f1de7fecb1cd5e7ba7ac1ec997395f6be1", + "bugs": { + "url": "https://github.com/wearefractal/vinyl/issues" + }, + "_id": "vinyl@0.4.6", + "_shasum": "2f356c87a550a255461f36bbeb2a5ba8bf784847", + "_from": "vinyl@>=0.4.3 <0.5.0", + "_npmVersion": "2.1.6", + "_nodeVersion": "0.10.33", + "_npmUser": { + "name": "fractal", + "email": "contact@wearefractal.com" + }, + "maintainers": [ + { + "name": "fractal", + "email": "contact@wearefractal.com" + } + ], + "dist": { + "shasum": "2f356c87a550a255461f36bbeb2a5ba8bf784847", + "tarball": "http://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/perf/clone.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/perf/clone.js deleted file mode 100644 index 4df8578722..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/perf/clone.js +++ /dev/null @@ -1,59 +0,0 @@ -var File = require('../'); - -var contents = new Buffer('blah blah blah'); - -var originalFile = new File({ - path: 'yo.coffee', - contents: contents -}); - -// simulate some history -originalFile.path = 'yo.js'; -originalFile.path = 'yo.js'; -originalFile.path = 'yo.js'; -originalFile.path = 'yo.js'; -originalFile.path = 'yo.js'; - -originalFile.ast = { - a: { - b: { - c: { -a: { - b: { - c: { -a: { - b: { - c: { -a: { - b: { - c: { -a: { - b: { - c: { -a: { - b: { - c: { - - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -}; - -for (var i = 0; i < 10000; i++) { - originalFile.clone(true).ast; -} \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/File.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/File.js deleted file mode 100644 index 419e7aac34..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/File.js +++ /dev/null @@ -1,753 +0,0 @@ -var Stream = require('stream'); -var fs = require('fs'); -var path = require('path'); -var es = require('event-stream'); -var File = require('../'); - -var should = require('should'); -require('mocha'); - -describe('File', function() { - describe('constructor()', function() { - it('should default cwd to process.cwd', function(done) { - var file = new File(); - file.cwd.should.equal(process.cwd()); - done(); - }); - - it('should default base to cwd', function(done) { - var cwd = '/'; - var file = new File({cwd: cwd}); - file.base.should.equal(cwd); - done(); - }); - - it('should default base to cwd even when none is given', function(done) { - var file = new File(); - file.base.should.equal(process.cwd()); - done(); - }); - - it('should default path to null', function(done) { - var file = new File(); - should.not.exist(file.path); - done(); - }); - - it('should default history to []', function(done) { - var file = new File(); - file.history.should.eql([]); - done(); - }); - - it('should default stat to null', function(done) { - var file = new File(); - should.not.exist(file.stat); - done(); - }); - - it('should default contents to null', function(done) { - var file = new File(); - should.not.exist(file.contents); - done(); - }); - - it('should set base to given value', function(done) { - var val = '/'; - var file = new File({base: val}); - file.base.should.equal(val); - done(); - }); - - it('should set cwd to given value', function(done) { - var val = '/'; - var file = new File({cwd: val}); - file.cwd.should.equal(val); - done(); - }); - - it('should set path to given value', function(done) { - var val = '/test.coffee'; - var file = new File({path: val}); - file.path.should.equal(val); - file.history.should.eql([val]); - done(); - }); - - it('should set history to given value', function(done) { - var val = '/test.coffee'; - var file = new File({history: [val]}); - file.path.should.equal(val); - file.history.should.eql([val]); - done(); - }); - - it('should set stat to given value', function(done) { - var val = {}; - var file = new File({stat: val}); - file.stat.should.equal(val); - done(); - }); - - it('should set contents to given value', function(done) { - var val = new Buffer('test'); - var file = new File({contents: val}); - file.contents.should.equal(val); - done(); - }); - }); - - describe('isBuffer()', function() { - it('should return true when the contents are a Buffer', function(done) { - var val = new Buffer('test'); - var file = new File({contents: val}); - file.isBuffer().should.equal(true); - done(); - }); - - it('should return false when the contents are a Stream', function(done) { - var val = new Stream(); - var file = new File({contents: val}); - file.isBuffer().should.equal(false); - done(); - }); - - it('should return false when the contents are a null', function(done) { - var file = new File({contents: null}); - file.isBuffer().should.equal(false); - done(); - }); - }); - - describe('isStream()', function() { - it('should return false when the contents are a Buffer', function(done) { - var val = new Buffer('test'); - var file = new File({contents: val}); - file.isStream().should.equal(false); - done(); - }); - - it('should return true when the contents are a Stream', function(done) { - var val = new Stream(); - var file = new File({contents: val}); - file.isStream().should.equal(true); - done(); - }); - - it('should return false when the contents are a null', function(done) { - var file = new File({contents: null}); - file.isStream().should.equal(false); - done(); - }); - }); - - describe('isNull()', function() { - it('should return false when the contents are a Buffer', function(done) { - var val = new Buffer('test'); - var file = new File({contents: val}); - file.isNull().should.equal(false); - done(); - }); - - it('should return false when the contents are a Stream', function(done) { - var val = new Stream(); - var file = new File({contents: val}); - file.isNull().should.equal(false); - done(); - }); - - it('should return true when the contents are a null', function(done) { - var file = new File({contents: null}); - file.isNull().should.equal(true); - done(); - }); - }); - - describe('isDirectory()', function() { - var fakeStat = { - isDirectory: function() { - return true; - } - }; - - it('should return false when the contents are a Buffer', function(done) { - var val = new Buffer('test'); - var file = new File({contents: val, stat: fakeStat}); - file.isDirectory().should.equal(false); - done(); - }); - - it('should return false when the contents are a Stream', function(done) { - var val = new Stream(); - var file = new File({contents: val, stat: fakeStat}); - file.isDirectory().should.equal(false); - done(); - }); - - it('should return true when the contents are a null', function(done) { - var file = new File({contents: null, stat: fakeStat}); - file.isDirectory().should.equal(true); - done(); - }); - }); - - describe('clone()', function() { - it('should copy all attributes over with Buffer', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: new Buffer('test') - }; - var file = new File(options); - var file2 = file.clone(); - - file2.should.not.equal(file, 'refs should be different'); - file2.cwd.should.equal(file.cwd); - file2.base.should.equal(file.base); - file2.path.should.equal(file.path); - file2.contents.should.not.equal(file.contents, 'buffer ref should be different'); - file2.contents.toString('utf8').should.equal(file.contents.toString('utf8')); - done(); - }); - - it('should copy buffer\'s reference with option contents: false', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.js', - contents: new Buffer('test') - }; - - var file = new File(options); - - var copy1 = file.clone({ contents: false }); - copy1.contents.should.equal(file.contents); - - var copy2 = file.clone({}); - copy2.contents.should.not.equal(file.contents); - - var copy3 = file.clone({ contents: 'any string' }); - copy3.contents.should.not.equal(file.contents); - - done(); - }); - - it('should copy all attributes over with Stream', function(done) { - var contents = new Stream.PassThrough(); - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: contents - }; - var file = new File(options); - var file2 = file.clone(); - - contents.write(new Buffer('wa')); - - process.nextTick(function() { - contents.write(new Buffer('dup')); - contents.end(); - }); - - file2.should.not.equal(file, 'refs should be different'); - file2.cwd.should.equal(file.cwd); - file2.base.should.equal(file.base); - file2.path.should.equal(file.path); - file2.contents.should.not.equal(file.contents, 'stream ref should not be the same'); - file.contents.pipe(es.wait(function(err, data) { - file2.contents.pipe(es.wait(function(err, data2) { - data2.should.not.equal(data, 'stream contents ref should not be the same'); - data2.should.eql(data, 'stream contents should be the same'); - })); - })); - done(); - }); - - it('should copy all attributes over with null', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: null - }; - var file = new File(options); - var file2 = file.clone(); - - file2.should.not.equal(file, 'refs should be different'); - file2.cwd.should.equal(file.cwd); - file2.base.should.equal(file.base); - file2.path.should.equal(file.path); - should.not.exist(file2.contents); - done(); - }); - - it('should properly clone the `stat` property', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.js', - contents: new Buffer('test'), - stat: fs.statSync(__filename) - }; - - var file = new File(options); - var copy = file.clone(); - - copy.stat.isFile().should.equal(true); - copy.stat.isDirectory().should.equal(false); - should(file.stat instanceof fs.Stats).equal(true); - should(copy.stat instanceof fs.Stats).equal(true); - - done(); - }); - - it('should properly clone the `history` property', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.js', - contents: new Buffer('test'), - stat: fs.statSync(__filename) - }; - - var file = new File(options); - var copy = file.clone(); - - copy.history[0].should.equal(options.path); - copy.path = 'lol'; - file.path.should.not.equal(copy.path); - done(); - }); - - it('should copy custom properties', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: null - }; - - var file = new File(options); - file.custom = { a: 'custom property' }; - - var file2 = file.clone(); - - file2.should.not.equal(file, 'refs should be different'); - file2.cwd.should.equal(file.cwd); - file2.base.should.equal(file.base); - file2.path.should.equal(file.path); - file2.custom.should.equal(file.custom); - file2.custom.a.should.equal(file.custom.a); - - done(); - }); - - it('should copy history', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: null - }; - - var file = new File(options); - file.path = '/test/test.js'; - file.path = '/test/test-938di2s.js'; - var file2 = file.clone(); - - file2.history.should.eql([ - '/test/test.coffee', - '/test/test.js', - '/test/test-938di2s.js' - ]); - file2.history.should.not.equal([ - '/test/test.coffee', - '/test/test.js', - '/test/test-938di2s.js' - ]); - file2.path.should.eql('/test/test-938di2s.js'); - - done(); - }); - - it('should copy all attributes deeply', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: null - }; - - var file = new File(options); - file.custom = { a: 'custom property' }; - - var file2 = file.clone(true); - file2.custom.should.eql(file.custom); - file2.custom.should.not.equal(file.custom); - file2.custom.a.should.equal(file.custom.a); - - var file3 = file.clone({ deep: true }); - file3.custom.should.eql(file.custom); - file3.custom.should.not.equal(file.custom); - file3.custom.a.should.equal(file.custom.a); - - var file4 = file.clone(false); - file4.custom.should.eql(file.custom); - file4.custom.should.equal(file.custom); - file4.custom.a.should.equal(file.custom.a); - - var file5 = file.clone({ deep: false }); - file5.custom.should.eql(file.custom); - file5.custom.should.equal(file.custom); - file5.custom.a.should.equal(file.custom.a); - - done(); - }); - }); - - describe('pipe()', function() { - it('should write to stream with Buffer', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: new Buffer('test') - }; - var file = new File(options); - var stream = new Stream.PassThrough(); - stream.on('data', function(chunk) { - should.exist(chunk); - (chunk instanceof Buffer).should.equal(true, 'should write as a buffer'); - chunk.toString('utf8').should.equal(options.contents.toString('utf8')); - }); - stream.on('end', function() { - done(); - }); - var ret = file.pipe(stream); - ret.should.equal(stream, 'should return the stream'); - }); - - it('should pipe to stream with Stream', function(done) { - var testChunk = new Buffer('test'); - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: new Stream.PassThrough() - }; - var file = new File(options); - var stream = new Stream.PassThrough(); - stream.on('data', function(chunk) { - should.exist(chunk); - (chunk instanceof Buffer).should.equal(true, 'should write as a buffer'); - chunk.toString('utf8').should.equal(testChunk.toString('utf8')); - done(); - }); - var ret = file.pipe(stream); - ret.should.equal(stream, 'should return the stream'); - - file.contents.write(testChunk); - }); - - it('should do nothing with null', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: null - }; - var file = new File(options); - var stream = new Stream.PassThrough(); - stream.on('data', function() { - throw new Error('should not write'); - }); - stream.on('end', function() { - done(); - }); - var ret = file.pipe(stream); - ret.should.equal(stream, 'should return the stream'); - }); - - it('should write to stream with Buffer', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: new Buffer('test') - }; - var file = new File(options); - var stream = new Stream.PassThrough(); - stream.on('data', function(chunk) { - should.exist(chunk); - (chunk instanceof Buffer).should.equal(true, 'should write as a buffer'); - chunk.toString('utf8').should.equal(options.contents.toString('utf8')); - done(); - }); - stream.on('end', function() { - throw new Error('should not end'); - }); - var ret = file.pipe(stream, {end: false}); - ret.should.equal(stream, 'should return the stream'); - }); - - it('should pipe to stream with Stream', function(done) { - var testChunk = new Buffer('test'); - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: new Stream.PassThrough() - }; - var file = new File(options); - var stream = new Stream.PassThrough(); - stream.on('data', function(chunk) { - should.exist(chunk); - (chunk instanceof Buffer).should.equal(true, 'should write as a buffer'); - chunk.toString('utf8').should.equal(testChunk.toString('utf8')); - done(); - }); - stream.on('end', function() { - throw new Error('should not end'); - }); - var ret = file.pipe(stream, {end: false}); - ret.should.equal(stream, 'should return the stream'); - - file.contents.write(testChunk); - }); - - it('should do nothing with null', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: null - }; - var file = new File(options); - var stream = new Stream.PassThrough(); - stream.on('data', function() { - throw new Error('should not write'); - }); - stream.on('end', function() { - throw new Error('should not end'); - }); - var ret = file.pipe(stream, {end: false}); - ret.should.equal(stream, 'should return the stream'); - process.nextTick(done); - }); - }); - - describe('inspect()', function() { - it('should return correct format when no contents and no path', function(done) { - var file = new File(); - file.inspect().should.equal(''); - done(); - }); - - it('should return correct format when Buffer and no path', function(done) { - var val = new Buffer('test'); - var file = new File({ - contents: val - }); - file.inspect().should.equal('>'); - done(); - }); - - it('should return correct format when Buffer and relative path', function(done) { - var val = new Buffer('test'); - var file = new File({ - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: val - }); - file.inspect().should.equal('>'); - done(); - }); - - it('should return correct format when Buffer and only path and no base', function(done) { - var val = new Buffer('test'); - var file = new File({ - cwd: '/', - path: '/test/test.coffee', - contents: val - }); - delete file.base; - file.inspect().should.equal('>'); - done(); - }); - - it('should return correct format when Stream and relative path', function(done) { - var file = new File({ - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: new Stream.PassThrough() - }); - file.inspect().should.equal('>'); - done(); - }); - - it('should return correct format when null and relative path', function(done) { - var file = new File({ - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: null - }); - file.inspect().should.equal(''); - done(); - }); - }); - - describe('contents get/set', function() { - it('should work with Buffer', function(done) { - var val = new Buffer('test'); - var file = new File(); - file.contents = val; - file.contents.should.equal(val); - done(); - }); - - it('should work with Stream', function(done) { - var val = new Stream.PassThrough(); - var file = new File(); - file.contents = val; - file.contents.should.equal(val); - done(); - }); - - it('should work with null', function(done) { - var val = null; - var file = new File(); - file.contents = val; - (file.contents === null).should.equal(true); - done(); - }); - - it('should not work with string', function(done) { - var val = 'test'; - var file = new File(); - try { - file.contents = val; - } catch (err) { - should.exist(err); - done(); - } - }); - }); - - describe('relative get/set', function() { - it('should error on set', function(done) { - var file = new File(); - try { - file.relative = 'test'; - } catch (err) { - should.exist(err); - done(); - } - }); - - it('should error on get when no base', function(done) { - var a; - var file = new File(); - delete file.base; - try { - a = file.relative; - } catch (err) { - should.exist(err); - done(); - } - }); - - it('should error on get when no path', function(done) { - var a; - var file = new File(); - try { - a = file.relative; - } catch (err) { - should.exist(err); - done(); - } - }); - - it('should return a relative path from base', function(done) { - var file = new File({ - cwd: '/', - base: '/test/', - path: '/test/test.coffee' - }); - file.relative.should.equal('test.coffee'); - done(); - }); - - it('should return a relative path from cwd', function(done) { - var file = new File({ - cwd: '/', - path: '/test/test.coffee' - }); - file.relative.should.equal(path.join('test','test.coffee')); - done(); - }); - }); - - describe('path get/set', function() { - - it('should record history when instantiation', function() { - var file = new File({ - cwd: '/', - path: '/test/test.coffee' - }); - - file.path.should.eql('/test/test.coffee'); - file.history.should.eql(['/test/test.coffee']); - }); - - it('should record history when path change', function() { - var file = new File({ - cwd: '/', - path: '/test/test.coffee' - }); - - file.path = '/test/test.js'; - file.path.should.eql('/test/test.js'); - file.history.should.eql(['/test/test.coffee', '/test/test.js']); - - file.path = '/test/test.coffee'; - file.path.should.eql('/test/test.coffee'); - file.history.should.eql(['/test/test.coffee', '/test/test.js', '/test/test.coffee']); - }); - - it('should not record history when set the same path', function() { - var file = new File({ - cwd: '/', - path: '/test/test.coffee' - }); - - file.path = '/test/test.coffee'; - file.path = '/test/test.coffee'; - file.path.should.eql('/test/test.coffee'); - file.history.should.eql(['/test/test.coffee']); - - // ignore when set empty string - file.path = ''; - file.path.should.eql('/test/test.coffee'); - file.history.should.eql(['/test/test.coffee']); - }); - - it('should throw when set path null', function() { - var file = new File({ - cwd: '/', - path: null - }); - - should.not.exist(file.path); - file.history.should.eql([]); - - (function() { - file.path = null; - }).should.throw('path should be string'); - }); - }); -}); diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/cloneBuffer.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/cloneBuffer.js deleted file mode 100644 index 34b3e7c105..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/cloneBuffer.js +++ /dev/null @@ -1,27 +0,0 @@ -var cloneBuffer = require('../lib/cloneBuffer'); -var should = require('should'); -require('mocha'); - -describe('cloneBuffer()', function() { - it('should return a new Buffer reference', function(done) { - var testBuffer = new Buffer('test'); - var testBuffer2 = cloneBuffer(testBuffer); - - should.exist(testBuffer2, 'should return something'); - (testBuffer2 instanceof Buffer).should.equal(true, 'should return a Buffer'); - testBuffer2.should.not.equal(testBuffer, 'pointer should change'); - done(); - }); - - it('should not replicate modifications to the original buffer', function(done) { - var testBuffer = new Buffer('test'); - var testBuffer2 = cloneBuffer(testBuffer); - - // test that changes dont modify both pointers - testBuffer2.write('w'); - - testBuffer.toString('utf8').should.equal('test', 'original should stay the same'); - testBuffer2.toString('utf8').should.equal('west', 'new buffer should be modified'); - done(); - }); -}); diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/inspectStream.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/inspectStream.js deleted file mode 100644 index fe1802c5d7..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/inspectStream.js +++ /dev/null @@ -1,53 +0,0 @@ -var inspectStream = require('../lib/inspectStream'); -var Stream = require('stream'); -var should = require('should'); -require('mocha'); - -describe('inspectStream()', function() { - it('should work on a core Stream', function(done) { - var testStream = new Stream(); - inspectStream(testStream).should.equal(''); - done(); - }); - - it('should work on a core Readable Stream', function(done) { - var testStream = new Stream.Readable(); - inspectStream(testStream).should.equal(''); - done(); - }); - - it('should work on a core Writable Stream', function(done) { - var testStream = new Stream.Writable(); - inspectStream(testStream).should.equal(''); - done(); - }); - - it('should work on a core Duplex Stream', function(done) { - var testStream = new Stream.Duplex(); - inspectStream(testStream).should.equal(''); - done(); - }); - - it('should work on a core Transform Stream', function(done) { - var testStream = new Stream.Transform(); - inspectStream(testStream).should.equal(''); - done(); - }); - - it('should work on a core PassThrough Stream', function(done) { - var testStream = new Stream.PassThrough(); - inspectStream(testStream).should.equal(''); - done(); - }); - - it('should not work on a Buffer', function(done) { - var testBuffer = new Buffer('test'); - should.not.exist(inspectStream(testBuffer)); - done(); - }); - - it('should not work on a null', function(done) { - should.not.exist(inspectStream(null)); - done(); - }); -}); \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/isBuffer.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/isBuffer.js deleted file mode 100644 index 432ad2aad7..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/isBuffer.js +++ /dev/null @@ -1,29 +0,0 @@ -var isBuffer = require('../lib/isBuffer'); -var Stream = require('stream'); -require('should'); -require('mocha'); - -describe('isBuffer()', function() { - it('should return true on a Buffer', function(done) { - var testBuffer = new Buffer('test'); - isBuffer(testBuffer).should.equal(true); - done(); - }); - - it('should return false on a Stream', function(done) { - var testStream = new Stream(); - isBuffer(testStream).should.equal(false); - done(); - }); - - it('should return false on a null', function(done) { - isBuffer(null).should.equal(false); - done(); - }); - - it('should return false on a array of numbers', function(done) { - var testArray = [1, 2, 3]; - isBuffer(testArray).should.equal(false); - done(); - }); -}); diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/isNull.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/isNull.js deleted file mode 100644 index 356934a644..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/isNull.js +++ /dev/null @@ -1,22 +0,0 @@ -var isNull = require('../lib/isNull'); -require('should'); -require('mocha'); - -describe('isNull()', function() { - it('should return true on null', function(done) { - isNull(null).should.equal(true); - done(); - }); - - it('should return false on undefined', function(done) { - isNull().should.equal(false); - isNull(undefined).should.equal(false); - done(); - }); - - it('should return false on defined values', function(done) { - isNull(1).should.equal(false); - isNull('test').should.equal(false); - done(); - }); -}); diff --git a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/isStream.js b/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/isStream.js deleted file mode 100644 index 5cc0e0b16f..0000000000 --- a/node_modules/gulp-changed/node_modules/gulp-util/node_modules/vinyl/test/isStream.js +++ /dev/null @@ -1,29 +0,0 @@ -var isStream = require('../lib/isStream'); -var Stream = require('stream'); -require('should'); -require('mocha'); - -describe('isStream()', function() { - it('should return true on a Stream', function(done) { - var testStream = new Stream(); - isStream(testStream).should.equal(true); - done(); - }); - - it('should return false on a Buffer', function(done) { - var testBuffer = new Buffer('test'); - isStream(testBuffer).should.equal(false); - done(); - }); - - it('should return false on a null', function(done) { - isStream(null).should.equal(false); - done(); - }); - - it('should return false on a array of numbers', function(done) { - var testArray = [1, 2, 3]; - isStream(testArray).should.equal(false); - done(); - }); -}); diff --git a/node_modules/gulp-changed/node_modules/gulp-util/package.json b/node_modules/gulp-changed/node_modules/gulp-util/package.json index ef107a7bf9..1fc1e4703d 100644 --- a/node_modules/gulp-changed/node_modules/gulp-util/package.json +++ b/node_modules/gulp-changed/node_modules/gulp-util/package.json @@ -1,77 +1,91 @@ -{ - "name": "gulp-util", - "description": "Utility functions for gulp plugins", - "version": "3.0.1", - "homepage": "http://github.com/wearefractal/gulp-util", - "repository": { - "type": "git", - "url": "git://github.com/wearefractal/gulp-util.git" - }, - "author": { - "name": "Fractal", - "email": "contact@wearefractal.com", - "url": "http://wearefractal.com/" - }, - "main": "./index.js", - "dependencies": { - "chalk": "^0.5.0", - "dateformat": "^1.0.7-1.2.3", - "lodash": "^2.4.1", - "lodash._reinterpolate": "^2.4.1", - "lodash.template": "^2.4.1", - "minimist": "^1.1.0", - "multipipe": "^0.1.0", - "through2": "^0.6.1", - "vinyl": "^0.4.0" - }, - "devDependencies": { - "mocha": "^1.17.0", - "should": "^4.0.0", - "mocha-lcov-reporter": "^0.0.1", - "coveralls": "^2.7.0", - "istanbul": "^0.3.0", - "rimraf": "^2.2.5", - "jshint": "^2.4.1", - "buffer-equal": "~0.0.1", - "lodash.templatesettings": "^2.4.1", - "event-stream": "^3.1.0" - }, - "scripts": { - "test": "mocha --reporter spec && jshint", - "coveralls": "istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage" - }, - "engines": { - "node": ">= 0.9" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/wearefractal/gulp-util/raw/master/LICENSE" - } - ], - "gitHead": "f6336c8ac9f52930b36ad14002cf267c06f801df", - "bugs": { - "url": "https://github.com/wearefractal/gulp-util/issues" - }, - "_id": "gulp-util@3.0.1", - "_shasum": "8214894d05c2bb6cc7f5544918a51ddf88180f00", - "_from": "gulp-util@^3.0.0", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "fractal", - "email": "contact@wearefractal.com" - }, - "maintainers": [ - { - "name": "fractal", - "email": "contact@wearefractal.com" - } - ], - "dist": { - "shasum": "8214894d05c2bb6cc7f5544918a51ddf88180f00", - "tarball": "http://registry.npmjs.org/gulp-util/-/gulp-util-3.0.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.1.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "gulp-util", + "description": "Utility functions for gulp plugins", + "version": "3.0.4", + "repository": { + "type": "git", + "url": "https://github.com/wearefractal/gulp-util" + }, + "author": { + "name": "Fractal", + "email": "contact@wearefractal.com", + "url": "http://wearefractal.com/" + }, + "files": [ + "index.js", + "lib" + ], + "dependencies": { + "array-differ": "^1.0.0", + "array-uniq": "^1.0.2", + "beeper": "^1.0.0", + "chalk": "^1.0.0", + "dateformat": "^1.0.11", + "lodash._reescape": "^3.0.0", + "lodash._reevaluate": "^3.0.0", + "lodash._reinterpolate": "^3.0.0", + "lodash.template": "^3.0.0", + "minimist": "^1.1.0", + "multipipe": "^0.1.2", + "object-assign": "^2.0.0", + "replace-ext": "0.0.1", + "through2": "^0.6.3", + "vinyl": "^0.4.3" + }, + "devDependencies": { + "buffer-equal": "^0.0.1", + "coveralls": "^2.11.2", + "event-stream": "^3.1.7", + "istanbul": "^0.3.5", + "istanbul-coveralls": "^1.0.1", + "jshint": "^2.5.11", + "lodash.templatesettings": "^3.0.0", + "mocha": "^2.0.1", + "rimraf": "^2.2.8", + "should": "^5.0.1" + }, + "scripts": { + "test": "jshint *.js lib/*.js test/*.js && mocha", + "coveralls": "istanbul cover _mocha --report lcovonly && istanbul-coveralls" + }, + "engines": { + "node": ">=0.10" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/wearefractal/gulp-util/raw/master/LICENSE" + } + ], + "gitHead": "d17e0f99e9fa8d90499757e823983e229561ac75", + "bugs": { + "url": "https://github.com/wearefractal/gulp-util/issues" + }, + "homepage": "https://github.com/wearefractal/gulp-util", + "_id": "gulp-util@3.0.4", + "_shasum": "ec73553090fdb23d88fa02812ad1b61225854881", + "_from": "gulp-util@>=3.0.0 <4.0.0", + "_npmVersion": "2.6.0", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "fractal", + "email": "contact@wearefractal.com" + }, + "maintainers": [ + { + "name": "fractal", + "email": "contact@wearefractal.com" + }, + { + "name": "phated", + "email": "blaine@iceddev.com" + } + ], + "dist": { + "shasum": "ec73553090fdb23d88fa02812ad1b61225854881", + "tarball": "http://registry.npmjs.org/gulp-util/-/gulp-util-3.0.4.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.4.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/through2/.npmignore b/node_modules/gulp-changed/node_modules/through2/.npmignore index 9d850afecf..1e1dcab34c 100644 --- a/node_modules/gulp-changed/node_modules/through2/.npmignore +++ b/node_modules/gulp-changed/node_modules/through2/.npmignore @@ -1,3 +1,3 @@ -test -.jshintrc +test +.jshintrc .travis.yml \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/through2/LICENSE b/node_modules/gulp-changed/node_modules/through2/LICENSE index ec09cceb2b..f6a0029de1 100644 --- a/node_modules/gulp-changed/node_modules/through2/LICENSE +++ b/node_modules/gulp-changed/node_modules/through2/LICENSE @@ -1,39 +1,39 @@ -Copyright 2013, Rod Vagg (the "Original Author") -All rights reserved. - -MIT +no-false-attribs License - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -Distributions of all or part of the Software intended to be used -by the recipients as they would use the unmodified Software, -containing modifications that substantially alter, remove, or -disable functionality of the Software, outside of the documented -configuration mechanisms provided by the Software, shall be -modified such that the Original Author's bug reporting email -addresses and urls are either replaced with the contact information -of the parties responsible for the changes, or removed entirely. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - - -Except where noted, this license applies to any and all software -programs and associated documentation files created by the +Copyright 2013, Rod Vagg (the "Original Author") +All rights reserved. + +MIT +no-false-attribs License + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +Distributions of all or part of the Software intended to be used +by the recipients as they would use the unmodified Software, +containing modifications that substantially alter, remove, or +disable functionality of the Software, outside of the documented +configuration mechanisms provided by the Software, shall be +modified such that the Original Author's bug reporting email +addresses and urls are either replaced with the contact information +of the parties responsible for the changes, or removed entirely. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + + +Except where noted, this license applies to any and all software +programs and associated documentation files created by the Original Author, when distributed with the Software. \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/through2/README.md b/node_modules/gulp-changed/node_modules/through2/README.md index b4d05e9c00..11259a5f71 100644 --- a/node_modules/gulp-changed/node_modules/through2/README.md +++ b/node_modules/gulp-changed/node_modules/through2/README.md @@ -1,149 +1,132 @@ -# through2 - - - -[![NPM](https://nodei.co/npm/through2.png?downloads&downloadRank)](https://nodei.co/npm/through2/) - - - -**A tiny wrapper around Node streams.Transform (Streams2) to avoid explicit subclassing noise** - -Inspired by [Dominic Tarr](https://github.com/dominictarr)'s [through](https://github.com/dominictarr/through) in that it's so much easier to make a stream out of a function than it is to set up the prototype chain properly: `through(function (chunk) { ... })`. - -Note: A **Streams3** version of through2 is available in npm with the tag `"1.0"` rather than `"latest"` so an `npm install through2` will get you the current Streams2 version (version number is 0.x.x). To use a Streams3 version use `npm install through2@1` to fetch the latest version 1.x.x. More information about Streams2 vs Streams3 and recommendations see the article **[Why I don't use Node's core 'stream' module](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html)**. - -```js -fs.createReadStream('ex.txt') - .pipe(through2(function (chunk, enc, callback) { - for (var i = 0; i < chunk.length; i++) - if (chunk[i] == 97) - chunk[i] = 122 // swap 'a' for 'z' - - this.push(chunk) - - callback() - })) - .pipe(fs.createWriteStream('out.txt')) -``` - -Or object streams: - -```js -var all = [] - -fs.createReadStream('data.csv') - .pipe(csv2()) - .pipe(through2.obj(function (chunk, enc, callback) { - var data = { - name : chunk[0] - , address : chunk[3] - , phone : chunk[10] - } - this.push(data) - - callback() - })) - .on('data', function (data) { - all.push(data) - }) - .on('end', function () { - doSomethingSpecial(all) - }) -``` - -Note that `through2.obj(fn)` is a convenience wrapper around `through2({ objectMode: true }, fn)`. - -## API - -through2([ options, ] [ transformFunction ] [, flushFunction ]) - -Consult the **[stream.Transform](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_transform)** documentation for the exact rules of the `transformFunction` (i.e. `this._transform`) and the optional `flushFunction` (i.e. `this._flush`). - -### options - -The options argument is optional and is passed straight through to `stream.Transform`. So you can use `objectMode:true` if you are processing non-binary streams (or just use `through2.obj()`). - -The `options` argument is first, unlike standard convention, because if I'm passing in an anonymous function then I'd prefer for the options argument to not get lost at the end of the call: - -```js -fs.createReadStream('/tmp/important.dat') - .pipe(through2({ objectMode: true, allowHalfOpen: false }, - function (chunk, enc, cb) { - cb(null, 'wut?') // note we can use the second argument on the callback - // to provide data as an alternative to this.push('wut?') - } - ) - .pipe(fs.createWriteStream('/tmp/wut.txt')) -``` - -### transformFunction - -The `transformFunction` must have the following signature: `function (chunk, encoding, callback) {}`. A minimal implementation should call the `callback` function to indicate that the transformation is done, even if that transformation means discarding the chunk. - -To queue a new chunk, call `this.push(chunk)`—this can be called as many times as required before the `callback()` if you have multiple pieces to send on. - -Alternatively, you may use `callback(err, chunk)` as shorthand for emitting a single chunk or an error. - -If you **do not provide a `transformFunction`** then you will get a simple pass-through stream. - -### flushFunction - -The optional `flushFunction` is provided as the last argument (2nd or 3rd, depending on whether you've supplied options) is called just prior to the stream ending. Can be used to finish up any processing that may be in progress. - -```js -fs.createReadStream('/tmp/important.dat') - .pipe(through2( - function (chunk, enc, cb) { cb(null, chunk) }, // transform is a noop - function (cb) { // flush function - this.push('tacking on an extra buffer to the end'); - cb(); - } - )) - .pipe(fs.createWriteStream('/tmp/wut.txt')); -``` - -through2.ctor([ options, ] transformFunction[, flushFunction ]) - -Instead of returning a `stream.Transform` instance, `through2.ctor()` returns a **constructor** for a custom Transform. This is useful when you want to use the same transform logic in multiple instances. - -```js -var FToC = through2.ctor({objectMode: true}, function (record, encoding, callback) { - if (record.temp != null && record.unit = "F") { - record.temp = ( ( record.temp - 32 ) * 5 ) / 9 - record.unit = "C" - } - this.push(record) - callback() -}) - -// Create instances of FToC like so: -var converter = new FToC() -// Or: -var converter = FToC() -// Or specify/override options when you instantiate, if you prefer: -var converter = FToC({objectMode: true}) -``` - -## See Also - - - [through2-map](https://github.com/brycebaril/through2-map) - Array.prototype.map analog for streams. - - [through2-filter](https://github.com/brycebaril/through2-filter) - Array.prototype.filter analog for streams. - - [through2-reduce](https://github.com/brycebaril/through2-reduce) - Array.prototype.reduce analog for streams. - - [through2-spy](https://github.com/brycebaril/through2-spy) - Wrapper for simple stream.PassThrough spies. - -## License - -**through2** is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. +# through2 + +[![NPM](https://nodei.co/npm/through2.png?downloads&downloadRank)](https://nodei.co/npm/through2/) + +**A tiny wrapper around Node streams.Transform (Streams2) to avoid explicit subclassing noise** + +Inspired by [Dominic Tarr](https://github.com/dominictarr)'s [through](https://github.com/dominictarr/through) in that it's so much easier to make a stream out of a function than it is to set up the prototype chain properly: `through(function (chunk) { ... })`. + +Note: A **Streams3** version of through2 is available in npm with the tag `"1.0"` rather than `"latest"` so an `npm install through2` will get you the current Streams2 version (version number is 0.x.x). To use a Streams3 version use `npm install through2@1` to fetch the latest version 1.x.x. More information about Streams2 vs Streams3 and recommendations see the article **[Why I don't use Node's core 'stream' module](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html)**. + +```js +fs.createReadStream('ex.txt') + .pipe(through2(function (chunk, enc, callback) { + for (var i = 0; i < chunk.length; i++) + if (chunk[i] == 97) + chunk[i] = 122 // swap 'a' for 'z' + + this.push(chunk) + + callback() + })) + .pipe(fs.createWriteStream('out.txt')) +``` + +Or object streams: + +```js +var all = [] + +fs.createReadStream('data.csv') + .pipe(csv2()) + .pipe(through2.obj(function (chunk, enc, callback) { + var data = { + name : chunk[0] + , address : chunk[3] + , phone : chunk[10] + } + this.push(data) + + callback() + })) + .on('data', function (data) { + all.push(data) + }) + .on('end', function () { + doSomethingSpecial(all) + }) +``` + +Note that `through2.obj(fn)` is a convenience wrapper around `through2({ objectMode: true }, fn)`. + +## API + +through2([ options, ] [ transformFunction ] [, flushFunction ]) + +Consult the **[stream.Transform](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_transform)** documentation for the exact rules of the `transformFunction` (i.e. `this._transform`) and the optional `flushFunction` (i.e. `this._flush`). + +### options + +The options argument is optional and is passed straight through to `stream.Transform`. So you can use `objectMode:true` if you are processing non-binary streams (or just use `through2.obj()`). + +The `options` argument is first, unlike standard convention, because if I'm passing in an anonymous function then I'd prefer for the options argument to not get lost at the end of the call: + +```js +fs.createReadStream('/tmp/important.dat') + .pipe(through2({ objectMode: true, allowHalfOpen: false }, + function (chunk, enc, cb) { + cb(null, 'wut?') // note we can use the second argument on the callback + // to provide data as an alternative to this.push('wut?') + } + ) + .pipe(fs.createWriteStream('/tmp/wut.txt')) +``` + +### transformFunction + +The `transformFunction` must have the following signature: `function (chunk, encoding, callback) {}`. A minimal implementation should call the `callback` function to indicate that the transformation is done, even if that transformation means discarding the chunk. + +To queue a new chunk, call `this.push(chunk)`—this can be called as many times as required before the `callback()` if you have multiple pieces to send on. + +Alternatively, you may use `callback(err, chunk)` as shorthand for emitting a single chunk or an error. + +If you **do not provide a `transformFunction`** then you will get a simple pass-through stream. + +### flushFunction + +The optional `flushFunction` is provided as the last argument (2nd or 3rd, depending on whether you've supplied options) is called just prior to the stream ending. Can be used to finish up any processing that may be in progress. + +```js +fs.createReadStream('/tmp/important.dat') + .pipe(through2( + function (chunk, enc, cb) { cb(null, chunk) }, // transform is a noop + function (cb) { // flush function + this.push('tacking on an extra buffer to the end'); + cb(); + } + )) + .pipe(fs.createWriteStream('/tmp/wut.txt')); +``` + +through2.ctor([ options, ] transformFunction[, flushFunction ]) + +Instead of returning a `stream.Transform` instance, `through2.ctor()` returns a **constructor** for a custom Transform. This is useful when you want to use the same transform logic in multiple instances. + +```js +var FToC = through2.ctor({objectMode: true}, function (record, encoding, callback) { + if (record.temp != null && record.unit = "F") { + record.temp = ( ( record.temp - 32 ) * 5 ) / 9 + record.unit = "C" + } + this.push(record) + callback() +}) + +// Create instances of FToC like so: +var converter = new FToC() +// Or: +var converter = FToC() +// Or specify/override options when you instantiate, if you prefer: +var converter = FToC({objectMode: true}) +``` + +## See Also + + - [through2-map](https://github.com/brycebaril/through2-map) - Array.prototype.map analog for streams. + - [through2-filter](https://github.com/brycebaril/through2-filter) - Array.prototype.filter analog for streams. + - [through2-reduce](https://github.com/brycebaril/through2-reduce) - Array.prototype.reduce analog for streams. + - [through2-spy](https://github.com/brycebaril/through2-spy) - Wrapper for simple stream.PassThrough spies. + +## License + +**through2** is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/.npmignore b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/.npmignore index 5f30966c24..38344f87a6 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/.npmignore +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/.npmignore @@ -1,5 +1,5 @@ -build/ -test/ -examples/ -fs.js +build/ +test/ +examples/ +fs.js zlib.js \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/LICENSE b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/LICENSE index a7e984dc7f..e3d4e695a4 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/LICENSE +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/LICENSE @@ -1,18 +1,18 @@ -Copyright Joyent, Inc. and other Node contributors. All rights reserved. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/README.md b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/README.md index ea6e37bce3..3fb3e8023e 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/README.md +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/README.md @@ -1,15 +1,15 @@ -# readable-stream - -***Node-core streams for userland*** - -[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) -[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/) - -This package is a mirror of the Streams2 and Streams3 implementations in Node-core. - -If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core. - -**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12. - -**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"` - +# readable-stream + +***Node-core streams for userland*** + +[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) +[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/) + +This package is a mirror of the Streams2 and Streams3 implementations in Node-core. + +If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core. + +**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12. + +**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"` + diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/core-util-is/README.md b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/core-util-is/README.md index f82839d0ae..5a76b4149c 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/core-util-is/README.md +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/core-util-is/README.md @@ -1,3 +1,3 @@ -# core-util-is - -The `util.is*` functions introduced in Node v0.12. +# core-util-is + +The `util.is*` functions introduced in Node v0.12. diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/core-util-is/float.patch b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/core-util-is/float.patch index cbf3646ebe..a06d5c05f7 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/core-util-is/float.patch +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/core-util-is/float.patch @@ -1,604 +1,604 @@ -diff --git a/lib/util.js b/lib/util.js -index a03e874..9074e8e 100644 ---- a/lib/util.js -+++ b/lib/util.js -@@ -19,430 +19,6 @@ - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - --var formatRegExp = /%[sdj%]/g; --exports.format = function(f) { -- if (!isString(f)) { -- var objects = []; -- for (var i = 0; i < arguments.length; i++) { -- objects.push(inspect(arguments[i])); -- } -- return objects.join(' '); -- } -- -- var i = 1; -- var args = arguments; -- var len = args.length; -- var str = String(f).replace(formatRegExp, function(x) { -- if (x === '%%') return '%'; -- if (i >= len) return x; -- switch (x) { -- case '%s': return String(args[i++]); -- case '%d': return Number(args[i++]); -- case '%j': -- try { -- return JSON.stringify(args[i++]); -- } catch (_) { -- return '[Circular]'; -- } -- default: -- return x; -- } -- }); -- for (var x = args[i]; i < len; x = args[++i]) { -- if (isNull(x) || !isObject(x)) { -- str += ' ' + x; -- } else { -- str += ' ' + inspect(x); -- } -- } -- return str; --}; -- -- --// Mark that a method should not be used. --// Returns a modified function which warns once by default. --// If --no-deprecation is set, then it is a no-op. --exports.deprecate = function(fn, msg) { -- // Allow for deprecating things in the process of starting up. -- if (isUndefined(global.process)) { -- return function() { -- return exports.deprecate(fn, msg).apply(this, arguments); -- }; -- } -- -- if (process.noDeprecation === true) { -- return fn; -- } -- -- var warned = false; -- function deprecated() { -- if (!warned) { -- if (process.throwDeprecation) { -- throw new Error(msg); -- } else if (process.traceDeprecation) { -- console.trace(msg); -- } else { -- console.error(msg); -- } -- warned = true; -- } -- return fn.apply(this, arguments); -- } -- -- return deprecated; --}; -- -- --var debugs = {}; --var debugEnviron; --exports.debuglog = function(set) { -- if (isUndefined(debugEnviron)) -- debugEnviron = process.env.NODE_DEBUG || ''; -- set = set.toUpperCase(); -- if (!debugs[set]) { -- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { -- var pid = process.pid; -- debugs[set] = function() { -- var msg = exports.format.apply(exports, arguments); -- console.error('%s %d: %s', set, pid, msg); -- }; -- } else { -- debugs[set] = function() {}; -- } -- } -- return debugs[set]; --}; -- -- --/** -- * Echos the value of a value. Trys to print the value out -- * in the best way possible given the different types. -- * -- * @param {Object} obj The object to print out. -- * @param {Object} opts Optional options object that alters the output. -- */ --/* legacy: obj, showHidden, depth, colors*/ --function inspect(obj, opts) { -- // default options -- var ctx = { -- seen: [], -- stylize: stylizeNoColor -- }; -- // legacy... -- if (arguments.length >= 3) ctx.depth = arguments[2]; -- if (arguments.length >= 4) ctx.colors = arguments[3]; -- if (isBoolean(opts)) { -- // legacy... -- ctx.showHidden = opts; -- } else if (opts) { -- // got an "options" object -- exports._extend(ctx, opts); -- } -- // set default options -- if (isUndefined(ctx.showHidden)) ctx.showHidden = false; -- if (isUndefined(ctx.depth)) ctx.depth = 2; -- if (isUndefined(ctx.colors)) ctx.colors = false; -- if (isUndefined(ctx.customInspect)) ctx.customInspect = true; -- if (ctx.colors) ctx.stylize = stylizeWithColor; -- return formatValue(ctx, obj, ctx.depth); --} --exports.inspect = inspect; -- -- --// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics --inspect.colors = { -- '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] --}; -- --// Don't use 'blue' not visible on cmd.exe --inspect.styles = { -- 'special': 'cyan', -- 'number': 'yellow', -- 'boolean': 'yellow', -- 'undefined': 'grey', -- 'null': 'bold', -- 'string': 'green', -- 'date': 'magenta', -- // "name": intentionally not styling -- 'regexp': 'red' --}; -- -- --function stylizeWithColor(str, styleType) { -- var style = inspect.styles[styleType]; -- -- if (style) { -- return '\u001b[' + inspect.colors[style][0] + 'm' + str + -- '\u001b[' + inspect.colors[style][1] + 'm'; -- } else { -- return str; -- } --} -- -- --function stylizeNoColor(str, styleType) { -- return str; --} -- -- --function arrayToHash(array) { -- var hash = {}; -- -- array.forEach(function(val, idx) { -- hash[val] = true; -- }); -- -- return hash; --} -- -- --function formatValue(ctx, value, recurseTimes) { -- // Provide a hook for user-specified inspect functions. -- // Check that value is an object with an inspect function on it -- if (ctx.customInspect && -- value && -- isFunction(value.inspect) && -- // Filter out the util module, it's inspect function is special -- value.inspect !== exports.inspect && -- // Also filter out any prototype objects using the circular check. -- !(value.constructor && value.constructor.prototype === value)) { -- var ret = value.inspect(recurseTimes, ctx); -- if (!isString(ret)) { -- ret = formatValue(ctx, ret, recurseTimes); -- } -- return ret; -- } -- -- // Primitive types cannot have properties -- var primitive = formatPrimitive(ctx, value); -- if (primitive) { -- return primitive; -- } -- -- // Look up the keys of the object. -- var keys = Object.keys(value); -- var visibleKeys = arrayToHash(keys); -- -- if (ctx.showHidden) { -- keys = Object.getOwnPropertyNames(value); -- } -- -- // Some type of object without properties can be shortcutted. -- if (keys.length === 0) { -- if (isFunction(value)) { -- var name = value.name ? ': ' + value.name : ''; -- return ctx.stylize('[Function' + name + ']', 'special'); -- } -- if (isRegExp(value)) { -- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); -- } -- if (isDate(value)) { -- return ctx.stylize(Date.prototype.toString.call(value), 'date'); -- } -- if (isError(value)) { -- return formatError(value); -- } -- } -- -- var base = '', array = false, braces = ['{', '}']; -- -- // Make Array say that they are Array -- if (isArray(value)) { -- array = true; -- braces = ['[', ']']; -- } -- -- // Make functions say that they are functions -- if (isFunction(value)) { -- var n = value.name ? ': ' + value.name : ''; -- base = ' [Function' + n + ']'; -- } -- -- // Make RegExps say that they are RegExps -- if (isRegExp(value)) { -- base = ' ' + RegExp.prototype.toString.call(value); -- } -- -- // Make dates with properties first say the date -- if (isDate(value)) { -- base = ' ' + Date.prototype.toUTCString.call(value); -- } -- -- // Make error with message first say the error -- if (isError(value)) { -- base = ' ' + formatError(value); -- } -- -- if (keys.length === 0 && (!array || value.length == 0)) { -- return braces[0] + base + braces[1]; -- } -- -- if (recurseTimes < 0) { -- if (isRegExp(value)) { -- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); -- } else { -- return ctx.stylize('[Object]', 'special'); -- } -- } -- -- ctx.seen.push(value); -- -- var output; -- if (array) { -- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); -- } else { -- output = keys.map(function(key) { -- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); -- }); -- } -- -- ctx.seen.pop(); -- -- return reduceToSingleString(output, base, braces); --} -- -- --function formatPrimitive(ctx, value) { -- if (isUndefined(value)) -- return ctx.stylize('undefined', 'undefined'); -- if (isString(value)) { -- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') -- .replace(/'/g, "\\'") -- .replace(/\\"/g, '"') + '\''; -- return ctx.stylize(simple, 'string'); -- } -- if (isNumber(value)) { -- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0, -- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 . -- if (value === 0 && 1 / value < 0) -- return ctx.stylize('-0', 'number'); -- return ctx.stylize('' + value, 'number'); -- } -- if (isBoolean(value)) -- return ctx.stylize('' + value, 'boolean'); -- // For some reason typeof null is "object", so special case here. -- if (isNull(value)) -- return ctx.stylize('null', 'null'); --} -- -- --function formatError(value) { -- return '[' + Error.prototype.toString.call(value) + ']'; --} -- -- --function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { -- var output = []; -- for (var i = 0, l = value.length; i < l; ++i) { -- if (hasOwnProperty(value, String(i))) { -- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, -- String(i), true)); -- } else { -- output.push(''); -- } -- } -- keys.forEach(function(key) { -- if (!key.match(/^\d+$/)) { -- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, -- key, true)); -- } -- }); -- return output; --} -- -- --function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { -- var name, str, desc; -- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; -- if (desc.get) { -- if (desc.set) { -- str = ctx.stylize('[Getter/Setter]', 'special'); -- } else { -- str = ctx.stylize('[Getter]', 'special'); -- } -- } else { -- if (desc.set) { -- str = ctx.stylize('[Setter]', 'special'); -- } -- } -- if (!hasOwnProperty(visibleKeys, key)) { -- name = '[' + key + ']'; -- } -- if (!str) { -- if (ctx.seen.indexOf(desc.value) < 0) { -- if (isNull(recurseTimes)) { -- str = formatValue(ctx, desc.value, null); -- } else { -- str = formatValue(ctx, desc.value, recurseTimes - 1); -- } -- if (str.indexOf('\n') > -1) { -- if (array) { -- str = str.split('\n').map(function(line) { -- return ' ' + line; -- }).join('\n').substr(2); -- } else { -- str = '\n' + str.split('\n').map(function(line) { -- return ' ' + line; -- }).join('\n'); -- } -- } -- } else { -- str = ctx.stylize('[Circular]', 'special'); -- } -- } -- if (isUndefined(name)) { -- if (array && key.match(/^\d+$/)) { -- return str; -- } -- name = JSON.stringify('' + key); -- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { -- name = name.substr(1, name.length - 2); -- name = ctx.stylize(name, 'name'); -- } else { -- name = name.replace(/'/g, "\\'") -- .replace(/\\"/g, '"') -- .replace(/(^"|"$)/g, "'"); -- name = ctx.stylize(name, 'string'); -- } -- } -- -- return name + ': ' + str; --} -- -- --function reduceToSingleString(output, base, braces) { -- var numLinesEst = 0; -- var length = output.reduce(function(prev, cur) { -- numLinesEst++; -- if (cur.indexOf('\n') >= 0) numLinesEst++; -- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; -- }, 0); -- -- if (length > 60) { -- return braces[0] + -- (base === '' ? '' : base + '\n ') + -- ' ' + -- output.join(',\n ') + -- ' ' + -- braces[1]; -- } -- -- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; --} -- -- - // NOTE: These type checking functions intentionally don't use `instanceof` - // because it is fragile and can be easily faked with `Object.create()`. - function isArray(ar) { -@@ -522,166 +98,10 @@ function isPrimitive(arg) { - exports.isPrimitive = isPrimitive; - - function isBuffer(arg) { -- return arg instanceof Buffer; -+ return Buffer.isBuffer(arg); - } - exports.isBuffer = isBuffer; - - function objectToString(o) { - return Object.prototype.toString.call(o); --} -- -- --function pad(n) { -- return n < 10 ? '0' + n.toString(10) : n.toString(10); --} -- -- --var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', -- 'Oct', 'Nov', 'Dec']; -- --// 26 Feb 16:19:34 --function timestamp() { -- var d = new Date(); -- var time = [pad(d.getHours()), -- pad(d.getMinutes()), -- pad(d.getSeconds())].join(':'); -- return [d.getDate(), months[d.getMonth()], time].join(' '); --} -- -- --// log is just a thin wrapper to console.log that prepends a timestamp --exports.log = function() { -- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); --}; -- -- --/** -- * Inherit the prototype methods from one constructor into another. -- * -- * The Function.prototype.inherits from lang.js rewritten as a standalone -- * function (not on Function.prototype). NOTE: If this file is to be loaded -- * during bootstrapping this function needs to be rewritten using some native -- * functions as prototype setup using normal JavaScript does not work as -- * expected during bootstrapping (see mirror.js in r114903). -- * -- * @param {function} ctor Constructor function which needs to inherit the -- * prototype. -- * @param {function} superCtor Constructor function to inherit prototype from. -- */ --exports.inherits = function(ctor, superCtor) { -- ctor.super_ = superCtor; -- ctor.prototype = Object.create(superCtor.prototype, { -- constructor: { -- value: ctor, -- enumerable: false, -- writable: true, -- configurable: true -- } -- }); --}; -- --exports._extend = function(origin, add) { -- // Don't do anything if add isn't an object -- if (!add || !isObject(add)) return origin; -- -- var keys = Object.keys(add); -- var i = keys.length; -- while (i--) { -- origin[keys[i]] = add[keys[i]]; -- } -- return origin; --}; -- --function hasOwnProperty(obj, prop) { -- return Object.prototype.hasOwnProperty.call(obj, prop); --} -- -- --// Deprecated old stuff. -- --exports.p = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- console.error(exports.inspect(arguments[i])); -- } --}, 'util.p: Use console.error() instead'); -- -- --exports.exec = exports.deprecate(function() { -- return require('child_process').exec.apply(this, arguments); --}, 'util.exec is now called `child_process.exec`.'); -- -- --exports.print = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stdout.write(String(arguments[i])); -- } --}, 'util.print: Use console.log instead'); -- -- --exports.puts = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stdout.write(arguments[i] + '\n'); -- } --}, 'util.puts: Use console.log instead'); -- -- --exports.debug = exports.deprecate(function(x) { -- process.stderr.write('DEBUG: ' + x + '\n'); --}, 'util.debug: Use console.error instead'); -- -- --exports.error = exports.deprecate(function(x) { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stderr.write(arguments[i] + '\n'); -- } --}, 'util.error: Use console.error instead'); -- -- --exports.pump = exports.deprecate(function(readStream, writeStream, callback) { -- var callbackCalled = false; -- -- function call(a, b, c) { -- if (callback && !callbackCalled) { -- callback(a, b, c); -- callbackCalled = true; -- } -- } -- -- readStream.addListener('data', function(chunk) { -- if (writeStream.write(chunk) === false) readStream.pause(); -- }); -- -- writeStream.addListener('drain', function() { -- readStream.resume(); -- }); -- -- readStream.addListener('end', function() { -- writeStream.end(); -- }); -- -- readStream.addListener('close', function() { -- call(); -- }); -- -- readStream.addListener('error', function(err) { -- writeStream.end(); -- call(err); -- }); -- -- writeStream.addListener('error', function(err) { -- readStream.destroy(); -- call(err); -- }); --}, 'util.pump(): Use readableStream.pipe() instead'); -- -- --var uv; --exports._errnoException = function(err, syscall) { -- if (isUndefined(uv)) uv = process.binding('uv'); -- var errname = uv.errname(err); -- var e = new Error(syscall + ' ' + errname); -- e.code = errname; -- e.errno = errname; -- e.syscall = syscall; -- return e; --}; +diff --git a/lib/util.js b/lib/util.js +index a03e874..9074e8e 100644 +--- a/lib/util.js ++++ b/lib/util.js +@@ -19,430 +19,6 @@ + // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE + // USE OR OTHER DEALINGS IN THE SOFTWARE. + +-var formatRegExp = /%[sdj%]/g; +-exports.format = function(f) { +- if (!isString(f)) { +- var objects = []; +- for (var i = 0; i < arguments.length; i++) { +- objects.push(inspect(arguments[i])); +- } +- return objects.join(' '); +- } +- +- var i = 1; +- var args = arguments; +- var len = args.length; +- var str = String(f).replace(formatRegExp, function(x) { +- if (x === '%%') return '%'; +- if (i >= len) return x; +- switch (x) { +- case '%s': return String(args[i++]); +- case '%d': return Number(args[i++]); +- case '%j': +- try { +- return JSON.stringify(args[i++]); +- } catch (_) { +- return '[Circular]'; +- } +- default: +- return x; +- } +- }); +- for (var x = args[i]; i < len; x = args[++i]) { +- if (isNull(x) || !isObject(x)) { +- str += ' ' + x; +- } else { +- str += ' ' + inspect(x); +- } +- } +- return str; +-}; +- +- +-// Mark that a method should not be used. +-// Returns a modified function which warns once by default. +-// If --no-deprecation is set, then it is a no-op. +-exports.deprecate = function(fn, msg) { +- // Allow for deprecating things in the process of starting up. +- if (isUndefined(global.process)) { +- return function() { +- return exports.deprecate(fn, msg).apply(this, arguments); +- }; +- } +- +- if (process.noDeprecation === true) { +- return fn; +- } +- +- var warned = false; +- function deprecated() { +- if (!warned) { +- if (process.throwDeprecation) { +- throw new Error(msg); +- } else if (process.traceDeprecation) { +- console.trace(msg); +- } else { +- console.error(msg); +- } +- warned = true; +- } +- return fn.apply(this, arguments); +- } +- +- return deprecated; +-}; +- +- +-var debugs = {}; +-var debugEnviron; +-exports.debuglog = function(set) { +- if (isUndefined(debugEnviron)) +- debugEnviron = process.env.NODE_DEBUG || ''; +- set = set.toUpperCase(); +- if (!debugs[set]) { +- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { +- var pid = process.pid; +- debugs[set] = function() { +- var msg = exports.format.apply(exports, arguments); +- console.error('%s %d: %s', set, pid, msg); +- }; +- } else { +- debugs[set] = function() {}; +- } +- } +- return debugs[set]; +-}; +- +- +-/** +- * Echos the value of a value. Trys to print the value out +- * in the best way possible given the different types. +- * +- * @param {Object} obj The object to print out. +- * @param {Object} opts Optional options object that alters the output. +- */ +-/* legacy: obj, showHidden, depth, colors*/ +-function inspect(obj, opts) { +- // default options +- var ctx = { +- seen: [], +- stylize: stylizeNoColor +- }; +- // legacy... +- if (arguments.length >= 3) ctx.depth = arguments[2]; +- if (arguments.length >= 4) ctx.colors = arguments[3]; +- if (isBoolean(opts)) { +- // legacy... +- ctx.showHidden = opts; +- } else if (opts) { +- // got an "options" object +- exports._extend(ctx, opts); +- } +- // set default options +- if (isUndefined(ctx.showHidden)) ctx.showHidden = false; +- if (isUndefined(ctx.depth)) ctx.depth = 2; +- if (isUndefined(ctx.colors)) ctx.colors = false; +- if (isUndefined(ctx.customInspect)) ctx.customInspect = true; +- if (ctx.colors) ctx.stylize = stylizeWithColor; +- return formatValue(ctx, obj, ctx.depth); +-} +-exports.inspect = inspect; +- +- +-// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics +-inspect.colors = { +- '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] +-}; +- +-// Don't use 'blue' not visible on cmd.exe +-inspect.styles = { +- 'special': 'cyan', +- 'number': 'yellow', +- 'boolean': 'yellow', +- 'undefined': 'grey', +- 'null': 'bold', +- 'string': 'green', +- 'date': 'magenta', +- // "name": intentionally not styling +- 'regexp': 'red' +-}; +- +- +-function stylizeWithColor(str, styleType) { +- var style = inspect.styles[styleType]; +- +- if (style) { +- return '\u001b[' + inspect.colors[style][0] + 'm' + str + +- '\u001b[' + inspect.colors[style][1] + 'm'; +- } else { +- return str; +- } +-} +- +- +-function stylizeNoColor(str, styleType) { +- return str; +-} +- +- +-function arrayToHash(array) { +- var hash = {}; +- +- array.forEach(function(val, idx) { +- hash[val] = true; +- }); +- +- return hash; +-} +- +- +-function formatValue(ctx, value, recurseTimes) { +- // Provide a hook for user-specified inspect functions. +- // Check that value is an object with an inspect function on it +- if (ctx.customInspect && +- value && +- isFunction(value.inspect) && +- // Filter out the util module, it's inspect function is special +- value.inspect !== exports.inspect && +- // Also filter out any prototype objects using the circular check. +- !(value.constructor && value.constructor.prototype === value)) { +- var ret = value.inspect(recurseTimes, ctx); +- if (!isString(ret)) { +- ret = formatValue(ctx, ret, recurseTimes); +- } +- return ret; +- } +- +- // Primitive types cannot have properties +- var primitive = formatPrimitive(ctx, value); +- if (primitive) { +- return primitive; +- } +- +- // Look up the keys of the object. +- var keys = Object.keys(value); +- var visibleKeys = arrayToHash(keys); +- +- if (ctx.showHidden) { +- keys = Object.getOwnPropertyNames(value); +- } +- +- // Some type of object without properties can be shortcutted. +- if (keys.length === 0) { +- if (isFunction(value)) { +- var name = value.name ? ': ' + value.name : ''; +- return ctx.stylize('[Function' + name + ']', 'special'); +- } +- if (isRegExp(value)) { +- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); +- } +- if (isDate(value)) { +- return ctx.stylize(Date.prototype.toString.call(value), 'date'); +- } +- if (isError(value)) { +- return formatError(value); +- } +- } +- +- var base = '', array = false, braces = ['{', '}']; +- +- // Make Array say that they are Array +- if (isArray(value)) { +- array = true; +- braces = ['[', ']']; +- } +- +- // Make functions say that they are functions +- if (isFunction(value)) { +- var n = value.name ? ': ' + value.name : ''; +- base = ' [Function' + n + ']'; +- } +- +- // Make RegExps say that they are RegExps +- if (isRegExp(value)) { +- base = ' ' + RegExp.prototype.toString.call(value); +- } +- +- // Make dates with properties first say the date +- if (isDate(value)) { +- base = ' ' + Date.prototype.toUTCString.call(value); +- } +- +- // Make error with message first say the error +- if (isError(value)) { +- base = ' ' + formatError(value); +- } +- +- if (keys.length === 0 && (!array || value.length == 0)) { +- return braces[0] + base + braces[1]; +- } +- +- if (recurseTimes < 0) { +- if (isRegExp(value)) { +- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); +- } else { +- return ctx.stylize('[Object]', 'special'); +- } +- } +- +- ctx.seen.push(value); +- +- var output; +- if (array) { +- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); +- } else { +- output = keys.map(function(key) { +- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); +- }); +- } +- +- ctx.seen.pop(); +- +- return reduceToSingleString(output, base, braces); +-} +- +- +-function formatPrimitive(ctx, value) { +- if (isUndefined(value)) +- return ctx.stylize('undefined', 'undefined'); +- if (isString(value)) { +- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') +- .replace(/'/g, "\\'") +- .replace(/\\"/g, '"') + '\''; +- return ctx.stylize(simple, 'string'); +- } +- if (isNumber(value)) { +- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0, +- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 . +- if (value === 0 && 1 / value < 0) +- return ctx.stylize('-0', 'number'); +- return ctx.stylize('' + value, 'number'); +- } +- if (isBoolean(value)) +- return ctx.stylize('' + value, 'boolean'); +- // For some reason typeof null is "object", so special case here. +- if (isNull(value)) +- return ctx.stylize('null', 'null'); +-} +- +- +-function formatError(value) { +- return '[' + Error.prototype.toString.call(value) + ']'; +-} +- +- +-function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { +- var output = []; +- for (var i = 0, l = value.length; i < l; ++i) { +- if (hasOwnProperty(value, String(i))) { +- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, +- String(i), true)); +- } else { +- output.push(''); +- } +- } +- keys.forEach(function(key) { +- if (!key.match(/^\d+$/)) { +- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, +- key, true)); +- } +- }); +- return output; +-} +- +- +-function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { +- var name, str, desc; +- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; +- if (desc.get) { +- if (desc.set) { +- str = ctx.stylize('[Getter/Setter]', 'special'); +- } else { +- str = ctx.stylize('[Getter]', 'special'); +- } +- } else { +- if (desc.set) { +- str = ctx.stylize('[Setter]', 'special'); +- } +- } +- if (!hasOwnProperty(visibleKeys, key)) { +- name = '[' + key + ']'; +- } +- if (!str) { +- if (ctx.seen.indexOf(desc.value) < 0) { +- if (isNull(recurseTimes)) { +- str = formatValue(ctx, desc.value, null); +- } else { +- str = formatValue(ctx, desc.value, recurseTimes - 1); +- } +- if (str.indexOf('\n') > -1) { +- if (array) { +- str = str.split('\n').map(function(line) { +- return ' ' + line; +- }).join('\n').substr(2); +- } else { +- str = '\n' + str.split('\n').map(function(line) { +- return ' ' + line; +- }).join('\n'); +- } +- } +- } else { +- str = ctx.stylize('[Circular]', 'special'); +- } +- } +- if (isUndefined(name)) { +- if (array && key.match(/^\d+$/)) { +- return str; +- } +- name = JSON.stringify('' + key); +- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { +- name = name.substr(1, name.length - 2); +- name = ctx.stylize(name, 'name'); +- } else { +- name = name.replace(/'/g, "\\'") +- .replace(/\\"/g, '"') +- .replace(/(^"|"$)/g, "'"); +- name = ctx.stylize(name, 'string'); +- } +- } +- +- return name + ': ' + str; +-} +- +- +-function reduceToSingleString(output, base, braces) { +- var numLinesEst = 0; +- var length = output.reduce(function(prev, cur) { +- numLinesEst++; +- if (cur.indexOf('\n') >= 0) numLinesEst++; +- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; +- }, 0); +- +- if (length > 60) { +- return braces[0] + +- (base === '' ? '' : base + '\n ') + +- ' ' + +- output.join(',\n ') + +- ' ' + +- braces[1]; +- } +- +- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; +-} +- +- + // NOTE: These type checking functions intentionally don't use `instanceof` + // because it is fragile and can be easily faked with `Object.create()`. + function isArray(ar) { +@@ -522,166 +98,10 @@ function isPrimitive(arg) { + exports.isPrimitive = isPrimitive; + + function isBuffer(arg) { +- return arg instanceof Buffer; ++ return Buffer.isBuffer(arg); + } + exports.isBuffer = isBuffer; + + function objectToString(o) { + return Object.prototype.toString.call(o); +-} +- +- +-function pad(n) { +- return n < 10 ? '0' + n.toString(10) : n.toString(10); +-} +- +- +-var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', +- 'Oct', 'Nov', 'Dec']; +- +-// 26 Feb 16:19:34 +-function timestamp() { +- var d = new Date(); +- var time = [pad(d.getHours()), +- pad(d.getMinutes()), +- pad(d.getSeconds())].join(':'); +- return [d.getDate(), months[d.getMonth()], time].join(' '); +-} +- +- +-// log is just a thin wrapper to console.log that prepends a timestamp +-exports.log = function() { +- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); +-}; +- +- +-/** +- * Inherit the prototype methods from one constructor into another. +- * +- * The Function.prototype.inherits from lang.js rewritten as a standalone +- * function (not on Function.prototype). NOTE: If this file is to be loaded +- * during bootstrapping this function needs to be rewritten using some native +- * functions as prototype setup using normal JavaScript does not work as +- * expected during bootstrapping (see mirror.js in r114903). +- * +- * @param {function} ctor Constructor function which needs to inherit the +- * prototype. +- * @param {function} superCtor Constructor function to inherit prototype from. +- */ +-exports.inherits = function(ctor, superCtor) { +- ctor.super_ = superCtor; +- ctor.prototype = Object.create(superCtor.prototype, { +- constructor: { +- value: ctor, +- enumerable: false, +- writable: true, +- configurable: true +- } +- }); +-}; +- +-exports._extend = function(origin, add) { +- // Don't do anything if add isn't an object +- if (!add || !isObject(add)) return origin; +- +- var keys = Object.keys(add); +- var i = keys.length; +- while (i--) { +- origin[keys[i]] = add[keys[i]]; +- } +- return origin; +-}; +- +-function hasOwnProperty(obj, prop) { +- return Object.prototype.hasOwnProperty.call(obj, prop); +-} +- +- +-// Deprecated old stuff. +- +-exports.p = exports.deprecate(function() { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- console.error(exports.inspect(arguments[i])); +- } +-}, 'util.p: Use console.error() instead'); +- +- +-exports.exec = exports.deprecate(function() { +- return require('child_process').exec.apply(this, arguments); +-}, 'util.exec is now called `child_process.exec`.'); +- +- +-exports.print = exports.deprecate(function() { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- process.stdout.write(String(arguments[i])); +- } +-}, 'util.print: Use console.log instead'); +- +- +-exports.puts = exports.deprecate(function() { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- process.stdout.write(arguments[i] + '\n'); +- } +-}, 'util.puts: Use console.log instead'); +- +- +-exports.debug = exports.deprecate(function(x) { +- process.stderr.write('DEBUG: ' + x + '\n'); +-}, 'util.debug: Use console.error instead'); +- +- +-exports.error = exports.deprecate(function(x) { +- for (var i = 0, len = arguments.length; i < len; ++i) { +- process.stderr.write(arguments[i] + '\n'); +- } +-}, 'util.error: Use console.error instead'); +- +- +-exports.pump = exports.deprecate(function(readStream, writeStream, callback) { +- var callbackCalled = false; +- +- function call(a, b, c) { +- if (callback && !callbackCalled) { +- callback(a, b, c); +- callbackCalled = true; +- } +- } +- +- readStream.addListener('data', function(chunk) { +- if (writeStream.write(chunk) === false) readStream.pause(); +- }); +- +- writeStream.addListener('drain', function() { +- readStream.resume(); +- }); +- +- readStream.addListener('end', function() { +- writeStream.end(); +- }); +- +- readStream.addListener('close', function() { +- call(); +- }); +- +- readStream.addListener('error', function(err) { +- writeStream.end(); +- call(err); +- }); +- +- writeStream.addListener('error', function(err) { +- readStream.destroy(); +- call(err); +- }); +-}, 'util.pump(): Use readableStream.pipe() instead'); +- +- +-var uv; +-exports._errnoException = function(err, syscall) { +- if (isUndefined(uv)) uv = process.binding('uv'); +- var errname = uv.errname(err); +- var e = new Error(syscall + ' ' + errname); +- e.code = errname; +- e.errno = errname; +- e.syscall = syscall; +- return e; +-}; +} \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/core-util-is/package.json b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/core-util-is/package.json index bc05eb8a15..4eb9ce4f3c 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/core-util-is/package.json +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/core-util-is/package.json @@ -1,54 +1,54 @@ -{ - "name": "core-util-is", - "version": "1.0.1", - "description": "The `util.is*` functions introduced in Node v0.12.", - "main": "lib/util.js", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/core-util-is" - }, - "keywords": [ - "util", - "isBuffer", - "isArray", - "isNumber", - "isString", - "isRegExp", - "isThis", - "isThat", - "polyfill" - ], - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/isaacs/core-util-is/issues" - }, - "readme": "# core-util-is\n\nThe `util.is*` functions introduced in Node v0.12.\n", - "readmeFilename": "README.md", - "homepage": "https://github.com/isaacs/core-util-is", - "_id": "core-util-is@1.0.1", - "dist": { - "shasum": "6b07085aef9a3ccac6ee53bf9d3df0c1521a5538", - "tarball": "http://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" - }, - "_from": "core-util-is@~1.0.0", - "_npmVersion": "1.3.23", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - } - ], - "directories": {}, - "_shasum": "6b07085aef9a3ccac6ee53bf9d3df0c1521a5538", - "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz", - "scripts": {} -} +{ + "name": "core-util-is", + "version": "1.0.1", + "description": "The `util.is*` functions introduced in Node v0.12.", + "main": "lib/util.js", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/core-util-is" + }, + "keywords": [ + "util", + "isBuffer", + "isArray", + "isNumber", + "isString", + "isRegExp", + "isThis", + "isThat", + "polyfill" + ], + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/isaacs/core-util-is/issues" + }, + "readme": "# core-util-is\n\nThe `util.is*` functions introduced in Node v0.12.\n", + "readmeFilename": "README.md", + "homepage": "https://github.com/isaacs/core-util-is", + "_id": "core-util-is@1.0.1", + "dist": { + "shasum": "6b07085aef9a3ccac6ee53bf9d3df0c1521a5538", + "tarball": "http://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" + }, + "_from": "core-util-is@>=1.0.0 <1.1.0", + "_npmVersion": "1.3.23", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_shasum": "6b07085aef9a3ccac6ee53bf9d3df0c1521a5538", + "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz", + "scripts": {} +} diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/inherits/LICENSE b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/inherits/LICENSE index 1d68a100c1..dea3013d67 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/inherits/LICENSE +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/inherits/LICENSE @@ -1,16 +1,16 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. - +The ISC License + +Copyright (c) Isaac Z. Schlueter + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. + diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/inherits/README.md b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/inherits/README.md index b41e30c2c4..b1c5665855 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/inherits/README.md +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/inherits/README.md @@ -1,42 +1,42 @@ -Browser-friendly inheritance fully compatible with standard node.js -[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). - -This package exports standard `inherits` from node.js `util` module in -node environment, but also provides alternative browser-friendly -implementation through [browser -field](https://gist.github.com/shtylman/4339901). Alternative -implementation is a literal copy of standard one located in standalone -module to avoid requiring of `util`. It also has a shim for old -browsers with no `Object.create` support. - -While keeping you sure you are using standard `inherits` -implementation in node.js environment, it allows bundlers such as -[browserify](https://github.com/substack/node-browserify) to not -include full `util` package to your client code if all you need is -just `inherits` function. It worth, because browser shim for `util` -package is large and `inherits` is often the single function you need -from it. - -It's recommended to use this package instead of -`require('util').inherits` for any code that has chances to be used -not only in node.js but in browser too. - -## usage - -```js -var inherits = require('inherits'); -// then use exactly as the standard one -``` - -## note on version ~1.0 - -Version ~1.0 had completely different motivation and is not compatible -neither with 2.0 nor with standard node.js `inherits`. - -If you are using version ~1.0 and planning to switch to ~2.0, be -careful: - -* new version uses `super_` instead of `super` for referencing - superclass -* new version overwrites current prototype while old one preserves any - existing fields on it +Browser-friendly inheritance fully compatible with standard node.js +[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). + +This package exports standard `inherits` from node.js `util` module in +node environment, but also provides alternative browser-friendly +implementation through [browser +field](https://gist.github.com/shtylman/4339901). Alternative +implementation is a literal copy of standard one located in standalone +module to avoid requiring of `util`. It also has a shim for old +browsers with no `Object.create` support. + +While keeping you sure you are using standard `inherits` +implementation in node.js environment, it allows bundlers such as +[browserify](https://github.com/substack/node-browserify) to not +include full `util` package to your client code if all you need is +just `inherits` function. It worth, because browser shim for `util` +package is large and `inherits` is often the single function you need +from it. + +It's recommended to use this package instead of +`require('util').inherits` for any code that has chances to be used +not only in node.js but in browser too. + +## usage + +```js +var inherits = require('inherits'); +// then use exactly as the standard one +``` + +## note on version ~1.0 + +Version ~1.0 had completely different motivation and is not compatible +neither with 2.0 nor with standard node.js `inherits`. + +If you are using version ~1.0 and planning to switch to ~2.0, be +careful: + +* new version uses `super_` instead of `super` for referencing + superclass +* new version overwrites current prototype while old one preserves any + existing fields on it diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/inherits/package.json b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/inherits/package.json index 93381fb36a..15d6b42c81 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/inherits/package.json +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/inherits/package.json @@ -1,51 +1,51 @@ -{ - "name": "inherits", - "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", - "version": "2.0.1", - "keywords": [ - "inheritance", - "class", - "klass", - "oop", - "object-oriented", - "inherits", - "browser", - "browserify" - ], - "main": "./inherits.js", - "browser": "./inherits_browser.js", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/inherits" - }, - "license": "ISC", - "scripts": { - "test": "node test" - }, - "readme": "Browser-friendly inheritance fully compatible with standard node.js\n[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).\n\nThis package exports standard `inherits` from node.js `util` module in\nnode environment, but also provides alternative browser-friendly\nimplementation through [browser\nfield](https://gist.github.com/shtylman/4339901). Alternative\nimplementation is a literal copy of standard one located in standalone\nmodule to avoid requiring of `util`. It also has a shim for old\nbrowsers with no `Object.create` support.\n\nWhile keeping you sure you are using standard `inherits`\nimplementation in node.js environment, it allows bundlers such as\n[browserify](https://github.com/substack/node-browserify) to not\ninclude full `util` package to your client code if all you need is\njust `inherits` function. It worth, because browser shim for `util`\npackage is large and `inherits` is often the single function you need\nfrom it.\n\nIt's recommended to use this package instead of\n`require('util').inherits` for any code that has chances to be used\nnot only in node.js but in browser too.\n\n## usage\n\n```js\nvar inherits = require('inherits');\n// then use exactly as the standard one\n```\n\n## note on version ~1.0\n\nVersion ~1.0 had completely different motivation and is not compatible\nneither with 2.0 nor with standard node.js `inherits`.\n\nIf you are using version ~1.0 and planning to switch to ~2.0, be\ncareful:\n\n* new version uses `super_` instead of `super` for referencing\n superclass\n* new version overwrites current prototype while old one preserves any\n existing fields on it\n", - "readmeFilename": "README.md", - "bugs": { - "url": "https://github.com/isaacs/inherits/issues" - }, - "_id": "inherits@2.0.1", - "dist": { - "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", - "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" - }, - "_from": "inherits@~2.0.1", - "_npmVersion": "1.3.8", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - } - ], - "directories": {}, - "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", - "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "homepage": "https://github.com/isaacs/inherits" -} +{ + "name": "inherits", + "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", + "version": "2.0.1", + "keywords": [ + "inheritance", + "class", + "klass", + "oop", + "object-oriented", + "inherits", + "browser", + "browserify" + ], + "main": "./inherits.js", + "browser": "./inherits_browser.js", + "repository": { + "type": "git", + "url": "git://github.com/isaacs/inherits" + }, + "license": "ISC", + "scripts": { + "test": "node test" + }, + "readme": "Browser-friendly inheritance fully compatible with standard node.js\n[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor).\n\nThis package exports standard `inherits` from node.js `util` module in\nnode environment, but also provides alternative browser-friendly\nimplementation through [browser\nfield](https://gist.github.com/shtylman/4339901). Alternative\nimplementation is a literal copy of standard one located in standalone\nmodule to avoid requiring of `util`. It also has a shim for old\nbrowsers with no `Object.create` support.\n\nWhile keeping you sure you are using standard `inherits`\nimplementation in node.js environment, it allows bundlers such as\n[browserify](https://github.com/substack/node-browserify) to not\ninclude full `util` package to your client code if all you need is\njust `inherits` function. It worth, because browser shim for `util`\npackage is large and `inherits` is often the single function you need\nfrom it.\n\nIt's recommended to use this package instead of\n`require('util').inherits` for any code that has chances to be used\nnot only in node.js but in browser too.\n\n## usage\n\n```js\nvar inherits = require('inherits');\n// then use exactly as the standard one\n```\n\n## note on version ~1.0\n\nVersion ~1.0 had completely different motivation and is not compatible\nneither with 2.0 nor with standard node.js `inherits`.\n\nIf you are using version ~1.0 and planning to switch to ~2.0, be\ncareful:\n\n* new version uses `super_` instead of `super` for referencing\n superclass\n* new version overwrites current prototype while old one preserves any\n existing fields on it\n", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/isaacs/inherits/issues" + }, + "_id": "inherits@2.0.1", + "dist": { + "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" + }, + "_from": "inherits@>=2.0.1 <2.1.0", + "_npmVersion": "1.3.8", + "_npmUser": { + "name": "isaacs", + "email": "i@izs.me" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + } + ], + "directories": {}, + "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", + "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "homepage": "https://github.com/isaacs/inherits" +} diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/isarray/README.md b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/isarray/README.md index 0bda61192a..052a62b8d7 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/isarray/README.md +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/isarray/README.md @@ -1,54 +1,54 @@ - -# isarray - -`Array#isArray` for older browsers. - -## Usage - -```js -var isArray = require('isarray'); - -console.log(isArray([])); // => true -console.log(isArray({})); // => false -``` - -## Installation - -With [npm](http://npmjs.org) do - -```bash -$ npm install isarray -``` - -Then bundle for the browser with -[browserify](https://github.com/substack/browserify). - -With [component](http://component.io) do - -```bash -$ component install juliangruber/isarray -``` - -## License - -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies -of the Software, and to permit persons to whom the Software is furnished to do -so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. + +# isarray + +`Array#isArray` for older browsers. + +## Usage + +```js +var isArray = require('isarray'); + +console.log(isArray([])); // => true +console.log(isArray({})); // => false +``` + +## Installation + +With [npm](http://npmjs.org) do + +```bash +$ npm install isarray +``` + +Then bundle for the browser with +[browserify](https://github.com/substack/browserify). + +With [component](http://component.io) do + +```bash +$ component install juliangruber/isarray +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/isarray/component.json b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/isarray/component.json index d21b0c89f9..9e31b68388 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/isarray/component.json +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/isarray/component.json @@ -1,19 +1,19 @@ -{ - "name" : "isarray", - "description" : "Array#isArray for older browsers", - "version" : "0.0.1", - "repository" : "juliangruber/isarray", - "homepage": "https://github.com/juliangruber/isarray", - "main" : "index.js", - "scripts" : [ - "index.js" - ], - "dependencies" : {}, - "keywords": ["browser","isarray","array"], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT" -} +{ + "name" : "isarray", + "description" : "Array#isArray for older browsers", + "version" : "0.0.1", + "repository" : "juliangruber/isarray", + "homepage": "https://github.com/juliangruber/isarray", + "main" : "index.js", + "scripts" : [ + "index.js" + ], + "dependencies" : {}, + "keywords": ["browser","isarray","array"], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT" +} diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/isarray/package.json b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/isarray/package.json index 04be3652d6..fc7904b67b 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/isarray/package.json +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/isarray/package.json @@ -1,54 +1,54 @@ -{ - "name": "isarray", - "description": "Array#isArray for older browsers", - "version": "0.0.1", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/isarray.git" - }, - "homepage": "https://github.com/juliangruber/isarray", - "main": "index.js", - "scripts": { - "test": "tap test/*.js" - }, - "dependencies": {}, - "devDependencies": { - "tap": "*" - }, - "keywords": [ - "browser", - "isarray", - "array" - ], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT", - "readme": "\n# isarray\n\n`Array#isArray` for older browsers.\n\n## Usage\n\n```js\nvar isArray = require('isarray');\n\nconsole.log(isArray([])); // => true\nconsole.log(isArray({})); // => false\n```\n\n## Installation\n\nWith [npm](http://npmjs.org) do\n\n```bash\n$ npm install isarray\n```\n\nThen bundle for the browser with\n[browserify](https://github.com/substack/browserify).\n\nWith [component](http://component.io) do\n\n```bash\n$ component install juliangruber/isarray\n```\n\n## License\n\n(MIT)\n\nCopyright (c) 2013 Julian Gruber <julian@juliangruber.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n", - "readmeFilename": "README.md", - "_id": "isarray@0.0.1", - "dist": { - "shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", - "tarball": "http://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" - }, - "_from": "isarray@0.0.1", - "_npmVersion": "1.2.18", - "_npmUser": { - "name": "juliangruber", - "email": "julian@juliangruber.com" - }, - "maintainers": [ - { - "name": "juliangruber", - "email": "julian@juliangruber.com" - } - ], - "directories": {}, - "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", - "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "bugs": { - "url": "https://github.com/juliangruber/isarray/issues" - } -} +{ + "name": "isarray", + "description": "Array#isArray for older browsers", + "version": "0.0.1", + "repository": { + "type": "git", + "url": "git://github.com/juliangruber/isarray.git" + }, + "homepage": "https://github.com/juliangruber/isarray", + "main": "index.js", + "scripts": { + "test": "tap test/*.js" + }, + "dependencies": {}, + "devDependencies": { + "tap": "*" + }, + "keywords": [ + "browser", + "isarray", + "array" + ], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT", + "readme": "\n# isarray\n\n`Array#isArray` for older browsers.\n\n## Usage\n\n```js\nvar isArray = require('isarray');\n\nconsole.log(isArray([])); // => true\nconsole.log(isArray({})); // => false\n```\n\n## Installation\n\nWith [npm](http://npmjs.org) do\n\n```bash\n$ npm install isarray\n```\n\nThen bundle for the browser with\n[browserify](https://github.com/substack/browserify).\n\nWith [component](http://component.io) do\n\n```bash\n$ component install juliangruber/isarray\n```\n\n## License\n\n(MIT)\n\nCopyright (c) 2013 Julian Gruber <julian@juliangruber.com>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n", + "readmeFilename": "README.md", + "_id": "isarray@0.0.1", + "dist": { + "shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", + "tarball": "http://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" + }, + "_from": "isarray@0.0.1", + "_npmVersion": "1.2.18", + "_npmUser": { + "name": "juliangruber", + "email": "julian@juliangruber.com" + }, + "maintainers": [ + { + "name": "juliangruber", + "email": "julian@juliangruber.com" + } + ], + "directories": {}, + "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", + "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "bugs": { + "url": "https://github.com/juliangruber/isarray/issues" + } +} diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/.npmignore b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/.npmignore index 1233780faf..206320cc1d 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/.npmignore +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/.npmignore @@ -1,2 +1,2 @@ -build -test +build +test diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/LICENSE b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/LICENSE index 81f562e1b0..6de584a48f 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/LICENSE +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/LICENSE @@ -1,20 +1,20 @@ -Copyright Joyent, Inc. and other Node contributors. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to permit -persons to whom the Software is furnished to do so, subject to the -following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -USE OR OTHER DEALINGS IN THE SOFTWARE. +Copyright Joyent, Inc. and other Node contributors. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/README.md b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/README.md index d859f022ac..4d2aa00150 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/README.md +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/README.md @@ -1,7 +1,7 @@ -**string_decoder.js** (`require('string_decoder')`) from Node.js core - -Copyright Joyent, Inc. and other Node contributors. See LICENCE file for details. - -Version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.** - +**string_decoder.js** (`require('string_decoder')`) from Node.js core + +Copyright Joyent, Inc. and other Node contributors. See LICENCE file for details. + +Version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.** + The *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version. \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/package.json b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/package.json index 7d26335999..0364d54ba4 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/package.json +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/node_modules/string_decoder/package.json @@ -1,54 +1,54 @@ -{ - "name": "string_decoder", - "version": "0.10.31", - "description": "The string_decoder module from Node core", - "main": "index.js", - "dependencies": {}, - "devDependencies": { - "tap": "~0.4.8" - }, - "scripts": { - "test": "tap test/simple/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/rvagg/string_decoder.git" - }, - "homepage": "https://github.com/rvagg/string_decoder", - "keywords": [ - "string", - "decoder", - "browser", - "browserify" - ], - "license": "MIT", - "gitHead": "d46d4fd87cf1d06e031c23f1ba170ca7d4ade9a0", - "bugs": { - "url": "https://github.com/rvagg/string_decoder/issues" - }, - "_id": "string_decoder@0.10.31", - "_shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94", - "_from": "string_decoder@~0.10.x", - "_npmVersion": "1.4.23", - "_npmUser": { - "name": "rvagg", - "email": "rod@vagg.org" - }, - "maintainers": [ - { - "name": "substack", - "email": "mail@substack.net" - }, - { - "name": "rvagg", - "email": "rod@vagg.org" - } - ], - "dist": { - "shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94", - "tarball": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "string_decoder", + "version": "0.10.31", + "description": "The string_decoder module from Node core", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "tap": "~0.4.8" + }, + "scripts": { + "test": "tap test/simple/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/rvagg/string_decoder.git" + }, + "homepage": "https://github.com/rvagg/string_decoder", + "keywords": [ + "string", + "decoder", + "browser", + "browserify" + ], + "license": "MIT", + "gitHead": "d46d4fd87cf1d06e031c23f1ba170ca7d4ade9a0", + "bugs": { + "url": "https://github.com/rvagg/string_decoder/issues" + }, + "_id": "string_decoder@0.10.31", + "_shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94", + "_from": "string_decoder@>=0.10.0 <0.11.0", + "_npmVersion": "1.4.23", + "_npmUser": { + "name": "rvagg", + "email": "rod@vagg.org" + }, + "maintainers": [ + { + "name": "substack", + "email": "mail@substack.net" + }, + { + "name": "rvagg", + "email": "rod@vagg.org" + } + ], + "dist": { + "shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94", + "tarball": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/package.json b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/package.json index 5d4076fec4..7494ce4791 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/package.json +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/readable-stream/package.json @@ -1,70 +1,70 @@ -{ - "name": "readable-stream", - "version": "1.0.33", - "description": "Streams2, a user-land copy of the stream library from Node.js v0.10.x", - "main": "readable.js", - "dependencies": { - "core-util-is": "~1.0.0", - "isarray": "0.0.1", - "string_decoder": "~0.10.x", - "inherits": "~2.0.1" - }, - "devDependencies": { - "tap": "~0.2.6" - }, - "scripts": { - "test": "tap test/simple/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/isaacs/readable-stream" - }, - "keywords": [ - "readable", - "stream", - "pipe" - ], - "browser": { - "util": false - }, - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": "MIT", - "gitHead": "0bf97a117c5646556548966409ebc57a6dda2638", - "bugs": { - "url": "https://github.com/isaacs/readable-stream/issues" - }, - "homepage": "https://github.com/isaacs/readable-stream", - "_id": "readable-stream@1.0.33", - "_shasum": "3a360dd66c1b1d7fd4705389860eda1d0f61126c", - "_from": "readable-stream@>=1.0.33-1 <1.1.0-0", - "_npmVersion": "1.4.28", - "_npmUser": { - "name": "rvagg", - "email": "rod@vagg.org" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - }, - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - { - "name": "rvagg", - "email": "rod@vagg.org" - } - ], - "dist": { - "shasum": "3a360dd66c1b1d7fd4705389860eda1d0f61126c", - "tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "readable-stream", + "version": "1.0.33", + "description": "Streams2, a user-land copy of the stream library from Node.js v0.10.x", + "main": "readable.js", + "dependencies": { + "core-util-is": "~1.0.0", + "isarray": "0.0.1", + "string_decoder": "~0.10.x", + "inherits": "~2.0.1" + }, + "devDependencies": { + "tap": "~0.2.6" + }, + "scripts": { + "test": "tap test/simple/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/readable-stream" + }, + "keywords": [ + "readable", + "stream", + "pipe" + ], + "browser": { + "util": false + }, + "author": { + "name": "Isaac Z. Schlueter", + "email": "i@izs.me", + "url": "http://blog.izs.me/" + }, + "license": "MIT", + "gitHead": "0bf97a117c5646556548966409ebc57a6dda2638", + "bugs": { + "url": "https://github.com/isaacs/readable-stream/issues" + }, + "homepage": "https://github.com/isaacs/readable-stream", + "_id": "readable-stream@1.0.33", + "_shasum": "3a360dd66c1b1d7fd4705389860eda1d0f61126c", + "_from": "readable-stream@>=1.0.33-1 <1.1.0-0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "rvagg", + "email": "rod@vagg.org" + }, + "maintainers": [ + { + "name": "isaacs", + "email": "i@izs.me" + }, + { + "name": "tootallnate", + "email": "nathan@tootallnate.net" + }, + { + "name": "rvagg", + "email": "rod@vagg.org" + } + ], + "dist": { + "shasum": "3a360dd66c1b1d7fd4705389860eda1d0f61126c", + "tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/.jshintrc b/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/.jshintrc index 3ee75381ef..77887b5f0f 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/.jshintrc +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/.jshintrc @@ -1,30 +1,30 @@ -{ - "maxdepth": 4, - "maxstatements": 200, - "maxcomplexity": 12, - "maxlen": 80, - "maxparams": 5, - - "curly": true, - "eqeqeq": true, - "immed": true, - "latedef": false, - "noarg": true, - "noempty": true, - "nonew": true, - "undef": true, - "unused": "vars", - "trailing": true, - - "quotmark": true, - "expr": true, - "asi": true, - - "browser": false, - "esnext": true, - "devel": false, - "node": false, - "nonstandard": false, - - "predef": ["require", "module", "__dirname", "__filename"] -} +{ + "maxdepth": 4, + "maxstatements": 200, + "maxcomplexity": 12, + "maxlen": 80, + "maxparams": 5, + + "curly": true, + "eqeqeq": true, + "immed": true, + "latedef": false, + "noarg": true, + "noempty": true, + "nonew": true, + "undef": true, + "unused": "vars", + "trailing": true, + + "quotmark": true, + "expr": true, + "asi": true, + + "browser": false, + "esnext": true, + "devel": false, + "node": false, + "nonstandard": false, + + "predef": ["require", "module", "__dirname", "__filename"] +} diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/.npmignore b/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/.npmignore index 08b25532d6..3c3629e647 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/.npmignore +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/.npmignore @@ -1 +1 @@ -node_modules +node_modules diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/LICENCE b/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/LICENCE index 92196d3a91..1a14b437e8 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/LICENCE +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/LICENCE @@ -1,19 +1,19 @@ -Copyright (c) 2012-2014 Raynos. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +Copyright (c) 2012-2014 Raynos. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/Makefile b/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/Makefile index dae7eddd2a..d583fcf49d 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/Makefile +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/Makefile @@ -1,4 +1,4 @@ -browser: - node ./support/compile - +browser: + node ./support/compile + .PHONY: browser \ No newline at end of file diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/README.md b/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/README.md index 159297b523..093cb2978e 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/README.md +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/README.md @@ -1,32 +1,32 @@ -# xtend - -[![browser support][3]][4] - -[![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) - -Extend like a boss - -xtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes precedence. - -## Examples - -```js -var extend = require("xtend") - -// extend returns a new object. Does not mutate arguments -var combination = extend({ - a: "a", - b: 'c' -}, { - b: "b" -}) -// { a: "a", b: "b" } -``` - -## Stability status: Locked - -## MIT Licenced - - - [3]: http://ci.testling.com/Raynos/xtend.png - [4]: http://ci.testling.com/Raynos/xtend +# xtend + +[![browser support][3]][4] + +[![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) + +Extend like a boss + +xtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes precedence. + +## Examples + +```js +var extend = require("xtend") + +// extend returns a new object. Does not mutate arguments +var combination = extend({ + a: "a", + b: 'c' +}, { + b: "b" +}) +// { a: "a", b: "b" } +``` + +## Stability status: Locked + +## MIT Licenced + + + [3]: http://ci.testling.com/Raynos/xtend.png + [4]: http://ci.testling.com/Raynos/xtend diff --git a/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/package.json b/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/package.json index 8521724047..d90698e811 100644 --- a/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/package.json +++ b/node_modules/gulp-changed/node_modules/through2/node_modules/xtend/package.json @@ -1,88 +1,88 @@ -{ - "name": "xtend", - "version": "4.0.0", - "description": "extend like a boss", - "keywords": [ - "extend", - "merge", - "options", - "opts", - "object", - "array" - ], - "author": { - "name": "Raynos", - "email": "raynos2@gmail.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/Raynos/xtend.git" - }, - "main": "immutable", - "scripts": { - "test": "node test" - }, - "dependencies": {}, - "devDependencies": { - "tape": "~1.1.0" - }, - "homepage": "https://github.com/Raynos/xtend", - "contributors": [ - { - "name": "Jake Verbaten" - }, - { - "name": "Matt Esch" - } - ], - "bugs": { - "url": "https://github.com/Raynos/xtend/issues", - "email": "raynos2@gmail.com" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/raynos/xtend/raw/master/LICENSE" - } - ], - "testling": { - "files": "test.js", - "browsers": [ - "ie/7..latest", - "firefox/16..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest" - ] - }, - "engines": { - "node": ">=0.4" - }, - "gitHead": "94a95d76154103290533b2c55ffa0fe4be16bfef", - "_id": "xtend@4.0.0", - "_shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f", - "_from": "xtend@>=4.0.0 <4.1.0-0", - "_npmVersion": "1.4.15", - "_npmUser": { - "name": "raynos", - "email": "raynos2@gmail.com" - }, - "maintainers": [ - { - "name": "raynos", - "email": "raynos2@gmail.com" - } - ], - "dist": { - "shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f", - "tarball": "http://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "xtend", + "version": "4.0.0", + "description": "extend like a boss", + "keywords": [ + "extend", + "merge", + "options", + "opts", + "object", + "array" + ], + "author": { + "name": "Raynos", + "email": "raynos2@gmail.com" + }, + "repository": { + "type": "git", + "url": "git://github.com/Raynos/xtend.git" + }, + "main": "immutable", + "scripts": { + "test": "node test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "~1.1.0" + }, + "homepage": "https://github.com/Raynos/xtend", + "contributors": [ + { + "name": "Jake Verbaten" + }, + { + "name": "Matt Esch" + } + ], + "bugs": { + "url": "https://github.com/Raynos/xtend/issues", + "email": "raynos2@gmail.com" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/raynos/xtend/raw/master/LICENSE" + } + ], + "testling": { + "files": "test.js", + "browsers": [ + "ie/7..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest" + ] + }, + "engines": { + "node": ">=0.4" + }, + "gitHead": "94a95d76154103290533b2c55ffa0fe4be16bfef", + "_id": "xtend@4.0.0", + "_shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f", + "_from": "xtend@>=4.0.0 <4.1.0-0", + "_npmVersion": "1.4.15", + "_npmUser": { + "name": "raynos", + "email": "raynos2@gmail.com" + }, + "maintainers": [ + { + "name": "raynos", + "email": "raynos2@gmail.com" + } + ], + "dist": { + "shasum": "8bc36ff87aedbe7ce9eaf0bca36b2354a743840f", + "tarball": "http://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/node_modules/through2/package.json b/node_modules/gulp-changed/node_modules/through2/package.json index 6946d8875b..8e8a440c84 100644 --- a/node_modules/gulp-changed/node_modules/through2/package.json +++ b/node_modules/gulp-changed/node_modules/through2/package.json @@ -1,65 +1,65 @@ -{ - "name": "through2", - "version": "0.6.3", - "description": "A tiny wrapper around Node streams2 Transform to avoid explicit subclassing noise", - "main": "through2.js", - "scripts": { - "test": "node test/test.js", - "test-local": "brtapsauce-local test/basic-test.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/rvagg/through2.git" - }, - "keywords": [ - "stream", - "streams2", - "through", - "transform" - ], - "author": { - "name": "Rod Vagg", - "email": "r@va.gg", - "url": "https://github.com/rvagg" - }, - "license": "MIT", - "dependencies": { - "readable-stream": ">=1.0.33-1 <1.1.0-0", - "xtend": ">=4.0.0 <4.1.0-0" - }, - "devDependencies": { - "bl": ">=0.9.0 <0.10.0-0", - "stream-spigot": ">=3.0.4 <3.1.0-0", - "tape": ">=2.14.0 <2.15.0-0" - }, - "gitHead": "af9b735f360a4edef6e0ba601644457a82374fe7", - "bugs": { - "url": "https://github.com/rvagg/through2/issues" - }, - "homepage": "https://github.com/rvagg/through2", - "_id": "through2@0.6.3", - "_shasum": "795292fde9f254c2a368b38f9cc5d1bd4663afb6", - "_from": "through2@^0.6.1", - "_npmVersion": "1.4.23", - "_npmUser": { - "name": "rvagg", - "email": "rod@vagg.org" - }, - "maintainers": [ - { - "name": "rvagg", - "email": "rod@vagg.org" - }, - { - "name": "bryce", - "email": "bryce@ravenwall.com" - } - ], - "dist": { - "shasum": "795292fde9f254c2a368b38f9cc5d1bd4663afb6", - "tarball": "http://registry.npmjs.org/through2/-/through2-0.6.3.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/through2/-/through2-0.6.3.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "through2", + "version": "0.6.5", + "description": "A tiny wrapper around Node streams2 Transform to avoid explicit subclassing noise", + "main": "through2.js", + "scripts": { + "test": "node test/test.js", + "test-local": "brtapsauce-local test/basic-test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/rvagg/through2.git" + }, + "keywords": [ + "stream", + "streams2", + "through", + "transform" + ], + "author": { + "name": "Rod Vagg", + "email": "r@va.gg", + "url": "https://github.com/rvagg" + }, + "license": "MIT", + "dependencies": { + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-0" + }, + "devDependencies": { + "bl": ">=0.9.0 <0.10.0-0", + "stream-spigot": ">=3.0.4 <3.1.0-0", + "tape": ">=2.14.0 <2.15.0-0" + }, + "gitHead": "ba4a87875f2c82323c10023e36f4ae4b386c1bf8", + "bugs": { + "url": "https://github.com/rvagg/through2/issues" + }, + "homepage": "https://github.com/rvagg/through2", + "_id": "through2@0.6.5", + "_shasum": "41ab9c67b29d57209071410e1d7a7a968cd3ad48", + "_from": "through2@>=0.6.1 <0.7.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "bryce", + "email": "bryce@ravenwall.com" + }, + "maintainers": [ + { + "name": "rvagg", + "email": "rod@vagg.org" + }, + { + "name": "bryce", + "email": "bryce@ravenwall.com" + } + ], + "dist": { + "shasum": "41ab9c67b29d57209071410e1d7a7a968cd3ad48", + "tarball": "http://registry.npmjs.org/through2/-/through2-0.6.5.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-changed/package.json b/node_modules/gulp-changed/package.json index edcf93e8b7..07c6a10554 100644 --- a/node_modules/gulp-changed/package.json +++ b/node_modules/gulp-changed/package.json @@ -1,90 +1,89 @@ -{ - "name": "gulp-changed", - "version": "1.0.0", - "description": "Only pass through changed files", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/sindresorhus/gulp-changed" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "contributors": [ - { - "name": "Alex Gorbatchev", - "url": "https://github.com/alexgorbatchev" - }, - { - "name": "Bo-Yi Wu", - "url": "https://github.com/appleboy" - }, - { - "name": "Milan Gardian", - "url": "https://github.com/milang" - } - ], - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js" - ], - "keywords": [ - "gulpplugin", - "file", - "files", - "changed", - "newer", - "modified", - "modification", - "updated", - "time", - "mtime", - "stat", - "cache", - "cached", - "passthrough" - ], - "dependencies": { - "gulp-util": "^3.0.0", - "through2": "^0.6.1" - }, - "devDependencies": { - "concat-stream": "^1.4.6", - "gulp": "^3.0.0", - "mocha": "*", - "rimraf": "^2.2.6" - }, - "gitHead": "8762ee5d45549371ca423753068dfd32cfa7b85e", - "bugs": { - "url": "https://github.com/sindresorhus/gulp-changed/issues" - }, - "homepage": "https://github.com/sindresorhus/gulp-changed", - "_id": "gulp-changed@1.0.0", - "_shasum": "84c476118677755a233bb2ee7dfbf036fc573380", - "_from": "gulp-changed@", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "dist": { - "shasum": "84c476118677755a233bb2ee7dfbf036fc573380", - "tarball": "http://registry.npmjs.org/gulp-changed/-/gulp-changed-1.0.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/gulp-changed/-/gulp-changed-1.0.0.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "gulp-changed", + "version": "1.2.1", + "description": "Only pass through changed files", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/gulp-changed" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "contributors": [ + { + "name": "Alex Gorbatchev", + "url": "https://github.com/alexgorbatchev" + }, + { + "name": "Bo-Yi Wu", + "url": "https://github.com/appleboy" + }, + { + "name": "Milan Gardian", + "url": "https://github.com/milang" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "gulpplugin", + "file", + "files", + "changed", + "newer", + "modified", + "modification", + "updated", + "time", + "mtime", + "stat", + "cache", + "cached", + "passthrough" + ], + "dependencies": { + "gulp-util": "^3.0.0", + "through2": "^0.6.1" + }, + "devDependencies": { + "concat-stream": "^1.4.6", + "gulp": "^3.0.0", + "mocha": "*", + "rimraf": "^2.2.6" + }, + "gitHead": "7049c7e33a8210e64bf79492ea8fe6656518fc59", + "bugs": { + "url": "https://github.com/sindresorhus/gulp-changed/issues" + }, + "homepage": "https://github.com/sindresorhus/gulp-changed", + "_id": "gulp-changed@1.2.1", + "_shasum": "862074b3a7e98b02b9b4dec2b79392b8cdc7afbd", + "_from": "gulp-changed@1.2.1", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "862074b3a7e98b02b9b4dec2b79392b8cdc7afbd", + "tarball": "http://registry.npmjs.org/gulp-changed/-/gulp-changed-1.2.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/gulp-changed/-/gulp-changed-1.2.1.tgz" +} diff --git a/node_modules/gulp-changed/readme.md b/node_modules/gulp-changed/readme.md index 8511bd8416..68ef210805 100644 --- a/node_modules/gulp-changed/readme.md +++ b/node_modules/gulp-changed/readme.md @@ -1,108 +1,110 @@ -# [gulp](http://gulpjs.com)-changed [![Build Status](https://travis-ci.org/sindresorhus/gulp-changed.svg?branch=master)](https://travis-ci.org/sindresorhus/gulp-changed) - -> Only pass through changed files - -No more wasting precious time on processing unchanged files. - -By default it's only able to detect whether files in the stream changed. If you require something more advanced like knowing if imports/dependencies changed, create a custom comparator, or use [another plugin](https://github.com/gulpjs/gulp#incremental-builds). - - -## Install - -```sh -$ npm install --save-dev gulp-changed -``` - - -## Usage - -```js -var gulp = require('gulp'); -var changed = require('gulp-changed'); -var ngmin = require('gulp-ngmin'); // just as an example - -var SRC = 'src/*.js'; -var DEST = 'dist'; - -gulp.task('default', function () { - return gulp.src(SRC) - .pipe(changed(DEST)) - // ngmin will only get the files that - // changed since the last time it was run - .pipe(ngmin()) - .pipe(gulp.dest(DEST)); -}); -``` - -## API - -### changed(destination, options) - -#### destination - -Type: `string` - -The destination directory. Same as you put into `gulp.dest()`. - -This is needed to be able to compare the current files with the destination files. - -#### options - -##### cwd - -Type: `string` -Default: `process.cwd()` - -The working directory the folder is relative to. - -##### extension - -Type: `string` - -Extension of the destination files. - -Useful if it differs from the original, like in the example below: - -```js -gulp.task('jade', function () { - gulp.src('src/**/*.jade') - .pipe(changed('app', {extension: '.html'})) - .pipe(jade()) - .pipe(gulp.dest('app')) -}); -``` - -##### hasChanged - -Type: `function` -Default: `changed.compareLastModifiedTime` - -Function that determines whether the source file is different from the destination file. - -###### Built-in comparators - -- `changed.compareLastModifiedTime` -- `changed.compareSha1Digest` - -###### Example - -```js -gulp.task('jade', function () { - gulp.src('src/**/*.jade') - .pipe(changed('app', {hasChanged: changed.compareSha1Digest})) - .pipe(jade()) - .pipe(gulp.dest('app')); -}); -``` - -You can also supply a custom comparator function which will receive the following arguments: - -- `stream` *([transform object stream](https://github.com/rvagg/through2#transformfunction))* - should be used to queue `sourceFile` if it passes some comparison -- `callback` *(function)* - should be called when done -- `sourceFile` *([vinyl file object](https://github.com/wearefractal/vinyl#file))* -- `destPath` *(string)* - destination for `sourceFile` as an absolute path - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# gulp-changed [![Build Status](https://travis-ci.org/sindresorhus/gulp-changed.svg?branch=master)](https://travis-ci.org/sindresorhus/gulp-changed) + +> Only pass through changed files + +No more wasting precious time on processing unchanged files. + +By default it's only able to detect whether files in the stream changed. If you require something more advanced like knowing if imports/dependencies changed, create a custom comparator, or use [another plugin](https://github.com/gulpjs/gulp#incremental-builds). + + +## Install + +``` +$ npm install --save-dev gulp-changed +``` + + +## Usage + +```js +var gulp = require('gulp'); +var changed = require('gulp-changed'); +var ngmin = require('gulp-ngmin'); // just as an example + +var SRC = 'src/*.js'; +var DEST = 'dist'; + +gulp.task('default', function () { + return gulp.src(SRC) + .pipe(changed(DEST)) + // ngmin will only get the files that + // changed since the last time it was run + .pipe(ngmin()) + .pipe(gulp.dest(DEST)); +}); +``` + +## API + +### changed(destination, options) + +#### destination + +Type: `string`, `function` + +The destination directory. Same as you put into `gulp.dest()`. + +This is needed to be able to compare the current files with the destination files. + +Can also be a function returning a destination directory path. + +#### options + +##### cwd + +Type: `string` +Default: `process.cwd()` + +The working directory the folder is relative to. + +##### extension + +Type: `string` + +Extension of the destination files. + +Useful if it differs from the original, like in the example below: + +```js +gulp.task('jade', function () { + gulp.src('src/**/*.jade') + .pipe(changed('app', {extension: '.html'})) + .pipe(jade()) + .pipe(gulp.dest('app')) +}); +``` + +##### hasChanged + +Type: `function` +Default: `changed.compareLastModifiedTime` + +Function that determines whether the source file is different from the destination file. + +###### Built-in comparators + +- `changed.compareLastModifiedTime` +- `changed.compareSha1Digest` + +###### Example + +```js +gulp.task('jade', function () { + gulp.src('src/**/*.jade') + .pipe(changed('app', {hasChanged: changed.compareSha1Digest})) + .pipe(jade()) + .pipe(gulp.dest('app')); +}); +``` + +You can also supply a custom comparator function which will receive the following arguments: + +- `stream` *([transform object stream](https://github.com/rvagg/through2#transformfunction))* - should be used to queue `sourceFile` if it passes some comparison +- `callback` *(function)* - should be called when done +- `sourceFile` *([vinyl file object](https://github.com/wearefractal/vinyl#file))* +- `destPath` *(string)* - destination for `sourceFile` as an absolute path + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-shell/.eslintrc b/node_modules/gulp-shell/.eslintrc new file mode 100644 index 0000000000..3cf971c8ef --- /dev/null +++ b/node_modules/gulp-shell/.eslintrc @@ -0,0 +1,23 @@ +env: + node: true + +rules: + wrap-iife: 2 + strict: 0 + no-shadow: 0 + indent: [2, 2] + brace-style: [2, 1tbs, {allowSingleLine: true}] + comma-style: 2 + func-style: [2, declaration] + operator-assignment: [2, always] + padded-blocks: [2, never] + quote-props: [2, as-needed] + quotes: [2, single, avoid-escape] + semi: [2, never] + space-after-keywords: 2 + space-before-blocks: 2 + space-before-function-parentheses: {anonymous: always, named: never} + space-in-brackets: [2, never] + space-in-parens: [2, never] + space-unary-ops: [2, {words: true, nonwords: false}] + spaced-line-comment: 2 diff --git a/node_modules/gulp-shell/.jscsrc b/node_modules/gulp-shell/.jscsrc deleted file mode 100644 index 8e1246f23a..0000000000 --- a/node_modules/gulp-shell/.jscsrc +++ /dev/null @@ -1,86 +0,0 @@ -{ - "requireCurlyBraces": [], - "requireSpaceAfterKeywords": [ - "if", - "else", - "for", - "while", - "do", - "switch", - "return", - "try", - "catch" - ], - "requireSpacesInAnonymousFunctionExpression": { - "beforeOpeningRoundBrace": true, - "beforeOpeningCurlyBrace": true - }, - "requireSpacesInNamedFunctionExpression": { - "beforeOpeningCurlyBrace": true - }, - "disallowSpacesInNamedFunctionExpression": { - "beforeOpeningRoundBrace": true - }, - "disallowMultipleVarDecl": true, - "disallowSpacesInsideObjectBrackets": true, - "disallowSpacesInsideArrayBrackets": true, - "disallowSpacesInsideParentheses": true, - "disallowQuotedKeysInObjects": true, - "disallowDanglingUnderscores": true, - "disallowSpaceAfterObjectKeys": true, - "requireCommaBeforeLineBreak": true, - "disallowSpaceBeforeBinaryOperators": [ - "," - ], - "requireSpacesInConditionalExpression": true, - "disallowSpaceAfterPrefixUnaryOperators": true, - "disallowSpaceBeforePostfixUnaryOperators": true, - "requireSpaceBeforeBinaryOperators": [ - "+", - "-", - "/", - "*", - "=", - "==", - "===", - "!=", - "!==", - ">", - ">=", - "<", - "<=" - ], - "requireSpaceAfterBinaryOperators": [ - "+", - "-", - "/", - "*", - "=", - "==", - "===", - "!=", - "!==", - ">", - ">=", - "<", - "<=" - ], - "requireCamelCaseOrUpperCaseIdentifiers": true, - "disallowMultipleLineStrings": true, - "validateQuoteMarks": true, - "validateIndentation": 2, - "disallowTrailingWhitespace": true, - "disallowKeywordsOnNewLine": [ - "else", - "catch" - ], - "requireLineFeedAtFileEnd": true, - "requireDotNotation": true, - "disallowYodaConditions": true, - "validateJSDoc": { - "checkParamNames": true, - "checkRedundantParams": true, - "requireParamTypes": true - }, - "excludeFiles": ["node_modules/**"] -} diff --git a/node_modules/gulp-shell/.jshintrc b/node_modules/gulp-shell/.jshintrc deleted file mode 100644 index 7ca583230c..0000000000 --- a/node_modules/gulp-shell/.jshintrc +++ /dev/null @@ -1,13 +0,0 @@ -{ - "eqeqeq": true, - "immed": true, - "indent": 2, - "quotmark": true, - "undef": true, - "unused": true, - "trailing": true, - "asi": true, - "eqnull": true, - "node": true, - "predef": ["describe", "it", "before", "beforeEach", "after", "afterEach"] -} diff --git a/node_modules/gulp-shell/.npmignore b/node_modules/gulp-shell/.npmignore index 99c38a32c1..159ba20a58 100644 --- a/node_modules/gulp-shell/.npmignore +++ b/node_modules/gulp-shell/.npmignore @@ -1,4 +1,4 @@ -/node_modules/ -/npm-debug.log - -/coverage/ +/node_modules/ +/npm-debug.log + +/coverage/ diff --git a/node_modules/gulp-shell/.travis.yml b/node_modules/gulp-shell/.travis.yml index bffa4c5958..046ab1ab4e 100644 --- a/node_modules/gulp-shell/.travis.yml +++ b/node_modules/gulp-shell/.travis.yml @@ -1,5 +1,7 @@ -language: node_js -node_js: - - "0.10" -after_script: - - npm run coveralls +language: node_js +node_js: + - "0.10" + - "0.12" + - iojs +after_script: + - npm run coveralls diff --git a/node_modules/gulp-shell/LICENSE b/node_modules/gulp-shell/LICENSE index c111b87d39..31b69194ee 100644 --- a/node_modules/gulp-shell/LICENSE +++ b/node_modules/gulp-shell/LICENSE @@ -1,20 +1,20 @@ -The MIT License (MIT) - -Copyright (c) 2014 Sun Zheng'an - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +The MIT License (MIT) + +Copyright (c) 2014 Sun Zheng'an + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/gulp-shell/README.md b/node_modules/gulp-shell/README.md index dba3aaa91e..ca96ab0d79 100644 --- a/node_modules/gulp-shell/README.md +++ b/node_modules/gulp-shell/README.md @@ -1,116 +1,131 @@ -# gulp-shell - -[![NPM version][npm-image]][npm-url] -[![Build Status][travis-image]][travis-url] -[![Coveralls Status][coveralls-image]][coveralls-url] -[![Dependency Status][david-dm-image]][david-dm-url] - -[npm-url]: https://badge.fury.io/js/gulp-shell -[npm-image]: https://badge.fury.io/js/gulp-shell.png -[travis-url]: https://travis-ci.org/sun-zheng-an/gulp-shell -[travis-image]: https://travis-ci.org/sun-zheng-an/gulp-shell.png?branch=master -[coveralls-url]: https://coveralls.io/r/sun-zheng-an/gulp-shell -[coveralls-image]: https://coveralls.io/repos/sun-zheng-an/gulp-shell/badge.png?branch=master -[david-dm-url]: https://david-dm.org/sun-zheng-an/gulp-shell -[david-dm-image]: https://david-dm.org/sun-zheng-an/gulp-shell.png?theme=shields.io - -> A handy command line interface for gulp - -## Installation - -```shell -npm install --save-dev gulp-shell -``` - -## Usage - -```js -var gulp = require('gulp') -var shell = require('gulp-shell') - -gulp.task('example', function () { - return gulp.src('*.js', {read: false}) - .pipe(shell([ - 'echo <%= f(file.path) %>', - 'ls -l <%= file.path %>' - ], { - templateData: { - f: function (s) { - return s.replace(/$/, '.bak') - } - } - })) -}) -``` - -If you just want to execute a series of commands only once, starting the stream with `gulp.src('')` should do the trick. - -Or you can use this shorthand: - -```js -gulp.task('shorthand', shell.task([ - 'echo hello', - 'echo world' -])) -``` - -You can find more examples in the [gulpfile][] of this project. - -[gulpfile]: https://github.com/sun-zheng-an/gulp-shell/blob/master/gulpfile.js - -## API - -### shell(commands, options) or shell.task(commands, options) - -#### commands - -type: `Array` or `String` - -A command can be a [template][] which can be interpolated by some [file][] info (e.g. `file.path`). - -[template]: http://lodash.com/docs#template -[file]: https://github.com/wearefractal/vinyl - -#### options.ignoreErrors - -type: `Boolean` - -default: `false` - -By default, it will emit an `error` event when the command finishes unsuccessfully. - -#### options.quiet - -type: `Boolean` - -default: `false` - -By default, it will print the command output. - -#### options.cwd - -type: `String` - -default: [`process.cwd()`](http://nodejs.org/api/process.html#process_process_cwd) - -Sets the current working directory for the command. - -#### options.templateData - -type: `Object` - -The data that can be accessed in template. - -#### options.maxBuffer - -type: `Number` - -default: 16MB(16 * 1024 * 1024) - -You won't need to set this option unless you encounter a "stdout maxBuffer exceeded" error. - -#### options.env - -type: `Object` - -default: [`process.env`](http://nodejs.org/api/process.html#process_process_env) with `PATH` prepended by `./node_modules/.bin`, allowing you to run executables in your Node's dependencies. +# gulp-shell + +[![NPM version][npm-image]][npm-url] +[![Build Status][travis-image]][travis-url] +[![Coveralls Status][coveralls-image]][coveralls-url] +[![Dependency Status][david-dm-image]][david-dm-url] + +[npm-url]: https://badge.fury.io/js/gulp-shell +[npm-image]: https://badge.fury.io/js/gulp-shell.png +[travis-url]: https://travis-ci.org/sun-zheng-an/gulp-shell +[travis-image]: https://travis-ci.org/sun-zheng-an/gulp-shell.png?branch=master +[coveralls-url]: https://coveralls.io/r/sun-zheng-an/gulp-shell +[coveralls-image]: https://coveralls.io/repos/sun-zheng-an/gulp-shell/badge.png?branch=master +[david-dm-url]: https://david-dm.org/sun-zheng-an/gulp-shell +[david-dm-image]: https://david-dm.org/sun-zheng-an/gulp-shell.png?theme=shields.io + +> A handy command line interface for gulp + +## Installation + +```shell +npm install --save-dev gulp-shell +``` + +## Usage + +```js +var gulp = require('gulp') +var shell = require('gulp-shell') + +gulp.task('example', function () { + return gulp.src('*.js', {read: false}) + .pipe(shell([ + 'echo <%= f(file.path) %>', + 'ls -l <%= file.path %>' + ], { + templateData: { + f: function (s) { + return s.replace(/$/, '.bak') + } + } + })) +}) +``` + +If you just want to execute a series of commands only once, starting the stream with `gulp.src('')` should do the trick. + +Or you can use this shorthand: + +```js +gulp.task('shorthand', shell.task([ + 'echo hello', + 'echo world' +])) +``` + +You can find more examples in the [gulpfile][] of this project. + +[gulpfile]: https://github.com/sun-zheng-an/gulp-shell/blob/master/gulpfile.js + +## API + +### shell(commands, options) or shell.task(commands, options) + +#### commands + +type: `Array` or `String` + +A command can be a [template][] which can be interpolated by some [file][] info (e.g. `file.path`). + +[template]: http://lodash.com/docs#template +[file]: https://github.com/wearefractal/vinyl + +#### options.errorMessage + +type: `String` + +default: ``Command `<%= command %>` failed with exit code <%= error.code %>`` + +You can add a custom error message for when the command fails. +This can be a [template][] which can be interpolated with the current `command`, some [file][] info (e.g. `file.path`) and some [error][] info (e.g. `error.code`). + +[error]: http://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback + +#### options.ignoreErrors + +type: `Boolean` + +default: `false` + +By default, it will emit an `error` event when the command finishes unsuccessfully. + +#### options.quiet + +type: `Boolean` + +default: `false` + +By default, it will print the command output. + +#### options.cwd + +type: `String` + +default: [`process.cwd()`](http://nodejs.org/api/process.html#process_process_cwd) + +Sets the current working directory for the command. + +#### options.templateData + +type: `Object` + +The data that can be accessed in template. + +#### options.maxBuffer + +type: `Number` + +default: 16MB(16 * 1024 * 1024) + +You won't need to set this option unless you encounter a "stdout maxBuffer exceeded" error. + +#### options.env + +type: `Object` + +By default, all the commands will be executed in an environment with all the variables in [`process.env`](http://nodejs.org/api/process.html#process_process_env) and `PATH` prepended by `./node_modules/.bin` (allowing you to run executables in your Node's dependencies). + +You can override any environment variables with this option. + +For example, setting it to `{PATH: process.env.PATH}` will reset the `PATH` if the default one brings your some troubles. diff --git a/node_modules/gulp-shell/gulpfile.js b/node_modules/gulp-shell/gulpfile.js index e293d68c31..201ebe8e72 100644 --- a/node_modules/gulp-shell/gulpfile.js +++ b/node_modules/gulp-shell/gulpfile.js @@ -1,20 +1,17 @@ -var gulp = require('gulp') +var gulp = require('gulp') var shell = require('./') var paths = { js: ['*.js', 'test/*.js'] } -gulp.task('test', shell.task('mocha -R spec -r should')) +gulp.task('test', shell.task('mocha -R spec')) gulp.task('coverage', ['test'], shell.task('istanbul cover _mocha -- -R spec')) gulp.task('coveralls', ['coverage'], shell.task('cat coverage/lcov.info | coveralls')) -gulp.task('lint', shell.task([ - 'jshint ' + paths.js.join(' '), - 'jscs ' + paths.js.join(' '), -])) +gulp.task('lint', shell.task('eslint ' + paths.js.join(' '))) gulp.task('default', ['coverage', 'lint']) diff --git a/node_modules/gulp-shell/index.js b/node_modules/gulp-shell/index.js index ec7489c728..25dc203670 100644 --- a/node_modules/gulp-shell/index.js +++ b/node_modules/gulp-shell/index.js @@ -16,17 +16,18 @@ function shell(commands, options) { throw new gutil.PluginError(PLUGIN_NAME, 'Missing commands') } - var pathToBin = path.join(process.cwd(), 'node_modules/.bin') - var PATH = pathToBin + path.delimiter + process.env.PATH - options = _.extend({ ignoreErrors: false, + errorMessage: 'Command `<%= command %>` failed with exit code <%= error.code %>', quiet: false, cwd: process.cwd(), - env: _.defaults({PATH: PATH}, process.env), maxBuffer: 16 * 1024 * 1024 }, options) + var pathToBin = path.join(process.cwd(), 'node_modules/.bin') + var PATH = pathToBin + path.delimiter + process.env.PATH + options.env = _.extend({}, process.env, {PATH: PATH}, options.env) + var stream = through.obj(function (file, unused, done) { var self = this @@ -40,17 +41,27 @@ function shell(commands, options) { maxBuffer: options.maxBuffer }, function (error, stdout, stderr) { process.stdin.unpipe(child.stdin) + process.stdin.resume() process.stdin.pause() if (error && !options.ignoreErrors) { error.stdout = stdout error.stderr = stderr + + var errorContext = _.extend({ + command: command, + file: file, + error: error + }, options.templateData) + + error.message = gutil.template(options.errorMessage, errorContext) } done(options.ignoreErrors ? null : error) }) process.stdin.resume() + process.stdin.setEncoding('utf8') process.stdin.pipe(child.stdin) if (!options.quiet) { @@ -59,9 +70,9 @@ function shell(commands, options) { } }, function (error) { if (error) { - self.emit('error', new gutil.PluginError(PLUGIN_NAME, error, { - stdout: error.stdout, - stderr: error.stderr + self.emit('error', new gutil.PluginError({ + plugin: PLUGIN_NAME, + message: error.message })) } else { self.push(file) diff --git a/node_modules/gulp-shell/node_modules/async/.travis.yml b/node_modules/gulp-shell/node_modules/async/.travis.yml index e02e6b49f6..6064ca0926 100644 --- a/node_modules/gulp-shell/node_modules/async/.travis.yml +++ b/node_modules/gulp-shell/node_modules/async/.travis.yml @@ -1,3 +1,5 @@ -language: node_js -node_js: - - "0.10" +language: node_js +node_js: + - "0.10" + - "0.12" + - "iojs" diff --git a/node_modules/gulp-shell/node_modules/async/LICENSE b/node_modules/gulp-shell/node_modules/async/LICENSE index ebc655194e..8f29698588 100644 --- a/node_modules/gulp-shell/node_modules/async/LICENSE +++ b/node_modules/gulp-shell/node_modules/async/LICENSE @@ -1,19 +1,19 @@ -Copyright (c) 2010-2014 Caolan McMahon - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +Copyright (c) 2010-2014 Caolan McMahon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-shell/node_modules/async/README.md b/node_modules/gulp-shell/node_modules/async/README.md index 5bd628d289..6cfb922c53 100644 --- a/node_modules/gulp-shell/node_modules/async/README.md +++ b/node_modules/gulp-shell/node_modules/async/README.md @@ -1,1646 +1,1647 @@ -# Async.js - -[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async) - - -Async is a utility module which provides straight-forward, powerful functions -for working with asynchronous JavaScript. Although originally designed for -use with [Node.js](http://nodejs.org), it can also be used directly in the -browser. Also supports [component](https://github.com/component/component). - -Async provides around 20 functions that include the usual 'functional' -suspects (`map`, `reduce`, `filter`, `each`…) as well as some common patterns -for asynchronous control flow (`parallel`, `series`, `waterfall`…). All these -functions assume you follow the Node.js convention of providing a single -callback as the last argument of your `async` function. - - -## Quick Examples - -```javascript -async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file -}); - -async.filter(['file1','file2','file3'], fs.exists, function(results){ - // results now equals an array of the existing files -}); - -async.parallel([ - function(){ ... }, - function(){ ... } -], callback); - -async.series([ - function(){ ... }, - function(){ ... } -]); -``` - -There are many more functions available so take a look at the docs below for a -full list. This module aims to be comprehensive, so if you feel anything is -missing please create a GitHub issue for it. - -## Common Pitfalls - -### Binding a context to an iterator - -This section is really about `bind`, not about `async`. If you are wondering how to -make `async` execute your iterators in a given context, or are confused as to why -a method of another library isn't working as an iterator, study this example: - -```js -// Here is a simple object with an (unnecessarily roundabout) squaring method -var AsyncSquaringLibrary = { - squareExponent: 2, - square: function(number, callback){ - var result = Math.pow(number, this.squareExponent); - setTimeout(function(){ - callback(null, result); - }, 200); - } -}; - -async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){ - // result is [NaN, NaN, NaN] - // This fails because the `this.squareExponent` expression in the square - // function is not evaluated in the context of AsyncSquaringLibrary, and is - // therefore undefined. -}); - -async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){ - // result is [1, 4, 9] - // With the help of bind we can attach a context to the iterator before - // passing it to async. Now the square function will be executed in its - // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent` - // will be as expected. -}); -``` - -## Download - -The source is available for download from -[GitHub](http://github.com/caolan/async). -Alternatively, you can install using Node Package Manager (`npm`): - - npm install async - -__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed - -## In the Browser - -So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. - -Usage: - -```html - - -``` - -## Documentation - -### Collections - -* [`each`](#each) -* [`eachSeries`](#eachSeries) -* [`eachLimit`](#eachLimit) -* [`map`](#map) -* [`mapSeries`](#mapSeries) -* [`mapLimit`](#mapLimit) -* [`filter`](#filter) -* [`filterSeries`](#filterSeries) -* [`reject`](#reject) -* [`rejectSeries`](#rejectSeries) -* [`reduce`](#reduce) -* [`reduceRight`](#reduceRight) -* [`detect`](#detect) -* [`detectSeries`](#detectSeries) -* [`sortBy`](#sortBy) -* [`some`](#some) -* [`every`](#every) -* [`concat`](#concat) -* [`concatSeries`](#concatSeries) - -### Control Flow - -* [`series`](#seriestasks-callback) -* [`parallel`](#parallel) -* [`parallelLimit`](#parallellimittasks-limit-callback) -* [`whilst`](#whilst) -* [`doWhilst`](#doWhilst) -* [`until`](#until) -* [`doUntil`](#doUntil) -* [`forever`](#forever) -* [`waterfall`](#waterfall) -* [`compose`](#compose) -* [`seq`](#seq) -* [`applyEach`](#applyEach) -* [`applyEachSeries`](#applyEachSeries) -* [`queue`](#queue) -* [`priorityQueue`](#priorityQueue) -* [`cargo`](#cargo) -* [`auto`](#auto) -* [`retry`](#retry) -* [`iterator`](#iterator) -* [`apply`](#apply) -* [`nextTick`](#nextTick) -* [`times`](#times) -* [`timesSeries`](#timesSeries) - -### Utils - -* [`memoize`](#memoize) -* [`unmemoize`](#unmemoize) -* [`log`](#log) -* [`dir`](#dir) -* [`noConflict`](#noConflict) - - -## Collections - - - -### each(arr, iterator, callback) - -Applies the function `iterator` to each item in `arr`, in parallel. -The `iterator` is called with an item from the list, and a callback for when it -has finished. If the `iterator` passes an error to its `callback`, the main -`callback` (for the `each` function) is immediately called with the error. - -Note, that since this function applies `iterator` to each item in parallel, -there is no guarantee that the iterator functions will complete in order. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err)` which must be called once it has - completed. If no error has occured, the `callback` should be run without - arguments or with an explicit `null` argument. -* `callback(err)` - A callback which is called when all `iterator` functions - have finished, or an error occurs. - -__Examples__ - - -```js -// assuming openFiles is an array of file names and saveFile is a function -// to save the modified contents of that file: - -async.each(openFiles, saveFile, function(err){ - // if any of the saves produced an error, err would equal that error -}); -``` - -```js -// assuming openFiles is an array of file names - -async.each(openFiles, function( file, callback) { - - // Perform operation on file here. - console.log('Processing file ' + file); - - if( file.length > 32 ) { - console.log('This file name is too long'); - callback('File name too long'); - } else { - // Do work to process file here - console.log('File processed'); - callback(); - } -}, function(err){ - // if any of the file processing produced an error, err would equal that error - if( err ) { - // One of the iterations produced an error. - // All processing will now stop. - console.log('A file failed to process'); - } else { - console.log('All files have been processed successfully'); - } -}); -``` - ---------------------------------------- - - - -### eachSeries(arr, iterator, callback) - -The same as [`each`](#each), only `iterator` is applied to each item in `arr` in -series. The next `iterator` is only called once the current one has completed. -This means the `iterator` functions will complete in order. - - ---------------------------------------- - - - -### eachLimit(arr, limit, iterator, callback) - -The same as [`each`](#each), only no more than `limit` `iterator`s will be simultaneously -running at any time. - -Note that the items in `arr` are not processed in batches, so there is no guarantee that -the first `limit` `iterator` functions will complete before any others are started. - -__Arguments__ - -* `arr` - An array to iterate over. -* `limit` - The maximum number of `iterator`s to run at any time. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err)` which must be called once it has - completed. If no error has occured, the callback should be run without - arguments or with an explicit `null` argument. -* `callback(err)` - A callback which is called when all `iterator` functions - have finished, or an error occurs. - -__Example__ - -```js -// Assume documents is an array of JSON objects and requestApi is a -// function that interacts with a rate-limited REST api. - -async.eachLimit(documents, 20, requestApi, function(err){ - // if any of the saves produced an error, err would equal that error -}); -``` - ---------------------------------------- - - -### map(arr, iterator, callback) - -Produces a new array of values by mapping each value in `arr` through -the `iterator` function. The `iterator` is called with an item from `arr` and a -callback for when it has finished processing. Each of these callback takes 2 arguments: -an `error`, and the transformed item from `arr`. If `iterator` passes an error to this -callback, the main `callback` (for the `map` function) is immediately called with the error. - -Note, that since this function applies the `iterator` to each item in parallel, -there is no guarantee that the `iterator` functions will complete in order. -However, the results array will be in the same order as the original `arr`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, transformed)` which must be called once - it has completed with an error (which can be `null`) and a transformed item. -* `callback(err, results)` - A callback which is called when all `iterator` - functions have finished, or an error occurs. Results is an array of the - transformed items from the `arr`. - -__Example__ - -```js -async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file -}); -``` - ---------------------------------------- - - -### mapSeries(arr, iterator, callback) - -The same as [`map`](#map), only the `iterator` is applied to each item in `arr` in -series. The next `iterator` is only called once the current one has completed. -The results array will be in the same order as the original. - - ---------------------------------------- - - -### mapLimit(arr, limit, iterator, callback) - -The same as [`map`](#map), only no more than `limit` `iterator`s will be simultaneously -running at any time. - -Note that the items are not processed in batches, so there is no guarantee that -the first `limit` `iterator` functions will complete before any others are started. - -__Arguments__ - -* `arr` - An array to iterate over. -* `limit` - The maximum number of `iterator`s to run at any time. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, transformed)` which must be called once - it has completed with an error (which can be `null`) and a transformed item. -* `callback(err, results)` - A callback which is called when all `iterator` - calls have finished, or an error occurs. The result is an array of the - transformed items from the original `arr`. - -__Example__ - -```js -async.mapLimit(['file1','file2','file3'], 1, fs.stat, function(err, results){ - // results is now an array of stats for each file -}); -``` - ---------------------------------------- - - - -### filter(arr, iterator, callback) - -__Alias:__ `select` - -Returns a new array of all the values in `arr` which pass an async truth test. -_The callback for each `iterator` call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. This operation is -performed in parallel, but the results array will be in the same order as the -original. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in `arr`. - The `iterator` is passed a `callback(truthValue)`, which must be called with a - boolean argument once it has completed. -* `callback(results)` - A callback which is called after all the `iterator` - functions have finished. - -__Example__ - -```js -async.filter(['file1','file2','file3'], fs.exists, function(results){ - // results now equals an array of the existing files -}); -``` - ---------------------------------------- - - - -### filterSeries(arr, iterator, callback) - -__Alias:__ `selectSeries` - -The same as [`filter`](#filter) only the `iterator` is applied to each item in `arr` in -series. The next `iterator` is only called once the current one has completed. -The results array will be in the same order as the original. - ---------------------------------------- - - -### reject(arr, iterator, callback) - -The opposite of [`filter`](#filter). Removes values that pass an `async` truth test. - ---------------------------------------- - - -### rejectSeries(arr, iterator, callback) - -The same as [`reject`](#reject), only the `iterator` is applied to each item in `arr` -in series. - - ---------------------------------------- - - -### reduce(arr, memo, iterator, callback) - -__Aliases:__ `inject`, `foldl` - -Reduces `arr` into a single value using an async `iterator` to return -each successive step. `memo` is the initial state of the reduction. -This function only operates in series. - -For performance reasons, it may make sense to split a call to this function into -a parallel map, and then use the normal `Array.prototype.reduce` on the results. -This function is for situations where each step in the reduction needs to be async; -if you can get the data before reducing it, then it's probably a good idea to do so. - -__Arguments__ - -* `arr` - An array to iterate over. -* `memo` - The initial state of the reduction. -* `iterator(memo, item, callback)` - A function applied to each item in the - array to produce the next step in the reduction. The `iterator` is passed a - `callback(err, reduction)` which accepts an optional error as its first - argument, and the state of the reduction as the second. If an error is - passed to the callback, the reduction is stopped and the main `callback` is - immediately called with the error. -* `callback(err, result)` - A callback which is called after all the `iterator` - functions have finished. Result is the reduced value. - -__Example__ - -```js -async.reduce([1,2,3], 0, function(memo, item, callback){ - // pointless async: - process.nextTick(function(){ - callback(null, memo + item) - }); -}, function(err, result){ - // result is now equal to the last value of memo, which is 6 -}); -``` - ---------------------------------------- - - -### reduceRight(arr, memo, iterator, callback) - -__Alias:__ `foldr` - -Same as [`reduce`](#reduce), only operates on `arr` in reverse order. - - ---------------------------------------- - - -### detect(arr, iterator, callback) - -Returns the first value in `arr` that passes an async truth test. The -`iterator` is applied in parallel, meaning the first iterator to return `true` will -fire the detect `callback` with that result. That means the result might not be -the first item in the original `arr` (in terms of order) that passes the test. - -If order within the original `arr` is important, then look at [`detectSeries`](#detectSeries). - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in `arr`. - The iterator is passed a `callback(truthValue)` which must be called with a - boolean argument once it has completed. -* `callback(result)` - A callback which is called as soon as any iterator returns - `true`, or after all the `iterator` functions have finished. Result will be - the first item in the array that passes the truth test (iterator) or the - value `undefined` if none passed. - -__Example__ - -```js -async.detect(['file1','file2','file3'], fs.exists, function(result){ - // result now equals the first file in the list that exists -}); -``` - ---------------------------------------- - - -### detectSeries(arr, iterator, callback) - -The same as [`detect`](#detect), only the `iterator` is applied to each item in `arr` -in series. This means the result is always the first in the original `arr` (in -terms of array order) that passes the truth test. - - ---------------------------------------- - - -### sortBy(arr, iterator, callback) - -Sorts a list by the results of running each `arr` value through an async `iterator`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, sortValue)` which must be called once it - has completed with an error (which can be `null`) and a value to use as the sort - criteria. -* `callback(err, results)` - A callback which is called after all the `iterator` - functions have finished, or an error occurs. Results is the items from - the original `arr` sorted by the values returned by the `iterator` calls. - -__Example__ - -```js -async.sortBy(['file1','file2','file3'], function(file, callback){ - fs.stat(file, function(err, stats){ - callback(err, stats.mtime); - }); -}, function(err, results){ - // results is now the original array of files sorted by - // modified date -}); -``` - -__Sort Order__ - -By modifying the callback parameter the sorting order can be influenced: - -```js -//ascending order -async.sortBy([1,9,3,5], function(x, callback){ - callback(err, x); -}, function(err,result){ - //result callback -} ); - -//descending order -async.sortBy([1,9,3,5], function(x, callback){ - callback(err, x*-1); //<- x*-1 instead of x, turns the order around -}, function(err,result){ - //result callback -} ); -``` - ---------------------------------------- - - -### some(arr, iterator, callback) - -__Alias:__ `any` - -Returns `true` if at least one element in the `arr` satisfies an async test. -_The callback for each iterator call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. Once any iterator -call returns `true`, the main `callback` is immediately called. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in the array - in parallel. The iterator is passed a callback(truthValue) which must be - called with a boolean argument once it has completed. -* `callback(result)` - A callback which is called as soon as any iterator returns - `true`, or after all the iterator functions have finished. Result will be - either `true` or `false` depending on the values of the async tests. - -__Example__ - -```js -async.some(['file1','file2','file3'], fs.exists, function(result){ - // if result is true then at least one of the files exists -}); -``` - ---------------------------------------- - - -### every(arr, iterator, callback) - -__Alias:__ `all` - -Returns `true` if every element in `arr` satisfies an async test. -_The callback for each `iterator` call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in the array - in parallel. The iterator is passed a callback(truthValue) which must be - called with a boolean argument once it has completed. -* `callback(result)` - A callback which is called after all the `iterator` - functions have finished. Result will be either `true` or `false` depending on - the values of the async tests. - -__Example__ - -```js -async.every(['file1','file2','file3'], fs.exists, function(result){ - // if result is true then every file exists -}); -``` - ---------------------------------------- - - -### concat(arr, iterator, callback) - -Applies `iterator` to each item in `arr`, concatenating the results. Returns the -concatenated list. The `iterator`s are called in parallel, and the results are -concatenated as they return. There is no guarantee that the results array will -be returned in the original order of `arr` passed to the `iterator` function. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, results)` which must be called once it - has completed with an error (which can be `null`) and an array of results. -* `callback(err, results)` - A callback which is called after all the `iterator` - functions have finished, or an error occurs. Results is an array containing - the concatenated results of the `iterator` function. - -__Example__ - -```js -async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ - // files is now a list of filenames that exist in the 3 directories -}); -``` - ---------------------------------------- - - -### concatSeries(arr, iterator, callback) - -Same as [`concat`](#concat), but executes in series instead of parallel. - - -## Control Flow - - -### series(tasks, [callback]) - -Run the functions in the `tasks` array in series, each one running once the previous -function has completed. If any functions in the series pass an error to its -callback, no more functions are run, and `callback` is immediately called with the value of the error. -Otherwise, `callback` receives an array of results when `tasks` have completed. - -It is also possible to use an object instead of an array. Each property will be -run as a function, and the results will be passed to the final `callback` as an object -instead of an array. This can be a more readable way of handling results from -[`series`](#series). - -**Note** that while many implementations preserve the order of object properties, the -[ECMAScript Language Specifcation](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) -explicitly states that - -> The mechanics and order of enumerating the properties is not specified. - -So if you rely on the order in which your series of functions are executed, and want -this to work on all platforms, consider using an array. - -__Arguments__ - -* `tasks` - An array or object containing functions to run, each function is passed - a `callback(err, result)` it must call on completion with an error `err` (which can - be `null`) and an optional `result` value. -* `callback(err, results)` - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the `task` callbacks. - -__Example__ - -```js -async.series([ - function(callback){ - // do some stuff ... - callback(null, 'one'); - }, - function(callback){ - // do some more stuff ... - callback(null, 'two'); - } -], -// optional callback -function(err, results){ - // results is now equal to ['one', 'two'] -}); - - -// an example using an object instead of an array -async.series({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - } -}, -function(err, results) { - // results is now equal to: {one: 1, two: 2} -}); -``` - ---------------------------------------- - - -### parallel(tasks, [callback]) - -Run the `tasks` array of functions in parallel, without waiting until the previous -function has completed. If any of the functions pass an error to its -callback, the main `callback` is immediately called with the value of the error. -Once the `tasks` have completed, the results are passed to the final `callback` as an -array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final `callback` as an object -instead of an array. This can be a more readable way of handling results from -[`parallel`](#parallel). - - -__Arguments__ - -* `tasks` - An array or object containing functions to run. Each function is passed - a `callback(err, result)` which it must call on completion with an error `err` - (which can be `null`) and an optional `result` value. -* `callback(err, results)` - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the task callbacks. - -__Example__ - -```js -async.parallel([ - function(callback){ - setTimeout(function(){ - callback(null, 'one'); - }, 200); - }, - function(callback){ - setTimeout(function(){ - callback(null, 'two'); - }, 100); - } -], -// optional callback -function(err, results){ - // the results array will equal ['one','two'] even though - // the second function had a shorter timeout. -}); - - -// an example using an object instead of an array -async.parallel({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - } -}, -function(err, results) { - // results is now equals to: {one: 1, two: 2} -}); -``` - ---------------------------------------- - - -### parallelLimit(tasks, limit, [callback]) - -The same as [`parallel`](#parallel), only `tasks` are executed in parallel -with a maximum of `limit` tasks executing at any time. - -Note that the `tasks` are not executed in batches, so there is no guarantee that -the first `limit` tasks will complete before any others are started. - -__Arguments__ - -* `tasks` - An array or object containing functions to run, each function is passed - a `callback(err, result)` it must call on completion with an error `err` (which can - be `null`) and an optional `result` value. -* `limit` - The maximum number of `tasks` to run at any time. -* `callback(err, results)` - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the `task` callbacks. - ---------------------------------------- - - -### whilst(test, fn, callback) - -Repeatedly call `fn`, while `test` returns `true`. Calls `callback` when stopped, -or an error occurs. - -__Arguments__ - -* `test()` - synchronous truth test to perform before each execution of `fn`. -* `fn(callback)` - A function which is called each time `test` passes. The function is - passed a `callback(err)`, which must be called once it has completed with an - optional `err` argument. -* `callback(err)` - A callback which is called after the test fails and repeated - execution of `fn` has stopped. - -__Example__ - -```js -var count = 0; - -async.whilst( - function () { return count < 5; }, - function (callback) { - count++; - setTimeout(callback, 1000); - }, - function (err) { - // 5 seconds have passed - } -); -``` - ---------------------------------------- - - -### doWhilst(fn, test, callback) - -The post-check version of [`whilst`](#whilst). To reflect the difference in -the order of operations, the arguments `test` and `fn` are switched. - -`doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. - ---------------------------------------- - - -### until(test, fn, callback) - -Repeatedly call `fn` until `test` returns `true`. Calls `callback` when stopped, -or an error occurs. - -The inverse of [`whilst`](#whilst). - ---------------------------------------- - - -### doUntil(fn, test, callback) - -Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument ordering differs from `until`. - ---------------------------------------- - - -### forever(fn, errback) - -Calls the asynchronous function `fn` with a callback parameter that allows it to -call itself again, in series, indefinitely. - -If an error is passed to the callback then `errback` is called with the -error, and execution stops, otherwise it will never be called. - -```js -async.forever( - function(next) { - // next is suitable for passing to things that need a callback(err [, whatever]); - // it will result in this function being called again. - }, - function(err) { - // if next is called with a value in its first parameter, it will appear - // in here as 'err', and execution will stop. - } -); -``` - ---------------------------------------- - - -### waterfall(tasks, [callback]) - -Runs the `tasks` array of functions in series, each passing their results to the next in -the array. However, if any of the `tasks` pass an error to their own callback, the -next function is not executed, and the main `callback` is immediately called with -the error. - -__Arguments__ - -* `tasks` - An array of functions to run, each function is passed a - `callback(err, result1, result2, ...)` it must call on completion. The first - argument is an error (which can be `null`) and any further arguments will be - passed as arguments in order to the next task. -* `callback(err, [results])` - An optional callback to run once all the functions - have completed. This will be passed the results of the last task's callback. - - - -__Example__ - -```js -async.waterfall([ - function(callback){ - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback){ - // arg1 now equals 'one' and arg2 now equals 'two' - callback(null, 'three'); - }, - function(arg1, callback){ - // arg1 now equals 'three' - callback(null, 'done'); - } -], function (err, result) { - // result now equals 'done' -}); -``` - ---------------------------------------- - -### compose(fn1, fn2...) - -Creates a function which is a composition of the passed asynchronous -functions. Each function consumes the return value of the function that -follows. Composing functions `f()`, `g()`, and `h()` would produce the result of -`f(g(h()))`, only this version uses callbacks to obtain the return values. - -Each function is executed with the `this` binding of the composed function. - -__Arguments__ - -* `functions...` - the asynchronous functions to compose - - -__Example__ - -```js -function add1(n, callback) { - setTimeout(function () { - callback(null, n + 1); - }, 10); -} - -function mul3(n, callback) { - setTimeout(function () { - callback(null, n * 3); - }, 10); -} - -var add1mul3 = async.compose(mul3, add1); - -add1mul3(4, function (err, result) { - // result now equals 15 -}); -``` - ---------------------------------------- - -### seq(fn1, fn2...) - -Version of the compose function that is more natural to read. -Each following function consumes the return value of the latter function. - -Each function is executed with the `this` binding of the composed function. - -__Arguments__ - -* functions... - the asynchronous functions to compose - - -__Example__ - -```js -// Requires lodash (or underscore), express3 and dresende's orm2. -// Part of an app, that fetches cats of the logged user. -// This example uses `seq` function to avoid overnesting and error -// handling clutter. -app.get('/cats', function(request, response) { - function handleError(err, data, callback) { - if (err) { - console.error(err); - response.json({ status: 'error', message: err.message }); - } - else { - callback(data); - } - } - var User = request.models.User; - async.seq( - _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) - handleError, - function(user, fn) { - user.getCats(fn); // 'getCats' has signature (callback(err, data)) - }, - handleError, - function(cats) { - response.json({ status: 'ok', message: 'Cats found', data: cats }); - } - )(req.session.user_id); - } -}); -``` - ---------------------------------------- - -### applyEach(fns, args..., callback) - -Applies the provided arguments to each function in the array, calling -`callback` after all functions have completed. If you only provide the first -argument, then it will return a function which lets you pass in the -arguments as if it were a single function call. - -__Arguments__ - -* `fns` - the asynchronous functions to all call with the same arguments -* `args...` - any number of separate arguments to pass to the function -* `callback` - the final argument should be the callback, called when all - functions have completed processing - - -__Example__ - -```js -async.applyEach([enableSearch, updateSchema], 'bucket', callback); - -// partial application example: -async.each( - buckets, - async.applyEach([enableSearch, updateSchema]), - callback -); -``` - ---------------------------------------- - - -### applyEachSeries(arr, iterator, callback) - -The same as [`applyEach`](#applyEach) only the functions are applied in series. - ---------------------------------------- - - -### queue(worker, concurrency) - -Creates a `queue` object with the specified `concurrency`. Tasks added to the -`queue` are processed in parallel (up to the `concurrency` limit). If all -`worker`s are in progress, the task is queued until one becomes available. -Once a `worker` completes a `task`, that `task`'s callback is called. - -__Arguments__ - -* `worker(task, callback)` - An asynchronous function for processing a queued - task, which must call its `callback(err)` argument when finished, with an - optional `error` as an argument. -* `concurrency` - An `integer` for determining how many `worker` functions should be - run in parallel. - -__Queue objects__ - -The `queue` object returned by this function has the following properties and -methods: - -* `length()` - a function returning the number of items waiting to be processed. -* `started` - a function returning whether or not any items have been pushed and processed by the queue -* `running()` - a function returning the number of items currently being processed. -* `idle()` - a function returning false if there are items waiting or being processed, or true if not. -* `concurrency` - an integer for determining how many `worker` functions should be - run in parallel. This property can be changed after a `queue` is created to - alter the concurrency on-the-fly. -* `push(task, [callback])` - add a new task to the `queue`. Calls `callback` once - the `worker` has finished processing the task. Instead of a single task, a `tasks` array - can be submitted. The respective callback is used for every task in the list. -* `unshift(task, [callback])` - add a new task to the front of the `queue`. -* `saturated` - a callback that is called when the `queue` length hits the `concurrency` limit, - and further tasks will be queued. -* `empty` - a callback that is called when the last item from the `queue` is given to a `worker`. -* `drain` - a callback that is called when the last item from the `queue` has returned from the `worker`. -* `paused` - a boolean for determining whether the queue is in a paused state -* `pause()` - a function that pauses the processing of tasks until `resume()` is called. -* `resume()` - a function that resumes the processing of queued tasks when the queue is paused. -* `kill()` - a function that empties remaining tasks from the queue forcing it to go idle. - -__Example__ - -```js -// create a queue object with concurrency 2 - -var q = async.queue(function (task, callback) { - console.log('hello ' + task.name); - callback(); -}, 2); - - -// assign a callback -q.drain = function() { - console.log('all items have been processed'); -} - -// add some items to the queue - -q.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); -}); -q.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); - -// add some items to the queue (batch-wise) - -q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { - console.log('finished processing bar'); -}); - -// add some items to the front of the queue - -q.unshift({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); -``` - - ---------------------------------------- - - -### priorityQueue(worker, concurrency) - -The same as [`queue`](#queue) only tasks are assigned a priority and completed in ascending priority order. There are two differences between `queue` and `priorityQueue` objects: - -* `push(task, priority, [callback])` - `priority` should be a number. If an array of - `tasks` is given, all tasks will be assigned the same priority. -* The `unshift` method was removed. - ---------------------------------------- - - -### cargo(worker, [payload]) - -Creates a `cargo` object with the specified payload. Tasks added to the -cargo will be processed altogether (up to the `payload` limit). If the -`worker` is in progress, the task is queued until it becomes available. Once -the `worker` has completed some tasks, each callback of those tasks is called. -Check out [this animation](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) for how `cargo` and `queue` work. - -While [queue](#queue) passes only one task to one of a group of workers -at a time, cargo passes an array of tasks to a single worker, repeating -when the worker is finished. - -__Arguments__ - -* `worker(tasks, callback)` - An asynchronous function for processing an array of - queued tasks, which must call its `callback(err)` argument when finished, with - an optional `err` argument. -* `payload` - An optional `integer` for determining how many tasks should be - processed per round; if omitted, the default is unlimited. - -__Cargo objects__ - -The `cargo` object returned by this function has the following properties and -methods: - -* `length()` - A function returning the number of items waiting to be processed. -* `payload` - An `integer` for determining how many tasks should be - process per round. This property can be changed after a `cargo` is created to - alter the payload on-the-fly. -* `push(task, [callback])` - Adds `task` to the `queue`. The callback is called - once the `worker` has finished processing the task. Instead of a single task, an array of `tasks` - can be submitted. The respective callback is used for every task in the list. -* `saturated` - A callback that is called when the `queue.length()` hits the concurrency and further tasks will be queued. -* `empty` - A callback that is called when the last item from the `queue` is given to a `worker`. -* `drain` - A callback that is called when the last item from the `queue` has returned from the `worker`. - -__Example__ - -```js -// create a cargo object with payload 2 - -var cargo = async.cargo(function (tasks, callback) { - for(var i=0; i -### auto(tasks, [callback]) - -Determines the best order for running the functions in `tasks`, based on their -requirements. Each function can optionally depend on other functions being completed -first, and each function is run as soon as its requirements are satisfied. - -If any of the functions pass an error to their callback, it will not -complete (so any other functions depending on it will not run), and the main -`callback` is immediately called with the error. Functions also receive an -object containing the results of functions which have completed so far. - -Note, all functions are called with a `results` object as a second argument, -so it is unsafe to pass functions in the `tasks` object which cannot handle the -extra argument. - -For example, this snippet of code: - -```js -async.auto({ - readData: async.apply(fs.readFile, 'data.txt', 'utf-8') -}, callback); -``` - -will have the effect of calling `readFile` with the results object as the last -argument, which will fail: - -```js -fs.readFile('data.txt', 'utf-8', cb, {}); -``` - -Instead, wrap the call to `readFile` in a function which does not forward the -`results` object: - -```js -async.auto({ - readData: function(cb, results){ - fs.readFile('data.txt', 'utf-8', cb); - } -}, callback); -``` - -__Arguments__ - -* `tasks` - An object. Each of its properties is either a function or an array of - requirements, with the function itself the last item in the array. The object's key - of a property serves as the name of the task defined by that property, - i.e. can be used when specifying requirements for other tasks. - The function receives two arguments: (1) a `callback(err, result)` which must be - called when finished, passing an `error` (which can be `null`) and the result of - the function's execution, and (2) a `results` object, containing the results of - the previously executed functions. -* `callback(err, results)` - An optional callback which is called when all the - tasks have been completed. It receives the `err` argument if any `tasks` - pass an error to their callback. Results are always returned; however, if - an error occurs, no further `tasks` will be performed, and the results - object will only contain partial results. - - -__Example__ - -```js -async.auto({ - get_data: function(callback){ - console.log('in get_data'); - // async code to get some data - callback(null, 'data', 'converted to array'); - }, - make_folder: function(callback){ - console.log('in make_folder'); - // async code to create a directory to store a file in - // this is run at the same time as getting the data - callback(null, 'folder'); - }, - write_file: ['get_data', 'make_folder', function(callback, results){ - console.log('in write_file', JSON.stringify(results)); - // once there is some data and the directory exists, - // write the data to a file in the directory - callback(null, 'filename'); - }], - email_link: ['write_file', function(callback, results){ - console.log('in email_link', JSON.stringify(results)); - // once the file is written let's email a link to it... - // results.write_file contains the filename returned by write_file. - callback(null, {'file':results.write_file, 'email':'user@example.com'}); - }] -}, function(err, results) { - console.log('err = ', err); - console.log('results = ', results); -}); -``` - -This is a fairly trivial example, but to do this using the basic parallel and -series functions would look like this: - -```js -async.parallel([ - function(callback){ - console.log('in get_data'); - // async code to get some data - callback(null, 'data', 'converted to array'); - }, - function(callback){ - console.log('in make_folder'); - // async code to create a directory to store a file in - // this is run at the same time as getting the data - callback(null, 'folder'); - } -], -function(err, results){ - async.series([ - function(callback){ - console.log('in write_file', JSON.stringify(results)); - // once there is some data and the directory exists, - // write the data to a file in the directory - results.push('filename'); - callback(null); - }, - function(callback){ - console.log('in email_link', JSON.stringify(results)); - // once the file is written let's email a link to it... - callback(null, {'file':results.pop(), 'email':'user@example.com'}); - } - ]); -}); -``` - -For a complicated series of `async` tasks, using the [`auto`](#auto) function makes adding -new tasks much easier (and the code more readable). - - ---------------------------------------- - - -### retry([times = 5], task, [callback]) - -Attempts to get a successful response from `task` no more than `times` times before -returning an error. If the task is successful, the `callback` will be passed the result -of the successfull task. If all attemps fail, the callback will be passed the error and -result (if any) of the final attempt. - -__Arguments__ - -* `times` - An integer indicating how many times to attempt the `task` before giving up. Defaults to 5. -* `task(callback, results)` - A function which receives two arguments: (1) a `callback(err, result)` - which must be called when finished, passing `err` (which can be `null`) and the `result` of - the function's execution, and (2) a `results` object, containing the results of - the previously executed functions (if nested inside another control flow). -* `callback(err, results)` - An optional callback which is called when the - task has succeeded, or after the final failed attempt. It receives the `err` and `result` arguments of the last attempt at completing the `task`. - -The [`retry`](#retry) function can be used as a stand-alone control flow by passing a -callback, as shown below: - -```js -async.retry(3, apiMethod, function(err, result) { - // do something with the result -}); -``` - -It can also be embeded within other control flow functions to retry individual methods -that are not as reliable, like this: - -```js -async.auto({ - users: api.getUsers.bind(api), - payments: async.retry(3, api.getPayments.bind(api)) -}, function(err, results) { - // do something with the results -}); -``` - - ---------------------------------------- - - -### iterator(tasks) - -Creates an iterator function which calls the next function in the `tasks` array, -returning a continuation to call the next one after that. It's also possible to -“peek” at the next iterator with `iterator.next()`. - -This function is used internally by the `async` module, but can be useful when -you want to manually control the flow of functions in series. - -__Arguments__ - -* `tasks` - An array of functions to run. - -__Example__ - -```js -var iterator = async.iterator([ - function(){ sys.p('one'); }, - function(){ sys.p('two'); }, - function(){ sys.p('three'); } -]); - -node> var iterator2 = iterator(); -'one' -node> var iterator3 = iterator2(); -'two' -node> iterator3(); -'three' -node> var nextfn = iterator2.next(); -node> nextfn(); -'three' -``` - ---------------------------------------- - - -### apply(function, arguments..) - -Creates a continuation function with some arguments already applied. - -Useful as a shorthand when combined with other control flow functions. Any arguments -passed to the returned function are added to the arguments originally passed -to apply. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to automatically apply when the - continuation is called. - -__Example__ - -```js -// using apply - -async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), -]); - - -// the same process without using apply - -async.parallel([ - function(callback){ - fs.writeFile('testfile1', 'test1', callback); - }, - function(callback){ - fs.writeFile('testfile2', 'test2', callback); - } -]); -``` - -It's possible to pass any number of additional arguments when calling the -continuation: - -```js -node> var fn = async.apply(sys.puts, 'one'); -node> fn('two', 'three'); -one -two -three -``` - ---------------------------------------- - - -### nextTick(callback) - -Calls `callback` on a later loop around the event loop. In Node.js this just -calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)` -if available, otherwise `setTimeout(callback, 0)`, which means other higher priority -events may precede the execution of `callback`. - -This is used internally for browser-compatibility purposes. - -__Arguments__ - -* `callback` - The function to call on a later loop around the event loop. - -__Example__ - -```js -var call_order = []; -async.nextTick(function(){ - call_order.push('two'); - // call_order now equals ['one','two'] -}); -call_order.push('one') -``` - - -### times(n, callback) - -Calls the `callback` function `n` times, and accumulates results in the same manner -you would use with [`map`](#map). - -__Arguments__ - -* `n` - The number of times to run the function. -* `callback` - The function to call `n` times. - -__Example__ - -```js -// Pretend this is some complicated async factory -var createUser = function(id, callback) { - callback(null, { - id: 'user' + id - }) -} -// generate 5 users -async.times(5, function(n, next){ - createUser(n, function(err, user) { - next(err, user) - }) -}, function(err, users) { - // we should now have 5 users -}); -``` - - -### timesSeries(n, callback) - -The same as [`times`](#times), only the iterator is applied to each item in `arr` in -series. The next `iterator` is only called once the current one has completed. -The results array will be in the same order as the original. - - -## Utils - - -### memoize(fn, [hasher]) - -Caches the results of an `async` function. When creating a hash to store function -results against, the callback is omitted from the hash and an optional hash -function can be used. - -The cache of results is exposed as the `memo` property of the function returned -by `memoize`. - -__Arguments__ - -* `fn` - The function to proxy and cache results from. -* `hasher` - Tn optional function for generating a custom hash for storing - results. It has all the arguments applied to it apart from the callback, and - must be synchronous. - -__Example__ - -```js -var slow_fn = function (name, callback) { - // do something - callback(null, result); -}; -var fn = async.memoize(slow_fn); - -// fn can now be used as if it were slow_fn -fn('some name', function () { - // callback -}); -``` - - -### unmemoize(fn) - -Undoes a [`memoize`](#memoize)d function, reverting it to the original, unmemoized -form. Handy for testing. - -__Arguments__ - -* `fn` - the memoized function - - -### log(function, arguments) - -Logs the result of an `async` function to the `console`. Only works in Node.js or -in browsers that support `console.log` and `console.error` (such as FF and Chrome). -If multiple arguments are returned from the async function, `console.log` is -called on each argument in order. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to apply to the function. - -__Example__ - -```js -var hello = function(name, callback){ - setTimeout(function(){ - callback(null, 'hello ' + name); - }, 1000); -}; -``` -```js -node> async.log(hello, 'world'); -'hello world' -``` - ---------------------------------------- - - -### dir(function, arguments) - -Logs the result of an `async` function to the `console` using `console.dir` to -display the properties of the resulting object. Only works in Node.js or -in browsers that support `console.dir` and `console.error` (such as FF and Chrome). -If multiple arguments are returned from the async function, `console.dir` is -called on each argument in order. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to apply to the function. - -__Example__ - -```js -var hello = function(name, callback){ - setTimeout(function(){ - callback(null, {hello: name}); - }, 1000); -}; -``` -```js -node> async.dir(hello, 'world'); -{hello: 'world'} -``` - ---------------------------------------- - - -### noConflict() - -Changes the value of `async` back to its original value, returning a reference to the -`async` object. +# Async.js + +[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async) + + +Async is a utility module which provides straight-forward, powerful functions +for working with asynchronous JavaScript. Although originally designed for +use with [Node.js](http://nodejs.org) and installable via `npm install async`, +it can also be used directly in the browser. + +Async is also installable via: + +- [bower](http://bower.io/): `bower install async` +- [component](https://github.com/component/component): `component install + caolan/async` +- [jam](http://jamjs.org/): `jam install async` +- [spm](http://spmjs.io/): `spm install async` + +Async provides around 20 functions that include the usual 'functional' +suspects (`map`, `reduce`, `filter`, `each`…) as well as some common patterns +for asynchronous control flow (`parallel`, `series`, `waterfall`…). All these +functions assume you follow the Node.js convention of providing a single +callback as the last argument of your `async` function. + + +## Quick Examples + +```javascript +async.map(['file1','file2','file3'], fs.stat, function(err, results){ + // results is now an array of stats for each file +}); + +async.filter(['file1','file2','file3'], fs.exists, function(results){ + // results now equals an array of the existing files +}); + +async.parallel([ + function(){ ... }, + function(){ ... } +], callback); + +async.series([ + function(){ ... }, + function(){ ... } +]); +``` + +There are many more functions available so take a look at the docs below for a +full list. This module aims to be comprehensive, so if you feel anything is +missing please create a GitHub issue for it. + +## Common Pitfalls + +### Binding a context to an iterator + +This section is really about `bind`, not about `async`. If you are wondering how to +make `async` execute your iterators in a given context, or are confused as to why +a method of another library isn't working as an iterator, study this example: + +```js +// Here is a simple object with an (unnecessarily roundabout) squaring method +var AsyncSquaringLibrary = { + squareExponent: 2, + square: function(number, callback){ + var result = Math.pow(number, this.squareExponent); + setTimeout(function(){ + callback(null, result); + }, 200); + } +}; + +async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){ + // result is [NaN, NaN, NaN] + // This fails because the `this.squareExponent` expression in the square + // function is not evaluated in the context of AsyncSquaringLibrary, and is + // therefore undefined. +}); + +async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){ + // result is [1, 4, 9] + // With the help of bind we can attach a context to the iterator before + // passing it to async. Now the square function will be executed in its + // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent` + // will be as expected. +}); +``` + +## Download + +The source is available for download from +[GitHub](http://github.com/caolan/async). +Alternatively, you can install using Node Package Manager (`npm`): + + npm install async + +__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed + +## In the Browser + +So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. + +Usage: + +```html + + +``` + +## Documentation + +### Collections + +* [`each`](#each) +* [`eachSeries`](#eachSeries) +* [`eachLimit`](#eachLimit) +* [`map`](#map) +* [`mapSeries`](#mapSeries) +* [`mapLimit`](#mapLimit) +* [`filter`](#filter) +* [`filterSeries`](#filterSeries) +* [`reject`](#reject) +* [`rejectSeries`](#rejectSeries) +* [`reduce`](#reduce) +* [`reduceRight`](#reduceRight) +* [`detect`](#detect) +* [`detectSeries`](#detectSeries) +* [`sortBy`](#sortBy) +* [`some`](#some) +* [`every`](#every) +* [`concat`](#concat) +* [`concatSeries`](#concatSeries) + +### Control Flow + +* [`series`](#seriestasks-callback) +* [`parallel`](#parallel) +* [`parallelLimit`](#parallellimittasks-limit-callback) +* [`whilst`](#whilst) +* [`doWhilst`](#doWhilst) +* [`until`](#until) +* [`doUntil`](#doUntil) +* [`forever`](#forever) +* [`waterfall`](#waterfall) +* [`compose`](#compose) +* [`seq`](#seq) +* [`applyEach`](#applyEach) +* [`applyEachSeries`](#applyEachSeries) +* [`queue`](#queue) +* [`priorityQueue`](#priorityQueue) +* [`cargo`](#cargo) +* [`auto`](#auto) +* [`retry`](#retry) +* [`iterator`](#iterator) +* [`apply`](#apply) +* [`nextTick`](#nextTick) +* [`times`](#times) +* [`timesSeries`](#timesSeries) + +### Utils + +* [`memoize`](#memoize) +* [`unmemoize`](#unmemoize) +* [`log`](#log) +* [`dir`](#dir) +* [`noConflict`](#noConflict) + + +## Collections + + + +### each(arr, iterator, callback) + +Applies the function `iterator` to each item in `arr`, in parallel. +The `iterator` is called with an item from the list, and a callback for when it +has finished. If the `iterator` passes an error to its `callback`, the main +`callback` (for the `each` function) is immediately called with the error. + +Note, that since this function applies `iterator` to each item in parallel, +there is no guarantee that the iterator functions will complete in order. + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A function to apply to each item in `arr`. + The iterator is passed a `callback(err)` which must be called once it has + completed. If no error has occurred, the `callback` should be run without + arguments or with an explicit `null` argument. +* `callback(err)` - A callback which is called when all `iterator` functions + have finished, or an error occurs. + +__Examples__ + + +```js +// assuming openFiles is an array of file names and saveFile is a function +// to save the modified contents of that file: + +async.each(openFiles, saveFile, function(err){ + // if any of the saves produced an error, err would equal that error +}); +``` + +```js +// assuming openFiles is an array of file names + +async.each(openFiles, function(file, callback) { + + // Perform operation on file here. + console.log('Processing file ' + file); + + if( file.length > 32 ) { + console.log('This file name is too long'); + callback('File name too long'); + } else { + // Do work to process file here + console.log('File processed'); + callback(); + } +}, function(err){ + // if any of the file processing produced an error, err would equal that error + if( err ) { + // One of the iterations produced an error. + // All processing will now stop. + console.log('A file failed to process'); + } else { + console.log('All files have been processed successfully'); + } +}); +``` + +--------------------------------------- + + + +### eachSeries(arr, iterator, callback) + +The same as [`each`](#each), only `iterator` is applied to each item in `arr` in +series. The next `iterator` is only called once the current one has completed. +This means the `iterator` functions will complete in order. + + +--------------------------------------- + + + +### eachLimit(arr, limit, iterator, callback) + +The same as [`each`](#each), only no more than `limit` `iterator`s will be simultaneously +running at any time. + +Note that the items in `arr` are not processed in batches, so there is no guarantee that +the first `limit` `iterator` functions will complete before any others are started. + +__Arguments__ + +* `arr` - An array to iterate over. +* `limit` - The maximum number of `iterator`s to run at any time. +* `iterator(item, callback)` - A function to apply to each item in `arr`. + The iterator is passed a `callback(err)` which must be called once it has + completed. If no error has occurred, the callback should be run without + arguments or with an explicit `null` argument. +* `callback(err)` - A callback which is called when all `iterator` functions + have finished, or an error occurs. + +__Example__ + +```js +// Assume documents is an array of JSON objects and requestApi is a +// function that interacts with a rate-limited REST api. + +async.eachLimit(documents, 20, requestApi, function(err){ + // if any of the saves produced an error, err would equal that error +}); +``` + +--------------------------------------- + + +### map(arr, iterator, callback) + +Produces a new array of values by mapping each value in `arr` through +the `iterator` function. The `iterator` is called with an item from `arr` and a +callback for when it has finished processing. Each of these callback takes 2 arguments: +an `error`, and the transformed item from `arr`. If `iterator` passes an error to his +callback, the main `callback` (for the `map` function) is immediately called with the error. + +Note, that since this function applies the `iterator` to each item in parallel, +there is no guarantee that the `iterator` functions will complete in order. +However, the results array will be in the same order as the original `arr`. + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A function to apply to each item in `arr`. + The iterator is passed a `callback(err, transformed)` which must be called once + it has completed with an error (which can be `null`) and a transformed item. +* `callback(err, results)` - A callback which is called when all `iterator` + functions have finished, or an error occurs. Results is an array of the + transformed items from the `arr`. + +__Example__ + +```js +async.map(['file1','file2','file3'], fs.stat, function(err, results){ + // results is now an array of stats for each file +}); +``` + +--------------------------------------- + + +### mapSeries(arr, iterator, callback) + +The same as [`map`](#map), only the `iterator` is applied to each item in `arr` in +series. The next `iterator` is only called once the current one has completed. +The results array will be in the same order as the original. + + +--------------------------------------- + + +### mapLimit(arr, limit, iterator, callback) + +The same as [`map`](#map), only no more than `limit` `iterator`s will be simultaneously +running at any time. + +Note that the items are not processed in batches, so there is no guarantee that +the first `limit` `iterator` functions will complete before any others are started. + +__Arguments__ + +* `arr` - An array to iterate over. +* `limit` - The maximum number of `iterator`s to run at any time. +* `iterator(item, callback)` - A function to apply to each item in `arr`. + The iterator is passed a `callback(err, transformed)` which must be called once + it has completed with an error (which can be `null`) and a transformed item. +* `callback(err, results)` - A callback which is called when all `iterator` + calls have finished, or an error occurs. The result is an array of the + transformed items from the original `arr`. + +__Example__ + +```js +async.mapLimit(['file1','file2','file3'], 1, fs.stat, function(err, results){ + // results is now an array of stats for each file +}); +``` + +--------------------------------------- + + + +### filter(arr, iterator, callback) + +__Alias:__ `select` + +Returns a new array of all the values in `arr` which pass an async truth test. +_The callback for each `iterator` call only accepts a single argument of `true` or +`false`; it does not accept an error argument first!_ This is in-line with the +way node libraries work with truth tests like `fs.exists`. This operation is +performed in parallel, but the results array will be in the same order as the +original. + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A truth test to apply to each item in `arr`. + The `iterator` is passed a `callback(truthValue)`, which must be called with a + boolean argument once it has completed. +* `callback(results)` - A callback which is called after all the `iterator` + functions have finished. + +__Example__ + +```js +async.filter(['file1','file2','file3'], fs.exists, function(results){ + // results now equals an array of the existing files +}); +``` + +--------------------------------------- + + + +### filterSeries(arr, iterator, callback) + +__Alias:__ `selectSeries` + +The same as [`filter`](#filter) only the `iterator` is applied to each item in `arr` in +series. The next `iterator` is only called once the current one has completed. +The results array will be in the same order as the original. + +--------------------------------------- + + +### reject(arr, iterator, callback) + +The opposite of [`filter`](#filter). Removes values that pass an `async` truth test. + +--------------------------------------- + + +### rejectSeries(arr, iterator, callback) + +The same as [`reject`](#reject), only the `iterator` is applied to each item in `arr` +in series. + + +--------------------------------------- + + +### reduce(arr, memo, iterator, callback) + +__Aliases:__ `inject`, `foldl` + +Reduces `arr` into a single value using an async `iterator` to return +each successive step. `memo` is the initial state of the reduction. +This function only operates in series. + +For performance reasons, it may make sense to split a call to this function into +a parallel map, and then use the normal `Array.prototype.reduce` on the results. +This function is for situations where each step in the reduction needs to be async; +if you can get the data before reducing it, then it's probably a good idea to do so. + +__Arguments__ + +* `arr` - An array to iterate over. +* `memo` - The initial state of the reduction. +* `iterator(memo, item, callback)` - A function applied to each item in the + array to produce the next step in the reduction. The `iterator` is passed a + `callback(err, reduction)` which accepts an optional error as its first + argument, and the state of the reduction as the second. If an error is + passed to the callback, the reduction is stopped and the main `callback` is + immediately called with the error. +* `callback(err, result)` - A callback which is called after all the `iterator` + functions have finished. Result is the reduced value. + +__Example__ + +```js +async.reduce([1,2,3], 0, function(memo, item, callback){ + // pointless async: + process.nextTick(function(){ + callback(null, memo + item) + }); +}, function(err, result){ + // result is now equal to the last value of memo, which is 6 +}); +``` + +--------------------------------------- + + +### reduceRight(arr, memo, iterator, callback) + +__Alias:__ `foldr` + +Same as [`reduce`](#reduce), only operates on `arr` in reverse order. + + +--------------------------------------- + + +### detect(arr, iterator, callback) + +Returns the first value in `arr` that passes an async truth test. The +`iterator` is applied in parallel, meaning the first iterator to return `true` will +fire the detect `callback` with that result. That means the result might not be +the first item in the original `arr` (in terms of order) that passes the test. + +If order within the original `arr` is important, then look at [`detectSeries`](#detectSeries). + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A truth test to apply to each item in `arr`. + The iterator is passed a `callback(truthValue)` which must be called with a + boolean argument once it has completed. +* `callback(result)` - A callback which is called as soon as any iterator returns + `true`, or after all the `iterator` functions have finished. Result will be + the first item in the array that passes the truth test (iterator) or the + value `undefined` if none passed. + +__Example__ + +```js +async.detect(['file1','file2','file3'], fs.exists, function(result){ + // result now equals the first file in the list that exists +}); +``` + +--------------------------------------- + + +### detectSeries(arr, iterator, callback) + +The same as [`detect`](#detect), only the `iterator` is applied to each item in `arr` +in series. This means the result is always the first in the original `arr` (in +terms of array order) that passes the truth test. + + +--------------------------------------- + + +### sortBy(arr, iterator, callback) + +Sorts a list by the results of running each `arr` value through an async `iterator`. + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A function to apply to each item in `arr`. + The iterator is passed a `callback(err, sortValue)` which must be called once it + has completed with an error (which can be `null`) and a value to use as the sort + criteria. +* `callback(err, results)` - A callback which is called after all the `iterator` + functions have finished, or an error occurs. Results is the items from + the original `arr` sorted by the values returned by the `iterator` calls. + +__Example__ + +```js +async.sortBy(['file1','file2','file3'], function(file, callback){ + fs.stat(file, function(err, stats){ + callback(err, stats.mtime); + }); +}, function(err, results){ + // results is now the original array of files sorted by + // modified date +}); +``` + +__Sort Order__ + +By modifying the callback parameter the sorting order can be influenced: + +```js +//ascending order +async.sortBy([1,9,3,5], function(x, callback){ + callback(null, x); +}, function(err,result){ + //result callback +} ); + +//descending order +async.sortBy([1,9,3,5], function(x, callback){ + callback(null, x*-1); //<- x*-1 instead of x, turns the order around +}, function(err,result){ + //result callback +} ); +``` + +--------------------------------------- + + +### some(arr, iterator, callback) + +__Alias:__ `any` + +Returns `true` if at least one element in the `arr` satisfies an async test. +_The callback for each iterator call only accepts a single argument of `true` or +`false`; it does not accept an error argument first!_ This is in-line with the +way node libraries work with truth tests like `fs.exists`. Once any iterator +call returns `true`, the main `callback` is immediately called. + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A truth test to apply to each item in the array + in parallel. The iterator is passed a callback(truthValue) which must be + called with a boolean argument once it has completed. +* `callback(result)` - A callback which is called as soon as any iterator returns + `true`, or after all the iterator functions have finished. Result will be + either `true` or `false` depending on the values of the async tests. + +__Example__ + +```js +async.some(['file1','file2','file3'], fs.exists, function(result){ + // if result is true then at least one of the files exists +}); +``` + +--------------------------------------- + + +### every(arr, iterator, callback) + +__Alias:__ `all` + +Returns `true` if every element in `arr` satisfies an async test. +_The callback for each `iterator` call only accepts a single argument of `true` or +`false`; it does not accept an error argument first!_ This is in-line with the +way node libraries work with truth tests like `fs.exists`. + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A truth test to apply to each item in the array + in parallel. The iterator is passed a callback(truthValue) which must be + called with a boolean argument once it has completed. +* `callback(result)` - A callback which is called after all the `iterator` + functions have finished. Result will be either `true` or `false` depending on + the values of the async tests. + +__Example__ + +```js +async.every(['file1','file2','file3'], fs.exists, function(result){ + // if result is true then every file exists +}); +``` + +--------------------------------------- + + +### concat(arr, iterator, callback) + +Applies `iterator` to each item in `arr`, concatenating the results. Returns the +concatenated list. The `iterator`s are called in parallel, and the results are +concatenated as they return. There is no guarantee that the results array will +be returned in the original order of `arr` passed to the `iterator` function. + +__Arguments__ + +* `arr` - An array to iterate over. +* `iterator(item, callback)` - A function to apply to each item in `arr`. + The iterator is passed a `callback(err, results)` which must be called once it + has completed with an error (which can be `null`) and an array of results. +* `callback(err, results)` - A callback which is called after all the `iterator` + functions have finished, or an error occurs. Results is an array containing + the concatenated results of the `iterator` function. + +__Example__ + +```js +async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ + // files is now a list of filenames that exist in the 3 directories +}); +``` + +--------------------------------------- + + +### concatSeries(arr, iterator, callback) + +Same as [`concat`](#concat), but executes in series instead of parallel. + + +## Control Flow + + +### series(tasks, [callback]) + +Run the functions in the `tasks` array in series, each one running once the previous +function has completed. If any functions in the series pass an error to its +callback, no more functions are run, and `callback` is immediately called with the value of the error. +Otherwise, `callback` receives an array of results when `tasks` have completed. + +It is also possible to use an object instead of an array. Each property will be +run as a function, and the results will be passed to the final `callback` as an object +instead of an array. This can be a more readable way of handling results from +[`series`](#series). + +**Note** that while many implementations preserve the order of object properties, the +[ECMAScript Language Specifcation](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) +explicitly states that + +> The mechanics and order of enumerating the properties is not specified. + +So if you rely on the order in which your series of functions are executed, and want +this to work on all platforms, consider using an array. + +__Arguments__ + +* `tasks` - An array or object containing functions to run, each function is passed + a `callback(err, result)` it must call on completion with an error `err` (which can + be `null`) and an optional `result` value. +* `callback(err, results)` - An optional callback to run once all the functions + have completed. This function gets a results array (or object) containing all + the result arguments passed to the `task` callbacks. + +__Example__ + +```js +async.series([ + function(callback){ + // do some stuff ... + callback(null, 'one'); + }, + function(callback){ + // do some more stuff ... + callback(null, 'two'); + } +], +// optional callback +function(err, results){ + // results is now equal to ['one', 'two'] +}); + + +// an example using an object instead of an array +async.series({ + one: function(callback){ + setTimeout(function(){ + callback(null, 1); + }, 200); + }, + two: function(callback){ + setTimeout(function(){ + callback(null, 2); + }, 100); + } +}, +function(err, results) { + // results is now equal to: {one: 1, two: 2} +}); +``` + +--------------------------------------- + + +### parallel(tasks, [callback]) + +Run the `tasks` array of functions in parallel, without waiting until the previous +function has completed. If any of the functions pass an error to its +callback, the main `callback` is immediately called with the value of the error. +Once the `tasks` have completed, the results are passed to the final `callback` as an +array. + +It is also possible to use an object instead of an array. Each property will be +run as a function and the results will be passed to the final `callback` as an object +instead of an array. This can be a more readable way of handling results from +[`parallel`](#parallel). + + +__Arguments__ + +* `tasks` - An array or object containing functions to run. Each function is passed + a `callback(err, result)` which it must call on completion with an error `err` + (which can be `null`) and an optional `result` value. +* `callback(err, results)` - An optional callback to run once all the functions + have completed. This function gets a results array (or object) containing all + the result arguments passed to the task callbacks. + +__Example__ + +```js +async.parallel([ + function(callback){ + setTimeout(function(){ + callback(null, 'one'); + }, 200); + }, + function(callback){ + setTimeout(function(){ + callback(null, 'two'); + }, 100); + } +], +// optional callback +function(err, results){ + // the results array will equal ['one','two'] even though + // the second function had a shorter timeout. +}); + + +// an example using an object instead of an array +async.parallel({ + one: function(callback){ + setTimeout(function(){ + callback(null, 1); + }, 200); + }, + two: function(callback){ + setTimeout(function(){ + callback(null, 2); + }, 100); + } +}, +function(err, results) { + // results is now equals to: {one: 1, two: 2} +}); +``` + +--------------------------------------- + + +### parallelLimit(tasks, limit, [callback]) + +The same as [`parallel`](#parallel), only `tasks` are executed in parallel +with a maximum of `limit` tasks executing at any time. + +Note that the `tasks` are not executed in batches, so there is no guarantee that +the first `limit` tasks will complete before any others are started. + +__Arguments__ + +* `tasks` - An array or object containing functions to run, each function is passed + a `callback(err, result)` it must call on completion with an error `err` (which can + be `null`) and an optional `result` value. +* `limit` - The maximum number of `tasks` to run at any time. +* `callback(err, results)` - An optional callback to run once all the functions + have completed. This function gets a results array (or object) containing all + the result arguments passed to the `task` callbacks. + +--------------------------------------- + + +### whilst(test, fn, callback) + +Repeatedly call `fn`, while `test` returns `true`. Calls `callback` when stopped, +or an error occurs. + +__Arguments__ + +* `test()` - synchronous truth test to perform before each execution of `fn`. +* `fn(callback)` - A function which is called each time `test` passes. The function is + passed a `callback(err)`, which must be called once it has completed with an + optional `err` argument. +* `callback(err)` - A callback which is called after the test fails and repeated + execution of `fn` has stopped. + +__Example__ + +```js +var count = 0; + +async.whilst( + function () { return count < 5; }, + function (callback) { + count++; + setTimeout(callback, 1000); + }, + function (err) { + // 5 seconds have passed + } +); +``` + +--------------------------------------- + + +### doWhilst(fn, test, callback) + +The post-check version of [`whilst`](#whilst). To reflect the difference in +the order of operations, the arguments `test` and `fn` are switched. + +`doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. + +--------------------------------------- + + +### until(test, fn, callback) + +Repeatedly call `fn` until `test` returns `true`. Calls `callback` when stopped, +or an error occurs. + +The inverse of [`whilst`](#whilst). + +--------------------------------------- + + +### doUntil(fn, test, callback) + +Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument ordering differs from `until`. + +--------------------------------------- + + +### forever(fn, errback) + +Calls the asynchronous function `fn` with a callback parameter that allows it to +call itself again, in series, indefinitely. + +If an error is passed to the callback then `errback` is called with the +error, and execution stops, otherwise it will never be called. + +```js +async.forever( + function(next) { + // next is suitable for passing to things that need a callback(err [, whatever]); + // it will result in this function being called again. + }, + function(err) { + // if next is called with a value in its first parameter, it will appear + // in here as 'err', and execution will stop. + } +); +``` + +--------------------------------------- + + +### waterfall(tasks, [callback]) + +Runs the `tasks` array of functions in series, each passing their results to the next in +the array. However, if any of the `tasks` pass an error to their own callback, the +next function is not executed, and the main `callback` is immediately called with +the error. + +__Arguments__ + +* `tasks` - An array of functions to run, each function is passed a + `callback(err, result1, result2, ...)` it must call on completion. The first + argument is an error (which can be `null`) and any further arguments will be + passed as arguments in order to the next task. +* `callback(err, [results])` - An optional callback to run once all the functions + have completed. This will be passed the results of the last task's callback. + + + +__Example__ + +```js +async.waterfall([ + function(callback) { + callback(null, 'one', 'two'); + }, + function(arg1, arg2, callback) { + // arg1 now equals 'one' and arg2 now equals 'two' + callback(null, 'three'); + }, + function(arg1, callback) { + // arg1 now equals 'three' + callback(null, 'done'); + } +], function (err, result) { + // result now equals 'done' +}); +``` + +--------------------------------------- + +### compose(fn1, fn2...) + +Creates a function which is a composition of the passed asynchronous +functions. Each function consumes the return value of the function that +follows. Composing functions `f()`, `g()`, and `h()` would produce the result of +`f(g(h()))`, only this version uses callbacks to obtain the return values. + +Each function is executed with the `this` binding of the composed function. + +__Arguments__ + +* `functions...` - the asynchronous functions to compose + + +__Example__ + +```js +function add1(n, callback) { + setTimeout(function () { + callback(null, n + 1); + }, 10); +} + +function mul3(n, callback) { + setTimeout(function () { + callback(null, n * 3); + }, 10); +} + +var add1mul3 = async.compose(mul3, add1); + +add1mul3(4, function (err, result) { + // result now equals 15 +}); +``` + +--------------------------------------- + +### seq(fn1, fn2...) + +Version of the compose function that is more natural to read. +Each function consumes the return value of the previous function. +It is the equivalent of [`compose`](#compose) with the arguments reversed. + +Each function is executed with the `this` binding of the composed function. + +__Arguments__ + +* functions... - the asynchronous functions to compose + + +__Example__ + +```js +// Requires lodash (or underscore), express3 and dresende's orm2. +// Part of an app, that fetches cats of the logged user. +// This example uses `seq` function to avoid overnesting and error +// handling clutter. +app.get('/cats', function(request, response) { + var User = request.models.User; + async.seq( + _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) + function(user, fn) { + user.getCats(fn); // 'getCats' has signature (callback(err, data)) + } + )(req.session.user_id, function (err, cats) { + if (err) { + console.error(err); + response.json({ status: 'error', message: err.message }); + } else { + response.json({ status: 'ok', message: 'Cats found', data: cats }); + } + }); +}); +``` + +--------------------------------------- + +### applyEach(fns, args..., callback) + +Applies the provided arguments to each function in the array, calling +`callback` after all functions have completed. If you only provide the first +argument, then it will return a function which lets you pass in the +arguments as if it were a single function call. + +__Arguments__ + +* `fns` - the asynchronous functions to all call with the same arguments +* `args...` - any number of separate arguments to pass to the function +* `callback` - the final argument should be the callback, called when all + functions have completed processing + + +__Example__ + +```js +async.applyEach([enableSearch, updateSchema], 'bucket', callback); + +// partial application example: +async.each( + buckets, + async.applyEach([enableSearch, updateSchema]), + callback +); +``` + +--------------------------------------- + + +### applyEachSeries(arr, iterator, callback) + +The same as [`applyEach`](#applyEach) only the functions are applied in series. + +--------------------------------------- + + +### queue(worker, concurrency) + +Creates a `queue` object with the specified `concurrency`. Tasks added to the +`queue` are processed in parallel (up to the `concurrency` limit). If all +`worker`s are in progress, the task is queued until one becomes available. +Once a `worker` completes a `task`, that `task`'s callback is called. + +__Arguments__ + +* `worker(task, callback)` - An asynchronous function for processing a queued + task, which must call its `callback(err)` argument when finished, with an + optional `error` as an argument. +* `concurrency` - An `integer` for determining how many `worker` functions should be + run in parallel. + +__Queue objects__ + +The `queue` object returned by this function has the following properties and +methods: + +* `length()` - a function returning the number of items waiting to be processed. +* `started` - a function returning whether or not any items have been pushed and processed by the queue +* `running()` - a function returning the number of items currently being processed. +* `idle()` - a function returning false if there are items waiting or being processed, or true if not. +* `concurrency` - an integer for determining how many `worker` functions should be + run in parallel. This property can be changed after a `queue` is created to + alter the concurrency on-the-fly. +* `push(task, [callback])` - add a new task to the `queue`. Calls `callback` once + the `worker` has finished processing the task. Instead of a single task, a `tasks` array + can be submitted. The respective callback is used for every task in the list. +* `unshift(task, [callback])` - add a new task to the front of the `queue`. +* `saturated` - a callback that is called when the `queue` length hits the `concurrency` limit, + and further tasks will be queued. +* `empty` - a callback that is called when the last item from the `queue` is given to a `worker`. +* `drain` - a callback that is called when the last item from the `queue` has returned from the `worker`. +* `paused` - a boolean for determining whether the queue is in a paused state +* `pause()` - a function that pauses the processing of tasks until `resume()` is called. +* `resume()` - a function that resumes the processing of queued tasks when the queue is paused. +* `kill()` - a function that removes the `drain` callback and empties remaining tasks from the queue forcing it to go idle. + +__Example__ + +```js +// create a queue object with concurrency 2 + +var q = async.queue(function (task, callback) { + console.log('hello ' + task.name); + callback(); +}, 2); + + +// assign a callback +q.drain = function() { + console.log('all items have been processed'); +} + +// add some items to the queue + +q.push({name: 'foo'}, function (err) { + console.log('finished processing foo'); +}); +q.push({name: 'bar'}, function (err) { + console.log('finished processing bar'); +}); + +// add some items to the queue (batch-wise) + +q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { + console.log('finished processing item'); +}); + +// add some items to the front of the queue + +q.unshift({name: 'bar'}, function (err) { + console.log('finished processing bar'); +}); +``` + + +--------------------------------------- + + +### priorityQueue(worker, concurrency) + +The same as [`queue`](#queue) only tasks are assigned a priority and completed in ascending priority order. There are two differences between `queue` and `priorityQueue` objects: + +* `push(task, priority, [callback])` - `priority` should be a number. If an array of + `tasks` is given, all tasks will be assigned the same priority. +* The `unshift` method was removed. + +--------------------------------------- + + +### cargo(worker, [payload]) + +Creates a `cargo` object with the specified payload. Tasks added to the +cargo will be processed altogether (up to the `payload` limit). If the +`worker` is in progress, the task is queued until it becomes available. Once +the `worker` has completed some tasks, each callback of those tasks is called. +Check out [this animation](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) for how `cargo` and `queue` work. + +While [queue](#queue) passes only one task to one of a group of workers +at a time, cargo passes an array of tasks to a single worker, repeating +when the worker is finished. + +__Arguments__ + +* `worker(tasks, callback)` - An asynchronous function for processing an array of + queued tasks, which must call its `callback(err)` argument when finished, with + an optional `err` argument. +* `payload` - An optional `integer` for determining how many tasks should be + processed per round; if omitted, the default is unlimited. + +__Cargo objects__ + +The `cargo` object returned by this function has the following properties and +methods: + +* `length()` - A function returning the number of items waiting to be processed. +* `payload` - An `integer` for determining how many tasks should be + process per round. This property can be changed after a `cargo` is created to + alter the payload on-the-fly. +* `push(task, [callback])` - Adds `task` to the `queue`. The callback is called + once the `worker` has finished processing the task. Instead of a single task, an array of `tasks` + can be submitted. The respective callback is used for every task in the list. +* `saturated` - A callback that is called when the `queue.length()` hits the concurrency and further tasks will be queued. +* `empty` - A callback that is called when the last item from the `queue` is given to a `worker`. +* `drain` - A callback that is called when the last item from the `queue` has returned from the `worker`. + +__Example__ + +```js +// create a cargo object with payload 2 + +var cargo = async.cargo(function (tasks, callback) { + for(var i=0; i +### auto(tasks, [callback]) + +Determines the best order for running the functions in `tasks`, based on their +requirements. Each function can optionally depend on other functions being completed +first, and each function is run as soon as its requirements are satisfied. + +If any of the functions pass an error to their callback, it will not +complete (so any other functions depending on it will not run), and the main +`callback` is immediately called with the error. Functions also receive an +object containing the results of functions which have completed so far. + +Note, all functions are called with a `results` object as a second argument, +so it is unsafe to pass functions in the `tasks` object which cannot handle the +extra argument. + +For example, this snippet of code: + +```js +async.auto({ + readData: async.apply(fs.readFile, 'data.txt', 'utf-8') +}, callback); +``` + +will have the effect of calling `readFile` with the results object as the last +argument, which will fail: + +```js +fs.readFile('data.txt', 'utf-8', cb, {}); +``` + +Instead, wrap the call to `readFile` in a function which does not forward the +`results` object: + +```js +async.auto({ + readData: function(cb, results){ + fs.readFile('data.txt', 'utf-8', cb); + } +}, callback); +``` + +__Arguments__ + +* `tasks` - An object. Each of its properties is either a function or an array of + requirements, with the function itself the last item in the array. The object's key + of a property serves as the name of the task defined by that property, + i.e. can be used when specifying requirements for other tasks. + The function receives two arguments: (1) a `callback(err, result)` which must be + called when finished, passing an `error` (which can be `null`) and the result of + the function's execution, and (2) a `results` object, containing the results of + the previously executed functions. +* `callback(err, results)` - An optional callback which is called when all the + tasks have been completed. It receives the `err` argument if any `tasks` + pass an error to their callback. Results are always returned; however, if + an error occurs, no further `tasks` will be performed, and the results + object will only contain partial results. + + +__Example__ + +```js +async.auto({ + get_data: function(callback){ + console.log('in get_data'); + // async code to get some data + callback(null, 'data', 'converted to array'); + }, + make_folder: function(callback){ + console.log('in make_folder'); + // async code to create a directory to store a file in + // this is run at the same time as getting the data + callback(null, 'folder'); + }, + write_file: ['get_data', 'make_folder', function(callback, results){ + console.log('in write_file', JSON.stringify(results)); + // once there is some data and the directory exists, + // write the data to a file in the directory + callback(null, 'filename'); + }], + email_link: ['write_file', function(callback, results){ + console.log('in email_link', JSON.stringify(results)); + // once the file is written let's email a link to it... + // results.write_file contains the filename returned by write_file. + callback(null, {'file':results.write_file, 'email':'user@example.com'}); + }] +}, function(err, results) { + console.log('err = ', err); + console.log('results = ', results); +}); +``` + +This is a fairly trivial example, but to do this using the basic parallel and +series functions would look like this: + +```js +async.parallel([ + function(callback){ + console.log('in get_data'); + // async code to get some data + callback(null, 'data', 'converted to array'); + }, + function(callback){ + console.log('in make_folder'); + // async code to create a directory to store a file in + // this is run at the same time as getting the data + callback(null, 'folder'); + } +], +function(err, results){ + async.series([ + function(callback){ + console.log('in write_file', JSON.stringify(results)); + // once there is some data and the directory exists, + // write the data to a file in the directory + results.push('filename'); + callback(null); + }, + function(callback){ + console.log('in email_link', JSON.stringify(results)); + // once the file is written let's email a link to it... + callback(null, {'file':results.pop(), 'email':'user@example.com'}); + } + ]); +}); +``` + +For a complicated series of `async` tasks, using the [`auto`](#auto) function makes adding +new tasks much easier (and the code more readable). + + +--------------------------------------- + + +### retry([times = 5], task, [callback]) + +Attempts to get a successful response from `task` no more than `times` times before +returning an error. If the task is successful, the `callback` will be passed the result +of the successful task. If all attempts fail, the callback will be passed the error and +result (if any) of the final attempt. + +__Arguments__ + +* `times` - An integer indicating how many times to attempt the `task` before giving up. Defaults to 5. +* `task(callback, results)` - A function which receives two arguments: (1) a `callback(err, result)` + which must be called when finished, passing `err` (which can be `null`) and the `result` of + the function's execution, and (2) a `results` object, containing the results of + the previously executed functions (if nested inside another control flow). +* `callback(err, results)` - An optional callback which is called when the + task has succeeded, or after the final failed attempt. It receives the `err` and `result` arguments of the last attempt at completing the `task`. + +The [`retry`](#retry) function can be used as a stand-alone control flow by passing a +callback, as shown below: + +```js +async.retry(3, apiMethod, function(err, result) { + // do something with the result +}); +``` + +It can also be embeded within other control flow functions to retry individual methods +that are not as reliable, like this: + +```js +async.auto({ + users: api.getUsers.bind(api), + payments: async.retry(3, api.getPayments.bind(api)) +}, function(err, results) { + // do something with the results +}); +``` + + +--------------------------------------- + + +### iterator(tasks) + +Creates an iterator function which calls the next function in the `tasks` array, +returning a continuation to call the next one after that. It's also possible to +“peek” at the next iterator with `iterator.next()`. + +This function is used internally by the `async` module, but can be useful when +you want to manually control the flow of functions in series. + +__Arguments__ + +* `tasks` - An array of functions to run. + +__Example__ + +```js +var iterator = async.iterator([ + function(){ sys.p('one'); }, + function(){ sys.p('two'); }, + function(){ sys.p('three'); } +]); + +node> var iterator2 = iterator(); +'one' +node> var iterator3 = iterator2(); +'two' +node> iterator3(); +'three' +node> var nextfn = iterator2.next(); +node> nextfn(); +'three' +``` + +--------------------------------------- + + +### apply(function, arguments..) + +Creates a continuation function with some arguments already applied. + +Useful as a shorthand when combined with other control flow functions. Any arguments +passed to the returned function are added to the arguments originally passed +to apply. + +__Arguments__ + +* `function` - The function you want to eventually apply all arguments to. +* `arguments...` - Any number of arguments to automatically apply when the + continuation is called. + +__Example__ + +```js +// using apply + +async.parallel([ + async.apply(fs.writeFile, 'testfile1', 'test1'), + async.apply(fs.writeFile, 'testfile2', 'test2'), +]); + + +// the same process without using apply + +async.parallel([ + function(callback){ + fs.writeFile('testfile1', 'test1', callback); + }, + function(callback){ + fs.writeFile('testfile2', 'test2', callback); + } +]); +``` + +It's possible to pass any number of additional arguments when calling the +continuation: + +```js +node> var fn = async.apply(sys.puts, 'one'); +node> fn('two', 'three'); +one +two +three +``` + +--------------------------------------- + + +### nextTick(callback), setImmediate(callback) + +Calls `callback` on a later loop around the event loop. In Node.js this just +calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)` +if available, otherwise `setTimeout(callback, 0)`, which means other higher priority +events may precede the execution of `callback`. + +This is used internally for browser-compatibility purposes. + +__Arguments__ + +* `callback` - The function to call on a later loop around the event loop. + +__Example__ + +```js +var call_order = []; +async.nextTick(function(){ + call_order.push('two'); + // call_order now equals ['one','two'] +}); +call_order.push('one') +``` + + +### times(n, callback) + +Calls the `callback` function `n` times, and accumulates results in the same manner +you would use with [`map`](#map). + +__Arguments__ + +* `n` - The number of times to run the function. +* `callback` - The function to call `n` times. + +__Example__ + +```js +// Pretend this is some complicated async factory +var createUser = function(id, callback) { + callback(null, { + id: 'user' + id + }) +} +// generate 5 users +async.times(5, function(n, next){ + createUser(n, function(err, user) { + next(err, user) + }) +}, function(err, users) { + // we should now have 5 users +}); +``` + + +### timesSeries(n, callback) + +The same as [`times`](#times), only the iterator is applied to each item in `arr` in +series. The next `iterator` is only called once the current one has completed. +The results array will be in the same order as the original. + + +## Utils + + +### memoize(fn, [hasher]) + +Caches the results of an `async` function. When creating a hash to store function +results against, the callback is omitted from the hash and an optional hash +function can be used. + +The cache of results is exposed as the `memo` property of the function returned +by `memoize`. + +__Arguments__ + +* `fn` - The function to proxy and cache results from. +* `hasher` - Tn optional function for generating a custom hash for storing + results. It has all the arguments applied to it apart from the callback, and + must be synchronous. + +__Example__ + +```js +var slow_fn = function (name, callback) { + // do something + callback(null, result); +}; +var fn = async.memoize(slow_fn); + +// fn can now be used as if it were slow_fn +fn('some name', function () { + // callback +}); +``` + + +### unmemoize(fn) + +Undoes a [`memoize`](#memoize)d function, reverting it to the original, unmemoized +form. Handy for testing. + +__Arguments__ + +* `fn` - the memoized function + + +### log(function, arguments) + +Logs the result of an `async` function to the `console`. Only works in Node.js or +in browsers that support `console.log` and `console.error` (such as FF and Chrome). +If multiple arguments are returned from the async function, `console.log` is +called on each argument in order. + +__Arguments__ + +* `function` - The function you want to eventually apply all arguments to. +* `arguments...` - Any number of arguments to apply to the function. + +__Example__ + +```js +var hello = function(name, callback){ + setTimeout(function(){ + callback(null, 'hello ' + name); + }, 1000); +}; +``` +```js +node> async.log(hello, 'world'); +'hello world' +``` + +--------------------------------------- + + +### dir(function, arguments) + +Logs the result of an `async` function to the `console` using `console.dir` to +display the properties of the resulting object. Only works in Node.js or +in browsers that support `console.dir` and `console.error` (such as FF and Chrome). +If multiple arguments are returned from the async function, `console.dir` is +called on each argument in order. + +__Arguments__ + +* `function` - The function you want to eventually apply all arguments to. +* `arguments...` - Any number of arguments to apply to the function. + +__Example__ + +```js +var hello = function(name, callback){ + setTimeout(function(){ + callback(null, {hello: name}); + }, 1000); +}; +``` +```js +node> async.dir(hello, 'world'); +{hello: 'world'} +``` + +--------------------------------------- + + +### noConflict() + +Changes the value of `async` back to its original value, returning a reference to the +`async` object. diff --git a/node_modules/gulp-shell/node_modules/async/bower.json b/node_modules/gulp-shell/node_modules/async/bower.json new file mode 100644 index 0000000000..18176881e0 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/async/bower.json @@ -0,0 +1,38 @@ +{ + "name": "async", + "description": "Higher-order functions and common patterns for asynchronous code", + "version": "0.9.2", + "main": "lib/async.js", + "keywords": [ + "async", + "callback", + "utility", + "module" + ], + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/caolan/async.git" + }, + "devDependencies": { + "nodeunit": ">0.0.0", + "uglify-js": "1.2.x", + "nodelint": ">0.0.0", + "lodash": ">=2.4.1" + }, + "moduleType": [ + "amd", + "globals", + "node" + ], + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ], + "authors": [ + "Caolan McMahon" + ] +} \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/async/component.json b/node_modules/gulp-shell/node_modules/async/component.json index 0beb9d5f8f..5003a7c52c 100644 --- a/node_modules/gulp-shell/node_modules/async/component.json +++ b/node_modules/gulp-shell/node_modules/async/component.json @@ -1,11 +1,16 @@ -{ - "name": "async", - "repo": "caolan/async", - "description": "Higher-order functions and common patterns for asynchronous code", - "version": "0.1.23", - "keywords": [], - "dependencies": {}, - "development": {}, - "main": "lib/async.js", - "scripts": [ "lib/async.js" ] -} +{ + "name": "async", + "description": "Higher-order functions and common patterns for asynchronous code", + "version": "0.9.2", + "keywords": [ + "async", + "callback", + "utility", + "module" + ], + "license": "MIT", + "repository": "caolan/async", + "scripts": [ + "lib/async.js" + ] +} \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/async/lib/async.js b/node_modules/gulp-shell/node_modules/async/lib/async.js index 01e8afcc4f..394c41cada 100644 --- a/node_modules/gulp-shell/node_modules/async/lib/async.js +++ b/node_modules/gulp-shell/node_modules/async/lib/async.js @@ -42,9 +42,6 @@ }; var _each = function (arr, iterator) { - if (arr.forEach) { - return arr.forEach(iterator); - } for (var i = 0; i < arr.length; i += 1) { iterator(arr[i], i, arr); } @@ -821,23 +818,26 @@ pause: function () { if (q.paused === true) { return; } q.paused = true; - q.process(); }, resume: function () { if (q.paused === false) { return; } q.paused = false; - q.process(); + // Need to call q.process once per concurrent + // worker to preserve full concurrency after pause + for (var w = 1; w <= q.concurrency; w++) { + async.setImmediate(q.process); + } } }; return q; }; - + async.priorityQueue = function (worker, concurrency) { - + function _compareTasks(a, b){ return a.priority - b.priority; }; - + function _binarySearch(sequence, item, compare) { var beg = -1, end = sequence.length - 1; @@ -851,7 +851,7 @@ } return beg; } - + function _insert(q, data, priority, callback) { if (!q.started){ q.started = true; @@ -873,7 +873,7 @@ priority: priority, callback: typeof callback === 'function' ? callback : null }; - + q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item); if (q.saturated && q.tasks.length === q.concurrency) { @@ -882,15 +882,15 @@ async.setImmediate(q.process); }); } - + // Start with a normal queue var q = async.queue(worker, concurrency); - + // Override push to accept second parameter representing priority q.push = function (data, priority, callback) { _insert(q, data, priority, callback); }; - + // Remove unshift function delete q.unshift; diff --git a/node_modules/gulp-shell/node_modules/async/package.json b/node_modules/gulp-shell/node_modules/async/package.json index b1a3c3b0a5..dde1d1b72e 100644 --- a/node_modules/gulp-shell/node_modules/async/package.json +++ b/node_modules/gulp-shell/node_modules/async/package.json @@ -1,60 +1,83 @@ -{ - "name": "async", - "description": "Higher-order functions and common patterns for asynchronous code", - "main": "./lib/async", - "author": { - "name": "Caolan McMahon" - }, - "version": "0.9.0", - "repository": { - "type": "git", - "url": "https://github.com/caolan/async.git" - }, - "bugs": { - "url": "https://github.com/caolan/async/issues" - }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/caolan/async/raw/master/LICENSE" - } - ], - "devDependencies": { - "nodeunit": ">0.0.0", - "uglify-js": "1.2.x", - "nodelint": ">0.0.0" - }, - "jam": { - "main": "lib/async.js", - "include": [ - "lib/async.js", - "README.md", - "LICENSE" - ] - }, - "scripts": { - "test": "nodeunit test/test-async.js" - }, - "homepage": "https://github.com/caolan/async", - "_id": "async@0.9.0", - "dist": { - "shasum": "ac3613b1da9bed1b47510bb4651b8931e47146c7", - "tarball": "http://registry.npmjs.org/async/-/async-0.9.0.tgz" - }, - "_from": "async@>=0.9.0 <0.10.0", - "_npmVersion": "1.4.3", - "_npmUser": { - "name": "caolan", - "email": "caolan.mcmahon@gmail.com" - }, - "maintainers": [ - { - "name": "caolan", - "email": "caolan@caolanmcmahon.com" - } - ], - "directories": {}, - "_shasum": "ac3613b1da9bed1b47510bb4651b8931e47146c7", - "_resolved": "https://registry.npmjs.org/async/-/async-0.9.0.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "async", + "description": "Higher-order functions and common patterns for asynchronous code", + "main": "lib/async.js", + "author": { + "name": "Caolan McMahon" + }, + "version": "0.9.2", + "keywords": [ + "async", + "callback", + "utility", + "module" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/caolan/async.git" + }, + "bugs": { + "url": "https://github.com/caolan/async/issues" + }, + "license": "MIT", + "devDependencies": { + "nodeunit": ">0.0.0", + "uglify-js": "1.2.x", + "nodelint": ">0.0.0", + "lodash": ">=2.4.1" + }, + "jam": { + "main": "lib/async.js", + "include": [ + "lib/async.js", + "README.md", + "LICENSE" + ], + "categories": [ + "Utilities" + ] + }, + "scripts": { + "test": "nodeunit test/test-async.js" + }, + "spm": { + "main": "lib/async.js" + }, + "volo": { + "main": "lib/async.js", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "test", + "tests" + ] + }, + "gitHead": "de3a16091d5125384eff4a54deb3998b13c3814c", + "homepage": "https://github.com/caolan/async#readme", + "_id": "async@0.9.2", + "_shasum": "aea74d5e61c1f899613bf64bda66d4c78f2fd17d", + "_from": "async@>=0.9.0 <0.10.0", + "_npmVersion": "2.9.0", + "_nodeVersion": "2.0.1", + "_npmUser": { + "name": "beaugunderson", + "email": "beau@beaugunderson.com" + }, + "maintainers": [ + { + "name": "caolan", + "email": "caolan.mcmahon@gmail.com" + }, + { + "name": "beaugunderson", + "email": "beau@beaugunderson.com" + } + ], + "dist": { + "shasum": "aea74d5e61c1f899613bf64bda66d4c78f2fd17d", + "tarball": "http://registry.npmjs.org/async/-/async-0.9.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz" +} diff --git a/node_modules/gulp-shell/node_modules/async/support/sync-package-managers.js b/node_modules/gulp-shell/node_modules/async/support/sync-package-managers.js new file mode 100755 index 0000000000..30cb7c2d0c --- /dev/null +++ b/node_modules/gulp-shell/node_modules/async/support/sync-package-managers.js @@ -0,0 +1,53 @@ +#!/usr/bin/env node + +// This should probably be its own module but complaints about bower/etc. +// support keep coming up and I'd rather just enable the workflow here for now +// and figure out where this should live later. -- @beaugunderson + +var fs = require('fs'); +var _ = require('lodash'); + +var packageJson = require('../package.json'); + +var IGNORES = ['**/.*', 'node_modules', 'bower_components', 'test', 'tests']; +var INCLUDES = ['lib/async.js', 'README.md', 'LICENSE']; +var REPOSITORY_NAME = 'caolan/async'; + +packageJson.jam = { + main: packageJson.main, + include: INCLUDES, + categories: ['Utilities'] +}; + +packageJson.spm = { + main: packageJson.main +}; + +packageJson.volo = { + main: packageJson.main, + ignore: IGNORES +}; + +var bowerSpecific = { + moduleType: ['amd', 'globals', 'node'], + ignore: IGNORES, + authors: [packageJson.author] +}; + +var bowerInclude = ['name', 'description', 'version', 'main', 'keywords', + 'license', 'homepage', 'repository', 'devDependencies']; + +var componentSpecific = { + repository: REPOSITORY_NAME, + scripts: [packageJson.main] +}; + +var componentInclude = ['name', 'description', 'version', 'keywords', + 'license']; + +var bowerJson = _.merge({}, _.pick(packageJson, bowerInclude), bowerSpecific); +var componentJson = _.merge({}, _.pick(packageJson, componentInclude), componentSpecific); + +fs.writeFileSync('./bower.json', JSON.stringify(bowerJson, null, 2)); +fs.writeFileSync('./component.json', JSON.stringify(componentJson, null, 2)); +fs.writeFileSync('./package.json', JSON.stringify(packageJson, null, 2)); diff --git a/node_modules/gulp-shell/node_modules/gulp-util/.npmignore b/node_modules/gulp-shell/node_modules/gulp-util/.npmignore deleted file mode 100644 index f9f39fd61c..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/.npmignore +++ /dev/null @@ -1,7 +0,0 @@ -.DS_Store -*.log -node_modules -build -*.node -components -test \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/.travis.yml b/node_modules/gulp-shell/node_modules/gulp-util/.travis.yml deleted file mode 100644 index 8703594c0d..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - "0.10" -after_script: - - npm run coveralls \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/LICENSE b/node_modules/gulp-shell/node_modules/gulp-util/LICENSE old mode 100644 new mode 100755 index acf1727d4f..7cbe012c64 --- a/node_modules/gulp-shell/node_modules/gulp-util/LICENSE +++ b/node_modules/gulp-shell/node_modules/gulp-util/LICENSE @@ -1,20 +1,20 @@ -Copyright (c) 2014 Fractal - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +Copyright (c) 2014 Fractal + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/gulp-shell/node_modules/gulp-util/README.md b/node_modules/gulp-shell/node_modules/gulp-util/README.md index 486ad4a557..39aa1aeb8c 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/README.md +++ b/node_modules/gulp-shell/node_modules/gulp-util/README.md @@ -1,141 +1,146 @@ -# gulp-util [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status][depstat-image]][depstat-url] - -## Information - - - - - - - - - - - - - -
    Packagegulp-util
    DescriptionUtility functions for gulp plugins
    Node Version>= 0.9
    - -## Usage - -```javascript -var gutil = require('gulp-util'); - -gutil.log('stuff happened', 'Really it did', gutil.colors.cyan('123')); -gutil.beep(); - -gutil.replaceExtension('file.coffee', '.js'); // file.js - -var opt = { - name: 'todd', - file: someGulpFile -}; -gutil.template('test <%= name %> <%= file.path %>', opt) // test todd /js/hi.js -``` - -### log(msg...) - -Logs stuff. Already prefixed with [gulp] and all that. Use the right colors for values. If you pass in multiple arguments it will join them by a space. - -``` -values (files, module names, etc.) = magenta -numbers (times, counts, etc) = cyan -``` - -### replaceExtension(path, newExtension) - -Replaces a file extension in a path. Returns the new path. - -### isStream(obj) - -Returns true or false if an object is a stream. - -### isBuffer(obj) - -Returns true or false if an object is a Buffer. - -### template(string[, data]) - -This is a lodash.template function wrapper. You must pass in a valid gulp file object so it is available to the user or it will error. You can not configure any of the delimiters. Look at the [lodash docs](http://lodash.com/docs#template) for more info. - -## new File(obj) - -This is just [vinyl](https://github.com/wearefractal/vinyl) - -```javascript -var file = new gutil.File({ - base: path.join(__dirname, './fixtures/'), - cwd: __dirname, - path: path.join(__dirname, './fixtures/test.coffee') -}); -``` - -## noop() - -Returns a stream that does nothing but pass data straight through. - -```javascript -// gulp should be called like this : -// $ gulp --type production -gulp.task('scripts', function() { - gulp.src('src/**/*.js') - .pipe(concat('script.js')) - .pipe(gutil.env.type === 'production' ? uglify() : gutil.noop()) - .pipe(gulp.dest('dist/'); -}); -``` - -## buffer(cb) - -This is similar to es.wait but instead of buffering text into one string it buffers anything into an array (so very useful for file objects). - -Returns a stream that can be piped to. - -The stream will emit one data event after the stream piped to it has ended. The data will be the same array passed to the callback. - -Callback is optional and receives two arguments: error and data - -```javascript -gulp.src('stuff/*.js') - .pipe(gutil.buffer(function(err, files){ - - }); -``` - -## new PluginError(pluginName, message[, options]) - -- pluginName should be the module name of your plugin -- message can be a string or an existing error -- By default the stack will not be shown. Set `options.showStack` to true if you think the stack is important for your error. -- If you pass an error in as the message the stack will be pulled from that, otherwise one will be created. -- Note that if you pass in a custom stack string you need to include the message along with that. -- Error properties will be included in `err.toString()`. Can be omitted by including `{showProperties: false}` in the options. - -These are all acceptable forms of instantiation: - -```javascript -var err = new gutil.PluginError('test', { - message: 'something broke' -}); - -var err = new gutil.PluginError({ - plugin: 'test', - message: 'something broke' -}); - -var err = new gutil.PluginError('test', 'something broke'); - -var err = new gutil.PluginError('test', 'something broke', {showStack: true}); - -var existingError = new Error('OMG'); -var err = new gutil.PluginError('test', existingError, {showStack: true}); -``` - -[npm-url]: https://npmjs.org/package/gulp-util -[npm-image]: https://badge.fury.io/js/gulp-util.svg -[travis-url]: https://travis-ci.org/gulpjs/gulp-util -[travis-image]: https://travis-ci.org/gulpjs/gulp-util.svg?branch=master -[coveralls-url]: https://coveralls.io/r/gulpjs/gulp-util -[coveralls-image]: https://coveralls.io/repos/gulpjs/gulp-util/badge.png -[depstat-url]: https://david-dm.org/gulpjs/gulp-util -[depstat-image]: https://david-dm.org/gulpjs/gulp-util.svg +# gulp-util [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Coveralls Status][coveralls-image]][coveralls-url] [![Dependency Status][depstat-image]][depstat-url] + +## Information + + + + + + + + + + + + + +
    Packagegulp-util
    DescriptionUtility functions for gulp plugins
    Node Version>= 0.9
    + +## Usage + +```javascript +var gutil = require('gulp-util'); + +gutil.log('stuff happened', 'Really it did', gutil.colors.magenta('123')); +gutil.beep(); + +gutil.replaceExtension('file.coffee', '.js'); // file.js + +var opt = { + name: 'todd', + file: someGulpFile +}; +gutil.template('test <%= name %> <%= file.path %>', opt) // test todd /js/hi.js +``` + +### log(msg...) + +Logs stuff. Already prefixed with [gulp] and all that. If you pass in multiple arguments it will join them by a space. + +The default gulp coloring using gutil.colors.: +``` +values (files, module names, etc.) = cyan +numbers (times, counts, etc) = magenta +``` + +### colors + +Is an instance of [chalk](https://github.com/sindresorhus/chalk). + +### replaceExtension(path, newExtension) + +Replaces a file extension in a path. Returns the new path. + +### isStream(obj) + +Returns true or false if an object is a stream. + +### isBuffer(obj) + +Returns true or false if an object is a Buffer. + +### template(string[, data]) + +This is a lodash.template function wrapper. You must pass in a valid gulp file object so it is available to the user or it will error. You can not configure any of the delimiters. Look at the [lodash docs](http://lodash.com/docs#template) for more info. + +## new File(obj) + +This is just [vinyl](https://github.com/wearefractal/vinyl) + +```javascript +var file = new gutil.File({ + base: path.join(__dirname, './fixtures/'), + cwd: __dirname, + path: path.join(__dirname, './fixtures/test.coffee') +}); +``` + +## noop() + +Returns a stream that does nothing but pass data straight through. + +```javascript +// gulp should be called like this : +// $ gulp --type production +gulp.task('scripts', function() { + gulp.src('src/**/*.js') + .pipe(concat('script.js')) + .pipe(gutil.env.type === 'production' ? uglify() : gutil.noop()) + .pipe(gulp.dest('dist/')); +}); +``` + +## buffer(cb) + +This is similar to es.wait but instead of buffering text into one string it buffers anything into an array (so very useful for file objects). + +Returns a stream that can be piped to. + +The stream will emit one data event after the stream piped to it has ended. The data will be the same array passed to the callback. + +Callback is optional and receives two arguments: error and data + +```javascript +gulp.src('stuff/*.js') + .pipe(gutil.buffer(function(err, files) { + + })); +``` + +## new PluginError(pluginName, message[, options]) + +- pluginName should be the module name of your plugin +- message can be a string or an existing error +- By default the stack will not be shown. Set `options.showStack` to true if you think the stack is important for your error. +- If you pass an error in as the message the stack will be pulled from that, otherwise one will be created. +- Note that if you pass in a custom stack string you need to include the message along with that. +- Error properties will be included in `err.toString()`. Can be omitted by including `{showProperties: false}` in the options. + +These are all acceptable forms of instantiation: + +```javascript +var err = new gutil.PluginError('test', { + message: 'something broke' +}); + +var err = new gutil.PluginError({ + plugin: 'test', + message: 'something broke' +}); + +var err = new gutil.PluginError('test', 'something broke'); + +var err = new gutil.PluginError('test', 'something broke', {showStack: true}); + +var existingError = new Error('OMG'); +var err = new gutil.PluginError('test', existingError, {showStack: true}); +``` + +[npm-url]: https://www.npmjs.com/package/gulp-util +[npm-image]: https://badge.fury.io/js/gulp-util.svg +[travis-url]: https://travis-ci.org/gulpjs/gulp-util +[travis-image]: https://img.shields.io/travis/gulpjs/gulp-util.svg?branch=master +[coveralls-url]: https://coveralls.io/r/gulpjs/gulp-util +[coveralls-image]: https://img.shields.io/coveralls/gulpjs/gulp-util.svg +[depstat-url]: https://david-dm.org/gulpjs/gulp-util +[depstat-image]: https://david-dm.org/gulpjs/gulp-util.svg diff --git a/node_modules/gulp-shell/node_modules/gulp-util/index.js b/node_modules/gulp-shell/node_modules/gulp-util/index.js index 6746ee4be2..199713c94b 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/index.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/index.js @@ -1,18 +1,18 @@ module.exports = { - File: require('./lib/File'), - replaceExtension: require('./lib/replaceExtension'), - colors: require('./lib/colors'), - date: require('./lib/date'), + File: require('vinyl'), + replaceExtension: require('replace-ext'), + colors: require('chalk'), + date: require('dateformat'), log: require('./lib/log'), template: require('./lib/template'), env: require('./lib/env'), - beep: require('./lib/beep'), + beep: require('beeper'), noop: require('./lib/noop'), isStream: require('./lib/isStream'), isBuffer: require('./lib/isBuffer'), isNull: require('./lib/isNull'), - linefeed: require('./lib/linefeed'), + linefeed: '\n', combine: require('./lib/combine'), buffer: require('./lib/buffer'), PluginError: require('./lib/PluginError') -}; \ No newline at end of file +}; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/lib/File.js b/node_modules/gulp-shell/node_modules/gulp-util/lib/File.js deleted file mode 100644 index 690a508a62..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/lib/File.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('vinyl'); \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/lib/PluginError.js b/node_modules/gulp-shell/node_modules/gulp-util/lib/PluginError.js index 0cdabd32fb..d60159ab1e 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/lib/PluginError.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/lib/PluginError.js @@ -1,13 +1,15 @@ var util = require('util'); -var colors = require('./colors'); -var _ = require('lodash'); +var arrayDiffer = require('array-differ'); +var arrayUniq = require('array-uniq'); +var chalk = require('chalk'); +var objectAssign = require('object-assign'); var nonEnumberableProperties = ['name', 'message', 'stack']; var propertiesNotToDisplay = nonEnumberableProperties.concat(['plugin', 'showStack', 'showProperties', '__safety', '_stack']); // wow what a clusterfuck var parseOptions = function(plugin, message, opt) { - if (!opt) opt = {}; + opt = opt || {}; if (typeof plugin === 'object') { opt = plugin; } else { @@ -21,12 +23,10 @@ var parseOptions = function(plugin, message, opt) { opt.plugin = plugin; } - _.defaults(opt, { + return objectAssign({ showStack: false, showProperties: true - }) - - return opt; + }, opt); }; function PluginError(plugin, message, opt) { @@ -35,14 +35,15 @@ function PluginError(plugin, message, opt) { Error.call(this); var options = parseOptions(plugin, message, opt); + var self = this; // if options has an error, grab details from it if (options.error) { // These properties are not enumerable, so we have to add them explicitly. - _.uniq(Object.keys(options.error).concat(nonEnumberableProperties)) + arrayUniq(Object.keys(options.error).concat(nonEnumberableProperties)) .forEach(function(prop) { - this[prop] = options.error[prop]; - }, this); + self[prop] = options.error[prop]; + }); } var properties = ['name', 'message', 'fileName', 'lineNumber', 'stack', 'showStack', 'showProperties', 'plugin']; @@ -86,22 +87,31 @@ PluginError.prototype._messageWithDetails = function() { }; PluginError.prototype._messageDetails = function() { - var properties; - if (this.showProperties) { - var properties = _(Object.keys(this)) - .filter(function(prop) { return propertiesNotToDisplay.indexOf(prop) === -1; }) - .map(function(prop) { return '\n ' + prop + ': ' + this[prop]; }, this) - .reduce(function(properties, next) { return properties + next; }); + if (!this.showProperties) { + return ''; + } + + var properties = arrayDiffer(Object.keys(this), propertiesNotToDisplay); + + if (properties.length === 0) { + return ''; } - return properties === undefined ? '' : ('Details:' + properties) + + var self = this; + properties = properties.map(function stringifyProperty(prop) { + return ' ' + prop + ': ' + self[prop]; + }); + + return 'Details:\n' + properties.join('\n'); }; PluginError.prototype.toString = function () { - var sig = colors.red(this.name) + ' in plugin \'' + colors.cyan(this.plugin) + '\''; + var sig = chalk.red(this.name) + ' in plugin \'' + chalk.cyan(this.plugin) + '\''; var detailsWithStack = function(stack) { return this._messageWithDetails() + '\nStack:\n' + stack; }.bind(this); + var msg; if (this.showStack) { if (this.__safety) { // There is no wrapped error, use the stack captured in the PluginError ctor msg = this.__safety.stack; @@ -114,7 +124,7 @@ PluginError.prototype.toString = function () { msg = this._messageWithDetails(); } - return sig+'\n'+msg; + return sig + '\n' + msg; }; module.exports = PluginError; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/lib/beep.js b/node_modules/gulp-shell/node_modules/gulp-util/lib/beep.js deleted file mode 100644 index 5473d75481..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/lib/beep.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = function() { - process.stdout.write('\x07'); -}; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/lib/buffer.js b/node_modules/gulp-shell/node_modules/gulp-util/lib/buffer.js index 4cb064acae..26c940db17 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/lib/buffer.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/lib/buffer.js @@ -12,4 +12,4 @@ module.exports = function(fn) { cb(); }; return through.obj(push, end); -}; \ No newline at end of file +}; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/lib/colors.js b/node_modules/gulp-shell/node_modules/gulp-util/lib/colors.js deleted file mode 100644 index bc8049406d..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/lib/colors.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('chalk'); \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/lib/date.js b/node_modules/gulp-shell/node_modules/gulp-util/lib/date.js deleted file mode 100644 index 935793cc68..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/lib/date.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('dateformat'); \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/lib/env.js b/node_modules/gulp-shell/node_modules/gulp-util/lib/env.js index ea1e03e4af..ee17c0e30b 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/lib/env.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/lib/env.js @@ -1,4 +1,4 @@ var parseArgs = require('minimist'); var argv = parseArgs(process.argv.slice(2)); -module.exports = argv; \ No newline at end of file +module.exports = argv; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/lib/isBuffer.js b/node_modules/gulp-shell/node_modules/gulp-util/lib/isBuffer.js index 0e23782c41..7c52f78c91 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/lib/isBuffer.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/lib/isBuffer.js @@ -4,4 +4,4 @@ var Buffer = buf.Buffer; // could use Buffer.isBuffer but this is the same exact thing... module.exports = function(o) { return typeof o === 'object' && o instanceof Buffer; -}; \ No newline at end of file +}; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/lib/isNull.js b/node_modules/gulp-shell/node_modules/gulp-util/lib/isNull.js index 403bb30e87..7f22c63ae8 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/lib/isNull.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/lib/isNull.js @@ -1,3 +1,3 @@ module.exports = function(v) { return v === null; -}; \ No newline at end of file +}; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/lib/isStream.js b/node_modules/gulp-shell/node_modules/gulp-util/lib/isStream.js index 9ce0929b03..6b54e123bb 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/lib/isStream.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/lib/isStream.js @@ -2,4 +2,4 @@ var Stream = require('stream').Stream; module.exports = function(o) { return !!o && o instanceof Stream; -}; \ No newline at end of file +}; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/lib/linefeed.js b/node_modules/gulp-shell/node_modules/gulp-util/lib/linefeed.js deleted file mode 100644 index 5b0dfa4b1c..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/lib/linefeed.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = '\n'; \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/lib/log.js b/node_modules/gulp-shell/node_modules/gulp-util/lib/log.js index e33d15ed96..3986b69bdb 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/lib/log.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/lib/log.js @@ -1,8 +1,8 @@ -var colors = require('./colors'); -var date = require('./date'); +var chalk = require('chalk'); +var dateformat = require('dateformat'); module.exports = function(){ - var time = '['+colors.grey(date(new Date(), 'HH:MM:ss'))+']'; + var time = '['+chalk.grey(dateformat(new Date(), 'HH:MM:ss'))+']'; var args = Array.prototype.slice.call(arguments); args.unshift(time); console.log.apply(console, args); diff --git a/node_modules/gulp-shell/node_modules/gulp-util/lib/template.js b/node_modules/gulp-shell/node_modules/gulp-util/lib/template.js index c467820f36..4500bcca3e 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/lib/template.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/lib/template.js @@ -1,14 +1,16 @@ var template = require('lodash.template'); +var reEscape = require('lodash._reescape'); +var reEvaluate = require('lodash._reevaluate'); var reInterpolate = require('lodash._reinterpolate'); var forcedSettings = { - escape: /<%-([\s\S]+?)%>/g, - evaluate: /<%([\s\S]+?)%>/g, + escape: reEscape, + evaluate: reEvaluate, interpolate: reInterpolate }; module.exports = function(tmpl, data){ - var fn = template(tmpl, null, forcedSettings); + var fn = template(tmpl, forcedSettings); var wrapped = function(o) { if (typeof o === 'undefined' || typeof o.file === 'undefined') throw new Error('Failed to provide the current file as "file" to the template'); diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/.bin/dateformat b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/.bin/dateformat new file mode 120000 index 0000000000..bb9cf7b16c --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/.bin/dateformat @@ -0,0 +1 @@ +../dateformat/bin/cli.js \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-differ/index.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-differ/index.js new file mode 100644 index 0000000000..fbe2ed2c81 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-differ/index.js @@ -0,0 +1,7 @@ +'use strict'; +module.exports = function (arr) { + var rest = [].concat.apply([], [].slice.call(arguments, 1)); + return arr.filter(function (el) { + return rest.indexOf(el) === -1; + }); +}; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-differ/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-differ/package.json new file mode 100644 index 0000000000..bc4f4f21f3 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-differ/package.json @@ -0,0 +1,61 @@ +{ + "name": "array-differ", + "version": "1.0.0", + "description": "Create an array with values that are present in the first input array but not additional ones", + "license": "MIT", + "repository": { + "type": "git", + "url": "git://github.com/sindresorhus/array-differ" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "array", + "difference", + "diff", + "differ", + "filter", + "exclude" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "e91802976c4710eef8dea2090d48e48525cf41b1", + "bugs": { + "url": "https://github.com/sindresorhus/array-differ/issues" + }, + "homepage": "https://github.com/sindresorhus/array-differ", + "_id": "array-differ@1.0.0", + "_shasum": "eff52e3758249d33be402b8bb8e564bb2b5d4031", + "_from": "array-differ@>=1.0.0 <2.0.0", + "_npmVersion": "1.4.14", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "eff52e3758249d33be402b8bb8e564bb2b5d4031", + "tarball": "http://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/array-differ/-/array-differ-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-differ/readme.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-differ/readme.md new file mode 100644 index 0000000000..68f5d36074 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-differ/readme.md @@ -0,0 +1,41 @@ +# array-differ [![Build Status](https://travis-ci.org/sindresorhus/array-differ.svg?branch=master)](https://travis-ci.org/sindresorhus/array-differ) + +> Create an array with values that are present in the first input array but not additional ones + + +## Install + +```sh +$ npm install --save array-differ +``` + + +## Usage + +```js +var arrayDiffer = require('array-differ'); + +arrayDiffer([2, 3, 4], [3, 50]); +//=> [2, 4] +``` + +## API + +### arrayDiffer(input, values, [values, ...]) + +Returns the new array. + +#### input + +Type: `array` + +#### values + +Type: `array` + +Arrays of values to exclude. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-uniq/index.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-uniq/index.js new file mode 100644 index 0000000000..40f81b8a08 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-uniq/index.js @@ -0,0 +1,60 @@ +'use strict'; + +// there's 3 implementations written in increasing order of efficiency + +// 1 - no Set type is defined +function uniqNoSet(arr) { + var ret = []; + + for (var i = 0; i < arr.length; i++) { + if (ret.indexOf(arr[i]) === -1) { + ret.push(arr[i]); + } + } + + return ret; +} + +// 2 - a simple Set type is defined +function uniqSet(arr) { + var seen = new Set(); + return arr.filter(function (el) { + if (!seen.has(el)) { + seen.add(el); + return true; + } + }); +} + +// 3 - a standard Set type is defined and it has a forEach method +function uniqSetWithForEach(arr) { + var ret = []; + + (new Set(arr)).forEach(function (el) { + ret.push(el); + }); + + return ret; +} + +// V8 currently has a broken implementation +// https://github.com/joyent/node/issues/8449 +function doesForEachActuallyWork() { + var ret = false; + + (new Set([true])).forEach(function (el) { + ret = el; + }); + + return ret === true; +} + +if ('Set' in global) { + if (typeof Set.prototype.forEach === 'function' && doesForEachActuallyWork()) { + module.exports = uniqSetWithForEach; + } else { + module.exports = uniqSet; + } +} else { + module.exports = uniqNoSet; +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-uniq/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-uniq/package.json new file mode 100644 index 0000000000..87427915a4 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-uniq/package.json @@ -0,0 +1,66 @@ +{ + "name": "array-uniq", + "version": "1.0.2", + "description": "Create an array without duplicates", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/array-uniq" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "array", + "arr", + "set", + "uniq", + "unique", + "es6", + "duplicate", + "remove" + ], + "devDependencies": { + "es6-set": "^0.1.0", + "mocha": "*", + "require-uncached": "^1.0.2" + }, + "gitHead": "d5e311f37692dfd25ec216490df10632ce5f69f3", + "bugs": { + "url": "https://github.com/sindresorhus/array-uniq/issues" + }, + "homepage": "https://github.com/sindresorhus/array-uniq", + "_id": "array-uniq@1.0.2", + "_shasum": "5fcc373920775723cfd64d65c64bef53bf9eba6d", + "_from": "array-uniq@>=1.0.2 <2.0.0", + "_npmVersion": "2.1.5", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "5fcc373920775723cfd64d65c64bef53bf9eba6d", + "tarball": "http://registry.npmjs.org/array-uniq/-/array-uniq-1.0.2.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.2.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-uniq/readme.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-uniq/readme.md new file mode 100644 index 0000000000..5183d07ec1 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/array-uniq/readme.md @@ -0,0 +1,30 @@ +# array-uniq [![Build Status](https://travis-ci.org/sindresorhus/array-uniq.svg?branch=master)](https://travis-ci.org/sindresorhus/array-uniq) + +> Create an array without duplicates + +It's already pretty fast, but will be much faster when [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) becomes available in V8 (especially with large arrays). + + +## Install + +```sh +$ npm install --save array-uniq +``` + + +## Usage + +```js +var arrayUniq = require('array-uniq'); + +arrayUniq([1, 1, 2, 3, 3]); +//=> [1, 2, 3] + +arrayUniq(['foo', 'foo', 'bar', 'foo']); +//=> ['foo', 'bar'] +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/beeper/index.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/beeper/index.js new file mode 100644 index 0000000000..9c4ba28b5c --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/beeper/index.js @@ -0,0 +1,45 @@ +'use strict'; + +var BEEP_DELAY = 500; + +if (!process.stdout.isTTY || + process.argv.indexOf('--no-beep') !== -1 || + process.argv.indexOf('--beep=false') !== -1) { + module.exports = function () {}; + return; +} + +function beep() { + process.stdout.write('\u0007'); +} + +function melodicalBeep(val) { + if (val.length === 0) { + return; + } + + setTimeout(function () { + if (val.shift() === '*') { + beep(); + } + + melodicalBeep(val); + }, BEEP_DELAY); +} + +module.exports = function (val) { + if (val == null) { + beep(); + } else if (typeof val === 'number') { + beep(); + val--; + + while (val--) { + setTimeout(beep, BEEP_DELAY * val); + } + } else if (typeof val === 'string') { + melodicalBeep(val.split('')); + } else { + throw new TypeError('Not an accepted type'); + } +}; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/beeper/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/beeper/package.json new file mode 100644 index 0000000000..cd1604cb1a --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/beeper/package.json @@ -0,0 +1,67 @@ +{ + "name": "beeper", + "version": "1.0.0", + "description": "Make your terminal beep", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/beeper" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "node test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "beep", + "beeper", + "boop", + "terminal", + "term", + "cli", + "console", + "ding", + "ping", + "alert", + "gulpfriendly" + ], + "devDependencies": { + "ava": "0.0.4" + }, + "gitHead": "89534b940dfb61ed6ca5df76bf8faa4b90448f4f", + "bugs": { + "url": "https://github.com/sindresorhus/beeper/issues" + }, + "homepage": "https://github.com/sindresorhus/beeper", + "_id": "beeper@1.0.0", + "_shasum": "1ad2a27a9c7e545234119180afed61f80daaf02c", + "_from": "beeper@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.5", + "_nodeVersion": "0.10.32", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "1ad2a27a9c7e545234119180afed61f80daaf02c", + "tarball": "http://registry.npmjs.org/beeper/-/beeper-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/beeper/-/beeper-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/beeper/readme.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/beeper/readme.md new file mode 100644 index 0000000000..86cf9fa358 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/beeper/readme.md @@ -0,0 +1,53 @@ +# beeper [![Build Status](https://travis-ci.org/sindresorhus/beeper.svg?branch=master)](https://travis-ci.org/sindresorhus/beeper) + +> Make your terminal beep + +Useful as an attention grabber e.g. when an error happens. + + +## Install + +```sh +$ npm install --save beeper +``` + + +## Usage + +```js +var beeper = require('beeper'); + +beeper(); +// beep one time + +beeper(3); +// beep three times + +beeper('****-*-*'); +// beep, beep, beep, beep, pause, beep, pause, beep +``` + + +## API + +It will not beep if stdout is not TTY or if the user supplies the `--no-beep` flag. + +### beeper([count|melody]) + +#### count + +Type: `number` +Default: `1` + +How many times you want it to beep. + +#### melody + +Type: `string` + +Construct your own melody by supplying a string of `*` for beep `-` for pause. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/index.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/index.js index ac1f16820d..4138a64dd9 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/index.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/index.js @@ -5,13 +5,23 @@ var stripAnsi = require('strip-ansi'); var hasAnsi = require('has-ansi'); var supportsColor = require('supports-color'); var defineProps = Object.defineProperties; -var chalk = module.exports; + +function Chalk(options) { + // detect mode if not set manually + this.enabled = !options || options.enabled === undefined ? supportsColor : options.enabled; +} + +// use bright blue on Windows as the normal blue color is illegible +if (process.platform === 'win32') { + ansiStyles.blue.open = '\u001b[94m'; +} function build(_styles) { var builder = function builder() { return applyStyle.apply(builder, arguments); }; builder._styles = _styles; + builder.enabled = this.enabled; // __proto__ is used because we must return a function, but there is // no way to create a function with a different prototype. builder.__proto__ = proto; @@ -21,14 +31,12 @@ function build(_styles) { var styles = (function () { var ret = {}; - ansiStyles.grey = ansiStyles.gray; - Object.keys(ansiStyles).forEach(function (key) { ansiStyles[key].closeRe = new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); ret[key] = { get: function () { - return build(this._styles.concat(key)); + return build.call(this, this._styles.concat(key)); } }; }); @@ -50,14 +58,15 @@ function applyStyle() { } } - if (!chalk.enabled || !str) { + if (!this.enabled || !str) { return str; } - /*jshint validthis: true*/ + /*jshint validthis: true */ var nestedStyles = this._styles; - for (var i = 0; i < nestedStyles.length; i++) { + var i = nestedStyles.length; + while (i--) { var code = ansiStyles[nestedStyles[i]]; // Replace any instances already present with a re-opening code // otherwise only the part of the string until said closing code @@ -74,7 +83,7 @@ function init() { Object.keys(styles).forEach(function (name) { ret[name] = { get: function () { - return build([name]); + return build.call(this, [name]); } }; }); @@ -82,14 +91,10 @@ function init() { return ret; } -defineProps(chalk, init()); - -chalk.styles = ansiStyles; -chalk.hasColor = hasAnsi; -chalk.stripColor = stripAnsi; -chalk.supportsColor = supportsColor; +defineProps(Chalk.prototype, init()); -// detect mode if not set manually -if (chalk.enabled === undefined) { - chalk.enabled = chalk.supportsColor; -} +module.exports = new Chalk(); +module.exports.styles = ansiStyles; +module.exports.hasColor = hasAnsi; +module.exports.stripColor = stripAnsi; +module.exports.supportsColor = supportsColor; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/license b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/license new file mode 100644 index 0000000000..654d0bfe94 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/has-ansi b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/has-ansi deleted file mode 100644 index c1e7413f1f..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/has-ansi +++ /dev/null @@ -1 +0,0 @@ -../has-ansi/cli.js \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/has-ansi b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/has-ansi new file mode 120000 index 0000000000..c1e7413f1f --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/has-ansi @@ -0,0 +1 @@ +../has-ansi/cli.js \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/strip-ansi b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/strip-ansi deleted file mode 100644 index b65c9f81df..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/strip-ansi +++ /dev/null @@ -1 +0,0 @@ -../strip-ansi/cli.js \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/strip-ansi b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/strip-ansi new file mode 120000 index 0000000000..b65c9f81df --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/strip-ansi @@ -0,0 +1 @@ +../strip-ansi/cli.js \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/supports-color b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/supports-color deleted file mode 100644 index af0f05efe8..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/supports-color +++ /dev/null @@ -1 +0,0 @@ -../supports-color/cli.js \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/supports-color b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/supports-color new file mode 120000 index 0000000000..af0f05efe8 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/.bin/supports-color @@ -0,0 +1 @@ +../supports-color/cli.js \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/index.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/index.js index 2d8b4726da..caf9e119eb 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/index.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/index.js @@ -1,40 +1,56 @@ 'use strict'; -var styles = module.exports; -var codes = { - reset: [0, 0], +var styles = module.exports = { + modifiers: { + reset: [0, 0], + bold: [1, 22], // 21 isn't widely supported and 22 does the same thing + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + colors: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39] + }, + bgColors: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49] + } +}; - bold: [1, 22], // 21 isn't widely supported and 22 does the same thing - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29], +// fix humans +styles.colors.grey = styles.colors.gray; - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - gray: [90, 39], +Object.keys(styles).forEach(function (groupName) { + var group = styles[groupName]; - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49] -}; + Object.keys(group).forEach(function (styleName) { + var style = group[styleName]; + + styles[styleName] = group[styleName] = { + open: '\u001b[' + style[0] + 'm', + close: '\u001b[' + style[1] + 'm' + }; + }); -Object.keys(codes).forEach(function (key) { - var val = codes[key]; - var style = styles[key] = {}; - style.open = '\u001b[' + val[0] + 'm'; - style.close = '\u001b[' + val[1] + 'm'; + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); }); diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/license b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/license new file mode 100644 index 0000000000..654d0bfe94 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/package.json index 7b4520fab0..e670f250a7 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/package.json +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/package.json @@ -1,74 +1,80 @@ -{ - "name": "ansi-styles", - "version": "1.1.0", - "description": "ANSI escape codes for styling strings in the terminal", - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/ansi-styles" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js" - ], - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "devDependencies": { - "mocha": "*" - }, - "bugs": { - "url": "https://github.com/sindresorhus/ansi-styles/issues" - }, - "homepage": "https://github.com/sindresorhus/ansi-styles", - "_id": "ansi-styles@1.1.0", - "_shasum": "eaecbf66cd706882760b2f4691582b8f55d7a7de", - "_from": "ansi-styles@>=1.1.0 <2.0.0", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "dist": { - "shasum": "eaecbf66cd706882760b2f4691582b8f55d7a7de", - "tarball": "http://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.1.0.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "ansi-styles", + "version": "2.0.1", + "description": "ANSI escape codes for styling strings in the terminal", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/ansi-styles" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "da6541334e1681cb803f891fab8abf4313cc4bc1", + "bugs": { + "url": "https://github.com/sindresorhus/ansi-styles/issues" + }, + "homepage": "https://github.com/sindresorhus/ansi-styles", + "_id": "ansi-styles@2.0.1", + "_shasum": "b033f57f93e2d28adeb8bc11138fa13da0fd20a3", + "_from": "ansi-styles@>=2.0.1 <3.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "b033f57f93e2d28adeb8bc11138fa13da0fd20a3", + "tarball": "http://registry.npmjs.org/ansi-styles/-/ansi-styles-2.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/readme.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/readme.md index cd7415389c..89ec6a7c1e 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/readme.md +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/ansi-styles/readme.md @@ -1,70 +1,86 @@ -# ansi-styles [![Build Status](https://travis-ci.org/sindresorhus/ansi-styles.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-styles) - -> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal - -You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings. - -![screenshot](screenshot.png) - - -## Install - -```sh -$ npm install --save ansi-styles -``` - - -## Usage - -```js -var ansi = require('ansi-styles'); - -console.log(ansi.green.open + 'Hello world!' + ansi.green.close); -``` - - -## API - -Each style has an `open` and `close` property. - - -## Styles - -### General - -- `reset` -- `bold` -- `dim` -- `italic` *(not widely supported)* -- `underline` -- `inverse` -- `hidden` -- `strikethrough` *(not widely supported)* - -### Text colors - -- `black` -- `red` -- `green` -- `yellow` -- `blue` -- `magenta` -- `cyan` -- `white` -- `gray` - -### Background colors - -- `bgBlack` -- `bgRed` -- `bgGreen` -- `bgYellow` -- `bgBlue` -- `bgMagenta` -- `bgCyan` -- `bgWhite` - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# ansi-styles [![Build Status](https://travis-ci.org/sindresorhus/ansi-styles.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-styles) + +> [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code#Colors_and_Styles) for styling strings in the terminal + +You probably want the higher-level [chalk](https://github.com/sindresorhus/chalk) module for styling your strings. + +![](screenshot.png) + + +## Install + +```sh +$ npm install --save ansi-styles +``` + + +## Usage + +```js +var ansi = require('ansi-styles'); + +console.log(ansi.green.open + 'Hello world!' + ansi.green.close); +``` + + +## API + +Each style has an `open` and `close` property. + + +## Styles + +### Modifiers + +- `reset` +- `bold` +- `dim` +- `italic` *(not widely supported)* +- `underline` +- `inverse` +- `hidden` +- `strikethrough` *(not widely supported)* + +### Colors + +- `black` +- `red` +- `green` +- `yellow` +- `blue` +- `magenta` +- `cyan` +- `white` +- `gray` + +### Background colors + +- `bgBlack` +- `bgRed` +- `bgGreen` +- `bgYellow` +- `bgBlue` +- `bgMagenta` +- `bgCyan` +- `bgWhite` + + +## Advanced usage + +By default you get a map of styles, but the styles are also available as groups. They are non-enumerable so they don't show up unless you access them explicitly. This makes it easier to expose only a subset in a higher-level module. + +- `ansi.modifiers` +- `ansi.colors` +- `ansi.bgColors` + + +###### Example + +```js +console.log(ansi.colors.green.open); +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/license b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/license new file mode 100644 index 0000000000..654d0bfe94 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/package.json index 39e3804ba0..749f5ded2a 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/package.json +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/package.json @@ -1,69 +1,70 @@ -{ - "name": "escape-string-regexp", - "version": "1.0.2", - "description": "Escape RegExp special characters", - "license": "MIT", - "repository": { - "type": "git", - "url": "https://github.com/sindresorhus/escape-string-regexp" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.8.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js" - ], - "keywords": [ - "regex", - "regexp", - "re", - "regular", - "expression", - "escape", - "string", - "str", - "special", - "characters" - ], - "devDependencies": { - "mocha": "*" - }, - "gitHead": "0587ee0ee03ea3fcbfa3c15cf67b47f214e20987", - "bugs": { - "url": "https://github.com/sindresorhus/escape-string-regexp/issues" - }, - "homepage": "https://github.com/sindresorhus/escape-string-regexp", - "_id": "escape-string-regexp@1.0.2", - "_shasum": "4dbc2fe674e71949caf3fb2695ce7f2dc1d9a8d1", - "_from": "escape-string-regexp@>=1.0.0 <2.0.0", - "_npmVersion": "1.4.23", - "_npmUser": { - "name": "jbnicolai", - "email": "jappelman@xebia.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - { - "name": "jbnicolai", - "email": "jappelman@xebia.com" - } - ], - "dist": { - "shasum": "4dbc2fe674e71949caf3fb2695ce7f2dc1d9a8d1", - "tarball": "http://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.2.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "escape-string-regexp", + "version": "1.0.3", + "description": "Escape RegExp special characters", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/escape-string-regexp" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.8.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "regex", + "regexp", + "re", + "regular", + "expression", + "escape", + "string", + "str", + "special", + "characters" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "1e446e6b4449b5f1f8868cd31bf8fd25ee37fb4b", + "bugs": { + "url": "https://github.com/sindresorhus/escape-string-regexp/issues" + }, + "homepage": "https://github.com/sindresorhus/escape-string-regexp", + "_id": "escape-string-regexp@1.0.3", + "_shasum": "9e2d8b25bc2555c3336723750e03f099c2735bb5", + "_from": "escape-string-regexp@>=1.0.2 <2.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "9e2d8b25bc2555c3336723750e03f099c2735bb5", + "tarball": "http://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/readme.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/readme.md index 000b53755a..808a963a86 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/readme.md +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/escape-string-regexp/readme.md @@ -1,27 +1,27 @@ -# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp) - -> Escape RegExp special characters - - -## Install - -```sh -$ npm install --save escape-string-regexp -``` - - -## Usage - -```js -var escapeStringRegexp = require('escape-string-regexp'); - -var escapedString = escapeStringRegexp('how much $ for a unicorn?'); -//=> how much \$ for a unicorn\? - -new RegExp(escapedString); -``` - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# escape-string-regexp [![Build Status](https://travis-ci.org/sindresorhus/escape-string-regexp.svg?branch=master)](https://travis-ci.org/sindresorhus/escape-string-regexp) + +> Escape RegExp special characters + + +## Install + +```sh +$ npm install --save escape-string-regexp +``` + + +## Usage + +```js +var escapeStringRegexp = require('escape-string-regexp'); + +var escapedString = escapeStringRegexp('how much $ for a unicorn?'); +//=> how much \$ for a unicorn\? + +new RegExp(escapedString); +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/cli.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/cli.js old mode 100644 new mode 100755 index e0956fcc72..0386a82423 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/cli.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/cli.js @@ -1,29 +1,21 @@ #!/usr/bin/env node 'use strict'; +var stdin = require('get-stdin'); var pkg = require('./package.json'); var hasAnsi = require('./'); -var input = process.argv[2]; - -function stdin(cb) { - var ret = ''; - process.stdin.setEncoding('utf8'); - process.stdin.on('data', function (data) { - ret += data; - }); - process.stdin.on('end', function () { - cb(ret); - }); -} +var argv = process.argv.slice(2); +var input = argv[0]; function help() { console.log([ - pkg.description, '', - 'Usage', - ' $ has-ansi ', - ' $ echo | has-ansi', + ' ' + pkg.description, + '', + ' Usage', + ' has-ansi ', + ' echo | has-ansi', '', - 'Exits with code 0 if input has ANSI escape codes and 1 if not' + ' Exits with code 0 if input has ANSI escape codes and 1 if not' ].join('\n')); } @@ -31,12 +23,12 @@ function init(data) { process.exit(hasAnsi(data) ? 0 : 1); } -if (process.argv.indexOf('--help') !== -1) { +if (argv.indexOf('--help') !== -1) { help(); return; } -if (process.argv.indexOf('--version') !== -1) { +if (argv.indexOf('--version') !== -1) { console.log(pkg.version); return; } diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/license b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/license new file mode 100644 index 0000000000..654d0bfe94 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js index 783c5c7bb6..2fcdd1e472 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js @@ -1,4 +1,4 @@ 'use strict'; module.exports = function () { - return /\u001b\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]/g; + return /(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/g; }; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/license b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/license new file mode 100644 index 0000000000..654d0bfe94 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json index 3e0b2faa37..8d7033012c 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json @@ -1,79 +1,86 @@ -{ - "name": "ansi-regex", - "version": "0.2.1", - "description": "Regular expression for matching ANSI escape codes", - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/ansi-regex" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js" - ], - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "devDependencies": { - "mocha": "*" - }, - "bugs": { - "url": "https://github.com/sindresorhus/ansi-regex/issues" - }, - "homepage": "https://github.com/sindresorhus/ansi-regex", - "_id": "ansi-regex@0.2.1", - "_shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9", - "_from": "ansi-regex@>=0.2.1 <0.3.0", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "dist": { - "shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9", - "tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "ansi-regex", + "version": "1.1.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/ansi-regex" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha test/test.js", + "view-supported": "node test/viewCodes.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "47fb974630af70998157b30fad6eb5e5bd7c7cd6", + "bugs": { + "url": "https://github.com/sindresorhus/ansi-regex/issues" + }, + "homepage": "https://github.com/sindresorhus/ansi-regex", + "_id": "ansi-regex@1.1.1", + "_shasum": "41c847194646375e6a1a5d10c3ca054ef9fc980d", + "_from": "ansi-regex@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "41c847194646375e6a1a5d10c3ca054ef9fc980d", + "tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md index 95837d0c5c..ae876e7292 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md @@ -1,33 +1,33 @@ -# ansi-regex [![Build Status](https://travis-ci.org/sindresorhus/ansi-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-regex) - -> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -```sh -$ npm install --save ansi-regex -``` - - -## Usage - -```js -var ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001b[4mcake\u001b[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001b[4mcake\u001b[0m'.match(ansiRegex()); -//=> ['\u001b[4m', '\u001b[0m'] -``` - -*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.* - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# ansi-regex [![Build Status](https://travis-ci.org/sindresorhus/ansi-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-regex) + +> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +```sh +$ npm install --save ansi-regex +``` + + +## Usage + +```js +var ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001b[4mcake\u001b[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001b[4mcake\u001b[0m'.match(ansiRegex()); +//=> ['\u001b[4m', '\u001b[0m'] +``` + +*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.* + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/index.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/index.js new file mode 100644 index 0000000000..0f1aeb3df4 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/index.js @@ -0,0 +1,49 @@ +'use strict'; + +module.exports = function (cb) { + var stdin = process.stdin; + var ret = ''; + + if (stdin.isTTY) { + setImmediate(cb, ''); + return; + } + + stdin.setEncoding('utf8'); + + stdin.on('readable', function () { + var chunk; + + while (chunk = stdin.read()) { + ret += chunk; + } + }); + + stdin.on('end', function () { + cb(ret); + }); +}; + +module.exports.buffer = function (cb) { + var stdin = process.stdin; + var ret = []; + var len = 0; + + if (stdin.isTTY) { + setImmediate(cb, new Buffer('')); + return; + } + + stdin.on('readable', function () { + var chunk; + + while (chunk = stdin.read()) { + ret.push(chunk); + len += chunk.length; + } + }); + + stdin.on('end', function () { + cb(Buffer.concat(ret, len)); + }); +}; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/package.json new file mode 100644 index 0000000000..e0e5c64a0f --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/package.json @@ -0,0 +1,64 @@ +{ + "name": "get-stdin", + "version": "4.0.1", + "description": "Easier stdin", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/get-stdin" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "node test.js && node test-buffer.js && echo unicorns | node test-real.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "std", + "stdin", + "stdio", + "concat", + "buffer", + "stream", + "process", + "stream" + ], + "devDependencies": { + "ava": "0.0.4", + "buffer-equal": "0.0.1" + }, + "gitHead": "65c744975229b25d6cc5c7546f49b6ad9099553f", + "bugs": { + "url": "https://github.com/sindresorhus/get-stdin/issues" + }, + "homepage": "https://github.com/sindresorhus/get-stdin", + "_id": "get-stdin@4.0.1", + "_shasum": "b968c6b0a04384324902e8bf1a5df32579a450fe", + "_from": "get-stdin@>=4.0.1 <5.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + } + ], + "dist": { + "shasum": "b968c6b0a04384324902e8bf1a5df32579a450fe", + "tarball": "http://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/readme.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/readme.md new file mode 100644 index 0000000000..bc1d32a8ad --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/node_modules/get-stdin/readme.md @@ -0,0 +1,44 @@ +# get-stdin [![Build Status](https://travis-ci.org/sindresorhus/get-stdin.svg?branch=master)](https://travis-ci.org/sindresorhus/get-stdin) + +> Easier stdin + + +## Install + +```sh +$ npm install --save get-stdin +``` + + +## Usage + +```js +// example.js +var stdin = require('get-stdin'); + +stdin(function (data) { + console.log(data); + //=> unicorns +}); +``` + +```sh +$ echo unicorns | node example.js +unicorns +``` + + +## API + +### stdin(callback) + +Get `stdin` as a string. + +### stdin.buffer(callback) + +Get `stdin` as a buffer. + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/package.json index fc8845b618..43582f8708 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/package.json +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/package.json @@ -1,85 +1,92 @@ -{ - "name": "has-ansi", - "version": "0.1.0", - "description": "Check if a string has ANSI escape codes", - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/has-ansi" - }, - "bin": { - "has-ansi": "cli.js" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js", - "cli.js" - ], - "keywords": [ - "cli", - "bin", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "string", - "tty", - "escape", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern", - "has" - ], - "dependencies": { - "ansi-regex": "^0.2.0" - }, - "devDependencies": { - "mocha": "*" - }, - "bugs": { - "url": "https://github.com/sindresorhus/has-ansi/issues" - }, - "homepage": "https://github.com/sindresorhus/has-ansi", - "_id": "has-ansi@0.1.0", - "_shasum": "84f265aae8c0e6a88a12d7022894b7568894c62e", - "_from": "has-ansi@>=0.1.0 <0.2.0", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "dist": { - "shasum": "84f265aae8c0e6a88a12d7022894b7568894c62e", - "tarball": "http://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-0.1.0.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "has-ansi", + "version": "1.0.3", + "description": "Check if a string has ANSI escape codes", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/has-ansi" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "bin": { + "has-ansi": "cli.js" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js", + "cli.js" + ], + "keywords": [ + "cli", + "bin", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "string", + "tty", + "escape", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern", + "has" + ], + "dependencies": { + "ansi-regex": "^1.1.0", + "get-stdin": "^4.0.1" + }, + "devDependencies": { + "mocha": "*" + }, + "gitHead": "416428ed16f8e9718aec54cea083173af6019917", + "bugs": { + "url": "https://github.com/sindresorhus/has-ansi/issues" + }, + "homepage": "https://github.com/sindresorhus/has-ansi", + "_id": "has-ansi@1.0.3", + "_shasum": "c0b5b1615d9e382b0ff67169d967b425e48ca538", + "_from": "has-ansi@>=1.0.3 <2.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "c0b5b1615d9e382b0ff67169d967b425e48ca538", + "tarball": "http://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-1.0.3.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/readme.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/readme.md index aaaef959f2..0fa149a82a 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/readme.md +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/readme.md @@ -1,45 +1,45 @@ -# has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi) - -> Check if a string has [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -```sh -$ npm install --save has-ansi -``` - - -## Usage - -```js -var hasAnsi = require('has-ansi'); - -hasAnsi('\u001b[4mcake\u001b[0m'); -//=> true - -hasAnsi('cake'); -//=> false -``` - - -## CLI - -```sh -$ npm install --global has-ansi -``` - -``` -$ has-ansi --help - -Usage - $ has-ansi - $ echo | has-ansi - -Exits with code 0 if input has ANSI escape codes and 1 if not -``` - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi) + +> Check if a string has [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +```sh +$ npm install --save has-ansi +``` + + +## Usage + +```js +var hasAnsi = require('has-ansi'); + +hasAnsi('\u001b[4mcake\u001b[0m'); +//=> true + +hasAnsi('cake'); +//=> false +``` + + +## CLI + +```sh +$ npm install --global has-ansi +``` + +``` +$ has-ansi --help + + Usage + has-ansi + echo | has-ansi + + Exits with code 0 if input has ANSI escape codes and 1 if not +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/cli.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/cli.js old mode 100644 new mode 100755 index 602ae00e8f..b83f63b907 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/cli.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/cli.js @@ -2,38 +2,46 @@ 'use strict'; var fs = require('fs'); var pkg = require('./package.json'); -var strip = require('./'); -var input = process.argv[2]; +var stripAnsi = require('./'); +var argv = process.argv.slice(2); +var input = argv[0]; function help() { console.log([ - pkg.description, '', - 'Usage', - ' $ strip-ansi > ', - ' $ cat | strip-ansi > ', + ' ' + pkg.description, '', - 'Example', - ' $ strip-ansi unicorn.txt > unicorn-stripped.txt' + ' Usage', + ' strip-ansi > ', + ' cat | strip-ansi > ', + '', + ' Example', + ' strip-ansi unicorn.txt > unicorn-stripped.txt' ].join('\n')); } -if (process.argv.indexOf('--help') !== -1) { +function init(data) { + process.stdout.write(stripAnsi(data)); +} + +if (argv.indexOf('--help') !== -1) { help(); return; } -if (process.argv.indexOf('--version') !== -1) { +if (argv.indexOf('--version') !== -1) { console.log(pkg.version); return; } -if (input) { - process.stdout.write(strip(fs.readFileSync(input, 'utf8'))); +if (!input && process.stdin.isTTY) { + help(); return; } -process.stdin.setEncoding('utf8'); -process.stdin.on('data', function (data) { - process.stdout.write(strip(data)); -}); +if (input) { + init(fs.readFileSync(input, 'utf8')); +} else { + process.stdin.setEncoding('utf8'); + process.stdin.on('data', init); +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js index 783c5c7bb6..2fcdd1e472 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js @@ -1,4 +1,4 @@ 'use strict'; module.exports = function () { - return /\u001b\[(?:[0-9]{1,3}(?:;[0-9]{1,3})*)?[m|K]/g; + return /(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/g; }; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/license b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/license new file mode 100644 index 0000000000..654d0bfe94 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json index 3e0b2faa37..8d7033012c 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json @@ -1,79 +1,86 @@ -{ - "name": "ansi-regex", - "version": "0.2.1", - "description": "Regular expression for matching ANSI escape codes", - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/ansi-regex" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js" - ], - "keywords": [ - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "text", - "regex", - "regexp", - "re", - "match", - "test", - "find", - "pattern" - ], - "devDependencies": { - "mocha": "*" - }, - "bugs": { - "url": "https://github.com/sindresorhus/ansi-regex/issues" - }, - "homepage": "https://github.com/sindresorhus/ansi-regex", - "_id": "ansi-regex@0.2.1", - "_shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9", - "_from": "ansi-regex@>=0.2.1 <0.3.0", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "dist": { - "shasum": "0d8e946967a3d8143f93e24e298525fc1b2235f9", - "tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-0.2.1.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "ansi-regex", + "version": "1.1.1", + "description": "Regular expression for matching ANSI escape codes", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/ansi-regex" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha test/test.js", + "view-supported": "node test/viewCodes.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "text", + "regex", + "regexp", + "re", + "match", + "test", + "find", + "pattern" + ], + "devDependencies": { + "mocha": "*" + }, + "gitHead": "47fb974630af70998157b30fad6eb5e5bd7c7cd6", + "bugs": { + "url": "https://github.com/sindresorhus/ansi-regex/issues" + }, + "homepage": "https://github.com/sindresorhus/ansi-regex", + "_id": "ansi-regex@1.1.1", + "_shasum": "41c847194646375e6a1a5d10c3ca054ef9fc980d", + "_from": "ansi-regex@>=1.0.0 <2.0.0", + "_npmVersion": "2.1.16", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + }, + "dist": { + "shasum": "41c847194646375e6a1a5d10c3ca054ef9fc980d", + "tarball": "http://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-1.1.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md index 95837d0c5c..ae876e7292 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md @@ -1,33 +1,33 @@ -# ansi-regex [![Build Status](https://travis-ci.org/sindresorhus/ansi-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-regex) - -> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -```sh -$ npm install --save ansi-regex -``` - - -## Usage - -```js -var ansiRegex = require('ansi-regex'); - -ansiRegex().test('\u001b[4mcake\u001b[0m'); -//=> true - -ansiRegex().test('cake'); -//=> false - -'\u001b[4mcake\u001b[0m'.match(ansiRegex()); -//=> ['\u001b[4m', '\u001b[0m'] -``` - -*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.* - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# ansi-regex [![Build Status](https://travis-ci.org/sindresorhus/ansi-regex.svg?branch=master)](https://travis-ci.org/sindresorhus/ansi-regex) + +> Regular expression for matching [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +```sh +$ npm install --save ansi-regex +``` + + +## Usage + +```js +var ansiRegex = require('ansi-regex'); + +ansiRegex().test('\u001b[4mcake\u001b[0m'); +//=> true + +ansiRegex().test('cake'); +//=> false + +'\u001b[4mcake\u001b[0m'.match(ansiRegex()); +//=> ['\u001b[4m', '\u001b[0m'] +``` + +*It's a function so you can create multiple instances. Regexes with the global flag will have the `.lastIndex` property changed for each call to methods on the instance. Therefore reusing the instance with multiple calls will not work as expected for `.test()`.* + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/package.json index dabee1dafc..44c71ffb20 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/package.json +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/package.json @@ -1,84 +1,89 @@ -{ - "name": "strip-ansi", - "version": "0.3.0", - "description": "Strip ANSI escape codes", - "license": "MIT", - "bin": { - "strip-ansi": "cli.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/strip-ansi" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js", - "cli.js" - ], - "keywords": [ - "strip", - "trim", - "remove", - "ansi", - "styles", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "tty", - "escape", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-regex": "^0.2.1" - }, - "devDependencies": { - "mocha": "*" - }, - "bugs": { - "url": "https://github.com/sindresorhus/strip-ansi/issues" - }, - "homepage": "https://github.com/sindresorhus/strip-ansi", - "_id": "strip-ansi@0.3.0", - "_shasum": "25f48ea22ca79187f3174a4db8759347bb126220", - "_from": "strip-ansi@>=0.3.0 <0.4.0", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "dist": { - "shasum": "25f48ea22ca79187f3174a4db8759347bb126220", - "tarball": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.3.0.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "strip-ansi", + "version": "2.0.1", + "description": "Strip ANSI escape codes", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/strip-ansi" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "http://sindresorhus.com" + }, + "bin": { + "strip-ansi": "cli.js" + }, + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js", + "cli.js" + ], + "keywords": [ + "strip", + "trim", + "remove", + "ansi", + "styles", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "tty", + "escape", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-regex": "^1.0.0" + }, + "devDependencies": { + "mocha": "*" + }, + "gitHead": "1eff0936c01f89efa312d9d51deed137259871a1", + "bugs": { + "url": "https://github.com/sindresorhus/strip-ansi/issues" + }, + "homepage": "https://github.com/sindresorhus/strip-ansi", + "_id": "strip-ansi@2.0.1", + "_shasum": "df62c1aa94ed2f114e1d0f21fd1d50482b79a60e", + "_from": "strip-ansi@>=2.0.1 <3.0.0", + "_npmVersion": "1.4.28", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "dist": { + "shasum": "df62c1aa94ed2f114e1d0f21fd1d50482b79a60e", + "tarball": "http://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-2.0.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/readme.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/readme.md index f16759a3ca..53ec26436c 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/readme.md +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/strip-ansi/readme.md @@ -1,43 +1,43 @@ -# strip-ansi [![Build Status](https://travis-ci.org/sindresorhus/strip-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-ansi) - -> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) - - -## Install - -```sh -$ npm install --save strip-ansi -``` - - -## Usage - -```js -var stripAnsi = require('strip-ansi'); - -stripAnsi('\x1b[4mcake\x1b[0m'); -//=> 'cake' -``` - - -## CLI - -```sh -$ npm install --global strip-ansi -``` - -```sh -$ strip-ansi --help - -Usage - $ strip-ansi > - $ cat | strip-ansi > - -Example - $ strip-ansi unicorn.txt > unicorn-stripped.txt -``` - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# strip-ansi [![Build Status](https://travis-ci.org/sindresorhus/strip-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/strip-ansi) + +> Strip [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code) + + +## Install + +```sh +$ npm install --save strip-ansi +``` + + +## Usage + +```js +var stripAnsi = require('strip-ansi'); + +stripAnsi('\u001b[4mcake\u001b[0m'); +//=> 'cake' +``` + + +## CLI + +```sh +$ npm install --global strip-ansi +``` + +```sh +$ strip-ansi --help + + Usage + strip-ansi > + cat | strip-ansi > + + Example + strip-ansi unicorn.txt > unicorn-stripped.txt +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/cli.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/cli.js old mode 100644 new mode 100755 index 0617971e6f..e746987666 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/cli.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/cli.js @@ -2,25 +2,26 @@ 'use strict'; var pkg = require('./package.json'); var supportsColor = require('./'); -var input = process.argv[2]; +var argv = process.argv.slice(2); function help() { console.log([ - pkg.description, '', - 'Usage', - ' $ supports-color', + ' ' + pkg.description, '', - 'Exits with code 0 if color is supported and 1 if not' + ' Usage', + ' supports-color', + '', + ' Exits with code 0 if color is supported and 1 if not' ].join('\n')); } -if (!input || process.argv.indexOf('--help') !== -1) { +if (argv.indexOf('--help') !== -1) { help(); return; } -if (process.argv.indexOf('--version') !== -1) { +if (argv.indexOf('--version') !== -1) { console.log(pkg.version); return; } diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/index.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/index.js index 092d0baef6..a17196485d 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/index.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/index.js @@ -1,10 +1,21 @@ 'use strict'; +var argv = process.argv; + module.exports = (function () { - if (process.argv.indexOf('--no-color') !== -1) { + if ('FORCE_COLOR' in process.env) { + return true; + } + + if (argv.indexOf('--no-color') !== -1 || + argv.indexOf('--no-colors') !== -1 || + argv.indexOf('--color=false') !== -1) { return false; } - if (process.argv.indexOf('--color') !== -1) { + if (argv.indexOf('--color') !== -1 || + argv.indexOf('--colors') !== -1 || + argv.indexOf('--color=true') !== -1 || + argv.indexOf('--color=always') !== -1) { return true; } diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/license b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/license new file mode 100644 index 0000000000..654d0bfe94 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/license @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/package.json index db6a77cb7d..0a52c0d1ed 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/package.json +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/package.json @@ -1,78 +1,85 @@ -{ - "name": "supports-color", - "version": "0.2.0", - "description": "Detect whether a terminal supports color", - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/supports-color" - }, - "bin": { - "supports-color": "cli.js" - }, - "author": { - "name": "Sindre Sorhus", - "email": "sindresorhus@gmail.com", - "url": "http://sindresorhus.com" - }, - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha" - }, - "files": [ - "index.js", - "cli.js" - ], - "keywords": [ - "cli", - "bin", - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "ansi", - "styles", - "tty", - "rgb", - "256", - "shell", - "xterm", - "command-line", - "support", - "supports", - "capability", - "detect" - ], - "devDependencies": { - "mocha": "*" - }, - "bugs": { - "url": "https://github.com/sindresorhus/supports-color/issues" - }, - "homepage": "https://github.com/sindresorhus/supports-color", - "_id": "supports-color@0.2.0", - "_shasum": "d92de2694eb3f67323973d7ae3d8b55b4c22190a", - "_from": "supports-color@>=0.2.0 <0.3.0", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - } - ], - "dist": { - "shasum": "d92de2694eb3f67323973d7ae3d8b55b4c22190a", - "tarball": "http://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-0.2.0.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "supports-color", + "version": "1.3.1", + "description": "Detect whether a terminal supports color", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/supports-color" + }, + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "bin": { + "supports-color": "cli.js" + }, + "engines": { + "node": ">=0.8.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js", + "cli.js" + ], + "keywords": [ + "cli", + "bin", + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "ansi", + "styles", + "tty", + "rgb", + "256", + "shell", + "xterm", + "command-line", + "support", + "supports", + "capability", + "detect" + ], + "devDependencies": { + "mocha": "*", + "require-uncached": "^1.0.2" + }, + "gitHead": "09f1b4c336cee7269b4c8b3a8880054a23fcb35e", + "bugs": { + "url": "https://github.com/sindresorhus/supports-color/issues" + }, + "homepage": "https://github.com/sindresorhus/supports-color", + "_id": "supports-color@1.3.1", + "_shasum": "15758df09d8ff3b4acc307539fabe27095e1042d", + "_from": "supports-color@>=1.3.0 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "dist": { + "shasum": "15758df09d8ff3b4acc307539fabe27095e1042d", + "tarball": "http://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/supports-color/-/supports-color-1.3.1.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/readme.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/readme.md index 1f1c32fffd..fe6016f9d0 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/readme.md +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/node_modules/supports-color/readme.md @@ -1,44 +1,46 @@ -# supports-color [![Build Status](https://travis-ci.org/sindresorhus/supports-color.svg?branch=master)](https://travis-ci.org/sindresorhus/supports-color) - -> Detect whether a terminal supports color - - -## Install - -```sh -$ npm install --save supports-color -``` - - -## Usage - -```js -var supportsColor = require('supports-color'); - -if (supportsColor) { - console.log('Terminal supports color'); -} -``` - -It obeys the `--color` and `--no-color` CLI flags. - - -## CLI - -```sh -$ npm install --global supports-color -``` - -```sh -$ supports-color --help - -Usage - $ supports-color - -# Exits with code 0 if color is supported and 1 if not -``` - - -## License - -MIT © [Sindre Sorhus](http://sindresorhus.com) +# supports-color [![Build Status](https://travis-ci.org/sindresorhus/supports-color.svg?branch=master)](https://travis-ci.org/sindresorhus/supports-color) + +> Detect whether a terminal supports color + + +## Install + +``` +$ npm install --save supports-color +``` + + +## Usage + +```js +var supportsColor = require('supports-color'); + +if (supportsColor) { + console.log('Terminal supports color'); +} +``` + +It obeys the `--color` and `--no-color` CLI flags. + +For situations where using `--color` is not possible, add an environment variable `FORCE_COLOR` with any value to force color. Trumps `--no-color`. + + +## CLI + +``` +$ npm install --global supports-color +``` + +``` +$ supports-color --help + + Usage + supports-color + + Exits with code 0 if color is supported and 1 if not +``` + + +## License + +MIT © [Sindre Sorhus](http://sindresorhus.com) diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/package.json index 471ff0d62a..93055c07c0 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/package.json +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/package.json @@ -1,82 +1,83 @@ -{ - "name": "chalk", - "version": "0.5.1", - "description": "Terminal string styling done right. Created because the `colors` module does some really horrible things.", - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/sindresorhus/chalk" - }, - "maintainers": [ - { - "name": "sindresorhus", - "email": "sindresorhus@gmail.com" - }, - { - "name": "jbnicolai", - "email": "jappelman@xebia.com" - } - ], - "engines": { - "node": ">=0.10.0" - }, - "scripts": { - "test": "mocha", - "bench": "matcha benchmark.js" - }, - "files": [ - "index.js" - ], - "keywords": [ - "color", - "colour", - "colors", - "terminal", - "console", - "cli", - "string", - "ansi", - "styles", - "tty", - "formatting", - "rgb", - "256", - "shell", - "xterm", - "log", - "logging", - "command-line", - "text" - ], - "dependencies": { - "ansi-styles": "^1.1.0", - "escape-string-regexp": "^1.0.0", - "has-ansi": "^0.1.0", - "strip-ansi": "^0.3.0", - "supports-color": "^0.2.0" - }, - "devDependencies": { - "matcha": "^0.5.0", - "mocha": "*" - }, - "gitHead": "994758f01293f1fdcf63282e9917cb9f2cfbdaac", - "bugs": { - "url": "https://github.com/sindresorhus/chalk/issues" - }, - "homepage": "https://github.com/sindresorhus/chalk", - "_id": "chalk@0.5.1", - "_shasum": "663b3a648b68b55d04690d49167aa837858f2174", - "_from": "chalk@>=0.5.0 <0.6.0", - "_npmVersion": "1.4.14", - "_npmUser": { - "name": "jbnicolai", - "email": "jappelman@xebia.com" - }, - "dist": { - "shasum": "663b3a648b68b55d04690d49167aa837858f2174", - "tarball": "http://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/chalk/-/chalk-0.5.1.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "chalk", + "version": "1.0.0", + "description": "Terminal string styling done right. Much color.", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/sindresorhus/chalk" + }, + "maintainers": [ + { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + { + "name": "jbnicolai", + "email": "jappelman@xebia.com" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha", + "bench": "matcha benchmark.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "color", + "colour", + "colors", + "terminal", + "console", + "cli", + "string", + "ansi", + "styles", + "tty", + "formatting", + "rgb", + "256", + "shell", + "xterm", + "log", + "logging", + "command-line", + "text" + ], + "dependencies": { + "ansi-styles": "^2.0.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^1.0.3", + "strip-ansi": "^2.0.1", + "supports-color": "^1.3.0" + }, + "devDependencies": { + "matcha": "^0.6.0", + "mocha": "*" + }, + "gitHead": "8864d3563313ed15574a38dd5c9d5966080c46ce", + "bugs": { + "url": "https://github.com/sindresorhus/chalk/issues" + }, + "homepage": "https://github.com/sindresorhus/chalk", + "_id": "chalk@1.0.0", + "_shasum": "b3cf4ed0ff5397c99c75b8f679db2f52831f96dc", + "_from": "chalk@>=1.0.0 <2.0.0", + "_npmVersion": "2.5.1", + "_nodeVersion": "0.12.0", + "_npmUser": { + "name": "sindresorhus", + "email": "sindresorhus@gmail.com" + }, + "dist": { + "shasum": "b3cf4ed0ff5397c99c75b8f679db2f52831f96dc", + "tarball": "http://registry.npmjs.org/chalk/-/chalk-1.0.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/chalk/-/chalk-1.0.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/readme.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/readme.md index 8151530601..43c7064335 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/readme.md +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/chalk/readme.md @@ -1,175 +1,197 @@ -# chalk - -> Terminal string styling done right - -[![Build Status](https://travis-ci.org/sindresorhus/chalk.svg?branch=master)](https://travis-ci.org/sindresorhus/chalk) -![](http://img.shields.io/badge/unicorn-approved-ff69b4.svg) - -[colors.js](https://github.com/Marak/colors.js) is currently the most popular string styling module, but it has serious deficiencies like extending String.prototype which causes all kinds of [problems](https://github.com/yeoman/yo/issues/68). Although there are other ones, they either do too much or not enough. - -**Chalk is a clean and focused alternative.** - -![screenshot](https://github.com/sindresorhus/ansi-styles/raw/master/screenshot.png) - - -## Why - -- Highly performant -- Doesn't extend String.prototype -- Expressive API -- Ability to nest styles -- Clean and focused -- Auto-detects color support -- Actively maintained -- [Used by 1000+ modules](https://npmjs.org/browse/depended/chalk) - - -## Install - -```sh -$ npm install --save chalk -``` - - -## Usage - -Chalk comes with an easy to use composable API where you just chain and nest the styles you want. - -```js -var chalk = require('chalk'); - -// style a string -console.log( chalk.blue('Hello world!') ); - -// combine styled and normal strings -console.log( chalk.blue('Hello'), 'World' + chalk.red('!') ); - -// compose multiple styles using the chainable API -console.log( chalk.blue.bgRed.bold('Hello world!') ); - -// pass in multiple arguments -console.log( chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz') ); - -// nest styles -console.log( chalk.red('Hello', chalk.underline.bgBlue('world') + '!') ); - -// nest styles of the same type even (color, underline, background) -console.log( chalk.green('I am a green line ' + chalk.blue('with a blue substring') + ' that becomes green again!') ); -``` - -Easily define your own themes. - -```js -var chalk = require('chalk'); -var error = chalk.bold.red; -console.log(error('Error!')); -``` - -Take advantage of console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data). - -```js -var name = 'Sindre'; -console.log(chalk.green('Hello %s'), name); -//=> Hello Sindre -``` - - -## API - -### chalk.` - - -
    -

    Code coverage report for All files

    -

    - - Statements: 100% (111 / 111)      - - - Branches: 100% (84 / 84)      - - - Functions: 100% (20 / 20)      - - - Lines: 100% (102 / 102)      - - Ignored: none      -

    -
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FileStatementsBranchesFunctionsLines
    vinyl/100%(89 / 89)100%(76 / 76)100%(15 / 15)100%(82 / 82)
    vinyl/lib/100%(22 / 22)100%(8 / 8)100%(5 / 5)100%(20 / 20)
    -
    -
    -
    - - - - - - - diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/prettify.css b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/prettify.css deleted file mode 100644 index 5181e157c9..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/prettify.css +++ /dev/null @@ -1 +0,0 @@ -.pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/prettify.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/prettify.js deleted file mode 100644 index ef51e03866..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/prettify.js +++ /dev/null @@ -1 +0,0 @@ -window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;arat[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/index.html b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/index.html deleted file mode 100644 index e4f84d2346..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/index.html +++ /dev/null @@ -1,350 +0,0 @@ - - - - Code coverage report for vinyl/ - - - - - - - -
    -

    Code coverage report for vinyl/

    -

    - - Statements: 100% (89 / 89)      - - - Branches: 100% (76 / 76)      - - - Functions: 100% (15 / 15)      - - - Lines: 100% (82 / 82)      - - Ignored: none      -

    -
    All files » vinyl/
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FileStatementsBranchesFunctionsLines
    index.js100%(89 / 89)100%(76 / 76)100%(15 / 15)100%(82 / 82)
    -
    -
    - - - - - - - - diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/index.js.html b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/index.js.html deleted file mode 100644 index f47d9b3794..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/index.js.html +++ /dev/null @@ -1,847 +0,0 @@ - - - - Code coverage report for vinyl/index.js - - - - - - - -
    -

    Code coverage report for vinyl/index.js

    -

    - - Statements: 100% (89 / 89)      - - - Branches: 100% (76 / 76)      - - - Functions: 100% (15 / 15)      - - - Lines: 100% (82 / 82)      - - Ignored: none      -

    -
    All files » vinyl/ » index.js
    -
    -
    -
    
    -
    -
    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 -49 -50 -51 -52 -53 -54 -55 -56 -57 -58 -59 -60 -61 -62 -63 -64 -65 -66 -67 -68 -69 -70 -71 -72 -73 -74 -75 -76 -77 -78 -79 -80 -81 -82 -83 -84 -85 -86 -87 -88 -89 -90 -91 -92 -93 -94 -95 -96 -97 -98 -99 -100 -101 -102 -103 -104 -105 -106 -107 -108 -109 -110 -111 -112 -113 -114 -115 -116 -117 -118 -119 -120 -121 -122 -123 -124 -125 -126 -127 -128 -129 -130 -131 -132 -133 -134 -135 -136 -137 -138 -139 -140 -141 -142 -143 -144 -145 -146 -147 -148 -149 -150 -151 -152 -153 -154 -155 -156 -157 -158 -159 -160 -161 -162 -163 -164 -165 -166 -167 -168 -169 -170 -171 -172 -173 -174 -175 -1761 -1 -1 -1 -1 -1 -1 -1 -1 -  -1 -73 -  -  -73 -73 -  -  -73 -73 -  -  -  -73 -  -  -73 -  -  -1 -26 -  -  -1 -29 -  -  -1 -6 -  -  -  -1 -3 -  -  -1 -14 -2 -  -  -  -12 -7 -  -  -  -  -5 -5 -  -  -  -14 -14 -1 -1 -13 -6 -  -  -14 -  -  -  -  -  -  -  -  -14 -  -75 -  -  -70 -  -5 -  -14 -  -  -1 -6 -6 -  -6 -2 -  -4 -2 -1 -  -1 -  -2 -  -  -  -2 -2 -  -  -1 -6 -  -  -6 -  -6 -4 -  -  -6 -3 -  -  -6 -1 -  -  -6 -  -  -  -  -1 -  -99 -  -  -78 -1 -  -77 -  -  -  -  -1 -  -7 -6 -5 -  -  -1 -  -  -  -1 -  -46 -  -  -9 -  -  -8 -5 -  -  -  -  -1 - 
    var path = require('path');
    -var clone = require('lodash').clone;
    -var cloneStats = require('clone-stats');
    -var cloneBuffer = require('./lib/cloneBuffer');
    -var isBuffer = require('./lib/isBuffer');
    -var isStream = require('./lib/isStream');
    -var isNull = require('./lib/isNull');
    -var inspectStream = require('./lib/inspectStream');
    -var Stream = require('stream');
    - 
    -function File(file) {
    -  if (!file) file = {};
    - 
    -  // record path change
    -  var history = file.path ? [file.path] : file.history;
    -  this.history = history || [];
    - 
    -  // TODO: should this be moved to vinyl-fs?
    -  this.cwd = file.cwd || process.cwd();
    -  this.base = file.base || this.cwd;
    - 
    -  // stat = fs stats object
    -  // TODO: should this be moved to vinyl-fs?
    -  this.stat = file.stat || null;
    - 
    -  // contents = stream, buffer, or null if not read
    -  this.contents = file.contents || null;
    -}
    - 
    -File.prototype.isBuffer = function() {
    -  return isBuffer(this.contents);
    -};
    - 
    -File.prototype.isStream = function() {
    -  return isStream(this.contents);
    -};
    - 
    -File.prototype.isNull = function() {
    -  return isNull(this.contents);
    -};
    - 
    -// TODO: should this be moved to vinyl-fs?
    -File.prototype.isDirectory = function() {
    -  return this.isNull() && this.stat && this.stat.isDirectory();
    -};
    - 
    -File.prototype.clone = function(opt) {
    -  if (typeof opt === 'boolean') {
    -    opt = {
    -      deep: opt,
    -      contents: true
    -    };
    -  } else if (!opt) {
    -    opt = {
    -      deep: false,
    -      contents: true
    -    };
    -  } else {
    -    opt.deep = opt.deep === true;
    -    opt.contents = opt.contents !== false;
    -  }
    - 
    -  // clone our file contents
    -  var contents;
    -  if (this.isStream()) {
    -    contents = this.contents.pipe(new Stream.PassThrough());
    -    this.contents = this.contents.pipe(new Stream.PassThrough());
    -  } else if (this.isBuffer()) {
    -    contents = opt.contents ? cloneBuffer(this.contents) : this.contents;
    -  }
    - 
    -  var file = new File({
    -    cwd: this.cwd,
    -    base: this.base,
    -    stat: (this.stat ? cloneStats(this.stat) : null),
    -    history: this.history.slice(),
    -    contents: contents
    -  });
    - 
    -  // clone our custom properties
    -  Object.keys(this).forEach(function(key) {
    -    // ignore built-in fields
    -    if (key === '_contents' || key === 'stat' ||
    -      key === 'history' || key === 'path' ||
    -      key === 'base' || key === 'cwd') {
    -      return;
    -    }
    -    file[key] = opt.deep ? clone(this[key], true) : this[key];
    -  }, this);
    -  return file;
    -};
    - 
    -File.prototype.pipe = function(stream, opt) {
    -  if (!opt) opt = {};
    -  if (typeof opt.end === 'undefined') opt.end = true;
    - 
    -  if (this.isStream()) {
    -    return this.contents.pipe(stream, opt);
    -  }
    -  if (this.isBuffer()) {
    -    if (opt.end) {
    -      stream.end(this.contents);
    -    } else {
    -      stream.write(this.contents);
    -    }
    -    return stream;
    -  }
    - 
    -  // isNull
    -  if (opt.end) stream.end();
    -  return stream;
    -};
    - 
    -File.prototype.inspect = function() {
    -  var inspect = [];
    - 
    -  // use relative path if possible
    -  var filePath = (this.base && this.path) ? this.relative : this.path;
    - 
    -  if (filePath) {
    -    inspect.push('"'+filePath+'"');
    -  }
    - 
    -  if (this.isBuffer()) {
    -    inspect.push(this.contents.inspect());
    -  }
    - 
    -  if (this.isStream()) {
    -    inspect.push(inspectStream(this.contents));
    -  }
    - 
    -  return '<File '+inspect.join(' ')+'>';
    -};
    - 
    -// virtual attributes
    -// or stuff with extra logic
    -Object.defineProperty(File.prototype, 'contents', {
    -  get: function() {
    -    return this._contents;
    -  },
    -  set: function(val) {
    -    if (!isBuffer(val) && !isStream(val) && !isNull(val)) {
    -      throw new Error('File.contents can only be a Buffer, a Stream, or null.');
    -    }
    -    this._contents = val;
    -  }
    -});
    - 
    -// TODO: should this be moved to vinyl-fs?
    -Object.defineProperty(File.prototype, 'relative', {
    -  get: function() {
    -    if (!this.base) throw new Error('No base specified! Can not get relative.');
    -    if (!this.path) throw new Error('No path specified! Can not get relative.');
    -    return path.relative(this.base, this.path);
    -  },
    -  set: function() {
    -    throw new Error('File.relative is generated from the base and path attributes. Do not modify it.');
    -  }
    -});
    - 
    -Object.defineProperty(File.prototype, 'path', {
    -  get: function() {
    -    return this.history[this.history.length - 1];
    -  },
    -  set: function(path) {
    -    if (typeof path !== 'string') throw new Error('path should be string');
    - 
    -    // record history only when path changed
    -    if (path && path !== this.path) {
    -      this.history.push(path);
    -    }
    -  }
    -});
    - 
    -module.exports = File;
    - 
    - -
    - - - - - - - - diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/cloneBuffer.js.html b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/cloneBuffer.js.html deleted file mode 100644 index db5a686f37..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/cloneBuffer.js.html +++ /dev/null @@ -1,343 +0,0 @@ - - - - Code coverage report for vinyl/lib/cloneBuffer.js - - - - - - - -
    -

    Code coverage report for vinyl/lib/cloneBuffer.js

    -

    - - Statements: 100% (5 / 5)      - - - Branches: 100% (0 / 0)      - - - Functions: 100% (1 / 1)      - - - Lines: 100% (5 / 5)      - - Ignored: none      -

    -
    All files » vinyl/lib/ » cloneBuffer.js
    -
    -
    -
    
    -
    -
    1 -2 -3 -4 -5 -6 -7 -81 -  -1 -7 -7 -7 -  - 
    var Buffer = require('buffer').Buffer;
    - 
    -module.exports = function(buf) {
    -  var out = new Buffer(buf.length);
    -  buf.copy(out);
    -  return out;
    -};
    - 
    - -
    - - - - - - - - diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/index.html b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/index.html deleted file mode 100644 index e5389556fa..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/index.html +++ /dev/null @@ -1,402 +0,0 @@ - - - - Code coverage report for vinyl/lib/ - - - - - - - -
    -

    Code coverage report for vinyl/lib/

    -

    - - Statements: 100% (22 / 22)      - - - Branches: 100% (8 / 8)      - - - Functions: 100% (5 / 5)      - - - Lines: 100% (20 / 20)      - - Ignored: none      -

    -
    All files » vinyl/lib/
    -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FileStatementsBranchesFunctionsLines
    cloneBuffer.js100%(5 / 5)100%(0 / 0)100%(1 / 1)100%(5 / 5)
    inspectStream.js100%(8 / 8)100%(4 / 4)100%(1 / 1)100%(6 / 6)
    isBuffer.js100%(4 / 4)100%(2 / 2)100%(1 / 1)100%(4 / 4)
    isNull.js100%(2 / 2)100%(0 / 0)100%(1 / 1)100%(2 / 2)
    isStream.js100%(3 / 3)100%(2 / 2)100%(1 / 1)100%(3 / 3)
    -
    -
    - - - - - - - - diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/inspectStream.js.html b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/inspectStream.js.html deleted file mode 100644 index 4cc79c7d8b..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/inspectStream.js.html +++ /dev/null @@ -1,355 +0,0 @@ - - - - Code coverage report for vinyl/lib/inspectStream.js - - - - - - - -
    -

    Code coverage report for vinyl/lib/inspectStream.js

    -

    - - Statements: 100% (8 / 8)      - - - Branches: 100% (4 / 4)      - - - Functions: 100% (1 / 1)      - - - Lines: 100% (6 / 6)      - - Ignored: none      -

    -
    All files » vinyl/lib/ » inspectStream.js
    -
    -
    -
    
    -
    -
    1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -121 -  -1 -9 -  -7 -  -7 -  -7 -  - 
    var isStream = require('./isStream');
    - 
    -module.exports = function(stream) {
    -  if (!isStream(stream)) return;
    - 
    -  var streamType = stream.constructor.name;
    -  // avoid StreamStream
    -  if (streamType === 'Stream') streamType = '';
    - 
    -  return '<'+streamType+'Stream>';
    -};
    - 
    - -
    - - - - - - - - diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isBuffer.js.html b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isBuffer.js.html deleted file mode 100644 index b8d03cf3c7..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isBuffer.js.html +++ /dev/null @@ -1,340 +0,0 @@ - - - - Code coverage report for vinyl/lib/isBuffer.js - - - - - - - -
    -

    Code coverage report for vinyl/lib/isBuffer.js

    -

    - - Statements: 100% (4 / 4)      - - - Branches: 100% (2 / 2)      - - - Functions: 100% (1 / 1)      - - - Lines: 100% (4 / 4)      - - Ignored: none      -

    -
    All files » vinyl/lib/ » isBuffer.js
    -
    -
    -
    
    -
    -
    1 -2 -3 -4 -5 -6 -71 -1 -  -  -1 -108 - 
    var buf = require('buffer');
    -var Buffer = buf.Buffer;
    - 
    -// could use Buffer.isBuffer but this is the same exact thing...
    -module.exports = function(o) {
    -  return typeof o === 'object' && o instanceof Buffer;
    -};
    - -
    - - - - - - - - diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isNull.js.html b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isNull.js.html deleted file mode 100644 index 7db9769a84..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isNull.js.html +++ /dev/null @@ -1,331 +0,0 @@ - - - - Code coverage report for vinyl/lib/isNull.js - - - - - - - -
    -

    Code coverage report for vinyl/lib/isNull.js

    -

    - - Statements: 100% (2 / 2)      - - - Branches: 100% (0 / 0)      - - - Functions: 100% (1 / 1)      - - - Lines: 100% (2 / 2)      - - Ignored: none      -

    -
    All files » vinyl/lib/ » isNull.js
    -
    -
    -
    
    -
    -
    1 -2 -3 -41 -57 -  - 
    module.exports = function(v) {
    -  return v === null;
    -};
    - 
    - -
    - - - - - - - - diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isStream.js.html b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isStream.js.html deleted file mode 100644 index 6a28a3dec5..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov-report/vinyl/lib/isStream.js.html +++ /dev/null @@ -1,334 +0,0 @@ - - - - Code coverage report for vinyl/lib/isStream.js - - - - - - - -
    -

    Code coverage report for vinyl/lib/isStream.js

    -

    - - Statements: 100% (3 / 3)      - - - Branches: 100% (2 / 2)      - - - Functions: 100% (1 / 1)      - - - Lines: 100% (3 / 3)      - - Ignored: none      -

    -
    All files » vinyl/lib/ » isStream.js
    -
    -
    -
    
    -
    -
    1 -2 -3 -4 -51 -  -1 -99 - 
    var Stream = require('stream').Stream;
    - 
    -module.exports = function(o) {
    -  return !!o && o instanceof Stream;
    -};
    - -
    - - - - - - - - diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov.info b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov.info deleted file mode 100644 index a4ec23afaf..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/coverage/lcov.info +++ /dev/null @@ -1,280 +0,0 @@ -TN: -SF:/Users/contra/Projects/vinyl/index.js -FN:11,File -FN:30,(anonymous_2) -FN:34,(anonymous_3) -FN:38,(anonymous_4) -FN:43,(anonymous_5) -FN:47,(anonymous_6) -FN:81,(anonymous_7) -FN:93,(anonymous_8) -FN:114,(anonymous_9) -FN:138,(anonymous_10) -FN:141,(anonymous_11) -FN:151,(anonymous_12) -FN:156,(anonymous_13) -FN:162,(anonymous_14) -FN:165,(anonymous_15) -FNF:15 -FNH:15 -FNDA:73,File -FNDA:26,(anonymous_2) -FNDA:29,(anonymous_3) -FNDA:6,(anonymous_4) -FNDA:3,(anonymous_5) -FNDA:14,(anonymous_6) -FNDA:75,(anonymous_7) -FNDA:6,(anonymous_8) -FNDA:6,(anonymous_9) -FNDA:99,(anonymous_10) -FNDA:78,(anonymous_11) -FNDA:7,(anonymous_12) -FNDA:1,(anonymous_13) -FNDA:46,(anonymous_14) -FNDA:9,(anonymous_15) -DA:1,1 -DA:2,1 -DA:3,1 -DA:4,1 -DA:5,1 -DA:6,1 -DA:7,1 -DA:8,1 -DA:9,1 -DA:11,1 -DA:12,73 -DA:15,73 -DA:16,73 -DA:19,73 -DA:20,73 -DA:24,73 -DA:27,73 -DA:30,1 -DA:31,26 -DA:34,1 -DA:35,29 -DA:38,1 -DA:39,6 -DA:43,1 -DA:44,3 -DA:47,1 -DA:48,14 -DA:49,2 -DA:53,12 -DA:54,7 -DA:59,5 -DA:60,5 -DA:64,14 -DA:65,14 -DA:66,1 -DA:67,1 -DA:68,13 -DA:69,6 -DA:72,14 -DA:81,14 -DA:83,75 -DA:86,70 -DA:88,5 -DA:90,14 -DA:93,1 -DA:94,6 -DA:95,6 -DA:97,6 -DA:98,2 -DA:100,4 -DA:101,2 -DA:102,1 -DA:104,1 -DA:106,2 -DA:110,2 -DA:111,2 -DA:114,1 -DA:115,6 -DA:118,6 -DA:120,6 -DA:121,4 -DA:124,6 -DA:125,3 -DA:128,6 -DA:129,1 -DA:132,6 -DA:137,1 -DA:139,99 -DA:142,78 -DA:143,1 -DA:145,77 -DA:150,1 -DA:152,7 -DA:153,6 -DA:154,5 -DA:157,1 -DA:161,1 -DA:163,46 -DA:166,9 -DA:169,8 -DA:170,5 -DA:175,1 -LF:82 -LH:82 -BRDA:12,1,0,14 -BRDA:12,1,1,59 -BRDA:15,2,0,25 -BRDA:15,2,1,48 -BRDA:16,3,0,73 -BRDA:16,3,1,33 -BRDA:19,4,0,73 -BRDA:19,4,1,32 -BRDA:20,5,0,73 -BRDA:20,5,1,39 -BRDA:24,6,0,73 -BRDA:24,6,1,65 -BRDA:27,7,0,73 -BRDA:27,7,1,44 -BRDA:44,8,0,3 -BRDA:44,8,1,1 -BRDA:44,8,2,1 -BRDA:48,9,0,2 -BRDA:48,9,1,12 -BRDA:53,10,0,7 -BRDA:53,10,1,5 -BRDA:65,11,0,1 -BRDA:65,11,1,13 -BRDA:68,12,0,6 -BRDA:68,12,1,7 -BRDA:69,13,0,5 -BRDA:69,13,1,1 -BRDA:75,14,0,2 -BRDA:75,14,1,12 -BRDA:83,15,0,70 -BRDA:83,15,1,5 -BRDA:83,16,0,75 -BRDA:83,16,1,61 -BRDA:83,16,2,47 -BRDA:83,16,3,33 -BRDA:83,16,4,33 -BRDA:83,16,5,19 -BRDA:88,17,0,2 -BRDA:88,17,1,3 -BRDA:94,18,0,3 -BRDA:94,18,1,3 -BRDA:95,19,0,3 -BRDA:95,19,1,3 -BRDA:97,20,0,2 -BRDA:97,20,1,4 -BRDA:100,21,0,2 -BRDA:100,21,1,2 -BRDA:101,22,0,1 -BRDA:101,22,1,1 -BRDA:110,23,0,1 -BRDA:110,23,1,1 -BRDA:118,24,0,3 -BRDA:118,24,1,3 -BRDA:118,25,0,6 -BRDA:118,25,1,5 -BRDA:120,26,0,4 -BRDA:120,26,1,2 -BRDA:124,27,0,3 -BRDA:124,27,1,3 -BRDA:128,28,0,1 -BRDA:128,28,1,5 -BRDA:142,29,0,1 -BRDA:142,29,1,77 -BRDA:142,30,0,78 -BRDA:142,30,1,57 -BRDA:142,30,2,46 -BRDA:152,31,0,1 -BRDA:152,31,1,6 -BRDA:153,32,0,1 -BRDA:153,32,1,5 -BRDA:166,33,0,1 -BRDA:166,33,1,8 -BRDA:169,34,0,5 -BRDA:169,34,1,3 -BRDA:169,35,0,8 -BRDA:169,35,1,7 -BRF:76 -BRH:76 -end_of_record -TN: -SF:/Users/contra/Projects/vinyl/lib/cloneBuffer.js -FN:3,(anonymous_1) -FNF:1 -FNH:1 -FNDA:7,(anonymous_1) -DA:1,1 -DA:3,1 -DA:4,7 -DA:5,7 -DA:6,7 -LF:5 -LH:5 -BRF:0 -BRH:0 -end_of_record -TN: -SF:/Users/contra/Projects/vinyl/lib/isBuffer.js -FN:5,(anonymous_1) -FNF:1 -FNH:1 -FNDA:108,(anonymous_1) -DA:1,1 -DA:2,1 -DA:5,1 -DA:6,108 -LF:4 -LH:4 -BRDA:6,1,0,108 -BRDA:6,1,1,107 -BRF:2 -BRH:2 -end_of_record -TN: -SF:/Users/contra/Projects/vinyl/lib/isStream.js -FN:3,(anonymous_1) -FNF:1 -FNH:1 -FNDA:99,(anonymous_1) -DA:1,1 -DA:3,1 -DA:4,99 -LF:3 -LH:3 -BRDA:4,1,0,99 -BRDA:4,1,1,40 -BRF:2 -BRH:2 -end_of_record -TN: -SF:/Users/contra/Projects/vinyl/lib/isNull.js -FN:1,(anonymous_1) -FNF:1 -FNH:1 -FNDA:57,(anonymous_1) -DA:1,1 -DA:2,57 -LF:2 -LH:2 -BRF:0 -BRH:0 -end_of_record -TN: -SF:/Users/contra/Projects/vinyl/lib/inspectStream.js -FN:3,(anonymous_1) -FNF:1 -FNH:1 -FNDA:9,(anonymous_1) -DA:1,1 -DA:3,1 -DA:4,9 -DA:6,7 -DA:8,7 -DA:10,7 -LF:6 -LH:6 -BRDA:4,1,0,2 -BRDA:4,1,1,7 -BRDA:8,2,0,1 -BRDA:8,2,1,6 -BRF:4 -BRH:4 -end_of_record diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/index.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/index.js index 09913c3a96..9aa47b78f1 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/index.js +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/index.js @@ -1,5 +1,5 @@ var path = require('path'); -var clone = require('lodash').clone; +var clone = require('clone'); var cloneStats = require('clone-stats'); var cloneBuffer = require('./lib/cloneBuffer'); var isBuffer = require('./lib/isBuffer'); diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/LICENSE.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/LICENSE.md index a23ecfb40b..146cb32a7d 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/LICENSE.md +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/LICENSE.md @@ -1,21 +1,21 @@ -## The MIT License (MIT) ## - -Copyright (c) 2014 Hugh Kennedy - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. +## The MIT License (MIT) ## + +Copyright (c) 2014 Hugh Kennedy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/README.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/README.md index 35dfb2ad2e..8b12b6fa5e 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/README.md +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/README.md @@ -1,17 +1,17 @@ -# clone-stats [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/clone-stats&title=clone-stats&description=hughsk/clone-stats%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) # - -Safely clone node's -[`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) instances without -losing their class methods, i.e. `stat.isDirectory()` and co. - -## Usage ## - -[![clone-stats](https://nodei.co/npm/clone-stats.png?mini=true)](https://nodei.co/npm/clone-stats) - -### `copy = require('clone-stats')(stat)` ### - -Returns a clone of the original `fs.Stats` instance (`stat`). - -## License ## - -MIT. See [LICENSE.md](http://github.com/hughsk/clone-stats/blob/master/LICENSE.md) for details. +# clone-stats [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/clone-stats&title=clone-stats&description=hughsk/clone-stats%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) # + +Safely clone node's +[`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) instances without +losing their class methods, i.e. `stat.isDirectory()` and co. + +## Usage ## + +[![clone-stats](https://nodei.co/npm/clone-stats.png?mini=true)](https://nodei.co/npm/clone-stats) + +### `copy = require('clone-stats')(stat)` ### + +Returns a clone of the original `fs.Stats` instance (`stat`). + +## License ## + +MIT. See [LICENSE.md](http://github.com/hughsk/clone-stats/blob/master/LICENSE.md) for details. diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/package.json index f184809f4f..76699ca0f0 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/package.json +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone-stats/package.json @@ -1,57 +1,57 @@ -{ - "name": "clone-stats", - "description": "Safely clone node's fs.Stats instances without losing their class methods", - "version": "0.0.1", - "main": "index.js", - "browser": "index.js", - "dependencies": {}, - "devDependencies": { - "tape": "~2.3.2" - }, - "scripts": { - "test": "node test" - }, - "author": { - "name": "Hugh Kennedy", - "email": "hughskennedy@gmail.com", - "url": "http://hughsk.io/" - }, - "license": "MIT", - "repository": { - "type": "git", - "url": "git://github.com/hughsk/clone-stats" - }, - "bugs": { - "url": "https://github.com/hughsk/clone-stats/issues" - }, - "homepage": "https://github.com/hughsk/clone-stats", - "keywords": [ - "stats", - "fs", - "clone", - "copy", - "prototype" - ], - "readme": "# clone-stats [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/clone-stats&title=clone-stats&description=hughsk/clone-stats%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) #\n\nSafely clone node's\n[`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) instances without\nlosing their class methods, i.e. `stat.isDirectory()` and co.\n\n## Usage ##\n\n[![clone-stats](https://nodei.co/npm/clone-stats.png?mini=true)](https://nodei.co/npm/clone-stats)\n\n### `copy = require('clone-stats')(stat)` ###\n\nReturns a clone of the original `fs.Stats` instance (`stat`).\n\n## License ##\n\nMIT. See [LICENSE.md](http://github.com/hughsk/clone-stats/blob/master/LICENSE.md) for details.\n", - "readmeFilename": "README.md", - "_id": "clone-stats@0.0.1", - "dist": { - "shasum": "b88f94a82cf38b8791d58046ea4029ad88ca99d1", - "tarball": "http://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz" - }, - "_from": "clone-stats@>=0.0.1 <0.0.2", - "_npmVersion": "1.3.22", - "_npmUser": { - "name": "hughsk", - "email": "hughskennedy@gmail.com" - }, - "maintainers": [ - { - "name": "hughsk", - "email": "hughskennedy@gmail.com" - } - ], - "directories": {}, - "_shasum": "b88f94a82cf38b8791d58046ea4029ad88ca99d1", - "_resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz" -} +{ + "name": "clone-stats", + "description": "Safely clone node's fs.Stats instances without losing their class methods", + "version": "0.0.1", + "main": "index.js", + "browser": "index.js", + "dependencies": {}, + "devDependencies": { + "tape": "~2.3.2" + }, + "scripts": { + "test": "node test" + }, + "author": { + "name": "Hugh Kennedy", + "email": "hughskennedy@gmail.com", + "url": "http://hughsk.io/" + }, + "license": "MIT", + "repository": { + "type": "git", + "url": "git://github.com/hughsk/clone-stats" + }, + "bugs": { + "url": "https://github.com/hughsk/clone-stats/issues" + }, + "homepage": "https://github.com/hughsk/clone-stats", + "keywords": [ + "stats", + "fs", + "clone", + "copy", + "prototype" + ], + "readme": "# clone-stats [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/clone-stats&title=clone-stats&description=hughsk/clone-stats%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) #\n\nSafely clone node's\n[`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) instances without\nlosing their class methods, i.e. `stat.isDirectory()` and co.\n\n## Usage ##\n\n[![clone-stats](https://nodei.co/npm/clone-stats.png?mini=true)](https://nodei.co/npm/clone-stats)\n\n### `copy = require('clone-stats')(stat)` ###\n\nReturns a clone of the original `fs.Stats` instance (`stat`).\n\n## License ##\n\nMIT. See [LICENSE.md](http://github.com/hughsk/clone-stats/blob/master/LICENSE.md) for details.\n", + "readmeFilename": "README.md", + "_id": "clone-stats@0.0.1", + "dist": { + "shasum": "b88f94a82cf38b8791d58046ea4029ad88ca99d1", + "tarball": "http://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz" + }, + "_from": "clone-stats@>=0.0.1 <0.0.2", + "_npmVersion": "1.3.22", + "_npmUser": { + "name": "hughsk", + "email": "hughskennedy@gmail.com" + }, + "maintainers": [ + { + "name": "hughsk", + "email": "hughskennedy@gmail.com" + } + ], + "directories": {}, + "_shasum": "b88f94a82cf38b8791d58046ea4029ad88ca99d1", + "_resolved": "https://registry.npmjs.org/clone-stats/-/clone-stats-0.0.1.tgz" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/.npmignore b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/.npmignore new file mode 100644 index 0000000000..c2658d7d1b --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/.npmignore @@ -0,0 +1 @@ +node_modules/ diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/.travis.yml b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/.travis.yml new file mode 100644 index 0000000000..58f23716ae --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/.travis.yml @@ -0,0 +1,5 @@ +language: node_js +node_js: + - 0.6 + - 0.8 + - 0.10 diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/LICENSE b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/LICENSE new file mode 100644 index 0000000000..fc808cce89 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/LICENSE @@ -0,0 +1,18 @@ +Copyright © 2011-2014 Paul Vorbach + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/README.md b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/README.md new file mode 100644 index 0000000000..d7231cfca7 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/README.md @@ -0,0 +1,126 @@ +# clone + +[![build status](https://secure.travis-ci.org/pvorb/node-clone.png)](http://travis-ci.org/pvorb/node-clone) + +offers foolproof _deep cloning_ of variables in JavaScript. + + +## Installation + + npm install clone + +or + + ender build clone + + +## Example + +~~~ javascript +var clone = require('clone'); + +var a, b; + +a = { foo: { bar: 'baz' } }; // initial value of a + +b = clone(a); // clone a -> b +a.foo.bar = 'foo'; // change a + +console.log(a); // show a +console.log(b); // show b +~~~ + +This will print: + +~~~ javascript +{ foo: { bar: 'foo' } } +{ foo: { bar: 'baz' } } +~~~ + +**clone** masters cloning simple objects (even with custom prototype), arrays, +Date objects, and RegExp objects. Everything is cloned recursively, so that you +can clone dates in arrays in objects, for example. + + +## API + +`clone(val, circular, depth)` + + * `val` -- the value that you want to clone, any type allowed + * `circular` -- boolean + + Call `clone` with `circular` set to `false` if you are certain that `obj` + contains no circular references. This will give better performance if needed. + There is no error if `undefined` or `null` is passed as `obj`. + * `depth` -- depth to which the object is to be cloned (optional, + defaults to infinity) + +`clone.clonePrototype(obj)` + + * `obj` -- the object that you want to clone + +Does a prototype clone as +[described by Oran Looney](http://oranlooney.com/functional-javascript/). + + +## Circular References + +~~~ javascript +var a, b; + +a = { hello: 'world' }; + +a.myself = a; +b = clone(a); + +console.log(b); +~~~ + +This will print: + +~~~ javascript +{ hello: "world", myself: [Circular] } +~~~ + +So, `b.myself` points to `b`, not `a`. Neat! + + +## Test + + npm test + + +## Caveat + +Some special objects like a socket or `process.stdout`/`stderr` are known to not +be cloneable. If you find other objects that cannot be cloned, please [open an +issue](https://github.com/pvorb/node-clone/issues/new). + + +## Bugs and Issues + +If you encounter any bugs or issues, feel free to [open an issue at +github](https://github.com/pvorb/node-clone/issues) or send me an email to +. I also always like to hear from you, if you’re using my code. + +## License + +Copyright © 2011-2014 [Paul Vorbach](http://paul.vorba.ch/) and +[contributors](https://github.com/pvorb/node-clone/graphs/contributors). + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/clone.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/clone.js new file mode 100644 index 0000000000..f8fa3159a7 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/clone.js @@ -0,0 +1,144 @@ +'use strict'; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} + +// shim for Node's 'util' package +// DO NOT REMOVE THIS! It is required for compatibility with EnderJS (http://enderjs.com/). +var util = { + isArray: function (ar) { + return Array.isArray(ar) || (typeof ar === 'object' && objectToString(ar) === '[object Array]'); + }, + isDate: function (d) { + return typeof d === 'object' && objectToString(d) === '[object Date]'; + }, + isRegExp: function (re) { + return typeof re === 'object' && objectToString(re) === '[object RegExp]'; + }, + getRegExpFlags: function (re) { + var flags = ''; + re.global && (flags += 'g'); + re.ignoreCase && (flags += 'i'); + re.multiline && (flags += 'm'); + return flags; + } +}; + + +if (typeof module === 'object') + module.exports = clone; + +/** + * Clones (copies) an Object using deep copying. + * + * This function supports circular references by default, but if you are certain + * there are no circular references in your object, you can save some CPU time + * by calling clone(obj, false). + * + * Caution: if `circular` is false and `parent` contains circular references, + * your program may enter an infinite loop and crash. + * + * @param `parent` - the object to be cloned + * @param `circular` - set to true if the object to be cloned may contain + * circular references. (optional - true by default) + * @param `depth` - set to a number if the object is only to be cloned to + * a particular depth. (optional - defaults to Infinity) + * @param `prototype` - sets the prototype to be used when cloning an object. + * (optional - defaults to parent prototype). +*/ + +function clone(parent, circular, depth, prototype) { + // maintain two arrays for circular references, where corresponding parents + // and children have the same index + var allParents = []; + var allChildren = []; + + var useBuffer = typeof Buffer != 'undefined'; + + if (typeof circular == 'undefined') + circular = true; + + if (typeof depth == 'undefined') + depth = Infinity; + + // recurse this function so we don't reset allParents and allChildren + function _clone(parent, depth) { + // cloning null always returns null + if (parent === null) + return null; + + if (depth == 0) + return parent; + + var child; + var proto; + if (typeof parent != 'object') { + return parent; + } + + if (util.isArray(parent)) { + child = []; + } else if (util.isRegExp(parent)) { + child = new RegExp(parent.source, util.getRegExpFlags(parent)); + if (parent.lastIndex) child.lastIndex = parent.lastIndex; + } else if (util.isDate(parent)) { + child = new Date(parent.getTime()); + } else if (useBuffer && Buffer.isBuffer(parent)) { + child = new Buffer(parent.length); + parent.copy(child); + return child; + } else { + if (typeof prototype == 'undefined') { + proto = Object.getPrototypeOf(parent); + child = Object.create(proto); + } + else { + child = Object.create(prototype); + proto = prototype; + } + } + + if (circular) { + var index = allParents.indexOf(parent); + + if (index != -1) { + return allChildren[index]; + } + allParents.push(parent); + allChildren.push(child); + } + + for (var i in parent) { + var attrs; + if (proto) { + attrs = Object.getOwnPropertyDescriptor(proto, i); + } + + if (attrs && attrs.set == null) { + continue; + } + child[i] = _clone(parent[i], depth - 1); + } + + return child; + } + + return _clone(parent, depth); +} + +/** + * Simple flat clone using prototype, accepts only objects, usefull for property + * override on FLAT configuration object (no nested props). + * + * USE WITH CAUTION! This may not behave as you wish if you do not know how this + * works. + */ +clone.clonePrototype = function(parent) { + if (parent === null) + return null; + + var c = function () {}; + c.prototype = parent; + return new c(); +}; diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/package.json new file mode 100644 index 0000000000..94633177fe --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/package.json @@ -0,0 +1,127 @@ +{ + "name": "clone", + "description": "deep cloning of objects and arrays", + "tags": [ + "clone", + "object", + "array", + "function", + "date" + ], + "version": "0.2.0", + "repository": { + "type": "git", + "url": "git://github.com/pvorb/node-clone.git" + }, + "bugs": { + "url": "https://github.com/pvorb/node-clone/issues" + }, + "main": "clone.js", + "author": { + "name": "Paul Vorbach", + "email": "paul@vorba.ch", + "url": "http://paul.vorba.ch/" + }, + "contributors": [ + { + "name": "Blake Miner", + "email": "miner.blake@gmail.com", + "url": "http://www.blakeminer.com/" + }, + { + "name": "Tian You", + "email": "axqd001@gmail.com", + "url": "http://blog.axqd.net/" + }, + { + "name": "George Stagas", + "email": "gstagas@gmail.com", + "url": "http://stagas.com/" + }, + { + "name": "Tobiasz Cudnik", + "email": "tobiasz.cudnik@gmail.com", + "url": "https://github.com/TobiaszCudnik" + }, + { + "name": "Pavel Lang", + "email": "langpavel@phpskelet.org", + "url": "https://github.com/langpavel" + }, + { + "name": "Dan MacTough", + "url": "http://yabfog.com/" + }, + { + "name": "w1nk", + "url": "https://github.com/w1nk" + }, + { + "name": "Hugh Kennedy", + "url": "http://twitter.com/hughskennedy" + }, + { + "name": "Dustin Diaz", + "url": "http://dustindiaz.com" + }, + { + "name": "Ilya Shaisultanov", + "url": "https://github.com/diversario" + }, + { + "name": "Nathan MacInnes", + "email": "nathan@macinn.es", + "url": "http://macinn.es/" + }, + { + "name": "Benjamin E. Coe", + "email": "ben@npmjs.com", + "url": "https://twitter.com/benjamincoe" + }, + { + "name": "Nathan Zadoks", + "url": "https://github.com/nathan7" + }, + { + "name": "Róbert Oroszi", + "email": "robert+gh@oroszi.net", + "url": "https://github.com/oroce" + } + ], + "license": "MIT", + "engines": { + "node": "*" + }, + "dependencies": {}, + "devDependencies": { + "underscore": "*", + "nodeunit": "*" + }, + "optionalDependencies": {}, + "scripts": { + "test": "nodeunit test.js" + }, + "gitHead": "bb11a43363a0f69e8ac014cb5376ce215ea1f8fd", + "homepage": "https://github.com/pvorb/node-clone", + "_id": "clone@0.2.0", + "_shasum": "c6126a90ad4f72dbf5acdb243cc37724fe93fc1f", + "_from": "clone@>=0.2.0 <0.3.0", + "_npmVersion": "1.4.14", + "_npmUser": { + "name": "pvorb", + "email": "paul@vorba.ch" + }, + "maintainers": [ + { + "name": "pvorb", + "email": "paul@vorb.de" + } + ], + "dist": { + "shasum": "c6126a90ad4f72dbf5acdb243cc37724fe93fc1f", + "tarball": "http://registry.npmjs.org/clone/-/clone-0.2.0.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/clone/-/clone-0.2.0.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/test.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/test.js new file mode 100644 index 0000000000..cb3d16631a --- /dev/null +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/node_modules/clone/test.js @@ -0,0 +1,289 @@ +if(module.parent === null) { + console.log('Run this test file with nodeunit:'); + console.log('$ nodeunit test.js'); +} + + +var clone = require('./'); +var util = require('util'); +var _ = require('underscore'); + + + +exports["clone string"] = function(test) { + test.expect(2); // how many tests? + + var a = "foo"; + test.strictEqual(clone(a), a); + a = ""; + test.strictEqual(clone(a), a); + + test.done(); +}; + + + +exports["clone number"] = function(test) { + test.expect(5); // how many tests? + + var a = 0; + test.strictEqual(clone(a), a); + a = 1; + test.strictEqual(clone(a), a); + a = -1000; + test.strictEqual(clone(a), a); + a = 3.1415927; + test.strictEqual(clone(a), a); + a = -3.1415927; + test.strictEqual(clone(a), a); + + test.done(); +}; + + + +exports["clone date"] = function(test) { + test.expect(3); // how many tests? + + var a = new Date; + var c = clone(a); + test.ok(a instanceof Date); + test.ok(c instanceof Date); + test.equal(c.getTime(), a.getTime()); + + test.done(); +}; + + + +exports["clone object"] = function(test) { + test.expect(2); // how many tests? + + var a = { foo: { bar: "baz" } }; + var b = clone(a); + + test.ok(_(a).isEqual(b), "underscore equal"); + test.deepEqual(b, a); + + test.done(); +}; + + + +exports["clone array"] = function(test) { + test.expect(2); // how many tests? + + var a = [ + { foo: "bar" }, + "baz" + ]; + var b = clone(a); + + test.ok(_(a).isEqual(b), "underscore equal"); + test.deepEqual(b, a); + + test.done(); +}; + +exports["clone buffer"] = function(test) { + test.expect(1); + + var a = new Buffer("this is a test buffer"); + var b = clone(a); + + // no underscore equal since it has no concept of Buffers + test.deepEqual(b, a); + test.done(); +}; + + + +exports["clone regexp"] = function(test) { + test.expect(5); + + var a = /abc123/gi; + var b = clone(a); + + test.deepEqual(b, a); + + var c = /a/g; + test.ok(c.lastIndex === 0); + + c.exec('123a456a'); + test.ok(c.lastIndex === 4); + + var d = clone(c); + test.ok(d.global); + test.ok(d.lastIndex === 4); + + test.done(); +}; + + +exports["clone object containing array"] = function(test) { + test.expect(2); // how many tests? + + var a = { + arr1: [ { a: '1234', b: '2345' } ], + arr2: [ { c: '345', d: '456' } ] + }; + var b = clone(a); + + test.ok(_(a).isEqual(b), "underscore equal"); + test.deepEqual(b, a); + + test.done(); +}; + + + +exports["clone object with circular reference"] = function(test) { + test.expect(8); // how many tests? + + var _ = test.ok; + var c = [1, "foo", {'hello': 'bar'}, function() {}, false, [2]]; + var b = [c, 2, 3, 4]; + var a = {'b': b, 'c': c}; + a.loop = a; + a.loop2 = a; + c.loop = c; + c.aloop = a; + var aCopy = clone(a); + _(a != aCopy); + _(a.c != aCopy.c); + _(aCopy.c == aCopy.b[0]); + _(aCopy.c.loop.loop.aloop == aCopy); + _(aCopy.c[0] == a.c[0]); + + //console.log(util.inspect(aCopy, true, null) ); + //console.log("------------------------------------------------------------"); + //console.log(util.inspect(a, true, null) ); + _(eq(a, aCopy)); + aCopy.c[0] = 2; + _(!eq(a, aCopy)); + aCopy.c = "2"; + _(!eq(a, aCopy)); + //console.log("------------------------------------------------------------"); + //console.log(util.inspect(aCopy, true, null) ); + + function eq(x, y) { + return util.inspect(x, true, null) === util.inspect(y, true, null); + } + + test.done(); +}; + + + +exports['clonePrototype'] = function(test) { + test.expect(3); // how many tests? + + var a = { + a: "aaa", + x: 123, + y: 45.65 + }; + var b = clone.clonePrototype(a); + + test.strictEqual(b.a, a.a); + test.strictEqual(b.x, a.x); + test.strictEqual(b.y, a.y); + + test.done(); +} + +exports['cloneWithinNewVMContext'] = function(test) { + test.expect(3); + var vm = require('vm'); + var ctx = vm.createContext({ clone: clone }); + var script = "clone( {array: [1, 2, 3], date: new Date(), regex: /^foo$/ig} );"; + var results = vm.runInContext(script, ctx); + test.ok(results.array instanceof Array); + test.ok(results.date instanceof Date); + test.ok(results.regex instanceof RegExp); + test.done(); +} + +exports['cloneObjectWithNoConstructor'] = function(test) { + test.expect(3); + var n = null; + var a = { foo: 'bar' }; + a.__proto__ = n; + test.ok(typeof a === 'object'); + test.ok(typeof a !== null); + var b = clone(a); + test.ok(a.foo, b.foo); + test.done(); +} + +exports['clone object with depth argument'] = function (test) { + test.expect(6); + var a = { + foo: { + bar : { + baz : 'qux' + } + } + }; + var b = clone(a, false, 1); + test.deepEqual(b, a); + test.notEqual(b, a); + test.strictEqual(b.foo, a.foo); + + b = clone(a, true, 2); + test.deepEqual(b, a); + test.notEqual(b.foo, a.foo); + test.strictEqual(b.foo.bar, a.foo.bar); + test.done(); +} + +exports['maintain prototype chain in clones'] = function (test) { + test.expect(1); + function Constructor() {} + var a = new Constructor(); + var b = clone(a); + test.strictEqual(Object.getPrototypeOf(a), Object.getPrototypeOf(b)); + test.done(); +} + +exports['parent prototype is overriden with prototype provided'] = function (test) { + test.expect(1); + function Constructor() {} + var a = new Constructor(); + var b = clone(a, true, Infinity, null); + test.strictEqual(b.__defineSetter__, undefined); + test.done(); +} + +exports['clone object with null children'] = function(test) { + test.expect(1); + var a = { + foo: { + bar: null, + baz: { + qux: false + } + } + }; + var b = clone(a); + test.deepEqual(b, a); + test.done(); +} + +exports['clone instance with getter'] = function(test) { + test.expect(1); + function Ctor() {}; + Object.defineProperty(Ctor.prototype, 'prop', { + configurable: true, + enumerable: true, + get: function() { + return 'value'; + } + }); + + var a = new Ctor(); + var b = clone(a); + + test.strictEqual(b.prop, 'value'); + test.done(); +}; \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/package.json b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/package.json index f6c1f0018f..c94ac8ef65 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/package.json +++ b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/package.json @@ -1,70 +1,75 @@ -{ - "name": "vinyl", - "description": "A virtual file format", - "version": "0.4.3", - "homepage": "http://github.com/wearefractal/vinyl", - "repository": { - "type": "git", - "url": "git://github.com/wearefractal/vinyl.git" - }, - "author": { - "name": "Fractal", - "email": "contact@wearefractal.com", - "url": "http://wearefractal.com/" - }, - "main": "./index.js", - "dependencies": { - "clone-stats": "^0.0.1", - "lodash": "^2.4.1" - }, - "devDependencies": { - "mocha": "^1.17.0", - "should": "^4.0.4", - "mocha-lcov-reporter": "^0.0.1", - "coveralls": "^2.6.1", - "istanbul": "^0.3.0", - "rimraf": "^2.2.5", - "jshint": "^2.4.1", - "buffer-equal": "0.0.1", - "lodash.templatesettings": "^2.4.1", - "event-stream": "^3.1.0" - }, - "scripts": { - "test": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter spec && jshint .", - "coveralls": "istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage" - }, - "engines": { - "node": ">= 0.9" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/wearefractal/vinyl/raw/master/LICENSE" - } - ], - "gitHead": "6eae432519b007c313a8df83b093adfb97a2944c", - "bugs": { - "url": "https://github.com/wearefractal/vinyl/issues" - }, - "_id": "vinyl@0.4.3", - "_shasum": "19f61a1b28e72b4c50697889dbe91d7503943ecf", - "_from": "vinyl@>=0.4.0 <0.5.0", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "fractal", - "email": "contact@wearefractal.com" - }, - "maintainers": [ - { - "name": "fractal", - "email": "contact@wearefractal.com" - } - ], - "dist": { - "shasum": "19f61a1b28e72b4c50697889dbe91d7503943ecf", - "tarball": "http://registry.npmjs.org/vinyl/-/vinyl-0.4.3.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.3.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "vinyl", + "description": "A virtual file format", + "version": "0.4.6", + "homepage": "http://github.com/wearefractal/vinyl", + "repository": { + "type": "git", + "url": "git://github.com/wearefractal/vinyl.git" + }, + "author": { + "name": "Fractal", + "email": "contact@wearefractal.com", + "url": "http://wearefractal.com/" + }, + "main": "./index.js", + "files": [ + "index.js", + "lib" + ], + "dependencies": { + "clone": "^0.2.0", + "clone-stats": "^0.0.1" + }, + "devDependencies": { + "mocha": "^2.0.0", + "should": "^4.0.4", + "mocha-lcov-reporter": "^0.0.1", + "coveralls": "^2.6.1", + "istanbul": "^0.3.0", + "rimraf": "^2.2.5", + "jshint": "^2.4.1", + "buffer-equal": "0.0.1", + "lodash.templatesettings": "^2.4.1", + "event-stream": "^3.1.0" + }, + "scripts": { + "test": "mocha --reporter spec && jshint lib", + "coveralls": "istanbul cover _mocha -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage" + }, + "engines": { + "node": ">= 0.9" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/wearefractal/vinyl/raw/master/LICENSE" + } + ], + "gitHead": "8255a5f1de7fecb1cd5e7ba7ac1ec997395f6be1", + "bugs": { + "url": "https://github.com/wearefractal/vinyl/issues" + }, + "_id": "vinyl@0.4.6", + "_shasum": "2f356c87a550a255461f36bbeb2a5ba8bf784847", + "_from": "vinyl@>=0.4.3 <0.5.0", + "_npmVersion": "2.1.6", + "_nodeVersion": "0.10.33", + "_npmUser": { + "name": "fractal", + "email": "contact@wearefractal.com" + }, + "maintainers": [ + { + "name": "fractal", + "email": "contact@wearefractal.com" + } + ], + "dist": { + "shasum": "2f356c87a550a255461f36bbeb2a5ba8bf784847", + "tarball": "http://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.4.6.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/perf/clone.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/perf/clone.js deleted file mode 100644 index 4df8578722..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/perf/clone.js +++ /dev/null @@ -1,59 +0,0 @@ -var File = require('../'); - -var contents = new Buffer('blah blah blah'); - -var originalFile = new File({ - path: 'yo.coffee', - contents: contents -}); - -// simulate some history -originalFile.path = 'yo.js'; -originalFile.path = 'yo.js'; -originalFile.path = 'yo.js'; -originalFile.path = 'yo.js'; -originalFile.path = 'yo.js'; - -originalFile.ast = { - a: { - b: { - c: { -a: { - b: { - c: { -a: { - b: { - c: { -a: { - b: { - c: { -a: { - b: { - c: { -a: { - b: { - c: { - - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -}; - -for (var i = 0; i < 10000; i++) { - originalFile.clone(true).ast; -} \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/File.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/File.js deleted file mode 100644 index 419e7aac34..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/File.js +++ /dev/null @@ -1,753 +0,0 @@ -var Stream = require('stream'); -var fs = require('fs'); -var path = require('path'); -var es = require('event-stream'); -var File = require('../'); - -var should = require('should'); -require('mocha'); - -describe('File', function() { - describe('constructor()', function() { - it('should default cwd to process.cwd', function(done) { - var file = new File(); - file.cwd.should.equal(process.cwd()); - done(); - }); - - it('should default base to cwd', function(done) { - var cwd = '/'; - var file = new File({cwd: cwd}); - file.base.should.equal(cwd); - done(); - }); - - it('should default base to cwd even when none is given', function(done) { - var file = new File(); - file.base.should.equal(process.cwd()); - done(); - }); - - it('should default path to null', function(done) { - var file = new File(); - should.not.exist(file.path); - done(); - }); - - it('should default history to []', function(done) { - var file = new File(); - file.history.should.eql([]); - done(); - }); - - it('should default stat to null', function(done) { - var file = new File(); - should.not.exist(file.stat); - done(); - }); - - it('should default contents to null', function(done) { - var file = new File(); - should.not.exist(file.contents); - done(); - }); - - it('should set base to given value', function(done) { - var val = '/'; - var file = new File({base: val}); - file.base.should.equal(val); - done(); - }); - - it('should set cwd to given value', function(done) { - var val = '/'; - var file = new File({cwd: val}); - file.cwd.should.equal(val); - done(); - }); - - it('should set path to given value', function(done) { - var val = '/test.coffee'; - var file = new File({path: val}); - file.path.should.equal(val); - file.history.should.eql([val]); - done(); - }); - - it('should set history to given value', function(done) { - var val = '/test.coffee'; - var file = new File({history: [val]}); - file.path.should.equal(val); - file.history.should.eql([val]); - done(); - }); - - it('should set stat to given value', function(done) { - var val = {}; - var file = new File({stat: val}); - file.stat.should.equal(val); - done(); - }); - - it('should set contents to given value', function(done) { - var val = new Buffer('test'); - var file = new File({contents: val}); - file.contents.should.equal(val); - done(); - }); - }); - - describe('isBuffer()', function() { - it('should return true when the contents are a Buffer', function(done) { - var val = new Buffer('test'); - var file = new File({contents: val}); - file.isBuffer().should.equal(true); - done(); - }); - - it('should return false when the contents are a Stream', function(done) { - var val = new Stream(); - var file = new File({contents: val}); - file.isBuffer().should.equal(false); - done(); - }); - - it('should return false when the contents are a null', function(done) { - var file = new File({contents: null}); - file.isBuffer().should.equal(false); - done(); - }); - }); - - describe('isStream()', function() { - it('should return false when the contents are a Buffer', function(done) { - var val = new Buffer('test'); - var file = new File({contents: val}); - file.isStream().should.equal(false); - done(); - }); - - it('should return true when the contents are a Stream', function(done) { - var val = new Stream(); - var file = new File({contents: val}); - file.isStream().should.equal(true); - done(); - }); - - it('should return false when the contents are a null', function(done) { - var file = new File({contents: null}); - file.isStream().should.equal(false); - done(); - }); - }); - - describe('isNull()', function() { - it('should return false when the contents are a Buffer', function(done) { - var val = new Buffer('test'); - var file = new File({contents: val}); - file.isNull().should.equal(false); - done(); - }); - - it('should return false when the contents are a Stream', function(done) { - var val = new Stream(); - var file = new File({contents: val}); - file.isNull().should.equal(false); - done(); - }); - - it('should return true when the contents are a null', function(done) { - var file = new File({contents: null}); - file.isNull().should.equal(true); - done(); - }); - }); - - describe('isDirectory()', function() { - var fakeStat = { - isDirectory: function() { - return true; - } - }; - - it('should return false when the contents are a Buffer', function(done) { - var val = new Buffer('test'); - var file = new File({contents: val, stat: fakeStat}); - file.isDirectory().should.equal(false); - done(); - }); - - it('should return false when the contents are a Stream', function(done) { - var val = new Stream(); - var file = new File({contents: val, stat: fakeStat}); - file.isDirectory().should.equal(false); - done(); - }); - - it('should return true when the contents are a null', function(done) { - var file = new File({contents: null, stat: fakeStat}); - file.isDirectory().should.equal(true); - done(); - }); - }); - - describe('clone()', function() { - it('should copy all attributes over with Buffer', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: new Buffer('test') - }; - var file = new File(options); - var file2 = file.clone(); - - file2.should.not.equal(file, 'refs should be different'); - file2.cwd.should.equal(file.cwd); - file2.base.should.equal(file.base); - file2.path.should.equal(file.path); - file2.contents.should.not.equal(file.contents, 'buffer ref should be different'); - file2.contents.toString('utf8').should.equal(file.contents.toString('utf8')); - done(); - }); - - it('should copy buffer\'s reference with option contents: false', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.js', - contents: new Buffer('test') - }; - - var file = new File(options); - - var copy1 = file.clone({ contents: false }); - copy1.contents.should.equal(file.contents); - - var copy2 = file.clone({}); - copy2.contents.should.not.equal(file.contents); - - var copy3 = file.clone({ contents: 'any string' }); - copy3.contents.should.not.equal(file.contents); - - done(); - }); - - it('should copy all attributes over with Stream', function(done) { - var contents = new Stream.PassThrough(); - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: contents - }; - var file = new File(options); - var file2 = file.clone(); - - contents.write(new Buffer('wa')); - - process.nextTick(function() { - contents.write(new Buffer('dup')); - contents.end(); - }); - - file2.should.not.equal(file, 'refs should be different'); - file2.cwd.should.equal(file.cwd); - file2.base.should.equal(file.base); - file2.path.should.equal(file.path); - file2.contents.should.not.equal(file.contents, 'stream ref should not be the same'); - file.contents.pipe(es.wait(function(err, data) { - file2.contents.pipe(es.wait(function(err, data2) { - data2.should.not.equal(data, 'stream contents ref should not be the same'); - data2.should.eql(data, 'stream contents should be the same'); - })); - })); - done(); - }); - - it('should copy all attributes over with null', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: null - }; - var file = new File(options); - var file2 = file.clone(); - - file2.should.not.equal(file, 'refs should be different'); - file2.cwd.should.equal(file.cwd); - file2.base.should.equal(file.base); - file2.path.should.equal(file.path); - should.not.exist(file2.contents); - done(); - }); - - it('should properly clone the `stat` property', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.js', - contents: new Buffer('test'), - stat: fs.statSync(__filename) - }; - - var file = new File(options); - var copy = file.clone(); - - copy.stat.isFile().should.equal(true); - copy.stat.isDirectory().should.equal(false); - should(file.stat instanceof fs.Stats).equal(true); - should(copy.stat instanceof fs.Stats).equal(true); - - done(); - }); - - it('should properly clone the `history` property', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.js', - contents: new Buffer('test'), - stat: fs.statSync(__filename) - }; - - var file = new File(options); - var copy = file.clone(); - - copy.history[0].should.equal(options.path); - copy.path = 'lol'; - file.path.should.not.equal(copy.path); - done(); - }); - - it('should copy custom properties', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: null - }; - - var file = new File(options); - file.custom = { a: 'custom property' }; - - var file2 = file.clone(); - - file2.should.not.equal(file, 'refs should be different'); - file2.cwd.should.equal(file.cwd); - file2.base.should.equal(file.base); - file2.path.should.equal(file.path); - file2.custom.should.equal(file.custom); - file2.custom.a.should.equal(file.custom.a); - - done(); - }); - - it('should copy history', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: null - }; - - var file = new File(options); - file.path = '/test/test.js'; - file.path = '/test/test-938di2s.js'; - var file2 = file.clone(); - - file2.history.should.eql([ - '/test/test.coffee', - '/test/test.js', - '/test/test-938di2s.js' - ]); - file2.history.should.not.equal([ - '/test/test.coffee', - '/test/test.js', - '/test/test-938di2s.js' - ]); - file2.path.should.eql('/test/test-938di2s.js'); - - done(); - }); - - it('should copy all attributes deeply', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: null - }; - - var file = new File(options); - file.custom = { a: 'custom property' }; - - var file2 = file.clone(true); - file2.custom.should.eql(file.custom); - file2.custom.should.not.equal(file.custom); - file2.custom.a.should.equal(file.custom.a); - - var file3 = file.clone({ deep: true }); - file3.custom.should.eql(file.custom); - file3.custom.should.not.equal(file.custom); - file3.custom.a.should.equal(file.custom.a); - - var file4 = file.clone(false); - file4.custom.should.eql(file.custom); - file4.custom.should.equal(file.custom); - file4.custom.a.should.equal(file.custom.a); - - var file5 = file.clone({ deep: false }); - file5.custom.should.eql(file.custom); - file5.custom.should.equal(file.custom); - file5.custom.a.should.equal(file.custom.a); - - done(); - }); - }); - - describe('pipe()', function() { - it('should write to stream with Buffer', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: new Buffer('test') - }; - var file = new File(options); - var stream = new Stream.PassThrough(); - stream.on('data', function(chunk) { - should.exist(chunk); - (chunk instanceof Buffer).should.equal(true, 'should write as a buffer'); - chunk.toString('utf8').should.equal(options.contents.toString('utf8')); - }); - stream.on('end', function() { - done(); - }); - var ret = file.pipe(stream); - ret.should.equal(stream, 'should return the stream'); - }); - - it('should pipe to stream with Stream', function(done) { - var testChunk = new Buffer('test'); - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: new Stream.PassThrough() - }; - var file = new File(options); - var stream = new Stream.PassThrough(); - stream.on('data', function(chunk) { - should.exist(chunk); - (chunk instanceof Buffer).should.equal(true, 'should write as a buffer'); - chunk.toString('utf8').should.equal(testChunk.toString('utf8')); - done(); - }); - var ret = file.pipe(stream); - ret.should.equal(stream, 'should return the stream'); - - file.contents.write(testChunk); - }); - - it('should do nothing with null', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: null - }; - var file = new File(options); - var stream = new Stream.PassThrough(); - stream.on('data', function() { - throw new Error('should not write'); - }); - stream.on('end', function() { - done(); - }); - var ret = file.pipe(stream); - ret.should.equal(stream, 'should return the stream'); - }); - - it('should write to stream with Buffer', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: new Buffer('test') - }; - var file = new File(options); - var stream = new Stream.PassThrough(); - stream.on('data', function(chunk) { - should.exist(chunk); - (chunk instanceof Buffer).should.equal(true, 'should write as a buffer'); - chunk.toString('utf8').should.equal(options.contents.toString('utf8')); - done(); - }); - stream.on('end', function() { - throw new Error('should not end'); - }); - var ret = file.pipe(stream, {end: false}); - ret.should.equal(stream, 'should return the stream'); - }); - - it('should pipe to stream with Stream', function(done) { - var testChunk = new Buffer('test'); - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: new Stream.PassThrough() - }; - var file = new File(options); - var stream = new Stream.PassThrough(); - stream.on('data', function(chunk) { - should.exist(chunk); - (chunk instanceof Buffer).should.equal(true, 'should write as a buffer'); - chunk.toString('utf8').should.equal(testChunk.toString('utf8')); - done(); - }); - stream.on('end', function() { - throw new Error('should not end'); - }); - var ret = file.pipe(stream, {end: false}); - ret.should.equal(stream, 'should return the stream'); - - file.contents.write(testChunk); - }); - - it('should do nothing with null', function(done) { - var options = { - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: null - }; - var file = new File(options); - var stream = new Stream.PassThrough(); - stream.on('data', function() { - throw new Error('should not write'); - }); - stream.on('end', function() { - throw new Error('should not end'); - }); - var ret = file.pipe(stream, {end: false}); - ret.should.equal(stream, 'should return the stream'); - process.nextTick(done); - }); - }); - - describe('inspect()', function() { - it('should return correct format when no contents and no path', function(done) { - var file = new File(); - file.inspect().should.equal(''); - done(); - }); - - it('should return correct format when Buffer and no path', function(done) { - var val = new Buffer('test'); - var file = new File({ - contents: val - }); - file.inspect().should.equal('>'); - done(); - }); - - it('should return correct format when Buffer and relative path', function(done) { - var val = new Buffer('test'); - var file = new File({ - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: val - }); - file.inspect().should.equal('>'); - done(); - }); - - it('should return correct format when Buffer and only path and no base', function(done) { - var val = new Buffer('test'); - var file = new File({ - cwd: '/', - path: '/test/test.coffee', - contents: val - }); - delete file.base; - file.inspect().should.equal('>'); - done(); - }); - - it('should return correct format when Stream and relative path', function(done) { - var file = new File({ - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: new Stream.PassThrough() - }); - file.inspect().should.equal('>'); - done(); - }); - - it('should return correct format when null and relative path', function(done) { - var file = new File({ - cwd: '/', - base: '/test/', - path: '/test/test.coffee', - contents: null - }); - file.inspect().should.equal(''); - done(); - }); - }); - - describe('contents get/set', function() { - it('should work with Buffer', function(done) { - var val = new Buffer('test'); - var file = new File(); - file.contents = val; - file.contents.should.equal(val); - done(); - }); - - it('should work with Stream', function(done) { - var val = new Stream.PassThrough(); - var file = new File(); - file.contents = val; - file.contents.should.equal(val); - done(); - }); - - it('should work with null', function(done) { - var val = null; - var file = new File(); - file.contents = val; - (file.contents === null).should.equal(true); - done(); - }); - - it('should not work with string', function(done) { - var val = 'test'; - var file = new File(); - try { - file.contents = val; - } catch (err) { - should.exist(err); - done(); - } - }); - }); - - describe('relative get/set', function() { - it('should error on set', function(done) { - var file = new File(); - try { - file.relative = 'test'; - } catch (err) { - should.exist(err); - done(); - } - }); - - it('should error on get when no base', function(done) { - var a; - var file = new File(); - delete file.base; - try { - a = file.relative; - } catch (err) { - should.exist(err); - done(); - } - }); - - it('should error on get when no path', function(done) { - var a; - var file = new File(); - try { - a = file.relative; - } catch (err) { - should.exist(err); - done(); - } - }); - - it('should return a relative path from base', function(done) { - var file = new File({ - cwd: '/', - base: '/test/', - path: '/test/test.coffee' - }); - file.relative.should.equal('test.coffee'); - done(); - }); - - it('should return a relative path from cwd', function(done) { - var file = new File({ - cwd: '/', - path: '/test/test.coffee' - }); - file.relative.should.equal(path.join('test','test.coffee')); - done(); - }); - }); - - describe('path get/set', function() { - - it('should record history when instantiation', function() { - var file = new File({ - cwd: '/', - path: '/test/test.coffee' - }); - - file.path.should.eql('/test/test.coffee'); - file.history.should.eql(['/test/test.coffee']); - }); - - it('should record history when path change', function() { - var file = new File({ - cwd: '/', - path: '/test/test.coffee' - }); - - file.path = '/test/test.js'; - file.path.should.eql('/test/test.js'); - file.history.should.eql(['/test/test.coffee', '/test/test.js']); - - file.path = '/test/test.coffee'; - file.path.should.eql('/test/test.coffee'); - file.history.should.eql(['/test/test.coffee', '/test/test.js', '/test/test.coffee']); - }); - - it('should not record history when set the same path', function() { - var file = new File({ - cwd: '/', - path: '/test/test.coffee' - }); - - file.path = '/test/test.coffee'; - file.path = '/test/test.coffee'; - file.path.should.eql('/test/test.coffee'); - file.history.should.eql(['/test/test.coffee']); - - // ignore when set empty string - file.path = ''; - file.path.should.eql('/test/test.coffee'); - file.history.should.eql(['/test/test.coffee']); - }); - - it('should throw when set path null', function() { - var file = new File({ - cwd: '/', - path: null - }); - - should.not.exist(file.path); - file.history.should.eql([]); - - (function() { - file.path = null; - }).should.throw('path should be string'); - }); - }); -}); diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/cloneBuffer.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/cloneBuffer.js deleted file mode 100644 index 34b3e7c105..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/cloneBuffer.js +++ /dev/null @@ -1,27 +0,0 @@ -var cloneBuffer = require('../lib/cloneBuffer'); -var should = require('should'); -require('mocha'); - -describe('cloneBuffer()', function() { - it('should return a new Buffer reference', function(done) { - var testBuffer = new Buffer('test'); - var testBuffer2 = cloneBuffer(testBuffer); - - should.exist(testBuffer2, 'should return something'); - (testBuffer2 instanceof Buffer).should.equal(true, 'should return a Buffer'); - testBuffer2.should.not.equal(testBuffer, 'pointer should change'); - done(); - }); - - it('should not replicate modifications to the original buffer', function(done) { - var testBuffer = new Buffer('test'); - var testBuffer2 = cloneBuffer(testBuffer); - - // test that changes dont modify both pointers - testBuffer2.write('w'); - - testBuffer.toString('utf8').should.equal('test', 'original should stay the same'); - testBuffer2.toString('utf8').should.equal('west', 'new buffer should be modified'); - done(); - }); -}); diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/inspectStream.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/inspectStream.js deleted file mode 100644 index fe1802c5d7..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/inspectStream.js +++ /dev/null @@ -1,53 +0,0 @@ -var inspectStream = require('../lib/inspectStream'); -var Stream = require('stream'); -var should = require('should'); -require('mocha'); - -describe('inspectStream()', function() { - it('should work on a core Stream', function(done) { - var testStream = new Stream(); - inspectStream(testStream).should.equal(''); - done(); - }); - - it('should work on a core Readable Stream', function(done) { - var testStream = new Stream.Readable(); - inspectStream(testStream).should.equal(''); - done(); - }); - - it('should work on a core Writable Stream', function(done) { - var testStream = new Stream.Writable(); - inspectStream(testStream).should.equal(''); - done(); - }); - - it('should work on a core Duplex Stream', function(done) { - var testStream = new Stream.Duplex(); - inspectStream(testStream).should.equal(''); - done(); - }); - - it('should work on a core Transform Stream', function(done) { - var testStream = new Stream.Transform(); - inspectStream(testStream).should.equal(''); - done(); - }); - - it('should work on a core PassThrough Stream', function(done) { - var testStream = new Stream.PassThrough(); - inspectStream(testStream).should.equal(''); - done(); - }); - - it('should not work on a Buffer', function(done) { - var testBuffer = new Buffer('test'); - should.not.exist(inspectStream(testBuffer)); - done(); - }); - - it('should not work on a null', function(done) { - should.not.exist(inspectStream(null)); - done(); - }); -}); \ No newline at end of file diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/isBuffer.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/isBuffer.js deleted file mode 100644 index 432ad2aad7..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/isBuffer.js +++ /dev/null @@ -1,29 +0,0 @@ -var isBuffer = require('../lib/isBuffer'); -var Stream = require('stream'); -require('should'); -require('mocha'); - -describe('isBuffer()', function() { - it('should return true on a Buffer', function(done) { - var testBuffer = new Buffer('test'); - isBuffer(testBuffer).should.equal(true); - done(); - }); - - it('should return false on a Stream', function(done) { - var testStream = new Stream(); - isBuffer(testStream).should.equal(false); - done(); - }); - - it('should return false on a null', function(done) { - isBuffer(null).should.equal(false); - done(); - }); - - it('should return false on a array of numbers', function(done) { - var testArray = [1, 2, 3]; - isBuffer(testArray).should.equal(false); - done(); - }); -}); diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/isNull.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/isNull.js deleted file mode 100644 index 356934a644..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/isNull.js +++ /dev/null @@ -1,22 +0,0 @@ -var isNull = require('../lib/isNull'); -require('should'); -require('mocha'); - -describe('isNull()', function() { - it('should return true on null', function(done) { - isNull(null).should.equal(true); - done(); - }); - - it('should return false on undefined', function(done) { - isNull().should.equal(false); - isNull(undefined).should.equal(false); - done(); - }); - - it('should return false on defined values', function(done) { - isNull(1).should.equal(false); - isNull('test').should.equal(false); - done(); - }); -}); diff --git a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/isStream.js b/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/isStream.js deleted file mode 100644 index 5cc0e0b16f..0000000000 --- a/node_modules/gulp-shell/node_modules/gulp-util/node_modules/vinyl/test/isStream.js +++ /dev/null @@ -1,29 +0,0 @@ -var isStream = require('../lib/isStream'); -var Stream = require('stream'); -require('should'); -require('mocha'); - -describe('isStream()', function() { - it('should return true on a Stream', function(done) { - var testStream = new Stream(); - isStream(testStream).should.equal(true); - done(); - }); - - it('should return false on a Buffer', function(done) { - var testBuffer = new Buffer('test'); - isStream(testBuffer).should.equal(false); - done(); - }); - - it('should return false on a null', function(done) { - isStream(null).should.equal(false); - done(); - }); - - it('should return false on a array of numbers', function(done) { - var testArray = [1, 2, 3]; - isStream(testArray).should.equal(false); - done(); - }); -}); diff --git a/node_modules/gulp-shell/node_modules/gulp-util/package.json b/node_modules/gulp-shell/node_modules/gulp-util/package.json index 3a8943599c..1fc1e4703d 100644 --- a/node_modules/gulp-shell/node_modules/gulp-util/package.json +++ b/node_modules/gulp-shell/node_modules/gulp-util/package.json @@ -1,77 +1,91 @@ -{ - "name": "gulp-util", - "description": "Utility functions for gulp plugins", - "version": "3.0.1", - "homepage": "http://github.com/wearefractal/gulp-util", - "repository": { - "type": "git", - "url": "git://github.com/wearefractal/gulp-util.git" - }, - "author": { - "name": "Fractal", - "email": "contact@wearefractal.com", - "url": "http://wearefractal.com/" - }, - "main": "./index.js", - "dependencies": { - "chalk": "^0.5.0", - "dateformat": "^1.0.7-1.2.3", - "lodash": "^2.4.1", - "lodash._reinterpolate": "^2.4.1", - "lodash.template": "^2.4.1", - "minimist": "^1.1.0", - "multipipe": "^0.1.0", - "through2": "^0.6.1", - "vinyl": "^0.4.0" - }, - "devDependencies": { - "mocha": "^1.17.0", - "should": "^4.0.0", - "mocha-lcov-reporter": "^0.0.1", - "coveralls": "^2.7.0", - "istanbul": "^0.3.0", - "rimraf": "^2.2.5", - "jshint": "^2.4.1", - "buffer-equal": "~0.0.1", - "lodash.templatesettings": "^2.4.1", - "event-stream": "^3.1.0" - }, - "scripts": { - "test": "mocha --reporter spec && jshint", - "coveralls": "istanbul cover _mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | coveralls && rm -rf ./coverage" - }, - "engines": { - "node": ">= 0.9" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/wearefractal/gulp-util/raw/master/LICENSE" - } - ], - "gitHead": "f6336c8ac9f52930b36ad14002cf267c06f801df", - "bugs": { - "url": "https://github.com/wearefractal/gulp-util/issues" - }, - "_id": "gulp-util@3.0.1", - "_shasum": "8214894d05c2bb6cc7f5544918a51ddf88180f00", - "_from": "gulp-util@>=3.0.0 <3.1.0", - "_npmVersion": "1.4.21", - "_npmUser": { - "name": "fractal", - "email": "contact@wearefractal.com" - }, - "maintainers": [ - { - "name": "fractal", - "email": "contact@wearefractal.com" - } - ], - "dist": { - "shasum": "8214894d05c2bb6cc7f5544918a51ddf88180f00", - "tarball": "http://registry.npmjs.org/gulp-util/-/gulp-util-3.0.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.1.tgz", - "readme": "ERROR: No README data found!" -} +{ + "name": "gulp-util", + "description": "Utility functions for gulp plugins", + "version": "3.0.4", + "repository": { + "type": "git", + "url": "https://github.com/wearefractal/gulp-util" + }, + "author": { + "name": "Fractal", + "email": "contact@wearefractal.com", + "url": "http://wearefractal.com/" + }, + "files": [ + "index.js", + "lib" + ], + "dependencies": { + "array-differ": "^1.0.0", + "array-uniq": "^1.0.2", + "beeper": "^1.0.0", + "chalk": "^1.0.0", + "dateformat": "^1.0.11", + "lodash._reescape": "^3.0.0", + "lodash._reevaluate": "^3.0.0", + "lodash._reinterpolate": "^3.0.0", + "lodash.template": "^3.0.0", + "minimist": "^1.1.0", + "multipipe": "^0.1.2", + "object-assign": "^2.0.0", + "replace-ext": "0.0.1", + "through2": "^0.6.3", + "vinyl": "^0.4.3" + }, + "devDependencies": { + "buffer-equal": "^0.0.1", + "coveralls": "^2.11.2", + "event-stream": "^3.1.7", + "istanbul": "^0.3.5", + "istanbul-coveralls": "^1.0.1", + "jshint": "^2.5.11", + "lodash.templatesettings": "^3.0.0", + "mocha": "^2.0.1", + "rimraf": "^2.2.8", + "should": "^5.0.1" + }, + "scripts": { + "test": "jshint *.js lib/*.js test/*.js && mocha", + "coveralls": "istanbul cover _mocha --report lcovonly && istanbul-coveralls" + }, + "engines": { + "node": ">=0.10" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/wearefractal/gulp-util/raw/master/LICENSE" + } + ], + "gitHead": "d17e0f99e9fa8d90499757e823983e229561ac75", + "bugs": { + "url": "https://github.com/wearefractal/gulp-util/issues" + }, + "homepage": "https://github.com/wearefractal/gulp-util", + "_id": "gulp-util@3.0.4", + "_shasum": "ec73553090fdb23d88fa02812ad1b61225854881", + "_from": "gulp-util@>=3.0.0 <4.0.0", + "_npmVersion": "2.6.0", + "_nodeVersion": "0.10.35", + "_npmUser": { + "name": "fractal", + "email": "contact@wearefractal.com" + }, + "maintainers": [ + { + "name": "fractal", + "email": "contact@wearefractal.com" + }, + { + "name": "phated", + "email": "blaine@iceddev.com" + } + ], + "dist": { + "shasum": "ec73553090fdb23d88fa02812ad1b61225854881", + "tarball": "http://registry.npmjs.org/gulp-util/-/gulp-util-3.0.4.tgz" + }, + "directories": {}, + "_resolved": "https://registry.npmjs.org/gulp-util/-/gulp-util-3.0.4.tgz", + "readme": "ERROR: No README data found!" +} diff --git a/node_modules/gulp-shell/node_modules/lodash/LICENSE.txt b/node_modules/gulp-shell/node_modules/lodash/LICENSE.txt index fb2a041715..9cd87e5dce 100644 --- a/node_modules/gulp-shell/node_modules/lodash/LICENSE.txt +++ b/node_modules/gulp-shell/node_modules/lodash/LICENSE.txt @@ -1,22 +1,22 @@ -Copyright 2012-2013 The Dojo Foundation -Based on Underscore.js 1.5.2, copyright 2009-2013 Jeremy Ashkenas, -DocumentCloud and Investigative Reporters & Editors - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file +Copyright 2012-2015 The Dojo Foundation +Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas, +DocumentCloud and Investigative Reporters & Editors + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/gulp-shell/node_modules/lodash/README.md b/node_modules/gulp-shell/node_modules/lodash/README.md index 44975a69fc..b44492ce3b 100644 --- a/node_modules/gulp-shell/node_modules/lodash/README.md +++ b/node_modules/gulp-shell/node_modules/lodash/README.md @@ -1,163 +1,116 @@ -# Lo-Dash v2.4.1 -A utility library delivering consistency, [customization](http://lodash.com/custom-builds), [performance](http://lodash.com/benchmarks), & [extras](http://lodash.com/#features). - -## Download - -Check out our [wiki]([https://github.com/lodash/lodash/wiki/build-differences]) for details over the differences between builds. - -* Modern builds perfect for newer browsers/environments:
    -[Development](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.js) & -[Production](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.min.js) - -* Compatibility builds for older environment support too:
    -[Development](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.compat.js) & -[Production](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.compat.min.js) - -* Underscore builds to use as a drop-in replacement:
    -[Development](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.underscore.js) & -[Production](https://raw.github.com/lodash/lodash/2.4.1/dist/lodash.underscore.min.js) - -CDN copies are available on [cdnjs](http://cdnjs.com/libraries/lodash.js/) & [jsDelivr](http://www.jsdelivr.com/#!lodash). For smaller file sizes, create [custom builds](http://lodash.com/custom-builds) with only the features needed. - -Love modules? We’ve got you covered with [lodash-amd](https://npmjs.org/package/lodash-amd), [lodash-es6](https://github.com/lodash/lodash-es6), [lodash-node](https://npmjs.org/package/lodash-node), & [npm packages](https://npmjs.org/browse/keyword/lodash-modularized) per method. - -## Dive in - -There’s plenty of **[documentation](http://lodash.com/docs)**, [unit tests](http://lodash.com/tests), & [benchmarks](http://lodash.com/benchmarks).
    -Check out DevDocs as a fast, organized, & searchable interface for our documentation. - -The full changelog for this release is available on our [wiki](https://github.com/lodash/lodash/wiki/Changelog).
    -A list of upcoming features is available on our [roadmap](https://github.com/lodash/lodash/wiki/Roadmap). - -## Features *not* in Underscore - - * AMD loader support ([curl](https://github.com/cujojs/curl), [dojo](http://dojotoolkit.org/), [requirejs](http://requirejs.org/), etc.) - * [_(…)](http://lodash.com/docs#_) supports intuitive chaining - * [_.at](http://lodash.com/docs#at) for cherry-picking collection values - * [_.bindKey](http://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods - * [_.clone](http://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects - * [_.cloneDeep](http://lodash.com/docs#cloneDeep) for deep cloning arrays & objects - * [_.constant](http://lodash.com/docs#constant) & [_.property](http://lodash.com/docs#property) function generators for composing functions - * [_.contains](http://lodash.com/docs#contains) accepts a `fromIndex` - * [_.create](http://lodash.com/docs#create) for easier object inheritance - * [_.createCallback](http://lodash.com/docs#createCallback) for extending callbacks in methods & mixins - * [_.curry](http://lodash.com/docs#curry) for creating [curried](http://hughfdjackson.com/javascript/2013/07/06/why-curry-helps/) functions - * [_.debounce](http://lodash.com/docs#debounce) & [_.throttle](http://lodash.com/docs#throttle) accept additional `options` for more control - * [_.findIndex](http://lodash.com/docs#findIndex) & [_.findKey](http://lodash.com/docs#findKey) for finding indexes & keys - * [_.forEach](http://lodash.com/docs#forEach) is chainable & supports exiting early - * [_.forIn](http://lodash.com/docs#forIn) for iterating own & inherited properties - * [_.forOwn](http://lodash.com/docs#forOwn) for iterating own properties - * [_.isPlainObject](http://lodash.com/docs#isPlainObject) for checking if values are created by `Object` - * [_.mapValues](http://lodash.com/docs#mapValues) for [mapping](http://lodash.com/docs#map) values to an object - * [_.memoize](http://lodash.com/docs#memoize) exposes the `cache` of memoized functions - * [_.merge](http://lodash.com/docs#merge) for a deep [_.extend](http://lodash.com/docs#extend) - * [_.noop](http://lodash.com/docs#noop) for function placeholders - * [_.now](http://lodash.com/docs#now) as a cross-browser `Date.now` alternative - * [_.parseInt](http://lodash.com/docs#parseInt) for consistent behavior - * [_.pull](http://lodash.com/docs#pull) & [_.remove](http://lodash.com/docs#remove) for mutating arrays - * [_.random](http://lodash.com/docs#random) supports returning floating-point numbers - * [_.runInContext](http://lodash.com/docs#runInContext) for easier mocking - * [_.sortBy](http://lodash.com/docs#sortBy) supports sorting by multiple properties - * [_.support](http://lodash.com/docs#support) for flagging environment features - * [_.template](http://lodash.com/docs#template) supports [*“imports”*](http://lodash.com/docs#templateSettings_imports) options & [ES6 template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals) - * [_.transform](http://lodash.com/docs#transform) as a powerful alternative to [_.reduce](http://lodash.com/docs#reduce) for transforming objects - * [_.where](http://lodash.com/docs#where) supports deep object comparisons - * [_.xor](http://lodash.com/docs#xor) as a companion to [_.difference](http://lodash.com/docs#difference), [_.intersection](http://lodash.com/docs#intersection), & [_.union](http://lodash.com/docs#union) - * [_.zip](http://lodash.com/docs#zip) is capable of unzipping values - * [_.omit](http://lodash.com/docs#omit), [_.pick](http://lodash.com/docs#pick), & - [more](http://lodash.com/docs "_.assign, _.clone, _.cloneDeep, _.first, _.initial, _.isEqual, _.last, _.merge, _.rest") accept callbacks - * [_.contains](http://lodash.com/docs#contains), [_.toArray](http://lodash.com/docs#toArray), & - [more](http://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.forEach, _.forEachRight, _.groupBy, _.invoke, _.map, _.max, _.min, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy, _.where") accept strings - * [_.filter](http://lodash.com/docs#filter), [_.map](http://lodash.com/docs#map), & - [more](http://lodash.com/docs "_.countBy, _.every, _.find, _.findKey, _.findLast, _.findLastIndex, _.findLastKey, _.first, _.groupBy, _.initial, _.last, _.max, _.min, _.reject, _.rest, _.some, _.sortBy, _.sortedIndex, _.uniq") support *“_.pluck”* & *“_.where”* shorthands - * [_.findLast](http://lodash.com/docs#findLast), [_.findLastIndex](http://lodash.com/docs#findLastIndex), & - [more](http://lodash.com/docs "_.findLastKey, _.forEachRight, _.forInRight, _.forOwnRight, _.partialRight") right-associative methods - -## Resources - - * Podcasts - - [JavaScript Jabber](http://javascriptjabber.com/079-jsj-lo-dash-with-john-david-dalton/) - - * Posts - - [Say “Hello” to Lo-Dash](http://kitcambridge.be/blog/say-hello-to-lo-dash/) - - [Custom builds in Lo-Dash 2.0](http://kitcambridge.be/blog/custom-builds-in-lo-dash-2-dot-0/) - - * Videos - - [Introduction](https://vimeo.com/44154599) - - [Origins](https://vimeo.com/44154600) - - [Optimizations & builds](https://vimeo.com/44154601) - - [Native method use](https://vimeo.com/48576012) - - [Testing](https://vimeo.com/45865290) - - [CascadiaJS ’12](http://www.youtube.com/watch?v=dpPy4f_SeEk) - - A list of other community created podcasts, posts, & videos is available on our [wiki](https://github.com/lodash/lodash/wiki/Resources). - -## Support - -Tested in Chrome 5~31, Firefox 2~25, IE 6-11, Opera 9.25~17, Safari 3-7, Node.js 0.6.21~0.10.22, Narwhal 0.3.2, PhantomJS 1.9.2, RingoJS 0.9, & Rhino 1.7RC5.
    -Automated browser test results [are available](https://saucelabs.com/u/lodash) as well as [Travis CI](https://travis-ci.org/) builds for [lodash](https://travis-ci.org/lodash/lodash/), [lodash-cli](https://travis-ci.org/lodash/lodash-cli/), [lodash-amd](https://travis-ci.org/lodash/lodash-amd/), [lodash-node](https://travis-ci.org/lodash/lodash-node/), & [grunt-lodash](https://travis-ci.org/lodash/grunt-lodash). - -Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing.
    -[![Sauce Labs](http://lodash.com/_img/sauce.png)](https://saucelabs.com/ "Sauce Labs: Selenium Testing & More") - -## Installation & usage - -In browsers: - -```html - -``` - -Using [`npm`](http://npmjs.org/): - -```bash -npm i --save lodash - -{sudo} npm i -g lodash -npm ln lodash -``` - -In [Node.js](http://nodejs.org/) & [Ringo](http://ringojs.org/): - -```js -var _ = require('lodash'); -// or as Underscore -var _ = require('lodash/dist/lodash.underscore'); -``` - -**Notes:** - * Don’t assign values to [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL - * If Lo-Dash is installed globally, run [`npm ln lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory *before* requiring it - -In [Rhino](http://www.mozilla.org/rhino/): - -```js -load('lodash.js'); -``` - -In an AMD loader: - -```js -require({ - 'packages': [ - { 'name': 'lodash', 'location': 'path/to/lodash', 'main': 'lodash' } - ] -}, -['lodash'], function(_) { - console.log(_.VERSION); -}); -``` - -## Author - -| [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter") | -|---| -| [John-David Dalton](http://allyoucanleet.com/) | - -## Contributors - -| [![twitter/blainebublitz](http://gravatar.com/avatar/ac1c67fd906c9fecd823ce302283b4c1?s=70)](https://twitter.com/blainebublitz "Follow @BlaineBublitz on Twitter") | [![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter") | [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | -|---|---|---| -| [Blaine Bublitz](http://www.iceddev.com/) | [Kit Cambridge](http://kitcambridge.be/) | [Mathias Bynens](http://mathiasbynens.be/) | - -[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/lodash/lodash/trend.png)](https://bitdeli.com/free "Bitdeli Badge") +# lodash v3.5.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules. + +Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli): +```bash +$ lodash modularize modern exports=node -o ./ +$ lodash modern -d -o ./index.js +``` + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash +``` + +In Node.js/io.js: + +```js +// load the modern build +var _ = require('lodash'); +// or a method category +var array = require('lodash/array'); +// or a method (great for smaller builds with browserify/webpack) +var chunk = require('lodash/array/chunk'); +``` + +See the [package source](https://github.com/lodash/lodash/tree/3.5.0-npm) for more details. + +**Note:**
    +Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.
    +Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash by default. + +## Module formats + +lodash is also available in a variety of other builds & module formats. + + * npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds + * AMD modules for [modern](https://github.com/lodash/lodash/tree/3.5.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.5.0-amd) builds + * ES modules for the [modern](https://github.com/lodash/lodash/tree/3.5.0-es) build + +## Further Reading + + * [API Documentation](https://lodash.com/docs) + * [Build Differences](https://github.com/lodash/lodash/wiki/Build-Differences) + * [Changelog](https://github.com/lodash/lodash/wiki/Changelog) + * [Release Notes](https://github.com/lodash/lodash/releases) + * [Roadmap](https://github.com/lodash/lodash/wiki/Roadmap) + * [More Resources](https://github.com/lodash/lodash/wiki/Resources) + +## Features *not* in Underscore + + * ~100% [code coverage](https://coveralls.io/r/lodash) + * Follows [semantic versioning](http://semver.org/) for releases + * [Lazily evaluated](http://filimanjaro.com/blog/2014/introducing-lazy-evaluation/) chaining + * [_(…)](https://lodash.com/docs#_) supports intuitive chaining + * [_.add](https://lodash.com/docs#add) for mathematical composition + * [_.ary](https://lodash.com/docs#ary) & [_.rearg](https://lodash.com/docs#rearg) to change function argument limits & order + * [_.at](https://lodash.com/docs#at) for cherry-picking collection values + * [_.attempt](https://lodash.com/docs#attempt) to execute functions which may error without a try-catch + * [_.before](https://lodash.com/docs#before) to complement [_.after](https://lodash.com/docs#after) + * [_.bindKey](https://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods + * [_.chunk](https://lodash.com/docs#chunk) for splitting an array into chunks of a given size + * [_.clone](https://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects + * [_.cloneDeep](https://lodash.com/docs#cloneDeep) for deep cloning arrays & objects + * [_.create](https://lodash.com/docs#create) for easier object inheritance + * [_.curry](https://lodash.com/docs#curry) & [_.curryRight](https://lodash.com/docs#curryRight) for creating [curried](http://hughfdjackson.com/javascript/why-curry-helps/) functions + * [_.debounce](https://lodash.com/docs#debounce) & [_.throttle](https://lodash.com/docs#throttle) are cancelable & accept options for more control + * [_.fill](https://lodash.com/docs#fill) to fill arrays with values + * [_.findKey](https://lodash.com/docs#findKey) for finding keys + * [_.flow](https://lodash.com/docs#flow) to complement [_.flowRight](https://lodash.com/docs#flowRight) (a.k.a `_.compose`) + * [_.forEach](https://lodash.com/docs#forEach) supports exiting early + * [_.forIn](https://lodash.com/docs#forIn) for iterating all enumerable properties + * [_.forOwn](https://lodash.com/docs#forOwn) for iterating own properties + * [_.inRange](https://lodash.com/docs#inRange) for checking whether a number is within a given range + * [_.isNative](https://lodash.com/docs#isNative) to check for native functions + * [_.isPlainObject](https://lodash.com/docs#isPlainObject) & [_.toPlainObject](https://lodash.com/docs#toPlainObject) to check for & convert to `Object` objects + * [_.isTypedArray](https://lodash.com/docs#isTypedArray) to check for typed arrays + * [_.matches](https://lodash.com/docs#matches) supports deep object comparisons + * [_.matchesProperty](https://lodash.com/docs#matchesProperty) to complement [_.matches](https://lodash.com/docs#matches) & [_.property](https://lodash.com/docs#property) + * [_.merge](https://lodash.com/docs#merge) for a deep [_.extend](https://lodash.com/docs#extend) + * [_.parseInt](https://lodash.com/docs#parseInt) for consistent cross-environment behavior + * [_.pull](https://lodash.com/docs#pull), [_.pullAt](https://lodash.com/docs#pullAt), & [_.remove](https://lodash.com/docs#remove) for mutating arrays + * [_.random](https://lodash.com/docs#random) supports returning floating-point numbers + * [_.runInContext](https://lodash.com/docs#runInContext) for collisionless mixins & easier mocking + * [_.slice](https://lodash.com/docs#slice) for creating subsets of array-like values + * [_.sortByAll](https://lodash.com/docs#sortByAll) & [_.sortByOrder](https://lodash.com/docs#sortByOrder) for sorting by multiple properties & orders + * [_.spread](https://lodash.com/docs#spread) for creating a function to spread an array of arguments to another + * [_.sum](https://lodash.com/docs#sum) to get the sum of values + * [_.support](https://lodash.com/docs#support) for flagging environment features + * [_.template](https://lodash.com/docs#template) supports [*“imports”*](https://lodash.com/docs#templateSettings-imports) options & [ES template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) + * [_.transform](https://lodash.com/docs#transform) as a powerful alternative to [_.reduce](https://lodash.com/docs#reduce) for transforming objects + * [_.xor](https://lodash.com/docs#xor) to complement [_.difference](https://lodash.com/docs#difference), [_.intersection](https://lodash.com/docs#intersection), & [_.union](https://lodash.com/docs#union) + * [_.valuesIn](https://lodash.com/docs#valuesIn) for getting values of all enumerable properties + * [_.bind](https://lodash.com/docs#bind), [_.curry](https://lodash.com/docs#curry), [_.partial](https://lodash.com/docs#partial), & + [more](https://lodash.com/docs "_.bindKey, _.curryRight, _.partialRight") support customizable argument placeholders + * [_.capitalize](https://lodash.com/docs#capitalize), [_.trim](https://lodash.com/docs#trim), & + [more](https://lodash.com/docs "_.camelCase, _.deburr, _.endsWith, _.escapeRegExp, _.kebabCase, _.pad, _.padLeft, _.padRight, _.repeat, _.snakeCase, _.startCase, _.startsWith, _.trimLeft, _.trimRight, _.trunc, _.words") string methods + * [_.clone](https://lodash.com/docs#clone), [_.isEqual](https://lodash.com/docs#isEqual), & + [more](https://lodash.com/docs "_.assign, _.cloneDeep, _.merge") accept callbacks + * [_.dropWhile](https://lodash.com/docs#dropWhile), [_.takeWhile](https://lodash.com/docs#takeWhile), & + [more](https://lodash.com/docs "_.drop, _.dropRightWhile, _.take, _.takeRightWhile") to complement [_.first](https://lodash.com/docs#first), [_.initial](https://lodash.com/docs#initial), [_.last](https://lodash.com/docs#last), & [_.rest](https://lodash.com/docs#rest) + * [_.findLast](https://lodash.com/docs#findLast), [_.findLastKey](https://lodash.com/docs#findLastKey), & + [more](https://lodash.com/docs "_.flowRight, _.forEachRight, _.forInRight, _.forOwnRight, _.partialRight") right-associative methods + * [_.includes](https://lodash.com/docs#includes), [_.toArray](https://lodash.com/docs#toArray), & + [more](https://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.findLast, _.forEach, _.forEachRight, _.groupBy, _.indexBy, _.invoke, _.map, _.max, _.min, _.partition, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy") accept strings + * [_#commit](https://lodash.com/docs#prototype-commit) & [_#plant](https://lodash.com/docs#prototype-plant) for working with chain sequences + * [_#thru](https://lodash.com/docs#thru) to pass values thru a chain sequence + +## Support + +Tested in Chrome 40-41, Firefox 35-36, IE 6-11, Opera 26-27, Safari 5-8, io.js 1.5.0, Node.js 0.8.28, 0.10.36, & 0.12.0, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5. +Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing. diff --git a/node_modules/gulp-shell/node_modules/lodash/array.js b/node_modules/gulp-shell/node_modules/lodash/array.js new file mode 100644 index 0000000000..6ef12c75e8 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array.js @@ -0,0 +1,42 @@ +module.exports = { + 'chunk': require('./array/chunk'), + 'compact': require('./array/compact'), + 'difference': require('./array/difference'), + 'drop': require('./array/drop'), + 'dropRight': require('./array/dropRight'), + 'dropRightWhile': require('./array/dropRightWhile'), + 'dropWhile': require('./array/dropWhile'), + 'fill': require('./array/fill'), + 'findIndex': require('./array/findIndex'), + 'findLastIndex': require('./array/findLastIndex'), + 'first': require('./array/first'), + 'flatten': require('./array/flatten'), + 'flattenDeep': require('./array/flattenDeep'), + 'head': require('./array/head'), + 'indexOf': require('./array/indexOf'), + 'initial': require('./array/initial'), + 'intersection': require('./array/intersection'), + 'last': require('./array/last'), + 'lastIndexOf': require('./array/lastIndexOf'), + 'object': require('./array/object'), + 'pull': require('./array/pull'), + 'pullAt': require('./array/pullAt'), + 'remove': require('./array/remove'), + 'rest': require('./array/rest'), + 'slice': require('./array/slice'), + 'sortedIndex': require('./array/sortedIndex'), + 'sortedLastIndex': require('./array/sortedLastIndex'), + 'tail': require('./array/tail'), + 'take': require('./array/take'), + 'takeRight': require('./array/takeRight'), + 'takeRightWhile': require('./array/takeRightWhile'), + 'takeWhile': require('./array/takeWhile'), + 'union': require('./array/union'), + 'uniq': require('./array/uniq'), + 'unique': require('./array/unique'), + 'unzip': require('./array/unzip'), + 'without': require('./array/without'), + 'xor': require('./array/xor'), + 'zip': require('./array/zip'), + 'zipObject': require('./array/zipObject') +}; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/chunk.js b/node_modules/gulp-shell/node_modules/lodash/array/chunk.js new file mode 100644 index 0000000000..4de9b39618 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/chunk.js @@ -0,0 +1,47 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** Native method references. */ +var ceil = Math.ceil; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Creates an array of elements split into groups the length of `size`. + * If `collection` can't be split evenly, the final chunk will be the remaining + * elements. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to process. + * @param {number} [size=1] The length of each chunk. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the new array containing chunks. + * @example + * + * _.chunk(['a', 'b', 'c', 'd'], 2); + * // => [['a', 'b'], ['c', 'd']] + * + * _.chunk(['a', 'b', 'c', 'd'], 3); + * // => [['a', 'b', 'c'], ['d']] + */ +function chunk(array, size, guard) { + if (guard ? isIterateeCall(array, size, guard) : size == null) { + size = 1; + } else { + size = nativeMax(+size || 1, 1); + } + var index = 0, + length = array ? array.length : 0, + resIndex = -1, + result = Array(ceil(length / size)); + + while (index < length) { + result[++resIndex] = baseSlice(array, index, (index += size)); + } + return result; +} + +module.exports = chunk; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/compact.js b/node_modules/gulp-shell/node_modules/lodash/array/compact.js new file mode 100644 index 0000000000..1dc1c55e8f --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/compact.js @@ -0,0 +1,30 @@ +/** + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are falsey. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to compact. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.compact([0, 1, false, 2, '', 3]); + * // => [1, 2, 3] + */ +function compact(array) { + var index = -1, + length = array ? array.length : 0, + resIndex = -1, + result = []; + + while (++index < length) { + var value = array[index]; + if (value) { + result[++resIndex] = value; + } + } + return result; +} + +module.exports = compact; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/difference.js b/node_modules/gulp-shell/node_modules/lodash/array/difference.js new file mode 100644 index 0000000000..d05774e2c8 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/difference.js @@ -0,0 +1,40 @@ +var baseDifference = require('../internal/baseDifference'), + baseFlatten = require('../internal/baseFlatten'), + isArguments = require('../lang/isArguments'), + isArray = require('../lang/isArray'); + +/** + * Creates an array excluding all values of the provided arrays using + * `SameValueZero` for equality comparisons. + * + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for more details. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The arrays of values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.difference([1, 2, 3], [4, 2]); + * // => [1, 3] + */ +function difference() { + var args = arguments, + index = -1, + length = args.length; + + while (++index < length) { + var value = args[index]; + if (isArray(value) || isArguments(value)) { + break; + } + } + return baseDifference(value, baseFlatten(args, false, true, ++index)); +} + +module.exports = difference; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/drop.js b/node_modules/gulp-shell/node_modules/lodash/array/drop.js new file mode 100644 index 0000000000..039a0b5fdc --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/drop.js @@ -0,0 +1,39 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` with `n` elements dropped from the beginning. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.drop([1, 2, 3]); + * // => [2, 3] + * + * _.drop([1, 2, 3], 2); + * // => [3] + * + * _.drop([1, 2, 3], 5); + * // => [] + * + * _.drop([1, 2, 3], 0); + * // => [1, 2, 3] + */ +function drop(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + return baseSlice(array, n < 0 ? 0 : n); +} + +module.exports = drop; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/dropRight.js b/node_modules/gulp-shell/node_modules/lodash/array/dropRight.js new file mode 100644 index 0000000000..14b5eb6f0a --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/dropRight.js @@ -0,0 +1,40 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` with `n` elements dropped from the end. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRight([1, 2, 3]); + * // => [1, 2] + * + * _.dropRight([1, 2, 3], 2); + * // => [1] + * + * _.dropRight([1, 2, 3], 5); + * // => [] + * + * _.dropRight([1, 2, 3], 0); + * // => [1, 2, 3] + */ +function dropRight(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + n = length - (+n || 0); + return baseSlice(array, 0, n < 0 ? 0 : n); +} + +module.exports = dropRight; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/dropRightWhile.js b/node_modules/gulp-shell/node_modules/lodash/array/dropRightWhile.js new file mode 100644 index 0000000000..8135410074 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/dropRightWhile.js @@ -0,0 +1,63 @@ +var baseCallback = require('../internal/baseCallback'), + baseSlice = require('../internal/baseSlice'); + +/** + * Creates a slice of `array` excluding elements dropped from the end. + * Elements are dropped until `predicate` returns falsey. The predicate is + * bound to `thisArg` and invoked with three arguments; (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that match the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRightWhile([1, 2, 3], function(n) { + * return n > 1; + * }); + * // => [1] + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user'); + * // => ['barney', 'fred'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.dropRightWhile(users, 'active', false), 'user'); + * // => ['barney'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.dropRightWhile(users, 'active'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ +function dropRightWhile(array, predicate, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + predicate = baseCallback(predicate, thisArg, 3); + while (length-- && predicate(array[length], length, array)) {} + return baseSlice(array, 0, length + 1); +} + +module.exports = dropRightWhile; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/dropWhile.js b/node_modules/gulp-shell/node_modules/lodash/array/dropWhile.js new file mode 100644 index 0000000000..2c88099695 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/dropWhile.js @@ -0,0 +1,64 @@ +var baseCallback = require('../internal/baseCallback'), + baseSlice = require('../internal/baseSlice'); + +/** + * Creates a slice of `array` excluding elements dropped from the beginning. + * Elements are dropped until `predicate` returns falsey. The predicate is + * bound to `thisArg` and invoked with three arguments; (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropWhile([1, 2, 3], function(n) { + * return n < 3; + * }); + * // => [3] + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user'); + * // => ['fred', 'pebbles'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.dropWhile(users, 'active', false), 'user'); + * // => ['pebbles'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.dropWhile(users, 'active'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ +function dropWhile(array, predicate, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + var index = -1; + predicate = baseCallback(predicate, thisArg, 3); + while (++index < length && predicate(array[index], index, array)) {} + return baseSlice(array, index); +} + +module.exports = dropWhile; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/fill.js b/node_modules/gulp-shell/node_modules/lodash/array/fill.js new file mode 100644 index 0000000000..44811d309e --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/fill.js @@ -0,0 +1,31 @@ +var baseFill = require('../internal/baseFill'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Fills elements of `array` with `value` from `start` up to, but not + * including, `end`. + * + * **Note:** This method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + */ +function fill(array, value, start, end) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { + start = 0; + end = length; + } + return baseFill(array, value, start, end); +} + +module.exports = fill; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/findIndex.js b/node_modules/gulp-shell/node_modules/lodash/array/findIndex.js new file mode 100644 index 0000000000..0c2ef30511 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/findIndex.js @@ -0,0 +1,64 @@ +var baseCallback = require('../internal/baseCallback'); + +/** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for, instead of the element itself. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(chr) { + * return chr.user == 'barney'; + * }); + * // => 0 + * + * // using the `_.matches` callback shorthand + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // using the `_.matchesProperty` callback shorthand + * _.findIndex(users, 'active', false); + * // => 0 + * + * // using the `_.property` callback shorthand + * _.findIndex(users, 'active'); + * // => 2 + */ +function findIndex(array, predicate, thisArg) { + var index = -1, + length = array ? array.length : 0; + + predicate = baseCallback(predicate, thisArg, 3); + while (++index < length) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + +module.exports = findIndex; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/findLastIndex.js b/node_modules/gulp-shell/node_modules/lodash/array/findLastIndex.js new file mode 100644 index 0000000000..7fdcc4ade9 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/findLastIndex.js @@ -0,0 +1,62 @@ +var baseCallback = require('../internal/baseCallback'); + +/** + * This method is like `_.findIndex` except that it iterates over elements + * of `collection` from right to left. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.findLastIndex(users, function(chr) { + * return chr.user == 'pebbles'; + * }); + * // => 2 + * + * // using the `_.matches` callback shorthand + * _.findLastIndex(users, { 'user': 'barney', 'active': true }); + * // => 0 + * + * // using the `_.matchesProperty` callback shorthand + * _.findLastIndex(users, 'active', false); + * // => 2 + * + * // using the `_.property` callback shorthand + * _.findLastIndex(users, 'active'); + * // => 0 + */ +function findLastIndex(array, predicate, thisArg) { + var length = array ? array.length : 0; + predicate = baseCallback(predicate, thisArg, 3); + while (length--) { + if (predicate(array[length], length, array)) { + return length; + } + } + return -1; +} + +module.exports = findLastIndex; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/first.js b/node_modules/gulp-shell/node_modules/lodash/array/first.js new file mode 100644 index 0000000000..b3b9c79c7b --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/first.js @@ -0,0 +1,22 @@ +/** + * Gets the first element of `array`. + * + * @static + * @memberOf _ + * @alias head + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the first element of `array`. + * @example + * + * _.first([1, 2, 3]); + * // => 1 + * + * _.first([]); + * // => undefined + */ +function first(array) { + return array ? array[0] : undefined; +} + +module.exports = first; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/flatten.js b/node_modules/gulp-shell/node_modules/lodash/array/flatten.js new file mode 100644 index 0000000000..4460c2db6e --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/flatten.js @@ -0,0 +1,32 @@ +var baseFlatten = require('../internal/baseFlatten'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Flattens a nested array. If `isDeep` is `true` the array is recursively + * flattened, otherwise it is only flattened a single level. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to flatten. + * @param {boolean} [isDeep] Specify a deep flatten. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, 3, [4]]]); + * // => [1, 2, 3, [4]]; + * + * // using `isDeep` + * _.flatten([1, [2, 3, [4]]], true); + * // => [1, 2, 3, 4]; + */ +function flatten(array, isDeep, guard) { + var length = array ? array.length : 0; + if (guard && isIterateeCall(array, isDeep, guard)) { + isDeep = false; + } + return length ? baseFlatten(array, isDeep, false, 0) : []; +} + +module.exports = flatten; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/flattenDeep.js b/node_modules/gulp-shell/node_modules/lodash/array/flattenDeep.js new file mode 100644 index 0000000000..ae498bb5b6 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/flattenDeep.js @@ -0,0 +1,21 @@ +var baseFlatten = require('../internal/baseFlatten'); + +/** + * Recursively flattens a nested array. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to recursively flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flattenDeep([1, [2, 3, [4]]]); + * // => [1, 2, 3, 4]; + */ +function flattenDeep(array) { + var length = array ? array.length : 0; + return length ? baseFlatten(array, true, false, 0) : []; +} + +module.exports = flattenDeep; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/head.js b/node_modules/gulp-shell/node_modules/lodash/array/head.js new file mode 100644 index 0000000000..1961b08c7e --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/head.js @@ -0,0 +1 @@ +module.exports = require('./first'); diff --git a/node_modules/gulp-shell/node_modules/lodash/array/indexOf.js b/node_modules/gulp-shell/node_modules/lodash/array/indexOf.js new file mode 100644 index 0000000000..b6d2a7d0ae --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/indexOf.js @@ -0,0 +1,58 @@ +var baseIndexOf = require('../internal/baseIndexOf'), + binaryIndex = require('../internal/binaryIndex'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Gets the index at which the first occurrence of `value` is found in `array` + * using `SameValueZero` for equality comparisons. If `fromIndex` is negative, + * it is used as the offset from the end of `array`. If `array` is sorted + * providing `true` for `fromIndex` performs a faster binary search. + * + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for more details. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {boolean|number} [fromIndex=0] The index to search from or `true` + * to perform a binary search on a sorted array. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + * + * // performing a binary search + * _.indexOf([1, 1, 2, 2], 2, true); + * // => 2 + */ +function indexOf(array, value, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + if (typeof fromIndex == 'number') { + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; + } else if (fromIndex) { + var index = binaryIndex(array, value), + other = array[index]; + + if (value === value ? (value === other) : (other !== other)) { + return index; + } + return -1; + } + return baseIndexOf(array, value, fromIndex || 0); +} + +module.exports = indexOf; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/initial.js b/node_modules/gulp-shell/node_modules/lodash/array/initial.js new file mode 100644 index 0000000000..59b7a7d96d --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/initial.js @@ -0,0 +1,20 @@ +var dropRight = require('./dropRight'); + +/** + * Gets all but the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.initial([1, 2, 3]); + * // => [1, 2] + */ +function initial(array) { + return dropRight(array, 1); +} + +module.exports = initial; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/intersection.js b/node_modules/gulp-shell/node_modules/lodash/array/intersection.js new file mode 100644 index 0000000000..bc7c8036e6 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/intersection.js @@ -0,0 +1,67 @@ +var baseIndexOf = require('../internal/baseIndexOf'), + cacheIndexOf = require('../internal/cacheIndexOf'), + createCache = require('../internal/createCache'), + isArguments = require('../lang/isArguments'), + isArray = require('../lang/isArray'); + +/** + * Creates an array of unique values in all provided arrays using `SameValueZero` + * for equality comparisons. + * + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for more details. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of shared values. + * @example + * _.intersection([1, 2], [4, 2], [2, 1]); + * // => [2] + */ +function intersection() { + var args = [], + argsIndex = -1, + argsLength = arguments.length, + caches = [], + indexOf = baseIndexOf, + isCommon = true; + + while (++argsIndex < argsLength) { + var value = arguments[argsIndex]; + if (isArray(value) || isArguments(value)) { + args.push(value); + caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null); + } + } + argsLength = args.length; + var array = args[0], + index = -1, + length = array ? array.length : 0, + result = [], + seen = caches[0]; + + outer: + while (++index < length) { + value = array[index]; + if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) { + argsIndex = argsLength; + while (--argsIndex) { + var cache = caches[argsIndex]; + if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value, 0)) < 0) { + continue outer; + } + } + if (seen) { + seen.push(value); + } + result.push(value); + } + } + return result; +} + +module.exports = intersection; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/last.js b/node_modules/gulp-shell/node_modules/lodash/array/last.js new file mode 100644 index 0000000000..299af3146c --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/last.js @@ -0,0 +1,19 @@ +/** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ +function last(array) { + var length = array ? array.length : 0; + return length ? array[length - 1] : undefined; +} + +module.exports = last; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/lastIndexOf.js b/node_modules/gulp-shell/node_modules/lodash/array/lastIndexOf.js new file mode 100644 index 0000000000..02b806269b --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/lastIndexOf.js @@ -0,0 +1,60 @@ +var binaryIndex = require('../internal/binaryIndex'), + indexOfNaN = require('../internal/indexOfNaN'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/** + * This method is like `_.indexOf` except that it iterates over elements of + * `array` from right to left. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {boolean|number} [fromIndex=array.length-1] The index to search from + * or `true` to perform a binary search on a sorted array. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.lastIndexOf([1, 2, 1, 2], 2); + * // => 3 + * + * // using `fromIndex` + * _.lastIndexOf([1, 2, 1, 2], 2, 2); + * // => 1 + * + * // performing a binary search + * _.lastIndexOf([1, 1, 2, 2], 2, true); + * // => 3 + */ +function lastIndexOf(array, value, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + var index = length; + if (typeof fromIndex == 'number') { + index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1; + } else if (fromIndex) { + index = binaryIndex(array, value, true) - 1; + var other = array[index]; + if (value === value ? (value === other) : (other !== other)) { + return index; + } + return -1; + } + if (value !== value) { + return indexOfNaN(array, index, true); + } + while (index--) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +module.exports = lastIndexOf; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/object.js b/node_modules/gulp-shell/node_modules/lodash/array/object.js new file mode 100644 index 0000000000..f4a34531b1 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/object.js @@ -0,0 +1 @@ +module.exports = require('./zipObject'); diff --git a/node_modules/gulp-shell/node_modules/lodash/array/pull.js b/node_modules/gulp-shell/node_modules/lodash/array/pull.js new file mode 100644 index 0000000000..11e43a3e50 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/pull.js @@ -0,0 +1,55 @@ +var baseIndexOf = require('../internal/baseIndexOf'); + +/** Used for native method references. */ +var arrayProto = Array.prototype; + +/** Native method references. */ +var splice = arrayProto.splice; + +/** + * Removes all provided values from `array` using `SameValueZero` for equality + * comparisons. + * + * **Notes:** + * - Unlike `_.without`, this method mutates `array`. + * - `SameValueZero` comparisons are like strict equality comparisons, e.g. `===`, + * except that `NaN` matches `NaN`. See the [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for more details. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {...*} [values] The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, 2, 3); + * console.log(array); + * // => [1, 1] + */ +function pull() { + var args = arguments, + array = args[0]; + + if (!(array && array.length)) { + return array; + } + var index = 0, + indexOf = baseIndexOf, + length = args.length; + + while (++index < length) { + var fromIndex = 0, + value = args[index]; + + while ((fromIndex = indexOf(array, value, fromIndex)) > -1) { + splice.call(array, fromIndex, 1); + } + } + return array; +} + +module.exports = pull; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/pullAt.js b/node_modules/gulp-shell/node_modules/lodash/array/pullAt.js new file mode 100644 index 0000000000..706e73cf9a --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/pullAt.js @@ -0,0 +1,33 @@ +var baseFlatten = require('../internal/baseFlatten'), + basePullAt = require('../internal/basePullAt'); + +/** + * Removes elements from `array` corresponding to the given indexes and returns + * an array of the removed elements. Indexes may be specified as an array of + * indexes or as individual arguments. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {...(number|number[])} [indexes] The indexes of elements to remove, + * specified as individual indexes or arrays of indexes. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [5, 10, 15, 20]; + * var evens = _.pullAt(array, 1, 3); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ +function pullAt(array) { + return basePullAt(array || [], baseFlatten(arguments, false, false, 1)); +} + +module.exports = pullAt; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/remove.js b/node_modules/gulp-shell/node_modules/lodash/array/remove.js new file mode 100644 index 0000000000..52fc526e56 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/remove.js @@ -0,0 +1,65 @@ +var baseCallback = require('../internal/baseCallback'); + +/** Used for native method references. */ +var arrayProto = Array.prototype; + +/** Native method references. */ +var splice = arrayProto.splice; + +/** + * Removes all elements from `array` that `predicate` returns truthy for + * and returns an array of the removed elements. The predicate is bound to + * `thisArg` and invoked with three arguments; (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * **Note:** Unlike `_.filter`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [1, 2, 3, 4]; + * var evens = _.remove(array, function(n) { + * return n % 2 == 0; + * }); + * + * console.log(array); + * // => [1, 3] + * + * console.log(evens); + * // => [2, 4] + */ +function remove(array, predicate, thisArg) { + var index = -1, + length = array ? array.length : 0, + result = []; + + predicate = baseCallback(predicate, thisArg, 3); + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result.push(value); + splice.call(array, index--, 1); + length--; + } + } + return result; +} + +module.exports = remove; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/rest.js b/node_modules/gulp-shell/node_modules/lodash/array/rest.js new file mode 100644 index 0000000000..9bfb734f1f --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/rest.js @@ -0,0 +1,21 @@ +var drop = require('./drop'); + +/** + * Gets all but the first element of `array`. + * + * @static + * @memberOf _ + * @alias tail + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.rest([1, 2, 3]); + * // => [2, 3] + */ +function rest(array) { + return drop(array, 1); +} + +module.exports = rest; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/slice.js b/node_modules/gulp-shell/node_modules/lodash/array/slice.js new file mode 100644 index 0000000000..ee6fb7395e --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/slice.js @@ -0,0 +1,30 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` from `start` up to, but not including, `end`. + * + * **Note:** This function is used instead of `Array#slice` to support node + * lists in IE < 9 and to ensure dense arrays are returned. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ +function slice(array, start, end) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + return baseSlice(array, start, end); +} + +module.exports = slice; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/sortedIndex.js b/node_modules/gulp-shell/node_modules/lodash/array/sortedIndex.js new file mode 100644 index 0000000000..fdc5e305e7 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/sortedIndex.js @@ -0,0 +1,59 @@ +var baseCallback = require('../internal/baseCallback'), + binaryIndex = require('../internal/binaryIndex'), + binaryIndexBy = require('../internal/binaryIndexBy'); + +/** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. If an iteratee + * function is provided it is invoked for `value` and each element of `array` + * to compute their sort ranking. The iteratee is bound to `thisArg` and + * invoked with one argument; (value). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 4, 5, 5], 5); + * // => 2 + * + * var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } }; + * + * // using an iteratee function + * _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) { + * return this.data[word]; + * }, dict); + * // => 1 + * + * // using the `_.property` callback shorthand + * _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); + * // => 1 + */ +function sortedIndex(array, value, iteratee, thisArg) { + return iteratee == null + ? binaryIndex(array, value) + : binaryIndexBy(array, value, baseCallback(iteratee, thisArg, 1)); +} + +module.exports = sortedIndex; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/sortedLastIndex.js b/node_modules/gulp-shell/node_modules/lodash/array/sortedLastIndex.js new file mode 100644 index 0000000000..6936d4e6cf --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/sortedLastIndex.js @@ -0,0 +1,31 @@ +var baseCallback = require('../internal/baseCallback'), + binaryIndex = require('../internal/binaryIndex'), + binaryIndexBy = require('../internal/binaryIndexBy'); + +/** + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedLastIndex([4, 4, 5, 5], 5); + * // => 4 + */ +function sortedLastIndex(array, value, iteratee, thisArg) { + return iteratee == null + ? binaryIndex(array, value, true) + : binaryIndexBy(array, value, baseCallback(iteratee, thisArg, 1), true); +} + +module.exports = sortedLastIndex; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/tail.js b/node_modules/gulp-shell/node_modules/lodash/array/tail.js new file mode 100644 index 0000000000..c5dfe779d6 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/tail.js @@ -0,0 +1 @@ +module.exports = require('./rest'); diff --git a/node_modules/gulp-shell/node_modules/lodash/array/take.js b/node_modules/gulp-shell/node_modules/lodash/array/take.js new file mode 100644 index 0000000000..875917a746 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/take.js @@ -0,0 +1,39 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` with `n` elements taken from the beginning. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.take([1, 2, 3]); + * // => [1] + * + * _.take([1, 2, 3], 2); + * // => [1, 2] + * + * _.take([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.take([1, 2, 3], 0); + * // => [] + */ +function take(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + return baseSlice(array, 0, n < 0 ? 0 : n); +} + +module.exports = take; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/takeRight.js b/node_modules/gulp-shell/node_modules/lodash/array/takeRight.js new file mode 100644 index 0000000000..6e89c87480 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/takeRight.js @@ -0,0 +1,40 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` with `n` elements taken from the end. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeRight([1, 2, 3]); + * // => [3] + * + * _.takeRight([1, 2, 3], 2); + * // => [2, 3] + * + * _.takeRight([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.takeRight([1, 2, 3], 0); + * // => [] + */ +function takeRight(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + n = length - (+n || 0); + return baseSlice(array, n < 0 ? 0 : n); +} + +module.exports = takeRight; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/takeRightWhile.js b/node_modules/gulp-shell/node_modules/lodash/array/takeRightWhile.js new file mode 100644 index 0000000000..57bb0ef066 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/takeRightWhile.js @@ -0,0 +1,63 @@ +var baseCallback = require('../internal/baseCallback'), + baseSlice = require('../internal/baseSlice'); + +/** + * Creates a slice of `array` with elements taken from the end. Elements are + * taken until `predicate` returns falsey. The predicate is bound to `thisArg` + * and invoked with three arguments; (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeRightWhile([1, 2, 3], function(n) { + * return n > 1; + * }); + * // => [2, 3] + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user'); + * // => ['pebbles'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.takeRightWhile(users, 'active', false), 'user'); + * // => ['fred', 'pebbles'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.takeRightWhile(users, 'active'), 'user'); + * // => [] + */ +function takeRightWhile(array, predicate, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + predicate = baseCallback(predicate, thisArg, 3); + while (length-- && predicate(array[length], length, array)) {} + return baseSlice(array, length + 1); +} + +module.exports = takeRightWhile; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/takeWhile.js b/node_modules/gulp-shell/node_modules/lodash/array/takeWhile.js new file mode 100644 index 0000000000..890e34a602 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/takeWhile.js @@ -0,0 +1,64 @@ +var baseCallback = require('../internal/baseCallback'), + baseSlice = require('../internal/baseSlice'); + +/** + * Creates a slice of `array` with elements taken from the beginning. Elements + * are taken until `predicate` returns falsey. The predicate is bound to + * `thisArg` and invoked with three arguments; (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeWhile([1, 2, 3], function(n) { + * return n < 3; + * }); + * // => [1, 2] + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false}, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.takeWhile(users, 'active', false), 'user'); + * // => ['barney', 'fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.takeWhile(users, 'active'), 'user'); + * // => [] + */ +function takeWhile(array, predicate, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + var index = -1; + predicate = baseCallback(predicate, thisArg, 3); + while (++index < length && predicate(array[index], index, array)) {} + return baseSlice(array, 0, index); +} + +module.exports = takeWhile; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/union.js b/node_modules/gulp-shell/node_modules/lodash/array/union.js new file mode 100644 index 0000000000..bb78dac34c --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/union.js @@ -0,0 +1,27 @@ +var baseFlatten = require('../internal/baseFlatten'), + baseUniq = require('../internal/baseUniq'); + +/** + * Creates an array of unique values, in order, of the provided arrays using + * `SameValueZero` for equality comparisons. + * + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for more details. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.union([1, 2], [4, 2], [2, 1]); + * // => [1, 2, 4] + */ +function union() { + return baseUniq(baseFlatten(arguments, false, true, 0)); +} + +module.exports = union; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/uniq.js b/node_modules/gulp-shell/node_modules/lodash/array/uniq.js new file mode 100644 index 0000000000..6b30328091 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/uniq.js @@ -0,0 +1,74 @@ +var baseCallback = require('../internal/baseCallback'), + baseUniq = require('../internal/baseUniq'), + isIterateeCall = require('../internal/isIterateeCall'), + sortedUniq = require('../internal/sortedUniq'); + +/** + * Creates a duplicate-value-free version of an array using `SameValueZero` + * for equality comparisons. Providing `true` for `isSorted` performs a faster + * search algorithm for sorted arrays. If an iteratee function is provided it + * is invoked for each value in the array to generate the criterion by which + * uniqueness is computed. The `iteratee` is bound to `thisArg` and invoked + * with three arguments; (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for more details. + * + * @static + * @memberOf _ + * @alias unique + * @category Array + * @param {Array} array The array to inspect. + * @param {boolean} [isSorted] Specify the array is sorted. + * @param {Function|Object|string} [iteratee] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new duplicate-value-free array. + * @example + * + * _.uniq([1, 2, 1]); + * // => [1, 2] + * + * // using `isSorted` + * _.uniq([1, 1, 2], true); + * // => [1, 2] + * + * // using an iteratee function + * _.uniq([1, 2.5, 1.5, 2], function(n) { + * return this.floor(n); + * }, Math); + * // => [1, 2.5] + * + * // using the `_.property` callback shorthand + * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ +function uniq(array, isSorted, iteratee, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (isSorted != null && typeof isSorted != 'boolean') { + thisArg = iteratee; + iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted; + isSorted = false; + } + iteratee = iteratee == null ? iteratee : baseCallback(iteratee, thisArg, 3); + return (isSorted) + ? sortedUniq(array, iteratee) + : baseUniq(array, iteratee); +} + +module.exports = uniq; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/unique.js b/node_modules/gulp-shell/node_modules/lodash/array/unique.js new file mode 100644 index 0000000000..396de1b804 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/unique.js @@ -0,0 +1 @@ +module.exports = require('./uniq'); diff --git a/node_modules/gulp-shell/node_modules/lodash/array/unzip.js b/node_modules/gulp-shell/node_modules/lodash/array/unzip.js new file mode 100644 index 0000000000..f7f8558481 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/unzip.js @@ -0,0 +1,37 @@ +var arrayMap = require('../internal/arrayMap'), + arrayMax = require('../internal/arrayMax'), + baseProperty = require('../internal/baseProperty'); + +/** Used to the length of n-tuples for `_.unzip`. */ +var getLength = baseProperty('length'); + +/** + * This method is like `_.zip` except that it accepts an array of grouped + * elements and creates an array regrouping the elements to their pre-`_.zip` + * configuration. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array of grouped elements to process. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]); + * // => [['fred', 30, true], ['barney', 40, false]] + * + * _.unzip(zipped); + * // => [['fred', 'barney'], [30, 40], [true, false]] + */ +function unzip(array) { + var index = -1, + length = (array && array.length && arrayMax(arrayMap(array, getLength))) >>> 0, + result = Array(length); + + while (++index < length) { + result[index] = arrayMap(array, baseProperty(index)); + } + return result; +} + +module.exports = unzip; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/without.js b/node_modules/gulp-shell/node_modules/lodash/array/without.js new file mode 100644 index 0000000000..e74c40396d --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/without.js @@ -0,0 +1,28 @@ +var baseDifference = require('../internal/baseDifference'), + baseSlice = require('../internal/baseSlice'); + +/** + * Creates an array excluding all provided values using `SameValueZero` for + * equality comparisons. + * + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for more details. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to filter. + * @param {...*} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.without([1, 2, 1, 3], 1, 2); + * // => [3] + */ +function without(array) { + return baseDifference(array, baseSlice(arguments, 1)); +} + +module.exports = without; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/xor.js b/node_modules/gulp-shell/node_modules/lodash/array/xor.js new file mode 100644 index 0000000000..fcdec8eb5b --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/xor.js @@ -0,0 +1,36 @@ +var baseDifference = require('../internal/baseDifference'), + baseUniq = require('../internal/baseUniq'), + isArguments = require('../lang/isArguments'), + isArray = require('../lang/isArray'); + +/** + * Creates an array that is the symmetric difference of the provided arrays. + * See [Wikipedia](https://en.wikipedia.org/wiki/Symmetric_difference) for + * more details. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of values. + * @example + * + * _.xor([1, 2], [4, 2]); + * // => [1, 4] + */ +function xor() { + var index = -1, + length = arguments.length; + + while (++index < length) { + var array = arguments[index]; + if (isArray(array) || isArguments(array)) { + var result = result + ? baseDifference(result, array).concat(baseDifference(array, result)) + : array; + } + } + return result ? baseUniq(result) : []; +} + +module.exports = xor; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/zip.js b/node_modules/gulp-shell/node_modules/lodash/array/zip.js new file mode 100644 index 0000000000..039bac0a96 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/zip.js @@ -0,0 +1,28 @@ +var unzip = require('./unzip'); + +/** + * Creates an array of grouped elements, the first of which contains the first + * elements of the given arrays, the second of which contains the second elements + * of the given arrays, and so on. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zip(['fred', 'barney'], [30, 40], [true, false]); + * // => [['fred', 30, true], ['barney', 40, false]] + */ +function zip() { + var length = arguments.length, + array = Array(length); + + while (length--) { + array[length] = arguments[length]; + } + return unzip(array); +} + +module.exports = zip; diff --git a/node_modules/gulp-shell/node_modules/lodash/array/zipObject.js b/node_modules/gulp-shell/node_modules/lodash/array/zipObject.js new file mode 100644 index 0000000000..bc3f9522ee --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/array/zipObject.js @@ -0,0 +1,39 @@ +var isArray = require('../lang/isArray'); + +/** + * Creates an object composed from arrays of property names and values. Provide + * either a single two dimensional array, e.g. `[[key1, value1], [key2, value2]]` + * or two arrays, one of property names and one of corresponding values. + * + * @static + * @memberOf _ + * @alias object + * @category Array + * @param {Array} props The property names. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObject(['fred', 'barney'], [30, 40]); + * // => { 'fred': 30, 'barney': 40 } + */ +function zipObject(props, values) { + var index = -1, + length = props ? props.length : 0, + result = {}; + + if (length && !values && !isArray(props[0])) { + values = []; + } + while (++index < length) { + var key = props[index]; + if (values) { + result[key] = values[index]; + } else if (key) { + result[key[0]] = key[1]; + } + } + return result; +} + +module.exports = zipObject; diff --git a/node_modules/gulp-shell/node_modules/lodash/chain.js b/node_modules/gulp-shell/node_modules/lodash/chain.js new file mode 100644 index 0000000000..7992b733e2 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain.js @@ -0,0 +1,15 @@ +module.exports = { + 'chain': require('./chain/chain'), + 'commit': require('./chain/commit'), + 'lodash': require('./chain/lodash'), + 'plant': require('./chain/plant'), + 'reverse': require('./chain/reverse'), + 'run': require('./chain/run'), + 'tap': require('./chain/tap'), + 'thru': require('./chain/thru'), + 'toJSON': require('./chain/toJSON'), + 'toString': require('./chain/toString'), + 'value': require('./chain/value'), + 'valueOf': require('./chain/valueOf'), + 'wrapperChain': require('./chain/wrapperChain') +}; diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/chain.js b/node_modules/gulp-shell/node_modules/lodash/chain/chain.js new file mode 100644 index 0000000000..453ba1eb5e --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/chain.js @@ -0,0 +1,35 @@ +var lodash = require('./lodash'); + +/** + * Creates a `lodash` object that wraps `value` with explicit method + * chaining enabled. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to wrap. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'pebbles', 'age': 1 } + * ]; + * + * var youngest = _.chain(users) + * .sortBy('age') + * .map(function(chr) { + * return chr.user + ' is ' + chr.age; + * }) + * .first() + * .value(); + * // => 'pebbles is 1' + */ +function chain(value) { + var result = lodash(value); + result.__chain__ = true; + return result; +} + +module.exports = chain; diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/commit.js b/node_modules/gulp-shell/node_modules/lodash/chain/commit.js new file mode 100644 index 0000000000..c732d1bf91 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/commit.js @@ -0,0 +1 @@ +module.exports = require('./wrapperCommit'); diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/lodash.js b/node_modules/gulp-shell/node_modules/lodash/chain/lodash.js new file mode 100644 index 0000000000..8ac40aeecd --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/lodash.js @@ -0,0 +1,122 @@ +var LazyWrapper = require('../internal/LazyWrapper'), + LodashWrapper = require('../internal/LodashWrapper'), + baseLodash = require('../internal/baseLodash'), + isArray = require('../lang/isArray'), + isObjectLike = require('../internal/isObjectLike'), + wrapperClone = require('../internal/wrapperClone'); + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Creates a `lodash` object which wraps `value` to enable implicit chaining. + * Methods that operate on and return arrays, collections, and functions can + * be chained together. Methods that return a boolean or single value will + * automatically end the chain returning the unwrapped value. Explicit chaining + * may be enabled using `_.chain`. The execution of chained methods is lazy, + * that is, execution is deferred until `_#value` is implicitly or explicitly + * called. + * + * Lazy evaluation allows several methods to support shortcut fusion. Shortcut + * fusion is an optimization that merges iteratees to avoid creating intermediate + * arrays and reduce the number of iteratee executions. + * + * Chaining is supported in custom builds as long as the `_#value` method is + * directly or indirectly included in the build. + * + * In addition to lodash methods, wrappers have `Array` and `String` methods. + * + * The wrapper `Array` methods are: + * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, + * `splice`, and `unshift` + * + * The wrapper `String` methods are: + * `replace` and `split` + * + * The wrapper methods that support shortcut fusion are: + * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, + * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`, + * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`, + * and `where` + * + * The chainable wrapper methods are: + * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`, + * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`, + * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`, + * `difference`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `fill`, + * `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`, + * `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, + * `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, + * `keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`, `memoize`, `merge`, + * `mixin`, `negate`, `noop`, `omit`, `once`, `pairs`, `partial`, `partialRight`, + * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`, + * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `reverse`, + * `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`, + * `spread`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, + * `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, `transform`, + * `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`, `where`, + * `without`, `wrap`, `xor`, `zip`, and `zipObject` + * + * The wrapper methods that are **not** chainable by default are: + * `add`, `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`, + * `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, + * `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `has`, + * `identity`, `includes`, `indexOf`, `inRange`, `isArguments`, `isArray`, + * `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, + * `isFinite`,`isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`, + * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, + * `isTypedArray`, `join`, `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, + * `noConflict`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, + * `random`, `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, + * `shift`, `size`, `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, + * `startCase`, `startsWith`, `sum`, `template`, `trim`, `trimLeft`, + * `trimRight`, `trunc`, `unescape`, `uniqueId`, `value`, and `words` + * + * The wrapper method `sample` will return a wrapped value when `n` is provided, + * otherwise an unwrapped value is returned. + * + * @name _ + * @constructor + * @category Chain + * @param {*} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var wrapped = _([1, 2, 3]); + * + * // returns an unwrapped value + * wrapped.reduce(function(sum, n) { + * return sum + n; + * }); + * // => 6 + * + * // returns a wrapped value + * var squares = wrapped.map(function(n) { + * return n * n; + * }); + * + * _.isArray(squares); + * // => false + * + * _.isArray(squares.value()); + * // => true + */ +function lodash(value) { + if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { + if (value instanceof LodashWrapper) { + return value; + } + if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) { + return wrapperClone(value); + } + } + return new LodashWrapper(value); +} + +// Ensure wrappers are instances of `baseLodash`. +lodash.prototype = baseLodash.prototype; + +module.exports = lodash; diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/plant.js b/node_modules/gulp-shell/node_modules/lodash/chain/plant.js new file mode 100644 index 0000000000..04099f2386 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/plant.js @@ -0,0 +1 @@ +module.exports = require('./wrapperPlant'); diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/reverse.js b/node_modules/gulp-shell/node_modules/lodash/chain/reverse.js new file mode 100644 index 0000000000..f72a64a19b --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/reverse.js @@ -0,0 +1 @@ +module.exports = require('./wrapperReverse'); diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/run.js b/node_modules/gulp-shell/node_modules/lodash/chain/run.js new file mode 100644 index 0000000000..5e751a2c32 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/run.js @@ -0,0 +1 @@ +module.exports = require('./wrapperValue'); diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/tap.js b/node_modules/gulp-shell/node_modules/lodash/chain/tap.js new file mode 100644 index 0000000000..3d0257ecfd --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/tap.js @@ -0,0 +1,29 @@ +/** + * This method invokes `interceptor` and returns `value`. The interceptor is + * bound to `thisArg` and invoked with one argument; (value). The purpose of + * this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @param {*} [thisArg] The `this` binding of `interceptor`. + * @returns {*} Returns `value`. + * @example + * + * _([1, 2, 3]) + * .tap(function(array) { + * array.pop(); + * }) + * .reverse() + * .value(); + * // => [2, 1] + */ +function tap(value, interceptor, thisArg) { + interceptor.call(thisArg, value); + return value; +} + +module.exports = tap; diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/thru.js b/node_modules/gulp-shell/node_modules/lodash/chain/thru.js new file mode 100644 index 0000000000..8ccc996966 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/thru.js @@ -0,0 +1,25 @@ +/** + * This method is like `_.tap` except that it returns the result of `interceptor`. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @param {*} [thisArg] The `this` binding of `interceptor`. + * @returns {*} Returns the result of `interceptor`. + * @example + * + * _([1, 2, 3]) + * .last() + * .thru(function(value) { + * return [value]; + * }) + * .value(); + * // => [3] + */ +function thru(value, interceptor, thisArg) { + return interceptor.call(thisArg, value); +} + +module.exports = thru; diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/toJSON.js b/node_modules/gulp-shell/node_modules/lodash/chain/toJSON.js new file mode 100644 index 0000000000..5e751a2c32 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/toJSON.js @@ -0,0 +1 @@ +module.exports = require('./wrapperValue'); diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/toString.js b/node_modules/gulp-shell/node_modules/lodash/chain/toString.js new file mode 100644 index 0000000000..c7bcbf9a54 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/toString.js @@ -0,0 +1 @@ +module.exports = require('./wrapperToString'); diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/value.js b/node_modules/gulp-shell/node_modules/lodash/chain/value.js new file mode 100644 index 0000000000..5e751a2c32 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/value.js @@ -0,0 +1 @@ +module.exports = require('./wrapperValue'); diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/valueOf.js b/node_modules/gulp-shell/node_modules/lodash/chain/valueOf.js new file mode 100644 index 0000000000..5e751a2c32 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/valueOf.js @@ -0,0 +1 @@ +module.exports = require('./wrapperValue'); diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/wrapperChain.js b/node_modules/gulp-shell/node_modules/lodash/chain/wrapperChain.js new file mode 100644 index 0000000000..38234819ba --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/wrapperChain.js @@ -0,0 +1,32 @@ +var chain = require('./chain'); + +/** + * Enables explicit method chaining on the wrapper object. + * + * @name chain + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // without explicit chaining + * _(users).first(); + * // => { 'user': 'barney', 'age': 36 } + * + * // with explicit chaining + * _(users).chain() + * .first() + * .pick('user') + * .value(); + * // => { 'user': 'barney' } + */ +function wrapperChain() { + return chain(this); +} + +module.exports = wrapperChain; diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/wrapperCommit.js b/node_modules/gulp-shell/node_modules/lodash/chain/wrapperCommit.js new file mode 100644 index 0000000000..c46a787e97 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/wrapperCommit.js @@ -0,0 +1,32 @@ +var LodashWrapper = require('../internal/LodashWrapper'); + +/** + * Executes the chained sequence and returns the wrapped result. + * + * @name commit + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapper = _(array).push(3); + * + * console.log(array); + * // => [1, 2] + * + * wrapper = wrapper.commit(); + * console.log(array); + * // => [1, 2, 3] + * + * wrapper.last(); + * // => 3 + * + * console.log(array); + * // => [1, 2, 3] + */ +function wrapperCommit() { + return new LodashWrapper(this.value(), this.__chain__); +} + +module.exports = wrapperCommit; diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/wrapperPlant.js b/node_modules/gulp-shell/node_modules/lodash/chain/wrapperPlant.js new file mode 100644 index 0000000000..a3de146b13 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/wrapperPlant.js @@ -0,0 +1,45 @@ +var baseLodash = require('../internal/baseLodash'), + wrapperClone = require('../internal/wrapperClone'); + +/** + * Creates a clone of the chained sequence planting `value` as the wrapped value. + * + * @name plant + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapper = _(array).map(function(value) { + * return Math.pow(value, 2); + * }); + * + * var other = [3, 4]; + * var otherWrapper = wrapper.plant(other); + * + * otherWrapper.value(); + * // => [9, 16] + * + * wrapper.value(); + * // => [1, 4] + */ +function wrapperPlant(value) { + var result, + parent = this; + + while (parent instanceof baseLodash) { + var clone = wrapperClone(parent); + if (result) { + previous.__wrapped__ = clone; + } else { + result = clone; + } + var previous = clone; + parent = parent.__wrapped__; + } + previous.__wrapped__ = value; + return result; +} + +module.exports = wrapperPlant; diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/wrapperReverse.js b/node_modules/gulp-shell/node_modules/lodash/chain/wrapperReverse.js new file mode 100644 index 0000000000..4518b3ed28 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/wrapperReverse.js @@ -0,0 +1,38 @@ +var LazyWrapper = require('../internal/LazyWrapper'), + LodashWrapper = require('../internal/LodashWrapper'), + thru = require('./thru'); + +/** + * Reverses the wrapped array so the first element becomes the last, the + * second element becomes the second to last, and so on. + * + * **Note:** This method mutates the wrapped array. + * + * @name reverse + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new reversed `lodash` wrapper instance. + * @example + * + * var array = [1, 2, 3]; + * + * _(array).reverse().value() + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ +function wrapperReverse() { + var value = this.__wrapped__; + if (value instanceof LazyWrapper) { + if (this.__actions__.length) { + value = new LazyWrapper(this); + } + return new LodashWrapper(value.reverse(), this.__chain__); + } + return this.thru(function(value) { + return value.reverse(); + }); +} + +module.exports = wrapperReverse; diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/wrapperToString.js b/node_modules/gulp-shell/node_modules/lodash/chain/wrapperToString.js new file mode 100644 index 0000000000..db975a5a35 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/wrapperToString.js @@ -0,0 +1,17 @@ +/** + * Produces the result of coercing the unwrapped value to a string. + * + * @name toString + * @memberOf _ + * @category Chain + * @returns {string} Returns the coerced string value. + * @example + * + * _([1, 2, 3]).toString(); + * // => '1,2,3' + */ +function wrapperToString() { + return (this.value() + ''); +} + +module.exports = wrapperToString; diff --git a/node_modules/gulp-shell/node_modules/lodash/chain/wrapperValue.js b/node_modules/gulp-shell/node_modules/lodash/chain/wrapperValue.js new file mode 100644 index 0000000000..2734e41c4a --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/chain/wrapperValue.js @@ -0,0 +1,20 @@ +var baseWrapperValue = require('../internal/baseWrapperValue'); + +/** + * Executes the chained sequence to extract the unwrapped value. + * + * @name value + * @memberOf _ + * @alias run, toJSON, valueOf + * @category Chain + * @returns {*} Returns the resolved unwrapped value. + * @example + * + * _([1, 2, 3]).value(); + * // => [1, 2, 3] + */ +function wrapperValue() { + return baseWrapperValue(this.__wrapped__, this.__actions__); +} + +module.exports = wrapperValue; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection.js b/node_modules/gulp-shell/node_modules/lodash/collection.js new file mode 100644 index 0000000000..03388571c3 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection.js @@ -0,0 +1,44 @@ +module.exports = { + 'all': require('./collection/all'), + 'any': require('./collection/any'), + 'at': require('./collection/at'), + 'collect': require('./collection/collect'), + 'contains': require('./collection/contains'), + 'countBy': require('./collection/countBy'), + 'detect': require('./collection/detect'), + 'each': require('./collection/each'), + 'eachRight': require('./collection/eachRight'), + 'every': require('./collection/every'), + 'filter': require('./collection/filter'), + 'find': require('./collection/find'), + 'findLast': require('./collection/findLast'), + 'findWhere': require('./collection/findWhere'), + 'foldl': require('./collection/foldl'), + 'foldr': require('./collection/foldr'), + 'forEach': require('./collection/forEach'), + 'forEachRight': require('./collection/forEachRight'), + 'groupBy': require('./collection/groupBy'), + 'include': require('./collection/include'), + 'includes': require('./collection/includes'), + 'indexBy': require('./collection/indexBy'), + 'inject': require('./collection/inject'), + 'invoke': require('./collection/invoke'), + 'map': require('./collection/map'), + 'max': require('./math/max'), + 'min': require('./math/min'), + 'partition': require('./collection/partition'), + 'pluck': require('./collection/pluck'), + 'reduce': require('./collection/reduce'), + 'reduceRight': require('./collection/reduceRight'), + 'reject': require('./collection/reject'), + 'sample': require('./collection/sample'), + 'select': require('./collection/select'), + 'shuffle': require('./collection/shuffle'), + 'size': require('./collection/size'), + 'some': require('./collection/some'), + 'sortBy': require('./collection/sortBy'), + 'sortByAll': require('./collection/sortByAll'), + 'sortByOrder': require('./collection/sortByOrder'), + 'sum': require('./math/sum'), + 'where': require('./collection/where') +}; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/all.js b/node_modules/gulp-shell/node_modules/lodash/collection/all.js new file mode 100644 index 0000000000..d0839f77ed --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/all.js @@ -0,0 +1 @@ +module.exports = require('./every'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/any.js b/node_modules/gulp-shell/node_modules/lodash/collection/any.js new file mode 100644 index 0000000000..900ac25e83 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/any.js @@ -0,0 +1 @@ +module.exports = require('./some'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/at.js b/node_modules/gulp-shell/node_modules/lodash/collection/at.js new file mode 100644 index 0000000000..48a714f6b1 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/at.js @@ -0,0 +1,34 @@ +var baseAt = require('../internal/baseAt'), + baseFlatten = require('../internal/baseFlatten'), + isLength = require('../internal/isLength'), + toIterable = require('../internal/toIterable'); + +/** + * Creates an array of elements corresponding to the given keys, or indexes, + * of `collection`. Keys may be specified as individual arguments or as arrays + * of keys. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {...(number|number[]|string|string[])} [props] The property names + * or indexes of elements to pick, specified individually or in arrays. + * @returns {Array} Returns the new array of picked elements. + * @example + * + * _.at(['a', 'b', 'c'], [0, 2]); + * // => ['a', 'c'] + * + * _.at(['fred', 'barney', 'pebbles'], 0, 2); + * // => ['fred', 'pebbles'] + */ +function at(collection) { + var length = collection ? collection.length : 0; + if (isLength(length)) { + collection = toIterable(collection); + } + return baseAt(collection, baseFlatten(arguments, false, false, 1)); +} + +module.exports = at; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/collect.js b/node_modules/gulp-shell/node_modules/lodash/collection/collect.js new file mode 100644 index 0000000000..0d1e1abfaf --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/collect.js @@ -0,0 +1 @@ +module.exports = require('./map'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/contains.js b/node_modules/gulp-shell/node_modules/lodash/collection/contains.js new file mode 100644 index 0000000000..594722af59 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/contains.js @@ -0,0 +1 @@ +module.exports = require('./includes'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/countBy.js b/node_modules/gulp-shell/node_modules/lodash/collection/countBy.js new file mode 100644 index 0000000000..7702d7bf14 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/countBy.js @@ -0,0 +1,54 @@ +var createAggregator = require('../internal/createAggregator'); + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is the number of times the key was returned by `iteratee`. + * The `iteratee` is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.countBy([4.3, 6.1, 6.4], function(n) { + * return Math.floor(n); + * }); + * // => { '4': 1, '6': 2 } + * + * _.countBy([4.3, 6.1, 6.4], function(n) { + * return this.floor(n); + * }, Math); + * // => { '4': 1, '6': 2 } + * + * _.countBy(['one', 'two', 'three'], 'length'); + * // => { '3': 2, '5': 1 } + */ +var countBy = createAggregator(function(result, value, key) { + hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1); +}); + +module.exports = countBy; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/detect.js b/node_modules/gulp-shell/node_modules/lodash/collection/detect.js new file mode 100644 index 0000000000..2fb6303efb --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/detect.js @@ -0,0 +1 @@ +module.exports = require('./find'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/each.js b/node_modules/gulp-shell/node_modules/lodash/collection/each.js new file mode 100644 index 0000000000..8800f42046 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/each.js @@ -0,0 +1 @@ +module.exports = require('./forEach'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/eachRight.js b/node_modules/gulp-shell/node_modules/lodash/collection/eachRight.js new file mode 100644 index 0000000000..3252b2aba3 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/eachRight.js @@ -0,0 +1 @@ +module.exports = require('./forEachRight'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/every.js b/node_modules/gulp-shell/node_modules/lodash/collection/every.js new file mode 100644 index 0000000000..276afb3ede --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/every.js @@ -0,0 +1,62 @@ +var arrayEvery = require('../internal/arrayEvery'), + baseCallback = require('../internal/baseCallback'), + baseEvery = require('../internal/baseEvery'), + isArray = require('../lang/isArray'); + +/** + * Checks if `predicate` returns truthy for **all** elements of `collection`. + * The predicate is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias all + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + * @example + * + * _.every([true, 1, null, 'yes'], Boolean); + * // => false + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.every(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // using the `_.matchesProperty` callback shorthand + * _.every(users, 'active', false); + * // => true + * + * // using the `_.property` callback shorthand + * _.every(users, 'active'); + * // => false + */ +function every(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayEvery : baseEvery; + if (typeof predicate != 'function' || typeof thisArg != 'undefined') { + predicate = baseCallback(predicate, thisArg, 3); + } + return func(collection, predicate); +} + +module.exports = every; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/filter.js b/node_modules/gulp-shell/node_modules/lodash/collection/filter.js new file mode 100644 index 0000000000..673ae22b83 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/filter.js @@ -0,0 +1,61 @@ +var arrayFilter = require('../internal/arrayFilter'), + baseCallback = require('../internal/baseCallback'), + baseFilter = require('../internal/baseFilter'), + isArray = require('../lang/isArray'); + +/** + * Iterates over elements of `collection`, returning an array of all elements + * `predicate` returns truthy for. The predicate is bound to `thisArg` and + * invoked with three arguments; (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias select + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new filtered array. + * @example + * + * _.filter([4, 5, 6], function(n) { + * return n % 2 == 0; + * }); + * // => [4, 6] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.filter(users, 'active', false), 'user'); + * // => ['fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.filter(users, 'active'), 'user'); + * // => ['barney'] + */ +function filter(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayFilter : baseFilter; + predicate = baseCallback(predicate, thisArg, 3); + return func(collection, predicate); +} + +module.exports = filter; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/find.js b/node_modules/gulp-shell/node_modules/lodash/collection/find.js new file mode 100644 index 0000000000..8e687d8339 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/find.js @@ -0,0 +1,66 @@ +var baseCallback = require('../internal/baseCallback'), + baseEach = require('../internal/baseEach'), + baseFind = require('../internal/baseFind'), + findIndex = require('../array/findIndex'), + isArray = require('../lang/isArray'); + +/** + * Iterates over elements of `collection`, returning the first element + * `predicate` returns truthy for. The predicate is bound to `thisArg` and + * invoked with three arguments; (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias detect + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false }, + * { 'user': 'pebbles', 'age': 1, 'active': true } + * ]; + * + * _.result(_.find(users, function(chr) { + * return chr.age < 40; + * }), 'user'); + * // => 'barney' + * + * // using the `_.matches` callback shorthand + * _.result(_.find(users, { 'age': 1, 'active': true }), 'user'); + * // => 'pebbles' + * + * // using the `_.matchesProperty` callback shorthand + * _.result(_.find(users, 'active', false), 'user'); + * // => 'fred' + * + * // using the `_.property` callback shorthand + * _.result(_.find(users, 'active'), 'user'); + * // => 'barney' + */ +function find(collection, predicate, thisArg) { + if (isArray(collection)) { + var index = findIndex(collection, predicate, thisArg); + return index > -1 ? collection[index] : undefined; + } + predicate = baseCallback(predicate, thisArg, 3); + return baseFind(collection, predicate, baseEach); +} + +module.exports = find; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/findLast.js b/node_modules/gulp-shell/node_modules/lodash/collection/findLast.js new file mode 100644 index 0000000000..f66f6cc854 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/findLast.js @@ -0,0 +1,29 @@ +var baseCallback = require('../internal/baseCallback'), + baseEachRight = require('../internal/baseEachRight'), + baseFind = require('../internal/baseFind'); + +/** + * This method is like `_.find` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * _.findLast([1, 2, 3, 4], function(n) { + * return n % 2 == 1; + * }); + * // => 3 + */ +function findLast(collection, predicate, thisArg) { + predicate = baseCallback(predicate, thisArg, 3); + return baseFind(collection, predicate, baseEachRight); +} + +module.exports = findLast; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/findWhere.js b/node_modules/gulp-shell/node_modules/lodash/collection/findWhere.js new file mode 100644 index 0000000000..2d620655ed --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/findWhere.js @@ -0,0 +1,37 @@ +var baseMatches = require('../internal/baseMatches'), + find = require('./find'); + +/** + * Performs a deep comparison between each element in `collection` and the + * source object, returning the first element that has equivalent property + * values. + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. For comparing a single + * own or inherited property value see `_.matchesProperty`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Object} source The object of property values to match. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * _.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user'); + * // => 'barney' + * + * _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user'); + * // => 'fred' + */ +function findWhere(collection, source) { + return find(collection, baseMatches(source)); +} + +module.exports = findWhere; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/foldl.js b/node_modules/gulp-shell/node_modules/lodash/collection/foldl.js new file mode 100644 index 0000000000..26f53cf7b2 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/foldl.js @@ -0,0 +1 @@ +module.exports = require('./reduce'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/foldr.js b/node_modules/gulp-shell/node_modules/lodash/collection/foldr.js new file mode 100644 index 0000000000..8fb199eda6 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/foldr.js @@ -0,0 +1 @@ +module.exports = require('./reduceRight'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/forEach.js b/node_modules/gulp-shell/node_modules/lodash/collection/forEach.js new file mode 100644 index 0000000000..38cf796727 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/forEach.js @@ -0,0 +1,42 @@ +var arrayEach = require('../internal/arrayEach'), + baseEach = require('../internal/baseEach'), + bindCallback = require('../internal/bindCallback'), + isArray = require('../lang/isArray'); + +/** + * Iterates over elements of `collection` invoking `iteratee` for each element. + * The `iteratee` is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). Iterator functions may exit iteration early + * by explicitly returning `false`. + * + * **Note:** As with other "Collections" methods, objects with a `length` property + * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` + * may be used for object iteration. + * + * @static + * @memberOf _ + * @alias each + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array|Object|string} Returns `collection`. + * @example + * + * _([1, 2]).forEach(function(n) { + * console.log(n); + * }).value(); + * // => logs each value from left to right and returns the array + * + * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { + * console.log(n, key); + * }); + * // => logs each value-key pair and returns the object (iteration order is not guaranteed) + */ +function forEach(collection, iteratee, thisArg) { + return (typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection)) + ? arrayEach(collection, iteratee) + : baseEach(collection, bindCallback(iteratee, thisArg, 3)); +} + +module.exports = forEach; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/forEachRight.js b/node_modules/gulp-shell/node_modules/lodash/collection/forEachRight.js new file mode 100644 index 0000000000..56bb8ffe33 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/forEachRight.js @@ -0,0 +1,31 @@ +var arrayEachRight = require('../internal/arrayEachRight'), + baseEachRight = require('../internal/baseEachRight'), + bindCallback = require('../internal/bindCallback'), + isArray = require('../lang/isArray'); + +/** + * This method is like `_.forEach` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @alias eachRight + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array|Object|string} Returns `collection`. + * @example + * + * _([1, 2]).forEachRight(function(n) { + * console.log(n); + * }).join(','); + * // => logs each value from right to left and returns the array + */ +function forEachRight(collection, iteratee, thisArg) { + return (typeof iteratee == 'function' && typeof thisArg == 'undefined' && isArray(collection)) + ? arrayEachRight(collection, iteratee) + : baseEachRight(collection, bindCallback(iteratee, thisArg, 3)); +} + +module.exports = forEachRight; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/groupBy.js b/node_modules/gulp-shell/node_modules/lodash/collection/groupBy.js new file mode 100644 index 0000000000..f2578b3f90 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/groupBy.js @@ -0,0 +1,59 @@ +var createAggregator = require('../internal/createAggregator'); + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is an array of the elements responsible for generating the key. + * The `iteratee` is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.groupBy([4.2, 6.1, 6.4], function(n) { + * return Math.floor(n); + * }); + * // => { '4': [4.2], '6': [6.1, 6.4] } + * + * _.groupBy([4.2, 6.1, 6.4], function(n) { + * return this.floor(n); + * }, Math); + * // => { '4': [4.2], '6': [6.1, 6.4] } + * + * // using the `_.property` callback shorthand + * _.groupBy(['one', 'two', 'three'], 'length'); + * // => { '3': ['one', 'two'], '5': ['three'] } + */ +var groupBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + result[key].push(value); + } else { + result[key] = [value]; + } +}); + +module.exports = groupBy; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/include.js b/node_modules/gulp-shell/node_modules/lodash/collection/include.js new file mode 100644 index 0000000000..594722af59 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/include.js @@ -0,0 +1 @@ +module.exports = require('./includes'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/includes.js b/node_modules/gulp-shell/node_modules/lodash/collection/includes.js new file mode 100644 index 0000000000..a383fabed3 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/includes.js @@ -0,0 +1,61 @@ +var baseIndexOf = require('../internal/baseIndexOf'), + isArray = require('../lang/isArray'), + isLength = require('../internal/isLength'), + isString = require('../lang/isString'), + values = require('../object/values'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Checks if `value` is in `collection` using `SameValueZero` for equality + * comparisons. If `fromIndex` is negative, it is used as the offset from + * the end of `collection`. + * + * **Note:** `SameValueZero` comparisons are like strict equality comparisons, + * e.g. `===`, except that `NaN` matches `NaN`. See the + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * for more details. + * + * @static + * @memberOf _ + * @alias contains, include + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {*} target The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @returns {boolean} Returns `true` if a matching element is found, else `false`. + * @example + * + * _.includes([1, 2, 3], 1); + * // => true + * + * _.includes([1, 2, 3], 1, 2); + * // => false + * + * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); + * // => true + * + * _.includes('pebbles', 'eb'); + * // => true + */ +function includes(collection, target, fromIndex) { + var length = collection ? collection.length : 0; + if (!isLength(length)) { + collection = values(collection); + length = collection.length; + } + if (!length) { + return false; + } + if (typeof fromIndex == 'number') { + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); + } else { + fromIndex = 0; + } + return (typeof collection == 'string' || !isArray(collection) && isString(collection)) + ? (fromIndex < length && collection.indexOf(target, fromIndex) > -1) + : (baseIndexOf(collection, target, fromIndex) > -1); +} + +module.exports = includes; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/indexBy.js b/node_modules/gulp-shell/node_modules/lodash/collection/indexBy.js new file mode 100644 index 0000000000..0cc42d5fee --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/indexBy.js @@ -0,0 +1,53 @@ +var createAggregator = require('../internal/createAggregator'); + +/** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is the last element responsible for generating the key. The + * iteratee function is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * var keyData = [ + * { 'dir': 'left', 'code': 97 }, + * { 'dir': 'right', 'code': 100 } + * ]; + * + * _.indexBy(keyData, 'dir'); + * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } + * + * _.indexBy(keyData, function(object) { + * return String.fromCharCode(object.code); + * }); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + * + * _.indexBy(keyData, function(object) { + * return this.fromCharCode(object.code); + * }, String); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + */ +var indexBy = createAggregator(function(result, value, key) { + result[key] = value; +}); + +module.exports = indexBy; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/inject.js b/node_modules/gulp-shell/node_modules/lodash/collection/inject.js new file mode 100644 index 0000000000..26f53cf7b2 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/inject.js @@ -0,0 +1 @@ +module.exports = require('./reduce'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/invoke.js b/node_modules/gulp-shell/node_modules/lodash/collection/invoke.js new file mode 100644 index 0000000000..c305a04735 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/invoke.js @@ -0,0 +1,30 @@ +var baseInvoke = require('../internal/baseInvoke'), + baseSlice = require('../internal/baseSlice'); + +/** + * Invokes the method named by `methodName` on each element in `collection`, + * returning an array of the results of each invoked method. Any additional + * arguments are provided to each invoked method. If `methodName` is a function + * it is invoked for, and `this` bound to, each element in `collection`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|string} methodName The name of the method to invoke or + * the function invoked per iteration. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {Array} Returns the array of results. + * @example + * + * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * _.invoke([123, 456], String.prototype.split, ''); + * // => [['1', '2', '3'], ['4', '5', '6']] + */ +function invoke(collection, methodName) { + return baseInvoke(collection, methodName, baseSlice(arguments, 2)); +} + +module.exports = invoke; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/map.js b/node_modules/gulp-shell/node_modules/lodash/collection/map.js new file mode 100644 index 0000000000..f918be61cd --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/map.js @@ -0,0 +1,68 @@ +var arrayMap = require('../internal/arrayMap'), + baseCallback = require('../internal/baseCallback'), + baseMap = require('../internal/baseMap'), + isArray = require('../lang/isArray'); + +/** + * Creates an array of values by running each element in `collection` through + * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three + * arguments; (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * Many lodash methods are guarded to work as interatees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, `drop`, + * `dropRight`, `fill`, `flatten`, `invert`, `max`, `min`, `parseInt`, `slice`, + * `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimLeft`, `trimRight`, + * `trunc`, `random`, `range`, `sample`, `uniq`, and `words` + * + * @static + * @memberOf _ + * @alias collect + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * create a `_.property` or `_.matches` style callback respectively. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new mapped array. + * @example + * + * function timesThree(n) { + * return n * 3; + * } + * + * _.map([1, 2], timesThree); + * // => [3, 6] + * + * _.map({ 'a': 1, 'b': 2 }, timesThree); + * // => [3, 6] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // using the `_.property` callback shorthand + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ +function map(collection, iteratee, thisArg) { + var func = isArray(collection) ? arrayMap : baseMap; + iteratee = baseCallback(iteratee, thisArg, 3); + return func(collection, iteratee); +} + +module.exports = map; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/max.js b/node_modules/gulp-shell/node_modules/lodash/collection/max.js new file mode 100644 index 0000000000..bb1d213c33 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/max.js @@ -0,0 +1 @@ +module.exports = require('../math/max'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/min.js b/node_modules/gulp-shell/node_modules/lodash/collection/min.js new file mode 100644 index 0000000000..eef13d02b8 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/min.js @@ -0,0 +1 @@ +module.exports = require('../math/min'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/partition.js b/node_modules/gulp-shell/node_modules/lodash/collection/partition.js new file mode 100644 index 0000000000..4a5bdbe00f --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/partition.js @@ -0,0 +1,66 @@ +var createAggregator = require('../internal/createAggregator'); + +/** + * Creates an array of elements split into two groups, the first of which + * contains elements `predicate` returns truthy for, while the second of which + * contains elements `predicate` returns falsey for. The predicate is bound + * to `thisArg` and invoked with three arguments; (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the array of grouped elements. + * @example + * + * _.partition([1, 2, 3], function(n) { + * return n % 2; + * }); + * // => [[1, 3], [2]] + * + * _.partition([1.2, 2.3, 3.4], function(n) { + * return this.floor(n) % 2; + * }, Math); + * // => [[1.2, 3.4], [2.3]] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true }, + * { 'user': 'pebbles', 'age': 1, 'active': false } + * ]; + * + * var mapper = function(array) { + * return _.pluck(array, 'user'); + * }; + * + * // using the `_.matches` callback shorthand + * _.map(_.partition(users, { 'age': 1, 'active': false }), mapper); + * // => [['pebbles'], ['barney', 'fred']] + * + * // using the `_.matchesProperty` callback shorthand + * _.map(_.partition(users, 'active', false), mapper); + * // => [['barney', 'pebbles'], ['fred']] + * + * // using the `_.property` callback shorthand + * _.map(_.partition(users, 'active'), mapper); + * // => [['fred'], ['barney', 'pebbles']] + */ +var partition = createAggregator(function(result, value, key) { + result[key ? 0 : 1].push(value); +}, function() { return [[], []]; }); + +module.exports = partition; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/pluck.js b/node_modules/gulp-shell/node_modules/lodash/collection/pluck.js new file mode 100644 index 0000000000..af85d5a9ab --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/pluck.js @@ -0,0 +1,31 @@ +var baseProperty = require('../internal/baseProperty'), + map = require('./map'); + +/** + * Gets the value of `key` from all elements in `collection`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {string} key The key of the property to pluck. + * @returns {Array} Returns the property values. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * _.pluck(users, 'user'); + * // => ['barney', 'fred'] + * + * var userIndex = _.indexBy(users, 'user'); + * _.pluck(userIndex, 'age'); + * // => [36, 40] (iteration order is not guaranteed) + */ +function pluck(collection, key) { + return map(collection, baseProperty(key)); +} + +module.exports = pluck; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/reduce.js b/node_modules/gulp-shell/node_modules/lodash/collection/reduce.js new file mode 100644 index 0000000000..f02fd9c8f7 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/reduce.js @@ -0,0 +1,48 @@ +var arrayReduce = require('../internal/arrayReduce'), + baseCallback = require('../internal/baseCallback'), + baseEach = require('../internal/baseEach'), + baseReduce = require('../internal/baseReduce'), + isArray = require('../lang/isArray'); + +/** + * Reduces `collection` to a value which is the accumulated result of running + * each element in `collection` through `iteratee`, where each successive + * invocation is supplied the return value of the previous. If `accumulator` + * is not provided the first element of `collection` is used as the initial + * value. The `iteratee` is bound to `thisArg`and invoked with four arguments; + * (accumulator, value, index|key, collection). + * + * Many lodash methods are guarded to work as interatees for methods like + * `_.reduce`, `_.reduceRight`, and `_.transform`. + * + * The guarded methods are: + * `assign`, `defaults`, `merge`, and `sortAllBy` + * + * @static + * @memberOf _ + * @alias foldl, inject + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {*} Returns the accumulated value. + * @example + * + * _.reduce([1, 2], function(sum, n) { + * return sum + n; + * }); + * // => 3 + * + * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) { + * result[key] = n * 3; + * return result; + * }, {}); + * // => { 'a': 3, 'b': 6 } (iteration order is not guaranteed) + */ +function reduce(collection, iteratee, accumulator, thisArg) { + var func = isArray(collection) ? arrayReduce : baseReduce; + return func(collection, baseCallback(iteratee, thisArg, 4), accumulator, arguments.length < 3, baseEach); +} + +module.exports = reduce; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/reduceRight.js b/node_modules/gulp-shell/node_modules/lodash/collection/reduceRight.js new file mode 100644 index 0000000000..d517632451 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/reduceRight.js @@ -0,0 +1,34 @@ +var arrayReduceRight = require('../internal/arrayReduceRight'), + baseCallback = require('../internal/baseCallback'), + baseEachRight = require('../internal/baseEachRight'), + baseReduce = require('../internal/baseReduce'), + isArray = require('../lang/isArray'); + +/** + * This method is like `_.reduce` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @alias foldr + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {*} Returns the accumulated value. + * @example + * + * var array = [[0, 1], [2, 3], [4, 5]]; + * + * _.reduceRight(array, function(flattened, other) { + * return flattened.concat(other); + * }, []); + * // => [4, 5, 2, 3, 0, 1] + */ +function reduceRight(collection, iteratee, accumulator, thisArg) { + var func = isArray(collection) ? arrayReduceRight : baseReduce; + return func(collection, baseCallback(iteratee, thisArg, 4), accumulator, arguments.length < 3, baseEachRight); +} + +module.exports = reduceRight; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/reject.js b/node_modules/gulp-shell/node_modules/lodash/collection/reject.js new file mode 100644 index 0000000000..e783fc7dd5 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/reject.js @@ -0,0 +1,61 @@ +var arrayFilter = require('../internal/arrayFilter'), + baseCallback = require('../internal/baseCallback'), + baseFilter = require('../internal/baseFilter'), + isArray = require('../lang/isArray'); + +/** + * The opposite of `_.filter`; this method returns the elements of `collection` + * that `predicate` does **not** return truthy for. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new filtered array. + * @example + * + * _.reject([1, 2, 3, 4], function(n) { + * return n % 2 == 0; + * }); + * // => [1, 3] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.reject(users, 'active', false), 'user'); + * // => ['fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.reject(users, 'active'), 'user'); + * // => ['barney'] + */ +function reject(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayFilter : baseFilter; + predicate = baseCallback(predicate, thisArg, 3); + return func(collection, function(value, index, collection) { + return !predicate(value, index, collection); + }); +} + +module.exports = reject; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/sample.js b/node_modules/gulp-shell/node_modules/lodash/collection/sample.js new file mode 100644 index 0000000000..f090db107d --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/sample.js @@ -0,0 +1,38 @@ +var baseRandom = require('../internal/baseRandom'), + isIterateeCall = require('../internal/isIterateeCall'), + shuffle = require('./shuffle'), + toIterable = require('../internal/toIterable'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMin = Math.min; + +/** + * Gets a random element or `n` random elements from a collection. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to sample. + * @param {number} [n] The number of elements to sample. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {*} Returns the random sample(s). + * @example + * + * _.sample([1, 2, 3, 4]); + * // => 2 + * + * _.sample([1, 2, 3, 4], 2); + * // => [3, 1] + */ +function sample(collection, n, guard) { + if (guard ? isIterateeCall(collection, n, guard) : n == null) { + collection = toIterable(collection); + var length = collection.length; + return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; + } + var result = shuffle(collection); + result.length = nativeMin(n < 0 ? 0 : (+n || 0), result.length); + return result; +} + +module.exports = sample; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/select.js b/node_modules/gulp-shell/node_modules/lodash/collection/select.js new file mode 100644 index 0000000000..ade80f6fba --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/select.js @@ -0,0 +1 @@ +module.exports = require('./filter'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/shuffle.js b/node_modules/gulp-shell/node_modules/lodash/collection/shuffle.js new file mode 100644 index 0000000000..7548c1a817 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/shuffle.js @@ -0,0 +1,36 @@ +var baseRandom = require('../internal/baseRandom'), + toIterable = require('../internal/toIterable'); + +/** + * Creates an array of shuffled values, using a version of the Fisher-Yates + * shuffle. See [Wikipedia](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle) + * for more details. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + * @example + * + * _.shuffle([1, 2, 3, 4]); + * // => [4, 1, 3, 2] + */ +function shuffle(collection) { + collection = toIterable(collection); + + var index = -1, + length = collection.length, + result = Array(length); + + while (++index < length) { + var rand = baseRandom(0, index); + if (index != rand) { + result[index] = result[rand]; + } + result[rand] = collection[index]; + } + return result; +} + +module.exports = shuffle; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/size.js b/node_modules/gulp-shell/node_modules/lodash/collection/size.js new file mode 100644 index 0000000000..2db4bcfd21 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/size.js @@ -0,0 +1,29 @@ +var isLength = require('../internal/isLength'), + keys = require('../object/keys'); + +/** + * Gets the size of `collection` by returning its length for array-like + * values or the number of own enumerable properties for objects. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @returns {number} Returns the size of `collection`. + * @example + * + * _.size([1, 2, 3]); + * // => 3 + * + * _.size({ 'a': 1, 'b': 2 }); + * // => 2 + * + * _.size('pebbles'); + * // => 7 + */ +function size(collection) { + var length = collection ? collection.length : 0; + return isLength(length) ? length : keys(collection).length; +} + +module.exports = size; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/some.js b/node_modules/gulp-shell/node_modules/lodash/collection/some.js new file mode 100644 index 0000000000..e256773aed --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/some.js @@ -0,0 +1,63 @@ +var arraySome = require('../internal/arraySome'), + baseCallback = require('../internal/baseCallback'), + baseSome = require('../internal/baseSome'), + isArray = require('../lang/isArray'); + +/** + * Checks if `predicate` returns truthy for **any** element of `collection`. + * The function returns as soon as it finds a passing value and does not iterate + * over the entire collection. The predicate is bound to `thisArg` and invoked + * with three arguments; (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias any + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + * @example + * + * _.some([null, 0, 'yes', false], Boolean); + * // => true + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.some(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // using the `_.matchesProperty` callback shorthand + * _.some(users, 'active', false); + * // => true + * + * // using the `_.property` callback shorthand + * _.some(users, 'active'); + * // => true + */ +function some(collection, predicate, thisArg) { + var func = isArray(collection) ? arraySome : baseSome; + if (typeof predicate != 'function' || typeof thisArg != 'undefined') { + predicate = baseCallback(predicate, thisArg, 3); + } + return func(collection, predicate); +} + +module.exports = some; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/sortBy.js b/node_modules/gulp-shell/node_modules/lodash/collection/sortBy.js new file mode 100644 index 0000000000..b0f68badfd --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/sortBy.js @@ -0,0 +1,75 @@ +var baseCallback = require('../internal/baseCallback'), + baseEach = require('../internal/baseEach'), + baseSortBy = require('../internal/baseSortBy'), + compareAscending = require('../internal/compareAscending'), + isIterateeCall = require('../internal/isIterateeCall'), + isLength = require('../internal/isLength'); + +/** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection through `iteratee`. This method performs + * a stable sort, that is, it preserves the original sort order of equal elements. + * The `iteratee` is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Array|Function|Object|string} [iteratee=_.identity] The function + * invoked per iteration. If a property name or an object is provided it is + * used to create a `_.property` or `_.matches` style callback respectively. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new sorted array. + * @example + * + * _.sortBy([1, 2, 3], function(n) { + * return Math.sin(n); + * }); + * // => [3, 1, 2] + * + * _.sortBy([1, 2, 3], function(n) { + * return this.sin(n); + * }, Math); + * // => [3, 1, 2] + * + * var users = [ + * { 'user': 'fred' }, + * { 'user': 'pebbles' }, + * { 'user': 'barney' } + * ]; + * + * // using the `_.property` callback shorthand + * _.pluck(_.sortBy(users, 'user'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ +function sortBy(collection, iteratee, thisArg) { + if (collection == null) { + return []; + } + var index = -1, + length = collection.length, + result = isLength(length) ? Array(length) : []; + + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } + iteratee = baseCallback(iteratee, thisArg, 3); + baseEach(collection, function(value, key, collection) { + result[++index] = { 'criteria': iteratee(value, key, collection), 'index': index, 'value': value }; + }); + return baseSortBy(result, compareAscending); +} + +module.exports = sortBy; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/sortByAll.js b/node_modules/gulp-shell/node_modules/lodash/collection/sortByAll.js new file mode 100644 index 0000000000..94339890bb --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/sortByAll.js @@ -0,0 +1,41 @@ +var baseFlatten = require('../internal/baseFlatten'), + baseSortByOrder = require('../internal/baseSortByOrder'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * This method is like `_.sortBy` except that it sorts by property names + * instead of an iteratee function. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {...(string|string[])} props The property names to sort by, + * specified as individual property names or arrays of property names. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'barney', 'age': 26 }, + * { 'user': 'fred', 'age': 30 } + * ]; + * + * _.map(_.sortByAll(users, ['user', 'age']), _.values); + * // => [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]] + */ +function sortByAll(collection) { + if (collection == null) { + return []; + } + var args = arguments, + guard = args[3]; + + if (guard && isIterateeCall(args[1], args[2], guard)) { + args = [collection, args[1]]; + } + return baseSortByOrder(collection, baseFlatten(args, false, false, 1), []); +} + +module.exports = sortByAll; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/sortByOrder.js b/node_modules/gulp-shell/node_modules/lodash/collection/sortByOrder.js new file mode 100644 index 0000000000..4528e6db9d --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/sortByOrder.js @@ -0,0 +1,48 @@ +var baseSortByOrder = require('../internal/baseSortByOrder'), + isArray = require('../lang/isArray'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * This method is like `_.sortByAll` except that it allows specifying the + * sort orders of the property names to sort by. A truthy value in `orders` + * will sort the corresponding property name in ascending order while a + * falsey value will sort it in descending order. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {string[]} props The property names to sort by. + * @param {boolean[]} orders The sort orders of `props`. + * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 26 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 30 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.map(_.sortByOrder(users, ['user', 'age'], [true, false]), _.values); + * // => [['barney', 36], ['barney', 26], ['fred', 40], ['fred', 30]] + */ +function sortByOrder(collection, props, orders, guard) { + if (collection == null) { + return []; + } + if (guard && isIterateeCall(props, orders, guard)) { + orders = null; + } + if (!isArray(props)) { + props = props == null ? [] : [props]; + } + if (!isArray(orders)) { + orders = orders == null ? [] : [orders]; + } + return baseSortByOrder(collection, props, orders); +} + +module.exports = sortByOrder; diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/sum.js b/node_modules/gulp-shell/node_modules/lodash/collection/sum.js new file mode 100644 index 0000000000..a2e93808ae --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/sum.js @@ -0,0 +1 @@ +module.exports = require('../math/sum'); diff --git a/node_modules/gulp-shell/node_modules/lodash/collection/where.js b/node_modules/gulp-shell/node_modules/lodash/collection/where.js new file mode 100644 index 0000000000..f603bf8ce4 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/collection/where.js @@ -0,0 +1,37 @@ +var baseMatches = require('../internal/baseMatches'), + filter = require('./filter'); + +/** + * Performs a deep comparison between each element in `collection` and the + * source object, returning an array of all elements that have equivalent + * property values. + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. For comparing a single + * own or inherited property value see `_.matchesProperty`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Object} source The object of property values to match. + * @returns {Array} Returns the new filtered array. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] }, + * { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] } + * ]; + * + * _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user'); + * // => ['barney'] + * + * _.pluck(_.where(users, { 'pets': ['dino'] }), 'user'); + * // => ['fred'] + */ +function where(collection, source) { + return filter(collection, baseMatches(source)); +} + +module.exports = where; diff --git a/node_modules/gulp-shell/node_modules/lodash/date.js b/node_modules/gulp-shell/node_modules/lodash/date.js new file mode 100644 index 0000000000..195366e777 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/date.js @@ -0,0 +1,3 @@ +module.exports = { + 'now': require('./date/now') +}; diff --git a/node_modules/gulp-shell/node_modules/lodash/date/now.js b/node_modules/gulp-shell/node_modules/lodash/date/now.js new file mode 100644 index 0000000000..628225d2a0 --- /dev/null +++ b/node_modules/gulp-shell/node_modules/lodash/date/now.js @@ -0,0 +1,24 @@ +var isNative = require('../lang/isNative'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeNow = isNative(nativeNow = Date.now) && nativeNow; + +/** + * Gets the number of milliseconds that have elapsed since the Unix epoch + * (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @category Date + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => logs the number of milliseconds it took for the deferred function to be invoked + */ +var now = nativeNow || function() { + return new Date().getTime(); +}; + +module.exports = now; diff --git a/node_modules/gulp-shell/node_modules/lodash/dist/lodash.compat.js b/node_modules/gulp-shell/node_modules/lodash/dist/lodash.compat.js deleted file mode 100644 index 23798ba853..0000000000 --- a/node_modules/gulp-shell/node_modules/lodash/dist/lodash.compat.js +++ /dev/null @@ -1,7157 +0,0 @@ -/** - * @license - * Lo-Dash 2.4.1 (Custom Build) - * Build: `lodash -o ./dist/lodash.compat.js` - * Copyright 2012-2013 The Dojo Foundation - * Based on Underscore.js 1.5.2 - * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -;(function() { - - /** Used as a safe reference for `undefined` in pre ES5 environments */ - var undefined; - - /** Used to pool arrays and objects used internally */ - var arrayPool = [], - objectPool = []; - - /** Used to generate unique IDs */ - var idCounter = 0; - - /** Used internally to indicate various things */ - var indicatorObject = {}; - - /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */ - var keyPrefix = +new Date + ''; - - /** Used as the size when optimizations are enabled for large arrays */ - var largeArraySize = 75; - - /** Used as the max size of the `arrayPool` and `objectPool` */ - var maxPoolSize = 40; - - /** Used to detect and test whitespace */ - var whitespace = ( - // whitespace - ' \t\x0B\f\xA0\ufeff' + - - // line terminators - '\n\r\u2028\u2029' + - - // unicode category "Zs" space separators - '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' - ); - - /** Used to match empty string literals in compiled template source */ - var reEmptyStringLeading = /\b__p \+= '';/g, - reEmptyStringMiddle = /\b(__p \+=) '' \+/g, - reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; - - /** - * Used to match ES6 template delimiters - * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals - */ - var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - - /** Used to match regexp flags from their coerced string values */ - var reFlags = /\w*$/; - - /** Used to detected named functions */ - var reFuncName = /^\s*function[ \n\r\t]+\w/; - - /** Used to match "interpolate" template delimiters */ - var reInterpolate = /<%=([\s\S]+?)%>/g; - - /** Used to match leading whitespace and zeros to be removed */ - var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)'); - - /** Used to ensure capturing order of template delimiters */ - var reNoMatch = /($^)/; - - /** Used to detect functions containing a `this` reference */ - var reThis = /\bthis\b/; - - /** Used to match unescaped characters in compiled string literals */ - var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g; - - /** Used to assign default `context` object properties */ - var contextProps = [ - 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object', - 'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', - 'parseInt', 'setTimeout' - ]; - - /** Used to fix the JScript [[DontEnum]] bug */ - var shadowedProps = [ - 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', - 'toLocaleString', 'toString', 'valueOf' - ]; - - /** Used to make template sourceURLs easier to identify */ - var templateCounter = 0; - - /** `Object#toString` result shortcuts */ - var argsClass = '[object Arguments]', - arrayClass = '[object Array]', - boolClass = '[object Boolean]', - dateClass = '[object Date]', - errorClass = '[object Error]', - funcClass = '[object Function]', - numberClass = '[object Number]', - objectClass = '[object Object]', - regexpClass = '[object RegExp]', - stringClass = '[object String]'; - - /** Used to identify object classifications that `_.clone` supports */ - var cloneableClasses = {}; - cloneableClasses[funcClass] = false; - cloneableClasses[argsClass] = cloneableClasses[arrayClass] = - cloneableClasses[boolClass] = cloneableClasses[dateClass] = - cloneableClasses[numberClass] = cloneableClasses[objectClass] = - cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true; - - /** Used as an internal `_.debounce` options object */ - var debounceOptions = { - 'leading': false, - 'maxWait': 0, - 'trailing': false - }; - - /** Used as the property descriptor for `__bindData__` */ - var descriptor = { - 'configurable': false, - 'enumerable': false, - 'value': null, - 'writable': false - }; - - /** Used as the data object for `iteratorTemplate` */ - var iteratorData = { - 'args': '', - 'array': null, - 'bottom': '', - 'firstArg': '', - 'init': '', - 'keys': null, - 'loop': '', - 'shadowedProps': null, - 'support': null, - 'top': '', - 'useHas': false - }; - - /** Used to determine if values are of the language type Object */ - var objectTypes = { - 'boolean': false, - 'function': true, - 'object': true, - 'number': false, - 'string': false, - 'undefined': false - }; - - /** Used to escape characters for inclusion in compiled string literals */ - var stringEscapes = { - '\\': '\\', - "'": "'", - '\n': 'n', - '\r': 'r', - '\t': 't', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - /** Used as a reference to the global object */ - var root = (objectTypes[typeof window] && window) || this; - - /** Detect free variable `exports` */ - var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; - - /** Detect free variable `module` */ - var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports` */ - var moduleExports = freeModule && freeModule.exports === freeExports && freeExports; - - /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */ - var freeGlobal = objectTypes[typeof global] && global; - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { - root = freeGlobal; - } - - /*--------------------------------------------------------------------------*/ - - /** - * The base implementation of `_.indexOf` without support for binary searches - * or `fromIndex` constraints. - * - * @private - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the matched value or `-1`. - */ - function baseIndexOf(array, value, fromIndex) { - var index = (fromIndex || 0) - 1, - length = array ? array.length : 0; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * An implementation of `_.contains` for cache objects that mimics the return - * signature of `_.indexOf` by returning `0` if the value is found, else `-1`. - * - * @private - * @param {Object} cache The cache object to inspect. - * @param {*} value The value to search for. - * @returns {number} Returns `0` if `value` is found, else `-1`. - */ - function cacheIndexOf(cache, value) { - var type = typeof value; - cache = cache.cache; - - if (type == 'boolean' || value == null) { - return cache[value] ? 0 : -1; - } - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value; - cache = (cache = cache[type]) && cache[key]; - - return type == 'object' - ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1) - : (cache ? 0 : -1); - } - - /** - * Adds a given value to the corresponding cache object. - * - * @private - * @param {*} value The value to add to the cache. - */ - function cachePush(value) { - var cache = this.cache, - type = typeof value; - - if (type == 'boolean' || value == null) { - cache[value] = true; - } else { - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value, - typeCache = cache[type] || (cache[type] = {}); - - if (type == 'object') { - (typeCache[key] || (typeCache[key] = [])).push(value); - } else { - typeCache[key] = true; - } - } - } - - /** - * Used by `_.max` and `_.min` as the default callback when a given - * collection is a string value. - * - * @private - * @param {string} value The character to inspect. - * @returns {number} Returns the code unit of given character. - */ - function charAtCallback(value) { - return value.charCodeAt(0); - } - - /** - * Used by `sortBy` to compare transformed `collection` elements, stable sorting - * them in ascending order. - * - * @private - * @param {Object} a The object to compare to `b`. - * @param {Object} b The object to compare to `a`. - * @returns {number} Returns the sort order indicator of `1` or `-1`. - */ - function compareAscending(a, b) { - var ac = a.criteria, - bc = b.criteria, - index = -1, - length = ac.length; - - while (++index < length) { - var value = ac[index], - other = bc[index]; - - if (value !== other) { - if (value > other || typeof value == 'undefined') { - return 1; - } - if (value < other || typeof other == 'undefined') { - return -1; - } - } - } - // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications - // that causes it, under certain circumstances, to return the same value for - // `a` and `b`. See https://github.com/jashkenas/underscore/pull/1247 - // - // This also ensures a stable sort in V8 and other engines. - // See http://code.google.com/p/v8/issues/detail?id=90 - return a.index - b.index; - } - - /** - * Creates a cache object to optimize linear searches of large arrays. - * - * @private - * @param {Array} [array=[]] The array to search. - * @returns {null|Object} Returns the cache object or `null` if caching should not be used. - */ - function createCache(array) { - var index = -1, - length = array.length, - first = array[0], - mid = array[(length / 2) | 0], - last = array[length - 1]; - - if (first && typeof first == 'object' && - mid && typeof mid == 'object' && last && typeof last == 'object') { - return false; - } - var cache = getObject(); - cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; - - var result = getObject(); - result.array = array; - result.cache = cache; - result.push = cachePush; - - while (++index < length) { - result.push(array[index]); - } - return result; - } - - /** - * Used by `template` to escape characters for inclusion in compiled - * string literals. - * - * @private - * @param {string} match The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeStringChar(match) { - return '\\' + stringEscapes[match]; - } - - /** - * Gets an array from the array pool or creates a new one if the pool is empty. - * - * @private - * @returns {Array} The array from the pool. - */ - function getArray() { - return arrayPool.pop() || []; - } - - /** - * Gets an object from the object pool or creates a new one if the pool is empty. - * - * @private - * @returns {Object} The object from the pool. - */ - function getObject() { - return objectPool.pop() || { - 'array': null, - 'cache': null, - 'criteria': null, - 'false': false, - 'index': 0, - 'null': false, - 'number': null, - 'object': null, - 'push': null, - 'string': null, - 'true': false, - 'undefined': false, - 'value': null - }; - } - - /** - * Checks if `value` is a DOM node in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a DOM node, else `false`. - */ - function isNode(value) { - // IE < 9 presents DOM nodes as `Object` objects except they have `toString` - // methods that are `typeof` "string" and still can coerce nodes to strings - return typeof value.toString != 'function' && typeof (value + '') == 'string'; - } - - /** - * Releases the given array back to the array pool. - * - * @private - * @param {Array} [array] The array to release. - */ - function releaseArray(array) { - array.length = 0; - if (arrayPool.length < maxPoolSize) { - arrayPool.push(array); - } - } - - /** - * Releases the given object back to the object pool. - * - * @private - * @param {Object} [object] The object to release. - */ - function releaseObject(object) { - var cache = object.cache; - if (cache) { - releaseObject(cache); - } - object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null; - if (objectPool.length < maxPoolSize) { - objectPool.push(object); - } - } - - /** - * Slices the `collection` from the `start` index up to, but not including, - * the `end` index. - * - * Note: This function is used instead of `Array#slice` to support node lists - * in IE < 9 and to ensure dense arrays are returned. - * - * @private - * @param {Array|Object|string} collection The collection to slice. - * @param {number} start The start index. - * @param {number} end The end index. - * @returns {Array} Returns the new array. - */ - function slice(array, start, end) { - start || (start = 0); - if (typeof end == 'undefined') { - end = array ? array.length : 0; - } - var index = -1, - length = end - start || 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = array[start + index]; - } - return result; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Create a new `lodash` function using the given context object. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Object} [context=root] The context object. - * @returns {Function} Returns the `lodash` function. - */ - function runInContext(context) { - // Avoid issues with some ES3 environments that attempt to use values, named - // after built-in constructors like `Object`, for the creation of literals. - // ES5 clears this up by stating that literals must use built-in constructors. - // See http://es5.github.io/#x11.1.5. - context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root; - - /** Native constructor references */ - var Array = context.Array, - Boolean = context.Boolean, - Date = context.Date, - Error = context.Error, - Function = context.Function, - Math = context.Math, - Number = context.Number, - Object = context.Object, - RegExp = context.RegExp, - String = context.String, - TypeError = context.TypeError; - - /** - * Used for `Array` method references. - * - * Normally `Array.prototype` would suffice, however, using an array literal - * avoids issues in Narwhal. - */ - var arrayRef = []; - - /** Used for native method references */ - var errorProto = Error.prototype, - objectProto = Object.prototype, - stringProto = String.prototype; - - /** Used to restore the original `_` reference in `noConflict` */ - var oldDash = context._; - - /** Used to resolve the internal [[Class]] of values */ - var toString = objectProto.toString; - - /** Used to detect if a method is native */ - var reNative = RegExp('^' + - String(toString) - .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') - .replace(/toString| for [^\]]+/g, '.*?') + '$' - ); - - /** Native method shortcuts */ - var ceil = Math.ceil, - clearTimeout = context.clearTimeout, - floor = Math.floor, - fnToString = Function.prototype.toString, - getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, - hasOwnProperty = objectProto.hasOwnProperty, - push = arrayRef.push, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - setTimeout = context.setTimeout, - splice = arrayRef.splice, - unshift = arrayRef.unshift; - - /** Used to set meta data on functions */ - var defineProperty = (function() { - // IE 8 only accepts DOM elements - try { - var o = {}, - func = isNative(func = Object.defineProperty) && func, - result = func(o, o, o) && func; - } catch(e) { } - return result; - }()); - - /* Native method shortcuts for methods with the same name as other `lodash` methods */ - var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate, - nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray, - nativeIsFinite = context.isFinite, - nativeIsNaN = context.isNaN, - nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, - nativeMax = Math.max, - nativeMin = Math.min, - nativeParseInt = context.parseInt, - nativeRandom = Math.random; - - /** Used to lookup a built-in constructor by [[Class]] */ - var ctorByClass = {}; - ctorByClass[arrayClass] = Array; - ctorByClass[boolClass] = Boolean; - ctorByClass[dateClass] = Date; - ctorByClass[funcClass] = Function; - ctorByClass[objectClass] = Object; - ctorByClass[numberClass] = Number; - ctorByClass[regexpClass] = RegExp; - ctorByClass[stringClass] = String; - - /** Used to avoid iterating non-enumerable properties in IE < 9 */ - var nonEnumProps = {}; - nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true }; - nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true }; - nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true }; - nonEnumProps[objectClass] = { 'constructor': true }; - - (function() { - var length = shadowedProps.length; - while (length--) { - var key = shadowedProps[length]; - for (var className in nonEnumProps) { - if (hasOwnProperty.call(nonEnumProps, className) && !hasOwnProperty.call(nonEnumProps[className], key)) { - nonEnumProps[className][key] = false; - } - } - } - }()); - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` object which wraps the given value to enable intuitive - * method chaining. - * - * In addition to Lo-Dash methods, wrappers also have the following `Array` methods: - * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`, - * and `unshift` - * - * Chaining is supported in custom builds as long as the `value` method is - * implicitly or explicitly included in the build. - * - * The chainable wrapper functions are: - * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, - * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`, - * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, - * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, - * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, - * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, - * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`, - * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, - * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, - * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, - * and `zip` - * - * The non-chainable wrapper functions are: - * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`, - * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`, - * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, - * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, - * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, - * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`, - * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, - * `template`, `unescape`, `uniqueId`, and `value` - * - * The wrapper functions `first` and `last` return wrapped values when `n` is - * provided, otherwise they return unwrapped values. - * - * Explicit chaining can be enabled by using the `_.chain` method. - * - * @name _ - * @constructor - * @category Chaining - * @param {*} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns a `lodash` instance. - * @example - * - * var wrapped = _([1, 2, 3]); - * - * // returns an unwrapped value - * wrapped.reduce(function(sum, num) { - * return sum + num; - * }); - * // => 6 - * - * // returns a wrapped value - * var squares = wrapped.map(function(num) { - * return num * num; - * }); - * - * _.isArray(squares); - * // => false - * - * _.isArray(squares.value()); - * // => true - */ - function lodash(value) { - // don't wrap if already wrapped, even if wrapped by a different `lodash` constructor - return (value && typeof value == 'object' && !isArray(value) && hasOwnProperty.call(value, '__wrapped__')) - ? value - : new lodashWrapper(value); - } - - /** - * A fast path for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap in a `lodash` instance. - * @param {boolean} chainAll A flag to enable chaining for all methods - * @returns {Object} Returns a `lodash` instance. - */ - function lodashWrapper(value, chainAll) { - this.__chain__ = !!chainAll; - this.__wrapped__ = value; - } - // ensure `new lodashWrapper` is an instance of `lodash` - lodashWrapper.prototype = lodash.prototype; - - /** - * An object used to flag environments features. - * - * @static - * @memberOf _ - * @type Object - */ - var support = lodash.support = {}; - - (function() { - var ctor = function() { this.x = 1; }, - object = { '0': 1, 'length': 1 }, - props = []; - - ctor.prototype = { 'valueOf': 1, 'y': 1 }; - for (var key in new ctor) { props.push(key); } - for (key in arguments) { } - - /** - * Detect if an `arguments` object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). - * - * @memberOf _.support - * @type boolean - */ - support.argsClass = toString.call(arguments) == argsClass; - - /** - * Detect if `arguments` objects are `Object` objects (all but Narwhal and Opera < 10.5). - * - * @memberOf _.support - * @type boolean - */ - support.argsObject = arguments.constructor == Object && !(arguments instanceof Array); - - /** - * Detect if `name` or `message` properties of `Error.prototype` are - * enumerable by default. (IE < 9, Safari < 5.1) - * - * @memberOf _.support - * @type boolean - */ - support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); - - /** - * Detect if `prototype` properties are enumerable by default. - * - * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 - * (if the prototype or a property on the prototype has been set) - * incorrectly sets a function's `prototype` property [[Enumerable]] - * value to `true`. - * - * @memberOf _.support - * @type boolean - */ - support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype'); - - /** - * Detect if functions can be decompiled by `Function#toString` - * (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps). - * - * @memberOf _.support - * @type boolean - */ - support.funcDecomp = !isNative(context.WinRTError) && reThis.test(runInContext); - - /** - * Detect if `Function#name` is supported (all but IE). - * - * @memberOf _.support - * @type boolean - */ - support.funcNames = typeof Function.name == 'string'; - - /** - * Detect if `arguments` object indexes are non-enumerable - * (Firefox < 4, IE < 9, PhantomJS, Safari < 5.1). - * - * @memberOf _.support - * @type boolean - */ - support.nonEnumArgs = key != 0; - - /** - * Detect if properties shadowing those on `Object.prototype` are non-enumerable. - * - * In IE < 9 an objects own properties, shadowing non-enumerable ones, are - * made non-enumerable as well (a.k.a the JScript [[DontEnum]] bug). - * - * @memberOf _.support - * @type boolean - */ - support.nonEnumShadows = !/valueOf/.test(props); - - /** - * Detect if own properties are iterated after inherited properties (all but IE < 9). - * - * @memberOf _.support - * @type boolean - */ - support.ownLast = props[0] != 'x'; - - /** - * Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. - * - * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()` - * and `splice()` functions that fail to remove the last element, `value[0]`, - * of array-like objects even though the `length` property is set to `0`. - * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()` - * is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9. - * - * @memberOf _.support - * @type boolean - */ - support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]); - - /** - * Detect lack of support for accessing string characters by index. - * - * IE < 8 can't access characters by index and IE 8 can only access - * characters by index on string literals. - * - * @memberOf _.support - * @type boolean - */ - support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx'; - - /** - * Detect if a DOM node's [[Class]] is resolvable (all but IE < 9) - * and that the JS engine errors when attempting to coerce an object to - * a string without a `toString` function. - * - * @memberOf _.support - * @type boolean - */ - try { - support.nodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + '')); - } catch(e) { - support.nodeClass = true; - } - }(1)); - - /** - * By default, the template delimiters used by Lo-Dash are similar to those in - * embedded Ruby (ERB). Change the following template settings to use alternative - * delimiters. - * - * @static - * @memberOf _ - * @type Object - */ - lodash.templateSettings = { - - /** - * Used to detect `data` property values to be HTML-escaped. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'escape': /<%-([\s\S]+?)%>/g, - - /** - * Used to detect code to be evaluated. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'evaluate': /<%([\s\S]+?)%>/g, - - /** - * Used to detect `data` property values to inject. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'interpolate': reInterpolate, - - /** - * Used to reference the data object in the template text. - * - * @memberOf _.templateSettings - * @type string - */ - 'variable': '', - - /** - * Used to import variables into the compiled template. - * - * @memberOf _.templateSettings - * @type Object - */ - 'imports': { - - /** - * A reference to the `lodash` function. - * - * @memberOf _.templateSettings.imports - * @type Function - */ - '_': lodash - } - }; - - /*--------------------------------------------------------------------------*/ - - /** - * The template used to create iterator functions. - * - * @private - * @param {Object} data The data object used to populate the text. - * @returns {string} Returns the interpolated text. - */ - var iteratorTemplate = function(obj) { - - var __p = 'var index, iterable = ' + - (obj.firstArg) + - ', result = ' + - (obj.init) + - ';\nif (!iterable) return result;\n' + - (obj.top) + - ';'; - if (obj.array) { - __p += '\nvar length = iterable.length; index = -1;\nif (' + - (obj.array) + - ') { '; - if (support.unindexedChars) { - __p += '\n if (isString(iterable)) {\n iterable = iterable.split(\'\')\n } '; - } - __p += '\n while (++index < length) {\n ' + - (obj.loop) + - ';\n }\n}\nelse { '; - } else if (support.nonEnumArgs) { - __p += '\n var length = iterable.length; index = -1;\n if (length && isArguments(iterable)) {\n while (++index < length) {\n index += \'\';\n ' + - (obj.loop) + - ';\n }\n } else { '; - } - - if (support.enumPrototypes) { - __p += '\n var skipProto = typeof iterable == \'function\';\n '; - } - - if (support.enumErrorProps) { - __p += '\n var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n '; - } - - var conditions = []; if (support.enumPrototypes) { conditions.push('!(skipProto && index == "prototype")'); } if (support.enumErrorProps) { conditions.push('!(skipErrorProps && (index == "message" || index == "name"))'); } - - if (obj.useHas && obj.keys) { - __p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] && keys(iterable),\n length = ownProps ? ownProps.length : 0;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n'; - if (conditions.length) { - __p += ' if (' + - (conditions.join(' && ')) + - ') {\n '; - } - __p += - (obj.loop) + - '; '; - if (conditions.length) { - __p += '\n }'; - } - __p += '\n } '; - } else { - __p += '\n for (index in iterable) {\n'; - if (obj.useHas) { conditions.push("hasOwnProperty.call(iterable, index)"); } if (conditions.length) { - __p += ' if (' + - (conditions.join(' && ')) + - ') {\n '; - } - __p += - (obj.loop) + - '; '; - if (conditions.length) { - __p += '\n }'; - } - __p += '\n } '; - if (support.nonEnumShadows) { - __p += '\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n isProto = iterable === (ctor && ctor.prototype),\n className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[className];\n '; - for (k = 0; k < 7; k++) { - __p += '\n index = \'' + - (obj.shadowedProps[k]) + - '\';\n if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))'; - if (!obj.useHas) { - __p += ' || (!nonEnum[index] && iterable[index] !== objectProto[index])'; - } - __p += ') {\n ' + - (obj.loop) + - ';\n } '; - } - __p += '\n } '; - } - - } - - if (obj.array || support.nonEnumArgs) { - __p += '\n}'; - } - __p += - (obj.bottom) + - ';\nreturn result'; - - return __p - }; - - /*--------------------------------------------------------------------------*/ - - /** - * The base implementation of `_.bind` that creates the bound function and - * sets its meta data. - * - * @private - * @param {Array} bindData The bind data array. - * @returns {Function} Returns the new bound function. - */ - function baseBind(bindData) { - var func = bindData[0], - partialArgs = bindData[2], - thisArg = bindData[4]; - - function bound() { - // `Function#bind` spec - // http://es5.github.io/#x15.3.4.5 - if (partialArgs) { - // avoid `arguments` object deoptimizations by using `slice` instead - // of `Array.prototype.slice.call` and not assigning `arguments` to a - // variable as a ternary expression - var args = slice(partialArgs); - push.apply(args, arguments); - } - // mimic the constructor's `return` behavior - // http://es5.github.io/#x13.2.2 - if (this instanceof bound) { - // ensure `new bound` is an instance of `func` - var thisBinding = baseCreate(func.prototype), - result = func.apply(thisBinding, args || arguments); - return isObject(result) ? result : thisBinding; - } - return func.apply(thisArg, args || arguments); - } - setBindData(bound, bindData); - return bound; - } - - /** - * The base implementation of `_.clone` without argument juggling or support - * for `thisArg` binding. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} [isDeep=false] Specify a deep clone. - * @param {Function} [callback] The function to customize cloning values. - * @param {Array} [stackA=[]] Tracks traversed source objects. - * @param {Array} [stackB=[]] Associates clones with source counterparts. - * @returns {*} Returns the cloned value. - */ - function baseClone(value, isDeep, callback, stackA, stackB) { - if (callback) { - var result = callback(value); - if (typeof result != 'undefined') { - return result; - } - } - // inspect [[Class]] - var isObj = isObject(value); - if (isObj) { - var className = toString.call(value); - if (!cloneableClasses[className] || (!support.nodeClass && isNode(value))) { - return value; - } - var ctor = ctorByClass[className]; - switch (className) { - case boolClass: - case dateClass: - return new ctor(+value); - - case numberClass: - case stringClass: - return new ctor(value); - - case regexpClass: - result = ctor(value.source, reFlags.exec(value)); - result.lastIndex = value.lastIndex; - return result; - } - } else { - return value; - } - var isArr = isArray(value); - if (isDeep) { - // check for circular references and return corresponding clone - var initedStack = !stackA; - stackA || (stackA = getArray()); - stackB || (stackB = getArray()); - - var length = stackA.length; - while (length--) { - if (stackA[length] == value) { - return stackB[length]; - } - } - result = isArr ? ctor(value.length) : {}; - } - else { - result = isArr ? slice(value) : assign({}, value); - } - // add array properties assigned by `RegExp#exec` - if (isArr) { - if (hasOwnProperty.call(value, 'index')) { - result.index = value.index; - } - if (hasOwnProperty.call(value, 'input')) { - result.input = value.input; - } - } - // exit for shallow clone - if (!isDeep) { - return result; - } - // add the source value to the stack of traversed objects - // and associate it with its clone - stackA.push(value); - stackB.push(result); - - // recursively populate clone (susceptible to call stack limits) - (isArr ? baseEach : forOwn)(value, function(objValue, key) { - result[key] = baseClone(objValue, isDeep, callback, stackA, stackB); - }); - - if (initedStack) { - releaseArray(stackA); - releaseArray(stackB); - } - return result; - } - - /** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} prototype The object to inherit from. - * @returns {Object} Returns the new object. - */ - function baseCreate(prototype, properties) { - return isObject(prototype) ? nativeCreate(prototype) : {}; - } - // fallback for browsers without `Object.create` - if (!nativeCreate) { - baseCreate = (function() { - function Object() {} - return function(prototype) { - if (isObject(prototype)) { - Object.prototype = prototype; - var result = new Object; - Object.prototype = null; - } - return result || context.Object(); - }; - }()); - } - - /** - * The base implementation of `_.createCallback` without support for creating - * "_.pluck" or "_.where" style callbacks. - * - * @private - * @param {*} [func=identity] The value to convert to a callback. - * @param {*} [thisArg] The `this` binding of the created callback. - * @param {number} [argCount] The number of arguments the callback accepts. - * @returns {Function} Returns a callback function. - */ - function baseCreateCallback(func, thisArg, argCount) { - if (typeof func != 'function') { - return identity; - } - // exit early for no `thisArg` or already bound by `Function#bind` - if (typeof thisArg == 'undefined' || !('prototype' in func)) { - return func; - } - var bindData = func.__bindData__; - if (typeof bindData == 'undefined') { - if (support.funcNames) { - bindData = !func.name; - } - bindData = bindData || !support.funcDecomp; - if (!bindData) { - var source = fnToString.call(func); - if (!support.funcNames) { - bindData = !reFuncName.test(source); - } - if (!bindData) { - // checks if `func` references the `this` keyword and stores the result - bindData = reThis.test(source); - setBindData(func, bindData); - } - } - } - // exit early if there are no `this` references or `func` is bound - if (bindData === false || (bindData !== true && bindData[1] & 1)) { - return func; - } - switch (argCount) { - case 1: return function(value) { - return func.call(thisArg, value); - }; - case 2: return function(a, b) { - return func.call(thisArg, a, b); - }; - case 3: return function(value, index, collection) { - return func.call(thisArg, value, index, collection); - }; - case 4: return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - } - return bind(func, thisArg); - } - - /** - * The base implementation of `createWrapper` that creates the wrapper and - * sets its meta data. - * - * @private - * @param {Array} bindData The bind data array. - * @returns {Function} Returns the new function. - */ - function baseCreateWrapper(bindData) { - var func = bindData[0], - bitmask = bindData[1], - partialArgs = bindData[2], - partialRightArgs = bindData[3], - thisArg = bindData[4], - arity = bindData[5]; - - var isBind = bitmask & 1, - isBindKey = bitmask & 2, - isCurry = bitmask & 4, - isCurryBound = bitmask & 8, - key = func; - - function bound() { - var thisBinding = isBind ? thisArg : this; - if (partialArgs) { - var args = slice(partialArgs); - push.apply(args, arguments); - } - if (partialRightArgs || isCurry) { - args || (args = slice(arguments)); - if (partialRightArgs) { - push.apply(args, partialRightArgs); - } - if (isCurry && args.length < arity) { - bitmask |= 16 & ~32; - return baseCreateWrapper([func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity]); - } - } - args || (args = arguments); - if (isBindKey) { - func = thisBinding[key]; - } - if (this instanceof bound) { - thisBinding = baseCreate(func.prototype); - var result = func.apply(thisBinding, args); - return isObject(result) ? result : thisBinding; - } - return func.apply(thisBinding, args); - } - setBindData(bound, bindData); - return bound; - } - - /** - * The base implementation of `_.difference` that accepts a single array - * of values to exclude. - * - * @private - * @param {Array} array The array to process. - * @param {Array} [values] The array of values to exclude. - * @returns {Array} Returns a new array of filtered values. - */ - function baseDifference(array, values) { - var index = -1, - indexOf = getIndexOf(), - length = array ? array.length : 0, - isLarge = length >= largeArraySize && indexOf === baseIndexOf, - result = []; - - if (isLarge) { - var cache = createCache(values); - if (cache) { - indexOf = cacheIndexOf; - values = cache; - } else { - isLarge = false; - } - } - while (++index < length) { - var value = array[index]; - if (indexOf(values, value) < 0) { - result.push(value); - } - } - if (isLarge) { - releaseObject(values); - } - return result; - } - - /** - * The base implementation of `_.flatten` without support for callback - * shorthands or `thisArg` binding. - * - * @private - * @param {Array} array The array to flatten. - * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level. - * @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects. - * @param {number} [fromIndex=0] The index to start from. - * @returns {Array} Returns a new flattened array. - */ - function baseFlatten(array, isShallow, isStrict, fromIndex) { - var index = (fromIndex || 0) - 1, - length = array ? array.length : 0, - result = []; - - while (++index < length) { - var value = array[index]; - - if (value && typeof value == 'object' && typeof value.length == 'number' - && (isArray(value) || isArguments(value))) { - // recursively flatten arrays (susceptible to call stack limits) - if (!isShallow) { - value = baseFlatten(value, isShallow, isStrict); - } - var valIndex = -1, - valLength = value.length, - resIndex = result.length; - - result.length += valLength; - while (++valIndex < valLength) { - result[resIndex++] = value[valIndex]; - } - } else if (!isStrict) { - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.isEqual`, without support for `thisArg` binding, - * that allows partial "_.where" style comparisons. - * - * @private - * @param {*} a The value to compare. - * @param {*} b The other value to compare. - * @param {Function} [callback] The function to customize comparing values. - * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons. - * @param {Array} [stackA=[]] Tracks traversed `a` objects. - * @param {Array} [stackB=[]] Tracks traversed `b` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ - function baseIsEqual(a, b, callback, isWhere, stackA, stackB) { - // used to indicate that when comparing objects, `a` has at least the properties of `b` - if (callback) { - var result = callback(a, b); - if (typeof result != 'undefined') { - return !!result; - } - } - // exit early for identical values - if (a === b) { - // treat `+0` vs. `-0` as not equal - return a !== 0 || (1 / a == 1 / b); - } - var type = typeof a, - otherType = typeof b; - - // exit early for unlike primitive values - if (a === a && - !(a && objectTypes[type]) && - !(b && objectTypes[otherType])) { - return false; - } - // exit early for `null` and `undefined` avoiding ES3's Function#call behavior - // http://es5.github.io/#x15.3.4.4 - if (a == null || b == null) { - return a === b; - } - // compare [[Class]] names - var className = toString.call(a), - otherClass = toString.call(b); - - if (className == argsClass) { - className = objectClass; - } - if (otherClass == argsClass) { - otherClass = objectClass; - } - if (className != otherClass) { - return false; - } - switch (className) { - case boolClass: - case dateClass: - // coerce dates and booleans to numbers, dates to milliseconds and booleans - // to `1` or `0` treating invalid dates coerced to `NaN` as not equal - return +a == +b; - - case numberClass: - // treat `NaN` vs. `NaN` as equal - return (a != +a) - ? b != +b - // but treat `+0` vs. `-0` as not equal - : (a == 0 ? (1 / a == 1 / b) : a == +b); - - case regexpClass: - case stringClass: - // coerce regexes to strings (http://es5.github.io/#x15.10.6.4) - // treat string primitives and their corresponding object instances as equal - return a == String(b); - } - var isArr = className == arrayClass; - if (!isArr) { - // unwrap any `lodash` wrapped values - var aWrapped = hasOwnProperty.call(a, '__wrapped__'), - bWrapped = hasOwnProperty.call(b, '__wrapped__'); - - if (aWrapped || bWrapped) { - return baseIsEqual(aWrapped ? a.__wrapped__ : a, bWrapped ? b.__wrapped__ : b, callback, isWhere, stackA, stackB); - } - // exit for functions and DOM nodes - if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) { - return false; - } - // in older versions of Opera, `arguments` objects have `Array` constructors - var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor, - ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor; - - // non `Object` object instances with different constructors are not equal - if (ctorA != ctorB && - !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) && - ('constructor' in a && 'constructor' in b) - ) { - return false; - } - } - // assume cyclic structures are equal - // the algorithm for detecting cyclic structures is adapted from ES 5.1 - // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3) - var initedStack = !stackA; - stackA || (stackA = getArray()); - stackB || (stackB = getArray()); - - var length = stackA.length; - while (length--) { - if (stackA[length] == a) { - return stackB[length] == b; - } - } - var size = 0; - result = true; - - // add `a` and `b` to the stack of traversed objects - stackA.push(a); - stackB.push(b); - - // recursively compare objects and arrays (susceptible to call stack limits) - if (isArr) { - // compare lengths to determine if a deep comparison is necessary - length = a.length; - size = b.length; - result = size == length; - - if (result || isWhere) { - // deep compare the contents, ignoring non-numeric properties - while (size--) { - var index = length, - value = b[size]; - - if (isWhere) { - while (index--) { - if ((result = baseIsEqual(a[index], value, callback, isWhere, stackA, stackB))) { - break; - } - } - } else if (!(result = baseIsEqual(a[size], value, callback, isWhere, stackA, stackB))) { - break; - } - } - } - } - else { - // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` - // which, in this case, is more costly - forIn(b, function(value, key, b) { - if (hasOwnProperty.call(b, key)) { - // count the number of properties. - size++; - // deep compare each property value. - return (result = hasOwnProperty.call(a, key) && baseIsEqual(a[key], value, callback, isWhere, stackA, stackB)); - } - }); - - if (result && !isWhere) { - // ensure both objects have the same number of properties - forIn(a, function(value, key, a) { - if (hasOwnProperty.call(a, key)) { - // `size` will be `-1` if `a` has more properties than `b` - return (result = --size > -1); - } - }); - } - } - stackA.pop(); - stackB.pop(); - - if (initedStack) { - releaseArray(stackA); - releaseArray(stackB); - } - return result; - } - - /** - * The base implementation of `_.merge` without argument juggling or support - * for `thisArg` binding. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {Function} [callback] The function to customize merging properties. - * @param {Array} [stackA=[]] Tracks traversed source objects. - * @param {Array} [stackB=[]] Associates values with source counterparts. - */ - function baseMerge(object, source, callback, stackA, stackB) { - (isArray(source) ? forEach : forOwn)(source, function(source, key) { - var found, - isArr, - result = source, - value = object[key]; - - if (source && ((isArr = isArray(source)) || isPlainObject(source))) { - // avoid merging previously merged cyclic sources - var stackLength = stackA.length; - while (stackLength--) { - if ((found = stackA[stackLength] == source)) { - value = stackB[stackLength]; - break; - } - } - if (!found) { - var isShallow; - if (callback) { - result = callback(value, source); - if ((isShallow = typeof result != 'undefined')) { - value = result; - } - } - if (!isShallow) { - value = isArr - ? (isArray(value) ? value : []) - : (isPlainObject(value) ? value : {}); - } - // add `source` and associated `value` to the stack of traversed objects - stackA.push(source); - stackB.push(value); - - // recursively merge objects and arrays (susceptible to call stack limits) - if (!isShallow) { - baseMerge(value, source, callback, stackA, stackB); - } - } - } - else { - if (callback) { - result = callback(value, source); - if (typeof result == 'undefined') { - result = source; - } - } - if (typeof result != 'undefined') { - value = result; - } - } - object[key] = value; - }); - } - - /** - * The base implementation of `_.random` without argument juggling or support - * for returning floating-point numbers. - * - * @private - * @param {number} min The minimum possible value. - * @param {number} max The maximum possible value. - * @returns {number} Returns a random number. - */ - function baseRandom(min, max) { - return min + floor(nativeRandom() * (max - min + 1)); - } - - /** - * The base implementation of `_.uniq` without support for callback shorthands - * or `thisArg` binding. - * - * @private - * @param {Array} array The array to process. - * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted. - * @param {Function} [callback] The function called per iteration. - * @returns {Array} Returns a duplicate-value-free array. - */ - function baseUniq(array, isSorted, callback) { - var index = -1, - indexOf = getIndexOf(), - length = array ? array.length : 0, - result = []; - - var isLarge = !isSorted && length >= largeArraySize && indexOf === baseIndexOf, - seen = (callback || isLarge) ? getArray() : result; - - if (isLarge) { - var cache = createCache(seen); - indexOf = cacheIndexOf; - seen = cache; - } - while (++index < length) { - var value = array[index], - computed = callback ? callback(value, index, array) : value; - - if (isSorted - ? !index || seen[seen.length - 1] !== computed - : indexOf(seen, computed) < 0 - ) { - if (callback || isLarge) { - seen.push(computed); - } - result.push(value); - } - } - if (isLarge) { - releaseArray(seen.array); - releaseObject(seen); - } else if (callback) { - releaseArray(seen); - } - return result; - } - - /** - * Creates a function that aggregates a collection, creating an object composed - * of keys generated from the results of running each element of the collection - * through a callback. The given `setter` function sets the keys and values - * of the composed object. - * - * @private - * @param {Function} setter The setter function. - * @returns {Function} Returns the new aggregator function. - */ - function createAggregator(setter) { - return function(collection, callback, thisArg) { - var result = {}; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - setter(result, value, callback(value, index, collection), collection); - } - } else { - baseEach(collection, function(value, key, collection) { - setter(result, value, callback(value, key, collection), collection); - }); - } - return result; - }; - } - - /** - * Creates a function that, when called, either curries or invokes `func` - * with an optional `this` binding and partially applied arguments. - * - * @private - * @param {Function|string} func The function or method name to reference. - * @param {number} bitmask The bitmask of method flags to compose. - * The bitmask may be composed of the following flags: - * 1 - `_.bind` - * 2 - `_.bindKey` - * 4 - `_.curry` - * 8 - `_.curry` (bound) - * 16 - `_.partial` - * 32 - `_.partialRight` - * @param {Array} [partialArgs] An array of arguments to prepend to those - * provided to the new function. - * @param {Array} [partialRightArgs] An array of arguments to append to those - * provided to the new function. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new function. - */ - function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) { - var isBind = bitmask & 1, - isBindKey = bitmask & 2, - isCurry = bitmask & 4, - isCurryBound = bitmask & 8, - isPartial = bitmask & 16, - isPartialRight = bitmask & 32; - - if (!isBindKey && !isFunction(func)) { - throw new TypeError; - } - if (isPartial && !partialArgs.length) { - bitmask &= ~16; - isPartial = partialArgs = false; - } - if (isPartialRight && !partialRightArgs.length) { - bitmask &= ~32; - isPartialRight = partialRightArgs = false; - } - var bindData = func && func.__bindData__; - if (bindData && bindData !== true) { - // clone `bindData` - bindData = slice(bindData); - if (bindData[2]) { - bindData[2] = slice(bindData[2]); - } - if (bindData[3]) { - bindData[3] = slice(bindData[3]); - } - // set `thisBinding` is not previously bound - if (isBind && !(bindData[1] & 1)) { - bindData[4] = thisArg; - } - // set if previously bound but not currently (subsequent curried functions) - if (!isBind && bindData[1] & 1) { - bitmask |= 8; - } - // set curried arity if not yet set - if (isCurry && !(bindData[1] & 4)) { - bindData[5] = arity; - } - // append partial left arguments - if (isPartial) { - push.apply(bindData[2] || (bindData[2] = []), partialArgs); - } - // append partial right arguments - if (isPartialRight) { - unshift.apply(bindData[3] || (bindData[3] = []), partialRightArgs); - } - // merge flags - bindData[1] |= bitmask; - return createWrapper.apply(null, bindData); - } - // fast path for `_.bind` - var creater = (bitmask == 1 || bitmask === 17) ? baseBind : baseCreateWrapper; - return creater([func, bitmask, partialArgs, partialRightArgs, thisArg, arity]); - } - - /** - * Creates compiled iteration functions. - * - * @private - * @param {...Object} [options] The compile options object(s). - * @param {string} [options.array] Code to determine if the iterable is an array or array-like. - * @param {boolean} [options.useHas] Specify using `hasOwnProperty` checks in the object loop. - * @param {Function} [options.keys] A reference to `_.keys` for use in own property iteration. - * @param {string} [options.args] A comma separated string of iteration function arguments. - * @param {string} [options.top] Code to execute before the iteration branches. - * @param {string} [options.loop] Code to execute in the object loop. - * @param {string} [options.bottom] Code to execute after the iteration branches. - * @returns {Function} Returns the compiled function. - */ - function createIterator() { - // data properties - iteratorData.shadowedProps = shadowedProps; - - // iterator options - iteratorData.array = iteratorData.bottom = iteratorData.loop = iteratorData.top = ''; - iteratorData.init = 'iterable'; - iteratorData.useHas = true; - - // merge options into a template data object - for (var object, index = 0; object = arguments[index]; index++) { - for (var key in object) { - iteratorData[key] = object[key]; - } - } - var args = iteratorData.args; - iteratorData.firstArg = /^[^,]+/.exec(args)[0]; - - // create the function factory - var factory = Function( - 'baseCreateCallback, errorClass, errorProto, hasOwnProperty, ' + - 'indicatorObject, isArguments, isArray, isString, keys, objectProto, ' + - 'objectTypes, nonEnumProps, stringClass, stringProto, toString', - 'return function(' + args + ') {\n' + iteratorTemplate(iteratorData) + '\n}' - ); - - // return the compiled function - return factory( - baseCreateCallback, errorClass, errorProto, hasOwnProperty, - indicatorObject, isArguments, isArray, isString, iteratorData.keys, objectProto, - objectTypes, nonEnumProps, stringClass, stringProto, toString - ); - } - - /** - * Used by `escape` to convert characters to HTML entities. - * - * @private - * @param {string} match The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeHtmlChar(match) { - return htmlEscapes[match]; - } - - /** - * Gets the appropriate "indexOf" function. If the `_.indexOf` method is - * customized, this method returns the custom method, otherwise it returns - * the `baseIndexOf` function. - * - * @private - * @returns {Function} Returns the "indexOf" function. - */ - function getIndexOf() { - var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result; - return result; - } - - /** - * Checks if `value` is a native function. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a native function, else `false`. - */ - function isNative(value) { - return typeof value == 'function' && reNative.test(value); - } - - /** - * Sets `this` binding data on a given function. - * - * @private - * @param {Function} func The function to set data on. - * @param {Array} value The data array to set. - */ - var setBindData = !defineProperty ? noop : function(func, value) { - descriptor.value = value; - defineProperty(func, '__bindData__', descriptor); - }; - - /** - * A fallback implementation of `isPlainObject` which checks if a given value - * is an object created by the `Object` constructor, assuming objects created - * by the `Object` constructor have no inherited enumerable properties and that - * there are no `Object.prototype` extensions. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - */ - function shimIsPlainObject(value) { - var ctor, - result; - - // avoid non Object objects, `arguments` objects, and DOM elements - if (!(value && toString.call(value) == objectClass) || - (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor)) || - (!support.argsClass && isArguments(value)) || - (!support.nodeClass && isNode(value))) { - return false; - } - // IE < 9 iterates inherited properties before own properties. If the first - // iterated property is an object's own property then there are no inherited - // enumerable properties. - if (support.ownLast) { - forIn(value, function(value, key, object) { - result = hasOwnProperty.call(object, key); - return false; - }); - return result !== false; - } - // In most environments an object's own properties are iterated before - // its inherited properties. If the last iterated property is an object's - // own property then there are no inherited enumerable properties. - forIn(value, function(value, key) { - result = key; - }); - return typeof result == 'undefined' || hasOwnProperty.call(value, result); - } - - /** - * Used by `unescape` to convert HTML entities to characters. - * - * @private - * @param {string} match The matched character to unescape. - * @returns {string} Returns the unescaped character. - */ - function unescapeHtmlChar(match) { - return htmlUnescapes[match]; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Checks if `value` is an `arguments` object. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`. - * @example - * - * (function() { return _.isArguments(arguments); })(1, 2, 3); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - function isArguments(value) { - return value && typeof value == 'object' && typeof value.length == 'number' && - toString.call(value) == argsClass || false; - } - // fallback for browsers that can't detect `arguments` objects by [[Class]] - if (!support.argsClass) { - isArguments = function(value) { - return value && typeof value == 'object' && typeof value.length == 'number' && - hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee') || false; - }; - } - - /** - * Checks if `value` is an array. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is an array, else `false`. - * @example - * - * (function() { return _.isArray(arguments); })(); - * // => false - * - * _.isArray([1, 2, 3]); - * // => true - */ - var isArray = nativeIsArray || function(value) { - return value && typeof value == 'object' && typeof value.length == 'number' && - toString.call(value) == arrayClass || false; - }; - - /** - * A fallback implementation of `Object.keys` which produces an array of the - * given object's own enumerable property names. - * - * @private - * @type Function - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property names. - */ - var shimKeys = createIterator({ - 'args': 'object', - 'init': '[]', - 'top': 'if (!(objectTypes[typeof object])) return result', - 'loop': 'result.push(index)' - }); - - /** - * Creates an array composed of the own enumerable property names of an object. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property names. - * @example - * - * _.keys({ 'one': 1, 'two': 2, 'three': 3 }); - * // => ['one', 'two', 'three'] (property order is not guaranteed across environments) - */ - var keys = !nativeKeys ? shimKeys : function(object) { - if (!isObject(object)) { - return []; - } - if ((support.enumPrototypes && typeof object == 'function') || - (support.nonEnumArgs && object.length && isArguments(object))) { - return shimKeys(object); - } - return nativeKeys(object); - }; - - /** Reusable iterator options shared by `each`, `forIn`, and `forOwn` */ - var eachIteratorOptions = { - 'args': 'collection, callback, thisArg', - 'top': "callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)", - 'array': "typeof length == 'number'", - 'keys': keys, - 'loop': 'if (callback(iterable[index], index, collection) === false) return result' - }; - - /** Reusable iterator options for `assign` and `defaults` */ - var defaultsIteratorOptions = { - 'args': 'object, source, guard', - 'top': - 'var args = arguments,\n' + - ' argsIndex = 0,\n' + - " argsLength = typeof guard == 'number' ? 2 : args.length;\n" + - 'while (++argsIndex < argsLength) {\n' + - ' iterable = args[argsIndex];\n' + - ' if (iterable && objectTypes[typeof iterable]) {', - 'keys': keys, - 'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]", - 'bottom': ' }\n}' - }; - - /** Reusable iterator options for `forIn` and `forOwn` */ - var forOwnIteratorOptions = { - 'top': 'if (!objectTypes[typeof iterable]) return result;\n' + eachIteratorOptions.top, - 'array': false - }; - - /** - * Used to convert characters to HTML entities: - * - * Though the `>` character is escaped for symmetry, characters like `>` and `/` - * don't require escaping in HTML and have no special meaning unless they're part - * of a tag or an unquoted attribute value. - * http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact") - */ - var htmlEscapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - - /** Used to convert HTML entities to characters */ - var htmlUnescapes = invert(htmlEscapes); - - /** Used to match HTML entities and HTML characters */ - var reEscapedHtml = RegExp('(' + keys(htmlUnescapes).join('|') + ')', 'g'), - reUnescapedHtml = RegExp('[' + keys(htmlEscapes).join('') + ']', 'g'); - - /** - * A function compiled to iterate `arguments` objects, arrays, objects, and - * strings consistenly across environments, executing the callback for each - * element in the collection. The callback is bound to `thisArg` and invoked - * with three arguments; (value, index|key, collection). Callbacks may exit - * iteration early by explicitly returning `false`. - * - * @private - * @type Function - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array|Object|string} Returns `collection`. - */ - var baseEach = createIterator(eachIteratorOptions); - - /*--------------------------------------------------------------------------*/ - - /** - * Assigns own enumerable properties of source object(s) to the destination - * object. Subsequent sources will overwrite property assignments of previous - * sources. If a callback is provided it will be executed to produce the - * assigned values. The callback is bound to `thisArg` and invoked with two - * arguments; (objectValue, sourceValue). - * - * @static - * @memberOf _ - * @type Function - * @alias extend - * @category Objects - * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. - * @param {Function} [callback] The function to customize assigning values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the destination object. - * @example - * - * _.assign({ 'name': 'fred' }, { 'employer': 'slate' }); - * // => { 'name': 'fred', 'employer': 'slate' } - * - * var defaults = _.partialRight(_.assign, function(a, b) { - * return typeof a == 'undefined' ? b : a; - * }); - * - * var object = { 'name': 'barney' }; - * defaults(object, { 'name': 'fred', 'employer': 'slate' }); - * // => { 'name': 'barney', 'employer': 'slate' } - */ - var assign = createIterator(defaultsIteratorOptions, { - 'top': - defaultsIteratorOptions.top.replace(';', - ';\n' + - "if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n" + - ' var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);\n' + - "} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n" + - ' callback = args[--argsLength];\n' + - '}' - ), - 'loop': 'result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]' - }); - - /** - * Creates a clone of `value`. If `isDeep` is `true` nested objects will also - * be cloned, otherwise they will be assigned by reference. If a callback - * is provided it will be executed to produce the cloned values. If the - * callback returns `undefined` cloning will be handled by the method instead. - * The callback is bound to `thisArg` and invoked with one argument; (value). - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to clone. - * @param {boolean} [isDeep=false] Specify a deep clone. - * @param {Function} [callback] The function to customize cloning values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the cloned value. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * var shallow = _.clone(characters); - * shallow[0] === characters[0]; - * // => true - * - * var deep = _.clone(characters, true); - * deep[0] === characters[0]; - * // => false - * - * _.mixin({ - * 'clone': _.partialRight(_.clone, function(value) { - * return _.isElement(value) ? value.cloneNode(false) : undefined; - * }) - * }); - * - * var clone = _.clone(document.body); - * clone.childNodes.length; - * // => 0 - */ - function clone(value, isDeep, callback, thisArg) { - // allows working with "Collections" methods without using their `index` - // and `collection` arguments for `isDeep` and `callback` - if (typeof isDeep != 'boolean' && isDeep != null) { - thisArg = callback; - callback = isDeep; - isDeep = false; - } - return baseClone(value, isDeep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1)); - } - - /** - * Creates a deep clone of `value`. If a callback is provided it will be - * executed to produce the cloned values. If the callback returns `undefined` - * cloning will be handled by the method instead. The callback is bound to - * `thisArg` and invoked with one argument; (value). - * - * Note: This method is loosely based on the structured clone algorithm. Functions - * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and - * objects created by constructors other than `Object` are cloned to plain `Object` objects. - * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to deep clone. - * @param {Function} [callback] The function to customize cloning values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the deep cloned value. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * var deep = _.cloneDeep(characters); - * deep[0] === characters[0]; - * // => false - * - * var view = { - * 'label': 'docs', - * 'node': element - * }; - * - * var clone = _.cloneDeep(view, function(value) { - * return _.isElement(value) ? value.cloneNode(true) : undefined; - * }); - * - * clone.node == view.node; - * // => false - */ - function cloneDeep(value, callback, thisArg) { - return baseClone(value, true, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1)); - } - - /** - * Creates an object that inherits from the given `prototype` object. If a - * `properties` object is provided its own enumerable properties are assigned - * to the created object. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} prototype The object to inherit from. - * @param {Object} [properties] The properties to assign to the object. - * @returns {Object} Returns the new object. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * function Circle() { - * Shape.call(this); - * } - * - * Circle.prototype = _.create(Shape.prototype, { 'constructor': Circle }); - * - * var circle = new Circle; - * circle instanceof Circle; - * // => true - * - * circle instanceof Shape; - * // => true - */ - function create(prototype, properties) { - var result = baseCreate(prototype); - return properties ? assign(result, properties) : result; - } - - /** - * Assigns own enumerable properties of source object(s) to the destination - * object for all destination properties that resolve to `undefined`. Once a - * property is set, additional defaults of the same property will be ignored. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. - * @param- {Object} [guard] Allows working with `_.reduce` without using its - * `key` and `object` arguments as sources. - * @returns {Object} Returns the destination object. - * @example - * - * var object = { 'name': 'barney' }; - * _.defaults(object, { 'name': 'fred', 'employer': 'slate' }); - * // => { 'name': 'barney', 'employer': 'slate' } - */ - var defaults = createIterator(defaultsIteratorOptions); - - /** - * This method is like `_.findIndex` except that it returns the key of the - * first element that passes the callback check, instead of the element itself. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to search. - * @param {Function|Object|string} [callback=identity] The function called per - * iteration. If a property name or object is provided it will be used to - * create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {string|undefined} Returns the key of the found element, else `undefined`. - * @example - * - * var characters = { - * 'barney': { 'age': 36, 'blocked': false }, - * 'fred': { 'age': 40, 'blocked': true }, - * 'pebbles': { 'age': 1, 'blocked': false } - * }; - * - * _.findKey(characters, function(chr) { - * return chr.age < 40; - * }); - * // => 'barney' (property order is not guaranteed across environments) - * - * // using "_.where" callback shorthand - * _.findKey(characters, { 'age': 1 }); - * // => 'pebbles' - * - * // using "_.pluck" callback shorthand - * _.findKey(characters, 'blocked'); - * // => 'fred' - */ - function findKey(object, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - forOwn(object, function(value, key, object) { - if (callback(value, key, object)) { - result = key; - return false; - } - }); - return result; - } - - /** - * This method is like `_.findKey` except that it iterates over elements - * of a `collection` in the opposite order. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to search. - * @param {Function|Object|string} [callback=identity] The function called per - * iteration. If a property name or object is provided it will be used to - * create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {string|undefined} Returns the key of the found element, else `undefined`. - * @example - * - * var characters = { - * 'barney': { 'age': 36, 'blocked': true }, - * 'fred': { 'age': 40, 'blocked': false }, - * 'pebbles': { 'age': 1, 'blocked': true } - * }; - * - * _.findLastKey(characters, function(chr) { - * return chr.age < 40; - * }); - * // => returns `pebbles`, assuming `_.findKey` returns `barney` - * - * // using "_.where" callback shorthand - * _.findLastKey(characters, { 'age': 40 }); - * // => 'fred' - * - * // using "_.pluck" callback shorthand - * _.findLastKey(characters, 'blocked'); - * // => 'pebbles' - */ - function findLastKey(object, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - forOwnRight(object, function(value, key, object) { - if (callback(value, key, object)) { - result = key; - return false; - } - }); - return result; - } - - /** - * Iterates over own and inherited enumerable properties of an object, - * executing the callback for each property. The callback is bound to `thisArg` - * and invoked with three arguments; (value, key, object). Callbacks may exit - * iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * Shape.prototype.move = function(x, y) { - * this.x += x; - * this.y += y; - * }; - * - * _.forIn(new Shape, function(value, key) { - * console.log(key); - * }); - * // => logs 'x', 'y', and 'move' (property order is not guaranteed across environments) - */ - var forIn = createIterator(eachIteratorOptions, forOwnIteratorOptions, { - 'useHas': false - }); - - /** - * This method is like `_.forIn` except that it iterates over elements - * of a `collection` in the opposite order. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * Shape.prototype.move = function(x, y) { - * this.x += x; - * this.y += y; - * }; - * - * _.forInRight(new Shape, function(value, key) { - * console.log(key); - * }); - * // => logs 'move', 'y', and 'x' assuming `_.forIn ` logs 'x', 'y', and 'move' - */ - function forInRight(object, callback, thisArg) { - var pairs = []; - - forIn(object, function(value, key) { - pairs.push(key, value); - }); - - var length = pairs.length; - callback = baseCreateCallback(callback, thisArg, 3); - while (length--) { - if (callback(pairs[length--], pairs[length], object) === false) { - break; - } - } - return object; - } - - /** - * Iterates over own enumerable properties of an object, executing the callback - * for each property. The callback is bound to `thisArg` and invoked with three - * arguments; (value, key, object). Callbacks may exit iteration early by - * explicitly returning `false`. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { - * console.log(key); - * }); - * // => logs '0', '1', and 'length' (property order is not guaranteed across environments) - */ - var forOwn = createIterator(eachIteratorOptions, forOwnIteratorOptions); - - /** - * This method is like `_.forOwn` except that it iterates over elements - * of a `collection` in the opposite order. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { - * console.log(key); - * }); - * // => logs 'length', '1', and '0' assuming `_.forOwn` logs '0', '1', and 'length' - */ - function forOwnRight(object, callback, thisArg) { - var props = keys(object), - length = props.length; - - callback = baseCreateCallback(callback, thisArg, 3); - while (length--) { - var key = props[length]; - if (callback(object[key], key, object) === false) { - break; - } - } - return object; - } - - /** - * Creates a sorted array of property names of all enumerable properties, - * own and inherited, of `object` that have function values. - * - * @static - * @memberOf _ - * @alias methods - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property names that have function values. - * @example - * - * _.functions(_); - * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...] - */ - function functions(object) { - var result = []; - forIn(object, function(value, key) { - if (isFunction(value)) { - result.push(key); - } - }); - return result.sort(); - } - - /** - * Checks if the specified property name exists as a direct property of `object`, - * instead of an inherited property. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @param {string} key The name of the property to check. - * @returns {boolean} Returns `true` if key is a direct property, else `false`. - * @example - * - * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); - * // => true - */ - function has(object, key) { - return object ? hasOwnProperty.call(object, key) : false; - } - - /** - * Creates an object composed of the inverted keys and values of the given object. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to invert. - * @returns {Object} Returns the created inverted object. - * @example - * - * _.invert({ 'first': 'fred', 'second': 'barney' }); - * // => { 'fred': 'first', 'barney': 'second' } - */ - function invert(object) { - var index = -1, - props = keys(object), - length = props.length, - result = {}; - - while (++index < length) { - var key = props[index]; - result[object[key]] = key; - } - return result; - } - - /** - * Checks if `value` is a boolean value. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a boolean value, else `false`. - * @example - * - * _.isBoolean(null); - * // => false - */ - function isBoolean(value) { - return value === true || value === false || - value && typeof value == 'object' && toString.call(value) == boolClass || false; - } - - /** - * Checks if `value` is a date. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a date, else `false`. - * @example - * - * _.isDate(new Date); - * // => true - */ - function isDate(value) { - return value && typeof value == 'object' && toString.call(value) == dateClass || false; - } - - /** - * Checks if `value` is a DOM element. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a DOM element, else `false`. - * @example - * - * _.isElement(document.body); - * // => true - */ - function isElement(value) { - return value && value.nodeType === 1 || false; - } - - /** - * Checks if `value` is empty. Arrays, strings, or `arguments` objects with a - * length of `0` and objects with no own enumerable properties are considered - * "empty". - * - * @static - * @memberOf _ - * @category Objects - * @param {Array|Object|string} value The value to inspect. - * @returns {boolean} Returns `true` if the `value` is empty, else `false`. - * @example - * - * _.isEmpty([1, 2, 3]); - * // => false - * - * _.isEmpty({}); - * // => true - * - * _.isEmpty(''); - * // => true - */ - function isEmpty(value) { - var result = true; - if (!value) { - return result; - } - var className = toString.call(value), - length = value.length; - - if ((className == arrayClass || className == stringClass || - (support.argsClass ? className == argsClass : isArguments(value))) || - (className == objectClass && typeof length == 'number' && isFunction(value.splice))) { - return !length; - } - forOwn(value, function() { - return (result = false); - }); - return result; - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent to each other. If a callback is provided it will be executed - * to compare values. If the callback returns `undefined` comparisons will - * be handled by the method instead. The callback is bound to `thisArg` and - * invoked with two arguments; (a, b). - * - * @static - * @memberOf _ - * @category Objects - * @param {*} a The value to compare. - * @param {*} b The other value to compare. - * @param {Function} [callback] The function to customize comparing values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'name': 'fred' }; - * var copy = { 'name': 'fred' }; - * - * object == copy; - * // => false - * - * _.isEqual(object, copy); - * // => true - * - * var words = ['hello', 'goodbye']; - * var otherWords = ['hi', 'goodbye']; - * - * _.isEqual(words, otherWords, function(a, b) { - * var reGreet = /^(?:hello|hi)$/i, - * aGreet = _.isString(a) && reGreet.test(a), - * bGreet = _.isString(b) && reGreet.test(b); - * - * return (aGreet || bGreet) ? (aGreet == bGreet) : undefined; - * }); - * // => true - */ - function isEqual(a, b, callback, thisArg) { - return baseIsEqual(a, b, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 2)); - } - - /** - * Checks if `value` is, or can be coerced to, a finite number. - * - * Note: This is not the same as native `isFinite` which will return true for - * booleans and empty strings. See http://es5.github.io/#x15.1.2.5. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is finite, else `false`. - * @example - * - * _.isFinite(-101); - * // => true - * - * _.isFinite('10'); - * // => true - * - * _.isFinite(true); - * // => false - * - * _.isFinite(''); - * // => false - * - * _.isFinite(Infinity); - * // => false - */ - function isFinite(value) { - return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value)); - } - - /** - * Checks if `value` is a function. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - */ - function isFunction(value) { - return typeof value == 'function'; - } - // fallback for older versions of Chrome and Safari - if (isFunction(/x/)) { - isFunction = function(value) { - return typeof value == 'function' && toString.call(value) == funcClass; - }; - } - - /** - * Checks if `value` is the language type of Object. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ - function isObject(value) { - // check if the value is the ECMAScript language type of Object - // http://es5.github.io/#x8 - // and avoid a V8 bug - // http://code.google.com/p/v8/issues/detail?id=2291 - return !!(value && objectTypes[typeof value]); - } - - /** - * Checks if `value` is `NaN`. - * - * Note: This is not the same as native `isNaN` which will return `true` for - * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is `NaN`, else `false`. - * @example - * - * _.isNaN(NaN); - * // => true - * - * _.isNaN(new Number(NaN)); - * // => true - * - * isNaN(undefined); - * // => true - * - * _.isNaN(undefined); - * // => false - */ - function isNaN(value) { - // `NaN` as a primitive is the only value that is not equal to itself - // (perform the [[Class]] check first to avoid errors with some host objects in IE) - return isNumber(value) && value != +value; - } - - /** - * Checks if `value` is `null`. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is `null`, else `false`. - * @example - * - * _.isNull(null); - * // => true - * - * _.isNull(undefined); - * // => false - */ - function isNull(value) { - return value === null; - } - - /** - * Checks if `value` is a number. - * - * Note: `NaN` is considered a number. See http://es5.github.io/#x8.5. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a number, else `false`. - * @example - * - * _.isNumber(8.4 * 5); - * // => true - */ - function isNumber(value) { - return typeof value == 'number' || - value && typeof value == 'object' && toString.call(value) == numberClass || false; - } - - /** - * Checks if `value` is an object created by the `Object` constructor. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * _.isPlainObject(new Shape); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'x': 0, 'y': 0 }); - * // => true - */ - var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { - if (!(value && toString.call(value) == objectClass) || (!support.argsClass && isArguments(value))) { - return false; - } - var valueOf = value.valueOf, - objProto = isNative(valueOf) && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); - - return objProto - ? (value == objProto || getPrototypeOf(value) == objProto) - : shimIsPlainObject(value); - }; - - /** - * Checks if `value` is a regular expression. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a regular expression, else `false`. - * @example - * - * _.isRegExp(/fred/); - * // => true - */ - function isRegExp(value) { - return value && objectTypes[typeof value] && toString.call(value) == regexpClass || false; - } - - /** - * Checks if `value` is a string. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a string, else `false`. - * @example - * - * _.isString('fred'); - * // => true - */ - function isString(value) { - return typeof value == 'string' || - value && typeof value == 'object' && toString.call(value) == stringClass || false; - } - - /** - * Checks if `value` is `undefined`. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is `undefined`, else `false`. - * @example - * - * _.isUndefined(void 0); - * // => true - */ - function isUndefined(value) { - return typeof value == 'undefined'; - } - - /** - * Creates an object with the same keys as `object` and values generated by - * running each own enumerable property of `object` through the callback. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, key, object). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new object with values of the results of each `callback` execution. - * @example - * - * _.mapValues({ 'a': 1, 'b': 2, 'c': 3} , function(num) { return num * 3; }); - * // => { 'a': 3, 'b': 6, 'c': 9 } - * - * var characters = { - * 'fred': { 'name': 'fred', 'age': 40 }, - * 'pebbles': { 'name': 'pebbles', 'age': 1 } - * }; - * - * // using "_.pluck" callback shorthand - * _.mapValues(characters, 'age'); - * // => { 'fred': 40, 'pebbles': 1 } - */ - function mapValues(object, callback, thisArg) { - var result = {}; - callback = lodash.createCallback(callback, thisArg, 3); - - forOwn(object, function(value, key, object) { - result[key] = callback(value, key, object); - }); - return result; - } - - /** - * Recursively merges own enumerable properties of the source object(s), that - * don't resolve to `undefined` into the destination object. Subsequent sources - * will overwrite property assignments of previous sources. If a callback is - * provided it will be executed to produce the merged values of the destination - * and source properties. If the callback returns `undefined` merging will - * be handled by the method instead. The callback is bound to `thisArg` and - * invoked with two arguments; (objectValue, sourceValue). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. - * @param {Function} [callback] The function to customize merging properties. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the destination object. - * @example - * - * var names = { - * 'characters': [ - * { 'name': 'barney' }, - * { 'name': 'fred' } - * ] - * }; - * - * var ages = { - * 'characters': [ - * { 'age': 36 }, - * { 'age': 40 } - * ] - * }; - * - * _.merge(names, ages); - * // => { 'characters': [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }] } - * - * var food = { - * 'fruits': ['apple'], - * 'vegetables': ['beet'] - * }; - * - * var otherFood = { - * 'fruits': ['banana'], - * 'vegetables': ['carrot'] - * }; - * - * _.merge(food, otherFood, function(a, b) { - * return _.isArray(a) ? a.concat(b) : undefined; - * }); - * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] } - */ - function merge(object) { - var args = arguments, - length = 2; - - if (!isObject(object)) { - return object; - } - // allows working with `_.reduce` and `_.reduceRight` without using - // their `index` and `collection` arguments - if (typeof args[2] != 'number') { - length = args.length; - } - if (length > 3 && typeof args[length - 2] == 'function') { - var callback = baseCreateCallback(args[--length - 1], args[length--], 2); - } else if (length > 2 && typeof args[length - 1] == 'function') { - callback = args[--length]; - } - var sources = slice(arguments, 1, length), - index = -1, - stackA = getArray(), - stackB = getArray(); - - while (++index < length) { - baseMerge(object, sources[index], callback, stackA, stackB); - } - releaseArray(stackA); - releaseArray(stackB); - return object; - } - - /** - * Creates a shallow clone of `object` excluding the specified properties. - * Property names may be specified as individual arguments or as arrays of - * property names. If a callback is provided it will be executed for each - * property of `object` omitting the properties the callback returns truey - * for. The callback is bound to `thisArg` and invoked with three arguments; - * (value, key, object). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The source object. - * @param {Function|...string|string[]} [callback] The properties to omit or the - * function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns an object without the omitted properties. - * @example - * - * _.omit({ 'name': 'fred', 'age': 40 }, 'age'); - * // => { 'name': 'fred' } - * - * _.omit({ 'name': 'fred', 'age': 40 }, function(value) { - * return typeof value == 'number'; - * }); - * // => { 'name': 'fred' } - */ - function omit(object, callback, thisArg) { - var result = {}; - if (typeof callback != 'function') { - var props = []; - forIn(object, function(value, key) { - props.push(key); - }); - props = baseDifference(props, baseFlatten(arguments, true, false, 1)); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - result[key] = object[key]; - } - } else { - callback = lodash.createCallback(callback, thisArg, 3); - forIn(object, function(value, key, object) { - if (!callback(value, key, object)) { - result[key] = value; - } - }); - } - return result; - } - - /** - * Creates a two dimensional array of an object's key-value pairs, - * i.e. `[[key1, value1], [key2, value2]]`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns new array of key-value pairs. - * @example - * - * _.pairs({ 'barney': 36, 'fred': 40 }); - * // => [['barney', 36], ['fred', 40]] (property order is not guaranteed across environments) - */ - function pairs(object) { - var index = -1, - props = keys(object), - length = props.length, - result = Array(length); - - while (++index < length) { - var key = props[index]; - result[index] = [key, object[key]]; - } - return result; - } - - /** - * Creates a shallow clone of `object` composed of the specified properties. - * Property names may be specified as individual arguments or as arrays of - * property names. If a callback is provided it will be executed for each - * property of `object` picking the properties the callback returns truey - * for. The callback is bound to `thisArg` and invoked with three arguments; - * (value, key, object). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The source object. - * @param {Function|...string|string[]} [callback] The function called per - * iteration or property names to pick, specified as individual property - * names or arrays of property names. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns an object composed of the picked properties. - * @example - * - * _.pick({ 'name': 'fred', '_userid': 'fred1' }, 'name'); - * // => { 'name': 'fred' } - * - * _.pick({ 'name': 'fred', '_userid': 'fred1' }, function(value, key) { - * return key.charAt(0) != '_'; - * }); - * // => { 'name': 'fred' } - */ - function pick(object, callback, thisArg) { - var result = {}; - if (typeof callback != 'function') { - var index = -1, - props = baseFlatten(arguments, true, false, 1), - length = isObject(object) ? props.length : 0; - - while (++index < length) { - var key = props[index]; - if (key in object) { - result[key] = object[key]; - } - } - } else { - callback = lodash.createCallback(callback, thisArg, 3); - forIn(object, function(value, key, object) { - if (callback(value, key, object)) { - result[key] = value; - } - }); - } - return result; - } - - /** - * An alternative to `_.reduce` this method transforms `object` to a new - * `accumulator` object which is the result of running each of its own - * enumerable properties through a callback, with each callback execution - * potentially mutating the `accumulator` object. The callback is bound to - * `thisArg` and invoked with four arguments; (accumulator, value, key, object). - * Callbacks may exit iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Array|Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [accumulator] The custom accumulator value. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the accumulated value. - * @example - * - * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) { - * num *= num; - * if (num % 2) { - * return result.push(num) < 3; - * } - * }); - * // => [1, 9, 25] - * - * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { - * result[key] = num * 3; - * }); - * // => { 'a': 3, 'b': 6, 'c': 9 } - */ - function transform(object, callback, accumulator, thisArg) { - var isArr = isArray(object); - if (accumulator == null) { - if (isArr) { - accumulator = []; - } else { - var ctor = object && object.constructor, - proto = ctor && ctor.prototype; - - accumulator = baseCreate(proto); - } - } - if (callback) { - callback = lodash.createCallback(callback, thisArg, 4); - (isArr ? baseEach : forOwn)(object, function(value, index, object) { - return callback(accumulator, value, index, object); - }); - } - return accumulator; - } - - /** - * Creates an array composed of the own enumerable property values of `object`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property values. - * @example - * - * _.values({ 'one': 1, 'two': 2, 'three': 3 }); - * // => [1, 2, 3] (property order is not guaranteed across environments) - */ - function values(object) { - var index = -1, - props = keys(object), - length = props.length, - result = Array(length); - - while (++index < length) { - result[index] = object[props[index]]; - } - return result; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Creates an array of elements from the specified indexes, or keys, of the - * `collection`. Indexes may be specified as individual arguments or as arrays - * of indexes. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {...(number|number[]|string|string[])} [index] The indexes of `collection` - * to retrieve, specified as individual indexes or arrays of indexes. - * @returns {Array} Returns a new array of elements corresponding to the - * provided indexes. - * @example - * - * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]); - * // => ['a', 'c', 'e'] - * - * _.at(['fred', 'barney', 'pebbles'], 0, 2); - * // => ['fred', 'pebbles'] - */ - function at(collection) { - var args = arguments, - index = -1, - props = baseFlatten(args, true, false, 1), - length = (args[2] && args[2][args[1]] === collection) ? 1 : props.length, - result = Array(length); - - if (support.unindexedChars && isString(collection)) { - collection = collection.split(''); - } - while(++index < length) { - result[index] = collection[props[index]]; - } - return result; - } - - /** - * Checks if a given value is present in a collection using strict equality - * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the - * offset from the end of the collection. - * - * @static - * @memberOf _ - * @alias include - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {*} target The value to check for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {boolean} Returns `true` if the `target` element is found, else `false`. - * @example - * - * _.contains([1, 2, 3], 1); - * // => true - * - * _.contains([1, 2, 3], 1, 2); - * // => false - * - * _.contains({ 'name': 'fred', 'age': 40 }, 'fred'); - * // => true - * - * _.contains('pebbles', 'eb'); - * // => true - */ - function contains(collection, target, fromIndex) { - var index = -1, - indexOf = getIndexOf(), - length = collection ? collection.length : 0, - result = false; - - fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0; - if (isArray(collection)) { - result = indexOf(collection, target, fromIndex) > -1; - } else if (typeof length == 'number') { - result = (isString(collection) ? collection.indexOf(target, fromIndex) : indexOf(collection, target, fromIndex)) > -1; - } else { - baseEach(collection, function(value) { - if (++index >= fromIndex) { - return !(result = value === target); - } - }); - } - return result; - } - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` through the callback. The corresponding value - * of each key is the number of times the key was returned by the callback. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); }); - * // => { '4': 1, '6': 2 } - * - * _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math); - * // => { '4': 1, '6': 2 } - * - * _.countBy(['one', 'two', 'three'], 'length'); - * // => { '3': 2, '5': 1 } - */ - var countBy = createAggregator(function(result, value, key) { - (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1); - }); - - /** - * Checks if the given callback returns truey value for **all** elements of - * a collection. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias all - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {boolean} Returns `true` if all elements passed the callback check, - * else `false`. - * @example - * - * _.every([true, 1, null, 'yes']); - * // => false - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * // using "_.pluck" callback shorthand - * _.every(characters, 'age'); - * // => true - * - * // using "_.where" callback shorthand - * _.every(characters, { 'age': 36 }); - * // => false - */ - function every(collection, callback, thisArg) { - var result = true; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if (!(result = !!callback(collection[index], index, collection))) { - break; - } - } - } else { - baseEach(collection, function(value, index, collection) { - return (result = !!callback(value, index, collection)); - }); - } - return result; - } - - /** - * Iterates over elements of a collection, returning an array of all elements - * the callback returns truey for. The callback is bound to `thisArg` and - * invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias select - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of elements that passed the callback check. - * @example - * - * var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); - * // => [2, 4, 6] - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true } - * ]; - * - * // using "_.pluck" callback shorthand - * _.filter(characters, 'blocked'); - * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }] - * - * // using "_.where" callback shorthand - * _.filter(characters, { 'age': 36 }); - * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }] - */ - function filter(collection, callback, thisArg) { - var result = []; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (callback(value, index, collection)) { - result.push(value); - } - } - } else { - baseEach(collection, function(value, index, collection) { - if (callback(value, index, collection)) { - result.push(value); - } - }); - } - return result; - } - - /** - * Iterates over elements of a collection, returning the first element that - * the callback returns truey for. The callback is bound to `thisArg` and - * invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias detect, findWhere - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the found element, else `undefined`. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true }, - * { 'name': 'pebbles', 'age': 1, 'blocked': false } - * ]; - * - * _.find(characters, function(chr) { - * return chr.age < 40; - * }); - * // => { 'name': 'barney', 'age': 36, 'blocked': false } - * - * // using "_.where" callback shorthand - * _.find(characters, { 'age': 1 }); - * // => { 'name': 'pebbles', 'age': 1, 'blocked': false } - * - * // using "_.pluck" callback shorthand - * _.find(characters, 'blocked'); - * // => { 'name': 'fred', 'age': 40, 'blocked': true } - */ - function find(collection, callback, thisArg) { - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (callback(value, index, collection)) { - return value; - } - } - } else { - var result; - baseEach(collection, function(value, index, collection) { - if (callback(value, index, collection)) { - result = value; - return false; - } - }); - return result; - } - } - - /** - * This method is like `_.find` except that it iterates over elements - * of a `collection` from right to left. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the found element, else `undefined`. - * @example - * - * _.findLast([1, 2, 3, 4], function(num) { - * return num % 2 == 1; - * }); - * // => 3 - */ - function findLast(collection, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - forEachRight(collection, function(value, index, collection) { - if (callback(value, index, collection)) { - result = value; - return false; - } - }); - return result; - } - - /** - * Iterates over elements of a collection, executing the callback for each - * element. The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). Callbacks may exit iteration early by - * explicitly returning `false`. - * - * Note: As with other "Collections" methods, objects with a `length` property - * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` - * may be used for object iteration. - * - * @static - * @memberOf _ - * @alias each - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array|Object|string} Returns `collection`. - * @example - * - * _([1, 2, 3]).forEach(function(num) { console.log(num); }).join(','); - * // => logs each number and returns '1,2,3' - * - * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); - * // => logs each number and returns the object (property order is not guaranteed across environments) - */ - function forEach(collection, callback, thisArg) { - if (callback && typeof thisArg == 'undefined' && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if (callback(collection[index], index, collection) === false) { - break; - } - } - } else { - baseEach(collection, callback, thisArg); - } - return collection; - } - - /** - * This method is like `_.forEach` except that it iterates over elements - * of a `collection` from right to left. - * - * @static - * @memberOf _ - * @alias eachRight - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array|Object|string} Returns `collection`. - * @example - * - * _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(','); - * // => logs each number from right to left and returns '3,2,1' - */ - function forEachRight(collection, callback, thisArg) { - var iterable = collection, - length = collection ? collection.length : 0; - - callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); - if (isArray(collection)) { - while (length--) { - if (callback(collection[length], length, collection) === false) { - break; - } - } - } else { - if (typeof length != 'number') { - var props = keys(collection); - length = props.length; - } else if (support.unindexedChars && isString(collection)) { - iterable = collection.split(''); - } - baseEach(collection, function(value, key, collection) { - key = props ? props[--length] : --length; - return callback(iterable[key], key, collection); - }); - } - return collection; - } - - /** - * Creates an object composed of keys generated from the results of running - * each element of a collection through the callback. The corresponding value - * of each key is an array of the elements responsible for generating the key. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false` - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); }); - * // => { '4': [4.2], '6': [6.1, 6.4] } - * - * _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math); - * // => { '4': [4.2], '6': [6.1, 6.4] } - * - * // using "_.pluck" callback shorthand - * _.groupBy(['one', 'two', 'three'], 'length'); - * // => { '3': ['one', 'two'], '5': ['three'] } - */ - var groupBy = createAggregator(function(result, value, key) { - (hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value); - }); - - /** - * Creates an object composed of keys generated from the results of running - * each element of the collection through the given callback. The corresponding - * value of each key is the last element responsible for generating the key. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * var keys = [ - * { 'dir': 'left', 'code': 97 }, - * { 'dir': 'right', 'code': 100 } - * ]; - * - * _.indexBy(keys, 'dir'); - * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } - * - * _.indexBy(keys, function(key) { return String.fromCharCode(key.code); }); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - * - * _.indexBy(characters, function(key) { this.fromCharCode(key.code); }, String); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - */ - var indexBy = createAggregator(function(result, value, key) { - result[key] = value; - }); - - /** - * Invokes the method named by `methodName` on each element in the `collection` - * returning an array of the results of each invoked method. Additional arguments - * will be provided to each invoked method. If `methodName` is a function it - * will be invoked for, and `this` bound to, each element in the `collection`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|string} methodName The name of the method to invoke or - * the function invoked per iteration. - * @param {...*} [arg] Arguments to invoke the method with. - * @returns {Array} Returns a new array of the results of each invoked method. - * @example - * - * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); - * // => [[1, 5, 7], [1, 2, 3]] - * - * _.invoke([123, 456], String.prototype.split, ''); - * // => [['1', '2', '3'], ['4', '5', '6']] - */ - function invoke(collection, methodName) { - var args = slice(arguments, 2), - index = -1, - isFunc = typeof methodName == 'function', - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - forEach(collection, function(value) { - result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args); - }); - return result; - } - - /** - * Creates an array of values by running each element in the collection - * through the callback. The callback is bound to `thisArg` and invoked with - * three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias collect - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of the results of each `callback` execution. - * @example - * - * _.map([1, 2, 3], function(num) { return num * 3; }); - * // => [3, 6, 9] - * - * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); - * // => [3, 6, 9] (property order is not guaranteed across environments) - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * // using "_.pluck" callback shorthand - * _.map(characters, 'name'); - * // => ['barney', 'fred'] - */ - function map(collection, callback, thisArg) { - var index = -1, - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - callback = lodash.createCallback(callback, thisArg, 3); - if (isArray(collection)) { - while (++index < length) { - result[index] = callback(collection[index], index, collection); - } - } else { - baseEach(collection, function(value, key, collection) { - result[++index] = callback(value, key, collection); - }); - } - return result; - } - - /** - * Retrieves the maximum value of a collection. If the collection is empty or - * falsey `-Infinity` is returned. If a callback is provided it will be executed - * for each value in the collection to generate the criterion by which the value - * is ranked. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the maximum value. - * @example - * - * _.max([4, 2, 8, 6]); - * // => 8 - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * _.max(characters, function(chr) { return chr.age; }); - * // => { 'name': 'fred', 'age': 40 }; - * - * // using "_.pluck" callback shorthand - * _.max(characters, 'age'); - * // => { 'name': 'fred', 'age': 40 }; - */ - function max(collection, callback, thisArg) { - var computed = -Infinity, - result = computed; - - // allows working with functions like `_.map` without using - // their `index` argument as a callback - if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) { - callback = null; - } - if (callback == null && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (value > result) { - result = value; - } - } - } else { - callback = (callback == null && isString(collection)) - ? charAtCallback - : lodash.createCallback(callback, thisArg, 3); - - baseEach(collection, function(value, index, collection) { - var current = callback(value, index, collection); - if (current > computed) { - computed = current; - result = value; - } - }); - } - return result; - } - - /** - * Retrieves the minimum value of a collection. If the collection is empty or - * falsey `Infinity` is returned. If a callback is provided it will be executed - * for each value in the collection to generate the criterion by which the value - * is ranked. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the minimum value. - * @example - * - * _.min([4, 2, 8, 6]); - * // => 2 - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * _.min(characters, function(chr) { return chr.age; }); - * // => { 'name': 'barney', 'age': 36 }; - * - * // using "_.pluck" callback shorthand - * _.min(characters, 'age'); - * // => { 'name': 'barney', 'age': 36 }; - */ - function min(collection, callback, thisArg) { - var computed = Infinity, - result = computed; - - // allows working with functions like `_.map` without using - // their `index` argument as a callback - if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) { - callback = null; - } - if (callback == null && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (value < result) { - result = value; - } - } - } else { - callback = (callback == null && isString(collection)) - ? charAtCallback - : lodash.createCallback(callback, thisArg, 3); - - baseEach(collection, function(value, index, collection) { - var current = callback(value, index, collection); - if (current < computed) { - computed = current; - result = value; - } - }); - } - return result; - } - - /** - * Retrieves the value of a specified property from all elements in the collection. - * - * @static - * @memberOf _ - * @type Function - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {string} property The name of the property to pluck. - * @returns {Array} Returns a new array of property values. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * _.pluck(characters, 'name'); - * // => ['barney', 'fred'] - */ - var pluck = map; - - /** - * Reduces a collection to a value which is the accumulated result of running - * each element in the collection through the callback, where each successive - * callback execution consumes the return value of the previous execution. If - * `accumulator` is not provided the first element of the collection will be - * used as the initial `accumulator` value. The callback is bound to `thisArg` - * and invoked with four arguments; (accumulator, value, index|key, collection). - * - * @static - * @memberOf _ - * @alias foldl, inject - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [accumulator] Initial value of the accumulator. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the accumulated value. - * @example - * - * var sum = _.reduce([1, 2, 3], function(sum, num) { - * return sum + num; - * }); - * // => 6 - * - * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { - * result[key] = num * 3; - * return result; - * }, {}); - * // => { 'a': 3, 'b': 6, 'c': 9 } - */ - function reduce(collection, callback, accumulator, thisArg) { - var noaccum = arguments.length < 3; - callback = lodash.createCallback(callback, thisArg, 4); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - if (noaccum) { - accumulator = collection[++index]; - } - while (++index < length) { - accumulator = callback(accumulator, collection[index], index, collection); - } - } else { - baseEach(collection, function(value, index, collection) { - accumulator = noaccum - ? (noaccum = false, value) - : callback(accumulator, value, index, collection) - }); - } - return accumulator; - } - - /** - * This method is like `_.reduce` except that it iterates over elements - * of a `collection` from right to left. - * - * @static - * @memberOf _ - * @alias foldr - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [accumulator] Initial value of the accumulator. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the accumulated value. - * @example - * - * var list = [[0, 1], [2, 3], [4, 5]]; - * var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); - * // => [4, 5, 2, 3, 0, 1] - */ - function reduceRight(collection, callback, accumulator, thisArg) { - var noaccum = arguments.length < 3; - callback = lodash.createCallback(callback, thisArg, 4); - forEachRight(collection, function(value, index, collection) { - accumulator = noaccum - ? (noaccum = false, value) - : callback(accumulator, value, index, collection); - }); - return accumulator; - } - - /** - * The opposite of `_.filter` this method returns the elements of a - * collection that the callback does **not** return truey for. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of elements that failed the callback check. - * @example - * - * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); - * // => [1, 3, 5] - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true } - * ]; - * - * // using "_.pluck" callback shorthand - * _.reject(characters, 'blocked'); - * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }] - * - * // using "_.where" callback shorthand - * _.reject(characters, { 'age': 36 }); - * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }] - */ - function reject(collection, callback, thisArg) { - callback = lodash.createCallback(callback, thisArg, 3); - return filter(collection, function(value, index, collection) { - return !callback(value, index, collection); - }); - } - - /** - * Retrieves a random element or `n` random elements from a collection. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to sample. - * @param {number} [n] The number of elements to sample. - * @param- {Object} [guard] Allows working with functions like `_.map` - * without using their `index` arguments as `n`. - * @returns {Array} Returns the random sample(s) of `collection`. - * @example - * - * _.sample([1, 2, 3, 4]); - * // => 2 - * - * _.sample([1, 2, 3, 4], 2); - * // => [3, 1] - */ - function sample(collection, n, guard) { - if (collection && typeof collection.length != 'number') { - collection = values(collection); - } else if (support.unindexedChars && isString(collection)) { - collection = collection.split(''); - } - if (n == null || guard) { - return collection ? collection[baseRandom(0, collection.length - 1)] : undefined; - } - var result = shuffle(collection); - result.length = nativeMin(nativeMax(0, n), result.length); - return result; - } - - /** - * Creates an array of shuffled values, using a version of the Fisher-Yates - * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to shuffle. - * @returns {Array} Returns a new shuffled collection. - * @example - * - * _.shuffle([1, 2, 3, 4, 5, 6]); - * // => [4, 1, 6, 3, 5, 2] - */ - function shuffle(collection) { - var index = -1, - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - forEach(collection, function(value) { - var rand = baseRandom(0, ++index); - result[index] = result[rand]; - result[rand] = value; - }); - return result; - } - - /** - * Gets the size of the `collection` by returning `collection.length` for arrays - * and array-like objects or the number of own enumerable properties for objects. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to inspect. - * @returns {number} Returns `collection.length` or number of own enumerable properties. - * @example - * - * _.size([1, 2]); - * // => 2 - * - * _.size({ 'one': 1, 'two': 2, 'three': 3 }); - * // => 3 - * - * _.size('pebbles'); - * // => 7 - */ - function size(collection) { - var length = collection ? collection.length : 0; - return typeof length == 'number' ? length : keys(collection).length; - } - - /** - * Checks if the callback returns a truey value for **any** element of a - * collection. The function returns as soon as it finds a passing value and - * does not iterate over the entire collection. The callback is bound to - * `thisArg` and invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias any - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {boolean} Returns `true` if any element passed the callback check, - * else `false`. - * @example - * - * _.some([null, 0, 'yes', false], Boolean); - * // => true - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true } - * ]; - * - * // using "_.pluck" callback shorthand - * _.some(characters, 'blocked'); - * // => true - * - * // using "_.where" callback shorthand - * _.some(characters, { 'age': 1 }); - * // => false - */ - function some(collection, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if ((result = callback(collection[index], index, collection))) { - break; - } - } - } else { - baseEach(collection, function(value, index, collection) { - return !(result = callback(value, index, collection)); - }); - } - return !!result; - } - - /** - * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection through the callback. This method - * performs a stable sort, that is, it will preserve the original sort order - * of equal elements. The callback is bound to `thisArg` and invoked with - * three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an array of property names is provided for `callback` the collection - * will be sorted by each property value. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Array|Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of sorted elements. - * @example - * - * _.sortBy([1, 2, 3], function(num) { return Math.sin(num); }); - * // => [3, 1, 2] - * - * _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math); - * // => [3, 1, 2] - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 }, - * { 'name': 'barney', 'age': 26 }, - * { 'name': 'fred', 'age': 30 } - * ]; - * - * // using "_.pluck" callback shorthand - * _.map(_.sortBy(characters, 'age'), _.values); - * // => [['barney', 26], ['fred', 30], ['barney', 36], ['fred', 40]] - * - * // sorting by multiple properties - * _.map(_.sortBy(characters, ['name', 'age']), _.values); - * // = > [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]] - */ - function sortBy(collection, callback, thisArg) { - var index = -1, - isArr = isArray(callback), - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - if (!isArr) { - callback = lodash.createCallback(callback, thisArg, 3); - } - forEach(collection, function(value, key, collection) { - var object = result[++index] = getObject(); - if (isArr) { - object.criteria = map(callback, function(key) { return value[key]; }); - } else { - (object.criteria = getArray())[0] = callback(value, key, collection); - } - object.index = index; - object.value = value; - }); - - length = result.length; - result.sort(compareAscending); - while (length--) { - var object = result[length]; - result[length] = object.value; - if (!isArr) { - releaseArray(object.criteria); - } - releaseObject(object); - } - return result; - } - - /** - * Converts the `collection` to an array. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to convert. - * @returns {Array} Returns the new converted array. - * @example - * - * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4); - * // => [2, 3, 4] - */ - function toArray(collection) { - if (collection && typeof collection.length == 'number') { - return (support.unindexedChars && isString(collection)) - ? collection.split('') - : slice(collection); - } - return values(collection); - } - - /** - * Performs a deep comparison of each element in a `collection` to the given - * `properties` object, returning an array of all elements that have equivalent - * property values. - * - * @static - * @memberOf _ - * @type Function - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Object} props The object of property values to filter by. - * @returns {Array} Returns a new array of elements that have the given properties. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }, - * { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] } - * ]; - * - * _.where(characters, { 'age': 36 }); - * // => [{ 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }] - * - * _.where(characters, { 'pets': ['dino'] }); - * // => [{ 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] }] - */ - var where = filter; - - /*--------------------------------------------------------------------------*/ - - /** - * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are all falsey. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to compact. - * @returns {Array} Returns a new array of filtered values. - * @example - * - * _.compact([0, 1, false, 2, '', 3]); - * // => [1, 2, 3] - */ - function compact(array) { - var index = -1, - length = array ? array.length : 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value) { - result.push(value); - } - } - return result; - } - - /** - * Creates an array excluding all values of the provided arrays using strict - * equality for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to process. - * @param {...Array} [values] The arrays of values to exclude. - * @returns {Array} Returns a new array of filtered values. - * @example - * - * _.difference([1, 2, 3, 4, 5], [5, 2, 10]); - * // => [1, 3, 4] - */ - function difference(array) { - return baseDifference(array, baseFlatten(arguments, true, true, 1)); - } - - /** - * This method is like `_.find` except that it returns the index of the first - * element that passes the callback check, instead of the element itself. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true }, - * { 'name': 'pebbles', 'age': 1, 'blocked': false } - * ]; - * - * _.findIndex(characters, function(chr) { - * return chr.age < 20; - * }); - * // => 2 - * - * // using "_.where" callback shorthand - * _.findIndex(characters, { 'age': 36 }); - * // => 0 - * - * // using "_.pluck" callback shorthand - * _.findIndex(characters, 'blocked'); - * // => 1 - */ - function findIndex(array, callback, thisArg) { - var index = -1, - length = array ? array.length : 0; - - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length) { - if (callback(array[index], index, array)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.findIndex` except that it iterates over elements - * of a `collection` from right to left. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': true }, - * { 'name': 'fred', 'age': 40, 'blocked': false }, - * { 'name': 'pebbles', 'age': 1, 'blocked': true } - * ]; - * - * _.findLastIndex(characters, function(chr) { - * return chr.age > 30; - * }); - * // => 1 - * - * // using "_.where" callback shorthand - * _.findLastIndex(characters, { 'age': 36 }); - * // => 0 - * - * // using "_.pluck" callback shorthand - * _.findLastIndex(characters, 'blocked'); - * // => 2 - */ - function findLastIndex(array, callback, thisArg) { - var length = array ? array.length : 0; - callback = lodash.createCallback(callback, thisArg, 3); - while (length--) { - if (callback(array[length], length, array)) { - return length; - } - } - return -1; - } - - /** - * Gets the first element or first `n` elements of an array. If a callback - * is provided elements at the beginning of the array are returned as long - * as the callback returns truey. The callback is bound to `thisArg` and - * invoked with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias head, take - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback] The function called - * per element or the number of elements to return. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the first element(s) of `array`. - * @example - * - * _.first([1, 2, 3]); - * // => 1 - * - * _.first([1, 2, 3], 2); - * // => [1, 2] - * - * _.first([1, 2, 3], function(num) { - * return num < 3; - * }); - * // => [1, 2] - * - * var characters = [ - * { 'name': 'barney', 'blocked': true, 'employer': 'slate' }, - * { 'name': 'fred', 'blocked': false, 'employer': 'slate' }, - * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.first(characters, 'blocked'); - * // => [{ 'name': 'barney', 'blocked': true, 'employer': 'slate' }] - * - * // using "_.where" callback shorthand - * _.pluck(_.first(characters, { 'employer': 'slate' }), 'name'); - * // => ['barney', 'fred'] - */ - function first(array, callback, thisArg) { - var n = 0, - length = array ? array.length : 0; - - if (typeof callback != 'number' && callback != null) { - var index = -1; - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length && callback(array[index], index, array)) { - n++; - } - } else { - n = callback; - if (n == null || thisArg) { - return array ? array[0] : undefined; - } - } - return slice(array, 0, nativeMin(nativeMax(0, n), length)); - } - - /** - * Flattens a nested array (the nesting can be to any depth). If `isShallow` - * is truey, the array will only be flattened a single level. If a callback - * is provided each element of the array is passed through the callback before - * flattening. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to flatten. - * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new flattened array. - * @example - * - * _.flatten([1, [2], [3, [[4]]]]); - * // => [1, 2, 3, 4]; - * - * _.flatten([1, [2], [3, [[4]]]], true); - * // => [1, 2, 3, [[4]]]; - * - * var characters = [ - * { 'name': 'barney', 'age': 30, 'pets': ['hoppy'] }, - * { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] } - * ]; - * - * // using "_.pluck" callback shorthand - * _.flatten(characters, 'pets'); - * // => ['hoppy', 'baby puss', 'dino'] - */ - function flatten(array, isShallow, callback, thisArg) { - // juggle arguments - if (typeof isShallow != 'boolean' && isShallow != null) { - thisArg = callback; - callback = (typeof isShallow != 'function' && thisArg && thisArg[isShallow] === array) ? null : isShallow; - isShallow = false; - } - if (callback != null) { - array = map(array, callback, thisArg); - } - return baseFlatten(array, isShallow); - } - - /** - * Gets the index at which the first occurrence of `value` is found using - * strict equality for comparisons, i.e. `===`. If the array is already sorted - * providing `true` for `fromIndex` will run a faster binary search. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {boolean|number} [fromIndex=0] The index to search from or `true` - * to perform a binary search on a sorted array. - * @returns {number} Returns the index of the matched value or `-1`. - * @example - * - * _.indexOf([1, 2, 3, 1, 2, 3], 2); - * // => 1 - * - * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3); - * // => 4 - * - * _.indexOf([1, 1, 2, 2, 3, 3], 2, true); - * // => 2 - */ - function indexOf(array, value, fromIndex) { - if (typeof fromIndex == 'number') { - var length = array ? array.length : 0; - fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0); - } else if (fromIndex) { - var index = sortedIndex(array, value); - return array[index] === value ? index : -1; - } - return baseIndexOf(array, value, fromIndex); - } - - /** - * Gets all but the last element or last `n` elements of an array. If a - * callback is provided elements at the end of the array are excluded from - * the result as long as the callback returns truey. The callback is bound - * to `thisArg` and invoked with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback=1] The function called - * per element or the number of elements to exclude. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a slice of `array`. - * @example - * - * _.initial([1, 2, 3]); - * // => [1, 2] - * - * _.initial([1, 2, 3], 2); - * // => [1] - * - * _.initial([1, 2, 3], function(num) { - * return num > 1; - * }); - * // => [1] - * - * var characters = [ - * { 'name': 'barney', 'blocked': false, 'employer': 'slate' }, - * { 'name': 'fred', 'blocked': true, 'employer': 'slate' }, - * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.initial(characters, 'blocked'); - * // => [{ 'name': 'barney', 'blocked': false, 'employer': 'slate' }] - * - * // using "_.where" callback shorthand - * _.pluck(_.initial(characters, { 'employer': 'na' }), 'name'); - * // => ['barney', 'fred'] - */ - function initial(array, callback, thisArg) { - var n = 0, - length = array ? array.length : 0; - - if (typeof callback != 'number' && callback != null) { - var index = length; - callback = lodash.createCallback(callback, thisArg, 3); - while (index-- && callback(array[index], index, array)) { - n++; - } - } else { - n = (callback == null || thisArg) ? 1 : callback || n; - } - return slice(array, 0, nativeMin(nativeMax(0, length - n), length)); - } - - /** - * Creates an array of unique values present in all provided arrays using - * strict equality for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {...Array} [array] The arrays to inspect. - * @returns {Array} Returns an array of shared values. - * @example - * - * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]); - * // => [1, 2] - */ - function intersection() { - var args = [], - argsIndex = -1, - argsLength = arguments.length, - caches = getArray(), - indexOf = getIndexOf(), - trustIndexOf = indexOf === baseIndexOf, - seen = getArray(); - - while (++argsIndex < argsLength) { - var value = arguments[argsIndex]; - if (isArray(value) || isArguments(value)) { - args.push(value); - caches.push(trustIndexOf && value.length >= largeArraySize && - createCache(argsIndex ? args[argsIndex] : seen)); - } - } - var array = args[0], - index = -1, - length = array ? array.length : 0, - result = []; - - outer: - while (++index < length) { - var cache = caches[0]; - value = array[index]; - - if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) { - argsIndex = argsLength; - (cache || seen).push(value); - while (--argsIndex) { - cache = caches[argsIndex]; - if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) { - continue outer; - } - } - result.push(value); - } - } - while (argsLength--) { - cache = caches[argsLength]; - if (cache) { - releaseObject(cache); - } - } - releaseArray(caches); - releaseArray(seen); - return result; - } - - /** - * Gets the last element or last `n` elements of an array. If a callback is - * provided elements at the end of the array are returned as long as the - * callback returns truey. The callback is bound to `thisArg` and invoked - * with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback] The function called - * per element or the number of elements to return. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the last element(s) of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - * - * _.last([1, 2, 3], 2); - * // => [2, 3] - * - * _.last([1, 2, 3], function(num) { - * return num > 1; - * }); - * // => [2, 3] - * - * var characters = [ - * { 'name': 'barney', 'blocked': false, 'employer': 'slate' }, - * { 'name': 'fred', 'blocked': true, 'employer': 'slate' }, - * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.pluck(_.last(characters, 'blocked'), 'name'); - * // => ['fred', 'pebbles'] - * - * // using "_.where" callback shorthand - * _.last(characters, { 'employer': 'na' }); - * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }] - */ - function last(array, callback, thisArg) { - var n = 0, - length = array ? array.length : 0; - - if (typeof callback != 'number' && callback != null) { - var index = length; - callback = lodash.createCallback(callback, thisArg, 3); - while (index-- && callback(array[index], index, array)) { - n++; - } - } else { - n = callback; - if (n == null || thisArg) { - return array ? array[length - 1] : undefined; - } - } - return slice(array, nativeMax(0, length - n)); - } - - /** - * Gets the index at which the last occurrence of `value` is found using strict - * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used - * as the offset from the end of the collection. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the matched value or `-1`. - * @example - * - * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); - * // => 4 - * - * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); - * // => 1 - */ - function lastIndexOf(array, value, fromIndex) { - var index = array ? array.length : 0; - if (typeof fromIndex == 'number') { - index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1; - } - while (index--) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * Removes all provided values from the given array using strict equality for - * comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to modify. - * @param {...*} [value] The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3, 1, 2, 3]; - * _.pull(array, 2, 3); - * console.log(array); - * // => [1, 1] - */ - function pull(array) { - var args = arguments, - argsIndex = 0, - argsLength = args.length, - length = array ? array.length : 0; - - while (++argsIndex < argsLength) { - var index = -1, - value = args[argsIndex]; - while (++index < length) { - if (array[index] === value) { - splice.call(array, index--, 1); - length--; - } - } - } - return array; - } - - /** - * Creates an array of numbers (positive and/or negative) progressing from - * `start` up to but not including `end`. If `start` is less than `stop` a - * zero-length range is created unless a negative `step` is specified. - * - * @static - * @memberOf _ - * @category Arrays - * @param {number} [start=0] The start of the range. - * @param {number} end The end of the range. - * @param {number} [step=1] The value to increment or decrement by. - * @returns {Array} Returns a new range array. - * @example - * - * _.range(4); - * // => [0, 1, 2, 3] - * - * _.range(1, 5); - * // => [1, 2, 3, 4] - * - * _.range(0, 20, 5); - * // => [0, 5, 10, 15] - * - * _.range(0, -4, -1); - * // => [0, -1, -2, -3] - * - * _.range(1, 4, 0); - * // => [1, 1, 1] - * - * _.range(0); - * // => [] - */ - function range(start, end, step) { - start = +start || 0; - step = typeof step == 'number' ? step : (+step || 1); - - if (end == null) { - end = start; - start = 0; - } - // use `Array(length)` so engines like Chakra and V8 avoid slower modes - // http://youtu.be/XAqIpGU8ZZk#t=17m25s - var index = -1, - length = nativeMax(0, ceil((end - start) / (step || 1))), - result = Array(length); - - while (++index < length) { - result[index] = start; - start += step; - } - return result; - } - - /** - * Removes all elements from an array that the callback returns truey for - * and returns an array of removed elements. The callback is bound to `thisArg` - * and invoked with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to modify. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4, 5, 6]; - * var evens = _.remove(array, function(num) { return num % 2 == 0; }); - * - * console.log(array); - * // => [1, 3, 5] - * - * console.log(evens); - * // => [2, 4, 6] - */ - function remove(array, callback, thisArg) { - var index = -1, - length = array ? array.length : 0, - result = []; - - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length) { - var value = array[index]; - if (callback(value, index, array)) { - result.push(value); - splice.call(array, index--, 1); - length--; - } - } - return result; - } - - /** - * The opposite of `_.initial` this method gets all but the first element or - * first `n` elements of an array. If a callback function is provided elements - * at the beginning of the array are excluded from the result as long as the - * callback returns truey. The callback is bound to `thisArg` and invoked - * with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias drop, tail - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback=1] The function called - * per element or the number of elements to exclude. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a slice of `array`. - * @example - * - * _.rest([1, 2, 3]); - * // => [2, 3] - * - * _.rest([1, 2, 3], 2); - * // => [3] - * - * _.rest([1, 2, 3], function(num) { - * return num < 3; - * }); - * // => [3] - * - * var characters = [ - * { 'name': 'barney', 'blocked': true, 'employer': 'slate' }, - * { 'name': 'fred', 'blocked': false, 'employer': 'slate' }, - * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.pluck(_.rest(characters, 'blocked'), 'name'); - * // => ['fred', 'pebbles'] - * - * // using "_.where" callback shorthand - * _.rest(characters, { 'employer': 'slate' }); - * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }] - */ - function rest(array, callback, thisArg) { - if (typeof callback != 'number' && callback != null) { - var n = 0, - index = -1, - length = array ? array.length : 0; - - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length && callback(array[index], index, array)) { - n++; - } - } else { - n = (callback == null || thisArg) ? 1 : nativeMax(0, callback); - } - return slice(array, n); - } - - /** - * Uses a binary search to determine the smallest index at which a value - * should be inserted into a given sorted array in order to maintain the sort - * order of the array. If a callback is provided it will be executed for - * `value` and each element of `array` to compute their sort ranking. The - * callback is bound to `thisArg` and invoked with one argument; (value). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to inspect. - * @param {*} value The value to evaluate. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * _.sortedIndex([20, 30, 50], 40); - * // => 2 - * - * // using "_.pluck" callback shorthand - * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); - * // => 2 - * - * var dict = { - * 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 } - * }; - * - * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { - * return dict.wordToNumber[word]; - * }); - * // => 2 - * - * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { - * return this.wordToNumber[word]; - * }, dict); - * // => 2 - */ - function sortedIndex(array, value, callback, thisArg) { - var low = 0, - high = array ? array.length : low; - - // explicitly reference `identity` for better inlining in Firefox - callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity; - value = callback(value); - - while (low < high) { - var mid = (low + high) >>> 1; - (callback(array[mid]) < value) - ? low = mid + 1 - : high = mid; - } - return low; - } - - /** - * Creates an array of unique values, in order, of the provided arrays using - * strict equality for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {...Array} [array] The arrays to inspect. - * @returns {Array} Returns an array of combined values. - * @example - * - * _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]); - * // => [1, 2, 3, 5, 4] - */ - function union() { - return baseUniq(baseFlatten(arguments, true, true)); - } - - /** - * Creates a duplicate-value-free version of an array using strict equality - * for comparisons, i.e. `===`. If the array is sorted, providing - * `true` for `isSorted` will use a faster algorithm. If a callback is provided - * each element of `array` is passed through the callback before uniqueness - * is computed. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias unique - * @category Arrays - * @param {Array} array The array to process. - * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a duplicate-value-free array. - * @example - * - * _.uniq([1, 2, 1, 3, 1]); - * // => [1, 2, 3] - * - * _.uniq([1, 1, 2, 2, 3], true); - * // => [1, 2, 3] - * - * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); }); - * // => ['A', 'b', 'C'] - * - * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math); - * // => [1, 2.5, 3] - * - * // using "_.pluck" callback shorthand - * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - function uniq(array, isSorted, callback, thisArg) { - // juggle arguments - if (typeof isSorted != 'boolean' && isSorted != null) { - thisArg = callback; - callback = (typeof isSorted != 'function' && thisArg && thisArg[isSorted] === array) ? null : isSorted; - isSorted = false; - } - if (callback != null) { - callback = lodash.createCallback(callback, thisArg, 3); - } - return baseUniq(array, isSorted, callback); - } - - /** - * Creates an array excluding all provided values using strict equality for - * comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to filter. - * @param {...*} [value] The values to exclude. - * @returns {Array} Returns a new array of filtered values. - * @example - * - * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); - * // => [2, 3, 4] - */ - function without(array) { - return baseDifference(array, slice(arguments, 1)); - } - - /** - * Creates an array that is the symmetric difference of the provided arrays. - * See http://en.wikipedia.org/wiki/Symmetric_difference. - * - * @static - * @memberOf _ - * @category Arrays - * @param {...Array} [array] The arrays to inspect. - * @returns {Array} Returns an array of values. - * @example - * - * _.xor([1, 2, 3], [5, 2, 1, 4]); - * // => [3, 5, 4] - * - * _.xor([1, 2, 5], [2, 3, 5], [3, 4, 5]); - * // => [1, 4, 5] - */ - function xor() { - var index = -1, - length = arguments.length; - - while (++index < length) { - var array = arguments[index]; - if (isArray(array) || isArguments(array)) { - var result = result - ? baseUniq(baseDifference(result, array).concat(baseDifference(array, result))) - : array; - } - } - return result || []; - } - - /** - * Creates an array of grouped elements, the first of which contains the first - * elements of the given arrays, the second of which contains the second - * elements of the given arrays, and so on. - * - * @static - * @memberOf _ - * @alias unzip - * @category Arrays - * @param {...Array} [array] Arrays to process. - * @returns {Array} Returns a new array of grouped elements. - * @example - * - * _.zip(['fred', 'barney'], [30, 40], [true, false]); - * // => [['fred', 30, true], ['barney', 40, false]] - */ - function zip() { - var array = arguments.length > 1 ? arguments : arguments[0], - index = -1, - length = array ? max(pluck(array, 'length')) : 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = pluck(array, index); - } - return result; - } - - /** - * Creates an object composed from arrays of `keys` and `values`. Provide - * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` - * or two arrays, one of `keys` and one of corresponding `values`. - * - * @static - * @memberOf _ - * @alias object - * @category Arrays - * @param {Array} keys The array of keys. - * @param {Array} [values=[]] The array of values. - * @returns {Object} Returns an object composed of the given keys and - * corresponding values. - * @example - * - * _.zipObject(['fred', 'barney'], [30, 40]); - * // => { 'fred': 30, 'barney': 40 } - */ - function zipObject(keys, values) { - var index = -1, - length = keys ? keys.length : 0, - result = {}; - - if (!values && length && !isArray(keys[0])) { - values = []; - } - while (++index < length) { - var key = keys[index]; - if (values) { - result[key] = values[index]; - } else if (key) { - result[key[0]] = key[1]; - } - } - return result; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a function that executes `func`, with the `this` binding and - * arguments of the created function, only after being called `n` times. - * - * @static - * @memberOf _ - * @category Functions - * @param {number} n The number of times the function must be called before - * `func` is executed. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var saves = ['profile', 'settings']; - * - * var done = _.after(saves.length, function() { - * console.log('Done saving!'); - * }); - * - * _.forEach(saves, function(type) { - * asyncSave({ 'type': type, 'complete': done }); - * }); - * // => logs 'Done saving!', after all saves have completed - */ - function after(n, func) { - if (!isFunction(func)) { - throw new TypeError; - } - return function() { - if (--n < 1) { - return func.apply(this, arguments); - } - }; - } - - /** - * Creates a function that, when called, invokes `func` with the `this` - * binding of `thisArg` and prepends any additional `bind` arguments to those - * provided to the bound function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to bind. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var func = function(greeting) { - * return greeting + ' ' + this.name; - * }; - * - * func = _.bind(func, { 'name': 'fred' }, 'hi'); - * func(); - * // => 'hi fred' - */ - function bind(func, thisArg) { - return arguments.length > 2 - ? createWrapper(func, 17, slice(arguments, 2), null, thisArg) - : createWrapper(func, 1, null, null, thisArg); - } - - /** - * Binds methods of an object to the object itself, overwriting the existing - * method. Method names may be specified as individual arguments or as arrays - * of method names. If no method names are provided all the function properties - * of `object` will be bound. - * - * @static - * @memberOf _ - * @category Functions - * @param {Object} object The object to bind and assign the bound methods to. - * @param {...string} [methodName] The object method names to - * bind, specified as individual method names or arrays of method names. - * @returns {Object} Returns `object`. - * @example - * - * var view = { - * 'label': 'docs', - * 'onClick': function() { console.log('clicked ' + this.label); } - * }; - * - * _.bindAll(view); - * jQuery('#docs').on('click', view.onClick); - * // => logs 'clicked docs', when the button is clicked - */ - function bindAll(object) { - var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object), - index = -1, - length = funcs.length; - - while (++index < length) { - var key = funcs[index]; - object[key] = createWrapper(object[key], 1, null, null, object); - } - return object; - } - - /** - * Creates a function that, when called, invokes the method at `object[key]` - * and prepends any additional `bindKey` arguments to those provided to the bound - * function. This method differs from `_.bind` by allowing bound functions to - * reference methods that will be redefined or don't yet exist. - * See http://michaux.ca/articles/lazy-function-definition-pattern. - * - * @static - * @memberOf _ - * @category Functions - * @param {Object} object The object the method belongs to. - * @param {string} key The key of the method. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var object = { - * 'name': 'fred', - * 'greet': function(greeting) { - * return greeting + ' ' + this.name; - * } - * }; - * - * var func = _.bindKey(object, 'greet', 'hi'); - * func(); - * // => 'hi fred' - * - * object.greet = function(greeting) { - * return greeting + 'ya ' + this.name + '!'; - * }; - * - * func(); - * // => 'hiya fred!' - */ - function bindKey(object, key) { - return arguments.length > 2 - ? createWrapper(key, 19, slice(arguments, 2), null, object) - : createWrapper(key, 3, null, null, object); - } - - /** - * Creates a function that is the composition of the provided functions, - * where each function consumes the return value of the function that follows. - * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. - * Each function is executed with the `this` binding of the composed function. - * - * @static - * @memberOf _ - * @category Functions - * @param {...Function} [func] Functions to compose. - * @returns {Function} Returns the new composed function. - * @example - * - * var realNameMap = { - * 'pebbles': 'penelope' - * }; - * - * var format = function(name) { - * name = realNameMap[name.toLowerCase()] || name; - * return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase(); - * }; - * - * var greet = function(formatted) { - * return 'Hiya ' + formatted + '!'; - * }; - * - * var welcome = _.compose(greet, format); - * welcome('pebbles'); - * // => 'Hiya Penelope!' - */ - function compose() { - var funcs = arguments, - length = funcs.length; - - while (length--) { - if (!isFunction(funcs[length])) { - throw new TypeError; - } - } - return function() { - var args = arguments, - length = funcs.length; - - while (length--) { - args = [funcs[length].apply(this, args)]; - } - return args[0]; - }; - } - - /** - * Creates a function which accepts one or more arguments of `func` that when - * invoked either executes `func` returning its result, if all `func` arguments - * have been provided, or returns a function that accepts one or more of the - * remaining `func` arguments, and so on. The arity of `func` can be specified - * if `func.length` is not sufficient. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @returns {Function} Returns the new curried function. - * @example - * - * var curried = _.curry(function(a, b, c) { - * console.log(a + b + c); - * }); - * - * curried(1)(2)(3); - * // => 6 - * - * curried(1, 2)(3); - * // => 6 - * - * curried(1, 2, 3); - * // => 6 - */ - function curry(func, arity) { - arity = typeof arity == 'number' ? arity : (+arity || func.length); - return createWrapper(func, 4, null, null, null, arity); - } - - /** - * Creates a function that will delay the execution of `func` until after - * `wait` milliseconds have elapsed since the last time it was invoked. - * Provide an options object to indicate that `func` should be invoked on - * the leading and/or trailing edge of the `wait` timeout. Subsequent calls - * to the debounced function will return the result of the last `func` call. - * - * Note: If `leading` and `trailing` options are `true` `func` will be called - * on the trailing edge of the timeout only if the the debounced function is - * invoked more than once during the `wait` timeout. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to debounce. - * @param {number} wait The number of milliseconds to delay. - * @param {Object} [options] The options object. - * @param {boolean} [options.leading=false] Specify execution on the leading edge of the timeout. - * @param {number} [options.maxWait] The maximum time `func` is allowed to be delayed before it's called. - * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // avoid costly calculations while the window size is in flux - * var lazyLayout = _.debounce(calculateLayout, 150); - * jQuery(window).on('resize', lazyLayout); - * - * // execute `sendMail` when the click event is fired, debouncing subsequent calls - * jQuery('#postbox').on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * }); - * - * // ensure `batchLog` is executed once after 1 second of debounced calls - * var source = new EventSource('/stream'); - * source.addEventListener('message', _.debounce(batchLog, 250, { - * 'maxWait': 1000 - * }, false); - */ - function debounce(func, wait, options) { - var args, - maxTimeoutId, - result, - stamp, - thisArg, - timeoutId, - trailingCall, - lastCalled = 0, - maxWait = false, - trailing = true; - - if (!isFunction(func)) { - throw new TypeError; - } - wait = nativeMax(0, wait) || 0; - if (options === true) { - var leading = true; - trailing = false; - } else if (isObject(options)) { - leading = options.leading; - maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0); - trailing = 'trailing' in options ? options.trailing : trailing; - } - var delayed = function() { - var remaining = wait - (now() - stamp); - if (remaining <= 0) { - if (maxTimeoutId) { - clearTimeout(maxTimeoutId); - } - var isCalled = trailingCall; - maxTimeoutId = timeoutId = trailingCall = undefined; - if (isCalled) { - lastCalled = now(); - result = func.apply(thisArg, args); - if (!timeoutId && !maxTimeoutId) { - args = thisArg = null; - } - } - } else { - timeoutId = setTimeout(delayed, remaining); - } - }; - - var maxDelayed = function() { - if (timeoutId) { - clearTimeout(timeoutId); - } - maxTimeoutId = timeoutId = trailingCall = undefined; - if (trailing || (maxWait !== wait)) { - lastCalled = now(); - result = func.apply(thisArg, args); - if (!timeoutId && !maxTimeoutId) { - args = thisArg = null; - } - } - }; - - return function() { - args = arguments; - stamp = now(); - thisArg = this; - trailingCall = trailing && (timeoutId || !leading); - - if (maxWait === false) { - var leadingCall = leading && !timeoutId; - } else { - if (!maxTimeoutId && !leading) { - lastCalled = stamp; - } - var remaining = maxWait - (stamp - lastCalled), - isCalled = remaining <= 0; - - if (isCalled) { - if (maxTimeoutId) { - maxTimeoutId = clearTimeout(maxTimeoutId); - } - lastCalled = stamp; - result = func.apply(thisArg, args); - } - else if (!maxTimeoutId) { - maxTimeoutId = setTimeout(maxDelayed, remaining); - } - } - if (isCalled && timeoutId) { - timeoutId = clearTimeout(timeoutId); - } - else if (!timeoutId && wait !== maxWait) { - timeoutId = setTimeout(delayed, wait); - } - if (leadingCall) { - isCalled = true; - result = func.apply(thisArg, args); - } - if (isCalled && !timeoutId && !maxTimeoutId) { - args = thisArg = null; - } - return result; - }; - } - - /** - * Defers executing the `func` function until the current call stack has cleared. - * Additional arguments will be provided to `func` when it is invoked. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to defer. - * @param {...*} [arg] Arguments to invoke the function with. - * @returns {number} Returns the timer id. - * @example - * - * _.defer(function(text) { console.log(text); }, 'deferred'); - * // logs 'deferred' after one or more milliseconds - */ - function defer(func) { - if (!isFunction(func)) { - throw new TypeError; - } - var args = slice(arguments, 1); - return setTimeout(function() { func.apply(undefined, args); }, 1); - } - - /** - * Executes the `func` function after `wait` milliseconds. Additional arguments - * will be provided to `func` when it is invoked. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay execution. - * @param {...*} [arg] Arguments to invoke the function with. - * @returns {number} Returns the timer id. - * @example - * - * _.delay(function(text) { console.log(text); }, 1000, 'later'); - * // => logs 'later' after one second - */ - function delay(func, wait) { - if (!isFunction(func)) { - throw new TypeError; - } - var args = slice(arguments, 2); - return setTimeout(function() { func.apply(undefined, args); }, wait); - } - - /** - * Creates a function that memoizes the result of `func`. If `resolver` is - * provided it will be used to determine the cache key for storing the result - * based on the arguments provided to the memoized function. By default, the - * first argument provided to the memoized function is used as the cache key. - * The `func` is executed with the `this` binding of the memoized function. - * The result cache is exposed as the `cache` property on the memoized function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to have its output memoized. - * @param {Function} [resolver] A function used to resolve the cache key. - * @returns {Function} Returns the new memoizing function. - * @example - * - * var fibonacci = _.memoize(function(n) { - * return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); - * }); - * - * fibonacci(9) - * // => 34 - * - * var data = { - * 'fred': { 'name': 'fred', 'age': 40 }, - * 'pebbles': { 'name': 'pebbles', 'age': 1 } - * }; - * - * // modifying the result cache - * var get = _.memoize(function(name) { return data[name]; }, _.identity); - * get('pebbles'); - * // => { 'name': 'pebbles', 'age': 1 } - * - * get.cache.pebbles.name = 'penelope'; - * get('pebbles'); - * // => { 'name': 'penelope', 'age': 1 } - */ - function memoize(func, resolver) { - if (!isFunction(func)) { - throw new TypeError; - } - var memoized = function() { - var cache = memoized.cache, - key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0]; - - return hasOwnProperty.call(cache, key) - ? cache[key] - : (cache[key] = func.apply(this, arguments)); - } - memoized.cache = {}; - return memoized; - } - - /** - * Creates a function that is restricted to execute `func` once. Repeat calls to - * the function will return the value of the first call. The `func` is executed - * with the `this` binding of the created function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var initialize = _.once(createApplication); - * initialize(); - * initialize(); - * // `initialize` executes `createApplication` once - */ - function once(func) { - var ran, - result; - - if (!isFunction(func)) { - throw new TypeError; - } - return function() { - if (ran) { - return result; - } - ran = true; - result = func.apply(this, arguments); - - // clear the `func` variable so the function may be garbage collected - func = null; - return result; - }; - } - - /** - * Creates a function that, when called, invokes `func` with any additional - * `partial` arguments prepended to those provided to the new function. This - * method is similar to `_.bind` except it does **not** alter the `this` binding. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * var greet = function(greeting, name) { return greeting + ' ' + name; }; - * var hi = _.partial(greet, 'hi'); - * hi('fred'); - * // => 'hi fred' - */ - function partial(func) { - return createWrapper(func, 16, slice(arguments, 1)); - } - - /** - * This method is like `_.partial` except that `partial` arguments are - * appended to those provided to the new function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * var defaultsDeep = _.partialRight(_.merge, _.defaults); - * - * var options = { - * 'variable': 'data', - * 'imports': { 'jq': $ } - * }; - * - * defaultsDeep(options, _.templateSettings); - * - * options.variable - * // => 'data' - * - * options.imports - * // => { '_': _, 'jq': $ } - */ - function partialRight(func) { - return createWrapper(func, 32, null, slice(arguments, 1)); - } - - /** - * Creates a function that, when executed, will only call the `func` function - * at most once per every `wait` milliseconds. Provide an options object to - * indicate that `func` should be invoked on the leading and/or trailing edge - * of the `wait` timeout. Subsequent calls to the throttled function will - * return the result of the last `func` call. - * - * Note: If `leading` and `trailing` options are `true` `func` will be called - * on the trailing edge of the timeout only if the the throttled function is - * invoked more than once during the `wait` timeout. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to throttle. - * @param {number} wait The number of milliseconds to throttle executions to. - * @param {Object} [options] The options object. - * @param {boolean} [options.leading=true] Specify execution on the leading edge of the timeout. - * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout. - * @returns {Function} Returns the new throttled function. - * @example - * - * // avoid excessively updating the position while scrolling - * var throttled = _.throttle(updatePosition, 100); - * jQuery(window).on('scroll', throttled); - * - * // execute `renewToken` when the click event is fired, but not more than once every 5 minutes - * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { - * 'trailing': false - * })); - */ - function throttle(func, wait, options) { - var leading = true, - trailing = true; - - if (!isFunction(func)) { - throw new TypeError; - } - if (options === false) { - leading = false; - } else if (isObject(options)) { - leading = 'leading' in options ? options.leading : leading; - trailing = 'trailing' in options ? options.trailing : trailing; - } - debounceOptions.leading = leading; - debounceOptions.maxWait = wait; - debounceOptions.trailing = trailing; - - return debounce(func, wait, debounceOptions); - } - - /** - * Creates a function that provides `value` to the wrapper function as its - * first argument. Additional arguments provided to the function are appended - * to those provided to the wrapper function. The wrapper is executed with - * the `this` binding of the created function. - * - * @static - * @memberOf _ - * @category Functions - * @param {*} value The value to wrap. - * @param {Function} wrapper The wrapper function. - * @returns {Function} Returns the new function. - * @example - * - * var p = _.wrap(_.escape, function(func, text) { - * return '

    ' + func(text) + '

    '; - * }); - * - * p('Fred, Wilma, & Pebbles'); - * // => '

    Fred, Wilma, & Pebbles

    ' - */ - function wrap(value, wrapper) { - return createWrapper(wrapper, 16, [value]); - } - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a function that returns `value`. - * - * @static - * @memberOf _ - * @category Utilities - * @param {*} value The value to return from the new function. - * @returns {Function} Returns the new function. - * @example - * - * var object = { 'name': 'fred' }; - * var getter = _.constant(object); - * getter() === object; - * // => true - */ - function constant(value) { - return function() { - return value; - }; - } - - /** - * Produces a callback bound to an optional `thisArg`. If `func` is a property - * name the created callback will return the property value for a given element. - * If `func` is an object the created callback will return `true` for elements - * that contain the equivalent object properties, otherwise it will return `false`. - * - * @static - * @memberOf _ - * @category Utilities - * @param {*} [func=identity] The value to convert to a callback. - * @param {*} [thisArg] The `this` binding of the created callback. - * @param {number} [argCount] The number of arguments the callback accepts. - * @returns {Function} Returns a callback function. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * // wrap to create custom callback shorthands - * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) { - * var match = /^(.+?)__([gl]t)(.+)$/.exec(callback); - * return !match ? func(callback, thisArg) : function(object) { - * return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3]; - * }; - * }); - * - * _.filter(characters, 'age__gt38'); - * // => [{ 'name': 'fred', 'age': 40 }] - */ - function createCallback(func, thisArg, argCount) { - var type = typeof func; - if (func == null || type == 'function') { - return baseCreateCallback(func, thisArg, argCount); - } - // handle "_.pluck" style callback shorthands - if (type != 'object') { - return property(func); - } - var props = keys(func), - key = props[0], - a = func[key]; - - // handle "_.where" style callback shorthands - if (props.length == 1 && a === a && !isObject(a)) { - // fast path the common case of providing an object with a single - // property containing a primitive value - return function(object) { - var b = object[key]; - return a === b && (a !== 0 || (1 / a == 1 / b)); - }; - } - return function(object) { - var length = props.length, - result = false; - - while (length--) { - if (!(result = baseIsEqual(object[props[length]], func[props[length]], null, true))) { - break; - } - } - return result; - }; - } - - /** - * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their - * corresponding HTML entities. - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} string The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escape('Fred, Wilma, & Pebbles'); - * // => 'Fred, Wilma, & Pebbles' - */ - function escape(string) { - return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar); - } - - /** - * This method returns the first argument provided to it. - * - * @static - * @memberOf _ - * @category Utilities - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'name': 'fred' }; - * _.identity(object) === object; - * // => true - */ - function identity(value) { - return value; - } - - /** - * Adds function properties of a source object to the destination object. - * If `object` is a function methods will be added to its prototype as well. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Function|Object} [object=lodash] object The destination object. - * @param {Object} source The object of functions to add. - * @param {Object} [options] The options object. - * @param {boolean} [options.chain=true] Specify whether the functions added are chainable. - * @example - * - * function capitalize(string) { - * return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); - * } - * - * _.mixin({ 'capitalize': capitalize }); - * _.capitalize('fred'); - * // => 'Fred' - * - * _('fred').capitalize().value(); - * // => 'Fred' - * - * _.mixin({ 'capitalize': capitalize }, { 'chain': false }); - * _('fred').capitalize(); - * // => 'Fred' - */ - function mixin(object, source, options) { - var chain = true, - methodNames = source && functions(source); - - if (!source || (!options && !methodNames.length)) { - if (options == null) { - options = source; - } - ctor = lodashWrapper; - source = object; - object = lodash; - methodNames = functions(source); - } - if (options === false) { - chain = false; - } else if (isObject(options) && 'chain' in options) { - chain = options.chain; - } - var ctor = object, - isFunc = isFunction(ctor); - - forEach(methodNames, function(methodName) { - var func = object[methodName] = source[methodName]; - if (isFunc) { - ctor.prototype[methodName] = function() { - var chainAll = this.__chain__, - value = this.__wrapped__, - args = [value]; - - push.apply(args, arguments); - var result = func.apply(object, args); - if (chain || chainAll) { - if (value === result && isObject(result)) { - return this; - } - result = new ctor(result); - result.__chain__ = chainAll; - } - return result; - }; - } - }); - } - - /** - * Reverts the '_' variable to its previous value and returns a reference to - * the `lodash` function. - * - * @static - * @memberOf _ - * @category Utilities - * @returns {Function} Returns the `lodash` function. - * @example - * - * var lodash = _.noConflict(); - */ - function noConflict() { - context._ = oldDash; - return this; - } - - /** - * A no-operation function. - * - * @static - * @memberOf _ - * @category Utilities - * @example - * - * var object = { 'name': 'fred' }; - * _.noop(object) === undefined; - * // => true - */ - function noop() { - // no operation performed - } - - /** - * Gets the number of milliseconds that have elapsed since the Unix epoch - * (1 January 1970 00:00:00 UTC). - * - * @static - * @memberOf _ - * @category Utilities - * @example - * - * var stamp = _.now(); - * _.defer(function() { console.log(_.now() - stamp); }); - * // => logs the number of milliseconds it took for the deferred function to be called - */ - var now = isNative(now = Date.now) && now || function() { - return new Date().getTime(); - }; - - /** - * Converts the given value into an integer of the specified radix. - * If `radix` is `undefined` or `0` a `radix` of `10` is used unless the - * `value` is a hexadecimal, in which case a `radix` of `16` is used. - * - * Note: This method avoids differences in native ES3 and ES5 `parseInt` - * implementations. See http://es5.github.io/#E. - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} value The value to parse. - * @param {number} [radix] The radix used to interpret the value to parse. - * @returns {number} Returns the new integer value. - * @example - * - * _.parseInt('08'); - * // => 8 - */ - var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) { - // Firefox < 21 and Opera < 15 follow the ES3 specified implementation of `parseInt` - return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0); - }; - - /** - * Creates a "_.pluck" style function, which returns the `key` value of a - * given object. - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} key The name of the property to retrieve. - * @returns {Function} Returns the new function. - * @example - * - * var characters = [ - * { 'name': 'fred', 'age': 40 }, - * { 'name': 'barney', 'age': 36 } - * ]; - * - * var getName = _.property('name'); - * - * _.map(characters, getName); - * // => ['barney', 'fred'] - * - * _.sortBy(characters, getName); - * // => [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }] - */ - function property(key) { - return function(object) { - return object[key]; - }; - } - - /** - * Produces a random number between `min` and `max` (inclusive). If only one - * argument is provided a number between `0` and the given number will be - * returned. If `floating` is truey or either `min` or `max` are floats a - * floating-point number will be returned instead of an integer. - * - * @static - * @memberOf _ - * @category Utilities - * @param {number} [min=0] The minimum possible value. - * @param {number} [max=1] The maximum possible value. - * @param {boolean} [floating=false] Specify returning a floating-point number. - * @returns {number} Returns a random number. - * @example - * - * _.random(0, 5); - * // => an integer between 0 and 5 - * - * _.random(5); - * // => also an integer between 0 and 5 - * - * _.random(5, true); - * // => a floating-point number between 0 and 5 - * - * _.random(1.2, 5.2); - * // => a floating-point number between 1.2 and 5.2 - */ - function random(min, max, floating) { - var noMin = min == null, - noMax = max == null; - - if (floating == null) { - if (typeof min == 'boolean' && noMax) { - floating = min; - min = 1; - } - else if (!noMax && typeof max == 'boolean') { - floating = max; - noMax = true; - } - } - if (noMin && noMax) { - max = 1; - } - min = +min || 0; - if (noMax) { - max = min; - min = 0; - } else { - max = +max || 0; - } - if (floating || min % 1 || max % 1) { - var rand = nativeRandom(); - return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max); - } - return baseRandom(min, max); - } - - /** - * Resolves the value of property `key` on `object`. If `key` is a function - * it will be invoked with the `this` binding of `object` and its result returned, - * else the property value is returned. If `object` is falsey then `undefined` - * is returned. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Object} object The object to inspect. - * @param {string} key The name of the property to resolve. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { - * 'cheese': 'crumpets', - * 'stuff': function() { - * return 'nonsense'; - * } - * }; - * - * _.result(object, 'cheese'); - * // => 'crumpets' - * - * _.result(object, 'stuff'); - * // => 'nonsense' - */ - function result(object, key) { - if (object) { - var value = object[key]; - return isFunction(value) ? object[key]() : value; - } - } - - /** - * A micro-templating method that handles arbitrary delimiters, preserves - * whitespace, and correctly escapes quotes within interpolated code. - * - * Note: In the development build, `_.template` utilizes sourceURLs for easier - * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl - * - * For more information on precompiling templates see: - * http://lodash.com/custom-builds - * - * For more information on Chrome extension sandboxes see: - * http://developer.chrome.com/stable/extensions/sandboxingEval.html - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} text The template text. - * @param {Object} data The data object used to populate the text. - * @param {Object} [options] The options object. - * @param {RegExp} [options.escape] The "escape" delimiter. - * @param {RegExp} [options.evaluate] The "evaluate" delimiter. - * @param {Object} [options.imports] An object to import into the template as local variables. - * @param {RegExp} [options.interpolate] The "interpolate" delimiter. - * @param {string} [sourceURL] The sourceURL of the template's compiled source. - * @param {string} [variable] The data object variable name. - * @returns {Function|string} Returns a compiled function when no `data` object - * is given, else it returns the interpolated text. - * @example - * - * // using the "interpolate" delimiter to create a compiled template - * var compiled = _.template('hello <%= name %>'); - * compiled({ 'name': 'fred' }); - * // => 'hello fred' - * - * // using the "escape" delimiter to escape HTML in data property values - * _.template('<%- value %>', { 'value': ' -``` - -Using [`npm`](http://npmjs.org/): - -```bash -npm i --save lodash - -{sudo} npm i -g lodash -npm ln lodash -``` - -In [Node.js](http://nodejs.org/) & [Ringo](http://ringojs.org/): - -```js -var _ = require('lodash'); -// or as Underscore -var _ = require('lodash/dist/lodash.underscore'); -``` - -**Notes:** - * Don’t assign values to [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL - * If Lo-Dash is installed globally, run [`npm ln lodash`](http://blog.nodejs.org/2011/03/23/npm-1-0-global-vs-local-installation/) in your project’s root directory *before* requiring it - -In [Rhino](http://www.mozilla.org/rhino/): - -```js -load('lodash.js'); -``` - -In an AMD loader: - -```js -require({ - 'packages': [ - { 'name': 'lodash', 'location': 'path/to/lodash', 'main': 'lodash' } - ] -}, -['lodash'], function(_) { - console.log(_.VERSION); -}); -``` - -## Author - -| [![twitter/jdalton](http://gravatar.com/avatar/299a3d891ff1920b69c364d061007043?s=70)](https://twitter.com/jdalton "Follow @jdalton on Twitter") | -|---| -| [John-David Dalton](http://allyoucanleet.com/) | - -## Contributors - -| [![twitter/blainebublitz](http://gravatar.com/avatar/ac1c67fd906c9fecd823ce302283b4c1?s=70)](https://twitter.com/blainebublitz "Follow @BlaineBublitz on Twitter") | [![twitter/kitcambridge](http://gravatar.com/avatar/6662a1d02f351b5ef2f8b4d815804661?s=70)](https://twitter.com/kitcambridge "Follow @kitcambridge on Twitter") | [![twitter/mathias](http://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") | -|---|---|---| -| [Blaine Bublitz](http://www.iceddev.com/) | [Kit Cambridge](http://kitcambridge.be/) | [Mathias Bynens](http://mathiasbynens.be/) | - -[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/lodash/lodash/trend.png)](https://bitdeli.com/free "Bitdeli Badge") +# lodash v3.7.0 + +The [modern build](https://github.com/lodash/lodash/wiki/Build-Differences) of [lodash](https://lodash.com/) exported as [Node.js](http://nodejs.org/)/[io.js](https://iojs.org/) modules. + +Generated using [lodash-cli](https://www.npmjs.com/package/lodash-cli): +```bash +$ lodash modularize modern exports=node -o ./ +$ lodash modern -d -o ./index.js +``` + +## Installation + +Using npm: + +```bash +$ {sudo -H} npm i -g npm +$ npm i --save lodash +``` + +In Node.js/io.js: + +```js +// load the modern build +var _ = require('lodash'); +// or a method category +var array = require('lodash/array'); +// or a method (great for smaller builds with browserify/webpack) +var chunk = require('lodash/array/chunk'); +``` + +See the [package source](https://github.com/lodash/lodash/tree/3.7.0-npm) for more details. + +**Note:**
    +Don’t assign values to the [special variable](http://nodejs.org/api/repl.html#repl_repl_features) `_` when in the REPL.
    +Install [n_](https://www.npmjs.com/package/n_) for a REPL that includes lodash by default. + +## Module formats + +lodash is also available in a variety of other builds & module formats. + + * npm packages for [modern](https://www.npmjs.com/package/lodash), [compatibility](https://www.npmjs.com/package/lodash-compat), & [per method](https://www.npmjs.com/browse/keyword/lodash-modularized) builds + * AMD modules for [modern](https://github.com/lodash/lodash/tree/3.7.0-amd) & [compatibility](https://github.com/lodash/lodash-compat/tree/3.7.0-amd) builds + * ES modules for the [modern](https://github.com/lodash/lodash/tree/3.7.0-es) build + +## Further Reading + + * [API Documentation](https://lodash.com/docs) + * [Build Differences](https://github.com/lodash/lodash/wiki/Build-Differences) + * [Changelog](https://github.com/lodash/lodash/wiki/Changelog) + * [Release Notes](https://github.com/lodash/lodash/releases) + * [Roadmap](https://github.com/lodash/lodash/wiki/Roadmap) + * [More Resources](https://github.com/lodash/lodash/wiki/Resources) + +## Features + + * ~100% [code coverage](https://coveralls.io/r/lodash) + * Follows [semantic versioning](http://semver.org/) for releases + * [Lazily evaluated](http://filimanjaro.com/blog/2014/introducing-lazy-evaluation/) chaining + * [_(…)](https://lodash.com/docs#_) supports intuitive chaining + * [_.add](https://lodash.com/docs#add) for mathematical composition + * [_.ary](https://lodash.com/docs#ary) & [_.rearg](https://lodash.com/docs#rearg) to change function argument limits & order + * [_.at](https://lodash.com/docs#at) for cherry-picking collection values + * [_.attempt](https://lodash.com/docs#attempt) to execute functions which may error without a try-catch + * [_.before](https://lodash.com/docs#before) to complement [_.after](https://lodash.com/docs#after) + * [_.bindKey](https://lodash.com/docs#bindKey) for binding [*“lazy”*](http://michaux.ca/articles/lazy-function-definition-pattern) defined methods + * [_.chunk](https://lodash.com/docs#chunk) for splitting an array into chunks of a given size + * [_.clone](https://lodash.com/docs#clone) supports shallow cloning of `Date` & `RegExp` objects + * [_.cloneDeep](https://lodash.com/docs#cloneDeep) for deep cloning arrays & objects + * [_.create](https://lodash.com/docs#create) for easier object inheritance + * [_.curry](https://lodash.com/docs#curry) & [_.curryRight](https://lodash.com/docs#curryRight) for creating [curried](http://hughfdjackson.com/javascript/why-curry-helps/) functions + * [_.debounce](https://lodash.com/docs#debounce) & [_.throttle](https://lodash.com/docs#throttle) are cancelable & accept options for more control + * [_.fill](https://lodash.com/docs#fill) to fill arrays with values + * [_.findKey](https://lodash.com/docs#findKey) for finding keys + * [_.flow](https://lodash.com/docs#flow) to complement [_.flowRight](https://lodash.com/docs#flowRight) (a.k.a `_.compose`) + * [_.forEach](https://lodash.com/docs#forEach) supports exiting early + * [_.forIn](https://lodash.com/docs#forIn) for iterating all enumerable properties + * [_.forOwn](https://lodash.com/docs#forOwn) for iterating own properties + * [_.get](https://lodash.com/docs#get) & [_.set](https://lodash.com/docs#set) for deep property getting & setting + * [_.inRange](https://lodash.com/docs#inRange) for checking whether a number is within a given range + * [_.isNative](https://lodash.com/docs#isNative) to check for native functions + * [_.isPlainObject](https://lodash.com/docs#isPlainObject) & [_.toPlainObject](https://lodash.com/docs#toPlainObject) to check for & convert to `Object` objects + * [_.isTypedArray](https://lodash.com/docs#isTypedArray) to check for typed arrays + * [_.matches](https://lodash.com/docs#matches) supports deep object comparisons + * [_.matchesProperty](https://lodash.com/docs#matchesProperty) to complement [_.matches](https://lodash.com/docs#matches) & [_.property](https://lodash.com/docs#property) + * [_.method](https://lodash.com/docs#method) & [_.methodOf](https://lodash.com/docs#methodOf) to create functions that invoke methods + * [_.merge](https://lodash.com/docs#merge) for a deep [_.extend](https://lodash.com/docs#extend) + * [_.parseInt](https://lodash.com/docs#parseInt) for consistent cross-environment behavior + * [_.pull](https://lodash.com/docs#pull), [_.pullAt](https://lodash.com/docs#pullAt), & [_.remove](https://lodash.com/docs#remove) for mutating arrays + * [_.random](https://lodash.com/docs#random) supports returning floating-point numbers + * [_.restParam](https://lodash.com/docs#restParam) & [_.spread](https://lodash.com/docs#spread) for applying rest parameters & spreading arguments to functions + * [_.runInContext](https://lodash.com/docs#runInContext) for collisionless mixins & easier mocking + * [_.slice](https://lodash.com/docs#slice) for creating subsets of array-like values + * [_.sortByAll](https://lodash.com/docs#sortByAll) & [_.sortByOrder](https://lodash.com/docs#sortByOrder) for sorting by multiple properties & orders + * [_.sum](https://lodash.com/docs#sum) to get the sum of values + * [_.support](https://lodash.com/docs#support) for flagging environment features + * [_.template](https://lodash.com/docs#template) supports [*“imports”*](https://lodash.com/docs#templateSettings-imports) options & [ES template delimiters](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-template-literal-lexical-components) + * [_.transform](https://lodash.com/docs#transform) as a powerful alternative to [_.reduce](https://lodash.com/docs#reduce) for transforming objects + * [_.xor](https://lodash.com/docs#xor) to complement [_.difference](https://lodash.com/docs#difference), [_.intersection](https://lodash.com/docs#intersection), & [_.union](https://lodash.com/docs#union) + * [_.valuesIn](https://lodash.com/docs#valuesIn) for getting values of all enumerable properties + * [_.bind](https://lodash.com/docs#bind), [_.curry](https://lodash.com/docs#curry), [_.partial](https://lodash.com/docs#partial), & + [more](https://lodash.com/docs "_.bindKey, _.curryRight, _.partialRight") support customizable argument placeholders + * [_.capitalize](https://lodash.com/docs#capitalize), [_.trim](https://lodash.com/docs#trim), & + [more](https://lodash.com/docs "_.camelCase, _.deburr, _.endsWith, _.escapeRegExp, _.kebabCase, _.pad, _.padLeft, _.padRight, _.repeat, _.snakeCase, _.startCase, _.startsWith, _.trimLeft, _.trimRight, _.trunc, _.words") string methods + * [_.clone](https://lodash.com/docs#clone), [_.isEqual](https://lodash.com/docs#isEqual), & + [more](https://lodash.com/docs "_.assign, _.cloneDeep, _.merge") accept callbacks + * [_.dropWhile](https://lodash.com/docs#dropWhile), [_.takeWhile](https://lodash.com/docs#takeWhile), & + [more](https://lodash.com/docs "_.drop, _.dropRightWhile, _.take, _.takeRightWhile") to complement [_.first](https://lodash.com/docs#first), [_.initial](https://lodash.com/docs#initial), [_.last](https://lodash.com/docs#last), & [_.rest](https://lodash.com/docs#rest) + * [_.findLast](https://lodash.com/docs#findLast), [_.findLastKey](https://lodash.com/docs#findLastKey), & + [more](https://lodash.com/docs "_.flowRight, _.forEachRight, _.forInRight, _.forOwnRight, _.partialRight") right-associative methods + * [_.includes](https://lodash.com/docs#includes), [_.toArray](https://lodash.com/docs#toArray), & + [more](https://lodash.com/docs "_.at, _.countBy, _.every, _.filter, _.find, _.findLast, _.forEach, _.forEachRight, _.groupBy, _.indexBy, _.invoke, _.map, _.max, _.min, _.partition, _.pluck, _.reduce, _.reduceRight, _.reject, _.shuffle, _.size, _.some, _.sortBy") accept strings + * [_#commit](https://lodash.com/docs#prototype-commit) & [_#plant](https://lodash.com/docs#prototype-plant) for working with chain sequences + * [_#thru](https://lodash.com/docs#thru) to pass values thru a chain sequence + +## Support + +Tested in Chrome 41-42, Firefox 36-37, IE 6-11, Opera 27-28, Safari 5-8, io.js 1.7.1, Node.js 0.8.28, 0.10.38, & 0.12.2, PhantomJS 1.9.8, RingoJS 0.11, & Rhino 1.7RC5. +Automated [browser](https://saucelabs.com/u/lodash) & [CI](https://travis-ci.org/lodash/lodash/) test runs are available. Special thanks to [Sauce Labs](https://saucelabs.com/) for providing automated browser testing. diff --git a/node_modules/lodash/array.js b/node_modules/lodash/array.js new file mode 100644 index 0000000000..6ef12c75e8 --- /dev/null +++ b/node_modules/lodash/array.js @@ -0,0 +1,42 @@ +module.exports = { + 'chunk': require('./array/chunk'), + 'compact': require('./array/compact'), + 'difference': require('./array/difference'), + 'drop': require('./array/drop'), + 'dropRight': require('./array/dropRight'), + 'dropRightWhile': require('./array/dropRightWhile'), + 'dropWhile': require('./array/dropWhile'), + 'fill': require('./array/fill'), + 'findIndex': require('./array/findIndex'), + 'findLastIndex': require('./array/findLastIndex'), + 'first': require('./array/first'), + 'flatten': require('./array/flatten'), + 'flattenDeep': require('./array/flattenDeep'), + 'head': require('./array/head'), + 'indexOf': require('./array/indexOf'), + 'initial': require('./array/initial'), + 'intersection': require('./array/intersection'), + 'last': require('./array/last'), + 'lastIndexOf': require('./array/lastIndexOf'), + 'object': require('./array/object'), + 'pull': require('./array/pull'), + 'pullAt': require('./array/pullAt'), + 'remove': require('./array/remove'), + 'rest': require('./array/rest'), + 'slice': require('./array/slice'), + 'sortedIndex': require('./array/sortedIndex'), + 'sortedLastIndex': require('./array/sortedLastIndex'), + 'tail': require('./array/tail'), + 'take': require('./array/take'), + 'takeRight': require('./array/takeRight'), + 'takeRightWhile': require('./array/takeRightWhile'), + 'takeWhile': require('./array/takeWhile'), + 'union': require('./array/union'), + 'uniq': require('./array/uniq'), + 'unique': require('./array/unique'), + 'unzip': require('./array/unzip'), + 'without': require('./array/without'), + 'xor': require('./array/xor'), + 'zip': require('./array/zip'), + 'zipObject': require('./array/zipObject') +}; diff --git a/node_modules/lodash/array/chunk.js b/node_modules/lodash/array/chunk.js new file mode 100644 index 0000000000..4de9b39618 --- /dev/null +++ b/node_modules/lodash/array/chunk.js @@ -0,0 +1,47 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** Native method references. */ +var ceil = Math.ceil; + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Creates an array of elements split into groups the length of `size`. + * If `collection` can't be split evenly, the final chunk will be the remaining + * elements. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to process. + * @param {number} [size=1] The length of each chunk. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the new array containing chunks. + * @example + * + * _.chunk(['a', 'b', 'c', 'd'], 2); + * // => [['a', 'b'], ['c', 'd']] + * + * _.chunk(['a', 'b', 'c', 'd'], 3); + * // => [['a', 'b', 'c'], ['d']] + */ +function chunk(array, size, guard) { + if (guard ? isIterateeCall(array, size, guard) : size == null) { + size = 1; + } else { + size = nativeMax(+size || 1, 1); + } + var index = 0, + length = array ? array.length : 0, + resIndex = -1, + result = Array(ceil(length / size)); + + while (index < length) { + result[++resIndex] = baseSlice(array, index, (index += size)); + } + return result; +} + +module.exports = chunk; diff --git a/node_modules/lodash/array/compact.js b/node_modules/lodash/array/compact.js new file mode 100644 index 0000000000..1dc1c55e8f --- /dev/null +++ b/node_modules/lodash/array/compact.js @@ -0,0 +1,30 @@ +/** + * Creates an array with all falsey values removed. The values `false`, `null`, + * `0`, `""`, `undefined`, and `NaN` are falsey. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to compact. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.compact([0, 1, false, 2, '', 3]); + * // => [1, 2, 3] + */ +function compact(array) { + var index = -1, + length = array ? array.length : 0, + resIndex = -1, + result = []; + + while (++index < length) { + var value = array[index]; + if (value) { + result[++resIndex] = value; + } + } + return result; +} + +module.exports = compact; diff --git a/node_modules/lodash/array/difference.js b/node_modules/lodash/array/difference.js new file mode 100644 index 0000000000..277b836e6e --- /dev/null +++ b/node_modules/lodash/array/difference.js @@ -0,0 +1,32 @@ +var baseDifference = require('../internal/baseDifference'), + baseFlatten = require('../internal/baseFlatten'), + isArguments = require('../lang/isArguments'), + isArray = require('../lang/isArray'), + restParam = require('../function/restParam'); + +/** + * Creates an array excluding all values of the provided arrays using + * `SameValueZero` for equality comparisons. + * + * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * comparisons are like strict equality comparisons, e.g. `===`, except that + * `NaN` matches `NaN`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to inspect. + * @param {...Array} [values] The arrays of values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.difference([1, 2, 3], [4, 2]); + * // => [1, 3] + */ +var difference = restParam(function(array, values) { + return (isArray(array) || isArguments(array)) + ? baseDifference(array, baseFlatten(values, false, true)) + : []; +}); + +module.exports = difference; diff --git a/node_modules/lodash/array/drop.js b/node_modules/lodash/array/drop.js new file mode 100644 index 0000000000..039a0b5fdc --- /dev/null +++ b/node_modules/lodash/array/drop.js @@ -0,0 +1,39 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` with `n` elements dropped from the beginning. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.drop([1, 2, 3]); + * // => [2, 3] + * + * _.drop([1, 2, 3], 2); + * // => [3] + * + * _.drop([1, 2, 3], 5); + * // => [] + * + * _.drop([1, 2, 3], 0); + * // => [1, 2, 3] + */ +function drop(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + return baseSlice(array, n < 0 ? 0 : n); +} + +module.exports = drop; diff --git a/node_modules/lodash/array/dropRight.js b/node_modules/lodash/array/dropRight.js new file mode 100644 index 0000000000..14b5eb6f0a --- /dev/null +++ b/node_modules/lodash/array/dropRight.js @@ -0,0 +1,40 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` with `n` elements dropped from the end. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to drop. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRight([1, 2, 3]); + * // => [1, 2] + * + * _.dropRight([1, 2, 3], 2); + * // => [1] + * + * _.dropRight([1, 2, 3], 5); + * // => [] + * + * _.dropRight([1, 2, 3], 0); + * // => [1, 2, 3] + */ +function dropRight(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + n = length - (+n || 0); + return baseSlice(array, 0, n < 0 ? 0 : n); +} + +module.exports = dropRight; diff --git a/node_modules/lodash/array/dropRightWhile.js b/node_modules/lodash/array/dropRightWhile.js new file mode 100644 index 0000000000..be158bd5fa --- /dev/null +++ b/node_modules/lodash/array/dropRightWhile.js @@ -0,0 +1,59 @@ +var baseCallback = require('../internal/baseCallback'), + baseWhile = require('../internal/baseWhile'); + +/** + * Creates a slice of `array` excluding elements dropped from the end. + * Elements are dropped until `predicate` returns falsey. The predicate is + * bound to `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that match the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropRightWhile([1, 2, 3], function(n) { + * return n > 1; + * }); + * // => [1] + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.dropRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user'); + * // => ['barney', 'fred'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.dropRightWhile(users, 'active', false), 'user'); + * // => ['barney'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.dropRightWhile(users, 'active'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ +function dropRightWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, baseCallback(predicate, thisArg, 3), true, true) + : []; +} + +module.exports = dropRightWhile; diff --git a/node_modules/lodash/array/dropWhile.js b/node_modules/lodash/array/dropWhile.js new file mode 100644 index 0000000000..d9eabae9fa --- /dev/null +++ b/node_modules/lodash/array/dropWhile.js @@ -0,0 +1,59 @@ +var baseCallback = require('../internal/baseCallback'), + baseWhile = require('../internal/baseWhile'); + +/** + * Creates a slice of `array` excluding elements dropped from the beginning. + * Elements are dropped until `predicate` returns falsey. The predicate is + * bound to `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.dropWhile([1, 2, 3], function(n) { + * return n < 3; + * }); + * // => [3] + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.dropWhile(users, { 'user': 'barney', 'active': false }), 'user'); + * // => ['fred', 'pebbles'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.dropWhile(users, 'active', false), 'user'); + * // => ['pebbles'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.dropWhile(users, 'active'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ +function dropWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, baseCallback(predicate, thisArg, 3), true) + : []; +} + +module.exports = dropWhile; diff --git a/node_modules/lodash/array/fill.js b/node_modules/lodash/array/fill.js new file mode 100644 index 0000000000..2c8f6da71d --- /dev/null +++ b/node_modules/lodash/array/fill.js @@ -0,0 +1,44 @@ +var baseFill = require('../internal/baseFill'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Fills elements of `array` with `value` from `start` up to, but not + * including, `end`. + * + * **Note:** This method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to fill. + * @param {*} value The value to fill `array` with. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3]; + * + * _.fill(array, 'a'); + * console.log(array); + * // => ['a', 'a', 'a'] + * + * _.fill(Array(3), 2); + * // => [2, 2, 2] + * + * _.fill([4, 6, 8], '*', 1, 2); + * // => [4, '*', 8] + */ +function fill(array, value, start, end) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (start && typeof start != 'number' && isIterateeCall(array, value, start)) { + start = 0; + end = length; + } + return baseFill(array, value, start, end); +} + +module.exports = fill; diff --git a/node_modules/lodash/array/findIndex.js b/node_modules/lodash/array/findIndex.js new file mode 100644 index 0000000000..2a6b8e14ba --- /dev/null +++ b/node_modules/lodash/array/findIndex.js @@ -0,0 +1,53 @@ +var createFindIndex = require('../internal/createFindIndex'); + +/** + * This method is like `_.find` except that it returns the index of the first + * element `predicate` returns truthy for instead of the element itself. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * _.findIndex(users, function(chr) { + * return chr.user == 'barney'; + * }); + * // => 0 + * + * // using the `_.matches` callback shorthand + * _.findIndex(users, { 'user': 'fred', 'active': false }); + * // => 1 + * + * // using the `_.matchesProperty` callback shorthand + * _.findIndex(users, 'active', false); + * // => 0 + * + * // using the `_.property` callback shorthand + * _.findIndex(users, 'active'); + * // => 2 + */ +var findIndex = createFindIndex(); + +module.exports = findIndex; diff --git a/node_modules/lodash/array/findLastIndex.js b/node_modules/lodash/array/findLastIndex.js new file mode 100644 index 0000000000..d6d8eca6df --- /dev/null +++ b/node_modules/lodash/array/findLastIndex.js @@ -0,0 +1,53 @@ +var createFindIndex = require('../internal/createFindIndex'); + +/** + * This method is like `_.findIndex` except that it iterates over elements + * of `collection` from right to left. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {number} Returns the index of the found element, else `-1`. + * @example + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * _.findLastIndex(users, function(chr) { + * return chr.user == 'pebbles'; + * }); + * // => 2 + * + * // using the `_.matches` callback shorthand + * _.findLastIndex(users, { 'user': 'barney', 'active': true }); + * // => 0 + * + * // using the `_.matchesProperty` callback shorthand + * _.findLastIndex(users, 'active', false); + * // => 2 + * + * // using the `_.property` callback shorthand + * _.findLastIndex(users, 'active'); + * // => 0 + */ +var findLastIndex = createFindIndex(true); + +module.exports = findLastIndex; diff --git a/node_modules/lodash/array/first.js b/node_modules/lodash/array/first.js new file mode 100644 index 0000000000..b3b9c79c7b --- /dev/null +++ b/node_modules/lodash/array/first.js @@ -0,0 +1,22 @@ +/** + * Gets the first element of `array`. + * + * @static + * @memberOf _ + * @alias head + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the first element of `array`. + * @example + * + * _.first([1, 2, 3]); + * // => 1 + * + * _.first([]); + * // => undefined + */ +function first(array) { + return array ? array[0] : undefined; +} + +module.exports = first; diff --git a/node_modules/lodash/array/flatten.js b/node_modules/lodash/array/flatten.js new file mode 100644 index 0000000000..65bbeefb77 --- /dev/null +++ b/node_modules/lodash/array/flatten.js @@ -0,0 +1,32 @@ +var baseFlatten = require('../internal/baseFlatten'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Flattens a nested array. If `isDeep` is `true` the array is recursively + * flattened, otherwise it is only flattened a single level. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to flatten. + * @param {boolean} [isDeep] Specify a deep flatten. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flatten([1, [2, 3, [4]]]); + * // => [1, 2, 3, [4]] + * + * // using `isDeep` + * _.flatten([1, [2, 3, [4]]], true); + * // => [1, 2, 3, 4] + */ +function flatten(array, isDeep, guard) { + var length = array ? array.length : 0; + if (guard && isIterateeCall(array, isDeep, guard)) { + isDeep = false; + } + return length ? baseFlatten(array, isDeep) : []; +} + +module.exports = flatten; diff --git a/node_modules/lodash/array/flattenDeep.js b/node_modules/lodash/array/flattenDeep.js new file mode 100644 index 0000000000..9f775febe2 --- /dev/null +++ b/node_modules/lodash/array/flattenDeep.js @@ -0,0 +1,21 @@ +var baseFlatten = require('../internal/baseFlatten'); + +/** + * Recursively flattens a nested array. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to recursively flatten. + * @returns {Array} Returns the new flattened array. + * @example + * + * _.flattenDeep([1, [2, 3, [4]]]); + * // => [1, 2, 3, 4] + */ +function flattenDeep(array) { + var length = array ? array.length : 0; + return length ? baseFlatten(array, true) : []; +} + +module.exports = flattenDeep; diff --git a/node_modules/lodash/array/head.js b/node_modules/lodash/array/head.js new file mode 100644 index 0000000000..1961b08c7e --- /dev/null +++ b/node_modules/lodash/array/head.js @@ -0,0 +1 @@ +module.exports = require('./first'); diff --git a/node_modules/lodash/array/indexOf.js b/node_modules/lodash/array/indexOf.js new file mode 100644 index 0000000000..98275997f3 --- /dev/null +++ b/node_modules/lodash/array/indexOf.js @@ -0,0 +1,57 @@ +var baseIndexOf = require('../internal/baseIndexOf'), + binaryIndex = require('../internal/binaryIndex'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Gets the index at which the first occurrence of `value` is found in `array` + * using `SameValueZero` for equality comparisons. If `fromIndex` is negative, + * it is used as the offset from the end of `array`. If `array` is sorted + * providing `true` for `fromIndex` performs a faster binary search. + * + * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * comparisons are like strict equality comparisons, e.g. `===`, except that + * `NaN` matches `NaN`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {boolean|number} [fromIndex=0] The index to search from or `true` + * to perform a binary search on a sorted array. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.indexOf([1, 2, 1, 2], 2); + * // => 1 + * + * // using `fromIndex` + * _.indexOf([1, 2, 1, 2], 2, 2); + * // => 3 + * + * // performing a binary search + * _.indexOf([1, 1, 2, 2], 2, true); + * // => 2 + */ +function indexOf(array, value, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + if (typeof fromIndex == 'number') { + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : fromIndex; + } else if (fromIndex) { + var index = binaryIndex(array, value), + other = array[index]; + + if (value === value ? (value === other) : (other !== other)) { + return index; + } + return -1; + } + return baseIndexOf(array, value, fromIndex || 0); +} + +module.exports = indexOf; diff --git a/node_modules/lodash/array/initial.js b/node_modules/lodash/array/initial.js new file mode 100644 index 0000000000..59b7a7d96d --- /dev/null +++ b/node_modules/lodash/array/initial.js @@ -0,0 +1,20 @@ +var dropRight = require('./dropRight'); + +/** + * Gets all but the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.initial([1, 2, 3]); + * // => [1, 2] + */ +function initial(array) { + return dropRight(array, 1); +} + +module.exports = initial; diff --git a/node_modules/lodash/array/intersection.js b/node_modules/lodash/array/intersection.js new file mode 100644 index 0000000000..c8ce09dc80 --- /dev/null +++ b/node_modules/lodash/array/intersection.js @@ -0,0 +1,69 @@ +var baseIndexOf = require('../internal/baseIndexOf'), + cacheIndexOf = require('../internal/cacheIndexOf'), + createCache = require('../internal/createCache'), + isArguments = require('../lang/isArguments'), + isArray = require('../lang/isArray'); + +/** + * Creates an array of unique values in all provided arrays using `SameValueZero` + * for equality comparisons. + * + * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * comparisons are like strict equality comparisons, e.g. `===`, except that + * `NaN` matches `NaN`. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of shared values. + * @example + * _.intersection([1, 2], [4, 2], [2, 1]); + * // => [2] + */ +function intersection() { + var args = [], + argsIndex = -1, + argsLength = arguments.length, + caches = [], + indexOf = baseIndexOf, + isCommon = true, + result = []; + + while (++argsIndex < argsLength) { + var value = arguments[argsIndex]; + if (isArray(value) || isArguments(value)) { + args.push(value); + caches.push((isCommon && value.length >= 120) ? createCache(argsIndex && value) : null); + } + } + argsLength = args.length; + if (argsLength < 2) { + return result; + } + var array = args[0], + index = -1, + length = array ? array.length : 0, + seen = caches[0]; + + outer: + while (++index < length) { + value = array[index]; + if ((seen ? cacheIndexOf(seen, value) : indexOf(result, value, 0)) < 0) { + argsIndex = argsLength; + while (--argsIndex) { + var cache = caches[argsIndex]; + if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value, 0)) < 0) { + continue outer; + } + } + if (seen) { + seen.push(value); + } + result.push(value); + } + } + return result; +} + +module.exports = intersection; diff --git a/node_modules/lodash/array/last.js b/node_modules/lodash/array/last.js new file mode 100644 index 0000000000..299af3146c --- /dev/null +++ b/node_modules/lodash/array/last.js @@ -0,0 +1,19 @@ +/** + * Gets the last element of `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @returns {*} Returns the last element of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + */ +function last(array) { + var length = array ? array.length : 0; + return length ? array[length - 1] : undefined; +} + +module.exports = last; diff --git a/node_modules/lodash/array/lastIndexOf.js b/node_modules/lodash/array/lastIndexOf.js new file mode 100644 index 0000000000..02b806269b --- /dev/null +++ b/node_modules/lodash/array/lastIndexOf.js @@ -0,0 +1,60 @@ +var binaryIndex = require('../internal/binaryIndex'), + indexOfNaN = require('../internal/indexOfNaN'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/** + * This method is like `_.indexOf` except that it iterates over elements of + * `array` from right to left. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {boolean|number} [fromIndex=array.length-1] The index to search from + * or `true` to perform a binary search on a sorted array. + * @returns {number} Returns the index of the matched value, else `-1`. + * @example + * + * _.lastIndexOf([1, 2, 1, 2], 2); + * // => 3 + * + * // using `fromIndex` + * _.lastIndexOf([1, 2, 1, 2], 2, 2); + * // => 1 + * + * // performing a binary search + * _.lastIndexOf([1, 1, 2, 2], 2, true); + * // => 3 + */ +function lastIndexOf(array, value, fromIndex) { + var length = array ? array.length : 0; + if (!length) { + return -1; + } + var index = length; + if (typeof fromIndex == 'number') { + index = (fromIndex < 0 ? nativeMax(length + fromIndex, 0) : nativeMin(fromIndex || 0, length - 1)) + 1; + } else if (fromIndex) { + index = binaryIndex(array, value, true) - 1; + var other = array[index]; + if (value === value ? (value === other) : (other !== other)) { + return index; + } + return -1; + } + if (value !== value) { + return indexOfNaN(array, index, true); + } + while (index--) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +module.exports = lastIndexOf; diff --git a/node_modules/lodash/array/object.js b/node_modules/lodash/array/object.js new file mode 100644 index 0000000000..f4a34531b1 --- /dev/null +++ b/node_modules/lodash/array/object.js @@ -0,0 +1 @@ +module.exports = require('./zipObject'); diff --git a/node_modules/lodash/array/pull.js b/node_modules/lodash/array/pull.js new file mode 100644 index 0000000000..2d4c517520 --- /dev/null +++ b/node_modules/lodash/array/pull.js @@ -0,0 +1,55 @@ +var baseIndexOf = require('../internal/baseIndexOf'); + +/** Used for native method references. */ +var arrayProto = Array.prototype; + +/** Native method references. */ +var splice = arrayProto.splice; + +/** + * Removes all provided values from `array` using `SameValueZero` for equality + * comparisons. + * + * **Notes:** + * - Unlike `_.without`, this method mutates `array` + * - [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * comparisons are like strict equality comparisons, e.g. `===`, except + * that `NaN` matches `NaN` + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {...*} [values] The values to remove. + * @returns {Array} Returns `array`. + * @example + * + * var array = [1, 2, 3, 1, 2, 3]; + * + * _.pull(array, 2, 3); + * console.log(array); + * // => [1, 1] + */ +function pull() { + var args = arguments, + array = args[0]; + + if (!(array && array.length)) { + return array; + } + var index = 0, + indexOf = baseIndexOf, + length = args.length; + + while (++index < length) { + var fromIndex = 0, + value = args[index]; + + while ((fromIndex = indexOf(array, value, fromIndex)) > -1) { + splice.call(array, fromIndex, 1); + } + } + return array; +} + +module.exports = pull; diff --git a/node_modules/lodash/array/pullAt.js b/node_modules/lodash/array/pullAt.js new file mode 100644 index 0000000000..da0e5874e3 --- /dev/null +++ b/node_modules/lodash/array/pullAt.js @@ -0,0 +1,41 @@ +var baseAt = require('../internal/baseAt'), + baseCompareAscending = require('../internal/baseCompareAscending'), + baseFlatten = require('../internal/baseFlatten'), + basePullAt = require('../internal/basePullAt'), + restParam = require('../function/restParam'); + +/** + * Removes elements from `array` corresponding to the given indexes and returns + * an array of the removed elements. Indexes may be specified as an array of + * indexes or as individual arguments. + * + * **Note:** Unlike `_.at`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {...(number|number[])} [indexes] The indexes of elements to remove, + * specified as individual indexes or arrays of indexes. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [5, 10, 15, 20]; + * var evens = _.pullAt(array, 1, 3); + * + * console.log(array); + * // => [5, 15] + * + * console.log(evens); + * // => [10, 20] + */ +var pullAt = restParam(function(array, indexes) { + array || (array = []); + indexes = baseFlatten(indexes); + + var result = baseAt(array, indexes); + basePullAt(array, indexes.sort(baseCompareAscending)); + return result; +}); + +module.exports = pullAt; diff --git a/node_modules/lodash/array/remove.js b/node_modules/lodash/array/remove.js new file mode 100644 index 0000000000..0cf979bda0 --- /dev/null +++ b/node_modules/lodash/array/remove.js @@ -0,0 +1,64 @@ +var baseCallback = require('../internal/baseCallback'), + basePullAt = require('../internal/basePullAt'); + +/** + * Removes all elements from `array` that `predicate` returns truthy for + * and returns an array of the removed elements. The predicate is bound to + * `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * **Note:** Unlike `_.filter`, this method mutates `array`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to modify. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new array of removed elements. + * @example + * + * var array = [1, 2, 3, 4]; + * var evens = _.remove(array, function(n) { + * return n % 2 == 0; + * }); + * + * console.log(array); + * // => [1, 3] + * + * console.log(evens); + * // => [2, 4] + */ +function remove(array, predicate, thisArg) { + var result = []; + if (!(array && array.length)) { + return result; + } + var index = -1, + indexes = [], + length = array.length; + + predicate = baseCallback(predicate, thisArg, 3); + while (++index < length) { + var value = array[index]; + if (predicate(value, index, array)) { + result.push(value); + indexes.push(index); + } + } + basePullAt(array, indexes); + return result; +} + +module.exports = remove; diff --git a/node_modules/lodash/array/rest.js b/node_modules/lodash/array/rest.js new file mode 100644 index 0000000000..9bfb734f1f --- /dev/null +++ b/node_modules/lodash/array/rest.js @@ -0,0 +1,21 @@ +var drop = require('./drop'); + +/** + * Gets all but the first element of `array`. + * + * @static + * @memberOf _ + * @alias tail + * @category Array + * @param {Array} array The array to query. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.rest([1, 2, 3]); + * // => [2, 3] + */ +function rest(array) { + return drop(array, 1); +} + +module.exports = rest; diff --git a/node_modules/lodash/array/slice.js b/node_modules/lodash/array/slice.js new file mode 100644 index 0000000000..48ef1a1a28 --- /dev/null +++ b/node_modules/lodash/array/slice.js @@ -0,0 +1,30 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` from `start` up to, but not including, `end`. + * + * **Note:** This method is used instead of `Array#slice` to support node + * lists in IE < 9 and to ensure dense arrays are returned. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ +function slice(array, start, end) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (end && typeof end != 'number' && isIterateeCall(array, start, end)) { + start = 0; + end = length; + } + return baseSlice(array, start, end); +} + +module.exports = slice; diff --git a/node_modules/lodash/array/sortedIndex.js b/node_modules/lodash/array/sortedIndex.js new file mode 100644 index 0000000000..51d150e3b3 --- /dev/null +++ b/node_modules/lodash/array/sortedIndex.js @@ -0,0 +1,53 @@ +var createSortedIndex = require('../internal/createSortedIndex'); + +/** + * Uses a binary search to determine the lowest index at which `value` should + * be inserted into `array` in order to maintain its sort order. If an iteratee + * function is provided it is invoked for `value` and each element of `array` + * to compute their sort ranking. The iteratee is bound to `thisArg` and + * invoked with one argument; (value). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedIndex([30, 50], 40); + * // => 1 + * + * _.sortedIndex([4, 4, 5, 5], 5); + * // => 2 + * + * var dict = { 'data': { 'thirty': 30, 'forty': 40, 'fifty': 50 } }; + * + * // using an iteratee function + * _.sortedIndex(['thirty', 'fifty'], 'forty', function(word) { + * return this.data[word]; + * }, dict); + * // => 1 + * + * // using the `_.property` callback shorthand + * _.sortedIndex([{ 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); + * // => 1 + */ +var sortedIndex = createSortedIndex(); + +module.exports = sortedIndex; diff --git a/node_modules/lodash/array/sortedLastIndex.js b/node_modules/lodash/array/sortedLastIndex.js new file mode 100644 index 0000000000..81a4a8689e --- /dev/null +++ b/node_modules/lodash/array/sortedLastIndex.js @@ -0,0 +1,25 @@ +var createSortedIndex = require('../internal/createSortedIndex'); + +/** + * This method is like `_.sortedIndex` except that it returns the highest + * index at which `value` should be inserted into `array` in order to + * maintain its sort order. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The sorted array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedLastIndex([4, 4, 5, 5], 5); + * // => 4 + */ +var sortedLastIndex = createSortedIndex(true); + +module.exports = sortedLastIndex; diff --git a/node_modules/lodash/array/tail.js b/node_modules/lodash/array/tail.js new file mode 100644 index 0000000000..c5dfe779d6 --- /dev/null +++ b/node_modules/lodash/array/tail.js @@ -0,0 +1 @@ +module.exports = require('./rest'); diff --git a/node_modules/lodash/array/take.js b/node_modules/lodash/array/take.js new file mode 100644 index 0000000000..875917a746 --- /dev/null +++ b/node_modules/lodash/array/take.js @@ -0,0 +1,39 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` with `n` elements taken from the beginning. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.take([1, 2, 3]); + * // => [1] + * + * _.take([1, 2, 3], 2); + * // => [1, 2] + * + * _.take([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.take([1, 2, 3], 0); + * // => [] + */ +function take(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + return baseSlice(array, 0, n < 0 ? 0 : n); +} + +module.exports = take; diff --git a/node_modules/lodash/array/takeRight.js b/node_modules/lodash/array/takeRight.js new file mode 100644 index 0000000000..6e89c87480 --- /dev/null +++ b/node_modules/lodash/array/takeRight.js @@ -0,0 +1,40 @@ +var baseSlice = require('../internal/baseSlice'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates a slice of `array` with `n` elements taken from the end. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {number} [n=1] The number of elements to take. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeRight([1, 2, 3]); + * // => [3] + * + * _.takeRight([1, 2, 3], 2); + * // => [2, 3] + * + * _.takeRight([1, 2, 3], 5); + * // => [1, 2, 3] + * + * _.takeRight([1, 2, 3], 0); + * // => [] + */ +function takeRight(array, n, guard) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (guard ? isIterateeCall(array, n, guard) : n == null) { + n = 1; + } + n = length - (+n || 0); + return baseSlice(array, n < 0 ? 0 : n); +} + +module.exports = takeRight; diff --git a/node_modules/lodash/array/takeRightWhile.js b/node_modules/lodash/array/takeRightWhile.js new file mode 100644 index 0000000000..5464d13b7f --- /dev/null +++ b/node_modules/lodash/array/takeRightWhile.js @@ -0,0 +1,59 @@ +var baseCallback = require('../internal/baseCallback'), + baseWhile = require('../internal/baseWhile'); + +/** + * Creates a slice of `array` with elements taken from the end. Elements are + * taken until `predicate` returns falsey. The predicate is bound to `thisArg` + * and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeRightWhile([1, 2, 3], function(n) { + * return n > 1; + * }); + * // => [2, 3] + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false }, + * { 'user': 'pebbles', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.takeRightWhile(users, { 'user': 'pebbles', 'active': false }), 'user'); + * // => ['pebbles'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.takeRightWhile(users, 'active', false), 'user'); + * // => ['fred', 'pebbles'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.takeRightWhile(users, 'active'), 'user'); + * // => [] + */ +function takeRightWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, baseCallback(predicate, thisArg, 3), false, true) + : []; +} + +module.exports = takeRightWhile; diff --git a/node_modules/lodash/array/takeWhile.js b/node_modules/lodash/array/takeWhile.js new file mode 100644 index 0000000000..f7e28a1d42 --- /dev/null +++ b/node_modules/lodash/array/takeWhile.js @@ -0,0 +1,59 @@ +var baseCallback = require('../internal/baseCallback'), + baseWhile = require('../internal/baseWhile'); + +/** + * Creates a slice of `array` with elements taken from the beginning. Elements + * are taken until `predicate` returns falsey. The predicate is bound to + * `thisArg` and invoked with three arguments: (value, index, array). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to query. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the slice of `array`. + * @example + * + * _.takeWhile([1, 2, 3], function(n) { + * return n < 3; + * }); + * // => [1, 2] + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false}, + * { 'user': 'pebbles', 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.takeWhile(users, { 'user': 'barney', 'active': false }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.takeWhile(users, 'active', false), 'user'); + * // => ['barney', 'fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.takeWhile(users, 'active'), 'user'); + * // => [] + */ +function takeWhile(array, predicate, thisArg) { + return (array && array.length) + ? baseWhile(array, baseCallback(predicate, thisArg, 3)) + : []; +} + +module.exports = takeWhile; diff --git a/node_modules/lodash/array/union.js b/node_modules/lodash/array/union.js new file mode 100644 index 0000000000..312b395258 --- /dev/null +++ b/node_modules/lodash/array/union.js @@ -0,0 +1,27 @@ +var baseFlatten = require('../internal/baseFlatten'), + baseUniq = require('../internal/baseUniq'), + restParam = require('../function/restParam'); + +/** + * Creates an array of unique values, in order, of the provided arrays using + * `SameValueZero` for equality comparisons. + * + * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * comparisons are like strict equality comparisons, e.g. `===`, except that + * `NaN` matches `NaN`. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of combined values. + * @example + * + * _.union([1, 2], [4, 2], [2, 1]); + * // => [1, 2, 4] + */ +var union = restParam(function(arrays) { + return baseUniq(baseFlatten(arrays, false, true)); +}); + +module.exports = union; diff --git a/node_modules/lodash/array/uniq.js b/node_modules/lodash/array/uniq.js new file mode 100644 index 0000000000..2c9fabadfb --- /dev/null +++ b/node_modules/lodash/array/uniq.js @@ -0,0 +1,74 @@ +var baseCallback = require('../internal/baseCallback'), + baseUniq = require('../internal/baseUniq'), + isIterateeCall = require('../internal/isIterateeCall'), + sortedUniq = require('../internal/sortedUniq'); + +/** + * Creates a duplicate-free version of an array, using `SameValueZero` for + * equality comparisons, in which only the first occurence of each element + * is kept. Providing `true` for `isSorted` performs a faster search algorithm + * for sorted arrays. If an iteratee function is provided it is invoked for + * each element in the array to generate the criterion by which uniqueness + * is computed. The `iteratee` is bound to `thisArg` and invoked with three + * arguments: (value, index, array). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * comparisons are like strict equality comparisons, e.g. `===`, except that + * `NaN` matches `NaN`. + * + * @static + * @memberOf _ + * @alias unique + * @category Array + * @param {Array} array The array to inspect. + * @param {boolean} [isSorted] Specify the array is sorted. + * @param {Function|Object|string} [iteratee] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new duplicate-value-free array. + * @example + * + * _.uniq([2, 1, 2]); + * // => [2, 1] + * + * // using `isSorted` + * _.uniq([1, 1, 2], true); + * // => [1, 2] + * + * // using an iteratee function + * _.uniq([1, 2.5, 1.5, 2], function(n) { + * return this.floor(n); + * }, Math); + * // => [1, 2.5] + * + * // using the `_.property` callback shorthand + * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); + * // => [{ 'x': 1 }, { 'x': 2 }] + */ +function uniq(array, isSorted, iteratee, thisArg) { + var length = array ? array.length : 0; + if (!length) { + return []; + } + if (isSorted != null && typeof isSorted != 'boolean') { + thisArg = iteratee; + iteratee = isIterateeCall(array, isSorted, thisArg) ? null : isSorted; + isSorted = false; + } + iteratee = iteratee == null ? iteratee : baseCallback(iteratee, thisArg, 3); + return (isSorted) + ? sortedUniq(array, iteratee) + : baseUniq(array, iteratee); +} + +module.exports = uniq; diff --git a/node_modules/lodash/array/unique.js b/node_modules/lodash/array/unique.js new file mode 100644 index 0000000000..396de1b804 --- /dev/null +++ b/node_modules/lodash/array/unique.js @@ -0,0 +1 @@ +module.exports = require('./uniq'); diff --git a/node_modules/lodash/array/unzip.js b/node_modules/lodash/array/unzip.js new file mode 100644 index 0000000000..5d28c9be6f --- /dev/null +++ b/node_modules/lodash/array/unzip.js @@ -0,0 +1,35 @@ +var arrayMap = require('../internal/arrayMap'), + arrayMax = require('../internal/arrayMax'), + baseProperty = require('../internal/baseProperty'), + getLength = require('../internal/getLength'); + +/** + * This method is like `_.zip` except that it accepts an array of grouped + * elements and creates an array regrouping the elements to their pre-`_.zip` + * configuration. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array of grouped elements to process. + * @returns {Array} Returns the new array of regrouped elements. + * @example + * + * var zipped = _.zip(['fred', 'barney'], [30, 40], [true, false]); + * // => [['fred', 30, true], ['barney', 40, false]] + * + * _.unzip(zipped); + * // => [['fred', 'barney'], [30, 40], [true, false]] + */ +function unzip(array) { + var index = -1, + length = (array && array.length && arrayMax(arrayMap(array, getLength))) >>> 0, + result = Array(length); + + while (++index < length) { + result[index] = arrayMap(array, baseProperty(index)); + } + return result; +} + +module.exports = unzip; diff --git a/node_modules/lodash/array/without.js b/node_modules/lodash/array/without.js new file mode 100644 index 0000000000..7927ba144b --- /dev/null +++ b/node_modules/lodash/array/without.js @@ -0,0 +1,31 @@ +var baseDifference = require('../internal/baseDifference'), + isArguments = require('../lang/isArguments'), + isArray = require('../lang/isArray'), + restParam = require('../function/restParam'); + +/** + * Creates an array excluding all provided values using `SameValueZero` for + * equality comparisons. + * + * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * comparisons are like strict equality comparisons, e.g. `===`, except that + * `NaN` matches `NaN`. + * + * @static + * @memberOf _ + * @category Array + * @param {Array} array The array to filter. + * @param {...*} [values] The values to exclude. + * @returns {Array} Returns the new array of filtered values. + * @example + * + * _.without([1, 2, 1, 3], 1, 2); + * // => [3] + */ +var without = restParam(function(array, values) { + return (isArray(array) || isArguments(array)) + ? baseDifference(array, values) + : []; +}); + +module.exports = without; diff --git a/node_modules/lodash/array/xor.js b/node_modules/lodash/array/xor.js new file mode 100644 index 0000000000..77638775da --- /dev/null +++ b/node_modules/lodash/array/xor.js @@ -0,0 +1,35 @@ +var baseDifference = require('../internal/baseDifference'), + baseUniq = require('../internal/baseUniq'), + isArguments = require('../lang/isArguments'), + isArray = require('../lang/isArray'); + +/** + * Creates an array that is the [symmetric difference](https://en.wikipedia.org/wiki/Symmetric_difference) + * of the provided arrays. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to inspect. + * @returns {Array} Returns the new array of values. + * @example + * + * _.xor([1, 2], [4, 2]); + * // => [1, 4] + */ +function xor() { + var index = -1, + length = arguments.length; + + while (++index < length) { + var array = arguments[index]; + if (isArray(array) || isArguments(array)) { + var result = result + ? baseDifference(result, array).concat(baseDifference(array, result)) + : array; + } + } + return result ? baseUniq(result) : []; +} + +module.exports = xor; diff --git a/node_modules/lodash/array/zip.js b/node_modules/lodash/array/zip.js new file mode 100644 index 0000000000..53a6f69912 --- /dev/null +++ b/node_modules/lodash/array/zip.js @@ -0,0 +1,21 @@ +var restParam = require('../function/restParam'), + unzip = require('./unzip'); + +/** + * Creates an array of grouped elements, the first of which contains the first + * elements of the given arrays, the second of which contains the second elements + * of the given arrays, and so on. + * + * @static + * @memberOf _ + * @category Array + * @param {...Array} [arrays] The arrays to process. + * @returns {Array} Returns the new array of grouped elements. + * @example + * + * _.zip(['fred', 'barney'], [30, 40], [true, false]); + * // => [['fred', 30, true], ['barney', 40, false]] + */ +var zip = restParam(unzip); + +module.exports = zip; diff --git a/node_modules/lodash/array/zipObject.js b/node_modules/lodash/array/zipObject.js new file mode 100644 index 0000000000..dec7a211b7 --- /dev/null +++ b/node_modules/lodash/array/zipObject.js @@ -0,0 +1,43 @@ +var isArray = require('../lang/isArray'); + +/** + * The inverse of `_.pairs`; this method returns an object composed from arrays + * of property names and values. Provide either a single two dimensional array, + * e.g. `[[key1, value1], [key2, value2]]` or two arrays, one of property names + * and one of corresponding values. + * + * @static + * @memberOf _ + * @alias object + * @category Array + * @param {Array} props The property names. + * @param {Array} [values=[]] The property values. + * @returns {Object} Returns the new object. + * @example + * + * _.zipObject([['fred', 30], ['barney', 40]]); + * // => { 'fred': 30, 'barney': 40 } + * + * _.zipObject(['fred', 'barney'], [30, 40]); + * // => { 'fred': 30, 'barney': 40 } + */ +function zipObject(props, values) { + var index = -1, + length = props ? props.length : 0, + result = {}; + + if (length && !values && !isArray(props[0])) { + values = []; + } + while (++index < length) { + var key = props[index]; + if (values) { + result[key] = values[index]; + } else if (key) { + result[key[0]] = key[1]; + } + } + return result; +} + +module.exports = zipObject; diff --git a/node_modules/lodash/chain.js b/node_modules/lodash/chain.js new file mode 100644 index 0000000000..7992b733e2 --- /dev/null +++ b/node_modules/lodash/chain.js @@ -0,0 +1,15 @@ +module.exports = { + 'chain': require('./chain/chain'), + 'commit': require('./chain/commit'), + 'lodash': require('./chain/lodash'), + 'plant': require('./chain/plant'), + 'reverse': require('./chain/reverse'), + 'run': require('./chain/run'), + 'tap': require('./chain/tap'), + 'thru': require('./chain/thru'), + 'toJSON': require('./chain/toJSON'), + 'toString': require('./chain/toString'), + 'value': require('./chain/value'), + 'valueOf': require('./chain/valueOf'), + 'wrapperChain': require('./chain/wrapperChain') +}; diff --git a/node_modules/lodash/chain/chain.js b/node_modules/lodash/chain/chain.js new file mode 100644 index 0000000000..453ba1eb5e --- /dev/null +++ b/node_modules/lodash/chain/chain.js @@ -0,0 +1,35 @@ +var lodash = require('./lodash'); + +/** + * Creates a `lodash` object that wraps `value` with explicit method + * chaining enabled. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to wrap. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 }, + * { 'user': 'pebbles', 'age': 1 } + * ]; + * + * var youngest = _.chain(users) + * .sortBy('age') + * .map(function(chr) { + * return chr.user + ' is ' + chr.age; + * }) + * .first() + * .value(); + * // => 'pebbles is 1' + */ +function chain(value) { + var result = lodash(value); + result.__chain__ = true; + return result; +} + +module.exports = chain; diff --git a/node_modules/lodash/chain/commit.js b/node_modules/lodash/chain/commit.js new file mode 100644 index 0000000000..c732d1bf91 --- /dev/null +++ b/node_modules/lodash/chain/commit.js @@ -0,0 +1 @@ +module.exports = require('./wrapperCommit'); diff --git a/node_modules/lodash/chain/lodash.js b/node_modules/lodash/chain/lodash.js new file mode 100644 index 0000000000..7ca104c448 --- /dev/null +++ b/node_modules/lodash/chain/lodash.js @@ -0,0 +1,122 @@ +var LazyWrapper = require('../internal/LazyWrapper'), + LodashWrapper = require('../internal/LodashWrapper'), + baseLodash = require('../internal/baseLodash'), + isArray = require('../lang/isArray'), + isObjectLike = require('../internal/isObjectLike'), + wrapperClone = require('../internal/wrapperClone'); + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Creates a `lodash` object which wraps `value` to enable implicit chaining. + * Methods that operate on and return arrays, collections, and functions can + * be chained together. Methods that return a boolean or single value will + * automatically end the chain returning the unwrapped value. Explicit chaining + * may be enabled using `_.chain`. The execution of chained methods is lazy, + * that is, execution is deferred until `_#value` is implicitly or explicitly + * called. + * + * Lazy evaluation allows several methods to support shortcut fusion. Shortcut + * fusion is an optimization that merges iteratees to avoid creating intermediate + * arrays and reduce the number of iteratee executions. + * + * Chaining is supported in custom builds as long as the `_#value` method is + * directly or indirectly included in the build. + * + * In addition to lodash methods, wrappers have `Array` and `String` methods. + * + * The wrapper `Array` methods are: + * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, + * `splice`, and `unshift` + * + * The wrapper `String` methods are: + * `replace` and `split` + * + * The wrapper methods that support shortcut fusion are: + * `compact`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `filter`, + * `first`, `initial`, `last`, `map`, `pluck`, `reject`, `rest`, `reverse`, + * `slice`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `toArray`, + * and `where` + * + * The chainable wrapper methods are: + * `after`, `ary`, `assign`, `at`, `before`, `bind`, `bindAll`, `bindKey`, + * `callback`, `chain`, `chunk`, `commit`, `compact`, `concat`, `constant`, + * `countBy`, `create`, `curry`, `debounce`, `defaults`, `defer`, `delay`, + * `difference`, `drop`, `dropRight`, `dropRightWhile`, `dropWhile`, `fill`, + * `filter`, `flatten`, `flattenDeep`, `flow`, `flowRight`, `forEach`, + * `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, `functions`, + * `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, `invoke`, `keys`, + * `keysIn`, `map`, `mapValues`, `matches`, `matchesProperty`, `memoize`, + * `merge`, `mixin`, `negate`, `omit`, `once`, `pairs`, `partial`, `partialRight`, + * `partition`, `pick`, `plant`, `pluck`, `property`, `propertyOf`, `pull`, + * `pullAt`, `push`, `range`, `rearg`, `reject`, `remove`, `rest`, `reverse`, + * `shuffle`, `slice`, `sort`, `sortBy`, `sortByAll`, `sortByOrder`, `splice`, + * `spread`, `take`, `takeRight`, `takeRightWhile`, `takeWhile`, `tap`, + * `throttle`, `thru`, `times`, `toArray`, `toPlainObject`, `transform`, + * `union`, `uniq`, `unshift`, `unzip`, `values`, `valuesIn`, `where`, + * `without`, `wrap`, `xor`, `zip`, and `zipObject` + * + * The wrapper methods that are **not** chainable by default are: + * `add`, `attempt`, `camelCase`, `capitalize`, `clone`, `cloneDeep`, `deburr`, + * `endsWith`, `escape`, `escapeRegExp`, `every`, `find`, `findIndex`, `findKey`, + * `findLast`, `findLastIndex`, `findLastKey`, `findWhere`, `first`, `has`, + * `identity`, `includes`, `indexOf`, `inRange`, `isArguments`, `isArray`, + * `isBoolean`, `isDate`, `isElement`, `isEmpty`, `isEqual`, `isError`, `isFinite` + * `isFunction`, `isMatch`, `isNative`, `isNaN`, `isNull`, `isNumber`, `isObject`, + * `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `isTypedArray`, + * `join`, `kebabCase`, `last`, `lastIndexOf`, `max`, `min`, `noConflict`, + * `noop`, `now`, `pad`, `padLeft`, `padRight`, `parseInt`, `pop`, `random`, + * `reduce`, `reduceRight`, `repeat`, `result`, `runInContext`, `shift`, `size`, + * `snakeCase`, `some`, `sortedIndex`, `sortedLastIndex`, `startCase`, `startsWith`, + * `sum`, `template`, `trim`, `trimLeft`, `trimRight`, `trunc`, `unescape`, + * `uniqueId`, `value`, and `words` + * + * The wrapper method `sample` will return a wrapped value when `n` is provided, + * otherwise an unwrapped value is returned. + * + * @name _ + * @constructor + * @category Chain + * @param {*} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var wrapped = _([1, 2, 3]); + * + * // returns an unwrapped value + * wrapped.reduce(function(total, n) { + * return total + n; + * }); + * // => 6 + * + * // returns a wrapped value + * var squares = wrapped.map(function(n) { + * return n * n; + * }); + * + * _.isArray(squares); + * // => false + * + * _.isArray(squares.value()); + * // => true + */ +function lodash(value) { + if (isObjectLike(value) && !isArray(value) && !(value instanceof LazyWrapper)) { + if (value instanceof LodashWrapper) { + return value; + } + if (hasOwnProperty.call(value, '__chain__') && hasOwnProperty.call(value, '__wrapped__')) { + return wrapperClone(value); + } + } + return new LodashWrapper(value); +} + +// Ensure wrappers are instances of `baseLodash`. +lodash.prototype = baseLodash.prototype; + +module.exports = lodash; diff --git a/node_modules/lodash/chain/plant.js b/node_modules/lodash/chain/plant.js new file mode 100644 index 0000000000..04099f2386 --- /dev/null +++ b/node_modules/lodash/chain/plant.js @@ -0,0 +1 @@ +module.exports = require('./wrapperPlant'); diff --git a/node_modules/lodash/chain/reverse.js b/node_modules/lodash/chain/reverse.js new file mode 100644 index 0000000000..f72a64a19b --- /dev/null +++ b/node_modules/lodash/chain/reverse.js @@ -0,0 +1 @@ +module.exports = require('./wrapperReverse'); diff --git a/node_modules/lodash/chain/run.js b/node_modules/lodash/chain/run.js new file mode 100644 index 0000000000..5e751a2c32 --- /dev/null +++ b/node_modules/lodash/chain/run.js @@ -0,0 +1 @@ +module.exports = require('./wrapperValue'); diff --git a/node_modules/lodash/chain/tap.js b/node_modules/lodash/chain/tap.js new file mode 100644 index 0000000000..3d0257ecfd --- /dev/null +++ b/node_modules/lodash/chain/tap.js @@ -0,0 +1,29 @@ +/** + * This method invokes `interceptor` and returns `value`. The interceptor is + * bound to `thisArg` and invoked with one argument; (value). The purpose of + * this method is to "tap into" a method chain in order to perform operations + * on intermediate results within the chain. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @param {*} [thisArg] The `this` binding of `interceptor`. + * @returns {*} Returns `value`. + * @example + * + * _([1, 2, 3]) + * .tap(function(array) { + * array.pop(); + * }) + * .reverse() + * .value(); + * // => [2, 1] + */ +function tap(value, interceptor, thisArg) { + interceptor.call(thisArg, value); + return value; +} + +module.exports = tap; diff --git a/node_modules/lodash/chain/thru.js b/node_modules/lodash/chain/thru.js new file mode 100644 index 0000000000..a715780376 --- /dev/null +++ b/node_modules/lodash/chain/thru.js @@ -0,0 +1,26 @@ +/** + * This method is like `_.tap` except that it returns the result of `interceptor`. + * + * @static + * @memberOf _ + * @category Chain + * @param {*} value The value to provide to `interceptor`. + * @param {Function} interceptor The function to invoke. + * @param {*} [thisArg] The `this` binding of `interceptor`. + * @returns {*} Returns the result of `interceptor`. + * @example + * + * _(' abc ') + * .chain() + * .trim() + * .thru(function(value) { + * return [value]; + * }) + * .value(); + * // => ['abc'] + */ +function thru(value, interceptor, thisArg) { + return interceptor.call(thisArg, value); +} + +module.exports = thru; diff --git a/node_modules/lodash/chain/toJSON.js b/node_modules/lodash/chain/toJSON.js new file mode 100644 index 0000000000..5e751a2c32 --- /dev/null +++ b/node_modules/lodash/chain/toJSON.js @@ -0,0 +1 @@ +module.exports = require('./wrapperValue'); diff --git a/node_modules/lodash/chain/toString.js b/node_modules/lodash/chain/toString.js new file mode 100644 index 0000000000..c7bcbf9a54 --- /dev/null +++ b/node_modules/lodash/chain/toString.js @@ -0,0 +1 @@ +module.exports = require('./wrapperToString'); diff --git a/node_modules/lodash/chain/value.js b/node_modules/lodash/chain/value.js new file mode 100644 index 0000000000..5e751a2c32 --- /dev/null +++ b/node_modules/lodash/chain/value.js @@ -0,0 +1 @@ +module.exports = require('./wrapperValue'); diff --git a/node_modules/lodash/chain/valueOf.js b/node_modules/lodash/chain/valueOf.js new file mode 100644 index 0000000000..5e751a2c32 --- /dev/null +++ b/node_modules/lodash/chain/valueOf.js @@ -0,0 +1 @@ +module.exports = require('./wrapperValue'); diff --git a/node_modules/lodash/chain/wrapperChain.js b/node_modules/lodash/chain/wrapperChain.js new file mode 100644 index 0000000000..38234819ba --- /dev/null +++ b/node_modules/lodash/chain/wrapperChain.js @@ -0,0 +1,32 @@ +var chain = require('./chain'); + +/** + * Enables explicit method chaining on the wrapper object. + * + * @name chain + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * // without explicit chaining + * _(users).first(); + * // => { 'user': 'barney', 'age': 36 } + * + * // with explicit chaining + * _(users).chain() + * .first() + * .pick('user') + * .value(); + * // => { 'user': 'barney' } + */ +function wrapperChain() { + return chain(this); +} + +module.exports = wrapperChain; diff --git a/node_modules/lodash/chain/wrapperCommit.js b/node_modules/lodash/chain/wrapperCommit.js new file mode 100644 index 0000000000..c46a787e97 --- /dev/null +++ b/node_modules/lodash/chain/wrapperCommit.js @@ -0,0 +1,32 @@ +var LodashWrapper = require('../internal/LodashWrapper'); + +/** + * Executes the chained sequence and returns the wrapped result. + * + * @name commit + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapper = _(array).push(3); + * + * console.log(array); + * // => [1, 2] + * + * wrapper = wrapper.commit(); + * console.log(array); + * // => [1, 2, 3] + * + * wrapper.last(); + * // => 3 + * + * console.log(array); + * // => [1, 2, 3] + */ +function wrapperCommit() { + return new LodashWrapper(this.value(), this.__chain__); +} + +module.exports = wrapperCommit; diff --git a/node_modules/lodash/chain/wrapperPlant.js b/node_modules/lodash/chain/wrapperPlant.js new file mode 100644 index 0000000000..a3de146b13 --- /dev/null +++ b/node_modules/lodash/chain/wrapperPlant.js @@ -0,0 +1,45 @@ +var baseLodash = require('../internal/baseLodash'), + wrapperClone = require('../internal/wrapperClone'); + +/** + * Creates a clone of the chained sequence planting `value` as the wrapped value. + * + * @name plant + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new `lodash` wrapper instance. + * @example + * + * var array = [1, 2]; + * var wrapper = _(array).map(function(value) { + * return Math.pow(value, 2); + * }); + * + * var other = [3, 4]; + * var otherWrapper = wrapper.plant(other); + * + * otherWrapper.value(); + * // => [9, 16] + * + * wrapper.value(); + * // => [1, 4] + */ +function wrapperPlant(value) { + var result, + parent = this; + + while (parent instanceof baseLodash) { + var clone = wrapperClone(parent); + if (result) { + previous.__wrapped__ = clone; + } else { + result = clone; + } + var previous = clone; + parent = parent.__wrapped__; + } + previous.__wrapped__ = value; + return result; +} + +module.exports = wrapperPlant; diff --git a/node_modules/lodash/chain/wrapperReverse.js b/node_modules/lodash/chain/wrapperReverse.js new file mode 100644 index 0000000000..4518b3ed28 --- /dev/null +++ b/node_modules/lodash/chain/wrapperReverse.js @@ -0,0 +1,38 @@ +var LazyWrapper = require('../internal/LazyWrapper'), + LodashWrapper = require('../internal/LodashWrapper'), + thru = require('./thru'); + +/** + * Reverses the wrapped array so the first element becomes the last, the + * second element becomes the second to last, and so on. + * + * **Note:** This method mutates the wrapped array. + * + * @name reverse + * @memberOf _ + * @category Chain + * @returns {Object} Returns the new reversed `lodash` wrapper instance. + * @example + * + * var array = [1, 2, 3]; + * + * _(array).reverse().value() + * // => [3, 2, 1] + * + * console.log(array); + * // => [3, 2, 1] + */ +function wrapperReverse() { + var value = this.__wrapped__; + if (value instanceof LazyWrapper) { + if (this.__actions__.length) { + value = new LazyWrapper(this); + } + return new LodashWrapper(value.reverse(), this.__chain__); + } + return this.thru(function(value) { + return value.reverse(); + }); +} + +module.exports = wrapperReverse; diff --git a/node_modules/lodash/chain/wrapperToString.js b/node_modules/lodash/chain/wrapperToString.js new file mode 100644 index 0000000000..db975a5a35 --- /dev/null +++ b/node_modules/lodash/chain/wrapperToString.js @@ -0,0 +1,17 @@ +/** + * Produces the result of coercing the unwrapped value to a string. + * + * @name toString + * @memberOf _ + * @category Chain + * @returns {string} Returns the coerced string value. + * @example + * + * _([1, 2, 3]).toString(); + * // => '1,2,3' + */ +function wrapperToString() { + return (this.value() + ''); +} + +module.exports = wrapperToString; diff --git a/node_modules/lodash/chain/wrapperValue.js b/node_modules/lodash/chain/wrapperValue.js new file mode 100644 index 0000000000..2734e41c4a --- /dev/null +++ b/node_modules/lodash/chain/wrapperValue.js @@ -0,0 +1,20 @@ +var baseWrapperValue = require('../internal/baseWrapperValue'); + +/** + * Executes the chained sequence to extract the unwrapped value. + * + * @name value + * @memberOf _ + * @alias run, toJSON, valueOf + * @category Chain + * @returns {*} Returns the resolved unwrapped value. + * @example + * + * _([1, 2, 3]).value(); + * // => [1, 2, 3] + */ +function wrapperValue() { + return baseWrapperValue(this.__wrapped__, this.__actions__); +} + +module.exports = wrapperValue; diff --git a/node_modules/lodash/collection.js b/node_modules/lodash/collection.js new file mode 100644 index 0000000000..03388571c3 --- /dev/null +++ b/node_modules/lodash/collection.js @@ -0,0 +1,44 @@ +module.exports = { + 'all': require('./collection/all'), + 'any': require('./collection/any'), + 'at': require('./collection/at'), + 'collect': require('./collection/collect'), + 'contains': require('./collection/contains'), + 'countBy': require('./collection/countBy'), + 'detect': require('./collection/detect'), + 'each': require('./collection/each'), + 'eachRight': require('./collection/eachRight'), + 'every': require('./collection/every'), + 'filter': require('./collection/filter'), + 'find': require('./collection/find'), + 'findLast': require('./collection/findLast'), + 'findWhere': require('./collection/findWhere'), + 'foldl': require('./collection/foldl'), + 'foldr': require('./collection/foldr'), + 'forEach': require('./collection/forEach'), + 'forEachRight': require('./collection/forEachRight'), + 'groupBy': require('./collection/groupBy'), + 'include': require('./collection/include'), + 'includes': require('./collection/includes'), + 'indexBy': require('./collection/indexBy'), + 'inject': require('./collection/inject'), + 'invoke': require('./collection/invoke'), + 'map': require('./collection/map'), + 'max': require('./math/max'), + 'min': require('./math/min'), + 'partition': require('./collection/partition'), + 'pluck': require('./collection/pluck'), + 'reduce': require('./collection/reduce'), + 'reduceRight': require('./collection/reduceRight'), + 'reject': require('./collection/reject'), + 'sample': require('./collection/sample'), + 'select': require('./collection/select'), + 'shuffle': require('./collection/shuffle'), + 'size': require('./collection/size'), + 'some': require('./collection/some'), + 'sortBy': require('./collection/sortBy'), + 'sortByAll': require('./collection/sortByAll'), + 'sortByOrder': require('./collection/sortByOrder'), + 'sum': require('./math/sum'), + 'where': require('./collection/where') +}; diff --git a/node_modules/lodash/collection/all.js b/node_modules/lodash/collection/all.js new file mode 100644 index 0000000000..d0839f77ed --- /dev/null +++ b/node_modules/lodash/collection/all.js @@ -0,0 +1 @@ +module.exports = require('./every'); diff --git a/node_modules/lodash/collection/any.js b/node_modules/lodash/collection/any.js new file mode 100644 index 0000000000..900ac25e83 --- /dev/null +++ b/node_modules/lodash/collection/any.js @@ -0,0 +1 @@ +module.exports = require('./some'); diff --git a/node_modules/lodash/collection/at.js b/node_modules/lodash/collection/at.js new file mode 100644 index 0000000000..753f4eabbd --- /dev/null +++ b/node_modules/lodash/collection/at.js @@ -0,0 +1,36 @@ +var baseAt = require('../internal/baseAt'), + baseFlatten = require('../internal/baseFlatten'), + getLength = require('../internal/getLength'), + isLength = require('../internal/isLength'), + restParam = require('../function/restParam'), + toIterable = require('../internal/toIterable'); + +/** + * Creates an array of elements corresponding to the given keys, or indexes, + * of `collection`. Keys may be specified as individual arguments or as arrays + * of keys. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {...(number|number[]|string|string[])} [props] The property names + * or indexes of elements to pick, specified individually or in arrays. + * @returns {Array} Returns the new array of picked elements. + * @example + * + * _.at(['a', 'b', 'c'], [0, 2]); + * // => ['a', 'c'] + * + * _.at(['barney', 'fred', 'pebbles'], 0, 2); + * // => ['barney', 'pebbles'] + */ +var at = restParam(function(collection, props) { + var length = collection ? getLength(collection) : 0; + if (isLength(length)) { + collection = toIterable(collection); + } + return baseAt(collection, baseFlatten(props)); +}); + +module.exports = at; diff --git a/node_modules/lodash/collection/collect.js b/node_modules/lodash/collection/collect.js new file mode 100644 index 0000000000..0d1e1abfaf --- /dev/null +++ b/node_modules/lodash/collection/collect.js @@ -0,0 +1 @@ +module.exports = require('./map'); diff --git a/node_modules/lodash/collection/contains.js b/node_modules/lodash/collection/contains.js new file mode 100644 index 0000000000..594722af59 --- /dev/null +++ b/node_modules/lodash/collection/contains.js @@ -0,0 +1 @@ +module.exports = require('./includes'); diff --git a/node_modules/lodash/collection/countBy.js b/node_modules/lodash/collection/countBy.js new file mode 100644 index 0000000000..e97dbb749d --- /dev/null +++ b/node_modules/lodash/collection/countBy.js @@ -0,0 +1,54 @@ +var createAggregator = require('../internal/createAggregator'); + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is the number of times the key was returned by `iteratee`. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.countBy([4.3, 6.1, 6.4], function(n) { + * return Math.floor(n); + * }); + * // => { '4': 1, '6': 2 } + * + * _.countBy([4.3, 6.1, 6.4], function(n) { + * return this.floor(n); + * }, Math); + * // => { '4': 1, '6': 2 } + * + * _.countBy(['one', 'two', 'three'], 'length'); + * // => { '3': 2, '5': 1 } + */ +var countBy = createAggregator(function(result, value, key) { + hasOwnProperty.call(result, key) ? ++result[key] : (result[key] = 1); +}); + +module.exports = countBy; diff --git a/node_modules/lodash/collection/detect.js b/node_modules/lodash/collection/detect.js new file mode 100644 index 0000000000..2fb6303efb --- /dev/null +++ b/node_modules/lodash/collection/detect.js @@ -0,0 +1 @@ +module.exports = require('./find'); diff --git a/node_modules/lodash/collection/each.js b/node_modules/lodash/collection/each.js new file mode 100644 index 0000000000..8800f42046 --- /dev/null +++ b/node_modules/lodash/collection/each.js @@ -0,0 +1 @@ +module.exports = require('./forEach'); diff --git a/node_modules/lodash/collection/eachRight.js b/node_modules/lodash/collection/eachRight.js new file mode 100644 index 0000000000..3252b2aba3 --- /dev/null +++ b/node_modules/lodash/collection/eachRight.js @@ -0,0 +1 @@ +module.exports = require('./forEachRight'); diff --git a/node_modules/lodash/collection/every.js b/node_modules/lodash/collection/every.js new file mode 100644 index 0000000000..a04d3db637 --- /dev/null +++ b/node_modules/lodash/collection/every.js @@ -0,0 +1,66 @@ +var arrayEvery = require('../internal/arrayEvery'), + baseCallback = require('../internal/baseCallback'), + baseEvery = require('../internal/baseEvery'), + isArray = require('../lang/isArray'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Checks if `predicate` returns truthy for **all** elements of `collection`. + * The predicate is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias all + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {boolean} Returns `true` if all elements pass the predicate check, + * else `false`. + * @example + * + * _.every([true, 1, null, 'yes'], Boolean); + * // => false + * + * var users = [ + * { 'user': 'barney', 'active': false }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.every(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // using the `_.matchesProperty` callback shorthand + * _.every(users, 'active', false); + * // => true + * + * // using the `_.property` callback shorthand + * _.every(users, 'active'); + * // => false + */ +function every(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayEvery : baseEvery; + if (thisArg && isIterateeCall(collection, predicate, thisArg)) { + predicate = null; + } + if (typeof predicate != 'function' || thisArg !== undefined) { + predicate = baseCallback(predicate, thisArg, 3); + } + return func(collection, predicate); +} + +module.exports = every; diff --git a/node_modules/lodash/collection/filter.js b/node_modules/lodash/collection/filter.js new file mode 100644 index 0000000000..7620aa7619 --- /dev/null +++ b/node_modules/lodash/collection/filter.js @@ -0,0 +1,61 @@ +var arrayFilter = require('../internal/arrayFilter'), + baseCallback = require('../internal/baseCallback'), + baseFilter = require('../internal/baseFilter'), + isArray = require('../lang/isArray'); + +/** + * Iterates over elements of `collection`, returning an array of all elements + * `predicate` returns truthy for. The predicate is bound to `thisArg` and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias select + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new filtered array. + * @example + * + * _.filter([4, 5, 6], function(n) { + * return n % 2 == 0; + * }); + * // => [4, 6] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.filter(users, { 'age': 36, 'active': true }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.filter(users, 'active', false), 'user'); + * // => ['fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.filter(users, 'active'), 'user'); + * // => ['barney'] + */ +function filter(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayFilter : baseFilter; + predicate = baseCallback(predicate, thisArg, 3); + return func(collection, predicate); +} + +module.exports = filter; diff --git a/node_modules/lodash/collection/find.js b/node_modules/lodash/collection/find.js new file mode 100644 index 0000000000..7358cfe86c --- /dev/null +++ b/node_modules/lodash/collection/find.js @@ -0,0 +1,56 @@ +var baseEach = require('../internal/baseEach'), + createFind = require('../internal/createFind'); + +/** + * Iterates over elements of `collection`, returning the first element + * `predicate` returns truthy for. The predicate is bound to `thisArg` and + * invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias detect + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false }, + * { 'user': 'pebbles', 'age': 1, 'active': true } + * ]; + * + * _.result(_.find(users, function(chr) { + * return chr.age < 40; + * }), 'user'); + * // => 'barney' + * + * // using the `_.matches` callback shorthand + * _.result(_.find(users, { 'age': 1, 'active': true }), 'user'); + * // => 'pebbles' + * + * // using the `_.matchesProperty` callback shorthand + * _.result(_.find(users, 'active', false), 'user'); + * // => 'fred' + * + * // using the `_.property` callback shorthand + * _.result(_.find(users, 'active'), 'user'); + * // => 'barney' + */ +var find = createFind(baseEach); + +module.exports = find; diff --git a/node_modules/lodash/collection/findLast.js b/node_modules/lodash/collection/findLast.js new file mode 100644 index 0000000000..75dbadca24 --- /dev/null +++ b/node_modules/lodash/collection/findLast.js @@ -0,0 +1,25 @@ +var baseEachRight = require('../internal/baseEachRight'), + createFind = require('../internal/createFind'); + +/** + * This method is like `_.find` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * _.findLast([1, 2, 3, 4], function(n) { + * return n % 2 == 1; + * }); + * // => 3 + */ +var findLast = createFind(baseEachRight, true); + +module.exports = findLast; diff --git a/node_modules/lodash/collection/findWhere.js b/node_modules/lodash/collection/findWhere.js new file mode 100644 index 0000000000..2d620655ed --- /dev/null +++ b/node_modules/lodash/collection/findWhere.js @@ -0,0 +1,37 @@ +var baseMatches = require('../internal/baseMatches'), + find = require('./find'); + +/** + * Performs a deep comparison between each element in `collection` and the + * source object, returning the first element that has equivalent property + * values. + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. For comparing a single + * own or inherited property value see `_.matchesProperty`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Object} source The object of property values to match. + * @returns {*} Returns the matched element, else `undefined`. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': true }, + * { 'user': 'fred', 'age': 40, 'active': false } + * ]; + * + * _.result(_.findWhere(users, { 'age': 36, 'active': true }), 'user'); + * // => 'barney' + * + * _.result(_.findWhere(users, { 'age': 40, 'active': false }), 'user'); + * // => 'fred' + */ +function findWhere(collection, source) { + return find(collection, baseMatches(source)); +} + +module.exports = findWhere; diff --git a/node_modules/lodash/collection/foldl.js b/node_modules/lodash/collection/foldl.js new file mode 100644 index 0000000000..26f53cf7b2 --- /dev/null +++ b/node_modules/lodash/collection/foldl.js @@ -0,0 +1 @@ +module.exports = require('./reduce'); diff --git a/node_modules/lodash/collection/foldr.js b/node_modules/lodash/collection/foldr.js new file mode 100644 index 0000000000..8fb199eda6 --- /dev/null +++ b/node_modules/lodash/collection/foldr.js @@ -0,0 +1 @@ +module.exports = require('./reduceRight'); diff --git a/node_modules/lodash/collection/forEach.js b/node_modules/lodash/collection/forEach.js new file mode 100644 index 0000000000..05a8e2140e --- /dev/null +++ b/node_modules/lodash/collection/forEach.js @@ -0,0 +1,37 @@ +var arrayEach = require('../internal/arrayEach'), + baseEach = require('../internal/baseEach'), + createForEach = require('../internal/createForEach'); + +/** + * Iterates over elements of `collection` invoking `iteratee` for each element. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). Iteratee functions may exit iteration early + * by explicitly returning `false`. + * + * **Note:** As with other "Collections" methods, objects with a "length" property + * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` + * may be used for object iteration. + * + * @static + * @memberOf _ + * @alias each + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array|Object|string} Returns `collection`. + * @example + * + * _([1, 2]).forEach(function(n) { + * console.log(n); + * }).value(); + * // => logs each value from left to right and returns the array + * + * _.forEach({ 'a': 1, 'b': 2 }, function(n, key) { + * console.log(n, key); + * }); + * // => logs each value-key pair and returns the object (iteration order is not guaranteed) + */ +var forEach = createForEach(arrayEach, baseEach); + +module.exports = forEach; diff --git a/node_modules/lodash/collection/forEachRight.js b/node_modules/lodash/collection/forEachRight.js new file mode 100644 index 0000000000..3499711002 --- /dev/null +++ b/node_modules/lodash/collection/forEachRight.js @@ -0,0 +1,26 @@ +var arrayEachRight = require('../internal/arrayEachRight'), + baseEachRight = require('../internal/baseEachRight'), + createForEach = require('../internal/createForEach'); + +/** + * This method is like `_.forEach` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @alias eachRight + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array|Object|string} Returns `collection`. + * @example + * + * _([1, 2]).forEachRight(function(n) { + * console.log(n); + * }).value(); + * // => logs each value from right to left and returns the array + */ +var forEachRight = createForEach(arrayEachRight, baseEachRight); + +module.exports = forEachRight; diff --git a/node_modules/lodash/collection/groupBy.js b/node_modules/lodash/collection/groupBy.js new file mode 100644 index 0000000000..a925c894a0 --- /dev/null +++ b/node_modules/lodash/collection/groupBy.js @@ -0,0 +1,59 @@ +var createAggregator = require('../internal/createAggregator'); + +/** Used for native method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + +/** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is an array of the elements responsible for generating the key. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * _.groupBy([4.2, 6.1, 6.4], function(n) { + * return Math.floor(n); + * }); + * // => { '4': [4.2], '6': [6.1, 6.4] } + * + * _.groupBy([4.2, 6.1, 6.4], function(n) { + * return this.floor(n); + * }, Math); + * // => { '4': [4.2], '6': [6.1, 6.4] } + * + * // using the `_.property` callback shorthand + * _.groupBy(['one', 'two', 'three'], 'length'); + * // => { '3': ['one', 'two'], '5': ['three'] } + */ +var groupBy = createAggregator(function(result, value, key) { + if (hasOwnProperty.call(result, key)) { + result[key].push(value); + } else { + result[key] = [value]; + } +}); + +module.exports = groupBy; diff --git a/node_modules/lodash/collection/include.js b/node_modules/lodash/collection/include.js new file mode 100644 index 0000000000..594722af59 --- /dev/null +++ b/node_modules/lodash/collection/include.js @@ -0,0 +1 @@ +module.exports = require('./includes'); diff --git a/node_modules/lodash/collection/includes.js b/node_modules/lodash/collection/includes.js new file mode 100644 index 0000000000..dcf6f20cfd --- /dev/null +++ b/node_modules/lodash/collection/includes.js @@ -0,0 +1,63 @@ +var baseIndexOf = require('../internal/baseIndexOf'), + getLength = require('../internal/getLength'), + isArray = require('../lang/isArray'), + isIterateeCall = require('../internal/isIterateeCall'), + isLength = require('../internal/isLength'), + isString = require('../lang/isString'), + values = require('../object/values'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; + +/** + * Checks if `value` is in `collection` using `SameValueZero` for equality + * comparisons. If `fromIndex` is negative, it is used as the offset from + * the end of `collection`. + * + * **Note:** [`SameValueZero`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-samevaluezero) + * comparisons are like strict equality comparisons, e.g. `===`, except that + * `NaN` matches `NaN`. + * + * @static + * @memberOf _ + * @alias contains, include + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {*} target The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. + * @returns {boolean} Returns `true` if a matching element is found, else `false`. + * @example + * + * _.includes([1, 2, 3], 1); + * // => true + * + * _.includes([1, 2, 3], 1, 2); + * // => false + * + * _.includes({ 'user': 'fred', 'age': 40 }, 'fred'); + * // => true + * + * _.includes('pebbles', 'eb'); + * // => true + */ +function includes(collection, target, fromIndex, guard) { + var length = collection ? getLength(collection) : 0; + if (!isLength(length)) { + collection = values(collection); + length = collection.length; + } + if (!length) { + return false; + } + if (typeof fromIndex != 'number' || (guard && isIterateeCall(target, fromIndex, guard))) { + fromIndex = 0; + } else { + fromIndex = fromIndex < 0 ? nativeMax(length + fromIndex, 0) : (fromIndex || 0); + } + return (typeof collection == 'string' || !isArray(collection) && isString(collection)) + ? (fromIndex < length && collection.indexOf(target, fromIndex) > -1) + : (baseIndexOf(collection, target, fromIndex) > -1); +} + +module.exports = includes; diff --git a/node_modules/lodash/collection/indexBy.js b/node_modules/lodash/collection/indexBy.js new file mode 100644 index 0000000000..34a941e729 --- /dev/null +++ b/node_modules/lodash/collection/indexBy.js @@ -0,0 +1,53 @@ +var createAggregator = require('../internal/createAggregator'); + +/** + * Creates an object composed of keys generated from the results of running + * each element of `collection` through `iteratee`. The corresponding value + * of each key is the last element responsible for generating the key. The + * iteratee function is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Object} Returns the composed aggregate object. + * @example + * + * var keyData = [ + * { 'dir': 'left', 'code': 97 }, + * { 'dir': 'right', 'code': 100 } + * ]; + * + * _.indexBy(keyData, 'dir'); + * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } + * + * _.indexBy(keyData, function(object) { + * return String.fromCharCode(object.code); + * }); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + * + * _.indexBy(keyData, function(object) { + * return this.fromCharCode(object.code); + * }, String); + * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } + */ +var indexBy = createAggregator(function(result, value, key) { + result[key] = value; +}); + +module.exports = indexBy; diff --git a/node_modules/lodash/collection/inject.js b/node_modules/lodash/collection/inject.js new file mode 100644 index 0000000000..26f53cf7b2 --- /dev/null +++ b/node_modules/lodash/collection/inject.js @@ -0,0 +1 @@ +module.exports = require('./reduce'); diff --git a/node_modules/lodash/collection/invoke.js b/node_modules/lodash/collection/invoke.js new file mode 100644 index 0000000000..d68fa33bba --- /dev/null +++ b/node_modules/lodash/collection/invoke.js @@ -0,0 +1,44 @@ +var baseEach = require('../internal/baseEach'), + getLength = require('../internal/getLength'), + invokePath = require('../internal/invokePath'), + isKey = require('../internal/isKey'), + isLength = require('../internal/isLength'), + restParam = require('../function/restParam'); + +/** + * Invokes the method at `path` on each element in `collection`, returning + * an array of the results of each invoked method. Any additional arguments + * are provided to each invoked method. If `methodName` is a function it is + * invoked for, and `this` bound to, each element in `collection`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Array|Function|string} path The path of the method to invoke or + * the function invoked per iteration. + * @param {...*} [args] The arguments to invoke the method with. + * @returns {Array} Returns the array of results. + * @example + * + * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * _.invoke([123, 456], String.prototype.split, ''); + * // => [['1', '2', '3'], ['4', '5', '6']] + */ +var invoke = restParam(function(collection, path, args) { + var index = -1, + isFunc = typeof path == 'function', + isProp = isKey(path), + length = getLength(collection), + result = isLength(length) ? Array(length) : []; + + baseEach(collection, function(value) { + var func = isFunc ? path : (isProp && value != null && value[path]); + result[++index] = func ? func.apply(value, args) : invokePath(value, path, args); + }); + return result; +}); + +module.exports = invoke; diff --git a/node_modules/lodash/collection/map.js b/node_modules/lodash/collection/map.js new file mode 100644 index 0000000000..cc337bcd5f --- /dev/null +++ b/node_modules/lodash/collection/map.js @@ -0,0 +1,67 @@ +var arrayMap = require('../internal/arrayMap'), + baseCallback = require('../internal/baseCallback'), + baseMap = require('../internal/baseMap'), + isArray = require('../lang/isArray'); + +/** + * Creates an array of values by running each element in `collection` through + * `iteratee`. The `iteratee` is bound to `thisArg` and invoked with three + * arguments: (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * Many lodash methods are guarded to work as interatees for methods like + * `_.every`, `_.filter`, `_.map`, `_.mapValues`, `_.reject`, and `_.some`. + * + * The guarded methods are: + * `ary`, `callback`, `chunk`, `clone`, `create`, `curry`, `curryRight`, `drop`, + * `dropRight`, `every`, `fill`, `flatten`, `invert`, `max`, `min`, `parseInt`, + * `slice`, `sortBy`, `take`, `takeRight`, `template`, `trim`, `trimLeft`, + * `trimRight`, `trunc`, `random`, `range`, `sample`, `some`, `uniq`, and `words` + * + * @static + * @memberOf _ + * @alias collect + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new mapped array. + * @example + * + * function timesThree(n) { + * return n * 3; + * } + * + * _.map([1, 2], timesThree); + * // => [3, 6] + * + * _.map({ 'a': 1, 'b': 2 }, timesThree); + * // => [3, 6] (iteration order is not guaranteed) + * + * var users = [ + * { 'user': 'barney' }, + * { 'user': 'fred' } + * ]; + * + * // using the `_.property` callback shorthand + * _.map(users, 'user'); + * // => ['barney', 'fred'] + */ +function map(collection, iteratee, thisArg) { + var func = isArray(collection) ? arrayMap : baseMap; + iteratee = baseCallback(iteratee, thisArg, 3); + return func(collection, iteratee); +} + +module.exports = map; diff --git a/node_modules/lodash/collection/max.js b/node_modules/lodash/collection/max.js new file mode 100644 index 0000000000..bb1d213c33 --- /dev/null +++ b/node_modules/lodash/collection/max.js @@ -0,0 +1 @@ +module.exports = require('../math/max'); diff --git a/node_modules/lodash/collection/min.js b/node_modules/lodash/collection/min.js new file mode 100644 index 0000000000..eef13d02b8 --- /dev/null +++ b/node_modules/lodash/collection/min.js @@ -0,0 +1 @@ +module.exports = require('../math/min'); diff --git a/node_modules/lodash/collection/partition.js b/node_modules/lodash/collection/partition.js new file mode 100644 index 0000000000..ee35f27d93 --- /dev/null +++ b/node_modules/lodash/collection/partition.js @@ -0,0 +1,66 @@ +var createAggregator = require('../internal/createAggregator'); + +/** + * Creates an array of elements split into two groups, the first of which + * contains elements `predicate` returns truthy for, while the second of which + * contains elements `predicate` returns falsey for. The predicate is bound + * to `thisArg` and invoked with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the array of grouped elements. + * @example + * + * _.partition([1, 2, 3], function(n) { + * return n % 2; + * }); + * // => [[1, 3], [2]] + * + * _.partition([1.2, 2.3, 3.4], function(n) { + * return this.floor(n) % 2; + * }, Math); + * // => [[1.2, 3.4], [2.3]] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true }, + * { 'user': 'pebbles', 'age': 1, 'active': false } + * ]; + * + * var mapper = function(array) { + * return _.pluck(array, 'user'); + * }; + * + * // using the `_.matches` callback shorthand + * _.map(_.partition(users, { 'age': 1, 'active': false }), mapper); + * // => [['pebbles'], ['barney', 'fred']] + * + * // using the `_.matchesProperty` callback shorthand + * _.map(_.partition(users, 'active', false), mapper); + * // => [['barney', 'pebbles'], ['fred']] + * + * // using the `_.property` callback shorthand + * _.map(_.partition(users, 'active'), mapper); + * // => [['fred'], ['barney', 'pebbles']] + */ +var partition = createAggregator(function(result, value, key) { + result[key ? 0 : 1].push(value); +}, function() { return [[], []]; }); + +module.exports = partition; diff --git a/node_modules/lodash/collection/pluck.js b/node_modules/lodash/collection/pluck.js new file mode 100644 index 0000000000..5ee1ec84ee --- /dev/null +++ b/node_modules/lodash/collection/pluck.js @@ -0,0 +1,31 @@ +var map = require('./map'), + property = require('../utility/property'); + +/** + * Gets the property value of `path` from all elements in `collection`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Array|string} path The path of the property to pluck. + * @returns {Array} Returns the property values. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 40 } + * ]; + * + * _.pluck(users, 'user'); + * // => ['barney', 'fred'] + * + * var userIndex = _.indexBy(users, 'user'); + * _.pluck(userIndex, 'age'); + * // => [36, 40] (iteration order is not guaranteed) + */ +function pluck(collection, path) { + return map(collection, property(path)); +} + +module.exports = pluck; diff --git a/node_modules/lodash/collection/reduce.js b/node_modules/lodash/collection/reduce.js new file mode 100644 index 0000000000..a483d2568b --- /dev/null +++ b/node_modules/lodash/collection/reduce.js @@ -0,0 +1,43 @@ +var arrayReduce = require('../internal/arrayReduce'), + baseEach = require('../internal/baseEach'), + createReduce = require('../internal/createReduce'); + +/** + * Reduces `collection` to a value which is the accumulated result of running + * each element in `collection` through `iteratee`, where each successive + * invocation is supplied the return value of the previous. If `accumulator` + * is not provided the first element of `collection` is used as the initial + * value. The `iteratee` is bound to `thisArg` and invoked with four arguments: + * (accumulator, value, index|key, collection). + * + * Many lodash methods are guarded to work as interatees for methods like + * `_.reduce`, `_.reduceRight`, and `_.transform`. + * + * The guarded methods are: + * `assign`, `defaults`, `includes`, `merge`, `sortByAll`, and `sortByOrder` + * + * @static + * @memberOf _ + * @alias foldl, inject + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {*} Returns the accumulated value. + * @example + * + * _.reduce([1, 2], function(total, n) { + * return total + n; + * }); + * // => 3 + * + * _.reduce({ 'a': 1, 'b': 2 }, function(result, n, key) { + * result[key] = n * 3; + * return result; + * }, {}); + * // => { 'a': 3, 'b': 6 } (iteration order is not guaranteed) + */ +var reduce = createReduce(arrayReduce, baseEach); + +module.exports = reduce; diff --git a/node_modules/lodash/collection/reduceRight.js b/node_modules/lodash/collection/reduceRight.js new file mode 100644 index 0000000000..b40e3338ee --- /dev/null +++ b/node_modules/lodash/collection/reduceRight.js @@ -0,0 +1,29 @@ +var arrayReduceRight = require('../internal/arrayReduceRight'), + baseEachRight = require('../internal/baseEachRight'), + createReduce = require('../internal/createReduce'); + +/** + * This method is like `_.reduce` except that it iterates over elements of + * `collection` from right to left. + * + * @static + * @memberOf _ + * @alias foldr + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {*} Returns the accumulated value. + * @example + * + * var array = [[0, 1], [2, 3], [4, 5]]; + * + * _.reduceRight(array, function(flattened, other) { + * return flattened.concat(other); + * }, []); + * // => [4, 5, 2, 3, 0, 1] + */ +var reduceRight = createReduce(arrayReduceRight, baseEachRight); + +module.exports = reduceRight; diff --git a/node_modules/lodash/collection/reject.js b/node_modules/lodash/collection/reject.js new file mode 100644 index 0000000000..e783fc7dd5 --- /dev/null +++ b/node_modules/lodash/collection/reject.js @@ -0,0 +1,61 @@ +var arrayFilter = require('../internal/arrayFilter'), + baseCallback = require('../internal/baseCallback'), + baseFilter = require('../internal/baseFilter'), + isArray = require('../lang/isArray'); + +/** + * The opposite of `_.filter`; this method returns the elements of `collection` + * that `predicate` does **not** return truthy for. + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Array} Returns the new filtered array. + * @example + * + * _.reject([1, 2, 3, 4], function(n) { + * return n % 2 == 0; + * }); + * // => [1, 3] + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false }, + * { 'user': 'fred', 'age': 40, 'active': true } + * ]; + * + * // using the `_.matches` callback shorthand + * _.pluck(_.reject(users, { 'age': 40, 'active': true }), 'user'); + * // => ['barney'] + * + * // using the `_.matchesProperty` callback shorthand + * _.pluck(_.reject(users, 'active', false), 'user'); + * // => ['fred'] + * + * // using the `_.property` callback shorthand + * _.pluck(_.reject(users, 'active'), 'user'); + * // => ['barney'] + */ +function reject(collection, predicate, thisArg) { + var func = isArray(collection) ? arrayFilter : baseFilter; + predicate = baseCallback(predicate, thisArg, 3); + return func(collection, function(value, index, collection) { + return !predicate(value, index, collection); + }); +} + +module.exports = reject; diff --git a/node_modules/lodash/collection/sample.js b/node_modules/lodash/collection/sample.js new file mode 100644 index 0000000000..f090db107d --- /dev/null +++ b/node_modules/lodash/collection/sample.js @@ -0,0 +1,38 @@ +var baseRandom = require('../internal/baseRandom'), + isIterateeCall = require('../internal/isIterateeCall'), + shuffle = require('./shuffle'), + toIterable = require('../internal/toIterable'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeMin = Math.min; + +/** + * Gets a random element or `n` random elements from a collection. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to sample. + * @param {number} [n] The number of elements to sample. + * @param- {Object} [guard] Enables use as a callback for functions like `_.map`. + * @returns {*} Returns the random sample(s). + * @example + * + * _.sample([1, 2, 3, 4]); + * // => 2 + * + * _.sample([1, 2, 3, 4], 2); + * // => [3, 1] + */ +function sample(collection, n, guard) { + if (guard ? isIterateeCall(collection, n, guard) : n == null) { + collection = toIterable(collection); + var length = collection.length; + return length > 0 ? collection[baseRandom(0, length - 1)] : undefined; + } + var result = shuffle(collection); + result.length = nativeMin(n < 0 ? 0 : (+n || 0), result.length); + return result; +} + +module.exports = sample; diff --git a/node_modules/lodash/collection/select.js b/node_modules/lodash/collection/select.js new file mode 100644 index 0000000000..ade80f6fba --- /dev/null +++ b/node_modules/lodash/collection/select.js @@ -0,0 +1 @@ +module.exports = require('./filter'); diff --git a/node_modules/lodash/collection/shuffle.js b/node_modules/lodash/collection/shuffle.js new file mode 100644 index 0000000000..2281d4f65b --- /dev/null +++ b/node_modules/lodash/collection/shuffle.js @@ -0,0 +1,35 @@ +var baseRandom = require('../internal/baseRandom'), + toIterable = require('../internal/toIterable'); + +/** + * Creates an array of shuffled values, using a version of the + * [Fisher-Yates shuffle](https://en.wikipedia.org/wiki/Fisher-Yates_shuffle). + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to shuffle. + * @returns {Array} Returns the new shuffled array. + * @example + * + * _.shuffle([1, 2, 3, 4]); + * // => [4, 1, 3, 2] + */ +function shuffle(collection) { + collection = toIterable(collection); + + var index = -1, + length = collection.length, + result = Array(length); + + while (++index < length) { + var rand = baseRandom(0, index); + if (index != rand) { + result[index] = result[rand]; + } + result[rand] = collection[index]; + } + return result; +} + +module.exports = shuffle; diff --git a/node_modules/lodash/collection/size.js b/node_modules/lodash/collection/size.js new file mode 100644 index 0000000000..78dcf4ce9b --- /dev/null +++ b/node_modules/lodash/collection/size.js @@ -0,0 +1,30 @@ +var getLength = require('../internal/getLength'), + isLength = require('../internal/isLength'), + keys = require('../object/keys'); + +/** + * Gets the size of `collection` by returning its length for array-like + * values or the number of own enumerable properties for objects. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to inspect. + * @returns {number} Returns the size of `collection`. + * @example + * + * _.size([1, 2, 3]); + * // => 3 + * + * _.size({ 'a': 1, 'b': 2 }); + * // => 2 + * + * _.size('pebbles'); + * // => 7 + */ +function size(collection) { + var length = collection ? getLength(collection) : 0; + return isLength(length) ? length : keys(collection).length; +} + +module.exports = size; diff --git a/node_modules/lodash/collection/some.js b/node_modules/lodash/collection/some.js new file mode 100644 index 0000000000..2b866b464b --- /dev/null +++ b/node_modules/lodash/collection/some.js @@ -0,0 +1,67 @@ +var arraySome = require('../internal/arraySome'), + baseCallback = require('../internal/baseCallback'), + baseSome = require('../internal/baseSome'), + isArray = require('../lang/isArray'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Checks if `predicate` returns truthy for **any** element of `collection`. + * The function returns as soon as it finds a passing value and does not iterate + * over the entire collection. The predicate is bound to `thisArg` and invoked + * with three arguments: (value, index|key, collection). + * + * If a property name is provided for `predicate` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `predicate` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @alias any + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [predicate=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. + * @example + * + * _.some([null, 0, 'yes', false], Boolean); + * // => true + * + * var users = [ + * { 'user': 'barney', 'active': true }, + * { 'user': 'fred', 'active': false } + * ]; + * + * // using the `_.matches` callback shorthand + * _.some(users, { 'user': 'barney', 'active': false }); + * // => false + * + * // using the `_.matchesProperty` callback shorthand + * _.some(users, 'active', false); + * // => true + * + * // using the `_.property` callback shorthand + * _.some(users, 'active'); + * // => true + */ +function some(collection, predicate, thisArg) { + var func = isArray(collection) ? arraySome : baseSome; + if (thisArg && isIterateeCall(collection, predicate, thisArg)) { + predicate = null; + } + if (typeof predicate != 'function' || thisArg !== undefined) { + predicate = baseCallback(predicate, thisArg, 3); + } + return func(collection, predicate); +} + +module.exports = some; diff --git a/node_modules/lodash/collection/sortBy.js b/node_modules/lodash/collection/sortBy.js new file mode 100644 index 0000000000..28d75f56da --- /dev/null +++ b/node_modules/lodash/collection/sortBy.js @@ -0,0 +1,71 @@ +var baseCallback = require('../internal/baseCallback'), + baseMap = require('../internal/baseMap'), + baseSortBy = require('../internal/baseSortBy'), + compareAscending = require('../internal/compareAscending'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * Creates an array of elements, sorted in ascending order by the results of + * running each element in a collection through `iteratee`. This method performs + * a stable sort, that is, it preserves the original sort order of equal elements. + * The `iteratee` is bound to `thisArg` and invoked with three arguments: + * (value, index|key, collection). + * + * If a property name is provided for `iteratee` the created `_.property` + * style callback returns the property value of the given element. + * + * If a value is also provided for `thisArg` the created `_.matchesProperty` + * style callback returns `true` for elements that have a matching property + * value, else `false`. + * + * If an object is provided for `iteratee` the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [iteratee=_.identity] The function invoked + * per iteration. + * @param {*} [thisArg] The `this` binding of `iteratee`. + * @returns {Array} Returns the new sorted array. + * @example + * + * _.sortBy([1, 2, 3], function(n) { + * return Math.sin(n); + * }); + * // => [3, 1, 2] + * + * _.sortBy([1, 2, 3], function(n) { + * return this.sin(n); + * }, Math); + * // => [3, 1, 2] + * + * var users = [ + * { 'user': 'fred' }, + * { 'user': 'pebbles' }, + * { 'user': 'barney' } + * ]; + * + * // using the `_.property` callback shorthand + * _.pluck(_.sortBy(users, 'user'), 'user'); + * // => ['barney', 'fred', 'pebbles'] + */ +function sortBy(collection, iteratee, thisArg) { + if (collection == null) { + return []; + } + if (thisArg && isIterateeCall(collection, iteratee, thisArg)) { + iteratee = null; + } + var index = -1; + iteratee = baseCallback(iteratee, thisArg, 3); + + var result = baseMap(collection, function(value, key, collection) { + return { 'criteria': iteratee(value, key, collection), 'index': ++index, 'value': value }; + }); + return baseSortBy(result, compareAscending); +} + +module.exports = sortBy; diff --git a/node_modules/lodash/collection/sortByAll.js b/node_modules/lodash/collection/sortByAll.js new file mode 100644 index 0000000000..4766c20985 --- /dev/null +++ b/node_modules/lodash/collection/sortByAll.js @@ -0,0 +1,52 @@ +var baseFlatten = require('../internal/baseFlatten'), + baseSortByOrder = require('../internal/baseSortByOrder'), + isIterateeCall = require('../internal/isIterateeCall'), + restParam = require('../function/restParam'); + +/** + * This method is like `_.sortBy` except that it can sort by multiple iteratees + * or property names. + * + * If a property name is provided for an iteratee the created `_.property` + * style callback returns the property value of the given element. + * + * If an object is provided for an iteratee the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {...(Function|Function[]|Object|Object[]|string|string[])} iteratees + * The iteratees to sort by, specified as individual values or arrays of values. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 36 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 34 } + * ]; + * + * _.map(_.sortByAll(users, ['user', 'age']), _.values); + * // => [['barney', 34], ['barney', 36], ['fred', 42], ['fred', 48]] + * + * _.map(_.sortByAll(users, 'user', function(chr) { + * return Math.floor(chr.age / 10); + * }), _.values); + * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ +var sortByAll = restParam(function(collection, iteratees) { + if (collection == null) { + return []; + } + var guard = iteratees[2]; + if (guard && isIterateeCall(iteratees[0], iteratees[1], guard)) { + iteratees.length = 1; + } + return baseSortByOrder(collection, baseFlatten(iteratees), []); +}); + +module.exports = sortByAll; diff --git a/node_modules/lodash/collection/sortByOrder.js b/node_modules/lodash/collection/sortByOrder.js new file mode 100644 index 0000000000..c704eeb61f --- /dev/null +++ b/node_modules/lodash/collection/sortByOrder.js @@ -0,0 +1,55 @@ +var baseSortByOrder = require('../internal/baseSortByOrder'), + isArray = require('../lang/isArray'), + isIterateeCall = require('../internal/isIterateeCall'); + +/** + * This method is like `_.sortByAll` except that it allows specifying the + * sort orders of the iteratees to sort by. A truthy value in `orders` will + * sort the corresponding property name in ascending order while a falsey + * value will sort it in descending order. + * + * If a property name is provided for an iteratee the created `_.property` + * style callback returns the property value of the given element. + * + * If an object is provided for an iteratee the created `_.matches` style + * callback returns `true` for elements that have the properties of the given + * object, else `false`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function[]|Object[]|string[]} iteratees The iteratees to sort by. + * @param {boolean[]} orders The sort orders of `iteratees`. + * @param- {Object} [guard] Enables use as a callback for functions like `_.reduce`. + * @returns {Array} Returns the new sorted array. + * @example + * + * var users = [ + * { 'user': 'fred', 'age': 48 }, + * { 'user': 'barney', 'age': 34 }, + * { 'user': 'fred', 'age': 42 }, + * { 'user': 'barney', 'age': 36 } + * ]; + * + * // sort by `user` in ascending order and by `age` in descending order + * _.map(_.sortByOrder(users, ['user', 'age'], [true, false]), _.values); + * // => [['barney', 36], ['barney', 34], ['fred', 48], ['fred', 42]] + */ +function sortByOrder(collection, iteratees, orders, guard) { + if (collection == null) { + return []; + } + if (guard && isIterateeCall(iteratees, orders, guard)) { + orders = null; + } + if (!isArray(iteratees)) { + iteratees = iteratees == null ? [] : [iteratees]; + } + if (!isArray(orders)) { + orders = orders == null ? [] : [orders]; + } + return baseSortByOrder(collection, iteratees, orders); +} + +module.exports = sortByOrder; diff --git a/node_modules/lodash/collection/sum.js b/node_modules/lodash/collection/sum.js new file mode 100644 index 0000000000..a2e93808ae --- /dev/null +++ b/node_modules/lodash/collection/sum.js @@ -0,0 +1 @@ +module.exports = require('../math/sum'); diff --git a/node_modules/lodash/collection/where.js b/node_modules/lodash/collection/where.js new file mode 100644 index 0000000000..f603bf8ce4 --- /dev/null +++ b/node_modules/lodash/collection/where.js @@ -0,0 +1,37 @@ +var baseMatches = require('../internal/baseMatches'), + filter = require('./filter'); + +/** + * Performs a deep comparison between each element in `collection` and the + * source object, returning an array of all elements that have equivalent + * property values. + * + * **Note:** This method supports comparing arrays, booleans, `Date` objects, + * numbers, `Object` objects, regexes, and strings. Objects are compared by + * their own, not inherited, enumerable properties. For comparing a single + * own or inherited property value see `_.matchesProperty`. + * + * @static + * @memberOf _ + * @category Collection + * @param {Array|Object|string} collection The collection to search. + * @param {Object} source The object of property values to match. + * @returns {Array} Returns the new filtered array. + * @example + * + * var users = [ + * { 'user': 'barney', 'age': 36, 'active': false, 'pets': ['hoppy'] }, + * { 'user': 'fred', 'age': 40, 'active': true, 'pets': ['baby puss', 'dino'] } + * ]; + * + * _.pluck(_.where(users, { 'age': 36, 'active': false }), 'user'); + * // => ['barney'] + * + * _.pluck(_.where(users, { 'pets': ['dino'] }), 'user'); + * // => ['fred'] + */ +function where(collection, source) { + return filter(collection, baseMatches(source)); +} + +module.exports = where; diff --git a/node_modules/lodash/date.js b/node_modules/lodash/date.js new file mode 100644 index 0000000000..195366e777 --- /dev/null +++ b/node_modules/lodash/date.js @@ -0,0 +1,3 @@ +module.exports = { + 'now': require('./date/now') +}; diff --git a/node_modules/lodash/date/now.js b/node_modules/lodash/date/now.js new file mode 100644 index 0000000000..628225d2a0 --- /dev/null +++ b/node_modules/lodash/date/now.js @@ -0,0 +1,24 @@ +var isNative = require('../lang/isNative'); + +/* Native method references for those with the same name as other `lodash` methods. */ +var nativeNow = isNative(nativeNow = Date.now) && nativeNow; + +/** + * Gets the number of milliseconds that have elapsed since the Unix epoch + * (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @category Date + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => logs the number of milliseconds it took for the deferred function to be invoked + */ +var now = nativeNow || function() { + return new Date().getTime(); +}; + +module.exports = now; diff --git a/node_modules/lodash/dist/lodash.compat.js b/node_modules/lodash/dist/lodash.compat.js deleted file mode 100644 index 23798ba853..0000000000 --- a/node_modules/lodash/dist/lodash.compat.js +++ /dev/null @@ -1,7157 +0,0 @@ -/** - * @license - * Lo-Dash 2.4.1 (Custom Build) - * Build: `lodash -o ./dist/lodash.compat.js` - * Copyright 2012-2013 The Dojo Foundation - * Based on Underscore.js 1.5.2 - * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - * Available under MIT license - */ -;(function() { - - /** Used as a safe reference for `undefined` in pre ES5 environments */ - var undefined; - - /** Used to pool arrays and objects used internally */ - var arrayPool = [], - objectPool = []; - - /** Used to generate unique IDs */ - var idCounter = 0; - - /** Used internally to indicate various things */ - var indicatorObject = {}; - - /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */ - var keyPrefix = +new Date + ''; - - /** Used as the size when optimizations are enabled for large arrays */ - var largeArraySize = 75; - - /** Used as the max size of the `arrayPool` and `objectPool` */ - var maxPoolSize = 40; - - /** Used to detect and test whitespace */ - var whitespace = ( - // whitespace - ' \t\x0B\f\xA0\ufeff' + - - // line terminators - '\n\r\u2028\u2029' + - - // unicode category "Zs" space separators - '\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000' - ); - - /** Used to match empty string literals in compiled template source */ - var reEmptyStringLeading = /\b__p \+= '';/g, - reEmptyStringMiddle = /\b(__p \+=) '' \+/g, - reEmptyStringTrailing = /(__e\(.*?\)|\b__t\)) \+\n'';/g; - - /** - * Used to match ES6 template delimiters - * http://people.mozilla.org/~jorendorff/es6-draft.html#sec-literals-string-literals - */ - var reEsTemplate = /\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g; - - /** Used to match regexp flags from their coerced string values */ - var reFlags = /\w*$/; - - /** Used to detected named functions */ - var reFuncName = /^\s*function[ \n\r\t]+\w/; - - /** Used to match "interpolate" template delimiters */ - var reInterpolate = /<%=([\s\S]+?)%>/g; - - /** Used to match leading whitespace and zeros to be removed */ - var reLeadingSpacesAndZeros = RegExp('^[' + whitespace + ']*0+(?=.$)'); - - /** Used to ensure capturing order of template delimiters */ - var reNoMatch = /($^)/; - - /** Used to detect functions containing a `this` reference */ - var reThis = /\bthis\b/; - - /** Used to match unescaped characters in compiled string literals */ - var reUnescapedString = /['\n\r\t\u2028\u2029\\]/g; - - /** Used to assign default `context` object properties */ - var contextProps = [ - 'Array', 'Boolean', 'Date', 'Error', 'Function', 'Math', 'Number', 'Object', - 'RegExp', 'String', '_', 'attachEvent', 'clearTimeout', 'isFinite', 'isNaN', - 'parseInt', 'setTimeout' - ]; - - /** Used to fix the JScript [[DontEnum]] bug */ - var shadowedProps = [ - 'constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', - 'toLocaleString', 'toString', 'valueOf' - ]; - - /** Used to make template sourceURLs easier to identify */ - var templateCounter = 0; - - /** `Object#toString` result shortcuts */ - var argsClass = '[object Arguments]', - arrayClass = '[object Array]', - boolClass = '[object Boolean]', - dateClass = '[object Date]', - errorClass = '[object Error]', - funcClass = '[object Function]', - numberClass = '[object Number]', - objectClass = '[object Object]', - regexpClass = '[object RegExp]', - stringClass = '[object String]'; - - /** Used to identify object classifications that `_.clone` supports */ - var cloneableClasses = {}; - cloneableClasses[funcClass] = false; - cloneableClasses[argsClass] = cloneableClasses[arrayClass] = - cloneableClasses[boolClass] = cloneableClasses[dateClass] = - cloneableClasses[numberClass] = cloneableClasses[objectClass] = - cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true; - - /** Used as an internal `_.debounce` options object */ - var debounceOptions = { - 'leading': false, - 'maxWait': 0, - 'trailing': false - }; - - /** Used as the property descriptor for `__bindData__` */ - var descriptor = { - 'configurable': false, - 'enumerable': false, - 'value': null, - 'writable': false - }; - - /** Used as the data object for `iteratorTemplate` */ - var iteratorData = { - 'args': '', - 'array': null, - 'bottom': '', - 'firstArg': '', - 'init': '', - 'keys': null, - 'loop': '', - 'shadowedProps': null, - 'support': null, - 'top': '', - 'useHas': false - }; - - /** Used to determine if values are of the language type Object */ - var objectTypes = { - 'boolean': false, - 'function': true, - 'object': true, - 'number': false, - 'string': false, - 'undefined': false - }; - - /** Used to escape characters for inclusion in compiled string literals */ - var stringEscapes = { - '\\': '\\', - "'": "'", - '\n': 'n', - '\r': 'r', - '\t': 't', - '\u2028': 'u2028', - '\u2029': 'u2029' - }; - - /** Used as a reference to the global object */ - var root = (objectTypes[typeof window] && window) || this; - - /** Detect free variable `exports` */ - var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; - - /** Detect free variable `module` */ - var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; - - /** Detect the popular CommonJS extension `module.exports` */ - var moduleExports = freeModule && freeModule.exports === freeExports && freeExports; - - /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */ - var freeGlobal = objectTypes[typeof global] && global; - if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { - root = freeGlobal; - } - - /*--------------------------------------------------------------------------*/ - - /** - * The base implementation of `_.indexOf` without support for binary searches - * or `fromIndex` constraints. - * - * @private - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {number} Returns the index of the matched value or `-1`. - */ - function baseIndexOf(array, value, fromIndex) { - var index = (fromIndex || 0) - 1, - length = array ? array.length : 0; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * An implementation of `_.contains` for cache objects that mimics the return - * signature of `_.indexOf` by returning `0` if the value is found, else `-1`. - * - * @private - * @param {Object} cache The cache object to inspect. - * @param {*} value The value to search for. - * @returns {number} Returns `0` if `value` is found, else `-1`. - */ - function cacheIndexOf(cache, value) { - var type = typeof value; - cache = cache.cache; - - if (type == 'boolean' || value == null) { - return cache[value] ? 0 : -1; - } - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value; - cache = (cache = cache[type]) && cache[key]; - - return type == 'object' - ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1) - : (cache ? 0 : -1); - } - - /** - * Adds a given value to the corresponding cache object. - * - * @private - * @param {*} value The value to add to the cache. - */ - function cachePush(value) { - var cache = this.cache, - type = typeof value; - - if (type == 'boolean' || value == null) { - cache[value] = true; - } else { - if (type != 'number' && type != 'string') { - type = 'object'; - } - var key = type == 'number' ? value : keyPrefix + value, - typeCache = cache[type] || (cache[type] = {}); - - if (type == 'object') { - (typeCache[key] || (typeCache[key] = [])).push(value); - } else { - typeCache[key] = true; - } - } - } - - /** - * Used by `_.max` and `_.min` as the default callback when a given - * collection is a string value. - * - * @private - * @param {string} value The character to inspect. - * @returns {number} Returns the code unit of given character. - */ - function charAtCallback(value) { - return value.charCodeAt(0); - } - - /** - * Used by `sortBy` to compare transformed `collection` elements, stable sorting - * them in ascending order. - * - * @private - * @param {Object} a The object to compare to `b`. - * @param {Object} b The object to compare to `a`. - * @returns {number} Returns the sort order indicator of `1` or `-1`. - */ - function compareAscending(a, b) { - var ac = a.criteria, - bc = b.criteria, - index = -1, - length = ac.length; - - while (++index < length) { - var value = ac[index], - other = bc[index]; - - if (value !== other) { - if (value > other || typeof value == 'undefined') { - return 1; - } - if (value < other || typeof other == 'undefined') { - return -1; - } - } - } - // Fixes an `Array#sort` bug in the JS engine embedded in Adobe applications - // that causes it, under certain circumstances, to return the same value for - // `a` and `b`. See https://github.com/jashkenas/underscore/pull/1247 - // - // This also ensures a stable sort in V8 and other engines. - // See http://code.google.com/p/v8/issues/detail?id=90 - return a.index - b.index; - } - - /** - * Creates a cache object to optimize linear searches of large arrays. - * - * @private - * @param {Array} [array=[]] The array to search. - * @returns {null|Object} Returns the cache object or `null` if caching should not be used. - */ - function createCache(array) { - var index = -1, - length = array.length, - first = array[0], - mid = array[(length / 2) | 0], - last = array[length - 1]; - - if (first && typeof first == 'object' && - mid && typeof mid == 'object' && last && typeof last == 'object') { - return false; - } - var cache = getObject(); - cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; - - var result = getObject(); - result.array = array; - result.cache = cache; - result.push = cachePush; - - while (++index < length) { - result.push(array[index]); - } - return result; - } - - /** - * Used by `template` to escape characters for inclusion in compiled - * string literals. - * - * @private - * @param {string} match The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeStringChar(match) { - return '\\' + stringEscapes[match]; - } - - /** - * Gets an array from the array pool or creates a new one if the pool is empty. - * - * @private - * @returns {Array} The array from the pool. - */ - function getArray() { - return arrayPool.pop() || []; - } - - /** - * Gets an object from the object pool or creates a new one if the pool is empty. - * - * @private - * @returns {Object} The object from the pool. - */ - function getObject() { - return objectPool.pop() || { - 'array': null, - 'cache': null, - 'criteria': null, - 'false': false, - 'index': 0, - 'null': false, - 'number': null, - 'object': null, - 'push': null, - 'string': null, - 'true': false, - 'undefined': false, - 'value': null - }; - } - - /** - * Checks if `value` is a DOM node in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a DOM node, else `false`. - */ - function isNode(value) { - // IE < 9 presents DOM nodes as `Object` objects except they have `toString` - // methods that are `typeof` "string" and still can coerce nodes to strings - return typeof value.toString != 'function' && typeof (value + '') == 'string'; - } - - /** - * Releases the given array back to the array pool. - * - * @private - * @param {Array} [array] The array to release. - */ - function releaseArray(array) { - array.length = 0; - if (arrayPool.length < maxPoolSize) { - arrayPool.push(array); - } - } - - /** - * Releases the given object back to the object pool. - * - * @private - * @param {Object} [object] The object to release. - */ - function releaseObject(object) { - var cache = object.cache; - if (cache) { - releaseObject(cache); - } - object.array = object.cache = object.criteria = object.object = object.number = object.string = object.value = null; - if (objectPool.length < maxPoolSize) { - objectPool.push(object); - } - } - - /** - * Slices the `collection` from the `start` index up to, but not including, - * the `end` index. - * - * Note: This function is used instead of `Array#slice` to support node lists - * in IE < 9 and to ensure dense arrays are returned. - * - * @private - * @param {Array|Object|string} collection The collection to slice. - * @param {number} start The start index. - * @param {number} end The end index. - * @returns {Array} Returns the new array. - */ - function slice(array, start, end) { - start || (start = 0); - if (typeof end == 'undefined') { - end = array ? array.length : 0; - } - var index = -1, - length = end - start || 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = array[start + index]; - } - return result; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Create a new `lodash` function using the given context object. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Object} [context=root] The context object. - * @returns {Function} Returns the `lodash` function. - */ - function runInContext(context) { - // Avoid issues with some ES3 environments that attempt to use values, named - // after built-in constructors like `Object`, for the creation of literals. - // ES5 clears this up by stating that literals must use built-in constructors. - // See http://es5.github.io/#x11.1.5. - context = context ? _.defaults(root.Object(), context, _.pick(root, contextProps)) : root; - - /** Native constructor references */ - var Array = context.Array, - Boolean = context.Boolean, - Date = context.Date, - Error = context.Error, - Function = context.Function, - Math = context.Math, - Number = context.Number, - Object = context.Object, - RegExp = context.RegExp, - String = context.String, - TypeError = context.TypeError; - - /** - * Used for `Array` method references. - * - * Normally `Array.prototype` would suffice, however, using an array literal - * avoids issues in Narwhal. - */ - var arrayRef = []; - - /** Used for native method references */ - var errorProto = Error.prototype, - objectProto = Object.prototype, - stringProto = String.prototype; - - /** Used to restore the original `_` reference in `noConflict` */ - var oldDash = context._; - - /** Used to resolve the internal [[Class]] of values */ - var toString = objectProto.toString; - - /** Used to detect if a method is native */ - var reNative = RegExp('^' + - String(toString) - .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') - .replace(/toString| for [^\]]+/g, '.*?') + '$' - ); - - /** Native method shortcuts */ - var ceil = Math.ceil, - clearTimeout = context.clearTimeout, - floor = Math.floor, - fnToString = Function.prototype.toString, - getPrototypeOf = isNative(getPrototypeOf = Object.getPrototypeOf) && getPrototypeOf, - hasOwnProperty = objectProto.hasOwnProperty, - push = arrayRef.push, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - setTimeout = context.setTimeout, - splice = arrayRef.splice, - unshift = arrayRef.unshift; - - /** Used to set meta data on functions */ - var defineProperty = (function() { - // IE 8 only accepts DOM elements - try { - var o = {}, - func = isNative(func = Object.defineProperty) && func, - result = func(o, o, o) && func; - } catch(e) { } - return result; - }()); - - /* Native method shortcuts for methods with the same name as other `lodash` methods */ - var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate, - nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray, - nativeIsFinite = context.isFinite, - nativeIsNaN = context.isNaN, - nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, - nativeMax = Math.max, - nativeMin = Math.min, - nativeParseInt = context.parseInt, - nativeRandom = Math.random; - - /** Used to lookup a built-in constructor by [[Class]] */ - var ctorByClass = {}; - ctorByClass[arrayClass] = Array; - ctorByClass[boolClass] = Boolean; - ctorByClass[dateClass] = Date; - ctorByClass[funcClass] = Function; - ctorByClass[objectClass] = Object; - ctorByClass[numberClass] = Number; - ctorByClass[regexpClass] = RegExp; - ctorByClass[stringClass] = String; - - /** Used to avoid iterating non-enumerable properties in IE < 9 */ - var nonEnumProps = {}; - nonEnumProps[arrayClass] = nonEnumProps[dateClass] = nonEnumProps[numberClass] = { 'constructor': true, 'toLocaleString': true, 'toString': true, 'valueOf': true }; - nonEnumProps[boolClass] = nonEnumProps[stringClass] = { 'constructor': true, 'toString': true, 'valueOf': true }; - nonEnumProps[errorClass] = nonEnumProps[funcClass] = nonEnumProps[regexpClass] = { 'constructor': true, 'toString': true }; - nonEnumProps[objectClass] = { 'constructor': true }; - - (function() { - var length = shadowedProps.length; - while (length--) { - var key = shadowedProps[length]; - for (var className in nonEnumProps) { - if (hasOwnProperty.call(nonEnumProps, className) && !hasOwnProperty.call(nonEnumProps[className], key)) { - nonEnumProps[className][key] = false; - } - } - } - }()); - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a `lodash` object which wraps the given value to enable intuitive - * method chaining. - * - * In addition to Lo-Dash methods, wrappers also have the following `Array` methods: - * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`, - * and `unshift` - * - * Chaining is supported in custom builds as long as the `value` method is - * implicitly or explicitly included in the build. - * - * The chainable wrapper functions are: - * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, - * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`, - * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, - * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, - * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, - * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, - * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`, - * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, - * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, - * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, - * and `zip` - * - * The non-chainable wrapper functions are: - * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`, - * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`, - * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, - * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, - * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, - * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`, - * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, - * `template`, `unescape`, `uniqueId`, and `value` - * - * The wrapper functions `first` and `last` return wrapped values when `n` is - * provided, otherwise they return unwrapped values. - * - * Explicit chaining can be enabled by using the `_.chain` method. - * - * @name _ - * @constructor - * @category Chaining - * @param {*} value The value to wrap in a `lodash` instance. - * @returns {Object} Returns a `lodash` instance. - * @example - * - * var wrapped = _([1, 2, 3]); - * - * // returns an unwrapped value - * wrapped.reduce(function(sum, num) { - * return sum + num; - * }); - * // => 6 - * - * // returns a wrapped value - * var squares = wrapped.map(function(num) { - * return num * num; - * }); - * - * _.isArray(squares); - * // => false - * - * _.isArray(squares.value()); - * // => true - */ - function lodash(value) { - // don't wrap if already wrapped, even if wrapped by a different `lodash` constructor - return (value && typeof value == 'object' && !isArray(value) && hasOwnProperty.call(value, '__wrapped__')) - ? value - : new lodashWrapper(value); - } - - /** - * A fast path for creating `lodash` wrapper objects. - * - * @private - * @param {*} value The value to wrap in a `lodash` instance. - * @param {boolean} chainAll A flag to enable chaining for all methods - * @returns {Object} Returns a `lodash` instance. - */ - function lodashWrapper(value, chainAll) { - this.__chain__ = !!chainAll; - this.__wrapped__ = value; - } - // ensure `new lodashWrapper` is an instance of `lodash` - lodashWrapper.prototype = lodash.prototype; - - /** - * An object used to flag environments features. - * - * @static - * @memberOf _ - * @type Object - */ - var support = lodash.support = {}; - - (function() { - var ctor = function() { this.x = 1; }, - object = { '0': 1, 'length': 1 }, - props = []; - - ctor.prototype = { 'valueOf': 1, 'y': 1 }; - for (var key in new ctor) { props.push(key); } - for (key in arguments) { } - - /** - * Detect if an `arguments` object's [[Class]] is resolvable (all but Firefox < 4, IE < 9). - * - * @memberOf _.support - * @type boolean - */ - support.argsClass = toString.call(arguments) == argsClass; - - /** - * Detect if `arguments` objects are `Object` objects (all but Narwhal and Opera < 10.5). - * - * @memberOf _.support - * @type boolean - */ - support.argsObject = arguments.constructor == Object && !(arguments instanceof Array); - - /** - * Detect if `name` or `message` properties of `Error.prototype` are - * enumerable by default. (IE < 9, Safari < 5.1) - * - * @memberOf _.support - * @type boolean - */ - support.enumErrorProps = propertyIsEnumerable.call(errorProto, 'message') || propertyIsEnumerable.call(errorProto, 'name'); - - /** - * Detect if `prototype` properties are enumerable by default. - * - * Firefox < 3.6, Opera > 9.50 - Opera < 11.60, and Safari < 5.1 - * (if the prototype or a property on the prototype has been set) - * incorrectly sets a function's `prototype` property [[Enumerable]] - * value to `true`. - * - * @memberOf _.support - * @type boolean - */ - support.enumPrototypes = propertyIsEnumerable.call(ctor, 'prototype'); - - /** - * Detect if functions can be decompiled by `Function#toString` - * (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps). - * - * @memberOf _.support - * @type boolean - */ - support.funcDecomp = !isNative(context.WinRTError) && reThis.test(runInContext); - - /** - * Detect if `Function#name` is supported (all but IE). - * - * @memberOf _.support - * @type boolean - */ - support.funcNames = typeof Function.name == 'string'; - - /** - * Detect if `arguments` object indexes are non-enumerable - * (Firefox < 4, IE < 9, PhantomJS, Safari < 5.1). - * - * @memberOf _.support - * @type boolean - */ - support.nonEnumArgs = key != 0; - - /** - * Detect if properties shadowing those on `Object.prototype` are non-enumerable. - * - * In IE < 9 an objects own properties, shadowing non-enumerable ones, are - * made non-enumerable as well (a.k.a the JScript [[DontEnum]] bug). - * - * @memberOf _.support - * @type boolean - */ - support.nonEnumShadows = !/valueOf/.test(props); - - /** - * Detect if own properties are iterated after inherited properties (all but IE < 9). - * - * @memberOf _.support - * @type boolean - */ - support.ownLast = props[0] != 'x'; - - /** - * Detect if `Array#shift` and `Array#splice` augment array-like objects correctly. - * - * Firefox < 10, IE compatibility mode, and IE < 9 have buggy Array `shift()` - * and `splice()` functions that fail to remove the last element, `value[0]`, - * of array-like objects even though the `length` property is set to `0`. - * The `shift()` method is buggy in IE 8 compatibility mode, while `splice()` - * is buggy regardless of mode in IE < 9 and buggy in compatibility mode in IE 9. - * - * @memberOf _.support - * @type boolean - */ - support.spliceObjects = (arrayRef.splice.call(object, 0, 1), !object[0]); - - /** - * Detect lack of support for accessing string characters by index. - * - * IE < 8 can't access characters by index and IE 8 can only access - * characters by index on string literals. - * - * @memberOf _.support - * @type boolean - */ - support.unindexedChars = ('x'[0] + Object('x')[0]) != 'xx'; - - /** - * Detect if a DOM node's [[Class]] is resolvable (all but IE < 9) - * and that the JS engine errors when attempting to coerce an object to - * a string without a `toString` function. - * - * @memberOf _.support - * @type boolean - */ - try { - support.nodeClass = !(toString.call(document) == objectClass && !({ 'toString': 0 } + '')); - } catch(e) { - support.nodeClass = true; - } - }(1)); - - /** - * By default, the template delimiters used by Lo-Dash are similar to those in - * embedded Ruby (ERB). Change the following template settings to use alternative - * delimiters. - * - * @static - * @memberOf _ - * @type Object - */ - lodash.templateSettings = { - - /** - * Used to detect `data` property values to be HTML-escaped. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'escape': /<%-([\s\S]+?)%>/g, - - /** - * Used to detect code to be evaluated. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'evaluate': /<%([\s\S]+?)%>/g, - - /** - * Used to detect `data` property values to inject. - * - * @memberOf _.templateSettings - * @type RegExp - */ - 'interpolate': reInterpolate, - - /** - * Used to reference the data object in the template text. - * - * @memberOf _.templateSettings - * @type string - */ - 'variable': '', - - /** - * Used to import variables into the compiled template. - * - * @memberOf _.templateSettings - * @type Object - */ - 'imports': { - - /** - * A reference to the `lodash` function. - * - * @memberOf _.templateSettings.imports - * @type Function - */ - '_': lodash - } - }; - - /*--------------------------------------------------------------------------*/ - - /** - * The template used to create iterator functions. - * - * @private - * @param {Object} data The data object used to populate the text. - * @returns {string} Returns the interpolated text. - */ - var iteratorTemplate = function(obj) { - - var __p = 'var index, iterable = ' + - (obj.firstArg) + - ', result = ' + - (obj.init) + - ';\nif (!iterable) return result;\n' + - (obj.top) + - ';'; - if (obj.array) { - __p += '\nvar length = iterable.length; index = -1;\nif (' + - (obj.array) + - ') { '; - if (support.unindexedChars) { - __p += '\n if (isString(iterable)) {\n iterable = iterable.split(\'\')\n } '; - } - __p += '\n while (++index < length) {\n ' + - (obj.loop) + - ';\n }\n}\nelse { '; - } else if (support.nonEnumArgs) { - __p += '\n var length = iterable.length; index = -1;\n if (length && isArguments(iterable)) {\n while (++index < length) {\n index += \'\';\n ' + - (obj.loop) + - ';\n }\n } else { '; - } - - if (support.enumPrototypes) { - __p += '\n var skipProto = typeof iterable == \'function\';\n '; - } - - if (support.enumErrorProps) { - __p += '\n var skipErrorProps = iterable === errorProto || iterable instanceof Error;\n '; - } - - var conditions = []; if (support.enumPrototypes) { conditions.push('!(skipProto && index == "prototype")'); } if (support.enumErrorProps) { conditions.push('!(skipErrorProps && (index == "message" || index == "name"))'); } - - if (obj.useHas && obj.keys) { - __p += '\n var ownIndex = -1,\n ownProps = objectTypes[typeof iterable] && keys(iterable),\n length = ownProps ? ownProps.length : 0;\n\n while (++ownIndex < length) {\n index = ownProps[ownIndex];\n'; - if (conditions.length) { - __p += ' if (' + - (conditions.join(' && ')) + - ') {\n '; - } - __p += - (obj.loop) + - '; '; - if (conditions.length) { - __p += '\n }'; - } - __p += '\n } '; - } else { - __p += '\n for (index in iterable) {\n'; - if (obj.useHas) { conditions.push("hasOwnProperty.call(iterable, index)"); } if (conditions.length) { - __p += ' if (' + - (conditions.join(' && ')) + - ') {\n '; - } - __p += - (obj.loop) + - '; '; - if (conditions.length) { - __p += '\n }'; - } - __p += '\n } '; - if (support.nonEnumShadows) { - __p += '\n\n if (iterable !== objectProto) {\n var ctor = iterable.constructor,\n isProto = iterable === (ctor && ctor.prototype),\n className = iterable === stringProto ? stringClass : iterable === errorProto ? errorClass : toString.call(iterable),\n nonEnum = nonEnumProps[className];\n '; - for (k = 0; k < 7; k++) { - __p += '\n index = \'' + - (obj.shadowedProps[k]) + - '\';\n if ((!(isProto && nonEnum[index]) && hasOwnProperty.call(iterable, index))'; - if (!obj.useHas) { - __p += ' || (!nonEnum[index] && iterable[index] !== objectProto[index])'; - } - __p += ') {\n ' + - (obj.loop) + - ';\n } '; - } - __p += '\n } '; - } - - } - - if (obj.array || support.nonEnumArgs) { - __p += '\n}'; - } - __p += - (obj.bottom) + - ';\nreturn result'; - - return __p - }; - - /*--------------------------------------------------------------------------*/ - - /** - * The base implementation of `_.bind` that creates the bound function and - * sets its meta data. - * - * @private - * @param {Array} bindData The bind data array. - * @returns {Function} Returns the new bound function. - */ - function baseBind(bindData) { - var func = bindData[0], - partialArgs = bindData[2], - thisArg = bindData[4]; - - function bound() { - // `Function#bind` spec - // http://es5.github.io/#x15.3.4.5 - if (partialArgs) { - // avoid `arguments` object deoptimizations by using `slice` instead - // of `Array.prototype.slice.call` and not assigning `arguments` to a - // variable as a ternary expression - var args = slice(partialArgs); - push.apply(args, arguments); - } - // mimic the constructor's `return` behavior - // http://es5.github.io/#x13.2.2 - if (this instanceof bound) { - // ensure `new bound` is an instance of `func` - var thisBinding = baseCreate(func.prototype), - result = func.apply(thisBinding, args || arguments); - return isObject(result) ? result : thisBinding; - } - return func.apply(thisArg, args || arguments); - } - setBindData(bound, bindData); - return bound; - } - - /** - * The base implementation of `_.clone` without argument juggling or support - * for `thisArg` binding. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} [isDeep=false] Specify a deep clone. - * @param {Function} [callback] The function to customize cloning values. - * @param {Array} [stackA=[]] Tracks traversed source objects. - * @param {Array} [stackB=[]] Associates clones with source counterparts. - * @returns {*} Returns the cloned value. - */ - function baseClone(value, isDeep, callback, stackA, stackB) { - if (callback) { - var result = callback(value); - if (typeof result != 'undefined') { - return result; - } - } - // inspect [[Class]] - var isObj = isObject(value); - if (isObj) { - var className = toString.call(value); - if (!cloneableClasses[className] || (!support.nodeClass && isNode(value))) { - return value; - } - var ctor = ctorByClass[className]; - switch (className) { - case boolClass: - case dateClass: - return new ctor(+value); - - case numberClass: - case stringClass: - return new ctor(value); - - case regexpClass: - result = ctor(value.source, reFlags.exec(value)); - result.lastIndex = value.lastIndex; - return result; - } - } else { - return value; - } - var isArr = isArray(value); - if (isDeep) { - // check for circular references and return corresponding clone - var initedStack = !stackA; - stackA || (stackA = getArray()); - stackB || (stackB = getArray()); - - var length = stackA.length; - while (length--) { - if (stackA[length] == value) { - return stackB[length]; - } - } - result = isArr ? ctor(value.length) : {}; - } - else { - result = isArr ? slice(value) : assign({}, value); - } - // add array properties assigned by `RegExp#exec` - if (isArr) { - if (hasOwnProperty.call(value, 'index')) { - result.index = value.index; - } - if (hasOwnProperty.call(value, 'input')) { - result.input = value.input; - } - } - // exit for shallow clone - if (!isDeep) { - return result; - } - // add the source value to the stack of traversed objects - // and associate it with its clone - stackA.push(value); - stackB.push(result); - - // recursively populate clone (susceptible to call stack limits) - (isArr ? baseEach : forOwn)(value, function(objValue, key) { - result[key] = baseClone(objValue, isDeep, callback, stackA, stackB); - }); - - if (initedStack) { - releaseArray(stackA); - releaseArray(stackB); - } - return result; - } - - /** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} prototype The object to inherit from. - * @returns {Object} Returns the new object. - */ - function baseCreate(prototype, properties) { - return isObject(prototype) ? nativeCreate(prototype) : {}; - } - // fallback for browsers without `Object.create` - if (!nativeCreate) { - baseCreate = (function() { - function Object() {} - return function(prototype) { - if (isObject(prototype)) { - Object.prototype = prototype; - var result = new Object; - Object.prototype = null; - } - return result || context.Object(); - }; - }()); - } - - /** - * The base implementation of `_.createCallback` without support for creating - * "_.pluck" or "_.where" style callbacks. - * - * @private - * @param {*} [func=identity] The value to convert to a callback. - * @param {*} [thisArg] The `this` binding of the created callback. - * @param {number} [argCount] The number of arguments the callback accepts. - * @returns {Function} Returns a callback function. - */ - function baseCreateCallback(func, thisArg, argCount) { - if (typeof func != 'function') { - return identity; - } - // exit early for no `thisArg` or already bound by `Function#bind` - if (typeof thisArg == 'undefined' || !('prototype' in func)) { - return func; - } - var bindData = func.__bindData__; - if (typeof bindData == 'undefined') { - if (support.funcNames) { - bindData = !func.name; - } - bindData = bindData || !support.funcDecomp; - if (!bindData) { - var source = fnToString.call(func); - if (!support.funcNames) { - bindData = !reFuncName.test(source); - } - if (!bindData) { - // checks if `func` references the `this` keyword and stores the result - bindData = reThis.test(source); - setBindData(func, bindData); - } - } - } - // exit early if there are no `this` references or `func` is bound - if (bindData === false || (bindData !== true && bindData[1] & 1)) { - return func; - } - switch (argCount) { - case 1: return function(value) { - return func.call(thisArg, value); - }; - case 2: return function(a, b) { - return func.call(thisArg, a, b); - }; - case 3: return function(value, index, collection) { - return func.call(thisArg, value, index, collection); - }; - case 4: return function(accumulator, value, index, collection) { - return func.call(thisArg, accumulator, value, index, collection); - }; - } - return bind(func, thisArg); - } - - /** - * The base implementation of `createWrapper` that creates the wrapper and - * sets its meta data. - * - * @private - * @param {Array} bindData The bind data array. - * @returns {Function} Returns the new function. - */ - function baseCreateWrapper(bindData) { - var func = bindData[0], - bitmask = bindData[1], - partialArgs = bindData[2], - partialRightArgs = bindData[3], - thisArg = bindData[4], - arity = bindData[5]; - - var isBind = bitmask & 1, - isBindKey = bitmask & 2, - isCurry = bitmask & 4, - isCurryBound = bitmask & 8, - key = func; - - function bound() { - var thisBinding = isBind ? thisArg : this; - if (partialArgs) { - var args = slice(partialArgs); - push.apply(args, arguments); - } - if (partialRightArgs || isCurry) { - args || (args = slice(arguments)); - if (partialRightArgs) { - push.apply(args, partialRightArgs); - } - if (isCurry && args.length < arity) { - bitmask |= 16 & ~32; - return baseCreateWrapper([func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity]); - } - } - args || (args = arguments); - if (isBindKey) { - func = thisBinding[key]; - } - if (this instanceof bound) { - thisBinding = baseCreate(func.prototype); - var result = func.apply(thisBinding, args); - return isObject(result) ? result : thisBinding; - } - return func.apply(thisBinding, args); - } - setBindData(bound, bindData); - return bound; - } - - /** - * The base implementation of `_.difference` that accepts a single array - * of values to exclude. - * - * @private - * @param {Array} array The array to process. - * @param {Array} [values] The array of values to exclude. - * @returns {Array} Returns a new array of filtered values. - */ - function baseDifference(array, values) { - var index = -1, - indexOf = getIndexOf(), - length = array ? array.length : 0, - isLarge = length >= largeArraySize && indexOf === baseIndexOf, - result = []; - - if (isLarge) { - var cache = createCache(values); - if (cache) { - indexOf = cacheIndexOf; - values = cache; - } else { - isLarge = false; - } - } - while (++index < length) { - var value = array[index]; - if (indexOf(values, value) < 0) { - result.push(value); - } - } - if (isLarge) { - releaseObject(values); - } - return result; - } - - /** - * The base implementation of `_.flatten` without support for callback - * shorthands or `thisArg` binding. - * - * @private - * @param {Array} array The array to flatten. - * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level. - * @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects. - * @param {number} [fromIndex=0] The index to start from. - * @returns {Array} Returns a new flattened array. - */ - function baseFlatten(array, isShallow, isStrict, fromIndex) { - var index = (fromIndex || 0) - 1, - length = array ? array.length : 0, - result = []; - - while (++index < length) { - var value = array[index]; - - if (value && typeof value == 'object' && typeof value.length == 'number' - && (isArray(value) || isArguments(value))) { - // recursively flatten arrays (susceptible to call stack limits) - if (!isShallow) { - value = baseFlatten(value, isShallow, isStrict); - } - var valIndex = -1, - valLength = value.length, - resIndex = result.length; - - result.length += valLength; - while (++valIndex < valLength) { - result[resIndex++] = value[valIndex]; - } - } else if (!isStrict) { - result.push(value); - } - } - return result; - } - - /** - * The base implementation of `_.isEqual`, without support for `thisArg` binding, - * that allows partial "_.where" style comparisons. - * - * @private - * @param {*} a The value to compare. - * @param {*} b The other value to compare. - * @param {Function} [callback] The function to customize comparing values. - * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons. - * @param {Array} [stackA=[]] Tracks traversed `a` objects. - * @param {Array} [stackB=[]] Tracks traversed `b` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ - function baseIsEqual(a, b, callback, isWhere, stackA, stackB) { - // used to indicate that when comparing objects, `a` has at least the properties of `b` - if (callback) { - var result = callback(a, b); - if (typeof result != 'undefined') { - return !!result; - } - } - // exit early for identical values - if (a === b) { - // treat `+0` vs. `-0` as not equal - return a !== 0 || (1 / a == 1 / b); - } - var type = typeof a, - otherType = typeof b; - - // exit early for unlike primitive values - if (a === a && - !(a && objectTypes[type]) && - !(b && objectTypes[otherType])) { - return false; - } - // exit early for `null` and `undefined` avoiding ES3's Function#call behavior - // http://es5.github.io/#x15.3.4.4 - if (a == null || b == null) { - return a === b; - } - // compare [[Class]] names - var className = toString.call(a), - otherClass = toString.call(b); - - if (className == argsClass) { - className = objectClass; - } - if (otherClass == argsClass) { - otherClass = objectClass; - } - if (className != otherClass) { - return false; - } - switch (className) { - case boolClass: - case dateClass: - // coerce dates and booleans to numbers, dates to milliseconds and booleans - // to `1` or `0` treating invalid dates coerced to `NaN` as not equal - return +a == +b; - - case numberClass: - // treat `NaN` vs. `NaN` as equal - return (a != +a) - ? b != +b - // but treat `+0` vs. `-0` as not equal - : (a == 0 ? (1 / a == 1 / b) : a == +b); - - case regexpClass: - case stringClass: - // coerce regexes to strings (http://es5.github.io/#x15.10.6.4) - // treat string primitives and their corresponding object instances as equal - return a == String(b); - } - var isArr = className == arrayClass; - if (!isArr) { - // unwrap any `lodash` wrapped values - var aWrapped = hasOwnProperty.call(a, '__wrapped__'), - bWrapped = hasOwnProperty.call(b, '__wrapped__'); - - if (aWrapped || bWrapped) { - return baseIsEqual(aWrapped ? a.__wrapped__ : a, bWrapped ? b.__wrapped__ : b, callback, isWhere, stackA, stackB); - } - // exit for functions and DOM nodes - if (className != objectClass || (!support.nodeClass && (isNode(a) || isNode(b)))) { - return false; - } - // in older versions of Opera, `arguments` objects have `Array` constructors - var ctorA = !support.argsObject && isArguments(a) ? Object : a.constructor, - ctorB = !support.argsObject && isArguments(b) ? Object : b.constructor; - - // non `Object` object instances with different constructors are not equal - if (ctorA != ctorB && - !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) && - ('constructor' in a && 'constructor' in b) - ) { - return false; - } - } - // assume cyclic structures are equal - // the algorithm for detecting cyclic structures is adapted from ES 5.1 - // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3) - var initedStack = !stackA; - stackA || (stackA = getArray()); - stackB || (stackB = getArray()); - - var length = stackA.length; - while (length--) { - if (stackA[length] == a) { - return stackB[length] == b; - } - } - var size = 0; - result = true; - - // add `a` and `b` to the stack of traversed objects - stackA.push(a); - stackB.push(b); - - // recursively compare objects and arrays (susceptible to call stack limits) - if (isArr) { - // compare lengths to determine if a deep comparison is necessary - length = a.length; - size = b.length; - result = size == length; - - if (result || isWhere) { - // deep compare the contents, ignoring non-numeric properties - while (size--) { - var index = length, - value = b[size]; - - if (isWhere) { - while (index--) { - if ((result = baseIsEqual(a[index], value, callback, isWhere, stackA, stackB))) { - break; - } - } - } else if (!(result = baseIsEqual(a[size], value, callback, isWhere, stackA, stackB))) { - break; - } - } - } - } - else { - // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` - // which, in this case, is more costly - forIn(b, function(value, key, b) { - if (hasOwnProperty.call(b, key)) { - // count the number of properties. - size++; - // deep compare each property value. - return (result = hasOwnProperty.call(a, key) && baseIsEqual(a[key], value, callback, isWhere, stackA, stackB)); - } - }); - - if (result && !isWhere) { - // ensure both objects have the same number of properties - forIn(a, function(value, key, a) { - if (hasOwnProperty.call(a, key)) { - // `size` will be `-1` if `a` has more properties than `b` - return (result = --size > -1); - } - }); - } - } - stackA.pop(); - stackB.pop(); - - if (initedStack) { - releaseArray(stackA); - releaseArray(stackB); - } - return result; - } - - /** - * The base implementation of `_.merge` without argument juggling or support - * for `thisArg` binding. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @param {Function} [callback] The function to customize merging properties. - * @param {Array} [stackA=[]] Tracks traversed source objects. - * @param {Array} [stackB=[]] Associates values with source counterparts. - */ - function baseMerge(object, source, callback, stackA, stackB) { - (isArray(source) ? forEach : forOwn)(source, function(source, key) { - var found, - isArr, - result = source, - value = object[key]; - - if (source && ((isArr = isArray(source)) || isPlainObject(source))) { - // avoid merging previously merged cyclic sources - var stackLength = stackA.length; - while (stackLength--) { - if ((found = stackA[stackLength] == source)) { - value = stackB[stackLength]; - break; - } - } - if (!found) { - var isShallow; - if (callback) { - result = callback(value, source); - if ((isShallow = typeof result != 'undefined')) { - value = result; - } - } - if (!isShallow) { - value = isArr - ? (isArray(value) ? value : []) - : (isPlainObject(value) ? value : {}); - } - // add `source` and associated `value` to the stack of traversed objects - stackA.push(source); - stackB.push(value); - - // recursively merge objects and arrays (susceptible to call stack limits) - if (!isShallow) { - baseMerge(value, source, callback, stackA, stackB); - } - } - } - else { - if (callback) { - result = callback(value, source); - if (typeof result == 'undefined') { - result = source; - } - } - if (typeof result != 'undefined') { - value = result; - } - } - object[key] = value; - }); - } - - /** - * The base implementation of `_.random` without argument juggling or support - * for returning floating-point numbers. - * - * @private - * @param {number} min The minimum possible value. - * @param {number} max The maximum possible value. - * @returns {number} Returns a random number. - */ - function baseRandom(min, max) { - return min + floor(nativeRandom() * (max - min + 1)); - } - - /** - * The base implementation of `_.uniq` without support for callback shorthands - * or `thisArg` binding. - * - * @private - * @param {Array} array The array to process. - * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted. - * @param {Function} [callback] The function called per iteration. - * @returns {Array} Returns a duplicate-value-free array. - */ - function baseUniq(array, isSorted, callback) { - var index = -1, - indexOf = getIndexOf(), - length = array ? array.length : 0, - result = []; - - var isLarge = !isSorted && length >= largeArraySize && indexOf === baseIndexOf, - seen = (callback || isLarge) ? getArray() : result; - - if (isLarge) { - var cache = createCache(seen); - indexOf = cacheIndexOf; - seen = cache; - } - while (++index < length) { - var value = array[index], - computed = callback ? callback(value, index, array) : value; - - if (isSorted - ? !index || seen[seen.length - 1] !== computed - : indexOf(seen, computed) < 0 - ) { - if (callback || isLarge) { - seen.push(computed); - } - result.push(value); - } - } - if (isLarge) { - releaseArray(seen.array); - releaseObject(seen); - } else if (callback) { - releaseArray(seen); - } - return result; - } - - /** - * Creates a function that aggregates a collection, creating an object composed - * of keys generated from the results of running each element of the collection - * through a callback. The given `setter` function sets the keys and values - * of the composed object. - * - * @private - * @param {Function} setter The setter function. - * @returns {Function} Returns the new aggregator function. - */ - function createAggregator(setter) { - return function(collection, callback, thisArg) { - var result = {}; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - setter(result, value, callback(value, index, collection), collection); - } - } else { - baseEach(collection, function(value, key, collection) { - setter(result, value, callback(value, key, collection), collection); - }); - } - return result; - }; - } - - /** - * Creates a function that, when called, either curries or invokes `func` - * with an optional `this` binding and partially applied arguments. - * - * @private - * @param {Function|string} func The function or method name to reference. - * @param {number} bitmask The bitmask of method flags to compose. - * The bitmask may be composed of the following flags: - * 1 - `_.bind` - * 2 - `_.bindKey` - * 4 - `_.curry` - * 8 - `_.curry` (bound) - * 16 - `_.partial` - * 32 - `_.partialRight` - * @param {Array} [partialArgs] An array of arguments to prepend to those - * provided to the new function. - * @param {Array} [partialRightArgs] An array of arguments to append to those - * provided to the new function. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {number} [arity] The arity of `func`. - * @returns {Function} Returns the new function. - */ - function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) { - var isBind = bitmask & 1, - isBindKey = bitmask & 2, - isCurry = bitmask & 4, - isCurryBound = bitmask & 8, - isPartial = bitmask & 16, - isPartialRight = bitmask & 32; - - if (!isBindKey && !isFunction(func)) { - throw new TypeError; - } - if (isPartial && !partialArgs.length) { - bitmask &= ~16; - isPartial = partialArgs = false; - } - if (isPartialRight && !partialRightArgs.length) { - bitmask &= ~32; - isPartialRight = partialRightArgs = false; - } - var bindData = func && func.__bindData__; - if (bindData && bindData !== true) { - // clone `bindData` - bindData = slice(bindData); - if (bindData[2]) { - bindData[2] = slice(bindData[2]); - } - if (bindData[3]) { - bindData[3] = slice(bindData[3]); - } - // set `thisBinding` is not previously bound - if (isBind && !(bindData[1] & 1)) { - bindData[4] = thisArg; - } - // set if previously bound but not currently (subsequent curried functions) - if (!isBind && bindData[1] & 1) { - bitmask |= 8; - } - // set curried arity if not yet set - if (isCurry && !(bindData[1] & 4)) { - bindData[5] = arity; - } - // append partial left arguments - if (isPartial) { - push.apply(bindData[2] || (bindData[2] = []), partialArgs); - } - // append partial right arguments - if (isPartialRight) { - unshift.apply(bindData[3] || (bindData[3] = []), partialRightArgs); - } - // merge flags - bindData[1] |= bitmask; - return createWrapper.apply(null, bindData); - } - // fast path for `_.bind` - var creater = (bitmask == 1 || bitmask === 17) ? baseBind : baseCreateWrapper; - return creater([func, bitmask, partialArgs, partialRightArgs, thisArg, arity]); - } - - /** - * Creates compiled iteration functions. - * - * @private - * @param {...Object} [options] The compile options object(s). - * @param {string} [options.array] Code to determine if the iterable is an array or array-like. - * @param {boolean} [options.useHas] Specify using `hasOwnProperty` checks in the object loop. - * @param {Function} [options.keys] A reference to `_.keys` for use in own property iteration. - * @param {string} [options.args] A comma separated string of iteration function arguments. - * @param {string} [options.top] Code to execute before the iteration branches. - * @param {string} [options.loop] Code to execute in the object loop. - * @param {string} [options.bottom] Code to execute after the iteration branches. - * @returns {Function} Returns the compiled function. - */ - function createIterator() { - // data properties - iteratorData.shadowedProps = shadowedProps; - - // iterator options - iteratorData.array = iteratorData.bottom = iteratorData.loop = iteratorData.top = ''; - iteratorData.init = 'iterable'; - iteratorData.useHas = true; - - // merge options into a template data object - for (var object, index = 0; object = arguments[index]; index++) { - for (var key in object) { - iteratorData[key] = object[key]; - } - } - var args = iteratorData.args; - iteratorData.firstArg = /^[^,]+/.exec(args)[0]; - - // create the function factory - var factory = Function( - 'baseCreateCallback, errorClass, errorProto, hasOwnProperty, ' + - 'indicatorObject, isArguments, isArray, isString, keys, objectProto, ' + - 'objectTypes, nonEnumProps, stringClass, stringProto, toString', - 'return function(' + args + ') {\n' + iteratorTemplate(iteratorData) + '\n}' - ); - - // return the compiled function - return factory( - baseCreateCallback, errorClass, errorProto, hasOwnProperty, - indicatorObject, isArguments, isArray, isString, iteratorData.keys, objectProto, - objectTypes, nonEnumProps, stringClass, stringProto, toString - ); - } - - /** - * Used by `escape` to convert characters to HTML entities. - * - * @private - * @param {string} match The matched character to escape. - * @returns {string} Returns the escaped character. - */ - function escapeHtmlChar(match) { - return htmlEscapes[match]; - } - - /** - * Gets the appropriate "indexOf" function. If the `_.indexOf` method is - * customized, this method returns the custom method, otherwise it returns - * the `baseIndexOf` function. - * - * @private - * @returns {Function} Returns the "indexOf" function. - */ - function getIndexOf() { - var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result; - return result; - } - - /** - * Checks if `value` is a native function. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a native function, else `false`. - */ - function isNative(value) { - return typeof value == 'function' && reNative.test(value); - } - - /** - * Sets `this` binding data on a given function. - * - * @private - * @param {Function} func The function to set data on. - * @param {Array} value The data array to set. - */ - var setBindData = !defineProperty ? noop : function(func, value) { - descriptor.value = value; - defineProperty(func, '__bindData__', descriptor); - }; - - /** - * A fallback implementation of `isPlainObject` which checks if a given value - * is an object created by the `Object` constructor, assuming objects created - * by the `Object` constructor have no inherited enumerable properties and that - * there are no `Object.prototype` extensions. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - */ - function shimIsPlainObject(value) { - var ctor, - result; - - // avoid non Object objects, `arguments` objects, and DOM elements - if (!(value && toString.call(value) == objectClass) || - (ctor = value.constructor, isFunction(ctor) && !(ctor instanceof ctor)) || - (!support.argsClass && isArguments(value)) || - (!support.nodeClass && isNode(value))) { - return false; - } - // IE < 9 iterates inherited properties before own properties. If the first - // iterated property is an object's own property then there are no inherited - // enumerable properties. - if (support.ownLast) { - forIn(value, function(value, key, object) { - result = hasOwnProperty.call(object, key); - return false; - }); - return result !== false; - } - // In most environments an object's own properties are iterated before - // its inherited properties. If the last iterated property is an object's - // own property then there are no inherited enumerable properties. - forIn(value, function(value, key) { - result = key; - }); - return typeof result == 'undefined' || hasOwnProperty.call(value, result); - } - - /** - * Used by `unescape` to convert HTML entities to characters. - * - * @private - * @param {string} match The matched character to unescape. - * @returns {string} Returns the unescaped character. - */ - function unescapeHtmlChar(match) { - return htmlUnescapes[match]; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Checks if `value` is an `arguments` object. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`. - * @example - * - * (function() { return _.isArguments(arguments); })(1, 2, 3); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ - function isArguments(value) { - return value && typeof value == 'object' && typeof value.length == 'number' && - toString.call(value) == argsClass || false; - } - // fallback for browsers that can't detect `arguments` objects by [[Class]] - if (!support.argsClass) { - isArguments = function(value) { - return value && typeof value == 'object' && typeof value.length == 'number' && - hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee') || false; - }; - } - - /** - * Checks if `value` is an array. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is an array, else `false`. - * @example - * - * (function() { return _.isArray(arguments); })(); - * // => false - * - * _.isArray([1, 2, 3]); - * // => true - */ - var isArray = nativeIsArray || function(value) { - return value && typeof value == 'object' && typeof value.length == 'number' && - toString.call(value) == arrayClass || false; - }; - - /** - * A fallback implementation of `Object.keys` which produces an array of the - * given object's own enumerable property names. - * - * @private - * @type Function - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property names. - */ - var shimKeys = createIterator({ - 'args': 'object', - 'init': '[]', - 'top': 'if (!(objectTypes[typeof object])) return result', - 'loop': 'result.push(index)' - }); - - /** - * Creates an array composed of the own enumerable property names of an object. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property names. - * @example - * - * _.keys({ 'one': 1, 'two': 2, 'three': 3 }); - * // => ['one', 'two', 'three'] (property order is not guaranteed across environments) - */ - var keys = !nativeKeys ? shimKeys : function(object) { - if (!isObject(object)) { - return []; - } - if ((support.enumPrototypes && typeof object == 'function') || - (support.nonEnumArgs && object.length && isArguments(object))) { - return shimKeys(object); - } - return nativeKeys(object); - }; - - /** Reusable iterator options shared by `each`, `forIn`, and `forOwn` */ - var eachIteratorOptions = { - 'args': 'collection, callback, thisArg', - 'top': "callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3)", - 'array': "typeof length == 'number'", - 'keys': keys, - 'loop': 'if (callback(iterable[index], index, collection) === false) return result' - }; - - /** Reusable iterator options for `assign` and `defaults` */ - var defaultsIteratorOptions = { - 'args': 'object, source, guard', - 'top': - 'var args = arguments,\n' + - ' argsIndex = 0,\n' + - " argsLength = typeof guard == 'number' ? 2 : args.length;\n" + - 'while (++argsIndex < argsLength) {\n' + - ' iterable = args[argsIndex];\n' + - ' if (iterable && objectTypes[typeof iterable]) {', - 'keys': keys, - 'loop': "if (typeof result[index] == 'undefined') result[index] = iterable[index]", - 'bottom': ' }\n}' - }; - - /** Reusable iterator options for `forIn` and `forOwn` */ - var forOwnIteratorOptions = { - 'top': 'if (!objectTypes[typeof iterable]) return result;\n' + eachIteratorOptions.top, - 'array': false - }; - - /** - * Used to convert characters to HTML entities: - * - * Though the `>` character is escaped for symmetry, characters like `>` and `/` - * don't require escaping in HTML and have no special meaning unless they're part - * of a tag or an unquoted attribute value. - * http://mathiasbynens.be/notes/ambiguous-ampersands (under "semi-related fun fact") - */ - var htmlEscapes = { - '&': '&', - '<': '<', - '>': '>', - '"': '"', - "'": ''' - }; - - /** Used to convert HTML entities to characters */ - var htmlUnescapes = invert(htmlEscapes); - - /** Used to match HTML entities and HTML characters */ - var reEscapedHtml = RegExp('(' + keys(htmlUnescapes).join('|') + ')', 'g'), - reUnescapedHtml = RegExp('[' + keys(htmlEscapes).join('') + ']', 'g'); - - /** - * A function compiled to iterate `arguments` objects, arrays, objects, and - * strings consistenly across environments, executing the callback for each - * element in the collection. The callback is bound to `thisArg` and invoked - * with three arguments; (value, index|key, collection). Callbacks may exit - * iteration early by explicitly returning `false`. - * - * @private - * @type Function - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array|Object|string} Returns `collection`. - */ - var baseEach = createIterator(eachIteratorOptions); - - /*--------------------------------------------------------------------------*/ - - /** - * Assigns own enumerable properties of source object(s) to the destination - * object. Subsequent sources will overwrite property assignments of previous - * sources. If a callback is provided it will be executed to produce the - * assigned values. The callback is bound to `thisArg` and invoked with two - * arguments; (objectValue, sourceValue). - * - * @static - * @memberOf _ - * @type Function - * @alias extend - * @category Objects - * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. - * @param {Function} [callback] The function to customize assigning values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the destination object. - * @example - * - * _.assign({ 'name': 'fred' }, { 'employer': 'slate' }); - * // => { 'name': 'fred', 'employer': 'slate' } - * - * var defaults = _.partialRight(_.assign, function(a, b) { - * return typeof a == 'undefined' ? b : a; - * }); - * - * var object = { 'name': 'barney' }; - * defaults(object, { 'name': 'fred', 'employer': 'slate' }); - * // => { 'name': 'barney', 'employer': 'slate' } - */ - var assign = createIterator(defaultsIteratorOptions, { - 'top': - defaultsIteratorOptions.top.replace(';', - ';\n' + - "if (argsLength > 3 && typeof args[argsLength - 2] == 'function') {\n" + - ' var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2);\n' + - "} else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') {\n" + - ' callback = args[--argsLength];\n' + - '}' - ), - 'loop': 'result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]' - }); - - /** - * Creates a clone of `value`. If `isDeep` is `true` nested objects will also - * be cloned, otherwise they will be assigned by reference. If a callback - * is provided it will be executed to produce the cloned values. If the - * callback returns `undefined` cloning will be handled by the method instead. - * The callback is bound to `thisArg` and invoked with one argument; (value). - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to clone. - * @param {boolean} [isDeep=false] Specify a deep clone. - * @param {Function} [callback] The function to customize cloning values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the cloned value. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * var shallow = _.clone(characters); - * shallow[0] === characters[0]; - * // => true - * - * var deep = _.clone(characters, true); - * deep[0] === characters[0]; - * // => false - * - * _.mixin({ - * 'clone': _.partialRight(_.clone, function(value) { - * return _.isElement(value) ? value.cloneNode(false) : undefined; - * }) - * }); - * - * var clone = _.clone(document.body); - * clone.childNodes.length; - * // => 0 - */ - function clone(value, isDeep, callback, thisArg) { - // allows working with "Collections" methods without using their `index` - // and `collection` arguments for `isDeep` and `callback` - if (typeof isDeep != 'boolean' && isDeep != null) { - thisArg = callback; - callback = isDeep; - isDeep = false; - } - return baseClone(value, isDeep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1)); - } - - /** - * Creates a deep clone of `value`. If a callback is provided it will be - * executed to produce the cloned values. If the callback returns `undefined` - * cloning will be handled by the method instead. The callback is bound to - * `thisArg` and invoked with one argument; (value). - * - * Note: This method is loosely based on the structured clone algorithm. Functions - * and DOM nodes are **not** cloned. The enumerable properties of `arguments` objects and - * objects created by constructors other than `Object` are cloned to plain `Object` objects. - * See http://www.w3.org/TR/html5/infrastructure.html#internal-structured-cloning-algorithm. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to deep clone. - * @param {Function} [callback] The function to customize cloning values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the deep cloned value. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * var deep = _.cloneDeep(characters); - * deep[0] === characters[0]; - * // => false - * - * var view = { - * 'label': 'docs', - * 'node': element - * }; - * - * var clone = _.cloneDeep(view, function(value) { - * return _.isElement(value) ? value.cloneNode(true) : undefined; - * }); - * - * clone.node == view.node; - * // => false - */ - function cloneDeep(value, callback, thisArg) { - return baseClone(value, true, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1)); - } - - /** - * Creates an object that inherits from the given `prototype` object. If a - * `properties` object is provided its own enumerable properties are assigned - * to the created object. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} prototype The object to inherit from. - * @param {Object} [properties] The properties to assign to the object. - * @returns {Object} Returns the new object. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * function Circle() { - * Shape.call(this); - * } - * - * Circle.prototype = _.create(Shape.prototype, { 'constructor': Circle }); - * - * var circle = new Circle; - * circle instanceof Circle; - * // => true - * - * circle instanceof Shape; - * // => true - */ - function create(prototype, properties) { - var result = baseCreate(prototype); - return properties ? assign(result, properties) : result; - } - - /** - * Assigns own enumerable properties of source object(s) to the destination - * object for all destination properties that resolve to `undefined`. Once a - * property is set, additional defaults of the same property will be ignored. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. - * @param- {Object} [guard] Allows working with `_.reduce` without using its - * `key` and `object` arguments as sources. - * @returns {Object} Returns the destination object. - * @example - * - * var object = { 'name': 'barney' }; - * _.defaults(object, { 'name': 'fred', 'employer': 'slate' }); - * // => { 'name': 'barney', 'employer': 'slate' } - */ - var defaults = createIterator(defaultsIteratorOptions); - - /** - * This method is like `_.findIndex` except that it returns the key of the - * first element that passes the callback check, instead of the element itself. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to search. - * @param {Function|Object|string} [callback=identity] The function called per - * iteration. If a property name or object is provided it will be used to - * create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {string|undefined} Returns the key of the found element, else `undefined`. - * @example - * - * var characters = { - * 'barney': { 'age': 36, 'blocked': false }, - * 'fred': { 'age': 40, 'blocked': true }, - * 'pebbles': { 'age': 1, 'blocked': false } - * }; - * - * _.findKey(characters, function(chr) { - * return chr.age < 40; - * }); - * // => 'barney' (property order is not guaranteed across environments) - * - * // using "_.where" callback shorthand - * _.findKey(characters, { 'age': 1 }); - * // => 'pebbles' - * - * // using "_.pluck" callback shorthand - * _.findKey(characters, 'blocked'); - * // => 'fred' - */ - function findKey(object, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - forOwn(object, function(value, key, object) { - if (callback(value, key, object)) { - result = key; - return false; - } - }); - return result; - } - - /** - * This method is like `_.findKey` except that it iterates over elements - * of a `collection` in the opposite order. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to search. - * @param {Function|Object|string} [callback=identity] The function called per - * iteration. If a property name or object is provided it will be used to - * create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {string|undefined} Returns the key of the found element, else `undefined`. - * @example - * - * var characters = { - * 'barney': { 'age': 36, 'blocked': true }, - * 'fred': { 'age': 40, 'blocked': false }, - * 'pebbles': { 'age': 1, 'blocked': true } - * }; - * - * _.findLastKey(characters, function(chr) { - * return chr.age < 40; - * }); - * // => returns `pebbles`, assuming `_.findKey` returns `barney` - * - * // using "_.where" callback shorthand - * _.findLastKey(characters, { 'age': 40 }); - * // => 'fred' - * - * // using "_.pluck" callback shorthand - * _.findLastKey(characters, 'blocked'); - * // => 'pebbles' - */ - function findLastKey(object, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - forOwnRight(object, function(value, key, object) { - if (callback(value, key, object)) { - result = key; - return false; - } - }); - return result; - } - - /** - * Iterates over own and inherited enumerable properties of an object, - * executing the callback for each property. The callback is bound to `thisArg` - * and invoked with three arguments; (value, key, object). Callbacks may exit - * iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * Shape.prototype.move = function(x, y) { - * this.x += x; - * this.y += y; - * }; - * - * _.forIn(new Shape, function(value, key) { - * console.log(key); - * }); - * // => logs 'x', 'y', and 'move' (property order is not guaranteed across environments) - */ - var forIn = createIterator(eachIteratorOptions, forOwnIteratorOptions, { - 'useHas': false - }); - - /** - * This method is like `_.forIn` except that it iterates over elements - * of a `collection` in the opposite order. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * Shape.prototype.move = function(x, y) { - * this.x += x; - * this.y += y; - * }; - * - * _.forInRight(new Shape, function(value, key) { - * console.log(key); - * }); - * // => logs 'move', 'y', and 'x' assuming `_.forIn ` logs 'x', 'y', and 'move' - */ - function forInRight(object, callback, thisArg) { - var pairs = []; - - forIn(object, function(value, key) { - pairs.push(key, value); - }); - - var length = pairs.length; - callback = baseCreateCallback(callback, thisArg, 3); - while (length--) { - if (callback(pairs[length--], pairs[length], object) === false) { - break; - } - } - return object; - } - - /** - * Iterates over own enumerable properties of an object, executing the callback - * for each property. The callback is bound to `thisArg` and invoked with three - * arguments; (value, key, object). Callbacks may exit iteration early by - * explicitly returning `false`. - * - * @static - * @memberOf _ - * @type Function - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { - * console.log(key); - * }); - * // => logs '0', '1', and 'length' (property order is not guaranteed across environments) - */ - var forOwn = createIterator(eachIteratorOptions, forOwnIteratorOptions); - - /** - * This method is like `_.forOwn` except that it iterates over elements - * of a `collection` in the opposite order. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns `object`. - * @example - * - * _.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { - * console.log(key); - * }); - * // => logs 'length', '1', and '0' assuming `_.forOwn` logs '0', '1', and 'length' - */ - function forOwnRight(object, callback, thisArg) { - var props = keys(object), - length = props.length; - - callback = baseCreateCallback(callback, thisArg, 3); - while (length--) { - var key = props[length]; - if (callback(object[key], key, object) === false) { - break; - } - } - return object; - } - - /** - * Creates a sorted array of property names of all enumerable properties, - * own and inherited, of `object` that have function values. - * - * @static - * @memberOf _ - * @alias methods - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property names that have function values. - * @example - * - * _.functions(_); - * // => ['all', 'any', 'bind', 'bindAll', 'clone', 'compact', 'compose', ...] - */ - function functions(object) { - var result = []; - forIn(object, function(value, key) { - if (isFunction(value)) { - result.push(key); - } - }); - return result.sort(); - } - - /** - * Checks if the specified property name exists as a direct property of `object`, - * instead of an inherited property. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @param {string} key The name of the property to check. - * @returns {boolean} Returns `true` if key is a direct property, else `false`. - * @example - * - * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); - * // => true - */ - function has(object, key) { - return object ? hasOwnProperty.call(object, key) : false; - } - - /** - * Creates an object composed of the inverted keys and values of the given object. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to invert. - * @returns {Object} Returns the created inverted object. - * @example - * - * _.invert({ 'first': 'fred', 'second': 'barney' }); - * // => { 'fred': 'first', 'barney': 'second' } - */ - function invert(object) { - var index = -1, - props = keys(object), - length = props.length, - result = {}; - - while (++index < length) { - var key = props[index]; - result[object[key]] = key; - } - return result; - } - - /** - * Checks if `value` is a boolean value. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a boolean value, else `false`. - * @example - * - * _.isBoolean(null); - * // => false - */ - function isBoolean(value) { - return value === true || value === false || - value && typeof value == 'object' && toString.call(value) == boolClass || false; - } - - /** - * Checks if `value` is a date. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a date, else `false`. - * @example - * - * _.isDate(new Date); - * // => true - */ - function isDate(value) { - return value && typeof value == 'object' && toString.call(value) == dateClass || false; - } - - /** - * Checks if `value` is a DOM element. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a DOM element, else `false`. - * @example - * - * _.isElement(document.body); - * // => true - */ - function isElement(value) { - return value && value.nodeType === 1 || false; - } - - /** - * Checks if `value` is empty. Arrays, strings, or `arguments` objects with a - * length of `0` and objects with no own enumerable properties are considered - * "empty". - * - * @static - * @memberOf _ - * @category Objects - * @param {Array|Object|string} value The value to inspect. - * @returns {boolean} Returns `true` if the `value` is empty, else `false`. - * @example - * - * _.isEmpty([1, 2, 3]); - * // => false - * - * _.isEmpty({}); - * // => true - * - * _.isEmpty(''); - * // => true - */ - function isEmpty(value) { - var result = true; - if (!value) { - return result; - } - var className = toString.call(value), - length = value.length; - - if ((className == arrayClass || className == stringClass || - (support.argsClass ? className == argsClass : isArguments(value))) || - (className == objectClass && typeof length == 'number' && isFunction(value.splice))) { - return !length; - } - forOwn(value, function() { - return (result = false); - }); - return result; - } - - /** - * Performs a deep comparison between two values to determine if they are - * equivalent to each other. If a callback is provided it will be executed - * to compare values. If the callback returns `undefined` comparisons will - * be handled by the method instead. The callback is bound to `thisArg` and - * invoked with two arguments; (a, b). - * - * @static - * @memberOf _ - * @category Objects - * @param {*} a The value to compare. - * @param {*} b The other value to compare. - * @param {Function} [callback] The function to customize comparing values. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'name': 'fred' }; - * var copy = { 'name': 'fred' }; - * - * object == copy; - * // => false - * - * _.isEqual(object, copy); - * // => true - * - * var words = ['hello', 'goodbye']; - * var otherWords = ['hi', 'goodbye']; - * - * _.isEqual(words, otherWords, function(a, b) { - * var reGreet = /^(?:hello|hi)$/i, - * aGreet = _.isString(a) && reGreet.test(a), - * bGreet = _.isString(b) && reGreet.test(b); - * - * return (aGreet || bGreet) ? (aGreet == bGreet) : undefined; - * }); - * // => true - */ - function isEqual(a, b, callback, thisArg) { - return baseIsEqual(a, b, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 2)); - } - - /** - * Checks if `value` is, or can be coerced to, a finite number. - * - * Note: This is not the same as native `isFinite` which will return true for - * booleans and empty strings. See http://es5.github.io/#x15.1.2.5. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is finite, else `false`. - * @example - * - * _.isFinite(-101); - * // => true - * - * _.isFinite('10'); - * // => true - * - * _.isFinite(true); - * // => false - * - * _.isFinite(''); - * // => false - * - * _.isFinite(Infinity); - * // => false - */ - function isFinite(value) { - return nativeIsFinite(value) && !nativeIsNaN(parseFloat(value)); - } - - /** - * Checks if `value` is a function. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - */ - function isFunction(value) { - return typeof value == 'function'; - } - // fallback for older versions of Chrome and Safari - if (isFunction(/x/)) { - isFunction = function(value) { - return typeof value == 'function' && toString.call(value) == funcClass; - }; - } - - /** - * Checks if `value` is the language type of Object. - * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(1); - * // => false - */ - function isObject(value) { - // check if the value is the ECMAScript language type of Object - // http://es5.github.io/#x8 - // and avoid a V8 bug - // http://code.google.com/p/v8/issues/detail?id=2291 - return !!(value && objectTypes[typeof value]); - } - - /** - * Checks if `value` is `NaN`. - * - * Note: This is not the same as native `isNaN` which will return `true` for - * `undefined` and other non-numeric values. See http://es5.github.io/#x15.1.2.4. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is `NaN`, else `false`. - * @example - * - * _.isNaN(NaN); - * // => true - * - * _.isNaN(new Number(NaN)); - * // => true - * - * isNaN(undefined); - * // => true - * - * _.isNaN(undefined); - * // => false - */ - function isNaN(value) { - // `NaN` as a primitive is the only value that is not equal to itself - // (perform the [[Class]] check first to avoid errors with some host objects in IE) - return isNumber(value) && value != +value; - } - - /** - * Checks if `value` is `null`. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is `null`, else `false`. - * @example - * - * _.isNull(null); - * // => true - * - * _.isNull(undefined); - * // => false - */ - function isNull(value) { - return value === null; - } - - /** - * Checks if `value` is a number. - * - * Note: `NaN` is considered a number. See http://es5.github.io/#x8.5. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a number, else `false`. - * @example - * - * _.isNumber(8.4 * 5); - * // => true - */ - function isNumber(value) { - return typeof value == 'number' || - value && typeof value == 'object' && toString.call(value) == numberClass || false; - } - - /** - * Checks if `value` is an object created by the `Object` constructor. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. - * @example - * - * function Shape() { - * this.x = 0; - * this.y = 0; - * } - * - * _.isPlainObject(new Shape); - * // => false - * - * _.isPlainObject([1, 2, 3]); - * // => false - * - * _.isPlainObject({ 'x': 0, 'y': 0 }); - * // => true - */ - var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { - if (!(value && toString.call(value) == objectClass) || (!support.argsClass && isArguments(value))) { - return false; - } - var valueOf = value.valueOf, - objProto = isNative(valueOf) && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); - - return objProto - ? (value == objProto || getPrototypeOf(value) == objProto) - : shimIsPlainObject(value); - }; - - /** - * Checks if `value` is a regular expression. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a regular expression, else `false`. - * @example - * - * _.isRegExp(/fred/); - * // => true - */ - function isRegExp(value) { - return value && objectTypes[typeof value] && toString.call(value) == regexpClass || false; - } - - /** - * Checks if `value` is a string. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is a string, else `false`. - * @example - * - * _.isString('fred'); - * // => true - */ - function isString(value) { - return typeof value == 'string' || - value && typeof value == 'object' && toString.call(value) == stringClass || false; - } - - /** - * Checks if `value` is `undefined`. - * - * @static - * @memberOf _ - * @category Objects - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if the `value` is `undefined`, else `false`. - * @example - * - * _.isUndefined(void 0); - * // => true - */ - function isUndefined(value) { - return typeof value == 'undefined'; - } - - /** - * Creates an object with the same keys as `object` and values generated by - * running each own enumerable property of `object` through the callback. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, key, object). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new object with values of the results of each `callback` execution. - * @example - * - * _.mapValues({ 'a': 1, 'b': 2, 'c': 3} , function(num) { return num * 3; }); - * // => { 'a': 3, 'b': 6, 'c': 9 } - * - * var characters = { - * 'fred': { 'name': 'fred', 'age': 40 }, - * 'pebbles': { 'name': 'pebbles', 'age': 1 } - * }; - * - * // using "_.pluck" callback shorthand - * _.mapValues(characters, 'age'); - * // => { 'fred': 40, 'pebbles': 1 } - */ - function mapValues(object, callback, thisArg) { - var result = {}; - callback = lodash.createCallback(callback, thisArg, 3); - - forOwn(object, function(value, key, object) { - result[key] = callback(value, key, object); - }); - return result; - } - - /** - * Recursively merges own enumerable properties of the source object(s), that - * don't resolve to `undefined` into the destination object. Subsequent sources - * will overwrite property assignments of previous sources. If a callback is - * provided it will be executed to produce the merged values of the destination - * and source properties. If the callback returns `undefined` merging will - * be handled by the method instead. The callback is bound to `thisArg` and - * invoked with two arguments; (objectValue, sourceValue). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The destination object. - * @param {...Object} [source] The source objects. - * @param {Function} [callback] The function to customize merging properties. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the destination object. - * @example - * - * var names = { - * 'characters': [ - * { 'name': 'barney' }, - * { 'name': 'fred' } - * ] - * }; - * - * var ages = { - * 'characters': [ - * { 'age': 36 }, - * { 'age': 40 } - * ] - * }; - * - * _.merge(names, ages); - * // => { 'characters': [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }] } - * - * var food = { - * 'fruits': ['apple'], - * 'vegetables': ['beet'] - * }; - * - * var otherFood = { - * 'fruits': ['banana'], - * 'vegetables': ['carrot'] - * }; - * - * _.merge(food, otherFood, function(a, b) { - * return _.isArray(a) ? a.concat(b) : undefined; - * }); - * // => { 'fruits': ['apple', 'banana'], 'vegetables': ['beet', 'carrot] } - */ - function merge(object) { - var args = arguments, - length = 2; - - if (!isObject(object)) { - return object; - } - // allows working with `_.reduce` and `_.reduceRight` without using - // their `index` and `collection` arguments - if (typeof args[2] != 'number') { - length = args.length; - } - if (length > 3 && typeof args[length - 2] == 'function') { - var callback = baseCreateCallback(args[--length - 1], args[length--], 2); - } else if (length > 2 && typeof args[length - 1] == 'function') { - callback = args[--length]; - } - var sources = slice(arguments, 1, length), - index = -1, - stackA = getArray(), - stackB = getArray(); - - while (++index < length) { - baseMerge(object, sources[index], callback, stackA, stackB); - } - releaseArray(stackA); - releaseArray(stackB); - return object; - } - - /** - * Creates a shallow clone of `object` excluding the specified properties. - * Property names may be specified as individual arguments or as arrays of - * property names. If a callback is provided it will be executed for each - * property of `object` omitting the properties the callback returns truey - * for. The callback is bound to `thisArg` and invoked with three arguments; - * (value, key, object). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The source object. - * @param {Function|...string|string[]} [callback] The properties to omit or the - * function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns an object without the omitted properties. - * @example - * - * _.omit({ 'name': 'fred', 'age': 40 }, 'age'); - * // => { 'name': 'fred' } - * - * _.omit({ 'name': 'fred', 'age': 40 }, function(value) { - * return typeof value == 'number'; - * }); - * // => { 'name': 'fred' } - */ - function omit(object, callback, thisArg) { - var result = {}; - if (typeof callback != 'function') { - var props = []; - forIn(object, function(value, key) { - props.push(key); - }); - props = baseDifference(props, baseFlatten(arguments, true, false, 1)); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - result[key] = object[key]; - } - } else { - callback = lodash.createCallback(callback, thisArg, 3); - forIn(object, function(value, key, object) { - if (!callback(value, key, object)) { - result[key] = value; - } - }); - } - return result; - } - - /** - * Creates a two dimensional array of an object's key-value pairs, - * i.e. `[[key1, value1], [key2, value2]]`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns new array of key-value pairs. - * @example - * - * _.pairs({ 'barney': 36, 'fred': 40 }); - * // => [['barney', 36], ['fred', 40]] (property order is not guaranteed across environments) - */ - function pairs(object) { - var index = -1, - props = keys(object), - length = props.length, - result = Array(length); - - while (++index < length) { - var key = props[index]; - result[index] = [key, object[key]]; - } - return result; - } - - /** - * Creates a shallow clone of `object` composed of the specified properties. - * Property names may be specified as individual arguments or as arrays of - * property names. If a callback is provided it will be executed for each - * property of `object` picking the properties the callback returns truey - * for. The callback is bound to `thisArg` and invoked with three arguments; - * (value, key, object). - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The source object. - * @param {Function|...string|string[]} [callback] The function called per - * iteration or property names to pick, specified as individual property - * names or arrays of property names. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns an object composed of the picked properties. - * @example - * - * _.pick({ 'name': 'fred', '_userid': 'fred1' }, 'name'); - * // => { 'name': 'fred' } - * - * _.pick({ 'name': 'fred', '_userid': 'fred1' }, function(value, key) { - * return key.charAt(0) != '_'; - * }); - * // => { 'name': 'fred' } - */ - function pick(object, callback, thisArg) { - var result = {}; - if (typeof callback != 'function') { - var index = -1, - props = baseFlatten(arguments, true, false, 1), - length = isObject(object) ? props.length : 0; - - while (++index < length) { - var key = props[index]; - if (key in object) { - result[key] = object[key]; - } - } - } else { - callback = lodash.createCallback(callback, thisArg, 3); - forIn(object, function(value, key, object) { - if (callback(value, key, object)) { - result[key] = value; - } - }); - } - return result; - } - - /** - * An alternative to `_.reduce` this method transforms `object` to a new - * `accumulator` object which is the result of running each of its own - * enumerable properties through a callback, with each callback execution - * potentially mutating the `accumulator` object. The callback is bound to - * `thisArg` and invoked with four arguments; (accumulator, value, key, object). - * Callbacks may exit iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Array|Object} object The object to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [accumulator] The custom accumulator value. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the accumulated value. - * @example - * - * var squares = _.transform([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], function(result, num) { - * num *= num; - * if (num % 2) { - * return result.push(num) < 3; - * } - * }); - * // => [1, 9, 25] - * - * var mapped = _.transform({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { - * result[key] = num * 3; - * }); - * // => { 'a': 3, 'b': 6, 'c': 9 } - */ - function transform(object, callback, accumulator, thisArg) { - var isArr = isArray(object); - if (accumulator == null) { - if (isArr) { - accumulator = []; - } else { - var ctor = object && object.constructor, - proto = ctor && ctor.prototype; - - accumulator = baseCreate(proto); - } - } - if (callback) { - callback = lodash.createCallback(callback, thisArg, 4); - (isArr ? baseEach : forOwn)(object, function(value, index, object) { - return callback(accumulator, value, index, object); - }); - } - return accumulator; - } - - /** - * Creates an array composed of the own enumerable property values of `object`. - * - * @static - * @memberOf _ - * @category Objects - * @param {Object} object The object to inspect. - * @returns {Array} Returns an array of property values. - * @example - * - * _.values({ 'one': 1, 'two': 2, 'three': 3 }); - * // => [1, 2, 3] (property order is not guaranteed across environments) - */ - function values(object) { - var index = -1, - props = keys(object), - length = props.length, - result = Array(length); - - while (++index < length) { - result[index] = object[props[index]]; - } - return result; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Creates an array of elements from the specified indexes, or keys, of the - * `collection`. Indexes may be specified as individual arguments or as arrays - * of indexes. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {...(number|number[]|string|string[])} [index] The indexes of `collection` - * to retrieve, specified as individual indexes or arrays of indexes. - * @returns {Array} Returns a new array of elements corresponding to the - * provided indexes. - * @example - * - * _.at(['a', 'b', 'c', 'd', 'e'], [0, 2, 4]); - * // => ['a', 'c', 'e'] - * - * _.at(['fred', 'barney', 'pebbles'], 0, 2); - * // => ['fred', 'pebbles'] - */ - function at(collection) { - var args = arguments, - index = -1, - props = baseFlatten(args, true, false, 1), - length = (args[2] && args[2][args[1]] === collection) ? 1 : props.length, - result = Array(length); - - if (support.unindexedChars && isString(collection)) { - collection = collection.split(''); - } - while(++index < length) { - result[index] = collection[props[index]]; - } - return result; - } - - /** - * Checks if a given value is present in a collection using strict equality - * for comparisons, i.e. `===`. If `fromIndex` is negative, it is used as the - * offset from the end of the collection. - * - * @static - * @memberOf _ - * @alias include - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {*} target The value to check for. - * @param {number} [fromIndex=0] The index to search from. - * @returns {boolean} Returns `true` if the `target` element is found, else `false`. - * @example - * - * _.contains([1, 2, 3], 1); - * // => true - * - * _.contains([1, 2, 3], 1, 2); - * // => false - * - * _.contains({ 'name': 'fred', 'age': 40 }, 'fred'); - * // => true - * - * _.contains('pebbles', 'eb'); - * // => true - */ - function contains(collection, target, fromIndex) { - var index = -1, - indexOf = getIndexOf(), - length = collection ? collection.length : 0, - result = false; - - fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex) || 0; - if (isArray(collection)) { - result = indexOf(collection, target, fromIndex) > -1; - } else if (typeof length == 'number') { - result = (isString(collection) ? collection.indexOf(target, fromIndex) : indexOf(collection, target, fromIndex)) > -1; - } else { - baseEach(collection, function(value) { - if (++index >= fromIndex) { - return !(result = value === target); - } - }); - } - return result; - } - - /** - * Creates an object composed of keys generated from the results of running - * each element of `collection` through the callback. The corresponding value - * of each key is the number of times the key was returned by the callback. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.countBy([4.3, 6.1, 6.4], function(num) { return Math.floor(num); }); - * // => { '4': 1, '6': 2 } - * - * _.countBy([4.3, 6.1, 6.4], function(num) { return this.floor(num); }, Math); - * // => { '4': 1, '6': 2 } - * - * _.countBy(['one', 'two', 'three'], 'length'); - * // => { '3': 2, '5': 1 } - */ - var countBy = createAggregator(function(result, value, key) { - (hasOwnProperty.call(result, key) ? result[key]++ : result[key] = 1); - }); - - /** - * Checks if the given callback returns truey value for **all** elements of - * a collection. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias all - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {boolean} Returns `true` if all elements passed the callback check, - * else `false`. - * @example - * - * _.every([true, 1, null, 'yes']); - * // => false - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * // using "_.pluck" callback shorthand - * _.every(characters, 'age'); - * // => true - * - * // using "_.where" callback shorthand - * _.every(characters, { 'age': 36 }); - * // => false - */ - function every(collection, callback, thisArg) { - var result = true; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if (!(result = !!callback(collection[index], index, collection))) { - break; - } - } - } else { - baseEach(collection, function(value, index, collection) { - return (result = !!callback(value, index, collection)); - }); - } - return result; - } - - /** - * Iterates over elements of a collection, returning an array of all elements - * the callback returns truey for. The callback is bound to `thisArg` and - * invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias select - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of elements that passed the callback check. - * @example - * - * var evens = _.filter([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); - * // => [2, 4, 6] - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true } - * ]; - * - * // using "_.pluck" callback shorthand - * _.filter(characters, 'blocked'); - * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }] - * - * // using "_.where" callback shorthand - * _.filter(characters, { 'age': 36 }); - * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }] - */ - function filter(collection, callback, thisArg) { - var result = []; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (callback(value, index, collection)) { - result.push(value); - } - } - } else { - baseEach(collection, function(value, index, collection) { - if (callback(value, index, collection)) { - result.push(value); - } - }); - } - return result; - } - - /** - * Iterates over elements of a collection, returning the first element that - * the callback returns truey for. The callback is bound to `thisArg` and - * invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias detect, findWhere - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the found element, else `undefined`. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true }, - * { 'name': 'pebbles', 'age': 1, 'blocked': false } - * ]; - * - * _.find(characters, function(chr) { - * return chr.age < 40; - * }); - * // => { 'name': 'barney', 'age': 36, 'blocked': false } - * - * // using "_.where" callback shorthand - * _.find(characters, { 'age': 1 }); - * // => { 'name': 'pebbles', 'age': 1, 'blocked': false } - * - * // using "_.pluck" callback shorthand - * _.find(characters, 'blocked'); - * // => { 'name': 'fred', 'age': 40, 'blocked': true } - */ - function find(collection, callback, thisArg) { - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (callback(value, index, collection)) { - return value; - } - } - } else { - var result; - baseEach(collection, function(value, index, collection) { - if (callback(value, index, collection)) { - result = value; - return false; - } - }); - return result; - } - } - - /** - * This method is like `_.find` except that it iterates over elements - * of a `collection` from right to left. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the found element, else `undefined`. - * @example - * - * _.findLast([1, 2, 3, 4], function(num) { - * return num % 2 == 1; - * }); - * // => 3 - */ - function findLast(collection, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - forEachRight(collection, function(value, index, collection) { - if (callback(value, index, collection)) { - result = value; - return false; - } - }); - return result; - } - - /** - * Iterates over elements of a collection, executing the callback for each - * element. The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). Callbacks may exit iteration early by - * explicitly returning `false`. - * - * Note: As with other "Collections" methods, objects with a `length` property - * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` - * may be used for object iteration. - * - * @static - * @memberOf _ - * @alias each - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array|Object|string} Returns `collection`. - * @example - * - * _([1, 2, 3]).forEach(function(num) { console.log(num); }).join(','); - * // => logs each number and returns '1,2,3' - * - * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); - * // => logs each number and returns the object (property order is not guaranteed across environments) - */ - function forEach(collection, callback, thisArg) { - if (callback && typeof thisArg == 'undefined' && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if (callback(collection[index], index, collection) === false) { - break; - } - } - } else { - baseEach(collection, callback, thisArg); - } - return collection; - } - - /** - * This method is like `_.forEach` except that it iterates over elements - * of a `collection` from right to left. - * - * @static - * @memberOf _ - * @alias eachRight - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array|Object|string} Returns `collection`. - * @example - * - * _([1, 2, 3]).forEachRight(function(num) { console.log(num); }).join(','); - * // => logs each number from right to left and returns '3,2,1' - */ - function forEachRight(collection, callback, thisArg) { - var iterable = collection, - length = collection ? collection.length : 0; - - callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); - if (isArray(collection)) { - while (length--) { - if (callback(collection[length], length, collection) === false) { - break; - } - } - } else { - if (typeof length != 'number') { - var props = keys(collection); - length = props.length; - } else if (support.unindexedChars && isString(collection)) { - iterable = collection.split(''); - } - baseEach(collection, function(value, key, collection) { - key = props ? props[--length] : --length; - return callback(iterable[key], key, collection); - }); - } - return collection; - } - - /** - * Creates an object composed of keys generated from the results of running - * each element of a collection through the callback. The corresponding value - * of each key is an array of the elements responsible for generating the key. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false` - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * _.groupBy([4.2, 6.1, 6.4], function(num) { return Math.floor(num); }); - * // => { '4': [4.2], '6': [6.1, 6.4] } - * - * _.groupBy([4.2, 6.1, 6.4], function(num) { return this.floor(num); }, Math); - * // => { '4': [4.2], '6': [6.1, 6.4] } - * - * // using "_.pluck" callback shorthand - * _.groupBy(['one', 'two', 'three'], 'length'); - * // => { '3': ['one', 'two'], '5': ['three'] } - */ - var groupBy = createAggregator(function(result, value, key) { - (hasOwnProperty.call(result, key) ? result[key] : result[key] = []).push(value); - }); - - /** - * Creates an object composed of keys generated from the results of running - * each element of the collection through the given callback. The corresponding - * value of each key is the last element responsible for generating the key. - * The callback is bound to `thisArg` and invoked with three arguments; - * (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Object} Returns the composed aggregate object. - * @example - * - * var keys = [ - * { 'dir': 'left', 'code': 97 }, - * { 'dir': 'right', 'code': 100 } - * ]; - * - * _.indexBy(keys, 'dir'); - * // => { 'left': { 'dir': 'left', 'code': 97 }, 'right': { 'dir': 'right', 'code': 100 } } - * - * _.indexBy(keys, function(key) { return String.fromCharCode(key.code); }); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - * - * _.indexBy(characters, function(key) { this.fromCharCode(key.code); }, String); - * // => { 'a': { 'dir': 'left', 'code': 97 }, 'd': { 'dir': 'right', 'code': 100 } } - */ - var indexBy = createAggregator(function(result, value, key) { - result[key] = value; - }); - - /** - * Invokes the method named by `methodName` on each element in the `collection` - * returning an array of the results of each invoked method. Additional arguments - * will be provided to each invoked method. If `methodName` is a function it - * will be invoked for, and `this` bound to, each element in the `collection`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|string} methodName The name of the method to invoke or - * the function invoked per iteration. - * @param {...*} [arg] Arguments to invoke the method with. - * @returns {Array} Returns a new array of the results of each invoked method. - * @example - * - * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); - * // => [[1, 5, 7], [1, 2, 3]] - * - * _.invoke([123, 456], String.prototype.split, ''); - * // => [['1', '2', '3'], ['4', '5', '6']] - */ - function invoke(collection, methodName) { - var args = slice(arguments, 2), - index = -1, - isFunc = typeof methodName == 'function', - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - forEach(collection, function(value) { - result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args); - }); - return result; - } - - /** - * Creates an array of values by running each element in the collection - * through the callback. The callback is bound to `thisArg` and invoked with - * three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias collect - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of the results of each `callback` execution. - * @example - * - * _.map([1, 2, 3], function(num) { return num * 3; }); - * // => [3, 6, 9] - * - * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); - * // => [3, 6, 9] (property order is not guaranteed across environments) - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * // using "_.pluck" callback shorthand - * _.map(characters, 'name'); - * // => ['barney', 'fred'] - */ - function map(collection, callback, thisArg) { - var index = -1, - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - callback = lodash.createCallback(callback, thisArg, 3); - if (isArray(collection)) { - while (++index < length) { - result[index] = callback(collection[index], index, collection); - } - } else { - baseEach(collection, function(value, key, collection) { - result[++index] = callback(value, key, collection); - }); - } - return result; - } - - /** - * Retrieves the maximum value of a collection. If the collection is empty or - * falsey `-Infinity` is returned. If a callback is provided it will be executed - * for each value in the collection to generate the criterion by which the value - * is ranked. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the maximum value. - * @example - * - * _.max([4, 2, 8, 6]); - * // => 8 - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * _.max(characters, function(chr) { return chr.age; }); - * // => { 'name': 'fred', 'age': 40 }; - * - * // using "_.pluck" callback shorthand - * _.max(characters, 'age'); - * // => { 'name': 'fred', 'age': 40 }; - */ - function max(collection, callback, thisArg) { - var computed = -Infinity, - result = computed; - - // allows working with functions like `_.map` without using - // their `index` argument as a callback - if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) { - callback = null; - } - if (callback == null && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (value > result) { - result = value; - } - } - } else { - callback = (callback == null && isString(collection)) - ? charAtCallback - : lodash.createCallback(callback, thisArg, 3); - - baseEach(collection, function(value, index, collection) { - var current = callback(value, index, collection); - if (current > computed) { - computed = current; - result = value; - } - }); - } - return result; - } - - /** - * Retrieves the minimum value of a collection. If the collection is empty or - * falsey `Infinity` is returned. If a callback is provided it will be executed - * for each value in the collection to generate the criterion by which the value - * is ranked. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the minimum value. - * @example - * - * _.min([4, 2, 8, 6]); - * // => 2 - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * _.min(characters, function(chr) { return chr.age; }); - * // => { 'name': 'barney', 'age': 36 }; - * - * // using "_.pluck" callback shorthand - * _.min(characters, 'age'); - * // => { 'name': 'barney', 'age': 36 }; - */ - function min(collection, callback, thisArg) { - var computed = Infinity, - result = computed; - - // allows working with functions like `_.map` without using - // their `index` argument as a callback - if (typeof callback != 'function' && thisArg && thisArg[callback] === collection) { - callback = null; - } - if (callback == null && isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - var value = collection[index]; - if (value < result) { - result = value; - } - } - } else { - callback = (callback == null && isString(collection)) - ? charAtCallback - : lodash.createCallback(callback, thisArg, 3); - - baseEach(collection, function(value, index, collection) { - var current = callback(value, index, collection); - if (current < computed) { - computed = current; - result = value; - } - }); - } - return result; - } - - /** - * Retrieves the value of a specified property from all elements in the collection. - * - * @static - * @memberOf _ - * @type Function - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {string} property The name of the property to pluck. - * @returns {Array} Returns a new array of property values. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * _.pluck(characters, 'name'); - * // => ['barney', 'fred'] - */ - var pluck = map; - - /** - * Reduces a collection to a value which is the accumulated result of running - * each element in the collection through the callback, where each successive - * callback execution consumes the return value of the previous execution. If - * `accumulator` is not provided the first element of the collection will be - * used as the initial `accumulator` value. The callback is bound to `thisArg` - * and invoked with four arguments; (accumulator, value, index|key, collection). - * - * @static - * @memberOf _ - * @alias foldl, inject - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [accumulator] Initial value of the accumulator. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the accumulated value. - * @example - * - * var sum = _.reduce([1, 2, 3], function(sum, num) { - * return sum + num; - * }); - * // => 6 - * - * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { - * result[key] = num * 3; - * return result; - * }, {}); - * // => { 'a': 3, 'b': 6, 'c': 9 } - */ - function reduce(collection, callback, accumulator, thisArg) { - var noaccum = arguments.length < 3; - callback = lodash.createCallback(callback, thisArg, 4); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - if (noaccum) { - accumulator = collection[++index]; - } - while (++index < length) { - accumulator = callback(accumulator, collection[index], index, collection); - } - } else { - baseEach(collection, function(value, index, collection) { - accumulator = noaccum - ? (noaccum = false, value) - : callback(accumulator, value, index, collection) - }); - } - return accumulator; - } - - /** - * This method is like `_.reduce` except that it iterates over elements - * of a `collection` from right to left. - * - * @static - * @memberOf _ - * @alias foldr - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function} [callback=identity] The function called per iteration. - * @param {*} [accumulator] Initial value of the accumulator. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the accumulated value. - * @example - * - * var list = [[0, 1], [2, 3], [4, 5]]; - * var flat = _.reduceRight(list, function(a, b) { return a.concat(b); }, []); - * // => [4, 5, 2, 3, 0, 1] - */ - function reduceRight(collection, callback, accumulator, thisArg) { - var noaccum = arguments.length < 3; - callback = lodash.createCallback(callback, thisArg, 4); - forEachRight(collection, function(value, index, collection) { - accumulator = noaccum - ? (noaccum = false, value) - : callback(accumulator, value, index, collection); - }); - return accumulator; - } - - /** - * The opposite of `_.filter` this method returns the elements of a - * collection that the callback does **not** return truey for. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of elements that failed the callback check. - * @example - * - * var odds = _.reject([1, 2, 3, 4, 5, 6], function(num) { return num % 2 == 0; }); - * // => [1, 3, 5] - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true } - * ]; - * - * // using "_.pluck" callback shorthand - * _.reject(characters, 'blocked'); - * // => [{ 'name': 'barney', 'age': 36, 'blocked': false }] - * - * // using "_.where" callback shorthand - * _.reject(characters, { 'age': 36 }); - * // => [{ 'name': 'fred', 'age': 40, 'blocked': true }] - */ - function reject(collection, callback, thisArg) { - callback = lodash.createCallback(callback, thisArg, 3); - return filter(collection, function(value, index, collection) { - return !callback(value, index, collection); - }); - } - - /** - * Retrieves a random element or `n` random elements from a collection. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to sample. - * @param {number} [n] The number of elements to sample. - * @param- {Object} [guard] Allows working with functions like `_.map` - * without using their `index` arguments as `n`. - * @returns {Array} Returns the random sample(s) of `collection`. - * @example - * - * _.sample([1, 2, 3, 4]); - * // => 2 - * - * _.sample([1, 2, 3, 4], 2); - * // => [3, 1] - */ - function sample(collection, n, guard) { - if (collection && typeof collection.length != 'number') { - collection = values(collection); - } else if (support.unindexedChars && isString(collection)) { - collection = collection.split(''); - } - if (n == null || guard) { - return collection ? collection[baseRandom(0, collection.length - 1)] : undefined; - } - var result = shuffle(collection); - result.length = nativeMin(nativeMax(0, n), result.length); - return result; - } - - /** - * Creates an array of shuffled values, using a version of the Fisher-Yates - * shuffle. See http://en.wikipedia.org/wiki/Fisher-Yates_shuffle. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to shuffle. - * @returns {Array} Returns a new shuffled collection. - * @example - * - * _.shuffle([1, 2, 3, 4, 5, 6]); - * // => [4, 1, 6, 3, 5, 2] - */ - function shuffle(collection) { - var index = -1, - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - forEach(collection, function(value) { - var rand = baseRandom(0, ++index); - result[index] = result[rand]; - result[rand] = value; - }); - return result; - } - - /** - * Gets the size of the `collection` by returning `collection.length` for arrays - * and array-like objects or the number of own enumerable properties for objects. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to inspect. - * @returns {number} Returns `collection.length` or number of own enumerable properties. - * @example - * - * _.size([1, 2]); - * // => 2 - * - * _.size({ 'one': 1, 'two': 2, 'three': 3 }); - * // => 3 - * - * _.size('pebbles'); - * // => 7 - */ - function size(collection) { - var length = collection ? collection.length : 0; - return typeof length == 'number' ? length : keys(collection).length; - } - - /** - * Checks if the callback returns a truey value for **any** element of a - * collection. The function returns as soon as it finds a passing value and - * does not iterate over the entire collection. The callback is bound to - * `thisArg` and invoked with three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias any - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {boolean} Returns `true` if any element passed the callback check, - * else `false`. - * @example - * - * _.some([null, 0, 'yes', false], Boolean); - * // => true - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true } - * ]; - * - * // using "_.pluck" callback shorthand - * _.some(characters, 'blocked'); - * // => true - * - * // using "_.where" callback shorthand - * _.some(characters, { 'age': 1 }); - * // => false - */ - function some(collection, callback, thisArg) { - var result; - callback = lodash.createCallback(callback, thisArg, 3); - - if (isArray(collection)) { - var index = -1, - length = collection.length; - - while (++index < length) { - if ((result = callback(collection[index], index, collection))) { - break; - } - } - } else { - baseEach(collection, function(value, index, collection) { - return !(result = callback(value, index, collection)); - }); - } - return !!result; - } - - /** - * Creates an array of elements, sorted in ascending order by the results of - * running each element in a collection through the callback. This method - * performs a stable sort, that is, it will preserve the original sort order - * of equal elements. The callback is bound to `thisArg` and invoked with - * three arguments; (value, index|key, collection). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an array of property names is provided for `callback` the collection - * will be sorted by each property value. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Array|Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of sorted elements. - * @example - * - * _.sortBy([1, 2, 3], function(num) { return Math.sin(num); }); - * // => [3, 1, 2] - * - * _.sortBy([1, 2, 3], function(num) { return this.sin(num); }, Math); - * // => [3, 1, 2] - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 }, - * { 'name': 'barney', 'age': 26 }, - * { 'name': 'fred', 'age': 30 } - * ]; - * - * // using "_.pluck" callback shorthand - * _.map(_.sortBy(characters, 'age'), _.values); - * // => [['barney', 26], ['fred', 30], ['barney', 36], ['fred', 40]] - * - * // sorting by multiple properties - * _.map(_.sortBy(characters, ['name', 'age']), _.values); - * // = > [['barney', 26], ['barney', 36], ['fred', 30], ['fred', 40]] - */ - function sortBy(collection, callback, thisArg) { - var index = -1, - isArr = isArray(callback), - length = collection ? collection.length : 0, - result = Array(typeof length == 'number' ? length : 0); - - if (!isArr) { - callback = lodash.createCallback(callback, thisArg, 3); - } - forEach(collection, function(value, key, collection) { - var object = result[++index] = getObject(); - if (isArr) { - object.criteria = map(callback, function(key) { return value[key]; }); - } else { - (object.criteria = getArray())[0] = callback(value, key, collection); - } - object.index = index; - object.value = value; - }); - - length = result.length; - result.sort(compareAscending); - while (length--) { - var object = result[length]; - result[length] = object.value; - if (!isArr) { - releaseArray(object.criteria); - } - releaseObject(object); - } - return result; - } - - /** - * Converts the `collection` to an array. - * - * @static - * @memberOf _ - * @category Collections - * @param {Array|Object|string} collection The collection to convert. - * @returns {Array} Returns the new converted array. - * @example - * - * (function() { return _.toArray(arguments).slice(1); })(1, 2, 3, 4); - * // => [2, 3, 4] - */ - function toArray(collection) { - if (collection && typeof collection.length == 'number') { - return (support.unindexedChars && isString(collection)) - ? collection.split('') - : slice(collection); - } - return values(collection); - } - - /** - * Performs a deep comparison of each element in a `collection` to the given - * `properties` object, returning an array of all elements that have equivalent - * property values. - * - * @static - * @memberOf _ - * @type Function - * @category Collections - * @param {Array|Object|string} collection The collection to iterate over. - * @param {Object} props The object of property values to filter by. - * @returns {Array} Returns a new array of elements that have the given properties. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }, - * { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] } - * ]; - * - * _.where(characters, { 'age': 36 }); - * // => [{ 'name': 'barney', 'age': 36, 'pets': ['hoppy'] }] - * - * _.where(characters, { 'pets': ['dino'] }); - * // => [{ 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] }] - */ - var where = filter; - - /*--------------------------------------------------------------------------*/ - - /** - * Creates an array with all falsey values removed. The values `false`, `null`, - * `0`, `""`, `undefined`, and `NaN` are all falsey. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to compact. - * @returns {Array} Returns a new array of filtered values. - * @example - * - * _.compact([0, 1, false, 2, '', 3]); - * // => [1, 2, 3] - */ - function compact(array) { - var index = -1, - length = array ? array.length : 0, - result = []; - - while (++index < length) { - var value = array[index]; - if (value) { - result.push(value); - } - } - return result; - } - - /** - * Creates an array excluding all values of the provided arrays using strict - * equality for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to process. - * @param {...Array} [values] The arrays of values to exclude. - * @returns {Array} Returns a new array of filtered values. - * @example - * - * _.difference([1, 2, 3, 4, 5], [5, 2, 10]); - * // => [1, 3, 4] - */ - function difference(array) { - return baseDifference(array, baseFlatten(arguments, true, true, 1)); - } - - /** - * This method is like `_.find` except that it returns the index of the first - * element that passes the callback check, instead of the element itself. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': false }, - * { 'name': 'fred', 'age': 40, 'blocked': true }, - * { 'name': 'pebbles', 'age': 1, 'blocked': false } - * ]; - * - * _.findIndex(characters, function(chr) { - * return chr.age < 20; - * }); - * // => 2 - * - * // using "_.where" callback shorthand - * _.findIndex(characters, { 'age': 36 }); - * // => 0 - * - * // using "_.pluck" callback shorthand - * _.findIndex(characters, 'blocked'); - * // => 1 - */ - function findIndex(array, callback, thisArg) { - var index = -1, - length = array ? array.length : 0; - - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length) { - if (callback(array[index], index, array)) { - return index; - } - } - return -1; - } - - /** - * This method is like `_.findIndex` except that it iterates over elements - * of a `collection` from right to left. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {number} Returns the index of the found element, else `-1`. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36, 'blocked': true }, - * { 'name': 'fred', 'age': 40, 'blocked': false }, - * { 'name': 'pebbles', 'age': 1, 'blocked': true } - * ]; - * - * _.findLastIndex(characters, function(chr) { - * return chr.age > 30; - * }); - * // => 1 - * - * // using "_.where" callback shorthand - * _.findLastIndex(characters, { 'age': 36 }); - * // => 0 - * - * // using "_.pluck" callback shorthand - * _.findLastIndex(characters, 'blocked'); - * // => 2 - */ - function findLastIndex(array, callback, thisArg) { - var length = array ? array.length : 0; - callback = lodash.createCallback(callback, thisArg, 3); - while (length--) { - if (callback(array[length], length, array)) { - return length; - } - } - return -1; - } - - /** - * Gets the first element or first `n` elements of an array. If a callback - * is provided elements at the beginning of the array are returned as long - * as the callback returns truey. The callback is bound to `thisArg` and - * invoked with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias head, take - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback] The function called - * per element or the number of elements to return. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the first element(s) of `array`. - * @example - * - * _.first([1, 2, 3]); - * // => 1 - * - * _.first([1, 2, 3], 2); - * // => [1, 2] - * - * _.first([1, 2, 3], function(num) { - * return num < 3; - * }); - * // => [1, 2] - * - * var characters = [ - * { 'name': 'barney', 'blocked': true, 'employer': 'slate' }, - * { 'name': 'fred', 'blocked': false, 'employer': 'slate' }, - * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.first(characters, 'blocked'); - * // => [{ 'name': 'barney', 'blocked': true, 'employer': 'slate' }] - * - * // using "_.where" callback shorthand - * _.pluck(_.first(characters, { 'employer': 'slate' }), 'name'); - * // => ['barney', 'fred'] - */ - function first(array, callback, thisArg) { - var n = 0, - length = array ? array.length : 0; - - if (typeof callback != 'number' && callback != null) { - var index = -1; - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length && callback(array[index], index, array)) { - n++; - } - } else { - n = callback; - if (n == null || thisArg) { - return array ? array[0] : undefined; - } - } - return slice(array, 0, nativeMin(nativeMax(0, n), length)); - } - - /** - * Flattens a nested array (the nesting can be to any depth). If `isShallow` - * is truey, the array will only be flattened a single level. If a callback - * is provided each element of the array is passed through the callback before - * flattening. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to flatten. - * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new flattened array. - * @example - * - * _.flatten([1, [2], [3, [[4]]]]); - * // => [1, 2, 3, 4]; - * - * _.flatten([1, [2], [3, [[4]]]], true); - * // => [1, 2, 3, [[4]]]; - * - * var characters = [ - * { 'name': 'barney', 'age': 30, 'pets': ['hoppy'] }, - * { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] } - * ]; - * - * // using "_.pluck" callback shorthand - * _.flatten(characters, 'pets'); - * // => ['hoppy', 'baby puss', 'dino'] - */ - function flatten(array, isShallow, callback, thisArg) { - // juggle arguments - if (typeof isShallow != 'boolean' && isShallow != null) { - thisArg = callback; - callback = (typeof isShallow != 'function' && thisArg && thisArg[isShallow] === array) ? null : isShallow; - isShallow = false; - } - if (callback != null) { - array = map(array, callback, thisArg); - } - return baseFlatten(array, isShallow); - } - - /** - * Gets the index at which the first occurrence of `value` is found using - * strict equality for comparisons, i.e. `===`. If the array is already sorted - * providing `true` for `fromIndex` will run a faster binary search. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {boolean|number} [fromIndex=0] The index to search from or `true` - * to perform a binary search on a sorted array. - * @returns {number} Returns the index of the matched value or `-1`. - * @example - * - * _.indexOf([1, 2, 3, 1, 2, 3], 2); - * // => 1 - * - * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3); - * // => 4 - * - * _.indexOf([1, 1, 2, 2, 3, 3], 2, true); - * // => 2 - */ - function indexOf(array, value, fromIndex) { - if (typeof fromIndex == 'number') { - var length = array ? array.length : 0; - fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0); - } else if (fromIndex) { - var index = sortedIndex(array, value); - return array[index] === value ? index : -1; - } - return baseIndexOf(array, value, fromIndex); - } - - /** - * Gets all but the last element or last `n` elements of an array. If a - * callback is provided elements at the end of the array are excluded from - * the result as long as the callback returns truey. The callback is bound - * to `thisArg` and invoked with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback=1] The function called - * per element or the number of elements to exclude. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a slice of `array`. - * @example - * - * _.initial([1, 2, 3]); - * // => [1, 2] - * - * _.initial([1, 2, 3], 2); - * // => [1] - * - * _.initial([1, 2, 3], function(num) { - * return num > 1; - * }); - * // => [1] - * - * var characters = [ - * { 'name': 'barney', 'blocked': false, 'employer': 'slate' }, - * { 'name': 'fred', 'blocked': true, 'employer': 'slate' }, - * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.initial(characters, 'blocked'); - * // => [{ 'name': 'barney', 'blocked': false, 'employer': 'slate' }] - * - * // using "_.where" callback shorthand - * _.pluck(_.initial(characters, { 'employer': 'na' }), 'name'); - * // => ['barney', 'fred'] - */ - function initial(array, callback, thisArg) { - var n = 0, - length = array ? array.length : 0; - - if (typeof callback != 'number' && callback != null) { - var index = length; - callback = lodash.createCallback(callback, thisArg, 3); - while (index-- && callback(array[index], index, array)) { - n++; - } - } else { - n = (callback == null || thisArg) ? 1 : callback || n; - } - return slice(array, 0, nativeMin(nativeMax(0, length - n), length)); - } - - /** - * Creates an array of unique values present in all provided arrays using - * strict equality for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {...Array} [array] The arrays to inspect. - * @returns {Array} Returns an array of shared values. - * @example - * - * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]); - * // => [1, 2] - */ - function intersection() { - var args = [], - argsIndex = -1, - argsLength = arguments.length, - caches = getArray(), - indexOf = getIndexOf(), - trustIndexOf = indexOf === baseIndexOf, - seen = getArray(); - - while (++argsIndex < argsLength) { - var value = arguments[argsIndex]; - if (isArray(value) || isArguments(value)) { - args.push(value); - caches.push(trustIndexOf && value.length >= largeArraySize && - createCache(argsIndex ? args[argsIndex] : seen)); - } - } - var array = args[0], - index = -1, - length = array ? array.length : 0, - result = []; - - outer: - while (++index < length) { - var cache = caches[0]; - value = array[index]; - - if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) { - argsIndex = argsLength; - (cache || seen).push(value); - while (--argsIndex) { - cache = caches[argsIndex]; - if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) { - continue outer; - } - } - result.push(value); - } - } - while (argsLength--) { - cache = caches[argsLength]; - if (cache) { - releaseObject(cache); - } - } - releaseArray(caches); - releaseArray(seen); - return result; - } - - /** - * Gets the last element or last `n` elements of an array. If a callback is - * provided elements at the end of the array are returned as long as the - * callback returns truey. The callback is bound to `thisArg` and invoked - * with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback] The function called - * per element or the number of elements to return. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {*} Returns the last element(s) of `array`. - * @example - * - * _.last([1, 2, 3]); - * // => 3 - * - * _.last([1, 2, 3], 2); - * // => [2, 3] - * - * _.last([1, 2, 3], function(num) { - * return num > 1; - * }); - * // => [2, 3] - * - * var characters = [ - * { 'name': 'barney', 'blocked': false, 'employer': 'slate' }, - * { 'name': 'fred', 'blocked': true, 'employer': 'slate' }, - * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.pluck(_.last(characters, 'blocked'), 'name'); - * // => ['fred', 'pebbles'] - * - * // using "_.where" callback shorthand - * _.last(characters, { 'employer': 'na' }); - * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }] - */ - function last(array, callback, thisArg) { - var n = 0, - length = array ? array.length : 0; - - if (typeof callback != 'number' && callback != null) { - var index = length; - callback = lodash.createCallback(callback, thisArg, 3); - while (index-- && callback(array[index], index, array)) { - n++; - } - } else { - n = callback; - if (n == null || thisArg) { - return array ? array[length - 1] : undefined; - } - } - return slice(array, nativeMax(0, length - n)); - } - - /** - * Gets the index at which the last occurrence of `value` is found using strict - * equality for comparisons, i.e. `===`. If `fromIndex` is negative, it is used - * as the offset from the end of the collection. - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to search. - * @param {*} value The value to search for. - * @param {number} [fromIndex=array.length-1] The index to search from. - * @returns {number} Returns the index of the matched value or `-1`. - * @example - * - * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2); - * // => 4 - * - * _.lastIndexOf([1, 2, 3, 1, 2, 3], 2, 3); - * // => 1 - */ - function lastIndexOf(array, value, fromIndex) { - var index = array ? array.length : 0; - if (typeof fromIndex == 'number') { - index = (fromIndex < 0 ? nativeMax(0, index + fromIndex) : nativeMin(fromIndex, index - 1)) + 1; - } - while (index--) { - if (array[index] === value) { - return index; - } - } - return -1; - } - - /** - * Removes all provided values from the given array using strict equality for - * comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to modify. - * @param {...*} [value] The values to remove. - * @returns {Array} Returns `array`. - * @example - * - * var array = [1, 2, 3, 1, 2, 3]; - * _.pull(array, 2, 3); - * console.log(array); - * // => [1, 1] - */ - function pull(array) { - var args = arguments, - argsIndex = 0, - argsLength = args.length, - length = array ? array.length : 0; - - while (++argsIndex < argsLength) { - var index = -1, - value = args[argsIndex]; - while (++index < length) { - if (array[index] === value) { - splice.call(array, index--, 1); - length--; - } - } - } - return array; - } - - /** - * Creates an array of numbers (positive and/or negative) progressing from - * `start` up to but not including `end`. If `start` is less than `stop` a - * zero-length range is created unless a negative `step` is specified. - * - * @static - * @memberOf _ - * @category Arrays - * @param {number} [start=0] The start of the range. - * @param {number} end The end of the range. - * @param {number} [step=1] The value to increment or decrement by. - * @returns {Array} Returns a new range array. - * @example - * - * _.range(4); - * // => [0, 1, 2, 3] - * - * _.range(1, 5); - * // => [1, 2, 3, 4] - * - * _.range(0, 20, 5); - * // => [0, 5, 10, 15] - * - * _.range(0, -4, -1); - * // => [0, -1, -2, -3] - * - * _.range(1, 4, 0); - * // => [1, 1, 1] - * - * _.range(0); - * // => [] - */ - function range(start, end, step) { - start = +start || 0; - step = typeof step == 'number' ? step : (+step || 1); - - if (end == null) { - end = start; - start = 0; - } - // use `Array(length)` so engines like Chakra and V8 avoid slower modes - // http://youtu.be/XAqIpGU8ZZk#t=17m25s - var index = -1, - length = nativeMax(0, ceil((end - start) / (step || 1))), - result = Array(length); - - while (++index < length) { - result[index] = start; - start += step; - } - return result; - } - - /** - * Removes all elements from an array that the callback returns truey for - * and returns an array of removed elements. The callback is bound to `thisArg` - * and invoked with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to modify. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a new array of removed elements. - * @example - * - * var array = [1, 2, 3, 4, 5, 6]; - * var evens = _.remove(array, function(num) { return num % 2 == 0; }); - * - * console.log(array); - * // => [1, 3, 5] - * - * console.log(evens); - * // => [2, 4, 6] - */ - function remove(array, callback, thisArg) { - var index = -1, - length = array ? array.length : 0, - result = []; - - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length) { - var value = array[index]; - if (callback(value, index, array)) { - result.push(value); - splice.call(array, index--, 1); - length--; - } - } - return result; - } - - /** - * The opposite of `_.initial` this method gets all but the first element or - * first `n` elements of an array. If a callback function is provided elements - * at the beginning of the array are excluded from the result as long as the - * callback returns truey. The callback is bound to `thisArg` and invoked - * with three arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias drop, tail - * @category Arrays - * @param {Array} array The array to query. - * @param {Function|Object|number|string} [callback=1] The function called - * per element or the number of elements to exclude. If a property name or - * object is provided it will be used to create a "_.pluck" or "_.where" - * style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a slice of `array`. - * @example - * - * _.rest([1, 2, 3]); - * // => [2, 3] - * - * _.rest([1, 2, 3], 2); - * // => [3] - * - * _.rest([1, 2, 3], function(num) { - * return num < 3; - * }); - * // => [3] - * - * var characters = [ - * { 'name': 'barney', 'blocked': true, 'employer': 'slate' }, - * { 'name': 'fred', 'blocked': false, 'employer': 'slate' }, - * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } - * ]; - * - * // using "_.pluck" callback shorthand - * _.pluck(_.rest(characters, 'blocked'), 'name'); - * // => ['fred', 'pebbles'] - * - * // using "_.where" callback shorthand - * _.rest(characters, { 'employer': 'slate' }); - * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }] - */ - function rest(array, callback, thisArg) { - if (typeof callback != 'number' && callback != null) { - var n = 0, - index = -1, - length = array ? array.length : 0; - - callback = lodash.createCallback(callback, thisArg, 3); - while (++index < length && callback(array[index], index, array)) { - n++; - } - } else { - n = (callback == null || thisArg) ? 1 : nativeMax(0, callback); - } - return slice(array, n); - } - - /** - * Uses a binary search to determine the smallest index at which a value - * should be inserted into a given sorted array in order to maintain the sort - * order of the array. If a callback is provided it will be executed for - * `value` and each element of `array` to compute their sort ranking. The - * callback is bound to `thisArg` and invoked with one argument; (value). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to inspect. - * @param {*} value The value to evaluate. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {number} Returns the index at which `value` should be inserted - * into `array`. - * @example - * - * _.sortedIndex([20, 30, 50], 40); - * // => 2 - * - * // using "_.pluck" callback shorthand - * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); - * // => 2 - * - * var dict = { - * 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 } - * }; - * - * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { - * return dict.wordToNumber[word]; - * }); - * // => 2 - * - * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { - * return this.wordToNumber[word]; - * }, dict); - * // => 2 - */ - function sortedIndex(array, value, callback, thisArg) { - var low = 0, - high = array ? array.length : low; - - // explicitly reference `identity` for better inlining in Firefox - callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity; - value = callback(value); - - while (low < high) { - var mid = (low + high) >>> 1; - (callback(array[mid]) < value) - ? low = mid + 1 - : high = mid; - } - return low; - } - - /** - * Creates an array of unique values, in order, of the provided arrays using - * strict equality for comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {...Array} [array] The arrays to inspect. - * @returns {Array} Returns an array of combined values. - * @example - * - * _.union([1, 2, 3], [5, 2, 1, 4], [2, 1]); - * // => [1, 2, 3, 5, 4] - */ - function union() { - return baseUniq(baseFlatten(arguments, true, true)); - } - - /** - * Creates a duplicate-value-free version of an array using strict equality - * for comparisons, i.e. `===`. If the array is sorted, providing - * `true` for `isSorted` will use a faster algorithm. If a callback is provided - * each element of `array` is passed through the callback before uniqueness - * is computed. The callback is bound to `thisArg` and invoked with three - * arguments; (value, index, array). - * - * If a property name is provided for `callback` the created "_.pluck" style - * callback will return the property value of the given element. - * - * If an object is provided for `callback` the created "_.where" style callback - * will return `true` for elements that have the properties of the given object, - * else `false`. - * - * @static - * @memberOf _ - * @alias unique - * @category Arrays - * @param {Array} array The array to process. - * @param {boolean} [isSorted=false] A flag to indicate that `array` is sorted. - * @param {Function|Object|string} [callback=identity] The function called - * per iteration. If a property name or object is provided it will be used - * to create a "_.pluck" or "_.where" style callback, respectively. - * @param {*} [thisArg] The `this` binding of `callback`. - * @returns {Array} Returns a duplicate-value-free array. - * @example - * - * _.uniq([1, 2, 1, 3, 1]); - * // => [1, 2, 3] - * - * _.uniq([1, 1, 2, 2, 3], true); - * // => [1, 2, 3] - * - * _.uniq(['A', 'b', 'C', 'a', 'B', 'c'], function(letter) { return letter.toLowerCase(); }); - * // => ['A', 'b', 'C'] - * - * _.uniq([1, 2.5, 3, 1.5, 2, 3.5], function(num) { return this.floor(num); }, Math); - * // => [1, 2.5, 3] - * - * // using "_.pluck" callback shorthand - * _.uniq([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }], 'x'); - * // => [{ 'x': 1 }, { 'x': 2 }] - */ - function uniq(array, isSorted, callback, thisArg) { - // juggle arguments - if (typeof isSorted != 'boolean' && isSorted != null) { - thisArg = callback; - callback = (typeof isSorted != 'function' && thisArg && thisArg[isSorted] === array) ? null : isSorted; - isSorted = false; - } - if (callback != null) { - callback = lodash.createCallback(callback, thisArg, 3); - } - return baseUniq(array, isSorted, callback); - } - - /** - * Creates an array excluding all provided values using strict equality for - * comparisons, i.e. `===`. - * - * @static - * @memberOf _ - * @category Arrays - * @param {Array} array The array to filter. - * @param {...*} [value] The values to exclude. - * @returns {Array} Returns a new array of filtered values. - * @example - * - * _.without([1, 2, 1, 0, 3, 1, 4], 0, 1); - * // => [2, 3, 4] - */ - function without(array) { - return baseDifference(array, slice(arguments, 1)); - } - - /** - * Creates an array that is the symmetric difference of the provided arrays. - * See http://en.wikipedia.org/wiki/Symmetric_difference. - * - * @static - * @memberOf _ - * @category Arrays - * @param {...Array} [array] The arrays to inspect. - * @returns {Array} Returns an array of values. - * @example - * - * _.xor([1, 2, 3], [5, 2, 1, 4]); - * // => [3, 5, 4] - * - * _.xor([1, 2, 5], [2, 3, 5], [3, 4, 5]); - * // => [1, 4, 5] - */ - function xor() { - var index = -1, - length = arguments.length; - - while (++index < length) { - var array = arguments[index]; - if (isArray(array) || isArguments(array)) { - var result = result - ? baseUniq(baseDifference(result, array).concat(baseDifference(array, result))) - : array; - } - } - return result || []; - } - - /** - * Creates an array of grouped elements, the first of which contains the first - * elements of the given arrays, the second of which contains the second - * elements of the given arrays, and so on. - * - * @static - * @memberOf _ - * @alias unzip - * @category Arrays - * @param {...Array} [array] Arrays to process. - * @returns {Array} Returns a new array of grouped elements. - * @example - * - * _.zip(['fred', 'barney'], [30, 40], [true, false]); - * // => [['fred', 30, true], ['barney', 40, false]] - */ - function zip() { - var array = arguments.length > 1 ? arguments : arguments[0], - index = -1, - length = array ? max(pluck(array, 'length')) : 0, - result = Array(length < 0 ? 0 : length); - - while (++index < length) { - result[index] = pluck(array, index); - } - return result; - } - - /** - * Creates an object composed from arrays of `keys` and `values`. Provide - * either a single two dimensional array, i.e. `[[key1, value1], [key2, value2]]` - * or two arrays, one of `keys` and one of corresponding `values`. - * - * @static - * @memberOf _ - * @alias object - * @category Arrays - * @param {Array} keys The array of keys. - * @param {Array} [values=[]] The array of values. - * @returns {Object} Returns an object composed of the given keys and - * corresponding values. - * @example - * - * _.zipObject(['fred', 'barney'], [30, 40]); - * // => { 'fred': 30, 'barney': 40 } - */ - function zipObject(keys, values) { - var index = -1, - length = keys ? keys.length : 0, - result = {}; - - if (!values && length && !isArray(keys[0])) { - values = []; - } - while (++index < length) { - var key = keys[index]; - if (values) { - result[key] = values[index]; - } else if (key) { - result[key[0]] = key[1]; - } - } - return result; - } - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a function that executes `func`, with the `this` binding and - * arguments of the created function, only after being called `n` times. - * - * @static - * @memberOf _ - * @category Functions - * @param {number} n The number of times the function must be called before - * `func` is executed. - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var saves = ['profile', 'settings']; - * - * var done = _.after(saves.length, function() { - * console.log('Done saving!'); - * }); - * - * _.forEach(saves, function(type) { - * asyncSave({ 'type': type, 'complete': done }); - * }); - * // => logs 'Done saving!', after all saves have completed - */ - function after(n, func) { - if (!isFunction(func)) { - throw new TypeError; - } - return function() { - if (--n < 1) { - return func.apply(this, arguments); - } - }; - } - - /** - * Creates a function that, when called, invokes `func` with the `this` - * binding of `thisArg` and prepends any additional `bind` arguments to those - * provided to the bound function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to bind. - * @param {*} [thisArg] The `this` binding of `func`. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var func = function(greeting) { - * return greeting + ' ' + this.name; - * }; - * - * func = _.bind(func, { 'name': 'fred' }, 'hi'); - * func(); - * // => 'hi fred' - */ - function bind(func, thisArg) { - return arguments.length > 2 - ? createWrapper(func, 17, slice(arguments, 2), null, thisArg) - : createWrapper(func, 1, null, null, thisArg); - } - - /** - * Binds methods of an object to the object itself, overwriting the existing - * method. Method names may be specified as individual arguments or as arrays - * of method names. If no method names are provided all the function properties - * of `object` will be bound. - * - * @static - * @memberOf _ - * @category Functions - * @param {Object} object The object to bind and assign the bound methods to. - * @param {...string} [methodName] The object method names to - * bind, specified as individual method names or arrays of method names. - * @returns {Object} Returns `object`. - * @example - * - * var view = { - * 'label': 'docs', - * 'onClick': function() { console.log('clicked ' + this.label); } - * }; - * - * _.bindAll(view); - * jQuery('#docs').on('click', view.onClick); - * // => logs 'clicked docs', when the button is clicked - */ - function bindAll(object) { - var funcs = arguments.length > 1 ? baseFlatten(arguments, true, false, 1) : functions(object), - index = -1, - length = funcs.length; - - while (++index < length) { - var key = funcs[index]; - object[key] = createWrapper(object[key], 1, null, null, object); - } - return object; - } - - /** - * Creates a function that, when called, invokes the method at `object[key]` - * and prepends any additional `bindKey` arguments to those provided to the bound - * function. This method differs from `_.bind` by allowing bound functions to - * reference methods that will be redefined or don't yet exist. - * See http://michaux.ca/articles/lazy-function-definition-pattern. - * - * @static - * @memberOf _ - * @category Functions - * @param {Object} object The object the method belongs to. - * @param {string} key The key of the method. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new bound function. - * @example - * - * var object = { - * 'name': 'fred', - * 'greet': function(greeting) { - * return greeting + ' ' + this.name; - * } - * }; - * - * var func = _.bindKey(object, 'greet', 'hi'); - * func(); - * // => 'hi fred' - * - * object.greet = function(greeting) { - * return greeting + 'ya ' + this.name + '!'; - * }; - * - * func(); - * // => 'hiya fred!' - */ - function bindKey(object, key) { - return arguments.length > 2 - ? createWrapper(key, 19, slice(arguments, 2), null, object) - : createWrapper(key, 3, null, null, object); - } - - /** - * Creates a function that is the composition of the provided functions, - * where each function consumes the return value of the function that follows. - * For example, composing the functions `f()`, `g()`, and `h()` produces `f(g(h()))`. - * Each function is executed with the `this` binding of the composed function. - * - * @static - * @memberOf _ - * @category Functions - * @param {...Function} [func] Functions to compose. - * @returns {Function} Returns the new composed function. - * @example - * - * var realNameMap = { - * 'pebbles': 'penelope' - * }; - * - * var format = function(name) { - * name = realNameMap[name.toLowerCase()] || name; - * return name.charAt(0).toUpperCase() + name.slice(1).toLowerCase(); - * }; - * - * var greet = function(formatted) { - * return 'Hiya ' + formatted + '!'; - * }; - * - * var welcome = _.compose(greet, format); - * welcome('pebbles'); - * // => 'Hiya Penelope!' - */ - function compose() { - var funcs = arguments, - length = funcs.length; - - while (length--) { - if (!isFunction(funcs[length])) { - throw new TypeError; - } - } - return function() { - var args = arguments, - length = funcs.length; - - while (length--) { - args = [funcs[length].apply(this, args)]; - } - return args[0]; - }; - } - - /** - * Creates a function which accepts one or more arguments of `func` that when - * invoked either executes `func` returning its result, if all `func` arguments - * have been provided, or returns a function that accepts one or more of the - * remaining `func` arguments, and so on. The arity of `func` can be specified - * if `func.length` is not sufficient. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to curry. - * @param {number} [arity=func.length] The arity of `func`. - * @returns {Function} Returns the new curried function. - * @example - * - * var curried = _.curry(function(a, b, c) { - * console.log(a + b + c); - * }); - * - * curried(1)(2)(3); - * // => 6 - * - * curried(1, 2)(3); - * // => 6 - * - * curried(1, 2, 3); - * // => 6 - */ - function curry(func, arity) { - arity = typeof arity == 'number' ? arity : (+arity || func.length); - return createWrapper(func, 4, null, null, null, arity); - } - - /** - * Creates a function that will delay the execution of `func` until after - * `wait` milliseconds have elapsed since the last time it was invoked. - * Provide an options object to indicate that `func` should be invoked on - * the leading and/or trailing edge of the `wait` timeout. Subsequent calls - * to the debounced function will return the result of the last `func` call. - * - * Note: If `leading` and `trailing` options are `true` `func` will be called - * on the trailing edge of the timeout only if the the debounced function is - * invoked more than once during the `wait` timeout. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to debounce. - * @param {number} wait The number of milliseconds to delay. - * @param {Object} [options] The options object. - * @param {boolean} [options.leading=false] Specify execution on the leading edge of the timeout. - * @param {number} [options.maxWait] The maximum time `func` is allowed to be delayed before it's called. - * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // avoid costly calculations while the window size is in flux - * var lazyLayout = _.debounce(calculateLayout, 150); - * jQuery(window).on('resize', lazyLayout); - * - * // execute `sendMail` when the click event is fired, debouncing subsequent calls - * jQuery('#postbox').on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * }); - * - * // ensure `batchLog` is executed once after 1 second of debounced calls - * var source = new EventSource('/stream'); - * source.addEventListener('message', _.debounce(batchLog, 250, { - * 'maxWait': 1000 - * }, false); - */ - function debounce(func, wait, options) { - var args, - maxTimeoutId, - result, - stamp, - thisArg, - timeoutId, - trailingCall, - lastCalled = 0, - maxWait = false, - trailing = true; - - if (!isFunction(func)) { - throw new TypeError; - } - wait = nativeMax(0, wait) || 0; - if (options === true) { - var leading = true; - trailing = false; - } else if (isObject(options)) { - leading = options.leading; - maxWait = 'maxWait' in options && (nativeMax(wait, options.maxWait) || 0); - trailing = 'trailing' in options ? options.trailing : trailing; - } - var delayed = function() { - var remaining = wait - (now() - stamp); - if (remaining <= 0) { - if (maxTimeoutId) { - clearTimeout(maxTimeoutId); - } - var isCalled = trailingCall; - maxTimeoutId = timeoutId = trailingCall = undefined; - if (isCalled) { - lastCalled = now(); - result = func.apply(thisArg, args); - if (!timeoutId && !maxTimeoutId) { - args = thisArg = null; - } - } - } else { - timeoutId = setTimeout(delayed, remaining); - } - }; - - var maxDelayed = function() { - if (timeoutId) { - clearTimeout(timeoutId); - } - maxTimeoutId = timeoutId = trailingCall = undefined; - if (trailing || (maxWait !== wait)) { - lastCalled = now(); - result = func.apply(thisArg, args); - if (!timeoutId && !maxTimeoutId) { - args = thisArg = null; - } - } - }; - - return function() { - args = arguments; - stamp = now(); - thisArg = this; - trailingCall = trailing && (timeoutId || !leading); - - if (maxWait === false) { - var leadingCall = leading && !timeoutId; - } else { - if (!maxTimeoutId && !leading) { - lastCalled = stamp; - } - var remaining = maxWait - (stamp - lastCalled), - isCalled = remaining <= 0; - - if (isCalled) { - if (maxTimeoutId) { - maxTimeoutId = clearTimeout(maxTimeoutId); - } - lastCalled = stamp; - result = func.apply(thisArg, args); - } - else if (!maxTimeoutId) { - maxTimeoutId = setTimeout(maxDelayed, remaining); - } - } - if (isCalled && timeoutId) { - timeoutId = clearTimeout(timeoutId); - } - else if (!timeoutId && wait !== maxWait) { - timeoutId = setTimeout(delayed, wait); - } - if (leadingCall) { - isCalled = true; - result = func.apply(thisArg, args); - } - if (isCalled && !timeoutId && !maxTimeoutId) { - args = thisArg = null; - } - return result; - }; - } - - /** - * Defers executing the `func` function until the current call stack has cleared. - * Additional arguments will be provided to `func` when it is invoked. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to defer. - * @param {...*} [arg] Arguments to invoke the function with. - * @returns {number} Returns the timer id. - * @example - * - * _.defer(function(text) { console.log(text); }, 'deferred'); - * // logs 'deferred' after one or more milliseconds - */ - function defer(func) { - if (!isFunction(func)) { - throw new TypeError; - } - var args = slice(arguments, 1); - return setTimeout(function() { func.apply(undefined, args); }, 1); - } - - /** - * Executes the `func` function after `wait` milliseconds. Additional arguments - * will be provided to `func` when it is invoked. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to delay. - * @param {number} wait The number of milliseconds to delay execution. - * @param {...*} [arg] Arguments to invoke the function with. - * @returns {number} Returns the timer id. - * @example - * - * _.delay(function(text) { console.log(text); }, 1000, 'later'); - * // => logs 'later' after one second - */ - function delay(func, wait) { - if (!isFunction(func)) { - throw new TypeError; - } - var args = slice(arguments, 2); - return setTimeout(function() { func.apply(undefined, args); }, wait); - } - - /** - * Creates a function that memoizes the result of `func`. If `resolver` is - * provided it will be used to determine the cache key for storing the result - * based on the arguments provided to the memoized function. By default, the - * first argument provided to the memoized function is used as the cache key. - * The `func` is executed with the `this` binding of the memoized function. - * The result cache is exposed as the `cache` property on the memoized function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to have its output memoized. - * @param {Function} [resolver] A function used to resolve the cache key. - * @returns {Function} Returns the new memoizing function. - * @example - * - * var fibonacci = _.memoize(function(n) { - * return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2); - * }); - * - * fibonacci(9) - * // => 34 - * - * var data = { - * 'fred': { 'name': 'fred', 'age': 40 }, - * 'pebbles': { 'name': 'pebbles', 'age': 1 } - * }; - * - * // modifying the result cache - * var get = _.memoize(function(name) { return data[name]; }, _.identity); - * get('pebbles'); - * // => { 'name': 'pebbles', 'age': 1 } - * - * get.cache.pebbles.name = 'penelope'; - * get('pebbles'); - * // => { 'name': 'penelope', 'age': 1 } - */ - function memoize(func, resolver) { - if (!isFunction(func)) { - throw new TypeError; - } - var memoized = function() { - var cache = memoized.cache, - key = resolver ? resolver.apply(this, arguments) : keyPrefix + arguments[0]; - - return hasOwnProperty.call(cache, key) - ? cache[key] - : (cache[key] = func.apply(this, arguments)); - } - memoized.cache = {}; - return memoized; - } - - /** - * Creates a function that is restricted to execute `func` once. Repeat calls to - * the function will return the value of the first call. The `func` is executed - * with the `this` binding of the created function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to restrict. - * @returns {Function} Returns the new restricted function. - * @example - * - * var initialize = _.once(createApplication); - * initialize(); - * initialize(); - * // `initialize` executes `createApplication` once - */ - function once(func) { - var ran, - result; - - if (!isFunction(func)) { - throw new TypeError; - } - return function() { - if (ran) { - return result; - } - ran = true; - result = func.apply(this, arguments); - - // clear the `func` variable so the function may be garbage collected - func = null; - return result; - }; - } - - /** - * Creates a function that, when called, invokes `func` with any additional - * `partial` arguments prepended to those provided to the new function. This - * method is similar to `_.bind` except it does **not** alter the `this` binding. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * var greet = function(greeting, name) { return greeting + ' ' + name; }; - * var hi = _.partial(greet, 'hi'); - * hi('fred'); - * // => 'hi fred' - */ - function partial(func) { - return createWrapper(func, 16, slice(arguments, 1)); - } - - /** - * This method is like `_.partial` except that `partial` arguments are - * appended to those provided to the new function. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to partially apply arguments to. - * @param {...*} [arg] Arguments to be partially applied. - * @returns {Function} Returns the new partially applied function. - * @example - * - * var defaultsDeep = _.partialRight(_.merge, _.defaults); - * - * var options = { - * 'variable': 'data', - * 'imports': { 'jq': $ } - * }; - * - * defaultsDeep(options, _.templateSettings); - * - * options.variable - * // => 'data' - * - * options.imports - * // => { '_': _, 'jq': $ } - */ - function partialRight(func) { - return createWrapper(func, 32, null, slice(arguments, 1)); - } - - /** - * Creates a function that, when executed, will only call the `func` function - * at most once per every `wait` milliseconds. Provide an options object to - * indicate that `func` should be invoked on the leading and/or trailing edge - * of the `wait` timeout. Subsequent calls to the throttled function will - * return the result of the last `func` call. - * - * Note: If `leading` and `trailing` options are `true` `func` will be called - * on the trailing edge of the timeout only if the the throttled function is - * invoked more than once during the `wait` timeout. - * - * @static - * @memberOf _ - * @category Functions - * @param {Function} func The function to throttle. - * @param {number} wait The number of milliseconds to throttle executions to. - * @param {Object} [options] The options object. - * @param {boolean} [options.leading=true] Specify execution on the leading edge of the timeout. - * @param {boolean} [options.trailing=true] Specify execution on the trailing edge of the timeout. - * @returns {Function} Returns the new throttled function. - * @example - * - * // avoid excessively updating the position while scrolling - * var throttled = _.throttle(updatePosition, 100); - * jQuery(window).on('scroll', throttled); - * - * // execute `renewToken` when the click event is fired, but not more than once every 5 minutes - * jQuery('.interactive').on('click', _.throttle(renewToken, 300000, { - * 'trailing': false - * })); - */ - function throttle(func, wait, options) { - var leading = true, - trailing = true; - - if (!isFunction(func)) { - throw new TypeError; - } - if (options === false) { - leading = false; - } else if (isObject(options)) { - leading = 'leading' in options ? options.leading : leading; - trailing = 'trailing' in options ? options.trailing : trailing; - } - debounceOptions.leading = leading; - debounceOptions.maxWait = wait; - debounceOptions.trailing = trailing; - - return debounce(func, wait, debounceOptions); - } - - /** - * Creates a function that provides `value` to the wrapper function as its - * first argument. Additional arguments provided to the function are appended - * to those provided to the wrapper function. The wrapper is executed with - * the `this` binding of the created function. - * - * @static - * @memberOf _ - * @category Functions - * @param {*} value The value to wrap. - * @param {Function} wrapper The wrapper function. - * @returns {Function} Returns the new function. - * @example - * - * var p = _.wrap(_.escape, function(func, text) { - * return '

    ' + func(text) + '

    '; - * }); - * - * p('Fred, Wilma, & Pebbles'); - * // => '

    Fred, Wilma, & Pebbles

    ' - */ - function wrap(value, wrapper) { - return createWrapper(wrapper, 16, [value]); - } - - /*--------------------------------------------------------------------------*/ - - /** - * Creates a function that returns `value`. - * - * @static - * @memberOf _ - * @category Utilities - * @param {*} value The value to return from the new function. - * @returns {Function} Returns the new function. - * @example - * - * var object = { 'name': 'fred' }; - * var getter = _.constant(object); - * getter() === object; - * // => true - */ - function constant(value) { - return function() { - return value; - }; - } - - /** - * Produces a callback bound to an optional `thisArg`. If `func` is a property - * name the created callback will return the property value for a given element. - * If `func` is an object the created callback will return `true` for elements - * that contain the equivalent object properties, otherwise it will return `false`. - * - * @static - * @memberOf _ - * @category Utilities - * @param {*} [func=identity] The value to convert to a callback. - * @param {*} [thisArg] The `this` binding of the created callback. - * @param {number} [argCount] The number of arguments the callback accepts. - * @returns {Function} Returns a callback function. - * @example - * - * var characters = [ - * { 'name': 'barney', 'age': 36 }, - * { 'name': 'fred', 'age': 40 } - * ]; - * - * // wrap to create custom callback shorthands - * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) { - * var match = /^(.+?)__([gl]t)(.+)$/.exec(callback); - * return !match ? func(callback, thisArg) : function(object) { - * return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3]; - * }; - * }); - * - * _.filter(characters, 'age__gt38'); - * // => [{ 'name': 'fred', 'age': 40 }] - */ - function createCallback(func, thisArg, argCount) { - var type = typeof func; - if (func == null || type == 'function') { - return baseCreateCallback(func, thisArg, argCount); - } - // handle "_.pluck" style callback shorthands - if (type != 'object') { - return property(func); - } - var props = keys(func), - key = props[0], - a = func[key]; - - // handle "_.where" style callback shorthands - if (props.length == 1 && a === a && !isObject(a)) { - // fast path the common case of providing an object with a single - // property containing a primitive value - return function(object) { - var b = object[key]; - return a === b && (a !== 0 || (1 / a == 1 / b)); - }; - } - return function(object) { - var length = props.length, - result = false; - - while (length--) { - if (!(result = baseIsEqual(object[props[length]], func[props[length]], null, true))) { - break; - } - } - return result; - }; - } - - /** - * Converts the characters `&`, `<`, `>`, `"`, and `'` in `string` to their - * corresponding HTML entities. - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} string The string to escape. - * @returns {string} Returns the escaped string. - * @example - * - * _.escape('Fred, Wilma, & Pebbles'); - * // => 'Fred, Wilma, & Pebbles' - */ - function escape(string) { - return string == null ? '' : String(string).replace(reUnescapedHtml, escapeHtmlChar); - } - - /** - * This method returns the first argument provided to it. - * - * @static - * @memberOf _ - * @category Utilities - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'name': 'fred' }; - * _.identity(object) === object; - * // => true - */ - function identity(value) { - return value; - } - - /** - * Adds function properties of a source object to the destination object. - * If `object` is a function methods will be added to its prototype as well. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Function|Object} [object=lodash] object The destination object. - * @param {Object} source The object of functions to add. - * @param {Object} [options] The options object. - * @param {boolean} [options.chain=true] Specify whether the functions added are chainable. - * @example - * - * function capitalize(string) { - * return string.charAt(0).toUpperCase() + string.slice(1).toLowerCase(); - * } - * - * _.mixin({ 'capitalize': capitalize }); - * _.capitalize('fred'); - * // => 'Fred' - * - * _('fred').capitalize().value(); - * // => 'Fred' - * - * _.mixin({ 'capitalize': capitalize }, { 'chain': false }); - * _('fred').capitalize(); - * // => 'Fred' - */ - function mixin(object, source, options) { - var chain = true, - methodNames = source && functions(source); - - if (!source || (!options && !methodNames.length)) { - if (options == null) { - options = source; - } - ctor = lodashWrapper; - source = object; - object = lodash; - methodNames = functions(source); - } - if (options === false) { - chain = false; - } else if (isObject(options) && 'chain' in options) { - chain = options.chain; - } - var ctor = object, - isFunc = isFunction(ctor); - - forEach(methodNames, function(methodName) { - var func = object[methodName] = source[methodName]; - if (isFunc) { - ctor.prototype[methodName] = function() { - var chainAll = this.__chain__, - value = this.__wrapped__, - args = [value]; - - push.apply(args, arguments); - var result = func.apply(object, args); - if (chain || chainAll) { - if (value === result && isObject(result)) { - return this; - } - result = new ctor(result); - result.__chain__ = chainAll; - } - return result; - }; - } - }); - } - - /** - * Reverts the '_' variable to its previous value and returns a reference to - * the `lodash` function. - * - * @static - * @memberOf _ - * @category Utilities - * @returns {Function} Returns the `lodash` function. - * @example - * - * var lodash = _.noConflict(); - */ - function noConflict() { - context._ = oldDash; - return this; - } - - /** - * A no-operation function. - * - * @static - * @memberOf _ - * @category Utilities - * @example - * - * var object = { 'name': 'fred' }; - * _.noop(object) === undefined; - * // => true - */ - function noop() { - // no operation performed - } - - /** - * Gets the number of milliseconds that have elapsed since the Unix epoch - * (1 January 1970 00:00:00 UTC). - * - * @static - * @memberOf _ - * @category Utilities - * @example - * - * var stamp = _.now(); - * _.defer(function() { console.log(_.now() - stamp); }); - * // => logs the number of milliseconds it took for the deferred function to be called - */ - var now = isNative(now = Date.now) && now || function() { - return new Date().getTime(); - }; - - /** - * Converts the given value into an integer of the specified radix. - * If `radix` is `undefined` or `0` a `radix` of `10` is used unless the - * `value` is a hexadecimal, in which case a `radix` of `16` is used. - * - * Note: This method avoids differences in native ES3 and ES5 `parseInt` - * implementations. See http://es5.github.io/#E. - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} value The value to parse. - * @param {number} [radix] The radix used to interpret the value to parse. - * @returns {number} Returns the new integer value. - * @example - * - * _.parseInt('08'); - * // => 8 - */ - var parseInt = nativeParseInt(whitespace + '08') == 8 ? nativeParseInt : function(value, radix) { - // Firefox < 21 and Opera < 15 follow the ES3 specified implementation of `parseInt` - return nativeParseInt(isString(value) ? value.replace(reLeadingSpacesAndZeros, '') : value, radix || 0); - }; - - /** - * Creates a "_.pluck" style function, which returns the `key` value of a - * given object. - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} key The name of the property to retrieve. - * @returns {Function} Returns the new function. - * @example - * - * var characters = [ - * { 'name': 'fred', 'age': 40 }, - * { 'name': 'barney', 'age': 36 } - * ]; - * - * var getName = _.property('name'); - * - * _.map(characters, getName); - * // => ['barney', 'fred'] - * - * _.sortBy(characters, getName); - * // => [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }] - */ - function property(key) { - return function(object) { - return object[key]; - }; - } - - /** - * Produces a random number between `min` and `max` (inclusive). If only one - * argument is provided a number between `0` and the given number will be - * returned. If `floating` is truey or either `min` or `max` are floats a - * floating-point number will be returned instead of an integer. - * - * @static - * @memberOf _ - * @category Utilities - * @param {number} [min=0] The minimum possible value. - * @param {number} [max=1] The maximum possible value. - * @param {boolean} [floating=false] Specify returning a floating-point number. - * @returns {number} Returns a random number. - * @example - * - * _.random(0, 5); - * // => an integer between 0 and 5 - * - * _.random(5); - * // => also an integer between 0 and 5 - * - * _.random(5, true); - * // => a floating-point number between 0 and 5 - * - * _.random(1.2, 5.2); - * // => a floating-point number between 1.2 and 5.2 - */ - function random(min, max, floating) { - var noMin = min == null, - noMax = max == null; - - if (floating == null) { - if (typeof min == 'boolean' && noMax) { - floating = min; - min = 1; - } - else if (!noMax && typeof max == 'boolean') { - floating = max; - noMax = true; - } - } - if (noMin && noMax) { - max = 1; - } - min = +min || 0; - if (noMax) { - max = min; - min = 0; - } else { - max = +max || 0; - } - if (floating || min % 1 || max % 1) { - var rand = nativeRandom(); - return nativeMin(min + (rand * (max - min + parseFloat('1e-' + ((rand +'').length - 1)))), max); - } - return baseRandom(min, max); - } - - /** - * Resolves the value of property `key` on `object`. If `key` is a function - * it will be invoked with the `this` binding of `object` and its result returned, - * else the property value is returned. If `object` is falsey then `undefined` - * is returned. - * - * @static - * @memberOf _ - * @category Utilities - * @param {Object} object The object to inspect. - * @param {string} key The name of the property to resolve. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { - * 'cheese': 'crumpets', - * 'stuff': function() { - * return 'nonsense'; - * } - * }; - * - * _.result(object, 'cheese'); - * // => 'crumpets' - * - * _.result(object, 'stuff'); - * // => 'nonsense' - */ - function result(object, key) { - if (object) { - var value = object[key]; - return isFunction(value) ? object[key]() : value; - } - } - - /** - * A micro-templating method that handles arbitrary delimiters, preserves - * whitespace, and correctly escapes quotes within interpolated code. - * - * Note: In the development build, `_.template` utilizes sourceURLs for easier - * debugging. See http://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl - * - * For more information on precompiling templates see: - * http://lodash.com/custom-builds - * - * For more information on Chrome extension sandboxes see: - * http://developer.chrome.com/stable/extensions/sandboxingEval.html - * - * @static - * @memberOf _ - * @category Utilities - * @param {string} text The template text. - * @param {Object} data The data object used to populate the text. - * @param {Object} [options] The options object. - * @param {RegExp} [options.escape] The "escape" delimiter. - * @param {RegExp} [options.evaluate] The "evaluate" delimiter. - * @param {Object} [options.imports] An object to import into the template as local variables. - * @param {RegExp} [options.interpolate] The "interpolate" delimiter. - * @param {string} [sourceURL] The sourceURL of the template's compiled source. - * @param {string} [variable] The data object variable name. - * @returns {Function|string} Returns a compiled function when no `data` object - * is given, else it returns the interpolated text. - * @example - * - * // using the "interpolate" delimiter to create a compiled template - * var compiled = _.template('hello <%= name %>'); - * compiled({ 'name': 'fred' }); - * // => 'hello fred' - * - * // using the "escape" delimiter to escape HTML in data property values - * _.template('<%- value %>', { 'value': '