forked from segmentio/analytics.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanalytics.min.js
6 lines (6 loc) · 172 KB
/
analytics.min.js
1
2
3
4
5
6
(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.analytics=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;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 require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var analytics=require("@segment/analytics.js-core");var Integrations=require("./integrations");module.exports=exports=analytics;analytics.require=require;exports.VERSION=require("../package.json").version;Object.keys(Integrations).forEach(function(name){analytics.use(Integrations[name])})},{"../package.json":123,"./integrations":2,"@segment/analytics.js-core":22}],2:[function(require,module,exports){"use strict";module.exports={findhotel:require("@segment/analytics.js-integration-segmentio"),"google-tag-manager":require("@segment/analytics.js-integration-google-tag-manager")}},{"@segment/analytics.js-integration-google-tag-manager":29,"@segment/analytics.js-integration-segmentio":30}],3:[function(require,module,exports){"use strict";var arity=require("@ndhoule/arity");var objToString=Object.prototype.toString;var isFunction=function(val){return typeof val==="function"};var isNumber=function(val){var type=typeof val;return type==="number"||type==="object"&&objToString.call(val)==="[object Number]"};var after=function after(n,fn){if(!isNumber(n)){throw new TypeError("Expected a number but received "+typeof n)}if(!isFunction(fn)){throw new TypeError("Expected a function but received "+typeof fn)}var callCount=0;return arity(fn.length,function(){callCount+=1;if(callCount<n){return}return fn.apply(this,arguments)})};module.exports=after},{"@ndhoule/arity":4}],4:[function(require,module,exports){"use strict";var objToString=Object.prototype.toString;var isFunction=function(val){return typeof val==="function"};var isNumber=function(val){var type=typeof val;return type==="number"||type==="object"&&objToString.call(val)==="[object Number]"};var createParams=function createParams(n){var args=[];for(var i=1;i<=n;i+=1){args.push("arg"+i)}return args};var createArityWrapper=function createArityWrapper(n){var paramNames=createParams(n).join(", ");var wrapperBody="".concat(" return function(",paramNames,") {\n"," return func.apply(this, arguments);\n"," };");return new Function("func",wrapperBody)};var arityWrapperCache=[function(fn){return function(){return fn.apply(this,arguments)}},function(fn){return function(arg1){return fn.apply(this,arguments)}},function(fn){return function(arg1,arg2){return fn.apply(this,arguments)}},function(fn){return function(arg1,arg2,arg3){return fn.apply(this,arguments)}},function(fn){return function(arg1,arg2,arg3,arg4){return fn.apply(this,arguments)}},function(fn){return function(arg1,arg2,arg3,arg4,arg5){return fn.apply(this,arguments)}}];var arity=function arity(n,func){if(!isFunction(func)){throw new TypeError("Expected a function but got "+typeof func)}n=Math.max(isNumber(n)?n:0,0);if(!arityWrapperCache[n]){arityWrapperCache[n]=createArityWrapper(n)}return arityWrapperCache[n](func)};module.exports=arity},{}],5:[function(require,module,exports){"use strict";var type=require("component-type");var clone=function clone(obj){var t=type(obj);if(t==="object"){var copy={};for(var key in obj){if(obj.hasOwnProperty(key)){copy[key]=clone(obj[key])}}return copy}if(t==="array"){var copy=new Array(obj.length);for(var i=0,l=obj.length;i<l;i++){copy[i]=clone(obj[i])}return copy}if(t==="regexp"){var flags="";flags+=obj.multiline?"m":"";flags+=obj.global?"g":"";flags+=obj.ignoreCase?"i":"";return new RegExp(obj.source,flags)}if(t==="date"){return new Date(obj.getTime())}return obj};module.exports=clone},{"component-type":76}],6:[function(require,module,exports){"use strict";var drop=require("@ndhoule/drop");var rest=require("@ndhoule/rest");var has=Object.prototype.hasOwnProperty;var objToString=Object.prototype.toString;var isObject=function isObject(value){return Boolean(value)&&typeof value==="object"};var isPlainObject=function isPlainObject(value){return Boolean(value)&&objToString.call(value)==="[object Object]"};var shallowCombiner=function shallowCombiner(target,source,value,key){if(has.call(source,key)&&target[key]===undefined){target[key]=value}return source};var deepCombiner=function(target,source,value,key){if(has.call(source,key)){if(isPlainObject(target[key])&&isPlainObject(value)){target[key]=defaultsDeep(target[key],value)}else if(target[key]===undefined){target[key]=value}}return source};var defaultsWith=function(combiner,target){if(!isObject(target)){return target}combiner=combiner||shallowCombiner;var sources=drop(2,arguments);for(var i=0;i<sources.length;i+=1){for(var key in sources[i]){combiner(target,sources[i],sources[i][key],key)}}return target};var defaultsDeep=function defaultsDeep(target){return defaultsWith.apply(null,[deepCombiner,target].concat(rest(arguments)))};var defaults=function(target){return defaultsWith.apply(null,[null,target].concat(rest(arguments)))};module.exports=defaults;module.exports.deep=defaultsDeep},{"@ndhoule/drop":7,"@ndhoule/rest":16}],7:[function(require,module,exports){"use strict";var max=Math.max;var drop=function drop(count,collection){var length=collection?collection.length:0;if(!length){return[]}var toDrop=max(Number(count)||0,0);var resultsLength=max(length-toDrop,0);var results=new Array(resultsLength);for(var i=0;i<resultsLength;i+=1){results[i]=collection[i+toDrop]}return results};module.exports=drop},{}],8:[function(require,module,exports){"use strict";var keys=require("@ndhoule/keys");var objToString=Object.prototype.toString;var isNumber=function isNumber(val){var type=typeof val;return type==="number"||type==="object"&&objToString.call(val)==="[object Number]"};var isArray=typeof Array.isArray==="function"?Array.isArray:function isArray(val){return objToString.call(val)==="[object Array]"};var isArrayLike=function isArrayLike(val){return val!=null&&(isArray(val)||val!=="function"&&isNumber(val.length))};var arrayEach=function arrayEach(iterator,array){for(var i=0;i<array.length;i+=1){if(iterator(array[i],i,array)===false){break}}};var baseEach=function baseEach(iterator,object){var ks=keys(object);for(var i=0;i<ks.length;i+=1){if(iterator(object[ks[i]],ks[i],object)===false){break}}};var each=function each(iterator,collection){return(isArrayLike(collection)?arrayEach:baseEach).call(this,iterator,collection)};module.exports=each},{"@ndhoule/keys":13}],9:[function(require,module,exports){"use strict";var each=require("@ndhoule/each");var every=function every(predicate,collection){if(typeof predicate!=="function"){throw new TypeError("`predicate` must be a function but was a "+typeof predicate)}var result=true;each(function(val,key,collection){result=!!predicate(val,key,collection);if(!result){return false}},collection);return result};module.exports=every},{"@ndhoule/each":8}],10:[function(require,module,exports){"use strict";var has=Object.prototype.hasOwnProperty;var extend=function extend(dest){var sources=Array.prototype.slice.call(arguments,1);for(var i=0;i<sources.length;i+=1){for(var key in sources[i]){if(has.call(sources[i],key)){dest[key]=sources[i][key]}}}return dest};module.exports=extend},{}],11:[function(require,module,exports){"use strict";var each=require("@ndhoule/each");var foldl=function foldl(iterator,accumulator,collection){if(typeof iterator!=="function"){throw new TypeError("Expected a function but received a "+typeof iterator)}each(function(val,i,collection){accumulator=iterator(accumulator,val,i,collection)},collection);return accumulator};module.exports=foldl},{"@ndhoule/each":8}],12:[function(require,module,exports){"use strict";var each=require("@ndhoule/each");var strIndexOf=String.prototype.indexOf;var sameValueZero=function sameValueZero(value1,value2){if(value1===value2){return value1!==0||1/value1===1/value2}return value1!==value1&&value2!==value2};var includes=function includes(searchElement,collection){var found=false;if(typeof collection==="string"){return strIndexOf.call(collection,searchElement)!==-1}each(function(value){if(sameValueZero(value,searchElement)){found=true;return false}},collection);return found};module.exports=includes},{"@ndhoule/each":8}],13:[function(require,module,exports){"use strict";var hop=Object.prototype.hasOwnProperty;var strCharAt=String.prototype.charAt;var toStr=Object.prototype.toString;var charAt=function(str,index){return strCharAt.call(str,index)};var has=function has(context,prop){return hop.call(context,prop)};var isString=function isString(val){return toStr.call(val)==="[object String]"};var isArrayLike=function isArrayLike(val){return val!=null&&(typeof val!=="function"&&typeof val.length==="number")};var indexKeys=function indexKeys(target,pred){pred=pred||has;var results=[];for(var i=0,len=target.length;i<len;i+=1){if(pred(target,i)){results.push(String(i))}}return results};var objectKeys=function objectKeys(target,pred){pred=pred||has;var results=[];for(var key in target){if(pred(target,key)){results.push(String(key))}}return results};var keys=function keys(source){if(source==null){return[]}if(isString(source)){return indexKeys(source,charAt)}if(isArrayLike(source)){return indexKeys(source,has)}return objectKeys(source)};module.exports=keys},{}],14:[function(require,module,exports){"use strict";var each=require("@ndhoule/each");var map=function map(iterator,collection){if(typeof iterator!=="function"){throw new TypeError("Expected a function but received a "+typeof iterator)}var result=[];each(function(val,i,collection){result.push(iterator(val,i,collection))},collection);return result};module.exports=map},{"@ndhoule/each":8}],15:[function(require,module,exports){"use strict";var objToString=Object.prototype.toString;var existy=function(val){return val!=null};var isArray=function(val){return objToString.call(val)==="[object Array]"};var isString=function(val){return typeof val==="string"||objToString.call(val)==="[object String]"};var isObject=function(val){return val!=null&&typeof val==="object"};var pick=function pick(props,object){if(!existy(object)||!isObject(object)){return{}}if(isString(props)){props=[props]}if(!isArray(props)){props=[]}var result={};for(var i=0;i<props.length;i+=1){if(isString(props[i])&&props[i]in object){result[props[i]]=object[props[i]]}}return result};module.exports=pick},{}],16:[function(require,module,exports){"use strict";var max=Math.max;var rest=function rest(collection){if(collection==null||!collection.length){return[]}var results=new Array(max(collection.length-2,0));for(var i=1;i<collection.length;i+=1){results[i-1]=collection[i]}return results};module.exports=rest},{}],17:[function(require,module,exports){"use strict";var parse=require("component-querystring").parse;var QUERYIDS={btid:"dataxu",urid:"millennial-media"};function ads(query){var params=parse(query);for(var key in params){if(params.hasOwnProperty(key)){for(var id in QUERYIDS){if(QUERYIDS.hasOwnProperty(id)){if(key===id){return{id:params[key],type:QUERYIDS[id]}}}}}}}module.exports=ads},{"component-querystring":74}],18:[function(require,module,exports){(function(global){"use strict";var _analytics=global.analytics;var Alias=require("segmentio-facade").Alias;var Emitter=require("component-emitter");var Group=require("segmentio-facade").Group;var Identify=require("segmentio-facade").Identify;var Page=require("segmentio-facade").Page;var Track=require("segmentio-facade").Track;var after=require("@ndhoule/after");var bindAll=require("bind-all");var clone=require("@ndhoule/clone");var cookie=require("./cookie");var debug=require("debug");var defaults=require("@ndhoule/defaults");var each=require("@ndhoule/each");var foldl=require("@ndhoule/foldl");var group=require("./group");var is=require("is");var isMeta=require("@segment/is-meta");var keys=require("@ndhoule/keys");var memory=require("./memory");var nextTick=require("next-tick");var normalize=require("./normalize");var on=require("component-event").bind;var pageDefaults=require("./pageDefaults");var pick=require("@ndhoule/pick");var prevent=require("@segment/prevent-default");var querystring=require("component-querystring");var store=require("./store");var user=require("./user");var type=require("component-type");function Analytics(){this._options({});this.Integrations={};this._integrations={};this._readied=false;this._timeout=300;this._user=user;this.log=debug("analytics.js");bindAll(this);var self=this;this.on("initialize",function(settings,options){if(options.initialPageview)self.page();self._parseQuery(window.location.search)})}Emitter(Analytics.prototype);Analytics.prototype.use=function(plugin){plugin(this);return this};Analytics.prototype.addIntegration=function(Integration){var name=Integration.prototype.name;if(!name)throw new TypeError("attempted to add an invalid integration");this.Integrations[name]=Integration;return this};Analytics.prototype.init=Analytics.prototype.initialize=function(settings,options){settings=settings||{};options=options||{};this._options(options);this._readied=false;var self=this;each(function(opts,name){var Integration=self.Integrations[name];if(!Integration)delete settings[name]},settings);each(function(opts,name){var Integration=self.Integrations[name];var integration=new Integration(clone(opts));self.log("initialize %o - %o",name,opts);self.add(integration)},settings);var integrations=this._integrations;user.load();group.load();var integrationCount=keys(integrations).length;var ready=after(integrationCount,function(){self._readied=true;self.emit("ready")});if(integrationCount<=0){ready()}this.failedInitializations=[];each(function(integration){if(options.initialPageview&&integration.options.initialPageview===false){integration.page=after(2,integration.page)}integration.analytics=self;integration.once("ready",ready);try{integration.initialize()}catch(e){var integrationName=integration.name;self.failedInitializations.push(integrationName);self.log("Error initializing %s integration: %o",integrationName,e);integration.ready()}},integrations);this.initialized=true;this.emit("initialize",settings,options);return this};Analytics.prototype.setAnonymousId=function(id){this.user().anonymousId(id);return this};Analytics.prototype.add=function(integration){this._integrations[integration.name]=integration;return this};Analytics.prototype.identify=function(id,traits,options,fn){if(is.fn(options))fn=options,options=null;if(is.fn(traits))fn=traits,options=null,traits=null;if(is.object(id))options=traits,traits=id,id=user.id();user.identify(id,traits);var msg=this.normalize({options:options,traits:user.traits(),userId:user.id()});this._invoke("identify",new Identify(msg));this.emit("identify",id,traits,options);this._callback(fn);return this};Analytics.prototype.user=function(){return user};Analytics.prototype.group=function(id,traits,options,fn){if(!arguments.length)return group;if(is.fn(options))fn=options,options=null;if(is.fn(traits))fn=traits,options=null,traits=null;if(is.object(id))options=traits,traits=id,id=group.id();group.identify(id,traits);var msg=this.normalize({options:options,traits:group.traits(),groupId:group.id()});this._invoke("group",new Group(msg));this.emit("group",id,traits,options);this._callback(fn);return this};Analytics.prototype.track=function(event,properties,options,fn){if(is.fn(options))fn=options,options=null;if(is.fn(properties))fn=properties,options=null,properties=null;var plan=this.options.plan||{};var events=plan.track||{};var msg=this.normalize({properties:properties,options:options,event:event});plan=events[event];if(plan){this.log("plan %o - %o",event,plan);if(plan.enabled===false){defaults(msg.integrations,{All:false,"Segment.io":true})}else{defaults(msg.integrations,plan.integrations||{})}}else{var defaultPlan=events.__default||{enabled:true};if(!defaultPlan.enabled){defaults(msg.integrations,{All:false,"Segment.io":true})}}this._invoke("track",new Track(msg));this.emit("track",event,properties,options);this._callback(fn);return this};Analytics.prototype.trackClick=Analytics.prototype.trackLink=function(links,event,properties){if(!links)return this;if(type(links)==="element")links=[links];var self=this;each(function(el){if(type(el)!=="element"){throw new TypeError("Must pass HTMLElement to `analytics.trackLink`.")}on(el,"click",function(e){var ev=is.fn(event)?event(el):event;var props=is.fn(properties)?properties(el):properties;var href=el.getAttribute("href")||el.getAttributeNS("http://www.w3.org/1999/xlink","href")||el.getAttribute("xlink:href");self.track(ev,props);if(href&&el.target!=="_blank"&&!isMeta(e)){prevent(e);self._callback(function(){window.location.href=href})}})},links);return this};Analytics.prototype.trackSubmit=Analytics.prototype.trackForm=function(forms,event,properties){if(!forms)return this;if(type(forms)==="element")forms=[forms];var self=this;each(function(el){if(type(el)!=="element")throw new TypeError("Must pass HTMLElement to `analytics.trackForm`.");function handler(e){prevent(e);var ev=is.fn(event)?event(el):event;var props=is.fn(properties)?properties(el):properties;self.track(ev,props);self._callback(function(){el.submit()})}var $=window.jQuery||window.Zepto;if($){$(el).submit(handler)}else{on(el,"submit",handler)}},forms);return this};Analytics.prototype.page=function(category,name,properties,options,fn){if(is.fn(options))fn=options,options=null;if(is.fn(properties))fn=properties,options=properties=null;if(is.fn(name))fn=name,options=properties=name=null;if(type(category)==="object")options=name,properties=category,name=category=null;if(type(name)==="object")options=properties,properties=name,name=null;if(type(category)==="string"&&type(name)!=="string")name=category,category=null;properties=clone(properties)||{};if(name)properties.name=name;if(category)properties.category=category;var defs=pageDefaults();defaults(properties,defs);var overrides=pick(keys(defs),properties);if(!is.empty(overrides)){options=options||{};options.context=options.context||{};options.context.page=overrides}var msg=this.normalize({properties:properties,category:category,options:options,name:name});this._invoke("page",new Page(msg));this.emit("page",category,name,properties,options);this._callback(fn);return this};Analytics.prototype.pageview=function(url){var properties={};if(url)properties.path=url;this.page(properties);return this};Analytics.prototype.alias=function(to,from,options,fn){if(is.fn(options))fn=options,options=null;if(is.fn(from))fn=from,options=null,from=null;if(is.object(from))options=from,from=null;var msg=this.normalize({options:options,previousId:from,userId:to});this._invoke("alias",new Alias(msg));this.emit("alias",to,from,options);this._callback(fn);return this};Analytics.prototype.ready=function(fn){if(is.fn(fn)){if(this._readied){nextTick(fn)}else{this.once("ready",fn)}}return this};Analytics.prototype.timeout=function(timeout){this._timeout=timeout};Analytics.prototype.debug=function(str){if(!arguments.length||str){debug.enable("analytics:"+(str||"*"))}else{debug.disable()}};Analytics.prototype._options=function(options){options=options||{};this.options=options;cookie.options(options.cookie);store.options(options.localStorage);user.options(options.user);group.options(options.group);return this};Analytics.prototype._callback=function(fn){if(is.fn(fn)){this._timeout?setTimeout(fn,this._timeout):nextTick(fn)}return this};Analytics.prototype._invoke=function(method,facade){var self=this;this.emit("invoke",facade);var failedInitializations=self.failedInitializations||[];each(function(integration,name){if(!facade.enabled(name))return;if(failedInitializations.indexOf(name)>=0){self.log("Skipping invokation of .%s method of %s integration. Integation failed to initialize properly.",method,name)}else{integration.invoke.call(integration,method,facade)}},this._integrations);return this};Analytics.prototype.push=function(args){var method=args.shift();if(!this[method])return;this[method].apply(this,args)};Analytics.prototype.reset=function(){this.user().logout();this.group().logout()};Analytics.prototype._parseQuery=function(query){var q=querystring.parse(query);var traits=pickPrefix("ajs_trait_",q);var props=pickPrefix("ajs_prop_",q);if(q.ajs_uid)this.identify(q.ajs_uid,traits);if(q.ajs_event)this.track(q.ajs_event,props);if(q.ajs_aid)user.anonymousId(q.ajs_aid);return this;function pickPrefix(prefix,object){var length=prefix.length;var sub;return foldl(function(acc,val,key){if(key.substr(0,length)===prefix){sub=key.substr(length);acc[sub]=val}return acc},{},object)}};Analytics.prototype.normalize=function(msg){msg=normalize(msg,keys(this._integrations));if(msg.anonymousId)user.anonymousId(msg.anonymousId);msg.anonymousId=user.anonymousId();msg.context.page=defaults(msg.context.page||{},pageDefaults());return msg};Analytics.prototype.noConflict=function(){window.analytics=_analytics;return this};module.exports=Analytics;module.exports.cookie=cookie;module.exports.memory=memory;module.exports.store=store}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./cookie":19,"./group":21,"./memory":23,"./normalize":24,"./pageDefaults":25,"./store":26,"./user":27,"@ndhoule/after":3,"@ndhoule/clone":5,"@ndhoule/defaults":6,"@ndhoule/each":8,"@ndhoule/foldl":11,"@ndhoule/keys":13,"@ndhoule/pick":15,"@segment/is-meta":45,"@segment/prevent-default":58,"bind-all":65,"component-emitter":71,"component-event":72,"component-querystring":74,"component-type":76,debug:78,is:86,"next-tick":97,"segmentio-facade":106}],19:[function(require,module,exports){"use strict";var bindAll=require("bind-all");var clone=require("@ndhoule/clone");var cookie=require("component-cookie");var debug=require("debug")("analytics.js:cookie");var defaults=require("@ndhoule/defaults");var json=require("json3");var topDomain=require("@segment/top-domain");function Cookie(options){this.options(options)}Cookie.prototype.options=function(options){if(arguments.length===0)return this._options;options=options||{};var domain="."+topDomain(window.location.href);if(domain===".")domain=null;this._options=defaults(options,{maxage:31536e6,path:"/",domain:domain});this.set("ajs:test",true);if(!this.get("ajs:test")){debug("fallback to domain=null");this._options.domain=null}this.remove("ajs:test")};Cookie.prototype.set=function(key,value){try{value=json.stringify(value);cookie(key,value,clone(this._options));return true}catch(e){return false}};Cookie.prototype.get=function(key){try{var value=cookie(key);value=value?json.parse(value):null;return value}catch(e){return null}};Cookie.prototype.remove=function(key){try{cookie(key,null,clone(this._options));return true}catch(e){return false}};module.exports=bindAll(new Cookie);module.exports.Cookie=Cookie},{"@ndhoule/clone":5,"@ndhoule/defaults":6,"@segment/top-domain":62,"bind-all":65,"component-cookie":68,debug:78,json3:87}],20:[function(require,module,exports){"use strict";var clone=require("@ndhoule/clone");var cookie=require("./cookie");var debug=require("debug")("analytics:entity");var defaults=require("@ndhoule/defaults");var extend=require("@ndhoule/extend");var memory=require("./memory");var store=require("./store");var isodateTraverse=require("@segment/isodate-traverse");module.exports=Entity;function Entity(options){this.options(options);this.initialize()}Entity.prototype.initialize=function(){cookie.set("ajs:cookies",true);if(cookie.get("ajs:cookies")){cookie.remove("ajs:cookies");this._storage=cookie;return}if(store.enabled){this._storage=store;return}debug("warning using memory store both cookies and localStorage are disabled");this._storage=memory};Entity.prototype.storage=function(){return this._storage};Entity.prototype.options=function(options){if(arguments.length===0)return this._options;this._options=defaults(options||{},this.defaults||{})};Entity.prototype.id=function(id){switch(arguments.length){case 0:return this._getId();case 1:return this._setId(id);default:}};Entity.prototype._getId=function(){var ret=this._options.persist?this.storage().get(this._options.cookie.key):this._id;return ret===undefined?null:ret};Entity.prototype._setId=function(id){if(this._options.persist){this.storage().set(this._options.cookie.key,id)}else{this._id=id}};Entity.prototype.properties=Entity.prototype.traits=function(traits){switch(arguments.length){case 0:return this._getTraits();case 1:return this._setTraits(traits);default:}};Entity.prototype._getTraits=function(){var ret=this._options.persist?store.get(this._options.localStorage.key):this._traits;return ret?isodateTraverse(clone(ret)):{}};Entity.prototype._setTraits=function(traits){traits=traits||{};if(this._options.persist){store.set(this._options.localStorage.key,traits)}else{this._traits=traits}};Entity.prototype.identify=function(id,traits){traits=traits||{};var current=this.id();if(current===null||current===id)traits=extend(this.traits(),traits);if(id)this.id(id);this.debug("identify %o, %o",id,traits);this.traits(traits);this.save()};Entity.prototype.save=function(){if(!this._options.persist)return false;cookie.set(this._options.cookie.key,this.id());store.set(this._options.localStorage.key,this.traits());return true};Entity.prototype.logout=function(){this.id(null);this.traits({});cookie.remove(this._options.cookie.key);store.remove(this._options.localStorage.key)};Entity.prototype.reset=function(){this.logout();this.options({})};Entity.prototype.load=function(){this.id(cookie.get(this._options.cookie.key));this.traits(store.get(this._options.localStorage.key))}},{"./cookie":19,"./memory":23,"./store":26,"@ndhoule/clone":5,"@ndhoule/defaults":6,"@ndhoule/extend":10,"@segment/isodate-traverse":46,debug:78}],21:[function(require,module,exports){"use strict";var Entity=require("./entity");var bindAll=require("bind-all");var debug=require("debug")("analytics:group");var inherit=require("inherits");Group.defaults={persist:true,cookie:{key:"ajs_group_id"},localStorage:{key:"ajs_group_properties"}};function Group(options){this.defaults=Group.defaults;this.debug=debug;Entity.call(this,options)}inherit(Group,Entity);module.exports=bindAll(new Group);module.exports.Group=Group},{"./entity":20,"bind-all":65,debug:78,inherits:84}],22:[function(require,module,exports){"use strict";var Analytics=require("./analytics");var analytics=new Analytics;analytics.require=require;analytics.VERSION=require("../package.json").version;module.exports=analytics},{"../package.json":28,"./analytics":18}],23:[function(require,module,exports){"use strict";var bindAll=require("bind-all");var clone=require("@ndhoule/clone");var has=Object.prototype.hasOwnProperty;module.exports=bindAll(new Memory);function Memory(){this.store={}}Memory.prototype.set=function(key,value){this.store[key]=clone(value);return true};Memory.prototype.get=function(key){if(!has.call(this.store,key))return;return clone(this.store[key])};Memory.prototype.remove=function(key){delete this.store[key];return true}},{"@ndhoule/clone":5,"bind-all":65}],24:[function(require,module,exports){"use strict";var debug=require("debug")("analytics.js:normalize");var defaults=require("@ndhoule/defaults");var each=require("@ndhoule/each");var includes=require("@ndhoule/includes");var map=require("@ndhoule/map");var type=require("component-type");var has=Object.prototype.hasOwnProperty;module.exports=normalize;var toplevel=["integrations","anonymousId","timestamp","context"];function normalize(msg,list){var lower=map(function(s){return s.toLowerCase()},list);var opts=msg.options||{};var integrations=opts.integrations||{};var providers=opts.providers||{};var context=opts.context||{};var ret={};debug("<-",msg);each(function(value,key){if(!integration(key))return;if(!has.call(integrations,key))integrations[key]=value;delete opts[key]},opts);delete opts.providers;each(function(value,key){if(!integration(key))return;if(type(integrations[key])==="object")return;if(has.call(integrations,key)&&typeof providers[key]==="boolean")return;integrations[key]=value},providers);each(function(value,key){if(includes(key,toplevel)){ret[key]=opts[key]}else{context[key]=opts[key]}},opts);delete msg.options;ret.integrations=integrations;ret.context=context;ret=defaults(ret,msg);debug("->",ret);return ret;function integration(name){return!!(includes(name,list)||name.toLowerCase()==="all"||includes(name.toLowerCase(),lower))}}},{"@ndhoule/defaults":6,"@ndhoule/each":8,"@ndhoule/includes":12,"@ndhoule/map":14,"component-type":76,debug:78}],25:[function(require,module,exports){"use strict";var canonical=require("@segment/canonical");var includes=require("@ndhoule/includes");var url=require("component-url");function pageDefaults(){return{path:canonicalPath(),referrer:document.referrer,search:location.search,title:document.title,url:canonicalUrl(location.search)}}function canonicalPath(){var canon=canonical();if(!canon)return window.location.pathname;var parsed=url.parse(canon);return parsed.pathname}function canonicalUrl(search){var canon=canonical();if(canon)return includes("?",canon)?canon:canon+search;var url=window.location.href;var i=url.indexOf("#");return i===-1?url:url.slice(0,i)}module.exports=pageDefaults},{"@ndhoule/includes":12,"@segment/canonical":43,"component-url":77}],26:[function(require,module,exports){"use strict";var bindAll=require("bind-all");var defaults=require("@ndhoule/defaults");var store=require("@segment/store");function Store(options){this.options(options)}Store.prototype.options=function(options){if(arguments.length===0)return this._options;options=options||{};defaults(options,{enabled:true});this.enabled=options.enabled&&store.enabled;this._options=options};Store.prototype.set=function(key,value){if(!this.enabled)return false;return store.set(key,value)};Store.prototype.get=function(key){if(!this.enabled)return null;return store.get(key)};Store.prototype.remove=function(key){if(!this.enabled)return false;return store.remove(key)};module.exports=bindAll(new Store);module.exports.Store=Store},{"@ndhoule/defaults":6,"@segment/store":61,"bind-all":65}],27:[function(require,module,exports){"use strict";var Entity=require("./entity");var bindAll=require("bind-all");var cookie=require("./cookie");var debug=require("debug")("analytics:user");var inherit=require("inherits");var rawCookie=require("component-cookie");var uuid=require("uuid");User.defaults={persist:true,cookie:{key:"ajs_user_id",oldKey:"ajs_user"},localStorage:{key:"ajs_user_traits"}};function User(options){this.defaults=User.defaults;this.debug=debug;Entity.call(this,options)}inherit(User,Entity);User.prototype.id=function(id){var prev=this._getId();var ret=Entity.prototype.id.apply(this,arguments);if(prev==null)return ret;if(prev!=id&&id)this.anonymousId(null);return ret};User.prototype.anonymousId=function(anonymousId){var store=this.storage();if(arguments.length){store.set("ajs_anonymous_id",anonymousId);return this}anonymousId=store.get("ajs_anonymous_id");if(anonymousId){return anonymousId}anonymousId=rawCookie("_sio");if(anonymousId){anonymousId=anonymousId.split("----")[0];store.set("ajs_anonymous_id",anonymousId);store.remove("_sio");return anonymousId}anonymousId=uuid.v4();store.set("ajs_anonymous_id",anonymousId);return store.get("ajs_anonymous_id")};User.prototype.logout=function(){Entity.prototype.logout.call(this);this.anonymousId(null)};User.prototype.load=function(){if(this._loadOldCookie())return;Entity.prototype.load.call(this)}
;User.prototype._loadOldCookie=function(){var user=cookie.get(this._options.cookie.oldKey);if(!user)return false;this.id(user.id);this.traits(user.traits);cookie.remove(this._options.cookie.oldKey);return true};module.exports=bindAll(new User);module.exports.User=User},{"./cookie":19,"./entity":20,"bind-all":65,"component-cookie":68,debug:78,inherits:84,uuid:120}],28:[function(require,module,exports){module.exports={name:"@segment/analytics.js-core",author:"Segment <[email protected]>",version:"3.2.5",description:"The hassle-free way to integrate analytics into any web application.",keywords:["analytics","analytics.js","segment","segment.io"],main:"lib/index.js",scripts:{test:"make test"},repository:{type:"git",url:"https://github.com/segmentio/analytics.js-core"},license:"SEE LICENSE IN LICENSE",bugs:{url:"https://github.com/segmentio/analytics.js-core/issues"},homepage:"https://github.com/segmentio/analytics.js-core#readme",dependencies:{"@ndhoule/after":"^1.0.0","@ndhoule/clone":"^1.0.0","@ndhoule/defaults":"^2.0.1","@ndhoule/each":"^2.0.1","@ndhoule/extend":"^2.0.0","@ndhoule/foldl":"^2.0.1","@ndhoule/includes":"^2.0.1","@ndhoule/keys":"^2.0.0","@ndhoule/map":"^2.0.1","@ndhoule/pick":"^2.0.0","@segment/canonical":"^1.0.0","@segment/is-meta":"^1.0.0","@segment/isodate":"^1.0.2","@segment/isodate-traverse":"^1.0.1","@segment/prevent-default":"^1.0.0","@segment/store":"^1.3.20","@segment/top-domain":"^3.0.0","bind-all":"^1.0.0","component-cookie":"^1.1.2","component-emitter":"^1.2.1","component-event":"^0.1.4","component-querystring":"^2.0.0","component-type":"^1.2.1","component-url":"^0.2.1",debug:"^0.7.4",inherits:"^2.0.1",install:"^0.7.3",is:"^3.1.0",json3:"^3.3.2","new-date":"^1.0.0","next-tick":"^0.2.2","segmentio-facade":"^3.0.2",uuid:"^2.0.2"},devDependencies:{"@segment/analytics.js-integration":"^3.2.0","@segment/eslint-config":"^3.1.1",browserify:"13.0.0","compat-trigger-event":"^1.0.0","component-each":"^0.2.6",eslint:"^2.9.0","eslint-plugin-mocha":"^2.2.0","eslint-plugin-require-path-exists":"^1.1.5",jquery:"^3.2.1",karma:"1.3.0","karma-browserify":"^5.0.4","karma-chrome-launcher":"^1.0.1","karma-coverage":"^1.0.0","karma-junit-reporter":"^1.0.0","karma-mocha":"1.0.1","karma-phantomjs-launcher":"^1.0.0","karma-sauce-launcher":"^1.0.0","karma-spec-reporter":"0.0.26",mocha:"^2.2.5","phantomjs-prebuilt":"^2.1.7",proclaim:"^3.4.1",sinon:"^1.7.3",watchify:"^3.7.0"}}},{}],29:[function(require,module,exports){"use strict";var integration=require("@segment/analytics.js-integration");var push=require("global-queue")("dataLayer",{wrap:false});var GTM=module.exports=integration("Google Tag Manager").global("dataLayer").global("google_tag_manager").option("containerId","").option("environment","").option("trackNamedPages",true).option("trackCategorizedPages",true).tag("no-env",'<script src="//www.googletagmanager.com/gtm.js?id={{ containerId }}&l=dataLayer">').tag("with-env",'<script src="//www.googletagmanager.com/gtm.js?id={{ containerId }}&l=dataLayer>m_preview={{ environment }}">');GTM.prototype.initialize=function(){push({"gtm.start":Number(new Date),event:"gtm.js"});if(this.options.environment.length){this.load("with-env",this.options,this.ready)}else{this.load("no-env",this.options,this.ready)}};GTM.prototype.loaded=function(){return!!(window.dataLayer&&Array.prototype.push!==window.dataLayer.push)};GTM.prototype.page=function(page){var category=page.category();var name=page.fullName();var opts=this.options;if(opts.trackAllPages){this.track(page.track())}if(category&&opts.trackCategorizedPages){this.track(page.track(category))}if(name&&opts.trackNamedPages){this.track(page.track(name))}};GTM.prototype.track=function(track){var props=track.properties();var userId=this.analytics.user().id();var anonymousId=this.analytics.user().anonymousId();if(userId)props.userId=userId;if(anonymousId)props.segmentAnonymousId=anonymousId;props.event=track.event();push(props)}},{"@segment/analytics.js-integration":37,"global-queue":80}],30:[function(require,module,exports){"use strict";var ads=require("@segment/ad-params");var clone=require("component-clone");var cookie=require("component-cookie");var extend=require("@ndhoule/extend");var integration=require("@segment/analytics.js-integration");var json=require("json3");var keys=require("@ndhoule/keys");var localstorage=require("yields-store");var md5=require("spark-md5").hash;var protocol=require("@segment/protocol");var send=require("@segment/send-json");var topDomain=require("@segment/top-domain");var utm=require("@segment/utm-params");var uuid=require("uuid").v4;var Queue=require("@segment/localstorage-retry");var cookieOptions={maxage:31536e6,secure:false,path:"/"};function getVclid(query){try{var queryParams=new URLSearchParams(query);var id=sessionStorage.getItem("vclid")||queryParams.get("vclid");if(!id)return{};return{vclid:id}}catch(error){if(typeof Sentry!=="undefined"){Sentry.captureException(error)}console.error("getVclid Error =>",error);return{}}}var Segment=exports=module.exports=integration("Segment.io").option("apiKey","").option("apiHost","api.segment.io/v1").option("crossDomainIdServers",[]).option("beacon",false).option("retryQueue",false).option("addBundledMetadata",false).option("unbundledIntegrations",[]);exports.storage=function(){return protocol()==="file:"||protocol()==="chrome-extension:"?localstorage:cookie};exports.global=window;Segment.prototype.initialize=function(){var self=this;if(this.options.retryQueue){this._lsqueue=new Queue("segmentio",function(item,done){item.sentAt=new Date;send(item.url,item.msg,item.headers,function(err,res){self.debug("sent %O, received %O",item.msg,arguments);if(err)return done(err);res.url=item.url;done()})});this._lsqueue.start()}this.ready();this.analytics.on("invoke",function(msg){var action=msg.action();var listener="on"+msg.action();self.debug("%s %o",action,msg);if(self[listener])self[listener](msg);self.ready()});if(this.cookie("segment_cross_domain_id")){this.cookie("seg_xid",this.cookie("segment_cross_domain_id"));this.cookie("seg_xid_fd",this.cookie("segment_cross_domain_id_from_domain"));this.cookie("seg_xid_ts",this.cookie("segment_cross_domain_id_timestamp"));this.cookie("segment_cross_domain_id",null);this.cookie("segment_cross_domain_id_from_domain",null);this.cookie("segment_cross_domain_id_timestamp",null)}if(this.options.crossDomainIdServers&&this.options.crossDomainIdServers.length>0){this.retrieveCrossDomainId()}};Segment.prototype.loaded=function(){return true};Segment.prototype.onpage=function(page){this.send("",page.json())};Segment.prototype.onidentify=function(identify){this.send("",identify.json())};Segment.prototype.ongroup=function(group){this.send("",group.json())};Segment.prototype.ontrack=function(track){var json=track.json();delete json.traits;this.send("",json)};Segment.prototype.onalias=function(alias){var json=alias.json();var user=this.analytics.user();json.previousId=json.previousId||json.from||user.id()||user.anonymousId();json.userId=json.userId||json.to;delete json.from;delete json.to;this.send("",json)};Segment.prototype.normalize=function(msg){this.debug("normalize %o",msg);var user=this.analytics.user();var global=exports.global;var query=global.location.search;var ctx=msg.context=msg.context||msg.options||{};delete msg.options;msg.writeKey=this.options.apiKey;ctx.userAgent=navigator.userAgent;if(!ctx.library)ctx.library={name:"analytics.js",version:this.analytics.VERSION};var crossDomainId=this.cookie("seg_xid");if(crossDomainId){if(!ctx.traits){ctx.traits={crossDomainId:crossDomainId}}else if(!ctx.traits.crossDomainId){ctx.traits.crossDomainId=crossDomainId}}if(!ctx.campaign){ctx.campaign=query?Object.assign(getVclid(query),utm(query)):getVclid("")}this.referrerId(query,ctx);msg.userId=msg.userId||user.id();msg.anonymousId=user.anonymousId();msg.sentAt=new Date;if(this.options.addBundledMetadata){var bundled=keys(this.analytics.Integrations);msg._metadata={bundled:bundled,unbundled:this.options.unbundledIntegrations}}msg.messageId="ajs-"+md5(json.stringify(msg)+uuid());this.debug("normalized %o",msg);this.ampId(ctx);return msg};Segment.prototype.ampId=function(ctx){var ampId=this.cookie("segment_amp_id");if(ampId)ctx.amp={id:ampId}};Segment.prototype.send=function(path,msg,fn){var url="https://"+this.options.apiHost+path;fn=fn||noop;var self=this;msg=this.normalize(msg);if(this.options.retryQueue){var headers={"Content-Type":"application/json","x-api-key":self.options.apiKey};this._lsqueue.addItem({url:url,headers:headers,msg:msg})}else if(this.options.beacon&&navigator.sendBeacon){if(navigator.sendBeacon(url,json.stringify(msg))){self.debug("beacon sent %o",msg);fn()}else{self.debug("beacon failed, falling back to ajax %o",msg);sendAjax()}}else{sendAjax()}function sendAjax(){var headers={"Content-Type":"application/json","x-api-key":self.options.apiKey};send(url,msg,headers,function(err,res){self.debug("ajax sent %o, received %o",msg,arguments);if(err)return fn(err);res.url=url;fn(null,res)})}};Segment.prototype.cookie=function(name,val){var store=Segment.storage();if(arguments.length===1)return store(name);var global=exports.global;var href=global.location.href;var domain="."+topDomain(href);if(domain===".")domain="";this.debug("store domain %s -> %s",href,domain);var opts=clone(cookieOptions);opts.domain=domain;this.debug("store %s, %s, %o",name,val,opts);store(name,val,opts);if(store(name))return;delete opts.domain;this.debug("fallback store %s, %s, %o",name,val,opts);store(name,val,opts)};Segment.prototype.referrerId=function(query,ctx){var stored=this.cookie("s:context.referrer");var ad;if(stored)stored=json.parse(stored);if(query)ad=ads(query);ad=ad||stored;if(!ad)return;ctx.referrer=extend(ctx.referrer||{},ad);this.cookie("s:context.referrer",json.stringify(ad))};Segment.prototype.retrieveCrossDomainId=function(callback){if(!this.options.crossDomainIdServers){if(callback){callback("crossDomainId not enabled",null)}return}if(!this.cookie("seg_xid")){var self=this;var writeKey=this.options.apiKey;var currentTld=getTld(window.location.hostname);var domains=[];for(var i=0;i<this.options.crossDomainIdServers.length;i++){var domain=this.options.crossDomainIdServers[i];if(getTld(domain)!==currentTld){domains.push(domain)}}getCrossDomainIdFromServerList(domains,writeKey,function(err,res){if(err){if(callback){callback(err,null)}return}var crossDomainId=null;var fromDomain=null;if(res){crossDomainId=res.id;fromDomain=res.domain}else{crossDomainId=uuid();fromDomain=window.location.hostname}var currentTimeMillis=(new Date).getTime();self.cookie("seg_xid",crossDomainId);self.cookie("seg_xid_fd",fromDomain);self.cookie("seg_xid_ts",currentTimeMillis);self.analytics.identify({crossDomainId:crossDomainId});if(callback){callback(null,{crossDomainId:crossDomainId,fromDomain:fromDomain,timestamp:currentTimeMillis})}})}};function getCrossDomainIdFromServerList(domains,writeKey,callback){if(domains.length===0){callback(null,null)}var crossDomainIdFound=false;var finishedRequests=0;var error=null;for(var i=0;i<domains.length;i++){var domain=domains[i];getCrossDomainIdFromSingleServer(domain,writeKey,function(err,res){finishedRequests++;if(err){error=err}else if(res&&res.id&&!crossDomainIdFound){crossDomainIdFound=true;callback(null,res)}if(finishedRequests===domains.length&&!crossDomainIdFound){callback(error,null)}})}}function getCrossDomainIdFromSingleServer(domain,writeKey,callback){var endpoint="https://"+domain+"/v1/id/"+writeKey;getJson(endpoint,function(err,res){if(err){callback(err,null)}else{callback(null,{domain:domain,id:res&&res.id||null})}})}function getJson(url,callback){var xhr=new XMLHttpRequest;xhr.open("GET",url,true);xhr.withCredentials=true;xhr.onreadystatechange=function(){if(xhr.readyState===XMLHttpRequest.DONE){if(xhr.status>=200&&xhr.status<300){callback(null,xhr.responseText?json.parse(xhr.responseText):null)}else{callback(xhr.statusText||"Unknown Error",null)}}};xhr.send()}function getTld(domain){return domain.split(".").splice(-2).join(".")}function noop(){}},{"@ndhoule/extend":10,"@ndhoule/keys":13,"@segment/ad-params":17,"@segment/analytics.js-integration":31,"@segment/localstorage-retry":49,"@segment/protocol":59,"@segment/send-json":60,"@segment/top-domain":62,"@segment/utm-params":63,"component-clone":67,"component-cookie":68,json3:87,"spark-md5":113,uuid:120,"yields-store":121}],31:[function(require,module,exports){"use strict";var bind=require("component-bind");var clone=require("@ndhoule/clone");var debug=require("debug");var defaults=require("@ndhoule/defaults");var extend=require("@ndhoule/extend");var slug=require("slug-component");var protos=require("./protos");var statics=require("./statics");function createIntegration(name){function Integration(options){if(options&&options.addIntegration){return options.addIntegration(Integration)}this.debug=debug("analytics:integration:"+slug(name));this.options=defaults(clone(options)||{},this.defaults);this._queue=[];this.once("ready",bind(this,this.flush));Integration.emit("construct",this);this.ready=bind(this,this.ready);this._wrapInitialize();this._wrapPage();this._wrapTrack()}Integration.prototype.defaults={};Integration.prototype.globals=[];Integration.prototype.templates={};Integration.prototype.name=name;extend(Integration,statics);extend(Integration.prototype,protos);return Integration}module.exports=createIntegration},{"./protos":32,"./statics":33,"@ndhoule/clone":5,"@ndhoule/defaults":6,"@ndhoule/extend":10,"component-bind":66,debug:35,"slug-component":112}],32:[function(require,module,exports){"use strict";var Emitter=require("component-emitter");var after=require("@ndhoule/after");var each=require("@ndhoule/each");var events=require("analytics-events");var every=require("@ndhoule/every");var fmt=require("@segment/fmt");var foldl=require("@ndhoule/foldl");var is=require("is");var loadIframe=require("load-iframe");var loadScript=require("@segment/load-script");var nextTick=require("next-tick");var normalize=require("to-no-case");var has=Object.prototype.hasOwnProperty;var noop=function noop(){};var onerror=window.onerror;var onload=null;Emitter(exports);exports.initialize=function(){var ready=this.ready;nextTick(ready)};exports.loaded=function(){return false};exports.page=function(page){};exports.track=function(track){};exports.map=function(options,key){var normalizedComparator=normalize(key);var mappingType=getMappingType(options);if(mappingType==="unknown"){return[]}return foldl(function(matchingValues,val,key){var compare;var result;if(mappingType==="map"){compare=key;result=val}if(mappingType==="array"){compare=val;result=val}if(mappingType==="mixed"){compare=val.key;result=val.value}if(normalize(compare)===normalizedComparator){matchingValues.push(result)}return matchingValues},[],options)};exports.invoke=function(method){if(!this[method])return;var args=Array.prototype.slice.call(arguments,1);if(!this._ready)return this.queue(method,args);this.debug("%s with %o",method,args);return this[method].apply(this,args)};exports.queue=function(method,args){if(method==="page"&&this._assumesPageview&&!this._initialized){return this.page.apply(this,args)}this._queue.push({method:method,args:args})};exports.flush=function(){this._ready=true;var self=this;each(function(call){self[call.method].apply(self,call.args)},this._queue);this._queue.length=0};exports.reset=function(){for(var i=0;i<this.globals.length;i++){window[this.globals[i]]=undefined}window.onerror=onerror;window.onload=onload};exports.load=function(name,locals,callback){if(typeof name==="function"){callback=name;locals=null;name=null}if(name&&typeof name==="object"){callback=locals;locals=name;name=null}if(typeof locals==="function"){callback=locals;locals=null}name=name||"library";locals=locals||{};locals=this.locals(locals);var template=this.templates[name];if(!template)throw new Error(fmt('template "%s" not defined.',name));var attrs=render(template,locals);callback=callback||noop;var self=this;var el;switch(template.type){case"img":attrs.width=1;attrs.height=1;el=loadImage(attrs,callback);break;case"script":el=loadScript(attrs,function(err){if(!err)return callback();self.debug('error loading "%s" error="%s"',self.name,err)});delete attrs.src;each(function(val,key){el.setAttribute(key,val)},attrs);break;case"iframe":el=loadIframe(attrs,callback);break;default:}return el};exports.locals=function(locals){locals=locals||{};var cache=Math.floor((new Date).getTime()/36e5);if(!locals.hasOwnProperty("cache"))locals.cache=cache;each(function(val,key){if(!locals.hasOwnProperty(key))locals[key]=val},this.options);return locals};exports.ready=function(){this.emit("ready")};exports._wrapInitialize=function(){var initialize=this.initialize;this.initialize=function(){this.debug("initialize");this._initialized=true;var ret=initialize.apply(this,arguments);this.emit("initialize");return ret};if(this._assumesPageview)this.initialize=after(2,this.initialize)};exports._wrapPage=function(){var page=this.page;this.page=function(){if(this._assumesPageview&&!this._initialized){return this.initialize.apply(this,arguments)}return page.apply(this,arguments)}};exports._wrapTrack=function(){var t=this.track;this.track=function(track){var event=track.event();var called;var ret;for(var method in events){if(has.call(events,method)){var regexp=events[method];if(!this[method])continue;if(!regexp.test(event))continue;ret=this[method].apply(this,arguments);called=true;break}}if(!called)ret=t.apply(this,arguments);return ret}};function getMappingType(mapping){if(is.array(mapping)){return every(isMixed,mapping)?"mixed":"array"}if(is.object(mapping))return"map";return"unknown"}function isMixed(item){if(!is.object(item))return false;if(!is.string(item.key))return false;if(!has.call(item,"value"))return false;return true}function loadImage(attrs,fn){fn=fn||function(){};var img=new Image;img.onerror=error(fn,"failed to load pixel",img);img.onload=function(){fn()};img.src=attrs.src;img.width=1;img.height=1;return img}function error(fn,message,img){return function(e){e=e||window.event;var err=new Error(message);err.event=e;err.source=img;fn(err)}}function render(template,locals){return foldl(function(attrs,val,key){attrs[key]=val.replace(/\{\{\ *(\w+)\ *\}\}/g,function(_,$1){return locals[$1]});return attrs},{},template.attrs)}},{"@ndhoule/after":3,"@ndhoule/each":8,"@ndhoule/every":9,"@ndhoule/foldl":11,"@segment/fmt":44,"@segment/load-script":48,"analytics-events":34,"component-emitter":71,is:86,"load-iframe":91,"next-tick":97,"to-no-case":115}],33:[function(require,module,exports){"use strict";var Emitter=require("component-emitter");var domify=require("domify");var each=require("@ndhoule/each");var includes=require("@ndhoule/includes");Emitter(exports);exports.option=function(key,value){this.prototype.defaults[key]=value;return this};exports.mapping=function(name){this.option(name,[]);this.prototype[name]=function(key){return this.map(this.options[name],key)};return this};exports.global=function(key){this.prototype.globals.push(key);return this};exports.assumesPageview=function(){this.prototype._assumesPageview=true;return this};exports.readyOnLoad=function(){this.prototype._readyOnLoad=true;return this};exports.readyOnInitialize=function(){this.prototype._readyOnInitialize=true;return this};exports.tag=function(name,tag){if(tag==null){tag=name;name="library"}this.prototype.templates[name]=objectify(tag);return this};function objectify(str){str=str.replace(' src="',' data-src="');var el=domify(str);var attrs={};each(function(attr){var name=attr.name==="data-src"?"src":attr.name;if(!includes(attr.name+"=",str))return;attrs[name]=attr.value},el.attributes);return{type:el.tagName.toLowerCase(),attrs:attrs}}},{"@ndhoule/each":8,"@ndhoule/includes":12,"component-emitter":71,domify:79}],34:[function(require,module,exports){module.exports={promotionViewed:/^[ _]?promotion[ _]?viewed?[ _]?$/i,viewedPromotion:/^[ _]?viewed[ _]?promotion?[ _]?$/i,promotionClicked:/^[ _]?promotion[ _]?clicked?[ _]?$/i,clickedPromotion:/^[ _]?clicked[ _]?promotion?[ _]?$/i,productsSearched:/^[ _]?products[ _]?searched[ _]?$/i,productListViewed:/^[ _]?product[ _]?list[ _]?viewed[ _]?$/i,productListFiltered:/^[ _]?product[ _]?list[ _]?filtered[ _]?$/i,viewedProductCategory:/^[ _]?viewed[ _]?product[ _]?category[ _]?$/i,viewedProductDetails:/^[ _]?viewed[ _]?product[ _]?details?[ _]?$/i,productClicked:/^[ _]?product[ _]?clicked[ _]?$/i,clickedProduct:/^[ _]?clicked[ _]?product[ _]?$/i,productViewed:/^[ _]?product[ _]?viewed[ _]?$/i,viewedProduct:/^[ _]?viewed[ _]?product[ _]?$/i,productAdded:/^[ _]?product[ _]?added[ _]?$/i,addedProduct:/^[ _]?added[ _]?product[ _]?$/i,productRemoved:/^[ _]?product[ _]?removed[ _]?$/i,removedProduct:/^[ _]?removed[ _]?product[ _]?$/i,cartViewed:/^[ _]?cart[ _]?viewed[ _]?$/i,orderStarted:/^[ _]?order[ _]?started[ _]?$/i,startedOrder:/^[ _]?started[ _]?order[ _]?$/i,orderUpdated:/^[ _]?order[ _]?updated[ _]?$/i,updatedOrder:/^[ _]?updated[ _]?order[ _]?$/i,orderCompleted:/^[ _]?order[ _]?completed[ _]?$/i,completedOrder:/^[ _]?completed[ _]?order[ _]?$/i,orderRefunded:/^[ _]?order[ _]?refunded[ _]?$/i,refundedOrder:/^[ _]?refunded[ _]?order[ _]?$/i,orderCancelled:/^[ _]?order[ _]?cancelled[ _]?$/i,paymentInfoAdded:/^[ _]?payment[ _]?info[ _]?added[ _]?$/i,checkoutStarted:/^[ _]?checkout[ _]?started[ _]?$/i,checkoutStepViewed:/^[ _]?checkout[ _]?step[ _]?viewed[ _]?$/i,viewedCheckoutStep:/^[ _]?viewed[ _]?checkout[ _]?step[ _]?$/i,checkoutStepCompleted:/^[ _]?checkout[ _]?step[ _]?completed[ _]?$/i,completedCheckoutStep:/^[ _]?completed[ _]?checkout[ _]?step[ _]?$/i,couponEntered:/^[ _]?coupon[ _]?entered[ _]?$/i,couponApplied:/^[ _]?coupon[ _]?applied[ _]?$/i,couponDenied:/^[ _]?coupon[ _]?denied[ _]?$/i,couponRemoved:/^[ _]?coupon[ _]?removed[ _]?$/i,productAddedToWishlist:/^[ _]?product[ _]?added[ _]?to[ _]?wishlist[ _]?$/i,wishlistProductRemoved:/^[ _]?wishlist[ _]?product[ _]?removed[ _]?$/i,wishlistProductAddedToCart:/^[ _]?wishlist[ _]?product[ _]?added[ _]?to[ _]?cart[ _]?$/i,productShared:/^[ _]?product[ _]?shared[ _]?$/i,cartShared:/^[ _]?cart[ _]?shared[ _]?$/i,productRemoved:/^[ _]?product[ _]?removed[ _]?$/i,applicationInstalled:/^[ _]?application[ _]?installed[ _]?$/i,applicationUpdated:/^[ _]?application[ _]?updated[ _]?$/i,applicationOpened:/^[ _]?application[ _]?opened[ _]?$/i,applicationBackgrounded:/^[ _]?application[ _]?backgrounded[ _]?$/i,applicationUninstalled:/^[ _]?application[ _]?uninstalled[ _]?$/i,installAttributed:/^[ _]?install[ _]?attributed[ _]?$/i,deepLinkOpened:/^[ _]?deep[ _]?link[ _]?opened[ _]?$/i,pushNotificationReceived:/^[ _]?push[ _]?notification[ _]?received[ _]?$/i,pushNotificationTapped:/^[ _]?push[ _]?notification[ _]?received[ _]?$/i,pushNotificationBounced:/^[ _]?push[ _]?notification[ _]?bounced[ _]?$/i}},{}],35:[function(require,module,exports){(function(process){exports=module.exports=require("./debug");exports.log=log;exports.formatArgs=formatArgs;exports.save=save;exports.load=load;exports.useColors=useColors;exports.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:localstorage();exports.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"];function useColors(){if(typeof window!=="undefined"&&window.process&&window.process.type==="renderer"){return true}return typeof document!=="undefined"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window!=="undefined"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator!=="undefined"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}exports.formatters.j=function(v){try{return JSON.stringify(v)}catch(err){return"[UnexpectedJSONParseError]: "+err.message}};function formatArgs(args){var useColors=this.useColors;args[0]=(useColors?"%c":"")+this.namespace+(useColors?" %c":" ")+args[0]+(useColors?"%c ":" ")+"+"+exports.humanize(this.diff);if(!useColors)return;var c="color: "+this.color;args.splice(1,0,c,"color: inherit");var index=0;var lastC=0;args[0].replace(/%[a-zA-Z%]/g,function(match){if("%%"===match)return;index++;if("%c"===match){lastC=index}});args.splice(lastC,0,c)}function log(){return"object"===typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function save(namespaces){try{if(null==namespaces){exports.storage.removeItem("debug")}else{exports.storage.debug=namespaces}}catch(e){}}function load(){var r;try{r=exports.storage.debug}catch(e){}if(!r&&typeof process!=="undefined"&&"env"in process){r=process.env.DEBUG}return r}exports.enable(load());function localstorage(){try{return window.localStorage}catch(e){}}}).call(this,require("_process"))},{"./debug":36,_process:99}],36:[function(require,module,exports){exports=module.exports=createDebug.debug=createDebug["default"]=createDebug;exports.coerce=coerce;exports.disable=disable;exports.enable=enable;exports.enabled=enabled;exports.humanize=require("ms");exports.names=[];exports.skips=[];exports.formatters={};var prevTime;function selectColor(namespace){var hash=0,i;for(i in namespace){hash=(hash<<5)-hash+namespace.charCodeAt(i);hash|=0}return exports.colors[Math.abs(hash)%exports.colors.length]}function createDebug(namespace){function debug(){if(!debug.enabled)return;var self=debug;var curr=+new Date;var ms=curr-(prevTime||curr);self.diff=ms;self.prev=prevTime;self.curr=curr;prevTime=curr;var args=new Array(arguments.length);for(var i=0;i<args.length;i++){args[i]=arguments[i]}args[0]=exports.coerce(args[0]);if("string"!==typeof args[0]){args.unshift("%O")}var index=0;args[0]=args[0].replace(/%([a-zA-Z%])/g,function(match,format){if(match==="%%")return match;index++;var formatter=exports.formatters[format];if("function"===typeof formatter){var val=args[index];match=formatter.call(self,val);args.splice(index,1);index--}return match});exports.formatArgs.call(self,args);var logFn=debug.log||exports.log||console.log.bind(console);logFn.apply(self,args)}debug.namespace=namespace;debug.enabled=exports.enabled(namespace);debug.useColors=exports.useColors();debug.color=selectColor(namespace);if("function"===typeof exports.init){exports.init(debug)}return debug}function enable(namespaces){exports.save(namespaces);exports.names=[];exports.skips=[];var split=(typeof namespaces==="string"?namespaces:"").split(/[\s,]+/);var len=split.length;for(var i=0;i<len;i++){if(!split[i])continue;namespaces=split[i].replace(/\*/g,".*?");if(namespaces[0]==="-"){exports.skips.push(new RegExp("^"+namespaces.substr(1)+"$"))}else{exports.names.push(new RegExp("^"+namespaces+"$"))}}}function disable(){exports.enable("")}function enabled(name){var i,len;for(i=0,len=exports.skips.length;i<len;i++){if(exports.skips[i].test(name)){return false}}for(i=0,len=exports.names.length;i<len;i++){if(exports.names[i].test(name)){return true}}return false}function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}},{ms:92}],37:[function(require,module,exports){arguments[4][31][0].apply(exports,arguments)},{"./protos":38,"./statics":39,"@ndhoule/clone":5,"@ndhoule/defaults":6,"@ndhoule/extend":10,"component-bind":66,debug:40,dup:31,"slug-component":112}],38:[function(require,module,exports){"use strict";var Emitter=require("component-emitter");var after=require("@ndhoule/after");var each=require("@ndhoule/each");var events=require("analytics-events");var every=require("@ndhoule/every");var fmt=require("@segment/fmt");var foldl=require("@ndhoule/foldl");var is=require("is");var loadIframe=require("load-iframe");var loadScript=require("@segment/load-script");var nextTick=require("next-tick");var normalize=require("to-no-case");var has=Object.prototype.hasOwnProperty;var noop=function noop(){};var onerror=window.onerror;var onload=null;Emitter(exports);exports.initialize=function(){var ready=this.ready;nextTick(ready)};exports.loaded=function(){return false};exports.page=function(page){};exports.track=function(track){};exports.map=function(options,key){var normalizedComparator=normalize(key);var mappingType=getMappingType(options);if(mappingType==="unknown"){return[]}return foldl(function(matchingValues,val,key){var compare;var result;if(mappingType==="map"){compare=key;result=val}if(mappingType==="array"){compare=val;result=val}if(mappingType==="mixed"){compare=val.key;result=val.value}if(normalize(compare)===normalizedComparator){matchingValues.push(result)}return matchingValues},[],options)};exports.invoke=function(method){if(!this[method])return;var args=Array.prototype.slice.call(arguments,1);if(!this._ready)return this.queue(method,args);var ret;try{this.debug("%s with %o",method,args);ret=this[method].apply(this,args)}catch(e){this.debug("error %o calling %s with %o",e,method,args)}return ret};exports.queue=function(method,args){this._queue.push({method:method,args:args})};exports.flush=function(){this._ready=true;var self=this;each(function(call){self[call.method].apply(self,call.args)},this._queue);this._queue.length=0};exports.reset=function(){for(var i=0;i<this.globals.length;i++){window[this.globals[i]]=undefined}window.onerror=onerror;window.onload=onload};exports.load=function(name,locals,callback){if(typeof name==="function"){callback=name;locals=null;name=null}if(name&&typeof name==="object"){callback=locals;locals=name;name=null}if(typeof locals==="function"){callback=locals;locals=null}name=name||"library";locals=locals||{};locals=this.locals(locals);var template=this.templates[name];if(!template)throw new Error(fmt('template "%s" not defined.',name));var attrs=render(template,locals);callback=callback||noop;var self=this;var el;switch(template.type){case"img":attrs.width=1;attrs.height=1;el=loadImage(attrs,callback);break;case"script":el=loadScript(attrs,function(err){if(!err)return callback();self.debug('error loading "%s" error="%s"',self.name,err)});delete attrs.src;each(function(val,key){el.setAttribute(key,val)},attrs);break;case"iframe":el=loadIframe(attrs,callback);break;default:}return el};exports.locals=function(locals){locals=locals||{};var cache=Math.floor((new Date).getTime()/36e5);if(!locals.hasOwnProperty("cache"))locals.cache=cache;each(function(val,key){if(!locals.hasOwnProperty(key))locals[key]=val},this.options);return locals};exports.ready=function(){this.emit("ready")};exports._wrapInitialize=function(){var initialize=this.initialize;this.initialize=function(){this.debug("initialize");this._initialized=true;var ret=initialize.apply(this,arguments);this.emit("initialize");return ret}};exports._wrapPage=function(){if(this._assumesPageview)return this.page=after(2,this.page)};exports._wrapTrack=function(){var t=this.track;this.track=function(track){var event=track.event();var called;var ret;for(var method in events){if(has.call(events,method)){var regexp=events[method];if(!this[method])continue;if(!regexp.test(event))continue;ret=this[method].apply(this,arguments);called=true;break}}if(!called)ret=t.apply(this,arguments);return ret}};function getMappingType(mapping){if(is.array(mapping)){return every(isMixed,mapping)?"mixed":"array"}if(is.object(mapping))return"map";return"unknown"}function isMixed(item){if(!is.object(item))return false;if(!is.string(item.key))return false;if(!has.call(item,"value"))return false;return true}function loadImage(attrs,fn){fn=fn||function(){};var img=new Image;img.onerror=error(fn,"failed to load pixel",img);img.onload=function(){fn()};img.src=attrs.src;img.width=1;img.height=1;return img}function error(fn,message,img){return function(e){e=e||window.event;var err=new Error(message);err.event=e;err.source=img;fn(err)}}function render(template,locals){return foldl(function(attrs,val,key){attrs[key]=val.replace(/\{\{\ *(\w+)\ *\}\}/g,function(_,$1){
return locals[$1]});return attrs},{},template.attrs)}},{"@ndhoule/after":3,"@ndhoule/each":8,"@ndhoule/every":9,"@ndhoule/foldl":11,"@segment/fmt":44,"@segment/load-script":48,"analytics-events":64,"component-emitter":71,is:86,"load-iframe":91,"next-tick":97,"to-no-case":115}],39:[function(require,module,exports){"use strict";var Emitter=require("component-emitter");var domify=require("domify");var each=require("@ndhoule/each");var includes=require("@ndhoule/includes");Emitter(exports);exports.option=function(key,value){this.prototype.defaults[key]=value;return this};exports.mapping=function(name){this.option(name,[]);this.prototype[name]=function(key){return this.map(this.options[name],key)};return this};exports.global=function(key){this.prototype.globals.push(key);return this};exports.assumesPageview=function(){this.prototype._assumesPageview=true;return this};exports.readyOnLoad=function(){this.prototype._readyOnLoad=true;return this};exports.readyOnInitialize=function(){this.prototype._readyOnInitialize=true;return this};exports.tag=function(name,tag){if(tag==null){tag=name;name="library"}this.prototype.templates[name]=objectify(tag);return this};function objectify(str){str=str.replace(' src="',' data-src="');var el=domify(str);var attrs={};each(function(attr){var name=attr.name==="data-src"?"src":attr.name;if(!includes(attr.name+"=",str))return;attrs[name]=attr.value},el.attributes);return{type:el.tagName.toLowerCase(),attrs:attrs}}},{"@ndhoule/each":8,"@ndhoule/includes":12,"component-emitter":71,domify:79}],40:[function(require,module,exports){arguments[4][35][0].apply(exports,arguments)},{"./debug":41,_process:99,dup:35}],41:[function(require,module,exports){arguments[4][36][0].apply(exports,arguments)},{dup:36,ms:92}],42:[function(require,module,exports){var utf8Encode=require("utf8-encode");var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";module.exports=encode;function encode(input){var output="";var chr1,chr2,chr3,enc1,enc2,enc3,enc4;var i=0;input=utf8Encode(input);while(i<input.length){chr1=input.charCodeAt(i++);chr2=input.charCodeAt(i++);chr3=input.charCodeAt(i++);enc1=chr1>>2;enc2=(chr1&3)<<4|chr2>>4;enc3=(chr2&15)<<2|chr3>>6;enc4=chr3&63;if(isNaN(chr2)){enc3=enc4=64}else if(isNaN(chr3)){enc4=64}output=output+keyStr.charAt(enc1)+keyStr.charAt(enc2)+keyStr.charAt(enc3)+keyStr.charAt(enc4)}return output}},{"utf8-encode":118}],43:[function(require,module,exports){"use strict";function canonical(){var tags=document.getElementsByTagName("link");for(var i=0,tag;tag=tags[i];i++){if(tag.getAttribute("rel")==="canonical"){return tag.getAttribute("href")}}}module.exports=canonical},{}],44:[function(require,module,exports){(function(global){"use strict";var toString=global.JSON&&typeof JSON.stringify==="function"?JSON.stringify:String;function fmt(str){var args=Array.prototype.slice.call(arguments,1);var j=0;return str.replace(/%([a-z])/gi,function(match,f){return fmt[f]?fmt[f](args[j++]):match+f})}fmt.o=toString;fmt.s=String;fmt.d=parseInt;module.exports=fmt}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],45:[function(require,module,exports){"use strict";function isMeta(e){if(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey){return true}var which=e.which;var button=e.button;if(!which&&button!==undefined){return!button&1&&!button&2&&button&4}else if(which===2){return true}return false}module.exports=isMeta},{}],46:[function(require,module,exports){"use strict";var type=require("component-type");var each=require("component-each");var isodate=require("@segment/isodate");module.exports=traverse;function traverse(input,strict){if(strict===undefined)strict=true;if(type(input)==="object")return object(input,strict);if(type(input)==="array")return array(input,strict);return input}function object(obj,strict){if(obj.length&&typeof obj.length==="number"&&!(obj.length-1 in obj)){obj.lengthNonArray=obj.length;delete obj.length}each(obj,function(key,val){if(isodate.is(val,strict)){obj[key]=val}else if(type(val)==="object"||type(val)==="array"){traverse(val,strict)}});if(obj.lengthNonArray){obj.length=obj.lengthNonArray;delete obj.lengthNonArray}return obj}function array(arr,strict){each(arr,function(val,x){if(type(val)==="object"){traverse(val,strict)}else if(isodate.is(val,strict)){arr[x]=val}});return arr}},{"@segment/isodate":47,"component-each":69,"component-type":76}],47:[function(require,module,exports){"use strict";var matcher=/^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;exports.parse=function(iso){var numericKeys=[1,5,6,7,11,12];var arr=matcher.exec(iso);var offset=0;if(!arr){return new Date(iso)}for(var i=0,val;val=numericKeys[i];i++){arr[val]=parseInt(arr[val],10)||0}arr[2]=parseInt(arr[2],10)||1;arr[3]=parseInt(arr[3],10)||1;arr[2]--;arr[8]=arr[8]?(arr[8]+"00").substring(0,3):0;if(arr[4]===" "){offset=(new Date).getTimezoneOffset()}else if(arr[9]!=="Z"&&arr[10]){offset=arr[11]*60+arr[12];if(arr[10]==="+"){offset=0-offset}}var millis=Date.UTC(arr[1],arr[2],arr[3],arr[5],arr[6]+offset,arr[7],arr[8]);return new Date(millis)};exports.is=function(string,strict){if(typeof string!=="string"){return false}if(strict&&/^\d{4}-\d{2}-\d{2}/.test(string)===false){return false}return matcher.test(string)}},{}],48:[function(require,module,exports){"use strict";var onload=require("script-onload");var tick=require("next-tick");var type=require("component-type");function loadScript(options,cb){if(!options){throw new Error("Can't load nothing...")}if(type(options)==="string"){options={src:options}}var https=document.location.protocol==="https:"||document.location.protocol==="chrome-extension:";if(options.src&&options.src.indexOf("//")===0){options.src=(https?"https:":"http:")+options.src}if(https&&options.https){options.src=options.https}else if(!https&&options.http){options.src=options.http}var script=document.createElement("script");script.type="text/javascript";script.async=true;script.src=options.src;if(type(cb)==="function"){onload(script,cb)}tick(function(){var firstScript=document.getElementsByTagName("script")[0];firstScript.parentNode.insertBefore(script,firstScript)});return script}module.exports=loadScript},{"component-type":76,"next-tick":97,"script-onload":100}],49:[function(require,module,exports){"use strict";var uuid=require("uuid").v4;var store=require("./store");var each=require("@ndhoule/each");var Schedule=require("./schedule");var debug=require("debug")("localstorage-retry");function bind(func,obj){return function(){return func.apply(obj,arguments)}}function Queue(name,fn){this.name=name;this.id=uuid();this.fn=fn;this.timeouts={ACK_TIMER:1e3,RECLAIM_TIMER:3e3,RECLAIM_TIMEOUT:1e4,RECLAIM_WAIT:500,MAX_QUEUE_DELAY:3e4};this._schedule=new Schedule;this._processId=0;this._store=store(this.name,this.id);this._store.inProgress.set({});this._store.queue.set([]);this._ack=bind(this._ack,this);this._checkReclaim=bind(this._checkReclaim,this);this._processHead=bind(this._processHead,this);this._running=false}Queue.prototype.start=function(){if(this._running){this.stop()}this._running=true;this._ack();this._checkReclaim();this._processHead()};Queue.prototype.stop=function(){this._schedule.cancelAll();this._running=false};Queue.prototype.getDelay=function(attemptNumber){return 1e3*Math.pow(attemptNumber,2)};Queue.prototype.addItem=function(item){this._enqueue({item:item,attemptNumber:0,time:this._schedule.now()})};Queue.prototype.requeue=function(item,attemptNumber){var delay=Math.min(this.getDelay(attemptNumber),this.timeouts.MAX_QUEUE_DELAY);this._enqueue({item:item,attemptNumber:attemptNumber,time:this._schedule.now()+delay})};Queue.prototype._enqueue=function(entry){var queue=this._store.queue.get();queue.push(entry);queue=queue.sort(function(a,b){return a.time-b.time});this._store.queue.set(queue);if(this._running){this._processHead()}};Queue.prototype._processHead=function(){var self=this;var store=this._store;this._schedule.cancel(this._processId);var queue=store.queue.get();var inProgress=store.inProgress.get();var now=this._schedule.now();var toRun=[];while(queue.length&&queue[0].time<=now){var el=queue.shift();var id=uuid();inProgress[id]={item:el.item,attemptNumber:el.attemptNumber,time:this._schedule.now()};toRun.push({item:el.item,done:function handle(err){var inProgress=store.inProgress.get();delete inProgress[id];store.inProgress.set(inProgress);if(err){self.requeue(el.item,el.attemptNumber+1)}}})}store.queue.set(queue);store.inProgress.set(inProgress);each(function(el){try{self.fn(el.item,el.done)}catch(err){debug("Process function threw error: "+err)}},toRun);queue=store.queue.get();this._schedule.cancel(this._processId);if(queue.length>0){this._processId=this._schedule.run(this._processHead,queue[0].time-now)}};Queue.prototype._ack=function(){this._store.ack.set(this._schedule.now());this._store.reclaimStart.set(null);this._store.reclaimEnd.set(null);this._schedule.run(this._ack,this.timeouts.ACK_TIMER)};Queue.prototype._checkReclaim=function(){var self=this;function tryReclaim(store){store.reclaimStart.set(self.id);store.ack.set(self._schedule.now());self._schedule.run(function(){if(store.reclaimStart.get()!==self.id)return;store.reclaimEnd.set(self.id);self._schedule.run(function(){if(store.reclaimEnd.get()!==self.id)return;if(store.reclaimStart.get()!==self.id)return;self._reclaim(store.id)},self.timeouts.RECLAIM_WAIT)},self.timeouts.RECLAIM_WAIT)}each(function(store){if(store.id===self.id)return;if(self._schedule.now()-store.ack.get()<self.timeouts.RECLAIM_TIMEOUT)return;tryReclaim(store)},store.getAll(this.name));this._schedule.run(this._checkReclaim,this.timeouts.RECLAIM_TIMER)};Queue.prototype._reclaim=function(id){var self=this;var other=store(this.name,id);var our={queue:this._store.queue.get()||[]};var their={inProgress:other.inProgress.get()||{},queue:other.queue.get()||[]};each(function(el){our.queue.push({item:el.item,attemptNumber:0,time:self._schedule.now()})},their.queue);each(function(el){our.queue.push({item:el.item,attemptNumber:0,time:self._schedule.now()})},their.inProgress);our.queue=our.queue.sort(function(a,b){return a.time-b.time});this._store.queue.set(our.queue);other.ack.remove();other.reclaimStart.remove();other.reclaimEnd.remove();other.inProgress.remove();other.queue.remove();this._processHead()};module.exports=Queue},{"./schedule":51,"./store":52,"@ndhoule/each":8,debug:78,uuid:53}],50:[function(require,module,exports){"use strict";var keys=require("@ndhoule/keys");var uuid=require("uuid").v4;var inMemoryStore={_data:{},length:0,setItem:function(key,value){this._data[key]=value;this.length=keys(this._data).length;return value},getItem:function(key){if(key in this._data){return this._data[key]}return null},removeItem:function(key){if(key in this._data){delete this._data[key]}this.length=keys(this._data).length;return null},clear:function(){this._data={};this.length=0},key:function(index){return keys(this._data)[index]}};function isSupportedNatively(){try{if(!window.localStorage)return false;var key=uuid();window.localStorage.setItem(key,"test_value");var value=window.localStorage.getItem(key);window.localStorage.removeItem(key);return value==="test_value"}catch(e){return false}}function pickStorage(){if(isSupportedNatively()){return window.localStorage}return inMemoryStore}module.exports.localStorage=pickStorage();module.exports.inMemoryStore=inMemoryStore},{"@ndhoule/keys":13,uuid:53}],51:[function(require,module,exports){"use strict";var each=require("@ndhoule/each");var defaultClock={setTimeout:function(fn,ms){return window.setTimeout(fn,ms)},clearTimeout:function(id){return window.clearTimeout(id)},Date:window.Date};var clock=defaultClock;function Schedule(){this.tasks={};this.nextId=1}Schedule.prototype.now=function(){return+new clock.Date};Schedule.prototype.run=function(task,timeout){var id=this.nextId++;this.tasks[id]=clock.setTimeout(this._handle(id,task),timeout);return id};Schedule.prototype.cancel=function(id){if(this.tasks[id]){clock.clearTimeout(this.tasks[id]);delete this.tasks[id]}};Schedule.prototype.cancelAll=function(){each(clock.clearTimeout,this.tasks);this.tasks={}};Schedule.prototype._handle=function(id,callback){var self=this;return function(){delete self.tasks[id];return callback()}};Schedule.setClock=function(newClock){clock=newClock};Schedule.resetClock=function(){clock=defaultClock};module.exports=Schedule},{"@ndhoule/each":8}],52:[function(require,module,exports){"use strict";var localStorage=require("./localStorage").localStorage;var json=require("json3");function StoreItem(key){this.key=key}StoreItem.prototype.get=function(){try{var str=localStorage.getItem(this.key);if(str===null){return null}return json.parse(str)}catch(err){return null}};StoreItem.prototype.set=function(value){localStorage.setItem(this.key,json.stringify(value))};StoreItem.prototype.remove=function(){localStorage.removeItem(this.key)};function createStore(name,id){return{name:name,id:id,ack:new StoreItem([name,id,"ack"].join(".")),reclaimStart:new StoreItem([name,id,"reclaimStart"].join(".")),reclaimEnd:new StoreItem([name,id,"reclaimEnd"].join(".")),inProgress:new StoreItem([name,id,"inProgress"].join(".")),queue:new StoreItem([name,id,"queue"].join("."))}}module.exports=createStore;module.exports.StoreItem=StoreItem;module.exports.getAll=function(name){var res=[];for(var i=0;i<localStorage.length;i++){var k=localStorage.key(i);var parts=k.split(".");if(parts.length!==3)continue;if(parts[0]!==name)continue;if(parts[2]!=="ack")continue;res.push(createStore(name,parts[1]))}return res}},{"./localStorage":50,json3:87}],53:[function(require,module,exports){var v1=require("./v1");var v4=require("./v4");var uuid=v4;uuid.v1=v1;uuid.v4=v4;module.exports=uuid},{"./v1":56,"./v4":57}],54:[function(require,module,exports){var byteToHex=[];for(var i=0;i<256;++i){byteToHex[i]=(i+256).toString(16).substr(1)}function bytesToUuid(buf,offset){var i=offset||0;var bth=byteToHex;return[bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],"-",bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]],bth[buf[i++]]].join("")}module.exports=bytesToUuid},{}],55:[function(require,module,exports){var getRandomValues=typeof crypto!="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!="undefined"&&typeof window.msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto);if(getRandomValues){var rnds8=new Uint8Array(16);module.exports=function whatwgRNG(){getRandomValues(rnds8);return rnds8}}else{var rnds=new Array(16);module.exports=function mathRNG(){for(var i=0,r;i<16;i++){if((i&3)===0)r=Math.random()*4294967296;rnds[i]=r>>>((i&3)<<3)&255}return rnds}}},{}],56:[function(require,module,exports){var rng=require("./lib/rng");var bytesToUuid=require("./lib/bytesToUuid");var _nodeId;var _clockseq;var _lastMSecs=0;var _lastNSecs=0;function v1(options,buf,offset){var i=buf&&offset||0;var b=buf||[];options=options||{};var node=options.node||_nodeId;var clockseq=options.clockseq!==undefined?options.clockseq:_clockseq;if(node==null||clockseq==null){var seedBytes=rng();if(node==null){node=_nodeId=[seedBytes[0]|1,seedBytes[1],seedBytes[2],seedBytes[3],seedBytes[4],seedBytes[5]]}if(clockseq==null){clockseq=_clockseq=(seedBytes[6]<<8|seedBytes[7])&16383}}var msecs=options.msecs!==undefined?options.msecs:(new Date).getTime();var nsecs=options.nsecs!==undefined?options.nsecs:_lastNSecs+1;var dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&options.clockseq===undefined){clockseq=clockseq+1&16383}if((dt<0||msecs>_lastMSecs)&&options.nsecs===undefined){nsecs=0}if(nsecs>=1e4){throw new Error("uuid.v1(): Can't create more than 10M uuids/sec")}_lastMSecs=msecs;_lastNSecs=nsecs;_clockseq=clockseq;msecs+=122192928e5;var tl=((msecs&268435455)*1e4+nsecs)%4294967296;b[i++]=tl>>>24&255;b[i++]=tl>>>16&255;b[i++]=tl>>>8&255;b[i++]=tl&255;var tmh=msecs/4294967296*1e4&268435455;b[i++]=tmh>>>8&255;b[i++]=tmh&255;b[i++]=tmh>>>24&15|16;b[i++]=tmh>>>16&255;b[i++]=clockseq>>>8|128;b[i++]=clockseq&255;for(var n=0;n<6;++n){b[i+n]=node[n]}return buf?buf:bytesToUuid(b)}module.exports=v1},{"./lib/bytesToUuid":54,"./lib/rng":55}],57:[function(require,module,exports){var rng=require("./lib/rng");var bytesToUuid=require("./lib/bytesToUuid");function v4(options,buf,offset){var i=buf&&offset||0;if(typeof options=="string"){buf=options==="binary"?new Array(16):null;options=null}options=options||{};var rnds=options.random||(options.rng||rng)();rnds[6]=rnds[6]&15|64;rnds[8]=rnds[8]&63|128;if(buf){for(var ii=0;ii<16;++ii){buf[i+ii]=rnds[ii]}}return buf||bytesToUuid(rnds)}module.exports=v4},{"./lib/bytesToUuid":54,"./lib/rng":55}],58:[function(require,module,exports){"use strict";function preventDefault(e){e=e||window.event;return e.preventDefault?e.preventDefault():e.returnValue=false}module.exports=preventDefault},{}],59:[function(require,module,exports){"use strict";var define=Object.defineProperty;var initialProtocol=window.location.protocol;var mockedProtocol;module.exports=function(protocol){if(arguments.length===0){return get()}return set(protocol)};module.exports.http=function(){set("http:")};module.exports.https=function(){set("https:")};module.exports.reset=function(){set(initialProtocol)};function get(){return mockedProtocol||window.location.protocol}function set(protocol){try{define(window.location,"protocol",{get:function(){return protocol}})}catch(err){mockedProtocol=protocol}}},{}],60:[function(require,module,exports){"use strict";var JSON=require("json3");var base64encode=require("@segment/base64-encode");var cors=require("has-cors");var jsonp=require("jsonp");exports=module.exports=cors?json:base64;exports.callback="callback";exports.prefix="data";exports.json=json;exports.base64=base64;exports.type=cors?"xhr":"jsonp";function json(url,obj,headers,fn){if(arguments.length===3)fn=headers,headers={};var req=new XMLHttpRequest;req.onerror=fn;req.onreadystatechange=done;req.open("POST",url,true);for(var k in headers){req.setRequestHeader(k,headers[k])}req.send(JSON.stringify(obj));function done(){if(req.readyState===4){return fn(null,req)}}}function base64(url,obj,_,fn){if(arguments.length===3)fn=_;var prefix=exports.prefix;var data=encode(obj);url+="?"+prefix+"="+data;jsonp(url,{param:exports.callback},function(err,obj){if(err)return fn(err);fn(null,{url:url,body:obj})})}function encode(obj){var str="";str=JSON.stringify(obj);str=base64encode(str);str=str.replace(/\+/g,"-").replace(/\//g,"_");return encodeURIComponent(str)}},{"@segment/base64-encode":42,"has-cors":83,json3:87,jsonp:88}],61:[function(require,module,exports){(function(global){"use strict";var JSON=require("json3");module.exports=function(){var store={},win=typeof window!="undefined"?window:global,doc=win.document,localStorageName="localStorage",scriptTag="script",storage;store.disabled=false;store.version="1.3.20";store.set=function(key,value){};store.get=function(key,defaultVal){};store.has=function(key){return store.get(key)!==undefined};store.remove=function(key){};store.clear=function(){};store.transact=function(key,defaultVal,transactionFn){if(transactionFn==null){transactionFn=defaultVal;defaultVal=null}if(defaultVal==null){defaultVal={}}var val=store.get(key,defaultVal);transactionFn(val);store.set(key,val)};store.getAll=function(){var ret={};store.forEach(function(key,val){ret[key]=val});return ret};store.forEach=function(){};store.serialize=function(value){return JSON.stringify(value)};store.deserialize=function(value){if(typeof value!="string"){return undefined}try{return JSON.parse(value)}catch(e){return value||undefined}};function isLocalStorageNameSupported(){try{return localStorageName in win&&win[localStorageName]}catch(err){return false}}if(isLocalStorageNameSupported()){storage=win[localStorageName];store.set=function(key,val){if(val===undefined){return store.remove(key)}storage.setItem(key,store.serialize(val));return val};store.get=function(key,defaultVal){var val=store.deserialize(storage.getItem(key));return val===undefined?defaultVal:val};store.remove=function(key){storage.removeItem(key)};store.clear=function(){storage.clear()};store.forEach=function(callback){for(var i=0;i<storage.length;i++){var key=storage.key(i);callback(key,store.get(key))}}}else if(doc&&doc.documentElement.addBehavior){var storageOwner,storageContainer;try{storageContainer=new ActiveXObject("htmlfile");storageContainer.open();storageContainer.write("<"+scriptTag+">document.w=window</"+scriptTag+'><iframe src="/favicon.ico"></iframe>');storageContainer.close();storageOwner=storageContainer.w.frames[0].document;storage=storageOwner.createElement("div")}catch(e){storage=doc.createElement("div");storageOwner=doc.body}var withIEStorage=function(storeFunction){return function(){var args=Array.prototype.slice.call(arguments,0);args.unshift(storage);storageOwner.appendChild(storage);storage.addBehavior("#default#userData");storage.load(localStorageName);var result=storeFunction.apply(store,args);storageOwner.removeChild(storage);return result}};var forbiddenCharsRegex=new RegExp("[!\"#$%&'()*+,/\\\\:;<=>?@[\\]^`{|}~]","g");var ieKeyFix=function(key){return key.replace(/^d/,"___$&").replace(forbiddenCharsRegex,"___")};store.set=withIEStorage(function(storage,key,val){key=ieKeyFix(key);if(val===undefined){return store.remove(key)}storage.setAttribute(key,store.serialize(val));storage.save(localStorageName);return val});store.get=withIEStorage(function(storage,key,defaultVal){key=ieKeyFix(key);var val=store.deserialize(storage.getAttribute(key));return val===undefined?defaultVal:val});store.remove=withIEStorage(function(storage,key){key=ieKeyFix(key);storage.removeAttribute(key);storage.save(localStorageName)});store.clear=withIEStorage(function(storage){var attributes=storage.XMLDocument.documentElement.attributes;storage.load(localStorageName);for(var i=attributes.length-1;i>=0;i--){storage.removeAttribute(attributes[i].name)}storage.save(localStorageName)});store.forEach=withIEStorage(function(storage,callback){var attributes=storage.XMLDocument.documentElement.attributes;for(var i=0,attr;attr=attributes[i];++i){callback(attr.name,store.deserialize(storage.getAttribute(attr.name)))}})}try{var testKey="__storejs__";store.set(testKey,testKey);if(store.get(testKey)!=testKey){store.disabled=true}store.remove(testKey)}catch(e){store.disabled=true}store.enabled=!store.disabled;return store}()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{json3:87}],62:[function(require,module,exports){"use strict";var parse=require("component-url").parse;var cookie=require("component-cookie");function domain(url){var cookie=exports.cookie;var levels=exports.levels(url);for(var i=0;i<levels.length;++i){var cname="__tld__";var domain=levels[i];var opts={domain:"."+domain};cookie(cname,1,opts);if(cookie(cname)){cookie(cname,null,opts);return domain}}return""}domain.levels=function(url){var host=parse(url).hostname;var parts=host.split(".");var last=parts[parts.length-1];var levels=[];if(parts.length===4&&last===parseInt(last,10)){return levels}if(parts.length<=1){return levels}for(var i=parts.length-2;i>=0;--i){levels.push(parts.slice(i).join("."))}return levels};domain.cookie=cookie;exports=module.exports=domain},{"component-cookie":68,"component-url":77}],63:[function(require,module,exports){"use strict";var foldl=require("@ndhoule/foldl");var parse=require("component-querystring").parse;var has=Object.prototype.hasOwnProperty;function utm(query){if(query.charAt(0)==="?"){query=query.substring(1)}query=query.replace(/\?/g,"&");var param;var params=parse(query);var results={};for(var key in params){if(has.call(params,key)){if(key.substr(0,4)==="utm_"){param=key.substr(4);if(param==="campaign")param="name";results[param]=params[key]}}}return results}var allowedKeys={name:true,term:true,source:true,medium:true,content:true};function strict(query){return foldl(function(acc,val,key){if(has.call(allowedKeys,key))acc[key]=val;return acc},{},utm(query))}module.exports=utm;module.exports.strict=strict},{"@ndhoule/foldl":11,"component-querystring":74}],64:[function(require,module,exports){"use strict";var map=require("@ndhoule/map");var foldl=require("@ndhoule/foldl");var eventMap={videoPlaybackStarted:[{object:"video playback",action:"started"}],videoPlaybackPaused:[{object:"video playback",action:"paused"}],videoPlaybackInterrupted:[{object:"video playback",action:"interrupted"}],videoPlaybackResumed:[{object:"video playback",action:"resumed"}],videoPlaybackCompleted:[{object:"video playback",action:"completed"}],videoPlaybackBufferStarted:[{object:"video playback buffer",action:"started"}],videoPlaybackBufferCompleted:[{object:"video playback buffer",action:"completed"}],videoPlaybackSeekStarted:[{object:"video playback seek",action:"started"}],videoPlaybackSeekCompleted:[{object:"video playback seek",action:"completed"}],videoContentStarted:[{object:"video content",action:"started"}],videoContentPlaying:[{object:"video content",action:"playing"}],videoContentCompleted:[{object:"video content",action:"completed"}],videoAdStarted:[{object:"video ad",action:"started"}],videoAdPlaying:[{object:"video ad",action:"playing"}],videoAdCompleted:[{object:"video ad",action:"completed"}],promotionViewed:[{object:"promotion",action:"viewed"}],promotionClicked:[{object:"promotion",action:"clicked"}],productsSearched:[{object:"products",action:"searched"}],productListViewed:[{object:"product list",action:"viewed"},{object:"product category",action:"viewed"}],productListFiltered:[{object:"product list",action:"filtered"}],productClicked:[{object:"product",action:"clicked"}],productViewed:[{object:"product",action:"viewed"}],productAdded:[{object:"product",action:"added"}],productRemoved:[{object:"product",action:"removed"}],cartViewed:[{object:"cart",action:"viewed"}],orderUpdated:[{object:"order",action:"updated"}],orderCompleted:[{object:"order",action:"completed"}],orderRefunded:[{object:"order",action:"refunded"}],orderCancelled:[{object:"order",action:"cancelled"}],paymentInfoEntered:[{object:"payment info",action:"entered"}],checkoutStarted:[{object:"checkout",action:"started"}],checkoutStepViewed:[{object:"checkout step",action:"viewed"}],checkoutStepCompleted:[{object:"checkout step",action:"completed"}],couponEntered:[{object:"coupon",action:"entered"}],couponApplied:[{object:"coupon",action:"applied"}],couponDenied:[{object:"coupon",action:"denied"}],couponRemoved:[{object:"coupon",action:"removed"}],productAddedToWishlist:[{object:"product",action:"added to wishlist"}],productRemovedFromWishlist:[{object:"product",action:"removed from wishlist"}],productAddedFromWishlistToCart:[{object:"product",action:"added to cart from wishlist"},{object:"product",action:"added from wishlist to cart"}],productShared:[{object:"product",action:"shared"}],cartShared:[{object:"cart",action:"shared"}],productReviewed:[{object:"product",action:"reviewed"}],applicationInstalled:[{object:"application",action:"installed"}],applicationUpdated:[{object:"application",action:"updated"}],applicationOpened:[{object:"application",action:"opened"}],applicationBackgrounded:[{object:"application",action:"backgrounded"}],applicationUninstalled:[{object:"application",action:"uninstalled"}],installAttributed:[{object:"install",action:"attributed"}],deepLinkOpened:[{object:"deep link",action:"opened"}],pushNotificationReceived:[{object:"push notification",action:"received"}],pushNotificationTapped:[{object:"push notification",action:"tapped"}],pushNotificationBounced:[{object:"push notification",action:"bounced"}]};module.exports=foldl(function transform(ret,pairs,method){var values=map(function(pair){return map(function(permutation){var flattened=[].concat.apply([],map(function(words){return words.split(" ")},permutation));return"^[ _]?"+flattened.join("[ _]?")+"[ _]?"},[[pair.action,pair.object],[pair.object,pair.action]]).join("|")},pairs);var conjoined=values.join("|")+"$";ret[method]=new RegExp(conjoined,"i");return ret},{},eventMap)},{"@ndhoule/foldl":11,"@ndhoule/map":14}],65:[function(require,module,exports){"use strict";var bind=require("component-bind");function bindAll(obj){for(var key in obj){var val=obj[key];if(typeof val==="function"){obj[key]=bind(obj,obj[key])}}return obj}module.exports=bindAll},{"component-bind":66}],66:[function(require,module,exports){var slice=[].slice;module.exports=function(obj,fn){if("string"==typeof fn)fn=obj[fn];if("function"!=typeof fn)throw new Error("bind() requires a function");var args=slice.call(arguments,2);return function(){return fn.apply(obj,args.concat(slice.call(arguments)))}}},{}],67:[function(require,module,exports){var type;try{type=require("component-type")}catch(_){type=require("type")}module.exports=clone;function clone(obj){switch(type(obj)){case"object":var copy={};for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key)){copy[key]=clone(obj[key])}}return copy;case"array":var copy=new Array(obj.length);for(var i=0,l=obj.length;i<l;i++){copy[i]=clone(obj[i])}return copy;case"regexp":var flags="";flags+=obj.multiline?"m":"";flags+=obj.global?"g":"";flags+=obj.ignoreCase?"i":"";return new RegExp(obj.source,flags);case"date":return new Date(obj.getTime());default:return obj}}},{"component-type":76,type:76}],68:[function(require,module,exports){var debug=require("debug")("cookie");module.exports=function(name,value,options){switch(arguments.length){case 3:case 2:return set(name,value,options);case 1:return get(name);default:return all()}};function set(name,value,options){options=options||{};var str=encode(name)+"="+encode(value);if(null==value)options.maxage=-1;if(options.maxage){options.expires=new Date(+new Date+options.maxage)}if(options.path)str+="; path="+options.path;if(options.domain)str+="; domain="+options.domain;if(options.expires)str+="; expires="+options.expires.toUTCString();if(options.secure)str+="; secure";document.cookie=str}function all(){var str;try{str=document.cookie}catch(err){if(typeof console!=="undefined"&&typeof console.error==="function"){console.error(err.stack||err)}return{}}return parse(str)}function get(name){return all()[name]}function parse(str){var obj={};var pairs=str.split(/ *; */);var pair;if(""==pairs[0])return obj;for(var i=0;i<pairs.length;++i){pair=pairs[i].split("=");obj[decode(pair[0])]=decode(pair[1])}return obj}function encode(value){try{return encodeURIComponent(value)}catch(e){debug("error `encode(%o)` - %o",value,e)}}function decode(value){try{return decodeURIComponent(value)}catch(e){debug("error `decode(%o)` - %o",value,e)}}},{debug:78}],69:[function(require,module,exports){try{var type=require("type")}catch(err){var type=require("component-type")}var toFunction=require("to-function");var has=Object.prototype.hasOwnProperty;module.exports=function(obj,fn,ctx){fn=toFunction(fn);ctx=ctx||this;switch(type(obj)){case"array":return array(obj,fn,ctx);case"object":if("number"==typeof obj.length)return array(obj,fn,ctx);return object(obj,fn,ctx);case"string":return string(obj,fn,ctx)}};function string(obj,fn,ctx){for(var i=0;i<obj.length;++i){fn.call(ctx,obj.charAt(i),i)}}function object(obj,fn,ctx){for(var key in obj){if(has.call(obj,key)){fn.call(ctx,key,obj[key])}}}function array(obj,fn,ctx){for(var i=0;i<obj.length;++i){fn.call(ctx,obj[i],i)}}},{"component-type":70,"to-function":114,type:70}],70:[function(require,module,exports){var toString=Object.prototype.toString;module.exports=function(val){switch(toString.call(val)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}if(val===null)return"null"
;if(val===undefined)return"undefined";if(val&&val.nodeType===1)return"element";if(val===Object(val))return"object";return typeof val}},{}],71:[function(require,module,exports){if(typeof module!=="undefined"){module.exports=Emitter}function Emitter(obj){if(obj)return mixin(obj)}function mixin(obj){for(var key in Emitter.prototype){obj[key]=Emitter.prototype[key]}return obj}Emitter.prototype.on=Emitter.prototype.addEventListener=function(event,fn){this._callbacks=this._callbacks||{};(this._callbacks["$"+event]=this._callbacks["$"+event]||[]).push(fn);return this};Emitter.prototype.once=function(event,fn){function on(){this.off(event,on);fn.apply(this,arguments)}on.fn=fn;this.on(event,on);return this};Emitter.prototype.off=Emitter.prototype.removeListener=Emitter.prototype.removeAllListeners=Emitter.prototype.removeEventListener=function(event,fn){this._callbacks=this._callbacks||{};if(0==arguments.length){this._callbacks={};return this}var callbacks=this._callbacks["$"+event];if(!callbacks)return this;if(1==arguments.length){delete this._callbacks["$"+event];return this}var cb;for(var i=0;i<callbacks.length;i++){cb=callbacks[i];if(cb===fn||cb.fn===fn){callbacks.splice(i,1);break}}return this};Emitter.prototype.emit=function(event){this._callbacks=this._callbacks||{};var args=[].slice.call(arguments,1),callbacks=this._callbacks["$"+event];if(callbacks){callbacks=callbacks.slice(0);for(var i=0,len=callbacks.length;i<len;++i){callbacks[i].apply(this,args)}}return this};Emitter.prototype.listeners=function(event){this._callbacks=this._callbacks||{};return this._callbacks["$"+event]||[]};Emitter.prototype.hasListeners=function(event){return!!this.listeners(event).length}},{}],72:[function(require,module,exports){var bind=window.addEventListener?"addEventListener":"attachEvent",unbind=window.removeEventListener?"removeEventListener":"detachEvent",prefix=bind!=="addEventListener"?"on":"";exports.bind=function(el,type,fn,capture){el[bind](prefix+type,fn,capture||false);return fn};exports.unbind=function(el,type,fn,capture){el[unbind](prefix+type,fn,capture||false);return fn}},{}],73:[function(require,module,exports){var globals=/\b(Array|Date|Object|Math|JSON)\b/g;module.exports=function(str,fn){var p=unique(props(str));if(fn&&"string"==typeof fn)fn=prefixed(fn);if(fn)return map(str,p,fn);return p};function props(str){return str.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(globals,"").match(/[a-zA-Z_]\w*/g)||[]}function map(str,props,fn){var re=/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g;return str.replace(re,function(_){if("("==_[_.length-1])return fn(_);if(!~props.indexOf(_))return _;return fn(_)})}function unique(arr){var ret=[];for(var i=0;i<arr.length;i++){if(~ret.indexOf(arr[i]))continue;ret.push(arr[i])}return ret}function prefixed(str){return function(_){return str+_}}},{}],74:[function(require,module,exports){var trim=require("trim");var type=require("type");var pattern=/(\w+)\[(\d+)\]/;var encode=function(str){try{return encodeURIComponent(str)}catch(e){return str}};var decode=function(str){try{return decodeURIComponent(str.replace(/\+/g," "))}catch(e){return str}};exports.parse=function(str){if("string"!=typeof str)return{};str=trim(str);if(""==str)return{};if("?"==str.charAt(0))str=str.slice(1);var obj={};var pairs=str.split("&");for(var i=0;i<pairs.length;i++){var parts=pairs[i].split("=");var key=decode(parts[0]);var m;if(m=pattern.exec(key)){obj[m[1]]=obj[m[1]]||[];obj[m[1]][m[2]]=decode(parts[1]);continue}obj[parts[0]]=null==parts[1]?"":decode(parts[1])}return obj};exports.stringify=function(obj){if(!obj)return"";var pairs=[];for(var key in obj){var value=obj[key];if("array"==type(value)){for(var i=0;i<value.length;++i){pairs.push(encode(key+"["+i+"]")+"="+encode(value[i]))}continue}pairs.push(encode(key)+"="+encode(obj[key]))}return pairs.join("&")}},{trim:116,type:75}],75:[function(require,module,exports){var toString=Object.prototype.toString;module.exports=function(val){switch(toString.call(val)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}if(val===null)return"null";if(val===undefined)return"undefined";if(val!==val)return"nan";if(val&&val.nodeType===1)return"element";val=val.valueOf?val.valueOf():Object.prototype.valueOf.apply(val);return typeof val}},{}],76:[function(require,module,exports){var toString=Object.prototype.toString;module.exports=function(val){switch(toString.call(val)){case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object Error]":return"error"}if(val===null)return"null";if(val===undefined)return"undefined";if(val!==val)return"nan";if(val&&val.nodeType===1)return"element";if(isBuffer(val))return"buffer";val=val.valueOf?val.valueOf():Object.prototype.valueOf.apply(val);return typeof val};function isBuffer(obj){return!!(obj!=null&&(obj._isBuffer||obj.constructor&&typeof obj.constructor.isBuffer==="function"&&obj.constructor.isBuffer(obj)))}},{}],77:[function(require,module,exports){exports.parse=function(url){var a=document.createElement("a");a.href=url;return{href:a.href,host:a.host||location.host,port:"0"===a.port||""===a.port?port(a.protocol):a.port,hash:a.hash,hostname:a.hostname||location.hostname,pathname:a.pathname.charAt(0)!="/"?"/"+a.pathname:a.pathname,protocol:!a.protocol||":"==a.protocol?location.protocol:a.protocol,search:a.search,query:a.search.slice(1)}};exports.isAbsolute=function(url){return 0==url.indexOf("//")||!!~url.indexOf("://")};exports.isRelative=function(url){return!exports.isAbsolute(url)};exports.isCrossDomain=function(url){url=exports.parse(url);var location=exports.parse(window.location.href);return url.hostname!==location.hostname||url.port!==location.port||url.protocol!==location.protocol};function port(protocol){switch(protocol){case"http:":return 80;case"https:":return 443;default:return location.port}}},{}],78:[function(require,module,exports){module.exports=debug;function debug(name){if(!debug.enabled(name))return function(){};return function(fmt){fmt=coerce(fmt);var curr=new Date;var ms=curr-(debug[name]||curr);debug[name]=curr;fmt=name+" "+fmt+" +"+debug.humanize(ms);window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}}debug.names=[];debug.skips=[];debug.enable=function(name){try{localStorage.debug=name}catch(e){}var split=(name||"").split(/[\s,]+/),len=split.length;for(var i=0;i<len;i++){name=split[i].replace("*",".*?");if(name[0]==="-"){debug.skips.push(new RegExp("^"+name.substr(1)+"$"))}else{debug.names.push(new RegExp("^"+name+"$"))}}};debug.disable=function(){debug.enable("")};debug.humanize=function(ms){var sec=1e3,min=60*1e3,hour=60*min;if(ms>=hour)return(ms/hour).toFixed(1)+"h";if(ms>=min)return(ms/min).toFixed(1)+"m";if(ms>=sec)return(ms/sec|0)+"s";return ms+"ms"};debug.enabled=function(name){for(var i=0,len=debug.skips.length;i<len;i++){if(debug.skips[i].test(name)){return false}}for(var i=0,len=debug.names.length;i<len;i++){if(debug.names[i].test(name)){return true}}return false};function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}try{if(window.localStorage)debug.enable(localStorage.debug)}catch(e){}},{}],79:[function(require,module,exports){module.exports=parse;var innerHTMLBug=false;var bugTestDiv;if(typeof document!=="undefined"){bugTestDiv=document.createElement("div");bugTestDiv.innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';innerHTMLBug=!bugTestDiv.getElementsByTagName("link").length;bugTestDiv=undefined}var map={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:innerHTMLBug?[1,"X<div>","</div>"]:[0,"",""]};map.td=map.th=[3,"<table><tbody><tr>","</tr></tbody></table>"];map.option=map.optgroup=[1,'<select multiple="multiple">',"</select>"];map.thead=map.tbody=map.colgroup=map.caption=map.tfoot=[1,"<table>","</table>"];map.polyline=map.ellipse=map.polygon=map.circle=map.text=map.line=map.path=map.rect=map.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function parse(html,doc){if("string"!=typeof html)throw new TypeError("String expected");if(!doc)doc=document;var m=/<([\w:]+)/.exec(html);if(!m)return doc.createTextNode(html);html=html.replace(/^\s+|\s+$/g,"");var tag=m[1];if(tag=="body"){var el=doc.createElement("html");el.innerHTML=html;return el.removeChild(el.lastChild)}var wrap=map[tag]||map._default;var depth=wrap[0];var prefix=wrap[1];var suffix=wrap[2];var el=doc.createElement("div");el.innerHTML=prefix+html+suffix;while(depth--)el=el.lastChild;if(el.firstChild==el.lastChild){return el.removeChild(el.firstChild)}var fragment=doc.createDocumentFragment();while(el.firstChild){fragment.appendChild(el.removeChild(el.firstChild))}return fragment}},{}],80:[function(require,module,exports){var debug=require("debug");module.exports=generate;function generate(name,options){var log=debug("global-queue:"+name);options=options||{};return function(args){args=[].slice.call(arguments);window[name]||(window[name]=[]);log("%o",args);options.wrap===false?window[name].push.apply(window[name],args):window[name].push(args)}}},{debug:81}],81:[function(require,module,exports){arguments[4][35][0].apply(exports,arguments)},{"./debug":82,_process:99,dup:35}],82:[function(require,module,exports){arguments[4][36][0].apply(exports,arguments)},{dup:36,ms:92}],83:[function(require,module,exports){try{module.exports=typeof XMLHttpRequest!=="undefined"&&"withCredentials"in new XMLHttpRequest}catch(err){module.exports=false}},{}],84:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],85:[function(require,module,exports){module.exports=function isEmail(string){return/.+\@.+\..+/.test(string)}},{}],86:[function(require,module,exports){"use strict";var objProto=Object.prototype;var owns=objProto.hasOwnProperty;var toStr=objProto.toString;var symbolValueOf;if(typeof Symbol==="function"){symbolValueOf=Symbol.prototype.valueOf}var isActualNaN=function(value){return value!==value};var NON_HOST_TYPES={boolean:1,number:1,string:1,undefined:1};var base64Regex=/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/;var hexRegex=/^[A-Fa-f0-9]+$/;var is={};is.a=is.type=function(value,type){return typeof value===type};is.defined=function(value){return typeof value!=="undefined"};is.empty=function(value){var type=toStr.call(value);var key;if(type==="[object Array]"||type==="[object Arguments]"||type==="[object String]"){return value.length===0}if(type==="[object Object]"){for(key in value){if(owns.call(value,key)){return false}}return true}return!value};is.equal=function equal(value,other){if(value===other){return true}var type=toStr.call(value);var key;if(type!==toStr.call(other)){return false}if(type==="[object Object]"){for(key in value){if(!is.equal(value[key],other[key])||!(key in other)){return false}}for(key in other){if(!is.equal(value[key],other[key])||!(key in value)){return false}}return true}if(type==="[object Array]"){key=value.length;if(key!==other.length){return false}while(key--){if(!is.equal(value[key],other[key])){return false}}return true}if(type==="[object Function]"){return value.prototype===other.prototype}if(type==="[object Date]"){return value.getTime()===other.getTime()}return false};is.hosted=function(value,host){var type=typeof host[value];return type==="object"?!!host[value]:!NON_HOST_TYPES[type]};is.instance=is["instanceof"]=function(value,constructor){return value instanceof constructor};is.nil=is["null"]=function(value){return value===null};is.undef=is.undefined=function(value){return typeof value==="undefined"};is.args=is.arguments=function(value){var isStandardArguments=toStr.call(value)==="[object Arguments]";var isOldArguments=!is.array(value)&&is.arraylike(value)&&is.object(value)&&is.fn(value.callee);return isStandardArguments||isOldArguments};is.array=Array.isArray||function(value){return toStr.call(value)==="[object Array]"};is.args.empty=function(value){return is.args(value)&&value.length===0};is.array.empty=function(value){return is.array(value)&&value.length===0};is.arraylike=function(value){return!!value&&!is.bool(value)&&owns.call(value,"length")&&isFinite(value.length)&&is.number(value.length)&&value.length>=0};is.bool=is["boolean"]=function(value){return toStr.call(value)==="[object Boolean]"};is["false"]=function(value){return is.bool(value)&&Boolean(Number(value))===false};is["true"]=function(value){return is.bool(value)&&Boolean(Number(value))===true};is.date=function(value){return toStr.call(value)==="[object Date]"};is.date.valid=function(value){return is.date(value)&&!isNaN(Number(value))};is.element=function(value){return value!==undefined&&typeof HTMLElement!=="undefined"&&value instanceof HTMLElement&&value.nodeType===1};is.error=function(value){return toStr.call(value)==="[object Error]"};is.fn=is["function"]=function(value){var isAlert=typeof window!=="undefined"&&value===window.alert;if(isAlert){return true}var str=toStr.call(value);return str==="[object Function]"||str==="[object GeneratorFunction]"||str==="[object AsyncFunction]"};is.number=function(value){return toStr.call(value)==="[object Number]"};is.infinite=function(value){return value===Infinity||value===-Infinity};is.decimal=function(value){return is.number(value)&&!isActualNaN(value)&&!is.infinite(value)&&value%1!==0};is.divisibleBy=function(value,n){var isDividendInfinite=is.infinite(value);var isDivisorInfinite=is.infinite(n);var isNonZeroNumber=is.number(value)&&!isActualNaN(value)&&is.number(n)&&!isActualNaN(n)&&n!==0;return isDividendInfinite||isDivisorInfinite||isNonZeroNumber&&value%n===0};is.integer=is["int"]=function(value){return is.number(value)&&!isActualNaN(value)&&value%1===0};is.maximum=function(value,others){if(isActualNaN(value)){throw new TypeError("NaN is not a valid value")}else if(!is.arraylike(others)){throw new TypeError("second argument must be array-like")}var len=others.length;while(--len>=0){if(value<others[len]){return false}}return true};is.minimum=function(value,others){if(isActualNaN(value)){throw new TypeError("NaN is not a valid value")}else if(!is.arraylike(others)){throw new TypeError("second argument must be array-like")}var len=others.length;while(--len>=0){if(value>others[len]){return false}}return true};is.nan=function(value){return!is.number(value)||value!==value};is.even=function(value){return is.infinite(value)||is.number(value)&&value===value&&value%2===0};is.odd=function(value){return is.infinite(value)||is.number(value)&&value===value&&value%2!==0};is.ge=function(value,other){if(isActualNaN(value)||isActualNaN(other)){throw new TypeError("NaN is not a valid value")}return!is.infinite(value)&&!is.infinite(other)&&value>=other};is.gt=function(value,other){if(isActualNaN(value)||isActualNaN(other)){throw new TypeError("NaN is not a valid value")}return!is.infinite(value)&&!is.infinite(other)&&value>other};is.le=function(value,other){if(isActualNaN(value)||isActualNaN(other)){throw new TypeError("NaN is not a valid value")}return!is.infinite(value)&&!is.infinite(other)&&value<=other};is.lt=function(value,other){if(isActualNaN(value)||isActualNaN(other)){throw new TypeError("NaN is not a valid value")}return!is.infinite(value)&&!is.infinite(other)&&value<other};is.within=function(value,start,finish){if(isActualNaN(value)||isActualNaN(start)||isActualNaN(finish)){throw new TypeError("NaN is not a valid value")}else if(!is.number(value)||!is.number(start)||!is.number(finish)){throw new TypeError("all arguments must be numbers")}var isAnyInfinite=is.infinite(value)||is.infinite(start)||is.infinite(finish);return isAnyInfinite||value>=start&&value<=finish};is.object=function(value){return toStr.call(value)==="[object Object]"};is.primitive=function isPrimitive(value){if(!value){return true}if(typeof value==="object"||is.object(value)||is.fn(value)||is.array(value)){return false}return true};is.hash=function(value){return is.object(value)&&value.constructor===Object&&!value.nodeType&&!value.setInterval};is.regexp=function(value){return toStr.call(value)==="[object RegExp]"};is.string=function(value){return toStr.call(value)==="[object String]"};is.base64=function(value){return is.string(value)&&(!value.length||base64Regex.test(value))};is.hex=function(value){return is.string(value)&&(!value.length||hexRegex.test(value))};is.symbol=function(value){return typeof Symbol==="function"&&toStr.call(value)==="[object Symbol]"&&typeof symbolValueOf.call(value)==="symbol"};module.exports=is},{}],87:[function(require,module,exports){(function(global){(function(){var isLoader=typeof define==="function"&&define.amd;var objectTypes={function:true,object:true};var freeExports=objectTypes[typeof exports]&&exports&&!exports.nodeType&&exports;var root=objectTypes[typeof window]&&window||this,freeGlobal=freeExports&&objectTypes[typeof module]&&module&&!module.nodeType&&typeof global=="object"&&global;if(freeGlobal&&(freeGlobal["global"]===freeGlobal||freeGlobal["window"]===freeGlobal||freeGlobal["self"]===freeGlobal)){root=freeGlobal}function runInContext(context,exports){context||(context=root["Object"]());exports||(exports=root["Object"]());var Number=context["Number"]||root["Number"],String=context["String"]||root["String"],Object=context["Object"]||root["Object"],Date=context["Date"]||root["Date"],SyntaxError=context["SyntaxError"]||root["SyntaxError"],TypeError=context["TypeError"]||root["TypeError"],Math=context["Math"]||root["Math"],nativeJSON=context["JSON"]||root["JSON"];if(typeof nativeJSON=="object"&&nativeJSON){exports.stringify=nativeJSON.stringify;exports.parse=nativeJSON.parse}var objectProto=Object.prototype,getClass=objectProto.toString,isProperty,forEach,undef;var isExtended=new Date(-0xc782b5b800cec);try{isExtended=isExtended.getUTCFullYear()==-109252&&isExtended.getUTCMonth()===0&&isExtended.getUTCDate()===1&&isExtended.getUTCHours()==10&&isExtended.getUTCMinutes()==37&&isExtended.getUTCSeconds()==6&&isExtended.getUTCMilliseconds()==708}catch(exception){}function has(name){if(has[name]!==undef){return has[name]}var isSupported;if(name=="bug-string-char-index"){isSupported="a"[0]!="a"}else if(name=="json"){isSupported=has("json-stringify")&&has("json-parse")}else{var value,serialized='{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}';if(name=="json-stringify"){var stringify=exports.stringify,stringifySupported=typeof stringify=="function"&&isExtended;if(stringifySupported){(value=function(){return 1}).toJSON=value;try{stringifySupported=stringify(0)==="0"&&stringify(new Number)==="0"&&stringify(new String)=='""'&&stringify(getClass)===undef&&stringify(undef)===undef&&stringify()===undef&&stringify(value)==="1"&&stringify([value])=="[1]"&&stringify([undef])=="[null]"&&stringify(null)=="null"&&stringify([undef,getClass,null])=="[null,null,null]"&&stringify({a:[value,true,false,null,"\0\b\n\f\r\t"]})==serialized&&stringify(null,value)==="1"&&stringify([1,2],null,1)=="[\n 1,\n 2\n]"&&stringify(new Date(-864e13))=='"-271821-04-20T00:00:00.000Z"'&&stringify(new Date(864e13))=='"+275760-09-13T00:00:00.000Z"'&&stringify(new Date(-621987552e5))=='"-000001-01-01T00:00:00.000Z"'&&stringify(new Date(-1))=='"1969-12-31T23:59:59.999Z"'}catch(exception){stringifySupported=false}}isSupported=stringifySupported}if(name=="json-parse"){var parse=exports.parse;if(typeof parse=="function"){try{if(parse("0")===0&&!parse(false)){value=parse(serialized);var parseSupported=value["a"].length==5&&value["a"][0]===1;if(parseSupported){try{parseSupported=!parse('"\t"')}catch(exception){}if(parseSupported){try{parseSupported=parse("01")!==1}catch(exception){}}if(parseSupported){try{parseSupported=parse("1.")!==1}catch(exception){}}}}}catch(exception){parseSupported=false}}isSupported=parseSupported}}return has[name]=!!isSupported}if(!has("json")){var functionClass="[object Function]",dateClass="[object Date]",numberClass="[object Number]",stringClass="[object String]",arrayClass="[object Array]",booleanClass="[object Boolean]";var charIndexBuggy=has("bug-string-char-index");if(!isExtended){var floor=Math.floor;var Months=[0,31,59,90,120,151,181,212,243,273,304,334];var getDay=function(year,month){return Months[month]+365*(year-1970)+floor((year-1969+(month=+(month>1)))/4)-floor((year-1901+month)/100)+floor((year-1601+month)/400)}}if(!(isProperty=objectProto.hasOwnProperty)){isProperty=function(property){var members={},constructor;if((members.__proto__=null,members.__proto__={toString:1},members).toString!=getClass){isProperty=function(property){var original=this.__proto__,result=property in(this.__proto__=null,this);this.__proto__=original;return result}}else{constructor=members.constructor;isProperty=function(property){var parent=(this.constructor||constructor).prototype;return property in this&&!(property in parent&&this[property]===parent[property])}}members=null;return isProperty.call(this,property)}}forEach=function(object,callback){var size=0,Properties,members,property;(Properties=function(){this.valueOf=0}).prototype.valueOf=0;members=new Properties;for(property in members){if(isProperty.call(members,property)){size++}}Properties=members=null;if(!size){members=["valueOf","toString","toLocaleString","propertyIsEnumerable","isPrototypeOf","hasOwnProperty","constructor"];forEach=function(object,callback){var isFunction=getClass.call(object)==functionClass,property,length;var hasProperty=!isFunction&&typeof object.constructor!="function"&&objectTypes[typeof object.hasOwnProperty]&&object.hasOwnProperty||isProperty;for(property in object){if(!(isFunction&&property=="prototype")&&hasProperty.call(object,property)){callback(property)}}for(length=members.length;property=members[--length];hasProperty.call(object,property)&&callback(property));}}else if(size==2){forEach=function(object,callback){var members={},isFunction=getClass.call(object)==functionClass,property;for(property in object){if(!(isFunction&&property=="prototype")&&!isProperty.call(members,property)&&(members[property]=1)&&isProperty.call(object,property)){callback(property)}}}}else{forEach=function(object,callback){var isFunction=getClass.call(object)==functionClass,property,isConstructor;for(property in object){if(!(isFunction&&property=="prototype")&&isProperty.call(object,property)&&!(isConstructor=property==="constructor")){callback(property)}}if(isConstructor||isProperty.call(object,property="constructor")){callback(property)}}}return forEach(object,callback)};if(!has("json-stringify")){var Escapes={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"};var leadingZeroes="000000";var toPaddedString=function(width,value){return(leadingZeroes+(value||0)).slice(-width)};var unicodePrefix="\\u00";var quote=function(value){var result='"',index=0,length=value.length,useCharIndex=!charIndexBuggy||length>10;var symbols=useCharIndex&&(charIndexBuggy?value.split(""):value);for(;index<length;index++){var charCode=value.charCodeAt(index);switch(charCode){case 8:case 9:case 10:case 12:case 13:case 34:case 92:result+=Escapes[charCode];break;default:if(charCode<32){result+=unicodePrefix+toPaddedString(2,charCode.toString(16));break}result+=useCharIndex?symbols[index]:value.charAt(index)}}return result+'"'};var serialize=function(property,object,callback,properties,whitespace,indentation,stack){var value,className,year,month,date,time,hours,minutes,seconds,milliseconds,results,element,index,length,prefix,result;try{value=object[property]}catch(exception){}if(typeof value=="object"&&value){className=getClass.call(value);if(className==dateClass&&!isProperty.call(value,"toJSON")){if(value>-1/0&&value<1/0){if(getDay){date=floor(value/864e5);for(year=floor(date/365.2425)+1970-1;getDay(year+1,0)<=date;year++);for(month=floor((date-getDay(year,0))/30.42);getDay(year,month+1)<=date;month++);date=1+date-getDay(year,month);time=(value%864e5+864e5)%864e5;hours=floor(time/36e5)%24;minutes=floor(time/6e4)%60;seconds=floor(time/1e3)%60;milliseconds=time%1e3}else{year=value.getUTCFullYear();month=value.getUTCMonth();date=value.getUTCDate();hours=value.getUTCHours();minutes=value.getUTCMinutes();seconds=value.getUTCSeconds();milliseconds=value.getUTCMilliseconds()}value=(year<=0||year>=1e4?(year<0?"-":"+")+toPaddedString(6,year<0?-year:year):toPaddedString(4,year))+"-"+toPaddedString(2,month+1)+"-"+toPaddedString(2,date)+"T"+toPaddedString(2,hours)+":"+toPaddedString(2,minutes)+":"+toPaddedString(2,seconds)+"."+toPaddedString(3,milliseconds)+"Z"}else{value=null}}else if(typeof value.toJSON=="function"&&(className!=numberClass&&className!=stringClass&&className!=arrayClass||isProperty.call(value,"toJSON"))){value=value.toJSON(property)}}if(callback){value=callback.call(object,property,value)}if(value===null){return"null"}className=getClass.call(value);if(className==booleanClass){return""+value}else if(className==numberClass){return value>-1/0&&value<1/0?""+value:"null"}else if(className==stringClass){return quote(""+value)}if(typeof value=="object"){for(length=stack.length;length--;){if(stack[length]===value){throw TypeError()}}stack.push(value);results=[];prefix=indentation;indentation+=whitespace;if(className==arrayClass){for(index=0,length=value.length;index<length;index++){element=serialize(index,value,callback,properties,whitespace,indentation,stack);results.push(element===undef?"null":element)}result=results.length?whitespace?"[\n"+indentation+results.join(",\n"+indentation)+"\n"+prefix+"]":"["+results.join(",")+"]":"[]"}else{forEach(properties||value,function(property){var element=serialize(property,value,callback,properties,whitespace,indentation,stack);if(element!==undef){results.push(quote(property)+":"+(whitespace?" ":"")+element)}});result=results.length?whitespace?"{\n"+indentation+results.join(",\n"+indentation)+"\n"+prefix+"}":"{"+results.join(",")+"}":"{}"}stack.pop();return result}};exports.stringify=function(source,filter,width){var whitespace,callback,properties,className;if(objectTypes[typeof filter]&&filter){if((className=getClass.call(filter))==functionClass){callback=filter}else if(className==arrayClass){properties={};for(var index=0,length=filter.length,value;index<length;value=filter[index++],(className=getClass.call(value),className==stringClass||className==numberClass)&&(properties[value]=1));}}if(width){if((className=getClass.call(width))==numberClass){if((width-=width%1)>0){for(whitespace="",width>10&&(width=10);whitespace.length<width;whitespace+=" ");}}else if(className==stringClass){whitespace=width.length<=10?width:width.slice(0,10)}}return serialize("",(value={},value[""]=source,value),callback,properties,whitespace,"",[])}}if(!has("json-parse")){var fromCharCode=String.fromCharCode;var Unescapes={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"};var Index,Source;var abort=function(){Index=Source=null;throw SyntaxError()};var lex=function(){var source=Source,length=source.length,value,begin,position,isSigned,charCode;while(Index<length){charCode=source.charCodeAt(Index);switch(charCode){case 9:case 10:case 13:case 32:Index++;break;case 123:case 125:case 91:case 93:case 58:case 44:value=charIndexBuggy?source.charAt(Index):source[Index];Index++;return value;case 34:for(value="@",Index++;Index<length;){charCode=source.charCodeAt(Index);if(charCode<32){abort()}else if(charCode==92){charCode=source.charCodeAt(++Index);switch(charCode){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:value+=Unescapes[charCode];Index++;break;case 117:begin=++Index;for(position=Index+4;Index<position;Index++){charCode=source.charCodeAt(Index);if(!(charCode>=48&&charCode<=57||charCode>=97&&charCode<=102||charCode>=65&&charCode<=70)){abort()}}value+=fromCharCode("0x"+source.slice(begin,Index));break;default:abort()}}else{if(charCode==34){break}charCode=source.charCodeAt(Index);begin=Index;while(charCode>=32&&charCode!=92&&charCode!=34){charCode=source.charCodeAt(++Index)}value+=source.slice(begin,Index)}}if(source.charCodeAt(Index)==34){Index++;return value}abort();default:begin=Index;if(charCode==45){isSigned=true;charCode=source.charCodeAt(++Index)}if(charCode>=48&&charCode<=57){if(charCode==48&&(charCode=source.charCodeAt(Index+1),charCode>=48&&charCode<=57)){abort()}isSigned=false;for(;Index<length&&(charCode=source.charCodeAt(Index),charCode>=48&&charCode<=57);Index++);if(source.charCodeAt(Index)==46){position=++Index;for(;position<length&&(charCode=source.charCodeAt(position),charCode>=48&&charCode<=57);position++);if(position==Index){abort()}Index=position}charCode=source.charCodeAt(Index);if(charCode==101||charCode==69){charCode=source.charCodeAt(++Index);if(charCode==43||charCode==45){Index++}for(position=Index;position<length&&(charCode=source.charCodeAt(position),charCode>=48&&charCode<=57);position++);if(position==Index){abort()}Index=position}return+source.slice(begin,Index)}if(isSigned){abort()}if(source.slice(Index,Index+4)=="true"){Index+=4;return true}else if(source.slice(Index,Index+5)=="false"){Index+=5;return false}else if(source.slice(Index,Index+4)=="null"){Index+=4;return null}abort()}}return"$"};var get=function(value){var results,hasMembers;if(value=="$"){abort()}if(typeof value=="string"){if((charIndexBuggy?value.charAt(0):value[0])=="@"){return value.slice(1)}if(value=="["){results=[];for(;;hasMembers||(hasMembers=true)){value=lex();if(value=="]"){break}if(hasMembers){if(value==","){value=lex();if(value=="]"){abort()}}else{abort()}}if(value==","){abort()}results.push(get(value))}return results}else if(value=="{"){results={};for(;;hasMembers||(hasMembers=true)){value=lex();if(value=="}"){break}if(hasMembers){if(value==","){value=lex();if(value=="}"){abort()}}else{abort()}}if(value==","||typeof value!="string"||(charIndexBuggy?value.charAt(0):value[0])!="@"||lex()!=":"){abort()}results[value.slice(1)]=get(lex())}return results}abort()}return value};var update=function(source,property,callback){var element=walk(source,property,callback);if(element===undef){delete source[property]}else{source[property]=element}};var walk=function(source,property,callback){var value=source[property],length;if(typeof value=="object"&&value){if(getClass.call(value)==arrayClass){for(length=value.length;length--;){update(value,length,callback)}}else{forEach(value,function(property){update(value,property,callback)})}}return callback.call(source,property,value)};exports.parse=function(source,callback){var result,value;Index=0;Source=""+source;result=get(lex());if(lex()!="$"){abort()}Index=Source=null;return callback&&getClass.call(callback)==functionClass?walk((value={},value[""]=result,value),"",callback):result}}}exports["runInContext"]=runInContext;return exports}if(freeExports&&!isLoader){runInContext(root,freeExports)}else{var nativeJSON=root.JSON,previousJSON=root["JSON3"],isRestored=false;var JSON3=runInContext(root,root["JSON3"]={noConflict:function(){if(!isRestored){isRestored=true;root.JSON=nativeJSON;root["JSON3"]=previousJSON;nativeJSON=previousJSON=null}return JSON3}});root.JSON={parse:JSON3.parse,stringify:JSON3.stringify}}if(isLoader){define(function(){return JSON3})}}).call(this)}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],88:[function(require,module,exports){var debug=require("debug")("jsonp");module.exports=jsonp;var count=0;function noop(){}function jsonp(url,opts,fn){
if("function"==typeof opts){fn=opts;opts={}}if(!opts)opts={};var prefix=opts.prefix||"__jp";var id=opts.name||prefix+count++;var param=opts.param||"callback";var timeout=null!=opts.timeout?opts.timeout:6e4;var enc=encodeURIComponent;var target=document.getElementsByTagName("script")[0]||document.head;var script;var timer;if(timeout){timer=setTimeout(function(){cleanup();if(fn)fn(new Error("Timeout"))},timeout)}function cleanup(){if(script.parentNode)script.parentNode.removeChild(script);window[id]=noop;if(timer)clearTimeout(timer)}function cancel(){if(window[id]){cleanup()}}window[id]=function(data){debug("jsonp got",data);cleanup();if(fn)fn(null,data)};url+=(~url.indexOf("?")?"&":"?")+param+"="+enc(id);url=url.replace("?&","?");debug('jsonp req "%s"',url);script=document.createElement("script");script.src=url;target.parentNode.insertBefore(script,target);return cancel}},{debug:89}],89:[function(require,module,exports){arguments[4][35][0].apply(exports,arguments)},{"./debug":90,_process:99,dup:35}],90:[function(require,module,exports){arguments[4][36][0].apply(exports,arguments)},{dup:36,ms:92}],91:[function(require,module,exports){var is=require("is");var onload=require("script-onload");var tick=require("next-tick");module.exports=function loadIframe(options,fn){if(!options)throw new Error("Cant load nothing...");if(is.string(options))options={src:options};var https=document.location.protocol==="https:"||document.location.protocol==="chrome-extension:";if(options.src&&options.src.indexOf("//")===0){options.src=https?"https:"+options.src:"http:"+options.src}if(https&&options.https)options.src=options.https;else if(!https&&options.http)options.src=options.http;var iframe=document.createElement("iframe");iframe.src=options.src;iframe.width=options.width||1;iframe.height=options.height||1;iframe.style.display="none";if(is.fn(fn)){onload(iframe,fn)}tick(function(){var firstScript=document.getElementsByTagName("script")[0];firstScript.parentNode.insertBefore(iframe,firstScript)});return iframe}},{is:86,"next-tick":97,"script-onload":100}],92:[function(require,module,exports){var s=1e3;var m=s*60;var h=m*60;var d=h*24;var y=d*365.25;module.exports=function(val,options){options=options||{};var type=typeof val;if(type==="string"&&val.length>0){return parse(val)}else if(type==="number"&&isNaN(val)===false){return options.long?fmtLong(val):fmtShort(val)}throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(val))};function parse(str){str=String(str);if(str.length>100){return}var match=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str);if(!match){return}var n=parseFloat(match[1]);var type=(match[2]||"ms").toLowerCase();switch(type){case"years":case"year":case"yrs":case"yr":case"y":return n*y;case"days":case"day":case"d":return n*d;case"hours":case"hour":case"hrs":case"hr":case"h":return n*h;case"minutes":case"minute":case"mins":case"min":case"m":return n*m;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return undefined}}function fmtShort(ms){if(ms>=d){return Math.round(ms/d)+"d"}if(ms>=h){return Math.round(ms/h)+"h"}if(ms>=m){return Math.round(ms/m)+"m"}if(ms>=s){return Math.round(ms/s)+"s"}return ms+"ms"}function fmtLong(ms){return plural(ms,d,"day")||plural(ms,h,"hour")||plural(ms,m,"minute")||plural(ms,s,"second")||ms+" ms"}function plural(ms,n,name){if(ms<n){return}if(ms<n*1.5){return Math.floor(ms/n)+" "+name}return Math.ceil(ms/n)+" "+name+"s"}},{}],93:[function(require,module,exports){"use strict";var is=require("is");var isodate=require("@segment/isodate");var milliseconds=require("./milliseconds");var seconds=require("./seconds");module.exports=function newDate(val){if(is.date(val))return val;if(is.number(val))return new Date(toMs(val));if(isodate.is(val)){return isodate.parse(val)}if(milliseconds.is(val)){return milliseconds.parse(val)}if(seconds.is(val)){return seconds.parse(val)}return new Date(val)};function toMs(num){if(num<315576e5)return num*1e3;return num}},{"./milliseconds":94,"./seconds":95,"@segment/isodate":96,is:86}],94:[function(require,module,exports){"use strict";var matcher=/\d{13}/;exports.is=function(string){return matcher.test(string)};exports.parse=function(millis){millis=parseInt(millis,10);return new Date(millis)}},{}],95:[function(require,module,exports){"use strict";var matcher=/\d{10}/;exports.is=function(string){return matcher.test(string)};exports.parse=function(seconds){var millis=parseInt(seconds,10)*1e3;return new Date(millis)}},{}],96:[function(require,module,exports){"use strict";var matcher=/^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/;exports.parse=function(iso){var numericKeys=[1,5,6,7,11,12];var arr=matcher.exec(iso);var offset=0;if(!arr){return new Date(iso)}for(var i=0,val;val=numericKeys[i];i++){arr[val]=parseInt(arr[val],10)||0}arr[2]=parseInt(arr[2],10)||1;arr[3]=parseInt(arr[3],10)||1;arr[2]--;arr[8]=arr[8]?(arr[8]+"00").substring(0,3):0;if(arr[4]===" "){offset=(new Date).getTimezoneOffset()}else if(arr[9]!=="Z"&&arr[10]){offset=arr[11]*60+arr[12];if(arr[10]==="+"){offset=0-offset}}var millis=Date.UTC(arr[1],arr[2],arr[3],arr[5],arr[6]+offset,arr[7],arr[8]);return new Date(millis)};exports.is=function(string,strict){if(strict&&/^\d{4}-\d{2}-\d{2}/.test(string)===false){return false}return matcher.test(string)}},{}],97:[function(require,module,exports){(function(process){"use strict";var callable,byObserver;callable=function(fn){if(typeof fn!=="function")throw new TypeError(fn+" is not a function");return fn};byObserver=function(Observer){var node=document.createTextNode(""),queue,i=0;new Observer(function(){var data;if(!queue)return;data=queue;queue=null;if(typeof data==="function"){data();return}data.forEach(function(fn){fn()})}).observe(node,{characterData:true});return function(fn){callable(fn);if(queue){if(typeof queue==="function")queue=[queue,fn];else queue.push(fn);return}queue=fn;node.data=i=++i%2}};module.exports=function(){if(typeof process!=="undefined"&&process&&typeof process.nextTick==="function"){return process.nextTick}if(typeof document==="object"&&document){if(typeof MutationObserver==="function"){return byObserver(MutationObserver)}if(typeof WebKitMutationObserver==="function"){return byObserver(WebKitMutationObserver)}}if(typeof setImmediate==="function"){return function(cb){setImmediate(callable(cb))}}if(typeof setTimeout==="function"){return function(cb){setTimeout(callable(cb),0)}}return null}()}).call(this,require("_process"))},{_process:99}],98:[function(require,module,exports){var identity=function(_){return _};module.exports=multiple(find);module.exports.find=module.exports;module.exports.replace=function(obj,key,val,options){multiple(replace).call(this,obj,key,val,options);return obj};module.exports.del=function(obj,key,options){multiple(del).call(this,obj,key,null,options);return obj};function multiple(fn){return function(obj,path,val,options){normalize=options&&isFunction(options.normalizer)?options.normalizer:defaultNormalize;path=normalize(path);var key;var finished=false;while(!finished)loop();function loop(){for(key in obj){var normalizedKey=normalize(key);if(0===path.indexOf(normalizedKey)){var temp=path.substr(normalizedKey.length);if(temp.charAt(0)==="."||temp.length===0){path=temp.substr(1);var child=obj[key];if(null==child){finished=true;return}if(!path.length){finished=true;return}obj=child;return}}}key=undefined;finished=true}if(!key)return;if(null==obj)return obj;return fn(obj,key,val)}}function find(obj,key){if(obj.hasOwnProperty(key))return obj[key]}function del(obj,key){if(obj.hasOwnProperty(key))delete obj[key];return obj}function replace(obj,key,val){if(obj.hasOwnProperty(key))obj[key]=val;return obj}function defaultNormalize(path){return path.replace(/[^a-zA-Z0-9\.]+/g,"").toLowerCase()}function isFunction(val){return typeof val==="function"}},{}],99:[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}},{}],100:[function(require,module,exports){module.exports=function(el,fn){return el.addEventListener?add(el,fn):attach(el,fn)};function add(el,fn){el.addEventListener("load",function(_,e){fn(null,e)},false);el.addEventListener("error",function(e){var err=new Error('script error "'+el.src+'"');err.event=e;fn(err)},false)}function attach(el,fn){el.attachEvent("onreadystatechange",function(e){if(!/complete|loaded/.test(el.readyState))return;fn(null,e)});el.attachEvent("onerror",function(e){var err=new Error('failed to load the script "'+el.src+'"');err.event=e||window.event;fn(err)})}},{}],101:[function(require,module,exports){"use strict";var get=require("obj-case");module.exports=function(proto){proto.zip=trait("postalCode","zip");proto.country=trait("country");proto.street=trait("street");proto.state=trait("state");proto.city=trait("city");proto.region=trait("region");function trait(a,b){return function(){var traits=this.traits();var props=this.properties?this.properties():{};return get(traits,"address."+a)||get(traits,a)||(b?get(traits,"address."+b):null)||(b?get(traits,b):null)||get(props,"address."+a)||get(props,a)||(b?get(props,"address."+b):null)||(b?get(props,b):null)}}}},{"obj-case":98}],102:[function(require,module,exports){"use strict";var inherit=require("./utils").inherit;var Facade=require("./facade");function Alias(dictionary,opts){Facade.call(this,dictionary,opts)}inherit(Alias,Facade);Alias.prototype.action=function(){return"alias"};Alias.prototype.type=Alias.prototype.action;Alias.prototype.previousId=function(){return this.field("previousId")||this.field("from")};Alias.prototype.from=Alias.prototype.previousId;Alias.prototype.userId=function(){return this.field("userId")||this.field("to")};Alias.prototype.to=Alias.prototype.userId;module.exports=Alias},{"./facade":103,"./utils":111}],103:[function(require,module,exports){"use strict";var address=require("./address");var clone=require("./utils").clone;var isEnabled=require("./is-enabled");var newDate=require("new-date");var objCase=require("obj-case");var traverse=require("@segment/isodate-traverse");var type=require("./utils").type;function Facade(obj,opts){opts=opts||{};if(!("clone"in opts))opts.clone=true;if(opts.clone)obj=clone(obj);if(!("traverse"in opts))opts.traverse=true;if(!("timestamp"in obj))obj.timestamp=new Date;else obj.timestamp=newDate(obj.timestamp);if(opts.traverse)traverse(obj);this.opts=opts;this.obj=obj}address(Facade.prototype);Facade.prototype.proxy=function(field){var fields=field.split(".");field=fields.shift();var obj=this[field]||this.field(field);if(!obj)return obj;if(typeof obj==="function")obj=obj.call(this)||{};if(fields.length===0)return this.opts.clone?transform(obj):obj;obj=objCase(obj,fields.join("."));return this.opts.clone?transform(obj):obj};Facade.prototype.field=function(field){var obj=this.obj[field];return this.opts.clone?transform(obj):obj};Facade.proxy=function(field){return function(){return this.proxy(field)}};Facade.field=function(field){return function(){return this.field(field)}};Facade.multi=function(path){return function(){var multi=this.proxy(path+"s");if(type(multi)==="array")return multi;var one=this.proxy(path);if(one)one=[this.opts.clone?clone(one):one];return one||[]}};Facade.one=function(path){return function(){var one=this.proxy(path);if(one)return one;var multi=this.proxy(path+"s");if(type(multi)==="array")return multi[0]}};Facade.prototype.json=function(){var ret=this.opts.clone?clone(this.obj):this.obj;if(this.type)ret.type=this.type();return ret};Facade.prototype.options=function(integration){var obj=this.obj.options||this.obj.context||{};var options=this.opts.clone?clone(obj):obj;if(!integration)return options;if(!this.enabled(integration))return;var integrations=this.integrations();var value=integrations[integration]||objCase(integrations,integration);if(typeof value!=="object")value=objCase(this.options(),integration);return typeof value==="object"?value:{}};Facade.prototype.context=Facade.prototype.options;Facade.prototype.enabled=function(integration){var allEnabled=this.proxy("options.providers.all");if(typeof allEnabled!=="boolean")allEnabled=this.proxy("options.all");if(typeof allEnabled!=="boolean")allEnabled=this.proxy("integrations.all");if(typeof allEnabled!=="boolean")allEnabled=true;var enabled=allEnabled&&isEnabled(integration);var options=this.integrations();if(options.providers&&options.providers.hasOwnProperty(integration)){enabled=options.providers[integration]}if(options.hasOwnProperty(integration)){var settings=options[integration];if(typeof settings==="boolean"){enabled=settings}else{enabled=true}}return!!enabled};Facade.prototype.integrations=function(){return this.obj.integrations||this.proxy("options.providers")||this.options()};Facade.prototype.active=function(){var active=this.proxy("options.active");if(active===null||active===undefined)active=true;return active};Facade.prototype.anonymousId=function(){return this.field("anonymousId")||this.field("sessionId")};Facade.prototype.sessionId=Facade.prototype.anonymousId;Facade.prototype.groupId=Facade.proxy("options.groupId");Facade.prototype.traits=function(aliases){var ret=this.proxy("options.traits")||{};var id=this.userId();aliases=aliases||{};if(id)ret.id=id;for(var alias in aliases){var value=this[alias]==null?this.proxy("options.traits."+alias):this[alias]();if(value==null)continue;ret[aliases[alias]]=value;delete ret[alias]}return ret};Facade.prototype.library=function(){var library=this.proxy("options.library");if(!library)return{name:"unknown",version:null};if(typeof library==="string")return{name:library,version:null};return library};Facade.prototype.device=function(){var device=this.proxy("context.device");if(type(device)!=="object")device={};var library=this.library().name;if(device.type)return device;if(library.indexOf("ios")>-1)device.type="ios";if(library.indexOf("android")>-1)device.type="android";return device};Facade.prototype.userAgent=Facade.proxy("context.userAgent");Facade.prototype.timezone=Facade.proxy("context.timezone");Facade.prototype.timestamp=Facade.field("timestamp");Facade.prototype.channel=Facade.field("channel");Facade.prototype.ip=Facade.proxy("context.ip");Facade.prototype.userId=Facade.field("userId");function transform(obj){return clone(obj)}module.exports=Facade},{"./address":101,"./is-enabled":107,"./utils":111,"@segment/isodate-traverse":46,"new-date":93,"obj-case":98}],104:[function(require,module,exports){"use strict";var inherit=require("./utils").inherit;var isEmail=require("is-email");var newDate=require("new-date");var Facade=require("./facade");function Group(dictionary,opts){Facade.call(this,dictionary,opts)}inherit(Group,Facade);Group.prototype.action=function(){return"group"};Group.prototype.type=Group.prototype.action;Group.prototype.groupId=Facade.field("groupId");Group.prototype.created=function(){var created=this.proxy("traits.createdAt")||this.proxy("traits.created")||this.proxy("properties.createdAt")||this.proxy("properties.created");if(created)return newDate(created)};Group.prototype.email=function(){var email=this.proxy("traits.email");if(email)return email;var groupId=this.groupId();if(isEmail(groupId))return groupId};Group.prototype.traits=function(aliases){var ret=this.properties();var id=this.groupId();aliases=aliases||{};if(id)ret.id=id;for(var alias in aliases){var value=this[alias]==null?this.proxy("traits."+alias):this[alias]();if(value==null)continue;ret[aliases[alias]]=value;delete ret[alias]}return ret};Group.prototype.name=Facade.proxy("traits.name");Group.prototype.industry=Facade.proxy("traits.industry");Group.prototype.employees=Facade.proxy("traits.employees");Group.prototype.properties=function(){return this.field("traits")||this.field("properties")||{}};module.exports=Group},{"./facade":103,"./utils":111,"is-email":85,"new-date":93}],105:[function(require,module,exports){"use strict";var Facade=require("./facade");var get=require("obj-case");var inherit=require("./utils").inherit;var isEmail=require("is-email");var newDate=require("new-date");var trim=require("trim");var type=require("./utils").type;function Identify(dictionary,opts){Facade.call(this,dictionary,opts)}inherit(Identify,Facade);Identify.prototype.action=function(){return"identify"};Identify.prototype.type=Identify.prototype.action;Identify.prototype.traits=function(aliases){var ret=this.field("traits")||{};var id=this.userId();aliases=aliases||{};if(id)ret.id=id;for(var alias in aliases){var value=this[alias]==null?this.proxy("traits."+alias):this[alias]();if(value==null)continue;ret[aliases[alias]]=value;if(alias!==aliases[alias])delete ret[alias]}return ret};Identify.prototype.email=function(){var email=this.proxy("traits.email");if(email)return email;var userId=this.userId();if(isEmail(userId))return userId};Identify.prototype.created=function(){var created=this.proxy("traits.created")||this.proxy("traits.createdAt");if(created)return newDate(created)};Identify.prototype.companyCreated=function(){var created=this.proxy("traits.company.created")||this.proxy("traits.company.createdAt");if(created){return newDate(created)}};Identify.prototype.companyName=function(){return this.proxy("traits.company.name")};Identify.prototype.name=function(){var name=this.proxy("traits.name");if(typeof name==="string"){return trim(name)}var firstName=this.firstName();var lastName=this.lastName();if(firstName&&lastName){return trim(firstName+" "+lastName)}};Identify.prototype.firstName=function(){var firstName=this.proxy("traits.firstName");if(typeof firstName==="string"){return trim(firstName)}var name=this.proxy("traits.name");if(typeof name==="string"){return trim(name).split(" ")[0]}};Identify.prototype.lastName=function(){var lastName=this.proxy("traits.lastName");if(typeof lastName==="string"){return trim(lastName)}var name=this.proxy("traits.name");if(typeof name!=="string"){return}var space=trim(name).indexOf(" ");if(space===-1){return}return trim(name.substr(space+1))};Identify.prototype.uid=function(){return this.userId()||this.username()||this.email()};Identify.prototype.description=function(){return this.proxy("traits.description")||this.proxy("traits.background")};Identify.prototype.age=function(){var date=this.birthday();var age=get(this.traits(),"age");if(age!=null)return age;if(type(date)!=="date")return;var now=new Date;return now.getFullYear()-date.getFullYear()};Identify.prototype.avatar=function(){var traits=this.traits();return get(traits,"avatar")||get(traits,"photoUrl")||get(traits,"avatarUrl")};Identify.prototype.position=function(){var traits=this.traits();return get(traits,"position")||get(traits,"jobTitle")};Identify.prototype.username=Facade.proxy("traits.username");Identify.prototype.website=Facade.one("traits.website");Identify.prototype.websites=Facade.multi("traits.website");Identify.prototype.phone=Facade.one("traits.phone");Identify.prototype.phones=Facade.multi("traits.phone");Identify.prototype.address=Facade.proxy("traits.address");Identify.prototype.gender=Facade.proxy("traits.gender");Identify.prototype.birthday=Facade.proxy("traits.birthday");module.exports=Identify},{"./facade":103,"./utils":111,"is-email":85,"new-date":93,"obj-case":98,trim:116}],106:[function(require,module,exports){"use strict";var Facade=require("./facade");Facade.Alias=require("./alias");Facade.Group=require("./group");Facade.Identify=require("./identify");Facade.Track=require("./track");Facade.Page=require("./page");Facade.Screen=require("./screen");module.exports=Facade},{"./alias":102,"./facade":103,"./group":104,"./identify":105,"./page":108,"./screen":109,"./track":110}],107:[function(require,module,exports){"use strict";var disabled={Salesforce:true};module.exports=function(integration){return!disabled[integration]}},{}],108:[function(require,module,exports){"use strict";var inherit=require("./utils").inherit;var Facade=require("./facade");var Track=require("./track");var isEmail=require("is-email");function Page(dictionary,opts){Facade.call(this,dictionary,opts)}inherit(Page,Facade);Page.prototype.action=function(){return"page"};Page.prototype.type=Page.prototype.action;Page.prototype.category=Facade.field("category");Page.prototype.name=Facade.field("name");Page.prototype.title=Facade.proxy("properties.title");Page.prototype.path=Facade.proxy("properties.path");Page.prototype.url=Facade.proxy("properties.url");Page.prototype.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")};Page.prototype.properties=function(aliases){var props=this.field("properties")||{};var category=this.category();var name=this.name();aliases=aliases||{};if(category)props.category=category;if(name)props.name=name;for(var alias in aliases){var value=this[alias]==null?this.proxy("properties."+alias):this[alias]();if(value==null)continue;props[aliases[alias]]=value;if(alias!==aliases[alias])delete props[alias]}return props};Page.prototype.email=function(){var email=this.proxy("context.traits.email")||this.proxy("properties.email");if(email)return email;var userId=this.userId();if(isEmail(userId))return userId};Page.prototype.fullName=function(){var category=this.category();var name=this.name();return name&&category?category+" "+name:name};Page.prototype.event=function(name){return name?"Viewed "+name+" Page":"Loaded a Page"};Page.prototype.track=function(name){var json=this.json();json.event=this.event(name);json.timestamp=this.timestamp();json.properties=this.properties();return new Track(json,this.opts)};module.exports=Page},{"./facade":103,"./track":110,"./utils":111,"is-email":85}],109:[function(require,module,exports){"use strict";var inherit=require("./utils").inherit;var Page=require("./page");var Track=require("./track");function Screen(dictionary,opts){Page.call(this,dictionary,opts)}inherit(Screen,Page);Screen.prototype.action=function(){return"screen"};Screen.prototype.type=Screen.prototype.action;Screen.prototype.event=function(name){return name?"Viewed "+name+" Screen":"Loaded a Screen"};Screen.prototype.track=function(name){var json=this.json();json.event=this.event(name);json.timestamp=this.timestamp();json.properties=this.properties();return new Track(json,this.opts)};module.exports=Screen},{"./page":108,"./track":110,"./utils":111}],110:[function(require,module,exports){"use strict";var inherit=require("./utils").inherit;var type=require("./utils").type;var Facade=require("./facade");var Identify=require("./identify");var isEmail=require("is-email");var get=require("obj-case");function Track(dictionary,opts){Facade.call(this,dictionary,opts)}inherit(Track,Facade);Track.prototype.action=function(){return"track"};Track.prototype.type=Track.prototype.action;Track.prototype.event=Facade.field("event");Track.prototype.value=Facade.proxy("properties.value");Track.prototype.category=Facade.proxy("properties.category");Track.prototype.id=Facade.proxy("properties.id");Track.prototype.productId=function(){return this.proxy("properties.product_id")||this.proxy("properties.productId")};Track.prototype.promotionId=function(){return this.proxy("properties.promotion_id")||this.proxy("properties.promotionId")};Track.prototype.cartId=function(){return this.proxy("properties.cart_id")||this.proxy("properties.cartId")};Track.prototype.checkoutId=function(){return this.proxy("properties.checkout_id")||this.proxy("properties.checkoutId")};Track.prototype.paymentId=function(){return this.proxy("properties.payment_id")||this.proxy("properties.paymentId")};Track.prototype.couponId=function(){return this.proxy("properties.coupon_id")||this.proxy("properties.couponId")};Track.prototype.wishlistId=function(){return this.proxy("properties.wishlist_id")||this.proxy("properties.wishlistId")};Track.prototype.reviewId=function(){return this.proxy("properties.review_id")||this.proxy("properties.reviewId")};Track.prototype.orderId=function(){return this.proxy("properties.id")||this.proxy("properties.order_id")||this.proxy("properties.orderId")};Track.prototype.sku=Facade.proxy("properties.sku");Track.prototype.tax=Facade.proxy("properties.tax");Track.prototype.name=Facade.proxy("properties.name");Track.prototype.price=Facade.proxy("properties.price");Track.prototype.total=Facade.proxy("properties.total");Track.prototype.repeat=Facade.proxy("properties.repeat");Track.prototype.coupon=Facade.proxy("properties.coupon");Track.prototype.shipping=Facade.proxy("properties.shipping");Track.prototype.discount=Facade.proxy("properties.discount");Track.prototype.shippingMethod=function(){return this.proxy("properties.shipping_method")||this.proxy("properties.shippingMethod")};Track.prototype.paymentMethod=function(){return this.proxy("properties.payment_method")||this.proxy("properties.paymentMethod")};Track.prototype.description=Facade.proxy("properties.description");Track.prototype.plan=Facade.proxy("properties.plan");Track.prototype.subtotal=function(){var subtotal=get(this.properties(),"subtotal");var total=this.total()||this.revenue();if(subtotal)return subtotal;if(!total)return 0;if(this.total()){var n=this.tax();if(n)total-=n;n=this.shipping();if(n)total-=n;n=this.discount();if(n)total+=n}return total};Track.prototype.products=function(){var props=this.properties();var products=get(props,"products");return type(products)==="array"?products:[]};Track.prototype.quantity=function(){var props=this.obj.properties||{};return props.quantity||1};Track.prototype.currency=function(){var props=this.obj.properties||{};return props.currency||"USD"};Track.prototype.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")};Track.prototype.query=Facade.proxy("options.query");Track.prototype.properties=function(aliases){var ret=this.field("properties")||{};aliases=aliases||{};for(var alias in aliases){var value=this[alias]==null?this.proxy("properties."+alias):this[alias]();if(value==null)continue;ret[aliases[alias]]=value;delete ret[alias]}return ret};Track.prototype.username=function(){return this.proxy("traits.username")||this.proxy("properties.username")||this.userId()||this.sessionId()};Track.prototype.email=function(){var email=this.proxy("traits.email")||this.proxy("properties.email")||this.proxy("options.traits.email");if(email)return email;var userId=this.userId();if(isEmail(userId))return userId};Track.prototype.revenue=function(){var revenue=this.proxy("properties.revenue");var event=this.event();var orderCompletedRegExp=/^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i;if(!revenue&&event&&event.match(orderCompletedRegExp)){revenue=this.proxy("properties.total")}return currency(revenue)};Track.prototype.cents=function(){var revenue=this.revenue();return typeof revenue!=="number"?this.value()||0:revenue*100};Track.prototype.identify=function(){var json=this.json();json.traits=this.traits();return new Identify(json,this.opts)};function currency(val){if(!val)return;if(typeof val==="number"){return val}if(typeof val!=="string"){return}val=val.replace(/\$/g,"");val=parseFloat(val);if(!isNaN(val)){return val}}module.exports=Track},{"./facade":103,"./identify":105,"./utils":111,"is-email":85,"obj-case":98}],111:[function(require,module,exports){"use strict";exports.inherit=require("inherits");exports.clone=require("@ndhoule/clone");exports.type=require("type-component")},{"@ndhoule/clone":5,inherits:84,"type-component":117}],112:[function(require,module,exports){module.exports=function(str,options){options||(options={});return str.toLowerCase().replace(options.replace||/[^a-z0-9]/g," ").replace(/^ +| +$/g,"").replace(/ +/g,options.separator||"-")}},{}],113:[function(require,module,exports){(function(factory){if(typeof exports==="object"){module.exports=factory()}else if(typeof define==="function"&&define.amd){define(factory)}else{var glob;try{glob=window}catch(e){glob=self}glob.SparkMD5=factory()}})(function(undefined){"use strict";var add32=function(a,b){return a+b&4294967295},hex_chr=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function cmn(q,a,b,x,s,t){a=add32(add32(a,q),add32(x,t));return add32(a<<s|a>>>32-s,b)}function ff(a,b,c,d,x,s,t){return cmn(b&c|~b&d,a,b,x,s,t)}function gg(a,b,c,d,x,s,t){return cmn(b&d|c&~d,a,b,x,s,t)}function hh(a,b,c,d,x,s,t){return cmn(b^c^d,a,b,x,s,t)}function ii(a,b,c,d,x,s,t){return cmn(c^(b|~d),a,b,x,s,t)}function md5cycle(x,k){var a=x[0],b=x[1],c=x[2],d=x[3];a=ff(a,b,c,d,k[0],7,-680876936);d=ff(d,a,b,c,k[1],12,-389564586);c=ff(c,d,a,b,k[2],17,606105819);b=ff(b,c,d,a,k[3],22,-1044525330);a=ff(a,b,c,d,k[4],7,-176418897);d=ff(d,a,b,c,k[5],12,1200080426);c=ff(c,d,a,b,k[6],17,-1473231341);b=ff(b,c,d,a,k[7],22,-45705983);a=ff(a,b,c,d,k[8],7,1770035416);d=ff(d,a,b,c,k[9],12,-1958414417);c=ff(c,d,a,b,k[10],17,-42063);b=ff(b,c,d,a,k[11],22,-1990404162);a=ff(a,b,c,d,k[12],7,1804603682);d=ff(d,a,b,c,k[13],12,-40341101);c=ff(c,d,a,b,k[14],17,-1502002290);b=ff(b,c,d,a,k[15],22,1236535329)
;a=gg(a,b,c,d,k[1],5,-165796510);d=gg(d,a,b,c,k[6],9,-1069501632);c=gg(c,d,a,b,k[11],14,643717713);b=gg(b,c,d,a,k[0],20,-373897302);a=gg(a,b,c,d,k[5],5,-701558691);d=gg(d,a,b,c,k[10],9,38016083);c=gg(c,d,a,b,k[15],14,-660478335);b=gg(b,c,d,a,k[4],20,-405537848);a=gg(a,b,c,d,k[9],5,568446438);d=gg(d,a,b,c,k[14],9,-1019803690);c=gg(c,d,a,b,k[3],14,-187363961);b=gg(b,c,d,a,k[8],20,1163531501);a=gg(a,b,c,d,k[13],5,-1444681467);d=gg(d,a,b,c,k[2],9,-51403784);c=gg(c,d,a,b,k[7],14,1735328473);b=gg(b,c,d,a,k[12],20,-1926607734);a=hh(a,b,c,d,k[5],4,-378558);d=hh(d,a,b,c,k[8],11,-2022574463);c=hh(c,d,a,b,k[11],16,1839030562);b=hh(b,c,d,a,k[14],23,-35309556);a=hh(a,b,c,d,k[1],4,-1530992060);d=hh(d,a,b,c,k[4],11,1272893353);c=hh(c,d,a,b,k[7],16,-155497632);b=hh(b,c,d,a,k[10],23,-1094730640);a=hh(a,b,c,d,k[13],4,681279174);d=hh(d,a,b,c,k[0],11,-358537222);c=hh(c,d,a,b,k[3],16,-722521979);b=hh(b,c,d,a,k[6],23,76029189);a=hh(a,b,c,d,k[9],4,-640364487);d=hh(d,a,b,c,k[12],11,-421815835);c=hh(c,d,a,b,k[15],16,530742520);b=hh(b,c,d,a,k[2],23,-995338651);a=ii(a,b,c,d,k[0],6,-198630844);d=ii(d,a,b,c,k[7],10,1126891415);c=ii(c,d,a,b,k[14],15,-1416354905);b=ii(b,c,d,a,k[5],21,-57434055);a=ii(a,b,c,d,k[12],6,1700485571);d=ii(d,a,b,c,k[3],10,-1894986606);c=ii(c,d,a,b,k[10],15,-1051523);b=ii(b,c,d,a,k[1],21,-2054922799);a=ii(a,b,c,d,k[8],6,1873313359);d=ii(d,a,b,c,k[15],10,-30611744);c=ii(c,d,a,b,k[6],15,-1560198380);b=ii(b,c,d,a,k[13],21,1309151649);a=ii(a,b,c,d,k[4],6,-145523070);d=ii(d,a,b,c,k[11],10,-1120210379);c=ii(c,d,a,b,k[2],15,718787259);b=ii(b,c,d,a,k[9],21,-343485551);x[0]=add32(a,x[0]);x[1]=add32(b,x[1]);x[2]=add32(c,x[2]);x[3]=add32(d,x[3])}function md5blk(s){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=s.charCodeAt(i)+(s.charCodeAt(i+1)<<8)+(s.charCodeAt(i+2)<<16)+(s.charCodeAt(i+3)<<24)}return md5blks}function md5blk_array(a){var md5blks=[],i;for(i=0;i<64;i+=4){md5blks[i>>2]=a[i]+(a[i+1]<<8)+(a[i+2]<<16)+(a[i+3]<<24)}return md5blks}function md51(s){var n=s.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk(s.substring(i-64,i)))}s=s.substring(i-64);length=s.length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<length;i+=1){tail[i>>2]|=s.charCodeAt(i)<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function md51_array(a){var n=a.length,state=[1732584193,-271733879,-1732584194,271733878],i,length,tail,tmp,lo,hi;for(i=64;i<=n;i+=64){md5cycle(state,md5blk_array(a.subarray(i-64,i)))}a=i-64<n?a.subarray(i-64):new Uint8Array(0);length=a.length;tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<length;i+=1){tail[i>>2]|=a[i]<<(i%4<<3)}tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(state,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=n*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(state,tail);return state}function rhex(n){var s="",j;for(j=0;j<4;j+=1){s+=hex_chr[n>>j*8+4&15]+hex_chr[n>>j*8&15]}return s}function hex(x){var i;for(i=0;i<x.length;i+=1){x[i]=rhex(x[i])}return x.join("")}if(hex(md51("hello"))!=="5d41402abc4b2a76b9719d911017c592"){add32=function(x,y){var lsw=(x&65535)+(y&65535),msw=(x>>16)+(y>>16)+(lsw>>16);return msw<<16|lsw&65535}}if(typeof ArrayBuffer!=="undefined"&&!ArrayBuffer.prototype.slice){(function(){function clamp(val,length){val=val|0||0;if(val<0){return Math.max(val+length,0)}return Math.min(val,length)}ArrayBuffer.prototype.slice=function(from,to){var length=this.byteLength,begin=clamp(from,length),end=length,num,target,targetArray,sourceArray;if(to!==undefined){end=clamp(to,length)}if(begin>end){return new ArrayBuffer(0)}num=end-begin;target=new ArrayBuffer(num);targetArray=new Uint8Array(target);sourceArray=new Uint8Array(this,begin,num);targetArray.set(sourceArray);return target}})()}function toUtf8(str){if(/[\u0080-\uFFFF]/.test(str)){str=unescape(encodeURIComponent(str))}return str}function utf8Str2ArrayBuffer(str,returnUInt8Array){var length=str.length,buff=new ArrayBuffer(length),arr=new Uint8Array(buff),i;for(i=0;i<length;i+=1){arr[i]=str.charCodeAt(i)}return returnUInt8Array?arr:buff}function arrayBuffer2Utf8Str(buff){return String.fromCharCode.apply(null,new Uint8Array(buff))}function concatenateArrayBuffers(first,second,returnUInt8Array){var result=new Uint8Array(first.byteLength+second.byteLength);result.set(new Uint8Array(first));result.set(new Uint8Array(second),first.byteLength);return returnUInt8Array?result:result.buffer}function hexToBinaryString(hex){var bytes=[],length=hex.length,x;for(x=0;x<length-1;x+=2){bytes.push(parseInt(hex.substr(x,2),16))}return String.fromCharCode.apply(String,bytes)}function SparkMD5(){this.reset()}SparkMD5.prototype.append=function(str){this.appendBinary(toUtf8(str));return this};SparkMD5.prototype.appendBinary=function(contents){this._buff+=contents;this._length+=contents.length;var length=this._buff.length,i;for(i=64;i<=length;i+=64){md5cycle(this._hash,md5blk(this._buff.substring(i-64,i)))}this._buff=this._buff.substring(i-64);return this};SparkMD5.prototype.end=function(raw){var buff=this._buff,length=buff.length,i,tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],ret;for(i=0;i<length;i+=1){tail[i>>2]|=buff.charCodeAt(i)<<(i%4<<3)}this._finish(tail,length);ret=hex(this._hash);if(raw){ret=hexToBinaryString(ret)}this.reset();return ret};SparkMD5.prototype.reset=function(){this._buff="";this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash}};SparkMD5.prototype.setState=function(state){this._buff=state.buff;this._length=state.length;this._hash=state.hash;return this};SparkMD5.prototype.destroy=function(){delete this._hash;delete this._buff;delete this._length};SparkMD5.prototype._finish=function(tail,length){var i=length,tmp,lo,hi;tail[i>>2]|=128<<(i%4<<3);if(i>55){md5cycle(this._hash,tail);for(i=0;i<16;i+=1){tail[i]=0}}tmp=this._length*8;tmp=tmp.toString(16).match(/(.*?)(.{0,8})$/);lo=parseInt(tmp[2],16);hi=parseInt(tmp[1],16)||0;tail[14]=lo;tail[15]=hi;md5cycle(this._hash,tail)};SparkMD5.hash=function(str,raw){return SparkMD5.hashBinary(toUtf8(str),raw)};SparkMD5.hashBinary=function(content,raw){var hash=md51(content),ret=hex(hash);return raw?hexToBinaryString(ret):ret};SparkMD5.ArrayBuffer=function(){this.reset()};SparkMD5.ArrayBuffer.prototype.append=function(arr){var buff=concatenateArrayBuffers(this._buff.buffer,arr,true),length=buff.length,i;this._length+=arr.byteLength;for(i=64;i<=length;i+=64){md5cycle(this._hash,md5blk_array(buff.subarray(i-64,i)))}this._buff=i-64<length?new Uint8Array(buff.buffer.slice(i-64)):new Uint8Array(0);return this};SparkMD5.ArrayBuffer.prototype.end=function(raw){var buff=this._buff,length=buff.length,tail=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i,ret;for(i=0;i<length;i+=1){tail[i>>2]|=buff[i]<<(i%4<<3)}this._finish(tail,length);ret=hex(this._hash);if(raw){ret=hexToBinaryString(ret)}this.reset();return ret};SparkMD5.ArrayBuffer.prototype.reset=function(){this._buff=new Uint8Array(0);this._length=0;this._hash=[1732584193,-271733879,-1732584194,271733878];return this};SparkMD5.ArrayBuffer.prototype.getState=function(){var state=SparkMD5.prototype.getState.call(this);state.buff=arrayBuffer2Utf8Str(state.buff);return state};SparkMD5.ArrayBuffer.prototype.setState=function(state){state.buff=utf8Str2ArrayBuffer(state.buff,true);return SparkMD5.prototype.setState.call(this,state)};SparkMD5.ArrayBuffer.prototype.destroy=SparkMD5.prototype.destroy;SparkMD5.ArrayBuffer.prototype._finish=SparkMD5.prototype._finish;SparkMD5.ArrayBuffer.hash=function(arr,raw){var hash=md51_array(new Uint8Array(arr)),ret=hex(hash);return raw?hexToBinaryString(ret):ret};return SparkMD5})},{}],114:[function(require,module,exports){var expr;try{expr=require("props")}catch(e){expr=require("component-props")}module.exports=toFunction;function toFunction(obj){switch({}.toString.call(obj)){case"[object Object]":return objectToFunction(obj);case"[object Function]":return obj;case"[object String]":return stringToFunction(obj);case"[object RegExp]":return regexpToFunction(obj);default:return defaultToFunction(obj)}}function defaultToFunction(val){return function(obj){return val===obj}}function regexpToFunction(re){return function(obj){return re.test(obj)}}function stringToFunction(str){if(/^ *\W+/.test(str))return new Function("_","return _ "+str);return new Function("_","return "+get(str))}function objectToFunction(obj){var match={};for(var key in obj){match[key]=typeof obj[key]==="string"?defaultToFunction(obj[key]):toFunction(obj[key])}return function(val){if(typeof val!=="object")return false;for(var key in match){if(!(key in val))return false;if(!match[key](val[key]))return false}return true}}function get(str){var props=expr(str);if(!props.length)return"_."+str;var val,i,prop;for(i=0;i<props.length;i++){prop=props[i];val="_."+prop;val="('function' == typeof "+val+" ? "+val+"() : "+val+")";str=stripNested(prop,str,val)}return str}function stripNested(prop,str,val){return str.replace(new RegExp("(\\.)?"+prop,"g"),function($0,$1){return $1?$0:val})}},{"component-props":73,props:73}],115:[function(require,module,exports){module.exports=toNoCase;var hasSpace=/\s/;var hasSeparator=/[\W_]/;function toNoCase(string){if(hasSpace.test(string))return string.toLowerCase();if(hasSeparator.test(string))return(unseparate(string)||string).toLowerCase();return uncamelize(string).toLowerCase()}var separatorSplitter=/[\W_]+(.|$)/g;function unseparate(string){return string.replace(separatorSplitter,function(m,next){return next?" "+next:""})}var camelSplitter=/(.)([A-Z]+)/g;function uncamelize(string){return string.replace(camelSplitter,function(m,previous,uppers){return previous+" "+uppers.toLowerCase().split("").join(" ")})}},{}],116:[function(require,module,exports){exports=module.exports=trim;function trim(str){return str.replace(/^\s*|\s*$/g,"")}exports.left=function(str){return str.replace(/^\s*/,"")};exports.right=function(str){return str.replace(/\s*$/,"")}},{}],117:[function(require,module,exports){var toString=Object.prototype.toString;module.exports=function(val){switch(toString.call(val)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array"}if(val===null)return"null";if(val===undefined)return"undefined";if(val===Object(val))return"object";return typeof val}},{}],118:[function(require,module,exports){module.exports=encode;function encode(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c)}else if(c>127&&c<2048){utftext+=String.fromCharCode(c>>6|192);utftext+=String.fromCharCode(c&63|128)}else{utftext+=String.fromCharCode(c>>12|224);utftext+=String.fromCharCode(c>>6&63|128);utftext+=String.fromCharCode(c&63|128)}}return utftext}},{}],119:[function(require,module,exports){(function(global){var rng;var crypto=global.crypto||global.msCrypto;if(crypto&&crypto.getRandomValues){var _rnds8=new Uint8Array(16);rng=function whatwgRNG(){crypto.getRandomValues(_rnds8);return _rnds8}}if(!rng){var _rnds=new Array(16);rng=function(){for(var i=0,r;i<16;i++){if((i&3)===0)r=Math.random()*4294967296;_rnds[i]=r>>>((i&3)<<3)&255}return _rnds}}module.exports=rng}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],120:[function(require,module,exports){var _rng=require("./rng");var _byteToHex=[];var _hexToByte={};for(var i=0;i<256;i++){_byteToHex[i]=(i+256).toString(16).substr(1);_hexToByte[_byteToHex[i]]=i}function parse(s,buf,offset){var i=buf&&offset||0,ii=0;buf=buf||[];s.toLowerCase().replace(/[0-9a-f]{2}/g,function(oct){if(ii<16){buf[i+ii++]=_hexToByte[oct]}});while(ii<16){buf[i+ii++]=0}return buf}function unparse(buf,offset){var i=offset||0,bth=_byteToHex;return bth[buf[i++]]+bth[buf[i++]]+bth[buf[i++]]+bth[buf[i++]]+"-"+bth[buf[i++]]+bth[buf[i++]]+"-"+bth[buf[i++]]+bth[buf[i++]]+"-"+bth[buf[i++]]+bth[buf[i++]]+"-"+bth[buf[i++]]+bth[buf[i++]]+bth[buf[i++]]+bth[buf[i++]]+bth[buf[i++]]+bth[buf[i++]]}var _seedBytes=_rng();var _nodeId=[_seedBytes[0]|1,_seedBytes[1],_seedBytes[2],_seedBytes[3],_seedBytes[4],_seedBytes[5]];var _clockseq=(_seedBytes[6]<<8|_seedBytes[7])&16383;var _lastMSecs=0,_lastNSecs=0;function v1(options,buf,offset){var i=buf&&offset||0;var b=buf||[];options=options||{};var clockseq=options.clockseq!==undefined?options.clockseq:_clockseq;var msecs=options.msecs!==undefined?options.msecs:(new Date).getTime();var nsecs=options.nsecs!==undefined?options.nsecs:_lastNSecs+1;var dt=msecs-_lastMSecs+(nsecs-_lastNSecs)/1e4;if(dt<0&&options.clockseq===undefined){clockseq=clockseq+1&16383}if((dt<0||msecs>_lastMSecs)&&options.nsecs===undefined){nsecs=0}if(nsecs>=1e4){throw new Error("uuid.v1(): Can't create more than 10M uuids/sec")}_lastMSecs=msecs;_lastNSecs=nsecs;_clockseq=clockseq;msecs+=122192928e5;var tl=((msecs&268435455)*1e4+nsecs)%4294967296;b[i++]=tl>>>24&255;b[i++]=tl>>>16&255;b[i++]=tl>>>8&255;b[i++]=tl&255;var tmh=msecs/4294967296*1e4&268435455;b[i++]=tmh>>>8&255;b[i++]=tmh&255;b[i++]=tmh>>>24&15|16;b[i++]=tmh>>>16&255;b[i++]=clockseq>>>8|128;b[i++]=clockseq&255;var node=options.node||_nodeId;for(var n=0;n<6;n++){b[i+n]=node[n]}return buf?buf:unparse(b)}function v4(options,buf,offset){var i=buf&&offset||0;if(typeof options=="string"){buf=options=="binary"?new Array(16):null;options=null}options=options||{};var rnds=options.random||(options.rng||_rng)();rnds[6]=rnds[6]&15|64;rnds[8]=rnds[8]&63|128;if(buf){for(var ii=0;ii<16;ii++){buf[i+ii]=rnds[ii]}}return buf||unparse(rnds)}var uuid=v4;uuid.v1=v1;uuid.v4=v4;uuid.parse=parse;uuid.unparse=unparse;module.exports=uuid},{"./rng":119}],121:[function(require,module,exports){var unserialize=require("unserialize");var each=require("each");var storage;try{storage=window.localStorage}catch(e){storage=null}module.exports=store;function store(key,value){var length=arguments.length;if(0==length)return all();if(2<=length)return set(key,value);if(1!=length)return;if(null==key)return storage.clear();if("string"==typeof key)return get(key);if("object"==typeof key)return each(key,set)}store.supported=!!storage;function set(key,val){return null==val?storage.removeItem(key):storage.setItem(key,JSON.stringify(val))}function get(key){return unserialize(storage.getItem(key))}function all(){var len=storage.length;var ret={};var key;while(0<=--len){key=storage.key(len);ret[key]=get(key)}return ret}},{each:69,unserialize:122}],122:[function(require,module,exports){module.exports=function(val){try{return JSON.parse(val)}catch(e){return val||undefined}}},{}],123:[function(require,module,exports){module.exports={name:"@segment/analytics.js",author:"Segment <[email protected]>",version:"2.11.0",description:"The hassle-free way to integrate analytics into any web application.",keywords:["analytics","analytics.js","segment","segment.io"],main:"analytics.js",scripts:{build:"make build",clean:"make clean",test:"make test"},repository:{type:"git",url:"https://github.com/segmentio/analytics.js.git"},license:"SEE LICENSE IN LICENSE",bugs:{url:"https://github.com/segmentio/analytics.js/issues"},homepage:"https://github.com/segmentio/analytics.js#readme",dependencies:{"@segment/analytics.js-core":"^3.0.0","@segment/analytics.js-integration":"^3.1.0","@segment/analytics.js-integration-segmentio":"git://github.com/FindHotel/analytics.js-integration-findhotel.git#a57b0039090b3866f076fa12e185129bda55da42","@segment/analytics.js-integration-google-tag-manager":"https://github.com/segment-integrations/analytics.js-integration-google-tag-manager"},devDependencies:{"@segment/eslint-config":"^3.1.1",browserify:"^13.0.1",eslint:"^2.9.0","eslint-plugin-mocha":"^2.2.0","eslint-plugin-require-path-exists":"^1.1.5","uglify-js":"^2.6.4"}}},{}]},{},[1])(1)});