-
Notifications
You must be signed in to change notification settings - Fork 1
/
directions.js
1 lines (1 loc) · 76.1 KB
/
directions.js
1
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).MapboxDirections=e()}}(function(){return function e(t,n,i){function r(s,a){if(!n[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){return r(t[s][1][e]||e)},l,l.exports,e,t,n,i)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}({1:[function(e,t,n){"use strict";var i={};function r(e){return Math.floor(Math.abs(e)+.5)*(e>=0?1:-1)}function o(e,t,n){var i=(e=r(e*n))-(t=r(t*n));i<<=1,e-t<0&&(i=~i);for(var o="";i>=32;)o+=String.fromCharCode(63+(32|31&i)),i>>=5;return o+=String.fromCharCode(i+63)}function s(e){for(var t=[],n=0;n<e.length;n++)t.push(e[n].slice().reverse());return t}i.decode=function(e,t){for(var n,i=0,r=0,o=0,s=[],a=0,u=0,c=null,l=Math.pow(10,Number.isInteger(t)?t:5);i<e.length;){c=null,a=0,u=0;do{u|=(31&(c=e.charCodeAt(i++)-63))<<a,a+=5}while(c>=32);n=1&u?~(u>>1):u>>1,a=u=0;do{u|=(31&(c=e.charCodeAt(i++)-63))<<a,a+=5}while(c>=32);r+=n,o+=1&u?~(u>>1):u>>1,s.push([r/l,o/l])}return s},i.encode=function(e,t){if(!e.length)return"";for(var n=Math.pow(10,Number.isInteger(t)?t:5),i=o(e[0][0],0,n)+o(e[0][1],0,n),r=1;r<e.length;r++){var s=e[r],a=e[r-1];i+=o(s[0],a[0],n),i+=o(s[1],a[1],n)}return i},i.fromGeoJSON=function(e,t){if(e&&"Feature"===e.type&&(e=e.geometry),!e||"LineString"!==e.type)throw new Error("Input must be a GeoJSON LineString");return i.encode(s(e.coordinates),t)},i.toGeoJSON=function(e,t){return{type:"LineString",coordinates:s(i.decode(e,t))}},"object"==typeof t&&t.exports&&(t.exports=i)},{}],2:[function(e,t,n){"use strict";var i=e("is-obj"),r=Object.prototype.hasOwnProperty,o=Object.prototype.propertyIsEnumerable;function s(e){if(null==e)throw new TypeError("Sources cannot be null or undefined");return Object(e)}function a(e,t,n){var o=t[n];if(null!=o){if(r.call(e,n)&&(void 0===e[n]||null===e[n]))throw new TypeError("Cannot convert undefined or null to object ("+n+")");r.call(e,n)&&i(o)?e[n]=u(Object(e[n]),t[n]):e[n]=o}}function u(e,t){if(e===t)return e;for(var n in t=Object(t))r.call(t,n)&&a(e,t,n);if(Object.getOwnPropertySymbols)for(var i=Object.getOwnPropertySymbols(t),s=0;s<i.length;s++)o.call(t,i[s])&&a(e,t,i[s]);return e}t.exports=function(e){e=s(e);for(var t=1;t<arguments.length;t++)u(e,arguments[t]);return e}},{"is-obj":5}],3:[function(e,t,n){function i(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"object"==typeof e&&null!==e}function s(e){return void 0===e}t.exports=i,i.EventEmitter=i,i.prototype._events=void 0,i.prototype._maxListeners=void 0,i.defaultMaxListeners=10,i.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},i.prototype.emit=function(e){var t,n,i,a,u,c;if(this._events||(this._events={}),"error"===e&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if((t=arguments[1])instanceof Error)throw t;var l=new Error('Uncaught, unspecified "error" event. ('+t+")");throw l.context=t,l}if(s(n=this._events[e]))return!1;if(r(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:a=Array.prototype.slice.call(arguments,1),n.apply(this,a)}else if(o(n))for(a=Array.prototype.slice.call(arguments,1),i=(c=n.slice()).length,u=0;u<i;u++)c[u].apply(this,a);return!0},i.prototype.addListener=function(e,t){var n;if(!r(t))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",e,r(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t,o(this._events[e])&&!this._events[e].warned&&(n=s(this._maxListeners)?i.defaultMaxListeners:this._maxListeners)&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[e].length),"function"==typeof console.trace&&console.trace()),this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(e,t){if(!r(t))throw TypeError("listener must be a function");var n=!1;function i(){this.removeListener(e,i),n||(n=!0,t.apply(this,arguments))}return i.listener=t,this.on(e,i),this},i.prototype.removeListener=function(e,t){var n,i,s,a;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(s=(n=this._events[e]).length,i=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(o(n)){for(a=s;a-- >0;)if(n[a]===t||n[a].listener&&n[a].listener===t){i=a;break}if(i<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(i,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},i.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[e]&&delete this._events[e],this;if(0===arguments.length){for(t in this._events)"removeListener"!==t&&this.removeAllListeners(t);return this.removeAllListeners("removeListener"),this._events={},this}if(r(n=this._events[e]))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},i.prototype.listeners=function(e){return this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},i.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},i.listenerCount=function(e,t){return e.listenerCount(t)}},{}],4:[function(e,t,n){!function(){var e={};void 0!==n?t.exports=e:this.fuzzy=e,e.simpleFilter=function(t,n){return n.filter(function(n){return e.test(t,n)})},e.test=function(t,n){return null!==e.match(t,n)},e.match=function(e,t,n){n=n||{};var i,r=0,o=[],s=t.length,a=0,u=0,c=n.pre||"",l=n.post||"",f=n.caseSensitive&&t||t.toLowerCase();e=n.caseSensitive&&e||e.toLowerCase();for(var d=0;d<s;d++)i=t[d],f[d]===e[r]?(i=c+i+l,r+=1,u+=1+u):u=0,a+=u,o[o.length]=i;return r===e.length?(a=f===e?1/0:a,{rendered:o.join(""),score:a}):null},e.filter=function(t,n,i){return n&&0!==n.length?"string"!=typeof t?n:(i=i||{},n.reduce(function(n,r,o,s){var a=r;i.extract&&(a=i.extract(r));var u=e.match(t,a,i);return null!=u&&(n[n.length]={string:u.rendered,score:u.score,index:o,original:r}),n},[]).sort(function(e,t){var n=t.score-e.score;return n||e.index-t.index})):[]}}()},{}],5:[function(e,t,n){"use strict";t.exports=function(e){var t=typeof e;return null!==e&&("object"===t||"function"===t)}},{}],6:[function(e,t,n){t.exports=/<%=([\s\S]+?)%>/g},{}],7:[function(e,t,n){(function(e){var n="Expected a function",i=NaN,r="[object Symbol]",o=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,a=/^0b[01]+$/i,u=/^0o[0-7]+$/i,c=parseInt,l="object"==typeof e&&e&&e.Object===Object&&e,f="object"==typeof self&&self&&self.Object===Object&&self,d=l||f||Function("return this")(),p=Object.prototype.toString,h=Math.max,v=Math.min,y=function(){return d.Date.now()};function g(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function m(e){if("number"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&p.call(e)==r}(e))return i;if(g(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=g(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(o,"");var n=a.test(e);return n||u.test(e)?c(e.slice(2),n?2:8):s.test(e)?i:+e}t.exports=function(e,t,i){var r,o,s,a,u,c,l=0,f=!1,d=!1,p=!0;if("function"!=typeof e)throw new TypeError(n);function b(t){var n=r,i=o;return r=o=void 0,l=t,a=e.apply(i,n)}function _(e){var n=e-c;return void 0===c||n>=t||n<0||d&&e-l>=s}function w(){var e=y();if(_(e))return O(e);u=setTimeout(w,function(e){var n=t-(e-c);return d?v(n,s-(e-l)):n}(e))}function O(e){return u=void 0,p&&r?b(e):(r=o=void 0,a)}function E(){var e=y(),n=_(e);if(r=arguments,o=this,c=e,n){if(void 0===u)return function(e){return l=e,u=setTimeout(w,t),f?b(e):a}(c);if(d)return u=setTimeout(w,t),b(c)}return void 0===u&&(u=setTimeout(w,t)),a}return t=m(t)||0,g(i)&&(f=!!i.leading,s=(d="maxWait"in i)?h(m(i.maxWait)||0,t):s,p="trailing"in i?!!i.trailing:p),E.cancel=function(){void 0!==u&&clearTimeout(u),l=0,r=c=o=u=void 0},E.flush=function(){return void 0===u?a:O(y())},E}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],8:[function(e,t,n){(function(e){var i=200,r="__lodash_hash_undefined__",o=1,s=2,a=9007199254740991,u="[object Arguments]",c="[object Array]",l="[object AsyncFunction]",f="[object Boolean]",d="[object Date]",p="[object Error]",h="[object Function]",v="[object GeneratorFunction]",y="[object Map]",g="[object Number]",m="[object Null]",b="[object Object]",_="[object Proxy]",w="[object RegExp]",O="[object Set]",E="[object String]",j="[object Symbol]",x="[object Undefined]",I="[object ArrayBuffer]",T="[object DataView]",S=/^\[object .+?Constructor\]$/,k=/^(?:0|[1-9]\d*)$/,N={};N["[object Float32Array]"]=N["[object Float64Array]"]=N["[object Int8Array]"]=N["[object Int16Array]"]=N["[object Int32Array]"]=N["[object Uint8Array]"]=N["[object Uint8ClampedArray]"]=N["[object Uint16Array]"]=N["[object Uint32Array]"]=!0,N[u]=N[c]=N[I]=N[f]=N[T]=N[d]=N[p]=N[h]=N[y]=N[g]=N[b]=N[w]=N[O]=N[E]=N["[object WeakMap]"]=!1;var C="object"==typeof e&&e&&e.Object===Object&&e,R="object"==typeof self&&self&&self.Object===Object&&self,L=C||R||Function("return this")(),A="object"==typeof n&&n&&!n.nodeType&&n,D=A&&"object"==typeof t&&t&&!t.nodeType&&t,M=D&&D.exports===A,P=M&&C.process,F=function(){try{return P&&P.binding&&P.binding("util")}catch(e){}}(),q=F&&F.isTypedArray;function U(e,t){for(var n=-1,i=null==e?0:e.length;++n<i;)if(t(e[n],n,e))return!0;return!1}function z(e){var t=-1,n=Array(e.size);return e.forEach(function(e,i){n[++t]=[i,e]}),n}function G(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var $,W,Q,V=Array.prototype,B=Function.prototype,H=Object.prototype,Y=L["__core-js_shared__"],K=B.toString,J=H.hasOwnProperty,X=($=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||""))?"Symbol(src)_1."+$:"",Z=H.toString,ee=RegExp("^"+K.call(J).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),te=M?L.Buffer:void 0,ne=L.Symbol,ie=L.Uint8Array,re=H.propertyIsEnumerable,oe=V.splice,se=ne?ne.toStringTag:void 0,ae=Object.getOwnPropertySymbols,ue=te?te.isBuffer:void 0,ce=(W=Object.keys,Q=Object,function(e){return W(Q(e))}),le=Fe(L,"DataView"),fe=Fe(L,"Map"),de=Fe(L,"Promise"),pe=Fe(L,"Set"),he=Fe(L,"WeakMap"),ve=Fe(Object,"create"),ye=Ge(le),ge=Ge(fe),me=Ge(de),be=Ge(pe),_e=Ge(he),we=ne?ne.prototype:void 0,Oe=we?we.valueOf:void 0;function Ee(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function je(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function xe(e){var t=-1,n=null==e?0:e.length;for(this.clear();++t<n;){var i=e[t];this.set(i[0],i[1])}}function Ie(e){var t=-1,n=null==e?0:e.length;for(this.__data__=new xe;++t<n;)this.add(e[t])}function Te(e){var t=this.__data__=new je(e);this.size=t.size}function Se(e,t){var n=Qe(e),i=!n&&We(e),r=!n&&!i&&Ve(e),o=!n&&!i&&!r&&Je(e),s=n||i||r||o,a=s?function(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}(e.length,String):[],u=a.length;for(var c in e)!t&&!J.call(e,c)||s&&("length"==c||r&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||ze(c,u))||a.push(c);return a}function ke(e,t){for(var n=e.length;n--;)if($e(e[n][0],t))return n;return-1}function Ne(e){return null==e?void 0===e?x:m:se&&se in Object(e)?function(e){var t=J.call(e,se),n=e[se];try{e[se]=void 0;var i=!0}catch(e){}var r=Z.call(e);i&&(t?e[se]=n:delete e[se]);return r}(e):function(e){return Z.call(e)}(e)}function Ce(e){return Ke(e)&&Ne(e)==u}function Re(e,t,n,i,r){return e===t||(null==e||null==t||!Ke(e)&&!Ke(t)?e!=e&&t!=t:function(e,t,n,i,r,a){var l=Qe(e),h=Qe(t),v=l?c:Ue(e),m=h?c:Ue(t),_=(v=v==u?b:v)==b,x=(m=m==u?b:m)==b,S=v==m;if(S&&Ve(e)){if(!Ve(t))return!1;l=!0,_=!1}if(S&&!_)return a||(a=new Te),l||Je(e)?De(e,t,n,i,r,a):function(e,t,n,i,r,a,u){switch(n){case T:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case I:return!(e.byteLength!=t.byteLength||!a(new ie(e),new ie(t)));case f:case d:case g:return $e(+e,+t);case p:return e.name==t.name&&e.message==t.message;case w:case E:return e==t+"";case y:var c=z;case O:var l=i&o;if(c||(c=G),e.size!=t.size&&!l)return!1;var h=u.get(e);if(h)return h==t;i|=s,u.set(e,t);var v=De(c(e),c(t),i,r,a,u);return u.delete(e),v;case j:if(Oe)return Oe.call(e)==Oe.call(t)}return!1}(e,t,v,n,i,r,a);if(!(n&o)){var k=_&&J.call(e,"__wrapped__"),N=x&&J.call(t,"__wrapped__");if(k||N){var C=k?e.value():e,R=N?t.value():t;return a||(a=new Te),r(C,R,n,i,a)}}if(!S)return!1;return a||(a=new Te),function(e,t,n,i,r,s){var a=n&o,u=Me(e),c=u.length,l=Me(t).length;if(c!=l&&!a)return!1;var f=c;for(;f--;){var d=u[f];if(!(a?d in t:J.call(t,d)))return!1}var p=s.get(e);if(p&&s.get(t))return p==t;var h=!0;s.set(e,t),s.set(t,e);var v=a;for(;++f<c;){d=u[f];var y=e[d],g=t[d];if(i)var m=a?i(g,y,d,t,e,s):i(y,g,d,e,t,s);if(!(void 0===m?y===g||r(y,g,n,i,s):m)){h=!1;break}v||(v="constructor"==d)}if(h&&!v){var b=e.constructor,_=t.constructor;b!=_&&"constructor"in e&&"constructor"in t&&!("function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _)&&(h=!1)}return s.delete(e),s.delete(t),h}(e,t,n,i,r,a)}(e,t,n,i,Re,r))}function Le(e){return!(!Ye(e)||function(e){return!!X&&X in e}(e))&&(Be(e)?ee:S).test(Ge(e))}function Ae(e){if(n=(t=e)&&t.constructor,i="function"==typeof n&&n.prototype||H,t!==i)return ce(e);var t,n,i,r=[];for(var o in Object(e))J.call(e,o)&&"constructor"!=o&&r.push(o);return r}function De(e,t,n,i,r,a){var u=n&o,c=e.length,l=t.length;if(c!=l&&!(u&&l>c))return!1;var f=a.get(e);if(f&&a.get(t))return f==t;var d=-1,p=!0,h=n&s?new Ie:void 0;for(a.set(e,t),a.set(t,e);++d<c;){var v=e[d],y=t[d];if(i)var g=u?i(y,v,d,t,e,a):i(v,y,d,e,t,a);if(void 0!==g){if(g)continue;p=!1;break}if(h){if(!U(t,function(e,t){if(o=t,!h.has(o)&&(v===e||r(v,e,n,i,a)))return h.push(t);var o})){p=!1;break}}else if(v!==y&&!r(v,y,n,i,a)){p=!1;break}}return a.delete(e),a.delete(t),p}function Me(e){return function(e,t,n){var i=t(e);return Qe(e)?i:function(e,t){for(var n=-1,i=t.length,r=e.length;++n<i;)e[r+n]=t[n];return e}(i,n(e))}(e,Xe,qe)}function Pe(e,t){var n,i,r=e.__data__;return("string"==(i=typeof(n=t))||"number"==i||"symbol"==i||"boolean"==i?"__proto__"!==n:null===n)?r["string"==typeof t?"string":"hash"]:r.map}function Fe(e,t){var n=function(e,t){return null==e?void 0:e[t]}(e,t);return Le(n)?n:void 0}Ee.prototype.clear=function(){this.__data__=ve?ve(null):{},this.size=0},Ee.prototype.delete=function(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t},Ee.prototype.get=function(e){var t=this.__data__;if(ve){var n=t[e];return n===r?void 0:n}return J.call(t,e)?t[e]:void 0},Ee.prototype.has=function(e){var t=this.__data__;return ve?void 0!==t[e]:J.call(t,e)},Ee.prototype.set=function(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=ve&&void 0===t?r:t,this},je.prototype.clear=function(){this.__data__=[],this.size=0},je.prototype.delete=function(e){var t=this.__data__,n=ke(t,e);return!(n<0)&&(n==t.length-1?t.pop():oe.call(t,n,1),--this.size,!0)},je.prototype.get=function(e){var t=this.__data__,n=ke(t,e);return n<0?void 0:t[n][1]},je.prototype.has=function(e){return ke(this.__data__,e)>-1},je.prototype.set=function(e,t){var n=this.__data__,i=ke(n,e);return i<0?(++this.size,n.push([e,t])):n[i][1]=t,this},xe.prototype.clear=function(){this.size=0,this.__data__={hash:new Ee,map:new(fe||je),string:new Ee}},xe.prototype.delete=function(e){var t=Pe(this,e).delete(e);return this.size-=t?1:0,t},xe.prototype.get=function(e){return Pe(this,e).get(e)},xe.prototype.has=function(e){return Pe(this,e).has(e)},xe.prototype.set=function(e,t){var n=Pe(this,e),i=n.size;return n.set(e,t),this.size+=n.size==i?0:1,this},Ie.prototype.add=Ie.prototype.push=function(e){return this.__data__.set(e,r),this},Ie.prototype.has=function(e){return this.__data__.has(e)},Te.prototype.clear=function(){this.__data__=new je,this.size=0},Te.prototype.delete=function(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n},Te.prototype.get=function(e){return this.__data__.get(e)},Te.prototype.has=function(e){return this.__data__.has(e)},Te.prototype.set=function(e,t){var n=this.__data__;if(n instanceof je){var r=n.__data__;if(!fe||r.length<i-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new xe(r)}return n.set(e,t),this.size=n.size,this};var qe=ae?function(e){return null==e?[]:(e=Object(e),function(e,t){for(var n=-1,i=null==e?0:e.length,r=0,o=[];++n<i;){var s=e[n];t(s,n,e)&&(o[r++]=s)}return o}(ae(e),function(t){return re.call(e,t)}))}:function(){return[]},Ue=Ne;function ze(e,t){return!!(t=null==t?a:t)&&("number"==typeof e||k.test(e))&&e>-1&&e%1==0&&e<t}function Ge(e){if(null!=e){try{return K.call(e)}catch(e){}try{return e+""}catch(e){}}return""}function $e(e,t){return e===t||e!=e&&t!=t}(le&&Ue(new le(new ArrayBuffer(1)))!=T||fe&&Ue(new fe)!=y||de&&"[object Promise]"!=Ue(de.resolve())||pe&&Ue(new pe)!=O||he&&"[object WeakMap]"!=Ue(new he))&&(Ue=function(e){var t=Ne(e),n=t==b?e.constructor:void 0,i=n?Ge(n):"";if(i)switch(i){case ye:return T;case ge:return y;case me:return"[object Promise]";case be:return O;case _e:return"[object WeakMap]"}return t});var We=Ce(function(){return arguments}())?Ce:function(e){return Ke(e)&&J.call(e,"callee")&&!re.call(e,"callee")},Qe=Array.isArray;var Ve=ue||function(){return!1};function Be(e){if(!Ye(e))return!1;var t=Ne(e);return t==h||t==v||t==l||t==_}function He(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=a}function Ye(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function Ke(e){return null!=e&&"object"==typeof e}var Je=q?function(e){return function(t){return e(t)}}(q):function(e){return Ke(e)&&He(e.length)&&!!N[Ne(e)]};function Xe(e){return null!=(t=e)&&He(t.length)&&!Be(t)?Se(e):Ae(e);var t}t.exports=function(e,t){return Re(e,t)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],9:[function(e,t,n){(function(n){var i=e("lodash._reinterpolate"),r=e("lodash.templatesettings"),o=1/0,s=9007199254740991,a="[object Arguments]",u="[object Error]",c="[object Function]",l="[object GeneratorFunction]",f="[object Symbol]",d=/\b__p \+= '';/g,p=/\b(__p \+=) '' \+/g,h=/(__e\(.*?\)|\b__t\)) \+\n'';/g,v=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,y=/^(?:0|[1-9]\d*)$/,g=/($^)/,m=/['\n\r\u2028\u2029\\]/g,b={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},_="object"==typeof n&&n&&n.Object===Object&&n,w="object"==typeof self&&self&&self.Object===Object&&self,O=_||w||Function("return this")();function E(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}function j(e,t){return function(e,t){for(var n=-1,i=e?e.length:0,r=Array(i);++n<i;)r[n]=t(e[n],n,e);return r}(t,function(t){return e[t]})}function x(e){return"\\"+b[e]}var I,T,S=Object.prototype,k=S.hasOwnProperty,N=S.toString,C=O.Symbol,R=S.propertyIsEnumerable,L=(I=Object.keys,T=Object,function(e){return I(T(e))}),A=Math.max,D=C?C.prototype:void 0,M=D?D.toString:void 0;function P(e,t){var n=B(e)||function(e){return function(e){return J(e)&&H(e)}(e)&&k.call(e,"callee")&&(!R.call(e,"callee")||N.call(e)==a)}(e)?function(e,t){for(var n=-1,i=Array(e);++n<e;)i[n]=t(n);return i}(e.length,String):[],i=n.length,r=!!i;for(var o in e)!t&&!k.call(e,o)||r&&("length"==o||$(o,i))||n.push(o);return n}function F(e,t,n,i){return void 0===e||V(e,S[n])&&!k.call(i,n)?t:e}function q(e,t,n){var i=e[t];k.call(e,t)&&V(i,n)&&(void 0!==n||t in e)||(e[t]=n)}function U(e){if(!K(e))return function(e){var t=[];if(null!=e)for(var n in Object(e))t.push(n);return t}(e);var t=Q(e),n=[];for(var i in e)("constructor"!=i||!t&&k.call(e,i))&&n.push(i);return n}function z(e,t){return t=A(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,r=A(n.length-t,0),o=Array(r);++i<r;)o[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=o,E(e,this,s)}}function G(e){if("string"==typeof e)return e;if(function(e){return"symbol"==typeof e||J(e)&&N.call(e)==f}(e))return M?M.call(e):"";var t=e+"";return"0"==t&&1/e==-o?"-0":t}function $(e,t){return!!(t=null==t?s:t)&&("number"==typeof e||y.test(e))&&e>-1&&e%1==0&&e<t}function W(e,t,n){if(!K(n))return!1;var i=typeof t;return!!("number"==i?H(n)&&$(t,n.length):"string"==i&&t in n)&&V(n[t],e)}function Q(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||S)}function V(e,t){return e===t||e!=e&&t!=t}var B=Array.isArray;function H(e){return null!=e&&function(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=s}(e.length)&&!function(e){var t=K(e)?N.call(e):"";return t==c||t==l}(e)}function Y(e){return!!J(e)&&(N.call(e)==u||"string"==typeof e.message&&"string"==typeof e.name)}function K(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function J(e){return!!e&&"object"==typeof e}var X,Z=(X=function(e,t,n,i){!function(e,t,n,i){n||(n={});for(var r=-1,o=t.length;++r<o;){var s=t[r],a=i?i(n[s],e[s],s,n,e):void 0;q(n,s,void 0===a?e[s]:a)}}(t,function(e){return H(e)?P(e,!0):U(e)}(t),e,i)},z(function(e,t){var n=-1,i=t.length,r=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(r=X.length>3&&"function"==typeof r?(i--,r):void 0,o&&W(t[0],t[1],o)&&(r=i<3?void 0:r,i=1),e=Object(e);++n<i;){var s=t[n];s&&X(e,s,n,r)}return e}));function ee(e){return H(e)?P(e):function(e){if(!Q(e))return L(e);var t=[];for(var n in Object(e))k.call(e,n)&&"constructor"!=n&&t.push(n);return t}(e)}var te=z(function(e,t){try{return E(e,void 0,t)}catch(e){return Y(e)?e:new Error(e)}});t.exports=function(e,t,n){var o,s=r.imports._.templateSettings||r;n&&W(e,t,n)&&(t=void 0),e=null==(o=e)?"":G(o),t=Z({},t,s,F);var a,u,c=Z({},t.imports,s.imports,F),l=ee(c),f=j(c,l),y=0,b=t.interpolate||g,_="__p += '",w=RegExp((t.escape||g).source+"|"+b.source+"|"+(b===i?v:g).source+"|"+(t.evaluate||g).source+"|$","g"),O="sourceURL"in t?"//# sourceURL="+t.sourceURL+"\n":"";e.replace(w,function(t,n,i,r,o,s){return i||(i=r),_+=e.slice(y,s).replace(m,x),n&&(a=!0,_+="' +\n__e("+n+") +\n'"),o&&(u=!0,_+="';\n"+o+";\n__p += '"),i&&(_+="' +\n((__t = ("+i+")) == null ? '' : __t) +\n'"),y=s+t.length,t}),_+="';\n";var E=t.variable;E||(_="with (obj) {\n"+_+"\n}\n"),_=(u?_.replace(d,""):_).replace(p,"$1").replace(h,"$1;"),_="function("+(E||"obj")+") {\n"+(E?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(a?", __e = _.escape":"")+(u?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+_+"return __p\n}";var I=te(function(){return Function(l,O+"return "+_).apply(void 0,f)});if(I.source=_,Y(I))throw I;return I}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"lodash._reinterpolate":6,"lodash.templatesettings":10}],10:[function(e,t,n){(function(n){var i=e("lodash._reinterpolate"),r=1/0,o="[object Symbol]",s=/[&<>"'`]/g,a=RegExp(s.source),u="object"==typeof n&&n&&n.Object===Object&&n,c="object"==typeof self&&self&&self.Object===Object&&self,l=u||c||Function("return this")();var f,d=(f={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},function(e){return null==f?void 0:f[e]}),p=Object.prototype.toString,h=l.Symbol,v=h?h.prototype:void 0,y=v?v.toString:void 0,g={escape:/<%-([\s\S]+?)%>/g,evaluate:/<%([\s\S]+?)%>/g,interpolate:i,variable:"",imports:{_:{escape:function(e){return(e=b(e))&&a.test(e)?e.replace(s,d):e}}}};function m(e){if("string"==typeof e)return e;if(function(e){return"symbol"==typeof e||function(e){return!!e&&"object"==typeof e}(e)&&p.call(e)==o}(e))return y?y.call(e):"";var t=e+"";return"0"==t&&1/e==-r?"-0":t}function b(e){return null==e?"":m(e)}t.exports=g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"lodash._reinterpolate":6}],11:[function(e,t,n){var i=e("./_root").Symbol;t.exports=i},{"./_root":18}],12:[function(e,t,n){var i=e("./_Symbol"),r=e("./_getRawTag"),o=e("./_objectToString"),s="[object Null]",a="[object Undefined]",u=i?i.toStringTag:void 0;t.exports=function(e){return null==e?void 0===e?a:s:u&&u in Object(e)?r(e):o(e)}},{"./_Symbol":11,"./_getRawTag":15,"./_objectToString":16}],13:[function(e,t,n){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],14:[function(e,t,n){var i=e("./_overArg")(Object.getPrototypeOf,Object);t.exports=i},{"./_overArg":17}],15:[function(e,t,n){var i=e("./_Symbol"),r=Object.prototype,o=r.hasOwnProperty,s=r.toString,a=i?i.toStringTag:void 0;t.exports=function(e){var t=o.call(e,a),n=e[a];try{e[a]=void 0;var i=!0}catch(e){}var r=s.call(e);return i&&(t?e[a]=n:delete e[a]),r}},{"./_Symbol":11}],16:[function(e,t,n){var i=Object.prototype.toString;t.exports=function(e){return i.call(e)}},{}],17:[function(e,t,n){t.exports=function(e,t){return function(n){return e(t(n))}}},{}],18:[function(e,t,n){var i=e("./_freeGlobal"),r="object"==typeof self&&self&&self.Object===Object&&self,o=i||r||Function("return this")();t.exports=o},{"./_freeGlobal":13}],19:[function(e,t,n){t.exports=function(e){return null!=e&&"object"==typeof e}},{}],20:[function(e,t,n){var i=e("./_baseGetTag"),r=e("./_getPrototype"),o=e("./isObjectLike"),s="[object Object]",a=Function.prototype,u=Object.prototype,c=a.toString,l=u.hasOwnProperty,f=c.call(Object);t.exports=function(e){if(!o(e)||i(e)!=s)return!1;var t=r(e);if(null===t)return!0;var n=l.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&c.call(n)==f}},{"./_baseGetTag":12,"./_getPrototype":14,"./isObjectLike":19}],21:[function(e,t,n){var i,r,o=t.exports={};function s(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(i===setTimeout)return setTimeout(e,0);if((i===s||!i)&&setTimeout)return i=setTimeout,setTimeout(e,0);try{return i(e,0)}catch(t){try{return i.call(null,e,0)}catch(t){return i.call(this,e,0)}}}!function(){try{i="function"==typeof setTimeout?setTimeout:s}catch(e){i=s}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var c,l=[],f=!1,d=-1;function p(){f&&c&&(f=!1,c.length?l=c.concat(l):d=-1,l.length&&h())}function h(){if(!f){var e=u(p);f=!0;for(var t=l.length;t;){for(c=l,l=[];++d<t;)c&&c[d].run();d=-1,t=l.length}c=null,f=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===a||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function v(e,t){this.fun=e,this.array=t}function y(){}o.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new v(e,t)),1!==l.length||f||u(h)},v.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=y,o.addListener=y,o.once=y,o.off=y,o.removeListener=y,o.removeAllListeners=y,o.emit=y,o.prependListener=y,o.prependOnceListener=y,o.listeners=function(e){return[]},o.binding=function(e){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(e){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],22:[function(e,t,n){"use strict";function i(e){return function(t){var n=t.dispatch,i=t.getState;return function(t){return function(r){return"function"==typeof r?r(n,i,e):t(r)}}}}n.__esModule=!0;var r=i();r.withExtraArgument=i,n.default=r},{}],23:[function(e,t,n){"use strict";n.__esModule=!0;var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e};n.default=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(n,r,o){var a,u=e(n,r,o),c=u.dispatch,l={getState:u.getState,dispatch:function(e){return c(e)}};return a=t.map(function(e){return e(l)}),c=s.default.apply(void 0,a)(u.dispatch),i({},u,{dispatch:c})}}};var r,o=e("./compose"),s=(r=o)&&r.__esModule?r:{default:r}},{"./compose":26}],24:[function(e,t,n){"use strict";function i(e,t){return function(){return t(e.apply(void 0,arguments))}}n.__esModule=!0,n.default=function(e,t){if("function"==typeof e)return i(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var n=Object.keys(e),r={},o=0;o<n.length;o++){var s=n[o],a=e[s];"function"==typeof a&&(r[s]=i(a,t))}return r}},{}],25:[function(e,t,n){(function(t){"use strict";n.__esModule=!0,n.default=function(e){for(var n=Object.keys(e),r={},s=0;s<n.length;s++){var c=n[s];"production"!==t.env.NODE_ENV&&void 0===e[c]&&(0,o.default)('No reducer provided for key "'+c+'"'),"function"==typeof e[c]&&(r[c]=e[c])}var l=Object.keys(r),f=void 0;"production"!==t.env.NODE_ENV&&(f={});var d=void 0;try{!function(e){Object.keys(e).forEach(function(t){var n=e[t];if(void 0===n(void 0,{type:i.ActionTypes.INIT}))throw new Error('Reducer "'+t+"\" returned undefined during initialization. If the state passed to the reducer is undefined, you must explicitly return the initial state. The initial state may not be undefined. If you don't want to set a value for this reducer, you can use null instead of undefined.");if(void 0===n(void 0,{type:"@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".")}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+i.ActionTypes.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.')})}(r)}catch(e){d=e}return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=arguments[1];if(d)throw d;if("production"!==t.env.NODE_ENV){var i=u(e,r,n,f);i&&(0,o.default)(i)}for(var s=!1,c={},p=0;p<l.length;p++){var h=l[p],v=r[h],y=e[h],g=v(y,n);if(void 0===g){var m=a(h,n);throw new Error(m)}c[h]=g,s=s||g!==y}return s?c:e}};var i=e("./createStore"),r=s(e("lodash/isPlainObject")),o=s(e("./utils/warning"));function s(e){return e&&e.__esModule?e:{default:e}}function a(e,t){var n=t&&t.type;return"Given action "+(n&&'"'+n.toString()+'"'||"an action")+', reducer "'+e+'" returned undefined. To ignore an action, you must explicitly return the previous state. If you want this reducer to hold no value, you can return null instead of undefined.'}function u(e,t,n,o){var s=Object.keys(t),a=n&&n.type===i.ActionTypes.INIT?"preloadedState argument passed to createStore":"previous state received by the reducer";if(0===s.length)return"Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers.";if(!(0,r.default)(e))return"The "+a+' has unexpected type of "'+{}.toString.call(e).match(/\s([a-z|A-Z]+)/)[1]+'". Expected argument to be an object with the following keys: "'+s.join('", "')+'"';var u=Object.keys(e).filter(function(e){return!t.hasOwnProperty(e)&&!o[e]});return u.forEach(function(e){o[e]=!0}),u.length>0?"Unexpected "+(u.length>1?"keys":"key")+' "'+u.join('", "')+'" found in '+a+'. Expected to find one of the known reducer keys instead: "'+s.join('", "')+'". Unexpected keys will be ignored.':void 0}}).call(this,e("_process"))},{"./createStore":27,"./utils/warning":29,_process:21,"lodash/isPlainObject":20}],26:[function(e,t,n){"use strict";n.__esModule=!0,n.default=function(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)return function(e){return e};if(1===t.length)return t[0];return t.reduce(function(e,t){return function(){return e(t.apply(void 0,arguments))}})}},{}],27:[function(e,t,n){"use strict";n.__esModule=!0,n.ActionTypes=void 0,n.default=function e(t,n,o){var a;"function"==typeof n&&void 0===o&&(o=n,n=void 0);if(void 0!==o){if("function"!=typeof o)throw new Error("Expected the enhancer to be a function.");return o(e)(t,n)}if("function"!=typeof t)throw new Error("Expected the reducer to be a function.");var u=t;var c=n;var l=[];var f=l;var d=!1;function p(){f===l&&(f=l.slice())}function h(){return c}function v(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return p(),f.push(e),function(){if(t){t=!1,p();var n=f.indexOf(e);f.splice(n,1)}}}function y(e){if(!(0,i.default)(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(d)throw new Error("Reducers may not dispatch actions.");try{d=!0,c=u(c,e)}finally{d=!1}for(var t=l=f,n=0;n<t.length;n++){var r=t[n];r()}return e}y({type:s.INIT});return a={dispatch:y,subscribe:v,getState:h,replaceReducer:function(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");u=e,y({type:s.INIT})}},a[r.default]=function(){var e,t=v;return(e={subscribe:function(e){if("object"!=typeof e)throw new TypeError("Expected the observer to be an object.");function n(){e.next&&e.next(h())}return n(),{unsubscribe:t(n)}}})[r.default]=function(){return this},e},a};var i=o(e("lodash/isPlainObject")),r=o(e("symbol-observable"));function o(e){return e&&e.__esModule?e:{default:e}}var s=n.ActionTypes={INIT:"@@redux/INIT"}},{"lodash/isPlainObject":20,"symbol-observable":33}],28:[function(e,t,n){(function(t){"use strict";n.__esModule=!0,n.compose=n.applyMiddleware=n.bindActionCreators=n.combineReducers=n.createStore=void 0;var i=c(e("./createStore")),r=c(e("./combineReducers")),o=c(e("./bindActionCreators")),s=c(e("./applyMiddleware")),a=c(e("./compose")),u=c(e("./utils/warning"));function c(e){return e&&e.__esModule?e:{default:e}}function l(){}"production"!==t.env.NODE_ENV&&"string"==typeof l.name&&"isCrushed"!==l.name&&(0,u.default)("You are currently using minified code outside of NODE_ENV === 'production'. This means that you are running a slower development build of Redux. You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) to ensure you have the correct code for your production build."),n.createStore=i.default,n.combineReducers=r.default,n.bindActionCreators=o.default,n.applyMiddleware=s.default,n.compose=a.default}).call(this,e("_process"))},{"./applyMiddleware":23,"./bindActionCreators":24,"./combineReducers":25,"./compose":26,"./createStore":27,"./utils/warning":29,_process:21}],29:[function(e,t,n){"use strict";n.__esModule=!0,n.default=function(e){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(e);try{throw new Error(e)}catch(e){}}},{}],30:[function(e,t,n){"use strict";var i=e("./src/suggestions");window.Suggestions=t.exports=i},{"./src/suggestions":32}],31:[function(e,t,n){var i=function(e){return this.component=e,this.items=[],this.active=0,this.element=document.createElement("ul"),this.element.className="suggestions",this.selectingListItem=!1,e.el.parentNode.insertBefore(this.element,e.el.nextSibling),this};i.prototype.show=function(){this.element.style.display="block"},i.prototype.hide=function(){this.element.style.display="none"},i.prototype.add=function(e){this.items.push(e)},i.prototype.clear=function(){this.items=[],this.active=0},i.prototype.isEmpty=function(){return!this.items.length},i.prototype.draw=function(){if(this.element.innerHTML="",0!==this.items.length){for(var e=0;e<this.items.length;e++)this.drawItem(this.items[e],this.active===e);this.show()}else this.hide()},i.prototype.drawItem=function(e,t){var n=document.createElement("li"),i=document.createElement("a");t&&(n.className+=" active"),i.innerHTML=e.string,n.appendChild(i),this.element.appendChild(n),n.addEventListener("mousedown",function(){this.selectingListItem=!0}.bind(this)),n.addEventListener("mouseup",function(){this.handleMouseUp.call(this,e)}.bind(this))},i.prototype.handleMouseUp=function(e){this.selectingListItem=!1,this.component.value(e.original),this.clear(),this.draw()},i.prototype.move=function(e){this.active=e,this.draw()},i.prototype.previous=function(){this.move(0===this.active?this.items.length-1:this.active-1)},i.prototype.next=function(){this.move(this.active===this.items.length-1?0:this.active+1)},t.exports=i},{}],32:[function(e,t,n){"use strict";var i=e("xtend"),r=e("fuzzy"),o=e("./list"),s=function(e,t,n){return n=n||{},this.options=i({minLength:2,limit:5,filter:!0},n),this.el=e,this.data=t||[],this.list=new o(this),this.query="",this.selected=null,this.list.draw(),this.el.addEventListener("keyup",function(e){this.handleKeyUp(e.keyCode)}.bind(this),!1),this.el.addEventListener("keydown",function(e){this.handleKeyDown(e)}.bind(this)),this.el.addEventListener("focus",function(){this.handleFocus()}.bind(this)),this.el.addEventListener("blur",function(){this.handleBlur()}.bind(this)),this.el.addEventListener("paste",function(e){this.handlePaste(e)}.bind(this)),this};s.prototype.handleKeyUp=function(e){40!==e&&38!==e&&27!==e&&13!==e&&9!==e&&this.handleInputChange(this.el.value)},s.prototype.handleKeyDown=function(e){switch(e.keyCode){case 13:case 9:e.preventDefault(),this.list.isEmpty()||(this.value(this.list.items[this.list.active].original),this.list.hide());break;case 27:this.list.isEmpty()||this.list.hide();break;case 38:this.list.previous();break;case 40:this.list.next()}},s.prototype.handleBlur=function(){this.list.selectingListItem||this.list.hide()},s.prototype.handlePaste=function(e){if(e.clipboardData)this.handleInputChange(e.clipboardData.getData("Text"));else{var t=this;setTimeout(function(){t.handleInputChange(e.target.value)},100)}},s.prototype.handleInputChange=function(e){this.query=this.normalize(e),this.list.clear(),this.query.length<this.options.minLength?this.list.draw():this.getCandidates(function(e){for(var t=0;t<e.length&&(this.list.add(e[t]),t!==this.options.limit-1);t++);this.list.draw()}.bind(this))},s.prototype.handleFocus=function(){this.list.isEmpty()||this.list.show(),this.list.selectingListItem=!1},s.prototype.update=function(e){this.data=e,this.handleKeyUp()},s.prototype.clear=function(){this.data=[],this.list.clear()},s.prototype.normalize=function(e){return e=e.toLowerCase()},s.prototype.match=function(e,t){return e.indexOf(t)>-1},s.prototype.value=function(e){if(this.selected=e,this.el.value=this.getItemValue(e),document.createEvent){var t=document.createEvent("HTMLEvents");t.initEvent("change",!0,!1),this.el.dispatchEvent(t)}else this.el.fireEvent("onchange")},s.prototype.getCandidates=function(e){var t={pre:"<strong>",post:"</strong>",extract:function(e){return this.getItemValue(e)}.bind(this)};e(this.options.filter?r.filter(this.query,this.data,t):this.data.map(function(e){for(var t=this.getItemValue(e),n=this.normalize(t),i=n.lastIndexOf(this.query);i>-1;){var r=i+this.query.length;t=t.slice(0,i)+"<strong>"+t.slice(i,r)+"</strong>"+t.slice(r),i=n.slice(0,i).lastIndexOf(this.query)}return{original:e,string:t}}.bind(this)))},s.prototype.getItemValue=function(e){return e},t.exports=s},{"./list":31,fuzzy:4,xtend:37}],33:[function(e,t,n){(function(i){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r,o,s=e("./ponyfill.js"),a=(r=s)&&r.__esModule?r:{default:r};o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==i?i:void 0!==t?t:Function("return this")();var u=(0,a.default)(o);n.default=u}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./ponyfill.js":34}],34:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(e){var t,n=e.Symbol;"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable";return t}},{}],35:[function(e,t,n){var i=e("turf-meta").coordEach;t.exports=function(e){var t=[1/0,1/0,-1/0,-1/0];return i(e,function(e){t[0]>e[0]&&(t[0]=e[0]),t[1]>e[1]&&(t[1]=e[1]),t[2]<e[0]&&(t[2]=e[0]),t[3]<e[1]&&(t[3]=e[1])}),t}},{"turf-meta":36}],36:[function(e,t,n){function i(e,t,n){var i,r,o,s,a,u,c,f,d,p=0,h="FeatureCollection"===e.type,v="Feature"===e.type,y=h?e.features.length:1;for(i=0;i<y;i++)for(u=(d="GeometryCollection"===(f=h?e.features[i].geometry:v?e.geometry:e).type)?f.geometries.length:1,s=0;s<u;s++)if(c=(a=d?f.geometries[s]:f).coordinates,p=!n||"Polygon"!==a.type&&"MultiPolygon"!==a.type?0:1,"Point"===a.type)t(c);else if("LineString"===a.type||"MultiPoint"===a.type)for(r=0;r<c.length;r++)t(c[r]);else if("Polygon"===a.type||"MultiLineString"===a.type)for(r=0;r<c.length;r++)for(o=0;o<c[r].length-p;o++)t(c[r][o]);else{if("MultiPolygon"!==a.type)throw new Error("Unknown Geometry Type");for(r=0;r<c.length;r++)for(o=0;o<c[r].length;o++)for(l=0;l<c[r][o].length-p;l++)t(c[r][o][l])}}function r(e,t){var n;switch(e.type){case"FeatureCollection":for(features=e.features,n=0;n<e.features.length;n++)t(e.features[n].properties);break;case"Feature":t(e.properties)}}t.exports.coordEach=i,t.exports.coordReduce=function(e,t,n,r){return i(e,function(e){n=t(n,e)},r),n},t.exports.propEach=r,t.exports.propReduce=function(e,t,n){return r(e,function(e){n=t(n,e)}),n}},{}],37:[function(e,t,n){t.exports=function(){for(var e={},t=0;t<arguments.length;t++){var n=arguments[t];for(var r in n)i.call(n,r)&&(e[r]=n[r])}return e};var i=Object.prototype.hasOwnProperty},{}],38:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.queryOrigin=function(e){return{type:r.ORIGIN_QUERY,query:e}},n.queryDestination=function(e){return{type:r.DESTINATION_QUERY,query:e}},n.queryOriginCoordinates=v,n.queryDestinationCoordinates=y,n.clearOrigin=function(){return function(e){e({type:r.ORIGIN_CLEAR}),e(_("clear",{type:"origin"})),e(h(null))}},n.clearDestination=function(){return function(e){e({type:r.DESTINATION_CLEAR}),e(_("clear",{type:"destination"})),e(h(null))}},n.setOptions=function(e){return{type:r.SET_OPTIONS,options:e}},n.hoverMarker=function(e){return function(t){t(function(e){return{type:r.HOVER_MARKER,hoverMarker:e}}(e?s.default.createPoint(e,{id:"hover"}):{}))}},n.setRouteIndex=g,n.createOrigin=m,n.createDestination=b,n.setProfile=function(e){return function(t,n){var i=n(),o=i.origin,s=i.destination;t({type:r.DIRECTIONS_PROFILE,profile:e}),t(_("profile",{profile:e})),o.geometry&&s.geometry&&t(d())}},n.reverse=function(){return function(e,t){var n=t();n.destination.geometry&&e(u(n.destination.geometry.coordinates)),n.origin.geometry&&e(c(n.origin.geometry.coordinates)),n.origin.geometry&&n.destination.geometry&&e(d())}},n.setOriginFromCoordinates=function(e){return function(t){if(s.default.validCoords(e)||(e=[s.default.wrap(e[0]),s.default.wrap(e[1])]),isNaN(e[0])&&isNaN(e[1]))return t(h(new Error("Coordinates are not valid")));t(v(e)),t(m(e))}},n.setDestinationFromCoordinates=function(e){return function(t){if(s.default.validCoords(e)||(e=[s.default.wrap(e[0]),s.default.wrap(e[1])]),isNaN(e[0])&&isNaN(e[1]))return t(h(new Error("Coordinates are not valid")));t(b(e)),t(y(e))}},n.addWaypoint=function(e,t){return function(n,i){var r=i(),o=r.destination,s=r.waypoints;s.splice(e,0,p(t)),n(f(s)),o.geometry&&n(d())}},n.setWaypoint=function(e,t){return function(n,i){var r=i(),o=r.destination,s=r.waypoints;s[e]=p(t),n(f(s)),o.geometry&&n(d())}},n.removeWaypoint=function(e){return function(t,n){var i=n(),r=i.destination,o=i.waypoints;t(f(o=o.filter(function(t){return!s.default.coordinateMatch(t,e)}))),r.geometry&&t(d())}},n.eventSubscribe=function(e,t){return function(n,i){var o=i().events;return o[e]=o[e]||[],o[e].push(t),{type:r.EVENTS,events:o}}},n.eventEmit=_;var i,r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(e("../constants/action_types")),o=e("../utils"),s=(i=o)&&i.__esModule?i:{default:i};var a=new XMLHttpRequest;function u(e){return function(t){var n=s.default.createPoint(e,{id:"origin","marker-symbol":"A"});t({type:r.ORIGIN,origin:n}),t(_("origin",{feature:n}))}}function c(e){return function(t){var n=s.default.createPoint(e,{id:"destination","marker-symbol":"B"});t({type:r.DESTINATION,destination:n}),t(_("destination",{feature:n}))}}function l(e){return function(t){t({type:r.DIRECTIONS,directions:e}),t(_("route",{route:e}))}}function f(e){return{type:r.WAYPOINTS,waypoints:e}}function d(){return function(e,t){var n=t(),i=n.api,r=n.accessToken,o=n.routeIndex,s=n.profile,f=n.alternatives,d=n.congestion,p=n.destination,v=n.language;if(p&&p.geometry){var y=function(e){var t=e(),n=t.origin,i=t.destination,r=t.waypoints,o=[];o.push(n.geometry.coordinates.join(",")),o.push(";"),r.length&&r.forEach(function(e){o.push(e.geometry.coordinates.join(",")),o.push(";")});return o.push(i.geometry.coordinates.join(",")),encodeURIComponent(o.join(""))}(t),m=[];m.push("geometries=polyline"),f&&m.push("alternatives=true"),d&&m.push("annotations=congestion"),m.push("steps=true"),m.push("overview=full"),v&&m.push("language="+v),r&&m.push("access_token="+r),a.abort(),a.open("GET",""+i+s+"/"+y+".json?"+m.join("&"),!0),a.onload=function(){if(!(a.status>=200&&a.status<400))return e(l([])),e(h(JSON.parse(a.responseText).message));var t=JSON.parse(a.responseText);if(t.error)return e(l([])),e(h(t.error));e(h(null)),t.routes[o]||e(g(0)),e(l(t.routes)),e(u(t.waypoints[0].location)),e(c(t.waypoints[t.waypoints.length-1].location))},a.onerror=function(){return e(l([])),e(h(JSON.parse(a.responseText).message))},a.send()}}}function p(e){var t={id:"waypoint"};return Object.assign(e,{properties:e.properties?Object.assign(e.properties,t):t})}function h(e){return function(t){t({type:"ERROR",error:e}),e&&t(_("error",{error:e}))}}function v(e){return{type:r.ORIGIN_FROM_COORDINATES,coordinates:e}}function y(e){return{type:r.DESTINATION_FROM_COORDINATES,coordinates:e}}function g(e){return{type:r.ROUTE_INDEX,routeIndex:e}}function m(e){return function(t,n){var i=n().destination;t(u(e)),i.geometry&&t(d())}}function b(e){return function(t,n){var i=n().origin;t(c(e)),i.geometry&&t(d())}}function _(e,t){var n=this;return function(i,o){var s=o().events;if(!s[e])return{type:r.EVENTS,events:s};for(var a=s[e].slice(),u=0;u<a.length;u++)a[u].call(n,t)}}},{"../constants/action_types":39,"../utils":47}],39:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.DESTINATION="DESTINATION",n.DESTINATION_CLEAR="DESTINATION_CLEAR",n.DESTINATION_QUERY="DESTINATION_QUERY",n.DESTINATION_FROM_COORDINATES="DESTINATION_FROM_COORDINATES",n.DIRECTIONS="DIRECTIONS",n.DIRECTIONS_PROFILE="DIRECTIONS_PROFILE",n.EVENTS="EVENTS",n.ERROR="ERROR",n.HOVER_MARKER="HOVER_MARKER",n.ORIGIN="ORIGIN",n.ORIGIN_CLEAR="ORIGIN_CLEAR",n.ORIGIN_QUERY="ORIGIN_QUERY",n.ORIGIN_FROM_COORDINATES="ORIGIN_FROM_COORDINATES",n.ROUTE_INDEX="ROUTE_INDEX",n.SET_OPTIONS="SET_OPTIONS",n.WAYPOINTS="WAYPOINTS"},{}],40:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),o=c(e("suggestions")),s=c(e("lodash.debounce")),a=e("events"),u=c(e("../utils"));function c(e){return e&&e.__esModule?e:{default:e}}var l=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._ev=new a.EventEmitter,this.options=t,this.api=t&&t.api||"https://api.mapbox.com/geocoding/v5/mapbox.places/"}return r(e,[{key:"onAdd",value:function(e){this._map=e,this.request=new XMLHttpRequest;var t=document.createElement("div");t.className="mapboxgl-ctrl-geocoder";var n=document.createElement("span");n.className="geocoder-icon geocoder-icon-search";var i=this._inputEl=document.createElement("input");i.type="text",i.placeholder=this.options.placeholder,i.addEventListener("keydown",(0,s.default)(function(e){if(!e.target.value)return this._clearEl.classList.remove("active");e.metaKey||-1!==[9,27,37,39,13,38,40].indexOf(e.keyCode)||this._queryFromInput(e.target.value)}.bind(this)),200),i.addEventListener("change",function(t){t.target.value&&this._clearEl.classList.add("active");var n=this._typeahead.selected;if(n){if(this.options.flyTo)if(n.bbox&&n.context&&n.context.length<=3||n.bbox&&!n.context){var i=n.bbox;e.fitBounds([[i[0],i[1]],[i[2],i[3]]])}else e.flyTo({center:n.center,zoom:this.options.zoom});this._input=n,this.fire("result",{result:n})}}.bind(this));var r=document.createElement("div");r.classList.add("geocoder-pin-right");var a=this._clearEl=document.createElement("button");a.className="geocoder-icon geocoder-icon-close",a.addEventListener("click",this._clear.bind(this));var u=this._loadingEl=document.createElement("span");return u.className="geocoder-icon geocoder-icon-loading",r.appendChild(a),r.appendChild(u),t.appendChild(n),t.appendChild(i),t.appendChild(r),this.options.container&&(this.options.position=!1),this._typeahead=new o.default(i,[],{filter:!1}),this._typeahead.getItemValue=function(e){return e.place_name},t}},{key:"_geocode",value:function(e,t){this._loadingEl.classList.add("active"),this.fire("loading");var n=this.options,i=["placeholder","zoom","flyTo","accessToken"],r=Object.keys(this.options).filter(function(e){return-1===i.indexOf(e)}).map(function(e){return e+"="+n[e]}),o=this.options.accessToken?this.options.accessToken:mapboxgl.accessToken;r.push("access_token="+o),this.request.abort(),this.request.open("GET",this.api+encodeURIComponent(e.trim())+".json?"+r.join("&"),!0),this.request.onload=function(){if(this._loadingEl.classList.remove("active"),this.request.status>=200&&this.request.status<400){var e=JSON.parse(this.request.responseText);return e.features.length?this._clearEl.classList.add("active"):(this._clearEl.classList.remove("active"),this._typeahead.selected=null),this.fire("results",{results:e.features}),this._typeahead.update(e.features),t(e.features)}this.fire("error",{error:JSON.parse(this.request.responseText).message})}.bind(this),this.request.onerror=function(){this._loadingEl.classList.remove("active"),this.fire("error",{error:JSON.parse(this.request.responseText).message})}.bind(this),this.request.send()}},{key:"_queryFromInput",value:function(e){(e=e.trim())||this._clear(),e.length>2&&this._geocode(e,function(e){this._results=e}.bind(this))}},{key:"_change",value:function(){var e=document.createEvent("HTMLEvents");e.initEvent("change",!0,!1),this._inputEl.dispatchEvent(e)}},{key:"_query",value:function(e){e&&("object"===(void 0===e?"undefined":i(e))&&e.length&&(e=[u.default.wrap(e[0]),u.default.wrap(e[1])].join()),this._geocode(e,function(e){if(e.length){var t=e[0];this._results=e,this._typeahead.selected=t,this._inputEl.value=t.place_name,this._change()}}.bind(this)))}},{key:"_setInput",value:function(e){e&&("object"===(void 0===e?"undefined":i(e))&&e.length&&(e=[u.default.roundWithOriginalPrecision(u.default.wrap(e[0]),e[0]),u.default.roundWithOriginalPrecision(u.default.wrap(e[1]),e[1])].join()),this._inputEl.value=e,this._input=null,this._typeahead.selected=null,this._typeahead.clear(),this._change())}},{key:"_clear",value:function(){this._input=null,this._inputEl.value="",this._typeahead.selected=null,this._typeahead.clear(),this._change(),this._inputEl.focus(),this._clearEl.classList.remove("active"),this.fire("clear")}},{key:"getResult",value:function(){return this._input}},{key:"query",value:function(e){return this._query(e),this}},{key:"setInput",value:function(e){return this._setInput(e),this}},{key:"on",value:function(e,t){return this._ev.on(e,t),this}},{key:"fire",value:function(e,t){return this._ev.emit(e,t),this}},{key:"off",value:function(e,t){return this._ev.removeListener(e,t),this}}]),e}();n.default=l},{"../utils":47,events:3,"lodash.debounce":7,suggestions:30}],41:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=u(e("./geocoder")),o=u(e("lodash.template")),s=u(e("lodash.isequal")),a=u(e("turf-extent"));function u(e){return e&&e.__esModule?e:{default:e}}var c=(0,o.default)("<div class='mapbox-directions-component mapbox-directions-inputs'>\n <div class='mapbox-directions-component-keyline'>\n <div class='mapbox-directions-origin'>\n <label class='mapbox-form-label'>\n <span class='directions-icon directions-icon-depart'></span>\n </label>\n <div id='mapbox-directions-origin-input'></div>\n </div>\n\n <button\n class='directions-icon directions-icon-reverse directions-reverse js-reverse-inputs'\n title='Reverse origin & destination'>\n </button>\n\n <div class='mapbox-directions-destination'>\n <label class='mapbox-form-label'>\n <span class='directions-icon directions-icon-arrive'></span>\n </label>\n <div id='mapbox-directions-destination-input'></div>\n </div>\n </div>\n\n <% if (controls.profileSwitcher) { %>\n <div class='mapbox-directions-profile mapbox-directions-component-keyline mapbox-directions-clearfix'><input\n id='mapbox-directions-profile-driving-traffic'\n type='radio'\n name='profile'\n value='mapbox/driving-traffic'\n <% if (profile === 'mapbox/driving-traffic') { %>checked<% } %>\n />\n <label for='mapbox-directions-profile-driving-traffic'>Traffic</label>\n <input\n id='mapbox-directions-profile-driving'\n type='radio'\n name='profile'\n value='mapbox/driving'\n <% if (profile === 'mapbox/driving') { %>checked<% } %>\n />\n <label for='mapbox-directions-profile-driving'>Driving</label>\n <input\n id='mapbox-directions-profile-walking'\n type='radio'\n name='profile'\n value='mapbox/walking'\n <% if (profile === 'mapbox/walking') { %>checked<% } %>\n />\n <label for='mapbox-directions-profile-walking'>Walking</label>\n <input\n id='mapbox-directions-profile-cycling'\n type='radio'\n name='profile'\n value='mapbox/cycling'\n <% if (profile === 'mapbox/cycling') { %>checked<% } %>\n />\n <label for='mapbox-directions-profile-cycling'>Cycling</label>\n </div>\n <% } %>\n</div>\n"),l=function(){function e(t,n,i,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e);var o=n.getState(),s=o.originQuery,a=o.destinationQuery,u=o.profile,l=o.controls;t.innerHTML=c({originQuery:s,destinationQuery:a,profile:u,controls:l}),this.container=t,this.actions=i,this.store=n,this._map=r,this.onAdd(),this.render()}return i(e,[{key:"animateToCoordinates",value:function(e,t){var n=this.store.getState(),i=n.origin,r=n.destination;if(i.geometry&&r.geometry&&!(0,s.default)(i.geometry,r.geometry)){var o=(0,a.default)({type:"FeatureCollection",features:[i,r]});this._map.fitBounds([[o[0],o[1]],[o[2],o[3]]],{padding:80})}else this._map.flyTo({center:t})}},{key:"onAdd",value:function(){var e=this,t=this.actions,n=t.clearOrigin,i=t.clearDestination,o=t.createOrigin,s=t.createDestination,a=t.setProfile,u=t.reverse,c=this.store.getState(),l=c.geocoder,f=c.accessToken,d=c.flyTo,p=c.placeholderOrigin,h=c.placeholderDestination,v=c.zoom;this.originInput=new r.default(Object.assign({},{accessToken:f},l,{flyTo:d,placeholder:p,zoom:v}));var y=this.originInput.onAdd(this._map);this.container.querySelector("#mapbox-directions-origin-input").appendChild(y),this.destinationInput=new r.default(Object.assign({},{accessToken:f},l,{flyTo:d,placeholder:h,zoom:v}));var g=this.destinationInput.onAdd(this._map);this.container.querySelector("#mapbox-directions-destination-input").appendChild(g),this.originInput.on("result",function(t){var n=t.result.center;o(n),e.animateToCoordinates("origin",n)}),this.originInput.on("clear",n),this.destinationInput.on("result",function(t){var n=t.result.center;s(n),e.animateToCoordinates("destination",n)}),this.destinationInput.on("clear",i);var m=this.container.querySelectorAll('input[type="radio"]');Array.prototype.forEach.call(m,function(e){e.addEventListener("change",function(){a(e.value)})}),this.container.querySelector(".js-reverse-inputs").addEventListener("click",function(){var t=e.store.getState(),n=t.origin,i=t.destination;n&&e.actions.queryDestination(n.geometry.coordinates),i&&e.actions.queryOrigin(i.geometry.coordinates),u()})}},{key:"render",value:function(){var e=this;this.store.subscribe(function(){var t=e.store.getState(),n=t.originQuery,i=t.destinationQuery,r=t.originQueryCoordinates,o=t.destinationQueryCoordinates;n&&(e.originInput.query(n),e.actions.queryOrigin(null)),i&&(e.destinationInput.query(i),e.actions.queryDestination(null)),r&&(e.originInput.setInput(r),e.animateToCoordinates("origin",r),e.actions.queryOriginCoordinates(null)),o&&(e.destinationInput.setInput(o),e.animateToCoordinates("destination",o),e.actions.queryDestinationCoordinates(null))})}}]),e}();n.default=l},{"./geocoder":40,"lodash.isequal":8,"lodash.template":9,"turf-extent":35}],42:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=a(e("../utils")),o=a(e("lodash.template")),s=a(e("lodash.isequal"));function a(e){return e&&e.__esModule?e:{default:e}}var u=(0,o.default)("<div class='directions-control directions-control-directions'>\n <div class='mapbox-directions-component mapbox-directions-route-summary<% if (routes > 1) { %> mapbox-directions-multiple<% } %>'>\n <% if (routes > 1) { %>\n <div class='mapbox-directions-routes mapbox-directions-clearfix'>\n <% for (var i = 0; i < routes; i++) { %>\n <input type='radio' name='routes' id='<%= i %>' <% if (i === routeIndex) { %>checked<% } %>>\n <label for='<%= i %>' class='mapbox-directions-route'><%= i + 1 %></label>\n <% } %>\n </div>\n <% } %>\n <h1><%- duration %></h1>\n <span><%- distance %></span>\n </div>\n\n <div class='mapbox-directions-instructions'>\n <div class='mapbox-directions-instructions-wrapper'>\n <ol class='mapbox-directions-steps'>\n <% steps.forEach(function(step) { %>\n <%\n var distance = step.distance ? format(step.distance) : false;\n var icon = step.maneuver.modifier ? step.maneuver.modifier.replace(/\\s+/g, '-').toLowerCase() : step.maneuver.type.replace(/\\s+/g, '-').toLowerCase();\n\n if (step.maneuver.type === 'arrive' || step.maneuver.type === 'depart') {\n icon = step.maneuver.type;\n }\n\n if (step.maneuver.type === 'roundabout' || step.maneuver.type === 'rotary') {\n icon= 'roundabout';\n }\n\n var lng = step.maneuver.location[0];\n var lat = step.maneuver.location[1];\n %>\n <li\n data-lat='<%= lat %>'\n data-lng='<%= lng %>'\n class='mapbox-directions-step'>\n <span class='directions-icon directions-icon-<%= icon %>'></span>\n <div class='mapbox-directions-step-maneuver'>\n <%= step.maneuver.instruction %>\n </div>\n <% if (distance) { %>\n <div class='mapbox-directions-step-distance'>\n <%= distance %>\n </div>\n <% } %>\n </li>\n <% }); %>\n </ol>\n </div>\n </div>\n</div>\n"),c=(0,o.default)("<div class='directions-control directions-control-directions'>\n <div class='mapbox-directions-error'>\n <%= error %>\n </div>\n</div>\n"),l=function(){function e(t,n,i,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.container=t,this.actions=i,this.store=n,this._map=r,this.directions={},this.render()}return i(e,[{key:"render",value:function(){var e=this;this.store.subscribe(function(){var t=e.actions,n=t.hoverMarker,i=t.setRouteIndex,o=e.store.getState(),a=o.routeIndex,l=o.unit,f=o.directions,d=o.error,p=o.compile,h=!(0,s.default)(f[a],e.directions);if(d)e.container.innerHTML=c({error:d});else if(f.length&&h){var v=e.directions=f[a];p&&v.legs.forEach(function(e){e.steps.forEach(function(e){e.maneuver.instruction=p("en",e)})}),e.container.innerHTML=u({routeIndex:a,routes:f.length,steps:v.legs[0].steps,format:r.default.format[l],duration:r.default.format[l](v.distance),distance:r.default.format.duration(v.duration)});var y=e.container.querySelectorAll(".mapbox-directions-step");Array.prototype.forEach.call(y,function(t){var i=t.getAttribute("data-lng"),r=t.getAttribute("data-lat");t.addEventListener("mouseover",function(){n([i,r])}),t.addEventListener("mouseout",function(){n(null)}),t.addEventListener("click",function(){e._map.flyTo({center:[i,r],zoom:16})})});var g=e.container.querySelectorAll('input[type="radio"]');Array.prototype.forEach.call(g,function(e){e.addEventListener("change",function(e){i(parseInt(e.target.id,10))})})}else e.container.innerHTML&&h&&(e.container.innerHTML="")})}}]),e}();n.default=l},{"../utils":47,"lodash.isequal":8,"lodash.template":9}],43:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=e("redux"),o=p(e("redux-thunk")),s=e("@mapbox/polyline"),a=p(e("./utils")),u=p(e("./reducers")),c=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(e("./actions")),l=p(e("./directions_style")),f=p(e("./controls/inputs")),d=p(e("./controls/instructions"));function p(e){return e&&e.__esModule?e:{default:e}}var h=(0,r.applyMiddleware)(o.default)(r.createStore)(u.default),v=function(){function e(t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.actions=(0,r.bindActionCreators)(c,h.dispatch),this.actions.setOptions(t||{}),this.options=t||{},this.onDragDown=this._onDragDown.bind(this),this.onDragMove=this._onDragMove.bind(this),this.onDragUp=this._onDragUp.bind(this),this.move=this._move.bind(this),this.onClick=this._clickHandler().bind(this)}return i(e,[{key:"onAdd",value:function(e){var t=this;this._map=e;var n=h.getState().controls,i=this.container=document.createElement("div");i.className="mapboxgl-ctrl-directions mapboxgl-ctrl";var r=document.createElement("div");r.className="directions-control directions-control-inputs",new f.default(r,h,this.actions,this._map);var o=document.createElement("div");return o.className="directions-control directions-control-instructions",new d.default(o,h,{hoverMarker:this.actions.hoverMarker,setRouteIndex:this.actions.setRouteIndex},this._map),n.inputs&&i.appendChild(r),n.instructions&&i.appendChild(o),this.subscribedActions(),this._map.loaded()?this.mapState():this._map.on("load",function(){return t.mapState()}),i}},{key:"onRemove",value:function(e){return this.container.parentNode.removeChild(this.container),this.removeRoutes(),e.off("mousedown",this.onDragDown),e.off("mousemove",this.move),e.off("touchstart",this.onDragDown),e.off("touchstart",this.move),e.off("click",this.onClick),this.storeUnsubscribe&&(this.storeUnsubscribe(),delete this.storeUnsubscribe),l.default.forEach(function(t){e.getLayer(t.id)&&e.removeLayer(t.id)}),e.getSource("directions")&&e.removeSource("directions"),this._map=null,this}},{key:"mapState",value:function(){var e=this,t=h.getState(),n=t.profile,i=(t.alternatives,t.congestion,t.styles),r=t.interactive;t.compile;this.actions.eventEmit("profile",{profile:n});this._map.addSource("directions",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),i&&i.length&&i.forEach(function(t){return e._map.addLayer(t)}),l.default.forEach(function(t){e._map.getLayer(t.id)||e._map.addLayer(t)}),r&&(this._map.on("mousedown",this.onDragDown),this._map.on("mousemove",this.move),this._map.on("click",this.onClick),this._map.on("touchstart",this.move),this._map.on("touchstart",this.onDragDown))}},{key:"subscribedActions",value:function(){var e=this;this.storeUnsubscribe=h.subscribe(function(){var t=h.getState(),n=t.origin,i=t.destination,r=t.hoverMarker,o=t.directions,a=t.routeIndex,u={type:"FeatureCollection",features:[n,i,r].filter(function(e){return e.geometry})};o.length&&o.forEach(function(e,t){var n=[];(0,s.decode)(e.geometry,5).map(function(e){return e.reverse()}).forEach(function(i,r){var o=n[n.length-1],s=e.legs[0].annotation&&e.legs[0].annotation.congestion&&e.legs[0].annotation.congestion[r-1];if(!o||s&&o.properties.congestion!==s){var u={geometry:{type:"LineString",coordinates:[]},properties:{"route-index":t,route:t===a?"selected":"alternate"}};o&&u.geometry.coordinates.push(o.geometry.coordinates[o.geometry.coordinates.length-1]),u.geometry.coordinates.push(i),s&&(u.properties.congestion=e.legs[0].annotation.congestion[r-1]),n.push(u)}else o.geometry.coordinates.push(i)}),u.features=u.features.concat(n),t===a&&e.legs[0].steps.forEach(function(e){"waypoint"===e.maneuver.type&&u.features.push({type:"Feature",geometry:e.maneuver.location,properties:{id:"waypoint"}})})}),e._map.style&&e._map.getSource("directions")&&e._map.getSource("directions").setData(u)})}},{key:"_clickHandler",value:function(){var e=null;return function(t){if(e)clearTimeout(e),e=null,this._map.zoomIn();else{var n=this._onSingleClick.bind(this);e=setTimeout(function(){n(t),e=null},250)}}}},{key:"_onSingleClick",value:function(e){var t=this,n=h.getState().origin,i=[e.lngLat.lng,e.lngLat.lat];if(n.geometry){var r=this._map.queryRenderedFeatures(e.point,{layers:["directions-origin-point","directions-destination-point","directions-waypoint-point","directions-route-line-alt"]});if(r.length){if(r.forEach(function(e){"directions-waypoint-point"===e.layer.id&&t.actions.removeWaypoint(e)}),"alternate"===r[0].properties.route){var o=r[0].properties["route-index"];this.actions.setRouteIndex(o)}}else this.actions.setDestinationFromCoordinates(i),this._map.flyTo({center:i})}else this.actions.setOriginFromCoordinates(i)}},{key:"_move",value:function(e){var t=this,n=h.getState().hoverMarker,i=this._map.queryRenderedFeatures(e.point,{layers:["directions-route-line-alt","directions-route-line","directions-origin-point","directions-destination-point","directions-hover-point"]});this._map.getCanvas().style.cursor=i.length?"pointer":"",i.length?(this.isCursorOverPoint=i[0],this._map.dragPan.disable(),i.forEach(function(i){"directions-route-line"===i.layer.id?t.actions.hoverMarker([e.lngLat.lng,e.lngLat.lat]):n.geometry&&t.actions.hoverMarker(null)})):this.isCursorOverPoint&&(this.isCursorOverPoint=!1,this._map.dragPan.enable())}},{key:"_onDragDown",value:function(){this.isCursorOverPoint&&(this.isDragging=this.isCursorOverPoint,this._map.getCanvas().style.cursor="grab",this._map.on("mousemove",this.onDragMove),this._map.on("mouseup",this.onDragUp),this._map.on("touchmove",this.onDragMove),this._map.on("touchend",this.onDragUp))}},{key:"_onDragMove",value:function(e){if(this.isDragging){var t=[e.lngLat.lng,e.lngLat.lat];switch(this.isDragging.layer.id){case"directions-origin-point":this.actions.createOrigin(t);break;case"directions-destination-point":this.actions.createDestination(t);break;case"directions-hover-point":this.actions.hoverMarker(t)}}}},{key:"_onDragUp",value:function(){if(this.isDragging){var e=h.getState(),t=e.hoverMarker,n=e.origin,i=e.destination;switch(this.isDragging.layer.id){case"directions-origin-point":this.actions.setOriginFromCoordinates(n.geometry.coordinates);break;case"directions-destination-point":this.actions.setDestinationFromCoordinates(i.geometry.coordinates);break;case"directions-hover-point":t.geometry&&!a.default.coordinateMatch(this.isDragging,t)&&this.actions.addWaypoint(0,t)}this.isDragging=!1,this._map.getCanvas().style.cursor="",this._map.off("touchmove",this.onDragMove),this._map.off("touchend",this.onDragUp),this._map.off("mousemove",this.onDragMove),this._map.off("mouseup",this.onDragUp)}}},{key:"interactive",value:function(e){return e?(this._map.on("touchstart",this.move),this._map.on("touchstart",this.onDragDown),this._map.on("mousedown",this.onDragDown),this._map.on("mousemove",this.move),this._map.on("click",this.onClick)):(this._map.off("touchstart",this.move),this._map.off("touchstart",this.onDragDown),this._map.off("mousedown",this.onDragDown),this._map.off("mousemove",this.move),this._map.off("click",this.onClick)),this}},{key:"getOrigin",value:function(){return h.getState().origin}},{key:"setOrigin",value:function(e){return"string"==typeof e?this.actions.queryOrigin(e):this.actions.setOriginFromCoordinates(e),this}},{key:"getDestination",value:function(){return h.getState().destination}},{key:"setDestination",value:function(e){return"string"==typeof e?this.actions.queryDestination(e):this.actions.setDestinationFromCoordinates(e),this}},{key:"reverse",value:function(){return this.actions.reverse(),this}},{key:"addWaypoint",value:function(e,t){return t.type||(t=a.default.createPoint(t,{id:"waypoint"})),this.actions.addWaypoint(e,t),this}},{key:"setWaypoint",value:function(e,t){return t.type||(t=a.default.createPoint(t,{id:"waypoint"})),this.actions.setWaypoint(e,t),this}},{key:"removeWaypoint",value:function(e){var t=h.getState().waypoints;return this.actions.removeWaypoint(t[e]),this}},{key:"getWaypoints",value:function(){return h.getState().waypoints}},{key:"removeRoutes",value:function(){return this.actions.clearOrigin(),this.actions.clearDestination(),this}},{key:"on",value:function(e,t){return this.actions.eventSubscribe(e,t),this}}]),e}();n.default=v},{"./actions":38,"./controls/inputs":41,"./controls/instructions":42,"./directions_style":44,"./reducers":46,"./utils":47,"@mapbox/polyline":1,redux:28,"redux-thunk":22}],44:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.default=[{id:"directions-route-line-alt",type:"line",source:"directions",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#bbb","line-width":4},filter:["all",["in","$type","LineString"],["in","route","alternate"]]},{id:"directions-route-line-casing",type:"line",source:"directions",layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2d5f99","line-width":12},filter:["all",["in","$type","LineString"],["in","route","selected"]]},{id:"directions-route-line",type:"line",source:"directions",layout:{"line-cap":"butt","line-join":"round"},paint:{"line-color":{property:"congestion",type:"categorical",default:"#4882c5",stops:[["unknown","#4882c5"],["low","#4882c5"],["moderate","#f09a46"],["heavy","#e34341"],["severe","#8b2342"]]},"line-width":7},filter:["all",["in","$type","LineString"],["in","route","selected"]]},{id:"directions-hover-point-casing",type:"circle",source:"directions",paint:{"circle-radius":8,"circle-color":"#fff"},filter:["all",["in","$type","Point"],["in","id","hover"]]},{id:"directions-hover-point",type:"circle",source:"directions",paint:{"circle-radius":6,"circle-color":"#3bb2d0"},filter:["all",["in","$type","Point"],["in","id","hover"]]},{id:"directions-waypoint-point-casing",type:"circle",source:"directions",paint:{"circle-radius":8,"circle-color":"#fff"},filter:["all",["in","$type","Point"],["in","id","waypoint"]]},{id:"directions-waypoint-point",type:"circle",source:"directions",paint:{"circle-radius":6,"circle-color":"#8a8bc9"},filter:["all",["in","$type","Point"],["in","id","waypoint"]]},{id:"directions-origin-point",type:"circle",source:"directions",paint:{"circle-radius":18,"circle-color":"#3bb2d0"},filter:["all",["in","$type","Point"],["in","marker-symbol","A"]]},{id:"directions-origin-label",type:"symbol",source:"directions",layout:{"text-field":"A","text-font":["Open Sans Bold","Arial Unicode MS Bold"],"text-size":12},paint:{"text-color":"#fff"},filter:["all",["in","$type","Point"],["in","marker-symbol","A"]]},{id:"directions-destination-point",type:"circle",source:"directions",paint:{"circle-radius":18,"circle-color":"#8a8bc9"},filter:["all",["in","$type","Point"],["in","marker-symbol","B"]]},{id:"directions-destination-label",type:"symbol",source:"directions",layout:{"text-field":"B","text-font":["Open Sans Bold","Arial Unicode MS Bold"],"text-size":12},paint:{"text-color":"#fff"},filter:["all",["in","$type","Point"],["in","marker-symbol","B"]]}]},{}],45:[function(e,t,n){"use strict";var i,r=e("./directions"),o=(i=r)&&i.__esModule?i:{default:i};t.exports=o.default},{"./directions":43}],46:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i,r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}(e("../constants/action_types.js")),o=e("deep-assign"),s=(i=o)&&i.__esModule?i:{default:i};var a={api:"https://api.mapbox.com/directions/v5/",profile:"mapbox/driving-traffic",alternatives:!1,congestion:!1,unit:"imperial",flyTo:!0,placeholderOrigin:"Choose a starting place",placeholderDestination:"Choose destination",zoom:16,language:"en",compile:null,proximity:!1,styles:[],controls:{profileSwitcher:!0,inputs:!0,instructions:!0},geocoder:{},interactive:!0,events:{},origin:{},destination:{},hoverMarker:{},waypoints:[],originQuery:null,destinationQuery:null,originQueryCoordinates:null,destinationQueryCoordinates:null,directions:[],routeIndex:0};n.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a,t=arguments[1];switch(t.type){case r.SET_OPTIONS:return(0,s.default)({},e,t.options);case r.DIRECTIONS_PROFILE:return Object.assign({},e,{profile:t.profile});case r.ORIGIN:return Object.assign({},e,{origin:t.origin,hoverMarker:{}});case r.DESTINATION:return Object.assign({},e,{destination:t.destination,hoverMarker:{}});case r.HOVER_MARKER:return Object.assign({},e,{hoverMarker:t.hoverMarker});case r.WAYPOINTS:return Object.assign({},e,{waypoints:t.waypoints});case r.ORIGIN_QUERY:return Object.assign({},e,{originQuery:t.query});case r.DESTINATION_QUERY:return Object.assign({},e,{destinationQuery:t.query});case r.ORIGIN_FROM_COORDINATES:return Object.assign({},e,{originQueryCoordinates:t.coordinates});case r.DESTINATION_FROM_COORDINATES:return Object.assign({},e,{destinationQueryCoordinates:t.coordinates});case r.ORIGIN_CLEAR:return Object.assign({},e,{origin:{},originQuery:"",waypoints:[],directions:[]});case r.DESTINATION_CLEAR:return Object.assign({},e,{destination:{},destinationQuery:"",waypoints:[],directions:[]});case r.DIRECTIONS:return Object.assign({},e,{directions:t.directions});case r.ROUTE_INDEX:return Object.assign({},e,{routeIndex:t.routeIndex});case r.ERROR:return Object.assign({},e,{error:t.error});default:return e}}},{"../constants/action_types.js":39,"deep-assign":2}],47:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var i={duration:function(e){var t=Math.floor(e/60),n=Math.floor(t/60);return e%=60,t%=60,0===n&&0===t?e+"s":0===n?t+"min":n+"h "+t+"min"},imperial:function(e){var t=e/1609.344;return t>=100?t.toFixed(0)+"mi":t>=10?t.toFixed(1)+"mi":t>=.1?t.toFixed(2)+"mi":(5280*t).toFixed(0)+"ft"},metric:function(e){return e>=1e5?(e/1e3).toFixed(0)+"km":e>=1e4?(e/1e3).toFixed(1)+"km":e>=100?(e/1e3).toFixed(2)+"km":e.toFixed(0)+"m"}};n.default={format:i,coordinateMatch:function(e,t){return e=e.geometry.coordinates,t=t.geometry.coordinates,e.join()===t.join()||e[0].toFixed(3)===t[0].toFixed(3)&&e[1].toFixed(3)===t[1].toFixed(3)},createPoint:function(e,t){return{type:"Feature",geometry:{type:"Point",coordinates:e},properties:t||{}}},validCoords:function(e){return e[0]>=-180&&e[0]<=180&&e[1]>=-90&&e[1]<=90},wrap:function(e){var t=((e- -180)%360+360)%360-180;return-180===t?180:t},roundWithOriginalPrecision:function(e,t){var n=0;return Math.floor(t)!==t&&(n=t.toString().split(".")[1].length),e.toFixed(Math.min(n,5))}}},{}]},{},[45])(45)});