(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Witstroom=f()}})(function(){var define,module,exports;return(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){"use strict";exports.__esModule=true;var bluebird_1=require("bluebird");function base(wnd){if(!document.createEvent){wnd.document.createEvent=wnd.document.createEventObject;}
if(!wnd.Promise){wnd.Promise=bluebird_1.Promise;}
if(!wnd.JSON){wnd.JSON={};wnd.JSON.stringify=function(obj){var t=typeof obj;if(t!="object"||obj===null){if(t=="string")
obj='"'+obj+'"';return String(obj);}
else{var n,v,json=[],arr=obj&&obj.constructor==Array;for(n in obj){v=obj[n];t=typeof v;if(t=="string")
v='"'+v+'"';else if(t=="object"&&v!==null)
v=JSON.stringify(v);json.push((arr?"":'"'+n+'":')+String(v));}
return(arr?"[":"{")+String(json)+(arr?"]":"}");}};wnd.JSON.parse=function(str){if(str==="")
str='""';eval("var p="+str+";");return bluebird_1.Promise;};}
if(!wnd.Element){wnd.Element=function(){};var __createElement=document.createElement;document.createElement=function(tagName){var element=__createElement(tagName);if(element==null){return null;}
for(var key in Element.prototype)
element[key]=Element.prototype[key];return element;};var __getElementById=document.getElementById;document.getElementById=function(id){var element=__getElementById(id);if(element==null){return null;}
for(var key in Element.prototype)
element[key]=Element.prototype[key];return element;};}
if(!Function.prototype.bind){Function.prototype.bind=function(oThis){if(typeof this!=="function"){throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");}
var aArgs=Array.prototype.slice.call(arguments,1),fToBind=this,fNOP=function(){},fBound=function(){return fToBind.apply(this instanceof fNOP&&oThis?this:oThis,aArgs.concat(Array.prototype.slice.call(arguments)));};fNOP.prototype=this.prototype;fBound.prototype=new fNOP();return fBound;};}}
exports.base=base;},{"bluebird":14}],2:[function(require,module,exports){"use strict";var __extends=(this&&this.__extends)||(function(){var extendStatics=Object.setPrototypeOf||({__proto__:[]}instanceof Array&&function(d,b){d.__proto__=b;})||function(d,b){for(var p in b)if(b.hasOwnProperty(p))d[p]=b[p];};return function(d,b){extendStatics(d,b);function __(){this.constructor=d;}
d.prototype=b===null?Object.create(b):(__.prototype=b.prototype,new __());};})();var __awaiter=(this&&this.__awaiter)||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value));}catch(e){reject(e);}}
function rejected(value){try{step(generator["throw"](value));}catch(e){reject(e);}}
function step(result){result.done?resolve(result.value):new P(function(resolve){resolve(result.value);}).then(fulfilled,rejected);}
step((generator=generator.apply(thisArg,_arguments||[])).next());});};var __generator=(this&&this.__generator)||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1];},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this;}),g;function verb(n){return function(v){return step([n,v]);};}
function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=y[op[0]&2?"return":op[0]?"throw":"next"])&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[0,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue;}
if(op[0]===3&&(!t||(op[1]>t[0]&&op[1]<t[3]))){_.label=op[1];break;}
if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break;}
if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break;}
if(t[2])_.ops.pop();_.trys.pop();continue;}
op=body.call(thisArg,_);}catch(e){op=[6,e];y=0;}finally{f=t=0;}
if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true};}};exports.__esModule=true;var http_1=require("./http");var events_1=require("events");var Client=(function(_super){__extends(Client,_super);function Client(uri,id){var _this=_super.call(this)||this;_this._initialized=false;_this._id=id;_this._uri=uri+"/visit";return _this;}
Client.prototype.on=function(ev,callback){_super.prototype.on.call(this,ev,callback);};Client.prototype.check=function(href,i,u,f){return __awaiter(this,void 0,void 0,function(){var elements,result;return __generator(this,function(_a){switch(_a.label){case 0:elements={i:i,u:u,f:f};return[4,http_1.Http.post_statusData(href,elements)];case 1:result=_a.sent();return[2,result];}});});};return Client;}(events_1.EventEmitter));exports.Client=Client;},{"./http":7,"events":15}],3:[function(require,module,exports){"use strict";exports.__esModule=true;var EverCookieOptions=(function(){function EverCookieOptions(){var host=window.location.host;if(host.indexOf("www.")>=0){host=host.split("www.")[1];}
this.domain=host.replace(/:\d+/,"");}
return EverCookieOptions;}());exports.EverCookieOptions=EverCookieOptions;},{}],4:[function(require,module,exports){"use strict";exports.__esModule=true;var Cookie=(function(){function Cookie(options){this._options=options;}
Cookie.prototype.set=function(key,value){this.cookie(key,value);};Cookie.prototype.get=function(key){return Promise.resolve(this.cookie(key));};Cookie.prototype["delete"]=function(key){document.cookie=key+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC;";};Cookie.prototype.cookie=function(key,value){if(value===void 0){value=undefined;}
if(value!==undefined){document.cookie=key+"=; expires=Mon, 20 Sep 2010 00:00:00 UTC; path=/; domain="+
this._options.domain;document.cookie=key+"="+
value+"; expires=Tue, 31 Dec 2099 00:00:00 UTC; path=/; domain="+
this._options.domain;return value;}
else{return this.getFromStr(key,document.cookie);}};Cookie.prototype.getFromStr=function(name,text){if(typeof text!=="string"){return;}
var nameEQ=name+"=",ca=text.split(/[;&]/),i,c;for(i=0;i<ca.length;i++){c=ca[i];while(c.charAt(0)===" "){c=c.substring(1,c.length);}
if(c.indexOf(nameEQ)===0){return c.substring(nameEQ.length,c.length);}}};return Cookie;}());exports.Cookie=Cookie;},{}],5:[function(require,module,exports){"use strict";exports.__esModule=true;var fingerprintData_1=require("./fingerprintData");var ua_parser_js_1=require("ua-parser-js");var fp_new=new fingerprintData_1.Fingerprint2();var Fingerprint=(function(){function Fingerprint(value,components){this.value=value;this.components=components;}
Fingerprint.prototype.getValue=function(){return this.value;};Fingerprint.prototype.getComponents=function(){return this.components;};Fingerprint.get=function(){function joinFingerprintObjects(array,sep){var res="";for(var i=0;i<array.length;i++){var obj=array[i];if(res!="")
res+=sep;res+=obj.key+","+obj.value;}
return res;}
function getFonts(){var baseFonts=["monospace","sans-serif","serif"];var fontList=["Andale Mono","Arial","Arial Black","Arial Hebrew","Arial MT","Arial Narrow","Arial Rounded MT Bold","Arial Unicode MS","Bitstream Vera Sans Mono","Book Antiqua","Bookman Old Style","Calibri","Cambria","Cambria Math","Century","Century Gothic","Century Schoolbook","Comic Sans","Comic Sans MS","Consolas","Courier","Courier New","Garamond","Geneva","Georgia","Helvetica","Helvetica Neue","Impact","Lucida Bright","Lucida Calligraphy","Lucida Console","Lucida Fax","LUCIDA GRANDE","Lucida Handwriting","Lucida Sans","Lucida Sans Typewriter","Lucida Sans Unicode","Microsoft Sans Serif","Monaco","Monotype Corsiva","MS Gothic","MS Outlook","MS PGothic","MS Reference Sans Serif","MS Sans Serif","MS Serif","MYRIAD","MYRIAD PRO","Palatino","Palatino Linotype","Segoe Print","Segoe Script","Segoe UI","Segoe UI Light","Segoe UI Semibold","Segoe UI Symbol","Tahoma","Times","Times New Roman","Times New Roman PS","Trebuchet MS","Verdana","Wingdings","Wingdings 2","Wingdings 3",];fontList=fontList.filter(function(font,position){return fontList.indexOf(font)===position;});var testString="mmmmmmmmmmlli";var testSize="72px";var h=document.getElementsByTagName("html")[0];var baseFontsDiv=document.createElement("div");var fontsDiv=document.createElement("div");var defaultWidth={};var defaultHeight={};var createSpan=function(){var s=document.createElement("span");s.style.position="absolute";s.style.left="-9999px";s.style.fontSize=testSize;s.style.lineHeight="normal";s.innerHTML=testString;return s;};var createSpanWithFonts=function(fontToDetect,baseFont){var s=createSpan();s.style.fontFamily="'"+fontToDetect+"',"+baseFont;return s;};var initializeBaseFontsSpans=function(){var spans=[];for(var index=0,length=baseFonts.length;index<length;index++){var s=createSpan();s.style.fontFamily=baseFonts[index];baseFontsDiv.appendChild(s);spans.push(s);}
return spans;};var initializeFontsSpans=function(){var spans={};for(var i=0,l=fontList.length;i<l;i++){var fontSpans=[];for(var j=0,numDefaultFonts=baseFonts.length;j<numDefaultFonts;j++){var s=createSpanWithFonts(fontList[i],baseFonts[j]);fontsDiv.appendChild(s);fontSpans.push(s);}
spans[fontList[i]]=fontSpans;}
return spans;};var isFontAvailable=function(fontSpans){var detected=false;for(var i=0;i<baseFonts.length;i++){detected=fontSpans[i].offsetWidth!==defaultWidth[baseFonts[i]]||fontSpans[i].offsetHeight!==defaultHeight[baseFonts[i]];if(detected){return detected;}}
return detected;};var baseFontsSpans=initializeBaseFontsSpans();h.appendChild(baseFontsDiv);for(var index=0,length=baseFonts.length;index<length;index++){defaultWidth[baseFonts[index]]=baseFontsSpans[index].offsetWidth;defaultHeight[baseFonts[index]]=baseFontsSpans[index].offsetHeight;}
var fontsSpans=initializeFontsSpans();h.appendChild(fontsDiv);var available=[];for(var i=0,l=fontList.length;i<l;i++){if(isFontAvailable(fontsSpans[fontList[i]])){available.push(fontList[i]);}}
h.removeChild(fontsDiv);h.removeChild(baseFontsDiv);return available;}
function getWebglCanvas(){var canvas=document.createElement("canvas");var gl=null;try{gl=canvas.getContext("webgl")||canvas.getContext("experimental-webgl");}
catch(e){}
if(!gl){gl=null;}
return gl;}
function getWebglVendorAndRenderer(){try{var glContext=getWebglCanvas();var extensionDebugRendererInfo=glContext.getExtension("WEBGL_debug_renderer_info");return(glContext.getParameter(extensionDebugRendererInfo.UNMASKED_VENDOR_WEBGL)+"~"+
glContext.getParameter(extensionDebugRendererInfo.UNMASKED_RENDERER_WEBGL));}
catch(e){return null;}}
function getBrowserName(){var userAgent=navigator.userAgent;if(userAgent.indexOf("MiuiBrowser")>=0){return"MiuiBrowser";}
else if(userAgent.indexOf("NetCast")>=0){return"NetCast";}
var parser=new ua_parser_js_1.UAParser(userAgent);var result=parser.getResult();return result.browser.name;}
var f;var nav=navigator;(function(){return fp_new.get({NOT_AVAILABLE:null,ERROR:null,excludes:{userAgent:true,timezone:true,timezoneOffset:true,adBlock:true,doNotTrack:true,hasLiedBrowser:true,hasLiedLanguages:true,hasLiedOs:true,hasLiedResolution:true},extraComponents:[{key:"vendor",getData:function(done,options){if(nav.vendor==undefined){done("not available");}
else
done(nav.vendor);}},{key:"productSub",getData:function(done,options){var p=nav.productSub;if(p==undefined||typeof(p)!='string'){done("not available");}
else
done(p);}},{key:"pluginsBool",getData:function(done,options){done(nav.plugins!=null&&nav.plugins!=undefined);}},{key:"pluginsLenght",getData:function(done,options){try{var length_1=nav.plugins.length;if(length_1==undefined)
done(null);else
done(length_1);}
catch(_a){done(null);}}},{key:"activeXObject",getData:function(done,options){done(!!("ActiveXObject"in window));}},{key:"browserName",getData:function(done,options){try{done(getBrowserName());}
catch(_a){done("not available");}}},{key:"fonts",getData:function(done,options){try{done(getFonts());}
catch(_a){done("not available");}}},],preprocessor:function(key,value){if(key=="deviceMemory"){var m=nav.deviceMemory;if(m==undefined||typeof(m)!="number")
return null;else{return m;}}
else if(key=="webglVendorAndRenderer"){var webgl=getWebglVendorAndRenderer();if(webgl==undefined)
return"not available";else{return webgl;}}
else{return value;}}},function(c){var hash=fp_new.x64hash128(joinFingerprintObjects(c,""),31);f=new Fingerprint(hash,c);});})();return f;};return Fingerprint;}());exports.Fingerprint=Fingerprint;},{"./fingerprintData":6,"ua-parser-js":18}],6:[function(require,module,exports){"use strict";exports.__esModule=true;var nav=navigator;var wnd=window;var doc=document;'use strict';var x64Add=function(m,n){m=[m[0]>>>16,m[0]&0xffff,m[1]>>>16,m[1]&0xffff];n=[n[0]>>>16,n[0]&0xffff,n[1]>>>16,n[1]&0xffff];var o=[0,0,0,0];o[3]+=m[3]+n[3];o[2]+=o[3]>>>16;o[3]&=0xffff;o[2]+=m[2]+n[2];o[1]+=o[2]>>>16;o[2]&=0xffff;o[1]+=m[1]+n[1];o[0]+=o[1]>>>16;o[1]&=0xffff;o[0]+=m[0]+n[0];o[0]&=0xffff;return[(o[0]<<16)|o[1],(o[2]<<16)|o[3]];};var x64Multiply=function(m,n){m=[m[0]>>>16,m[0]&0xffff,m[1]>>>16,m[1]&0xffff];n=[n[0]>>>16,n[0]&0xffff,n[1]>>>16,n[1]&0xffff];var o=[0,0,0,0];o[3]+=m[3]*n[3];o[2]+=o[3]>>>16;o[3]&=0xffff;o[2]+=m[2]*n[3];o[1]+=o[2]>>>16;o[2]&=0xffff;o[2]+=m[3]*n[2];o[1]+=o[2]>>>16;o[2]&=0xffff;o[1]+=m[1]*n[3];o[0]+=o[1]>>>16;o[1]&=0xffff;o[1]+=m[2]*n[2];o[0]+=o[1]>>>16;o[1]&=0xffff;o[1]+=m[3]*n[1];o[0]+=o[1]>>>16;o[1]&=0xffff;o[0]+=(m[0]*n[3])+(m[1]*n[2])+(m[2]*n[1])+(m[3]*n[0]);o[0]&=0xffff;return[(o[0]<<16)|o[1],(o[2]<<16)|o[3]];};var x64Rotl=function(m,n){n%=64;if(n===32){return[m[1],m[0]];}
else if(n<32){return[(m[0]<<n)|(m[1]>>>(32-n)),(m[1]<<n)|(m[0]>>>(32-n))];}
else{n-=32;return[(m[1]<<n)|(m[0]>>>(32-n)),(m[0]<<n)|(m[1]>>>(32-n))];}};var x64LeftShift=function(m,n){n%=64;if(n===0){return m;}
else if(n<32){return[(m[0]<<n)|(m[1]>>>(32-n)),m[1]<<n];}
else{return[m[1]<<(n-32),0];}};var x64Xor=function(m,n){return[m[0]^n[0],m[1]^n[1]];};var x64Fmix=function(h){h=x64Xor(h,[0,h[0]>>>1]);h=x64Multiply(h,[0xff51afd7,0xed558ccd]);h=x64Xor(h,[0,h[0]>>>1]);h=x64Multiply(h,[0xc4ceb9fe,0x1a85ec53]);h=x64Xor(h,[0,h[0]>>>1]);return h;};var x64hash128=function(key,seed){key=key||'';seed=seed||0;var remainder=key.length%16;var bytes=key.length-remainder;var h1=[0,seed];var h2=[0,seed];var k1=[0,0];var k2=[0,0];var c1=[0x87c37b91,0x114253d5];var c2=[0x4cf5ad43,0x2745937f];for(var i=0;i<bytes;i=i+16){k1=[((key.charCodeAt(i+4)&0xff))|((key.charCodeAt(i+5)&0xff)<<8)|((key.charCodeAt(i+6)&0xff)<<16)|((key.charCodeAt(i+7)&0xff)<<24),((key.charCodeAt(i)&0xff))|((key.charCodeAt(i+1)&0xff)<<8)|((key.charCodeAt(i+2)&0xff)<<16)|((key.charCodeAt(i+3)&0xff)<<24)];k2=[((key.charCodeAt(i+12)&0xff))|((key.charCodeAt(i+13)&0xff)<<8)|((key.charCodeAt(i+14)&0xff)<<16)|((key.charCodeAt(i+15)&0xff)<<24),((key.charCodeAt(i+8)&0xff))|((key.charCodeAt(i+9)&0xff)<<8)|((key.charCodeAt(i+10)&0xff)<<16)|((key.charCodeAt(i+11)&0xff)<<24)];k1=x64Multiply(k1,c1);k1=x64Rotl(k1,31);k1=x64Multiply(k1,c2);h1=x64Xor(h1,k1);h1=x64Rotl(h1,27);h1=x64Add(h1,h2);h1=x64Add(x64Multiply(h1,[0,5]),[0,0x52dce729]);k2=x64Multiply(k2,c2);k2=x64Rotl(k2,33);k2=x64Multiply(k2,c1);h2=x64Xor(h2,k2);h2=x64Rotl(h2,31);h2=x64Add(h2,h1);h2=x64Add(x64Multiply(h2,[0,5]),[0,0x38495ab5]);}
k1=[0,0];k2=[0,0];switch(remainder){case 15:k2=x64Xor(k2,x64LeftShift([0,key.charCodeAt(i+14)],48));case 14:k2=x64Xor(k2,x64LeftShift([0,key.charCodeAt(i+13)],40));case 13:k2=x64Xor(k2,x64LeftShift([0,key.charCodeAt(i+12)],32));case 12:k2=x64Xor(k2,x64LeftShift([0,key.charCodeAt(i+11)],24));case 11:k2=x64Xor(k2,x64LeftShift([0,key.charCodeAt(i+10)],16));case 10:k2=x64Xor(k2,x64LeftShift([0,key.charCodeAt(i+9)],8));case 9:k2=x64Xor(k2,[0,key.charCodeAt(i+8)]);k2=x64Multiply(k2,c2);k2=x64Rotl(k2,33);k2=x64Multiply(k2,c1);h2=x64Xor(h2,k2);case 8:k1=x64Xor(k1,x64LeftShift([0,key.charCodeAt(i+7)],56));case 7:k1=x64Xor(k1,x64LeftShift([0,key.charCodeAt(i+6)],48));case 6:k1=x64Xor(k1,x64LeftShift([0,key.charCodeAt(i+5)],40));case 5:k1=x64Xor(k1,x64LeftShift([0,key.charCodeAt(i+4)],32));case 4:k1=x64Xor(k1,x64LeftShift([0,key.charCodeAt(i+3)],24));case 3:k1=x64Xor(k1,x64LeftShift([0,key.charCodeAt(i+2)],16));case 2:k1=x64Xor(k1,x64LeftShift([0,key.charCodeAt(i+1)],8));case 1:k1=x64Xor(k1,[0,key.charCodeAt(i)]);k1=x64Multiply(k1,c1);k1=x64Rotl(k1,31);k1=x64Multiply(k1,c2);h1=x64Xor(h1,k1);}
h1=x64Xor(h1,[0,key.length]);h2=x64Xor(h2,[0,key.length]);h1=x64Add(h1,h2);h2=x64Add(h2,h1);h1=x64Fmix(h1);h2=x64Fmix(h2);h1=x64Add(h1,h2);h2=x64Add(h2,h1);return('00000000'+(h1[0]>>>0).toString(16)).slice(-8)+('00000000'+(h1[1]>>>0).toString(16)).slice(-8)+('00000000'+(h2[0]>>>0).toString(16)).slice(-8)+('00000000'+(h2[1]>>>0).toString(16)).slice(-8);};var defaultOptions={preprocessor:null,audio:{timeout:1000,excludeIOS11:true},fonts:{swfContainerId:'fingerprintjs2',swfPath:'flash/compiled/FontList.swf',userDefinedFonts:[],extendedJsFonts:false},screen:{detectScreenOrientation:false},plugins:{sortPluginsFor:[/palemoon/i],excludeIE:false},extraComponents:[],excludes:{'enumerateDevices':true,'pixelRatio':true,'doNotTrack':true,'fontsFlash':true},NOT_AVAILABLE:'not available',ERROR:'error',EXCLUDED:'excluded'};var each=function(obj,iterator){if(Array.prototype.forEach&&obj.forEach===Array.prototype.forEach){obj.forEach(iterator);}
else if(obj.length===+obj.length){for(var i=0,l=obj.length;i<l;i++){iterator(obj[i],i,obj);}}
else{for(var key in obj){if(obj.hasOwnProperty(key)){iterator(obj[key],key,obj);}}}};var map=function(obj,iterator){var results=[];if(obj==null){return results;}
if(Array.prototype.map&&obj.map===Array.prototype.map){return obj.map(iterator);}
each(obj,function(value,index,list){results.push(iterator(value,index,list));});return results;};var extendSoft=function(target,source){if(source==null){return target;}
var value;var key;for(key in source){value=source[key];if(value!=null&&!(Object.prototype.hasOwnProperty.call(target,key))){target[key]=value;}}
return target;};var isEnumerateDevicesSupported=function(){return(navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices);};var UserAgent=function(done){done(navigator.userAgent);};var languageKey=function(done,options){done(navigator.language||nav.userLanguage||nav.browserLanguage||nav.systemLanguage||options.NOT_AVAILABLE);};var colorDepthKey=function(done,options){done(window.screen.colorDepth||options.NOT_AVAILABLE);};var deviceMemoryKey=function(done,options){done(nav.deviceMemory||options.NOT_AVAILABLE);};var pixelRatioKey=function(done,options){done(window.devicePixelRatio||options.NOT_AVAILABLE);};var screenResolutionKey=function(done,options){done(getScreenResolution(options));};var getScreenResolution=function(options){var resolution=[window.screen.width,window.screen.height];return resolution;};var availableScreenResolutionKey=function(done,options){done(getAvailableScreenResolution(options));};var getAvailableScreenResolution=function(options){if(window.screen.availWidth&&window.screen.availHeight){var available=[window.screen.availWidth,window.screen.availHeight];return available;}
return options.NOT_AVAILABLE;};var timezoneOffset=function(done){done(new Date().getTimezoneOffset());};var timezone=function(done,options){if(wnd.Intl&&wnd.Intl.DateTimeFormat){done(new wnd.Intl.DateTimeFormat().resolvedOptions().timeZone);return;}
done(options.NOT_AVAILABLE);};var sessionStorageKey=function(done,options){done(hasSessionStorage(options));};var localStorageKey=function(done,options){done(hasLocalStorage(options));};var indexedDbKey=function(done,options){done(hasIndexedDB(options));};var addBehaviorKey=function(done){done(!!(doc.body&&doc.body.addBehavior));};var openDatabaseKey=function(done){done(!!wnd.openDatabase);};var cpuClassKey=function(done,options){done(getNavigatorCpuClass(options));};var platformKey=function(done,options){done(getNavigatorPlatform(options));};var doNotTrackKey=function(done,options){done(getDoNotTrack(options));};var canvasKey=function(done,options){if(isCanvasSupported()){done(getCanvasFp(options));return;}
done(options.NOT_AVAILABLE);};var webglKey=function(done,options){if(isWebGlSupported()){done(getWebglFp());return;}
done(options.NOT_AVAILABLE);};var webglVendorAndRendererKey=function(done){if(isWebGlSupported()){done(getWebglVendorAndRenderer());return;}
done();};var adBlockKey=function(done){done(getAdBlock());};var hasLiedLanguagesKey=function(done){done(getHasLiedLanguages());};var hasLiedResolutionKey=function(done){done(getHasLiedResolution());};var hasLiedOsKey=function(done){done(getHasLiedOs());};var hasLiedBrowserKey=function(done){done(getHasLiedBrowser());};var flashFontsKey=function(done,options){if(!hasSwfObjectLoaded()){return done('swf object not loaded');}
if(!hasMinFlashInstalled()){return done('flash not installed');}
if(!options.fonts.swfPath){return done('missing options.fonts.swfPath');}
loadSwfAndDetectFonts(function(fonts){done(fonts);},options);};var pluginsComponent=function(done,options){if(isIE()){if(!options.plugins.excludeIE){done(getIEPlugins(options));}
else{done(options.EXCLUDED);}}
else{done(getRegularPlugins(options));}};var getRegularPlugins=function(options){if(navigator.plugins==null){return options.NOT_AVAILABLE;}
var plugins=[];for(var i=0,l=navigator.plugins.length;i<l;i++){if(navigator.plugins[i]){plugins.push(navigator.plugins[i]);}}
if(pluginsShouldBeSorted(options)){plugins=plugins.sort(function(a,b){if(a.name>b.name){return 1;}
if(a.name<b.name){return-1;}
return 0;});}
return map(plugins,function(p){var mimeTypes=map(p,function(mt){return[mt.type,mt.suffixes];});return[p.name,p.description,mimeTypes];});};var getIEPlugins=function(options){var result=[];if((Object.getOwnPropertyDescriptor&&Object.getOwnPropertyDescriptor(window,'ActiveXObject'))||('ActiveXObject'in window)){var names=['AcroPDF.PDF','Adodb.Stream','AgControl.AgControl','DevalVRXCtrl.DevalVRXCtrl.1','MacromediaFlashPaper.MacromediaFlashPaper','Msxml2.DOMDocument','Msxml2.XMLHTTP','PDF.PdfCtrl','QuickTime.QuickTime','QuickTimeCheckObject.QuickTimeCheck.1','RealPlayer','RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)','RealVideo.RealVideo(tm) ActiveX Control (32-bit)','Scripting.Dictionary','SWCtl.SWCtl','Shell.UIHelper','ShockwaveFlash.ShockwaveFlash','Skype.Detection','TDCCtl.TDCCtl','WMPlayer.OCX','rmocx.RealPlayer G2 Control','rmocx.RealPlayer G2 Control.1'];result=map(names,function(name){try{new wnd.ActiveXObject(name);return name;}
catch(e){return options.ERROR;}});}
else{result.push(options.NOT_AVAILABLE);}
if(navigator.plugins){result=result.concat(getRegularPlugins(options));}
return result;};var pluginsShouldBeSorted=function(options){var should=false;for(var i=0,l=options.plugins.sortPluginsFor.length;i<l;i++){var re=options.plugins.sortPluginsFor[i];if(navigator.userAgent.match(re)){should=true;break;}}
return should;};var touchSupportKey=function(done){done(getTouchSupport());};var hardwareConcurrencyKey=function(done,options){done(getHardwareConcurrency(options));};var hasSessionStorage=function(options){try{return!!window.sessionStorage;}
catch(e){return options.ERROR;}};var hasLocalStorage=function(options){try{return!!window.localStorage;}
catch(e){return options.ERROR;}};var hasIndexedDB=function(options){try{return!!window.indexedDB;}
catch(e){return options.ERROR;}};var getHardwareConcurrency=function(options){if(navigator.hardwareConcurrency){return navigator.hardwareConcurrency;}
return options.NOT_AVAILABLE;};var getNavigatorCpuClass=function(options){return nav.cpuClass||options.NOT_AVAILABLE;};var getNavigatorPlatform=function(options){if(navigator.platform){return navigator.platform;}
else{return options.NOT_AVAILABLE;}};var getDoNotTrack=function(options){if(navigator.doNotTrack){return navigator.doNotTrack;}
else if(nav.msDoNotTrack){return nav.msDoNotTrack;}
else if(wnd.doNotTrack){return wnd.doNotTrack;}
else{return options.NOT_AVAILABLE;}};var getTouchSupport=function(){var maxTouchPoints=0;var touchEvent;if(typeof nav.maxTouchPoints!=='undefined'){maxTouchPoints=nav.maxTouchPoints;}
else if(typeof nav.msMaxTouchPoints!=='undefined'){maxTouchPoints=nav.msMaxTouchPoints;}
try{document.createEvent('TouchEvent');touchEvent=true;}
catch(_){touchEvent=false;}
var touchStart='ontouchstart'in window;return[maxTouchPoints,touchEvent,touchStart];};var getCanvasFp=function(options){var result=[];var canvas=document.createElement('canvas');canvas.width=2000;canvas.height=200;canvas.style.display='inline';var ctx=canvas.getContext('2d');ctx.rect(0,0,10,10);ctx.rect(2,2,6,6);result.push('canvas winding:'+((ctx.isPointInPath(5,5,'evenodd')===false)?'yes':'no'));ctx.textBaseline='alphabetic';ctx.fillStyle='#f60';ctx.fillRect(125,1,62,20);ctx.fillStyle='#069';if(options.dontUseFakeFontInCanvas){ctx.font='11pt Arial';}
else{ctx.font='11pt no-real-font-123';}
ctx.fillText('Cwm fjordbank glyphs vext quiz, \ud83d\ude03',2,15);ctx.fillStyle='rgba(102, 204, 0, 0.2)';ctx.font='18pt Arial';ctx.fillText('Cwm fjordbank glyphs vext quiz, \ud83d\ude03',4,45);ctx.globalCompositeOperation='multiply';ctx.fillStyle='rgb(255,0,255)';ctx.beginPath();ctx.arc(50,50,50,0,Math.PI*2,true);ctx.closePath();ctx.fill();ctx.fillStyle='rgb(0,255,255)';ctx.beginPath();ctx.arc(100,50,50,0,Math.PI*2,true);ctx.closePath();ctx.fill();ctx.fillStyle='rgb(255,255,0)';ctx.beginPath();ctx.arc(75,100,50,0,Math.PI*2,true);ctx.closePath();ctx.fill();ctx.fillStyle='rgb(255,0,255)';ctx.arc(75,75,75,0,Math.PI*2,true);ctx.arc(75,75,25,0,Math.PI*2,true);ctx.fill('evenodd');if(canvas.toDataURL){result.push('canvas fp:'+canvas.toDataURL());}
return result;};var getWebglFp=function(){var gl;var fa2s=function(fa){gl.clearColor(0.0,0.0,0.0,1.0);gl.enable(gl.DEPTH_TEST);gl.depthFunc(gl.LEQUAL);gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);return'['+fa[0]+', '+fa[1]+']';};var maxAnisotropy=function(gl){var ext=gl.getExtension('EXT_texture_filter_anisotropic')||gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic')||gl.getExtension('MOZ_EXT_texture_filter_anisotropic');if(ext){var anisotropy=gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT);if(anisotropy===0){anisotropy=2;}
return anisotropy;}
else{return null;}};gl=getWebglCanvas();if(!gl){return null;}
var result=[];var vShaderTemplate='attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}';var fShaderTemplate='precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}';var vertexPosBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,vertexPosBuffer);var vertices=new Float32Array([-0.2,-0.9,0,0.4,-0.26,0,0,0.732134444,0]);gl.bufferData(gl.ARRAY_BUFFER,vertices,gl.STATIC_DRAW);vertexPosBuffer.itemSize=3;vertexPosBuffer.numItems=3;var program=gl.createProgram();var vshader=gl.createShader(gl.VERTEX_SHADER);gl.shaderSource(vshader,vShaderTemplate);gl.compileShader(vshader);var fshader=gl.createShader(gl.FRAGMENT_SHADER);gl.shaderSource(fshader,fShaderTemplate);gl.compileShader(fshader);gl.attachShader(program,vshader);gl.attachShader(program,fshader);gl.linkProgram(program);gl.useProgram(program);program.vertexPosAttrib=gl.getAttribLocation(program,'attrVertex');program.offsetUniform=gl.getUniformLocation(program,'uniformOffset');gl.enableVertexAttribArray(program.vertexPosArray);gl.vertexAttribPointer(program.vertexPosAttrib,vertexPosBuffer.itemSize,gl.FLOAT,!1,0,0);gl.uniform2f(program.offsetUniform,1,1);gl.drawArrays(gl.TRIANGLE_STRIP,0,vertexPosBuffer.numItems);try{result.push(gl.canvas.toDataURL());}
catch(e){}
result.push('extensions:'+(gl.getSupportedExtensions()||[]).join(';'));result.push('webgl aliased line width range:'+fa2s(gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE)));result.push('webgl aliased point size range:'+fa2s(gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE)));result.push('webgl alpha bits:'+gl.getParameter(gl.ALPHA_BITS));result.push('webgl antialiasing:'+(gl.getContextAttributes().antialias?'yes':'no'));result.push('webgl blue bits:'+gl.getParameter(gl.BLUE_BITS));result.push('webgl depth bits:'+gl.getParameter(gl.DEPTH_BITS));result.push('webgl green bits:'+gl.getParameter(gl.GREEN_BITS));result.push('webgl max anisotropy:'+maxAnisotropy(gl));result.push('webgl max combined texture image units:'+gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS));result.push('webgl max cube map texture size:'+gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE));result.push('webgl max fragment uniform vectors:'+gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS));result.push('webgl max render buffer size:'+gl.getParameter(gl.MAX_RENDERBUFFER_SIZE));result.push('webgl max texture image units:'+gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS));result.push('webgl max texture size:'+gl.getParameter(gl.MAX_TEXTURE_SIZE));result.push('webgl max varying vectors:'+gl.getParameter(gl.MAX_VARYING_VECTORS));result.push('webgl max vertex attribs:'+gl.getParameter(gl.MAX_VERTEX_ATTRIBS));result.push('webgl max vertex texture image units:'+gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS));result.push('webgl max vertex uniform vectors:'+gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS));result.push('webgl max viewport dims:'+fa2s(gl.getParameter(gl.MAX_VIEWPORT_DIMS)));result.push('webgl red bits:'+gl.getParameter(gl.RED_BITS));result.push('webgl renderer:'+gl.getParameter(gl.RENDERER));result.push('webgl shading language version:'+gl.getParameter(gl.SHADING_LANGUAGE_VERSION));result.push('webgl stencil bits:'+gl.getParameter(gl.STENCIL_BITS));result.push('webgl vendor:'+gl.getParameter(gl.VENDOR));result.push('webgl version:'+gl.getParameter(gl.VERSION));try{var extensionDebugRendererInfo=gl.getExtension('WEBGL_debug_renderer_info');if(extensionDebugRendererInfo){result.push('webgl unmasked vendor:'+gl.getParameter(extensionDebugRendererInfo.UNMASKED_VENDOR_WEBGL));result.push('webgl unmasked renderer:'+gl.getParameter(extensionDebugRendererInfo.UNMASKED_RENDERER_WEBGL));}}
catch(e){}
if(!gl.getShaderPrecisionFormat){return result;}
each(['FLOAT','INT'],function(numType){each(['VERTEX','FRAGMENT'],function(shader){each(['HIGH','MEDIUM','LOW'],function(numSize){each(['precision','rangeMin','rangeMax'],function(key){var format=gl.getShaderPrecisionFormat(gl[shader+'_SHADER'],gl[numSize+'_'+numType])[key];if(key!=='precision'){key='precision '+key;}
var line=['webgl ',shader.toLowerCase(),' shader ',numSize.toLowerCase(),' ',numType.toLowerCase(),' ',key,':',format].join('');result.push(line);});});});});return result;};var getWebglVendorAndRenderer=function(){try{var glContext=getWebglCanvas();var extensionDebugRendererInfo=glContext.getExtension('WEBGL_debug_renderer_info');return glContext.getParameter(extensionDebugRendererInfo.UNMASKED_VENDOR_WEBGL)+'~'+glContext.getParameter(extensionDebugRendererInfo.UNMASKED_RENDERER_WEBGL);}
catch(e){return null;}};var getAdBlock=function(){var ads=document.createElement('div');ads.innerHTML='&nbsp;';ads.className='adsbox';var result=false;try{document.body.appendChild(ads);result=doc.getElementsByClassName('adsbox')[0].offsetHeight===0;document.body.removeChild(ads);}
catch(e){result=false;}
return result;};var getHasLiedLanguages=function(){if(typeof navigator.languages!=='undefined'){try{var firstLanguages=navigator.languages[0].substr(0,2);if(firstLanguages!==navigator.language.substr(0,2)){return true;}}
catch(err){return true;}}
return false;};var getHasLiedResolution=function(){return window.screen.width<window.screen.availWidth||window.screen.height<window.screen.availHeight;};var getHasLiedOs=function(){var userAgent=nav.userAgent.toLowerCase();var oscpu=nav.oscpu;var platform=nav.platform.toLowerCase();var os;if(userAgent.indexOf('windows phone')>=0){os='Windows Phone';}
else if(userAgent.indexOf('win')>=0){os='Windows';}
else if(userAgent.indexOf('android')>=0){os='Android';}
else if(userAgent.indexOf('linux')>=0){os='Linux';}
else if(userAgent.indexOf('iphone')>=0||userAgent.indexOf('ipad')>=0){os='iOS';}
else if(userAgent.indexOf('mac')>=0){os='Mac';}
else{os='Other';}
var mobileDevice=(('ontouchstart'in wnd)||(nav.maxTouchPoints>0)||(nav.msMaxTouchPoints>0));if(mobileDevice&&os!=='Windows Phone'&&os!=='Android'&&os!=='iOS'&&os!=='Other'){return true;}
if(typeof oscpu!=='undefined'){oscpu=oscpu.toLowerCase();if(oscpu.indexOf('win')>=0&&os!=='Windows'&&os!=='Windows Phone'){return true;}
else if(oscpu.indexOf('linux')>=0&&os!=='Linux'&&os!=='Android'){return true;}
else if(oscpu.indexOf('mac')>=0&&os!=='Mac'&&os!=='iOS'){return true;}
else if((oscpu.indexOf('win')===-1&&oscpu.indexOf('linux')===-1&&oscpu.indexOf('mac')===-1)!==(os==='Other')){return true;}}
if(platform.indexOf('win')>=0&&os!=='Windows'&&os!=='Windows Phone'){return true;}
else if((platform.indexOf('linux')>=0||platform.indexOf('android')>=0||platform.indexOf('pike')>=0)&&os!=='Linux'&&os!=='Android'){return true;}
else if((platform.indexOf('mac')>=0||platform.indexOf('ipad')>=0||platform.indexOf('ipod')>=0||platform.indexOf('iphone')>=0)&&os!=='Mac'&&os!=='iOS'){return true;}
else if((platform.indexOf('win')===-1&&platform.indexOf('linux')===-1&&platform.indexOf('mac')===-1)!==(os==='Other')){return true;}
return typeof navigator.plugins==='undefined'&&os!=='Windows'&&os!=='Windows Phone';};var getHasLiedBrowser=function(){var userAgent=navigator.userAgent.toLowerCase();var productSub=navigator.productSub;var browser;if(userAgent.indexOf('firefox')>=0){browser='Firefox';}
else if(userAgent.indexOf('opera')>=0||userAgent.indexOf('opr')>=0){browser='Opera';}
else if(userAgent.indexOf('chrome')>=0){browser='Chrome';}
else if(userAgent.indexOf('safari')>=0){browser='Safari';}
else if(userAgent.indexOf('trident')>=0){browser='Internet Explorer';}
else{browser='Other';}
if((browser==='Chrome'||browser==='Safari'||browser==='Opera')&&productSub!=='20030107'){return true;}
var tempRes=eval.toString().length;if(tempRes===37&&browser!=='Safari'&&browser!=='Firefox'&&browser!=='Other'){return true;}
else if(tempRes===39&&browser!=='Internet Explorer'&&browser!=='Other'){return true;}
else if(tempRes===33&&browser!=='Chrome'&&browser!=='Opera'&&browser!=='Other'){return true;}
var errFirefox;try{throw'a';}
catch(err){try{err.toSource();errFirefox=true;}
catch(errOfErr){errFirefox=false;}}
return errFirefox&&browser!=='Firefox'&&browser!=='Other';};var isCanvasSupported=function(){var elem=document.createElement('canvas');return!!(elem.getContext&&elem.getContext('2d'));};var isWebGlSupported=function(){if(!isCanvasSupported()){return false;}
var glContext=getWebglCanvas();return!!wnd.WebGLRenderingContext&&!!glContext;};var isIE=function(){if(navigator.appName==='Microsoft Internet Explorer'){return true;}
else if(navigator.appName==='Netscape'&&/Trident/.test(navigator.userAgent)){return true;}
return false;};var hasSwfObjectLoaded=function(){return typeof wnd.swfobject!=='undefined';};var hasMinFlashInstalled=function(){return wnd.swfobject.hasFlashPlayerVersion('9.0.0');};var addFlashDivNode=function(options){var node=document.createElement('div');node.setAttribute('id',options.fonts.swfContainerId);document.body.appendChild(node);};var loadSwfAndDetectFonts=function(done,options){var hiddenCallback='___fp_swf_loaded';window[hiddenCallback]=function(fonts){done(fonts);};var id=options.fonts.swfContainerId;addFlashDivNode(undefined);var flashvars={onReady:hiddenCallback};var flashparams={allowScriptAccess:'always',menu:'false'};wnd.swfobject.embedSWF(options.fonts.swfPath,id,'1','1','9.0.0',false,flashvars,flashparams,{});};var getWebglCanvas=function(){var canvas=document.createElement('canvas');var gl=null;try{gl=canvas.getContext('webgl')||canvas.getContext('experimental-webgl');}
catch(e){}
if(!gl){gl=null;}
return gl;};var components=[{key:'userAgent',getData:UserAgent},{key:'language',getData:languageKey},{key:'colorDepth',getData:colorDepthKey},{key:'deviceMemory',getData:deviceMemoryKey},{key:'pixelRatio',getData:pixelRatioKey},{key:'hardwareConcurrency',getData:hardwareConcurrencyKey},{key:'screenResolution',getData:screenResolutionKey},{key:'availableScreenResolution',getData:availableScreenResolutionKey},{key:'timezoneOffset',getData:timezoneOffset},{key:'timezone',getData:timezone},{key:'sessionStorage',getData:sessionStorageKey},{key:'localStorage',getData:localStorageKey},{key:'indexedDb',getData:indexedDbKey},{key:'addBehavior',getData:addBehaviorKey},{key:'openDatabase',getData:openDatabaseKey},{key:'cpuClass',getData:cpuClassKey},{key:'platform',getData:platformKey},{key:'doNotTrack',getData:doNotTrackKey},{key:'plugins',getData:pluginsComponent},{key:'canvas',getData:canvasKey},{key:'webgl',getData:webglKey},{key:'webglVendorAndRenderer',getData:webglVendorAndRendererKey},{key:'adBlock',getData:adBlockKey},{key:'hasLiedLanguages',getData:hasLiedLanguagesKey},{key:'hasLiedResolution',getData:hasLiedResolutionKey},{key:'hasLiedOs',getData:hasLiedOsKey},{key:'hasLiedBrowser',getData:hasLiedBrowserKey},{key:'touchSupport',getData:touchSupportKey},];var Fingerprint2=(function(){function Fingerprint2(){this.get=function(options,callback){if(!callback){callback=options;options={};}
else if(!options){options={};}
extendSoft(options,defaultOptions);options.components=options.extraComponents.concat(components);var keys={data:[],addPreprocessedComponent:function(key,value){if(typeof options.preprocessor==='function'){value=options.preprocessor(key,value);}
keys.data.push({key:key,value:value});}};var i=-1;var chainComponents=function(alreadyWaited){i+=1;if(i>=options.components.length){callback(keys.data);return;}
var component=options.components[i];if(options.excludes[component.key]){chainComponents(false);return;}
if(!alreadyWaited&&component.pauseBefore){i-=1;setTimeout(function(){chainComponents(true);},1);return;}
try{component.getData(function(value){keys.addPreprocessedComponent(component.key,value);chainComponents(false);},options);}
catch(error){keys.addPreprocessedComponent(component.key,String(error));chainComponents(false);}};chainComponents(false);};this.getPromise=function(options){return new Promise(function(resolve,reject){this.get(options,resolve);});};this.getV18=function(options,callback){if(callback==null){callback=options;options={};}
return this.get(options,function(components){var newComponents=[];for(var i=0;i<components.length;i++){var component=components[i];if(component.value===(options.NOT_AVAILABLE||'not available')){newComponents.push({key:component.key,value:'unknown'});}
else if(component.key==='plugins'){newComponents.push({key:'plugins',value:map(component.value,function(p){var mimeTypes=map(p[2],function(mt){if(mt.join){return mt.join('~');}
return mt;}).join(',');return[p[0],p[1],mimeTypes].join('::');})});}
else if(['canvas','webgl'].indexOf(component.key)!==-1){newComponents.push({key:component.key,value:component.value.join('~')});}
else if(['sessionStorage','localStorage','indexedDb','addBehavior','openDatabase'].indexOf(component.key)!==-1){if(component.value){newComponents.push({key:component.key,value:1});}
else{continue;}}
else{if(component.value){newComponents.push(component.value.join?{key:component.key,value:component.value.join(';')}:component);}
else{newComponents.push({key:component.key,value:component.value});}}}
var murmur=x64hash128(map(newComponents,function(component){return component.value;}).join('~~~'),31);callback(murmur,newComponents);});};this.x64hash128=x64hash128;this.VERSION='2.0.0';}
return Fingerprint2;}());exports.Fingerprint2=Fingerprint2;},{}],7:[function(require,module,exports){"use strict";exports.__esModule=true;var Http=(function(){function Http(){}
Http.post_statusData=function(url,data){return new Promise(function(resolve,reject){var request=new XMLHttpRequest();request.onload=function(){if(this.status>=200&&this.status<303){var res=[this.status,this.response];resolve(res);}
else{reject(new Error(this.statusText));}};request.onerror=function(){reject(new Error("(POST_COUNTER)XMLHttpRequest Error: "+this.statusText));};request.open("POST",url,true);request.setRequestHeader("Content-Type","application/json");request.send(JSON.stringify(data));});};return Http;}());exports.Http=Http;},{}],8:[function(require,module,exports){"use strict";exports.__esModule=true;function wait_ga(wnd,timeout,callback){if(wnd.ga!=undefined){setTimeout(function(){callback();},1000);callback();return;}
setTimeout(function(){wait_ga(wnd,timeout,callback);},timeout);}
exports.wait_ga=wait_ga;},{}],9:[function(require,module,exports){"use strict";exports.__esModule=true;function wait_ya(wnd,timeout,callback){var yaCounterX=Object.keys(wnd).filter(function(el){return/^yaCounter.*?/i.test(el);})[0];if(wnd.ym!=undefined||yaCounterX!=undefined){setTimeout(function(){callback();},1000);return;}
setTimeout(function(){wait_ya(wnd,timeout,callback);},timeout);}
exports.wait_ya=wait_ya;},{}],10:[function(require,module,exports){"use strict";exports.__esModule=true;var fingerprint_1=require("./core/fingerprint");function fp(wnd){var bkd=wnd._b_data_;var fpData=fingerprint_1.Fingerprint.get();var obj={};var nav=navigator;function getAdBlock(){var ads=document.createElement("div");ads.innerHTML="&nbsp;";ads.className="adsbox";var result=false;try{document.body.appendChild(ads);result=0===document.getElementsByClassName("adsbox")[0].offsetHeight;document.body.removeChild(ads);}
catch(e){result=false;}
return result;}
function getDoNotTrack(){try{var msDontr=nav.msDoNotTrack;var navDontr=nav.doNotTrack;if(msDontr){if(msDontr=="0"){return false;}
else if(msDontr=="1"){return true;}
else if(msDontr=="yes"){return true;}
else if(msDontr=="no"){return false;}
else if(msDontr=="null"){return false;}
else
return false;}
else if(navDontr){if(navDontr=="0"){return false;}
else if(navDontr=="1"){return true;}
else if(navDontr=="unspecified"){return false;}
else if(navDontr=="null"){return false;}
else
return false;}
else{return false;}}
catch(_a){return false;}}
function getHasLiedLanguages(){if(typeof navigator.languages!=="undefined"){try{var firstLanguages=navigator.languages[0].substr(0,2);if(firstLanguages!==navigator.language.substr(0,2)){return true;}}
catch(err){return true;}}
return false;}
function getHasLiedResolution(){try{return(window.screen.width<window.screen.availWidth||window.screen.height<window.screen.availHeight);}
catch(_a){return null;}}
function getBuildId(){var win=window;try{var b=win.navigator.buildID;if(b==undefined||typeof(b)!="string"){b="undefined";}
return b;}
catch(_a){return null;}}
function getHasLiedOs(){var nav=navigator;var userAgent=nav.userAgent.toLowerCase();var oscpu=nav.oscpu;var platform=nav.platform.toLowerCase();var os;if(userAgent.indexOf("windows phone")>=0){os="Windows Phone";}
else if(userAgent.indexOf("win")>=0){os="Windows";}
else if(userAgent.indexOf("android")>=0){os="Android";}
else if(userAgent.indexOf("linux")>=0){os="Linux";}
else if(userAgent.indexOf("iphone")>=0||userAgent.indexOf("ipad")>=0){os="iOS";}
else if(userAgent.indexOf("mac")>=0){os="Mac";}
else{os="Other";}
var mobileDevice="ontouchstart"in window||nav.maxTouchPoints>0||nav.msMaxTouchPoints>0;if(mobileDevice&&os!=="Windows Phone"&&os!=="Android"&&os!=="iOS"&&os!=="Other"){return true;}
if(typeof oscpu!=="undefined"){oscpu=oscpu.toLowerCase();if(oscpu.indexOf("win")>=0&&os!=="Windows"&&os!=="Windows Phone"){return true;}
else if(oscpu.indexOf("linux")>=0&&os!=="Linux"&&os!=="Android"){return true;}
else if(oscpu.indexOf("mac")>=0&&os!=="Mac"&&os!=="iOS"){return true;}
else if((oscpu.indexOf("win")===-1&&oscpu.indexOf("linux")===-1&&oscpu.indexOf("mac")===-1)!==(os==="Other")){return true;}}
if(platform.indexOf("win")>=0&&os!=="Windows"&&os!=="Windows Phone"){return true;}
else if((platform.indexOf("linux")>=0||platform.indexOf("android")>=0||platform.indexOf("pike")>=0)&&os!=="Linux"&&os!=="Android"){return true;}
else if((platform.indexOf("mac")>=0||platform.indexOf("ipad")>=0||platform.indexOf("ipod")>=0||platform.indexOf("iphone")>=0)&&os!=="Mac"&&os!=="iOS"){return true;}
else if(os==="Other"&&platform.indexOf("mac")===-1&&platform.indexOf("ipad")===-1&&platform.indexOf("ipod")===-1&&platform.indexOf("iphone")===-1&&platform.indexOf("linux")===-1&&platform.indexOf("android")===-1&&platform.indexOf("pike")===-1&&platform.indexOf("win")===-1){return true;}
return(typeof navigator.plugins==="undefined"&&os!=="Windows"&&os!=="Windows Phone");}
function getHasLiedBrowser(){var nav=navigator;var userAgent=nav.userAgent.toLowerCase();var productSub=nav.productSub;var browser;if(userAgent.indexOf("firefox")>=0){browser="Firefox";}
else if(userAgent.indexOf("opera")>=0||userAgent.indexOf("opr")>=0){browser="Opera";}
else if(userAgent.indexOf("chrome")>=0){browser="Chrome";}
else if(userAgent.indexOf("safari")>=0){browser="Safari";}
else if(userAgent.indexOf("trident")>=0){browser="Internet Explorer";}
else{browser="Other";}
if((browser==="Chrome"||browser==="Safari"||browser==="Opera")&&productSub!=="20030107"){return true;}
var tempRes=eval.toString().length;if(tempRes===37&&browser!=="Safari"&&browser!=="Firefox"&&browser!=="Other"){return true;}
else if(tempRes===39&&browser!=="Internet Explorer"&&browser!=="Other"){return true;}
else if(tempRes===33&&browser!=="Chrome"&&browser!=="Opera"&&browser!=="Other"){return true;}
var errFirefox;try{throw"a";}
catch(err){try{err.toSource();errFirefox=true;}
catch(errOfErr){errFirefox=false;}}
return errFirefox&&browser!=="Firefox"&&browser!=="Other";}
function timezone(){try{var param=wnd.Intl.DateTimeFormat().resolvedOptions().timeZone;if(param==undefined){return"not available";}
else
return param;}
catch(_a){return"not available";}}
function timezoneOffset(){try{var timeOffset=new Date().getTimezoneOffset();if(timeOffset==undefined||typeof(timeOffset)!='number'){return null;}
else
return timeOffset;}
catch(_a){return null;}}
function getWebdriver(){try{var webdrv=navigator.webdriver;if(webdrv==undefined){return false;}
if(webdrv==true){return true;}
if(webdrv==false){return false;}
else{return null;}}
catch(_a){return null;}}
function getBodyStyle(){try{var bs=document.body.style;if("msTransform"in bs)
return"ms";else if("MozTransform"in bs&&"MozColumnCount"in bs&&"MozBorderImage"in bs&&"MozColumnGap"in bs)
return"moz";else if("OTransform"in bs)
return"opera";else
return"undefined";}
catch(_a){return null;}}
function getHiddenFunc(d){try{if(d.webkitHidden!=undefined)
return"webkitHidden";if(d.msHidden!=undefined)
return"msHidden";if(d.mozHidden!=undefined)
return"mozHidden";else
return"n/a";}
catch(_a){return"n/a";}}
for(var _i=0,_a=fpData.getComponents();_i<_a.length;_i++){var item=_a[_i];obj[item.key]=item.value;}
obj["adBlock"]=getAdBlock();obj["bodyStyle"]=getBodyStyle();obj["buildId"]=getBuildId();obj["clipboard"]=(nav.clipboard!=null)&&(nav.clipboard!=undefined);obj["doNotTrack"]=getDoNotTrack();obj["getBattery"]=!!("getBattery"in nav);obj["hasLiedLanguages"]=getHasLiedLanguages();obj["hasLiedResolution"]=getHasLiedResolution();obj["hasLiedOs"]=getHasLiedOs();obj["hasLiedBrowser"]=getHasLiedBrowser();obj["locationBar"]=(wnd.locationbar&&wnd.locationbar.visible)||wnd.locationbar!=undefined;obj["mozInnerScreen"]=("mozInnerScreenX"in wnd)&&("mozInnerScreenY"in wnd);obj["requestFileSystem"]=!!("webkitRequestFileSystem"in wnd);obj["timezone"]=timezone();obj["timezoneOffset"]=timezoneOffset();obj["userAgent"]=nav.userAgent;obj["webdriver"]=getWebdriver();obj["productSub"]=nav.productSub.toString();obj["phantom"]=!!(wnd.callPhantom||wnd._phantom);obj["node"]=wnd.Buffer!==undefined;obj["coach"]=wnd.emit!==undefined;obj["rhino"]=wnd.spawn!==undefined;obj["domAuto"]=wnd.domAutomation!==undefined||wnd.domAutomationController!==undefined;obj["online"]=wnd.navigator.onLine;obj["audio"]=null;obj["canvas"]=null;obj["webgl"]=null;obj["touchSupport"]=null;obj["pixelRatio"]=null;var d=document;obj["applePay"]=!!(wnd.ApplePaySession);obj["performance"]=!!(wnd.performance&&"function"==typeof performance.now);obj["topself"]=!!(window.top===window.self);obj["hiddenFunc"]=getHiddenFunc(d);obj["hasFocus"]="hasFocus"in document?document.hasFocus()?true:false:undefined;obj["sendBeacon"]=nav.sendBeacon?true:false;obj["hasCookie"]=!!(nav.cookieEnabled);obj["media"]=nav.mediaDevices&&nav.mediaDevices.getUserMedia?2:nav.getUserMedia?1:0;obj["mFullScreen"]=!!(d.mozCancelFullScreen||d.mozFullScreen||d.mozFullScreenElement||d.mozFullScreenEnabled||d.mozSetImageElement);obj["mRtci"]=!!(wnd.mozRTCIceCandidate||wnd.mozRTCPeerConnection||wnd.mozRTCSessionDescription);if(obj["fonts"]=="TypeError: Cannot read property 'appendChild' of undefined"){obj["fonts"]=["TypeError"];}
obj["uaDataMobile"]=null;obj["uaDataPlatform"]=null;obj["uaDataBrands"]=null;var uaData=nav.userAgentData;if(uaData!=undefined){obj["uaDataBrands"]=uaData.brands;obj["uaDataMobile"]=uaData.mobile;obj["uaDataPlatform"]=uaData.platform;}
obj["windowChrome"]=!!wnd.chrome;obj["doNotTrack"]=!!obj["doNotTrack"];if(typeof(obj["productSub"])!='string')
obj["productSub"]=obj["productSub"].toString();if(typeof(obj["deviceMemory"])!='number')
obj["deviceMemory"]=null;var scr=obj["screenResolution"];if(typeof(scr[0])!='number'||typeof(scr[1])!='number')
obj["screenResolution"]=[0,0];if(typeof(obj["hardwareConcurrency"])!='number')
obj["hardwareConcurrency"]=null;bkd.fpr=obj;bkd.has=fpData.getValue();}
exports.fp=fp;},{"./core/fingerprint":5}],11:[function(require,module,exports){"use strict";var __awaiter=(this&&this.__awaiter)||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value));}catch(e){reject(e);}}
function rejected(value){try{step(generator["throw"](value));}catch(e){reject(e);}}
function step(result){result.done?resolve(result.value):new P(function(resolve){resolve(result.value);}).then(fulfilled,rejected);}
step((generator=generator.apply(thisArg,_arguments||[])).next());});};var __generator=(this&&this.__generator)||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1];},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this;}),g;function verb(n){return function(v){return step([n,v]);};}
function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=y[op[0]&2?"return":op[0]?"throw":"next"])&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[0,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue;}
if(op[0]===3&&(!t||(op[1]>t[0]&&op[1]<t[3]))){_.label=op[1];break;}
if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break;}
if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break;}
if(t[2])_.ops.pop();_.trys.pop();continue;}
op=body.call(thisArg,_);}catch(e){op=[6,e];y=0;}finally{f=t=0;}
if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true};}};exports.__esModule=true;function getAnalyze(wnd){return __awaiter(this,void 0,void 0,function(){var bkd,_u_analytics_,_y_metrika_,isBot,isNobot,isFraud,isBux,isClean,param,cats,cat,h_dimension;return __generator(this,function(_a){bkd=wnd._b_data_;_u_analytics_=bkd.ga4;_y_metrika_=bkd.ycr;isBot=(bkd.oos==1||bkd.oot==true);isNobot=!!(bkd.oos==0)&&!isBot;isFraud=!!(bkd.oos==2);isBux=!!(bkd.oox==true);isClean=!!(bkd.oos==3);param=null;if(isClean){param="clean";}
else if(isNobot){param="nobot";}
else if(isFraud){param="suspect";}
else if(isBot){param="bot";}
if(bkd.srv==1){if(param!=null){if(isBot&&isBux){wnd.ym(_y_metrika_,"params",{"Botfaqtor":'bot'});wnd.ym(_y_metrika_,"params",{"Botfaqtor":'bux'});bkd.yps=1;wnd.gtag("event","page_view",{"Botfaqtor":'bot'});wnd.gtag("event","page_view",{"Botfaqtor":'bux'});bkd.gps=1;}
else{wnd.ym(_y_metrika_,"params",{"Botfaqtor":param});bkd.yps=1;wnd.gtag("event","page_view",{"Botfaqtor":param});bkd.gps=1;}
if(isBot){eval("_tmr.push({type: 'reachGoal', id: 3375222, goal: 'bot'});");bkd.vps=1;}}
if(bkd.ooc!=null){if((isNobot||isClean)&&bkd.ooc.length>0){cats=bkd.ooc;for(cat in cats){wnd.ym(_y_metrika_,"params",{"Botfaqtor":{"Category":cat}});bkd.ycs=1;}}}
if(bkd.uuu!=""){wnd.ym(_y_metrika_,"setUserID",bkd.uuu);}}
if(bkd.srv==0&&param!=null){h_dimension={};h_dimension[bkd.gdb]="Honest-Metrics";wnd.gtag("config",_u_analytics_,{custom_map:h_dimension});wnd.gtag("event","pageview",{"Honest-Metrics":param});}
return[2];});});}
exports.getAnalyze=getAnalyze;},{}],12:[function(require,module,exports){"use strict";var __awaiter=(this&&this.__awaiter)||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value));}catch(e){reject(e);}}
function rejected(value){try{step(generator["throw"](value));}catch(e){reject(e);}}
function step(result){result.done?resolve(result.value):new P(function(resolve){resolve(result.value);}).then(fulfilled,rejected);}
step((generator=generator.apply(thisArg,_arguments||[])).next());});};var __generator=(this&&this.__generator)||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1];},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this;}),g;function verb(n){return function(v){return step([n,v]);};}
function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=y[op[0]&2?"return":op[0]?"throw":"next"])&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[0,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue;}
if(op[0]===3&&(!t||(op[1]>t[0]&&op[1]<t[3]))){_.label=op[1];break;}
if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break;}
if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break;}
if(t[2])_.ops.pop();_.trys.pop();continue;}
op=body.call(thisArg,_);}catch(e){op=[6,e];y=0;}finally{f=t=0;}
if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true};}};exports.__esModule=true;var base_1=require("./core/base");var fp_1=require("./fp");var options_1=require("./core/evercookie/options");var cookie_1=require("./core/evercookie/sources/cookie");var status_async_1=require("./status_async");var wait_ya_1=require("./core/wait_ya");var wait_ga_1=require("./core/wait_ga");var getAnalyze_1=require("./getAnalyze");base_1.base(window);var _locate=location.href;if(_locate.indexOf(".ru")>=0){var wnd=window;wnd._b_data_={sid:829,srv:1,uri:"5-182-5-41",gcr:"UA-160917634-2",ga4:"G-W3TJZ8K0PP",ycr:57157849,gdb:"dimension1",gdc:"dimension2"};}
else if(_locate.indexOf(".com")>=0){var wnd=window;wnd._b_data_={sid:1403,srv:0,uri:"5-182-5-41",gcr:"UA-185912251-1",gdb:"dimension1"};}
function getUid(){var cookie=new cookie_1.Cookie(new options_1.EverCookieOptions());var uid;var cook=document.cookie;if(cook!=null){if(cook.indexOf("ab_id=")>-1){uid=cook.split("ab_id=")[1];if(uid.indexOf(";")>-1){uid=uid.split(";")[0];}}}
if(uid=="00000000-0000-0000-0000-000000000000"){cookie["delete"]("ab_id");return undefined;}
return uid;}
run_async(window);function run_async(wnd){return __awaiter(this,void 0,void 0,function(){var bkd;return __generator(this,function(_a){switch(_a.label){case 0:bkd=wnd._b_data_;bkd.uuu=getUid();fp_1.fp(wnd);return[4,status_async_1.get_status_async(wnd)];case 1:_a.sent();if(bkd.srv==0){wait_ga_1.wait_ga(wnd,500,function(){if(bkd.srv==1){wait_ya_1.wait_ya(wnd,500,function(){getAnalyze_1.getAnalyze(wnd);});}
else{getAnalyze_1.getAnalyze(wnd);}});}
else{wait_ya_1.wait_ya(wnd,500,function(){getAnalyze_1.getAnalyze(wnd);});}
return[2];}});});}},{"./core/base":1,"./core/evercookie/options":3,"./core/evercookie/sources/cookie":4,"./core/wait_ga":8,"./core/wait_ya":9,"./fp":10,"./getAnalyze":11,"./status_async":13}],13:[function(require,module,exports){"use strict";var __awaiter=(this&&this.__awaiter)||function(thisArg,_arguments,P,generator){return new(P||(P=Promise))(function(resolve,reject){function fulfilled(value){try{step(generator.next(value));}catch(e){reject(e);}}
function rejected(value){try{step(generator["throw"](value));}catch(e){reject(e);}}
function step(result){result.done?resolve(result.value):new P(function(resolve){resolve(result.value);}).then(fulfilled,rejected);}
step((generator=generator.apply(thisArg,_arguments||[])).next());});};var __generator=(this&&this.__generator)||function(thisArg,body){var _={label:0,sent:function(){if(t[0]&1)throw t[1];return t[1];},trys:[],ops:[]},f,y,t,g;return g={next:verb(0),"throw":verb(1),"return":verb(2)},typeof Symbol==="function"&&(g[Symbol.iterator]=function(){return this;}),g;function verb(n){return function(v){return step([n,v]);};}
function step(op){if(f)throw new TypeError("Generator is already executing.");while(_)try{if(f=1,y&&(t=y[op[0]&2?"return":op[0]?"throw":"next"])&&!(t=t.call(y,op[1])).done)return t;if(y=0,t)op=[0,t.value];switch(op[0]){case 0:case 1:t=op;break;case 4:_.label++;return{value:op[1],done:false};case 5:_.label++;y=op[1];op=[0];continue;case 7:op=_.ops.pop();_.trys.pop();continue;default:if(!(t=_.trys,t=t.length>0&&t[t.length-1])&&(op[0]===6||op[0]===2)){_=0;continue;}
if(op[0]===3&&(!t||(op[1]>t[0]&&op[1]<t[3]))){_.label=op[1];break;}
if(op[0]===6&&_.label<t[1]){_.label=t[1];t=op;break;}
if(t&&_.label<t[2]){_.label=t[2];_.ops.push(op);break;}
if(t[2])_.ops.pop();_.trys.pop();continue;}
op=body.call(thisArg,_);}catch(e){op=[6,e];y=0;}finally{f=t=0;}
if(op[0]&5)throw op[1];return{value:op[0]?op[1]:void 0,done:true};}};exports.__esModule=true;var client_1=require("./core/client");var options_1=require("./core/evercookie/options");var cookie_1=require("./core/evercookie/sources/cookie");function get_status_async(wnd){return __awaiter(this,void 0,void 0,function(){var bkd,_client,uri,status_data,parse,cookie;return __generator(this,function(_a){switch(_a.label){case 0:bkd=wnd._b_data_;_client=new client_1.Client(bkd.uri,bkd.sid);uri=null;if(bkd.srv==0){uri="https://"+bkd.uri+".witstroom.com/b/h";}
else if(bkd.srv==1){uri="https://"+bkd.uri+".botfaqtor.ru/b/s";}
return[4,_client.check(uri,bkd.has,location.href,bkd.fpr)];case 1:status_data=_a.sent();if(typeof status_data==="object"){if(status_data[0]==200){if(status_data[1]){parse=JSON.parse(status_data[1]);;bkd.ooc=parse.c;bkd.oos=parse.s;bkd.oox=parse.x||false;bkd.oot=parse.t||false;bkd.uuu=bkd.uuu||parse.u;}}}
cookie=new cookie_1.Cookie(new options_1.EverCookieOptions());if(bkd.uuu&&bkd.uuu!="00000000-0000-0000-0000-000000000000"&&bkd.uuu!=""){cookie.set("ab_id",bkd.uuu);}
return[2];}});});}
exports.get_status_async=get_status_async;},{"./core/client":2,"./core/evercookie/options":3,"./core/evercookie/sources/cookie":4}],14:[function(require,module,exports){(function(process,global,setImmediate){!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise){var SomePromiseArray=Promise._SomePromiseArray;function any(promises){var ret=new SomePromiseArray(promises);var promise=ret.promise();ret.setHowMany(1);ret.setUnwrap();ret.init();return promise;}
Promise.any=function(promises){return any(promises);};Promise.prototype.any=function(){return any(this);};};},{}],2:[function(_dereq_,module,exports){"use strict";var firstLineError;try{throw new Error();}catch(e){firstLineError=e;}
var schedule=_dereq_("./schedule");var Queue=_dereq_("./queue");var util=_dereq_("./util");function Async(){this._customScheduler=false;this._isTickUsed=false;this._lateQueue=new Queue(16);this._normalQueue=new Queue(16);this._haveDrainedQueues=false;this._trampolineEnabled=true;var self=this;this.drainQueues=function(){self._drainQueues();};this._schedule=schedule;}
Async.prototype.setScheduler=function(fn){var prev=this._schedule;this._schedule=fn;this._customScheduler=true;return prev;};Async.prototype.hasCustomScheduler=function(){return this._customScheduler;};Async.prototype.enableTrampoline=function(){this._trampolineEnabled=true;};Async.prototype.disableTrampolineIfNecessary=function(){if(util.hasDevTools){this._trampolineEnabled=false;}};Async.prototype.haveItemsQueued=function(){return this._isTickUsed||this._haveDrainedQueues;};Async.prototype.fatalError=function(e,isNode){if(isNode){process.stderr.write("Fatal "+(e instanceof Error?e.stack:e)+"\n");process.exit(2);}else{this.throwLater(e);}};Async.prototype.throwLater=function(fn,arg){if(arguments.length===1){arg=fn;fn=function(){throw arg;};}
if(typeof setTimeout!=="undefined"){setTimeout(function(){fn(arg);},0);}else try{this._schedule(function(){fn(arg);});}catch(e){throw new Error("No async scheduler available\u000a\u000a    See http://goo.gl/MqrFmX\u000a");}};function AsyncInvokeLater(fn,receiver,arg){this._lateQueue.push(fn,receiver,arg);this._queueTick();}
function AsyncInvoke(fn,receiver,arg){this._normalQueue.push(fn,receiver,arg);this._queueTick();}
function AsyncSettlePromises(promise){this._normalQueue._pushOne(promise);this._queueTick();}
if(!util.hasDevTools){Async.prototype.invokeLater=AsyncInvokeLater;Async.prototype.invoke=AsyncInvoke;Async.prototype.settlePromises=AsyncSettlePromises;}else{Async.prototype.invokeLater=function(fn,receiver,arg){if(this._trampolineEnabled){AsyncInvokeLater.call(this,fn,receiver,arg);}else{this._schedule(function(){setTimeout(function(){fn.call(receiver,arg);},100);});}};Async.prototype.invoke=function(fn,receiver,arg){if(this._trampolineEnabled){AsyncInvoke.call(this,fn,receiver,arg);}else{this._schedule(function(){fn.call(receiver,arg);});}};Async.prototype.settlePromises=function(promise){if(this._trampolineEnabled){AsyncSettlePromises.call(this,promise);}else{this._schedule(function(){promise._settlePromises();});}};}
function _drainQueue(queue){while(queue.length()>0){_drainQueueStep(queue);}}
function _drainQueueStep(queue){var fn=queue.shift();if(typeof fn!=="function"){fn._settlePromises();}else{var receiver=queue.shift();var arg=queue.shift();fn.call(receiver,arg);}}
Async.prototype._drainQueues=function(){_drainQueue(this._normalQueue);this._reset();this._haveDrainedQueues=true;_drainQueue(this._lateQueue);};Async.prototype._queueTick=function(){if(!this._isTickUsed){this._isTickUsed=true;this._schedule(this.drainQueues);}};Async.prototype._reset=function(){this._isTickUsed=false;};module.exports=Async;module.exports.firstLineError=firstLineError;},{"./queue":26,"./schedule":29,"./util":36}],3:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL,tryConvertToPromise,debug){var calledBind=false;var rejectThis=function(_,e){this._reject(e);};var targetRejected=function(e,context){context.promiseRejectionQueued=true;context.bindingPromise._then(rejectThis,rejectThis,null,this,e);};var bindingResolved=function(thisArg,context){if(((this._bitField&50397184)===0)){this._resolveCallback(context.target);}};var bindingRejected=function(e,context){if(!context.promiseRejectionQueued)this._reject(e);};Promise.prototype.bind=function(thisArg){if(!calledBind){calledBind=true;Promise.prototype._propagateFrom=debug.propagateFromFunction();Promise.prototype._boundValue=debug.boundValueFunction();}
var maybePromise=tryConvertToPromise(thisArg);var ret=new Promise(INTERNAL);ret._propagateFrom(this,1);var target=this._target();ret._setBoundTo(maybePromise);if(maybePromise instanceof Promise){var context={promiseRejectionQueued:false,promise:ret,target:target,bindingPromise:maybePromise};target._then(INTERNAL,targetRejected,undefined,ret,context);maybePromise._then(bindingResolved,bindingRejected,undefined,ret,context);ret._setOnCancel(maybePromise);}else{ret._resolveCallback(target);}
return ret;};Promise.prototype._setBoundTo=function(obj){if(obj!==undefined){this._bitField=this._bitField|2097152;this._boundTo=obj;}else{this._bitField=this._bitField&(~2097152);}};Promise.prototype._isBound=function(){return(this._bitField&2097152)===2097152;};Promise.bind=function(thisArg,value){return Promise.resolve(value).bind(thisArg);};};},{}],4:[function(_dereq_,module,exports){"use strict";var old;if(typeof Promise!=="undefined")old=Promise;function noConflict(){try{if(Promise===bluebird)Promise=old;}
catch(e){}
return bluebird;}
var bluebird=_dereq_("./promise")();bluebird.noConflict=noConflict;module.exports=bluebird;},{"./promise":22}],5:[function(_dereq_,module,exports){"use strict";var cr=Object.create;if(cr){var callerCache=cr(null);var getterCache=cr(null);callerCache[" size"]=getterCache[" size"]=0;}
module.exports=function(Promise){var util=_dereq_("./util");var canEvaluate=util.canEvaluate;var isIdentifier=util.isIdentifier;var getMethodCaller;var getGetter;if(!true){var makeMethodCaller=function(methodName){return new Function("ensureMethod","                                    \n\
        return function(obj) {                                               \n\
            'use strict'                                                     \n\
            var len = this.length;                                           \n\
            ensureMethod(obj, 'methodName');                                 \n\
            switch(len) {                                                    \n\
                case 1: return obj.methodName(this[0]);                      \n\
                case 2: return obj.methodName(this[0], this[1]);             \n\
                case 3: return obj.methodName(this[0], this[1], this[2]);    \n\
                case 0: return obj.methodName();                             \n\
                default:                                                     \n\
                    return obj.methodName.apply(obj, this);                  \n\
            }                                                                \n\
        };                                                                   \n\
        ".replace(/methodName/g,methodName))(ensureMethod);};var makeGetter=function(propertyName){return new Function("obj","                                             \n\
        'use strict';                                                        \n\
        return obj.propertyName;                                             \n\
        ".replace("propertyName",propertyName));};var getCompiled=function(name,compiler,cache){var ret=cache[name];if(typeof ret!=="function"){if(!isIdentifier(name)){return null;}
ret=compiler(name);cache[name]=ret;cache[" size"]++;if(cache[" size"]>512){var keys=Object.keys(cache);for(var i=0;i<256;++i)delete cache[keys[i]];cache[" size"]=keys.length-256;}}
return ret;};getMethodCaller=function(name){return getCompiled(name,makeMethodCaller,callerCache);};getGetter=function(name){return getCompiled(name,makeGetter,getterCache);};}
function ensureMethod(obj,methodName){var fn;if(obj!=null)fn=obj[methodName];if(typeof fn!=="function"){var message="Object "+util.classString(obj)+" has no method '"+
util.toString(methodName)+"'";throw new Promise.TypeError(message);}
return fn;}
function caller(obj){var methodName=this.pop();var fn=ensureMethod(obj,methodName);return fn.apply(obj,this);}
Promise.prototype.call=function(methodName){var args=[].slice.call(arguments,1);;if(!true){if(canEvaluate){var maybeCaller=getMethodCaller(methodName);if(maybeCaller!==null){return this._then(maybeCaller,undefined,undefined,args,undefined);}}}
args.push(methodName);return this._then(caller,undefined,undefined,args,undefined);};function namedGetter(obj){return obj[this];}
function indexedGetter(obj){var index=+this;if(index<0)index=Math.max(0,index+obj.length);return obj[index];}
Promise.prototype.get=function(propertyName){var isIndex=(typeof propertyName==="number");var getter;if(!isIndex){if(canEvaluate){var maybeGetter=getGetter(propertyName);getter=maybeGetter!==null?maybeGetter:namedGetter;}else{getter=namedGetter;}}else{getter=indexedGetter;}
return this._then(getter,undefined,undefined,propertyName,undefined);};};},{"./util":36}],6:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,PromiseArray,apiRejection,debug){var util=_dereq_("./util");var tryCatch=util.tryCatch;var errorObj=util.errorObj;var async=Promise._async;Promise.prototype["break"]=Promise.prototype.cancel=function(){if(!debug.cancellation())return this._warn("cancellation is disabled");var promise=this;var child=promise;while(promise._isCancellable()){if(!promise._cancelBy(child)){if(child._isFollowing()){child._followee().cancel();}else{child._cancelBranched();}
break;}
var parent=promise._cancellationParent;if(parent==null||!parent._isCancellable()){if(promise._isFollowing()){promise._followee().cancel();}else{promise._cancelBranched();}
break;}else{if(promise._isFollowing())promise._followee().cancel();promise._setWillBeCancelled();child=promise;promise=parent;}}};Promise.prototype._branchHasCancelled=function(){this._branchesRemainingToCancel--;};Promise.prototype._enoughBranchesHaveCancelled=function(){return this._branchesRemainingToCancel===undefined||this._branchesRemainingToCancel<=0;};Promise.prototype._cancelBy=function(canceller){if(canceller===this){this._branchesRemainingToCancel=0;this._invokeOnCancel();return true;}else{this._branchHasCancelled();if(this._enoughBranchesHaveCancelled()){this._invokeOnCancel();return true;}}
return false;};Promise.prototype._cancelBranched=function(){if(this._enoughBranchesHaveCancelled()){this._cancel();}};Promise.prototype._cancel=function(){if(!this._isCancellable())return;this._setCancelled();async.invoke(this._cancelPromises,this,undefined);};Promise.prototype._cancelPromises=function(){if(this._length()>0)this._settlePromises();};Promise.prototype._unsetOnCancel=function(){this._onCancelField=undefined;};Promise.prototype._isCancellable=function(){return this.isPending()&&!this._isCancelled();};Promise.prototype.isCancellable=function(){return this.isPending()&&!this.isCancelled();};Promise.prototype._doInvokeOnCancel=function(onCancelCallback,internalOnly){if(util.isArray(onCancelCallback)){for(var i=0;i<onCancelCallback.length;++i){this._doInvokeOnCancel(onCancelCallback[i],internalOnly);}}else if(onCancelCallback!==undefined){if(typeof onCancelCallback==="function"){if(!internalOnly){var e=tryCatch(onCancelCallback).call(this._boundValue());if(e===errorObj){this._attachExtraTrace(e.e);async.throwLater(e.e);}}}else{onCancelCallback._resultCancelled(this);}}};Promise.prototype._invokeOnCancel=function(){var onCancelCallback=this._onCancel();this._unsetOnCancel();async.invoke(this._doInvokeOnCancel,this,onCancelCallback);};Promise.prototype._invokeInternalOnCancel=function(){if(this._isCancellable()){this._doInvokeOnCancel(this._onCancel(),true);this._unsetOnCancel();}};Promise.prototype._resultCancelled=function(){this.cancel();};};},{"./util":36}],7:[function(_dereq_,module,exports){"use strict";module.exports=function(NEXT_FILTER){var util=_dereq_("./util");var getKeys=_dereq_("./es5").keys;var tryCatch=util.tryCatch;var errorObj=util.errorObj;function catchFilter(instances,cb,promise){return function(e){var boundTo=promise._boundValue();predicateLoop:for(var i=0;i<instances.length;++i){var item=instances[i];if(item===Error||(item!=null&&item.prototype instanceof Error)){if(e instanceof item){return tryCatch(cb).call(boundTo,e);}}else if(typeof item==="function"){var matchesPredicate=tryCatch(item).call(boundTo,e);if(matchesPredicate===errorObj){return matchesPredicate;}else if(matchesPredicate){return tryCatch(cb).call(boundTo,e);}}else if(util.isObject(e)){var keys=getKeys(item);for(var j=0;j<keys.length;++j){var key=keys[j];if(item[key]!=e[key]){continue predicateLoop;}}
return tryCatch(cb).call(boundTo,e);}}
return NEXT_FILTER;};}
return catchFilter;};},{"./es5":13,"./util":36}],8:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise){var longStackTraces=false;var contextStack=[];Promise.prototype._promiseCreated=function(){};Promise.prototype._pushContext=function(){};Promise.prototype._popContext=function(){return null;};Promise._peekContext=Promise.prototype._peekContext=function(){};function Context(){this._trace=new Context.CapturedTrace(peekContext());}
Context.prototype._pushContext=function(){if(this._trace!==undefined){this._trace._promiseCreated=null;contextStack.push(this._trace);}};Context.prototype._popContext=function(){if(this._trace!==undefined){var trace=contextStack.pop();var ret=trace._promiseCreated;trace._promiseCreated=null;return ret;}
return null;};function createContext(){if(longStackTraces)return new Context();}
function peekContext(){var lastIndex=contextStack.length-1;if(lastIndex>=0){return contextStack[lastIndex];}
return undefined;}
Context.CapturedTrace=null;Context.create=createContext;Context.deactivateLongStackTraces=function(){};Context.activateLongStackTraces=function(){var Promise_pushContext=Promise.prototype._pushContext;var Promise_popContext=Promise.prototype._popContext;var Promise_PeekContext=Promise._peekContext;var Promise_peekContext=Promise.prototype._peekContext;var Promise_promiseCreated=Promise.prototype._promiseCreated;Context.deactivateLongStackTraces=function(){Promise.prototype._pushContext=Promise_pushContext;Promise.prototype._popContext=Promise_popContext;Promise._peekContext=Promise_PeekContext;Promise.prototype._peekContext=Promise_peekContext;Promise.prototype._promiseCreated=Promise_promiseCreated;longStackTraces=false;};longStackTraces=true;Promise.prototype._pushContext=Context.prototype._pushContext;Promise.prototype._popContext=Context.prototype._popContext;Promise._peekContext=Promise.prototype._peekContext=peekContext;Promise.prototype._promiseCreated=function(){var ctx=this._peekContext();if(ctx&&ctx._promiseCreated==null)ctx._promiseCreated=this;};};return Context;};},{}],9:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,Context){var getDomain=Promise._getDomain;var async=Promise._async;var Warning=_dereq_("./errors").Warning;var util=_dereq_("./util");var es5=_dereq_("./es5");var canAttachTrace=util.canAttachTrace;var unhandledRejectionHandled;var possiblyUnhandledRejection;var bluebirdFramePattern=/[\\\/]bluebird[\\\/]js[\\\/](release|debug|instrumented)/;var nodeFramePattern=/\((?:timers\.js):\d+:\d+\)/;var parseLinePattern=/[\/<\(](.+?):(\d+):(\d+)\)?\s*$/;var stackFramePattern=null;var formatStack=null;var indentStackFrames=false;var printWarning;var debugging=!!(util.env("BLUEBIRD_DEBUG")!=0&&(true||util.env("BLUEBIRD_DEBUG")||util.env("NODE_ENV")==="development"));var warnings=!!(util.env("BLUEBIRD_WARNINGS")!=0&&(debugging||util.env("BLUEBIRD_WARNINGS")));var longStackTraces=!!(util.env("BLUEBIRD_LONG_STACK_TRACES")!=0&&(debugging||util.env("BLUEBIRD_LONG_STACK_TRACES")));var wForgottenReturn=util.env("BLUEBIRD_W_FORGOTTEN_RETURN")!=0&&(warnings||!!util.env("BLUEBIRD_W_FORGOTTEN_RETURN"));Promise.prototype.suppressUnhandledRejections=function(){var target=this._target();target._bitField=((target._bitField&(~1048576))|524288);};Promise.prototype._ensurePossibleRejectionHandled=function(){if((this._bitField&524288)!==0)return;this._setRejectionIsUnhandled();var self=this;setTimeout(function(){self._notifyUnhandledRejection();},1);};Promise.prototype._notifyUnhandledRejectionIsHandled=function(){fireRejectionEvent("rejectionHandled",unhandledRejectionHandled,undefined,this);};Promise.prototype._setReturnedNonUndefined=function(){this._bitField=this._bitField|268435456;};Promise.prototype._returnedNonUndefined=function(){return(this._bitField&268435456)!==0;};Promise.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var reason=this._settledValue();this._setUnhandledRejectionIsNotified();fireRejectionEvent("unhandledRejection",possiblyUnhandledRejection,reason,this);}};Promise.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=this._bitField|262144;};Promise.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=this._bitField&(~262144);};Promise.prototype._isUnhandledRejectionNotified=function(){return(this._bitField&262144)>0;};Promise.prototype._setRejectionIsUnhandled=function(){this._bitField=this._bitField|1048576;};Promise.prototype._unsetRejectionIsUnhandled=function(){this._bitField=this._bitField&(~1048576);if(this._isUnhandledRejectionNotified()){this._unsetUnhandledRejectionIsNotified();this._notifyUnhandledRejectionIsHandled();}};Promise.prototype._isRejectionUnhandled=function(){return(this._bitField&1048576)>0;};Promise.prototype._warn=function(message,shouldUseOwnTrace,promise){return warn(message,shouldUseOwnTrace,promise||this);};Promise.onPossiblyUnhandledRejection=function(fn){var domain=getDomain();possiblyUnhandledRejection=typeof fn==="function"?(domain===null?fn:util.domainBind(domain,fn)):undefined;};Promise.onUnhandledRejectionHandled=function(fn){var domain=getDomain();unhandledRejectionHandled=typeof fn==="function"?(domain===null?fn:util.domainBind(domain,fn)):undefined;};var disableLongStackTraces=function(){};Promise.longStackTraces=function(){if(async.haveItemsQueued()&&!config.longStackTraces){throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a    See http://goo.gl/MqrFmX\u000a");}
if(!config.longStackTraces&&longStackTracesIsSupported()){var Promise_captureStackTrace=Promise.prototype._captureStackTrace;var Promise_attachExtraTrace=Promise.prototype._attachExtraTrace;var Promise_dereferenceTrace=Promise.prototype._dereferenceTrace;config.longStackTraces=true;disableLongStackTraces=function(){if(async.haveItemsQueued()&&!config.longStackTraces){throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a    See http://goo.gl/MqrFmX\u000a");}
Promise.prototype._captureStackTrace=Promise_captureStackTrace;Promise.prototype._attachExtraTrace=Promise_attachExtraTrace;Promise.prototype._dereferenceTrace=Promise_dereferenceTrace;Context.deactivateLongStackTraces();async.enableTrampoline();config.longStackTraces=false;};Promise.prototype._captureStackTrace=longStackTracesCaptureStackTrace;Promise.prototype._attachExtraTrace=longStackTracesAttachExtraTrace;Promise.prototype._dereferenceTrace=longStackTracesDereferenceTrace;Context.activateLongStackTraces();async.disableTrampolineIfNecessary();}};Promise.hasLongStackTraces=function(){return config.longStackTraces&&longStackTracesIsSupported();};var fireDomEvent=(function(){try{if(typeof CustomEvent==="function"){var event=new CustomEvent("CustomEvent");util.global.dispatchEvent(event);return function(name,event){var eventData={detail:event,cancelable:true};es5.defineProperty(eventData,"promise",{value:event.promise});es5.defineProperty(eventData,"reason",{value:event.reason});var domEvent=new CustomEvent(name.toLowerCase(),eventData);return!util.global.dispatchEvent(domEvent);};}else if(typeof Event==="function"){var event=new Event("CustomEvent");util.global.dispatchEvent(event);return function(name,event){var domEvent=new Event(name.toLowerCase(),{cancelable:true});domEvent.detail=event;es5.defineProperty(domEvent,"promise",{value:event.promise});es5.defineProperty(domEvent,"reason",{value:event.reason});return!util.global.dispatchEvent(domEvent);};}else{var event=document.createEvent("CustomEvent");event.initCustomEvent("testingtheevent",false,true,{});util.global.dispatchEvent(event);return function(name,event){var domEvent=document.createEvent("CustomEvent");domEvent.initCustomEvent(name.toLowerCase(),false,true,event);return!util.global.dispatchEvent(domEvent);};}}catch(e){}
return function(){return false;};})();var fireGlobalEvent=(function(){if(util.isNode){return function(){return process.emit.apply(process,arguments);};}else{if(!util.global){return function(){return false;};}
return function(name){var methodName="on"+name.toLowerCase();var method=util.global[methodName];if(!method)return false;method.apply(util.global,[].slice.call(arguments,1));return true;};}})();function generatePromiseLifecycleEventObject(name,promise){return{promise:promise};}
var eventToObjectGenerator={promiseCreated:generatePromiseLifecycleEventObject,promiseFulfilled:generatePromiseLifecycleEventObject,promiseRejected:generatePromiseLifecycleEventObject,promiseResolved:generatePromiseLifecycleEventObject,promiseCancelled:generatePromiseLifecycleEventObject,promiseChained:function(name,promise,child){return{promise:promise,child:child};},warning:function(name,warning){return{warning:warning};},unhandledRejection:function(name,reason,promise){return{reason:reason,promise:promise};},rejectionHandled:generatePromiseLifecycleEventObject};var activeFireEvent=function(name){var globalEventFired=false;try{globalEventFired=fireGlobalEvent.apply(null,arguments);}catch(e){async.throwLater(e);globalEventFired=true;}
var domEventFired=false;try{domEventFired=fireDomEvent(name,eventToObjectGenerator[name].apply(null,arguments));}catch(e){async.throwLater(e);domEventFired=true;}
return domEventFired||globalEventFired;};Promise.config=function(opts){opts=Object(opts);if("longStackTraces"in opts){if(opts.longStackTraces){Promise.longStackTraces();}else if(!opts.longStackTraces&&Promise.hasLongStackTraces()){disableLongStackTraces();}}
if("warnings"in opts){var warningsOption=opts.warnings;config.warnings=!!warningsOption;wForgottenReturn=config.warnings;if(util.isObject(warningsOption)){if("wForgottenReturn"in warningsOption){wForgottenReturn=!!warningsOption.wForgottenReturn;}}}
if("cancellation"in opts&&opts.cancellation&&!config.cancellation){if(async.haveItemsQueued()){throw new Error("cannot enable cancellation after promises are in use");}
Promise.prototype._clearCancellationData=cancellationClearCancellationData;Promise.prototype._propagateFrom=cancellationPropagateFrom;Promise.prototype._onCancel=cancellationOnCancel;Promise.prototype._setOnCancel=cancellationSetOnCancel;Promise.prototype._attachCancellationCallback=cancellationAttachCancellationCallback;Promise.prototype._execute=cancellationExecute;propagateFromFunction=cancellationPropagateFrom;config.cancellation=true;}
if("monitoring"in opts){if(opts.monitoring&&!config.monitoring){config.monitoring=true;Promise.prototype._fireEvent=activeFireEvent;}else if(!opts.monitoring&&config.monitoring){config.monitoring=false;Promise.prototype._fireEvent=defaultFireEvent;}}
return Promise;};function defaultFireEvent(){return false;}
Promise.prototype._fireEvent=defaultFireEvent;Promise.prototype._execute=function(executor,resolve,reject){try{executor(resolve,reject);}catch(e){return e;}};Promise.prototype._onCancel=function(){};Promise.prototype._setOnCancel=function(handler){;};Promise.prototype._attachCancellationCallback=function(onCancel){;};Promise.prototype._captureStackTrace=function(){};Promise.prototype._attachExtraTrace=function(){};Promise.prototype._dereferenceTrace=function(){};Promise.prototype._clearCancellationData=function(){};Promise.prototype._propagateFrom=function(parent,flags){;;};function cancellationExecute(executor,resolve,reject){var promise=this;try{executor(resolve,reject,function(onCancel){if(typeof onCancel!=="function"){throw new TypeError("onCancel must be a function, got: "+
util.toString(onCancel));}
promise._attachCancellationCallback(onCancel);});}catch(e){return e;}}
function cancellationAttachCancellationCallback(onCancel){if(!this._isCancellable())return this;var previousOnCancel=this._onCancel();if(previousOnCancel!==undefined){if(util.isArray(previousOnCancel)){previousOnCancel.push(onCancel);}else{this._setOnCancel([previousOnCancel,onCancel]);}}else{this._setOnCancel(onCancel);}}
function cancellationOnCancel(){return this._onCancelField;}
function cancellationSetOnCancel(onCancel){this._onCancelField=onCancel;}
function cancellationClearCancellationData(){this._cancellationParent=undefined;this._onCancelField=undefined;}
function cancellationPropagateFrom(parent,flags){if((flags&1)!==0){this._cancellationParent=parent;var branchesRemainingToCancel=parent._branchesRemainingToCancel;if(branchesRemainingToCancel===undefined){branchesRemainingToCancel=0;}
parent._branchesRemainingToCancel=branchesRemainingToCancel+1;}
if((flags&2)!==0&&parent._isBound()){this._setBoundTo(parent._boundTo);}}
function bindingPropagateFrom(parent,flags){if((flags&2)!==0&&parent._isBound()){this._setBoundTo(parent._boundTo);}}
var propagateFromFunction=bindingPropagateFrom;function boundValueFunction(){var ret=this._boundTo;if(ret!==undefined){if(ret instanceof Promise){if(ret.isFulfilled()){return ret.value();}else{return undefined;}}}
return ret;}
function longStackTracesCaptureStackTrace(){this._trace=new CapturedTrace(this._peekContext());}
function longStackTracesAttachExtraTrace(error,ignoreSelf){if(canAttachTrace(error)){var trace=this._trace;if(trace!==undefined){if(ignoreSelf)trace=trace._parent;}
if(trace!==undefined){trace.attachExtraTrace(error);}else if(!error.__stackCleaned__){var parsed=parseStackAndMessage(error);util.notEnumerableProp(error,"stack",parsed.message+"\n"+parsed.stack.join("\n"));util.notEnumerableProp(error,"__stackCleaned__",true);}}}
function longStackTracesDereferenceTrace(){this._trace=undefined;}
function checkForgottenReturns(returnValue,promiseCreated,name,promise,parent){if(returnValue===undefined&&promiseCreated!==null&&wForgottenReturn){if(parent!==undefined&&parent._returnedNonUndefined())return;if((promise._bitField&65535)===0)return;if(name)name=name+" ";var handlerLine="";var creatorLine="";if(promiseCreated._trace){var traceLines=promiseCreated._trace.stack.split("\n");var stack=cleanStack(traceLines);for(var i=stack.length-1;i>=0;--i){var line=stack[i];if(!nodeFramePattern.test(line)){var lineMatches=line.match(parseLinePattern);if(lineMatches){handlerLine="at "+lineMatches[1]+":"+lineMatches[2]+":"+lineMatches[3]+" ";}
break;}}
if(stack.length>0){var firstUserLine=stack[0];for(var i=0;i<traceLines.length;++i){if(traceLines[i]===firstUserLine){if(i>0){creatorLine="\n"+traceLines[i-1];}
break;}}}}
var msg="a promise was created in a "+name+"handler "+handlerLine+"but was not returned from it, "+"see http://goo.gl/rRqMUw"+
creatorLine;promise._warn(msg,true,promiseCreated);}}
function deprecated(name,replacement){var message=name+" is deprecated and will be removed in a future version.";if(replacement)message+=" Use "+replacement+" instead.";return warn(message);}
function warn(message,shouldUseOwnTrace,promise){if(!config.warnings)return;var warning=new Warning(message);var ctx;if(shouldUseOwnTrace){promise._attachExtraTrace(warning);}else if(config.longStackTraces&&(ctx=Promise._peekContext())){ctx.attachExtraTrace(warning);}else{var parsed=parseStackAndMessage(warning);warning.stack=parsed.message+"\n"+parsed.stack.join("\n");}
if(!activeFireEvent("warning",warning)){formatAndLogError(warning,"",true);}}
function reconstructStack(message,stacks){for(var i=0;i<stacks.length-1;++i){stacks[i].push("From previous event:");stacks[i]=stacks[i].join("\n");}
if(i<stacks.length){stacks[i]=stacks[i].join("\n");}
return message+"\n"+stacks.join("\n");}
function removeDuplicateOrEmptyJumps(stacks){for(var i=0;i<stacks.length;++i){if(stacks[i].length===0||((i+1<stacks.length)&&stacks[i][0]===stacks[i+1][0])){stacks.splice(i,1);i--;}}}
function removeCommonRoots(stacks){var current=stacks[0];for(var i=1;i<stacks.length;++i){var prev=stacks[i];var currentLastIndex=current.length-1;var currentLastLine=current[currentLastIndex];var commonRootMeetPoint=-1;for(var j=prev.length-1;j>=0;--j){if(prev[j]===currentLastLine){commonRootMeetPoint=j;break;}}
for(var j=commonRootMeetPoint;j>=0;--j){var line=prev[j];if(current[currentLastIndex]===line){current.pop();currentLastIndex--;}else{break;}}
current=prev;}}
function cleanStack(stack){var ret=[];for(var i=0;i<stack.length;++i){var line=stack[i];var isTraceLine="    (No stack trace)"===line||stackFramePattern.test(line);var isInternalFrame=isTraceLine&&shouldIgnore(line);if(isTraceLine&&!isInternalFrame){if(indentStackFrames&&line.charAt(0)!==" "){line="    "+line;}
ret.push(line);}}
return ret;}
function stackFramesAsArray(error){var stack=error.stack.replace(/\s+$/g,"").split("\n");for(var i=0;i<stack.length;++i){var line=stack[i];if("    (No stack trace)"===line||stackFramePattern.test(line)){break;}}
if(i>0&&error.name!="SyntaxError"){stack=stack.slice(i);}
return stack;}
function parseStackAndMessage(error){var stack=error.stack;var message=error.toString();stack=typeof stack==="string"&&stack.length>0?stackFramesAsArray(error):["    (No stack trace)"];return{message:message,stack:error.name=="SyntaxError"?stack:cleanStack(stack)};}
function formatAndLogError(error,title,isSoft){if(typeof console!=="undefined"){var message;if(util.isObject(error)){var stack=error.stack;message=title+formatStack(stack,error);}else{message=title+String(error);}
if(typeof printWarning==="function"){printWarning(message,isSoft);}else if(typeof console.log==="function"||typeof console.log==="object"){console.log(message);}}}
function fireRejectionEvent(name,localHandler,reason,promise){var localEventFired=false;try{if(typeof localHandler==="function"){localEventFired=true;if(name==="rejectionHandled"){localHandler(promise);}else{localHandler(reason,promise);}}}catch(e){async.throwLater(e);}
if(name==="unhandledRejection"){if(!activeFireEvent(name,reason,promise)&&!localEventFired){formatAndLogError(reason,"Unhandled rejection ");}}else{activeFireEvent(name,promise);}}
function formatNonError(obj){var str;if(typeof obj==="function"){str="[function "+
(obj.name||"anonymous")+"]";}else{str=obj&&typeof obj.toString==="function"?obj.toString():util.toString(obj);var ruselessToString=/\[object [a-zA-Z0-9$_]+\]/;if(ruselessToString.test(str)){try{var newStr=JSON.stringify(obj);str=newStr;}
catch(e){}}
if(str.length===0){str="(empty array)";}}
return("(<"+snip(str)+">, no stack trace)");}
function snip(str){var maxChars=41;if(str.length<maxChars){return str;}
return str.substr(0,maxChars-3)+"...";}
function longStackTracesIsSupported(){return typeof captureStackTrace==="function";}
var shouldIgnore=function(){return false;};var parseLineInfoRegex=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;function parseLineInfo(line){var matches=line.match(parseLineInfoRegex);if(matches){return{fileName:matches[1],line:parseInt(matches[2],10)};}}
function setBounds(firstLineError,lastLineError){if(!longStackTracesIsSupported())return;var firstStackLines=firstLineError.stack.split("\n");var lastStackLines=lastLineError.stack.split("\n");var firstIndex=-1;var lastIndex=-1;var firstFileName;var lastFileName;for(var i=0;i<firstStackLines.length;++i){var result=parseLineInfo(firstStackLines[i]);if(result){firstFileName=result.fileName;firstIndex=result.line;break;}}
for(var i=0;i<lastStackLines.length;++i){var result=parseLineInfo(lastStackLines[i]);if(result){lastFileName=result.fileName;lastIndex=result.line;break;}}
if(firstIndex<0||lastIndex<0||!firstFileName||!lastFileName||firstFileName!==lastFileName||firstIndex>=lastIndex){return;}
shouldIgnore=function(line){if(bluebirdFramePattern.test(line))return true;var info=parseLineInfo(line);if(info){if(info.fileName===firstFileName&&(firstIndex<=info.line&&info.line<=lastIndex)){return true;}}
return false;};}
function CapturedTrace(parent){this._parent=parent;this._promisesCreated=0;var length=this._length=1+(parent===undefined?0:parent._length);captureStackTrace(this,CapturedTrace);if(length>32)this.uncycle();}
util.inherits(CapturedTrace,Error);Context.CapturedTrace=CapturedTrace;CapturedTrace.prototype.uncycle=function(){var length=this._length;if(length<2)return;var nodes=[];var stackToIndex={};for(var i=0,node=this;node!==undefined;++i){nodes.push(node);node=node._parent;}
length=this._length=i;for(var i=length-1;i>=0;--i){var stack=nodes[i].stack;if(stackToIndex[stack]===undefined){stackToIndex[stack]=i;}}
for(var i=0;i<length;++i){var currentStack=nodes[i].stack;var index=stackToIndex[currentStack];if(index!==undefined&&index!==i){if(index>0){nodes[index-1]._parent=undefined;nodes[index-1]._length=1;}
nodes[i]._parent=undefined;nodes[i]._length=1;var cycleEdgeNode=i>0?nodes[i-1]:this;if(index<length-1){cycleEdgeNode._parent=nodes[index+1];cycleEdgeNode._parent.uncycle();cycleEdgeNode._length=cycleEdgeNode._parent._length+1;}else{cycleEdgeNode._parent=undefined;cycleEdgeNode._length=1;}
var currentChildLength=cycleEdgeNode._length+1;for(var j=i-2;j>=0;--j){nodes[j]._length=currentChildLength;currentChildLength++;}
return;}}};CapturedTrace.prototype.attachExtraTrace=function(error){if(error.__stackCleaned__)return;this.uncycle();var parsed=parseStackAndMessage(error);var message=parsed.message;var stacks=[parsed.stack];var trace=this;while(trace!==undefined){stacks.push(cleanStack(trace.stack.split("\n")));trace=trace._parent;}
removeCommonRoots(stacks);removeDuplicateOrEmptyJumps(stacks);util.notEnumerableProp(error,"stack",reconstructStack(message,stacks));util.notEnumerableProp(error,"__stackCleaned__",true);};var captureStackTrace=(function stackDetection(){var v8stackFramePattern=/^\s*at\s*/;var v8stackFormatter=function(stack,error){if(typeof stack==="string")return stack;if(error.name!==undefined&&error.message!==undefined){return error.toString();}
return formatNonError(error);};if(typeof Error.stackTraceLimit==="number"&&typeof Error.captureStackTrace==="function"){Error.stackTraceLimit+=6;stackFramePattern=v8stackFramePattern;formatStack=v8stackFormatter;var captureStackTrace=Error.captureStackTrace;shouldIgnore=function(line){return bluebirdFramePattern.test(line);};return function(receiver,ignoreUntil){Error.stackTraceLimit+=6;captureStackTrace(receiver,ignoreUntil);Error.stackTraceLimit-=6;};}
var err=new Error();if(typeof err.stack==="string"&&err.stack.split("\n")[0].indexOf("stackDetection@")>=0){stackFramePattern=/@/;formatStack=v8stackFormatter;indentStackFrames=true;return function captureStackTrace(o){o.stack=new Error().stack;};}
var hasStackAfterThrow;try{throw new Error();}
catch(e){hasStackAfterThrow=("stack"in e);}
if(!("stack"in err)&&hasStackAfterThrow&&typeof Error.stackTraceLimit==="number"){stackFramePattern=v8stackFramePattern;formatStack=v8stackFormatter;return function captureStackTrace(o){Error.stackTraceLimit+=6;try{throw new Error();}
catch(e){o.stack=e.stack;}
Error.stackTraceLimit-=6;};}
formatStack=function(stack,error){if(typeof stack==="string")return stack;if((typeof error==="object"||typeof error==="function")&&error.name!==undefined&&error.message!==undefined){return error.toString();}
return formatNonError(error);};return null;})([]);if(typeof console!=="undefined"&&typeof console.warn!=="undefined"){printWarning=function(message){console.warn(message);};if(util.isNode&&process.stderr.isTTY){printWarning=function(message,isSoft){var color=isSoft?"\u001b[33m":"\u001b[31m";console.warn(color+message+"\u001b[0m\n");};}else if(!util.isNode&&typeof(new Error().stack)==="string"){printWarning=function(message,isSoft){console.warn("%c"+message,isSoft?"color: darkorange":"color: red");};}}
var config={warnings:warnings,longStackTraces:false,cancellation:false,monitoring:false};if(longStackTraces)Promise.longStackTraces();return{longStackTraces:function(){return config.longStackTraces;},warnings:function(){return config.warnings;},cancellation:function(){return config.cancellation;},monitoring:function(){return config.monitoring;},propagateFromFunction:function(){return propagateFromFunction;},boundValueFunction:function(){return boundValueFunction;},checkForgottenReturns:checkForgottenReturns,setBounds:setBounds,warn:warn,deprecated:deprecated,CapturedTrace:CapturedTrace,fireDomEvent:fireDomEvent,fireGlobalEvent:fireGlobalEvent};};},{"./errors":12,"./es5":13,"./util":36}],10:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise){function returner(){return this.value;}
function thrower(){throw this.reason;}
Promise.prototype["return"]=Promise.prototype.thenReturn=function(value){if(value instanceof Promise)value.suppressUnhandledRejections();return this._then(returner,undefined,undefined,{value:value},undefined);};Promise.prototype["throw"]=Promise.prototype.thenThrow=function(reason){return this._then(thrower,undefined,undefined,{reason:reason},undefined);};Promise.prototype.catchThrow=function(reason){if(arguments.length<=1){return this._then(undefined,thrower,undefined,{reason:reason},undefined);}else{var _reason=arguments[1];var handler=function(){throw _reason;};return this.caught(reason,handler);}};Promise.prototype.catchReturn=function(value){if(arguments.length<=1){if(value instanceof Promise)value.suppressUnhandledRejections();return this._then(undefined,returner,undefined,{value:value},undefined);}else{var _value=arguments[1];if(_value instanceof Promise)_value.suppressUnhandledRejections();var handler=function(){return _value;};return this.caught(value,handler);}};};},{}],11:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL){var PromiseReduce=Promise.reduce;var PromiseAll=Promise.all;function promiseAllThis(){return PromiseAll(this);}
function PromiseMapSeries(promises,fn){return PromiseReduce(promises,fn,INTERNAL,INTERNAL);}
Promise.prototype.each=function(fn){return PromiseReduce(this,fn,INTERNAL,0)._then(promiseAllThis,undefined,undefined,this,undefined);};Promise.prototype.mapSeries=function(fn){return PromiseReduce(this,fn,INTERNAL,INTERNAL);};Promise.each=function(promises,fn){return PromiseReduce(promises,fn,INTERNAL,0)._then(promiseAllThis,undefined,undefined,promises,undefined);};Promise.mapSeries=PromiseMapSeries;};},{}],12:[function(_dereq_,module,exports){"use strict";var es5=_dereq_("./es5");var Objectfreeze=es5.freeze;var util=_dereq_("./util");var inherits=util.inherits;var notEnumerableProp=util.notEnumerableProp;function subError(nameProperty,defaultMessage){function SubError(message){if(!(this instanceof SubError))return new SubError(message);notEnumerableProp(this,"message",typeof message==="string"?message:defaultMessage);notEnumerableProp(this,"name",nameProperty);if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor);}else{Error.call(this);}}
inherits(SubError,Error);return SubError;}
var _TypeError,_RangeError;var Warning=subError("Warning","warning");var CancellationError=subError("CancellationError","cancellation error");var TimeoutError=subError("TimeoutError","timeout error");var AggregateError=subError("AggregateError","aggregate error");try{_TypeError=TypeError;_RangeError=RangeError;}catch(e){_TypeError=subError("TypeError","type error");_RangeError=subError("RangeError","range error");}
var methods=("join pop push shift unshift slice filter forEach some "+"every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" ");for(var i=0;i<methods.length;++i){if(typeof Array.prototype[methods[i]]==="function"){AggregateError.prototype[methods[i]]=Array.prototype[methods[i]];}}
es5.defineProperty(AggregateError.prototype,"length",{value:0,configurable:false,writable:true,enumerable:true});AggregateError.prototype["isOperational"]=true;var level=0;AggregateError.prototype.toString=function(){var indent=Array(level*4+1).join(" ");var ret="\n"+indent+"AggregateError of:"+"\n";level++;indent=Array(level*4+1).join(" ");for(var i=0;i<this.length;++i){var str=this[i]===this?"[Circular AggregateError]":this[i]+"";var lines=str.split("\n");for(var j=0;j<lines.length;++j){lines[j]=indent+lines[j];}
str=lines.join("\n");ret+=str+"\n";}
level--;return ret;};function OperationalError(message){if(!(this instanceof OperationalError))
return new OperationalError(message);notEnumerableProp(this,"name","OperationalError");notEnumerableProp(this,"message",message);this.cause=message;this["isOperational"]=true;if(message instanceof Error){notEnumerableProp(this,"message",message.message);notEnumerableProp(this,"stack",message.stack);}else if(Error.captureStackTrace){Error.captureStackTrace(this,this.constructor);}}
inherits(OperationalError,Error);var errorTypes=Error["__BluebirdErrorTypes__"];if(!errorTypes){errorTypes=Objectfreeze({CancellationError:CancellationError,TimeoutError:TimeoutError,OperationalError:OperationalError,RejectionError:OperationalError,AggregateError:AggregateError});es5.defineProperty(Error,"__BluebirdErrorTypes__",{value:errorTypes,writable:false,enumerable:false,configurable:false});}
module.exports={Error:Error,TypeError:_TypeError,RangeError:_RangeError,CancellationError:errorTypes.CancellationError,OperationalError:errorTypes.OperationalError,TimeoutError:errorTypes.TimeoutError,AggregateError:errorTypes.AggregateError,Warning:Warning};},{"./es5":13,"./util":36}],13:[function(_dereq_,module,exports){var isES5=(function(){"use strict";return this===undefined;})();if(isES5){module.exports={freeze:Object.freeze,defineProperty:Object.defineProperty,getDescriptor:Object.getOwnPropertyDescriptor,keys:Object.keys,names:Object.getOwnPropertyNames,getPrototypeOf:Object.getPrototypeOf,isArray:Array.isArray,isES5:isES5,propertyIsWritable:function(obj,prop){var descriptor=Object.getOwnPropertyDescriptor(obj,prop);return!!(!descriptor||descriptor.writable||descriptor.set);}};}else{var has={}.hasOwnProperty;var str={}.toString;var proto={}.constructor.prototype;var ObjectKeys=function(o){var ret=[];for(var key in o){if(has.call(o,key)){ret.push(key);}}
return ret;};var ObjectGetDescriptor=function(o,key){return{value:o[key]};};var ObjectDefineProperty=function(o,key,desc){o[key]=desc.value;return o;};var ObjectFreeze=function(obj){return obj;};var ObjectGetPrototypeOf=function(obj){try{return Object(obj).constructor.prototype;}
catch(e){return proto;}};var ArrayIsArray=function(obj){try{return str.call(obj)==="[object Array]";}
catch(e){return false;}};module.exports={isArray:ArrayIsArray,keys:ObjectKeys,names:ObjectKeys,defineProperty:ObjectDefineProperty,getDescriptor:ObjectGetDescriptor,freeze:ObjectFreeze,getPrototypeOf:ObjectGetPrototypeOf,isES5:isES5,propertyIsWritable:function(){return true;}};}},{}],14:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL){var PromiseMap=Promise.map;Promise.prototype.filter=function(fn,options){return PromiseMap(this,fn,options,INTERNAL);};Promise.filter=function(promises,fn,options){return PromiseMap(promises,fn,options,INTERNAL);};};},{}],15:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,tryConvertToPromise,NEXT_FILTER){var util=_dereq_("./util");var CancellationError=Promise.CancellationError;var errorObj=util.errorObj;var catchFilter=_dereq_("./catch_filter")(NEXT_FILTER);function PassThroughHandlerContext(promise,type,handler){this.promise=promise;this.type=type;this.handler=handler;this.called=false;this.cancelPromise=null;}
PassThroughHandlerContext.prototype.isFinallyHandler=function(){return this.type===0;};function FinallyHandlerCancelReaction(finallyHandler){this.finallyHandler=finallyHandler;}
FinallyHandlerCancelReaction.prototype._resultCancelled=function(){checkCancel(this.finallyHandler);};function checkCancel(ctx,reason){if(ctx.cancelPromise!=null){if(arguments.length>1){ctx.cancelPromise._reject(reason);}else{ctx.cancelPromise._cancel();}
ctx.cancelPromise=null;return true;}
return false;}
function succeed(){return finallyHandler.call(this,this.promise._target()._settledValue());}
function fail(reason){if(checkCancel(this,reason))return;errorObj.e=reason;return errorObj;}
function finallyHandler(reasonOrValue){var promise=this.promise;var handler=this.handler;if(!this.called){this.called=true;var ret=this.isFinallyHandler()?handler.call(promise._boundValue()):handler.call(promise._boundValue(),reasonOrValue);if(ret===NEXT_FILTER){return ret;}else if(ret!==undefined){promise._setReturnedNonUndefined();var maybePromise=tryConvertToPromise(ret,promise);if(maybePromise instanceof Promise){if(this.cancelPromise!=null){if(maybePromise._isCancelled()){var reason=new CancellationError("late cancellation observer");promise._attachExtraTrace(reason);errorObj.e=reason;return errorObj;}else if(maybePromise.isPending()){maybePromise._attachCancellationCallback(new FinallyHandlerCancelReaction(this));}}
return maybePromise._then(succeed,fail,undefined,this,undefined);}}}
if(promise.isRejected()){checkCancel(this);errorObj.e=reasonOrValue;return errorObj;}else{checkCancel(this);return reasonOrValue;}}
Promise.prototype._passThrough=function(handler,type,success,fail){if(typeof handler!=="function")return this.then();return this._then(success,fail,undefined,new PassThroughHandlerContext(this,type,handler),undefined);};Promise.prototype.lastly=Promise.prototype["finally"]=function(handler){return this._passThrough(handler,0,finallyHandler,finallyHandler);};Promise.prototype.tap=function(handler){return this._passThrough(handler,1,finallyHandler);};Promise.prototype.tapCatch=function(handlerOrPredicate){var len=arguments.length;if(len===1){return this._passThrough(handlerOrPredicate,1,undefined,finallyHandler);}else{var catchInstances=new Array(len-1),j=0,i;for(i=0;i<len-1;++i){var item=arguments[i];if(util.isObject(item)){catchInstances[j++]=item;}else{return Promise.reject(new TypeError("tapCatch statement predicate: "
+"expecting an object but got "+util.classString(item)));}}
catchInstances.length=j;var handler=arguments[i];return this._passThrough(catchFilter(catchInstances,handler,this),1,undefined,finallyHandler);}};return PassThroughHandlerContext;};},{"./catch_filter":7,"./util":36}],16:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,apiRejection,INTERNAL,tryConvertToPromise,Proxyable,debug){var errors=_dereq_("./errors");var TypeError=errors.TypeError;var util=_dereq_("./util");var errorObj=util.errorObj;var tryCatch=util.tryCatch;var yieldHandlers=[];function promiseFromYieldHandler(value,yieldHandlers,traceParent){for(var i=0;i<yieldHandlers.length;++i){traceParent._pushContext();var result=tryCatch(yieldHandlers[i])(value);traceParent._popContext();if(result===errorObj){traceParent._pushContext();var ret=Promise.reject(errorObj.e);traceParent._popContext();return ret;}
var maybePromise=tryConvertToPromise(result,traceParent);if(maybePromise instanceof Promise)return maybePromise;}
return null;}
function PromiseSpawn(generatorFunction,receiver,yieldHandler,stack){if(debug.cancellation()){var internal=new Promise(INTERNAL);var _finallyPromise=this._finallyPromise=new Promise(INTERNAL);this._promise=internal.lastly(function(){return _finallyPromise;});internal._captureStackTrace();internal._setOnCancel(this);}else{var promise=this._promise=new Promise(INTERNAL);promise._captureStackTrace();}
this._stack=stack;this._generatorFunction=generatorFunction;this._receiver=receiver;this._generator=undefined;this._yieldHandlers=typeof yieldHandler==="function"?[yieldHandler].concat(yieldHandlers):yieldHandlers;this._yieldedPromise=null;this._cancellationPhase=false;}
util.inherits(PromiseSpawn,Proxyable);PromiseSpawn.prototype._isResolved=function(){return this._promise===null;};PromiseSpawn.prototype._cleanup=function(){this._promise=this._generator=null;if(debug.cancellation()&&this._finallyPromise!==null){this._finallyPromise._fulfill();this._finallyPromise=null;}};PromiseSpawn.prototype._promiseCancelled=function(){if(this._isResolved())return;var implementsReturn=typeof this._generator["return"]!=="undefined";var result;if(!implementsReturn){var reason=new Promise.CancellationError("generator .return() sentinel");Promise.coroutine.returnSentinel=reason;this._promise._attachExtraTrace(reason);this._promise._pushContext();result=tryCatch(this._generator["throw"]).call(this._generator,reason);this._promise._popContext();}else{this._promise._pushContext();result=tryCatch(this._generator["return"]).call(this._generator,undefined);this._promise._popContext();}
this._cancellationPhase=true;this._yieldedPromise=null;this._continue(result);};PromiseSpawn.prototype._promiseFulfilled=function(value){this._yieldedPromise=null;this._promise._pushContext();var result=tryCatch(this._generator.next).call(this._generator,value);this._promise._popContext();this._continue(result);};PromiseSpawn.prototype._promiseRejected=function(reason){this._yieldedPromise=null;this._promise._attachExtraTrace(reason);this._promise._pushContext();var result=tryCatch(this._generator["throw"]).call(this._generator,reason);this._promise._popContext();this._continue(result);};PromiseSpawn.prototype._resultCancelled=function(){if(this._yieldedPromise instanceof Promise){var promise=this._yieldedPromise;this._yieldedPromise=null;promise.cancel();}};PromiseSpawn.prototype.promise=function(){return this._promise;};PromiseSpawn.prototype._run=function(){this._generator=this._generatorFunction.call(this._receiver);this._receiver=this._generatorFunction=undefined;this._promiseFulfilled(undefined);};PromiseSpawn.prototype._continue=function(result){var promise=this._promise;if(result===errorObj){this._cleanup();if(this._cancellationPhase){return promise.cancel();}else{return promise._rejectCallback(result.e,false);}}
var value=result.value;if(result.done===true){this._cleanup();if(this._cancellationPhase){return promise.cancel();}else{return promise._resolveCallback(value);}}else{var maybePromise=tryConvertToPromise(value,this._promise);if(!(maybePromise instanceof Promise)){maybePromise=promiseFromYieldHandler(maybePromise,this._yieldHandlers,this._promise);if(maybePromise===null){this._promiseRejected(new TypeError("A value %s was yielded that could not be treated as a promise\u000a\u000a    See http://goo.gl/MqrFmX\u000a\u000a".replace("%s",String(value))+"From coroutine:\u000a"+
this._stack.split("\n").slice(1,-7).join("\n")));return;}}
maybePromise=maybePromise._target();var bitField=maybePromise._bitField;;if(((bitField&50397184)===0)){this._yieldedPromise=maybePromise;maybePromise._proxy(this,null);}else if(((bitField&33554432)!==0)){Promise._async.invoke(this._promiseFulfilled,this,maybePromise._value());}else if(((bitField&16777216)!==0)){Promise._async.invoke(this._promiseRejected,this,maybePromise._reason());}else{this._promiseCancelled();}}};Promise.coroutine=function(generatorFunction,options){if(typeof generatorFunction!=="function"){throw new TypeError("generatorFunction must be a function\u000a\u000a    See http://goo.gl/MqrFmX\u000a");}
var yieldHandler=Object(options).yieldHandler;var PromiseSpawn$=PromiseSpawn;var stack=new Error().stack;return function(){var generator=generatorFunction.apply(this,arguments);var spawn=new PromiseSpawn$(undefined,undefined,yieldHandler,stack);var ret=spawn.promise();spawn._generator=generator;spawn._promiseFulfilled(undefined);return ret;};};Promise.coroutine.addYieldHandler=function(fn){if(typeof fn!=="function"){throw new TypeError("expecting a function but got "+util.classString(fn));}
yieldHandlers.push(fn);};Promise.spawn=function(generatorFunction){debug.deprecated("Promise.spawn()","Promise.coroutine()");if(typeof generatorFunction!=="function"){return apiRejection("generatorFunction must be a function\u000a\u000a    See http://goo.gl/MqrFmX\u000a");}
var spawn=new PromiseSpawn(generatorFunction,this);var ret=spawn.promise();spawn._run(Promise.spawn);return ret;};};},{"./errors":12,"./util":36}],17:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,PromiseArray,tryConvertToPromise,INTERNAL,async,getDomain){var util=_dereq_("./util");var canEvaluate=util.canEvaluate;var tryCatch=util.tryCatch;var errorObj=util.errorObj;var reject;if(!true){if(canEvaluate){var thenCallback=function(i){return new Function("value","holder","                             \n\
            'use strict';                                                    \n\
            holder.pIndex = value;                                           \n\
            holder.checkFulfillment(this);                                   \n\
            ".replace(/Index/g,i));};var promiseSetter=function(i){return new Function("promise","holder","                           \n\
            'use strict';                                                    \n\
            holder.pIndex = promise;                                         \n\
            ".replace(/Index/g,i));};var generateHolderClass=function(total){var props=new Array(total);for(var i=0;i<props.length;++i){props[i]="this.p"+(i+1);}
var assignment=props.join(" = ")+" = null;";var cancellationCode="var promise;\n"+props.map(function(prop){return"                                                         \n\
                promise = "+prop+";                                      \n\
                if (promise instanceof Promise) {                            \n\
                    promise.cancel();                                        \n\
                }                                                            \n\
            ";}).join("\n");var passedArguments=props.join(", ");var name="Holder$"+total;var code="return function(tryCatch, errorObj, Promise, async) {    \n\
            'use strict';                                                    \n\
            function [TheName](fn) {                                         \n\
                [TheProperties]                                              \n\
                this.fn = fn;                                                \n\
                this.asyncNeeded = true;                                     \n\
                this.now = 0;                                                \n\
            }                                                                \n\
                                                                             \n\
            [TheName].prototype._callFunction = function(promise) {          \n\
                promise._pushContext();                                      \n\
                var ret = tryCatch(this.fn)([ThePassedArguments]);           \n\
                promise._popContext();                                       \n\
                if (ret === errorObj) {                                      \n\
                    promise._rejectCallback(ret.e, false);                   \n\
                } else {                                                     \n\
                    promise._resolveCallback(ret);                           \n\
                }                                                            \n\
            };                                                               \n\
                                                                             \n\
            [TheName].prototype.checkFulfillment = function(promise) {       \n\
                var now = ++this.now;                                        \n\
                if (now === [TheTotal]) {                                    \n\
                    if (this.asyncNeeded) {                                  \n\
                        async.invoke(this._callFunction, this, promise);     \n\
                    } else {                                                 \n\
                        this._callFunction(promise);                         \n\
                    }                                                        \n\
                                                                             \n\
                }                                                            \n\
            };                                                               \n\
                                                                             \n\
            [TheName].prototype._resultCancelled = function() {              \n\
                [CancellationCode]                                           \n\
            };                                                               \n\
                                                                             \n\
            return [TheName];                                                \n\
        }(tryCatch, errorObj, Promise, async);                               \n\
        ";code=code.replace(/\[TheName\]/g,name).replace(/\[TheTotal\]/g,total).replace(/\[ThePassedArguments\]/g,passedArguments).replace(/\[TheProperties\]/g,assignment).replace(/\[CancellationCode\]/g,cancellationCode);return new Function("tryCatch","errorObj","Promise","async",code)
(tryCatch,errorObj,Promise,async);};var holderClasses=[];var thenCallbacks=[];var promiseSetters=[];for(var i=0;i<8;++i){holderClasses.push(generateHolderClass(i+1));thenCallbacks.push(thenCallback(i+1));promiseSetters.push(promiseSetter(i+1));}
reject=function(reason){this._reject(reason);};}}
Promise.join=function(){var last=arguments.length-1;var fn;if(last>0&&typeof arguments[last]==="function"){fn=arguments[last];if(!true){if(last<=8&&canEvaluate){var ret=new Promise(INTERNAL);ret._captureStackTrace();var HolderClass=holderClasses[last-1];var holder=new HolderClass(fn);var callbacks=thenCallbacks;for(var i=0;i<last;++i){var maybePromise=tryConvertToPromise(arguments[i],ret);if(maybePromise instanceof Promise){maybePromise=maybePromise._target();var bitField=maybePromise._bitField;;if(((bitField&50397184)===0)){maybePromise._then(callbacks[i],reject,undefined,ret,holder);promiseSetters[i](maybePromise,holder);holder.asyncNeeded=false;}else if(((bitField&33554432)!==0)){callbacks[i].call(ret,maybePromise._value(),holder);}else if(((bitField&16777216)!==0)){ret._reject(maybePromise._reason());}else{ret._cancel();}}else{callbacks[i].call(ret,maybePromise,holder);}}
if(!ret._isFateSealed()){if(holder.asyncNeeded){var domain=getDomain();if(domain!==null){holder.fn=util.domainBind(domain,holder.fn);}}
ret._setAsyncGuaranteed();ret._setOnCancel(holder);}
return ret;}}}
var args=[].slice.call(arguments);;if(fn)args.pop();var ret=new PromiseArray(args).promise();return fn!==undefined?ret.spread(fn):ret;};};},{"./util":36}],18:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,PromiseArray,apiRejection,tryConvertToPromise,INTERNAL,debug){var getDomain=Promise._getDomain;var util=_dereq_("./util");var tryCatch=util.tryCatch;var errorObj=util.errorObj;var async=Promise._async;function MappingPromiseArray(promises,fn,limit,_filter){this.constructor$(promises);this._promise._captureStackTrace();var domain=getDomain();this._callback=domain===null?fn:util.domainBind(domain,fn);this._preservedValues=_filter===INTERNAL?new Array(this.length()):null;this._limit=limit;this._inFlight=0;this._queue=[];async.invoke(this._asyncInit,this,undefined);}
util.inherits(MappingPromiseArray,PromiseArray);MappingPromiseArray.prototype._asyncInit=function(){this._init$(undefined,-2);};MappingPromiseArray.prototype._init=function(){};MappingPromiseArray.prototype._promiseFulfilled=function(value,index){var values=this._values;var length=this.length();var preservedValues=this._preservedValues;var limit=this._limit;if(index<0){index=(index*-1)-1;values[index]=value;if(limit>=1){this._inFlight--;this._drainQueue();if(this._isResolved())return true;}}else{if(limit>=1&&this._inFlight>=limit){values[index]=value;this._queue.push(index);return false;}
if(preservedValues!==null)preservedValues[index]=value;var promise=this._promise;var callback=this._callback;var receiver=promise._boundValue();promise._pushContext();var ret=tryCatch(callback).call(receiver,value,index,length);var promiseCreated=promise._popContext();debug.checkForgottenReturns(ret,promiseCreated,preservedValues!==null?"Promise.filter":"Promise.map",promise);if(ret===errorObj){this._reject(ret.e);return true;}
var maybePromise=tryConvertToPromise(ret,this._promise);if(maybePromise instanceof Promise){maybePromise=maybePromise._target();var bitField=maybePromise._bitField;;if(((bitField&50397184)===0)){if(limit>=1)this._inFlight++;values[index]=maybePromise;maybePromise._proxy(this,(index+1)*-1);return false;}else if(((bitField&33554432)!==0)){ret=maybePromise._value();}else if(((bitField&16777216)!==0)){this._reject(maybePromise._reason());return true;}else{this._cancel();return true;}}
values[index]=ret;}
var totalResolved=++this._totalResolved;if(totalResolved>=length){if(preservedValues!==null){this._filter(values,preservedValues);}else{this._resolve(values);}
return true;}
return false;};MappingPromiseArray.prototype._drainQueue=function(){var queue=this._queue;var limit=this._limit;var values=this._values;while(queue.length>0&&this._inFlight<limit){if(this._isResolved())return;var index=queue.pop();this._promiseFulfilled(values[index],index);}};MappingPromiseArray.prototype._filter=function(booleans,values){var len=values.length;var ret=new Array(len);var j=0;for(var i=0;i<len;++i){if(booleans[i])ret[j++]=values[i];}
ret.length=j;this._resolve(ret);};MappingPromiseArray.prototype.preservedValues=function(){return this._preservedValues;};function map(promises,fn,options,_filter){if(typeof fn!=="function"){return apiRejection("expecting a function but got "+util.classString(fn));}
var limit=0;if(options!==undefined){if(typeof options==="object"&&options!==null){if(typeof options.concurrency!=="number"){return Promise.reject(new TypeError("'concurrency' must be a number but it is "+
util.classString(options.concurrency)));}
limit=options.concurrency;}else{return Promise.reject(new TypeError("options argument must be an object but it is "+
util.classString(options)));}}
limit=typeof limit==="number"&&isFinite(limit)&&limit>=1?limit:0;return new MappingPromiseArray(promises,fn,limit,_filter).promise();}
Promise.prototype.map=function(fn,options){return map(this,fn,options,null);};Promise.map=function(promises,fn,options,_filter){return map(promises,fn,options,_filter);};};},{"./util":36}],19:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL,tryConvertToPromise,apiRejection,debug){var util=_dereq_("./util");var tryCatch=util.tryCatch;Promise.method=function(fn){if(typeof fn!=="function"){throw new Promise.TypeError("expecting a function but got "+util.classString(fn));}
return function(){var ret=new Promise(INTERNAL);ret._captureStackTrace();ret._pushContext();var value=tryCatch(fn).apply(this,arguments);var promiseCreated=ret._popContext();debug.checkForgottenReturns(value,promiseCreated,"Promise.method",ret);ret._resolveFromSyncValue(value);return ret;};};Promise.attempt=Promise["try"]=function(fn){if(typeof fn!=="function"){return apiRejection("expecting a function but got "+util.classString(fn));}
var ret=new Promise(INTERNAL);ret._captureStackTrace();ret._pushContext();var value;if(arguments.length>1){debug.deprecated("calling Promise.try with more than 1 argument");var arg=arguments[1];var ctx=arguments[2];value=util.isArray(arg)?tryCatch(fn).apply(ctx,arg):tryCatch(fn).call(ctx,arg);}else{value=tryCatch(fn)();}
var promiseCreated=ret._popContext();debug.checkForgottenReturns(value,promiseCreated,"Promise.try",ret);ret._resolveFromSyncValue(value);return ret;};Promise.prototype._resolveFromSyncValue=function(value){if(value===util.errorObj){this._rejectCallback(value.e,false);}else{this._resolveCallback(value,true);}};};},{"./util":36}],20:[function(_dereq_,module,exports){"use strict";var util=_dereq_("./util");var maybeWrapAsError=util.maybeWrapAsError;var errors=_dereq_("./errors");var OperationalError=errors.OperationalError;var es5=_dereq_("./es5");function isUntypedError(obj){return obj instanceof Error&&es5.getPrototypeOf(obj)===Error.prototype;}
var rErrorKey=/^(?:name|message|stack|cause)$/;function wrapAsOperationalError(obj){var ret;if(isUntypedError(obj)){ret=new OperationalError(obj);ret.name=obj.name;ret.message=obj.message;ret.stack=obj.stack;var keys=es5.keys(obj);for(var i=0;i<keys.length;++i){var key=keys[i];if(!rErrorKey.test(key)){ret[key]=obj[key];}}
return ret;}
util.markAsOriginatingFromRejection(obj);return obj;}
function nodebackForPromise(promise,multiArgs){return function(err,value){if(promise===null)return;if(err){var wrapped=wrapAsOperationalError(maybeWrapAsError(err));promise._attachExtraTrace(wrapped);promise._reject(wrapped);}else if(!multiArgs){promise._fulfill(value);}else{var args=[].slice.call(arguments,1);;promise._fulfill(args);}
promise=null;};}
module.exports=nodebackForPromise;},{"./errors":12,"./es5":13,"./util":36}],21:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise){var util=_dereq_("./util");var async=Promise._async;var tryCatch=util.tryCatch;var errorObj=util.errorObj;function spreadAdapter(val,nodeback){var promise=this;if(!util.isArray(val))return successAdapter.call(promise,val,nodeback);var ret=tryCatch(nodeback).apply(promise._boundValue(),[null].concat(val));if(ret===errorObj){async.throwLater(ret.e);}}
function successAdapter(val,nodeback){var promise=this;var receiver=promise._boundValue();var ret=val===undefined?tryCatch(nodeback).call(receiver,null):tryCatch(nodeback).call(receiver,null,val);if(ret===errorObj){async.throwLater(ret.e);}}
function errorAdapter(reason,nodeback){var promise=this;if(!reason){var newReason=new Error(reason+"");newReason.cause=reason;reason=newReason;}
var ret=tryCatch(nodeback).call(promise._boundValue(),reason);if(ret===errorObj){async.throwLater(ret.e);}}
Promise.prototype.asCallback=Promise.prototype.nodeify=function(nodeback,options){if(typeof nodeback=="function"){var adapter=successAdapter;if(options!==undefined&&Object(options).spread){adapter=spreadAdapter;}
this._then(adapter,errorAdapter,undefined,this,nodeback);}
return this;};};},{"./util":36}],22:[function(_dereq_,module,exports){"use strict";module.exports=function(){var makeSelfResolutionError=function(){return new TypeError("circular promise resolution chain\u000a\u000a    See http://goo.gl/MqrFmX\u000a");};var reflectHandler=function(){return new Promise.PromiseInspection(this._target());};var apiRejection=function(msg){return Promise.reject(new TypeError(msg));};function Proxyable(){}
var UNDEFINED_BINDING={};var util=_dereq_("./util");var getDomain;if(util.isNode){getDomain=function(){var ret=process.domain;if(ret===undefined)ret=null;return ret;};}else{getDomain=function(){return null;};}
util.notEnumerableProp(Promise,"_getDomain",getDomain);var es5=_dereq_("./es5");var Async=_dereq_("./async");var async=new Async();es5.defineProperty(Promise,"_async",{value:async});var errors=_dereq_("./errors");var TypeError=Promise.TypeError=errors.TypeError;Promise.RangeError=errors.RangeError;var CancellationError=Promise.CancellationError=errors.CancellationError;Promise.TimeoutError=errors.TimeoutError;Promise.OperationalError=errors.OperationalError;Promise.RejectionError=errors.OperationalError;Promise.AggregateError=errors.AggregateError;var INTERNAL=function(){};var APPLY={};var NEXT_FILTER={};var tryConvertToPromise=_dereq_("./thenables")(Promise,INTERNAL);var PromiseArray=_dereq_("./promise_array")(Promise,INTERNAL,tryConvertToPromise,apiRejection,Proxyable);var Context=_dereq_("./context")(Promise);var createContext=Context.create;var debug=_dereq_("./debuggability")(Promise,Context);var CapturedTrace=debug.CapturedTrace;var PassThroughHandlerContext=_dereq_("./finally")(Promise,tryConvertToPromise,NEXT_FILTER);var catchFilter=_dereq_("./catch_filter")(NEXT_FILTER);var nodebackForPromise=_dereq_("./nodeback");var errorObj=util.errorObj;var tryCatch=util.tryCatch;function check(self,executor){if(self==null||self.constructor!==Promise){throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a    See http://goo.gl/MqrFmX\u000a");}
if(typeof executor!=="function"){throw new TypeError("expecting a function but got "+util.classString(executor));}}
function Promise(executor){if(executor!==INTERNAL){check(this,executor);}
this._bitField=0;this._fulfillmentHandler0=undefined;this._rejectionHandler0=undefined;this._promise0=undefined;this._receiver0=undefined;this._resolveFromExecutor(executor);this._promiseCreated();this._fireEvent("promiseCreated",this);}
Promise.prototype.toString=function(){return"[object Promise]";};Promise.prototype.caught=Promise.prototype["catch"]=function(fn){var len=arguments.length;if(len>1){var catchInstances=new Array(len-1),j=0,i;for(i=0;i<len-1;++i){var item=arguments[i];if(util.isObject(item)){catchInstances[j++]=item;}else{return apiRejection("Catch statement predicate: "+"expecting an object but got "+util.classString(item));}}
catchInstances.length=j;fn=arguments[i];return this.then(undefined,catchFilter(catchInstances,fn,this));}
return this.then(undefined,fn);};Promise.prototype.reflect=function(){return this._then(reflectHandler,reflectHandler,undefined,this,undefined);};Promise.prototype.then=function(didFulfill,didReject){if(debug.warnings()&&arguments.length>0&&typeof didFulfill!=="function"&&typeof didReject!=="function"){var msg=".then() only accepts functions but was passed: "+
util.classString(didFulfill);if(arguments.length>1){msg+=", "+util.classString(didReject);}
this._warn(msg);}
return this._then(didFulfill,didReject,undefined,undefined,undefined);};Promise.prototype.done=function(didFulfill,didReject){var promise=this._then(didFulfill,didReject,undefined,undefined,undefined);promise._setIsFinal();};Promise.prototype.spread=function(fn){if(typeof fn!=="function"){return apiRejection("expecting a function but got "+util.classString(fn));}
return this.all()._then(fn,undefined,undefined,APPLY,undefined);};Promise.prototype.toJSON=function(){var ret={isFulfilled:false,isRejected:false,fulfillmentValue:undefined,rejectionReason:undefined};if(this.isFulfilled()){ret.fulfillmentValue=this.value();ret.isFulfilled=true;}else if(this.isRejected()){ret.rejectionReason=this.reason();ret.isRejected=true;}
return ret;};Promise.prototype.all=function(){if(arguments.length>0){this._warn(".all() was passed arguments but it does not take any");}
return new PromiseArray(this).promise();};Promise.prototype.error=function(fn){return this.caught(util.originatesFromRejection,fn);};Promise.getNewLibraryCopy=module.exports;Promise.is=function(val){return val instanceof Promise;};Promise.fromNode=Promise.fromCallback=function(fn){var ret=new Promise(INTERNAL);ret._captureStackTrace();var multiArgs=arguments.length>1?!!Object(arguments[1]).multiArgs:false;var result=tryCatch(fn)(nodebackForPromise(ret,multiArgs));if(result===errorObj){ret._rejectCallback(result.e,true);}
if(!ret._isFateSealed())ret._setAsyncGuaranteed();return ret;};Promise.all=function(promises){return new PromiseArray(promises).promise();};Promise.cast=function(obj){var ret=tryConvertToPromise(obj);if(!(ret instanceof Promise)){ret=new Promise(INTERNAL);ret._captureStackTrace();ret._setFulfilled();ret._rejectionHandler0=obj;}
return ret;};Promise.resolve=Promise.fulfilled=Promise.cast;Promise.reject=Promise.rejected=function(reason){var ret=new Promise(INTERNAL);ret._captureStackTrace();ret._rejectCallback(reason,true);return ret;};Promise.setScheduler=function(fn){if(typeof fn!=="function"){throw new TypeError("expecting a function but got "+util.classString(fn));}
return async.setScheduler(fn);};Promise.prototype._then=function(didFulfill,didReject,_,receiver,internalData){var haveInternalData=internalData!==undefined;var promise=haveInternalData?internalData:new Promise(INTERNAL);var target=this._target();var bitField=target._bitField;if(!haveInternalData){promise._propagateFrom(this,3);promise._captureStackTrace();if(receiver===undefined&&((this._bitField&2097152)!==0)){if(!((bitField&50397184)===0)){receiver=this._boundValue();}else{receiver=target===this?undefined:this._boundTo;}}
this._fireEvent("promiseChained",this,promise);}
var domain=getDomain();if(!((bitField&50397184)===0)){var handler,value,settler=target._settlePromiseCtx;if(((bitField&33554432)!==0)){value=target._rejectionHandler0;handler=didFulfill;}else if(((bitField&16777216)!==0)){value=target._fulfillmentHandler0;handler=didReject;target._unsetRejectionIsUnhandled();}else{settler=target._settlePromiseLateCancellationObserver;value=new CancellationError("late cancellation observer");target._attachExtraTrace(value);handler=didReject;}
async.invoke(settler,target,{handler:domain===null?handler:(typeof handler==="function"&&util.domainBind(domain,handler)),promise:promise,receiver:receiver,value:value});}else{target._addCallbacks(didFulfill,didReject,promise,receiver,domain);}
return promise;};Promise.prototype._length=function(){return this._bitField&65535;};Promise.prototype._isFateSealed=function(){return(this._bitField&117506048)!==0;};Promise.prototype._isFollowing=function(){return(this._bitField&67108864)===67108864;};Promise.prototype._setLength=function(len){this._bitField=(this._bitField&-65536)|(len&65535);};Promise.prototype._setFulfilled=function(){this._bitField=this._bitField|33554432;this._fireEvent("promiseFulfilled",this);};Promise.prototype._setRejected=function(){this._bitField=this._bitField|16777216;this._fireEvent("promiseRejected",this);};Promise.prototype._setFollowing=function(){this._bitField=this._bitField|67108864;this._fireEvent("promiseResolved",this);};Promise.prototype._setIsFinal=function(){this._bitField=this._bitField|4194304;};Promise.prototype._isFinal=function(){return(this._bitField&4194304)>0;};Promise.prototype._unsetCancelled=function(){this._bitField=this._bitField&(~65536);};Promise.prototype._setCancelled=function(){this._bitField=this._bitField|65536;this._fireEvent("promiseCancelled",this);};Promise.prototype._setWillBeCancelled=function(){this._bitField=this._bitField|8388608;};Promise.prototype._setAsyncGuaranteed=function(){if(async.hasCustomScheduler())return;this._bitField=this._bitField|134217728;};Promise.prototype._receiverAt=function(index){var ret=index===0?this._receiver0:this[index*4-4+3];if(ret===UNDEFINED_BINDING){return undefined;}else if(ret===undefined&&this._isBound()){return this._boundValue();}
return ret;};Promise.prototype._promiseAt=function(index){return this[index*4-4+2];};Promise.prototype._fulfillmentHandlerAt=function(index){return this[index*4-4+0];};Promise.prototype._rejectionHandlerAt=function(index){return this[index*4-4+1];};Promise.prototype._boundValue=function(){};Promise.prototype._migrateCallback0=function(follower){var bitField=follower._bitField;var fulfill=follower._fulfillmentHandler0;var reject=follower._rejectionHandler0;var promise=follower._promise0;var receiver=follower._receiverAt(0);if(receiver===undefined)receiver=UNDEFINED_BINDING;this._addCallbacks(fulfill,reject,promise,receiver,null);};Promise.prototype._migrateCallbackAt=function(follower,index){var fulfill=follower._fulfillmentHandlerAt(index);var reject=follower._rejectionHandlerAt(index);var promise=follower._promiseAt(index);var receiver=follower._receiverAt(index);if(receiver===undefined)receiver=UNDEFINED_BINDING;this._addCallbacks(fulfill,reject,promise,receiver,null);};Promise.prototype._addCallbacks=function(fulfill,reject,promise,receiver,domain){var index=this._length();if(index>=65535-4){index=0;this._setLength(0);}
if(index===0){this._promise0=promise;this._receiver0=receiver;if(typeof fulfill==="function"){this._fulfillmentHandler0=domain===null?fulfill:util.domainBind(domain,fulfill);}
if(typeof reject==="function"){this._rejectionHandler0=domain===null?reject:util.domainBind(domain,reject);}}else{var base=index*4-4;this[base+2]=promise;this[base+3]=receiver;if(typeof fulfill==="function"){this[base+0]=domain===null?fulfill:util.domainBind(domain,fulfill);}
if(typeof reject==="function"){this[base+1]=domain===null?reject:util.domainBind(domain,reject);}}
this._setLength(index+1);return index;};Promise.prototype._proxy=function(proxyable,arg){this._addCallbacks(undefined,undefined,arg,proxyable,null);};Promise.prototype._resolveCallback=function(value,shouldBind){if(((this._bitField&117506048)!==0))return;if(value===this)
return this._rejectCallback(makeSelfResolutionError(),false);var maybePromise=tryConvertToPromise(value,this);if(!(maybePromise instanceof Promise))return this._fulfill(value);if(shouldBind)this._propagateFrom(maybePromise,2);var promise=maybePromise._target();if(promise===this){this._reject(makeSelfResolutionError());return;}
var bitField=promise._bitField;if(((bitField&50397184)===0)){var len=this._length();if(len>0)promise._migrateCallback0(this);for(var i=1;i<len;++i){promise._migrateCallbackAt(this,i);}
this._setFollowing();this._setLength(0);this._setFollowee(promise);}else if(((bitField&33554432)!==0)){this._fulfill(promise._value());}else if(((bitField&16777216)!==0)){this._reject(promise._reason());}else{var reason=new CancellationError("late cancellation observer");promise._attachExtraTrace(reason);this._reject(reason);}};Promise.prototype._rejectCallback=function(reason,synchronous,ignoreNonErrorWarnings){var trace=util.ensureErrorObject(reason);var hasStack=trace===reason;if(!hasStack&&!ignoreNonErrorWarnings&&debug.warnings()){var message="a promise was rejected with a non-error: "+
util.classString(reason);this._warn(message,true);}
this._attachExtraTrace(trace,synchronous?hasStack:false);this._reject(reason);};Promise.prototype._resolveFromExecutor=function(executor){if(executor===INTERNAL)return;var promise=this;this._captureStackTrace();this._pushContext();var synchronous=true;var r=this._execute(executor,function(value){promise._resolveCallback(value);},function(reason){promise._rejectCallback(reason,synchronous);});synchronous=false;this._popContext();if(r!==undefined){promise._rejectCallback(r,true);}};Promise.prototype._settlePromiseFromHandler=function(handler,receiver,value,promise){var bitField=promise._bitField;if(((bitField&65536)!==0))return;promise._pushContext();var x;if(receiver===APPLY){if(!value||typeof value.length!=="number"){x=errorObj;x.e=new TypeError("cannot .spread() a non-array: "+
util.classString(value));}else{x=tryCatch(handler).apply(this._boundValue(),value);}}else{x=tryCatch(handler).call(receiver,value);}
var promiseCreated=promise._popContext();bitField=promise._bitField;if(((bitField&65536)!==0))return;if(x===NEXT_FILTER){promise._reject(value);}else if(x===errorObj){promise._rejectCallback(x.e,false);}else{debug.checkForgottenReturns(x,promiseCreated,"",promise,this);promise._resolveCallback(x);}};Promise.prototype._target=function(){var ret=this;while(ret._isFollowing())ret=ret._followee();return ret;};Promise.prototype._followee=function(){return this._rejectionHandler0;};Promise.prototype._setFollowee=function(promise){this._rejectionHandler0=promise;};Promise.prototype._settlePromise=function(promise,handler,receiver,value){var isPromise=promise instanceof Promise;var bitField=this._bitField;var asyncGuaranteed=((bitField&134217728)!==0);if(((bitField&65536)!==0)){if(isPromise)promise._invokeInternalOnCancel();if(receiver instanceof PassThroughHandlerContext&&receiver.isFinallyHandler()){receiver.cancelPromise=promise;if(tryCatch(handler).call(receiver,value)===errorObj){promise._reject(errorObj.e);}}else if(handler===reflectHandler){promise._fulfill(reflectHandler.call(receiver));}else if(receiver instanceof Proxyable){receiver._promiseCancelled(promise);}else if(isPromise||promise instanceof PromiseArray){promise._cancel();}else{receiver.cancel();}}else if(typeof handler==="function"){if(!isPromise){handler.call(receiver,value,promise);}else{if(asyncGuaranteed)promise._setAsyncGuaranteed();this._settlePromiseFromHandler(handler,receiver,value,promise);}}else if(receiver instanceof Proxyable){if(!receiver._isResolved()){if(((bitField&33554432)!==0)){receiver._promiseFulfilled(value,promise);}else{receiver._promiseRejected(value,promise);}}}else if(isPromise){if(asyncGuaranteed)promise._setAsyncGuaranteed();if(((bitField&33554432)!==0)){promise._fulfill(value);}else{promise._reject(value);}}};Promise.prototype._settlePromiseLateCancellationObserver=function(ctx){var handler=ctx.handler;var promise=ctx.promise;var receiver=ctx.receiver;var value=ctx.value;if(typeof handler==="function"){if(!(promise instanceof Promise)){handler.call(receiver,value,promise);}else{this._settlePromiseFromHandler(handler,receiver,value,promise);}}else if(promise instanceof Promise){promise._reject(value);}};Promise.prototype._settlePromiseCtx=function(ctx){this._settlePromise(ctx.promise,ctx.handler,ctx.receiver,ctx.value);};Promise.prototype._settlePromise0=function(handler,value,bitField){var promise=this._promise0;var receiver=this._receiverAt(0);this._promise0=undefined;this._receiver0=undefined;this._settlePromise(promise,handler,receiver,value);};Promise.prototype._clearCallbackDataAtIndex=function(index){var base=index*4-4;this[base+2]=this[base+3]=this[base+0]=this[base+1]=undefined;};Promise.prototype._fulfill=function(value){var bitField=this._bitField;if(((bitField&117506048)>>>16))return;if(value===this){var err=makeSelfResolutionError();this._attachExtraTrace(err);return this._reject(err);}
this._setFulfilled();this._rejectionHandler0=value;if((bitField&65535)>0){if(((bitField&134217728)!==0)){this._settlePromises();}else{async.settlePromises(this);}
this._dereferenceTrace();}};Promise.prototype._reject=function(reason){var bitField=this._bitField;if(((bitField&117506048)>>>16))return;this._setRejected();this._fulfillmentHandler0=reason;if(this._isFinal()){return async.fatalError(reason,util.isNode);}
if((bitField&65535)>0){async.settlePromises(this);}else{this._ensurePossibleRejectionHandled();}};Promise.prototype._fulfillPromises=function(len,value){for(var i=1;i<len;i++){var handler=this._fulfillmentHandlerAt(i);var promise=this._promiseAt(i);var receiver=this._receiverAt(i);this._clearCallbackDataAtIndex(i);this._settlePromise(promise,handler,receiver,value);}};Promise.prototype._rejectPromises=function(len,reason){for(var i=1;i<len;i++){var handler=this._rejectionHandlerAt(i);var promise=this._promiseAt(i);var receiver=this._receiverAt(i);this._clearCallbackDataAtIndex(i);this._settlePromise(promise,handler,receiver,reason);}};Promise.prototype._settlePromises=function(){var bitField=this._bitField;var len=(bitField&65535);if(len>0){if(((bitField&16842752)!==0)){var reason=this._fulfillmentHandler0;this._settlePromise0(this._rejectionHandler0,reason,bitField);this._rejectPromises(len,reason);}else{var value=this._rejectionHandler0;this._settlePromise0(this._fulfillmentHandler0,value,bitField);this._fulfillPromises(len,value);}
this._setLength(0);}
this._clearCancellationData();};Promise.prototype._settledValue=function(){var bitField=this._bitField;if(((bitField&33554432)!==0)){return this._rejectionHandler0;}else if(((bitField&16777216)!==0)){return this._fulfillmentHandler0;}};function deferResolve(v){this.promise._resolveCallback(v);}
function deferReject(v){this.promise._rejectCallback(v,false);}
Promise.defer=Promise.pending=function(){debug.deprecated("Promise.defer","new Promise");var promise=new Promise(INTERNAL);return{promise:promise,resolve:deferResolve,reject:deferReject};};util.notEnumerableProp(Promise,"_makeSelfResolutionError",makeSelfResolutionError);_dereq_("./method")(Promise,INTERNAL,tryConvertToPromise,apiRejection,debug);_dereq_("./bind")(Promise,INTERNAL,tryConvertToPromise,debug);_dereq_("./cancel")(Promise,PromiseArray,apiRejection,debug);_dereq_("./direct_resolve")(Promise);_dereq_("./synchronous_inspection")(Promise);_dereq_("./join")(Promise,PromiseArray,tryConvertToPromise,INTERNAL,async,getDomain);Promise.Promise=Promise;Promise.version="3.5.3";_dereq_('./map.js')(Promise,PromiseArray,apiRejection,tryConvertToPromise,INTERNAL,debug);_dereq_('./call_get.js')(Promise);_dereq_('./using.js')(Promise,apiRejection,tryConvertToPromise,createContext,INTERNAL,debug);_dereq_('./timers.js')(Promise,INTERNAL,debug);_dereq_('./generators.js')(Promise,apiRejection,INTERNAL,tryConvertToPromise,Proxyable,debug);_dereq_('./nodeify.js')(Promise);_dereq_('./promisify.js')(Promise,INTERNAL);_dereq_('./props.js')(Promise,PromiseArray,tryConvertToPromise,apiRejection);_dereq_('./race.js')(Promise,INTERNAL,tryConvertToPromise,apiRejection);_dereq_('./reduce.js')(Promise,PromiseArray,apiRejection,tryConvertToPromise,INTERNAL,debug);_dereq_('./settle.js')(Promise,PromiseArray,debug);_dereq_('./some.js')(Promise,PromiseArray,apiRejection);_dereq_('./filter.js')(Promise,INTERNAL);_dereq_('./each.js')(Promise,INTERNAL);_dereq_('./any.js')(Promise);util.toFastProperties(Promise);util.toFastProperties(Promise.prototype);function fillTypes(value){var p=new Promise(INTERNAL);p._fulfillmentHandler0=value;p._rejectionHandler0=value;p._promise0=value;p._receiver0=value;}
fillTypes({a:1});fillTypes({b:2});fillTypes({c:3});fillTypes(1);fillTypes(function(){});fillTypes(undefined);fillTypes(false);fillTypes(new Promise(INTERNAL));debug.setBounds(Async.firstLineError,util.lastLineError);return Promise;};},{"./any.js":1,"./async":2,"./bind":3,"./call_get.js":5,"./cancel":6,"./catch_filter":7,"./context":8,"./debuggability":9,"./direct_resolve":10,"./each.js":11,"./errors":12,"./es5":13,"./filter.js":14,"./finally":15,"./generators.js":16,"./join":17,"./map.js":18,"./method":19,"./nodeback":20,"./nodeify.js":21,"./promise_array":23,"./promisify.js":24,"./props.js":25,"./race.js":27,"./reduce.js":28,"./settle.js":30,"./some.js":31,"./synchronous_inspection":32,"./thenables":33,"./timers.js":34,"./using.js":35,"./util":36}],23:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL,tryConvertToPromise,apiRejection,Proxyable){var util=_dereq_("./util");var isArray=util.isArray;function toResolutionValue(val){switch(val){case-2:return[];case-3:return{};case-6:return new Map();}}
function PromiseArray(values){var promise=this._promise=new Promise(INTERNAL);if(values instanceof Promise){promise._propagateFrom(values,3);}
promise._setOnCancel(this);this._values=values;this._length=0;this._totalResolved=0;this._init(undefined,-2);}
util.inherits(PromiseArray,Proxyable);PromiseArray.prototype.length=function(){return this._length;};PromiseArray.prototype.promise=function(){return this._promise;};PromiseArray.prototype._init=function init(_,resolveValueIfEmpty){var values=tryConvertToPromise(this._values,this._promise);if(values instanceof Promise){values=values._target();var bitField=values._bitField;;this._values=values;if(((bitField&50397184)===0)){this._promise._setAsyncGuaranteed();return values._then(init,this._reject,undefined,this,resolveValueIfEmpty);}else if(((bitField&33554432)!==0)){values=values._value();}else if(((bitField&16777216)!==0)){return this._reject(values._reason());}else{return this._cancel();}}
values=util.asArray(values);if(values===null){var err=apiRejection("expecting an array or an iterable object but got "+util.classString(values)).reason();this._promise._rejectCallback(err,false);return;}
if(values.length===0){if(resolveValueIfEmpty===-5){this._resolveEmptyArray();}
else{this._resolve(toResolutionValue(resolveValueIfEmpty));}
return;}
this._iterate(values);};PromiseArray.prototype._iterate=function(values){var len=this.getActualLength(values.length);this._length=len;this._values=this.shouldCopyValues()?new Array(len):this._values;var result=this._promise;var isResolved=false;var bitField=null;for(var i=0;i<len;++i){var maybePromise=tryConvertToPromise(values[i],result);if(maybePromise instanceof Promise){maybePromise=maybePromise._target();bitField=maybePromise._bitField;}else{bitField=null;}
if(isResolved){if(bitField!==null){maybePromise.suppressUnhandledRejections();}}else if(bitField!==null){if(((bitField&50397184)===0)){maybePromise._proxy(this,i);this._values[i]=maybePromise;}else if(((bitField&33554432)!==0)){isResolved=this._promiseFulfilled(maybePromise._value(),i);}else if(((bitField&16777216)!==0)){isResolved=this._promiseRejected(maybePromise._reason(),i);}else{isResolved=this._promiseCancelled(i);}}else{isResolved=this._promiseFulfilled(maybePromise,i);}}
if(!isResolved)result._setAsyncGuaranteed();};PromiseArray.prototype._isResolved=function(){return this._values===null;};PromiseArray.prototype._resolve=function(value){this._values=null;this._promise._fulfill(value);};PromiseArray.prototype._cancel=function(){if(this._isResolved()||!this._promise._isCancellable())return;this._values=null;this._promise._cancel();};PromiseArray.prototype._reject=function(reason){this._values=null;this._promise._rejectCallback(reason,false);};PromiseArray.prototype._promiseFulfilled=function(value,index){this._values[index]=value;var totalResolved=++this._totalResolved;if(totalResolved>=this._length){this._resolve(this._values);return true;}
return false;};PromiseArray.prototype._promiseCancelled=function(){this._cancel();return true;};PromiseArray.prototype._promiseRejected=function(reason){this._totalResolved++;this._reject(reason);return true;};PromiseArray.prototype._resultCancelled=function(){if(this._isResolved())return;var values=this._values;this._cancel();if(values instanceof Promise){values.cancel();}else{for(var i=0;i<values.length;++i){if(values[i]instanceof Promise){values[i].cancel();}}}};PromiseArray.prototype.shouldCopyValues=function(){return true;};PromiseArray.prototype.getActualLength=function(len){return len;};return PromiseArray;};},{"./util":36}],24:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL){var THIS={};var util=_dereq_("./util");var nodebackForPromise=_dereq_("./nodeback");var withAppended=util.withAppended;var maybeWrapAsError=util.maybeWrapAsError;var canEvaluate=util.canEvaluate;var TypeError=_dereq_("./errors").TypeError;var defaultSuffix="Async";var defaultPromisified={__isPromisified__:true};var noCopyProps=["arity","length","name","arguments","caller","callee","prototype","__isPromisified__"];var noCopyPropsPattern=new RegExp("^(?:"+noCopyProps.join("|")+")$");var defaultFilter=function(name){return util.isIdentifier(name)&&name.charAt(0)!=="_"&&name!=="constructor";};function propsFilter(key){return!noCopyPropsPattern.test(key);}
function isPromisified(fn){try{return fn.__isPromisified__===true;}
catch(e){return false;}}
function hasPromisified(obj,key,suffix){var val=util.getDataPropertyOrDefault(obj,key+suffix,defaultPromisified);return val?isPromisified(val):false;}
function checkValid(ret,suffix,suffixRegexp){for(var i=0;i<ret.length;i+=2){var key=ret[i];if(suffixRegexp.test(key)){var keyWithoutAsyncSuffix=key.replace(suffixRegexp,"");for(var j=0;j<ret.length;j+=2){if(ret[j]===keyWithoutAsyncSuffix){throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a    See http://goo.gl/MqrFmX\u000a".replace("%s",suffix));}}}}}
function promisifiableMethods(obj,suffix,suffixRegexp,filter){var keys=util.inheritedDataKeys(obj);var ret=[];for(var i=0;i<keys.length;++i){var key=keys[i];var value=obj[key];var passesDefaultFilter=filter===defaultFilter?true:defaultFilter(key,value,obj);if(typeof value==="function"&&!isPromisified(value)&&!hasPromisified(obj,key,suffix)&&filter(key,value,obj,passesDefaultFilter)){ret.push(key,value);}}
checkValid(ret,suffix,suffixRegexp);return ret;}
var escapeIdentRegex=function(str){return str.replace(/([$])/,"\\$");};var makeNodePromisifiedEval;if(!true){var switchCaseArgumentOrder=function(likelyArgumentCount){var ret=[likelyArgumentCount];var min=Math.max(0,likelyArgumentCount-1-3);for(var i=likelyArgumentCount-1;i>=min;--i){ret.push(i);}
for(var i=likelyArgumentCount+1;i<=3;++i){ret.push(i);}
return ret;};var argumentSequence=function(argumentCount){return util.filledRange(argumentCount,"_arg","");};var parameterDeclaration=function(parameterCount){return util.filledRange(Math.max(parameterCount,3),"_arg","");};var parameterCount=function(fn){if(typeof fn.length==="number"){return Math.max(Math.min(fn.length,1023+1),0);}
return 0;};makeNodePromisifiedEval=function(callback,receiver,originalName,fn,_,multiArgs){var newParameterCount=Math.max(0,parameterCount(fn)-1);var argumentOrder=switchCaseArgumentOrder(newParameterCount);var shouldProxyThis=typeof callback==="string"||receiver===THIS;function generateCallForArgumentCount(count){var args=argumentSequence(count).join(", ");var comma=count>0?", ":"";var ret;if(shouldProxyThis){ret="ret = callback.call(this, {{args}}, nodeback); break;\n";}else{ret=receiver===undefined?"ret = callback({{args}}, nodeback); break;\n":"ret = callback.call(receiver, {{args}}, nodeback); break;\n";}
return ret.replace("{{args}}",args).replace(", ",comma);}
function generateArgumentSwitchCase(){var ret="";for(var i=0;i<argumentOrder.length;++i){ret+="case "+argumentOrder[i]+":"+
generateCallForArgumentCount(argumentOrder[i]);}
ret+="                                                             \n\
        default:                                                             \n\
            var args = new Array(len + 1);                                   \n\
            var i = 0;                                                       \n\
            for (var i = 0; i < len; ++i) {                                  \n\
               args[i] = arguments[i];                                       \n\
            }                                                                \n\
            args[i] = nodeback;                                              \n\
            [CodeForCall]                                                    \n\
            break;                                                           \n\
        ".replace("[CodeForCall]",(shouldProxyThis?"ret = callback.apply(this, args);\n":"ret = callback.apply(receiver, args);\n"));return ret;}
var getFunctionCode=typeof callback==="string"?("this != null ? this['"+callback+"'] : fn"):"fn";var body="'use strict';                                                \n\
        var ret = function (Parameters) {                                    \n\
            'use strict';                                                    \n\
            var len = arguments.length;                                      \n\
            var promise = new Promise(INTERNAL);                             \n\
            promise._captureStackTrace();                                    \n\
            var nodeback = nodebackForPromise(promise, "+multiArgs+");   \n\
            var ret;                                                         \n\
            var callback = tryCatch([GetFunctionCode]);                      \n\
            switch(len) {                                                    \n\
                [CodeForSwitchCase]                                          \n\
            }                                                                \n\
            if (ret === errorObj) {                                          \n\
                promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\
            }                                                                \n\
            if (!promise._isFateSealed()) promise._setAsyncGuaranteed();     \n\
            return promise;                                                  \n\
        };                                                                   \n\
        notEnumerableProp(ret, '__isPromisified__', true);                   \n\
        return ret;                                                          \n\
    ".replace("[CodeForSwitchCase]",generateArgumentSwitchCase()).replace("[GetFunctionCode]",getFunctionCode);body=body.replace("Parameters",parameterDeclaration(newParameterCount));return new Function("Promise","fn","receiver","withAppended","maybeWrapAsError","nodebackForPromise","tryCatch","errorObj","notEnumerableProp","INTERNAL",body)(Promise,fn,receiver,withAppended,maybeWrapAsError,nodebackForPromise,util.tryCatch,util.errorObj,util.notEnumerableProp,INTERNAL);};}
function makeNodePromisifiedClosure(callback,receiver,_,fn,__,multiArgs){var defaultThis=(function(){return this;})();var method=callback;if(typeof method==="string"){callback=fn;}
function promisified(){var _receiver=receiver;if(receiver===THIS)_receiver=this;var promise=new Promise(INTERNAL);promise._captureStackTrace();var cb=typeof method==="string"&&this!==defaultThis?this[method]:callback;var fn=nodebackForPromise(promise,multiArgs);try{cb.apply(_receiver,withAppended(arguments,fn));}catch(e){promise._rejectCallback(maybeWrapAsError(e),true,true);}
if(!promise._isFateSealed())promise._setAsyncGuaranteed();return promise;}
util.notEnumerableProp(promisified,"__isPromisified__",true);return promisified;}
var makeNodePromisified=canEvaluate?makeNodePromisifiedEval:makeNodePromisifiedClosure;function promisifyAll(obj,suffix,filter,promisifier,multiArgs){var suffixRegexp=new RegExp(escapeIdentRegex(suffix)+"$");var methods=promisifiableMethods(obj,suffix,suffixRegexp,filter);for(var i=0,len=methods.length;i<len;i+=2){var key=methods[i];var fn=methods[i+1];var promisifiedKey=key+suffix;if(promisifier===makeNodePromisified){obj[promisifiedKey]=makeNodePromisified(key,THIS,key,fn,suffix,multiArgs);}else{var promisified=promisifier(fn,function(){return makeNodePromisified(key,THIS,key,fn,suffix,multiArgs);});util.notEnumerableProp(promisified,"__isPromisified__",true);obj[promisifiedKey]=promisified;}}
util.toFastProperties(obj);return obj;}
function promisify(callback,receiver,multiArgs){return makeNodePromisified(callback,receiver,undefined,callback,null,multiArgs);}
Promise.promisify=function(fn,options){if(typeof fn!=="function"){throw new TypeError("expecting a function but got "+util.classString(fn));}
if(isPromisified(fn)){return fn;}
options=Object(options);var receiver=options.context===undefined?THIS:options.context;var multiArgs=!!options.multiArgs;var ret=promisify(fn,receiver,multiArgs);util.copyDescriptors(fn,ret,propsFilter);return ret;};Promise.promisifyAll=function(target,options){if(typeof target!=="function"&&typeof target!=="object"){throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a    See http://goo.gl/MqrFmX\u000a");}
options=Object(options);var multiArgs=!!options.multiArgs;var suffix=options.suffix;if(typeof suffix!=="string")suffix=defaultSuffix;var filter=options.filter;if(typeof filter!=="function")filter=defaultFilter;var promisifier=options.promisifier;if(typeof promisifier!=="function")promisifier=makeNodePromisified;if(!util.isIdentifier(suffix)){throw new RangeError("suffix must be a valid identifier\u000a\u000a    See http://goo.gl/MqrFmX\u000a");}
var keys=util.inheritedDataKeys(target);for(var i=0;i<keys.length;++i){var value=target[keys[i]];if(keys[i]!=="constructor"&&util.isClass(value)){promisifyAll(value.prototype,suffix,filter,promisifier,multiArgs);promisifyAll(value,suffix,filter,promisifier,multiArgs);}}
return promisifyAll(target,suffix,filter,promisifier,multiArgs);};};},{"./errors":12,"./nodeback":20,"./util":36}],25:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,PromiseArray,tryConvertToPromise,apiRejection){var util=_dereq_("./util");var isObject=util.isObject;var es5=_dereq_("./es5");var Es6Map;if(typeof Map==="function")Es6Map=Map;var mapToEntries=(function(){var index=0;var size=0;function extractEntry(value,key){this[index]=value;this[index+size]=key;index++;}
return function mapToEntries(map){size=map.size;index=0;var ret=new Array(map.size*2);map.forEach(extractEntry,ret);return ret;};})();var entriesToMap=function(entries){var ret=new Es6Map();var length=entries.length/2|0;for(var i=0;i<length;++i){var key=entries[length+i];var value=entries[i];ret.set(key,value);}
return ret;};function PropertiesPromiseArray(obj){var isMap=false;var entries;if(Es6Map!==undefined&&obj instanceof Es6Map){entries=mapToEntries(obj);isMap=true;}else{var keys=es5.keys(obj);var len=keys.length;entries=new Array(len*2);for(var i=0;i<len;++i){var key=keys[i];entries[i]=obj[key];entries[i+len]=key;}}
this.constructor$(entries);this._isMap=isMap;this._init$(undefined,isMap?-6:-3);}
util.inherits(PropertiesPromiseArray,PromiseArray);PropertiesPromiseArray.prototype._init=function(){};PropertiesPromiseArray.prototype._promiseFulfilled=function(value,index){this._values[index]=value;var totalResolved=++this._totalResolved;if(totalResolved>=this._length){var val;if(this._isMap){val=entriesToMap(this._values);}else{val={};var keyOffset=this.length();for(var i=0,len=this.length();i<len;++i){val[this._values[i+keyOffset]]=this._values[i];}}
this._resolve(val);return true;}
return false;};PropertiesPromiseArray.prototype.shouldCopyValues=function(){return false;};PropertiesPromiseArray.prototype.getActualLength=function(len){return len>>1;};function props(promises){var ret;var castValue=tryConvertToPromise(promises);if(!isObject(castValue)){return apiRejection("cannot await properties of a non-object\u000a\u000a    See http://goo.gl/MqrFmX\u000a");}else if(castValue instanceof Promise){ret=castValue._then(Promise.props,undefined,undefined,undefined,undefined);}else{ret=new PropertiesPromiseArray(castValue).promise();}
if(castValue instanceof Promise){ret._propagateFrom(castValue,2);}
return ret;}
Promise.prototype.props=function(){return props(this);};Promise.props=function(promises){return props(promises);};};},{"./es5":13,"./util":36}],26:[function(_dereq_,module,exports){"use strict";function arrayMove(src,srcIndex,dst,dstIndex,len){for(var j=0;j<len;++j){dst[j+dstIndex]=src[j+srcIndex];src[j+srcIndex]=void 0;}}
function Queue(capacity){this._capacity=capacity;this._length=0;this._front=0;}
Queue.prototype._willBeOverCapacity=function(size){return this._capacity<size;};Queue.prototype._pushOne=function(arg){var length=this.length();this._checkCapacity(length+1);var i=(this._front+length)&(this._capacity-1);this[i]=arg;this._length=length+1;};Queue.prototype.push=function(fn,receiver,arg){var length=this.length()+3;if(this._willBeOverCapacity(length)){this._pushOne(fn);this._pushOne(receiver);this._pushOne(arg);return;}
var j=this._front+length-3;this._checkCapacity(length);var wrapMask=this._capacity-1;this[(j+0)&wrapMask]=fn;this[(j+1)&wrapMask]=receiver;this[(j+2)&wrapMask]=arg;this._length=length;};Queue.prototype.shift=function(){var front=this._front,ret=this[front];this[front]=undefined;this._front=(front+1)&(this._capacity-1);this._length--;return ret;};Queue.prototype.length=function(){return this._length;};Queue.prototype._checkCapacity=function(size){if(this._capacity<size){this._resizeTo(this._capacity<<1);}};Queue.prototype._resizeTo=function(capacity){var oldCapacity=this._capacity;this._capacity=capacity;var front=this._front;var length=this._length;var moveItemsCount=(front+length)&(oldCapacity-1);arrayMove(this,0,this,oldCapacity,moveItemsCount);};module.exports=Queue;},{}],27:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL,tryConvertToPromise,apiRejection){var util=_dereq_("./util");var raceLater=function(promise){return promise.then(function(array){return race(array,promise);});};function race(promises,parent){var maybePromise=tryConvertToPromise(promises);if(maybePromise instanceof Promise){return raceLater(maybePromise);}else{promises=util.asArray(promises);if(promises===null)
return apiRejection("expecting an array or an iterable object but got "+util.classString(promises));}
var ret=new Promise(INTERNAL);if(parent!==undefined){ret._propagateFrom(parent,3);}
var fulfill=ret._fulfill;var reject=ret._reject;for(var i=0,len=promises.length;i<len;++i){var val=promises[i];if(val===undefined&&!(i in promises)){continue;}
Promise.cast(val)._then(fulfill,reject,undefined,ret,null);}
return ret;}
Promise.race=function(promises){return race(promises,undefined);};Promise.prototype.race=function(){return race(this,undefined);};};},{"./util":36}],28:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,PromiseArray,apiRejection,tryConvertToPromise,INTERNAL,debug){var getDomain=Promise._getDomain;var util=_dereq_("./util");var tryCatch=util.tryCatch;function ReductionPromiseArray(promises,fn,initialValue,_each){this.constructor$(promises);var domain=getDomain();this._fn=domain===null?fn:util.domainBind(domain,fn);if(initialValue!==undefined){initialValue=Promise.resolve(initialValue);initialValue._attachCancellationCallback(this);}
this._initialValue=initialValue;this._currentCancellable=null;if(_each===INTERNAL){this._eachValues=Array(this._length);}else if(_each===0){this._eachValues=null;}else{this._eachValues=undefined;}
this._promise._captureStackTrace();this._init$(undefined,-5);}
util.inherits(ReductionPromiseArray,PromiseArray);ReductionPromiseArray.prototype._gotAccum=function(accum){if(this._eachValues!==undefined&&this._eachValues!==null&&accum!==INTERNAL){this._eachValues.push(accum);}};ReductionPromiseArray.prototype._eachComplete=function(value){if(this._eachValues!==null){this._eachValues.push(value);}
return this._eachValues;};ReductionPromiseArray.prototype._init=function(){};ReductionPromiseArray.prototype._resolveEmptyArray=function(){this._resolve(this._eachValues!==undefined?this._eachValues:this._initialValue);};ReductionPromiseArray.prototype.shouldCopyValues=function(){return false;};ReductionPromiseArray.prototype._resolve=function(value){this._promise._resolveCallback(value);this._values=null;};ReductionPromiseArray.prototype._resultCancelled=function(sender){if(sender===this._initialValue)return this._cancel();if(this._isResolved())return;this._resultCancelled$();if(this._currentCancellable instanceof Promise){this._currentCancellable.cancel();}
if(this._initialValue instanceof Promise){this._initialValue.cancel();}};ReductionPromiseArray.prototype._iterate=function(values){this._values=values;var value;var i;var length=values.length;if(this._initialValue!==undefined){value=this._initialValue;i=0;}else{value=Promise.resolve(values[0]);i=1;}
this._currentCancellable=value;if(!value.isRejected()){for(;i<length;++i){var ctx={accum:null,value:values[i],index:i,length:length,array:this};value=value._then(gotAccum,undefined,undefined,ctx,undefined);}}
if(this._eachValues!==undefined){value=value._then(this._eachComplete,undefined,undefined,this,undefined);}
value._then(completed,completed,undefined,value,this);};Promise.prototype.reduce=function(fn,initialValue){return reduce(this,fn,initialValue,null);};Promise.reduce=function(promises,fn,initialValue,_each){return reduce(promises,fn,initialValue,_each);};function completed(valueOrReason,array){if(this.isFulfilled()){array._resolve(valueOrReason);}else{array._reject(valueOrReason);}}
function reduce(promises,fn,initialValue,_each){if(typeof fn!=="function"){return apiRejection("expecting a function but got "+util.classString(fn));}
var array=new ReductionPromiseArray(promises,fn,initialValue,_each);return array.promise();}
function gotAccum(accum){this.accum=accum;this.array._gotAccum(accum);var value=tryConvertToPromise(this.value,this.array._promise);if(value instanceof Promise){this.array._currentCancellable=value;return value._then(gotValue,undefined,undefined,this,undefined);}else{return gotValue.call(this,value);}}
function gotValue(value){var array=this.array;var promise=array._promise;var fn=tryCatch(array._fn);promise._pushContext();var ret;if(array._eachValues!==undefined){ret=fn.call(promise._boundValue(),value,this.index,this.length);}else{ret=fn.call(promise._boundValue(),this.accum,value,this.index,this.length);}
if(ret instanceof Promise){array._currentCancellable=ret;}
var promiseCreated=promise._popContext();debug.checkForgottenReturns(ret,promiseCreated,array._eachValues!==undefined?"Promise.each":"Promise.reduce",promise);return ret;}};},{"./util":36}],29:[function(_dereq_,module,exports){"use strict";var util=_dereq_("./util");var schedule;var noAsyncScheduler=function(){throw new Error("No async scheduler available\u000a\u000a    See http://goo.gl/MqrFmX\u000a");};var NativePromise=util.getNativePromise();if(util.isNode&&typeof MutationObserver==="undefined"){var GlobalSetImmediate=global.setImmediate;var ProcessNextTick=process.nextTick;schedule=util.isRecentNode?function(fn){GlobalSetImmediate.call(global,fn);}:function(fn){ProcessNextTick.call(process,fn);};}else if(typeof NativePromise==="function"&&typeof NativePromise.resolve==="function"){var nativePromise=NativePromise.resolve();schedule=function(fn){nativePromise.then(fn);};}else if((typeof MutationObserver!=="undefined")&&!(typeof window!=="undefined"&&window.navigator&&(window.navigator.standalone||window.cordova))){schedule=(function(){var div=document.createElement("div");var opts={attributes:true};var toggleScheduled=false;var div2=document.createElement("div");var o2=new MutationObserver(function(){div.classList.toggle("foo");toggleScheduled=false;});o2.observe(div2,opts);var scheduleToggle=function(){if(toggleScheduled)return;toggleScheduled=true;div2.classList.toggle("foo");};return function schedule(fn){var o=new MutationObserver(function(){o.disconnect();fn();});o.observe(div,opts);scheduleToggle();};})();}else if(typeof setImmediate!=="undefined"){schedule=function(fn){setImmediate(fn);};}else if(typeof setTimeout!=="undefined"){schedule=function(fn){setTimeout(fn,0);};}else{schedule=noAsyncScheduler;}
module.exports=schedule;},{"./util":36}],30:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,PromiseArray,debug){var PromiseInspection=Promise.PromiseInspection;var util=_dereq_("./util");function SettledPromiseArray(values){this.constructor$(values);}
util.inherits(SettledPromiseArray,PromiseArray);SettledPromiseArray.prototype._promiseResolved=function(index,inspection){this._values[index]=inspection;var totalResolved=++this._totalResolved;if(totalResolved>=this._length){this._resolve(this._values);return true;}
return false;};SettledPromiseArray.prototype._promiseFulfilled=function(value,index){var ret=new PromiseInspection();ret._bitField=33554432;ret._settledValueField=value;return this._promiseResolved(index,ret);};SettledPromiseArray.prototype._promiseRejected=function(reason,index){var ret=new PromiseInspection();ret._bitField=16777216;ret._settledValueField=reason;return this._promiseResolved(index,ret);};Promise.settle=function(promises){debug.deprecated(".settle()",".reflect()");return new SettledPromiseArray(promises).promise();};Promise.prototype.settle=function(){return Promise.settle(this);};};},{"./util":36}],31:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,PromiseArray,apiRejection){var util=_dereq_("./util");var RangeError=_dereq_("./errors").RangeError;var AggregateError=_dereq_("./errors").AggregateError;var isArray=util.isArray;var CANCELLATION={};function SomePromiseArray(values){this.constructor$(values);this._howMany=0;this._unwrap=false;this._initialized=false;}
util.inherits(SomePromiseArray,PromiseArray);SomePromiseArray.prototype._init=function(){if(!this._initialized){return;}
if(this._howMany===0){this._resolve([]);return;}
this._init$(undefined,-5);var isArrayResolved=isArray(this._values);if(!this._isResolved()&&isArrayResolved&&this._howMany>this._canPossiblyFulfill()){this._reject(this._getRangeError(this.length()));}};SomePromiseArray.prototype.init=function(){this._initialized=true;this._init();};SomePromiseArray.prototype.setUnwrap=function(){this._unwrap=true;};SomePromiseArray.prototype.howMany=function(){return this._howMany;};SomePromiseArray.prototype.setHowMany=function(count){this._howMany=count;};SomePromiseArray.prototype._promiseFulfilled=function(value){this._addFulfilled(value);if(this._fulfilled()===this.howMany()){this._values.length=this.howMany();if(this.howMany()===1&&this._unwrap){this._resolve(this._values[0]);}else{this._resolve(this._values);}
return true;}
return false;};SomePromiseArray.prototype._promiseRejected=function(reason){this._addRejected(reason);return this._checkOutcome();};SomePromiseArray.prototype._promiseCancelled=function(){if(this._values instanceof Promise||this._values==null){return this._cancel();}
this._addRejected(CANCELLATION);return this._checkOutcome();};SomePromiseArray.prototype._checkOutcome=function(){if(this.howMany()>this._canPossiblyFulfill()){var e=new AggregateError();for(var i=this.length();i<this._values.length;++i){if(this._values[i]!==CANCELLATION){e.push(this._values[i]);}}
if(e.length>0){this._reject(e);}else{this._cancel();}
return true;}
return false;};SomePromiseArray.prototype._fulfilled=function(){return this._totalResolved;};SomePromiseArray.prototype._rejected=function(){return this._values.length-this.length();};SomePromiseArray.prototype._addRejected=function(reason){this._values.push(reason);};SomePromiseArray.prototype._addFulfilled=function(value){this._values[this._totalResolved++]=value;};SomePromiseArray.prototype._canPossiblyFulfill=function(){return this.length()-this._rejected();};SomePromiseArray.prototype._getRangeError=function(count){var message="Input array must contain at least "+
this._howMany+" items but contains only "+count+" items";return new RangeError(message);};SomePromiseArray.prototype._resolveEmptyArray=function(){this._reject(this._getRangeError(0));};function some(promises,howMany){if((howMany|0)!==howMany||howMany<0){return apiRejection("expecting a positive integer\u000a\u000a    See http://goo.gl/MqrFmX\u000a");}
var ret=new SomePromiseArray(promises);var promise=ret.promise();ret.setHowMany(howMany);ret.init();return promise;}
Promise.some=function(promises,howMany){return some(promises,howMany);};Promise.prototype.some=function(howMany){return some(this,howMany);};Promise._SomePromiseArray=SomePromiseArray;};},{"./errors":12,"./util":36}],32:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise){function PromiseInspection(promise){if(promise!==undefined){promise=promise._target();this._bitField=promise._bitField;this._settledValueField=promise._isFateSealed()?promise._settledValue():undefined;}
else{this._bitField=0;this._settledValueField=undefined;}}
PromiseInspection.prototype._settledValue=function(){return this._settledValueField;};var value=PromiseInspection.prototype.value=function(){if(!this.isFulfilled()){throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a    See http://goo.gl/MqrFmX\u000a");}
return this._settledValue();};var reason=PromiseInspection.prototype.error=PromiseInspection.prototype.reason=function(){if(!this.isRejected()){throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a    See http://goo.gl/MqrFmX\u000a");}
return this._settledValue();};var isFulfilled=PromiseInspection.prototype.isFulfilled=function(){return(this._bitField&33554432)!==0;};var isRejected=PromiseInspection.prototype.isRejected=function(){return(this._bitField&16777216)!==0;};var isPending=PromiseInspection.prototype.isPending=function(){return(this._bitField&50397184)===0;};var isResolved=PromiseInspection.prototype.isResolved=function(){return(this._bitField&50331648)!==0;};PromiseInspection.prototype.isCancelled=function(){return(this._bitField&8454144)!==0;};Promise.prototype.__isCancelled=function(){return(this._bitField&65536)===65536;};Promise.prototype._isCancelled=function(){return this._target().__isCancelled();};Promise.prototype.isCancelled=function(){return(this._target()._bitField&8454144)!==0;};Promise.prototype.isPending=function(){return isPending.call(this._target());};Promise.prototype.isRejected=function(){return isRejected.call(this._target());};Promise.prototype.isFulfilled=function(){return isFulfilled.call(this._target());};Promise.prototype.isResolved=function(){return isResolved.call(this._target());};Promise.prototype.value=function(){return value.call(this._target());};Promise.prototype.reason=function(){var target=this._target();target._unsetRejectionIsUnhandled();return reason.call(target);};Promise.prototype._value=function(){return this._settledValue();};Promise.prototype._reason=function(){this._unsetRejectionIsUnhandled();return this._settledValue();};Promise.PromiseInspection=PromiseInspection;};},{}],33:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL){var util=_dereq_("./util");var errorObj=util.errorObj;var isObject=util.isObject;function tryConvertToPromise(obj,context){if(isObject(obj)){if(obj instanceof Promise)return obj;var then=getThen(obj);if(then===errorObj){if(context)context._pushContext();var ret=Promise.reject(then.e);if(context)context._popContext();return ret;}else if(typeof then==="function"){if(isAnyBluebirdPromise(obj)){var ret=new Promise(INTERNAL);obj._then(ret._fulfill,ret._reject,undefined,ret,null);return ret;}
return doThenable(obj,then,context);}}
return obj;}
function doGetThen(obj){return obj.then;}
function getThen(obj){try{return doGetThen(obj);}catch(e){errorObj.e=e;return errorObj;}}
var hasProp={}.hasOwnProperty;function isAnyBluebirdPromise(obj){try{return hasProp.call(obj,"_promise0");}catch(e){return false;}}
function doThenable(x,then,context){var promise=new Promise(INTERNAL);var ret=promise;if(context)context._pushContext();promise._captureStackTrace();if(context)context._popContext();var synchronous=true;var result=util.tryCatch(then).call(x,resolve,reject);synchronous=false;if(promise&&result===errorObj){promise._rejectCallback(result.e,true,true);promise=null;}
function resolve(value){if(!promise)return;promise._resolveCallback(value);promise=null;}
function reject(reason){if(!promise)return;promise._rejectCallback(reason,synchronous,true);promise=null;}
return ret;}
return tryConvertToPromise;};},{"./util":36}],34:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,INTERNAL,debug){var util=_dereq_("./util");var TimeoutError=Promise.TimeoutError;function HandleWrapper(handle){this.handle=handle;}
HandleWrapper.prototype._resultCancelled=function(){clearTimeout(this.handle);};var afterValue=function(value){return delay(+this).thenReturn(value);};var delay=Promise.delay=function(ms,value){var ret;var handle;if(value!==undefined){ret=Promise.resolve(value)._then(afterValue,null,null,ms,undefined);if(debug.cancellation()&&value instanceof Promise){ret._setOnCancel(value);}}else{ret=new Promise(INTERNAL);handle=setTimeout(function(){ret._fulfill();},+ms);if(debug.cancellation()){ret._setOnCancel(new HandleWrapper(handle));}
ret._captureStackTrace();}
ret._setAsyncGuaranteed();return ret;};Promise.prototype.delay=function(ms){return delay(ms,this);};var afterTimeout=function(promise,message,parent){var err;if(typeof message!=="string"){if(message instanceof Error){err=message;}else{err=new TimeoutError("operation timed out");}}else{err=new TimeoutError(message);}
util.markAsOriginatingFromRejection(err);promise._attachExtraTrace(err);promise._reject(err);if(parent!=null){parent.cancel();}};function successClear(value){clearTimeout(this.handle);return value;}
function failureClear(reason){clearTimeout(this.handle);throw reason;}
Promise.prototype.timeout=function(ms,message){ms=+ms;var ret,parent;var handleWrapper=new HandleWrapper(setTimeout(function timeoutTimeout(){if(ret.isPending()){afterTimeout(ret,message,parent);}},ms));if(debug.cancellation()){parent=this.then();ret=parent._then(successClear,failureClear,undefined,handleWrapper,undefined);ret._setOnCancel(handleWrapper);}else{ret=this._then(successClear,failureClear,undefined,handleWrapper,undefined);}
return ret;};};},{"./util":36}],35:[function(_dereq_,module,exports){"use strict";module.exports=function(Promise,apiRejection,tryConvertToPromise,createContext,INTERNAL,debug){var util=_dereq_("./util");var TypeError=_dereq_("./errors").TypeError;var inherits=_dereq_("./util").inherits;var errorObj=util.errorObj;var tryCatch=util.tryCatch;var NULL={};function thrower(e){setTimeout(function(){throw e;},0);}
function castPreservingDisposable(thenable){var maybePromise=tryConvertToPromise(thenable);if(maybePromise!==thenable&&typeof thenable._isDisposable==="function"&&typeof thenable._getDisposer==="function"&&thenable._isDisposable()){maybePromise._setDisposable(thenable._getDisposer());}
return maybePromise;}
function dispose(resources,inspection){var i=0;var len=resources.length;var ret=new Promise(INTERNAL);function iterator(){if(i>=len)return ret._fulfill();var maybePromise=castPreservingDisposable(resources[i++]);if(maybePromise instanceof Promise&&maybePromise._isDisposable()){try{maybePromise=tryConvertToPromise(maybePromise._getDisposer().tryDispose(inspection),resources.promise);}catch(e){return thrower(e);}
if(maybePromise instanceof Promise){return maybePromise._then(iterator,thrower,null,null,null);}}
iterator();}
iterator();return ret;}
function Disposer(data,promise,context){this._data=data;this._promise=promise;this._context=context;}
Disposer.prototype.data=function(){return this._data;};Disposer.prototype.promise=function(){return this._promise;};Disposer.prototype.resource=function(){if(this.promise().isFulfilled()){return this.promise().value();}
return NULL;};Disposer.prototype.tryDispose=function(inspection){var resource=this.resource();var context=this._context;if(context!==undefined)context._pushContext();var ret=resource!==NULL?this.doDispose(resource,inspection):null;if(context!==undefined)context._popContext();this._promise._unsetDisposable();this._data=null;return ret;};Disposer.isDisposer=function(d){return(d!=null&&typeof d.resource==="function"&&typeof d.tryDispose==="function");};function FunctionDisposer(fn,promise,context){this.constructor$(fn,promise,context);}
inherits(FunctionDisposer,Disposer);FunctionDisposer.prototype.doDispose=function(resource,inspection){var fn=this.data();return fn.call(resource,resource,inspection);};function maybeUnwrapDisposer(value){if(Disposer.isDisposer(value)){this.resources[this.index]._setDisposable(value);return value.promise();}
return value;}
function ResourceList(length){this.length=length;this.promise=null;this[length-1]=null;}
ResourceList.prototype._resultCancelled=function(){var len=this.length;for(var i=0;i<len;++i){var item=this[i];if(item instanceof Promise){item.cancel();}}};Promise.using=function(){var len=arguments.length;if(len<2)return apiRejection("you must pass at least 2 arguments to Promise.using");var fn=arguments[len-1];if(typeof fn!=="function"){return apiRejection("expecting a function but got "+util.classString(fn));}
var input;var spreadArgs=true;if(len===2&&Array.isArray(arguments[0])){input=arguments[0];len=input.length;spreadArgs=false;}else{input=arguments;len--;}
var resources=new ResourceList(len);for(var i=0;i<len;++i){var resource=input[i];if(Disposer.isDisposer(resource)){var disposer=resource;resource=resource.promise();resource._setDisposable(disposer);}else{var maybePromise=tryConvertToPromise(resource);if(maybePromise instanceof Promise){resource=maybePromise._then(maybeUnwrapDisposer,null,null,{resources:resources,index:i},undefined);}}
resources[i]=resource;}
var reflectedResources=new Array(resources.length);for(var i=0;i<reflectedResources.length;++i){reflectedResources[i]=Promise.resolve(resources[i]).reflect();}
var resultPromise=Promise.all(reflectedResources).then(function(inspections){for(var i=0;i<inspections.length;++i){var inspection=inspections[i];if(inspection.isRejected()){errorObj.e=inspection.error();return errorObj;}else if(!inspection.isFulfilled()){resultPromise.cancel();return;}
inspections[i]=inspection.value();}
promise._pushContext();fn=tryCatch(fn);var ret=spreadArgs?fn.apply(undefined,inspections):fn(inspections);var promiseCreated=promise._popContext();debug.checkForgottenReturns(ret,promiseCreated,"Promise.using",promise);return ret;});var promise=resultPromise.lastly(function(){var inspection=new Promise.PromiseInspection(resultPromise);return dispose(resources,inspection);});resources.promise=promise;promise._setOnCancel(resources);return promise;};Promise.prototype._setDisposable=function(disposer){this._bitField=this._bitField|131072;this._disposer=disposer;};Promise.prototype._isDisposable=function(){return(this._bitField&131072)>0;};Promise.prototype._getDisposer=function(){return this._disposer;};Promise.prototype._unsetDisposable=function(){this._bitField=this._bitField&(~131072);this._disposer=undefined;};Promise.prototype.disposer=function(fn){if(typeof fn==="function"){return new FunctionDisposer(fn,this,createContext());}
throw new TypeError();};};},{"./errors":12,"./util":36}],36:[function(_dereq_,module,exports){"use strict";var es5=_dereq_("./es5");var canEvaluate=typeof navigator=="undefined";var errorObj={e:{}};var tryCatchTarget;var globalObject=typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:this!==undefined?this:null;function tryCatcher(){try{var target=tryCatchTarget;tryCatchTarget=null;return target.apply(this,arguments);}catch(e){errorObj.e=e;return errorObj;}}
function tryCatch(fn){tryCatchTarget=fn;return tryCatcher;}
var inherits=function(Child,Parent){var hasProp={}.hasOwnProperty;function T(){this.constructor=Child;this.constructor$=Parent;for(var propertyName in Parent.prototype){if(hasProp.call(Parent.prototype,propertyName)&&propertyName.charAt(propertyName.length-1)!=="$"){this[propertyName+"$"]=Parent.prototype[propertyName];}}}
T.prototype=Parent.prototype;Child.prototype=new T();return Child.prototype;};function isPrimitive(val){return val==null||val===true||val===false||typeof val==="string"||typeof val==="number";}
function isObject(value){return typeof value==="function"||typeof value==="object"&&value!==null;}
function maybeWrapAsError(maybeError){if(!isPrimitive(maybeError))return maybeError;return new Error(safeToString(maybeError));}
function withAppended(target,appendee){var len=target.length;var ret=new Array(len+1);var i;for(i=0;i<len;++i){ret[i]=target[i];}
ret[i]=appendee;return ret;}
function getDataPropertyOrDefault(obj,key,defaultValue){if(es5.isES5){var desc=Object.getOwnPropertyDescriptor(obj,key);if(desc!=null){return desc.get==null&&desc.set==null?desc.value:defaultValue;}}else{return{}.hasOwnProperty.call(obj,key)?obj[key]:undefined;}}
function notEnumerableProp(obj,name,value){if(isPrimitive(obj))return obj;var descriptor={value:value,configurable:true,enumerable:false,writable:true};es5.defineProperty(obj,name,descriptor);return obj;}
function thrower(r){throw r;}
var inheritedDataKeys=(function(){var excludedPrototypes=[Array.prototype,Object.prototype,Function.prototype];var isExcludedProto=function(val){for(var i=0;i<excludedPrototypes.length;++i){if(excludedPrototypes[i]===val){return true;}}
return false;};if(es5.isES5){var getKeys=Object.getOwnPropertyNames;return function(obj){var ret=[];var visitedKeys=Object.create(null);while(obj!=null&&!isExcludedProto(obj)){var keys;try{keys=getKeys(obj);}catch(e){return ret;}
for(var i=0;i<keys.length;++i){var key=keys[i];if(visitedKeys[key])continue;visitedKeys[key]=true;var desc=Object.getOwnPropertyDescriptor(obj,key);if(desc!=null&&desc.get==null&&desc.set==null){ret.push(key);}}
obj=es5.getPrototypeOf(obj);}
return ret;};}else{var hasProp={}.hasOwnProperty;return function(obj){if(isExcludedProto(obj))return[];var ret=[];enumeration:for(var key in obj){if(hasProp.call(obj,key)){ret.push(key);}else{for(var i=0;i<excludedPrototypes.length;++i){if(hasProp.call(excludedPrototypes[i],key)){continue enumeration;}}
ret.push(key);}}
return ret;};}})();var thisAssignmentPattern=/this\s*\.\s*\S+\s*=/;function isClass(fn){try{if(typeof fn==="function"){var keys=es5.names(fn.prototype);var hasMethods=es5.isES5&&keys.length>1;var hasMethodsOtherThanConstructor=keys.length>0&&!(keys.length===1&&keys[0]==="constructor");var hasThisAssignmentAndStaticMethods=thisAssignmentPattern.test(fn+"")&&es5.names(fn).length>0;if(hasMethods||hasMethodsOtherThanConstructor||hasThisAssignmentAndStaticMethods){return true;}}
return false;}catch(e){return false;}}
function toFastProperties(obj){function FakeConstructor(){}
FakeConstructor.prototype=obj;var receiver=new FakeConstructor();function ic(){return typeof receiver.foo;}
ic();ic();return obj;eval(obj);}
var rident=/^[a-z$_][a-z$_0-9]*$/i;function isIdentifier(str){return rident.test(str);}
function filledRange(count,prefix,suffix){var ret=new Array(count);for(var i=0;i<count;++i){ret[i]=prefix+i+suffix;}
return ret;}
function safeToString(obj){try{return obj+"";}catch(e){return"[no string representation]";}}
function isError(obj){return obj instanceof Error||(obj!==null&&typeof obj==="object"&&typeof obj.message==="string"&&typeof obj.name==="string");}
function markAsOriginatingFromRejection(e){try{notEnumerableProp(e,"isOperational",true);}
catch(ignore){}}
function originatesFromRejection(e){if(e==null)return false;return((e instanceof Error["__BluebirdErrorTypes__"].OperationalError)||e["isOperational"]===true);}
function canAttachTrace(obj){return isError(obj)&&es5.propertyIsWritable(obj,"stack");}
var ensureErrorObject=(function(){if(!("stack"in new Error())){return function(value){if(canAttachTrace(value))return value;try{throw new Error(safeToString(value));}
catch(err){return err;}};}else{return function(value){if(canAttachTrace(value))return value;return new Error(safeToString(value));};}})();function classString(obj){return{}.toString.call(obj);}
function copyDescriptors(from,to,filter){var keys=es5.names(from);for(var i=0;i<keys.length;++i){var key=keys[i];if(filter(key)){try{es5.defineProperty(to,key,es5.getDescriptor(from,key));}catch(ignore){}}}}
var asArray=function(v){if(es5.isArray(v)){return v;}
return null;};if(typeof Symbol!=="undefined"&&Symbol.iterator){var ArrayFrom=typeof Array.from==="function"?function(v){return Array.from(v);}:function(v){var ret=[];var it=v[Symbol.iterator]();var itResult;while(!((itResult=it.next()).done)){ret.push(itResult.value);}
return ret;};asArray=function(v){if(es5.isArray(v)){return v;}else if(v!=null&&typeof v[Symbol.iterator]==="function"){return ArrayFrom(v);}
return null;};}
var isNode=typeof process!=="undefined"&&classString(process).toLowerCase()==="[object process]";var hasEnvVariables=typeof process!=="undefined"&&typeof process.env!=="undefined";function env(key){return hasEnvVariables?process.env[key]:undefined;}
function getNativePromise(){if(typeof Promise==="function"){try{var promise=new Promise(function(){});if({}.toString.call(promise)==="[object Promise]"){return Promise;}}catch(e){}}}
function domainBind(self,cb){return self.bind(cb);}
var ret={isClass:isClass,isIdentifier:isIdentifier,inheritedDataKeys:inheritedDataKeys,getDataPropertyOrDefault:getDataPropertyOrDefault,thrower:thrower,isArray:es5.isArray,asArray:asArray,notEnumerableProp:notEnumerableProp,isPrimitive:isPrimitive,isObject:isObject,isError:isError,canEvaluate:canEvaluate,errorObj:errorObj,tryCatch:tryCatch,inherits:inherits,withAppended:withAppended,maybeWrapAsError:maybeWrapAsError,toFastProperties:toFastProperties,filledRange:filledRange,toString:safeToString,canAttachTrace:canAttachTrace,ensureErrorObject:ensureErrorObject,originatesFromRejection:originatesFromRejection,markAsOriginatingFromRejection:markAsOriginatingFromRejection,classString:classString,copyDescriptors:copyDescriptors,hasDevTools:typeof chrome!=="undefined"&&chrome&&typeof chrome.loadTimes==="function",isNode:isNode,hasEnvVariables:hasEnvVariables,env:env,global:globalObject,getNativePromise:getNativePromise,domainBind:domainBind};ret.isRecentNode=ret.isNode&&(function(){var version=process.versions.node.split(".").map(Number);return(version[0]===0&&version[1]>10)||(version[0]>0);})();if(ret.isNode)ret.toFastProperties(process);try{throw new Error();}catch(e){ret.lastLineError=e;}
module.exports=ret;},{"./es5":13}]},{},[4])(4)});;if(typeof window!=='undefined'&&window!==null){window.P=window.Promise;}else if(typeof self!=='undefined'&&self!==null){self.P=self.Promise;}}).call(this,require('_process'),typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{},require("timers").setImmediate)},{"_process":16,"timers":17}],15:[function(require,module,exports){var objectCreate=Object.create||objectCreatePolyfill
var objectKeys=Object.keys||objectKeysPolyfill
var bind=Function.prototype.bind||functionBindPolyfill
function EventEmitter(){if(!this._events||!Object.prototype.hasOwnProperty.call(this,'_events')){this._events=objectCreate(null);this._eventsCount=0;}
this._maxListeners=this._maxListeners||undefined;}
module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;var defaultMaxListeners=10;var hasDefineProperty;try{var o={};if(Object.defineProperty)Object.defineProperty(o,'x',{value:0});hasDefineProperty=o.x===0;}catch(err){hasDefineProperty=false}
if(hasDefineProperty){Object.defineProperty(EventEmitter,'defaultMaxListeners',{enumerable:true,get:function(){return defaultMaxListeners;},set:function(arg){if(typeof arg!=='number'||arg<0||arg!==arg)
throw new TypeError('"defaultMaxListeners" must be a positive number');defaultMaxListeners=arg;}});}else{EventEmitter.defaultMaxListeners=defaultMaxListeners;}
EventEmitter.prototype.setMaxListeners=function setMaxListeners(n){if(typeof n!=='number'||n<0||isNaN(n))
throw new TypeError('"n" argument must be a positive number');this._maxListeners=n;return this;};function $getMaxListeners(that){if(that._maxListeners===undefined)
return EventEmitter.defaultMaxListeners;return that._maxListeners;}
EventEmitter.prototype.getMaxListeners=function getMaxListeners(){return $getMaxListeners(this);};function emitNone(handler,isFn,self){if(isFn)
handler.call(self);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i<len;++i)
listeners[i].call(self);}}
function emitOne(handler,isFn,self,arg1){if(isFn)
handler.call(self,arg1);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i<len;++i)
listeners[i].call(self,arg1);}}
function emitTwo(handler,isFn,self,arg1,arg2){if(isFn)
handler.call(self,arg1,arg2);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i<len;++i)
listeners[i].call(self,arg1,arg2);}}
function emitThree(handler,isFn,self,arg1,arg2,arg3){if(isFn)
handler.call(self,arg1,arg2,arg3);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i<len;++i)
listeners[i].call(self,arg1,arg2,arg3);}}
function emitMany(handler,isFn,self,args){if(isFn)
handler.apply(self,args);else{var len=handler.length;var listeners=arrayClone(handler,len);for(var i=0;i<len;++i)
listeners[i].apply(self,args);}}
EventEmitter.prototype.emit=function emit(type){var er,handler,len,args,i,events;var doError=(type==='error');events=this._events;if(events)
doError=(doError&&events.error==null);else if(!doError)
return false;if(doError){if(arguments.length>1)
er=arguments[1];if(er instanceof Error){throw er;}else{var err=new Error('Unhandled "error" event. ('+er+')');err.context=er;throw err;}
return false;}
handler=events[type];if(!handler)
return false;var isFn=typeof handler==='function';len=arguments.length;switch(len){case 1:emitNone(handler,isFn,this);break;case 2:emitOne(handler,isFn,this,arguments[1]);break;case 3:emitTwo(handler,isFn,this,arguments[1],arguments[2]);break;case 4:emitThree(handler,isFn,this,arguments[1],arguments[2],arguments[3]);break;default:args=new Array(len-1);for(i=1;i<len;i++)
args[i-1]=arguments[i];emitMany(handler,isFn,this,args);}
return true;};function _addListener(target,type,listener,prepend){var m;var events;var existing;if(typeof listener!=='function')
throw new TypeError('"listener" argument must be a function');events=target._events;if(!events){events=target._events=objectCreate(null);target._eventsCount=0;}else{if(events.newListener){target.emit('newListener',type,listener.listener?listener.listener:listener);events=target._events;}
existing=events[type];}
if(!existing){existing=events[type]=listener;++target._eventsCount;}else{if(typeof existing==='function'){existing=events[type]=prepend?[listener,existing]:[existing,listener];}else{if(prepend){existing.unshift(listener);}else{existing.push(listener);}}
if(!existing.warned){m=$getMaxListeners(target);if(m&&m>0&&existing.length>m){existing.warned=true;var w=new Error('Possible EventEmitter memory leak detected. '+
existing.length+' "'+String(type)+'" listeners '+'added. Use emitter.setMaxListeners() to '+'increase limit.');w.name='MaxListenersExceededWarning';w.emitter=target;w.type=type;w.count=existing.length;if(typeof console==='object'&&console.warn){console.warn('%s: %s',w.name,w.message);}}}}
return target;}
EventEmitter.prototype.addListener=function addListener(type,listener){return _addListener(this,type,listener,false);};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.prependListener=function prependListener(type,listener){return _addListener(this,type,listener,true);};function onceWrapper(){if(!this.fired){this.target.removeListener(this.type,this.wrapFn);this.fired=true;switch(arguments.length){case 0:return this.listener.call(this.target);case 1:return this.listener.call(this.target,arguments[0]);case 2:return this.listener.call(this.target,arguments[0],arguments[1]);case 3:return this.listener.call(this.target,arguments[0],arguments[1],arguments[2]);default:var args=new Array(arguments.length);for(var i=0;i<args.length;++i)
args[i]=arguments[i];this.listener.apply(this.target,args);}}}
function _onceWrap(target,type,listener){var state={fired:false,wrapFn:undefined,target:target,type:type,listener:listener};var wrapped=bind.call(onceWrapper,state);wrapped.listener=listener;state.wrapFn=wrapped;return wrapped;}
EventEmitter.prototype.once=function once(type,listener){if(typeof listener!=='function')
throw new TypeError('"listener" argument must be a function');this.on(type,_onceWrap(this,type,listener));return this;};EventEmitter.prototype.prependOnceListener=function prependOnceListener(type,listener){if(typeof listener!=='function')
throw new TypeError('"listener" argument must be a function');this.prependListener(type,_onceWrap(this,type,listener));return this;};EventEmitter.prototype.removeListener=function removeListener(type,listener){var list,events,position,i,originalListener;if(typeof listener!=='function')
throw new TypeError('"listener" argument must be a function');events=this._events;if(!events)
return this;list=events[type];if(!list)
return this;if(list===listener||list.listener===listener){if(--this._eventsCount===0)
this._events=objectCreate(null);else{delete events[type];if(events.removeListener)
this.emit('removeListener',type,list.listener||listener);}}else if(typeof list!=='function'){position=-1;for(i=list.length-1;i>=0;i--){if(list[i]===listener||list[i].listener===listener){originalListener=list[i].listener;position=i;break;}}
if(position<0)
return this;if(position===0)
list.shift();else
spliceOne(list,position);if(list.length===1)
events[type]=list[0];if(events.removeListener)
this.emit('removeListener',type,originalListener||listener);}
return this;};EventEmitter.prototype.removeAllListeners=function removeAllListeners(type){var listeners,events,i;events=this._events;if(!events)
return this;if(!events.removeListener){if(arguments.length===0){this._events=objectCreate(null);this._eventsCount=0;}else if(events[type]){if(--this._eventsCount===0)
this._events=objectCreate(null);else
delete events[type];}
return this;}
if(arguments.length===0){var keys=objectKeys(events);var key;for(i=0;i<keys.length;++i){key=keys[i];if(key==='removeListener')continue;this.removeAllListeners(key);}
this.removeAllListeners('removeListener');this._events=objectCreate(null);this._eventsCount=0;return this;}
listeners=events[type];if(typeof listeners==='function'){this.removeListener(type,listeners);}else if(listeners){for(i=listeners.length-1;i>=0;i--){this.removeListener(type,listeners[i]);}}
return this;};function _listeners(target,type,unwrap){var events=target._events;if(!events)
return[];var evlistener=events[type];if(!evlistener)
return[];if(typeof evlistener==='function')
return unwrap?[evlistener.listener||evlistener]:[evlistener];return unwrap?unwrapListeners(evlistener):arrayClone(evlistener,evlistener.length);}
EventEmitter.prototype.listeners=function listeners(type){return _listeners(this,type,true);};EventEmitter.prototype.rawListeners=function rawListeners(type){return _listeners(this,type,false);};EventEmitter.listenerCount=function(emitter,type){if(typeof emitter.listenerCount==='function'){return emitter.listenerCount(type);}else{return listenerCount.call(emitter,type);}};EventEmitter.prototype.listenerCount=listenerCount;function listenerCount(type){var events=this._events;if(events){var evlistener=events[type];if(typeof evlistener==='function'){return 1;}else if(evlistener){return evlistener.length;}}
return 0;}
EventEmitter.prototype.eventNames=function eventNames(){return this._eventsCount>0?Reflect.ownKeys(this._events):[];};function spliceOne(list,index){for(var i=index,k=i+1,n=list.length;k<n;i+=1,k+=1)
list[i]=list[k];list.pop();}
function arrayClone(arr,n){var copy=new Array(n);for(var i=0;i<n;++i)
copy[i]=arr[i];return copy;}
function unwrapListeners(arr){var ret=new Array(arr.length);for(var i=0;i<ret.length;++i){ret[i]=arr[i].listener||arr[i];}
return ret;}
function objectCreatePolyfill(proto){var F=function(){};F.prototype=proto;return new F;}
function objectKeysPolyfill(obj){var keys=[];for(var k in obj)if(Object.prototype.hasOwnProperty.call(obj,k)){keys.push(k);}
return k;}
function functionBindPolyfill(context){var fn=this;return function(){return fn.apply(context,arguments);};}},{}],16:[function(require,module,exports){var process=module.exports={};var cachedSetTimeout;var cachedClearTimeout;function defaultSetTimout(){throw new Error('setTimeout has not been defined');}
function defaultClearTimeout(){throw new Error('clearTimeout has not been defined');}
(function(){try{if(typeof setTimeout==='function'){cachedSetTimeout=setTimeout;}else{cachedSetTimeout=defaultSetTimout;}}catch(e){cachedSetTimeout=defaultSetTimout;}
try{if(typeof clearTimeout==='function'){cachedClearTimeout=clearTimeout;}else{cachedClearTimeout=defaultClearTimeout;}}catch(e){cachedClearTimeout=defaultClearTimeout;}}())
function runTimeout(fun){if(cachedSetTimeout===setTimeout){return setTimeout(fun,0);}
if((cachedSetTimeout===defaultSetTimout||!cachedSetTimeout)&&setTimeout){cachedSetTimeout=setTimeout;return setTimeout(fun,0);}
try{return cachedSetTimeout(fun,0);}catch(e){try{return cachedSetTimeout.call(null,fun,0);}catch(e){return cachedSetTimeout.call(this,fun,0);}}}
function runClearTimeout(marker){if(cachedClearTimeout===clearTimeout){return clearTimeout(marker);}
if((cachedClearTimeout===defaultClearTimeout||!cachedClearTimeout)&&clearTimeout){cachedClearTimeout=clearTimeout;return clearTimeout(marker);}
try{return cachedClearTimeout(marker);}catch(e){try{return cachedClearTimeout.call(null,marker);}catch(e){return cachedClearTimeout.call(this,marker);}}}
var queue=[];var draining=false;var currentQueue;var queueIndex=-1;function cleanUpNextTick(){if(!draining||!currentQueue){return;}
draining=false;if(currentQueue.length){queue=currentQueue.concat(queue);}else{queueIndex=-1;}
if(queue.length){drainQueue();}}
function drainQueue(){if(draining){return;}
var timeout=runTimeout(cleanUpNextTick);draining=true;var len=queue.length;while(len){currentQueue=queue;queue=[];while(++queueIndex<len){if(currentQueue){currentQueue[queueIndex].run();}}
queueIndex=-1;len=queue.length;}
currentQueue=null;draining=false;runClearTimeout(timeout);}
process.nextTick=function(fun){var args=new Array(arguments.length-1);if(arguments.length>1){for(var i=1;i<arguments.length;i++){args[i-1]=arguments[i];}}
queue.push(new Item(fun,args));if(queue.length===1&&!draining){runTimeout(drainQueue);}};function Item(fun,array){this.fun=fun;this.array=array;}
Item.prototype.run=function(){this.fun.apply(null,this.array);};process.title='browser';process.browser=true;process.env={};process.argv=[];process.version='';process.versions={};function noop(){}
process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.prependListener=noop;process.prependOnceListener=noop;process.listeners=function(name){return[]}
process.binding=function(name){throw new Error('process.binding is not supported');};process.cwd=function(){return'/'};process.chdir=function(dir){throw new Error('process.chdir is not supported');};process.umask=function(){return 0;};},{}],17:[function(require,module,exports){(function(setImmediate,clearImmediate){var nextTick=require('process/browser.js').nextTick;var apply=Function.prototype.apply;var slice=Array.prototype.slice;var immediateIds={};var nextImmediateId=0;exports.setTimeout=function(){return new Timeout(apply.call(setTimeout,window,arguments),clearTimeout);};exports.setInterval=function(){return new Timeout(apply.call(setInterval,window,arguments),clearInterval);};exports.clearTimeout=exports.clearInterval=function(timeout){timeout.close();};function Timeout(id,clearFn){this._id=id;this._clearFn=clearFn;}
Timeout.prototype.unref=Timeout.prototype.ref=function(){};Timeout.prototype.close=function(){this._clearFn.call(window,this._id);};exports.enroll=function(item,msecs){clearTimeout(item._idleTimeoutId);item._idleTimeout=msecs;};exports.unenroll=function(item){clearTimeout(item._idleTimeoutId);item._idleTimeout=-1;};exports._unrefActive=exports.active=function(item){clearTimeout(item._idleTimeoutId);var msecs=item._idleTimeout;if(msecs>=0){item._idleTimeoutId=setTimeout(function onTimeout(){if(item._onTimeout)
item._onTimeout();},msecs);}};exports.setImmediate=typeof setImmediate==="function"?setImmediate:function(fn){var id=nextImmediateId++;var args=arguments.length<2?false:slice.call(arguments,1);immediateIds[id]=true;nextTick(function onNextTick(){if(immediateIds[id]){if(args){fn.apply(null,args);}else{fn.call(null);}
exports.clearImmediate(id);}});return id;};exports.clearImmediate=typeof clearImmediate==="function"?clearImmediate:function(id){delete immediateIds[id];};}).call(this,require("timers").setImmediate,require("timers").clearImmediate)},{"process/browser.js":16,"timers":17}],18:[function(require,module,exports){/*!@license
  UAParser.js v0.7.28
  Lightweight JavaScript-based User-Agent string parser
  https://github.com/faisalman/ua-parser-js
 
  Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
  Licensed under MIT License
 */(function(window,undefined){'use strict';var LIBVERSION='0.7.28',EMPTY='',UNKNOWN='?',FUNC_TYPE='function',UNDEF_TYPE='undefined',OBJ_TYPE='object',STR_TYPE='string',MAJOR='major',MODEL='model',NAME='name',TYPE='type',VENDOR='vendor',VERSION='version',ARCHITECTURE='architecture',CONSOLE='console',MOBILE='mobile',TABLET='tablet',SMARTTV='smarttv',WEARABLE='wearable',EMBEDDED='embedded',UA_MAX_LENGTH=255;var util={extend:function(regexes,extensions){var mergedRegexes={};for(var i in regexes){if(extensions[i]&&extensions[i].length%2===0){mergedRegexes[i]=extensions[i].concat(regexes[i]);}else{mergedRegexes[i]=regexes[i];}}
return mergedRegexes;},has:function(str1,str2){return typeof str1===STR_TYPE?str2.toLowerCase().indexOf(str1.toLowerCase())!==-1:false;},lowerize:function(str){return str.toLowerCase();},major:function(version){return typeof(version)===STR_TYPE?version.replace(/[^\d\.]/g,'').split(".")[0]:undefined;},trim:function(str,len){str=str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,'');return typeof(len)===UNDEF_TYPE?str:str.substring(0,UA_MAX_LENGTH);}};var mapper={rgx:function(ua,arrays){var i=0,j,k,p,q,matches,match;while(i<arrays.length&&!matches){var regex=arrays[i],props=arrays[i+1];j=k=0;while(j<regex.length&&!matches){matches=regex[j++].exec(ua);if(!!matches){for(p=0;p<props.length;p++){match=matches[++k];q=props[p];if(typeof q===OBJ_TYPE&&q.length>0){if(q.length==2){if(typeof q[1]==FUNC_TYPE){this[q[0]]=q[1].call(this,match);}else{this[q[0]]=q[1];}}else if(q.length==3){if(typeof q[1]===FUNC_TYPE&&!(q[1].exec&&q[1].test)){this[q[0]]=match?q[1].call(this,match,q[2]):undefined;}else{this[q[0]]=match?match.replace(q[1],q[2]):undefined;}}else if(q.length==4){this[q[0]]=match?q[3].call(this,match.replace(q[1],q[2])):undefined;}}else{this[q]=match?match:undefined;}}}}
i+=2;}},str:function(str,map){for(var i in map){if(typeof map[i]===OBJ_TYPE&&map[i].length>0){for(var j=0;j<map[i].length;j++){if(util.has(map[i][j],str)){return(i===UNKNOWN)?undefined:i;}}}else if(util.has(map[i],str)){return(i===UNKNOWN)?undefined:i;}}
return str;}};var maps={browser:{oldSafari:{version:{'1.0':'/8','1.2':'/1','1.3':'/3','2.0':'/412','2.0.2':'/416','2.0.3':'/417','2.0.4':'/419','?':'/'}},oldEdge:{version:{'0.1':'12.','21':'13.','31':'14.','39':'15.','41':'16.','42':'17.','44':'18.'}}},os:{windows:{version:{'ME':'4.90','NT 3.11':'NT3.51','NT 4.0':'NT4.0','2000':'NT 5.0','XP':['NT 5.1','NT 5.2'],'Vista':'NT 6.0','7':'NT 6.1','8':'NT 6.2','8.1':'NT 6.3','10':['NT 6.4','NT 10.0'],'RT':'ARM'}}}};var regexes={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[VERSION,[NAME,'Chrome']],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[VERSION,[NAME,'Edge']],[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]{3,6})\b.+version\/([\w\.-]+)/i,/(opera)(?:.+version\/|[\/\s]+)([\w\.]+)/i,],[NAME,VERSION],[/opios[\/\s]+([\w\.]+)/i],[VERSION,[NAME,'Opera Mini']],[/\sopr\/([\w\.]+)/i],[VERSION,[NAME,'Opera']],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i,/(avant\s|iemobile|slim)(?:browser)?[\/\s]?([\w\.]*)/i,/(ba?idubrowser)[\/\s]?([\w\.]+)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon)\/([\w\.-]+)/i,/(rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([\w\.]+)/i,/(weibo)__([\d\.]+)/i],[NAME,VERSION],[/(?:[\s\/]uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[VERSION,[NAME,'UCBrowser']],[/(?:windowswechat)?\sqbcore\/([\w\.]+)\b.*(?:windowswechat)?/i],[VERSION,[NAME,'WeChat(Win) Desktop']],[/micromessenger\/([\w\.]+)/i],[VERSION,[NAME,'WeChat']],[/konqueror\/([\w\.]+)/i],[VERSION,[NAME,'Konqueror']],[/trident.+rv[:\s]([\w\.]{1,9})\b.+like\sgecko/i],[VERSION,[NAME,'IE']],[/yabrowser\/([\w\.]+)/i],[VERSION,[NAME,'Yandex']],[/(avast|avg)\/([\w\.]+)/i],[[NAME,/(.+)/,'$1 Secure Browser'],VERSION],[/focus\/([\w\.]+)/i],[VERSION,[NAME,'Firefox Focus']],[/opt\/([\w\.]+)/i],[VERSION,[NAME,'Opera Touch']],[/coc_coc_browser\/([\w\.]+)/i],[VERSION,[NAME,'Coc Coc']],[/dolfin\/([\w\.]+)/i],[VERSION,[NAME,'Dolphin']],[/coast\/([\w\.]+)/i],[VERSION,[NAME,'Opera Coast']],[/xiaomi\/miuibrowser\/([\w\.]+)/i],[VERSION,[NAME,'MIUI Browser']],[/fxios\/([\w\.-]+)/i],[VERSION,[NAME,'Firefox']],[/(qihu|qhbrowser|qihoobrowser|360browser)/i],[[NAME,'360 Browser']],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[NAME,/(.+)/,'$1 Browser'],VERSION],[/(comodo_dragon)\/([\w\.]+)/i],[[NAME,/_/g,' '],VERSION],[/\s(electron)\/([\w\.]+)\ssafari/i,/(tesla)(?:\sqtcarbrowser|\/(20[12]\d\.[\w\.-]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/\s]?([\w\.]+)/i],[NAME,VERSION],[/(MetaSr)[\/\s]?([\w\.]+)/i,/(LBBROWSER)/i],[NAME],[/;fbav\/([\w\.]+);/i],[VERSION,[NAME,'Facebook']],[/FBAN\/FBIOS|FB_IAB\/FB4A/i],[[NAME,'Facebook']],[/safari\s(line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/\s]([\w\.-]+)/i],[NAME,VERSION],[/\bgsa\/([\w\.]+)\s.*safari\//i],[VERSION,[NAME,'GSA']],[/headlesschrome(?:\/([\w\.]+)|\s)/i],[VERSION,[NAME,'Chrome Headless']],[/\swv\).+(chrome)\/([\w\.]+)/i],[[NAME,'Chrome WebView'],VERSION],[/droid.+\sversion\/([\w\.]+)\b.+(?:mobile\ssafari|safari)/i],[VERSION,[NAME,'Android Browser']],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[NAME,VERSION],[/version\/([\w\.]+)\s.*mobile\/\w+\s(safari)/i],[VERSION,[NAME,'Mobile Safari']],[/version\/([\w\.]+)\s.*(mobile\s?safari|safari)/i],[VERSION,NAME],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[NAME,[VERSION,mapper.str,maps.browser.oldSafari.version]],[/(webkit|khtml)\/([\w\.]+)/i],[NAME,VERSION],[/(navigator|netscape)\/([\w\.-]+)/i],[[NAME,'Netscape'],VERSION],[/ile\svr;\srv:([\w\.]+)\).+firefox/i],[VERSION,[NAME,'Firefox Reality']],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i,/(firefox)\/([\w\.]+)\s[\w\s\-]+\/[\w\.]+$/i,/(mozilla)\/([\w\.]+)\s.+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]*)/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[NAME,VERSION]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[[ARCHITECTURE,'amd64']],[/(ia32(?=;))/i],[[ARCHITECTURE,util.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[ARCHITECTURE,'ia32']],[/\b(aarch64|armv?8e?l?)\b/i],[[ARCHITECTURE,'arm64']],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[ARCHITECTURE,'armhf']],[/windows\s(ce|mobile);\sppc;/i],[[ARCHITECTURE,'arm']],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[[ARCHITECTURE,/ower/,'',util.lowerize]],[/(sun4\w)[;\)]/i],[[ARCHITECTURE,'sparc']],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?:64|(?=v(?:[1-7]|[5-7]1)l?|;|eabi))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[ARCHITECTURE,util.lowerize]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus\s10)/i],[MODEL,[VENDOR,'Samsung'],[TYPE,TABLET]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy\snexus)/i,/\ssamsung[\s-]([\w-]+)/i,/sec-(sgh\w+)/i],[MODEL,[VENDOR,'Samsung'],[TYPE,MOBILE]],[/\((ip(?:hone|od)[\s\w]*);/i],[MODEL,[VENDOR,'Apple'],[TYPE,MOBILE]],[/\((ipad);[\w\s\),;-]+apple/i,/applecoremedia\/[\w\.]+\s\((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[MODEL,[VENDOR,'Apple'],[TYPE,TABLET]],[/\b((?:agr|ags[23]|bah2?|sht?)-a?[lw]\d{2})/i,],[MODEL,[VENDOR,'Huawei'],[TYPE,TABLET]],[/d\/huawei([\w\s-]+)[;\)]/i,/\b(nexus\s6p|vog-[at]?l\d\d|ane-[at]?l[x\d]\d|eml-a?l\d\da?|lya-[at]?l\d[\dc]|clt-a?l\d\di?|ele-l\d\d)/i,/\b(\w{2,4}-[atu][ln][01259][019])[;\)\s]/i],[MODEL,[VENDOR,'Huawei'],[TYPE,MOBILE]],[/\b(poco[\s\w]+)(?:\sbuild|\))/i,/\b;\s(\w+)\sbuild\/hm\1/i,/\b(hm[\s\-_]?note?[\s_]?(?:\d\w)?)\sbuild/i,/\b(redmi[\s\-_]?(?:note|k)?[\w\s_]+)(?:\sbuild|\))/i,/\b(mi[\s\-_]?(?:a\d|one|one[\s_]plus|note lte)?[\s_]?(?:\d?\w?)[\s_]?(?:plus)?)\sbuild/i],[[MODEL,/_/g,' '],[VENDOR,'Xiaomi'],[TYPE,MOBILE]],[/\b(mi[\s\-_]?(?:pad)(?:[\w\s_]+))(?:\sbuild|\))/i],[[MODEL,/_/g,' '],[VENDOR,'Xiaomi'],[TYPE,TABLET]],[/;\s(\w+)\sbuild.+\soppo/i,/\s(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007)\b/i],[MODEL,[VENDOR,'OPPO'],[TYPE,MOBILE]],[/\svivo\s(\w+)(?:\sbuild|\))/i,/\s(v[12]\d{3}\w?[at])(?:\sbuild|;)/i],[MODEL,[VENDOR,'Vivo'],[TYPE,MOBILE]],[/\s(rmx[12]\d{3})(?:\sbuild|;)/i],[MODEL,[VENDOR,'Realme'],[TYPE,MOBILE]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)\b[\w\s]+build\//i,/\smot(?:orola)?[\s-](\w*)/i,/((?:moto[\s\w\(\)]+|xt\d{3,4}|nexus\s6)(?=\sbuild|\)))/i],[MODEL,[VENDOR,'Motorola'],[TYPE,MOBILE]],[/\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[MODEL,[VENDOR,'Motorola'],[TYPE,TABLET]],[/((?=lg)?[vl]k\-?\d{3})\sbuild|\s3\.[\s\w;-]{10}lg?-([06cv9]{3,4})/i],[MODEL,[VENDOR,'LG'],[TYPE,TABLET]],[/(lm-?f100[nv]?|nexus\s[45])/i,/lg[e;\s\/-]+((?!browser|netcast)\w+)/i,/\blg(\-?[\d\w]+)\sbuild/i],[MODEL,[VENDOR,'LG'],[TYPE,MOBILE]],[/(ideatab[\w\-\s]+)/i,/lenovo\s?(s(?:5000|6000)(?:[\w-]+)|tab(?:[\s\w]+)|yt[\d\w-]{6}|tb[\d\w-]{6})/i],[MODEL,[VENDOR,'Lenovo'],[TYPE,TABLET]],[/(?:maemo|nokia).*(n900|lumia\s\d+)/i,/nokia[\s_-]?([\w\.-]*)/i],[[MODEL,/_/g,' '],[VENDOR,'Nokia'],[TYPE,MOBILE]],[/droid.+;\s(pixel\sc)[\s)]/i],[MODEL,[VENDOR,'Google'],[TYPE,TABLET]],[/droid.+;\s(pixel[\s\daxl]{0,6})(?:\sbuild|\))/i],[MODEL,[VENDOR,'Google'],[TYPE,MOBILE]],[/droid.+\s([c-g]\d{4}|so[-l]\w+|xq-a\w[4-7][12])(?=\sbuild\/|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[MODEL,[VENDOR,'Sony'],[TYPE,MOBILE]],[/sony\stablet\s[ps]\sbuild\//i,/(?:sony)?sgp\w+(?:\sbuild\/|\))/i],[[MODEL,'Xperia Tablet'],[VENDOR,'Sony'],[TYPE,TABLET]],[/\s(kb2005|in20[12]5|be20[12][59])\b/i,/\ba000(1)\sbuild/i,/\boneplus\s(a\d{4})[\s)]/i],[MODEL,[VENDOR,'OnePlus'],[TYPE,MOBILE]],[/(alexa)webm/i,/(kf[a-z]{2}wi)(\sbuild\/|\))/i,/(kf[a-z]+)(\sbuild\/|\)).+silk\//i],[MODEL,[VENDOR,'Amazon'],[TYPE,TABLET]],[/(sd|kf)[0349hijorstuw]+(\sbuild\/|\)).+silk\//i],[[MODEL,'Fire Phone'],[VENDOR,'Amazon'],[TYPE,MOBILE]],[/\((playbook);[\w\s\),;-]+(rim)/i],[MODEL,VENDOR,[TYPE,TABLET]],[/((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10;\s(\w+)/i],[MODEL,[VENDOR,'BlackBerry'],[TYPE,MOBILE]],[/(?:\b|asus_)(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus\s7|padfone|p00[cj])/i],[MODEL,[VENDOR,'ASUS'],[TYPE,TABLET]],[/\s(z[es]6[027][01][km][ls]|zenfone\s\d\w?)\b/i],[MODEL,[VENDOR,'ASUS'],[TYPE,MOBILE]],[/(nexus\s9)/i],[MODEL,[VENDOR,'HTC'],[TYPE,TABLET]],[/(htc)[;_\s-]{1,2}([\w\s]+(?=\)|\sbuild)|\w+)/i,/(zte)-(\w*)/i,/(alcatel|geeksphone|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],[VENDOR,[MODEL,/_/g,' '],[TYPE,MOBILE]],[/droid[x\d\.\s;]+\s([ab][1-7]\-?[0178a]\d\d?)/i],[MODEL,[VENDOR,'Acer'],[TYPE,TABLET]],[/droid.+;\s(m[1-5]\snote)\sbuild/i,/\bmz-([\w-]{2,})/i],[MODEL,[VENDOR,'Meizu'],[TYPE,MOBILE]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i,/(microsoft);\s(lumia[\s\w]+)/i,/(lenovo)[_\s-]?([\w-]+)/i,/linux;.+(jolla);/i,/droid.+;\s(oppo)\s?([\w\s]+)\sbuild/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i,/[;\/]\s?(le[\s\-]+pan)[\s\-]+(\w{1,9})\sbuild/i,/[;\/]\s?(trinity)[\-\s]*(t\d{3})\sbuild/i,/\b(gigaset)[\s\-]+(q\w{1,9})\sbuild/i,/\b(vodafone)\s([\w\s]+)(?:\)|\sbuild)/i],[VENDOR,MODEL,[TYPE,TABLET]],[/\s(surface\sduo)\s/i],[MODEL,[VENDOR,'Microsoft'],[TYPE,TABLET]],[/droid\s[\d\.]+;\s(fp\du?)\sbuild/i],[MODEL,[VENDOR,'Fairphone'],[TYPE,MOBILE]],[/\s(u304aa)\sbuild/i],[MODEL,[VENDOR,'AT&T'],[TYPE,MOBILE]],[/sie-(\w*)/i],[MODEL,[VENDOR,'Siemens'],[TYPE,MOBILE]],[/[;\/]\s?(rct\w+)\sbuild/i],[MODEL,[VENDOR,'RCA'],[TYPE,TABLET]],[/[;\/\s](venue[\d\s]{2,7})\sbuild/i],[MODEL,[VENDOR,'Dell'],[TYPE,TABLET]],[/[;\/]\s?(q(?:mv|ta)\w+)\sbuild/i],[MODEL,[VENDOR,'Verizon'],[TYPE,TABLET]],[/[;\/]\s(?:barnes[&\s]+noble\s|bn[rt])([\w\s\+]*)\sbuild/i],[MODEL,[VENDOR,'Barnes & Noble'],[TYPE,TABLET]],[/[;\/]\s(tm\d{3}\w+)\sbuild/i],[MODEL,[VENDOR,'NuVision'],[TYPE,TABLET]],[/;\s(k88)\sbuild/i],[MODEL,[VENDOR,'ZTE'],[TYPE,TABLET]],[/;\s(nx\d{3}j)\sbuild/i],[MODEL,[VENDOR,'ZTE'],[TYPE,MOBILE]],[/[;\/]\s?(gen\d{3})\sbuild.*49h/i],[MODEL,[VENDOR,'Swiss'],[TYPE,MOBILE]],[/[;\/]\s?(zur\d{3})\sbuild/i],[MODEL,[VENDOR,'Swiss'],[TYPE,TABLET]],[/[;\/]\s?((zeki)?tb.*\b)\sbuild/i],[MODEL,[VENDOR,'Zeki'],[TYPE,TABLET]],[/[;\/]\s([yr]\d{2})\sbuild/i,/[;\/]\s(dragon[\-\s]+touch\s|dt)(\w{5})\sbuild/i],[[VENDOR,'Dragon Touch'],MODEL,[TYPE,TABLET]],[/[;\/]\s?(ns-?\w{0,9})\sbuild/i],[MODEL,[VENDOR,'Insignia'],[TYPE,TABLET]],[/[;\/]\s?((nxa|Next)-?\w{0,9})\sbuild/i],[MODEL,[VENDOR,'NextBook'],[TYPE,TABLET]],[/[;\/]\s?(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05]))\sbuild/i],[[VENDOR,'Voice'],MODEL,[TYPE,MOBILE]],[/[;\/]\s?(lvtel\-)?(v1[12])\sbuild/i],[[VENDOR,'LvTel'],MODEL,[TYPE,MOBILE]],[/;\s(ph-1)\s/i],[MODEL,[VENDOR,'Essential'],[TYPE,MOBILE]],[/[;\/]\s?(v(100md|700na|7011|917g).*\b)\sbuild/i],[MODEL,[VENDOR,'Envizen'],[TYPE,TABLET]],[/[;\/]\s?(trio[\s\w\-\.]+)\sbuild/i],[MODEL,[VENDOR,'MachSpeed'],[TYPE,TABLET]],[/[;\/]\s?tu_(1491)\sbuild/i],[MODEL,[VENDOR,'Rotor'],[TYPE,TABLET]],[/(shield[\w\s]+)\sbuild/i],[MODEL,[VENDOR,'Nvidia'],[TYPE,TABLET]],[/(sprint)\s(\w+)/i],[VENDOR,MODEL,[TYPE,MOBILE]],[/(kin\.[onetw]{3})/i],[[MODEL,/\./g,' '],[VENDOR,'Microsoft'],[TYPE,MOBILE]],[/droid\s[\d\.]+;\s(cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[MODEL,[VENDOR,'Zebra'],[TYPE,TABLET]],[/droid\s[\d\.]+;\s(ec30|ps20|tc[2-8]\d[kx])\)/i],[MODEL,[VENDOR,'Zebra'],[TYPE,MOBILE]],[/\s(ouya)\s/i,/(nintendo)\s([wids3utch]+)/i],[VENDOR,MODEL,[TYPE,CONSOLE]],[/droid.+;\s(shield)\sbuild/i],[MODEL,[VENDOR,'Nvidia'],[TYPE,CONSOLE]],[/(playstation\s[345portablevi]+)/i],[MODEL,[VENDOR,'Sony'],[TYPE,CONSOLE]],[/[\s\(;](xbox(?:\sone)?(?!;\sxbox))[\s\);]/i],[MODEL,[VENDOR,'Microsoft'],[TYPE,CONSOLE]],[/smart-tv.+(samsung)/i],[VENDOR,[TYPE,SMARTTV]],[/hbbtv.+maple;(\d+)/i],[[MODEL,/^/,'SmartTV'],[VENDOR,'Samsung'],[TYPE,SMARTTV]],[/(?:linux;\snetcast.+smarttv|lg\snetcast\.tv-201\d)/i,],[[VENDOR,'LG'],[TYPE,SMARTTV]],[/(apple)\s?tv/i],[VENDOR,[MODEL,'Apple TV'],[TYPE,SMARTTV]],[/crkey/i],[[MODEL,'Chromecast'],[VENDOR,'Google'],[TYPE,SMARTTV]],[/droid.+aft([\w])(\sbuild\/|\))/i],[MODEL,[VENDOR,'Amazon'],[TYPE,SMARTTV]],[/\(dtv[\);].+(aquos)/i],[MODEL,[VENDOR,'Sharp'],[TYPE,SMARTTV]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[[VENDOR,util.trim],[MODEL,util.trim],[TYPE,SMARTTV]],[/[\s\/\(](android\s|smart[-\s]?|opera\s)tv[;\)\s]/i],[[TYPE,SMARTTV]],[/((pebble))app\/[\d\.]+\s/i],[VENDOR,MODEL,[TYPE,WEARABLE]],[/droid.+;\s(glass)\s\d/i],[MODEL,[VENDOR,'Google'],[TYPE,WEARABLE]],[/droid\s[\d\.]+;\s(wt63?0{2,3})\)/i],[MODEL,[VENDOR,'Zebra'],[TYPE,WEARABLE]],[/(tesla)(?:\sqtcarbrowser|\/20[12]\d\.[\w\.-]+)/i],[VENDOR,[TYPE,EMBEDDED]],[/droid .+?; ([^;]+?)(?: build|\) applewebkit).+? mobile safari/i],[MODEL,[TYPE,MOBILE]],[/droid .+?;\s([^;]+?)(?: build|\) applewebkit).+?(?! mobile) safari/i],[MODEL,[TYPE,TABLET]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[[TYPE,util.lowerize]],[/(android[\w\.\s\-]{0,9});.+build/i],[MODEL,[VENDOR,'Generic']],[/(phone)/i],[[TYPE,MOBILE]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[VERSION,[NAME,'EdgeHTML']],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[VERSION,[NAME,'Blink']],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[NAME,VERSION],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[VERSION,NAME]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[NAME,VERSION],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)(?!.+xbox)/i],[NAME,[VERSION,mapper.str,maps.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[NAME,'Windows'],[VERSION,mapper.str,maps.os.windows.version]],[/ip[honead]{2,4}\b(?:.*os\s([\w]+)\slike\smac|;\sopera)/i,/cfnetwork\/.+darwin/i],[[VERSION,/_/g,'.'],[NAME,'iOS']],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)(?!.+haiku)/i],[[NAME,'Mac OS'],[VERSION,/_/g,'.']],[/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|sailfish|contiki)[\/\s-]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/\s]([\w\.]+)/i,/\((series40);/i],[NAME,VERSION],[/\(bb(10);/i],[VERSION,[NAME,'BlackBerry']],[/(?:symbian\s?os|symbos|s60(?=;)|series60)[\/\s-]?([\w\.]*)/i],[VERSION,[NAME,'Symbian']],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[NAME,'Firefox OS']],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[VERSION,[NAME,'webOS']],[/crkey\/([\d\.]+)/i],[VERSION,[NAME,'Chromecast']],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[NAME,'Chromium OS'],VERSION],[/(nintendo|playstation)\s([wids345portablevuch]+)/i,/(xbox);\s+xbox\s([^\);]+)/i,/(mint)[\/\s\(\)]?(\w*)/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?=\slinux)|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus|raspbian)(?:\sgnu\/linux)?(?:\slinux)?[\/\s-]?(?!chrom|package)([\w\.-]*)/i,/(hurd|linux)\s?([\w\.]*)/i,/(gnu)\s?([\w\.]*)/i,/\s([frentopc-]{0,4}bsd|dragonfly)\s?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku)\s(\w+)/i],[NAME,VERSION],[/(sunos)\s?([\w\.\d]*)/i],[[NAME,'Solaris'],VERSION],[/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms|fuchsia)/i,/(unix)\s?([\w\.]*)/i],[NAME,VERSION]]};var UAParser=function(ua,extensions){if(typeof ua==='object'){extensions=ua;ua=undefined;}
if(!(this instanceof UAParser)){return new UAParser(ua,extensions).getResult();}
var _ua=ua||((typeof window!=='undefined'&&window.navigator&&window.navigator.userAgent)?window.navigator.userAgent:EMPTY);var _rgxmap=extensions?util.extend(regexes,extensions):regexes;this.getBrowser=function(){var _browser={name:undefined,version:undefined};mapper.rgx.call(_browser,_ua,_rgxmap.browser);_browser.major=util.major(_browser.version);return _browser;};this.getCPU=function(){var _cpu={architecture:undefined};mapper.rgx.call(_cpu,_ua,_rgxmap.cpu);return _cpu;};this.getDevice=function(){var _device={vendor:undefined,model:undefined,type:undefined};mapper.rgx.call(_device,_ua,_rgxmap.device);return _device;};this.getEngine=function(){var _engine={name:undefined,version:undefined};mapper.rgx.call(_engine,_ua,_rgxmap.engine);return _engine;};this.getOS=function(){var _os={name:undefined,version:undefined};mapper.rgx.call(_os,_ua,_rgxmap.os);return _os;};this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()};};this.getUA=function(){return _ua;};this.setUA=function(ua){_ua=(typeof ua===STR_TYPE&&ua.length>UA_MAX_LENGTH)?util.trim(ua,UA_MAX_LENGTH):ua;return this;};this.setUA(_ua);return this;};UAParser.VERSION=LIBVERSION;UAParser.BROWSER={NAME:NAME,MAJOR:MAJOR,VERSION:VERSION};UAParser.CPU={ARCHITECTURE:ARCHITECTURE};UAParser.DEVICE={MODEL:MODEL,VENDOR:VENDOR,TYPE:TYPE,CONSOLE:CONSOLE,MOBILE:MOBILE,SMARTTV:SMARTTV,TABLET:TABLET,WEARABLE:WEARABLE,EMBEDDED:EMBEDDED};UAParser.ENGINE={NAME:NAME,VERSION:VERSION};UAParser.OS={NAME:NAME,VERSION:VERSION};if(typeof(exports)!==UNDEF_TYPE){if(typeof module!==UNDEF_TYPE&&module.exports){exports=module.exports=UAParser;}
exports.UAParser=UAParser;}else{if(typeof(define)==='function'&&define.amd){define(function(){return UAParser;});}else if(typeof window!=='undefined'){window.UAParser=UAParser;}}
var $=typeof window!=='undefined'&&(window.jQuery||window.Zepto);if($&&!$.ua){var parser=new UAParser();$.ua=parser.getResult();$.ua.get=function(){return parser.getUA();};$.ua.set=function(uastring){parser.setUA(uastring);var result=parser.getResult();for(var prop in result){$.ua[prop]=result[prop];}};}})(typeof window==='object'?window:this);},{}]},{},[12])(12)});