From 1e5854b43db87c8e99a04183f7785b14c49c88e9 Mon Sep 17 00:00:00 2001 From: Deepak Grover Date: Tue, 16 May 2017 18:51:56 +0530 Subject: [PATCH] update reactivemaps and bump version --- dist/airbnb_recipe.bundle.js | 6 +++--- dist/ecommerce_recipe.bundle.js | 6 +++--- dist/meetup_recipe.bundle.js | 6 +++--- dist/news_recipe.bundle.js | 6 +++--- dist/producthunt_recipe.bundle.js | 6 +++--- dist/simplebeds_recipe.bundle.js | 6 +++--- dist/yelp_recipe.bundle.js | 6 +++--- package.json | 4 ++-- umd/ReactiveSearch.js | 18 +++++++++--------- yarn.lock | 14 +++++++------- 10 files changed, 39 insertions(+), 39 deletions(-) diff --git a/dist/airbnb_recipe.bundle.js b/dist/airbnb_recipe.bundle.js index 04753dc7dc..dcbcf3e182 100644 --- a/dist/airbnb_recipe.bundle.js +++ b/dist/airbnb_recipe.bundle.js @@ -22,7 +22,7 @@ return s(d,a?n:this,p)}var a=t&ve,i=Zo(e);return o}function ua(e){return functio Licensed under the MIT License (MIT), see http://jedwatson.github.io/react-select */ -"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;ts.bottom||i.topt.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var n=this,r="object"==typeof t?t:this.props;if(r.multi){if("string"==typeof e&&(e=e.split(r.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return n.expandValue(e,r)}).filter(function(e){return e})}var o=this.expandValue(e,r);return o?[o]:[]},expandValue:function(e,t){var n=typeof e;if("string"!==n&&"number"!==n&&"boolean"!==n)return e;var r=t.options,o=t.valueKey;if(r)for(var a=0;ar&&this.focusOption(n[r+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var n=-1,r=0;r0?n-=1:n=t.length-1;else if("start"===e)n=0;else if("end"===e)n=t.length-1;else if("page_up"===e){var o=n-this.props.pageSize;n=o<0?0:o}else if("page_down"===e){var o=n+this.props.pageSize;n=o>t.length-1?t.length-1:o}n===-1&&(n=0),this.setState({focusedIndex:t[n].index,focusedOption:t[n].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return l["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},l["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var n=this,r=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:l["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var a=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return l["default"].createElement(o,{id:n._instancePrefix+"-value-"+t,instancePrefix:n._instancePrefix,disabled:n.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[n.props.valueKey],onClick:a,onRemove:n.removeValue,value:e},r(e,t),l["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(a=null),l["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:a,value:e[0]},r(e[0])))},renderInput:function(e,t){var n,r=this,i=(0,m["default"])("Select-input",this.props.inputProps.className),u=!!this.state.isOpen,c=(0,m["default"])((n={},a(n,this._instancePrefix+"-list",u),a(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),p=s({},this.props.inputProps,{role:"combobox","aria-expanded":""+u,"aria-owns":c,"aria-haspopup":""+u,"aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:i,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(p);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,h=(d.inputClassName,o(d,["inputClassName"]));return l["default"].createElement("div",s({},h,{role:"combobox","aria-expanded":u,"aria-owns":u?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:i,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?l["default"].createElement(f["default"],s({},p,{minWidth:"5"})):l["default"].createElement("div",{className:i},l["default"].createElement("input",p))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return l["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,n=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return l["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},n)},filterOptions:function N(e){var t=this.state.inputValue,n=this.props.options||[];if(this.props.filterOptions){var N="function"==typeof this.props.filterOptions?this.props.filterOptions:_["default"];return N(n,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return n},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,n){return e&&e.length?this.props.menuRenderer({focusedOption:n,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?l["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var n=e.map(function(e){return i(e[t.props.valueKey])}).join(this.props.delimiter);return l["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:n,disabled:this.props.disabled})}return e.map(function(e,n){return l["default"].createElement("input",{key:"hidden."+n,type:"hidden",ref:"value"+n,name:t.props.name,value:i(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var n=this.state.focusedOption||e;if(n&&!n.disabled){var r=t.indexOf(n);if(r!==-1)return r}for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c){var d={startTime:(new Date).getTime(),appliedQuery:u},f=this.appbaseRef[t];if(f){var h=u;h.type="*"===this.type[t]?"":this.type[t],h.preference=this.app[t],n(d),f.search(h).on("data",function(e){d.mode="historic",d.data=o.highlightModify(e,d.appliedQuery),i.emitter.emit(t,d);var n=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:d,react:s.react,queryOptions:n})}).on("error",function(e){var n={appliedQuery:d.appliedQuery,error:e,startTime:d.startTime};i.emitter.emit(t,n)}),s.stream&&r.call(this,t,u,f)}else console.error("appbaseRef is not set for "+t)}else{var m={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,m)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t){"use strict";function n(e,t){for(var n=[],r={object:null,string:""},o=Object.keys(t),a=o,i=Array.isArray(a),s=0,a=i?a:a[Symbol.iterator]();;){var u;if(i){if(s>=a.length)break;u=a[s++]}else{if(s=a.next(),s.done)break;u=s.value}var l=u,c=t[l];typeof e[l]===c&&e[l]!==r[c]||n.push(l)}for(var p="",d=0;d0)||new Error("fields missing: "+p)}e.exports={validate:n}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],i(n))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:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,u=0;u0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n), +"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;ts.bottom||i.topt.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var n=this,r="object"==typeof t?t:this.props;if(r.multi){if("string"==typeof e&&(e=e.split(r.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return n.expandValue(e,r)}).filter(function(e){return e})}var o=this.expandValue(e,r);return o?[o]:[]},expandValue:function(e,t){var n=typeof e;if("string"!==n&&"number"!==n&&"boolean"!==n)return e;var r=t.options,o=t.valueKey;if(r)for(var a=0;ar&&this.focusOption(n[r+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var n=-1,r=0;r0?n-=1:n=t.length-1;else if("start"===e)n=0;else if("end"===e)n=t.length-1;else if("page_up"===e){var o=n-this.props.pageSize;n=o<0?0:o}else if("page_down"===e){var o=n+this.props.pageSize;n=o>t.length-1?t.length-1:o}n===-1&&(n=0),this.setState({focusedIndex:t[n].index,focusedOption:t[n].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return l["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},l["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var n=this,r=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:l["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var a=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return l["default"].createElement(o,{id:n._instancePrefix+"-value-"+t,instancePrefix:n._instancePrefix,disabled:n.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[n.props.valueKey],onClick:a,onRemove:n.removeValue,value:e},r(e,t),l["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(a=null),l["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:a,value:e[0]},r(e[0])))},renderInput:function(e,t){var n,r=this,i=(0,m["default"])("Select-input",this.props.inputProps.className),u=!!this.state.isOpen,c=(0,m["default"])((n={},a(n,this._instancePrefix+"-list",u),a(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),p=s({},this.props.inputProps,{role:"combobox","aria-expanded":""+u,"aria-owns":c,"aria-haspopup":""+u,"aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:i,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(p);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,h=(d.inputClassName,o(d,["inputClassName"]));return l["default"].createElement("div",s({},h,{role:"combobox","aria-expanded":u,"aria-owns":u?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:i,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?l["default"].createElement(f["default"],s({},p,{minWidth:"5"})):l["default"].createElement("div",{className:i},l["default"].createElement("input",p))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return l["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,n=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return l["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},n)},filterOptions:function N(e){var t=this.state.inputValue,n=this.props.options||[];if(this.props.filterOptions){var N="function"==typeof this.props.filterOptions?this.props.filterOptions:_["default"];return N(n,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return n},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,n){return e&&e.length?this.props.menuRenderer({focusedOption:n,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?l["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var n=e.map(function(e){return i(e[t.props.valueKey])}).join(this.props.delimiter);return l["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:n,disabled:this.props.disabled})}return e.map(function(e,n){return l["default"].createElement("input",{key:"hidden."+n,type:"hidden",ref:"value"+n,name:t.props.name,value:i(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var n=this.state.focusedOption||e;if(n&&!n.disabled){var r=t.indexOf(n);if(r!==-1)return r}for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c)!function(){var e={startTime:(new Date).getTime(),appliedQuery:u},a=o.appbaseRef[t];if(a){var l=u;l.type="*"===o.type[t]?"":o.type[t],l.preference=o.app[t],n(e),a.search(l).on("data",function(n){e.mode="historic",e.data=o.highlightModify(n,e.appliedQuery),i.emitter.emit(t,e);var r=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:e,react:s.react,queryOptions:r})}).on("error",function(n){var r={appliedQuery:e.appliedQuery,error:n,startTime:e.startTime};i.emitter.emit(t,r)}),s.stream&&r.call(o,t,u,a)}else console.error("appbaseRef is not set for "+t)}();else{var d={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,d)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t){"use strict";function n(e,t){for(var n=[],r={object:null,string:""},o=Object.keys(t),a=o,i=Array.isArray(a),s=0,a=i?a:a[Symbol.iterator]();;){var u;if(i){if(s>=a.length)break;u=a[s++]}else{if(s=a.next(),s.done)break;u=s.value}var l=u,c=t[l];typeof e[l]===c&&e[l]!==r[c]||n.push(l)}for(var p="",d=0;d0)||new Error("fields missing: "+p)}e.exports={validate:n}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],i(n))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:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,u=0;u0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n), o||(o=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var o=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,o,i,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=i;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.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(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a];s?this[a]=s(n):"target"===a?this.target=r:this[a]=n[a]}var u=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;return u?this.isDefaultPrevented=i.thatReturnsTrue:this.isDefaultPrevented=i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse,this}var o=n(9),a=n(47),i=n(25),s=(n(5),"function"==typeof Proxy,["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),u={type:null,target:null,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};o(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=i.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=i.thatReturnsTrue)},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n-1)return!1;if(r.filterOption)return r.filterOption.call(o,e,t);if(!t)return!0;var a=String(e[r.valueKey]),s=String(e[r.labelKey]);return r.ignoreAccents&&("label"!==r.matchProp&&(a=(0,i["default"])(a)),"value"!==r.matchProp&&(s=(0,i["default"])(s))),r.ignoreCase&&("label"!==r.matchProp&&(a=a.toLowerCase()),"value"!==r.matchProp&&(s=s.toLowerCase())),"start"===r.matchPos?"label"!==r.matchProp&&a.substr(0,t.length)===t||"value"!==r.matchProp&&s.substr(0,t.length)===t:"label"!==r.matchProp&&a.indexOf(t)>=0||"value"!==r.matchProp&&s.indexOf(t)>=0})}var a=n(350),i=r(a);e.exports=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.focusedOption,n=e.instancePrefix,r=(e.labelKey,e.onFocus),o=e.onSelect,a=e.optionClassName,s=e.optionComponent,l=e.optionRenderer,c=e.options,p=e.valueArray,d=e.valueKey,f=e.onOptionRef,h=s;return c.map(function(e,s){var c=p&&p.indexOf(e)>-1,m=e===t,y=(0,i["default"])(a,{"Select-option":!0,"is-selected":c,"is-focused":m,"is-disabled":e.disabled});return u["default"].createElement(h,{className:y,instancePrefix:n,isDisabled:e.disabled,isFocused:m,isSelected:c,key:"option-"+s+"-"+e[d],onFocus:r,onSelect:o,option:e,optionIndex:s,ref:function(e){f(e,m)}},l(e,s))})}var a=n(3),i=r(a),s=n(2),u=r(s);e.exports=o},function(e,t){"use strict";var n=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];e.exports=function(e){for(var t=0;t0)if(t.ended&&!o){var i=new Error("stream.push() after EOF");e.emit("error",i)}else if(t.endEmitted&&o){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var l;!t.decoder||o||r||(n=t.decoder.write(n),l=!t.objectMode&&0===n.length),o||(t.reading=!1),l||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,o?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&d(e))),h(e,t)}else o||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length=B?e=B:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function l(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function c(e,t){var n=null;return j.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function p(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,d(e)}}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(N("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?O(f,e):f(e))}function f(e){N("emit readable"),e.emit("readable"),b(e)}function h(e,t){t.readingMore||(t.readingMore=!0,O(m,e,t))}function m(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=M(e,t.buffer,t.decoder),n}function M(e,t,n){var r;return ea.length?a.length:e;if(o+=i===a.length?a:a.slice(0,e),e-=i,0===e){i===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(i));break}++r}return t.length-=r,o}function k(e,t){var n=Y.allocUnsafe(e),r=t.head,o=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,i=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,i),e-=i,0===e){i===a.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(i));break}++o}return t.length-=o,n}function S(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,O(P,t,e))}function P(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function L(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return N("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?S(this):d(this),null;if(e=l(e,t),0===e&&t.ended)return 0===t.length&&S(this),null;var r=t.needReadable;N("need readable",r),(0===t.length||t.length-e0?T(e,t):null,null===o?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&S(this)),null!==o&&this.emit("data",o),o},a.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},a.prototype.pipe=function(e,n){function o(e){N("onunpipe"),e===d&&i()}function a(){N("onend"),e.end()}function i(){N("cleanup"),e.removeListener("close",l),e.removeListener("finish",c),e.removeListener("drain",v),e.removeListener("error",u),e.removeListener("unpipe",o),d.removeListener("end",a),d.removeListener("end",i),d.removeListener("data",s),g=!0,!f.awaitDrain||e._writableState&&!e._writableState.needDrain||v()}function s(t){N("ondata"),_=!1;var n=e.write(t);!1!==n||_||((1===f.pipesCount&&f.pipes===e||f.pipesCount>1&&L(f.pipes,e)!==-1)&&!g&&(N("false write response, pause",d._readableState.awaitDrain),d._readableState.awaitDrain++,_=!0),d.pause())}function u(t){N("onerror",t),p(),e.removeListener("error",u),0===C(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",c),p()}function c(){N("onfinish"),e.removeListener("close",l),p()}function p(){N("unpipe"),d.unpipe(e)}var d=this,f=this._readableState;switch(f.pipesCount){case 0:f.pipes=e;break;case 1:f.pipes=[f.pipes,e];break;default:f.pipes.push(e)}f.pipesCount+=1,N("pipe count=%d opts=%j",f.pipesCount,n);var h=(!n||n.end!==!1)&&e!==t.stdout&&e!==t.stderr,m=h?a:i;f.endEmitted?O(m):d.once("end",m),e.on("unpipe",o);var v=y(d);e.on("drain",v);var g=!1,_=!1;return d.on("data",s),r(e,"error",u),e.once("close",l),e.once("finish",c),e.emit("pipe",d),f.flowing||(N("pipe resume"),d.resume()),e},a.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?r:S;s.WritableState=i;var L=n(14);L.inherits=n(11);var D={deprecate:n(745)},O=n(359),E=n(15).Buffer,C=n(78);L.inherits(s,O),i.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(i.prototype,"buffer",{get:D.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var x;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(x=Function.prototype[Symbol.hasInstance],Object.defineProperty(s,Symbol.hasInstance,{value:function(e){return!!x.call(this,e)||e&&e._writableState instanceof i}})):x=function(e){return e instanceof this},s.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},s.prototype.write=function(e,t,n){var r=this._writableState,a=!1,i=E.isBuffer(e);return"function"==typeof t&&(n=t,t=null),i?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=o),r.ended?u(this,n):(i||l(this,r,e,n))&&(r.pendingcb++,a=p(this,r,i,e,t,n)),a},s.prototype.cork=function(){var e=this._writableState;e.corked++},s.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||g(this,e))},s.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},s.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},s.prototype._writev=null,s.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)}}).call(t,n(7),n(141).setImmediate)},function(e,t,n){e.exports=n(36).EventEmitter},function(e,t,n){"use strict";function r(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function o(e){var t=r(e);if("string"!=typeof t&&(g.isEncoding===b||!b(e)))throw new Error("Unknown encoding: "+e);return t||e}function a(e){this.encoding=o(e);var t;switch(this.encoding){case"utf16le":this.text=d,this.end=f,t=4;break;case"utf8":this.fillLast=l,t=4;break;case"base64":this.text=h,this.end=m,t=3;break;default:return this.write=y,void(this.end=v)}this.lastNeed=0,this.lastTotal=0,this.lastChar=_.allocUnsafe(t)}function i(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:-1}function s(e,t,n){var r=t.length-1;if(r=0?(o>0&&(e.lastNeed=o-1),o):--r=0?(o>0&&(e.lastNeed=o-2),o):--r=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0))}function u(e,t,n){if(128!==(192&t[0]))return e.lastNeed=0,"�".repeat(n);if(e.lastNeed>1&&t.length>1){if(128!==(192&t[1]))return e.lastNeed=1,"�".repeat(n+1);if(e.lastNeed>2&&t.length>2&&128!==(192&t[2]))return e.lastNeed=2,"�".repeat(n+2)}}function l(e){var t=this.lastTotal-this.lastNeed,n=u(this,e,t);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�".repeat(this.lastTotal-this.lastNeed):t}function d(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function f(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function h(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function m(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function y(e){return e.toString(this.encoding)}function v(e){return e&&e.length?this.write(e):""}var g=n(15).Buffer,_=n(78),b=g.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n&&n.and?"string"==typeof n.and&&(n.and=[n.and]):n.and=[],n.and.push("streamChanges"),this.sortObj&&this.enableSort(n);var r=h["default"].create(this.context.appbaseRef,this.context.type,n,this.props.size,this.props.from,this.props.stream,this.context.app);if(this.channelId=r.channelId,this.channelListener=r.emitter.addListener(r.channelId,function(t){if(t.error&&t.startTime>e.queryStartTime&&(e.setState({queryStart:!1,showPlaceholder:!1}),e.props.onAllData)){var n=L.prepareResultData(t);e.props.onAllData(n.res,n.err)}if(t.appliedQuery)if("historic"===t.mode&&t.startTime>e.queryStartTime){var r=!(!t.appliedQuery||!t.data||t.data.error||t.data.hits&&t.data.hits.total),o={resultFound:!!(t.appliedQuery&&t.data&&!t.data.error&&t.data.hits&&t.data.hits.total)};t.appliedQuery&&t.data&&!t.data.error&&(o.total=t.data.hits.total,o.took=t.data.took),e.setState({queryStart:!1,visibleNoResults:r,resultStats:o,showPlaceholder:!1}),e.afterChannelResponse(t)}else"streaming"===t.mode&&(e.afterChannelResponse(t),e.updateResultStats(t.data));else e.setState({showPlaceholder:!0})}),this.listenLoadingChannel(r),t){var o={key:"streamChanges",value:""};L.selectedSensor.set(o,!0)}}},{key:"updateResultStats",value:function(e){var t=this.state.resultStats;t.total=L.updateStats(t.total,e),this.setState({resultStats:t})}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"afterChannelResponse",value:function(e){var t=this,n=e.data,r=void 0,o=void 0,a=[],i=[];if(this.streamFlag=!1,"streaming"===e.mode)this.channelMethod="streaming",a=n,a.stream=!0,i=this.state.currentData,this.streamFlag=!0,o=this.setMarkersData(r);else if("historic"===e.mode){this.queryStartTime=e.startTime,this.channelMethod="historic",a=n.hits&&n.hits.hits?n.hits.hits:[];var s=this.normalizeCurrentData(e,this.state.currentData,a);a=s.newData,i=s.currentData}this.setState({rawData:r,newData:a,currentData:i,markersData:o,isLoading:!1},function(){e.allMarkers=r;var n=JSON.parse(JSON.stringify(e));n.newData=t.state.newData,n.currentData=t.state.currentData,delete n.data,n=L.prepareResultData(n,e.data);var o=t.props.onAllData?t.props.onAllData(n.res,n.err):t.defaultonAllData(n.res,n.err);t.setState({resultMarkup:o,currentData:t.combineCurrentData(a)})})}},{key:"normalizeCurrentData",value:function(e,t,n){var r=JSON.parse(JSON.stringify(e.appliedQuery)),o=JSON.stringify(r)===JSON.stringify(this.appliedQuery)?t||[]:[];return o.length?n=n.filter(function(e){var t=!0;return o.forEach(function(n){e._id+"-"+e._type==n._id+"-"+n._type&&(t=!1)}),t}):this.appliedQuery=r,{currentData:o,newData:n}}},{key:"combineCurrentData",value:function(e){return P["default"].isArray(e)?this.state.currentData.concat(e):this.streamDataModify(this.state.currentData,e)}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.createChannel(e)}},{key:"removeChannel",value:function(){this.channelId&&(h["default"].stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"render",value:function(){var e=null,t=null,n=(0,d["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-stream-active":this.props.stream,"rbc-stream-inactive":!this.props.stream,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader,"rbc-resultstats-active":this.props.showResultStats,"rbc-resultstats-inactive":!this.props.showResultStats,"rbc-noresults-active":this.props.noResults,"rbc-noresults-inactive":!this.props.noResults});return this.props.title&&(e=c["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.props.placeholder&&(t=c["default"].createElement("div",{className:"rbc-placeholder col s12 col-xs-12"},this.props.placeholder)),c["default"].createElement("div",{className:"rbc-reactiveelement-container"},c["default"].createElement("div",{className:"rbc rbc-reactiveelement card thumbnail "+n,style:this.props.componentStyle},e,this.state.resultStats&&this.state.resultStats.resultFound&&this.props.showResultStats?c["default"].createElement(M["default"],{onResultStats:this.props.onResultStats,took:this.state.resultStats.took,total:this.state.resultStats.total}):null,this.state.resultMarkup,this.state.showPlaceholder?t:null),this.props.noResults&&this.state.visibleNoResults?c["default"].createElement(b["default"],{defaultText:this.props.noResults.text}):null,this.props.initialLoader&&this.state.queryStart?c["default"].createElement(g["default"],{defaultText:this.props.initialLoader.text}):null,c["default"].createElement(y["default"],{container:"rbc-reactiveelement-container"}))}}]),t}(l.Component);t["default"]=D,D.propTypes={componentId:c["default"].PropTypes.string,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),from:L.validation.resultListFrom,onAllData:c["default"].PropTypes.func,size:L.sizeValidation,stream:c["default"].PropTypes.bool,componentStyle:c["default"].PropTypes.object,initialLoader:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),noResults:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),showResultStats:c["default"].PropTypes.bool,onResultStats:c["default"].PropTypes.func,react:c["default"].PropTypes.object,placeholder:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element])},D.defaultProps={from:0,size:20,stream:!1,showResultStats:!0,componentStyle:{}},D.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired,app:c["default"].PropTypes.any.isRequired},D.types={componentId:k.STRING,title:k.STRING,react:k.OBJECT,from:k.NUMBER,size:k.NUMBER,onAllData:k.FUNCTION,stream:k.BOOLEAN,componentStyle:k.OBJECT,initialLoader:k.STRING,noResults:k.STRING,showResultStats:k.BOOLEAN,onResultStats:k.FUNCTION,placeholder:k.STRING}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nt.height(),i=n.get(0).scrollHeight>n.height();if(!a&&!i&&n.length&&!e.props.pagination){var s=o(t.find(".rbc-title"))+o(t.find(".rbc-pagination"))*t.find(".rbc-pagination").length,u=t.height()-60-s;u>0&&n.css({height:n.height()+15,"padding-bottom":20})}};t&&t.length&&n&&n.length&&(n.css({height:"auto","padding-bottom":0}),setTimeout(a.bind(this),1e3))}},{key:"removeChannel",value:function(){this.channelId&&(m["default"].stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"createChannel",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n&&n.and?"string"==typeof n.and&&(n.and=[n.and]):n.and=[],n.and.push("streamChanges"),this.props.pagination&&(n.and.push("paginationChanges"),n.pagination=null),this.sortObj&&this.enableSort(n);var r=m["default"].create(this.context.appbaseRef,this.context.type,n,this.props.size,this.props.from,this.props.stream,this.context.app);this.channelId=r.channelId,this.channelListener=r.emitter.addListener(r.channelId,function(t){if(t.error&&t.startTime>e.queryStartTime&&(e.setState({queryStart:!1,showPlaceholder:!1}),e.props.onAllData)){var n=x.prepareResultData(t);e.props.onAllData(n.res,n.err)}if(t.appliedQuery)if("historic"===t.mode&&t.startTime>e.queryStartTime){var r=!(!(t.appliedQuery&&Object.keys(t.appliedQuery).length&&t.data)||t.data.error||t.data.hits&&t.data.hits.total),o={resultFound:!!(t.appliedQuery&&t.data&&!t.data.error&&t.data.hits&&t.data.hits.total)};t.appliedQuery&&t.data&&!t.data.error&&(o.total=t.data.hits.total,o.took=t.data.took),e.setState({queryStart:!1,visibleNoResults:r,resultStats:o,showPlaceholder:!1}),e.afterChannelResponse(t)}else"streaming"===t.mode&&(e.afterChannelResponse(t),e.updateResultStats(t.data));else e.setState({showPlaceholder:!0})}),this.listenLoadingChannel(r),t&&setTimeout(function(){var e={key:"streamChanges",value:""};x.selectedSensor.set(e,!0)},100)}},{key:"updateResultStats",value:function(e){var t=this.state.resultStats;t.total=x.updateStats(t.total,e),this.setState({resultStats:t})}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){if(e.appliedQuery){var n=!(t.state.requestOnScroll&&e.appliedQuery.body&&e.appliedQuery.body.from);t.setState({queryStart:e.queryState,showInitialLoader:n})}})}},{key:"afterChannelResponse",value:function(e){var t=this,n=e.data,r=void 0,o=void 0,a=[],i=[];if(this.streamFlag=!1,"streaming"===e.mode)this.channelMethod="streaming",a=n,a.stream=!0,i=this.state.currentData,this.streamFlag=!0,o=this.setMarkersData(r);else if("historic"===e.mode){this.queryStartTime=e.startTime,this.channelMethod="historic",a=n.hits&&n.hits.hits?n.hits.hits:[];var s=this.normalizeCurrentData(e,this.state.currentData,a);a=s.newData,i=s.currentData}this.setState({rawData:r,newData:a,currentData:i,markersData:o,isLoading:!1},function(){e.allMarkers=r;var o=JSON.parse(JSON.stringify(e));o.newData=t.state.newData,o.currentData=t.state.currentData,delete o.data,o=x.prepareResultData(o,n);var i=t.props.onAllData?t.props.onAllData(o.res,o.err):t.defaultonAllData(o.res,o.err);t.setState({resultMarkup:t.wrapMarkup(i),currentData:t.combineCurrentData(a)})})}},{key:"wrapMarkup",value:function(e){var t=null;return t=C["default"].isArray(e)?e.map(function(e,t){return p["default"].createElement("div",{key:t,className:"rbc-list-item"},e)}):e}},{key:"normalizeCurrentData",value:function(e,t,n){var r=JSON.parse(JSON.stringify(e.appliedQuery));this.state.requestOnScroll&&r&&r.body&&(delete r.body.from,delete r.body.size);var o=JSON.stringify(r)===JSON.stringify(this.appliedQuery),a=o?t||[]:[];return a.length?n=n.filter(function(e){var t=!0;return a.forEach(function(n){e._id+"-"+e._type==n._id+"-"+n._type&&(t=!1)}),t}):this.appliedQuery=r,o||j(".rbc.rbc-reactivelist").animate({scrollTop:0},100),{currentData:a,newData:n}}},{key:"combineCurrentData",value:function(e){return C["default"].isArray(e)?(e=e.map(function(e){return e.stream=!1,e}),this.state.currentData.concat(e)):this.streamDataModify(this.state.currentData,e,!1)}},{key:"enableSort",value:function(e){e.and.push(this.resultSortKey);var t={key:this.resultSortKey,value:this.sortObj};x.selectedSensor.setSortInfo(t)}},{key:"appendData",value:function(e){var t=this.state.rawData,n=t.hits.hits.concat(e.hits.hits);return t.hits.hits=C["default"].uniqBy(n,"_id"),t}},{key:"streamDataModify",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(t)if(t.stream=n,t.streamStart=new Date,t._deleted){var r=e.filter(function(e){return e._id!==t._id});e=r}else{var o=e.filter(function(e){return e._id!==t._id});e=o,e.unshift(t)}return e}},{key:"setMarkersData",value:function(e){return e?e:[]}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.createChannel(e),this.state.requestOnScroll?this.listComponent():this.setQueryForPagination()}},{key:"setQueryForPagination",value:function(){var e={queryType:"match",inputData:this.props.appbaseField,customQuery:function(){return null}},t={key:"paginationChanges",value:e};x.selectedSensor.setSensorInfo(t)}},{key:"executePaginationUpdate",value:function(){setTimeout(function(){var e={key:"paginationChanges",value:Math.random()};x.selectedSensor.set(e,!0)},100)}},{key:"paginationAt",value:function(e){var t=void 0;return!this.props.pagination||this.props.paginationAt!==e&&"both"!==this.props.paginationAt||(t=p["default"].createElement("div",{className:"rbc-pagination-container col s12 col-xs-12"},p["default"].createElement(L["default"],{className:"rbc-pagination-"+e,componentId:"pagination",onPageChange:this.props.onPageChange,title:this.props.paginationTitle}))),t}},{key:"defaultonAllData",value:function(e){var t=this,n=null;if(e){var r=e.currentData;"historic"===e.mode?r=e.currentData.concat(e.newData):"streaming"===e.mode&&(r=x.combineStreamData(e.currentData,e.newData)),r&&(n=r.map(function(e){var n=e._source;return t.props.onData?t.props.onData(e):p["default"].createElement("div",{className:"row",style:{marginTop:"20px"}},t.itemMarkup(n,e))}))}return n}},{key:"itemMarkup",value:function(e,t){return p["default"].createElement("div",{key:t._id,style:{padding:"12px",fontSize:"12px"},className:"makerInfo"},p["default"].createElement(v["default"],{data:e}))}},{key:"nextPage",value:function(){function e(){this.setState({isLoading:!0}),m["default"].nextPage(this.channelId)}this.state.resultStats.total>this.state.currentData.length&&!this.state.queryStart&&e.call(this)}},{key:"listComponent",value:function(){function e(e){var t=this;e&&e.addEventListener("scroll",function(){t.state.requestOnScroll&&j(e).scrollTop()+j(e).innerHeight()>=e.scrollHeight&&t.state.resultStats.total>t.state.currentData.length&&!t.state.queryStart&&t.nextPage()})}e.call(this,this.listParentElement),e.call(this,this.listChildElement)}},{key:"handleSortSelect",value:function(e){var t=e.target.value;this.sortObj=a({},this.props.sortOptions[t].appbaseField,{order:this.props.sortOptions[t].sortBy});var n={key:this.resultSortKey,value:this.sortObj};x.selectedSensor.set(n,!0,"sortChange")}},{key:"render",value:function(){var e=this,t=null,n=null,r=null,o=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-sort-active":this.props.sortOptions,"rbc-sort-inactive":!this.props.sortOptions,"rbc-stream-active":this.props.stream,"rbc-stream-inactive":!this.props.stream,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader,"rbc-resultstats-active":this.props.showResultStats,"rbc-resultstats-inactive":!this.props.showResultStats,"rbc-noresults-active":this.props.noResults,"rbc-noresults-inactive":!this.props.noResults,"rbc-pagination-active":this.props.pagination,"rbc-pagination-inactive":!this.props.pagination});if(this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.props.placeholder&&(n=p["default"].createElement("div",{className:"rbc-placeholder col s12 col-xs-12"},this.props.placeholder)),this.props.sortOptions){var a=this.props.sortOptions.map(function(e,t){return p["default"].createElement("option",{value:t,key:e.label},e.label)});r=p["default"].createElement("div",{className:"rbc-sortoptions input-field col"},p["default"].createElement("select",{className:"browser-default form-control",onChange:this.handleSortSelect},a))}return p["default"].createElement("div",{ className:"rbc-reactivelist-container"},p["default"].createElement("div",{ref:function(t){e.listParentElement=t},className:"rbc rbc-reactivelist card thumbnail "+o,style:this.props.componentStyle},t,r,this.props.showResultStats&&this.state.resultStats.resultFound?p["default"].createElement(S["default"],{onResultStats:this.props.onResultStats,took:this.state.resultStats.took,total:this.state.resultStats.total}):null,this.paginationAt("top"),p["default"].createElement("div",{ref:function(t){e.listChildElement=t},className:"rbc-reactivelist-scroll-container col s12 col-xs-12"},this.state.resultMarkup),this.state.isLoading?p["default"].createElement("div",{className:"rbc-loader"}):null,this.state.showPlaceholder?n:null,this.paginationAt("bottom")),this.props.noResults&&this.state.visibleNoResults?p["default"].createElement(w["default"],{defaultText:this.props.noResults}):null,this.props.initialLoader&&this.state.queryStart&&this.state.showInitialLoader?p["default"].createElement(T["default"],{defaultText:this.props.initialLoader}):null,p["default"].createElement(_["default"],{container:"rbc-reactivelist-container"}))}}]),t}(c.Component);t["default"]=Y,Y.propTypes={componentId:p["default"].PropTypes.string,appbaseField:p["default"].PropTypes.string,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),sortBy:p["default"].PropTypes.oneOf(["asc","desc","default"]),sortOptions:p["default"].PropTypes.arrayOf(p["default"].PropTypes.shape({label:p["default"].PropTypes.string,appbaseField:p["default"].PropTypes.string,sortBy:p["default"].PropTypes.string})),from:x.validation.resultListFrom,onAllData:p["default"].PropTypes.func,size:x.sizeValidation,stream:p["default"].PropTypes.bool,componentStyle:p["default"].PropTypes.object,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),noResults:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),showResultStats:p["default"].PropTypes.bool,onResultStats:p["default"].PropTypes.func,placeholder:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,paginationAt:p["default"].PropTypes.string,pagination:p["default"].PropTypes.bool},Y.defaultProps={from:0,size:20,stream:!1,componentStyle:{},showResultStats:!0,pagination:!1,paginationAt:"bottom"},Y.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired,app:p["default"].PropTypes.any.isRequired},Y.types={componentId:O.STRING,appbaseField:O.STRING,title:O.STRING,react:O.OBJECT,sortBy:O.STRING,sortOptions:O.OBJECT,from:O.NUMBER,onAllData:O.FUNCTION,onData:O.FUNCTION,size:O.NUMBER,stream:O.BOOLEAN,componentStyle:O.OBJECT,initialLoader:O.STRING,noResults:O.FUNCTION,showResultStats:O.BOOLEAN,onResultStats:O.FUNCTION,placeholder:O.STRING,pagination:O.BOOLEAN,paginationAt:O.STRING}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Bar=t.HistoGramComponent=void 0;var s=function(){function e(e,t){for(var n=0;n-1;t?this.setDefaultSelectAll():this.setState({selectedItems:this.props.defaultSelected,defaultSelectall:this.props.defaultSelectall},function(){e.updateAction.bind(e),e.props.onSelect(e.state.selectedItems)})}},{key:"setDefaultSelectAll",value:function(){this.props.items&&this.props.items.length?setTimeout(this.handleListClickAll.bind(this,this.props.selectAllLabel,!0),1e3):setTimeout(this.setDefaultSelectAll.bind(this),1e3)}},{key:"componentDidUpdate",value:function(){var e=this,t=null,n=!0;this.state.selectedItems&&(t=JSON.parse(JSON.stringify(this.state.selectedItems))),t&&t.length&&this.props.items&&this.props.items.length&&(t=t.filter(function(t){var n=e.props.items.filter(function(e){return e.key===t});return!!n.length}),t.length!==this.state.selectedItems.length&&(n=!t.length,this.props.onRemove(this.state.selectedItems,n),this.updateSelectedItems(t),t.length&&this.props.onSelect(t)))}},{key:"handleListClick",value:function(e,t){var n=void 0;t?(this.props.onRemove(this.state.selectedItems,!1),n=this.state.selectedItems,n.push(e),this.setState({selectedItems:n},this.updateAction.bind(this)),this.state.selectedItems.length&&this.props.onSelect(this.state.selectedItems)):this.handleTagClick(e)}},{key:"handleTagClick",value:function(e){var t=1===this.state.selectedItems.length;this.props.onRemove(this.state.selectedItems,t);var n=e.toString().replace(/ /g,"_"),r="ref"+n,o=this.refStore[r];o.state.status=!1;var a=this.state.selectedItems,i=a.indexOf(e);a.splice(i,1),this.setState({selectedItems:a},this.updateAction.bind(this)),this.props.onSelect(a)}},{key:"clearAll",value:function(){this.handleListClickAll(this.props.selectAllLabel,!1)}},{key:"getSelectedItems",value:function(){var e=[];return this.props.items.forEach(function(t){t.status&&e.indexOf(t.key)<0&&e.push(t.key)}),e}},{key:"handleListClickAll",value:function(e,t){var n=this;this.props.selectAll(t);var r=this.props.items.map(function(e){return e.key});r=t?r:[],this.setState({defaultSelectall:t,selectedItems:r},function(){n.updateAction.bind(n),n.props.onSelect(n.state.selectedItems,r)})}},{key:"updateSelectedItems",value:function(e){this.setState({selectedItems:e})}},{key:"updateAction",value:function(){this.state.selectedItems.length||this.props.onSelect(null)}},{key:"render",value:function(){var e=this,t=this.props.items,n=this.getSelectedItems(),r=[],o=[];return t.forEach(function(t,n){try{t.keyRef=t.key.replace(/ /g,"_")}catch(o){t.keyRef=n}var a=!("visible"in t&&!t.visible);r.push(l["default"].createElement(p["default"],{key:t.keyRef,value:t.key,doc_count:t.doc_count,countField:e.props.showCount,handleClick:e.handleListClick,visible:a,showCheckbox:e.props.showCheckbox,status:t.status||!1,ref:function(n){var r="ref"+t.keyRef;e.refStore[r]=n}}))}),this.props.selectAllLabel&&t&&t.length&&r.unshift(l["default"].createElement(p["default"],{key:"selectall",value:this.props.selectAllLabel,countField:!1,visible:!0,showCheckbox:this.props.showCheckbox,handleClick:this.handleListClickAll,status:this.props.selectAllValue,ref:function(t){e.refStore.refselectall=t}})),this.props.showTags&&n&&(n.length<=5?n.forEach(function(t){o.push(l["default"].createElement(f["default"],{key:t,value:t,onClick:e.handleTagClick}))}):o.unshift(l["default"].createElement(f["default"],{key:"Clear All",value:"Clear All",onClick:this.clearAll}))),l["default"].createElement("div",{className:"rbc-list-container col s12 col-xs-12"},o.length?l["default"].createElement("div",{className:"row rbc-tag-container"},o):null,l["default"].createElement("div",{className:"row"},r))}}]),t}(u.Component);t["default"]=h,h.propTypes={defaultSelected:l["default"].PropTypes.array,items:l["default"].PropTypes.array,onRemove:l["default"].PropTypes.func,onSelect:l["default"].PropTypes.func,selectAll:l["default"].PropTypes.func,selectAllLabel:l["default"].PropTypes.string,selectAllValue:l["default"].PropTypes.bool,showCount:l["default"].PropTypes.bool,showTags:l["default"].PropTypes.bool,defaultSelectall:l["default"].PropTypes.bool},h.defaultProps={showTags:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n-1){var n=t.channelResponse&&t.channelResponse.data&&t.channelResponse.data.hits?t.channelResponse.data.hits.total:0,r=Math.ceil(n/t.queryOptions.size)<1?1:Math.ceil(n/t.queryOptions.size),o=t.queryOptions.size?t.queryOptions.size:20,a=Math.round(t.queryOptions.from/o)+1;e.setState({totalHits:n,size:o,maxPageNumber:r,currentValue:a})}})}},{key:"handleChange",value:function(e){this.setState({currentValue:e});var t={key:this.props.componentId,value:e},n=!0;h.selectedSensor.set(t,n,"paginationChange"),this.props.onPageChange&&this.props.onPageChange(e)}},{key:"firstPage",value:function(){1!==this.state.currentValue&&this.handleChange.call(this,1)}},{key:"lastPage",value:function(){this.state.currentValue!==this.state.maxPageNumber&&this.handleChange.call(this,this.state.maxPageNumber)}},{key:"prePage",value:function(){var e=this.state.currentValue>1?this.state.currentValue-1:1;this.state.currentValue!==e&&this.handleChange.call(this,e)}},{key:"nextPage",value:function(){var e=this.state.currentValue0;r--)if(r%5===0||1===r){t=r;break}for(var o=function(t){var r=l["default"].createElement("li",{key:t,className:"rbc-page-number "+(e.state.currentValue===t?"active rbc-pagination-active":"waves-effect")},l["default"].createElement("a",{onClick:function(){return e.handleChange(t)}},t));t<=e.state.maxPageNumber&&n.push(r)},a=t;a<=t+5;a++)o(a);return l["default"].createElement("ul",{className:"pagination"},l["default"].createElement("li",{className:1===this.state.currentValue?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.firstPage},l["default"].createElement("i",{className:"fa fa-angle-double-left"}))),l["default"].createElement("li",{className:1===this.state.currentValue?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.prePage},l["default"].createElement("i",{className:"fa fa-angle-left"}))),n,l["default"].createElement("li",{className:this.state.currentValue===this.state.maxPageNumber?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-next",onClick:this.nextPage},l["default"].createElement("i",{className:"fa fa-angle-right"}))),l["default"].createElement("li",{className:this.state.currentValue===this.state.maxPageNumber?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.lastPage},l["default"].createElement("i",{className:"fa fa-angle-double-right"}))))}},{key:"render",value:function(){var e=null;this.props.title&&(e=l["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,p["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return l["default"].createElement("div",{className:"rbc rbc-pagination col s12 col-xs-12 "+t+" "+this.props.className},e,l["default"].createElement("div",{className:"col s12 col-xs-12"},this.renderPageNumber()))}}]),t}(u.Component);t["default"]=m,m.propTypes={componentId:l["default"].PropTypes.string.isRequired,title:l["default"].PropTypes.string,onPageChange:l["default"].PropTypes.func},m.defaultProps={},m.contextTypes={appbaseRef:l["default"].PropTypes.any.isRequired,type:l["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.StaticSearch=void 0;var s=function(){function e(e,t){for(var n=0;n-1)d=d||{},d=Object.assign(d,t[e]);else{r[e]=i(e);var o=a(e);o&&(d=d||{},d=Object.assign(d,o))}var u=n(e);!u||"aggSort"in u||p.push(u)}),r}function l(t){var n=o.serializeDepends.createQuery(e.serializeDepends,t);return n&&n.body?(p&&p.length&&(n.body.sort=p),d&&Object.keys(d).length&&Object.keys(d).forEach(function(e){n.body[e]=d[e]})):n={},n}function c(){var e=u(),t=l(e);return t}var p=[],d=null;return c()}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.params.get(e);if(n&&r)try{r=JSON.parse(r)}catch(o){console.log(o)}return t?r&&r.trim()?r.split(","):null:r}},{key:"update",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&(this.setOrDelete(e,t),this.applyURLUpdate())}},{key:"setOrDelete",value:function(e,t){e&&(null===t||void 0===t?this.params["delete"](e):this.params.set(e,t)); -}},{key:"applyURLUpdate",value:function(){if(history.pushState&&this.params.toString()){var e=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+this.params.toString();window.history.pushState({path:e},"",e)}}}]),e}();t.URLParams=new u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(49);t.ResponsiveStory=function(){var e=function(e){return e.height()?e.height():0},t=function(){var t=r(window).height(),n=t-15;r(".rbc.rbc-reactivelist, .rbc.rbc-reactiveelement").css({maxHeight:n});var o=[r(".rbc.rbc-singlelist"),r(".rbc.rbc-multilist"),r(".rbc.rbc-nestedlist"),r(".rbc.rbc-tagcloud")];o.forEach(function(n){if(n.length){var r=e(n.find(".rbc-title"))+e(n.find(".rbc-search-container"));n.find(".rbc-list-container").css({maxHeight:t-r-35})}}),r(".rbc-base > .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(e[t]<1||e[t]>1e3)&&(n=new Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=new Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]<=0&&(n=new Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=new Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start<=0&&(r=new Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return!isNaN(e[t])&&r>=e.defaultSelected&&o<=e.defaultSelected||(n=new Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return e[t]<0&&(n=new Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=new Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n'],post_tags:[""],fields:e}}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.defaultSearchQuery}};this.props.highlight&&(e.value.externalQuery=this.highlightQuery()),w.selectedSensor.setSensorInfo(e);var t={key:this.searchInputId,value:{queryType:"multi_match",inputData:this.props.appbaseField,customQuery:this.defaultSearchQuery}};w.selectedSensor.setSensorInfo(t)}},{key:"setValue",value:function(e){var t={key:this.searchInputId,value:e};w.URLParams.update(this.props.componentId,e,this.props.URLParams),w.selectedSensor.set(t,!0),e&&""!==e.trim()?this.setState({options:[{label:e,value:e}],isLoadingOptions:!0,currentValue:e}):this.setState({options:[],isLoadingOptions:!1,currentValue:e})}},{key:"getValue",value:function(e,t){var n=void(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0);if(M["default"].has(t,e))n=t[e];else if(e.indexOf(".")>-1){var r="",o=e.split(".");o.forEach(function(e,a){r+=e,M["default"].isArray(M["default"].get(t,r))&&(r+="["+a+"]"),o.length-1!==a?r+=".":n=M["default"].get(t,r)})}return n}},{key:"setData",value:function(e){var t=this,n=[];M["default"].isArray(this.props.appbaseField)?this.props.appbaseField:[this.props.appbaseField],e.hits.hits.map(function(e){if("string"===t.fieldType){var r=t.getValue(t.props.appbaseField.trim(),e._source);n.push({value:r,label:r})}else"object"===t.fieldType&&t.props.appbaseField.map(function(r){var o=t.getValue(r,e._source);o&&n.push({value:o,label:o})})}),this.state.currentValue&&""!==this.state.currentValue.trim()&&n.unshift({label:this.state.currentValue,value:this.state.currentValue}),n=this.removeDuplicates(n,"label"),this.setState({options:n,isLoadingOptions:!1})}},{key:"defaultSearchQuery",value:function(e){var t=null,n=void 0;return e&&(n="string"===this.fieldType?[this.props.appbaseField]:this.props.appbaseField,t={bool:{should:[{multi_match:{query:e,fields:n,type:"phrase_prefix"}},{multi_match:{query:e,fields:n}}],minimum_should_match:"1"}}),t}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.searchInputId);var n=g["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({rawData:r}),e.props.autocomplete&&e.setData(r)})}},{key:"checkDefault",value:function(){this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultValue&&this.defaultSelected!=this.defaultValue&&(this.defaultSelected=this.defaultValue,setTimeout(this.setValue.bind(this,this.defaultSelected),100),this.handleSearch({value:this.defaultSelected}))}},{key:"handleSearch",value:function(e){var t=e?e.value:null;t="null"===t?null:t;var n={key:this.props.componentId,value:t};w.selectedSensor.set(n,!0),this.setState({currentValue:t})}},{key:"handleInputChange",value:function(e){var t=e.target.value;this.setState({currentValue:t});var n={key:this.props.componentId,value:t};this.props.onValueChange&&this.props.onValueChange(n.value);var r=!0;w.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=d["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,y["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-autocomplete-active":this.props.autocomplete,"rbc-autocomplete-inactive":!this.props.autocomplete});return d["default"].createElement("div",{className:"rbc rbc-datasearch col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},e,this.props.autocomplete?d["default"].createElement(h["default"],u({isLoading:this.state.isLoadingOptions,value:this.state.currentValue,options:this.state.options,onInputChange:this.setValue,onChange:this.handleSearch,onBlurResetsInput:!1},this.props)):d["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},d["default"].createElement("input",{type:"text",className:"rbc-input",placeholder:this.props.placeholder,value:this.state.currentValue?this.state.currentValue:"",onChange:this.handleInputChange}),d["default"].createElement("span",{className:"rbc-search-icon"})))}}]),t}(p.Component);t["default"]=k,k.propTypes={componentId:d["default"].PropTypes.string.isRequired,appbaseField:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),title:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.element]),placeholder:d["default"].PropTypes.string,autocomplete:d["default"].PropTypes.bool,defaultSelected:d["default"].PropTypes.string,customQuery:d["default"].PropTypes.func,onValueChange:d["default"].PropTypes.func,react:d["default"].PropTypes.object,componentStyle:d["default"].PropTypes.object,highlight:d["default"].PropTypes.bool,highlightFields:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),URLParams:d["default"].PropTypes.bool},k.defaultProps={placeholder:"Search",autocomplete:!0,componentStyle:{},highlight:!1,URLParams:!1},k.contextTypes={appbaseRef:d["default"].PropTypes.any.isRequired,type:d["default"].PropTypes.any.isRequired},k.types={componentId:b.STRING,appbaseField:b.STRING,appbaseFieldType:b.STRING,react:b.OBJECT,title:b.STRING,placeholder:b.STRING,autocomplete:b.BOOLEAN,defaultSelected:b.STRING,customQuery:b.FUNCTION,componentStyle:b.OBJECT,highlight:b.BOOLEAN,URLParams:b.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&setTimeout(this.handleChange.bind(this,t),1e3)}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!_["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t;var n=e.state.data.filter(function(t){ -return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&(null!==e.urlParams?e.handleChange(n):setTimeout(e.handleChange.bind(e,n),1e3))}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};b.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){if(e.length>0)return e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}})}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}}},{key:"handleChange",value:function(e){var t=[];t=e.map(function(e){return e.label}),t=t.join(),this.setState({selected:t});var n={key:this.props.componentId,value:e},r=!0;this.props.onValueChange&&this.props.onValueChange(n.value),b.URLParams.update(this.props.componentId,t,this.props.URLParams),b.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return p["default"].createElement("div",{className:"rbc rbc-multidropdownrange col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"col s12 col-xs-12"},p["default"].createElement(f["default"],{options:this.state.data,value:this.state.selected,onChange:this.handleChange,clearable:!1,multi:!0,placeholder:this.props.placeholder,searchable:!0}))))}}]),t}(c.Component);t["default"]=T,T.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),placeholder:p["default"].PropTypes.string,data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},T.defaultProps={URLParams:!1},T.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},T.types={componentId:v.STRING,appbaseField:v.STRING,appbaseFieldType:v.NUMBER,data:v.OBJECT,defaultSelected:v.ARRAY,title:v.STRING,placeholder:v.STRING,customQuery:v.FUNCTION,componentStyle:v.OBJECT,URLParams:v.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&(null!==this.urlParams?this.handleChange(t):setTimeout(this.handleChange.bind(this,t),1e3))}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!v["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t,e.resetState();var n=e.props.data.filter(function(e){return t.indexOf(e.label)>-1});n&&n.length&&setTimeout(e.handleChange.bind(e,n),1e3)}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.length>0?e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}}):null}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}return null}},{key:"handleChange",value:function(e){function t(e,t,o){o.label===e.label&&(r=t,n.splice(t,1))}var n=this.state.selected,r=null,o=e;v["default"].isArray(e)||(o=[e]),o.forEach(function(e){n.forEach(function(n,r){t(n,r,e)})}),null===r&&o.forEach(function(e){n.push(e)}),this.setState({selected:n});var a={key:this.props.componentId,value:n},i=!0;this.props.onValueChange&&this.props.onValueChange(a.value),g.URLParams.update(this.props.componentId,this.getSelectedLabels(n),this.props.URLParams),g.selectedSensor.set(a,i)}},{key:"getSelectedLabels",value:function(e){return e.map(function(e){return e.label})}},{key:"resetState",value:function(){this.setState({selected:[]});var e={key:this.props.componentId,value:[]},t=!0;g.URLParams.update(this.props.componentId,null,this.props.URLParams),g.selectedSensor.set(e,t)}},{key:"handleTagClick",value:function(e){var t=this.state.selected.filter(function(t){return t.label===e});this.handleChange(t[0])}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t){return p["default"].createElement("div",{className:"rbc-list-item row",key:t.label,onClick:function(){return e.handleChange(t)}},p["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:n.indexOf(t.label)>-1,value:t.label}),p["default"].createElement("label",{className:"rbc-label"},t.label))})),t}},{key:"render",value:function(){var e=this,t=null,n=[];this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.selected&&this.state.selected.forEach(function(t){n.push(p["default"].createElement(b,{key:t.label,value:t.label,onClick:e.handleTagClick}))});var r=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return p["default"].createElement("div",{className:"rbc rbc-multirange col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},t,p["default"].createElement("div",{className:"col s12 col-xs-12 rbc-list-container"},n.length?p["default"].createElement("div",{className:"row",style:{marginTop:"0"}},n):null,this.renderButtons())))}}]),t}(c.Component);t["default"]=_;var b=function(e){return p["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},p["default"].createElement("a",{className:"close"},"×"),p["default"].createElement("span",null,e.value))};b.propTypes={onClick:p["default"].PropTypes.func.isRequired,value:p["default"].PropTypes.string.isRequired},_.propTypes={appbaseField:p["default"].PropTypes.string.isRequired,componentId:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nr;return p["default"].createElement("div",{className:"rbc-numberbox-container col s12 col-xs-12"},p["default"].createElement("div",{className:"rbc-label"},t),p["default"].createElement("div",{className:"rbc-numberbox-btn-container"},p["default"].createElement(g,{isActive:s,handleChange:o,type:"minus"}),p["default"].createElement("span",{className:"rbc-numberbox-number"},a),p["default"].createElement(g,{isActive:i,handleChange:o,type:"plus"})))},b=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),o=r.props.focused;r.urlParams=y.URLParams.get(r.props.componentId);var a=null!==r.urlParams?r.urlParams:r.props.defaultSelected;return r.state={currentValue:a?a:r.props.data.start,focused:o},r.type="term",r.handleChange=r.handleChange.bind(r),r.customQuery=r.customQuery.bind(r),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.setQueryInfo(),null!==this.urlParams?this.updateQuery(this.urlParams):setTimeout(this.handleChange.bind(this),1e3)}},{key:"componentWillReceiveProps",value:function(e){var t=this;setTimeout(function(){var n=null!==t.urlParams?t.urlParams:t.props.defaultSelected;!n&&0!==n||n===t.state.currentValue||t.setState({currentValue:n}),e.queryFormat!==t.queryFormat&&(t.queryFormat=e.queryFormat,t.updateQuery())},300)}},{key:"customQuery",value:function(e){var t=null;if(e&&(e.value||0===e.value)){var n=e.value;switch(this.props.queryFormat){case"exact":t=this.exactQuery(n);break;case"lte":t=this.lteQuery(n);break;case"gte":default:t=this.gteQuery(n)}}return t}},{key:"exactQuery",value:function(e){return a({},this.type,a({},this.props.appbaseField,e))}},{key:"gteQuery",value:function(e){return{range:a({},this.props.appbaseField,{gte:e,boost:2})}}},{key:"lteQuery",value:function(e){return{range:a({},this.props.appbaseField,{lte:e,boost:2})}}},{key:"setQueryInfo",value:function(){var e=this.props,t=e.componentId,n=e.appbaseField,r={key:t,value:{queryType:this.type,inputData:n,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};y.selectedSensor.setSensorInfo(r)}},{key:"handleChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.props,n=(t.componentId,t.data),r=n.start,o=n.end,a=this.state.currentValue;r=void 0!=r?r:a-1,o=void 0!=o?o:a+1,e>0&&ar&&(a-=1),this.setState({currentValue:a},this.updateQuery.bind(this))}},{key:"updateQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.start.currentValue,t={key:this.props.componentId,value:{value:e,queryFormat:this.props.queryFormat}};this.props.onValueChange&&this.props.onValueChange(t.value),y.URLParams.update(this.props.componentId,e,this.props.URLParams),y.selectedSensor.set(t,!0)}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.data,r=e.labelPosition,o=this.state.currentValue,a=t?p["default"].createElement(v,{title:t}):null,i=(0,f["default"])({"rbc-title-active":t,"rbc-title-inactive":!t});return p["default"].createElement("div",{className:"rbc rbc-numberbox col s12 col-xs-12 card thumbnail "+i+" rbc-label-"+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},a,p["default"].createElement(_,{handleChange:this.handleChange,value:o,label:n.label,start:n.start,end:n.end})))}}]),t}(c.Component);t["default"]=b,b.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.shape({start:y.validateThreshold,end:y.validateThreshold,label:p["default"].PropTypes.string}),defaultSelected:y.valueValidation,labelPosition:p["default"].PropTypes.oneOf(["top","bottom","left","right"]),customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,queryFormat:p["default"].PropTypes.oneOf(["exact","gte","lte"]),URLParams:p["default"].PropTypes.bool},b.defaultProps={componentStyle:{},queryFormat:"gte",URLParams:!1},b.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},b.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.NUMBER,labelPosition:m.STRING,customQuery:m.FUNCTION,componentStyle:m.OBJECT,queryFormat:m.STRING,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=n.end){var r=(n.end-n.start)%e.stepValue;if(r){t.setState({values:{min:t.state.values.min,max:n.end-r}});var o={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-r}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(o.value),S.URLParams.update(t.props.componentId,t.setURLParam(o.value),t.props.URLParams),S.selectedSensor.set(o,!0)},1e3)}else{var a={};a.min=n.start,a.max=n.end,t.setState({values:a,currentValues:a});var i={key:t.props.componentId,value:{from:a.min,to:a.max}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(i.value),S.URLParams.update(t.props.componentId,t.setURLParam(i.value),t.props.URLParams),S.selectedSensor.set(i,!0)},1e3)}}if(e.range.start!==t.state.startThreshold||e.range.end!==t.state.endThreshold){if(e.range.start<=n.start&&e.range.end>=n.end)t.setState({startThreshold:e.range.start,endThreshold:e.range.end});else{var s={min:t.state.values.min,max:t.state.values.max};t.state.values.mine.range.end&&(s.max=e.range.end),t.setState({startThreshold:e.range.start,endThreshold:e.range.end,values:s});var u={from:s.min,to:s.max},l={key:t.props.componentId,value:u};t.props.onValueChange&&t.props.onValueChange(l.value),S.URLParams.update(t.props.componentId,t.setURLParam(l.value),t.props.URLParams),S.selectedSensor.set(l,!0)}t.setRangeValue()}if(e.stepValue!==t.props.stepValue){var c=(n.end-n.start)%e.stepValue;if(c){t.setState({values:{min:t.state.values.min,max:n.end-c}});var p={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-c}};t.props.onValueChange&&t.props.onValueChange(p.value),S.URLParams.update(t.props.componentId,t.setURLParam(p.value),t.props.URLParams),S.selectedSensor.set(p,!0)}}},300)}},{key:"shouldComponentUpdate",value:function(e,t){return e.stepValue<=0||e.stepValue>Math.floor((e.range.end-e.range.start)/2)?(console.error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."),!1):!(t.values.max>t.endThreshold)}},{key:"componentWillUnmount",value:function(){this.channelId&&v["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setURLParam",value:function(e){return"from"in e&&"to"in e&&(e={start:e.from,end:e.to}),JSON.stringify(e)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField}},t={key:this.props.componentId+"-internal",value:{queryType:"range",inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};S.selectedSensor.setSensorInfo(e),S.selectedSensor.setSensorInfo(t),this.setRangeValue()}},{key:"setRangeValue",value:function(){var e={key:this.props.componentId+"-internal",value:this.props.range};this.props.onValueChange&&this.props.onValueChange(e.value),S.selectedSensor.set(e,!0)}},{key:"customQuery",value:function(e){if(e)return{range:a({},this.props.appbaseField,{gte:e.start,lte:e.end,boost:2})}}},{key:"histogramQuery",value:function(){return a({},this.props.appbaseField,{histogram:{field:this.props.appbaseField,interval:this.props.interval?this.props.interval:Math.ceil((this.props.range.end-this.props.range.start)/10)}})}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t.aggs={key:this.props.appbaseField,sort:"asc",size:1e3,customQuery:this.histogramQuery},t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.props.componentId+"-internal");var n=v["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery&&t.startTime>e.queryStartTime){e.queryStartTime=t.startTime?t.startTime:0;var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(n)}}),this.listenLoadingChannel(n)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"getSize",value:function(){return Math.min(this.props.range.end-this.props.range.start,this.maxSize)}},{key:"setData",value:function(e){try{this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}catch(t){console.log(t)}}},{key:"handleValuesChange",value:function(e,t){this.setState({values:t})}},{key:"countCalc",value:function(e,t,n){return n.map(function(e){return e.doc_count})}},{key:"addItemsToList",value:function(e){var t=this;e=k["default"].orderBy(e,["key"],["asc"]);var n=e.length,r=this.state.startThreshold?this.state.startThreshold:e[0].key,o=this.state.endThreshold?this.state.endThreshold:e[n-1].key;if(n>1){var a={counts:this.countCalc(r,o,e),startThreshold:r,endThreshold:o,values:{min:this.state.values.min,max:this.state.values.max}};this.setState(a,function(){k["default"].isEqual(a.values,t.state.currentValues)||t.handleResults(null,a.values)})}}},{key:"handleResults",value:function(e,t){var n=void 0;n=e?{min:e[0],max:e[1]}:t;var r={from:n.min,to:n.max},o={key:this.props.componentId,value:r};this.props.onValueChange&&this.props.onValueChange(o.value),S.URLParams.update(this.props.componentId,this.setURLParam(o.value),this.props.URLParams),S.selectedSensor.set(o,!0),this.setState({currentValues:n,values:n})}},{key:"render",value:function(){var e=null,t=null,n={};if(this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.counts&&this.state.counts.length&&this.props.showHistogram&&(t=p["default"].createElement(g.HistoGramComponent,{data:this.state.counts})),this.props.rangeLabels.start||this.props.rangeLabels.end){var r;r={},a(r,this.state.startThreshold,this.props.rangeLabels.start),a(r,this.state.endThreshold,this.props.rangeLabels.end),n=r}var o=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-labels-active":this.props.rangeLabels.start||this.props.rangeLabels.end,"rbc-labels-inactive":!this.props.rangeLabels.start&&!this.props.rangeLabels.end,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return p["default"].createElement("div",{className:"rbc rbc-rangeslider card thumbnail col s12 col-xs-12 "+o,style:this.props.componentStyle},e,t,p["default"].createElement("div",{className:"rbc-rangeslider-container col s12 col-xs-12"},p["default"].createElement(f["default"],{range:!0,value:[this.state.values.min,this.state.values.max],min:this.state.startThreshold,max:this.state.endThreshold,onChange:this.handleResults,step:this.props.stepValue,marks:n})),this.props.initialLoader&&this.state.queryStart?p["default"].createElement(b["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(c.Component);t["default"]=P,P.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),range:p["default"].PropTypes.shape({start:S.validateThreshold,end:S.validateThreshold}),rangeLabels:p["default"].PropTypes.shape({start:p["default"].PropTypes.string,end:p["default"].PropTypes.string}),defaultSelected:p["default"].PropTypes.shape({start:p["default"].PropTypes.number,end:p["default"].PropTypes.number}),stepValue:S.stepValidation,showHistogram:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,interval:p["default"].PropTypes.number,URLParams:p["default"].PropTypes.bool},P.defaultProps={title:null,range:{start:0,end:10},rangeLabels:{start:"",end:""},defaultSelected:{start:0,end:10},stepValue:1,showHistogram:!0,componentStyle:{},URLParams:!1},P.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},P.types={componentId:M.STRING,appbaseField:M.STRING,appbaseFieldType:M.NUMBER,title:M.STRING,react:M.OBJECT,range:M.OBJECT,rangeLabels:M.OBJECT,defaultSelected:M.OBJECT,stepValue:M.NUMBER,showHistogram:M.BOOLEAN,customQuery:M.FUNCTION,initialLoader:M.OBJECT,componentStyle:M.OBJECT,interval:M.NUMBER,URLParams:M.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(e[t]<1||e[t]>1e3)&&(n=new Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=new Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]<=0&&(n=new Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=new Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start<=0&&(r=new Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return!isNaN(e[t])&&r>=e.defaultSelected&&o<=e.defaultSelected||(n=new Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return e[t]<0&&(n=new Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=new Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n'],post_tags:[""],fields:e}}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.defaultSearchQuery}};this.props.highlight&&(e.value.externalQuery=this.highlightQuery()),w.selectedSensor.setSensorInfo(e);var t={key:this.searchInputId,value:{queryType:"multi_match",inputData:this.props.appbaseField,customQuery:this.defaultSearchQuery}};w.selectedSensor.setSensorInfo(t)}},{key:"setValue",value:function(e){var t={key:this.searchInputId,value:e};w.URLParams.update(this.props.componentId,e,this.props.URLParams),w.selectedSensor.set(t,!0),e&&""!==e.trim()?this.setState({options:[{label:e,value:e}],isLoadingOptions:!0,currentValue:e}):this.setState({options:[],isLoadingOptions:!1,currentValue:e})}},{key:"getValue",value:function(e,t){var n=void(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0);return M["default"].has(t,e)?n=t[e]:e.indexOf(".")>-1&&!function(){var r="",o=e.split(".");o.forEach(function(e,a){r+=e,M["default"].isArray(M["default"].get(t,r))&&(r+="["+a+"]"),o.length-1!==a?r+=".":n=M["default"].get(t,r)})}(),n}},{key:"setData",value:function(e){var t=this,n=[];M["default"].isArray(this.props.appbaseField)?this.props.appbaseField:[this.props.appbaseField],e.hits.hits.map(function(e){if("string"===t.fieldType){var r=t.getValue(t.props.appbaseField.trim(),e._source);n.push({value:r,label:r})}else"object"===t.fieldType&&t.props.appbaseField.map(function(r){var o=t.getValue(r,e._source);o&&n.push({value:o,label:o})})}),this.state.currentValue&&""!==this.state.currentValue.trim()&&n.unshift({label:this.state.currentValue,value:this.state.currentValue}),n=this.removeDuplicates(n,"label"),this.setState({options:n,isLoadingOptions:!1})}},{key:"defaultSearchQuery",value:function(e){var t=null,n=void 0;return e&&(n="string"===this.fieldType?[this.props.appbaseField]:this.props.appbaseField,t={bool:{should:[{multi_match:{query:e,fields:n,type:"phrase_prefix"}},{multi_match:{query:e,fields:n}}],minimum_should_match:"1"}}),t}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.searchInputId);var n=g["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({rawData:r}),e.props.autocomplete&&e.setData(r)})}},{key:"checkDefault",value:function(){this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultValue&&this.defaultSelected!=this.defaultValue&&(this.defaultSelected=this.defaultValue,setTimeout(this.setValue.bind(this,this.defaultSelected),100),this.handleSearch({value:this.defaultSelected}))}},{key:"handleSearch",value:function(e){var t=e?e.value:null;t="null"===t?null:t;var n={key:this.props.componentId,value:t};w.selectedSensor.set(n,!0),this.setState({currentValue:t})}},{key:"handleInputChange",value:function(e){var t=e.target.value;this.setState({currentValue:t});var n={key:this.props.componentId,value:t};this.props.onValueChange&&this.props.onValueChange(n.value);var r=!0;w.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=d["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,y["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-autocomplete-active":this.props.autocomplete,"rbc-autocomplete-inactive":!this.props.autocomplete});return d["default"].createElement("div",{className:"rbc rbc-datasearch col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},e,this.props.autocomplete?d["default"].createElement(h["default"],u({isLoading:this.state.isLoadingOptions,value:this.state.currentValue,options:this.state.options,onInputChange:this.setValue,onChange:this.handleSearch,onBlurResetsInput:!1},this.props)):d["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},d["default"].createElement("input",{type:"text",className:"rbc-input",placeholder:this.props.placeholder,value:this.state.currentValue?this.state.currentValue:"",onChange:this.handleInputChange}),d["default"].createElement("span",{className:"rbc-search-icon"})))}}]),t}(p.Component);t["default"]=k,k.propTypes={componentId:d["default"].PropTypes.string.isRequired,appbaseField:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),title:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.element]),placeholder:d["default"].PropTypes.string,autocomplete:d["default"].PropTypes.bool,defaultSelected:d["default"].PropTypes.string,customQuery:d["default"].PropTypes.func,onValueChange:d["default"].PropTypes.func,react:d["default"].PropTypes.object,componentStyle:d["default"].PropTypes.object,highlight:d["default"].PropTypes.bool,highlightFields:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),URLParams:d["default"].PropTypes.bool},k.defaultProps={placeholder:"Search",autocomplete:!0,componentStyle:{},highlight:!1,URLParams:!1},k.contextTypes={appbaseRef:d["default"].PropTypes.any.isRequired,type:d["default"].PropTypes.any.isRequired},k.types={componentId:b.STRING,appbaseField:b.STRING,appbaseFieldType:b.STRING,react:b.OBJECT,title:b.STRING,placeholder:b.STRING,autocomplete:b.BOOLEAN,defaultSelected:b.STRING,customQuery:b.FUNCTION,componentStyle:b.OBJECT,highlight:b.BOOLEAN,URLParams:b.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&setTimeout(this.handleChange.bind(this,t),1e3)}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!_["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t;var n=e.state.data.filter(function(t){ +return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&(null!==e.urlParams?e.handleChange(n):setTimeout(e.handleChange.bind(e,n),1e3))}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};b.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){if(e.length>0)return e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}})}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}}},{key:"handleChange",value:function(e){var t=[];t=e.map(function(e){return e.label}),t=t.join(),this.setState({selected:t});var n={key:this.props.componentId,value:e},r=!0;this.props.onValueChange&&this.props.onValueChange(n.value),b.URLParams.update(this.props.componentId,t,this.props.URLParams),b.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return p["default"].createElement("div",{className:"rbc rbc-multidropdownrange col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"col s12 col-xs-12"},p["default"].createElement(f["default"],{options:this.state.data,value:this.state.selected,onChange:this.handleChange,clearable:!1,multi:!0,placeholder:this.props.placeholder,searchable:!0}))))}}]),t}(c.Component);t["default"]=T,T.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),placeholder:p["default"].PropTypes.string,data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},T.defaultProps={URLParams:!1},T.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},T.types={componentId:v.STRING,appbaseField:v.STRING,appbaseFieldType:v.NUMBER,data:v.OBJECT,defaultSelected:v.ARRAY,title:v.STRING,placeholder:v.STRING,customQuery:v.FUNCTION,componentStyle:v.OBJECT,URLParams:v.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&(null!==this.urlParams?this.handleChange(t):setTimeout(this.handleChange.bind(this,t),1e3))}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!v["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t,e.resetState();var n=e.props.data.filter(function(e){return t.indexOf(e.label)>-1});n&&n.length&&setTimeout(e.handleChange.bind(e,n),1e3)}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.length>0?e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}}):null}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}return null}},{key:"handleChange",value:function(e){function t(e,t,o){o.label===e.label&&(r=t,n.splice(t,1))}var n=this.state.selected,r=null,o=e;v["default"].isArray(e)||(o=[e]),o.forEach(function(e){n.forEach(function(n,r){t(n,r,e)})}),null===r&&o.forEach(function(e){n.push(e)}),this.setState({selected:n});var a={key:this.props.componentId,value:n},i=!0;this.props.onValueChange&&this.props.onValueChange(a.value),g.URLParams.update(this.props.componentId,this.getSelectedLabels(n),this.props.URLParams),g.selectedSensor.set(a,i)}},{key:"getSelectedLabels",value:function(e){return e.map(function(e){return e.label})}},{key:"resetState",value:function(){this.setState({selected:[]});var e={key:this.props.componentId,value:[]},t=!0;g.URLParams.update(this.props.componentId,null,this.props.URLParams),g.selectedSensor.set(e,t)}},{key:"handleTagClick",value:function(e){var t=this.state.selected.filter(function(t){return t.label===e});this.handleChange(t[0])}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t){return p["default"].createElement("div",{className:"rbc-list-item row",key:t.label,onClick:function(){return e.handleChange(t)}},p["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:n.indexOf(t.label)>-1,value:t.label}),p["default"].createElement("label",{className:"rbc-label"},t.label))})),t}},{key:"render",value:function(){var e=this,t=null,n=[];this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.selected&&this.state.selected.forEach(function(t){n.push(p["default"].createElement(b,{key:t.label,value:t.label,onClick:e.handleTagClick}))});var r=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return p["default"].createElement("div",{className:"rbc rbc-multirange col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},t,p["default"].createElement("div",{className:"col s12 col-xs-12 rbc-list-container"},n.length?p["default"].createElement("div",{className:"row",style:{marginTop:"0"}},n):null,this.renderButtons())))}}]),t}(c.Component);t["default"]=_;var b=function(e){return p["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},p["default"].createElement("a",{className:"close"},"×"),p["default"].createElement("span",null,e.value))};b.propTypes={onClick:p["default"].PropTypes.func.isRequired,value:p["default"].PropTypes.string.isRequired},_.propTypes={appbaseField:p["default"].PropTypes.string.isRequired,componentId:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nr;return p["default"].createElement("div",{className:"rbc-numberbox-container col s12 col-xs-12"},p["default"].createElement("div",{className:"rbc-label"},t),p["default"].createElement("div",{className:"rbc-numberbox-btn-container"},p["default"].createElement(g,{isActive:s,handleChange:o,type:"minus"}),p["default"].createElement("span",{className:"rbc-numberbox-number"},a),p["default"].createElement(g,{isActive:i,handleChange:o,type:"plus"})))},b=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),o=r.props.focused;r.urlParams=y.URLParams.get(r.props.componentId);var a=null!==r.urlParams?r.urlParams:r.props.defaultSelected;return r.state={currentValue:a?a:r.props.data.start,focused:o},r.type="term",r.handleChange=r.handleChange.bind(r),r.customQuery=r.customQuery.bind(r),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.setQueryInfo(),null!==this.urlParams?this.updateQuery(this.urlParams):setTimeout(this.handleChange.bind(this),1e3)}},{key:"componentWillReceiveProps",value:function(e){var t=this;setTimeout(function(){var n=null!==t.urlParams?t.urlParams:t.props.defaultSelected;!n&&0!==n||n===t.state.currentValue||t.setState({currentValue:n}),e.queryFormat!==t.queryFormat&&(t.queryFormat=e.queryFormat,t.updateQuery())},300)}},{key:"customQuery",value:function(e){var t=null;if(e&&(e.value||0===e.value)){var n=e.value;switch(this.props.queryFormat){case"exact":t=this.exactQuery(n);break;case"lte":t=this.lteQuery(n);break;case"gte":default:t=this.gteQuery(n)}}return t}},{key:"exactQuery",value:function(e){return a({},this.type,a({},this.props.appbaseField,e))}},{key:"gteQuery",value:function(e){return{range:a({},this.props.appbaseField,{gte:e,boost:2})}}},{key:"lteQuery",value:function(e){return{range:a({},this.props.appbaseField,{lte:e,boost:2})}}},{key:"setQueryInfo",value:function(){var e=this.props,t=e.componentId,n=e.appbaseField,r={key:t,value:{queryType:this.type,inputData:n,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};y.selectedSensor.setSensorInfo(r)}},{key:"handleChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.props,n=(t.componentId,t.data),r=n.start,o=n.end,a=this.state.currentValue;r=void 0!=r?r:a-1,o=void 0!=o?o:a+1,e>0&&ar&&(a-=1),this.setState({currentValue:a},this.updateQuery.bind(this))}},{key:"updateQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.start.currentValue,t={key:this.props.componentId,value:{value:e,queryFormat:this.props.queryFormat}};this.props.onValueChange&&this.props.onValueChange(t.value),y.URLParams.update(this.props.componentId,e,this.props.URLParams),y.selectedSensor.set(t,!0)}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.data,r=e.labelPosition,o=this.state.currentValue,a=t?p["default"].createElement(v,{title:t}):null,i=(0,f["default"])({"rbc-title-active":t,"rbc-title-inactive":!t});return p["default"].createElement("div",{className:"rbc rbc-numberbox col s12 col-xs-12 card thumbnail "+i+" rbc-label-"+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},a,p["default"].createElement(_,{handleChange:this.handleChange,value:o,label:n.label,start:n.start,end:n.end})))}}]),t}(c.Component);t["default"]=b,b.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.shape({start:y.validateThreshold,end:y.validateThreshold,label:p["default"].PropTypes.string}),defaultSelected:y.valueValidation,labelPosition:p["default"].PropTypes.oneOf(["top","bottom","left","right"]),customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,queryFormat:p["default"].PropTypes.oneOf(["exact","gte","lte"]),URLParams:p["default"].PropTypes.bool},b.defaultProps={componentStyle:{},queryFormat:"gte",URLParams:!1},b.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},b.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.NUMBER,labelPosition:m.STRING,customQuery:m.FUNCTION,componentStyle:m.OBJECT,queryFormat:m.STRING,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=n.end){var r=(n.end-n.start)%e.stepValue;r?!function(){t.setState({values:{min:t.state.values.min,max:n.end-r}});var e={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-r}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(e.value),S.URLParams.update(t.props.componentId,t.setURLParam(e.value),t.props.URLParams),S.selectedSensor.set(e,!0)},1e3)}():!function(){var e={};e.min=n.start,e.max=n.end,t.setState({values:e,currentValues:e});var r={key:t.props.componentId,value:{from:e.min,to:e.max}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(r.value),S.URLParams.update(t.props.componentId,t.setURLParam(r.value),t.props.URLParams),S.selectedSensor.set(r,!0)},1e3)}()}if(e.range.start!==t.state.startThreshold||e.range.end!==t.state.endThreshold){if(e.range.start<=n.start&&e.range.end>=n.end)t.setState({startThreshold:e.range.start,endThreshold:e.range.end});else{var o={min:t.state.values.min,max:t.state.values.max};t.state.values.mine.range.end&&(o.max=e.range.end),t.setState({startThreshold:e.range.start,endThreshold:e.range.end,values:o});var a={from:o.min,to:o.max},i={key:t.props.componentId,value:a};t.props.onValueChange&&t.props.onValueChange(i.value),S.URLParams.update(t.props.componentId,t.setURLParam(i.value),t.props.URLParams),S.selectedSensor.set(i,!0)}t.setRangeValue()}if(e.stepValue!==t.props.stepValue){var s=(n.end-n.start)%e.stepValue;if(s){t.setState({values:{min:t.state.values.min,max:n.end-s}});var u={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-s}};t.props.onValueChange&&t.props.onValueChange(u.value),S.URLParams.update(t.props.componentId,t.setURLParam(u.value),t.props.URLParams),S.selectedSensor.set(u,!0)}}},300)}},{key:"shouldComponentUpdate",value:function(e,t){return e.stepValue<=0||e.stepValue>Math.floor((e.range.end-e.range.start)/2)?(console.error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."),!1):!(t.values.max>t.endThreshold)}},{key:"componentWillUnmount",value:function(){this.channelId&&v["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setURLParam",value:function(e){return"from"in e&&"to"in e&&(e={start:e.from,end:e.to}),JSON.stringify(e)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField}},t={key:this.props.componentId+"-internal",value:{queryType:"range",inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};S.selectedSensor.setSensorInfo(e),S.selectedSensor.setSensorInfo(t),this.setRangeValue()}},{key:"setRangeValue",value:function(){var e={key:this.props.componentId+"-internal",value:this.props.range};this.props.onValueChange&&this.props.onValueChange(e.value),S.selectedSensor.set(e,!0)}},{key:"customQuery",value:function(e){if(e)return{range:a({},this.props.appbaseField,{gte:e.start,lte:e.end,boost:2})}}},{key:"histogramQuery",value:function(){return a({},this.props.appbaseField,{histogram:{field:this.props.appbaseField,interval:this.props.interval?this.props.interval:Math.ceil((this.props.range.end-this.props.range.start)/10)}})}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t.aggs={key:this.props.appbaseField,sort:"asc",size:1e3,customQuery:this.histogramQuery},t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.props.componentId+"-internal");var n=v["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery&&t.startTime>e.queryStartTime){e.queryStartTime=t.startTime?t.startTime:0;var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(n)}}),this.listenLoadingChannel(n)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"getSize",value:function(){return Math.min(this.props.range.end-this.props.range.start,this.maxSize)}},{key:"setData",value:function(e){try{this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}catch(t){console.log(t)}}},{key:"handleValuesChange",value:function(e,t){this.setState({values:t})}},{key:"countCalc",value:function(e,t,n){return n.map(function(e){return e.doc_count})}},{key:"addItemsToList",value:function(e){var t=this;e=k["default"].orderBy(e,["key"],["asc"]);var n=e.length,r=this.state.startThreshold?this.state.startThreshold:e[0].key,o=this.state.endThreshold?this.state.endThreshold:e[n-1].key;n>1&&!function(){var n={counts:t.countCalc(r,o,e),startThreshold:r,endThreshold:o,values:{min:t.state.values.min,max:t.state.values.max}};t.setState(n,function(){k["default"].isEqual(n.values,t.state.currentValues)||t.handleResults(null,n.values)})}()}},{key:"handleResults",value:function(e,t){var n=void 0;n=e?{min:e[0],max:e[1]}:t;var r={from:n.min,to:n.max},o={key:this.props.componentId,value:r};this.props.onValueChange&&this.props.onValueChange(o.value),S.URLParams.update(this.props.componentId,this.setURLParam(o.value),this.props.URLParams),S.selectedSensor.set(o,!0),this.setState({currentValues:n,values:n})}},{key:"render",value:function(){var e=null,t=null,n={};if(this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.counts&&this.state.counts.length&&this.props.showHistogram&&(t=p["default"].createElement(g.HistoGramComponent,{data:this.state.counts})),this.props.rangeLabels.start||this.props.rangeLabels.end){var r;r={},a(r,this.state.startThreshold,this.props.rangeLabels.start),a(r,this.state.endThreshold,this.props.rangeLabels.end),n=r}var o=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-labels-active":this.props.rangeLabels.start||this.props.rangeLabels.end,"rbc-labels-inactive":!this.props.rangeLabels.start&&!this.props.rangeLabels.end,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return p["default"].createElement("div",{className:"rbc rbc-rangeslider card thumbnail col s12 col-xs-12 "+o,style:this.props.componentStyle},e,t,p["default"].createElement("div",{className:"rbc-rangeslider-container col s12 col-xs-12"},p["default"].createElement(f["default"],{range:!0,value:[this.state.values.min,this.state.values.max],min:this.state.startThreshold,max:this.state.endThreshold,onChange:this.handleResults,step:this.props.stepValue,marks:n})),this.props.initialLoader&&this.state.queryStart?p["default"].createElement(b["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(c.Component);t["default"]=P,P.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),range:p["default"].PropTypes.shape({start:S.validateThreshold,end:S.validateThreshold}),rangeLabels:p["default"].PropTypes.shape({start:p["default"].PropTypes.string,end:p["default"].PropTypes.string}),defaultSelected:p["default"].PropTypes.shape({start:p["default"].PropTypes.number,end:p["default"].PropTypes.number}),stepValue:S.stepValidation,showHistogram:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,interval:p["default"].PropTypes.number,URLParams:p["default"].PropTypes.bool},P.defaultProps={title:null,range:{start:0,end:10},rangeLabels:{start:"",end:""},defaultSelected:{start:0,end:10},stepValue:1,showHistogram:!0,componentStyle:{},URLParams:!1},P.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},P.types={componentId:M.STRING,appbaseField:M.STRING,appbaseFieldType:M.NUMBER,title:M.STRING,react:M.OBJECT,range:M.OBJECT,rangeLabels:M.OBJECT,defaultSelected:M.OBJECT,stepValue:M.NUMBER,showHistogram:M.BOOLEAN,customQuery:M.FUNCTION,initialLoader:M.OBJECT,componentStyle:M.OBJECT,interval:M.NUMBER,URLParams:M.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&t.forEach(function(t){null!==e.urlParams?e.handleChange(t):setTimeout(e.handleChange.bind(e,t),1e3)})}}},{key:"componentWillUpdate",value:function(){var e=this,t=null!==this.urlParams?this.urlParams:this.props.defaultSelected;if(this.defaultSelected!=t){this.defaultSelected=t,this.defaultSelected=v["default"].isArray(this.defaultSelected)?this.defaultSelected:[this.defaultSelected];var n=this.props.data.filter(function(t){return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&n.forEach(function(t){setTimeout(e.handleChange.bind(e,t),1e3)})}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.map(function(e,n){return{term:a({},t,e.value)}})}var n=null;return e&&e.length?n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}}:n}},{key:"handleChange",value:function(e){var t=this.state.selected,n=[],r=null;t.forEach(function(n,o){e.label===n.label&&(r=o,t.splice(o,1))}),null===r?this.props.multiSelect?(t.push(e),n=t):n.push(e):n=t,this.setState({selected:n});var o={key:this.props.componentId,value:n},a=!0;this.props.onValueChange&&this.props.onValueChange(o.value),g.URLParams.update(this.props.componentId,this.setURLValue(n),this.props.URLParams),g.selectedSensor.set(o,a)}},{key:"setURLValue",value:function(e){return e.map(function(e){return e.label})}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t,r){return p["default"].createElement("button",{key:r,className:"btn rbc-btn "+(n.indexOf(t.label)>-1?"rbc-btn-active":"rbc-btn-inactive"),onClick:function(){return e.handleChange(t)},title:t.title?t.title:t.label},t.label)})),t}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-multiselect-active":this.props.multiSelect,"rbc-multiselect-inactive":!this.props.multiSelect});return p["default"].createElement("div",{className:"rbc rbc-togglebutton col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"rbc-buttongroup col s12 col-xs-12"},this.renderButtons())))}}]),t}(c.Component);t["default"]=_,_.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.oneOfType([p["default"].PropTypes.array,p["default"].PropTypes.string]),multiSelect:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={multiSelect:!0,componentStyle:{},URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.KEYWORD,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,multiSelect:m.BOOLEAN,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]&&arguments[0];this.setGeoQueryInfo(),this.createChannel(e);var t=this.getMapStyle(this.props.defaultMapStyle);this.initialMapBoundQuery=!!this.props.defaultCenter,this.applyGeoQuery=this.props.applyGeoQuery?this.props.applyGeoQuery:this.props.setSearchAsMove,this.setState({currentMapStyle:t})}},{key:"componentWillReceiveProps",value:function(e){e.defaultMapStyle!==this.props.defaultMapStyle&&this.mapStyleChange(this.getMapStyle(e.defaultMapStyle))}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){e.streamProp!==e.props.stream&&(e.streamProp=e.props.stream,e.removeChannel(),e.initialize()),e.sizeProp!==e.props.size&&(e.sizeProp=e.props.size,e.removeChannel(),e.initialize(!0))},300)}},{key:"componentWillUnmount",value:function(){this.removeChannel()}},{key:"removeChannel",value:function(){this.channelId&&(_.AppbaseChannelManager.stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove()}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and?"string"==typeof t.and&&(t.and=[t.and]):t.and=[],t.or=t.or?t.or:[],t.or.push("geoQuery"),t.and.push("streamChanges");var n=_.AppbaseChannelManager.create(this.context.appbaseRef,this.context.type,t,this.props.size,this.props.from,this.props.stream);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){function n(){"historic"===t.mode&&t.startTime>this.queryStartTime?this.afterChannelResponse(t):"streaming"===t.mode&&this.afterChannelResponse(t)}function r(){if(t.error&&t.startTime>this.queryStartTime){if(this.props.onAllData){var e=_.AppbaseSensorHelper.prepareResultData(t);this.props.onAllData(e.res,e.err)}}else t.appliedQuery&&(this.state.mapBounds?this.props.autoMapRender?n.call(this):o.hits.hits.length&&n.call(this):n.call(this))}var o=t.data;r.call(e)});var r={key:"streamChanges",value:""};_.AppbaseSensorHelper.selectedSensor.set(r,!0)}},{key:"afterChannelResponse",value:function(e){var t=this,n=w.afterChannelResponse(e,this.state.rawData,this.props.appbaseField,this.state.markersData);this.reposition=!0,this.streamFlag=n.streamFlag,this.queryStartTime=n.queryStartTime?n.queryStartTime:0,this.setState({rawData:n.rawData,markersData:n.markersData},function(){if(t.props.onAllData){e.allMarkers=n.rawData;var r=JSON.parse(JSON.stringify(e));if(r.newData=n.newData,r.currentData=n.currentData,delete r.data,r=_.AppbaseSensorHelper.prepareResultData(r,e.data),t.props.onAllData){r.res&&(r.res.mapRef=t.mapRef);var o=t.props.onAllData(r.res,r.err);t.setState({externalData:o})}}t.streamFlag&&t.streamMarkerInterval()})}},{key:"setGeoQueryInfo",value:function(){var e={key:"geoQuery",value:{queryType:"geo_bounding_box",inputData:this.props.appbaseField,customQuery:this.geoCustomQuery}},t={key:"updateExecute",value:{queryType:"random",inputData:this.props.appbaseField}};_.AppbaseSensorHelper.selectedSensor.setSensorInfo(e),_.AppbaseSensorHelper.selectedSensor.setSensorInfo(t)}},{key:"geoCustomQuery",value:function(e){var t=null;return e&&(this.initialMapBoundQuery||this.searchAsMove)&&(t={geo_bounding_box:a({},this.props.appbaseField,e)},this.geoRelatedEventsChange?this.geoRelatedEventsChange=!1:this.applyGeoQuery&&(this.applyGeoQuery=!1),this.initialMapBoundQuery=!1),t}},{key:"updateExecute",value:function(){setTimeout(function(){var e={key:"updateExecute",value:Math.random()};_.AppbaseSensorHelper.selectedSensor.set(e,!0)},1e3)}},{key:"handleMarkerClick",value:function(e){var t=this;e.showInfo=!0,this.reposition=!1,this.setState({rerender:!0},function(){t.props.popoverTTL&&t.watchPopoverTTL(e)})}},{key:"handleMarkerClose",value:function(e){e.showInfo=!1,this.reposition=!1,this.setState(this.state)}},{key:"watchPopoverTTL",value:function(e){var t=this;this.popoverTTLStore=this.popoverTTLStore?this.popoverTTLStore:{},this.popoverTTLStore[e._type+e._id]?this.clearTTL(e._type+e._id):this.popoverTTLStore[e._type+e._id]=setTimeout(function(){t.handleMarkerClose(e),t.clearTTL(e._type+e._id)},1e3*this.props.popoverTTL)}},{key:"clearTTL",value:function(e){clearTimeout(this.popoverTTLStore[e]),delete this.popoverTTLStore[e]}},{key:"renderInfoWindow",value:function(e,t){var n=this,r=this.props.onPopoverTrigger?this.props.onPopoverTrigger(t):"Popver";return f["default"].createElement(h.InfoWindow,{zIndex:500,key:e+"_info_window",onCloseclick:function(){return n.handleMarkerClose(t)}},f["default"].createElement("div",null,r))}},{key:"handleOnIdle",value:function(){var e=this.mapRef?this.mapRef.getBounds():null;if(e){var t=e.getNorthEast().lat(),n=e.getSouthWest().lat(),r=e.getNorthEast().lng(),o=e.getSouthWest().lng(),a={top_left:[o,t],bottom_right:[r,n]},i={mapBounds:e};if(this.props.onIdle){var s=this.props.onIdle(this.mapRef,{boundingBoxCoordinates:a,mapBounds:e});i.externalData=s}if(this.initialMapBoundQuery||this.applyGeoQuery||this.geoRelatedEventsChange&&this.searchAsMove&&!this.searchQueryProgress){var u=!!this.initialMapBoundQuery||(this.applyGeoQuery?this.applyGeoQuery:this.searchAsMove);this.setValue(a,u)}this.setState(i)}}},{key:"handleOnDrage",value:function(){this.storeCenter=null}},{key:"setValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={key:"geoQuery",value:e};_.AppbaseSensorHelper.selectedSensor.set(n,t)}},{key:"searchAsMoveChange",value:function(e){this.searchAsMove=e,e&&this.mapRef&&(this.geoRelatedEventsChange=!0,this.handleOnIdle())}},{key:"mapStyleChange",value:function(e){this.setState({currentMapStyle:e})}},{key:"handleBoundsChanged",value:function(){var e=this;this.searchQueryProgress&&setTimeout(function(){e.searchQueryProgress=!1},1e3)}},{key:"streamMarkerInterval",value:function(){var e=this,t=this.state.markersData,n=t.filter(function(e){return e.stream&&e.streamStart});n.length?(this.isStreamDataExists=!0,setTimeout(function(){return e.streamToNormal()},1e3*this.props.streamTTL)):this.isStreamDataExists=!1}},{key:"streamToNormal",value:function(){var e=this,t=this.state.markersData,n=t.filter(function(e){return e.stream&&e.streamStart});n.length?(t=t.map(function(t){if(t.stream&&t.streamStart){var n=new Date,r=(n.getTime()-t.streamStart.getTime())/1e3;r>=e.props.streamTTL&&(delete t.stream,delete t.streamStart)}return t}),this.setState({markersData:t})):this.isStreamDataExists=!1}},{key:"getIcon",value:function(e){return e.stream?this.props.streamMarkerImage:this.props.defaultMarkerImage}},{key:"chooseIcon",value:function(e){var t=e.external_icon?e.external_icon:this.getIcon(e);t=this.props.onData?this.props.onData(e):t;var n=!!("object"===("undefined"==typeof t?"undefined":c(t))&&"path"in t);if(n&&(t=JSON.parse(JSON.stringify(t)),this.props.autoMarkerPosition)){var r=e.angleDeg?e.angleDeg:0;t.rotation=r}return t}},{key:"combineProps",value:function(e){var t=void 0,n={};return this.state.externalData&&this.state.externalData.markers&&this.state.externalData.markers[e._id]&&(t=this.state.externalData.markers[e._id],Object.keys(t).forEach(function(r){e["external_"+r]=t[r],n[r]=t[r]})),n.icon=this.chooseIcon(e),n}},{key:"generateMarkers",value:function(){var e=this,t=this,n=this.state.markersData,r={markerComponent:[],defaultCenter:null,convertedGeo:[]};return n&&n.length&&(n=n.filter(function(e){return w.identifyGeoData(e._source[t.props.appbaseField])}),r.markerComponent=n.map(function(n,o){var a=w.identifyGeoData(n._source[t.props.appbaseField]);r.convertedGeo.push(a);var i={position:a},s="marker_ref_"+o,u=void 0;if(e.props.showPopoverOn){u={};var c=e.props.showPopoverOn.split("");c[0]=c[0].toUpperCase(),c=c.join(""),u["on"+c]=e.handleMarkerClick.bind(e,n)}else u={},u.onClick=e.handleMarkerClick.bind(e,n);var p=function(){},d={onClick:e.props.markerOnClick?e.props.markerOnClick:p,onDblclick:e.props.markerOnDblclick?e.props.markerOnDblclick:p,onMouseover:e.props.onMouseover?e.props.onMouseover:p,onMouseout:e.props.onMouseout?e.props.onMouseout:p};return f["default"].createElement(h.Marker,l({},i,{key:n._id,zIndex:1,ref:s},t.combineProps(n),{onClick:function(){return d.onClick(n._source)},onDblclick:function(){return d.onDblclick(n._source)},onMouseover:function(){return d.onMouseover(n._source)},onMouseout:function(){return d.onMouseout(n._source)}},u),n.showInfo?t.renderInfoWindow(s,n):null)}),r.convertedGeo[0]&&(r.defaultCenter={lat:r.convertedGeo[0].lat,lng:r.convertedGeo[0].lng})),this.props.showMarkers||(r.markerComponent=[]),r}},{key:"externalData",value:function(){var e=this,t=[];return this.state.externalData&&Object.keys(this.state.externalData).forEach(function(n){"markers"!==n&&(t=t.concat(e.state.externalData[n]))}),t}},{key:"mapEvents",value:function(e){if(this.geoRelatedEvents.indexOf(e)>-1&&(this.geoRelatedEventsChange=!0),this.props[e]){var t=this.props[e](this.mapRef);t&&this.setState({externalData:t})}}},{key:"getStoreCenter",value:function(){return this.storeCenter?this.storeCenter:this.state.center}},{key:"render",value:function(){var e=this,t=void 0,n=void 0,r=void 0,o=null,a=null,i={},s=this.generateMarkers();t=this.props.setMarkerCluster?f["default"].createElement(y["default"],{averageCenter:!0,enableRetinaIcons:!0,gridSize:60},s.markerComponent):s.markerComponent;var u=!0;"streaming"!==this.channelMethod||this.props.streamAutoCenter||(u=!1),this.props.autoCenter&&this.reposition&&u?(a=s.defaultCenter?s.defaultCenter:this.getStoreCenter(),this.storeCenter=a,this.reposition=!1,i.center=w.normalizeCenter(a)):this.storeCenter?(a=this.storeCenter,i.center=w.normalizeCenter(a)):a=null,this.props.showSearchAsMove&&(n=f["default"].createElement(b.SearchAsMove,{searchAsMoveDefault:this.props.setSearchAsMove,searchAsMoveChange:this.searchAsMoveChange})),this.props.showMapStyles&&(r=f["default"].createElement(T.MapStyles,{defaultSelected:this.props.defaultMapStyle,mapStyleChange:this.mapStyleChange})),this.props.title&&(o=f["default"].createElement("h4",{className:"rbc-title col s12 m8 col-xs-12 col-sm-8"},this.props.title));var c=(0,g["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return f["default"].createElement("div",{className:"rbc rbc-reactivemap col s12 col-xs-12 card thumbnail "+c,style:w.mapPropsStyles(this.props.componentStyle,"component")},o,r,f["default"].createElement(h.GoogleMapLoader,{containerElement:f["default"].createElement("div",{className:"rbc-container col s12 col-xs-12",style:w.mapPropsStyles(this.props.componentStyle,"map",this.mapDefaultHeight)}),googleMapElement:f["default"].createElement(h.GoogleMap,l({ref:function(t){ e.mapRef=t}},i,w.normalizeProps(this.props),{options:{styles:this.state.currentMapStyle},defaultCenter:w.normalizeCenter(this.state.defaultCenter),onDragstart:function(){e.handleOnDrage(),e.mapEvents("onDragstart")},onIdle:function(){return e.handleOnIdle()},onClick:function(){return e.mapEvents("onClick")},onDblclick:function(){return e.mapEvents("onDblclick")},onDrag:function(){return e.mapEvents("onDrag")},onDragend:function(){return e.mapEvents("onDragend")},onMousemove:function(){return e.mapEvents("onMousemove")},onMouseout:function(){return e.mapEvents("onMouseout")},onMouseover:function(){return e.mapEvents("onMouseover")},onResize:function(){return e.mapEvents("onResize")},onRightclick:function(){return e.mapEvents("onRightclick")},onTilesloaded:function(){return e.mapEvents("onTilesloaded")},onBoundsChanged:function(){return e.mapEvents("onBoundsChanged")},onCenterChanged:function(){return e.mapEvents("onCenterChanged")},onProjectionChanged:function(){return e.mapEvents("onProjectionChanged")},onTiltChanged:function(){return e.mapEvents("onTiltChanged")},onZoomChanged:function(){return e.mapEvents("onZoomChanged")}}),t,this.externalData())}),n,f["default"].createElement(_.PoweredBy,null))}}]),t}(d.Component);t["default"]=k,k.propTypes={appbaseField:f["default"].PropTypes.string.isRequired,onIdle:f["default"].PropTypes.func,onAllData:f["default"].PropTypes.func,onData:f["default"].PropTypes.func,onPopoverTrigger:f["default"].PropTypes.func,setMarkerCluster:f["default"].PropTypes.bool,autoMarkerPosition:f["default"].PropTypes.bool,showMarkers:f["default"].PropTypes.bool,streamTTL:w.validation.streamTTL,popoverTTL:w.validation.popoverTTL,size:_.AppbaseSensorHelper.sizeValidation,from:w.validation.fromValidation,autoMapRender:f["default"].PropTypes.bool,componentStyle:f["default"].PropTypes.object,autoCenter:f["default"].PropTypes.bool,showSearchAsMove:f["default"].PropTypes.bool,setSearchAsMove:f["default"].PropTypes.bool,defaultMapStyle:f["default"].PropTypes.oneOf(["Standard","Blue Essence","Blue Water","Flat Map","Light Monochrome","Midnight Commander","Unsaturated Browns"]),title:f["default"].PropTypes.oneOfType([f["default"].PropTypes.string,f["default"].PropTypes.element]),streamAutoCenter:f["default"].PropTypes.bool,defaultMarkerImage:f["default"].PropTypes.string,streamMarkerImage:f["default"].PropTypes.string,stream:f["default"].PropTypes.bool,defaultZoom:w.validation.defaultZoom,applyGeoQuery:f["default"].PropTypes.bool,showPopoverOn:f["default"].PropTypes.oneOf(["click","mouseover"]),defaultCenter:f["default"].PropTypes.shape({lat:w.validation.validCenter,lon:w.validation.validCenter}),react:f["default"].PropTypes.object,markerOnClick:f["default"].PropTypes.func,markerOnDblclick:f["default"].PropTypes.func,onMouseover:f["default"].PropTypes.func,onMouseout:f["default"].PropTypes.func,showMapStyles:f["default"].PropTypes.bool},k.defaultProps={setMarkerCluster:!0,autoCenter:!0,showSearchAsMove:!0,setSearchAsMove:!1,showMapStyles:!0,defaultMapStyle:"Standard",from:0,size:100,streamTTL:5,streamAutoCenter:!1,autoMarkerPosition:!1,showMarkers:!0,autoMapRender:!0,defaultMarkerImage:"https://opensource.appbase.io/reactivemaps/dist/images/historic-pin.png",streamMarkerImage:"https://opensource.appbase.io/reactivemaps/dist/images/stream-pin.png",componentStyle:{},stream:!1,applyGeoQuery:!1,defaultZoom:13},k.contextTypes={appbaseRef:f["default"].PropTypes.any.isRequired,type:f["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ItemCheckboxList=void 0;var s=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0],c[this.state.selectedValue].value);this.props.mapStyleChange(e)}},{key:"render",value:function(){var e=this.state.items.map(function(e,t){return l["default"].createElement("option",{value:t,key:t},e.key)});return l["default"].createElement("div",{className:"input-field col rbc-mapstyles pull-right right"},l["default"].createElement("select",{className:"browser-default form-control",onChange:this.handleSelect,value:this.state.selectedValue,name:"mapStyles",id:"mapStyles"},e))}}]),t}(u.Component);p.propTypes={},p.defaultProps={fieldName:"MapStyles"}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.SearchAsMove=void 0;var s=function(){function e(e,t){for(var n=0;n20)return new Error("zoom value should be an integer between 0 and 20.")},validCenter:function(e,t,n){return isNaN(e[t])?new Error(t+" value must be number"):"lat"===t&&(e[t]<-90||e[t]>90)?new Error(t+" value should be between -90 and 90."):"lng"===t&&(e[t]<-180||e[t]>180)?new Error(t+" value should be between -180 and 180."):void 0},fromValidation:function(e,t,n){if(e[t]<0)return new Error(t+" value should be greater than or equal to 0.")},streamTTL:function(e,t,n){if(e[t]<0||e[t]>1e3)return new Error(t+" should be a positive integer between 0 and 1000, counted in seconds for a streaming update to be visible.")},popoverTTL:function(e,t,n){if(e[t]<.1||e[t]>60)return new Error(t+" should be a positive integer between 1 and 60, counted in seconds for a popover to be visible.")}},t.normalizeCenter=function(e){return e&&e.lon&&(e.lng=e.lon),e});t.normalizeProps=function(e){var t=JSON.parse(JSON.stringify(e));return t.defaultCenter&&(t.defaultCenter=p(t.defaultCenter)),t.center&&(t.center=p(t.center)),t},t.mapPropsStyles=function(e,t,n){var r=JSON.parse(JSON.stringify(e)),o=void 0;return"component"===t?o=r:"map"===t&&(o={height:r.height?r.height:n}),o}},function(e,t){"use strict";e.exports=[{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#e0efef"}]},{featureType:"poi",elementType:"geometry.fill",stylers:[{visibility:"on"},{hue:"#1900ff"},{color:"#c0e8e8"}]},{featureType:"road",elementType:"geometry",stylers:[{lightness:100},{visibility:"simplified"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"transit.line",elementType:"geometry",stylers:[{visibility:"on"},{lightness:700}]},{featureType:"water",elementType:"all",stylers:[{color:"#7dcdcd"}]}]},function(e,t){"use strict";e.exports=[{featureType:"administrative",elementType:"labels.text.fill",stylers:[{color:"#444444"}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#f2f2f2"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"all",stylers:[{saturation:-100},{lightness:45}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"all",stylers:[{color:"#46bcec"},{visibility:"on"}]}]},function(e,t){"use strict";e.exports=[{featureType:"all",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"landscape",elementType:"all",stylers:[{visibility:"on"},{color:"#f3f4f4"}]},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{weight:.9},{visibility:"off"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#83cead"}]},{featureType:"road",elementType:"all",stylers:[{visibility:"on"},{color:"#ffffff"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"on"},{color:"#fee379"}]},{featureType:"road.arterial",elementType:"all",stylers:[{visibility:"on"},{color:"#fee379"}]},{featureType:"water",elementType:"all",stylers:[{visibility:"on"},{color:"#7fc8ed"}]}]},function(e,t){"use strict";e.exports=[{featureType:"administrative.locality",elementType:"all",stylers:[{hue:"#2c2e33"},{saturation:7},{lightness:19},{visibility:"on"}]},{featureType:"landscape",elementType:"all",stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100},{visibility:"simplified"}]},{featureType:"poi",elementType:"all",stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100},{visibility:"off"}]},{featureType:"road",elementType:"geometry",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:31},{visibility:"simplified"}]},{featureType:"road",elementType:"labels",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:31},{visibility:"on"}]},{featureType:"road.arterial",elementType:"labels",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:-2},{visibility:"simplified"}]},{featureType:"road.local",elementType:"geometry",stylers:[{hue:"#e9ebed"},{saturation:-90},{lightness:-8},{visibility:"simplified"}]},{featureType:"transit",elementType:"all",stylers:[{hue:"#e9ebed"},{saturation:10},{lightness:69},{visibility:"on"}]},{featureType:"water",elementType:"all",stylers:[{hue:"#e9ebed"},{saturation:-78},{lightness:67},{visibility:"simplified"}]}]},function(e,t){"use strict";e.exports=[{featureType:"all",elementType:"labels.text.fill",stylers:[{color:"#ffffff"}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{color:"#000000"},{lightness:13}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#144b53"},{lightness:14},{weight:1.4}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#08304b"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#0c4152"},{lightness:5}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#0b434f"},{lightness:25}]},{featureType:"road.arterial",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.arterial",elementType:"geometry.stroke",stylers:[{color:"#0b3d51"},{lightness:16}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#000000"}]},{featureType:"transit",elementType:"all",stylers:[{color:"#146474"}]},{featureType:"water",elementType:"all",stylers:[{color:"#021019"}]}]},function(e,t){"use strict";e.exports=[{featureType:"water",stylers:[{saturation:43},{lightness:-11},{hue:"#0088ff"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{hue:"#ff0000"},{saturation:-100},{lightness:99}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#808080"},{lightness:54}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{color:"#ece2d9"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#ccdca1"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#767676"}]},{featureType:"road",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]},{featureType:"poi",stylers:[{visibility:"off"}]},{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#b8cb93"}]},{featureType:"poi.park",stylers:[{visibility:"on"}]},{featureType:"poi.sports_complex",stylers:[{visibility:"on"}]},{featureType:"poi.medical",stylers:[{visibility:"on"}]},{featureType:"poi.business",stylers:[{visibility:"simplified"}]}]},function(e,t){"use strict";e.exports=[{elementType:"geometry",stylers:[{hue:"#ff4400"},{saturation:-68},{lightness:-4},{gamma:.72}]},{featureType:"road",elementType:"labels.icon"},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{hue:"#0077ff"},{gamma:3.1}]},{featureType:"water",stylers:[{hue:"#00ccff"},{gamma:.44},{saturation:-33}]},{featureType:"poi.park",stylers:[{hue:"#44ff00"},{saturation:-23}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{hue:"#007fff"},{gamma:.77},{saturation:65},{lightness:99}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{gamma:.11},{weight:5.6},{saturation:99},{hue:"#0091ff"},{lightness:-86}]},{featureType:"transit.line",elementType:"geometry",stylers:[{lightness:-48},{hue:"#ff5e00"},{gamma:1.2},{saturation:-23}]},{featureType:"transit",elementType:"labels.text.stroke",stylers:[{saturation:-64},{hue:"#ff9100"},{lightness:16},{gamma:.47},{weight:2.7}]}]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n=0&&e.end>=0&&""!==e.location){var n;t=o({},this.type,(n={},o(n,this.props.appbaseField,e.location),o(n,"from",e.start+this.unit),o(n,"to",e.end+this.unit),n))}return t}},{key:"getCoordinates",value:function(e,t){var n=this;e&&""!==e?m["default"].get("https://maps.googleapis.com/maps/api/geocode/json?address="+e).then(function(e){var r=e.data.results[0].geometry.location;n.locString=r.lat+", "+r.lng,t?t.call(n,n.defaultSelected.label):n.executeQuery()}):p.AppbaseSensorHelper.selectedSensor.set(null,!0)}},{key:"executeQuery",value:function(){if(""!==this.state.currentValue&&this.state.selected&&this.locString){var e,t={key:this.props.componentId,value:{currentValue:this.state.currentValue,start:this.state.selected.start,end:this.state.selected.end,location:this.locString,unit:this.unit}},n={key:this.props.componentId,value:o({},this.sortInfo.type,(e={},o(e,this.props.appbaseField,this.locString),o(e,"order",this.sortInfo.order),o(e,"unit",this.unit),e))};this.props.onValueChange&&this.props.onValueChange(t.value),p.AppbaseSensorHelper.selectedSensor.setSortInfo(n),p.AppbaseSensorHelper.URLParams.update(this.props.componentId,this.setURLValue(),this.props.URLParams),p.AppbaseSensorHelper.selectedSensor.set(t,!0)}}},{key:"setURLValue",value:function(){return JSON.stringify({location:this.state.currentValue,label:this.state.selected.label})}},{key:"handleChange",value:function(e){if(e){var t=e.value;this.setState({currentValue:t}),this.getCoordinates(t)}else{this.setState({currentValue:""});var n={key:this.props.componentId,value:null};this.props.onValueChange&&this.props.onValueChange(n.value),p.AppbaseSensorHelper.URLParams.update(this.props.componentId,null,this.props.URLParams),p.AppbaseSensorHelper.selectedSensor.set(n,!0)}}},{key:"loadOptions",value:function(e,t){var n=this;if(this.callback=t,e){var r=this.googleMaps||window.google.maps;this.autocompleteService=new r.places.AutocompleteService;var o={input:e};this.result={options:[]},this.autocompleteService.getPlacePredictions(o,function(e){e.forEach(function(e){n.result.options.push({label:e.description,value:e.description})}),n.state.userLocation.length&&"Use my current location"!==n.result.options[0].label&&n.result.options.unshift({label:"Use my current location",value:n.state.userLocation}),n.callback(null,n.result)})}else this.callback(null,this.result)}},{key:"handleDistanceChange",value:function(e){this.setState({selected:{start:e.start,end:e.end,label:e.label}},this.executeQuery.bind(this))}},{key:"renderValue",value:function(e){return c["default"].createElement("span",null,e.value)}},{key:"render",value:function(){var e=null;this.props.title&&(e=c["default"].createElement("h4",{className:"rbc-title"},this.props.title));var t=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return c["default"].createElement("div",{className:"rbc rbc-geodistancedropdown clearfix card thumbnail col s12 col-xs-12 "+t,style:this.props.componentStyle},c["default"].createElement("div",{className:"row"},e,c["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},c["default"].createElement(v["default"].Async,{value:this.state.currentValue,loadOptions:this.loadOptions,placeholder:this.props.placeholder,onChange:this.handleChange,filterOption:function(){return!0},valueRenderer:this.renderValue})),c["default"].createElement("div",{className:"col s12 col-xs-12"},c["default"].createElement(v["default"],{value:this.state.selected.label?this.state.selected:"",options:this.props.data,clearable:!1,searchable:!1,onChange:this.handleDistanceChange,placeholder:this.props.placeholderDropdown}))))}}]),t}(l.Component);t["default"]=_,_.propTypes={componentId:c["default"].PropTypes.string.isRequired,appbaseField:c["default"].PropTypes.string.isRequired,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]), customQuery:c["default"].PropTypes.func,defaultSelected:c["default"].PropTypes.shape({label:c["default"].PropTypes.string,location:c["default"].PropTypes.string}),placeholder:c["default"].PropTypes.string,placeholderDropdown:c["default"].PropTypes.string,autoLocation:c["default"].PropTypes.bool,unit:c["default"].PropTypes.oneOf(["mi","miles","yd","yards","ft","feet","in","inch","km","kilometers","m","meters","cm","centimeters","mm","millimeters","NM","nmi","nauticalmiles"]),data:c["default"].PropTypes.arrayOf(c["default"].PropTypes.shape({start:p.AppbaseSensorHelper.validateThreshold,end:p.AppbaseSensorHelper.validateThreshold,label:c["default"].PropTypes.string.isRequired})),onValueChange:c["default"].PropTypes.func,componentStyle:c["default"].PropTypes.object,URLParams:c["default"].PropTypes.bool},_.defaultProps={unit:"mi",placeholder:"Search...",placeholderDropdown:"Select Distance",autoLocation:!0,componentStyle:{},URLParams:!1},_.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n>8-a%1*8)){if(o=t.charCodeAt(a+=.75),o>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|o}return s}),n.atob||(n.atob=function(t){if(t=t.replace(/=+$/,""),t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,s="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?s+=String.fromCharCode(255&n>>(-2*a&6)):0)o=r.indexOf(o);return s})}()},function(e,t){"use strict";function n(){return!1}function r(){return!0}function o(){this.timeStamp=Date.now(),this.target=void 0,this.currentTarget=void 0}Object.defineProperty(t,"__esModule",{value:!0}),o.prototype={isEventObject:1,constructor:o,isDefaultPrevented:n,isPropagationStopped:n,isImmediatePropagationStopped:n,preventDefault:function(){this.isDefaultPrevented=r},stopPropagation:function(){this.isPropagationStopped=r},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=r,this.stopPropagation()},halt:function(e){e?this.stopImmediatePropagation():this.stopPropagation(),this.preventDefault()}},t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return null===e||void 0===e}function a(){return d}function i(){return f}function s(e){var t=e.type,n="function"==typeof e.stopPropagation||"boolean"==typeof e.cancelBubble;l["default"].call(this),this.nativeEvent=e;var r=i;"defaultPrevented"in e?r=e.defaultPrevented?a:i:"getPreventDefault"in e?r=e.getPreventDefault()?a:i:"returnValue"in e&&(r=e.returnValue===f?a:i),this.isDefaultPrevented=r;var o=[],s=void 0,u=void 0,c=void 0,p=h.concat();for(m.forEach(function(e){t.match(e.reg)&&(p=p.concat(e.props),e.fix&&o.push(e.fix))}),u=p.length;u;)c=p[--u],this[c]=e[c];for(!this.target&&n&&(this.target=e.srcElement||document),this.target&&3===this.target.nodeType&&(this.target=this.target.parentNode),u=o.length;u;)(s=o[--u])(this,e);this.timeStamp=e.timeStamp||Date.now()}Object.defineProperty(t,"__esModule",{value:!0});var u=n(411),l=r(u),c=n(9),p=r(c),d=!0,f=!1,h=["altKey","bubbles","cancelable","ctrlKey","currentTarget","eventPhase","metaKey","shiftKey","target","timeStamp","view","type"],m=[{reg:/^key/,props:["char","charCode","key","keyCode","which"],fix:function(e,t){o(e.which)&&(e.which=o(t.charCode)?t.keyCode:t.charCode),void 0===e.metaKey&&(e.metaKey=e.ctrlKey)}},{reg:/^touch/,props:["touches","changedTouches","targetTouches"]},{reg:/^hashchange$/,props:["newURL","oldURL"]},{reg:/^gesturechange$/i,props:["rotation","scale"]},{reg:/^(mousewheel|DOMMouseScroll)$/,props:[],fix:function(e,t){var n=void 0,r=void 0,o=void 0,a=t.wheelDelta,i=t.axis,s=t.wheelDeltaY,u=t.wheelDeltaX,l=t.detail;a&&(o=a/120),l&&(o=0-(l%3===0?l/3:l)),void 0!==i&&(i===e.HORIZONTAL_AXIS?(r=0,n=0-o):i===e.VERTICAL_AXIS&&(n=0,r=o)),void 0!==s&&(r=s/120),void 0!==u&&(n=-1*u/120),n||r||(r=o),void 0!==n&&(e.deltaX=n),void 0!==r&&(e.deltaY=r),void 0!==o&&(e.delta=o)}},{reg:/^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,props:["buttons","clientX","clientY","button","offsetX","relatedTarget","which","fromElement","toElement","offsetY","pageX","pageY","screenX","screenY"],fix:function(e,t){var n=void 0,r=void 0,a=void 0,i=e.target,s=t.button;return i&&o(e.pageX)&&!o(t.clientX)&&(n=i.ownerDocument||document,r=n.documentElement,a=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||a&&a.scrollLeft||0)-(r&&r.clientLeft||a&&a.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||a&&a.scrollTop||0)-(r&&r.clientTop||a&&a.clientTop||0)),e.which||void 0===s||(1&s?e.which=1:2&s?e.which=3:4&s?e.which=2:e.which=0),!e.relatedTarget&&e.fromElement&&(e.relatedTarget=e.fromElement===i?e.toElement:e.fromElement),e}}],y=l["default"].prototype;(0,p["default"])(s.prototype,y,{constructor:s,preventDefault:function(){var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=f,y.preventDefault.call(this)},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=d,y.stopPropagation.call(this)}}),t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){function r(t){var r=new i["default"](t);n.call(e,r)}return e.addEventListener?(e.addEventListener(t,r,!1),{remove:function(){e.removeEventListener(t,r,!1)}}):e.attachEvent?(e.attachEvent("on"+t,r),{remove:function(){e.detachEvent("on"+t,r)}}):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var a=n(412),i=r(a);e.exports=t["default"]},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;var o=t.type,a=t.body;delete t.type,delete t.body;var i;return i=o?o+"/_bulk":"/_bulk",e.performStreamingRequest({method:"POST",path:i,params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;delete t.type,delete t.id;var i=o+"/"+a;return e.performStreamingRequest({method:"DELETE",path:i,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;delete t.type,delete t.id;var i=o+"/"+a;return e.performStreamingRequest({method:"GET",path:i,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(140),o=function(e){var t=r.obj(function(e,t,n){var r=Object.keys(e)[0],o=Object.keys(e[r].mappings).filter(function(e){return"_default_"!==e});this.push(o),n()});return t.writable=!1,e.performStreamingRequest({method:"GET",path:"_mapping"}).pipe(t)};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",body:"object"});if(n!==!0)throw n;var o=t.type,a=t.id,i=t.body;delete t.type,delete t.id,delete t.body;var s;return s=a?o+"/"+a:o,e.performStreamingRequest({method:"POST",path:s,params:t,body:i})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;var o;o=t.type.constructor===Array?t.type.join():t.type;var a=t.body;delete t.type,delete t.body;var i;return i=o?o+"/_search":"/_search",e.performStreamingRequest({method:"POST",path:i,params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;return delete t.type,delete t.id,delete t.stream,t.stream===!0||"true"===t.stream?t.stream="true":(delete t.stream,t.streamonly="true"),e.performWsRequest({method:"GET",path:o+"/"+a,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;if(void 0===t.type||"string"!=typeof t.type&&t.type.constructor!==Array||""===t.type||0===t.type.length)throw new Error("fields missing: type");var o;o=t.type.constructor===Array?t.type.join():t.type;var o=t.type,a=t.body;return delete t.type,delete t.body,delete t.stream,t.streamonly="true",e.performWsRequest({method:"POST",path:o+"/_search",params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string",body:"object"});if(n!==!0)throw n;var o=t.type,a=t.id,i=t.body;delete t.type,delete t.id,delete t.body;var s=o+"/"+a+"/_update";return e.performStreamingRequest({method:"POST",path:s,params:t,body:i})};e.exports=o},function(e,t,n){"use strict";var r=n(565),o=n(34),a=function(e,t,n){var a=o.validate(t,{body:"object"});if(a!==!0)throw a;if(void 0===t.type||"string"!=typeof t.type&&t.type.constructor!==Array||""===t.type||0===t.type.length)throw new Error("fields missing: type");if(a=o.validate(t.body,{query:"object"}),a!==!0)throw a;if(t.type.constructor===Array?(this.type=t.type,this.type_string=t.type.join()):(this.type=[t.type],this.type_string=t.type),this.webhooks=[],this.client=e,this.query=t.body.query,"string"==typeof n){var i={};i.url=n,i.method="GET",this.webhooks.push(i)}else if(n.constructor===Array)this.webhooks=n;else{if(n!==Object(n))throw new Error("fields missing: second argument(webhook) is necessary");this.webhooks.push(n)}this.populateBody();var s=btoa(r(this.query)),u=".percolator/webhooks-0-"+this.type_string+"-0-"+s;return this.path=u,this.performRequest("POST")};a.prototype.populateBody=function(){this.body={},this.body.webhooks=this.webhooks,this.body.query=this.query,this.body.type=this.type},a.prototype.performRequest=function(e){var t=this.client.performStreamingRequest({method:e,path:this.path,body:this.body});return t.change=this.change.bind(this),t.stop=this.stop.bind(this),t},a.prototype.change=function(e){if(this.webhooks=[],"string"==typeof e){var t={};t.url=e,t.method="POST",this.webhooks.push(t)}else if(e.constructor===Array)this.webhooks=e;else{if(e!==Object(e))throw new Error("fields missing: one of webhook or url fields is required");this.webhooks.push(e)}return this.populateBody(),this.performRequest("POST")},a.prototype.stop=function(){return delete this.body,this.performRequest("DELETE")},e.exports=a},function(e,t,n){"use strict";var r=n(142),o=n(425),a=n(426),i=n(427),s=n(418),u=n(416),l=n(422),c=n(415),p=n(414),d=n(419),f=n(417),h=n(423),m=n(420),y=n(421),v=function g(e){if(!(this instanceof g))return new g(e);if("string"!=typeof e.url||""===e.url)throw new Error("URL not present in options.");var t=r.parse(e.url);if(this.url=t.host,this.protocol=t.protocol,this.credentials=t.auth,this.appname=e.appname||e.app,"string"!=typeof this.appname||""===this.appname)throw new Error("App name is not present in options.");if("string"!=typeof this.protocol||""===this.protocol)throw new Error("Protocol is not present in url. URL should be of the form https://scalr.api.appbase.io");if("string"==typeof e.username&&""!==e.username&&"string"==typeof e.password&&""!==e.password&&(this.credentials=e.username+":"+e.password),"string"==typeof e.credentials&&""!==e.credentials&&(this.credentials=e.credentials),"string"!=typeof this.credentials||""===this.credentials)throw new Error("Authentication information is not present. Did you add credentials?");"https:"===t.protocol?this.ws=new o("wss://"+t.host+"/"+this.appname):this.ws=new o("ws://"+t.host+"/"+this.appname),"/"===this.url.slice(-1)&&(this.url=this.url.slice(0,-1));var n={};return n.index=this.index.bind(this),n.get=this.get.bind(this),n.update=this.update.bind(this),n["delete"]=this["delete"].bind(this),n.bulk=this.bulk.bind(this),n.search=this.search.bind(this),n.getStream=this.getStream.bind(this),n.searchStream=this.searchStream.bind(this),n.searchStreamToURL=this.searchStreamToURL.bind(this),n.getTypes=this.getTypes.bind(this),n};v.prototype.performWsRequest=function(e){return new i(this,JSON.parse(JSON.stringify(e)))},v.prototype.performStreamingRequest=function(e){return new a(this,JSON.parse(JSON.stringify(e)))},v.prototype.index=function(e){return new s(this,JSON.parse(JSON.stringify(e)))},v.prototype.get=function(e){return new u(this,JSON.parse(JSON.stringify(e)))},v.prototype.update=function(e){return new l(this,JSON.parse(JSON.stringify(e)))},v.prototype["delete"]=function(e){return new c(this,JSON.parse(JSON.stringify(e)))},v.prototype.bulk=function(e){return new p(this,JSON.parse(JSON.stringify(e)))},v.prototype.search=function(e){return new d(this,JSON.parse(JSON.stringify(e)))},v.prototype.getStream=function(e){return new m(this,JSON.parse(JSON.stringify(e)))},v.prototype.searchStream=function(e){return new y(this,JSON.parse(JSON.stringify(e)))},v.prototype.searchStreamToURL=function(e,t){return new h(this,JSON.parse(JSON.stringify(e)),JSON.parse(JSON.stringify(t)))},v.prototype.getTypes=function(){return new f(this)},"undefined"!=typeof window&&(window.Appbase=v),e.exports=v},function(e,t,n){"use strict";var r="undefined"!=typeof window?window.WebSocket:n(748),o=n(36).EventEmitter,a=function(e){var t=new r(e),n=new o;return n.setMaxListeners(0),n.send=function(e){return 1===t.readyState?(t.send(JSON.stringify(e)),this):void n.on("open",function r(){t.send(JSON.stringify(e)),n.removeListener("open",r)})},t.onopen=function(){n.emit("open")},t.onmessage=function(e){var t=JSON.parse(e.data);n.emit("message",t)},t.onerror=function(e){n.emit("error",e)},t.onclose=function(e){n.emit("close",e)},n};e.exports=a},function(e,t,n){(function(t){"use strict";var r=n(553),o=n(733),a=n(113),i=n(140),s=function(e,t){if(this.client=e,this.args=t,this.method=t.method,this.path=t.path,this.params=t.params,this.body=t.body,(!this.body||"object"!=typeof this.body&&this.body.constructor!==Array)&&(this.body={}),this.body.constructor===Array){var n=this.body;this.body="";for(var r=0;r=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;ts.bottom||i.topt.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var n=this,r="object"==typeof t?t:this.props;if(r.multi){if("string"==typeof e&&(e=e.split(r.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return n.expandValue(e,r)}).filter(function(e){return e})}var o=this.expandValue(e,r);return o?[o]:[]},expandValue:function(e,t){var n=typeof e;if("string"!==n&&"number"!==n&&"boolean"!==n)return e;var r=t.options,o=t.valueKey;if(r)for(var a=0;ar&&this.focusOption(n[r+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var n=-1,r=0;r0?n-=1:n=t.length-1;else if("start"===e)n=0;else if("end"===e)n=t.length-1;else if("page_up"===e){var o=n-this.props.pageSize;n=o<0?0:o}else if("page_down"===e){var o=n+this.props.pageSize;n=o>t.length-1?t.length-1:o}n===-1&&(n=0),this.setState({focusedIndex:t[n].index,focusedOption:t[n].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return l["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},l["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var n=this,r=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:l["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var a=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return l["default"].createElement(o,{id:n._instancePrefix+"-value-"+t,instancePrefix:n._instancePrefix,disabled:n.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[n.props.valueKey],onClick:a,onRemove:n.removeValue,value:e},r(e,t),l["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(a=null),l["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:a,value:e[0]},r(e[0])))},renderInput:function(e,t){var n,r=this,i=(0,m["default"])("Select-input",this.props.inputProps.className),u=!!this.state.isOpen,c=(0,m["default"])((n={},a(n,this._instancePrefix+"-list",u),a(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),p=s({},this.props.inputProps,{role:"combobox","aria-expanded":""+u,"aria-owns":c,"aria-haspopup":""+u,"aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:i,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(p);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,h=(d.inputClassName,o(d,["inputClassName"]));return l["default"].createElement("div",s({},h,{role:"combobox","aria-expanded":u,"aria-owns":u?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:i,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?l["default"].createElement(f["default"],s({},p,{minWidth:"5"})):l["default"].createElement("div",{className:i},l["default"].createElement("input",p))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return l["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,n=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return l["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},n)},filterOptions:function N(e){var t=this.state.inputValue,n=this.props.options||[];if(this.props.filterOptions){var N="function"==typeof this.props.filterOptions?this.props.filterOptions:_["default"];return N(n,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return n},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,n){return e&&e.length?this.props.menuRenderer({focusedOption:n,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?l["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var n=e.map(function(e){return i(e[t.props.valueKey])}).join(this.props.delimiter);return l["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:n,disabled:this.props.disabled})}return e.map(function(e,n){return l["default"].createElement("input",{key:"hidden."+n,type:"hidden",ref:"value"+n,name:t.props.name,value:i(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var n=this.state.focusedOption||e;if(n&&!n.disabled){var r=t.indexOf(n);if(r!==-1)return r}for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c){var d={startTime:(new Date).getTime(),appliedQuery:u},f=this.appbaseRef[t];if(f){var h=u;h.type="*"===this.type[t]?"":this.type[t],h.preference=this.app[t],n(d),f.search(h).on("data",function(e){d.mode="historic",d.data=o.highlightModify(e,d.appliedQuery),i.emitter.emit(t,d);var n=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:d,react:s.react,queryOptions:n})}).on("error",function(e){var n={appliedQuery:d.appliedQuery,error:e,startTime:d.startTime};i.emitter.emit(t,n)}),s.stream&&r.call(this,t,u,f)}else console.error("appbaseRef is not set for "+t)}else{var m={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,m)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t){"use strict";function n(e,t){for(var n=[],r={object:null,string:""},o=Object.keys(t),a=o,i=Array.isArray(a),s=0,a=i?a:a[Symbol.iterator]();;){var u;if(i){if(s>=a.length)break;u=a[s++]}else{if(s=a.next(),s.done)break;u=s.value}var l=u,c=t[l];typeof e[l]===c&&e[l]!==r[c]||n.push(l)}for(var p="",d=0;d0)||new Error("fields missing: "+p)}e.exports={validate:n}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],i(n))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:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,u=0;u0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n), +"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;ts.bottom||i.topt.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var n=this,r="object"==typeof t?t:this.props;if(r.multi){if("string"==typeof e&&(e=e.split(r.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return n.expandValue(e,r)}).filter(function(e){return e})}var o=this.expandValue(e,r);return o?[o]:[]},expandValue:function(e,t){var n=typeof e;if("string"!==n&&"number"!==n&&"boolean"!==n)return e;var r=t.options,o=t.valueKey;if(r)for(var a=0;ar&&this.focusOption(n[r+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var n=-1,r=0;r0?n-=1:n=t.length-1;else if("start"===e)n=0;else if("end"===e)n=t.length-1;else if("page_up"===e){var o=n-this.props.pageSize;n=o<0?0:o}else if("page_down"===e){var o=n+this.props.pageSize;n=o>t.length-1?t.length-1:o}n===-1&&(n=0),this.setState({focusedIndex:t[n].index,focusedOption:t[n].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return l["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},l["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var n=this,r=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:l["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var a=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return l["default"].createElement(o,{id:n._instancePrefix+"-value-"+t,instancePrefix:n._instancePrefix,disabled:n.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[n.props.valueKey],onClick:a,onRemove:n.removeValue,value:e},r(e,t),l["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(a=null),l["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:a,value:e[0]},r(e[0])))},renderInput:function(e,t){var n,r=this,i=(0,m["default"])("Select-input",this.props.inputProps.className),u=!!this.state.isOpen,c=(0,m["default"])((n={},a(n,this._instancePrefix+"-list",u),a(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),p=s({},this.props.inputProps,{role:"combobox","aria-expanded":""+u,"aria-owns":c,"aria-haspopup":""+u,"aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:i,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(p);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,h=(d.inputClassName,o(d,["inputClassName"]));return l["default"].createElement("div",s({},h,{role:"combobox","aria-expanded":u,"aria-owns":u?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:i,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?l["default"].createElement(f["default"],s({},p,{minWidth:"5"})):l["default"].createElement("div",{className:i},l["default"].createElement("input",p))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return l["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,n=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return l["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},n)},filterOptions:function N(e){var t=this.state.inputValue,n=this.props.options||[];if(this.props.filterOptions){var N="function"==typeof this.props.filterOptions?this.props.filterOptions:_["default"];return N(n,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return n},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,n){return e&&e.length?this.props.menuRenderer({focusedOption:n,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?l["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var n=e.map(function(e){return i(e[t.props.valueKey])}).join(this.props.delimiter);return l["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:n,disabled:this.props.disabled})}return e.map(function(e,n){return l["default"].createElement("input",{key:"hidden."+n,type:"hidden",ref:"value"+n,name:t.props.name,value:i(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var n=this.state.focusedOption||e;if(n&&!n.disabled){var r=t.indexOf(n);if(r!==-1)return r}for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c)!function(){var e={startTime:(new Date).getTime(),appliedQuery:u},a=o.appbaseRef[t];if(a){var l=u;l.type="*"===o.type[t]?"":o.type[t],l.preference=o.app[t],n(e),a.search(l).on("data",function(n){e.mode="historic",e.data=o.highlightModify(n,e.appliedQuery),i.emitter.emit(t,e);var r=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:e,react:s.react,queryOptions:r})}).on("error",function(n){var r={appliedQuery:e.appliedQuery,error:n,startTime:e.startTime};i.emitter.emit(t,r)}),s.stream&&r.call(o,t,u,a)}else console.error("appbaseRef is not set for "+t)}();else{var d={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,d)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t){"use strict";function n(e,t){for(var n=[],r={object:null,string:""},o=Object.keys(t),a=o,i=Array.isArray(a),s=0,a=i?a:a[Symbol.iterator]();;){var u;if(i){if(s>=a.length)break;u=a[s++]}else{if(s=a.next(),s.done)break;u=s.value}var l=u,c=t[l];typeof e[l]===c&&e[l]!==r[c]||n.push(l)}for(var p="",d=0;d0)||new Error("fields missing: "+p)}e.exports={validate:n}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],i(n))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:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,u=0;u0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n), o||(o=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var o=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,o,i,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=i;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.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(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a];s?this[a]=s(n):"target"===a?this.target=r:this[a]=n[a]}var u=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;return u?this.isDefaultPrevented=i.thatReturnsTrue:this.isDefaultPrevented=i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse,this}var o=n(9),a=n(47),i=n(25),s=(n(5),"function"==typeof Proxy,["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),u={type:null,target:null,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};o(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=i.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=i.thatReturnsTrue)},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n-1)return!1;if(r.filterOption)return r.filterOption.call(o,e,t);if(!t)return!0;var a=String(e[r.valueKey]),s=String(e[r.labelKey]);return r.ignoreAccents&&("label"!==r.matchProp&&(a=(0,i["default"])(a)),"value"!==r.matchProp&&(s=(0,i["default"])(s))),r.ignoreCase&&("label"!==r.matchProp&&(a=a.toLowerCase()),"value"!==r.matchProp&&(s=s.toLowerCase())),"start"===r.matchPos?"label"!==r.matchProp&&a.substr(0,t.length)===t||"value"!==r.matchProp&&s.substr(0,t.length)===t:"label"!==r.matchProp&&a.indexOf(t)>=0||"value"!==r.matchProp&&s.indexOf(t)>=0})}var a=n(350),i=r(a);e.exports=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.focusedOption,n=e.instancePrefix,r=(e.labelKey,e.onFocus),o=e.onSelect,a=e.optionClassName,s=e.optionComponent,l=e.optionRenderer,c=e.options,p=e.valueArray,d=e.valueKey,f=e.onOptionRef,h=s;return c.map(function(e,s){var c=p&&p.indexOf(e)>-1,m=e===t,y=(0,i["default"])(a,{"Select-option":!0,"is-selected":c,"is-focused":m,"is-disabled":e.disabled});return u["default"].createElement(h,{className:y,instancePrefix:n,isDisabled:e.disabled,isFocused:m,isSelected:c,key:"option-"+s+"-"+e[d],onFocus:r,onSelect:o,option:e,optionIndex:s,ref:function(e){f(e,m)}},l(e,s))})}var a=n(3),i=r(a),s=n(2),u=r(s);e.exports=o},function(e,t){"use strict";var n=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];e.exports=function(e){for(var t=0;t0)if(t.ended&&!o){var i=new Error("stream.push() after EOF");e.emit("error",i)}else if(t.endEmitted&&o){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var l;!t.decoder||o||r||(n=t.decoder.write(n),l=!t.objectMode&&0===n.length),o||(t.reading=!1),l||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,o?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&d(e))),h(e,t)}else o||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length=B?e=B:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function l(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function c(e,t){var n=null;return j.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function p(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,d(e)}}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(N("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?O(f,e):f(e))}function f(e){N("emit readable"),e.emit("readable"),b(e)}function h(e,t){t.readingMore||(t.readingMore=!0,O(m,e,t))}function m(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=M(e,t.buffer,t.decoder),n}function M(e,t,n){var r;return ea.length?a.length:e;if(o+=i===a.length?a:a.slice(0,e),e-=i,0===e){i===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(i));break}++r}return t.length-=r,o}function k(e,t){var n=Y.allocUnsafe(e),r=t.head,o=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,i=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,i),e-=i,0===e){i===a.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(i));break}++o}return t.length-=o,n}function S(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,O(P,t,e))}function P(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function L(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return N("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?S(this):d(this),null;if(e=l(e,t),0===e&&t.ended)return 0===t.length&&S(this),null;var r=t.needReadable;N("need readable",r),(0===t.length||t.length-e0?T(e,t):null,null===o?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&S(this)),null!==o&&this.emit("data",o),o},a.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},a.prototype.pipe=function(e,n){function o(e){N("onunpipe"),e===d&&i()}function a(){N("onend"),e.end()}function i(){N("cleanup"),e.removeListener("close",l),e.removeListener("finish",c),e.removeListener("drain",v),e.removeListener("error",u),e.removeListener("unpipe",o),d.removeListener("end",a),d.removeListener("end",i),d.removeListener("data",s),g=!0,!f.awaitDrain||e._writableState&&!e._writableState.needDrain||v()}function s(t){N("ondata"),_=!1;var n=e.write(t);!1!==n||_||((1===f.pipesCount&&f.pipes===e||f.pipesCount>1&&L(f.pipes,e)!==-1)&&!g&&(N("false write response, pause",d._readableState.awaitDrain),d._readableState.awaitDrain++,_=!0),d.pause())}function u(t){N("onerror",t),p(),e.removeListener("error",u),0===C(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",c),p()}function c(){N("onfinish"),e.removeListener("close",l),p()}function p(){N("unpipe"),d.unpipe(e)}var d=this,f=this._readableState;switch(f.pipesCount){case 0:f.pipes=e;break;case 1:f.pipes=[f.pipes,e];break;default:f.pipes.push(e)}f.pipesCount+=1,N("pipe count=%d opts=%j",f.pipesCount,n);var h=(!n||n.end!==!1)&&e!==t.stdout&&e!==t.stderr,m=h?a:i;f.endEmitted?O(m):d.once("end",m),e.on("unpipe",o);var v=y(d);e.on("drain",v);var g=!1,_=!1;return d.on("data",s),r(e,"error",u),e.once("close",l),e.once("finish",c),e.emit("pipe",d),f.flowing||(N("pipe resume"),d.resume()),e},a.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?r:S;s.WritableState=i;var L=n(14);L.inherits=n(11);var D={deprecate:n(745)},O=n(359),E=n(15).Buffer,C=n(78);L.inherits(s,O),i.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(i.prototype,"buffer",{get:D.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var x;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(x=Function.prototype[Symbol.hasInstance],Object.defineProperty(s,Symbol.hasInstance,{value:function(e){return!!x.call(this,e)||e&&e._writableState instanceof i}})):x=function(e){return e instanceof this},s.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},s.prototype.write=function(e,t,n){var r=this._writableState,a=!1,i=E.isBuffer(e);return"function"==typeof t&&(n=t,t=null),i?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=o),r.ended?u(this,n):(i||l(this,r,e,n))&&(r.pendingcb++,a=p(this,r,i,e,t,n)),a},s.prototype.cork=function(){var e=this._writableState;e.corked++},s.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||g(this,e))},s.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},s.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},s.prototype._writev=null,s.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)}}).call(t,n(7),n(141).setImmediate)},function(e,t,n){e.exports=n(36).EventEmitter},function(e,t,n){"use strict";function r(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function o(e){var t=r(e);if("string"!=typeof t&&(g.isEncoding===b||!b(e)))throw new Error("Unknown encoding: "+e);return t||e}function a(e){this.encoding=o(e);var t;switch(this.encoding){case"utf16le":this.text=d,this.end=f,t=4;break;case"utf8":this.fillLast=l,t=4;break;case"base64":this.text=h,this.end=m,t=3;break;default:return this.write=y,void(this.end=v)}this.lastNeed=0,this.lastTotal=0,this.lastChar=_.allocUnsafe(t)}function i(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:-1}function s(e,t,n){var r=t.length-1;if(r=0?(o>0&&(e.lastNeed=o-1),o):--r=0?(o>0&&(e.lastNeed=o-2),o):--r=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0))}function u(e,t,n){if(128!==(192&t[0]))return e.lastNeed=0,"�".repeat(n);if(e.lastNeed>1&&t.length>1){if(128!==(192&t[1]))return e.lastNeed=1,"�".repeat(n+1);if(e.lastNeed>2&&t.length>2&&128!==(192&t[2]))return e.lastNeed=2,"�".repeat(n+2)}}function l(e){var t=this.lastTotal-this.lastNeed,n=u(this,e,t);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�".repeat(this.lastTotal-this.lastNeed):t}function d(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function f(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function h(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function m(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function y(e){return e.toString(this.encoding)}function v(e){return e&&e.length?this.write(e):""}var g=n(15).Buffer,_=n(78),b=g.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n&&n.and?"string"==typeof n.and&&(n.and=[n.and]):n.and=[],n.and.push("streamChanges"),this.sortObj&&this.enableSort(n);var r=h["default"].create(this.context.appbaseRef,this.context.type,n,this.props.size,this.props.from,this.props.stream,this.context.app);if(this.channelId=r.channelId,this.channelListener=r.emitter.addListener(r.channelId,function(t){if(t.error&&t.startTime>e.queryStartTime&&(e.setState({queryStart:!1,showPlaceholder:!1}),e.props.onAllData)){var n=L.prepareResultData(t);e.props.onAllData(n.res,n.err)}if(t.appliedQuery)if("historic"===t.mode&&t.startTime>e.queryStartTime){var r=!(!t.appliedQuery||!t.data||t.data.error||t.data.hits&&t.data.hits.total),o={resultFound:!!(t.appliedQuery&&t.data&&!t.data.error&&t.data.hits&&t.data.hits.total)};t.appliedQuery&&t.data&&!t.data.error&&(o.total=t.data.hits.total,o.took=t.data.took),e.setState({queryStart:!1,visibleNoResults:r,resultStats:o,showPlaceholder:!1}),e.afterChannelResponse(t)}else"streaming"===t.mode&&(e.afterChannelResponse(t),e.updateResultStats(t.data));else e.setState({showPlaceholder:!0})}),this.listenLoadingChannel(r),t){var o={key:"streamChanges",value:""};L.selectedSensor.set(o,!0)}}},{key:"updateResultStats",value:function(e){var t=this.state.resultStats;t.total=L.updateStats(t.total,e),this.setState({resultStats:t})}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"afterChannelResponse",value:function(e){var t=this,n=e.data,r=void 0,o=void 0,a=[],i=[];if(this.streamFlag=!1,"streaming"===e.mode)this.channelMethod="streaming",a=n,a.stream=!0,i=this.state.currentData,this.streamFlag=!0,o=this.setMarkersData(r);else if("historic"===e.mode){this.queryStartTime=e.startTime,this.channelMethod="historic",a=n.hits&&n.hits.hits?n.hits.hits:[];var s=this.normalizeCurrentData(e,this.state.currentData,a);a=s.newData,i=s.currentData}this.setState({rawData:r,newData:a,currentData:i,markersData:o,isLoading:!1},function(){e.allMarkers=r;var n=JSON.parse(JSON.stringify(e));n.newData=t.state.newData,n.currentData=t.state.currentData,delete n.data,n=L.prepareResultData(n,e.data);var o=t.props.onAllData?t.props.onAllData(n.res,n.err):t.defaultonAllData(n.res,n.err);t.setState({resultMarkup:o,currentData:t.combineCurrentData(a)})})}},{key:"normalizeCurrentData",value:function(e,t,n){var r=JSON.parse(JSON.stringify(e.appliedQuery)),o=JSON.stringify(r)===JSON.stringify(this.appliedQuery)?t||[]:[];return o.length?n=n.filter(function(e){var t=!0;return o.forEach(function(n){e._id+"-"+e._type==n._id+"-"+n._type&&(t=!1)}),t}):this.appliedQuery=r,{currentData:o,newData:n}}},{key:"combineCurrentData",value:function(e){return P["default"].isArray(e)?this.state.currentData.concat(e):this.streamDataModify(this.state.currentData,e)}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.createChannel(e)}},{key:"removeChannel",value:function(){this.channelId&&(h["default"].stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"render",value:function(){var e=null,t=null,n=(0,d["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-stream-active":this.props.stream,"rbc-stream-inactive":!this.props.stream,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader,"rbc-resultstats-active":this.props.showResultStats,"rbc-resultstats-inactive":!this.props.showResultStats,"rbc-noresults-active":this.props.noResults,"rbc-noresults-inactive":!this.props.noResults});return this.props.title&&(e=c["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.props.placeholder&&(t=c["default"].createElement("div",{className:"rbc-placeholder col s12 col-xs-12"},this.props.placeholder)),c["default"].createElement("div",{className:"rbc-reactiveelement-container"},c["default"].createElement("div",{className:"rbc rbc-reactiveelement card thumbnail "+n,style:this.props.componentStyle},e,this.state.resultStats&&this.state.resultStats.resultFound&&this.props.showResultStats?c["default"].createElement(M["default"],{onResultStats:this.props.onResultStats,took:this.state.resultStats.took,total:this.state.resultStats.total}):null,this.state.resultMarkup,this.state.showPlaceholder?t:null),this.props.noResults&&this.state.visibleNoResults?c["default"].createElement(b["default"],{defaultText:this.props.noResults.text}):null,this.props.initialLoader&&this.state.queryStart?c["default"].createElement(g["default"],{defaultText:this.props.initialLoader.text}):null,c["default"].createElement(y["default"],{container:"rbc-reactiveelement-container"}))}}]),t}(l.Component);t["default"]=D,D.propTypes={componentId:c["default"].PropTypes.string,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),from:L.validation.resultListFrom,onAllData:c["default"].PropTypes.func,size:L.sizeValidation,stream:c["default"].PropTypes.bool,componentStyle:c["default"].PropTypes.object,initialLoader:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),noResults:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),showResultStats:c["default"].PropTypes.bool,onResultStats:c["default"].PropTypes.func,react:c["default"].PropTypes.object,placeholder:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element])},D.defaultProps={from:0,size:20,stream:!1,showResultStats:!0,componentStyle:{}},D.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired,app:c["default"].PropTypes.any.isRequired},D.types={componentId:k.STRING,title:k.STRING,react:k.OBJECT,from:k.NUMBER,size:k.NUMBER,onAllData:k.FUNCTION,stream:k.BOOLEAN,componentStyle:k.OBJECT,initialLoader:k.STRING,noResults:k.STRING,showResultStats:k.BOOLEAN,onResultStats:k.FUNCTION,placeholder:k.STRING}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nt.height(),i=n.get(0).scrollHeight>n.height();if(!a&&!i&&n.length&&!e.props.pagination){var s=o(t.find(".rbc-title"))+o(t.find(".rbc-pagination"))*t.find(".rbc-pagination").length,u=t.height()-60-s;u>0&&n.css({height:n.height()+15,"padding-bottom":20})}};t&&t.length&&n&&n.length&&(n.css({height:"auto","padding-bottom":0}),setTimeout(a.bind(this),1e3))}},{key:"removeChannel",value:function(){this.channelId&&(m["default"].stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"createChannel",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n&&n.and?"string"==typeof n.and&&(n.and=[n.and]):n.and=[],n.and.push("streamChanges"),this.props.pagination&&(n.and.push("paginationChanges"),n.pagination=null),this.sortObj&&this.enableSort(n);var r=m["default"].create(this.context.appbaseRef,this.context.type,n,this.props.size,this.props.from,this.props.stream,this.context.app);this.channelId=r.channelId,this.channelListener=r.emitter.addListener(r.channelId,function(t){if(t.error&&t.startTime>e.queryStartTime&&(e.setState({queryStart:!1,showPlaceholder:!1}),e.props.onAllData)){var n=x.prepareResultData(t);e.props.onAllData(n.res,n.err)}if(t.appliedQuery)if("historic"===t.mode&&t.startTime>e.queryStartTime){var r=!(!(t.appliedQuery&&Object.keys(t.appliedQuery).length&&t.data)||t.data.error||t.data.hits&&t.data.hits.total),o={resultFound:!!(t.appliedQuery&&t.data&&!t.data.error&&t.data.hits&&t.data.hits.total)};t.appliedQuery&&t.data&&!t.data.error&&(o.total=t.data.hits.total,o.took=t.data.took),e.setState({queryStart:!1,visibleNoResults:r,resultStats:o,showPlaceholder:!1}),e.afterChannelResponse(t)}else"streaming"===t.mode&&(e.afterChannelResponse(t),e.updateResultStats(t.data));else e.setState({showPlaceholder:!0})}),this.listenLoadingChannel(r),t&&setTimeout(function(){var e={key:"streamChanges",value:""};x.selectedSensor.set(e,!0)},100)}},{key:"updateResultStats",value:function(e){var t=this.state.resultStats;t.total=x.updateStats(t.total,e),this.setState({resultStats:t})}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){if(e.appliedQuery){var n=!(t.state.requestOnScroll&&e.appliedQuery.body&&e.appliedQuery.body.from);t.setState({queryStart:e.queryState,showInitialLoader:n})}})}},{key:"afterChannelResponse",value:function(e){var t=this,n=e.data,r=void 0,o=void 0,a=[],i=[];if(this.streamFlag=!1,"streaming"===e.mode)this.channelMethod="streaming",a=n,a.stream=!0,i=this.state.currentData,this.streamFlag=!0,o=this.setMarkersData(r);else if("historic"===e.mode){this.queryStartTime=e.startTime,this.channelMethod="historic",a=n.hits&&n.hits.hits?n.hits.hits:[];var s=this.normalizeCurrentData(e,this.state.currentData,a);a=s.newData,i=s.currentData}this.setState({rawData:r,newData:a,currentData:i,markersData:o,isLoading:!1},function(){e.allMarkers=r;var o=JSON.parse(JSON.stringify(e));o.newData=t.state.newData,o.currentData=t.state.currentData,delete o.data,o=x.prepareResultData(o,n);var i=t.props.onAllData?t.props.onAllData(o.res,o.err):t.defaultonAllData(o.res,o.err);t.setState({resultMarkup:t.wrapMarkup(i),currentData:t.combineCurrentData(a)})})}},{key:"wrapMarkup",value:function(e){var t=null;return t=C["default"].isArray(e)?e.map(function(e,t){return p["default"].createElement("div",{key:t,className:"rbc-list-item"},e)}):e}},{key:"normalizeCurrentData",value:function(e,t,n){var r=JSON.parse(JSON.stringify(e.appliedQuery));this.state.requestOnScroll&&r&&r.body&&(delete r.body.from,delete r.body.size);var o=JSON.stringify(r)===JSON.stringify(this.appliedQuery),a=o?t||[]:[];return a.length?n=n.filter(function(e){var t=!0;return a.forEach(function(n){e._id+"-"+e._type==n._id+"-"+n._type&&(t=!1)}),t}):this.appliedQuery=r,o||j(".rbc.rbc-reactivelist").animate({scrollTop:0},100),{currentData:a,newData:n}}},{key:"combineCurrentData",value:function(e){return C["default"].isArray(e)?(e=e.map(function(e){return e.stream=!1,e}),this.state.currentData.concat(e)):this.streamDataModify(this.state.currentData,e,!1)}},{key:"enableSort",value:function(e){e.and.push(this.resultSortKey);var t={key:this.resultSortKey,value:this.sortObj};x.selectedSensor.setSortInfo(t)}},{key:"appendData",value:function(e){var t=this.state.rawData,n=t.hits.hits.concat(e.hits.hits);return t.hits.hits=C["default"].uniqBy(n,"_id"),t}},{key:"streamDataModify",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(t)if(t.stream=n,t.streamStart=new Date,t._deleted){var r=e.filter(function(e){return e._id!==t._id});e=r}else{var o=e.filter(function(e){return e._id!==t._id});e=o,e.unshift(t)}return e}},{key:"setMarkersData",value:function(e){return e?e:[]}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.createChannel(e),this.state.requestOnScroll?this.listComponent():this.setQueryForPagination()}},{key:"setQueryForPagination",value:function(){var e={queryType:"match",inputData:this.props.appbaseField,customQuery:function(){return null}},t={key:"paginationChanges",value:e};x.selectedSensor.setSensorInfo(t)}},{key:"executePaginationUpdate",value:function(){setTimeout(function(){var e={key:"paginationChanges",value:Math.random()};x.selectedSensor.set(e,!0)},100)}},{key:"paginationAt",value:function(e){var t=void 0;return!this.props.pagination||this.props.paginationAt!==e&&"both"!==this.props.paginationAt||(t=p["default"].createElement("div",{className:"rbc-pagination-container col s12 col-xs-12"},p["default"].createElement(L["default"],{className:"rbc-pagination-"+e,componentId:"pagination",onPageChange:this.props.onPageChange,title:this.props.paginationTitle}))),t}},{key:"defaultonAllData",value:function(e){var t=this,n=null;if(e){var r=e.currentData;"historic"===e.mode?r=e.currentData.concat(e.newData):"streaming"===e.mode&&(r=x.combineStreamData(e.currentData,e.newData)),r&&(n=r.map(function(e){var n=e._source;return t.props.onData?t.props.onData(e):p["default"].createElement("div",{className:"row",style:{marginTop:"20px"}},t.itemMarkup(n,e))}))}return n}},{key:"itemMarkup",value:function(e,t){return p["default"].createElement("div",{key:t._id,style:{padding:"12px",fontSize:"12px"},className:"makerInfo"},p["default"].createElement(v["default"],{data:e}))}},{key:"nextPage",value:function(){function e(){this.setState({isLoading:!0}),m["default"].nextPage(this.channelId)}this.state.resultStats.total>this.state.currentData.length&&!this.state.queryStart&&e.call(this)}},{key:"listComponent",value:function(){function e(e){var t=this;e&&e.addEventListener("scroll",function(){t.state.requestOnScroll&&j(e).scrollTop()+j(e).innerHeight()>=e.scrollHeight&&t.state.resultStats.total>t.state.currentData.length&&!t.state.queryStart&&t.nextPage()})}e.call(this,this.listParentElement),e.call(this,this.listChildElement)}},{key:"handleSortSelect",value:function(e){var t=e.target.value;this.sortObj=a({},this.props.sortOptions[t].appbaseField,{order:this.props.sortOptions[t].sortBy});var n={key:this.resultSortKey,value:this.sortObj};x.selectedSensor.set(n,!0,"sortChange")}},{key:"render",value:function(){var e=this,t=null,n=null,r=null,o=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-sort-active":this.props.sortOptions,"rbc-sort-inactive":!this.props.sortOptions,"rbc-stream-active":this.props.stream,"rbc-stream-inactive":!this.props.stream,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader,"rbc-resultstats-active":this.props.showResultStats,"rbc-resultstats-inactive":!this.props.showResultStats,"rbc-noresults-active":this.props.noResults,"rbc-noresults-inactive":!this.props.noResults,"rbc-pagination-active":this.props.pagination,"rbc-pagination-inactive":!this.props.pagination});if(this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.props.placeholder&&(n=p["default"].createElement("div",{className:"rbc-placeholder col s12 col-xs-12"},this.props.placeholder)),this.props.sortOptions){var a=this.props.sortOptions.map(function(e,t){return p["default"].createElement("option",{value:t,key:e.label},e.label)});r=p["default"].createElement("div",{className:"rbc-sortoptions input-field col"},p["default"].createElement("select",{className:"browser-default form-control",onChange:this.handleSortSelect},a))}return p["default"].createElement("div",{ className:"rbc-reactivelist-container"},p["default"].createElement("div",{ref:function(t){e.listParentElement=t},className:"rbc rbc-reactivelist card thumbnail "+o,style:this.props.componentStyle},t,r,this.props.showResultStats&&this.state.resultStats.resultFound?p["default"].createElement(S["default"],{onResultStats:this.props.onResultStats,took:this.state.resultStats.took,total:this.state.resultStats.total}):null,this.paginationAt("top"),p["default"].createElement("div",{ref:function(t){e.listChildElement=t},className:"rbc-reactivelist-scroll-container col s12 col-xs-12"},this.state.resultMarkup),this.state.isLoading?p["default"].createElement("div",{className:"rbc-loader"}):null,this.state.showPlaceholder?n:null,this.paginationAt("bottom")),this.props.noResults&&this.state.visibleNoResults?p["default"].createElement(w["default"],{defaultText:this.props.noResults}):null,this.props.initialLoader&&this.state.queryStart&&this.state.showInitialLoader?p["default"].createElement(T["default"],{defaultText:this.props.initialLoader}):null,p["default"].createElement(_["default"],{container:"rbc-reactivelist-container"}))}}]),t}(c.Component);t["default"]=Y,Y.propTypes={componentId:p["default"].PropTypes.string,appbaseField:p["default"].PropTypes.string,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),sortBy:p["default"].PropTypes.oneOf(["asc","desc","default"]),sortOptions:p["default"].PropTypes.arrayOf(p["default"].PropTypes.shape({label:p["default"].PropTypes.string,appbaseField:p["default"].PropTypes.string,sortBy:p["default"].PropTypes.string})),from:x.validation.resultListFrom,onAllData:p["default"].PropTypes.func,size:x.sizeValidation,stream:p["default"].PropTypes.bool,componentStyle:p["default"].PropTypes.object,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),noResults:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),showResultStats:p["default"].PropTypes.bool,onResultStats:p["default"].PropTypes.func,placeholder:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,paginationAt:p["default"].PropTypes.string,pagination:p["default"].PropTypes.bool},Y.defaultProps={from:0,size:20,stream:!1,componentStyle:{},showResultStats:!0,pagination:!1,paginationAt:"bottom"},Y.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired,app:p["default"].PropTypes.any.isRequired},Y.types={componentId:O.STRING,appbaseField:O.STRING,title:O.STRING,react:O.OBJECT,sortBy:O.STRING,sortOptions:O.OBJECT,from:O.NUMBER,onAllData:O.FUNCTION,onData:O.FUNCTION,size:O.NUMBER,stream:O.BOOLEAN,componentStyle:O.OBJECT,initialLoader:O.STRING,noResults:O.FUNCTION,showResultStats:O.BOOLEAN,onResultStats:O.FUNCTION,placeholder:O.STRING,pagination:O.BOOLEAN,paginationAt:O.STRING}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Bar=t.HistoGramComponent=void 0;var s=function(){function e(e,t){for(var n=0;n-1;t?this.setDefaultSelectAll():this.setState({selectedItems:this.props.defaultSelected,defaultSelectall:this.props.defaultSelectall},function(){e.updateAction.bind(e),e.props.onSelect(e.state.selectedItems)})}},{key:"setDefaultSelectAll",value:function(){this.props.items&&this.props.items.length?setTimeout(this.handleListClickAll.bind(this,this.props.selectAllLabel,!0),1e3):setTimeout(this.setDefaultSelectAll.bind(this),1e3)}},{key:"componentDidUpdate",value:function(){var e=this,t=null,n=!0;this.state.selectedItems&&(t=JSON.parse(JSON.stringify(this.state.selectedItems))),t&&t.length&&this.props.items&&this.props.items.length&&(t=t.filter(function(t){var n=e.props.items.filter(function(e){return e.key===t});return!!n.length}),t.length!==this.state.selectedItems.length&&(n=!t.length,this.props.onRemove(this.state.selectedItems,n),this.updateSelectedItems(t),t.length&&this.props.onSelect(t)))}},{key:"handleListClick",value:function(e,t){var n=void 0;t?(this.props.onRemove(this.state.selectedItems,!1),n=this.state.selectedItems,n.push(e),this.setState({selectedItems:n},this.updateAction.bind(this)),this.state.selectedItems.length&&this.props.onSelect(this.state.selectedItems)):this.handleTagClick(e)}},{key:"handleTagClick",value:function(e){var t=1===this.state.selectedItems.length;this.props.onRemove(this.state.selectedItems,t);var n=e.toString().replace(/ /g,"_"),r="ref"+n,o=this.refStore[r];o.state.status=!1;var a=this.state.selectedItems,i=a.indexOf(e);a.splice(i,1),this.setState({selectedItems:a},this.updateAction.bind(this)),this.props.onSelect(a)}},{key:"clearAll",value:function(){this.handleListClickAll(this.props.selectAllLabel,!1)}},{key:"getSelectedItems",value:function(){var e=[];return this.props.items.forEach(function(t){t.status&&e.indexOf(t.key)<0&&e.push(t.key)}),e}},{key:"handleListClickAll",value:function(e,t){var n=this;this.props.selectAll(t);var r=this.props.items.map(function(e){return e.key});r=t?r:[],this.setState({defaultSelectall:t,selectedItems:r},function(){n.updateAction.bind(n),n.props.onSelect(n.state.selectedItems,r)})}},{key:"updateSelectedItems",value:function(e){this.setState({selectedItems:e})}},{key:"updateAction",value:function(){this.state.selectedItems.length||this.props.onSelect(null)}},{key:"render",value:function(){var e=this,t=this.props.items,n=this.getSelectedItems(),r=[],o=[];return t.forEach(function(t,n){try{t.keyRef=t.key.replace(/ /g,"_")}catch(o){t.keyRef=n}var a=!("visible"in t&&!t.visible);r.push(l["default"].createElement(p["default"],{key:t.keyRef,value:t.key,doc_count:t.doc_count,countField:e.props.showCount,handleClick:e.handleListClick,visible:a,showCheckbox:e.props.showCheckbox,status:t.status||!1,ref:function(n){var r="ref"+t.keyRef;e.refStore[r]=n}}))}),this.props.selectAllLabel&&t&&t.length&&r.unshift(l["default"].createElement(p["default"],{key:"selectall",value:this.props.selectAllLabel,countField:!1,visible:!0,showCheckbox:this.props.showCheckbox,handleClick:this.handleListClickAll,status:this.props.selectAllValue,ref:function(t){e.refStore.refselectall=t}})),this.props.showTags&&n&&(n.length<=5?n.forEach(function(t){o.push(l["default"].createElement(f["default"],{key:t,value:t,onClick:e.handleTagClick}))}):o.unshift(l["default"].createElement(f["default"],{key:"Clear All",value:"Clear All",onClick:this.clearAll}))),l["default"].createElement("div",{className:"rbc-list-container col s12 col-xs-12"},o.length?l["default"].createElement("div",{className:"row rbc-tag-container"},o):null,l["default"].createElement("div",{className:"row"},r))}}]),t}(u.Component);t["default"]=h,h.propTypes={defaultSelected:l["default"].PropTypes.array,items:l["default"].PropTypes.array,onRemove:l["default"].PropTypes.func,onSelect:l["default"].PropTypes.func,selectAll:l["default"].PropTypes.func,selectAllLabel:l["default"].PropTypes.string,selectAllValue:l["default"].PropTypes.bool,showCount:l["default"].PropTypes.bool,showTags:l["default"].PropTypes.bool,defaultSelectall:l["default"].PropTypes.bool},h.defaultProps={showTags:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n-1){var n=t.channelResponse&&t.channelResponse.data&&t.channelResponse.data.hits?t.channelResponse.data.hits.total:0,r=Math.ceil(n/t.queryOptions.size)<1?1:Math.ceil(n/t.queryOptions.size),o=t.queryOptions.size?t.queryOptions.size:20,a=Math.round(t.queryOptions.from/o)+1;e.setState({totalHits:n,size:o,maxPageNumber:r,currentValue:a})}})}},{key:"handleChange",value:function(e){this.setState({currentValue:e});var t={key:this.props.componentId,value:e},n=!0;h.selectedSensor.set(t,n,"paginationChange"),this.props.onPageChange&&this.props.onPageChange(e)}},{key:"firstPage",value:function(){1!==this.state.currentValue&&this.handleChange.call(this,1)}},{key:"lastPage",value:function(){this.state.currentValue!==this.state.maxPageNumber&&this.handleChange.call(this,this.state.maxPageNumber)}},{key:"prePage",value:function(){var e=this.state.currentValue>1?this.state.currentValue-1:1;this.state.currentValue!==e&&this.handleChange.call(this,e)}},{key:"nextPage",value:function(){var e=this.state.currentValue0;r--)if(r%5===0||1===r){t=r;break}for(var o=function(t){var r=l["default"].createElement("li",{key:t,className:"rbc-page-number "+(e.state.currentValue===t?"active rbc-pagination-active":"waves-effect")},l["default"].createElement("a",{onClick:function(){return e.handleChange(t)}},t));t<=e.state.maxPageNumber&&n.push(r)},a=t;a<=t+5;a++)o(a);return l["default"].createElement("ul",{className:"pagination"},l["default"].createElement("li",{className:1===this.state.currentValue?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.firstPage},l["default"].createElement("i",{className:"fa fa-angle-double-left"}))),l["default"].createElement("li",{className:1===this.state.currentValue?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.prePage},l["default"].createElement("i",{className:"fa fa-angle-left"}))),n,l["default"].createElement("li",{className:this.state.currentValue===this.state.maxPageNumber?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-next",onClick:this.nextPage},l["default"].createElement("i",{className:"fa fa-angle-right"}))),l["default"].createElement("li",{className:this.state.currentValue===this.state.maxPageNumber?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.lastPage},l["default"].createElement("i",{className:"fa fa-angle-double-right"}))))}},{key:"render",value:function(){var e=null;this.props.title&&(e=l["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,p["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return l["default"].createElement("div",{className:"rbc rbc-pagination col s12 col-xs-12 "+t+" "+this.props.className},e,l["default"].createElement("div",{className:"col s12 col-xs-12"},this.renderPageNumber()))}}]),t}(u.Component);t["default"]=m,m.propTypes={componentId:l["default"].PropTypes.string.isRequired,title:l["default"].PropTypes.string,onPageChange:l["default"].PropTypes.func},m.defaultProps={},m.contextTypes={appbaseRef:l["default"].PropTypes.any.isRequired,type:l["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.StaticSearch=void 0;var s=function(){function e(e,t){for(var n=0;n-1)d=d||{},d=Object.assign(d,t[e]);else{r[e]=i(e);var o=a(e);o&&(d=d||{},d=Object.assign(d,o))}var u=n(e);!u||"aggSort"in u||p.push(u)}),r}function l(t){var n=o.serializeDepends.createQuery(e.serializeDepends,t);return n&&n.body?(p&&p.length&&(n.body.sort=p),d&&Object.keys(d).length&&Object.keys(d).forEach(function(e){n.body[e]=d[e]})):n={},n}function c(){var e=u(),t=l(e);return t}var p=[],d=null;return c()}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.params.get(e);if(n&&r)try{r=JSON.parse(r)}catch(o){console.log(o)}return t?r&&r.trim()?r.split(","):null:r}},{key:"update",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&(this.setOrDelete(e,t),this.applyURLUpdate())}},{key:"setOrDelete",value:function(e,t){e&&(null===t||void 0===t?this.params["delete"](e):this.params.set(e,t)); -}},{key:"applyURLUpdate",value:function(){if(history.pushState&&this.params.toString()){var e=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+this.params.toString();window.history.pushState({path:e},"",e)}}}]),e}();t.URLParams=new u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(49);t.ResponsiveStory=function(){var e=function(e){return e.height()?e.height():0},t=function(){var t=r(window).height(),n=t-15;r(".rbc.rbc-reactivelist, .rbc.rbc-reactiveelement").css({maxHeight:n});var o=[r(".rbc.rbc-singlelist"),r(".rbc.rbc-multilist"),r(".rbc.rbc-nestedlist"),r(".rbc.rbc-tagcloud")];o.forEach(function(n){if(n.length){var r=e(n.find(".rbc-title"))+e(n.find(".rbc-search-container"));n.find(".rbc-list-container").css({maxHeight:t-r-35})}}),r(".rbc-base > .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(e[t]<1||e[t]>1e3)&&(n=new Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=new Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]<=0&&(n=new Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=new Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start<=0&&(r=new Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return!isNaN(e[t])&&r>=e.defaultSelected&&o<=e.defaultSelected||(n=new Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return e[t]<0&&(n=new Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=new Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n'],post_tags:[""],fields:e}}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.defaultSearchQuery}};this.props.highlight&&(e.value.externalQuery=this.highlightQuery()),w.selectedSensor.setSensorInfo(e);var t={key:this.searchInputId,value:{queryType:"multi_match",inputData:this.props.appbaseField,customQuery:this.defaultSearchQuery}};w.selectedSensor.setSensorInfo(t)}},{key:"setValue",value:function(e){var t={key:this.searchInputId,value:e};w.URLParams.update(this.props.componentId,e,this.props.URLParams),w.selectedSensor.set(t,!0),e&&""!==e.trim()?this.setState({options:[{label:e,value:e}],isLoadingOptions:!0,currentValue:e}):this.setState({options:[],isLoadingOptions:!1,currentValue:e})}},{key:"getValue",value:function(e,t){var n=void(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0);if(M["default"].has(t,e))n=t[e];else if(e.indexOf(".")>-1){var r="",o=e.split(".");o.forEach(function(e,a){r+=e,M["default"].isArray(M["default"].get(t,r))&&(r+="["+a+"]"),o.length-1!==a?r+=".":n=M["default"].get(t,r)})}return n}},{key:"setData",value:function(e){var t=this,n=[];M["default"].isArray(this.props.appbaseField)?this.props.appbaseField:[this.props.appbaseField],e.hits.hits.map(function(e){if("string"===t.fieldType){var r=t.getValue(t.props.appbaseField.trim(),e._source);n.push({value:r,label:r})}else"object"===t.fieldType&&t.props.appbaseField.map(function(r){var o=t.getValue(r,e._source);o&&n.push({value:o,label:o})})}),this.state.currentValue&&""!==this.state.currentValue.trim()&&n.unshift({label:this.state.currentValue,value:this.state.currentValue}),n=this.removeDuplicates(n,"label"),this.setState({options:n,isLoadingOptions:!1})}},{key:"defaultSearchQuery",value:function(e){var t=null,n=void 0;return e&&(n="string"===this.fieldType?[this.props.appbaseField]:this.props.appbaseField,t={bool:{should:[{multi_match:{query:e,fields:n,type:"phrase_prefix"}},{multi_match:{query:e,fields:n}}],minimum_should_match:"1"}}),t}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.searchInputId);var n=g["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({rawData:r}),e.props.autocomplete&&e.setData(r)})}},{key:"checkDefault",value:function(){this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultValue&&this.defaultSelected!=this.defaultValue&&(this.defaultSelected=this.defaultValue,setTimeout(this.setValue.bind(this,this.defaultSelected),100),this.handleSearch({value:this.defaultSelected}))}},{key:"handleSearch",value:function(e){var t=e?e.value:null;t="null"===t?null:t;var n={key:this.props.componentId,value:t};w.selectedSensor.set(n,!0),this.setState({currentValue:t})}},{key:"handleInputChange",value:function(e){var t=e.target.value;this.setState({currentValue:t});var n={key:this.props.componentId,value:t};this.props.onValueChange&&this.props.onValueChange(n.value);var r=!0;w.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=d["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,y["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-autocomplete-active":this.props.autocomplete,"rbc-autocomplete-inactive":!this.props.autocomplete});return d["default"].createElement("div",{className:"rbc rbc-datasearch col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},e,this.props.autocomplete?d["default"].createElement(h["default"],u({isLoading:this.state.isLoadingOptions,value:this.state.currentValue,options:this.state.options,onInputChange:this.setValue,onChange:this.handleSearch,onBlurResetsInput:!1},this.props)):d["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},d["default"].createElement("input",{type:"text",className:"rbc-input",placeholder:this.props.placeholder,value:this.state.currentValue?this.state.currentValue:"",onChange:this.handleInputChange}),d["default"].createElement("span",{className:"rbc-search-icon"})))}}]),t}(p.Component);t["default"]=k,k.propTypes={componentId:d["default"].PropTypes.string.isRequired,appbaseField:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),title:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.element]),placeholder:d["default"].PropTypes.string,autocomplete:d["default"].PropTypes.bool,defaultSelected:d["default"].PropTypes.string,customQuery:d["default"].PropTypes.func,onValueChange:d["default"].PropTypes.func,react:d["default"].PropTypes.object,componentStyle:d["default"].PropTypes.object,highlight:d["default"].PropTypes.bool,highlightFields:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),URLParams:d["default"].PropTypes.bool},k.defaultProps={placeholder:"Search",autocomplete:!0,componentStyle:{},highlight:!1,URLParams:!1},k.contextTypes={appbaseRef:d["default"].PropTypes.any.isRequired,type:d["default"].PropTypes.any.isRequired},k.types={componentId:b.STRING,appbaseField:b.STRING,appbaseFieldType:b.STRING,react:b.OBJECT,title:b.STRING,placeholder:b.STRING,autocomplete:b.BOOLEAN,defaultSelected:b.STRING,customQuery:b.FUNCTION,componentStyle:b.OBJECT,highlight:b.BOOLEAN,URLParams:b.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&setTimeout(this.handleChange.bind(this,t),1e3)}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!_["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t;var n=e.state.data.filter(function(t){ -return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&(null!==e.urlParams?e.handleChange(n):setTimeout(e.handleChange.bind(e,n),1e3))}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};b.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){if(e.length>0)return e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}})}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}}},{key:"handleChange",value:function(e){var t=[];t=e.map(function(e){return e.label}),t=t.join(),this.setState({selected:t});var n={key:this.props.componentId,value:e},r=!0;this.props.onValueChange&&this.props.onValueChange(n.value),b.URLParams.update(this.props.componentId,t,this.props.URLParams),b.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return p["default"].createElement("div",{className:"rbc rbc-multidropdownrange col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"col s12 col-xs-12"},p["default"].createElement(f["default"],{options:this.state.data,value:this.state.selected,onChange:this.handleChange,clearable:!1,multi:!0,placeholder:this.props.placeholder,searchable:!0}))))}}]),t}(c.Component);t["default"]=T,T.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),placeholder:p["default"].PropTypes.string,data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},T.defaultProps={URLParams:!1},T.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},T.types={componentId:v.STRING,appbaseField:v.STRING,appbaseFieldType:v.NUMBER,data:v.OBJECT,defaultSelected:v.ARRAY,title:v.STRING,placeholder:v.STRING,customQuery:v.FUNCTION,componentStyle:v.OBJECT,URLParams:v.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&(null!==this.urlParams?this.handleChange(t):setTimeout(this.handleChange.bind(this,t),1e3))}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!v["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t,e.resetState();var n=e.props.data.filter(function(e){return t.indexOf(e.label)>-1});n&&n.length&&setTimeout(e.handleChange.bind(e,n),1e3)}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.length>0?e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}}):null}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}return null}},{key:"handleChange",value:function(e){function t(e,t,o){o.label===e.label&&(r=t,n.splice(t,1))}var n=this.state.selected,r=null,o=e;v["default"].isArray(e)||(o=[e]),o.forEach(function(e){n.forEach(function(n,r){t(n,r,e)})}),null===r&&o.forEach(function(e){n.push(e)}),this.setState({selected:n});var a={key:this.props.componentId,value:n},i=!0;this.props.onValueChange&&this.props.onValueChange(a.value),g.URLParams.update(this.props.componentId,this.getSelectedLabels(n),this.props.URLParams),g.selectedSensor.set(a,i)}},{key:"getSelectedLabels",value:function(e){return e.map(function(e){return e.label})}},{key:"resetState",value:function(){this.setState({selected:[]});var e={key:this.props.componentId,value:[]},t=!0;g.URLParams.update(this.props.componentId,null,this.props.URLParams),g.selectedSensor.set(e,t)}},{key:"handleTagClick",value:function(e){var t=this.state.selected.filter(function(t){return t.label===e});this.handleChange(t[0])}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t){return p["default"].createElement("div",{className:"rbc-list-item row",key:t.label,onClick:function(){return e.handleChange(t)}},p["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:n.indexOf(t.label)>-1,value:t.label}),p["default"].createElement("label",{className:"rbc-label"},t.label))})),t}},{key:"render",value:function(){var e=this,t=null,n=[];this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.selected&&this.state.selected.forEach(function(t){n.push(p["default"].createElement(b,{key:t.label,value:t.label,onClick:e.handleTagClick}))});var r=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return p["default"].createElement("div",{className:"rbc rbc-multirange col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},t,p["default"].createElement("div",{className:"col s12 col-xs-12 rbc-list-container"},n.length?p["default"].createElement("div",{className:"row",style:{marginTop:"0"}},n):null,this.renderButtons())))}}]),t}(c.Component);t["default"]=_;var b=function(e){return p["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},p["default"].createElement("a",{className:"close"},"×"),p["default"].createElement("span",null,e.value))};b.propTypes={onClick:p["default"].PropTypes.func.isRequired,value:p["default"].PropTypes.string.isRequired},_.propTypes={appbaseField:p["default"].PropTypes.string.isRequired,componentId:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nr;return p["default"].createElement("div",{className:"rbc-numberbox-container col s12 col-xs-12"},p["default"].createElement("div",{className:"rbc-label"},t),p["default"].createElement("div",{className:"rbc-numberbox-btn-container"},p["default"].createElement(g,{isActive:s,handleChange:o,type:"minus"}),p["default"].createElement("span",{className:"rbc-numberbox-number"},a),p["default"].createElement(g,{isActive:i,handleChange:o,type:"plus"})))},b=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),o=r.props.focused;r.urlParams=y.URLParams.get(r.props.componentId);var a=null!==r.urlParams?r.urlParams:r.props.defaultSelected;return r.state={currentValue:a?a:r.props.data.start,focused:o},r.type="term",r.handleChange=r.handleChange.bind(r),r.customQuery=r.customQuery.bind(r),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.setQueryInfo(),null!==this.urlParams?this.updateQuery(this.urlParams):setTimeout(this.handleChange.bind(this),1e3)}},{key:"componentWillReceiveProps",value:function(e){var t=this;setTimeout(function(){var n=null!==t.urlParams?t.urlParams:t.props.defaultSelected;!n&&0!==n||n===t.state.currentValue||t.setState({currentValue:n}),e.queryFormat!==t.queryFormat&&(t.queryFormat=e.queryFormat,t.updateQuery())},300)}},{key:"customQuery",value:function(e){var t=null;if(e&&(e.value||0===e.value)){var n=e.value;switch(this.props.queryFormat){case"exact":t=this.exactQuery(n);break;case"lte":t=this.lteQuery(n);break;case"gte":default:t=this.gteQuery(n)}}return t}},{key:"exactQuery",value:function(e){return a({},this.type,a({},this.props.appbaseField,e))}},{key:"gteQuery",value:function(e){return{range:a({},this.props.appbaseField,{gte:e,boost:2})}}},{key:"lteQuery",value:function(e){return{range:a({},this.props.appbaseField,{lte:e,boost:2})}}},{key:"setQueryInfo",value:function(){var e=this.props,t=e.componentId,n=e.appbaseField,r={key:t,value:{queryType:this.type,inputData:n,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};y.selectedSensor.setSensorInfo(r)}},{key:"handleChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.props,n=(t.componentId,t.data),r=n.start,o=n.end,a=this.state.currentValue;r=void 0!=r?r:a-1,o=void 0!=o?o:a+1,e>0&&ar&&(a-=1),this.setState({currentValue:a},this.updateQuery.bind(this))}},{key:"updateQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.start.currentValue,t={key:this.props.componentId,value:{value:e,queryFormat:this.props.queryFormat}};this.props.onValueChange&&this.props.onValueChange(t.value),y.URLParams.update(this.props.componentId,e,this.props.URLParams),y.selectedSensor.set(t,!0)}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.data,r=e.labelPosition,o=this.state.currentValue,a=t?p["default"].createElement(v,{title:t}):null,i=(0,f["default"])({"rbc-title-active":t,"rbc-title-inactive":!t});return p["default"].createElement("div",{className:"rbc rbc-numberbox col s12 col-xs-12 card thumbnail "+i+" rbc-label-"+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},a,p["default"].createElement(_,{handleChange:this.handleChange,value:o,label:n.label,start:n.start,end:n.end})))}}]),t}(c.Component);t["default"]=b,b.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.shape({start:y.validateThreshold,end:y.validateThreshold,label:p["default"].PropTypes.string}),defaultSelected:y.valueValidation,labelPosition:p["default"].PropTypes.oneOf(["top","bottom","left","right"]),customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,queryFormat:p["default"].PropTypes.oneOf(["exact","gte","lte"]),URLParams:p["default"].PropTypes.bool},b.defaultProps={componentStyle:{},queryFormat:"gte",URLParams:!1},b.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},b.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.NUMBER,labelPosition:m.STRING,customQuery:m.FUNCTION,componentStyle:m.OBJECT,queryFormat:m.STRING,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=n.end){var r=(n.end-n.start)%e.stepValue;if(r){t.setState({values:{min:t.state.values.min,max:n.end-r}});var o={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-r}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(o.value),S.URLParams.update(t.props.componentId,t.setURLParam(o.value),t.props.URLParams),S.selectedSensor.set(o,!0)},1e3)}else{var a={};a.min=n.start,a.max=n.end,t.setState({values:a,currentValues:a});var i={key:t.props.componentId,value:{from:a.min,to:a.max}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(i.value),S.URLParams.update(t.props.componentId,t.setURLParam(i.value),t.props.URLParams),S.selectedSensor.set(i,!0)},1e3)}}if(e.range.start!==t.state.startThreshold||e.range.end!==t.state.endThreshold){if(e.range.start<=n.start&&e.range.end>=n.end)t.setState({startThreshold:e.range.start,endThreshold:e.range.end});else{var s={min:t.state.values.min,max:t.state.values.max};t.state.values.mine.range.end&&(s.max=e.range.end),t.setState({startThreshold:e.range.start,endThreshold:e.range.end,values:s});var u={from:s.min,to:s.max},l={key:t.props.componentId,value:u};t.props.onValueChange&&t.props.onValueChange(l.value),S.URLParams.update(t.props.componentId,t.setURLParam(l.value),t.props.URLParams),S.selectedSensor.set(l,!0)}t.setRangeValue()}if(e.stepValue!==t.props.stepValue){var c=(n.end-n.start)%e.stepValue;if(c){t.setState({values:{min:t.state.values.min,max:n.end-c}});var p={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-c}};t.props.onValueChange&&t.props.onValueChange(p.value),S.URLParams.update(t.props.componentId,t.setURLParam(p.value),t.props.URLParams),S.selectedSensor.set(p,!0)}}},300)}},{key:"shouldComponentUpdate",value:function(e,t){return e.stepValue<=0||e.stepValue>Math.floor((e.range.end-e.range.start)/2)?(console.error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."),!1):!(t.values.max>t.endThreshold)}},{key:"componentWillUnmount",value:function(){this.channelId&&v["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setURLParam",value:function(e){return"from"in e&&"to"in e&&(e={start:e.from,end:e.to}),JSON.stringify(e)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField}},t={key:this.props.componentId+"-internal",value:{queryType:"range",inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};S.selectedSensor.setSensorInfo(e),S.selectedSensor.setSensorInfo(t),this.setRangeValue()}},{key:"setRangeValue",value:function(){var e={key:this.props.componentId+"-internal",value:this.props.range};this.props.onValueChange&&this.props.onValueChange(e.value),S.selectedSensor.set(e,!0)}},{key:"customQuery",value:function(e){if(e)return{range:a({},this.props.appbaseField,{gte:e.start,lte:e.end,boost:2})}}},{key:"histogramQuery",value:function(){return a({},this.props.appbaseField,{histogram:{field:this.props.appbaseField,interval:this.props.interval?this.props.interval:Math.ceil((this.props.range.end-this.props.range.start)/10)}})}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t.aggs={key:this.props.appbaseField,sort:"asc",size:1e3,customQuery:this.histogramQuery},t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.props.componentId+"-internal");var n=v["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery&&t.startTime>e.queryStartTime){e.queryStartTime=t.startTime?t.startTime:0;var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(n)}}),this.listenLoadingChannel(n)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"getSize",value:function(){return Math.min(this.props.range.end-this.props.range.start,this.maxSize)}},{key:"setData",value:function(e){try{this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}catch(t){console.log(t)}}},{key:"handleValuesChange",value:function(e,t){this.setState({values:t})}},{key:"countCalc",value:function(e,t,n){return n.map(function(e){return e.doc_count})}},{key:"addItemsToList",value:function(e){var t=this;e=k["default"].orderBy(e,["key"],["asc"]);var n=e.length,r=this.state.startThreshold?this.state.startThreshold:e[0].key,o=this.state.endThreshold?this.state.endThreshold:e[n-1].key;if(n>1){var a={counts:this.countCalc(r,o,e),startThreshold:r,endThreshold:o,values:{min:this.state.values.min,max:this.state.values.max}};this.setState(a,function(){k["default"].isEqual(a.values,t.state.currentValues)||t.handleResults(null,a.values)})}}},{key:"handleResults",value:function(e,t){var n=void 0;n=e?{min:e[0],max:e[1]}:t;var r={from:n.min,to:n.max},o={key:this.props.componentId,value:r};this.props.onValueChange&&this.props.onValueChange(o.value),S.URLParams.update(this.props.componentId,this.setURLParam(o.value),this.props.URLParams),S.selectedSensor.set(o,!0),this.setState({currentValues:n,values:n})}},{key:"render",value:function(){var e=null,t=null,n={};if(this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.counts&&this.state.counts.length&&this.props.showHistogram&&(t=p["default"].createElement(g.HistoGramComponent,{data:this.state.counts})),this.props.rangeLabels.start||this.props.rangeLabels.end){var r;r={},a(r,this.state.startThreshold,this.props.rangeLabels.start),a(r,this.state.endThreshold,this.props.rangeLabels.end),n=r}var o=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-labels-active":this.props.rangeLabels.start||this.props.rangeLabels.end,"rbc-labels-inactive":!this.props.rangeLabels.start&&!this.props.rangeLabels.end,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return p["default"].createElement("div",{className:"rbc rbc-rangeslider card thumbnail col s12 col-xs-12 "+o,style:this.props.componentStyle},e,t,p["default"].createElement("div",{className:"rbc-rangeslider-container col s12 col-xs-12"},p["default"].createElement(f["default"],{range:!0,value:[this.state.values.min,this.state.values.max],min:this.state.startThreshold,max:this.state.endThreshold,onChange:this.handleResults,step:this.props.stepValue,marks:n})),this.props.initialLoader&&this.state.queryStart?p["default"].createElement(b["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(c.Component);t["default"]=P,P.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),range:p["default"].PropTypes.shape({start:S.validateThreshold,end:S.validateThreshold}),rangeLabels:p["default"].PropTypes.shape({start:p["default"].PropTypes.string,end:p["default"].PropTypes.string}),defaultSelected:p["default"].PropTypes.shape({start:p["default"].PropTypes.number,end:p["default"].PropTypes.number}),stepValue:S.stepValidation,showHistogram:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,interval:p["default"].PropTypes.number,URLParams:p["default"].PropTypes.bool},P.defaultProps={title:null,range:{start:0,end:10},rangeLabels:{start:"",end:""},defaultSelected:{start:0,end:10},stepValue:1,showHistogram:!0,componentStyle:{},URLParams:!1},P.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},P.types={componentId:M.STRING,appbaseField:M.STRING,appbaseFieldType:M.NUMBER,title:M.STRING,react:M.OBJECT,range:M.OBJECT,rangeLabels:M.OBJECT,defaultSelected:M.OBJECT,stepValue:M.NUMBER,showHistogram:M.BOOLEAN,customQuery:M.FUNCTION,initialLoader:M.OBJECT,componentStyle:M.OBJECT,interval:M.NUMBER,URLParams:M.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(e[t]<1||e[t]>1e3)&&(n=new Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=new Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]<=0&&(n=new Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=new Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start<=0&&(r=new Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return!isNaN(e[t])&&r>=e.defaultSelected&&o<=e.defaultSelected||(n=new Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return e[t]<0&&(n=new Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=new Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n'],post_tags:[""],fields:e}}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.defaultSearchQuery}};this.props.highlight&&(e.value.externalQuery=this.highlightQuery()),w.selectedSensor.setSensorInfo(e);var t={key:this.searchInputId,value:{queryType:"multi_match",inputData:this.props.appbaseField,customQuery:this.defaultSearchQuery}};w.selectedSensor.setSensorInfo(t)}},{key:"setValue",value:function(e){var t={key:this.searchInputId,value:e};w.URLParams.update(this.props.componentId,e,this.props.URLParams),w.selectedSensor.set(t,!0),e&&""!==e.trim()?this.setState({options:[{label:e,value:e}],isLoadingOptions:!0,currentValue:e}):this.setState({options:[],isLoadingOptions:!1,currentValue:e})}},{key:"getValue",value:function(e,t){var n=void(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0);return M["default"].has(t,e)?n=t[e]:e.indexOf(".")>-1&&!function(){var r="",o=e.split(".");o.forEach(function(e,a){r+=e,M["default"].isArray(M["default"].get(t,r))&&(r+="["+a+"]"),o.length-1!==a?r+=".":n=M["default"].get(t,r)})}(),n}},{key:"setData",value:function(e){var t=this,n=[];M["default"].isArray(this.props.appbaseField)?this.props.appbaseField:[this.props.appbaseField],e.hits.hits.map(function(e){if("string"===t.fieldType){var r=t.getValue(t.props.appbaseField.trim(),e._source);n.push({value:r,label:r})}else"object"===t.fieldType&&t.props.appbaseField.map(function(r){var o=t.getValue(r,e._source);o&&n.push({value:o,label:o})})}),this.state.currentValue&&""!==this.state.currentValue.trim()&&n.unshift({label:this.state.currentValue,value:this.state.currentValue}),n=this.removeDuplicates(n,"label"),this.setState({options:n,isLoadingOptions:!1})}},{key:"defaultSearchQuery",value:function(e){var t=null,n=void 0;return e&&(n="string"===this.fieldType?[this.props.appbaseField]:this.props.appbaseField,t={bool:{should:[{multi_match:{query:e,fields:n,type:"phrase_prefix"}},{multi_match:{query:e,fields:n}}],minimum_should_match:"1"}}),t}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.searchInputId);var n=g["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({rawData:r}),e.props.autocomplete&&e.setData(r)})}},{key:"checkDefault",value:function(){this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultValue&&this.defaultSelected!=this.defaultValue&&(this.defaultSelected=this.defaultValue,setTimeout(this.setValue.bind(this,this.defaultSelected),100),this.handleSearch({value:this.defaultSelected}))}},{key:"handleSearch",value:function(e){var t=e?e.value:null;t="null"===t?null:t;var n={key:this.props.componentId,value:t};w.selectedSensor.set(n,!0),this.setState({currentValue:t})}},{key:"handleInputChange",value:function(e){var t=e.target.value;this.setState({currentValue:t});var n={key:this.props.componentId,value:t};this.props.onValueChange&&this.props.onValueChange(n.value);var r=!0;w.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=d["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,y["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-autocomplete-active":this.props.autocomplete,"rbc-autocomplete-inactive":!this.props.autocomplete});return d["default"].createElement("div",{className:"rbc rbc-datasearch col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},e,this.props.autocomplete?d["default"].createElement(h["default"],u({isLoading:this.state.isLoadingOptions,value:this.state.currentValue,options:this.state.options,onInputChange:this.setValue,onChange:this.handleSearch,onBlurResetsInput:!1},this.props)):d["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},d["default"].createElement("input",{type:"text",className:"rbc-input",placeholder:this.props.placeholder,value:this.state.currentValue?this.state.currentValue:"",onChange:this.handleInputChange}),d["default"].createElement("span",{className:"rbc-search-icon"})))}}]),t}(p.Component);t["default"]=k,k.propTypes={componentId:d["default"].PropTypes.string.isRequired,appbaseField:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),title:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.element]),placeholder:d["default"].PropTypes.string,autocomplete:d["default"].PropTypes.bool,defaultSelected:d["default"].PropTypes.string,customQuery:d["default"].PropTypes.func,onValueChange:d["default"].PropTypes.func,react:d["default"].PropTypes.object,componentStyle:d["default"].PropTypes.object,highlight:d["default"].PropTypes.bool,highlightFields:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),URLParams:d["default"].PropTypes.bool},k.defaultProps={placeholder:"Search",autocomplete:!0,componentStyle:{},highlight:!1,URLParams:!1},k.contextTypes={appbaseRef:d["default"].PropTypes.any.isRequired,type:d["default"].PropTypes.any.isRequired},k.types={componentId:b.STRING,appbaseField:b.STRING,appbaseFieldType:b.STRING,react:b.OBJECT,title:b.STRING,placeholder:b.STRING,autocomplete:b.BOOLEAN,defaultSelected:b.STRING,customQuery:b.FUNCTION,componentStyle:b.OBJECT,highlight:b.BOOLEAN,URLParams:b.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&setTimeout(this.handleChange.bind(this,t),1e3)}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!_["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t;var n=e.state.data.filter(function(t){ +return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&(null!==e.urlParams?e.handleChange(n):setTimeout(e.handleChange.bind(e,n),1e3))}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};b.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){if(e.length>0)return e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}})}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}}},{key:"handleChange",value:function(e){var t=[];t=e.map(function(e){return e.label}),t=t.join(),this.setState({selected:t});var n={key:this.props.componentId,value:e},r=!0;this.props.onValueChange&&this.props.onValueChange(n.value),b.URLParams.update(this.props.componentId,t,this.props.URLParams),b.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return p["default"].createElement("div",{className:"rbc rbc-multidropdownrange col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"col s12 col-xs-12"},p["default"].createElement(f["default"],{options:this.state.data,value:this.state.selected,onChange:this.handleChange,clearable:!1,multi:!0,placeholder:this.props.placeholder,searchable:!0}))))}}]),t}(c.Component);t["default"]=T,T.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),placeholder:p["default"].PropTypes.string,data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},T.defaultProps={URLParams:!1},T.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},T.types={componentId:v.STRING,appbaseField:v.STRING,appbaseFieldType:v.NUMBER,data:v.OBJECT,defaultSelected:v.ARRAY,title:v.STRING,placeholder:v.STRING,customQuery:v.FUNCTION,componentStyle:v.OBJECT,URLParams:v.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&(null!==this.urlParams?this.handleChange(t):setTimeout(this.handleChange.bind(this,t),1e3))}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!v["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t,e.resetState();var n=e.props.data.filter(function(e){return t.indexOf(e.label)>-1});n&&n.length&&setTimeout(e.handleChange.bind(e,n),1e3)}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.length>0?e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}}):null}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}return null}},{key:"handleChange",value:function(e){function t(e,t,o){o.label===e.label&&(r=t,n.splice(t,1))}var n=this.state.selected,r=null,o=e;v["default"].isArray(e)||(o=[e]),o.forEach(function(e){n.forEach(function(n,r){t(n,r,e)})}),null===r&&o.forEach(function(e){n.push(e)}),this.setState({selected:n});var a={key:this.props.componentId,value:n},i=!0;this.props.onValueChange&&this.props.onValueChange(a.value),g.URLParams.update(this.props.componentId,this.getSelectedLabels(n),this.props.URLParams),g.selectedSensor.set(a,i)}},{key:"getSelectedLabels",value:function(e){return e.map(function(e){return e.label})}},{key:"resetState",value:function(){this.setState({selected:[]});var e={key:this.props.componentId,value:[]},t=!0;g.URLParams.update(this.props.componentId,null,this.props.URLParams),g.selectedSensor.set(e,t)}},{key:"handleTagClick",value:function(e){var t=this.state.selected.filter(function(t){return t.label===e});this.handleChange(t[0])}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t){return p["default"].createElement("div",{className:"rbc-list-item row",key:t.label,onClick:function(){return e.handleChange(t)}},p["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:n.indexOf(t.label)>-1,value:t.label}),p["default"].createElement("label",{className:"rbc-label"},t.label))})),t}},{key:"render",value:function(){var e=this,t=null,n=[];this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.selected&&this.state.selected.forEach(function(t){n.push(p["default"].createElement(b,{key:t.label,value:t.label,onClick:e.handleTagClick}))});var r=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return p["default"].createElement("div",{className:"rbc rbc-multirange col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},t,p["default"].createElement("div",{className:"col s12 col-xs-12 rbc-list-container"},n.length?p["default"].createElement("div",{className:"row",style:{marginTop:"0"}},n):null,this.renderButtons())))}}]),t}(c.Component);t["default"]=_;var b=function(e){return p["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},p["default"].createElement("a",{className:"close"},"×"),p["default"].createElement("span",null,e.value))};b.propTypes={onClick:p["default"].PropTypes.func.isRequired,value:p["default"].PropTypes.string.isRequired},_.propTypes={appbaseField:p["default"].PropTypes.string.isRequired,componentId:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nr;return p["default"].createElement("div",{className:"rbc-numberbox-container col s12 col-xs-12"},p["default"].createElement("div",{className:"rbc-label"},t),p["default"].createElement("div",{className:"rbc-numberbox-btn-container"},p["default"].createElement(g,{isActive:s,handleChange:o,type:"minus"}),p["default"].createElement("span",{className:"rbc-numberbox-number"},a),p["default"].createElement(g,{isActive:i,handleChange:o,type:"plus"})))},b=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),o=r.props.focused;r.urlParams=y.URLParams.get(r.props.componentId);var a=null!==r.urlParams?r.urlParams:r.props.defaultSelected;return r.state={currentValue:a?a:r.props.data.start,focused:o},r.type="term",r.handleChange=r.handleChange.bind(r),r.customQuery=r.customQuery.bind(r),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.setQueryInfo(),null!==this.urlParams?this.updateQuery(this.urlParams):setTimeout(this.handleChange.bind(this),1e3)}},{key:"componentWillReceiveProps",value:function(e){var t=this;setTimeout(function(){var n=null!==t.urlParams?t.urlParams:t.props.defaultSelected;!n&&0!==n||n===t.state.currentValue||t.setState({currentValue:n}),e.queryFormat!==t.queryFormat&&(t.queryFormat=e.queryFormat,t.updateQuery())},300)}},{key:"customQuery",value:function(e){var t=null;if(e&&(e.value||0===e.value)){var n=e.value;switch(this.props.queryFormat){case"exact":t=this.exactQuery(n);break;case"lte":t=this.lteQuery(n);break;case"gte":default:t=this.gteQuery(n)}}return t}},{key:"exactQuery",value:function(e){return a({},this.type,a({},this.props.appbaseField,e))}},{key:"gteQuery",value:function(e){return{range:a({},this.props.appbaseField,{gte:e,boost:2})}}},{key:"lteQuery",value:function(e){return{range:a({},this.props.appbaseField,{lte:e,boost:2})}}},{key:"setQueryInfo",value:function(){var e=this.props,t=e.componentId,n=e.appbaseField,r={key:t,value:{queryType:this.type,inputData:n,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};y.selectedSensor.setSensorInfo(r)}},{key:"handleChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.props,n=(t.componentId,t.data),r=n.start,o=n.end,a=this.state.currentValue;r=void 0!=r?r:a-1,o=void 0!=o?o:a+1,e>0&&ar&&(a-=1),this.setState({currentValue:a},this.updateQuery.bind(this))}},{key:"updateQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.start.currentValue,t={key:this.props.componentId,value:{value:e,queryFormat:this.props.queryFormat}};this.props.onValueChange&&this.props.onValueChange(t.value),y.URLParams.update(this.props.componentId,e,this.props.URLParams),y.selectedSensor.set(t,!0)}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.data,r=e.labelPosition,o=this.state.currentValue,a=t?p["default"].createElement(v,{title:t}):null,i=(0,f["default"])({"rbc-title-active":t,"rbc-title-inactive":!t});return p["default"].createElement("div",{className:"rbc rbc-numberbox col s12 col-xs-12 card thumbnail "+i+" rbc-label-"+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},a,p["default"].createElement(_,{handleChange:this.handleChange,value:o,label:n.label,start:n.start,end:n.end})))}}]),t}(c.Component);t["default"]=b,b.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.shape({start:y.validateThreshold,end:y.validateThreshold,label:p["default"].PropTypes.string}),defaultSelected:y.valueValidation,labelPosition:p["default"].PropTypes.oneOf(["top","bottom","left","right"]),customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,queryFormat:p["default"].PropTypes.oneOf(["exact","gte","lte"]),URLParams:p["default"].PropTypes.bool},b.defaultProps={componentStyle:{},queryFormat:"gte",URLParams:!1},b.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},b.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.NUMBER,labelPosition:m.STRING,customQuery:m.FUNCTION,componentStyle:m.OBJECT,queryFormat:m.STRING,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=n.end){var r=(n.end-n.start)%e.stepValue;r?!function(){t.setState({values:{min:t.state.values.min,max:n.end-r}});var e={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-r}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(e.value),S.URLParams.update(t.props.componentId,t.setURLParam(e.value),t.props.URLParams),S.selectedSensor.set(e,!0)},1e3)}():!function(){var e={};e.min=n.start,e.max=n.end,t.setState({values:e,currentValues:e});var r={key:t.props.componentId,value:{from:e.min,to:e.max}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(r.value),S.URLParams.update(t.props.componentId,t.setURLParam(r.value),t.props.URLParams),S.selectedSensor.set(r,!0)},1e3)}()}if(e.range.start!==t.state.startThreshold||e.range.end!==t.state.endThreshold){if(e.range.start<=n.start&&e.range.end>=n.end)t.setState({startThreshold:e.range.start,endThreshold:e.range.end});else{var o={min:t.state.values.min,max:t.state.values.max};t.state.values.mine.range.end&&(o.max=e.range.end),t.setState({startThreshold:e.range.start,endThreshold:e.range.end,values:o});var a={from:o.min,to:o.max},i={key:t.props.componentId,value:a};t.props.onValueChange&&t.props.onValueChange(i.value),S.URLParams.update(t.props.componentId,t.setURLParam(i.value),t.props.URLParams),S.selectedSensor.set(i,!0)}t.setRangeValue()}if(e.stepValue!==t.props.stepValue){var s=(n.end-n.start)%e.stepValue;if(s){t.setState({values:{min:t.state.values.min,max:n.end-s}});var u={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-s}};t.props.onValueChange&&t.props.onValueChange(u.value),S.URLParams.update(t.props.componentId,t.setURLParam(u.value),t.props.URLParams),S.selectedSensor.set(u,!0)}}},300)}},{key:"shouldComponentUpdate",value:function(e,t){return e.stepValue<=0||e.stepValue>Math.floor((e.range.end-e.range.start)/2)?(console.error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."),!1):!(t.values.max>t.endThreshold)}},{key:"componentWillUnmount",value:function(){this.channelId&&v["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setURLParam",value:function(e){return"from"in e&&"to"in e&&(e={start:e.from,end:e.to}),JSON.stringify(e)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField}},t={key:this.props.componentId+"-internal",value:{queryType:"range",inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};S.selectedSensor.setSensorInfo(e),S.selectedSensor.setSensorInfo(t),this.setRangeValue()}},{key:"setRangeValue",value:function(){var e={key:this.props.componentId+"-internal",value:this.props.range};this.props.onValueChange&&this.props.onValueChange(e.value),S.selectedSensor.set(e,!0)}},{key:"customQuery",value:function(e){if(e)return{range:a({},this.props.appbaseField,{gte:e.start,lte:e.end,boost:2})}}},{key:"histogramQuery",value:function(){return a({},this.props.appbaseField,{histogram:{field:this.props.appbaseField,interval:this.props.interval?this.props.interval:Math.ceil((this.props.range.end-this.props.range.start)/10)}})}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t.aggs={key:this.props.appbaseField,sort:"asc",size:1e3,customQuery:this.histogramQuery},t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.props.componentId+"-internal");var n=v["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery&&t.startTime>e.queryStartTime){e.queryStartTime=t.startTime?t.startTime:0;var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(n)}}),this.listenLoadingChannel(n)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"getSize",value:function(){return Math.min(this.props.range.end-this.props.range.start,this.maxSize)}},{key:"setData",value:function(e){try{this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}catch(t){console.log(t)}}},{key:"handleValuesChange",value:function(e,t){this.setState({values:t})}},{key:"countCalc",value:function(e,t,n){return n.map(function(e){return e.doc_count})}},{key:"addItemsToList",value:function(e){var t=this;e=k["default"].orderBy(e,["key"],["asc"]);var n=e.length,r=this.state.startThreshold?this.state.startThreshold:e[0].key,o=this.state.endThreshold?this.state.endThreshold:e[n-1].key;n>1&&!function(){var n={counts:t.countCalc(r,o,e),startThreshold:r,endThreshold:o,values:{min:t.state.values.min,max:t.state.values.max}};t.setState(n,function(){k["default"].isEqual(n.values,t.state.currentValues)||t.handleResults(null,n.values)})}()}},{key:"handleResults",value:function(e,t){var n=void 0;n=e?{min:e[0],max:e[1]}:t;var r={from:n.min,to:n.max},o={key:this.props.componentId,value:r};this.props.onValueChange&&this.props.onValueChange(o.value),S.URLParams.update(this.props.componentId,this.setURLParam(o.value),this.props.URLParams),S.selectedSensor.set(o,!0),this.setState({currentValues:n,values:n})}},{key:"render",value:function(){var e=null,t=null,n={};if(this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.counts&&this.state.counts.length&&this.props.showHistogram&&(t=p["default"].createElement(g.HistoGramComponent,{data:this.state.counts})),this.props.rangeLabels.start||this.props.rangeLabels.end){var r;r={},a(r,this.state.startThreshold,this.props.rangeLabels.start),a(r,this.state.endThreshold,this.props.rangeLabels.end),n=r}var o=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-labels-active":this.props.rangeLabels.start||this.props.rangeLabels.end,"rbc-labels-inactive":!this.props.rangeLabels.start&&!this.props.rangeLabels.end,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return p["default"].createElement("div",{className:"rbc rbc-rangeslider card thumbnail col s12 col-xs-12 "+o,style:this.props.componentStyle},e,t,p["default"].createElement("div",{className:"rbc-rangeslider-container col s12 col-xs-12"},p["default"].createElement(f["default"],{range:!0,value:[this.state.values.min,this.state.values.max],min:this.state.startThreshold,max:this.state.endThreshold,onChange:this.handleResults,step:this.props.stepValue,marks:n})),this.props.initialLoader&&this.state.queryStart?p["default"].createElement(b["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(c.Component);t["default"]=P,P.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),range:p["default"].PropTypes.shape({start:S.validateThreshold,end:S.validateThreshold}),rangeLabels:p["default"].PropTypes.shape({start:p["default"].PropTypes.string,end:p["default"].PropTypes.string}),defaultSelected:p["default"].PropTypes.shape({start:p["default"].PropTypes.number,end:p["default"].PropTypes.number}),stepValue:S.stepValidation,showHistogram:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,interval:p["default"].PropTypes.number,URLParams:p["default"].PropTypes.bool},P.defaultProps={title:null,range:{start:0,end:10},rangeLabels:{start:"",end:""},defaultSelected:{start:0,end:10},stepValue:1,showHistogram:!0,componentStyle:{},URLParams:!1},P.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},P.types={componentId:M.STRING,appbaseField:M.STRING,appbaseFieldType:M.NUMBER,title:M.STRING,react:M.OBJECT,range:M.OBJECT,rangeLabels:M.OBJECT,defaultSelected:M.OBJECT,stepValue:M.NUMBER,showHistogram:M.BOOLEAN,customQuery:M.FUNCTION,initialLoader:M.OBJECT,componentStyle:M.OBJECT,interval:M.NUMBER,URLParams:M.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&t.forEach(function(t){null!==e.urlParams?e.handleChange(t):setTimeout(e.handleChange.bind(e,t),1e3)})}}},{key:"componentWillUpdate",value:function(){var e=this,t=null!==this.urlParams?this.urlParams:this.props.defaultSelected;if(this.defaultSelected!=t){this.defaultSelected=t,this.defaultSelected=v["default"].isArray(this.defaultSelected)?this.defaultSelected:[this.defaultSelected];var n=this.props.data.filter(function(t){return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&n.forEach(function(t){setTimeout(e.handleChange.bind(e,t),1e3)})}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.map(function(e,n){return{term:a({},t,e.value)}})}var n=null;return e&&e.length?n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}}:n}},{key:"handleChange",value:function(e){var t=this.state.selected,n=[],r=null;t.forEach(function(n,o){e.label===n.label&&(r=o,t.splice(o,1))}),null===r?this.props.multiSelect?(t.push(e),n=t):n.push(e):n=t,this.setState({selected:n});var o={key:this.props.componentId,value:n},a=!0;this.props.onValueChange&&this.props.onValueChange(o.value),g.URLParams.update(this.props.componentId,this.setURLValue(n),this.props.URLParams),g.selectedSensor.set(o,a)}},{key:"setURLValue",value:function(e){return e.map(function(e){return e.label})}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t,r){return p["default"].createElement("button",{key:r,className:"btn rbc-btn "+(n.indexOf(t.label)>-1?"rbc-btn-active":"rbc-btn-inactive"),onClick:function(){return e.handleChange(t)},title:t.title?t.title:t.label},t.label)})),t}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-multiselect-active":this.props.multiSelect,"rbc-multiselect-inactive":!this.props.multiSelect});return p["default"].createElement("div",{className:"rbc rbc-togglebutton col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"rbc-buttongroup col s12 col-xs-12"},this.renderButtons())))}}]),t}(c.Component);t["default"]=_,_.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.oneOfType([p["default"].PropTypes.array,p["default"].PropTypes.string]),multiSelect:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={multiSelect:!0,componentStyle:{},URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.KEYWORD,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,multiSelect:m.BOOLEAN,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]&&arguments[0];this.setGeoQueryInfo(),this.createChannel(e);var t=this.getMapStyle(this.props.defaultMapStyle);this.initialMapBoundQuery=!!this.props.defaultCenter,this.applyGeoQuery=this.props.applyGeoQuery?this.props.applyGeoQuery:this.props.setSearchAsMove,this.setState({currentMapStyle:t})}},{key:"componentWillReceiveProps",value:function(e){e.defaultMapStyle!==this.props.defaultMapStyle&&this.mapStyleChange(this.getMapStyle(e.defaultMapStyle))}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){e.streamProp!==e.props.stream&&(e.streamProp=e.props.stream,e.removeChannel(),e.initialize()),e.sizeProp!==e.props.size&&(e.sizeProp=e.props.size,e.removeChannel(),e.initialize(!0))},300)}},{key:"componentWillUnmount",value:function(){this.removeChannel()}},{key:"removeChannel",value:function(){this.channelId&&(_.AppbaseChannelManager.stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove()}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and?"string"==typeof t.and&&(t.and=[t.and]):t.and=[],t.or=t.or?t.or:[],t.or.push("geoQuery"),t.and.push("streamChanges");var n=_.AppbaseChannelManager.create(this.context.appbaseRef,this.context.type,t,this.props.size,this.props.from,this.props.stream);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){function n(){"historic"===t.mode&&t.startTime>this.queryStartTime?this.afterChannelResponse(t):"streaming"===t.mode&&this.afterChannelResponse(t)}function r(){if(t.error&&t.startTime>this.queryStartTime){if(this.props.onAllData){var e=_.AppbaseSensorHelper.prepareResultData(t);this.props.onAllData(e.res,e.err)}}else t.appliedQuery&&(this.state.mapBounds?this.props.autoMapRender?n.call(this):o.hits.hits.length&&n.call(this):n.call(this))}var o=t.data;r.call(e)});var r={key:"streamChanges",value:""};_.AppbaseSensorHelper.selectedSensor.set(r,!0)}},{key:"afterChannelResponse",value:function(e){var t=this,n=w.afterChannelResponse(e,this.state.rawData,this.props.appbaseField,this.state.markersData);this.reposition=!0,this.streamFlag=n.streamFlag,this.queryStartTime=n.queryStartTime?n.queryStartTime:0,this.setState({rawData:n.rawData,markersData:n.markersData},function(){if(t.props.onAllData){e.allMarkers=n.rawData;var r=JSON.parse(JSON.stringify(e));if(r.newData=n.newData,r.currentData=n.currentData,delete r.data,r=_.AppbaseSensorHelper.prepareResultData(r,e.data),t.props.onAllData){r.res&&(r.res.mapRef=t.mapRef);var o=t.props.onAllData(r.res,r.err);t.setState({externalData:o})}}t.streamFlag&&t.streamMarkerInterval()})}},{key:"setGeoQueryInfo",value:function(){var e={key:"geoQuery",value:{queryType:"geo_bounding_box",inputData:this.props.appbaseField,customQuery:this.geoCustomQuery}},t={key:"updateExecute",value:{queryType:"random",inputData:this.props.appbaseField}};_.AppbaseSensorHelper.selectedSensor.setSensorInfo(e),_.AppbaseSensorHelper.selectedSensor.setSensorInfo(t)}},{key:"geoCustomQuery",value:function(e){var t=null;return e&&(this.initialMapBoundQuery||this.searchAsMove)&&(t={geo_bounding_box:a({},this.props.appbaseField,e)},this.geoRelatedEventsChange?this.geoRelatedEventsChange=!1:this.applyGeoQuery&&(this.applyGeoQuery=!1),this.initialMapBoundQuery=!1),t}},{key:"updateExecute",value:function(){setTimeout(function(){var e={key:"updateExecute",value:Math.random()};_.AppbaseSensorHelper.selectedSensor.set(e,!0)},1e3)}},{key:"handleMarkerClick",value:function(e){var t=this;e.showInfo=!0,this.reposition=!1,this.setState({rerender:!0},function(){t.props.popoverTTL&&t.watchPopoverTTL(e)})}},{key:"handleMarkerClose",value:function(e){e.showInfo=!1,this.reposition=!1,this.setState(this.state)}},{key:"watchPopoverTTL",value:function(e){var t=this;this.popoverTTLStore=this.popoverTTLStore?this.popoverTTLStore:{},this.popoverTTLStore[e._type+e._id]?this.clearTTL(e._type+e._id):this.popoverTTLStore[e._type+e._id]=setTimeout(function(){t.handleMarkerClose(e),t.clearTTL(e._type+e._id)},1e3*this.props.popoverTTL)}},{key:"clearTTL",value:function(e){clearTimeout(this.popoverTTLStore[e]),delete this.popoverTTLStore[e]}},{key:"renderInfoWindow",value:function(e,t){var n=this,r=this.props.onPopoverTrigger?this.props.onPopoverTrigger(t):"Popver";return f["default"].createElement(h.InfoWindow,{zIndex:500,key:e+"_info_window",onCloseclick:function(){return n.handleMarkerClose(t)}},f["default"].createElement("div",null,r))}},{key:"handleOnIdle",value:function(){var e=this.mapRef?this.mapRef.getBounds():null;if(e){var t=e.getNorthEast().lat(),n=e.getSouthWest().lat(),r=e.getNorthEast().lng(),o=e.getSouthWest().lng(),a={top_left:[o,t],bottom_right:[r,n]},i={mapBounds:e};if(this.props.onIdle){var s=this.props.onIdle(this.mapRef,{boundingBoxCoordinates:a,mapBounds:e});i.externalData=s}if(this.initialMapBoundQuery||this.applyGeoQuery||this.geoRelatedEventsChange&&this.searchAsMove&&!this.searchQueryProgress){var u=!!this.initialMapBoundQuery||(this.applyGeoQuery?this.applyGeoQuery:this.searchAsMove);this.setValue(a,u)}this.setState(i)}}},{key:"handleOnDrage",value:function(){this.storeCenter=null}},{key:"setValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={key:"geoQuery",value:e};_.AppbaseSensorHelper.selectedSensor.set(n,t)}},{key:"searchAsMoveChange",value:function(e){this.searchAsMove=e,e&&this.mapRef&&(this.geoRelatedEventsChange=!0,this.handleOnIdle())}},{key:"mapStyleChange",value:function(e){this.setState({currentMapStyle:e})}},{key:"handleBoundsChanged",value:function(){var e=this;this.searchQueryProgress&&setTimeout(function(){e.searchQueryProgress=!1},1e3)}},{key:"streamMarkerInterval",value:function(){var e=this,t=this.state.markersData,n=t.filter(function(e){return e.stream&&e.streamStart});n.length?(this.isStreamDataExists=!0,setTimeout(function(){return e.streamToNormal()},1e3*this.props.streamTTL)):this.isStreamDataExists=!1}},{key:"streamToNormal",value:function(){var e=this,t=this.state.markersData,n=t.filter(function(e){return e.stream&&e.streamStart});n.length?(t=t.map(function(t){if(t.stream&&t.streamStart){var n=new Date,r=(n.getTime()-t.streamStart.getTime())/1e3;r>=e.props.streamTTL&&(delete t.stream,delete t.streamStart)}return t}),this.setState({markersData:t})):this.isStreamDataExists=!1}},{key:"getIcon",value:function(e){return e.stream?this.props.streamMarkerImage:this.props.defaultMarkerImage}},{key:"chooseIcon",value:function(e){var t=e.external_icon?e.external_icon:this.getIcon(e);t=this.props.onData?this.props.onData(e):t;var n=!!("object"===("undefined"==typeof t?"undefined":c(t))&&"path"in t);if(n&&(t=JSON.parse(JSON.stringify(t)),this.props.autoMarkerPosition)){var r=e.angleDeg?e.angleDeg:0;t.rotation=r}return t}},{key:"combineProps",value:function(e){var t=void 0,n={};return this.state.externalData&&this.state.externalData.markers&&this.state.externalData.markers[e._id]&&(t=this.state.externalData.markers[e._id],Object.keys(t).forEach(function(r){e["external_"+r]=t[r],n[r]=t[r]})),n.icon=this.chooseIcon(e),n}},{key:"generateMarkers",value:function(){var e=this,t=this,n=this.state.markersData,r={markerComponent:[],defaultCenter:null,convertedGeo:[]};return n&&n.length&&(n=n.filter(function(e){return w.identifyGeoData(e._source[t.props.appbaseField])}),r.markerComponent=n.map(function(n,o){var a=w.identifyGeoData(n._source[t.props.appbaseField]);r.convertedGeo.push(a);var i={position:a},s="marker_ref_"+o,u=void 0;if(e.props.showPopoverOn){u={};var c=e.props.showPopoverOn.split("");c[0]=c[0].toUpperCase(),c=c.join(""),u["on"+c]=e.handleMarkerClick.bind(e,n)}else u={},u.onClick=e.handleMarkerClick.bind(e,n);var p=function(){},d={onClick:e.props.markerOnClick?e.props.markerOnClick:p,onDblclick:e.props.markerOnDblclick?e.props.markerOnDblclick:p,onMouseover:e.props.onMouseover?e.props.onMouseover:p,onMouseout:e.props.onMouseout?e.props.onMouseout:p};return f["default"].createElement(h.Marker,l({},i,{key:n._id,zIndex:1,ref:s},t.combineProps(n),{onClick:function(){return d.onClick(n._source)},onDblclick:function(){return d.onDblclick(n._source)},onMouseover:function(){return d.onMouseover(n._source)},onMouseout:function(){return d.onMouseout(n._source)}},u),n.showInfo?t.renderInfoWindow(s,n):null)}),r.convertedGeo[0]&&(r.defaultCenter={lat:r.convertedGeo[0].lat,lng:r.convertedGeo[0].lng})),this.props.showMarkers||(r.markerComponent=[]),r}},{key:"externalData",value:function(){var e=this,t=[];return this.state.externalData&&Object.keys(this.state.externalData).forEach(function(n){"markers"!==n&&(t=t.concat(e.state.externalData[n]))}),t}},{key:"mapEvents",value:function(e){if(this.geoRelatedEvents.indexOf(e)>-1&&(this.geoRelatedEventsChange=!0),this.props[e]){var t=this.props[e](this.mapRef);t&&this.setState({externalData:t})}}},{key:"getStoreCenter",value:function(){return this.storeCenter?this.storeCenter:this.state.center}},{key:"render",value:function(){var e=this,t=void 0,n=void 0,r=void 0,o=null,a=null,i={},s=this.generateMarkers();t=this.props.setMarkerCluster?f["default"].createElement(y["default"],{averageCenter:!0,enableRetinaIcons:!0,gridSize:60},s.markerComponent):s.markerComponent;var u=!0;"streaming"!==this.channelMethod||this.props.streamAutoCenter||(u=!1),this.props.autoCenter&&this.reposition&&u?(a=s.defaultCenter?s.defaultCenter:this.getStoreCenter(),this.storeCenter=a,this.reposition=!1,i.center=w.normalizeCenter(a)):this.storeCenter?(a=this.storeCenter,i.center=w.normalizeCenter(a)):a=null,this.props.showSearchAsMove&&(n=f["default"].createElement(b.SearchAsMove,{searchAsMoveDefault:this.props.setSearchAsMove,searchAsMoveChange:this.searchAsMoveChange})),this.props.showMapStyles&&(r=f["default"].createElement(T.MapStyles,{defaultSelected:this.props.defaultMapStyle,mapStyleChange:this.mapStyleChange})),this.props.title&&(o=f["default"].createElement("h4",{className:"rbc-title col s12 m8 col-xs-12 col-sm-8"},this.props.title));var c=(0,g["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return f["default"].createElement("div",{className:"rbc rbc-reactivemap col s12 col-xs-12 card thumbnail "+c,style:w.mapPropsStyles(this.props.componentStyle,"component")},o,r,f["default"].createElement(h.GoogleMapLoader,{containerElement:f["default"].createElement("div",{className:"rbc-container col s12 col-xs-12",style:w.mapPropsStyles(this.props.componentStyle,"map",this.mapDefaultHeight)}),googleMapElement:f["default"].createElement(h.GoogleMap,l({ref:function(t){ e.mapRef=t}},i,w.normalizeProps(this.props),{options:{styles:this.state.currentMapStyle},defaultCenter:w.normalizeCenter(this.state.defaultCenter),onDragstart:function(){e.handleOnDrage(),e.mapEvents("onDragstart")},onIdle:function(){return e.handleOnIdle()},onClick:function(){return e.mapEvents("onClick")},onDblclick:function(){return e.mapEvents("onDblclick")},onDrag:function(){return e.mapEvents("onDrag")},onDragend:function(){return e.mapEvents("onDragend")},onMousemove:function(){return e.mapEvents("onMousemove")},onMouseout:function(){return e.mapEvents("onMouseout")},onMouseover:function(){return e.mapEvents("onMouseover")},onResize:function(){return e.mapEvents("onResize")},onRightclick:function(){return e.mapEvents("onRightclick")},onTilesloaded:function(){return e.mapEvents("onTilesloaded")},onBoundsChanged:function(){return e.mapEvents("onBoundsChanged")},onCenterChanged:function(){return e.mapEvents("onCenterChanged")},onProjectionChanged:function(){return e.mapEvents("onProjectionChanged")},onTiltChanged:function(){return e.mapEvents("onTiltChanged")},onZoomChanged:function(){return e.mapEvents("onZoomChanged")}}),t,this.externalData())}),n,f["default"].createElement(_.PoweredBy,null))}}]),t}(d.Component);t["default"]=k,k.propTypes={appbaseField:f["default"].PropTypes.string.isRequired,onIdle:f["default"].PropTypes.func,onAllData:f["default"].PropTypes.func,onData:f["default"].PropTypes.func,onPopoverTrigger:f["default"].PropTypes.func,setMarkerCluster:f["default"].PropTypes.bool,autoMarkerPosition:f["default"].PropTypes.bool,showMarkers:f["default"].PropTypes.bool,streamTTL:w.validation.streamTTL,popoverTTL:w.validation.popoverTTL,size:_.AppbaseSensorHelper.sizeValidation,from:w.validation.fromValidation,autoMapRender:f["default"].PropTypes.bool,componentStyle:f["default"].PropTypes.object,autoCenter:f["default"].PropTypes.bool,showSearchAsMove:f["default"].PropTypes.bool,setSearchAsMove:f["default"].PropTypes.bool,defaultMapStyle:f["default"].PropTypes.oneOf(["Standard","Blue Essence","Blue Water","Flat Map","Light Monochrome","Midnight Commander","Unsaturated Browns"]),title:f["default"].PropTypes.oneOfType([f["default"].PropTypes.string,f["default"].PropTypes.element]),streamAutoCenter:f["default"].PropTypes.bool,defaultMarkerImage:f["default"].PropTypes.string,streamMarkerImage:f["default"].PropTypes.string,stream:f["default"].PropTypes.bool,defaultZoom:w.validation.defaultZoom,applyGeoQuery:f["default"].PropTypes.bool,showPopoverOn:f["default"].PropTypes.oneOf(["click","mouseover"]),defaultCenter:f["default"].PropTypes.shape({lat:w.validation.validCenter,lon:w.validation.validCenter}),react:f["default"].PropTypes.object,markerOnClick:f["default"].PropTypes.func,markerOnDblclick:f["default"].PropTypes.func,onMouseover:f["default"].PropTypes.func,onMouseout:f["default"].PropTypes.func,showMapStyles:f["default"].PropTypes.bool},k.defaultProps={setMarkerCluster:!0,autoCenter:!0,showSearchAsMove:!0,setSearchAsMove:!1,showMapStyles:!0,defaultMapStyle:"Standard",from:0,size:100,streamTTL:5,streamAutoCenter:!1,autoMarkerPosition:!1,showMarkers:!0,autoMapRender:!0,defaultMarkerImage:"https://opensource.appbase.io/reactivemaps/dist/images/historic-pin.png",streamMarkerImage:"https://opensource.appbase.io/reactivemaps/dist/images/stream-pin.png",componentStyle:{},stream:!1,applyGeoQuery:!1,defaultZoom:13},k.contextTypes={appbaseRef:f["default"].PropTypes.any.isRequired,type:f["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ItemCheckboxList=void 0;var s=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0],c[this.state.selectedValue].value);this.props.mapStyleChange(e)}},{key:"render",value:function(){var e=this.state.items.map(function(e,t){return l["default"].createElement("option",{value:t,key:t},e.key)});return l["default"].createElement("div",{className:"input-field col rbc-mapstyles pull-right right"},l["default"].createElement("select",{className:"browser-default form-control",onChange:this.handleSelect,value:this.state.selectedValue,name:"mapStyles",id:"mapStyles"},e))}}]),t}(u.Component);p.propTypes={},p.defaultProps={fieldName:"MapStyles"}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.SearchAsMove=void 0;var s=function(){function e(e,t){for(var n=0;n20)return new Error("zoom value should be an integer between 0 and 20.")},validCenter:function(e,t,n){return isNaN(e[t])?new Error(t+" value must be number"):"lat"===t&&(e[t]<-90||e[t]>90)?new Error(t+" value should be between -90 and 90."):"lng"===t&&(e[t]<-180||e[t]>180)?new Error(t+" value should be between -180 and 180."):void 0},fromValidation:function(e,t,n){if(e[t]<0)return new Error(t+" value should be greater than or equal to 0.")},streamTTL:function(e,t,n){if(e[t]<0||e[t]>1e3)return new Error(t+" should be a positive integer between 0 and 1000, counted in seconds for a streaming update to be visible.")},popoverTTL:function(e,t,n){if(e[t]<.1||e[t]>60)return new Error(t+" should be a positive integer between 1 and 60, counted in seconds for a popover to be visible.")}},t.normalizeCenter=function(e){return e&&e.lon&&(e.lng=e.lon),e});t.normalizeProps=function(e){var t=JSON.parse(JSON.stringify(e));return t.defaultCenter&&(t.defaultCenter=p(t.defaultCenter)),t.center&&(t.center=p(t.center)),t},t.mapPropsStyles=function(e,t,n){var r=JSON.parse(JSON.stringify(e)),o=void 0;return"component"===t?o=r:"map"===t&&(o={height:r.height?r.height:n}),o}},function(e,t){"use strict";e.exports=[{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#e0efef"}]},{featureType:"poi",elementType:"geometry.fill",stylers:[{visibility:"on"},{hue:"#1900ff"},{color:"#c0e8e8"}]},{featureType:"road",elementType:"geometry",stylers:[{lightness:100},{visibility:"simplified"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"transit.line",elementType:"geometry",stylers:[{visibility:"on"},{lightness:700}]},{featureType:"water",elementType:"all",stylers:[{color:"#7dcdcd"}]}]},function(e,t){"use strict";e.exports=[{featureType:"administrative",elementType:"labels.text.fill",stylers:[{color:"#444444"}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#f2f2f2"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"all",stylers:[{saturation:-100},{lightness:45}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"all",stylers:[{color:"#46bcec"},{visibility:"on"}]}]},function(e,t){"use strict";e.exports=[{featureType:"all",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"landscape",elementType:"all",stylers:[{visibility:"on"},{color:"#f3f4f4"}]},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{weight:.9},{visibility:"off"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#83cead"}]},{featureType:"road",elementType:"all",stylers:[{visibility:"on"},{color:"#ffffff"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"on"},{color:"#fee379"}]},{featureType:"road.arterial",elementType:"all",stylers:[{visibility:"on"},{color:"#fee379"}]},{featureType:"water",elementType:"all",stylers:[{visibility:"on"},{color:"#7fc8ed"}]}]},function(e,t){"use strict";e.exports=[{featureType:"administrative.locality",elementType:"all",stylers:[{hue:"#2c2e33"},{saturation:7},{lightness:19},{visibility:"on"}]},{featureType:"landscape",elementType:"all",stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100},{visibility:"simplified"}]},{featureType:"poi",elementType:"all",stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100},{visibility:"off"}]},{featureType:"road",elementType:"geometry",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:31},{visibility:"simplified"}]},{featureType:"road",elementType:"labels",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:31},{visibility:"on"}]},{featureType:"road.arterial",elementType:"labels",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:-2},{visibility:"simplified"}]},{featureType:"road.local",elementType:"geometry",stylers:[{hue:"#e9ebed"},{saturation:-90},{lightness:-8},{visibility:"simplified"}]},{featureType:"transit",elementType:"all",stylers:[{hue:"#e9ebed"},{saturation:10},{lightness:69},{visibility:"on"}]},{featureType:"water",elementType:"all",stylers:[{hue:"#e9ebed"},{saturation:-78},{lightness:67},{visibility:"simplified"}]}]},function(e,t){"use strict";e.exports=[{featureType:"all",elementType:"labels.text.fill",stylers:[{color:"#ffffff"}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{color:"#000000"},{lightness:13}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#144b53"},{lightness:14},{weight:1.4}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#08304b"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#0c4152"},{lightness:5}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#0b434f"},{lightness:25}]},{featureType:"road.arterial",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.arterial",elementType:"geometry.stroke",stylers:[{color:"#0b3d51"},{lightness:16}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#000000"}]},{featureType:"transit",elementType:"all",stylers:[{color:"#146474"}]},{featureType:"water",elementType:"all",stylers:[{color:"#021019"}]}]},function(e,t){"use strict";e.exports=[{featureType:"water",stylers:[{saturation:43},{lightness:-11},{hue:"#0088ff"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{hue:"#ff0000"},{saturation:-100},{lightness:99}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#808080"},{lightness:54}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{color:"#ece2d9"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#ccdca1"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#767676"}]},{featureType:"road",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]},{featureType:"poi",stylers:[{visibility:"off"}]},{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#b8cb93"}]},{featureType:"poi.park",stylers:[{visibility:"on"}]},{featureType:"poi.sports_complex",stylers:[{visibility:"on"}]},{featureType:"poi.medical",stylers:[{visibility:"on"}]},{featureType:"poi.business",stylers:[{visibility:"simplified"}]}]},function(e,t){"use strict";e.exports=[{elementType:"geometry",stylers:[{hue:"#ff4400"},{saturation:-68},{lightness:-4},{gamma:.72}]},{featureType:"road",elementType:"labels.icon"},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{hue:"#0077ff"},{gamma:3.1}]},{featureType:"water",stylers:[{hue:"#00ccff"},{gamma:.44},{saturation:-33}]},{featureType:"poi.park",stylers:[{hue:"#44ff00"},{saturation:-23}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{hue:"#007fff"},{gamma:.77},{saturation:65},{lightness:99}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{gamma:.11},{weight:5.6},{saturation:99},{hue:"#0091ff"},{lightness:-86}]},{featureType:"transit.line",elementType:"geometry",stylers:[{lightness:-48},{hue:"#ff5e00"},{gamma:1.2},{saturation:-23}]},{featureType:"transit",elementType:"labels.text.stroke",stylers:[{saturation:-64},{hue:"#ff9100"},{lightness:16},{gamma:.47},{weight:2.7}]}]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n=0&&e.end>=0&&""!==e.location){var n;t=o({},this.type,(n={},o(n,this.props.appbaseField,e.location),o(n,"from",e.start+this.unit),o(n,"to",e.end+this.unit),n))}return t}},{key:"getCoordinates",value:function(e,t){var n=this;e&&""!==e?m["default"].get("https://maps.googleapis.com/maps/api/geocode/json?address="+e).then(function(e){var r=e.data.results[0].geometry.location;n.locString=r.lat+", "+r.lng,t?t.call(n,n.defaultSelected.label):n.executeQuery()}):p.AppbaseSensorHelper.selectedSensor.set(null,!0)}},{key:"executeQuery",value:function(){if(""!==this.state.currentValue&&this.state.selected&&this.locString){var e,t={key:this.props.componentId,value:{currentValue:this.state.currentValue,start:this.state.selected.start,end:this.state.selected.end,location:this.locString,unit:this.unit}},n={key:this.props.componentId,value:o({},this.sortInfo.type,(e={},o(e,this.props.appbaseField,this.locString),o(e,"order",this.sortInfo.order),o(e,"unit",this.unit),e))};this.props.onValueChange&&this.props.onValueChange(t.value),p.AppbaseSensorHelper.selectedSensor.setSortInfo(n),p.AppbaseSensorHelper.URLParams.update(this.props.componentId,this.setURLValue(),this.props.URLParams),p.AppbaseSensorHelper.selectedSensor.set(t,!0)}}},{key:"setURLValue",value:function(){return JSON.stringify({location:this.state.currentValue,label:this.state.selected.label})}},{key:"handleChange",value:function(e){if(e){var t=e.value;this.setState({currentValue:t}),this.getCoordinates(t)}else{this.setState({currentValue:""});var n={key:this.props.componentId,value:null};this.props.onValueChange&&this.props.onValueChange(n.value),p.AppbaseSensorHelper.URLParams.update(this.props.componentId,null,this.props.URLParams),p.AppbaseSensorHelper.selectedSensor.set(n,!0)}}},{key:"loadOptions",value:function(e,t){var n=this;if(this.callback=t,e){var r=this.googleMaps||window.google.maps;this.autocompleteService=new r.places.AutocompleteService;var o={input:e};this.result={options:[]},this.autocompleteService.getPlacePredictions(o,function(e){e.forEach(function(e){n.result.options.push({label:e.description,value:e.description})}),n.state.userLocation.length&&"Use my current location"!==n.result.options[0].label&&n.result.options.unshift({label:"Use my current location",value:n.state.userLocation}),n.callback(null,n.result)})}else this.callback(null,this.result)}},{key:"handleDistanceChange",value:function(e){this.setState({selected:{start:e.start,end:e.end,label:e.label}},this.executeQuery.bind(this))}},{key:"renderValue",value:function(e){return c["default"].createElement("span",null,e.value)}},{key:"render",value:function(){var e=null;this.props.title&&(e=c["default"].createElement("h4",{className:"rbc-title"},this.props.title));var t=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return c["default"].createElement("div",{className:"rbc rbc-geodistancedropdown clearfix card thumbnail col s12 col-xs-12 "+t,style:this.props.componentStyle},c["default"].createElement("div",{className:"row"},e,c["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},c["default"].createElement(v["default"].Async,{value:this.state.currentValue,loadOptions:this.loadOptions,placeholder:this.props.placeholder,onChange:this.handleChange,filterOption:function(){return!0},valueRenderer:this.renderValue})),c["default"].createElement("div",{className:"col s12 col-xs-12"},c["default"].createElement(v["default"],{value:this.state.selected.label?this.state.selected:"",options:this.props.data,clearable:!1,searchable:!1,onChange:this.handleDistanceChange,placeholder:this.props.placeholderDropdown}))))}}]),t}(l.Component);t["default"]=_,_.propTypes={componentId:c["default"].PropTypes.string.isRequired,appbaseField:c["default"].PropTypes.string.isRequired,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]), customQuery:c["default"].PropTypes.func,defaultSelected:c["default"].PropTypes.shape({label:c["default"].PropTypes.string,location:c["default"].PropTypes.string}),placeholder:c["default"].PropTypes.string,placeholderDropdown:c["default"].PropTypes.string,autoLocation:c["default"].PropTypes.bool,unit:c["default"].PropTypes.oneOf(["mi","miles","yd","yards","ft","feet","in","inch","km","kilometers","m","meters","cm","centimeters","mm","millimeters","NM","nmi","nauticalmiles"]),data:c["default"].PropTypes.arrayOf(c["default"].PropTypes.shape({start:p.AppbaseSensorHelper.validateThreshold,end:p.AppbaseSensorHelper.validateThreshold,label:c["default"].PropTypes.string.isRequired})),onValueChange:c["default"].PropTypes.func,componentStyle:c["default"].PropTypes.object,URLParams:c["default"].PropTypes.bool},_.defaultProps={unit:"mi",placeholder:"Search...",placeholderDropdown:"Select Distance",autoLocation:!0,componentStyle:{},URLParams:!1},_.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n>8-a%1*8)){if(o=t.charCodeAt(a+=.75),o>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|o}return s}),n.atob||(n.atob=function(t){if(t=t.replace(/=+$/,""),t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,s="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?s+=String.fromCharCode(255&n>>(-2*a&6)):0)o=r.indexOf(o);return s})}()},function(e,t){"use strict";function n(){return!1}function r(){return!0}function o(){this.timeStamp=Date.now(),this.target=void 0,this.currentTarget=void 0}Object.defineProperty(t,"__esModule",{value:!0}),o.prototype={isEventObject:1,constructor:o,isDefaultPrevented:n,isPropagationStopped:n,isImmediatePropagationStopped:n,preventDefault:function(){this.isDefaultPrevented=r},stopPropagation:function(){this.isPropagationStopped=r},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=r,this.stopPropagation()},halt:function(e){e?this.stopImmediatePropagation():this.stopPropagation(),this.preventDefault()}},t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return null===e||void 0===e}function a(){return d}function i(){return f}function s(e){var t=e.type,n="function"==typeof e.stopPropagation||"boolean"==typeof e.cancelBubble;l["default"].call(this),this.nativeEvent=e;var r=i;"defaultPrevented"in e?r=e.defaultPrevented?a:i:"getPreventDefault"in e?r=e.getPreventDefault()?a:i:"returnValue"in e&&(r=e.returnValue===f?a:i),this.isDefaultPrevented=r;var o=[],s=void 0,u=void 0,c=void 0,p=h.concat();for(m.forEach(function(e){t.match(e.reg)&&(p=p.concat(e.props),e.fix&&o.push(e.fix))}),u=p.length;u;)c=p[--u],this[c]=e[c];for(!this.target&&n&&(this.target=e.srcElement||document),this.target&&3===this.target.nodeType&&(this.target=this.target.parentNode),u=o.length;u;)(s=o[--u])(this,e);this.timeStamp=e.timeStamp||Date.now()}Object.defineProperty(t,"__esModule",{value:!0});var u=n(411),l=r(u),c=n(9),p=r(c),d=!0,f=!1,h=["altKey","bubbles","cancelable","ctrlKey","currentTarget","eventPhase","metaKey","shiftKey","target","timeStamp","view","type"],m=[{reg:/^key/,props:["char","charCode","key","keyCode","which"],fix:function(e,t){o(e.which)&&(e.which=o(t.charCode)?t.keyCode:t.charCode),void 0===e.metaKey&&(e.metaKey=e.ctrlKey)}},{reg:/^touch/,props:["touches","changedTouches","targetTouches"]},{reg:/^hashchange$/,props:["newURL","oldURL"]},{reg:/^gesturechange$/i,props:["rotation","scale"]},{reg:/^(mousewheel|DOMMouseScroll)$/,props:[],fix:function(e,t){var n=void 0,r=void 0,o=void 0,a=t.wheelDelta,i=t.axis,s=t.wheelDeltaY,u=t.wheelDeltaX,l=t.detail;a&&(o=a/120),l&&(o=0-(l%3===0?l/3:l)),void 0!==i&&(i===e.HORIZONTAL_AXIS?(r=0,n=0-o):i===e.VERTICAL_AXIS&&(n=0,r=o)),void 0!==s&&(r=s/120),void 0!==u&&(n=-1*u/120),n||r||(r=o),void 0!==n&&(e.deltaX=n),void 0!==r&&(e.deltaY=r),void 0!==o&&(e.delta=o)}},{reg:/^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,props:["buttons","clientX","clientY","button","offsetX","relatedTarget","which","fromElement","toElement","offsetY","pageX","pageY","screenX","screenY"],fix:function(e,t){var n=void 0,r=void 0,a=void 0,i=e.target,s=t.button;return i&&o(e.pageX)&&!o(t.clientX)&&(n=i.ownerDocument||document,r=n.documentElement,a=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||a&&a.scrollLeft||0)-(r&&r.clientLeft||a&&a.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||a&&a.scrollTop||0)-(r&&r.clientTop||a&&a.clientTop||0)),e.which||void 0===s||(1&s?e.which=1:2&s?e.which=3:4&s?e.which=2:e.which=0),!e.relatedTarget&&e.fromElement&&(e.relatedTarget=e.fromElement===i?e.toElement:e.fromElement),e}}],y=l["default"].prototype;(0,p["default"])(s.prototype,y,{constructor:s,preventDefault:function(){var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=f,y.preventDefault.call(this)},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=d,y.stopPropagation.call(this)}}),t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){function r(t){var r=new i["default"](t);n.call(e,r)}return e.addEventListener?(e.addEventListener(t,r,!1),{remove:function(){e.removeEventListener(t,r,!1)}}):e.attachEvent?(e.attachEvent("on"+t,r),{remove:function(){e.detachEvent("on"+t,r)}}):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var a=n(412),i=r(a);e.exports=t["default"]},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;var o=t.type,a=t.body;delete t.type,delete t.body;var i;return i=o?o+"/_bulk":"/_bulk",e.performStreamingRequest({method:"POST",path:i,params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;delete t.type,delete t.id;var i=o+"/"+a;return e.performStreamingRequest({method:"DELETE",path:i,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;delete t.type,delete t.id;var i=o+"/"+a;return e.performStreamingRequest({method:"GET",path:i,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(140),o=function(e){var t=r.obj(function(e,t,n){var r=Object.keys(e)[0],o=Object.keys(e[r].mappings).filter(function(e){return"_default_"!==e});this.push(o),n()});return t.writable=!1,e.performStreamingRequest({method:"GET",path:"_mapping"}).pipe(t)};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",body:"object"});if(n!==!0)throw n;var o=t.type,a=t.id,i=t.body;delete t.type,delete t.id,delete t.body;var s;return s=a?o+"/"+a:o,e.performStreamingRequest({method:"POST",path:s,params:t,body:i})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;var o;o=t.type.constructor===Array?t.type.join():t.type;var a=t.body;delete t.type,delete t.body;var i;return i=o?o+"/_search":"/_search",e.performStreamingRequest({method:"POST",path:i,params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;return delete t.type,delete t.id,delete t.stream,t.stream===!0||"true"===t.stream?t.stream="true":(delete t.stream,t.streamonly="true"),e.performWsRequest({method:"GET",path:o+"/"+a,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;if(void 0===t.type||"string"!=typeof t.type&&t.type.constructor!==Array||""===t.type||0===t.type.length)throw new Error("fields missing: type");var o;o=t.type.constructor===Array?t.type.join():t.type;var o=t.type,a=t.body;return delete t.type,delete t.body,delete t.stream,t.streamonly="true",e.performWsRequest({method:"POST",path:o+"/_search",params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string",body:"object"});if(n!==!0)throw n;var o=t.type,a=t.id,i=t.body;delete t.type,delete t.id,delete t.body;var s=o+"/"+a+"/_update";return e.performStreamingRequest({method:"POST",path:s,params:t,body:i})};e.exports=o},function(e,t,n){"use strict";var r=n(565),o=n(34),a=function(e,t,n){var a=o.validate(t,{body:"object"});if(a!==!0)throw a;if(void 0===t.type||"string"!=typeof t.type&&t.type.constructor!==Array||""===t.type||0===t.type.length)throw new Error("fields missing: type");if(a=o.validate(t.body,{query:"object"}),a!==!0)throw a;if(t.type.constructor===Array?(this.type=t.type,this.type_string=t.type.join()):(this.type=[t.type],this.type_string=t.type),this.webhooks=[],this.client=e,this.query=t.body.query,"string"==typeof n){var i={};i.url=n,i.method="GET",this.webhooks.push(i)}else if(n.constructor===Array)this.webhooks=n;else{if(n!==Object(n))throw new Error("fields missing: second argument(webhook) is necessary");this.webhooks.push(n)}this.populateBody();var s=btoa(r(this.query)),u=".percolator/webhooks-0-"+this.type_string+"-0-"+s;return this.path=u,this.performRequest("POST")};a.prototype.populateBody=function(){this.body={},this.body.webhooks=this.webhooks,this.body.query=this.query,this.body.type=this.type},a.prototype.performRequest=function(e){var t=this.client.performStreamingRequest({method:e,path:this.path,body:this.body});return t.change=this.change.bind(this),t.stop=this.stop.bind(this),t},a.prototype.change=function(e){if(this.webhooks=[],"string"==typeof e){var t={};t.url=e,t.method="POST",this.webhooks.push(t)}else if(e.constructor===Array)this.webhooks=e;else{if(e!==Object(e))throw new Error("fields missing: one of webhook or url fields is required");this.webhooks.push(e)}return this.populateBody(),this.performRequest("POST")},a.prototype.stop=function(){return delete this.body,this.performRequest("DELETE")},e.exports=a},function(e,t,n){"use strict";var r=n(142),o=n(425),a=n(426),i=n(427),s=n(418),u=n(416),l=n(422),c=n(415),p=n(414),d=n(419),f=n(417),h=n(423),m=n(420),y=n(421),v=function g(e){if(!(this instanceof g))return new g(e);if("string"!=typeof e.url||""===e.url)throw new Error("URL not present in options.");var t=r.parse(e.url);if(this.url=t.host,this.protocol=t.protocol,this.credentials=t.auth,this.appname=e.appname||e.app,"string"!=typeof this.appname||""===this.appname)throw new Error("App name is not present in options.");if("string"!=typeof this.protocol||""===this.protocol)throw new Error("Protocol is not present in url. URL should be of the form https://scalr.api.appbase.io");if("string"==typeof e.username&&""!==e.username&&"string"==typeof e.password&&""!==e.password&&(this.credentials=e.username+":"+e.password),"string"==typeof e.credentials&&""!==e.credentials&&(this.credentials=e.credentials),"string"!=typeof this.credentials||""===this.credentials)throw new Error("Authentication information is not present. Did you add credentials?");"https:"===t.protocol?this.ws=new o("wss://"+t.host+"/"+this.appname):this.ws=new o("ws://"+t.host+"/"+this.appname),"/"===this.url.slice(-1)&&(this.url=this.url.slice(0,-1));var n={};return n.index=this.index.bind(this),n.get=this.get.bind(this),n.update=this.update.bind(this),n["delete"]=this["delete"].bind(this),n.bulk=this.bulk.bind(this),n.search=this.search.bind(this),n.getStream=this.getStream.bind(this),n.searchStream=this.searchStream.bind(this),n.searchStreamToURL=this.searchStreamToURL.bind(this),n.getTypes=this.getTypes.bind(this),n};v.prototype.performWsRequest=function(e){return new i(this,JSON.parse(JSON.stringify(e)))},v.prototype.performStreamingRequest=function(e){return new a(this,JSON.parse(JSON.stringify(e)))},v.prototype.index=function(e){return new s(this,JSON.parse(JSON.stringify(e)))},v.prototype.get=function(e){return new u(this,JSON.parse(JSON.stringify(e)))},v.prototype.update=function(e){return new l(this,JSON.parse(JSON.stringify(e)))},v.prototype["delete"]=function(e){return new c(this,JSON.parse(JSON.stringify(e)))},v.prototype.bulk=function(e){return new p(this,JSON.parse(JSON.stringify(e)))},v.prototype.search=function(e){return new d(this,JSON.parse(JSON.stringify(e)))},v.prototype.getStream=function(e){return new m(this,JSON.parse(JSON.stringify(e)))},v.prototype.searchStream=function(e){return new y(this,JSON.parse(JSON.stringify(e)))},v.prototype.searchStreamToURL=function(e,t){return new h(this,JSON.parse(JSON.stringify(e)),JSON.parse(JSON.stringify(t)))},v.prototype.getTypes=function(){return new f(this)},"undefined"!=typeof window&&(window.Appbase=v),e.exports=v},function(e,t,n){"use strict";var r="undefined"!=typeof window?window.WebSocket:n(748),o=n(36).EventEmitter,a=function(e){var t=new r(e),n=new o;return n.setMaxListeners(0),n.send=function(e){return 1===t.readyState?(t.send(JSON.stringify(e)),this):void n.on("open",function r(){t.send(JSON.stringify(e)),n.removeListener("open",r)})},t.onopen=function(){n.emit("open")},t.onmessage=function(e){var t=JSON.parse(e.data);n.emit("message",t)},t.onerror=function(e){n.emit("error",e)},t.onclose=function(e){n.emit("close",e)},n};e.exports=a},function(e,t,n){(function(t){"use strict";var r=n(553),o=n(733),a=n(113),i=n(140),s=function(e,t){if(this.client=e,this.args=t,this.method=t.method,this.path=t.path,this.params=t.params,this.body=t.body,(!this.body||"object"!=typeof this.body&&this.body.constructor!==Array)&&(this.body={}),this.body.constructor===Array){var n=this.body;this.body="";for(var r=0;r=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;ts.bottom||i.topt.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var n=this,r="object"==typeof t?t:this.props;if(r.multi){if("string"==typeof e&&(e=e.split(r.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return n.expandValue(e,r)}).filter(function(e){return e})}var o=this.expandValue(e,r);return o?[o]:[]},expandValue:function(e,t){var n=typeof e;if("string"!==n&&"number"!==n&&"boolean"!==n)return e;var r=t.options,o=t.valueKey;if(r)for(var a=0;ar&&this.focusOption(n[r+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var n=-1,r=0;r0?n-=1:n=t.length-1;else if("start"===e)n=0;else if("end"===e)n=t.length-1;else if("page_up"===e){var o=n-this.props.pageSize;n=o<0?0:o}else if("page_down"===e){var o=n+this.props.pageSize;n=o>t.length-1?t.length-1:o}n===-1&&(n=0),this.setState({focusedIndex:t[n].index,focusedOption:t[n].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return l["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},l["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var n=this,r=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:l["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var a=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return l["default"].createElement(o,{id:n._instancePrefix+"-value-"+t,instancePrefix:n._instancePrefix,disabled:n.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[n.props.valueKey],onClick:a,onRemove:n.removeValue,value:e},r(e,t),l["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(a=null),l["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:a,value:e[0]},r(e[0])))},renderInput:function(e,t){var n,r=this,i=(0,m["default"])("Select-input",this.props.inputProps.className),u=!!this.state.isOpen,c=(0,m["default"])((n={},a(n,this._instancePrefix+"-list",u),a(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),p=s({},this.props.inputProps,{role:"combobox","aria-expanded":""+u,"aria-owns":c,"aria-haspopup":""+u,"aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:i,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(p);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,h=(d.inputClassName,o(d,["inputClassName"]));return l["default"].createElement("div",s({},h,{role:"combobox","aria-expanded":u,"aria-owns":u?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:i,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?l["default"].createElement(f["default"],s({},p,{minWidth:"5"})):l["default"].createElement("div",{className:i},l["default"].createElement("input",p))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return l["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,n=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return l["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},n)},filterOptions:function N(e){var t=this.state.inputValue,n=this.props.options||[];if(this.props.filterOptions){var N="function"==typeof this.props.filterOptions?this.props.filterOptions:_["default"];return N(n,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return n},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,n){return e&&e.length?this.props.menuRenderer({focusedOption:n,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?l["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var n=e.map(function(e){return i(e[t.props.valueKey])}).join(this.props.delimiter);return l["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:n,disabled:this.props.disabled})}return e.map(function(e,n){return l["default"].createElement("input",{key:"hidden."+n,type:"hidden",ref:"value"+n,name:t.props.name,value:i(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var n=this.state.focusedOption||e;if(n&&!n.disabled){var r=t.indexOf(n);if(r!==-1)return r}for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c){var d={startTime:(new Date).getTime(),appliedQuery:u},f=this.appbaseRef[t];if(f){var h=u;h.type="*"===this.type[t]?"":this.type[t],h.preference=this.app[t],n(d),f.search(h).on("data",function(e){d.mode="historic",d.data=o.highlightModify(e,d.appliedQuery),i.emitter.emit(t,d);var n=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:d,react:s.react,queryOptions:n})}).on("error",function(e){var n={appliedQuery:d.appliedQuery,error:e,startTime:d.startTime};i.emitter.emit(t,n)}),s.stream&&r.call(this,t,u,f)}else console.error("appbaseRef is not set for "+t)}else{var m={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,m)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t){"use strict";function n(e,t){for(var n=[],r={object:null,string:""},o=Object.keys(t),a=o,i=Array.isArray(a),s=0,a=i?a:a[Symbol.iterator]();;){var u;if(i){if(s>=a.length)break;u=a[s++]}else{if(s=a.next(),s.done)break;u=s.value}var l=u,c=t[l];typeof e[l]===c&&e[l]!==r[c]||n.push(l)}for(var p="",d=0;d0)||new Error("fields missing: "+p)}e.exports={validate:n}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],i(n))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:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,u=0;u0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n), +"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;ts.bottom||i.topt.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var n=this,r="object"==typeof t?t:this.props;if(r.multi){if("string"==typeof e&&(e=e.split(r.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return n.expandValue(e,r)}).filter(function(e){return e})}var o=this.expandValue(e,r);return o?[o]:[]},expandValue:function(e,t){var n=typeof e;if("string"!==n&&"number"!==n&&"boolean"!==n)return e;var r=t.options,o=t.valueKey;if(r)for(var a=0;ar&&this.focusOption(n[r+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var n=-1,r=0;r0?n-=1:n=t.length-1;else if("start"===e)n=0;else if("end"===e)n=t.length-1;else if("page_up"===e){var o=n-this.props.pageSize;n=o<0?0:o}else if("page_down"===e){var o=n+this.props.pageSize;n=o>t.length-1?t.length-1:o}n===-1&&(n=0),this.setState({focusedIndex:t[n].index,focusedOption:t[n].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return l["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},l["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var n=this,r=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:l["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var a=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return l["default"].createElement(o,{id:n._instancePrefix+"-value-"+t,instancePrefix:n._instancePrefix,disabled:n.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[n.props.valueKey],onClick:a,onRemove:n.removeValue,value:e},r(e,t),l["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(a=null),l["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:a,value:e[0]},r(e[0])))},renderInput:function(e,t){var n,r=this,i=(0,m["default"])("Select-input",this.props.inputProps.className),u=!!this.state.isOpen,c=(0,m["default"])((n={},a(n,this._instancePrefix+"-list",u),a(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),p=s({},this.props.inputProps,{role:"combobox","aria-expanded":""+u,"aria-owns":c,"aria-haspopup":""+u,"aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:i,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(p);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,h=(d.inputClassName,o(d,["inputClassName"]));return l["default"].createElement("div",s({},h,{role:"combobox","aria-expanded":u,"aria-owns":u?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:i,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?l["default"].createElement(f["default"],s({},p,{minWidth:"5"})):l["default"].createElement("div",{className:i},l["default"].createElement("input",p))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return l["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,n=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return l["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},n)},filterOptions:function N(e){var t=this.state.inputValue,n=this.props.options||[];if(this.props.filterOptions){var N="function"==typeof this.props.filterOptions?this.props.filterOptions:_["default"];return N(n,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return n},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,n){return e&&e.length?this.props.menuRenderer({focusedOption:n,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?l["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var n=e.map(function(e){return i(e[t.props.valueKey])}).join(this.props.delimiter);return l["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:n,disabled:this.props.disabled})}return e.map(function(e,n){return l["default"].createElement("input",{key:"hidden."+n,type:"hidden",ref:"value"+n,name:t.props.name,value:i(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var n=this.state.focusedOption||e;if(n&&!n.disabled){var r=t.indexOf(n);if(r!==-1)return r}for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c)!function(){var e={startTime:(new Date).getTime(),appliedQuery:u},a=o.appbaseRef[t];if(a){var l=u;l.type="*"===o.type[t]?"":o.type[t],l.preference=o.app[t],n(e),a.search(l).on("data",function(n){e.mode="historic",e.data=o.highlightModify(n,e.appliedQuery),i.emitter.emit(t,e);var r=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:e,react:s.react,queryOptions:r})}).on("error",function(n){var r={appliedQuery:e.appliedQuery,error:n,startTime:e.startTime};i.emitter.emit(t,r)}),s.stream&&r.call(o,t,u,a)}else console.error("appbaseRef is not set for "+t)}();else{var d={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,d)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t){"use strict";function n(e,t){for(var n=[],r={object:null,string:""},o=Object.keys(t),a=o,i=Array.isArray(a),s=0,a=i?a:a[Symbol.iterator]();;){var u;if(i){if(s>=a.length)break;u=a[s++]}else{if(s=a.next(),s.done)break;u=s.value}var l=u,c=t[l];typeof e[l]===c&&e[l]!==r[c]||n.push(l)}for(var p="",d=0;d0)||new Error("fields missing: "+p)}e.exports={validate:n}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],i(n))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:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,u=0;u0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n), o||(o=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var o=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,o,i,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=i;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.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(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a];s?this[a]=s(n):"target"===a?this.target=r:this[a]=n[a]}var u=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;return u?this.isDefaultPrevented=i.thatReturnsTrue:this.isDefaultPrevented=i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse,this}var o=n(9),a=n(47),i=n(25),s=(n(5),"function"==typeof Proxy,["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),u={type:null,target:null,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};o(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=i.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=i.thatReturnsTrue)},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n-1)return!1;if(r.filterOption)return r.filterOption.call(o,e,t);if(!t)return!0;var a=String(e[r.valueKey]),s=String(e[r.labelKey]);return r.ignoreAccents&&("label"!==r.matchProp&&(a=(0,i["default"])(a)),"value"!==r.matchProp&&(s=(0,i["default"])(s))),r.ignoreCase&&("label"!==r.matchProp&&(a=a.toLowerCase()),"value"!==r.matchProp&&(s=s.toLowerCase())),"start"===r.matchPos?"label"!==r.matchProp&&a.substr(0,t.length)===t||"value"!==r.matchProp&&s.substr(0,t.length)===t:"label"!==r.matchProp&&a.indexOf(t)>=0||"value"!==r.matchProp&&s.indexOf(t)>=0})}var a=n(350),i=r(a);e.exports=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.focusedOption,n=e.instancePrefix,r=(e.labelKey,e.onFocus),o=e.onSelect,a=e.optionClassName,s=e.optionComponent,l=e.optionRenderer,c=e.options,p=e.valueArray,d=e.valueKey,f=e.onOptionRef,h=s;return c.map(function(e,s){var c=p&&p.indexOf(e)>-1,m=e===t,y=(0,i["default"])(a,{"Select-option":!0,"is-selected":c,"is-focused":m,"is-disabled":e.disabled});return u["default"].createElement(h,{className:y,instancePrefix:n,isDisabled:e.disabled,isFocused:m,isSelected:c,key:"option-"+s+"-"+e[d],onFocus:r,onSelect:o,option:e,optionIndex:s,ref:function(e){f(e,m)}},l(e,s))})}var a=n(3),i=r(a),s=n(2),u=r(s);e.exports=o},function(e,t){"use strict";var n=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];e.exports=function(e){for(var t=0;t0)if(t.ended&&!o){var i=new Error("stream.push() after EOF");e.emit("error",i)}else if(t.endEmitted&&o){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var l;!t.decoder||o||r||(n=t.decoder.write(n),l=!t.objectMode&&0===n.length),o||(t.reading=!1),l||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,o?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&d(e))),h(e,t)}else o||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length=B?e=B:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function l(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function c(e,t){var n=null;return j.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function p(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,d(e)}}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(N("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?O(f,e):f(e))}function f(e){N("emit readable"),e.emit("readable"),b(e)}function h(e,t){t.readingMore||(t.readingMore=!0,O(m,e,t))}function m(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=M(e,t.buffer,t.decoder),n}function M(e,t,n){var r;return ea.length?a.length:e;if(o+=i===a.length?a:a.slice(0,e),e-=i,0===e){i===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(i));break}++r}return t.length-=r,o}function k(e,t){var n=Y.allocUnsafe(e),r=t.head,o=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,i=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,i),e-=i,0===e){i===a.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(i));break}++o}return t.length-=o,n}function S(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,O(P,t,e))}function P(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function L(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return N("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?S(this):d(this),null;if(e=l(e,t),0===e&&t.ended)return 0===t.length&&S(this),null;var r=t.needReadable;N("need readable",r),(0===t.length||t.length-e0?T(e,t):null,null===o?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&S(this)),null!==o&&this.emit("data",o),o},a.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},a.prototype.pipe=function(e,n){function o(e){N("onunpipe"),e===d&&i()}function a(){N("onend"),e.end()}function i(){N("cleanup"),e.removeListener("close",l),e.removeListener("finish",c),e.removeListener("drain",v),e.removeListener("error",u),e.removeListener("unpipe",o),d.removeListener("end",a),d.removeListener("end",i),d.removeListener("data",s),g=!0,!f.awaitDrain||e._writableState&&!e._writableState.needDrain||v()}function s(t){N("ondata"),_=!1;var n=e.write(t);!1!==n||_||((1===f.pipesCount&&f.pipes===e||f.pipesCount>1&&L(f.pipes,e)!==-1)&&!g&&(N("false write response, pause",d._readableState.awaitDrain),d._readableState.awaitDrain++,_=!0),d.pause())}function u(t){N("onerror",t),p(),e.removeListener("error",u),0===C(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",c),p()}function c(){N("onfinish"),e.removeListener("close",l),p()}function p(){N("unpipe"),d.unpipe(e)}var d=this,f=this._readableState;switch(f.pipesCount){case 0:f.pipes=e;break;case 1:f.pipes=[f.pipes,e];break;default:f.pipes.push(e)}f.pipesCount+=1,N("pipe count=%d opts=%j",f.pipesCount,n);var h=(!n||n.end!==!1)&&e!==t.stdout&&e!==t.stderr,m=h?a:i;f.endEmitted?O(m):d.once("end",m),e.on("unpipe",o);var v=y(d);e.on("drain",v);var g=!1,_=!1;return d.on("data",s),r(e,"error",u),e.once("close",l),e.once("finish",c),e.emit("pipe",d),f.flowing||(N("pipe resume"),d.resume()),e},a.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?r:S;s.WritableState=i;var L=n(14);L.inherits=n(11);var D={deprecate:n(745)},O=n(359),E=n(15).Buffer,C=n(78);L.inherits(s,O),i.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(i.prototype,"buffer",{get:D.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var x;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(x=Function.prototype[Symbol.hasInstance],Object.defineProperty(s,Symbol.hasInstance,{value:function(e){return!!x.call(this,e)||e&&e._writableState instanceof i}})):x=function(e){return e instanceof this},s.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},s.prototype.write=function(e,t,n){var r=this._writableState,a=!1,i=E.isBuffer(e);return"function"==typeof t&&(n=t,t=null),i?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=o),r.ended?u(this,n):(i||l(this,r,e,n))&&(r.pendingcb++,a=p(this,r,i,e,t,n)),a},s.prototype.cork=function(){var e=this._writableState;e.corked++},s.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||g(this,e))},s.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},s.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},s.prototype._writev=null,s.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)}}).call(t,n(7),n(141).setImmediate)},function(e,t,n){e.exports=n(36).EventEmitter},function(e,t,n){"use strict";function r(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function o(e){var t=r(e);if("string"!=typeof t&&(g.isEncoding===b||!b(e)))throw new Error("Unknown encoding: "+e);return t||e}function a(e){this.encoding=o(e);var t;switch(this.encoding){case"utf16le":this.text=d,this.end=f,t=4;break;case"utf8":this.fillLast=l,t=4;break;case"base64":this.text=h,this.end=m,t=3;break;default:return this.write=y,void(this.end=v)}this.lastNeed=0,this.lastTotal=0,this.lastChar=_.allocUnsafe(t)}function i(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:-1}function s(e,t,n){var r=t.length-1;if(r=0?(o>0&&(e.lastNeed=o-1),o):--r=0?(o>0&&(e.lastNeed=o-2),o):--r=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0))}function u(e,t,n){if(128!==(192&t[0]))return e.lastNeed=0,"�".repeat(n);if(e.lastNeed>1&&t.length>1){if(128!==(192&t[1]))return e.lastNeed=1,"�".repeat(n+1);if(e.lastNeed>2&&t.length>2&&128!==(192&t[2]))return e.lastNeed=2,"�".repeat(n+2)}}function l(e){var t=this.lastTotal-this.lastNeed,n=u(this,e,t);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�".repeat(this.lastTotal-this.lastNeed):t}function d(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function f(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function h(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function m(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function y(e){return e.toString(this.encoding)}function v(e){return e&&e.length?this.write(e):""}var g=n(15).Buffer,_=n(78),b=g.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n&&n.and?"string"==typeof n.and&&(n.and=[n.and]):n.and=[],n.and.push("streamChanges"),this.sortObj&&this.enableSort(n);var r=h["default"].create(this.context.appbaseRef,this.context.type,n,this.props.size,this.props.from,this.props.stream,this.context.app);if(this.channelId=r.channelId,this.channelListener=r.emitter.addListener(r.channelId,function(t){if(t.error&&t.startTime>e.queryStartTime&&(e.setState({queryStart:!1,showPlaceholder:!1}),e.props.onAllData)){var n=L.prepareResultData(t);e.props.onAllData(n.res,n.err)}if(t.appliedQuery)if("historic"===t.mode&&t.startTime>e.queryStartTime){var r=!(!t.appliedQuery||!t.data||t.data.error||t.data.hits&&t.data.hits.total),o={resultFound:!!(t.appliedQuery&&t.data&&!t.data.error&&t.data.hits&&t.data.hits.total)};t.appliedQuery&&t.data&&!t.data.error&&(o.total=t.data.hits.total,o.took=t.data.took),e.setState({queryStart:!1,visibleNoResults:r,resultStats:o,showPlaceholder:!1}),e.afterChannelResponse(t)}else"streaming"===t.mode&&(e.afterChannelResponse(t),e.updateResultStats(t.data));else e.setState({showPlaceholder:!0})}),this.listenLoadingChannel(r),t){var o={key:"streamChanges",value:""};L.selectedSensor.set(o,!0)}}},{key:"updateResultStats",value:function(e){var t=this.state.resultStats;t.total=L.updateStats(t.total,e),this.setState({resultStats:t})}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"afterChannelResponse",value:function(e){var t=this,n=e.data,r=void 0,o=void 0,a=[],i=[];if(this.streamFlag=!1,"streaming"===e.mode)this.channelMethod="streaming",a=n,a.stream=!0,i=this.state.currentData,this.streamFlag=!0,o=this.setMarkersData(r);else if("historic"===e.mode){this.queryStartTime=e.startTime,this.channelMethod="historic",a=n.hits&&n.hits.hits?n.hits.hits:[];var s=this.normalizeCurrentData(e,this.state.currentData,a);a=s.newData,i=s.currentData}this.setState({rawData:r,newData:a,currentData:i,markersData:o,isLoading:!1},function(){e.allMarkers=r;var n=JSON.parse(JSON.stringify(e));n.newData=t.state.newData,n.currentData=t.state.currentData,delete n.data,n=L.prepareResultData(n,e.data);var o=t.props.onAllData?t.props.onAllData(n.res,n.err):t.defaultonAllData(n.res,n.err);t.setState({resultMarkup:o,currentData:t.combineCurrentData(a)})})}},{key:"normalizeCurrentData",value:function(e,t,n){var r=JSON.parse(JSON.stringify(e.appliedQuery)),o=JSON.stringify(r)===JSON.stringify(this.appliedQuery)?t||[]:[];return o.length?n=n.filter(function(e){var t=!0;return o.forEach(function(n){e._id+"-"+e._type==n._id+"-"+n._type&&(t=!1)}),t}):this.appliedQuery=r,{currentData:o,newData:n}}},{key:"combineCurrentData",value:function(e){return P["default"].isArray(e)?this.state.currentData.concat(e):this.streamDataModify(this.state.currentData,e)}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.createChannel(e)}},{key:"removeChannel",value:function(){this.channelId&&(h["default"].stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"render",value:function(){var e=null,t=null,n=(0,d["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-stream-active":this.props.stream,"rbc-stream-inactive":!this.props.stream,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader,"rbc-resultstats-active":this.props.showResultStats,"rbc-resultstats-inactive":!this.props.showResultStats,"rbc-noresults-active":this.props.noResults,"rbc-noresults-inactive":!this.props.noResults});return this.props.title&&(e=c["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.props.placeholder&&(t=c["default"].createElement("div",{className:"rbc-placeholder col s12 col-xs-12"},this.props.placeholder)),c["default"].createElement("div",{className:"rbc-reactiveelement-container"},c["default"].createElement("div",{className:"rbc rbc-reactiveelement card thumbnail "+n,style:this.props.componentStyle},e,this.state.resultStats&&this.state.resultStats.resultFound&&this.props.showResultStats?c["default"].createElement(M["default"],{onResultStats:this.props.onResultStats,took:this.state.resultStats.took,total:this.state.resultStats.total}):null,this.state.resultMarkup,this.state.showPlaceholder?t:null),this.props.noResults&&this.state.visibleNoResults?c["default"].createElement(b["default"],{defaultText:this.props.noResults.text}):null,this.props.initialLoader&&this.state.queryStart?c["default"].createElement(g["default"],{defaultText:this.props.initialLoader.text}):null,c["default"].createElement(y["default"],{container:"rbc-reactiveelement-container"}))}}]),t}(l.Component);t["default"]=D,D.propTypes={componentId:c["default"].PropTypes.string,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),from:L.validation.resultListFrom,onAllData:c["default"].PropTypes.func,size:L.sizeValidation,stream:c["default"].PropTypes.bool,componentStyle:c["default"].PropTypes.object,initialLoader:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),noResults:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),showResultStats:c["default"].PropTypes.bool,onResultStats:c["default"].PropTypes.func,react:c["default"].PropTypes.object,placeholder:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element])},D.defaultProps={from:0,size:20,stream:!1,showResultStats:!0,componentStyle:{}},D.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired,app:c["default"].PropTypes.any.isRequired},D.types={componentId:k.STRING,title:k.STRING,react:k.OBJECT,from:k.NUMBER,size:k.NUMBER,onAllData:k.FUNCTION,stream:k.BOOLEAN,componentStyle:k.OBJECT,initialLoader:k.STRING,noResults:k.STRING,showResultStats:k.BOOLEAN,onResultStats:k.FUNCTION,placeholder:k.STRING}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nt.height(),i=n.get(0).scrollHeight>n.height();if(!a&&!i&&n.length&&!e.props.pagination){var s=o(t.find(".rbc-title"))+o(t.find(".rbc-pagination"))*t.find(".rbc-pagination").length,u=t.height()-60-s;u>0&&n.css({height:n.height()+15,"padding-bottom":20})}};t&&t.length&&n&&n.length&&(n.css({height:"auto","padding-bottom":0}),setTimeout(a.bind(this),1e3))}},{key:"removeChannel",value:function(){this.channelId&&(m["default"].stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"createChannel",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n&&n.and?"string"==typeof n.and&&(n.and=[n.and]):n.and=[],n.and.push("streamChanges"),this.props.pagination&&(n.and.push("paginationChanges"),n.pagination=null),this.sortObj&&this.enableSort(n);var r=m["default"].create(this.context.appbaseRef,this.context.type,n,this.props.size,this.props.from,this.props.stream,this.context.app);this.channelId=r.channelId,this.channelListener=r.emitter.addListener(r.channelId,function(t){if(t.error&&t.startTime>e.queryStartTime&&(e.setState({queryStart:!1,showPlaceholder:!1}),e.props.onAllData)){var n=x.prepareResultData(t);e.props.onAllData(n.res,n.err)}if(t.appliedQuery)if("historic"===t.mode&&t.startTime>e.queryStartTime){var r=!(!(t.appliedQuery&&Object.keys(t.appliedQuery).length&&t.data)||t.data.error||t.data.hits&&t.data.hits.total),o={resultFound:!!(t.appliedQuery&&t.data&&!t.data.error&&t.data.hits&&t.data.hits.total)};t.appliedQuery&&t.data&&!t.data.error&&(o.total=t.data.hits.total,o.took=t.data.took),e.setState({queryStart:!1,visibleNoResults:r,resultStats:o,showPlaceholder:!1}),e.afterChannelResponse(t)}else"streaming"===t.mode&&(e.afterChannelResponse(t),e.updateResultStats(t.data));else e.setState({showPlaceholder:!0})}),this.listenLoadingChannel(r),t&&setTimeout(function(){var e={key:"streamChanges",value:""};x.selectedSensor.set(e,!0)},100)}},{key:"updateResultStats",value:function(e){var t=this.state.resultStats;t.total=x.updateStats(t.total,e),this.setState({resultStats:t})}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){if(e.appliedQuery){var n=!(t.state.requestOnScroll&&e.appliedQuery.body&&e.appliedQuery.body.from);t.setState({queryStart:e.queryState,showInitialLoader:n})}})}},{key:"afterChannelResponse",value:function(e){var t=this,n=e.data,r=void 0,o=void 0,a=[],i=[];if(this.streamFlag=!1,"streaming"===e.mode)this.channelMethod="streaming",a=n,a.stream=!0,i=this.state.currentData,this.streamFlag=!0,o=this.setMarkersData(r);else if("historic"===e.mode){this.queryStartTime=e.startTime,this.channelMethod="historic",a=n.hits&&n.hits.hits?n.hits.hits:[];var s=this.normalizeCurrentData(e,this.state.currentData,a);a=s.newData,i=s.currentData}this.setState({rawData:r,newData:a,currentData:i,markersData:o,isLoading:!1},function(){e.allMarkers=r;var o=JSON.parse(JSON.stringify(e));o.newData=t.state.newData,o.currentData=t.state.currentData,delete o.data,o=x.prepareResultData(o,n);var i=t.props.onAllData?t.props.onAllData(o.res,o.err):t.defaultonAllData(o.res,o.err);t.setState({resultMarkup:t.wrapMarkup(i),currentData:t.combineCurrentData(a)})})}},{key:"wrapMarkup",value:function(e){var t=null;return t=C["default"].isArray(e)?e.map(function(e,t){return p["default"].createElement("div",{key:t,className:"rbc-list-item"},e)}):e}},{key:"normalizeCurrentData",value:function(e,t,n){var r=JSON.parse(JSON.stringify(e.appliedQuery));this.state.requestOnScroll&&r&&r.body&&(delete r.body.from,delete r.body.size);var o=JSON.stringify(r)===JSON.stringify(this.appliedQuery),a=o?t||[]:[];return a.length?n=n.filter(function(e){var t=!0;return a.forEach(function(n){e._id+"-"+e._type==n._id+"-"+n._type&&(t=!1)}),t}):this.appliedQuery=r,o||j(".rbc.rbc-reactivelist").animate({scrollTop:0},100),{currentData:a,newData:n}}},{key:"combineCurrentData",value:function(e){return C["default"].isArray(e)?(e=e.map(function(e){return e.stream=!1,e}),this.state.currentData.concat(e)):this.streamDataModify(this.state.currentData,e,!1)}},{key:"enableSort",value:function(e){e.and.push(this.resultSortKey);var t={key:this.resultSortKey,value:this.sortObj};x.selectedSensor.setSortInfo(t)}},{key:"appendData",value:function(e){var t=this.state.rawData,n=t.hits.hits.concat(e.hits.hits);return t.hits.hits=C["default"].uniqBy(n,"_id"),t}},{key:"streamDataModify",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(t)if(t.stream=n,t.streamStart=new Date,t._deleted){var r=e.filter(function(e){return e._id!==t._id});e=r}else{var o=e.filter(function(e){return e._id!==t._id});e=o,e.unshift(t)}return e}},{key:"setMarkersData",value:function(e){return e?e:[]}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.createChannel(e),this.state.requestOnScroll?this.listComponent():this.setQueryForPagination()}},{key:"setQueryForPagination",value:function(){var e={queryType:"match",inputData:this.props.appbaseField,customQuery:function(){return null}},t={key:"paginationChanges",value:e};x.selectedSensor.setSensorInfo(t)}},{key:"executePaginationUpdate",value:function(){setTimeout(function(){var e={key:"paginationChanges",value:Math.random()};x.selectedSensor.set(e,!0)},100)}},{key:"paginationAt",value:function(e){var t=void 0;return!this.props.pagination||this.props.paginationAt!==e&&"both"!==this.props.paginationAt||(t=p["default"].createElement("div",{className:"rbc-pagination-container col s12 col-xs-12"},p["default"].createElement(L["default"],{className:"rbc-pagination-"+e,componentId:"pagination",onPageChange:this.props.onPageChange,title:this.props.paginationTitle}))),t}},{key:"defaultonAllData",value:function(e){var t=this,n=null;if(e){var r=e.currentData;"historic"===e.mode?r=e.currentData.concat(e.newData):"streaming"===e.mode&&(r=x.combineStreamData(e.currentData,e.newData)),r&&(n=r.map(function(e){var n=e._source;return t.props.onData?t.props.onData(e):p["default"].createElement("div",{className:"row",style:{marginTop:"20px"}},t.itemMarkup(n,e))}))}return n}},{key:"itemMarkup",value:function(e,t){return p["default"].createElement("div",{key:t._id,style:{padding:"12px",fontSize:"12px"},className:"makerInfo"},p["default"].createElement(v["default"],{data:e}))}},{key:"nextPage",value:function(){function e(){this.setState({isLoading:!0}),m["default"].nextPage(this.channelId)}this.state.resultStats.total>this.state.currentData.length&&!this.state.queryStart&&e.call(this)}},{key:"listComponent",value:function(){function e(e){var t=this;e&&e.addEventListener("scroll",function(){t.state.requestOnScroll&&j(e).scrollTop()+j(e).innerHeight()>=e.scrollHeight&&t.state.resultStats.total>t.state.currentData.length&&!t.state.queryStart&&t.nextPage()})}e.call(this,this.listParentElement),e.call(this,this.listChildElement)}},{key:"handleSortSelect",value:function(e){var t=e.target.value;this.sortObj=a({},this.props.sortOptions[t].appbaseField,{order:this.props.sortOptions[t].sortBy});var n={key:this.resultSortKey,value:this.sortObj};x.selectedSensor.set(n,!0,"sortChange")}},{key:"render",value:function(){var e=this,t=null,n=null,r=null,o=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-sort-active":this.props.sortOptions,"rbc-sort-inactive":!this.props.sortOptions,"rbc-stream-active":this.props.stream,"rbc-stream-inactive":!this.props.stream,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader,"rbc-resultstats-active":this.props.showResultStats,"rbc-resultstats-inactive":!this.props.showResultStats,"rbc-noresults-active":this.props.noResults,"rbc-noresults-inactive":!this.props.noResults,"rbc-pagination-active":this.props.pagination,"rbc-pagination-inactive":!this.props.pagination});if(this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.props.placeholder&&(n=p["default"].createElement("div",{className:"rbc-placeholder col s12 col-xs-12"},this.props.placeholder)),this.props.sortOptions){var a=this.props.sortOptions.map(function(e,t){return p["default"].createElement("option",{value:t,key:e.label},e.label)});r=p["default"].createElement("div",{className:"rbc-sortoptions input-field col"},p["default"].createElement("select",{className:"browser-default form-control",onChange:this.handleSortSelect},a))}return p["default"].createElement("div",{ className:"rbc-reactivelist-container"},p["default"].createElement("div",{ref:function(t){e.listParentElement=t},className:"rbc rbc-reactivelist card thumbnail "+o,style:this.props.componentStyle},t,r,this.props.showResultStats&&this.state.resultStats.resultFound?p["default"].createElement(S["default"],{onResultStats:this.props.onResultStats,took:this.state.resultStats.took,total:this.state.resultStats.total}):null,this.paginationAt("top"),p["default"].createElement("div",{ref:function(t){e.listChildElement=t},className:"rbc-reactivelist-scroll-container col s12 col-xs-12"},this.state.resultMarkup),this.state.isLoading?p["default"].createElement("div",{className:"rbc-loader"}):null,this.state.showPlaceholder?n:null,this.paginationAt("bottom")),this.props.noResults&&this.state.visibleNoResults?p["default"].createElement(w["default"],{defaultText:this.props.noResults}):null,this.props.initialLoader&&this.state.queryStart&&this.state.showInitialLoader?p["default"].createElement(T["default"],{defaultText:this.props.initialLoader}):null,p["default"].createElement(_["default"],{container:"rbc-reactivelist-container"}))}}]),t}(c.Component);t["default"]=Y,Y.propTypes={componentId:p["default"].PropTypes.string,appbaseField:p["default"].PropTypes.string,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),sortBy:p["default"].PropTypes.oneOf(["asc","desc","default"]),sortOptions:p["default"].PropTypes.arrayOf(p["default"].PropTypes.shape({label:p["default"].PropTypes.string,appbaseField:p["default"].PropTypes.string,sortBy:p["default"].PropTypes.string})),from:x.validation.resultListFrom,onAllData:p["default"].PropTypes.func,size:x.sizeValidation,stream:p["default"].PropTypes.bool,componentStyle:p["default"].PropTypes.object,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),noResults:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),showResultStats:p["default"].PropTypes.bool,onResultStats:p["default"].PropTypes.func,placeholder:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,paginationAt:p["default"].PropTypes.string,pagination:p["default"].PropTypes.bool},Y.defaultProps={from:0,size:20,stream:!1,componentStyle:{},showResultStats:!0,pagination:!1,paginationAt:"bottom"},Y.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired,app:p["default"].PropTypes.any.isRequired},Y.types={componentId:O.STRING,appbaseField:O.STRING,title:O.STRING,react:O.OBJECT,sortBy:O.STRING,sortOptions:O.OBJECT,from:O.NUMBER,onAllData:O.FUNCTION,onData:O.FUNCTION,size:O.NUMBER,stream:O.BOOLEAN,componentStyle:O.OBJECT,initialLoader:O.STRING,noResults:O.FUNCTION,showResultStats:O.BOOLEAN,onResultStats:O.FUNCTION,placeholder:O.STRING,pagination:O.BOOLEAN,paginationAt:O.STRING}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Bar=t.HistoGramComponent=void 0;var s=function(){function e(e,t){for(var n=0;n-1;t?this.setDefaultSelectAll():this.setState({selectedItems:this.props.defaultSelected,defaultSelectall:this.props.defaultSelectall},function(){e.updateAction.bind(e),e.props.onSelect(e.state.selectedItems)})}},{key:"setDefaultSelectAll",value:function(){this.props.items&&this.props.items.length?setTimeout(this.handleListClickAll.bind(this,this.props.selectAllLabel,!0),1e3):setTimeout(this.setDefaultSelectAll.bind(this),1e3)}},{key:"componentDidUpdate",value:function(){var e=this,t=null,n=!0;this.state.selectedItems&&(t=JSON.parse(JSON.stringify(this.state.selectedItems))),t&&t.length&&this.props.items&&this.props.items.length&&(t=t.filter(function(t){var n=e.props.items.filter(function(e){return e.key===t});return!!n.length}),t.length!==this.state.selectedItems.length&&(n=!t.length,this.props.onRemove(this.state.selectedItems,n),this.updateSelectedItems(t),t.length&&this.props.onSelect(t)))}},{key:"handleListClick",value:function(e,t){var n=void 0;t?(this.props.onRemove(this.state.selectedItems,!1),n=this.state.selectedItems,n.push(e),this.setState({selectedItems:n},this.updateAction.bind(this)),this.state.selectedItems.length&&this.props.onSelect(this.state.selectedItems)):this.handleTagClick(e)}},{key:"handleTagClick",value:function(e){var t=1===this.state.selectedItems.length;this.props.onRemove(this.state.selectedItems,t);var n=e.toString().replace(/ /g,"_"),r="ref"+n,o=this.refStore[r];o.state.status=!1;var a=this.state.selectedItems,i=a.indexOf(e);a.splice(i,1),this.setState({selectedItems:a},this.updateAction.bind(this)),this.props.onSelect(a)}},{key:"clearAll",value:function(){this.handleListClickAll(this.props.selectAllLabel,!1)}},{key:"getSelectedItems",value:function(){var e=[];return this.props.items.forEach(function(t){t.status&&e.indexOf(t.key)<0&&e.push(t.key)}),e}},{key:"handleListClickAll",value:function(e,t){var n=this;this.props.selectAll(t);var r=this.props.items.map(function(e){return e.key});r=t?r:[],this.setState({defaultSelectall:t,selectedItems:r},function(){n.updateAction.bind(n),n.props.onSelect(n.state.selectedItems,r)})}},{key:"updateSelectedItems",value:function(e){this.setState({selectedItems:e})}},{key:"updateAction",value:function(){this.state.selectedItems.length||this.props.onSelect(null)}},{key:"render",value:function(){var e=this,t=this.props.items,n=this.getSelectedItems(),r=[],o=[];return t.forEach(function(t,n){try{t.keyRef=t.key.replace(/ /g,"_")}catch(o){t.keyRef=n}var a=!("visible"in t&&!t.visible);r.push(l["default"].createElement(p["default"],{key:t.keyRef,value:t.key,doc_count:t.doc_count,countField:e.props.showCount,handleClick:e.handleListClick,visible:a,showCheckbox:e.props.showCheckbox,status:t.status||!1,ref:function(n){var r="ref"+t.keyRef;e.refStore[r]=n}}))}),this.props.selectAllLabel&&t&&t.length&&r.unshift(l["default"].createElement(p["default"],{key:"selectall",value:this.props.selectAllLabel,countField:!1,visible:!0,showCheckbox:this.props.showCheckbox,handleClick:this.handleListClickAll,status:this.props.selectAllValue,ref:function(t){e.refStore.refselectall=t}})),this.props.showTags&&n&&(n.length<=5?n.forEach(function(t){o.push(l["default"].createElement(f["default"],{key:t,value:t,onClick:e.handleTagClick}))}):o.unshift(l["default"].createElement(f["default"],{key:"Clear All",value:"Clear All",onClick:this.clearAll}))),l["default"].createElement("div",{className:"rbc-list-container col s12 col-xs-12"},o.length?l["default"].createElement("div",{className:"row rbc-tag-container"},o):null,l["default"].createElement("div",{className:"row"},r))}}]),t}(u.Component);t["default"]=h,h.propTypes={defaultSelected:l["default"].PropTypes.array,items:l["default"].PropTypes.array,onRemove:l["default"].PropTypes.func,onSelect:l["default"].PropTypes.func,selectAll:l["default"].PropTypes.func,selectAllLabel:l["default"].PropTypes.string,selectAllValue:l["default"].PropTypes.bool,showCount:l["default"].PropTypes.bool,showTags:l["default"].PropTypes.bool,defaultSelectall:l["default"].PropTypes.bool},h.defaultProps={showTags:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n-1){var n=t.channelResponse&&t.channelResponse.data&&t.channelResponse.data.hits?t.channelResponse.data.hits.total:0,r=Math.ceil(n/t.queryOptions.size)<1?1:Math.ceil(n/t.queryOptions.size),o=t.queryOptions.size?t.queryOptions.size:20,a=Math.round(t.queryOptions.from/o)+1;e.setState({totalHits:n,size:o,maxPageNumber:r,currentValue:a})}})}},{key:"handleChange",value:function(e){this.setState({currentValue:e});var t={key:this.props.componentId,value:e},n=!0;h.selectedSensor.set(t,n,"paginationChange"),this.props.onPageChange&&this.props.onPageChange(e)}},{key:"firstPage",value:function(){1!==this.state.currentValue&&this.handleChange.call(this,1)}},{key:"lastPage",value:function(){this.state.currentValue!==this.state.maxPageNumber&&this.handleChange.call(this,this.state.maxPageNumber)}},{key:"prePage",value:function(){var e=this.state.currentValue>1?this.state.currentValue-1:1;this.state.currentValue!==e&&this.handleChange.call(this,e)}},{key:"nextPage",value:function(){var e=this.state.currentValue0;r--)if(r%5===0||1===r){t=r;break}for(var o=function(t){var r=l["default"].createElement("li",{key:t,className:"rbc-page-number "+(e.state.currentValue===t?"active rbc-pagination-active":"waves-effect")},l["default"].createElement("a",{onClick:function(){return e.handleChange(t)}},t));t<=e.state.maxPageNumber&&n.push(r)},a=t;a<=t+5;a++)o(a);return l["default"].createElement("ul",{className:"pagination"},l["default"].createElement("li",{className:1===this.state.currentValue?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.firstPage},l["default"].createElement("i",{className:"fa fa-angle-double-left"}))),l["default"].createElement("li",{className:1===this.state.currentValue?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.prePage},l["default"].createElement("i",{className:"fa fa-angle-left"}))),n,l["default"].createElement("li",{className:this.state.currentValue===this.state.maxPageNumber?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-next",onClick:this.nextPage},l["default"].createElement("i",{className:"fa fa-angle-right"}))),l["default"].createElement("li",{className:this.state.currentValue===this.state.maxPageNumber?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.lastPage},l["default"].createElement("i",{className:"fa fa-angle-double-right"}))))}},{key:"render",value:function(){var e=null;this.props.title&&(e=l["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,p["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return l["default"].createElement("div",{className:"rbc rbc-pagination col s12 col-xs-12 "+t+" "+this.props.className},e,l["default"].createElement("div",{className:"col s12 col-xs-12"},this.renderPageNumber()))}}]),t}(u.Component);t["default"]=m,m.propTypes={componentId:l["default"].PropTypes.string.isRequired,title:l["default"].PropTypes.string,onPageChange:l["default"].PropTypes.func},m.defaultProps={},m.contextTypes={appbaseRef:l["default"].PropTypes.any.isRequired,type:l["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.StaticSearch=void 0;var s=function(){function e(e,t){for(var n=0;n-1)d=d||{},d=Object.assign(d,t[e]);else{r[e]=i(e);var o=a(e);o&&(d=d||{},d=Object.assign(d,o))}var u=n(e);!u||"aggSort"in u||p.push(u)}),r}function l(t){var n=o.serializeDepends.createQuery(e.serializeDepends,t);return n&&n.body?(p&&p.length&&(n.body.sort=p),d&&Object.keys(d).length&&Object.keys(d).forEach(function(e){n.body[e]=d[e]})):n={},n}function c(){var e=u(),t=l(e);return t}var p=[],d=null;return c()}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.params.get(e);if(n&&r)try{r=JSON.parse(r)}catch(o){console.log(o)}return t?r&&r.trim()?r.split(","):null:r}},{key:"update",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&(this.setOrDelete(e,t),this.applyURLUpdate())}},{key:"setOrDelete",value:function(e,t){e&&(null===t||void 0===t?this.params["delete"](e):this.params.set(e,t)); -}},{key:"applyURLUpdate",value:function(){if(history.pushState&&this.params.toString()){var e=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+this.params.toString();window.history.pushState({path:e},"",e)}}}]),e}();t.URLParams=new u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(49);t.ResponsiveStory=function(){var e=function(e){return e.height()?e.height():0},t=function(){var t=r(window).height(),n=t-15;r(".rbc.rbc-reactivelist, .rbc.rbc-reactiveelement").css({maxHeight:n});var o=[r(".rbc.rbc-singlelist"),r(".rbc.rbc-multilist"),r(".rbc.rbc-nestedlist"),r(".rbc.rbc-tagcloud")];o.forEach(function(n){if(n.length){var r=e(n.find(".rbc-title"))+e(n.find(".rbc-search-container"));n.find(".rbc-list-container").css({maxHeight:t-r-35})}}),r(".rbc-base > .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(e[t]<1||e[t]>1e3)&&(n=new Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=new Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]<=0&&(n=new Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=new Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start<=0&&(r=new Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return!isNaN(e[t])&&r>=e.defaultSelected&&o<=e.defaultSelected||(n=new Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return e[t]<0&&(n=new Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=new Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n'],post_tags:[""],fields:e}}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.defaultSearchQuery}};this.props.highlight&&(e.value.externalQuery=this.highlightQuery()),w.selectedSensor.setSensorInfo(e);var t={key:this.searchInputId,value:{queryType:"multi_match",inputData:this.props.appbaseField,customQuery:this.defaultSearchQuery}};w.selectedSensor.setSensorInfo(t)}},{key:"setValue",value:function(e){var t={key:this.searchInputId,value:e};w.URLParams.update(this.props.componentId,e,this.props.URLParams),w.selectedSensor.set(t,!0),e&&""!==e.trim()?this.setState({options:[{label:e,value:e}],isLoadingOptions:!0,currentValue:e}):this.setState({options:[],isLoadingOptions:!1,currentValue:e})}},{key:"getValue",value:function(e,t){var n=void(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0);if(M["default"].has(t,e))n=t[e];else if(e.indexOf(".")>-1){var r="",o=e.split(".");o.forEach(function(e,a){r+=e,M["default"].isArray(M["default"].get(t,r))&&(r+="["+a+"]"),o.length-1!==a?r+=".":n=M["default"].get(t,r)})}return n}},{key:"setData",value:function(e){var t=this,n=[];M["default"].isArray(this.props.appbaseField)?this.props.appbaseField:[this.props.appbaseField],e.hits.hits.map(function(e){if("string"===t.fieldType){var r=t.getValue(t.props.appbaseField.trim(),e._source);n.push({value:r,label:r})}else"object"===t.fieldType&&t.props.appbaseField.map(function(r){var o=t.getValue(r,e._source);o&&n.push({value:o,label:o})})}),this.state.currentValue&&""!==this.state.currentValue.trim()&&n.unshift({label:this.state.currentValue,value:this.state.currentValue}),n=this.removeDuplicates(n,"label"),this.setState({options:n,isLoadingOptions:!1})}},{key:"defaultSearchQuery",value:function(e){var t=null,n=void 0;return e&&(n="string"===this.fieldType?[this.props.appbaseField]:this.props.appbaseField,t={bool:{should:[{multi_match:{query:e,fields:n,type:"phrase_prefix"}},{multi_match:{query:e,fields:n}}],minimum_should_match:"1"}}),t}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.searchInputId);var n=g["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({rawData:r}),e.props.autocomplete&&e.setData(r)})}},{key:"checkDefault",value:function(){this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultValue&&this.defaultSelected!=this.defaultValue&&(this.defaultSelected=this.defaultValue,setTimeout(this.setValue.bind(this,this.defaultSelected),100),this.handleSearch({value:this.defaultSelected}))}},{key:"handleSearch",value:function(e){var t=e?e.value:null;t="null"===t?null:t;var n={key:this.props.componentId,value:t};w.selectedSensor.set(n,!0),this.setState({currentValue:t})}},{key:"handleInputChange",value:function(e){var t=e.target.value;this.setState({currentValue:t});var n={key:this.props.componentId,value:t};this.props.onValueChange&&this.props.onValueChange(n.value);var r=!0;w.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=d["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,y["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-autocomplete-active":this.props.autocomplete,"rbc-autocomplete-inactive":!this.props.autocomplete});return d["default"].createElement("div",{className:"rbc rbc-datasearch col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},e,this.props.autocomplete?d["default"].createElement(h["default"],u({isLoading:this.state.isLoadingOptions,value:this.state.currentValue,options:this.state.options,onInputChange:this.setValue,onChange:this.handleSearch,onBlurResetsInput:!1},this.props)):d["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},d["default"].createElement("input",{type:"text",className:"rbc-input",placeholder:this.props.placeholder,value:this.state.currentValue?this.state.currentValue:"",onChange:this.handleInputChange}),d["default"].createElement("span",{className:"rbc-search-icon"})))}}]),t}(p.Component);t["default"]=k,k.propTypes={componentId:d["default"].PropTypes.string.isRequired,appbaseField:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),title:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.element]),placeholder:d["default"].PropTypes.string,autocomplete:d["default"].PropTypes.bool,defaultSelected:d["default"].PropTypes.string,customQuery:d["default"].PropTypes.func,onValueChange:d["default"].PropTypes.func,react:d["default"].PropTypes.object,componentStyle:d["default"].PropTypes.object,highlight:d["default"].PropTypes.bool,highlightFields:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),URLParams:d["default"].PropTypes.bool},k.defaultProps={placeholder:"Search",autocomplete:!0,componentStyle:{},highlight:!1,URLParams:!1},k.contextTypes={appbaseRef:d["default"].PropTypes.any.isRequired,type:d["default"].PropTypes.any.isRequired},k.types={componentId:b.STRING,appbaseField:b.STRING,appbaseFieldType:b.STRING,react:b.OBJECT,title:b.STRING,placeholder:b.STRING,autocomplete:b.BOOLEAN,defaultSelected:b.STRING,customQuery:b.FUNCTION,componentStyle:b.OBJECT,highlight:b.BOOLEAN,URLParams:b.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&setTimeout(this.handleChange.bind(this,t),1e3)}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!_["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t;var n=e.state.data.filter(function(t){ -return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&(null!==e.urlParams?e.handleChange(n):setTimeout(e.handleChange.bind(e,n),1e3))}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};b.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){if(e.length>0)return e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}})}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}}},{key:"handleChange",value:function(e){var t=[];t=e.map(function(e){return e.label}),t=t.join(),this.setState({selected:t});var n={key:this.props.componentId,value:e},r=!0;this.props.onValueChange&&this.props.onValueChange(n.value),b.URLParams.update(this.props.componentId,t,this.props.URLParams),b.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return p["default"].createElement("div",{className:"rbc rbc-multidropdownrange col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"col s12 col-xs-12"},p["default"].createElement(f["default"],{options:this.state.data,value:this.state.selected,onChange:this.handleChange,clearable:!1,multi:!0,placeholder:this.props.placeholder,searchable:!0}))))}}]),t}(c.Component);t["default"]=T,T.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),placeholder:p["default"].PropTypes.string,data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},T.defaultProps={URLParams:!1},T.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},T.types={componentId:v.STRING,appbaseField:v.STRING,appbaseFieldType:v.NUMBER,data:v.OBJECT,defaultSelected:v.ARRAY,title:v.STRING,placeholder:v.STRING,customQuery:v.FUNCTION,componentStyle:v.OBJECT,URLParams:v.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&(null!==this.urlParams?this.handleChange(t):setTimeout(this.handleChange.bind(this,t),1e3))}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!v["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t,e.resetState();var n=e.props.data.filter(function(e){return t.indexOf(e.label)>-1});n&&n.length&&setTimeout(e.handleChange.bind(e,n),1e3)}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.length>0?e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}}):null}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}return null}},{key:"handleChange",value:function(e){function t(e,t,o){o.label===e.label&&(r=t,n.splice(t,1))}var n=this.state.selected,r=null,o=e;v["default"].isArray(e)||(o=[e]),o.forEach(function(e){n.forEach(function(n,r){t(n,r,e)})}),null===r&&o.forEach(function(e){n.push(e)}),this.setState({selected:n});var a={key:this.props.componentId,value:n},i=!0;this.props.onValueChange&&this.props.onValueChange(a.value),g.URLParams.update(this.props.componentId,this.getSelectedLabels(n),this.props.URLParams),g.selectedSensor.set(a,i)}},{key:"getSelectedLabels",value:function(e){return e.map(function(e){return e.label})}},{key:"resetState",value:function(){this.setState({selected:[]});var e={key:this.props.componentId,value:[]},t=!0;g.URLParams.update(this.props.componentId,null,this.props.URLParams),g.selectedSensor.set(e,t)}},{key:"handleTagClick",value:function(e){var t=this.state.selected.filter(function(t){return t.label===e});this.handleChange(t[0])}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t){return p["default"].createElement("div",{className:"rbc-list-item row",key:t.label,onClick:function(){return e.handleChange(t)}},p["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:n.indexOf(t.label)>-1,value:t.label}),p["default"].createElement("label",{className:"rbc-label"},t.label))})),t}},{key:"render",value:function(){var e=this,t=null,n=[];this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.selected&&this.state.selected.forEach(function(t){n.push(p["default"].createElement(b,{key:t.label,value:t.label,onClick:e.handleTagClick}))});var r=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return p["default"].createElement("div",{className:"rbc rbc-multirange col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},t,p["default"].createElement("div",{className:"col s12 col-xs-12 rbc-list-container"},n.length?p["default"].createElement("div",{className:"row",style:{marginTop:"0"}},n):null,this.renderButtons())))}}]),t}(c.Component);t["default"]=_;var b=function(e){return p["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},p["default"].createElement("a",{className:"close"},"×"),p["default"].createElement("span",null,e.value))};b.propTypes={onClick:p["default"].PropTypes.func.isRequired,value:p["default"].PropTypes.string.isRequired},_.propTypes={appbaseField:p["default"].PropTypes.string.isRequired,componentId:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nr;return p["default"].createElement("div",{className:"rbc-numberbox-container col s12 col-xs-12"},p["default"].createElement("div",{className:"rbc-label"},t),p["default"].createElement("div",{className:"rbc-numberbox-btn-container"},p["default"].createElement(g,{isActive:s,handleChange:o,type:"minus"}),p["default"].createElement("span",{className:"rbc-numberbox-number"},a),p["default"].createElement(g,{isActive:i,handleChange:o,type:"plus"})))},b=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),o=r.props.focused;r.urlParams=y.URLParams.get(r.props.componentId);var a=null!==r.urlParams?r.urlParams:r.props.defaultSelected;return r.state={currentValue:a?a:r.props.data.start,focused:o},r.type="term",r.handleChange=r.handleChange.bind(r),r.customQuery=r.customQuery.bind(r),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.setQueryInfo(),null!==this.urlParams?this.updateQuery(this.urlParams):setTimeout(this.handleChange.bind(this),1e3)}},{key:"componentWillReceiveProps",value:function(e){var t=this;setTimeout(function(){var n=null!==t.urlParams?t.urlParams:t.props.defaultSelected;!n&&0!==n||n===t.state.currentValue||t.setState({currentValue:n}),e.queryFormat!==t.queryFormat&&(t.queryFormat=e.queryFormat,t.updateQuery())},300)}},{key:"customQuery",value:function(e){var t=null;if(e&&(e.value||0===e.value)){var n=e.value;switch(this.props.queryFormat){case"exact":t=this.exactQuery(n);break;case"lte":t=this.lteQuery(n);break;case"gte":default:t=this.gteQuery(n)}}return t}},{key:"exactQuery",value:function(e){return a({},this.type,a({},this.props.appbaseField,e))}},{key:"gteQuery",value:function(e){return{range:a({},this.props.appbaseField,{gte:e,boost:2})}}},{key:"lteQuery",value:function(e){return{range:a({},this.props.appbaseField,{lte:e,boost:2})}}},{key:"setQueryInfo",value:function(){var e=this.props,t=e.componentId,n=e.appbaseField,r={key:t,value:{queryType:this.type,inputData:n,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};y.selectedSensor.setSensorInfo(r)}},{key:"handleChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.props,n=(t.componentId,t.data),r=n.start,o=n.end,a=this.state.currentValue;r=void 0!=r?r:a-1,o=void 0!=o?o:a+1,e>0&&ar&&(a-=1),this.setState({currentValue:a},this.updateQuery.bind(this))}},{key:"updateQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.start.currentValue,t={key:this.props.componentId,value:{value:e,queryFormat:this.props.queryFormat}};this.props.onValueChange&&this.props.onValueChange(t.value),y.URLParams.update(this.props.componentId,e,this.props.URLParams),y.selectedSensor.set(t,!0)}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.data,r=e.labelPosition,o=this.state.currentValue,a=t?p["default"].createElement(v,{title:t}):null,i=(0,f["default"])({"rbc-title-active":t,"rbc-title-inactive":!t});return p["default"].createElement("div",{className:"rbc rbc-numberbox col s12 col-xs-12 card thumbnail "+i+" rbc-label-"+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},a,p["default"].createElement(_,{handleChange:this.handleChange,value:o,label:n.label,start:n.start,end:n.end})))}}]),t}(c.Component);t["default"]=b,b.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.shape({start:y.validateThreshold,end:y.validateThreshold,label:p["default"].PropTypes.string}),defaultSelected:y.valueValidation,labelPosition:p["default"].PropTypes.oneOf(["top","bottom","left","right"]),customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,queryFormat:p["default"].PropTypes.oneOf(["exact","gte","lte"]),URLParams:p["default"].PropTypes.bool},b.defaultProps={componentStyle:{},queryFormat:"gte",URLParams:!1},b.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},b.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.NUMBER,labelPosition:m.STRING,customQuery:m.FUNCTION,componentStyle:m.OBJECT,queryFormat:m.STRING,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=n.end){var r=(n.end-n.start)%e.stepValue;if(r){t.setState({values:{min:t.state.values.min,max:n.end-r}});var o={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-r}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(o.value),S.URLParams.update(t.props.componentId,t.setURLParam(o.value),t.props.URLParams),S.selectedSensor.set(o,!0)},1e3)}else{var a={};a.min=n.start,a.max=n.end,t.setState({values:a,currentValues:a});var i={key:t.props.componentId,value:{from:a.min,to:a.max}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(i.value),S.URLParams.update(t.props.componentId,t.setURLParam(i.value),t.props.URLParams),S.selectedSensor.set(i,!0)},1e3)}}if(e.range.start!==t.state.startThreshold||e.range.end!==t.state.endThreshold){if(e.range.start<=n.start&&e.range.end>=n.end)t.setState({startThreshold:e.range.start,endThreshold:e.range.end});else{var s={min:t.state.values.min,max:t.state.values.max};t.state.values.mine.range.end&&(s.max=e.range.end),t.setState({startThreshold:e.range.start,endThreshold:e.range.end,values:s});var u={from:s.min,to:s.max},l={key:t.props.componentId,value:u};t.props.onValueChange&&t.props.onValueChange(l.value),S.URLParams.update(t.props.componentId,t.setURLParam(l.value),t.props.URLParams),S.selectedSensor.set(l,!0)}t.setRangeValue()}if(e.stepValue!==t.props.stepValue){var c=(n.end-n.start)%e.stepValue;if(c){t.setState({values:{min:t.state.values.min,max:n.end-c}});var p={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-c}};t.props.onValueChange&&t.props.onValueChange(p.value),S.URLParams.update(t.props.componentId,t.setURLParam(p.value),t.props.URLParams),S.selectedSensor.set(p,!0)}}},300)}},{key:"shouldComponentUpdate",value:function(e,t){return e.stepValue<=0||e.stepValue>Math.floor((e.range.end-e.range.start)/2)?(console.error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."),!1):!(t.values.max>t.endThreshold)}},{key:"componentWillUnmount",value:function(){this.channelId&&v["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setURLParam",value:function(e){return"from"in e&&"to"in e&&(e={start:e.from,end:e.to}),JSON.stringify(e)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField}},t={key:this.props.componentId+"-internal",value:{queryType:"range",inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};S.selectedSensor.setSensorInfo(e),S.selectedSensor.setSensorInfo(t),this.setRangeValue()}},{key:"setRangeValue",value:function(){var e={key:this.props.componentId+"-internal",value:this.props.range};this.props.onValueChange&&this.props.onValueChange(e.value),S.selectedSensor.set(e,!0)}},{key:"customQuery",value:function(e){if(e)return{range:a({},this.props.appbaseField,{gte:e.start,lte:e.end,boost:2})}}},{key:"histogramQuery",value:function(){return a({},this.props.appbaseField,{histogram:{field:this.props.appbaseField,interval:this.props.interval?this.props.interval:Math.ceil((this.props.range.end-this.props.range.start)/10)}})}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t.aggs={key:this.props.appbaseField,sort:"asc",size:1e3,customQuery:this.histogramQuery},t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.props.componentId+"-internal");var n=v["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery&&t.startTime>e.queryStartTime){e.queryStartTime=t.startTime?t.startTime:0;var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(n)}}),this.listenLoadingChannel(n)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"getSize",value:function(){return Math.min(this.props.range.end-this.props.range.start,this.maxSize)}},{key:"setData",value:function(e){try{this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}catch(t){console.log(t)}}},{key:"handleValuesChange",value:function(e,t){this.setState({values:t})}},{key:"countCalc",value:function(e,t,n){return n.map(function(e){return e.doc_count})}},{key:"addItemsToList",value:function(e){var t=this;e=k["default"].orderBy(e,["key"],["asc"]);var n=e.length,r=this.state.startThreshold?this.state.startThreshold:e[0].key,o=this.state.endThreshold?this.state.endThreshold:e[n-1].key;if(n>1){var a={counts:this.countCalc(r,o,e),startThreshold:r,endThreshold:o,values:{min:this.state.values.min,max:this.state.values.max}};this.setState(a,function(){k["default"].isEqual(a.values,t.state.currentValues)||t.handleResults(null,a.values)})}}},{key:"handleResults",value:function(e,t){var n=void 0;n=e?{min:e[0],max:e[1]}:t;var r={from:n.min,to:n.max},o={key:this.props.componentId,value:r};this.props.onValueChange&&this.props.onValueChange(o.value),S.URLParams.update(this.props.componentId,this.setURLParam(o.value),this.props.URLParams),S.selectedSensor.set(o,!0),this.setState({currentValues:n,values:n})}},{key:"render",value:function(){var e=null,t=null,n={};if(this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.counts&&this.state.counts.length&&this.props.showHistogram&&(t=p["default"].createElement(g.HistoGramComponent,{data:this.state.counts})),this.props.rangeLabels.start||this.props.rangeLabels.end){var r;r={},a(r,this.state.startThreshold,this.props.rangeLabels.start),a(r,this.state.endThreshold,this.props.rangeLabels.end),n=r}var o=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-labels-active":this.props.rangeLabels.start||this.props.rangeLabels.end,"rbc-labels-inactive":!this.props.rangeLabels.start&&!this.props.rangeLabels.end,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return p["default"].createElement("div",{className:"rbc rbc-rangeslider card thumbnail col s12 col-xs-12 "+o,style:this.props.componentStyle},e,t,p["default"].createElement("div",{className:"rbc-rangeslider-container col s12 col-xs-12"},p["default"].createElement(f["default"],{range:!0,value:[this.state.values.min,this.state.values.max],min:this.state.startThreshold,max:this.state.endThreshold,onChange:this.handleResults,step:this.props.stepValue,marks:n})),this.props.initialLoader&&this.state.queryStart?p["default"].createElement(b["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(c.Component);t["default"]=P,P.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),range:p["default"].PropTypes.shape({start:S.validateThreshold,end:S.validateThreshold}),rangeLabels:p["default"].PropTypes.shape({start:p["default"].PropTypes.string,end:p["default"].PropTypes.string}),defaultSelected:p["default"].PropTypes.shape({start:p["default"].PropTypes.number,end:p["default"].PropTypes.number}),stepValue:S.stepValidation,showHistogram:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,interval:p["default"].PropTypes.number,URLParams:p["default"].PropTypes.bool},P.defaultProps={title:null,range:{start:0,end:10},rangeLabels:{start:"",end:""},defaultSelected:{start:0,end:10},stepValue:1,showHistogram:!0,componentStyle:{},URLParams:!1},P.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},P.types={componentId:M.STRING,appbaseField:M.STRING,appbaseFieldType:M.NUMBER,title:M.STRING,react:M.OBJECT,range:M.OBJECT,rangeLabels:M.OBJECT,defaultSelected:M.OBJECT,stepValue:M.NUMBER,showHistogram:M.BOOLEAN,customQuery:M.FUNCTION,initialLoader:M.OBJECT,componentStyle:M.OBJECT,interval:M.NUMBER,URLParams:M.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(e[t]<1||e[t]>1e3)&&(n=new Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=new Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]<=0&&(n=new Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=new Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start<=0&&(r=new Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return!isNaN(e[t])&&r>=e.defaultSelected&&o<=e.defaultSelected||(n=new Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return e[t]<0&&(n=new Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=new Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n'],post_tags:[""],fields:e}}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.defaultSearchQuery}};this.props.highlight&&(e.value.externalQuery=this.highlightQuery()),w.selectedSensor.setSensorInfo(e);var t={key:this.searchInputId,value:{queryType:"multi_match",inputData:this.props.appbaseField,customQuery:this.defaultSearchQuery}};w.selectedSensor.setSensorInfo(t)}},{key:"setValue",value:function(e){var t={key:this.searchInputId,value:e};w.URLParams.update(this.props.componentId,e,this.props.URLParams),w.selectedSensor.set(t,!0),e&&""!==e.trim()?this.setState({options:[{label:e,value:e}],isLoadingOptions:!0,currentValue:e}):this.setState({options:[],isLoadingOptions:!1,currentValue:e})}},{key:"getValue",value:function(e,t){var n=void(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0);return M["default"].has(t,e)?n=t[e]:e.indexOf(".")>-1&&!function(){var r="",o=e.split(".");o.forEach(function(e,a){r+=e,M["default"].isArray(M["default"].get(t,r))&&(r+="["+a+"]"),o.length-1!==a?r+=".":n=M["default"].get(t,r)})}(),n}},{key:"setData",value:function(e){var t=this,n=[];M["default"].isArray(this.props.appbaseField)?this.props.appbaseField:[this.props.appbaseField],e.hits.hits.map(function(e){if("string"===t.fieldType){var r=t.getValue(t.props.appbaseField.trim(),e._source);n.push({value:r,label:r})}else"object"===t.fieldType&&t.props.appbaseField.map(function(r){var o=t.getValue(r,e._source);o&&n.push({value:o,label:o})})}),this.state.currentValue&&""!==this.state.currentValue.trim()&&n.unshift({label:this.state.currentValue,value:this.state.currentValue}),n=this.removeDuplicates(n,"label"),this.setState({options:n,isLoadingOptions:!1})}},{key:"defaultSearchQuery",value:function(e){var t=null,n=void 0;return e&&(n="string"===this.fieldType?[this.props.appbaseField]:this.props.appbaseField,t={bool:{should:[{multi_match:{query:e,fields:n,type:"phrase_prefix"}},{multi_match:{query:e,fields:n}}],minimum_should_match:"1"}}),t}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.searchInputId);var n=g["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({rawData:r}),e.props.autocomplete&&e.setData(r)})}},{key:"checkDefault",value:function(){this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultValue&&this.defaultSelected!=this.defaultValue&&(this.defaultSelected=this.defaultValue,setTimeout(this.setValue.bind(this,this.defaultSelected),100),this.handleSearch({value:this.defaultSelected}))}},{key:"handleSearch",value:function(e){var t=e?e.value:null;t="null"===t?null:t;var n={key:this.props.componentId,value:t};w.selectedSensor.set(n,!0),this.setState({currentValue:t})}},{key:"handleInputChange",value:function(e){var t=e.target.value;this.setState({currentValue:t});var n={key:this.props.componentId,value:t};this.props.onValueChange&&this.props.onValueChange(n.value);var r=!0;w.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=d["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,y["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-autocomplete-active":this.props.autocomplete,"rbc-autocomplete-inactive":!this.props.autocomplete});return d["default"].createElement("div",{className:"rbc rbc-datasearch col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},e,this.props.autocomplete?d["default"].createElement(h["default"],u({isLoading:this.state.isLoadingOptions,value:this.state.currentValue,options:this.state.options,onInputChange:this.setValue,onChange:this.handleSearch,onBlurResetsInput:!1},this.props)):d["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},d["default"].createElement("input",{type:"text",className:"rbc-input",placeholder:this.props.placeholder,value:this.state.currentValue?this.state.currentValue:"",onChange:this.handleInputChange}),d["default"].createElement("span",{className:"rbc-search-icon"})))}}]),t}(p.Component);t["default"]=k,k.propTypes={componentId:d["default"].PropTypes.string.isRequired,appbaseField:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),title:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.element]),placeholder:d["default"].PropTypes.string,autocomplete:d["default"].PropTypes.bool,defaultSelected:d["default"].PropTypes.string,customQuery:d["default"].PropTypes.func,onValueChange:d["default"].PropTypes.func,react:d["default"].PropTypes.object,componentStyle:d["default"].PropTypes.object,highlight:d["default"].PropTypes.bool,highlightFields:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),URLParams:d["default"].PropTypes.bool},k.defaultProps={placeholder:"Search",autocomplete:!0,componentStyle:{},highlight:!1,URLParams:!1},k.contextTypes={appbaseRef:d["default"].PropTypes.any.isRequired,type:d["default"].PropTypes.any.isRequired},k.types={componentId:b.STRING,appbaseField:b.STRING,appbaseFieldType:b.STRING,react:b.OBJECT,title:b.STRING,placeholder:b.STRING,autocomplete:b.BOOLEAN,defaultSelected:b.STRING,customQuery:b.FUNCTION,componentStyle:b.OBJECT,highlight:b.BOOLEAN,URLParams:b.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&setTimeout(this.handleChange.bind(this,t),1e3)}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!_["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t;var n=e.state.data.filter(function(t){ +return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&(null!==e.urlParams?e.handleChange(n):setTimeout(e.handleChange.bind(e,n),1e3))}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};b.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){if(e.length>0)return e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}})}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}}},{key:"handleChange",value:function(e){var t=[];t=e.map(function(e){return e.label}),t=t.join(),this.setState({selected:t});var n={key:this.props.componentId,value:e},r=!0;this.props.onValueChange&&this.props.onValueChange(n.value),b.URLParams.update(this.props.componentId,t,this.props.URLParams),b.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return p["default"].createElement("div",{className:"rbc rbc-multidropdownrange col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"col s12 col-xs-12"},p["default"].createElement(f["default"],{options:this.state.data,value:this.state.selected,onChange:this.handleChange,clearable:!1,multi:!0,placeholder:this.props.placeholder,searchable:!0}))))}}]),t}(c.Component);t["default"]=T,T.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),placeholder:p["default"].PropTypes.string,data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},T.defaultProps={URLParams:!1},T.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},T.types={componentId:v.STRING,appbaseField:v.STRING,appbaseFieldType:v.NUMBER,data:v.OBJECT,defaultSelected:v.ARRAY,title:v.STRING,placeholder:v.STRING,customQuery:v.FUNCTION,componentStyle:v.OBJECT,URLParams:v.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&(null!==this.urlParams?this.handleChange(t):setTimeout(this.handleChange.bind(this,t),1e3))}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!v["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t,e.resetState();var n=e.props.data.filter(function(e){return t.indexOf(e.label)>-1});n&&n.length&&setTimeout(e.handleChange.bind(e,n),1e3)}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.length>0?e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}}):null}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}return null}},{key:"handleChange",value:function(e){function t(e,t,o){o.label===e.label&&(r=t,n.splice(t,1))}var n=this.state.selected,r=null,o=e;v["default"].isArray(e)||(o=[e]),o.forEach(function(e){n.forEach(function(n,r){t(n,r,e)})}),null===r&&o.forEach(function(e){n.push(e)}),this.setState({selected:n});var a={key:this.props.componentId,value:n},i=!0;this.props.onValueChange&&this.props.onValueChange(a.value),g.URLParams.update(this.props.componentId,this.getSelectedLabels(n),this.props.URLParams),g.selectedSensor.set(a,i)}},{key:"getSelectedLabels",value:function(e){return e.map(function(e){return e.label})}},{key:"resetState",value:function(){this.setState({selected:[]});var e={key:this.props.componentId,value:[]},t=!0;g.URLParams.update(this.props.componentId,null,this.props.URLParams),g.selectedSensor.set(e,t)}},{key:"handleTagClick",value:function(e){var t=this.state.selected.filter(function(t){return t.label===e});this.handleChange(t[0])}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t){return p["default"].createElement("div",{className:"rbc-list-item row",key:t.label,onClick:function(){return e.handleChange(t)}},p["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:n.indexOf(t.label)>-1,value:t.label}),p["default"].createElement("label",{className:"rbc-label"},t.label))})),t}},{key:"render",value:function(){var e=this,t=null,n=[];this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.selected&&this.state.selected.forEach(function(t){n.push(p["default"].createElement(b,{key:t.label,value:t.label,onClick:e.handleTagClick}))});var r=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return p["default"].createElement("div",{className:"rbc rbc-multirange col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},t,p["default"].createElement("div",{className:"col s12 col-xs-12 rbc-list-container"},n.length?p["default"].createElement("div",{className:"row",style:{marginTop:"0"}},n):null,this.renderButtons())))}}]),t}(c.Component);t["default"]=_;var b=function(e){return p["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},p["default"].createElement("a",{className:"close"},"×"),p["default"].createElement("span",null,e.value))};b.propTypes={onClick:p["default"].PropTypes.func.isRequired,value:p["default"].PropTypes.string.isRequired},_.propTypes={appbaseField:p["default"].PropTypes.string.isRequired,componentId:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nr;return p["default"].createElement("div",{className:"rbc-numberbox-container col s12 col-xs-12"},p["default"].createElement("div",{className:"rbc-label"},t),p["default"].createElement("div",{className:"rbc-numberbox-btn-container"},p["default"].createElement(g,{isActive:s,handleChange:o,type:"minus"}),p["default"].createElement("span",{className:"rbc-numberbox-number"},a),p["default"].createElement(g,{isActive:i,handleChange:o,type:"plus"})))},b=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),o=r.props.focused;r.urlParams=y.URLParams.get(r.props.componentId);var a=null!==r.urlParams?r.urlParams:r.props.defaultSelected;return r.state={currentValue:a?a:r.props.data.start,focused:o},r.type="term",r.handleChange=r.handleChange.bind(r),r.customQuery=r.customQuery.bind(r),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.setQueryInfo(),null!==this.urlParams?this.updateQuery(this.urlParams):setTimeout(this.handleChange.bind(this),1e3)}},{key:"componentWillReceiveProps",value:function(e){var t=this;setTimeout(function(){var n=null!==t.urlParams?t.urlParams:t.props.defaultSelected;!n&&0!==n||n===t.state.currentValue||t.setState({currentValue:n}),e.queryFormat!==t.queryFormat&&(t.queryFormat=e.queryFormat,t.updateQuery())},300)}},{key:"customQuery",value:function(e){var t=null;if(e&&(e.value||0===e.value)){var n=e.value;switch(this.props.queryFormat){case"exact":t=this.exactQuery(n);break;case"lte":t=this.lteQuery(n);break;case"gte":default:t=this.gteQuery(n)}}return t}},{key:"exactQuery",value:function(e){return a({},this.type,a({},this.props.appbaseField,e))}},{key:"gteQuery",value:function(e){return{range:a({},this.props.appbaseField,{gte:e,boost:2})}}},{key:"lteQuery",value:function(e){return{range:a({},this.props.appbaseField,{lte:e,boost:2})}}},{key:"setQueryInfo",value:function(){var e=this.props,t=e.componentId,n=e.appbaseField,r={key:t,value:{queryType:this.type,inputData:n,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};y.selectedSensor.setSensorInfo(r)}},{key:"handleChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.props,n=(t.componentId,t.data),r=n.start,o=n.end,a=this.state.currentValue;r=void 0!=r?r:a-1,o=void 0!=o?o:a+1,e>0&&ar&&(a-=1),this.setState({currentValue:a},this.updateQuery.bind(this))}},{key:"updateQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.start.currentValue,t={key:this.props.componentId,value:{value:e,queryFormat:this.props.queryFormat}};this.props.onValueChange&&this.props.onValueChange(t.value),y.URLParams.update(this.props.componentId,e,this.props.URLParams),y.selectedSensor.set(t,!0)}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.data,r=e.labelPosition,o=this.state.currentValue,a=t?p["default"].createElement(v,{title:t}):null,i=(0,f["default"])({"rbc-title-active":t,"rbc-title-inactive":!t});return p["default"].createElement("div",{className:"rbc rbc-numberbox col s12 col-xs-12 card thumbnail "+i+" rbc-label-"+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},a,p["default"].createElement(_,{handleChange:this.handleChange,value:o,label:n.label,start:n.start,end:n.end})))}}]),t}(c.Component);t["default"]=b,b.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.shape({start:y.validateThreshold,end:y.validateThreshold,label:p["default"].PropTypes.string}),defaultSelected:y.valueValidation,labelPosition:p["default"].PropTypes.oneOf(["top","bottom","left","right"]),customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,queryFormat:p["default"].PropTypes.oneOf(["exact","gte","lte"]),URLParams:p["default"].PropTypes.bool},b.defaultProps={componentStyle:{},queryFormat:"gte",URLParams:!1},b.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},b.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.NUMBER,labelPosition:m.STRING,customQuery:m.FUNCTION,componentStyle:m.OBJECT,queryFormat:m.STRING,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=n.end){var r=(n.end-n.start)%e.stepValue;r?!function(){t.setState({values:{min:t.state.values.min,max:n.end-r}});var e={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-r}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(e.value),S.URLParams.update(t.props.componentId,t.setURLParam(e.value),t.props.URLParams),S.selectedSensor.set(e,!0)},1e3)}():!function(){var e={};e.min=n.start,e.max=n.end,t.setState({values:e,currentValues:e});var r={key:t.props.componentId,value:{from:e.min,to:e.max}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(r.value),S.URLParams.update(t.props.componentId,t.setURLParam(r.value),t.props.URLParams),S.selectedSensor.set(r,!0)},1e3)}()}if(e.range.start!==t.state.startThreshold||e.range.end!==t.state.endThreshold){if(e.range.start<=n.start&&e.range.end>=n.end)t.setState({startThreshold:e.range.start,endThreshold:e.range.end});else{var o={min:t.state.values.min,max:t.state.values.max};t.state.values.mine.range.end&&(o.max=e.range.end),t.setState({startThreshold:e.range.start,endThreshold:e.range.end,values:o});var a={from:o.min,to:o.max},i={key:t.props.componentId,value:a};t.props.onValueChange&&t.props.onValueChange(i.value),S.URLParams.update(t.props.componentId,t.setURLParam(i.value),t.props.URLParams),S.selectedSensor.set(i,!0)}t.setRangeValue()}if(e.stepValue!==t.props.stepValue){var s=(n.end-n.start)%e.stepValue;if(s){t.setState({values:{min:t.state.values.min,max:n.end-s}});var u={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-s}};t.props.onValueChange&&t.props.onValueChange(u.value),S.URLParams.update(t.props.componentId,t.setURLParam(u.value),t.props.URLParams),S.selectedSensor.set(u,!0)}}},300)}},{key:"shouldComponentUpdate",value:function(e,t){return e.stepValue<=0||e.stepValue>Math.floor((e.range.end-e.range.start)/2)?(console.error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."),!1):!(t.values.max>t.endThreshold)}},{key:"componentWillUnmount",value:function(){this.channelId&&v["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setURLParam",value:function(e){return"from"in e&&"to"in e&&(e={start:e.from,end:e.to}),JSON.stringify(e)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField}},t={key:this.props.componentId+"-internal",value:{queryType:"range",inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};S.selectedSensor.setSensorInfo(e),S.selectedSensor.setSensorInfo(t),this.setRangeValue()}},{key:"setRangeValue",value:function(){var e={key:this.props.componentId+"-internal",value:this.props.range};this.props.onValueChange&&this.props.onValueChange(e.value),S.selectedSensor.set(e,!0)}},{key:"customQuery",value:function(e){if(e)return{range:a({},this.props.appbaseField,{gte:e.start,lte:e.end,boost:2})}}},{key:"histogramQuery",value:function(){return a({},this.props.appbaseField,{histogram:{field:this.props.appbaseField,interval:this.props.interval?this.props.interval:Math.ceil((this.props.range.end-this.props.range.start)/10)}})}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t.aggs={key:this.props.appbaseField,sort:"asc",size:1e3,customQuery:this.histogramQuery},t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.props.componentId+"-internal");var n=v["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery&&t.startTime>e.queryStartTime){e.queryStartTime=t.startTime?t.startTime:0;var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(n)}}),this.listenLoadingChannel(n)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"getSize",value:function(){return Math.min(this.props.range.end-this.props.range.start,this.maxSize)}},{key:"setData",value:function(e){try{this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}catch(t){console.log(t)}}},{key:"handleValuesChange",value:function(e,t){this.setState({values:t})}},{key:"countCalc",value:function(e,t,n){return n.map(function(e){return e.doc_count})}},{key:"addItemsToList",value:function(e){var t=this;e=k["default"].orderBy(e,["key"],["asc"]);var n=e.length,r=this.state.startThreshold?this.state.startThreshold:e[0].key,o=this.state.endThreshold?this.state.endThreshold:e[n-1].key;n>1&&!function(){var n={counts:t.countCalc(r,o,e),startThreshold:r,endThreshold:o,values:{min:t.state.values.min,max:t.state.values.max}};t.setState(n,function(){k["default"].isEqual(n.values,t.state.currentValues)||t.handleResults(null,n.values)})}()}},{key:"handleResults",value:function(e,t){var n=void 0;n=e?{min:e[0],max:e[1]}:t;var r={from:n.min,to:n.max},o={key:this.props.componentId,value:r};this.props.onValueChange&&this.props.onValueChange(o.value),S.URLParams.update(this.props.componentId,this.setURLParam(o.value),this.props.URLParams),S.selectedSensor.set(o,!0),this.setState({currentValues:n,values:n})}},{key:"render",value:function(){var e=null,t=null,n={};if(this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.counts&&this.state.counts.length&&this.props.showHistogram&&(t=p["default"].createElement(g.HistoGramComponent,{data:this.state.counts})),this.props.rangeLabels.start||this.props.rangeLabels.end){var r;r={},a(r,this.state.startThreshold,this.props.rangeLabels.start),a(r,this.state.endThreshold,this.props.rangeLabels.end),n=r}var o=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-labels-active":this.props.rangeLabels.start||this.props.rangeLabels.end,"rbc-labels-inactive":!this.props.rangeLabels.start&&!this.props.rangeLabels.end,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return p["default"].createElement("div",{className:"rbc rbc-rangeslider card thumbnail col s12 col-xs-12 "+o,style:this.props.componentStyle},e,t,p["default"].createElement("div",{className:"rbc-rangeslider-container col s12 col-xs-12"},p["default"].createElement(f["default"],{range:!0,value:[this.state.values.min,this.state.values.max],min:this.state.startThreshold,max:this.state.endThreshold,onChange:this.handleResults,step:this.props.stepValue,marks:n})),this.props.initialLoader&&this.state.queryStart?p["default"].createElement(b["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(c.Component);t["default"]=P,P.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),range:p["default"].PropTypes.shape({start:S.validateThreshold,end:S.validateThreshold}),rangeLabels:p["default"].PropTypes.shape({start:p["default"].PropTypes.string,end:p["default"].PropTypes.string}),defaultSelected:p["default"].PropTypes.shape({start:p["default"].PropTypes.number,end:p["default"].PropTypes.number}),stepValue:S.stepValidation,showHistogram:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,interval:p["default"].PropTypes.number,URLParams:p["default"].PropTypes.bool},P.defaultProps={title:null,range:{start:0,end:10},rangeLabels:{start:"",end:""},defaultSelected:{start:0,end:10},stepValue:1,showHistogram:!0,componentStyle:{},URLParams:!1},P.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},P.types={componentId:M.STRING,appbaseField:M.STRING,appbaseFieldType:M.NUMBER,title:M.STRING,react:M.OBJECT,range:M.OBJECT,rangeLabels:M.OBJECT,defaultSelected:M.OBJECT,stepValue:M.NUMBER,showHistogram:M.BOOLEAN,customQuery:M.FUNCTION,initialLoader:M.OBJECT,componentStyle:M.OBJECT,interval:M.NUMBER,URLParams:M.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&t.forEach(function(t){null!==e.urlParams?e.handleChange(t):setTimeout(e.handleChange.bind(e,t),1e3)})}}},{key:"componentWillUpdate",value:function(){var e=this,t=null!==this.urlParams?this.urlParams:this.props.defaultSelected;if(this.defaultSelected!=t){this.defaultSelected=t,this.defaultSelected=v["default"].isArray(this.defaultSelected)?this.defaultSelected:[this.defaultSelected];var n=this.props.data.filter(function(t){return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&n.forEach(function(t){setTimeout(e.handleChange.bind(e,t),1e3)})}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.map(function(e,n){return{term:a({},t,e.value)}})}var n=null;return e&&e.length?n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}}:n}},{key:"handleChange",value:function(e){var t=this.state.selected,n=[],r=null;t.forEach(function(n,o){e.label===n.label&&(r=o,t.splice(o,1))}),null===r?this.props.multiSelect?(t.push(e),n=t):n.push(e):n=t,this.setState({selected:n});var o={key:this.props.componentId,value:n},a=!0;this.props.onValueChange&&this.props.onValueChange(o.value),g.URLParams.update(this.props.componentId,this.setURLValue(n),this.props.URLParams),g.selectedSensor.set(o,a)}},{key:"setURLValue",value:function(e){return e.map(function(e){return e.label})}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t,r){return p["default"].createElement("button",{key:r,className:"btn rbc-btn "+(n.indexOf(t.label)>-1?"rbc-btn-active":"rbc-btn-inactive"),onClick:function(){return e.handleChange(t)},title:t.title?t.title:t.label},t.label)})),t}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-multiselect-active":this.props.multiSelect,"rbc-multiselect-inactive":!this.props.multiSelect});return p["default"].createElement("div",{className:"rbc rbc-togglebutton col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"rbc-buttongroup col s12 col-xs-12"},this.renderButtons())))}}]),t}(c.Component);t["default"]=_,_.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.oneOfType([p["default"].PropTypes.array,p["default"].PropTypes.string]),multiSelect:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={multiSelect:!0,componentStyle:{},URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.KEYWORD,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,multiSelect:m.BOOLEAN,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]&&arguments[0];this.setGeoQueryInfo(),this.createChannel(e);var t=this.getMapStyle(this.props.defaultMapStyle);this.initialMapBoundQuery=!!this.props.defaultCenter,this.applyGeoQuery=this.props.applyGeoQuery?this.props.applyGeoQuery:this.props.setSearchAsMove,this.setState({currentMapStyle:t})}},{key:"componentWillReceiveProps",value:function(e){e.defaultMapStyle!==this.props.defaultMapStyle&&this.mapStyleChange(this.getMapStyle(e.defaultMapStyle))}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){e.streamProp!==e.props.stream&&(e.streamProp=e.props.stream,e.removeChannel(),e.initialize()),e.sizeProp!==e.props.size&&(e.sizeProp=e.props.size,e.removeChannel(),e.initialize(!0))},300)}},{key:"componentWillUnmount",value:function(){this.removeChannel()}},{key:"removeChannel",value:function(){this.channelId&&(_.AppbaseChannelManager.stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove()}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and?"string"==typeof t.and&&(t.and=[t.and]):t.and=[],t.or=t.or?t.or:[],t.or.push("geoQuery"),t.and.push("streamChanges");var n=_.AppbaseChannelManager.create(this.context.appbaseRef,this.context.type,t,this.props.size,this.props.from,this.props.stream);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){function n(){"historic"===t.mode&&t.startTime>this.queryStartTime?this.afterChannelResponse(t):"streaming"===t.mode&&this.afterChannelResponse(t)}function r(){if(t.error&&t.startTime>this.queryStartTime){if(this.props.onAllData){var e=_.AppbaseSensorHelper.prepareResultData(t);this.props.onAllData(e.res,e.err)}}else t.appliedQuery&&(this.state.mapBounds?this.props.autoMapRender?n.call(this):o.hits.hits.length&&n.call(this):n.call(this))}var o=t.data;r.call(e)});var r={key:"streamChanges",value:""};_.AppbaseSensorHelper.selectedSensor.set(r,!0)}},{key:"afterChannelResponse",value:function(e){var t=this,n=w.afterChannelResponse(e,this.state.rawData,this.props.appbaseField,this.state.markersData);this.reposition=!0,this.streamFlag=n.streamFlag,this.queryStartTime=n.queryStartTime?n.queryStartTime:0,this.setState({rawData:n.rawData,markersData:n.markersData},function(){if(t.props.onAllData){e.allMarkers=n.rawData;var r=JSON.parse(JSON.stringify(e));if(r.newData=n.newData,r.currentData=n.currentData,delete r.data,r=_.AppbaseSensorHelper.prepareResultData(r,e.data),t.props.onAllData){r.res&&(r.res.mapRef=t.mapRef);var o=t.props.onAllData(r.res,r.err);t.setState({externalData:o})}}t.streamFlag&&t.streamMarkerInterval()})}},{key:"setGeoQueryInfo",value:function(){var e={key:"geoQuery",value:{queryType:"geo_bounding_box",inputData:this.props.appbaseField,customQuery:this.geoCustomQuery}},t={key:"updateExecute",value:{queryType:"random",inputData:this.props.appbaseField}};_.AppbaseSensorHelper.selectedSensor.setSensorInfo(e),_.AppbaseSensorHelper.selectedSensor.setSensorInfo(t)}},{key:"geoCustomQuery",value:function(e){var t=null;return e&&(this.initialMapBoundQuery||this.searchAsMove)&&(t={geo_bounding_box:a({},this.props.appbaseField,e)},this.geoRelatedEventsChange?this.geoRelatedEventsChange=!1:this.applyGeoQuery&&(this.applyGeoQuery=!1),this.initialMapBoundQuery=!1),t}},{key:"updateExecute",value:function(){setTimeout(function(){var e={key:"updateExecute",value:Math.random()};_.AppbaseSensorHelper.selectedSensor.set(e,!0)},1e3)}},{key:"handleMarkerClick",value:function(e){var t=this;e.showInfo=!0,this.reposition=!1,this.setState({rerender:!0},function(){t.props.popoverTTL&&t.watchPopoverTTL(e)})}},{key:"handleMarkerClose",value:function(e){e.showInfo=!1,this.reposition=!1,this.setState(this.state)}},{key:"watchPopoverTTL",value:function(e){var t=this;this.popoverTTLStore=this.popoverTTLStore?this.popoverTTLStore:{},this.popoverTTLStore[e._type+e._id]?this.clearTTL(e._type+e._id):this.popoverTTLStore[e._type+e._id]=setTimeout(function(){t.handleMarkerClose(e),t.clearTTL(e._type+e._id)},1e3*this.props.popoverTTL)}},{key:"clearTTL",value:function(e){clearTimeout(this.popoverTTLStore[e]),delete this.popoverTTLStore[e]}},{key:"renderInfoWindow",value:function(e,t){var n=this,r=this.props.onPopoverTrigger?this.props.onPopoverTrigger(t):"Popver";return f["default"].createElement(h.InfoWindow,{zIndex:500,key:e+"_info_window",onCloseclick:function(){return n.handleMarkerClose(t)}},f["default"].createElement("div",null,r))}},{key:"handleOnIdle",value:function(){var e=this.mapRef?this.mapRef.getBounds():null;if(e){var t=e.getNorthEast().lat(),n=e.getSouthWest().lat(),r=e.getNorthEast().lng(),o=e.getSouthWest().lng(),a={top_left:[o,t],bottom_right:[r,n]},i={mapBounds:e};if(this.props.onIdle){var s=this.props.onIdle(this.mapRef,{boundingBoxCoordinates:a,mapBounds:e});i.externalData=s}if(this.initialMapBoundQuery||this.applyGeoQuery||this.geoRelatedEventsChange&&this.searchAsMove&&!this.searchQueryProgress){var u=!!this.initialMapBoundQuery||(this.applyGeoQuery?this.applyGeoQuery:this.searchAsMove);this.setValue(a,u)}this.setState(i)}}},{key:"handleOnDrage",value:function(){this.storeCenter=null}},{key:"setValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={key:"geoQuery",value:e};_.AppbaseSensorHelper.selectedSensor.set(n,t)}},{key:"searchAsMoveChange",value:function(e){this.searchAsMove=e,e&&this.mapRef&&(this.geoRelatedEventsChange=!0,this.handleOnIdle())}},{key:"mapStyleChange",value:function(e){this.setState({currentMapStyle:e})}},{key:"handleBoundsChanged",value:function(){var e=this;this.searchQueryProgress&&setTimeout(function(){e.searchQueryProgress=!1},1e3)}},{key:"streamMarkerInterval",value:function(){var e=this,t=this.state.markersData,n=t.filter(function(e){return e.stream&&e.streamStart});n.length?(this.isStreamDataExists=!0,setTimeout(function(){return e.streamToNormal()},1e3*this.props.streamTTL)):this.isStreamDataExists=!1}},{key:"streamToNormal",value:function(){var e=this,t=this.state.markersData,n=t.filter(function(e){return e.stream&&e.streamStart});n.length?(t=t.map(function(t){if(t.stream&&t.streamStart){var n=new Date,r=(n.getTime()-t.streamStart.getTime())/1e3;r>=e.props.streamTTL&&(delete t.stream,delete t.streamStart)}return t}),this.setState({markersData:t})):this.isStreamDataExists=!1}},{key:"getIcon",value:function(e){return e.stream?this.props.streamMarkerImage:this.props.defaultMarkerImage}},{key:"chooseIcon",value:function(e){var t=e.external_icon?e.external_icon:this.getIcon(e);t=this.props.onData?this.props.onData(e):t;var n=!!("object"===("undefined"==typeof t?"undefined":c(t))&&"path"in t);if(n&&(t=JSON.parse(JSON.stringify(t)),this.props.autoMarkerPosition)){var r=e.angleDeg?e.angleDeg:0;t.rotation=r}return t}},{key:"combineProps",value:function(e){var t=void 0,n={};return this.state.externalData&&this.state.externalData.markers&&this.state.externalData.markers[e._id]&&(t=this.state.externalData.markers[e._id],Object.keys(t).forEach(function(r){e["external_"+r]=t[r],n[r]=t[r]})),n.icon=this.chooseIcon(e),n}},{key:"generateMarkers",value:function(){var e=this,t=this,n=this.state.markersData,r={markerComponent:[],defaultCenter:null,convertedGeo:[]};return n&&n.length&&(n=n.filter(function(e){return w.identifyGeoData(e._source[t.props.appbaseField])}),r.markerComponent=n.map(function(n,o){var a=w.identifyGeoData(n._source[t.props.appbaseField]);r.convertedGeo.push(a);var i={position:a},s="marker_ref_"+o,u=void 0;if(e.props.showPopoverOn){u={};var c=e.props.showPopoverOn.split("");c[0]=c[0].toUpperCase(),c=c.join(""),u["on"+c]=e.handleMarkerClick.bind(e,n)}else u={},u.onClick=e.handleMarkerClick.bind(e,n);var p=function(){},d={onClick:e.props.markerOnClick?e.props.markerOnClick:p,onDblclick:e.props.markerOnDblclick?e.props.markerOnDblclick:p,onMouseover:e.props.onMouseover?e.props.onMouseover:p,onMouseout:e.props.onMouseout?e.props.onMouseout:p};return f["default"].createElement(h.Marker,l({},i,{key:n._id,zIndex:1,ref:s},t.combineProps(n),{onClick:function(){return d.onClick(n._source)},onDblclick:function(){return d.onDblclick(n._source)},onMouseover:function(){return d.onMouseover(n._source)},onMouseout:function(){return d.onMouseout(n._source)}},u),n.showInfo?t.renderInfoWindow(s,n):null)}),r.convertedGeo[0]&&(r.defaultCenter={lat:r.convertedGeo[0].lat,lng:r.convertedGeo[0].lng})),this.props.showMarkers||(r.markerComponent=[]),r}},{key:"externalData",value:function(){var e=this,t=[];return this.state.externalData&&Object.keys(this.state.externalData).forEach(function(n){"markers"!==n&&(t=t.concat(e.state.externalData[n]))}),t}},{key:"mapEvents",value:function(e){if(this.geoRelatedEvents.indexOf(e)>-1&&(this.geoRelatedEventsChange=!0),this.props[e]){var t=this.props[e](this.mapRef);t&&this.setState({externalData:t})}}},{key:"getStoreCenter",value:function(){return this.storeCenter?this.storeCenter:this.state.center}},{key:"render",value:function(){var e=this,t=void 0,n=void 0,r=void 0,o=null,a=null,i={},s=this.generateMarkers();t=this.props.setMarkerCluster?f["default"].createElement(y["default"],{averageCenter:!0,enableRetinaIcons:!0,gridSize:60},s.markerComponent):s.markerComponent;var u=!0;"streaming"!==this.channelMethod||this.props.streamAutoCenter||(u=!1),this.props.autoCenter&&this.reposition&&u?(a=s.defaultCenter?s.defaultCenter:this.getStoreCenter(),this.storeCenter=a,this.reposition=!1,i.center=w.normalizeCenter(a)):this.storeCenter?(a=this.storeCenter,i.center=w.normalizeCenter(a)):a=null,this.props.showSearchAsMove&&(n=f["default"].createElement(b.SearchAsMove,{searchAsMoveDefault:this.props.setSearchAsMove,searchAsMoveChange:this.searchAsMoveChange})),this.props.showMapStyles&&(r=f["default"].createElement(T.MapStyles,{defaultSelected:this.props.defaultMapStyle,mapStyleChange:this.mapStyleChange})),this.props.title&&(o=f["default"].createElement("h4",{className:"rbc-title col s12 m8 col-xs-12 col-sm-8"},this.props.title));var c=(0,g["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return f["default"].createElement("div",{className:"rbc rbc-reactivemap col s12 col-xs-12 card thumbnail "+c,style:w.mapPropsStyles(this.props.componentStyle,"component")},o,r,f["default"].createElement(h.GoogleMapLoader,{containerElement:f["default"].createElement("div",{className:"rbc-container col s12 col-xs-12",style:w.mapPropsStyles(this.props.componentStyle,"map",this.mapDefaultHeight)}),googleMapElement:f["default"].createElement(h.GoogleMap,l({ref:function(t){ e.mapRef=t}},i,w.normalizeProps(this.props),{options:{styles:this.state.currentMapStyle},defaultCenter:w.normalizeCenter(this.state.defaultCenter),onDragstart:function(){e.handleOnDrage(),e.mapEvents("onDragstart")},onIdle:function(){return e.handleOnIdle()},onClick:function(){return e.mapEvents("onClick")},onDblclick:function(){return e.mapEvents("onDblclick")},onDrag:function(){return e.mapEvents("onDrag")},onDragend:function(){return e.mapEvents("onDragend")},onMousemove:function(){return e.mapEvents("onMousemove")},onMouseout:function(){return e.mapEvents("onMouseout")},onMouseover:function(){return e.mapEvents("onMouseover")},onResize:function(){return e.mapEvents("onResize")},onRightclick:function(){return e.mapEvents("onRightclick")},onTilesloaded:function(){return e.mapEvents("onTilesloaded")},onBoundsChanged:function(){return e.mapEvents("onBoundsChanged")},onCenterChanged:function(){return e.mapEvents("onCenterChanged")},onProjectionChanged:function(){return e.mapEvents("onProjectionChanged")},onTiltChanged:function(){return e.mapEvents("onTiltChanged")},onZoomChanged:function(){return e.mapEvents("onZoomChanged")}}),t,this.externalData())}),n,f["default"].createElement(_.PoweredBy,null))}}]),t}(d.Component);t["default"]=k,k.propTypes={appbaseField:f["default"].PropTypes.string.isRequired,onIdle:f["default"].PropTypes.func,onAllData:f["default"].PropTypes.func,onData:f["default"].PropTypes.func,onPopoverTrigger:f["default"].PropTypes.func,setMarkerCluster:f["default"].PropTypes.bool,autoMarkerPosition:f["default"].PropTypes.bool,showMarkers:f["default"].PropTypes.bool,streamTTL:w.validation.streamTTL,popoverTTL:w.validation.popoverTTL,size:_.AppbaseSensorHelper.sizeValidation,from:w.validation.fromValidation,autoMapRender:f["default"].PropTypes.bool,componentStyle:f["default"].PropTypes.object,autoCenter:f["default"].PropTypes.bool,showSearchAsMove:f["default"].PropTypes.bool,setSearchAsMove:f["default"].PropTypes.bool,defaultMapStyle:f["default"].PropTypes.oneOf(["Standard","Blue Essence","Blue Water","Flat Map","Light Monochrome","Midnight Commander","Unsaturated Browns"]),title:f["default"].PropTypes.oneOfType([f["default"].PropTypes.string,f["default"].PropTypes.element]),streamAutoCenter:f["default"].PropTypes.bool,defaultMarkerImage:f["default"].PropTypes.string,streamMarkerImage:f["default"].PropTypes.string,stream:f["default"].PropTypes.bool,defaultZoom:w.validation.defaultZoom,applyGeoQuery:f["default"].PropTypes.bool,showPopoverOn:f["default"].PropTypes.oneOf(["click","mouseover"]),defaultCenter:f["default"].PropTypes.shape({lat:w.validation.validCenter,lon:w.validation.validCenter}),react:f["default"].PropTypes.object,markerOnClick:f["default"].PropTypes.func,markerOnDblclick:f["default"].PropTypes.func,onMouseover:f["default"].PropTypes.func,onMouseout:f["default"].PropTypes.func,showMapStyles:f["default"].PropTypes.bool},k.defaultProps={setMarkerCluster:!0,autoCenter:!0,showSearchAsMove:!0,setSearchAsMove:!1,showMapStyles:!0,defaultMapStyle:"Standard",from:0,size:100,streamTTL:5,streamAutoCenter:!1,autoMarkerPosition:!1,showMarkers:!0,autoMapRender:!0,defaultMarkerImage:"https://opensource.appbase.io/reactivemaps/dist/images/historic-pin.png",streamMarkerImage:"https://opensource.appbase.io/reactivemaps/dist/images/stream-pin.png",componentStyle:{},stream:!1,applyGeoQuery:!1,defaultZoom:13},k.contextTypes={appbaseRef:f["default"].PropTypes.any.isRequired,type:f["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ItemCheckboxList=void 0;var s=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0],c[this.state.selectedValue].value);this.props.mapStyleChange(e)}},{key:"render",value:function(){var e=this.state.items.map(function(e,t){return l["default"].createElement("option",{value:t,key:t},e.key)});return l["default"].createElement("div",{className:"input-field col rbc-mapstyles pull-right right"},l["default"].createElement("select",{className:"browser-default form-control",onChange:this.handleSelect,value:this.state.selectedValue,name:"mapStyles",id:"mapStyles"},e))}}]),t}(u.Component);p.propTypes={},p.defaultProps={fieldName:"MapStyles"}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.SearchAsMove=void 0;var s=function(){function e(e,t){for(var n=0;n20)return new Error("zoom value should be an integer between 0 and 20.")},validCenter:function(e,t,n){return isNaN(e[t])?new Error(t+" value must be number"):"lat"===t&&(e[t]<-90||e[t]>90)?new Error(t+" value should be between -90 and 90."):"lng"===t&&(e[t]<-180||e[t]>180)?new Error(t+" value should be between -180 and 180."):void 0},fromValidation:function(e,t,n){if(e[t]<0)return new Error(t+" value should be greater than or equal to 0.")},streamTTL:function(e,t,n){if(e[t]<0||e[t]>1e3)return new Error(t+" should be a positive integer between 0 and 1000, counted in seconds for a streaming update to be visible.")},popoverTTL:function(e,t,n){if(e[t]<.1||e[t]>60)return new Error(t+" should be a positive integer between 1 and 60, counted in seconds for a popover to be visible.")}},t.normalizeCenter=function(e){return e&&e.lon&&(e.lng=e.lon),e});t.normalizeProps=function(e){var t=JSON.parse(JSON.stringify(e));return t.defaultCenter&&(t.defaultCenter=p(t.defaultCenter)),t.center&&(t.center=p(t.center)),t},t.mapPropsStyles=function(e,t,n){var r=JSON.parse(JSON.stringify(e)),o=void 0;return"component"===t?o=r:"map"===t&&(o={height:r.height?r.height:n}),o}},function(e,t){"use strict";e.exports=[{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#e0efef"}]},{featureType:"poi",elementType:"geometry.fill",stylers:[{visibility:"on"},{hue:"#1900ff"},{color:"#c0e8e8"}]},{featureType:"road",elementType:"geometry",stylers:[{lightness:100},{visibility:"simplified"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"transit.line",elementType:"geometry",stylers:[{visibility:"on"},{lightness:700}]},{featureType:"water",elementType:"all",stylers:[{color:"#7dcdcd"}]}]},function(e,t){"use strict";e.exports=[{featureType:"administrative",elementType:"labels.text.fill",stylers:[{color:"#444444"}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#f2f2f2"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"all",stylers:[{saturation:-100},{lightness:45}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"all",stylers:[{color:"#46bcec"},{visibility:"on"}]}]},function(e,t){"use strict";e.exports=[{featureType:"all",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"landscape",elementType:"all",stylers:[{visibility:"on"},{color:"#f3f4f4"}]},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{weight:.9},{visibility:"off"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#83cead"}]},{featureType:"road",elementType:"all",stylers:[{visibility:"on"},{color:"#ffffff"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"on"},{color:"#fee379"}]},{featureType:"road.arterial",elementType:"all",stylers:[{visibility:"on"},{color:"#fee379"}]},{featureType:"water",elementType:"all",stylers:[{visibility:"on"},{color:"#7fc8ed"}]}]},function(e,t){"use strict";e.exports=[{featureType:"administrative.locality",elementType:"all",stylers:[{hue:"#2c2e33"},{saturation:7},{lightness:19},{visibility:"on"}]},{featureType:"landscape",elementType:"all",stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100},{visibility:"simplified"}]},{featureType:"poi",elementType:"all",stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100},{visibility:"off"}]},{featureType:"road",elementType:"geometry",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:31},{visibility:"simplified"}]},{featureType:"road",elementType:"labels",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:31},{visibility:"on"}]},{featureType:"road.arterial",elementType:"labels",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:-2},{visibility:"simplified"}]},{featureType:"road.local",elementType:"geometry",stylers:[{hue:"#e9ebed"},{saturation:-90},{lightness:-8},{visibility:"simplified"}]},{featureType:"transit",elementType:"all",stylers:[{hue:"#e9ebed"},{saturation:10},{lightness:69},{visibility:"on"}]},{featureType:"water",elementType:"all",stylers:[{hue:"#e9ebed"},{saturation:-78},{lightness:67},{visibility:"simplified"}]}]},function(e,t){"use strict";e.exports=[{featureType:"all",elementType:"labels.text.fill",stylers:[{color:"#ffffff"}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{color:"#000000"},{lightness:13}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#144b53"},{lightness:14},{weight:1.4}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#08304b"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#0c4152"},{lightness:5}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#0b434f"},{lightness:25}]},{featureType:"road.arterial",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.arterial",elementType:"geometry.stroke",stylers:[{color:"#0b3d51"},{lightness:16}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#000000"}]},{featureType:"transit",elementType:"all",stylers:[{color:"#146474"}]},{featureType:"water",elementType:"all",stylers:[{color:"#021019"}]}]},function(e,t){"use strict";e.exports=[{featureType:"water",stylers:[{saturation:43},{lightness:-11},{hue:"#0088ff"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{hue:"#ff0000"},{saturation:-100},{lightness:99}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#808080"},{lightness:54}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{color:"#ece2d9"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#ccdca1"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#767676"}]},{featureType:"road",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]},{featureType:"poi",stylers:[{visibility:"off"}]},{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#b8cb93"}]},{featureType:"poi.park",stylers:[{visibility:"on"}]},{featureType:"poi.sports_complex",stylers:[{visibility:"on"}]},{featureType:"poi.medical",stylers:[{visibility:"on"}]},{featureType:"poi.business",stylers:[{visibility:"simplified"}]}]},function(e,t){"use strict";e.exports=[{elementType:"geometry",stylers:[{hue:"#ff4400"},{saturation:-68},{lightness:-4},{gamma:.72}]},{featureType:"road",elementType:"labels.icon"},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{hue:"#0077ff"},{gamma:3.1}]},{featureType:"water",stylers:[{hue:"#00ccff"},{gamma:.44},{saturation:-33}]},{featureType:"poi.park",stylers:[{hue:"#44ff00"},{saturation:-23}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{hue:"#007fff"},{gamma:.77},{saturation:65},{lightness:99}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{gamma:.11},{weight:5.6},{saturation:99},{hue:"#0091ff"},{lightness:-86}]},{featureType:"transit.line",elementType:"geometry",stylers:[{lightness:-48},{hue:"#ff5e00"},{gamma:1.2},{saturation:-23}]},{featureType:"transit",elementType:"labels.text.stroke",stylers:[{saturation:-64},{hue:"#ff9100"},{lightness:16},{gamma:.47},{weight:2.7}]}]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n=0&&e.end>=0&&""!==e.location){var n;t=o({},this.type,(n={},o(n,this.props.appbaseField,e.location),o(n,"from",e.start+this.unit),o(n,"to",e.end+this.unit),n))}return t}},{key:"getCoordinates",value:function(e,t){var n=this;e&&""!==e?m["default"].get("https://maps.googleapis.com/maps/api/geocode/json?address="+e).then(function(e){var r=e.data.results[0].geometry.location;n.locString=r.lat+", "+r.lng,t?t.call(n,n.defaultSelected.label):n.executeQuery()}):p.AppbaseSensorHelper.selectedSensor.set(null,!0)}},{key:"executeQuery",value:function(){if(""!==this.state.currentValue&&this.state.selected&&this.locString){var e,t={key:this.props.componentId,value:{currentValue:this.state.currentValue,start:this.state.selected.start,end:this.state.selected.end,location:this.locString,unit:this.unit}},n={key:this.props.componentId,value:o({},this.sortInfo.type,(e={},o(e,this.props.appbaseField,this.locString),o(e,"order",this.sortInfo.order),o(e,"unit",this.unit),e))};this.props.onValueChange&&this.props.onValueChange(t.value),p.AppbaseSensorHelper.selectedSensor.setSortInfo(n),p.AppbaseSensorHelper.URLParams.update(this.props.componentId,this.setURLValue(),this.props.URLParams),p.AppbaseSensorHelper.selectedSensor.set(t,!0)}}},{key:"setURLValue",value:function(){return JSON.stringify({location:this.state.currentValue,label:this.state.selected.label})}},{key:"handleChange",value:function(e){if(e){var t=e.value;this.setState({currentValue:t}),this.getCoordinates(t)}else{this.setState({currentValue:""});var n={key:this.props.componentId,value:null};this.props.onValueChange&&this.props.onValueChange(n.value),p.AppbaseSensorHelper.URLParams.update(this.props.componentId,null,this.props.URLParams),p.AppbaseSensorHelper.selectedSensor.set(n,!0)}}},{key:"loadOptions",value:function(e,t){var n=this;if(this.callback=t,e){var r=this.googleMaps||window.google.maps;this.autocompleteService=new r.places.AutocompleteService;var o={input:e};this.result={options:[]},this.autocompleteService.getPlacePredictions(o,function(e){e.forEach(function(e){n.result.options.push({label:e.description,value:e.description})}),n.state.userLocation.length&&"Use my current location"!==n.result.options[0].label&&n.result.options.unshift({label:"Use my current location",value:n.state.userLocation}),n.callback(null,n.result)})}else this.callback(null,this.result)}},{key:"handleDistanceChange",value:function(e){this.setState({selected:{start:e.start,end:e.end,label:e.label}},this.executeQuery.bind(this))}},{key:"renderValue",value:function(e){return c["default"].createElement("span",null,e.value)}},{key:"render",value:function(){var e=null;this.props.title&&(e=c["default"].createElement("h4",{className:"rbc-title"},this.props.title));var t=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return c["default"].createElement("div",{className:"rbc rbc-geodistancedropdown clearfix card thumbnail col s12 col-xs-12 "+t,style:this.props.componentStyle},c["default"].createElement("div",{className:"row"},e,c["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},c["default"].createElement(v["default"].Async,{value:this.state.currentValue,loadOptions:this.loadOptions,placeholder:this.props.placeholder,onChange:this.handleChange,filterOption:function(){return!0},valueRenderer:this.renderValue})),c["default"].createElement("div",{className:"col s12 col-xs-12"},c["default"].createElement(v["default"],{value:this.state.selected.label?this.state.selected:"",options:this.props.data,clearable:!1,searchable:!1,onChange:this.handleDistanceChange,placeholder:this.props.placeholderDropdown}))))}}]),t}(l.Component);t["default"]=_,_.propTypes={componentId:c["default"].PropTypes.string.isRequired,appbaseField:c["default"].PropTypes.string.isRequired,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]), customQuery:c["default"].PropTypes.func,defaultSelected:c["default"].PropTypes.shape({label:c["default"].PropTypes.string,location:c["default"].PropTypes.string}),placeholder:c["default"].PropTypes.string,placeholderDropdown:c["default"].PropTypes.string,autoLocation:c["default"].PropTypes.bool,unit:c["default"].PropTypes.oneOf(["mi","miles","yd","yards","ft","feet","in","inch","km","kilometers","m","meters","cm","centimeters","mm","millimeters","NM","nmi","nauticalmiles"]),data:c["default"].PropTypes.arrayOf(c["default"].PropTypes.shape({start:p.AppbaseSensorHelper.validateThreshold,end:p.AppbaseSensorHelper.validateThreshold,label:c["default"].PropTypes.string.isRequired})),onValueChange:c["default"].PropTypes.func,componentStyle:c["default"].PropTypes.object,URLParams:c["default"].PropTypes.bool},_.defaultProps={unit:"mi",placeholder:"Search...",placeholderDropdown:"Select Distance",autoLocation:!0,componentStyle:{},URLParams:!1},_.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n>8-a%1*8)){if(o=t.charCodeAt(a+=.75),o>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|o}return s}),n.atob||(n.atob=function(t){if(t=t.replace(/=+$/,""),t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,s="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?s+=String.fromCharCode(255&n>>(-2*a&6)):0)o=r.indexOf(o);return s})}()},function(e,t){"use strict";function n(){return!1}function r(){return!0}function o(){this.timeStamp=Date.now(),this.target=void 0,this.currentTarget=void 0}Object.defineProperty(t,"__esModule",{value:!0}),o.prototype={isEventObject:1,constructor:o,isDefaultPrevented:n,isPropagationStopped:n,isImmediatePropagationStopped:n,preventDefault:function(){this.isDefaultPrevented=r},stopPropagation:function(){this.isPropagationStopped=r},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=r,this.stopPropagation()},halt:function(e){e?this.stopImmediatePropagation():this.stopPropagation(),this.preventDefault()}},t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return null===e||void 0===e}function a(){return d}function i(){return f}function s(e){var t=e.type,n="function"==typeof e.stopPropagation||"boolean"==typeof e.cancelBubble;l["default"].call(this),this.nativeEvent=e;var r=i;"defaultPrevented"in e?r=e.defaultPrevented?a:i:"getPreventDefault"in e?r=e.getPreventDefault()?a:i:"returnValue"in e&&(r=e.returnValue===f?a:i),this.isDefaultPrevented=r;var o=[],s=void 0,u=void 0,c=void 0,p=h.concat();for(m.forEach(function(e){t.match(e.reg)&&(p=p.concat(e.props),e.fix&&o.push(e.fix))}),u=p.length;u;)c=p[--u],this[c]=e[c];for(!this.target&&n&&(this.target=e.srcElement||document),this.target&&3===this.target.nodeType&&(this.target=this.target.parentNode),u=o.length;u;)(s=o[--u])(this,e);this.timeStamp=e.timeStamp||Date.now()}Object.defineProperty(t,"__esModule",{value:!0});var u=n(411),l=r(u),c=n(9),p=r(c),d=!0,f=!1,h=["altKey","bubbles","cancelable","ctrlKey","currentTarget","eventPhase","metaKey","shiftKey","target","timeStamp","view","type"],m=[{reg:/^key/,props:["char","charCode","key","keyCode","which"],fix:function(e,t){o(e.which)&&(e.which=o(t.charCode)?t.keyCode:t.charCode),void 0===e.metaKey&&(e.metaKey=e.ctrlKey)}},{reg:/^touch/,props:["touches","changedTouches","targetTouches"]},{reg:/^hashchange$/,props:["newURL","oldURL"]},{reg:/^gesturechange$/i,props:["rotation","scale"]},{reg:/^(mousewheel|DOMMouseScroll)$/,props:[],fix:function(e,t){var n=void 0,r=void 0,o=void 0,a=t.wheelDelta,i=t.axis,s=t.wheelDeltaY,u=t.wheelDeltaX,l=t.detail;a&&(o=a/120),l&&(o=0-(l%3===0?l/3:l)),void 0!==i&&(i===e.HORIZONTAL_AXIS?(r=0,n=0-o):i===e.VERTICAL_AXIS&&(n=0,r=o)),void 0!==s&&(r=s/120),void 0!==u&&(n=-1*u/120),n||r||(r=o),void 0!==n&&(e.deltaX=n),void 0!==r&&(e.deltaY=r),void 0!==o&&(e.delta=o)}},{reg:/^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,props:["buttons","clientX","clientY","button","offsetX","relatedTarget","which","fromElement","toElement","offsetY","pageX","pageY","screenX","screenY"],fix:function(e,t){var n=void 0,r=void 0,a=void 0,i=e.target,s=t.button;return i&&o(e.pageX)&&!o(t.clientX)&&(n=i.ownerDocument||document,r=n.documentElement,a=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||a&&a.scrollLeft||0)-(r&&r.clientLeft||a&&a.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||a&&a.scrollTop||0)-(r&&r.clientTop||a&&a.clientTop||0)),e.which||void 0===s||(1&s?e.which=1:2&s?e.which=3:4&s?e.which=2:e.which=0),!e.relatedTarget&&e.fromElement&&(e.relatedTarget=e.fromElement===i?e.toElement:e.fromElement),e}}],y=l["default"].prototype;(0,p["default"])(s.prototype,y,{constructor:s,preventDefault:function(){var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=f,y.preventDefault.call(this)},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=d,y.stopPropagation.call(this)}}),t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){function r(t){var r=new i["default"](t);n.call(e,r)}return e.addEventListener?(e.addEventListener(t,r,!1),{remove:function(){e.removeEventListener(t,r,!1)}}):e.attachEvent?(e.attachEvent("on"+t,r),{remove:function(){e.detachEvent("on"+t,r)}}):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var a=n(412),i=r(a);e.exports=t["default"]},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;var o=t.type,a=t.body;delete t.type,delete t.body;var i;return i=o?o+"/_bulk":"/_bulk",e.performStreamingRequest({method:"POST",path:i,params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;delete t.type,delete t.id;var i=o+"/"+a;return e.performStreamingRequest({method:"DELETE",path:i,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;delete t.type,delete t.id;var i=o+"/"+a;return e.performStreamingRequest({method:"GET",path:i,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(140),o=function(e){var t=r.obj(function(e,t,n){var r=Object.keys(e)[0],o=Object.keys(e[r].mappings).filter(function(e){return"_default_"!==e});this.push(o),n()});return t.writable=!1,e.performStreamingRequest({method:"GET",path:"_mapping"}).pipe(t)};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",body:"object"});if(n!==!0)throw n;var o=t.type,a=t.id,i=t.body;delete t.type,delete t.id,delete t.body;var s;return s=a?o+"/"+a:o,e.performStreamingRequest({method:"POST",path:s,params:t,body:i})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;var o;o=t.type.constructor===Array?t.type.join():t.type;var a=t.body;delete t.type,delete t.body;var i;return i=o?o+"/_search":"/_search",e.performStreamingRequest({method:"POST",path:i,params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;return delete t.type,delete t.id,delete t.stream,t.stream===!0||"true"===t.stream?t.stream="true":(delete t.stream,t.streamonly="true"),e.performWsRequest({method:"GET",path:o+"/"+a,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;if(void 0===t.type||"string"!=typeof t.type&&t.type.constructor!==Array||""===t.type||0===t.type.length)throw new Error("fields missing: type");var o;o=t.type.constructor===Array?t.type.join():t.type;var o=t.type,a=t.body;return delete t.type,delete t.body,delete t.stream,t.streamonly="true",e.performWsRequest({method:"POST",path:o+"/_search",params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string",body:"object"});if(n!==!0)throw n;var o=t.type,a=t.id,i=t.body;delete t.type,delete t.id,delete t.body;var s=o+"/"+a+"/_update";return e.performStreamingRequest({method:"POST",path:s,params:t,body:i})};e.exports=o},function(e,t,n){"use strict";var r=n(565),o=n(34),a=function(e,t,n){var a=o.validate(t,{body:"object"});if(a!==!0)throw a;if(void 0===t.type||"string"!=typeof t.type&&t.type.constructor!==Array||""===t.type||0===t.type.length)throw new Error("fields missing: type");if(a=o.validate(t.body,{query:"object"}),a!==!0)throw a;if(t.type.constructor===Array?(this.type=t.type,this.type_string=t.type.join()):(this.type=[t.type],this.type_string=t.type),this.webhooks=[],this.client=e,this.query=t.body.query,"string"==typeof n){var i={};i.url=n,i.method="GET",this.webhooks.push(i)}else if(n.constructor===Array)this.webhooks=n;else{if(n!==Object(n))throw new Error("fields missing: second argument(webhook) is necessary");this.webhooks.push(n)}this.populateBody();var s=btoa(r(this.query)),u=".percolator/webhooks-0-"+this.type_string+"-0-"+s;return this.path=u,this.performRequest("POST")};a.prototype.populateBody=function(){this.body={},this.body.webhooks=this.webhooks,this.body.query=this.query,this.body.type=this.type},a.prototype.performRequest=function(e){var t=this.client.performStreamingRequest({method:e,path:this.path,body:this.body});return t.change=this.change.bind(this),t.stop=this.stop.bind(this),t},a.prototype.change=function(e){if(this.webhooks=[],"string"==typeof e){var t={};t.url=e,t.method="POST",this.webhooks.push(t)}else if(e.constructor===Array)this.webhooks=e;else{if(e!==Object(e))throw new Error("fields missing: one of webhook or url fields is required");this.webhooks.push(e)}return this.populateBody(),this.performRequest("POST")},a.prototype.stop=function(){return delete this.body,this.performRequest("DELETE")},e.exports=a},function(e,t,n){"use strict";var r=n(142),o=n(425),a=n(426),i=n(427),s=n(418),u=n(416),l=n(422),c=n(415),p=n(414),d=n(419),f=n(417),h=n(423),m=n(420),y=n(421),v=function g(e){if(!(this instanceof g))return new g(e);if("string"!=typeof e.url||""===e.url)throw new Error("URL not present in options.");var t=r.parse(e.url);if(this.url=t.host,this.protocol=t.protocol,this.credentials=t.auth,this.appname=e.appname||e.app,"string"!=typeof this.appname||""===this.appname)throw new Error("App name is not present in options.");if("string"!=typeof this.protocol||""===this.protocol)throw new Error("Protocol is not present in url. URL should be of the form https://scalr.api.appbase.io");if("string"==typeof e.username&&""!==e.username&&"string"==typeof e.password&&""!==e.password&&(this.credentials=e.username+":"+e.password),"string"==typeof e.credentials&&""!==e.credentials&&(this.credentials=e.credentials),"string"!=typeof this.credentials||""===this.credentials)throw new Error("Authentication information is not present. Did you add credentials?");"https:"===t.protocol?this.ws=new o("wss://"+t.host+"/"+this.appname):this.ws=new o("ws://"+t.host+"/"+this.appname),"/"===this.url.slice(-1)&&(this.url=this.url.slice(0,-1));var n={};return n.index=this.index.bind(this),n.get=this.get.bind(this),n.update=this.update.bind(this),n["delete"]=this["delete"].bind(this),n.bulk=this.bulk.bind(this),n.search=this.search.bind(this),n.getStream=this.getStream.bind(this),n.searchStream=this.searchStream.bind(this),n.searchStreamToURL=this.searchStreamToURL.bind(this),n.getTypes=this.getTypes.bind(this),n};v.prototype.performWsRequest=function(e){return new i(this,JSON.parse(JSON.stringify(e)))},v.prototype.performStreamingRequest=function(e){return new a(this,JSON.parse(JSON.stringify(e)))},v.prototype.index=function(e){return new s(this,JSON.parse(JSON.stringify(e)))},v.prototype.get=function(e){return new u(this,JSON.parse(JSON.stringify(e)))},v.prototype.update=function(e){return new l(this,JSON.parse(JSON.stringify(e)))},v.prototype["delete"]=function(e){return new c(this,JSON.parse(JSON.stringify(e)))},v.prototype.bulk=function(e){return new p(this,JSON.parse(JSON.stringify(e)))},v.prototype.search=function(e){return new d(this,JSON.parse(JSON.stringify(e)))},v.prototype.getStream=function(e){return new m(this,JSON.parse(JSON.stringify(e)))},v.prototype.searchStream=function(e){return new y(this,JSON.parse(JSON.stringify(e)))},v.prototype.searchStreamToURL=function(e,t){return new h(this,JSON.parse(JSON.stringify(e)),JSON.parse(JSON.stringify(t)))},v.prototype.getTypes=function(){return new f(this)},"undefined"!=typeof window&&(window.Appbase=v),e.exports=v},function(e,t,n){"use strict";var r="undefined"!=typeof window?window.WebSocket:n(748),o=n(36).EventEmitter,a=function(e){var t=new r(e),n=new o;return n.setMaxListeners(0),n.send=function(e){return 1===t.readyState?(t.send(JSON.stringify(e)),this):void n.on("open",function r(){t.send(JSON.stringify(e)),n.removeListener("open",r)})},t.onopen=function(){n.emit("open")},t.onmessage=function(e){var t=JSON.parse(e.data);n.emit("message",t)},t.onerror=function(e){n.emit("error",e)},t.onclose=function(e){n.emit("close",e)},n};e.exports=a},function(e,t,n){(function(t){"use strict";var r=n(553),o=n(733),a=n(113),i=n(140),s=function(e,t){if(this.client=e,this.args=t,this.method=t.method,this.path=t.path,this.params=t.params,this.body=t.body,(!this.body||"object"!=typeof this.body&&this.body.constructor!==Array)&&(this.body={}),this.body.constructor===Array){var n=this.body;this.body="";for(var r=0;r=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;ts.bottom||i.topt.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var n=this,r="object"==typeof t?t:this.props;if(r.multi){if("string"==typeof e&&(e=e.split(r.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return n.expandValue(e,r)}).filter(function(e){return e})}var o=this.expandValue(e,r);return o?[o]:[]},expandValue:function(e,t){var n=typeof e;if("string"!==n&&"number"!==n&&"boolean"!==n)return e;var r=t.options,o=t.valueKey;if(r)for(var a=0;ar&&this.focusOption(n[r+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var n=-1,r=0;r0?n-=1:n=t.length-1;else if("start"===e)n=0;else if("end"===e)n=t.length-1;else if("page_up"===e){var o=n-this.props.pageSize;n=o<0?0:o}else if("page_down"===e){var o=n+this.props.pageSize;n=o>t.length-1?t.length-1:o}n===-1&&(n=0),this.setState({focusedIndex:t[n].index,focusedOption:t[n].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return l["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},l["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var n=this,r=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:l["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var a=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return l["default"].createElement(o,{id:n._instancePrefix+"-value-"+t,instancePrefix:n._instancePrefix,disabled:n.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[n.props.valueKey],onClick:a,onRemove:n.removeValue,value:e},r(e,t),l["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(a=null),l["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:a,value:e[0]},r(e[0])))},renderInput:function(e,t){var n,r=this,i=(0,m["default"])("Select-input",this.props.inputProps.className),u=!!this.state.isOpen,c=(0,m["default"])((n={},a(n,this._instancePrefix+"-list",u),a(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),p=s({},this.props.inputProps,{role:"combobox","aria-expanded":""+u,"aria-owns":c,"aria-haspopup":""+u,"aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:i,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(p);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,h=(d.inputClassName,o(d,["inputClassName"]));return l["default"].createElement("div",s({},h,{role:"combobox","aria-expanded":u,"aria-owns":u?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:i,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?l["default"].createElement(f["default"],s({},p,{minWidth:"5"})):l["default"].createElement("div",{className:i},l["default"].createElement("input",p))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return l["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,n=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return l["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},n)},filterOptions:function N(e){var t=this.state.inputValue,n=this.props.options||[];if(this.props.filterOptions){var N="function"==typeof this.props.filterOptions?this.props.filterOptions:_["default"];return N(n,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return n},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,n){return e&&e.length?this.props.menuRenderer({focusedOption:n,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?l["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var n=e.map(function(e){return i(e[t.props.valueKey])}).join(this.props.delimiter);return l["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:n,disabled:this.props.disabled})}return e.map(function(e,n){return l["default"].createElement("input",{key:"hidden."+n,type:"hidden",ref:"value"+n,name:t.props.name,value:i(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var n=this.state.focusedOption||e;if(n&&!n.disabled){var r=t.indexOf(n);if(r!==-1)return r}for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c){var d={startTime:(new Date).getTime(),appliedQuery:u},f=this.appbaseRef[t];if(f){var h=u;h.type="*"===this.type[t]?"":this.type[t],h.preference=this.app[t],n(d),f.search(h).on("data",function(e){d.mode="historic",d.data=o.highlightModify(e,d.appliedQuery),i.emitter.emit(t,d);var n=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:d,react:s.react,queryOptions:n})}).on("error",function(e){var n={appliedQuery:d.appliedQuery,error:e,startTime:d.startTime};i.emitter.emit(t,n)}),s.stream&&r.call(this,t,u,f)}else console.error("appbaseRef is not set for "+t)}else{var m={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,m)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t){"use strict";function n(e,t){for(var n=[],r={object:null,string:""},o=Object.keys(t),a=o,i=Array.isArray(a),s=0,a=i?a:a[Symbol.iterator]();;){var u;if(i){if(s>=a.length)break;u=a[s++]}else{if(s=a.next(),s.done)break;u=s.value}var l=u,c=t[l];typeof e[l]===c&&e[l]!==r[c]||n.push(l)}for(var p="",d=0;d0)||new Error("fields missing: "+p)}e.exports={validate:n}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],i(n))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:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,u=0;u0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n), +"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;ts.bottom||i.topt.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var n=this,r="object"==typeof t?t:this.props;if(r.multi){if("string"==typeof e&&(e=e.split(r.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return n.expandValue(e,r)}).filter(function(e){return e})}var o=this.expandValue(e,r);return o?[o]:[]},expandValue:function(e,t){var n=typeof e;if("string"!==n&&"number"!==n&&"boolean"!==n)return e;var r=t.options,o=t.valueKey;if(r)for(var a=0;ar&&this.focusOption(n[r+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var n=-1,r=0;r0?n-=1:n=t.length-1;else if("start"===e)n=0;else if("end"===e)n=t.length-1;else if("page_up"===e){var o=n-this.props.pageSize;n=o<0?0:o}else if("page_down"===e){var o=n+this.props.pageSize;n=o>t.length-1?t.length-1:o}n===-1&&(n=0),this.setState({focusedIndex:t[n].index,focusedOption:t[n].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return l["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},l["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var n=this,r=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:l["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var a=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return l["default"].createElement(o,{id:n._instancePrefix+"-value-"+t,instancePrefix:n._instancePrefix,disabled:n.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[n.props.valueKey],onClick:a,onRemove:n.removeValue,value:e},r(e,t),l["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(a=null),l["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:a,value:e[0]},r(e[0])))},renderInput:function(e,t){var n,r=this,i=(0,m["default"])("Select-input",this.props.inputProps.className),u=!!this.state.isOpen,c=(0,m["default"])((n={},a(n,this._instancePrefix+"-list",u),a(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),p=s({},this.props.inputProps,{role:"combobox","aria-expanded":""+u,"aria-owns":c,"aria-haspopup":""+u,"aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:i,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(p);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,h=(d.inputClassName,o(d,["inputClassName"]));return l["default"].createElement("div",s({},h,{role:"combobox","aria-expanded":u,"aria-owns":u?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:i,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?l["default"].createElement(f["default"],s({},p,{minWidth:"5"})):l["default"].createElement("div",{className:i},l["default"].createElement("input",p))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return l["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,n=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return l["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},n)},filterOptions:function N(e){var t=this.state.inputValue,n=this.props.options||[];if(this.props.filterOptions){var N="function"==typeof this.props.filterOptions?this.props.filterOptions:_["default"];return N(n,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return n},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,n){return e&&e.length?this.props.menuRenderer({focusedOption:n,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?l["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var n=e.map(function(e){return i(e[t.props.valueKey])}).join(this.props.delimiter);return l["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:n,disabled:this.props.disabled})}return e.map(function(e,n){return l["default"].createElement("input",{key:"hidden."+n,type:"hidden",ref:"value"+n,name:t.props.name,value:i(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var n=this.state.focusedOption||e;if(n&&!n.disabled){var r=t.indexOf(n);if(r!==-1)return r}for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c)!function(){var e={startTime:(new Date).getTime(),appliedQuery:u},a=o.appbaseRef[t];if(a){var l=u;l.type="*"===o.type[t]?"":o.type[t],l.preference=o.app[t],n(e),a.search(l).on("data",function(n){e.mode="historic",e.data=o.highlightModify(n,e.appliedQuery),i.emitter.emit(t,e);var r=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:e,react:s.react,queryOptions:r})}).on("error",function(n){var r={appliedQuery:e.appliedQuery,error:n,startTime:e.startTime};i.emitter.emit(t,r)}),s.stream&&r.call(o,t,u,a)}else console.error("appbaseRef is not set for "+t)}();else{var d={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,d)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t){"use strict";function n(e,t){for(var n=[],r={object:null,string:""},o=Object.keys(t),a=o,i=Array.isArray(a),s=0,a=i?a:a[Symbol.iterator]();;){var u;if(i){if(s>=a.length)break;u=a[s++]}else{if(s=a.next(),s.done)break;u=s.value}var l=u,c=t[l];typeof e[l]===c&&e[l]!==r[c]||n.push(l)}for(var p="",d=0;d0)||new Error("fields missing: "+p)}e.exports={validate:n}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],i(n))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:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,u=0;u0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n), o||(o=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var o=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,o,i,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=i;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.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(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a];s?this[a]=s(n):"target"===a?this.target=r:this[a]=n[a]}var u=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;return u?this.isDefaultPrevented=i.thatReturnsTrue:this.isDefaultPrevented=i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse,this}var o=n(9),a=n(47),i=n(25),s=(n(5),"function"==typeof Proxy,["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),u={type:null,target:null,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};o(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=i.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=i.thatReturnsTrue)},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n-1)return!1;if(r.filterOption)return r.filterOption.call(o,e,t);if(!t)return!0;var a=String(e[r.valueKey]),s=String(e[r.labelKey]);return r.ignoreAccents&&("label"!==r.matchProp&&(a=(0,i["default"])(a)),"value"!==r.matchProp&&(s=(0,i["default"])(s))),r.ignoreCase&&("label"!==r.matchProp&&(a=a.toLowerCase()),"value"!==r.matchProp&&(s=s.toLowerCase())),"start"===r.matchPos?"label"!==r.matchProp&&a.substr(0,t.length)===t||"value"!==r.matchProp&&s.substr(0,t.length)===t:"label"!==r.matchProp&&a.indexOf(t)>=0||"value"!==r.matchProp&&s.indexOf(t)>=0})}var a=n(350),i=r(a);e.exports=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.focusedOption,n=e.instancePrefix,r=(e.labelKey,e.onFocus),o=e.onSelect,a=e.optionClassName,s=e.optionComponent,l=e.optionRenderer,c=e.options,p=e.valueArray,d=e.valueKey,f=e.onOptionRef,h=s;return c.map(function(e,s){var c=p&&p.indexOf(e)>-1,m=e===t,y=(0,i["default"])(a,{"Select-option":!0,"is-selected":c,"is-focused":m,"is-disabled":e.disabled});return u["default"].createElement(h,{className:y,instancePrefix:n,isDisabled:e.disabled,isFocused:m,isSelected:c,key:"option-"+s+"-"+e[d],onFocus:r,onSelect:o,option:e,optionIndex:s,ref:function(e){f(e,m)}},l(e,s))})}var a=n(3),i=r(a),s=n(2),u=r(s);e.exports=o},function(e,t){"use strict";var n=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];e.exports=function(e){for(var t=0;t0)if(t.ended&&!o){var i=new Error("stream.push() after EOF");e.emit("error",i)}else if(t.endEmitted&&o){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var l;!t.decoder||o||r||(n=t.decoder.write(n),l=!t.objectMode&&0===n.length),o||(t.reading=!1),l||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,o?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&d(e))),h(e,t)}else o||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length=B?e=B:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function l(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function c(e,t){var n=null;return j.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function p(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,d(e)}}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(N("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?O(f,e):f(e))}function f(e){N("emit readable"),e.emit("readable"),b(e)}function h(e,t){t.readingMore||(t.readingMore=!0,O(m,e,t))}function m(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=M(e,t.buffer,t.decoder),n}function M(e,t,n){var r;return ea.length?a.length:e;if(o+=i===a.length?a:a.slice(0,e),e-=i,0===e){i===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(i));break}++r}return t.length-=r,o}function k(e,t){var n=Y.allocUnsafe(e),r=t.head,o=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,i=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,i),e-=i,0===e){i===a.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(i));break}++o}return t.length-=o,n}function S(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,O(P,t,e))}function P(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function L(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return N("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?S(this):d(this),null;if(e=l(e,t),0===e&&t.ended)return 0===t.length&&S(this),null;var r=t.needReadable;N("need readable",r),(0===t.length||t.length-e0?T(e,t):null,null===o?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&S(this)),null!==o&&this.emit("data",o),o},a.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},a.prototype.pipe=function(e,n){function o(e){N("onunpipe"),e===d&&i()}function a(){N("onend"),e.end()}function i(){N("cleanup"),e.removeListener("close",l),e.removeListener("finish",c),e.removeListener("drain",v),e.removeListener("error",u),e.removeListener("unpipe",o),d.removeListener("end",a),d.removeListener("end",i),d.removeListener("data",s),g=!0,!f.awaitDrain||e._writableState&&!e._writableState.needDrain||v()}function s(t){N("ondata"),_=!1;var n=e.write(t);!1!==n||_||((1===f.pipesCount&&f.pipes===e||f.pipesCount>1&&L(f.pipes,e)!==-1)&&!g&&(N("false write response, pause",d._readableState.awaitDrain),d._readableState.awaitDrain++,_=!0),d.pause())}function u(t){N("onerror",t),p(),e.removeListener("error",u),0===C(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",c),p()}function c(){N("onfinish"),e.removeListener("close",l),p()}function p(){N("unpipe"),d.unpipe(e)}var d=this,f=this._readableState;switch(f.pipesCount){case 0:f.pipes=e;break;case 1:f.pipes=[f.pipes,e];break;default:f.pipes.push(e)}f.pipesCount+=1,N("pipe count=%d opts=%j",f.pipesCount,n);var h=(!n||n.end!==!1)&&e!==t.stdout&&e!==t.stderr,m=h?a:i;f.endEmitted?O(m):d.once("end",m),e.on("unpipe",o);var v=y(d);e.on("drain",v);var g=!1,_=!1;return d.on("data",s),r(e,"error",u),e.once("close",l),e.once("finish",c),e.emit("pipe",d),f.flowing||(N("pipe resume"),d.resume()),e},a.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?r:S;s.WritableState=i;var L=n(14);L.inherits=n(11);var D={deprecate:n(745)},O=n(359),E=n(15).Buffer,C=n(78);L.inherits(s,O),i.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(i.prototype,"buffer",{get:D.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var x;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(x=Function.prototype[Symbol.hasInstance],Object.defineProperty(s,Symbol.hasInstance,{value:function(e){return!!x.call(this,e)||e&&e._writableState instanceof i}})):x=function(e){return e instanceof this},s.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},s.prototype.write=function(e,t,n){var r=this._writableState,a=!1,i=E.isBuffer(e);return"function"==typeof t&&(n=t,t=null),i?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=o),r.ended?u(this,n):(i||l(this,r,e,n))&&(r.pendingcb++,a=p(this,r,i,e,t,n)),a},s.prototype.cork=function(){var e=this._writableState;e.corked++},s.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||g(this,e))},s.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},s.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},s.prototype._writev=null,s.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)}}).call(t,n(7),n(141).setImmediate)},function(e,t,n){e.exports=n(36).EventEmitter},function(e,t,n){"use strict";function r(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function o(e){var t=r(e);if("string"!=typeof t&&(g.isEncoding===b||!b(e)))throw new Error("Unknown encoding: "+e);return t||e}function a(e){this.encoding=o(e);var t;switch(this.encoding){case"utf16le":this.text=d,this.end=f,t=4;break;case"utf8":this.fillLast=l,t=4;break;case"base64":this.text=h,this.end=m,t=3;break;default:return this.write=y,void(this.end=v)}this.lastNeed=0,this.lastTotal=0,this.lastChar=_.allocUnsafe(t)}function i(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:-1}function s(e,t,n){var r=t.length-1;if(r=0?(o>0&&(e.lastNeed=o-1),o):--r=0?(o>0&&(e.lastNeed=o-2),o):--r=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0))}function u(e,t,n){if(128!==(192&t[0]))return e.lastNeed=0,"�".repeat(n);if(e.lastNeed>1&&t.length>1){if(128!==(192&t[1]))return e.lastNeed=1,"�".repeat(n+1);if(e.lastNeed>2&&t.length>2&&128!==(192&t[2]))return e.lastNeed=2,"�".repeat(n+2)}}function l(e){var t=this.lastTotal-this.lastNeed,n=u(this,e,t);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�".repeat(this.lastTotal-this.lastNeed):t}function d(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function f(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function h(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function m(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function y(e){return e.toString(this.encoding)}function v(e){return e&&e.length?this.write(e):""}var g=n(15).Buffer,_=n(78),b=g.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n&&n.and?"string"==typeof n.and&&(n.and=[n.and]):n.and=[],n.and.push("streamChanges"),this.sortObj&&this.enableSort(n);var r=h["default"].create(this.context.appbaseRef,this.context.type,n,this.props.size,this.props.from,this.props.stream,this.context.app);if(this.channelId=r.channelId,this.channelListener=r.emitter.addListener(r.channelId,function(t){if(t.error&&t.startTime>e.queryStartTime&&(e.setState({queryStart:!1,showPlaceholder:!1}),e.props.onAllData)){var n=L.prepareResultData(t);e.props.onAllData(n.res,n.err)}if(t.appliedQuery)if("historic"===t.mode&&t.startTime>e.queryStartTime){var r=!(!t.appliedQuery||!t.data||t.data.error||t.data.hits&&t.data.hits.total),o={resultFound:!!(t.appliedQuery&&t.data&&!t.data.error&&t.data.hits&&t.data.hits.total)};t.appliedQuery&&t.data&&!t.data.error&&(o.total=t.data.hits.total,o.took=t.data.took),e.setState({queryStart:!1,visibleNoResults:r,resultStats:o,showPlaceholder:!1}),e.afterChannelResponse(t)}else"streaming"===t.mode&&(e.afterChannelResponse(t),e.updateResultStats(t.data));else e.setState({showPlaceholder:!0})}),this.listenLoadingChannel(r),t){var o={key:"streamChanges",value:""};L.selectedSensor.set(o,!0)}}},{key:"updateResultStats",value:function(e){var t=this.state.resultStats;t.total=L.updateStats(t.total,e),this.setState({resultStats:t})}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"afterChannelResponse",value:function(e){var t=this,n=e.data,r=void 0,o=void 0,a=[],i=[];if(this.streamFlag=!1,"streaming"===e.mode)this.channelMethod="streaming",a=n,a.stream=!0,i=this.state.currentData,this.streamFlag=!0,o=this.setMarkersData(r);else if("historic"===e.mode){this.queryStartTime=e.startTime,this.channelMethod="historic",a=n.hits&&n.hits.hits?n.hits.hits:[];var s=this.normalizeCurrentData(e,this.state.currentData,a);a=s.newData,i=s.currentData}this.setState({rawData:r,newData:a,currentData:i,markersData:o,isLoading:!1},function(){e.allMarkers=r;var n=JSON.parse(JSON.stringify(e));n.newData=t.state.newData,n.currentData=t.state.currentData,delete n.data,n=L.prepareResultData(n,e.data);var o=t.props.onAllData?t.props.onAllData(n.res,n.err):t.defaultonAllData(n.res,n.err);t.setState({resultMarkup:o,currentData:t.combineCurrentData(a)})})}},{key:"normalizeCurrentData",value:function(e,t,n){var r=JSON.parse(JSON.stringify(e.appliedQuery)),o=JSON.stringify(r)===JSON.stringify(this.appliedQuery)?t||[]:[];return o.length?n=n.filter(function(e){var t=!0;return o.forEach(function(n){e._id+"-"+e._type==n._id+"-"+n._type&&(t=!1)}),t}):this.appliedQuery=r,{currentData:o,newData:n}}},{key:"combineCurrentData",value:function(e){return P["default"].isArray(e)?this.state.currentData.concat(e):this.streamDataModify(this.state.currentData,e)}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.createChannel(e)}},{key:"removeChannel",value:function(){this.channelId&&(h["default"].stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"render",value:function(){var e=null,t=null,n=(0,d["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-stream-active":this.props.stream,"rbc-stream-inactive":!this.props.stream,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader,"rbc-resultstats-active":this.props.showResultStats,"rbc-resultstats-inactive":!this.props.showResultStats,"rbc-noresults-active":this.props.noResults,"rbc-noresults-inactive":!this.props.noResults});return this.props.title&&(e=c["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.props.placeholder&&(t=c["default"].createElement("div",{className:"rbc-placeholder col s12 col-xs-12"},this.props.placeholder)),c["default"].createElement("div",{className:"rbc-reactiveelement-container"},c["default"].createElement("div",{className:"rbc rbc-reactiveelement card thumbnail "+n,style:this.props.componentStyle},e,this.state.resultStats&&this.state.resultStats.resultFound&&this.props.showResultStats?c["default"].createElement(M["default"],{onResultStats:this.props.onResultStats,took:this.state.resultStats.took,total:this.state.resultStats.total}):null,this.state.resultMarkup,this.state.showPlaceholder?t:null),this.props.noResults&&this.state.visibleNoResults?c["default"].createElement(b["default"],{defaultText:this.props.noResults.text}):null,this.props.initialLoader&&this.state.queryStart?c["default"].createElement(g["default"],{defaultText:this.props.initialLoader.text}):null,c["default"].createElement(y["default"],{container:"rbc-reactiveelement-container"}))}}]),t}(l.Component);t["default"]=D,D.propTypes={componentId:c["default"].PropTypes.string,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),from:L.validation.resultListFrom,onAllData:c["default"].PropTypes.func,size:L.sizeValidation,stream:c["default"].PropTypes.bool,componentStyle:c["default"].PropTypes.object,initialLoader:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),noResults:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),showResultStats:c["default"].PropTypes.bool,onResultStats:c["default"].PropTypes.func,react:c["default"].PropTypes.object,placeholder:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element])},D.defaultProps={from:0,size:20,stream:!1,showResultStats:!0,componentStyle:{}},D.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired,app:c["default"].PropTypes.any.isRequired},D.types={componentId:k.STRING,title:k.STRING,react:k.OBJECT,from:k.NUMBER,size:k.NUMBER,onAllData:k.FUNCTION,stream:k.BOOLEAN,componentStyle:k.OBJECT,initialLoader:k.STRING,noResults:k.STRING,showResultStats:k.BOOLEAN,onResultStats:k.FUNCTION,placeholder:k.STRING}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nt.height(),i=n.get(0).scrollHeight>n.height();if(!a&&!i&&n.length&&!e.props.pagination){var s=o(t.find(".rbc-title"))+o(t.find(".rbc-pagination"))*t.find(".rbc-pagination").length,u=t.height()-60-s;u>0&&n.css({height:n.height()+15,"padding-bottom":20})}};t&&t.length&&n&&n.length&&(n.css({height:"auto","padding-bottom":0}),setTimeout(a.bind(this),1e3))}},{key:"removeChannel",value:function(){this.channelId&&(m["default"].stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"createChannel",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n&&n.and?"string"==typeof n.and&&(n.and=[n.and]):n.and=[],n.and.push("streamChanges"),this.props.pagination&&(n.and.push("paginationChanges"),n.pagination=null),this.sortObj&&this.enableSort(n);var r=m["default"].create(this.context.appbaseRef,this.context.type,n,this.props.size,this.props.from,this.props.stream,this.context.app);this.channelId=r.channelId,this.channelListener=r.emitter.addListener(r.channelId,function(t){if(t.error&&t.startTime>e.queryStartTime&&(e.setState({queryStart:!1,showPlaceholder:!1}),e.props.onAllData)){var n=x.prepareResultData(t);e.props.onAllData(n.res,n.err)}if(t.appliedQuery)if("historic"===t.mode&&t.startTime>e.queryStartTime){var r=!(!(t.appliedQuery&&Object.keys(t.appliedQuery).length&&t.data)||t.data.error||t.data.hits&&t.data.hits.total),o={resultFound:!!(t.appliedQuery&&t.data&&!t.data.error&&t.data.hits&&t.data.hits.total)};t.appliedQuery&&t.data&&!t.data.error&&(o.total=t.data.hits.total,o.took=t.data.took),e.setState({queryStart:!1,visibleNoResults:r,resultStats:o,showPlaceholder:!1}),e.afterChannelResponse(t)}else"streaming"===t.mode&&(e.afterChannelResponse(t),e.updateResultStats(t.data));else e.setState({showPlaceholder:!0})}),this.listenLoadingChannel(r),t&&setTimeout(function(){var e={key:"streamChanges",value:""};x.selectedSensor.set(e,!0)},100)}},{key:"updateResultStats",value:function(e){var t=this.state.resultStats;t.total=x.updateStats(t.total,e),this.setState({resultStats:t})}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){if(e.appliedQuery){var n=!(t.state.requestOnScroll&&e.appliedQuery.body&&e.appliedQuery.body.from);t.setState({queryStart:e.queryState,showInitialLoader:n})}})}},{key:"afterChannelResponse",value:function(e){var t=this,n=e.data,r=void 0,o=void 0,a=[],i=[];if(this.streamFlag=!1,"streaming"===e.mode)this.channelMethod="streaming",a=n,a.stream=!0,i=this.state.currentData,this.streamFlag=!0,o=this.setMarkersData(r);else if("historic"===e.mode){this.queryStartTime=e.startTime,this.channelMethod="historic",a=n.hits&&n.hits.hits?n.hits.hits:[];var s=this.normalizeCurrentData(e,this.state.currentData,a);a=s.newData,i=s.currentData}this.setState({rawData:r,newData:a,currentData:i,markersData:o,isLoading:!1},function(){e.allMarkers=r;var o=JSON.parse(JSON.stringify(e));o.newData=t.state.newData,o.currentData=t.state.currentData,delete o.data,o=x.prepareResultData(o,n);var i=t.props.onAllData?t.props.onAllData(o.res,o.err):t.defaultonAllData(o.res,o.err);t.setState({resultMarkup:t.wrapMarkup(i),currentData:t.combineCurrentData(a)})})}},{key:"wrapMarkup",value:function(e){var t=null;return t=C["default"].isArray(e)?e.map(function(e,t){return p["default"].createElement("div",{key:t,className:"rbc-list-item"},e)}):e}},{key:"normalizeCurrentData",value:function(e,t,n){var r=JSON.parse(JSON.stringify(e.appliedQuery));this.state.requestOnScroll&&r&&r.body&&(delete r.body.from,delete r.body.size);var o=JSON.stringify(r)===JSON.stringify(this.appliedQuery),a=o?t||[]:[];return a.length?n=n.filter(function(e){var t=!0;return a.forEach(function(n){e._id+"-"+e._type==n._id+"-"+n._type&&(t=!1)}),t}):this.appliedQuery=r,o||j(".rbc.rbc-reactivelist").animate({scrollTop:0},100),{currentData:a,newData:n}}},{key:"combineCurrentData",value:function(e){return C["default"].isArray(e)?(e=e.map(function(e){return e.stream=!1,e}),this.state.currentData.concat(e)):this.streamDataModify(this.state.currentData,e,!1)}},{key:"enableSort",value:function(e){e.and.push(this.resultSortKey);var t={key:this.resultSortKey,value:this.sortObj};x.selectedSensor.setSortInfo(t)}},{key:"appendData",value:function(e){var t=this.state.rawData,n=t.hits.hits.concat(e.hits.hits);return t.hits.hits=C["default"].uniqBy(n,"_id"),t}},{key:"streamDataModify",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(t)if(t.stream=n,t.streamStart=new Date,t._deleted){var r=e.filter(function(e){return e._id!==t._id});e=r}else{var o=e.filter(function(e){return e._id!==t._id});e=o,e.unshift(t)}return e}},{key:"setMarkersData",value:function(e){return e?e:[]}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.createChannel(e),this.state.requestOnScroll?this.listComponent():this.setQueryForPagination()}},{key:"setQueryForPagination",value:function(){var e={queryType:"match",inputData:this.props.appbaseField,customQuery:function(){return null}},t={key:"paginationChanges",value:e};x.selectedSensor.setSensorInfo(t)}},{key:"executePaginationUpdate",value:function(){setTimeout(function(){var e={key:"paginationChanges",value:Math.random()};x.selectedSensor.set(e,!0)},100)}},{key:"paginationAt",value:function(e){var t=void 0;return!this.props.pagination||this.props.paginationAt!==e&&"both"!==this.props.paginationAt||(t=p["default"].createElement("div",{className:"rbc-pagination-container col s12 col-xs-12"},p["default"].createElement(L["default"],{className:"rbc-pagination-"+e,componentId:"pagination",onPageChange:this.props.onPageChange,title:this.props.paginationTitle}))),t}},{key:"defaultonAllData",value:function(e){var t=this,n=null;if(e){var r=e.currentData;"historic"===e.mode?r=e.currentData.concat(e.newData):"streaming"===e.mode&&(r=x.combineStreamData(e.currentData,e.newData)),r&&(n=r.map(function(e){var n=e._source;return t.props.onData?t.props.onData(e):p["default"].createElement("div",{className:"row",style:{marginTop:"20px"}},t.itemMarkup(n,e))}))}return n}},{key:"itemMarkup",value:function(e,t){return p["default"].createElement("div",{key:t._id,style:{padding:"12px",fontSize:"12px"},className:"makerInfo"},p["default"].createElement(v["default"],{data:e}))}},{key:"nextPage",value:function(){function e(){this.setState({isLoading:!0}),m["default"].nextPage(this.channelId)}this.state.resultStats.total>this.state.currentData.length&&!this.state.queryStart&&e.call(this)}},{key:"listComponent",value:function(){function e(e){var t=this;e&&e.addEventListener("scroll",function(){t.state.requestOnScroll&&j(e).scrollTop()+j(e).innerHeight()>=e.scrollHeight&&t.state.resultStats.total>t.state.currentData.length&&!t.state.queryStart&&t.nextPage()})}e.call(this,this.listParentElement),e.call(this,this.listChildElement)}},{key:"handleSortSelect",value:function(e){var t=e.target.value;this.sortObj=a({},this.props.sortOptions[t].appbaseField,{order:this.props.sortOptions[t].sortBy});var n={key:this.resultSortKey,value:this.sortObj};x.selectedSensor.set(n,!0,"sortChange")}},{key:"render",value:function(){var e=this,t=null,n=null,r=null,o=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-sort-active":this.props.sortOptions,"rbc-sort-inactive":!this.props.sortOptions,"rbc-stream-active":this.props.stream,"rbc-stream-inactive":!this.props.stream,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader,"rbc-resultstats-active":this.props.showResultStats,"rbc-resultstats-inactive":!this.props.showResultStats,"rbc-noresults-active":this.props.noResults,"rbc-noresults-inactive":!this.props.noResults,"rbc-pagination-active":this.props.pagination,"rbc-pagination-inactive":!this.props.pagination});if(this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.props.placeholder&&(n=p["default"].createElement("div",{className:"rbc-placeholder col s12 col-xs-12"},this.props.placeholder)),this.props.sortOptions){var a=this.props.sortOptions.map(function(e,t){return p["default"].createElement("option",{value:t,key:e.label},e.label)});r=p["default"].createElement("div",{className:"rbc-sortoptions input-field col"},p["default"].createElement("select",{className:"browser-default form-control",onChange:this.handleSortSelect},a))}return p["default"].createElement("div",{ className:"rbc-reactivelist-container"},p["default"].createElement("div",{ref:function(t){e.listParentElement=t},className:"rbc rbc-reactivelist card thumbnail "+o,style:this.props.componentStyle},t,r,this.props.showResultStats&&this.state.resultStats.resultFound?p["default"].createElement(S["default"],{onResultStats:this.props.onResultStats,took:this.state.resultStats.took,total:this.state.resultStats.total}):null,this.paginationAt("top"),p["default"].createElement("div",{ref:function(t){e.listChildElement=t},className:"rbc-reactivelist-scroll-container col s12 col-xs-12"},this.state.resultMarkup),this.state.isLoading?p["default"].createElement("div",{className:"rbc-loader"}):null,this.state.showPlaceholder?n:null,this.paginationAt("bottom")),this.props.noResults&&this.state.visibleNoResults?p["default"].createElement(w["default"],{defaultText:this.props.noResults}):null,this.props.initialLoader&&this.state.queryStart&&this.state.showInitialLoader?p["default"].createElement(T["default"],{defaultText:this.props.initialLoader}):null,p["default"].createElement(_["default"],{container:"rbc-reactivelist-container"}))}}]),t}(c.Component);t["default"]=Y,Y.propTypes={componentId:p["default"].PropTypes.string,appbaseField:p["default"].PropTypes.string,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),sortBy:p["default"].PropTypes.oneOf(["asc","desc","default"]),sortOptions:p["default"].PropTypes.arrayOf(p["default"].PropTypes.shape({label:p["default"].PropTypes.string,appbaseField:p["default"].PropTypes.string,sortBy:p["default"].PropTypes.string})),from:x.validation.resultListFrom,onAllData:p["default"].PropTypes.func,size:x.sizeValidation,stream:p["default"].PropTypes.bool,componentStyle:p["default"].PropTypes.object,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),noResults:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),showResultStats:p["default"].PropTypes.bool,onResultStats:p["default"].PropTypes.func,placeholder:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,paginationAt:p["default"].PropTypes.string,pagination:p["default"].PropTypes.bool},Y.defaultProps={from:0,size:20,stream:!1,componentStyle:{},showResultStats:!0,pagination:!1,paginationAt:"bottom"},Y.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired,app:p["default"].PropTypes.any.isRequired},Y.types={componentId:O.STRING,appbaseField:O.STRING,title:O.STRING,react:O.OBJECT,sortBy:O.STRING,sortOptions:O.OBJECT,from:O.NUMBER,onAllData:O.FUNCTION,onData:O.FUNCTION,size:O.NUMBER,stream:O.BOOLEAN,componentStyle:O.OBJECT,initialLoader:O.STRING,noResults:O.FUNCTION,showResultStats:O.BOOLEAN,onResultStats:O.FUNCTION,placeholder:O.STRING,pagination:O.BOOLEAN,paginationAt:O.STRING}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Bar=t.HistoGramComponent=void 0;var s=function(){function e(e,t){for(var n=0;n-1;t?this.setDefaultSelectAll():this.setState({selectedItems:this.props.defaultSelected,defaultSelectall:this.props.defaultSelectall},function(){e.updateAction.bind(e),e.props.onSelect(e.state.selectedItems)})}},{key:"setDefaultSelectAll",value:function(){this.props.items&&this.props.items.length?setTimeout(this.handleListClickAll.bind(this,this.props.selectAllLabel,!0),1e3):setTimeout(this.setDefaultSelectAll.bind(this),1e3)}},{key:"componentDidUpdate",value:function(){var e=this,t=null,n=!0;this.state.selectedItems&&(t=JSON.parse(JSON.stringify(this.state.selectedItems))),t&&t.length&&this.props.items&&this.props.items.length&&(t=t.filter(function(t){var n=e.props.items.filter(function(e){return e.key===t});return!!n.length}),t.length!==this.state.selectedItems.length&&(n=!t.length,this.props.onRemove(this.state.selectedItems,n),this.updateSelectedItems(t),t.length&&this.props.onSelect(t)))}},{key:"handleListClick",value:function(e,t){var n=void 0;t?(this.props.onRemove(this.state.selectedItems,!1),n=this.state.selectedItems,n.push(e),this.setState({selectedItems:n},this.updateAction.bind(this)),this.state.selectedItems.length&&this.props.onSelect(this.state.selectedItems)):this.handleTagClick(e)}},{key:"handleTagClick",value:function(e){var t=1===this.state.selectedItems.length;this.props.onRemove(this.state.selectedItems,t);var n=e.toString().replace(/ /g,"_"),r="ref"+n,o=this.refStore[r];o.state.status=!1;var a=this.state.selectedItems,i=a.indexOf(e);a.splice(i,1),this.setState({selectedItems:a},this.updateAction.bind(this)),this.props.onSelect(a)}},{key:"clearAll",value:function(){this.handleListClickAll(this.props.selectAllLabel,!1)}},{key:"getSelectedItems",value:function(){var e=[];return this.props.items.forEach(function(t){t.status&&e.indexOf(t.key)<0&&e.push(t.key)}),e}},{key:"handleListClickAll",value:function(e,t){var n=this;this.props.selectAll(t);var r=this.props.items.map(function(e){return e.key});r=t?r:[],this.setState({defaultSelectall:t,selectedItems:r},function(){n.updateAction.bind(n),n.props.onSelect(n.state.selectedItems,r)})}},{key:"updateSelectedItems",value:function(e){this.setState({selectedItems:e})}},{key:"updateAction",value:function(){this.state.selectedItems.length||this.props.onSelect(null)}},{key:"render",value:function(){var e=this,t=this.props.items,n=this.getSelectedItems(),r=[],o=[];return t.forEach(function(t,n){try{t.keyRef=t.key.replace(/ /g,"_")}catch(o){t.keyRef=n}var a=!("visible"in t&&!t.visible);r.push(l["default"].createElement(p["default"],{key:t.keyRef,value:t.key,doc_count:t.doc_count,countField:e.props.showCount,handleClick:e.handleListClick,visible:a,showCheckbox:e.props.showCheckbox,status:t.status||!1,ref:function(n){var r="ref"+t.keyRef;e.refStore[r]=n}}))}),this.props.selectAllLabel&&t&&t.length&&r.unshift(l["default"].createElement(p["default"],{key:"selectall",value:this.props.selectAllLabel,countField:!1,visible:!0,showCheckbox:this.props.showCheckbox,handleClick:this.handleListClickAll,status:this.props.selectAllValue,ref:function(t){e.refStore.refselectall=t}})),this.props.showTags&&n&&(n.length<=5?n.forEach(function(t){o.push(l["default"].createElement(f["default"],{key:t,value:t,onClick:e.handleTagClick}))}):o.unshift(l["default"].createElement(f["default"],{key:"Clear All",value:"Clear All",onClick:this.clearAll}))),l["default"].createElement("div",{className:"rbc-list-container col s12 col-xs-12"},o.length?l["default"].createElement("div",{className:"row rbc-tag-container"},o):null,l["default"].createElement("div",{className:"row"},r))}}]),t}(u.Component);t["default"]=h,h.propTypes={defaultSelected:l["default"].PropTypes.array,items:l["default"].PropTypes.array,onRemove:l["default"].PropTypes.func,onSelect:l["default"].PropTypes.func,selectAll:l["default"].PropTypes.func,selectAllLabel:l["default"].PropTypes.string,selectAllValue:l["default"].PropTypes.bool,showCount:l["default"].PropTypes.bool,showTags:l["default"].PropTypes.bool,defaultSelectall:l["default"].PropTypes.bool},h.defaultProps={showTags:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n-1){var n=t.channelResponse&&t.channelResponse.data&&t.channelResponse.data.hits?t.channelResponse.data.hits.total:0,r=Math.ceil(n/t.queryOptions.size)<1?1:Math.ceil(n/t.queryOptions.size),o=t.queryOptions.size?t.queryOptions.size:20,a=Math.round(t.queryOptions.from/o)+1;e.setState({totalHits:n,size:o,maxPageNumber:r,currentValue:a})}})}},{key:"handleChange",value:function(e){this.setState({currentValue:e});var t={key:this.props.componentId,value:e},n=!0;h.selectedSensor.set(t,n,"paginationChange"),this.props.onPageChange&&this.props.onPageChange(e)}},{key:"firstPage",value:function(){1!==this.state.currentValue&&this.handleChange.call(this,1)}},{key:"lastPage",value:function(){this.state.currentValue!==this.state.maxPageNumber&&this.handleChange.call(this,this.state.maxPageNumber)}},{key:"prePage",value:function(){var e=this.state.currentValue>1?this.state.currentValue-1:1;this.state.currentValue!==e&&this.handleChange.call(this,e)}},{key:"nextPage",value:function(){var e=this.state.currentValue0;r--)if(r%5===0||1===r){t=r;break}for(var o=function(t){var r=l["default"].createElement("li",{key:t,className:"rbc-page-number "+(e.state.currentValue===t?"active rbc-pagination-active":"waves-effect")},l["default"].createElement("a",{onClick:function(){return e.handleChange(t)}},t));t<=e.state.maxPageNumber&&n.push(r)},a=t;a<=t+5;a++)o(a);return l["default"].createElement("ul",{className:"pagination"},l["default"].createElement("li",{className:1===this.state.currentValue?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.firstPage},l["default"].createElement("i",{className:"fa fa-angle-double-left"}))),l["default"].createElement("li",{className:1===this.state.currentValue?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.prePage},l["default"].createElement("i",{className:"fa fa-angle-left"}))),n,l["default"].createElement("li",{className:this.state.currentValue===this.state.maxPageNumber?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-next",onClick:this.nextPage},l["default"].createElement("i",{className:"fa fa-angle-right"}))),l["default"].createElement("li",{className:this.state.currentValue===this.state.maxPageNumber?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.lastPage},l["default"].createElement("i",{className:"fa fa-angle-double-right"}))))}},{key:"render",value:function(){var e=null;this.props.title&&(e=l["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,p["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return l["default"].createElement("div",{className:"rbc rbc-pagination col s12 col-xs-12 "+t+" "+this.props.className},e,l["default"].createElement("div",{className:"col s12 col-xs-12"},this.renderPageNumber()))}}]),t}(u.Component);t["default"]=m,m.propTypes={componentId:l["default"].PropTypes.string.isRequired,title:l["default"].PropTypes.string,onPageChange:l["default"].PropTypes.func},m.defaultProps={},m.contextTypes={appbaseRef:l["default"].PropTypes.any.isRequired,type:l["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.StaticSearch=void 0;var s=function(){function e(e,t){for(var n=0;n-1)d=d||{},d=Object.assign(d,t[e]);else{r[e]=i(e);var o=a(e);o&&(d=d||{},d=Object.assign(d,o))}var u=n(e);!u||"aggSort"in u||p.push(u)}),r}function l(t){var n=o.serializeDepends.createQuery(e.serializeDepends,t);return n&&n.body?(p&&p.length&&(n.body.sort=p),d&&Object.keys(d).length&&Object.keys(d).forEach(function(e){n.body[e]=d[e]})):n={},n}function c(){var e=u(),t=l(e);return t}var p=[],d=null;return c()}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.params.get(e);if(n&&r)try{r=JSON.parse(r)}catch(o){console.log(o)}return t?r&&r.trim()?r.split(","):null:r}},{key:"update",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&(this.setOrDelete(e,t),this.applyURLUpdate())}},{key:"setOrDelete",value:function(e,t){e&&(null===t||void 0===t?this.params["delete"](e):this.params.set(e,t)); -}},{key:"applyURLUpdate",value:function(){if(history.pushState&&this.params.toString()){var e=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+this.params.toString();window.history.pushState({path:e},"",e)}}}]),e}();t.URLParams=new u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(49);t.ResponsiveStory=function(){var e=function(e){return e.height()?e.height():0},t=function(){var t=r(window).height(),n=t-15;r(".rbc.rbc-reactivelist, .rbc.rbc-reactiveelement").css({maxHeight:n});var o=[r(".rbc.rbc-singlelist"),r(".rbc.rbc-multilist"),r(".rbc.rbc-nestedlist"),r(".rbc.rbc-tagcloud")];o.forEach(function(n){if(n.length){var r=e(n.find(".rbc-title"))+e(n.find(".rbc-search-container"));n.find(".rbc-list-container").css({maxHeight:t-r-35})}}),r(".rbc-base > .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(e[t]<1||e[t]>1e3)&&(n=new Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=new Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]<=0&&(n=new Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=new Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start<=0&&(r=new Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return!isNaN(e[t])&&r>=e.defaultSelected&&o<=e.defaultSelected||(n=new Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return e[t]<0&&(n=new Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=new Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n'],post_tags:[""],fields:e}}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.defaultSearchQuery}};this.props.highlight&&(e.value.externalQuery=this.highlightQuery()),w.selectedSensor.setSensorInfo(e);var t={key:this.searchInputId,value:{queryType:"multi_match",inputData:this.props.appbaseField,customQuery:this.defaultSearchQuery}};w.selectedSensor.setSensorInfo(t)}},{key:"setValue",value:function(e){var t={key:this.searchInputId,value:e};w.URLParams.update(this.props.componentId,e,this.props.URLParams),w.selectedSensor.set(t,!0),e&&""!==e.trim()?this.setState({options:[{label:e,value:e}],isLoadingOptions:!0,currentValue:e}):this.setState({options:[],isLoadingOptions:!1,currentValue:e})}},{key:"getValue",value:function(e,t){var n=void(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0);if(M["default"].has(t,e))n=t[e];else if(e.indexOf(".")>-1){var r="",o=e.split(".");o.forEach(function(e,a){r+=e,M["default"].isArray(M["default"].get(t,r))&&(r+="["+a+"]"),o.length-1!==a?r+=".":n=M["default"].get(t,r)})}return n}},{key:"setData",value:function(e){var t=this,n=[];M["default"].isArray(this.props.appbaseField)?this.props.appbaseField:[this.props.appbaseField],e.hits.hits.map(function(e){if("string"===t.fieldType){var r=t.getValue(t.props.appbaseField.trim(),e._source);n.push({value:r,label:r})}else"object"===t.fieldType&&t.props.appbaseField.map(function(r){var o=t.getValue(r,e._source);o&&n.push({value:o,label:o})})}),this.state.currentValue&&""!==this.state.currentValue.trim()&&n.unshift({label:this.state.currentValue,value:this.state.currentValue}),n=this.removeDuplicates(n,"label"),this.setState({options:n,isLoadingOptions:!1})}},{key:"defaultSearchQuery",value:function(e){var t=null,n=void 0;return e&&(n="string"===this.fieldType?[this.props.appbaseField]:this.props.appbaseField,t={bool:{should:[{multi_match:{query:e,fields:n,type:"phrase_prefix"}},{multi_match:{query:e,fields:n}}],minimum_should_match:"1"}}),t}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.searchInputId);var n=g["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({rawData:r}),e.props.autocomplete&&e.setData(r)})}},{key:"checkDefault",value:function(){this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultValue&&this.defaultSelected!=this.defaultValue&&(this.defaultSelected=this.defaultValue,setTimeout(this.setValue.bind(this,this.defaultSelected),100),this.handleSearch({value:this.defaultSelected}))}},{key:"handleSearch",value:function(e){var t=e?e.value:null;t="null"===t?null:t;var n={key:this.props.componentId,value:t};w.selectedSensor.set(n,!0),this.setState({currentValue:t})}},{key:"handleInputChange",value:function(e){var t=e.target.value;this.setState({currentValue:t});var n={key:this.props.componentId,value:t};this.props.onValueChange&&this.props.onValueChange(n.value);var r=!0;w.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=d["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,y["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-autocomplete-active":this.props.autocomplete,"rbc-autocomplete-inactive":!this.props.autocomplete});return d["default"].createElement("div",{className:"rbc rbc-datasearch col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},e,this.props.autocomplete?d["default"].createElement(h["default"],u({isLoading:this.state.isLoadingOptions,value:this.state.currentValue,options:this.state.options,onInputChange:this.setValue,onChange:this.handleSearch,onBlurResetsInput:!1},this.props)):d["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},d["default"].createElement("input",{type:"text",className:"rbc-input",placeholder:this.props.placeholder,value:this.state.currentValue?this.state.currentValue:"",onChange:this.handleInputChange}),d["default"].createElement("span",{className:"rbc-search-icon"})))}}]),t}(p.Component);t["default"]=k,k.propTypes={componentId:d["default"].PropTypes.string.isRequired,appbaseField:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),title:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.element]),placeholder:d["default"].PropTypes.string,autocomplete:d["default"].PropTypes.bool,defaultSelected:d["default"].PropTypes.string,customQuery:d["default"].PropTypes.func,onValueChange:d["default"].PropTypes.func,react:d["default"].PropTypes.object,componentStyle:d["default"].PropTypes.object,highlight:d["default"].PropTypes.bool,highlightFields:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),URLParams:d["default"].PropTypes.bool},k.defaultProps={placeholder:"Search",autocomplete:!0,componentStyle:{},highlight:!1,URLParams:!1},k.contextTypes={appbaseRef:d["default"].PropTypes.any.isRequired,type:d["default"].PropTypes.any.isRequired},k.types={componentId:b.STRING,appbaseField:b.STRING,appbaseFieldType:b.STRING,react:b.OBJECT,title:b.STRING,placeholder:b.STRING,autocomplete:b.BOOLEAN,defaultSelected:b.STRING,customQuery:b.FUNCTION,componentStyle:b.OBJECT,highlight:b.BOOLEAN,URLParams:b.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&setTimeout(this.handleChange.bind(this,t),1e3)}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!_["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t;var n=e.state.data.filter(function(t){ -return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&(null!==e.urlParams?e.handleChange(n):setTimeout(e.handleChange.bind(e,n),1e3))}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};b.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){if(e.length>0)return e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}})}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}}},{key:"handleChange",value:function(e){var t=[];t=e.map(function(e){return e.label}),t=t.join(),this.setState({selected:t});var n={key:this.props.componentId,value:e},r=!0;this.props.onValueChange&&this.props.onValueChange(n.value),b.URLParams.update(this.props.componentId,t,this.props.URLParams),b.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return p["default"].createElement("div",{className:"rbc rbc-multidropdownrange col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"col s12 col-xs-12"},p["default"].createElement(f["default"],{options:this.state.data,value:this.state.selected,onChange:this.handleChange,clearable:!1,multi:!0,placeholder:this.props.placeholder,searchable:!0}))))}}]),t}(c.Component);t["default"]=T,T.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),placeholder:p["default"].PropTypes.string,data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},T.defaultProps={URLParams:!1},T.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},T.types={componentId:v.STRING,appbaseField:v.STRING,appbaseFieldType:v.NUMBER,data:v.OBJECT,defaultSelected:v.ARRAY,title:v.STRING,placeholder:v.STRING,customQuery:v.FUNCTION,componentStyle:v.OBJECT,URLParams:v.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&(null!==this.urlParams?this.handleChange(t):setTimeout(this.handleChange.bind(this,t),1e3))}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!v["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t,e.resetState();var n=e.props.data.filter(function(e){return t.indexOf(e.label)>-1});n&&n.length&&setTimeout(e.handleChange.bind(e,n),1e3)}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.length>0?e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}}):null}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}return null}},{key:"handleChange",value:function(e){function t(e,t,o){o.label===e.label&&(r=t,n.splice(t,1))}var n=this.state.selected,r=null,o=e;v["default"].isArray(e)||(o=[e]),o.forEach(function(e){n.forEach(function(n,r){t(n,r,e)})}),null===r&&o.forEach(function(e){n.push(e)}),this.setState({selected:n});var a={key:this.props.componentId,value:n},i=!0;this.props.onValueChange&&this.props.onValueChange(a.value),g.URLParams.update(this.props.componentId,this.getSelectedLabels(n),this.props.URLParams),g.selectedSensor.set(a,i)}},{key:"getSelectedLabels",value:function(e){return e.map(function(e){return e.label})}},{key:"resetState",value:function(){this.setState({selected:[]});var e={key:this.props.componentId,value:[]},t=!0;g.URLParams.update(this.props.componentId,null,this.props.URLParams),g.selectedSensor.set(e,t)}},{key:"handleTagClick",value:function(e){var t=this.state.selected.filter(function(t){return t.label===e});this.handleChange(t[0])}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t){return p["default"].createElement("div",{className:"rbc-list-item row",key:t.label,onClick:function(){return e.handleChange(t)}},p["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:n.indexOf(t.label)>-1,value:t.label}),p["default"].createElement("label",{className:"rbc-label"},t.label))})),t}},{key:"render",value:function(){var e=this,t=null,n=[];this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.selected&&this.state.selected.forEach(function(t){n.push(p["default"].createElement(b,{key:t.label,value:t.label,onClick:e.handleTagClick}))});var r=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return p["default"].createElement("div",{className:"rbc rbc-multirange col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},t,p["default"].createElement("div",{className:"col s12 col-xs-12 rbc-list-container"},n.length?p["default"].createElement("div",{className:"row",style:{marginTop:"0"}},n):null,this.renderButtons())))}}]),t}(c.Component);t["default"]=_;var b=function(e){return p["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},p["default"].createElement("a",{className:"close"},"×"),p["default"].createElement("span",null,e.value))};b.propTypes={onClick:p["default"].PropTypes.func.isRequired,value:p["default"].PropTypes.string.isRequired},_.propTypes={appbaseField:p["default"].PropTypes.string.isRequired,componentId:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nr;return p["default"].createElement("div",{className:"rbc-numberbox-container col s12 col-xs-12"},p["default"].createElement("div",{className:"rbc-label"},t),p["default"].createElement("div",{className:"rbc-numberbox-btn-container"},p["default"].createElement(g,{isActive:s,handleChange:o,type:"minus"}),p["default"].createElement("span",{className:"rbc-numberbox-number"},a),p["default"].createElement(g,{isActive:i,handleChange:o,type:"plus"})))},b=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),o=r.props.focused;r.urlParams=y.URLParams.get(r.props.componentId);var a=null!==r.urlParams?r.urlParams:r.props.defaultSelected;return r.state={currentValue:a?a:r.props.data.start,focused:o},r.type="term",r.handleChange=r.handleChange.bind(r),r.customQuery=r.customQuery.bind(r),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.setQueryInfo(),null!==this.urlParams?this.updateQuery(this.urlParams):setTimeout(this.handleChange.bind(this),1e3)}},{key:"componentWillReceiveProps",value:function(e){var t=this;setTimeout(function(){var n=null!==t.urlParams?t.urlParams:t.props.defaultSelected;!n&&0!==n||n===t.state.currentValue||t.setState({currentValue:n}),e.queryFormat!==t.queryFormat&&(t.queryFormat=e.queryFormat,t.updateQuery())},300)}},{key:"customQuery",value:function(e){var t=null;if(e&&(e.value||0===e.value)){var n=e.value;switch(this.props.queryFormat){case"exact":t=this.exactQuery(n);break;case"lte":t=this.lteQuery(n);break;case"gte":default:t=this.gteQuery(n)}}return t}},{key:"exactQuery",value:function(e){return a({},this.type,a({},this.props.appbaseField,e))}},{key:"gteQuery",value:function(e){return{range:a({},this.props.appbaseField,{gte:e,boost:2})}}},{key:"lteQuery",value:function(e){return{range:a({},this.props.appbaseField,{lte:e,boost:2})}}},{key:"setQueryInfo",value:function(){var e=this.props,t=e.componentId,n=e.appbaseField,r={key:t,value:{queryType:this.type,inputData:n,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};y.selectedSensor.setSensorInfo(r)}},{key:"handleChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.props,n=(t.componentId,t.data),r=n.start,o=n.end,a=this.state.currentValue;r=void 0!=r?r:a-1,o=void 0!=o?o:a+1,e>0&&ar&&(a-=1),this.setState({currentValue:a},this.updateQuery.bind(this))}},{key:"updateQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.start.currentValue,t={key:this.props.componentId,value:{value:e,queryFormat:this.props.queryFormat}};this.props.onValueChange&&this.props.onValueChange(t.value),y.URLParams.update(this.props.componentId,e,this.props.URLParams),y.selectedSensor.set(t,!0)}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.data,r=e.labelPosition,o=this.state.currentValue,a=t?p["default"].createElement(v,{title:t}):null,i=(0,f["default"])({"rbc-title-active":t,"rbc-title-inactive":!t});return p["default"].createElement("div",{className:"rbc rbc-numberbox col s12 col-xs-12 card thumbnail "+i+" rbc-label-"+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},a,p["default"].createElement(_,{handleChange:this.handleChange,value:o,label:n.label,start:n.start,end:n.end})))}}]),t}(c.Component);t["default"]=b,b.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.shape({start:y.validateThreshold,end:y.validateThreshold,label:p["default"].PropTypes.string}),defaultSelected:y.valueValidation,labelPosition:p["default"].PropTypes.oneOf(["top","bottom","left","right"]),customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,queryFormat:p["default"].PropTypes.oneOf(["exact","gte","lte"]),URLParams:p["default"].PropTypes.bool},b.defaultProps={componentStyle:{},queryFormat:"gte",URLParams:!1},b.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},b.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.NUMBER,labelPosition:m.STRING,customQuery:m.FUNCTION,componentStyle:m.OBJECT,queryFormat:m.STRING,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=n.end){var r=(n.end-n.start)%e.stepValue;if(r){t.setState({values:{min:t.state.values.min,max:n.end-r}});var o={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-r}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(o.value),S.URLParams.update(t.props.componentId,t.setURLParam(o.value),t.props.URLParams),S.selectedSensor.set(o,!0)},1e3)}else{var a={};a.min=n.start,a.max=n.end,t.setState({values:a,currentValues:a});var i={key:t.props.componentId,value:{from:a.min,to:a.max}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(i.value),S.URLParams.update(t.props.componentId,t.setURLParam(i.value),t.props.URLParams),S.selectedSensor.set(i,!0)},1e3)}}if(e.range.start!==t.state.startThreshold||e.range.end!==t.state.endThreshold){if(e.range.start<=n.start&&e.range.end>=n.end)t.setState({startThreshold:e.range.start,endThreshold:e.range.end});else{var s={min:t.state.values.min,max:t.state.values.max};t.state.values.mine.range.end&&(s.max=e.range.end),t.setState({startThreshold:e.range.start,endThreshold:e.range.end,values:s});var u={from:s.min,to:s.max},l={key:t.props.componentId,value:u};t.props.onValueChange&&t.props.onValueChange(l.value),S.URLParams.update(t.props.componentId,t.setURLParam(l.value),t.props.URLParams),S.selectedSensor.set(l,!0)}t.setRangeValue()}if(e.stepValue!==t.props.stepValue){var c=(n.end-n.start)%e.stepValue;if(c){t.setState({values:{min:t.state.values.min,max:n.end-c}});var p={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-c}};t.props.onValueChange&&t.props.onValueChange(p.value),S.URLParams.update(t.props.componentId,t.setURLParam(p.value),t.props.URLParams),S.selectedSensor.set(p,!0)}}},300)}},{key:"shouldComponentUpdate",value:function(e,t){return e.stepValue<=0||e.stepValue>Math.floor((e.range.end-e.range.start)/2)?(console.error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."),!1):!(t.values.max>t.endThreshold)}},{key:"componentWillUnmount",value:function(){this.channelId&&v["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setURLParam",value:function(e){return"from"in e&&"to"in e&&(e={start:e.from,end:e.to}),JSON.stringify(e)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField}},t={key:this.props.componentId+"-internal",value:{queryType:"range",inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};S.selectedSensor.setSensorInfo(e),S.selectedSensor.setSensorInfo(t),this.setRangeValue()}},{key:"setRangeValue",value:function(){var e={key:this.props.componentId+"-internal",value:this.props.range};this.props.onValueChange&&this.props.onValueChange(e.value),S.selectedSensor.set(e,!0)}},{key:"customQuery",value:function(e){if(e)return{range:a({},this.props.appbaseField,{gte:e.start,lte:e.end,boost:2})}}},{key:"histogramQuery",value:function(){return a({},this.props.appbaseField,{histogram:{field:this.props.appbaseField,interval:this.props.interval?this.props.interval:Math.ceil((this.props.range.end-this.props.range.start)/10)}})}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t.aggs={key:this.props.appbaseField,sort:"asc",size:1e3,customQuery:this.histogramQuery},t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.props.componentId+"-internal");var n=v["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery&&t.startTime>e.queryStartTime){e.queryStartTime=t.startTime?t.startTime:0;var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(n)}}),this.listenLoadingChannel(n)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"getSize",value:function(){return Math.min(this.props.range.end-this.props.range.start,this.maxSize)}},{key:"setData",value:function(e){try{this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}catch(t){console.log(t)}}},{key:"handleValuesChange",value:function(e,t){this.setState({values:t})}},{key:"countCalc",value:function(e,t,n){return n.map(function(e){return e.doc_count})}},{key:"addItemsToList",value:function(e){var t=this;e=k["default"].orderBy(e,["key"],["asc"]);var n=e.length,r=this.state.startThreshold?this.state.startThreshold:e[0].key,o=this.state.endThreshold?this.state.endThreshold:e[n-1].key;if(n>1){var a={counts:this.countCalc(r,o,e),startThreshold:r,endThreshold:o,values:{min:this.state.values.min,max:this.state.values.max}};this.setState(a,function(){k["default"].isEqual(a.values,t.state.currentValues)||t.handleResults(null,a.values)})}}},{key:"handleResults",value:function(e,t){var n=void 0;n=e?{min:e[0],max:e[1]}:t;var r={from:n.min,to:n.max},o={key:this.props.componentId,value:r};this.props.onValueChange&&this.props.onValueChange(o.value),S.URLParams.update(this.props.componentId,this.setURLParam(o.value),this.props.URLParams),S.selectedSensor.set(o,!0),this.setState({currentValues:n,values:n})}},{key:"render",value:function(){var e=null,t=null,n={};if(this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.counts&&this.state.counts.length&&this.props.showHistogram&&(t=p["default"].createElement(g.HistoGramComponent,{data:this.state.counts})),this.props.rangeLabels.start||this.props.rangeLabels.end){var r;r={},a(r,this.state.startThreshold,this.props.rangeLabels.start),a(r,this.state.endThreshold,this.props.rangeLabels.end),n=r}var o=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-labels-active":this.props.rangeLabels.start||this.props.rangeLabels.end,"rbc-labels-inactive":!this.props.rangeLabels.start&&!this.props.rangeLabels.end,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return p["default"].createElement("div",{className:"rbc rbc-rangeslider card thumbnail col s12 col-xs-12 "+o,style:this.props.componentStyle},e,t,p["default"].createElement("div",{className:"rbc-rangeslider-container col s12 col-xs-12"},p["default"].createElement(f["default"],{range:!0,value:[this.state.values.min,this.state.values.max],min:this.state.startThreshold,max:this.state.endThreshold,onChange:this.handleResults,step:this.props.stepValue,marks:n})),this.props.initialLoader&&this.state.queryStart?p["default"].createElement(b["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(c.Component);t["default"]=P,P.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),range:p["default"].PropTypes.shape({start:S.validateThreshold,end:S.validateThreshold}),rangeLabels:p["default"].PropTypes.shape({start:p["default"].PropTypes.string,end:p["default"].PropTypes.string}),defaultSelected:p["default"].PropTypes.shape({start:p["default"].PropTypes.number,end:p["default"].PropTypes.number}),stepValue:S.stepValidation,showHistogram:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,interval:p["default"].PropTypes.number,URLParams:p["default"].PropTypes.bool},P.defaultProps={title:null,range:{start:0,end:10},rangeLabels:{start:"",end:""},defaultSelected:{start:0,end:10},stepValue:1,showHistogram:!0,componentStyle:{},URLParams:!1},P.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},P.types={componentId:M.STRING,appbaseField:M.STRING,appbaseFieldType:M.NUMBER,title:M.STRING,react:M.OBJECT,range:M.OBJECT,rangeLabels:M.OBJECT,defaultSelected:M.OBJECT,stepValue:M.NUMBER,showHistogram:M.BOOLEAN,customQuery:M.FUNCTION,initialLoader:M.OBJECT,componentStyle:M.OBJECT,interval:M.NUMBER,URLParams:M.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(e[t]<1||e[t]>1e3)&&(n=new Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=new Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]<=0&&(n=new Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=new Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start<=0&&(r=new Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return!isNaN(e[t])&&r>=e.defaultSelected&&o<=e.defaultSelected||(n=new Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return e[t]<0&&(n=new Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=new Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n'],post_tags:[""],fields:e}}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.defaultSearchQuery}};this.props.highlight&&(e.value.externalQuery=this.highlightQuery()),w.selectedSensor.setSensorInfo(e);var t={key:this.searchInputId,value:{queryType:"multi_match",inputData:this.props.appbaseField,customQuery:this.defaultSearchQuery}};w.selectedSensor.setSensorInfo(t)}},{key:"setValue",value:function(e){var t={key:this.searchInputId,value:e};w.URLParams.update(this.props.componentId,e,this.props.URLParams),w.selectedSensor.set(t,!0),e&&""!==e.trim()?this.setState({options:[{label:e,value:e}],isLoadingOptions:!0,currentValue:e}):this.setState({options:[],isLoadingOptions:!1,currentValue:e})}},{key:"getValue",value:function(e,t){var n=void(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0);return M["default"].has(t,e)?n=t[e]:e.indexOf(".")>-1&&!function(){var r="",o=e.split(".");o.forEach(function(e,a){r+=e,M["default"].isArray(M["default"].get(t,r))&&(r+="["+a+"]"),o.length-1!==a?r+=".":n=M["default"].get(t,r)})}(),n}},{key:"setData",value:function(e){var t=this,n=[];M["default"].isArray(this.props.appbaseField)?this.props.appbaseField:[this.props.appbaseField],e.hits.hits.map(function(e){if("string"===t.fieldType){var r=t.getValue(t.props.appbaseField.trim(),e._source);n.push({value:r,label:r})}else"object"===t.fieldType&&t.props.appbaseField.map(function(r){var o=t.getValue(r,e._source);o&&n.push({value:o,label:o})})}),this.state.currentValue&&""!==this.state.currentValue.trim()&&n.unshift({label:this.state.currentValue,value:this.state.currentValue}),n=this.removeDuplicates(n,"label"),this.setState({options:n,isLoadingOptions:!1})}},{key:"defaultSearchQuery",value:function(e){var t=null,n=void 0;return e&&(n="string"===this.fieldType?[this.props.appbaseField]:this.props.appbaseField,t={bool:{should:[{multi_match:{query:e,fields:n,type:"phrase_prefix"}},{multi_match:{query:e,fields:n}}],minimum_should_match:"1"}}),t}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.searchInputId);var n=g["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({rawData:r}),e.props.autocomplete&&e.setData(r)})}},{key:"checkDefault",value:function(){this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultValue&&this.defaultSelected!=this.defaultValue&&(this.defaultSelected=this.defaultValue,setTimeout(this.setValue.bind(this,this.defaultSelected),100),this.handleSearch({value:this.defaultSelected}))}},{key:"handleSearch",value:function(e){var t=e?e.value:null;t="null"===t?null:t;var n={key:this.props.componentId,value:t};w.selectedSensor.set(n,!0),this.setState({currentValue:t})}},{key:"handleInputChange",value:function(e){var t=e.target.value;this.setState({currentValue:t});var n={key:this.props.componentId,value:t};this.props.onValueChange&&this.props.onValueChange(n.value);var r=!0;w.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=d["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,y["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-autocomplete-active":this.props.autocomplete,"rbc-autocomplete-inactive":!this.props.autocomplete});return d["default"].createElement("div",{className:"rbc rbc-datasearch col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},e,this.props.autocomplete?d["default"].createElement(h["default"],u({isLoading:this.state.isLoadingOptions,value:this.state.currentValue,options:this.state.options,onInputChange:this.setValue,onChange:this.handleSearch,onBlurResetsInput:!1},this.props)):d["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},d["default"].createElement("input",{type:"text",className:"rbc-input",placeholder:this.props.placeholder,value:this.state.currentValue?this.state.currentValue:"",onChange:this.handleInputChange}),d["default"].createElement("span",{className:"rbc-search-icon"})))}}]),t}(p.Component);t["default"]=k,k.propTypes={componentId:d["default"].PropTypes.string.isRequired,appbaseField:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),title:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.element]),placeholder:d["default"].PropTypes.string,autocomplete:d["default"].PropTypes.bool,defaultSelected:d["default"].PropTypes.string,customQuery:d["default"].PropTypes.func,onValueChange:d["default"].PropTypes.func,react:d["default"].PropTypes.object,componentStyle:d["default"].PropTypes.object,highlight:d["default"].PropTypes.bool,highlightFields:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),URLParams:d["default"].PropTypes.bool},k.defaultProps={placeholder:"Search",autocomplete:!0,componentStyle:{},highlight:!1,URLParams:!1},k.contextTypes={appbaseRef:d["default"].PropTypes.any.isRequired,type:d["default"].PropTypes.any.isRequired},k.types={componentId:b.STRING,appbaseField:b.STRING,appbaseFieldType:b.STRING,react:b.OBJECT,title:b.STRING,placeholder:b.STRING,autocomplete:b.BOOLEAN,defaultSelected:b.STRING,customQuery:b.FUNCTION,componentStyle:b.OBJECT,highlight:b.BOOLEAN,URLParams:b.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&setTimeout(this.handleChange.bind(this,t),1e3)}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!_["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t;var n=e.state.data.filter(function(t){ +return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&(null!==e.urlParams?e.handleChange(n):setTimeout(e.handleChange.bind(e,n),1e3))}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};b.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){if(e.length>0)return e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}})}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}}},{key:"handleChange",value:function(e){var t=[];t=e.map(function(e){return e.label}),t=t.join(),this.setState({selected:t});var n={key:this.props.componentId,value:e},r=!0;this.props.onValueChange&&this.props.onValueChange(n.value),b.URLParams.update(this.props.componentId,t,this.props.URLParams),b.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return p["default"].createElement("div",{className:"rbc rbc-multidropdownrange col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"col s12 col-xs-12"},p["default"].createElement(f["default"],{options:this.state.data,value:this.state.selected,onChange:this.handleChange,clearable:!1,multi:!0,placeholder:this.props.placeholder,searchable:!0}))))}}]),t}(c.Component);t["default"]=T,T.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),placeholder:p["default"].PropTypes.string,data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},T.defaultProps={URLParams:!1},T.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},T.types={componentId:v.STRING,appbaseField:v.STRING,appbaseFieldType:v.NUMBER,data:v.OBJECT,defaultSelected:v.ARRAY,title:v.STRING,placeholder:v.STRING,customQuery:v.FUNCTION,componentStyle:v.OBJECT,URLParams:v.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&(null!==this.urlParams?this.handleChange(t):setTimeout(this.handleChange.bind(this,t),1e3))}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!v["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t,e.resetState();var n=e.props.data.filter(function(e){return t.indexOf(e.label)>-1});n&&n.length&&setTimeout(e.handleChange.bind(e,n),1e3)}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.length>0?e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}}):null}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}return null}},{key:"handleChange",value:function(e){function t(e,t,o){o.label===e.label&&(r=t,n.splice(t,1))}var n=this.state.selected,r=null,o=e;v["default"].isArray(e)||(o=[e]),o.forEach(function(e){n.forEach(function(n,r){t(n,r,e)})}),null===r&&o.forEach(function(e){n.push(e)}),this.setState({selected:n});var a={key:this.props.componentId,value:n},i=!0;this.props.onValueChange&&this.props.onValueChange(a.value),g.URLParams.update(this.props.componentId,this.getSelectedLabels(n),this.props.URLParams),g.selectedSensor.set(a,i)}},{key:"getSelectedLabels",value:function(e){return e.map(function(e){return e.label})}},{key:"resetState",value:function(){this.setState({selected:[]});var e={key:this.props.componentId,value:[]},t=!0;g.URLParams.update(this.props.componentId,null,this.props.URLParams),g.selectedSensor.set(e,t)}},{key:"handleTagClick",value:function(e){var t=this.state.selected.filter(function(t){return t.label===e});this.handleChange(t[0])}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t){return p["default"].createElement("div",{className:"rbc-list-item row",key:t.label,onClick:function(){return e.handleChange(t)}},p["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:n.indexOf(t.label)>-1,value:t.label}),p["default"].createElement("label",{className:"rbc-label"},t.label))})),t}},{key:"render",value:function(){var e=this,t=null,n=[];this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.selected&&this.state.selected.forEach(function(t){n.push(p["default"].createElement(b,{key:t.label,value:t.label,onClick:e.handleTagClick}))});var r=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return p["default"].createElement("div",{className:"rbc rbc-multirange col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},t,p["default"].createElement("div",{className:"col s12 col-xs-12 rbc-list-container"},n.length?p["default"].createElement("div",{className:"row",style:{marginTop:"0"}},n):null,this.renderButtons())))}}]),t}(c.Component);t["default"]=_;var b=function(e){return p["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},p["default"].createElement("a",{className:"close"},"×"),p["default"].createElement("span",null,e.value))};b.propTypes={onClick:p["default"].PropTypes.func.isRequired,value:p["default"].PropTypes.string.isRequired},_.propTypes={appbaseField:p["default"].PropTypes.string.isRequired,componentId:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nr;return p["default"].createElement("div",{className:"rbc-numberbox-container col s12 col-xs-12"},p["default"].createElement("div",{className:"rbc-label"},t),p["default"].createElement("div",{className:"rbc-numberbox-btn-container"},p["default"].createElement(g,{isActive:s,handleChange:o,type:"minus"}),p["default"].createElement("span",{className:"rbc-numberbox-number"},a),p["default"].createElement(g,{isActive:i,handleChange:o,type:"plus"})))},b=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),o=r.props.focused;r.urlParams=y.URLParams.get(r.props.componentId);var a=null!==r.urlParams?r.urlParams:r.props.defaultSelected;return r.state={currentValue:a?a:r.props.data.start,focused:o},r.type="term",r.handleChange=r.handleChange.bind(r),r.customQuery=r.customQuery.bind(r),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.setQueryInfo(),null!==this.urlParams?this.updateQuery(this.urlParams):setTimeout(this.handleChange.bind(this),1e3)}},{key:"componentWillReceiveProps",value:function(e){var t=this;setTimeout(function(){var n=null!==t.urlParams?t.urlParams:t.props.defaultSelected;!n&&0!==n||n===t.state.currentValue||t.setState({currentValue:n}),e.queryFormat!==t.queryFormat&&(t.queryFormat=e.queryFormat,t.updateQuery())},300)}},{key:"customQuery",value:function(e){var t=null;if(e&&(e.value||0===e.value)){var n=e.value;switch(this.props.queryFormat){case"exact":t=this.exactQuery(n);break;case"lte":t=this.lteQuery(n);break;case"gte":default:t=this.gteQuery(n)}}return t}},{key:"exactQuery",value:function(e){return a({},this.type,a({},this.props.appbaseField,e))}},{key:"gteQuery",value:function(e){return{range:a({},this.props.appbaseField,{gte:e,boost:2})}}},{key:"lteQuery",value:function(e){return{range:a({},this.props.appbaseField,{lte:e,boost:2})}}},{key:"setQueryInfo",value:function(){var e=this.props,t=e.componentId,n=e.appbaseField,r={key:t,value:{queryType:this.type,inputData:n,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};y.selectedSensor.setSensorInfo(r)}},{key:"handleChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.props,n=(t.componentId,t.data),r=n.start,o=n.end,a=this.state.currentValue;r=void 0!=r?r:a-1,o=void 0!=o?o:a+1,e>0&&ar&&(a-=1),this.setState({currentValue:a},this.updateQuery.bind(this))}},{key:"updateQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.start.currentValue,t={key:this.props.componentId,value:{value:e,queryFormat:this.props.queryFormat}};this.props.onValueChange&&this.props.onValueChange(t.value),y.URLParams.update(this.props.componentId,e,this.props.URLParams),y.selectedSensor.set(t,!0)}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.data,r=e.labelPosition,o=this.state.currentValue,a=t?p["default"].createElement(v,{title:t}):null,i=(0,f["default"])({"rbc-title-active":t,"rbc-title-inactive":!t});return p["default"].createElement("div",{className:"rbc rbc-numberbox col s12 col-xs-12 card thumbnail "+i+" rbc-label-"+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},a,p["default"].createElement(_,{handleChange:this.handleChange,value:o,label:n.label,start:n.start,end:n.end})))}}]),t}(c.Component);t["default"]=b,b.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.shape({start:y.validateThreshold,end:y.validateThreshold,label:p["default"].PropTypes.string}),defaultSelected:y.valueValidation,labelPosition:p["default"].PropTypes.oneOf(["top","bottom","left","right"]),customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,queryFormat:p["default"].PropTypes.oneOf(["exact","gte","lte"]),URLParams:p["default"].PropTypes.bool},b.defaultProps={componentStyle:{},queryFormat:"gte",URLParams:!1},b.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},b.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.NUMBER,labelPosition:m.STRING,customQuery:m.FUNCTION,componentStyle:m.OBJECT,queryFormat:m.STRING,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=n.end){var r=(n.end-n.start)%e.stepValue;r?!function(){t.setState({values:{min:t.state.values.min,max:n.end-r}});var e={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-r}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(e.value),S.URLParams.update(t.props.componentId,t.setURLParam(e.value),t.props.URLParams),S.selectedSensor.set(e,!0)},1e3)}():!function(){var e={};e.min=n.start,e.max=n.end,t.setState({values:e,currentValues:e});var r={key:t.props.componentId,value:{from:e.min,to:e.max}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(r.value),S.URLParams.update(t.props.componentId,t.setURLParam(r.value),t.props.URLParams),S.selectedSensor.set(r,!0)},1e3)}()}if(e.range.start!==t.state.startThreshold||e.range.end!==t.state.endThreshold){if(e.range.start<=n.start&&e.range.end>=n.end)t.setState({startThreshold:e.range.start,endThreshold:e.range.end});else{var o={min:t.state.values.min,max:t.state.values.max};t.state.values.mine.range.end&&(o.max=e.range.end),t.setState({startThreshold:e.range.start,endThreshold:e.range.end,values:o});var a={from:o.min,to:o.max},i={key:t.props.componentId,value:a};t.props.onValueChange&&t.props.onValueChange(i.value),S.URLParams.update(t.props.componentId,t.setURLParam(i.value),t.props.URLParams),S.selectedSensor.set(i,!0)}t.setRangeValue()}if(e.stepValue!==t.props.stepValue){var s=(n.end-n.start)%e.stepValue;if(s){t.setState({values:{min:t.state.values.min,max:n.end-s}});var u={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-s}};t.props.onValueChange&&t.props.onValueChange(u.value),S.URLParams.update(t.props.componentId,t.setURLParam(u.value),t.props.URLParams),S.selectedSensor.set(u,!0)}}},300)}},{key:"shouldComponentUpdate",value:function(e,t){return e.stepValue<=0||e.stepValue>Math.floor((e.range.end-e.range.start)/2)?(console.error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."),!1):!(t.values.max>t.endThreshold)}},{key:"componentWillUnmount",value:function(){this.channelId&&v["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setURLParam",value:function(e){return"from"in e&&"to"in e&&(e={start:e.from,end:e.to}),JSON.stringify(e)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField}},t={key:this.props.componentId+"-internal",value:{queryType:"range",inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};S.selectedSensor.setSensorInfo(e),S.selectedSensor.setSensorInfo(t),this.setRangeValue()}},{key:"setRangeValue",value:function(){var e={key:this.props.componentId+"-internal",value:this.props.range};this.props.onValueChange&&this.props.onValueChange(e.value),S.selectedSensor.set(e,!0)}},{key:"customQuery",value:function(e){if(e)return{range:a({},this.props.appbaseField,{gte:e.start,lte:e.end,boost:2})}}},{key:"histogramQuery",value:function(){return a({},this.props.appbaseField,{histogram:{field:this.props.appbaseField,interval:this.props.interval?this.props.interval:Math.ceil((this.props.range.end-this.props.range.start)/10)}})}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t.aggs={key:this.props.appbaseField,sort:"asc",size:1e3,customQuery:this.histogramQuery},t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.props.componentId+"-internal");var n=v["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery&&t.startTime>e.queryStartTime){e.queryStartTime=t.startTime?t.startTime:0;var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(n)}}),this.listenLoadingChannel(n)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"getSize",value:function(){return Math.min(this.props.range.end-this.props.range.start,this.maxSize)}},{key:"setData",value:function(e){try{this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}catch(t){console.log(t)}}},{key:"handleValuesChange",value:function(e,t){this.setState({values:t})}},{key:"countCalc",value:function(e,t,n){return n.map(function(e){return e.doc_count})}},{key:"addItemsToList",value:function(e){var t=this;e=k["default"].orderBy(e,["key"],["asc"]);var n=e.length,r=this.state.startThreshold?this.state.startThreshold:e[0].key,o=this.state.endThreshold?this.state.endThreshold:e[n-1].key;n>1&&!function(){var n={counts:t.countCalc(r,o,e),startThreshold:r,endThreshold:o,values:{min:t.state.values.min,max:t.state.values.max}};t.setState(n,function(){k["default"].isEqual(n.values,t.state.currentValues)||t.handleResults(null,n.values)})}()}},{key:"handleResults",value:function(e,t){var n=void 0;n=e?{min:e[0],max:e[1]}:t;var r={from:n.min,to:n.max},o={key:this.props.componentId,value:r};this.props.onValueChange&&this.props.onValueChange(o.value),S.URLParams.update(this.props.componentId,this.setURLParam(o.value),this.props.URLParams),S.selectedSensor.set(o,!0),this.setState({currentValues:n,values:n})}},{key:"render",value:function(){var e=null,t=null,n={};if(this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.counts&&this.state.counts.length&&this.props.showHistogram&&(t=p["default"].createElement(g.HistoGramComponent,{data:this.state.counts})),this.props.rangeLabels.start||this.props.rangeLabels.end){var r;r={},a(r,this.state.startThreshold,this.props.rangeLabels.start),a(r,this.state.endThreshold,this.props.rangeLabels.end),n=r}var o=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-labels-active":this.props.rangeLabels.start||this.props.rangeLabels.end,"rbc-labels-inactive":!this.props.rangeLabels.start&&!this.props.rangeLabels.end,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return p["default"].createElement("div",{className:"rbc rbc-rangeslider card thumbnail col s12 col-xs-12 "+o,style:this.props.componentStyle},e,t,p["default"].createElement("div",{className:"rbc-rangeslider-container col s12 col-xs-12"},p["default"].createElement(f["default"],{range:!0,value:[this.state.values.min,this.state.values.max],min:this.state.startThreshold,max:this.state.endThreshold,onChange:this.handleResults,step:this.props.stepValue,marks:n})),this.props.initialLoader&&this.state.queryStart?p["default"].createElement(b["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(c.Component);t["default"]=P,P.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),range:p["default"].PropTypes.shape({start:S.validateThreshold,end:S.validateThreshold}),rangeLabels:p["default"].PropTypes.shape({start:p["default"].PropTypes.string,end:p["default"].PropTypes.string}),defaultSelected:p["default"].PropTypes.shape({start:p["default"].PropTypes.number,end:p["default"].PropTypes.number}),stepValue:S.stepValidation,showHistogram:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,interval:p["default"].PropTypes.number,URLParams:p["default"].PropTypes.bool},P.defaultProps={title:null,range:{start:0,end:10},rangeLabels:{start:"",end:""},defaultSelected:{start:0,end:10},stepValue:1,showHistogram:!0,componentStyle:{},URLParams:!1},P.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},P.types={componentId:M.STRING,appbaseField:M.STRING,appbaseFieldType:M.NUMBER,title:M.STRING,react:M.OBJECT,range:M.OBJECT,rangeLabels:M.OBJECT,defaultSelected:M.OBJECT,stepValue:M.NUMBER,showHistogram:M.BOOLEAN,customQuery:M.FUNCTION,initialLoader:M.OBJECT,componentStyle:M.OBJECT,interval:M.NUMBER,URLParams:M.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&t.forEach(function(t){null!==e.urlParams?e.handleChange(t):setTimeout(e.handleChange.bind(e,t),1e3)})}}},{key:"componentWillUpdate",value:function(){var e=this,t=null!==this.urlParams?this.urlParams:this.props.defaultSelected;if(this.defaultSelected!=t){this.defaultSelected=t,this.defaultSelected=v["default"].isArray(this.defaultSelected)?this.defaultSelected:[this.defaultSelected];var n=this.props.data.filter(function(t){return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&n.forEach(function(t){setTimeout(e.handleChange.bind(e,t),1e3)})}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.map(function(e,n){return{term:a({},t,e.value)}})}var n=null;return e&&e.length?n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}}:n}},{key:"handleChange",value:function(e){var t=this.state.selected,n=[],r=null;t.forEach(function(n,o){e.label===n.label&&(r=o,t.splice(o,1))}),null===r?this.props.multiSelect?(t.push(e),n=t):n.push(e):n=t,this.setState({selected:n});var o={key:this.props.componentId,value:n},a=!0;this.props.onValueChange&&this.props.onValueChange(o.value),g.URLParams.update(this.props.componentId,this.setURLValue(n),this.props.URLParams),g.selectedSensor.set(o,a)}},{key:"setURLValue",value:function(e){return e.map(function(e){return e.label})}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t,r){return p["default"].createElement("button",{key:r,className:"btn rbc-btn "+(n.indexOf(t.label)>-1?"rbc-btn-active":"rbc-btn-inactive"),onClick:function(){return e.handleChange(t)},title:t.title?t.title:t.label},t.label)})),t}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-multiselect-active":this.props.multiSelect,"rbc-multiselect-inactive":!this.props.multiSelect});return p["default"].createElement("div",{className:"rbc rbc-togglebutton col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"rbc-buttongroup col s12 col-xs-12"},this.renderButtons())))}}]),t}(c.Component);t["default"]=_,_.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.oneOfType([p["default"].PropTypes.array,p["default"].PropTypes.string]),multiSelect:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={multiSelect:!0,componentStyle:{},URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.KEYWORD,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,multiSelect:m.BOOLEAN,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]&&arguments[0];this.setGeoQueryInfo(),this.createChannel(e);var t=this.getMapStyle(this.props.defaultMapStyle);this.initialMapBoundQuery=!!this.props.defaultCenter,this.applyGeoQuery=this.props.applyGeoQuery?this.props.applyGeoQuery:this.props.setSearchAsMove,this.setState({currentMapStyle:t})}},{key:"componentWillReceiveProps",value:function(e){e.defaultMapStyle!==this.props.defaultMapStyle&&this.mapStyleChange(this.getMapStyle(e.defaultMapStyle))}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){e.streamProp!==e.props.stream&&(e.streamProp=e.props.stream,e.removeChannel(),e.initialize()),e.sizeProp!==e.props.size&&(e.sizeProp=e.props.size,e.removeChannel(),e.initialize(!0))},300)}},{key:"componentWillUnmount",value:function(){this.removeChannel()}},{key:"removeChannel",value:function(){this.channelId&&(_.AppbaseChannelManager.stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove()}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and?"string"==typeof t.and&&(t.and=[t.and]):t.and=[],t.or=t.or?t.or:[],t.or.push("geoQuery"),t.and.push("streamChanges");var n=_.AppbaseChannelManager.create(this.context.appbaseRef,this.context.type,t,this.props.size,this.props.from,this.props.stream);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){function n(){"historic"===t.mode&&t.startTime>this.queryStartTime?this.afterChannelResponse(t):"streaming"===t.mode&&this.afterChannelResponse(t)}function r(){if(t.error&&t.startTime>this.queryStartTime){if(this.props.onAllData){var e=_.AppbaseSensorHelper.prepareResultData(t);this.props.onAllData(e.res,e.err)}}else t.appliedQuery&&(this.state.mapBounds?this.props.autoMapRender?n.call(this):o.hits.hits.length&&n.call(this):n.call(this))}var o=t.data;r.call(e)});var r={key:"streamChanges",value:""};_.AppbaseSensorHelper.selectedSensor.set(r,!0)}},{key:"afterChannelResponse",value:function(e){var t=this,n=w.afterChannelResponse(e,this.state.rawData,this.props.appbaseField,this.state.markersData);this.reposition=!0,this.streamFlag=n.streamFlag,this.queryStartTime=n.queryStartTime?n.queryStartTime:0,this.setState({rawData:n.rawData,markersData:n.markersData},function(){if(t.props.onAllData){e.allMarkers=n.rawData;var r=JSON.parse(JSON.stringify(e));if(r.newData=n.newData,r.currentData=n.currentData,delete r.data,r=_.AppbaseSensorHelper.prepareResultData(r,e.data),t.props.onAllData){r.res&&(r.res.mapRef=t.mapRef);var o=t.props.onAllData(r.res,r.err);t.setState({externalData:o})}}t.streamFlag&&t.streamMarkerInterval()})}},{key:"setGeoQueryInfo",value:function(){var e={key:"geoQuery",value:{queryType:"geo_bounding_box",inputData:this.props.appbaseField,customQuery:this.geoCustomQuery}},t={key:"updateExecute",value:{queryType:"random",inputData:this.props.appbaseField}};_.AppbaseSensorHelper.selectedSensor.setSensorInfo(e),_.AppbaseSensorHelper.selectedSensor.setSensorInfo(t)}},{key:"geoCustomQuery",value:function(e){var t=null;return e&&(this.initialMapBoundQuery||this.searchAsMove)&&(t={geo_bounding_box:a({},this.props.appbaseField,e)},this.geoRelatedEventsChange?this.geoRelatedEventsChange=!1:this.applyGeoQuery&&(this.applyGeoQuery=!1),this.initialMapBoundQuery=!1),t}},{key:"updateExecute",value:function(){setTimeout(function(){var e={key:"updateExecute",value:Math.random()};_.AppbaseSensorHelper.selectedSensor.set(e,!0)},1e3)}},{key:"handleMarkerClick",value:function(e){var t=this;e.showInfo=!0,this.reposition=!1,this.setState({rerender:!0},function(){t.props.popoverTTL&&t.watchPopoverTTL(e)})}},{key:"handleMarkerClose",value:function(e){e.showInfo=!1,this.reposition=!1,this.setState(this.state)}},{key:"watchPopoverTTL",value:function(e){var t=this;this.popoverTTLStore=this.popoverTTLStore?this.popoverTTLStore:{},this.popoverTTLStore[e._type+e._id]?this.clearTTL(e._type+e._id):this.popoverTTLStore[e._type+e._id]=setTimeout(function(){t.handleMarkerClose(e),t.clearTTL(e._type+e._id)},1e3*this.props.popoverTTL)}},{key:"clearTTL",value:function(e){clearTimeout(this.popoverTTLStore[e]),delete this.popoverTTLStore[e]}},{key:"renderInfoWindow",value:function(e,t){var n=this,r=this.props.onPopoverTrigger?this.props.onPopoverTrigger(t):"Popver";return f["default"].createElement(h.InfoWindow,{zIndex:500,key:e+"_info_window",onCloseclick:function(){return n.handleMarkerClose(t)}},f["default"].createElement("div",null,r))}},{key:"handleOnIdle",value:function(){var e=this.mapRef?this.mapRef.getBounds():null;if(e){var t=e.getNorthEast().lat(),n=e.getSouthWest().lat(),r=e.getNorthEast().lng(),o=e.getSouthWest().lng(),a={top_left:[o,t],bottom_right:[r,n]},i={mapBounds:e};if(this.props.onIdle){var s=this.props.onIdle(this.mapRef,{boundingBoxCoordinates:a,mapBounds:e});i.externalData=s}if(this.initialMapBoundQuery||this.applyGeoQuery||this.geoRelatedEventsChange&&this.searchAsMove&&!this.searchQueryProgress){var u=!!this.initialMapBoundQuery||(this.applyGeoQuery?this.applyGeoQuery:this.searchAsMove);this.setValue(a,u)}this.setState(i)}}},{key:"handleOnDrage",value:function(){this.storeCenter=null}},{key:"setValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={key:"geoQuery",value:e};_.AppbaseSensorHelper.selectedSensor.set(n,t)}},{key:"searchAsMoveChange",value:function(e){this.searchAsMove=e,e&&this.mapRef&&(this.geoRelatedEventsChange=!0,this.handleOnIdle())}},{key:"mapStyleChange",value:function(e){this.setState({currentMapStyle:e})}},{key:"handleBoundsChanged",value:function(){var e=this;this.searchQueryProgress&&setTimeout(function(){e.searchQueryProgress=!1},1e3)}},{key:"streamMarkerInterval",value:function(){var e=this,t=this.state.markersData,n=t.filter(function(e){return e.stream&&e.streamStart});n.length?(this.isStreamDataExists=!0,setTimeout(function(){return e.streamToNormal()},1e3*this.props.streamTTL)):this.isStreamDataExists=!1}},{key:"streamToNormal",value:function(){var e=this,t=this.state.markersData,n=t.filter(function(e){return e.stream&&e.streamStart});n.length?(t=t.map(function(t){if(t.stream&&t.streamStart){var n=new Date,r=(n.getTime()-t.streamStart.getTime())/1e3;r>=e.props.streamTTL&&(delete t.stream,delete t.streamStart)}return t}),this.setState({markersData:t})):this.isStreamDataExists=!1}},{key:"getIcon",value:function(e){return e.stream?this.props.streamMarkerImage:this.props.defaultMarkerImage}},{key:"chooseIcon",value:function(e){var t=e.external_icon?e.external_icon:this.getIcon(e);t=this.props.onData?this.props.onData(e):t;var n=!!("object"===("undefined"==typeof t?"undefined":c(t))&&"path"in t);if(n&&(t=JSON.parse(JSON.stringify(t)),this.props.autoMarkerPosition)){var r=e.angleDeg?e.angleDeg:0;t.rotation=r}return t}},{key:"combineProps",value:function(e){var t=void 0,n={};return this.state.externalData&&this.state.externalData.markers&&this.state.externalData.markers[e._id]&&(t=this.state.externalData.markers[e._id],Object.keys(t).forEach(function(r){e["external_"+r]=t[r],n[r]=t[r]})),n.icon=this.chooseIcon(e),n}},{key:"generateMarkers",value:function(){var e=this,t=this,n=this.state.markersData,r={markerComponent:[],defaultCenter:null,convertedGeo:[]};return n&&n.length&&(n=n.filter(function(e){return w.identifyGeoData(e._source[t.props.appbaseField])}),r.markerComponent=n.map(function(n,o){var a=w.identifyGeoData(n._source[t.props.appbaseField]);r.convertedGeo.push(a);var i={position:a},s="marker_ref_"+o,u=void 0;if(e.props.showPopoverOn){u={};var c=e.props.showPopoverOn.split("");c[0]=c[0].toUpperCase(),c=c.join(""),u["on"+c]=e.handleMarkerClick.bind(e,n)}else u={},u.onClick=e.handleMarkerClick.bind(e,n);var p=function(){},d={onClick:e.props.markerOnClick?e.props.markerOnClick:p,onDblclick:e.props.markerOnDblclick?e.props.markerOnDblclick:p,onMouseover:e.props.onMouseover?e.props.onMouseover:p,onMouseout:e.props.onMouseout?e.props.onMouseout:p};return f["default"].createElement(h.Marker,l({},i,{key:n._id,zIndex:1,ref:s},t.combineProps(n),{onClick:function(){return d.onClick(n._source)},onDblclick:function(){return d.onDblclick(n._source)},onMouseover:function(){return d.onMouseover(n._source)},onMouseout:function(){return d.onMouseout(n._source)}},u),n.showInfo?t.renderInfoWindow(s,n):null)}),r.convertedGeo[0]&&(r.defaultCenter={lat:r.convertedGeo[0].lat,lng:r.convertedGeo[0].lng})),this.props.showMarkers||(r.markerComponent=[]),r}},{key:"externalData",value:function(){var e=this,t=[];return this.state.externalData&&Object.keys(this.state.externalData).forEach(function(n){"markers"!==n&&(t=t.concat(e.state.externalData[n]))}),t}},{key:"mapEvents",value:function(e){if(this.geoRelatedEvents.indexOf(e)>-1&&(this.geoRelatedEventsChange=!0),this.props[e]){var t=this.props[e](this.mapRef);t&&this.setState({externalData:t})}}},{key:"getStoreCenter",value:function(){return this.storeCenter?this.storeCenter:this.state.center}},{key:"render",value:function(){var e=this,t=void 0,n=void 0,r=void 0,o=null,a=null,i={},s=this.generateMarkers();t=this.props.setMarkerCluster?f["default"].createElement(y["default"],{averageCenter:!0,enableRetinaIcons:!0,gridSize:60},s.markerComponent):s.markerComponent;var u=!0;"streaming"!==this.channelMethod||this.props.streamAutoCenter||(u=!1),this.props.autoCenter&&this.reposition&&u?(a=s.defaultCenter?s.defaultCenter:this.getStoreCenter(),this.storeCenter=a,this.reposition=!1,i.center=w.normalizeCenter(a)):this.storeCenter?(a=this.storeCenter,i.center=w.normalizeCenter(a)):a=null,this.props.showSearchAsMove&&(n=f["default"].createElement(b.SearchAsMove,{searchAsMoveDefault:this.props.setSearchAsMove,searchAsMoveChange:this.searchAsMoveChange})),this.props.showMapStyles&&(r=f["default"].createElement(T.MapStyles,{defaultSelected:this.props.defaultMapStyle,mapStyleChange:this.mapStyleChange})),this.props.title&&(o=f["default"].createElement("h4",{className:"rbc-title col s12 m8 col-xs-12 col-sm-8"},this.props.title));var c=(0,g["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return f["default"].createElement("div",{className:"rbc rbc-reactivemap col s12 col-xs-12 card thumbnail "+c,style:w.mapPropsStyles(this.props.componentStyle,"component")},o,r,f["default"].createElement(h.GoogleMapLoader,{containerElement:f["default"].createElement("div",{className:"rbc-container col s12 col-xs-12",style:w.mapPropsStyles(this.props.componentStyle,"map",this.mapDefaultHeight)}),googleMapElement:f["default"].createElement(h.GoogleMap,l({ref:function(t){ e.mapRef=t}},i,w.normalizeProps(this.props),{options:{styles:this.state.currentMapStyle},defaultCenter:w.normalizeCenter(this.state.defaultCenter),onDragstart:function(){e.handleOnDrage(),e.mapEvents("onDragstart")},onIdle:function(){return e.handleOnIdle()},onClick:function(){return e.mapEvents("onClick")},onDblclick:function(){return e.mapEvents("onDblclick")},onDrag:function(){return e.mapEvents("onDrag")},onDragend:function(){return e.mapEvents("onDragend")},onMousemove:function(){return e.mapEvents("onMousemove")},onMouseout:function(){return e.mapEvents("onMouseout")},onMouseover:function(){return e.mapEvents("onMouseover")},onResize:function(){return e.mapEvents("onResize")},onRightclick:function(){return e.mapEvents("onRightclick")},onTilesloaded:function(){return e.mapEvents("onTilesloaded")},onBoundsChanged:function(){return e.mapEvents("onBoundsChanged")},onCenterChanged:function(){return e.mapEvents("onCenterChanged")},onProjectionChanged:function(){return e.mapEvents("onProjectionChanged")},onTiltChanged:function(){return e.mapEvents("onTiltChanged")},onZoomChanged:function(){return e.mapEvents("onZoomChanged")}}),t,this.externalData())}),n,f["default"].createElement(_.PoweredBy,null))}}]),t}(d.Component);t["default"]=k,k.propTypes={appbaseField:f["default"].PropTypes.string.isRequired,onIdle:f["default"].PropTypes.func,onAllData:f["default"].PropTypes.func,onData:f["default"].PropTypes.func,onPopoverTrigger:f["default"].PropTypes.func,setMarkerCluster:f["default"].PropTypes.bool,autoMarkerPosition:f["default"].PropTypes.bool,showMarkers:f["default"].PropTypes.bool,streamTTL:w.validation.streamTTL,popoverTTL:w.validation.popoverTTL,size:_.AppbaseSensorHelper.sizeValidation,from:w.validation.fromValidation,autoMapRender:f["default"].PropTypes.bool,componentStyle:f["default"].PropTypes.object,autoCenter:f["default"].PropTypes.bool,showSearchAsMove:f["default"].PropTypes.bool,setSearchAsMove:f["default"].PropTypes.bool,defaultMapStyle:f["default"].PropTypes.oneOf(["Standard","Blue Essence","Blue Water","Flat Map","Light Monochrome","Midnight Commander","Unsaturated Browns"]),title:f["default"].PropTypes.oneOfType([f["default"].PropTypes.string,f["default"].PropTypes.element]),streamAutoCenter:f["default"].PropTypes.bool,defaultMarkerImage:f["default"].PropTypes.string,streamMarkerImage:f["default"].PropTypes.string,stream:f["default"].PropTypes.bool,defaultZoom:w.validation.defaultZoom,applyGeoQuery:f["default"].PropTypes.bool,showPopoverOn:f["default"].PropTypes.oneOf(["click","mouseover"]),defaultCenter:f["default"].PropTypes.shape({lat:w.validation.validCenter,lon:w.validation.validCenter}),react:f["default"].PropTypes.object,markerOnClick:f["default"].PropTypes.func,markerOnDblclick:f["default"].PropTypes.func,onMouseover:f["default"].PropTypes.func,onMouseout:f["default"].PropTypes.func,showMapStyles:f["default"].PropTypes.bool},k.defaultProps={setMarkerCluster:!0,autoCenter:!0,showSearchAsMove:!0,setSearchAsMove:!1,showMapStyles:!0,defaultMapStyle:"Standard",from:0,size:100,streamTTL:5,streamAutoCenter:!1,autoMarkerPosition:!1,showMarkers:!0,autoMapRender:!0,defaultMarkerImage:"https://opensource.appbase.io/reactivemaps/dist/images/historic-pin.png",streamMarkerImage:"https://opensource.appbase.io/reactivemaps/dist/images/stream-pin.png",componentStyle:{},stream:!1,applyGeoQuery:!1,defaultZoom:13},k.contextTypes={appbaseRef:f["default"].PropTypes.any.isRequired,type:f["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ItemCheckboxList=void 0;var s=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0],c[this.state.selectedValue].value);this.props.mapStyleChange(e)}},{key:"render",value:function(){var e=this.state.items.map(function(e,t){return l["default"].createElement("option",{value:t,key:t},e.key)});return l["default"].createElement("div",{className:"input-field col rbc-mapstyles pull-right right"},l["default"].createElement("select",{className:"browser-default form-control",onChange:this.handleSelect,value:this.state.selectedValue,name:"mapStyles",id:"mapStyles"},e))}}]),t}(u.Component);p.propTypes={},p.defaultProps={fieldName:"MapStyles"}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.SearchAsMove=void 0;var s=function(){function e(e,t){for(var n=0;n20)return new Error("zoom value should be an integer between 0 and 20.")},validCenter:function(e,t,n){return isNaN(e[t])?new Error(t+" value must be number"):"lat"===t&&(e[t]<-90||e[t]>90)?new Error(t+" value should be between -90 and 90."):"lng"===t&&(e[t]<-180||e[t]>180)?new Error(t+" value should be between -180 and 180."):void 0},fromValidation:function(e,t,n){if(e[t]<0)return new Error(t+" value should be greater than or equal to 0.")},streamTTL:function(e,t,n){if(e[t]<0||e[t]>1e3)return new Error(t+" should be a positive integer between 0 and 1000, counted in seconds for a streaming update to be visible.")},popoverTTL:function(e,t,n){if(e[t]<.1||e[t]>60)return new Error(t+" should be a positive integer between 1 and 60, counted in seconds for a popover to be visible.")}},t.normalizeCenter=function(e){return e&&e.lon&&(e.lng=e.lon),e});t.normalizeProps=function(e){var t=JSON.parse(JSON.stringify(e));return t.defaultCenter&&(t.defaultCenter=p(t.defaultCenter)),t.center&&(t.center=p(t.center)),t},t.mapPropsStyles=function(e,t,n){var r=JSON.parse(JSON.stringify(e)),o=void 0;return"component"===t?o=r:"map"===t&&(o={height:r.height?r.height:n}),o}},function(e,t){"use strict";e.exports=[{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#e0efef"}]},{featureType:"poi",elementType:"geometry.fill",stylers:[{visibility:"on"},{hue:"#1900ff"},{color:"#c0e8e8"}]},{featureType:"road",elementType:"geometry",stylers:[{lightness:100},{visibility:"simplified"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"transit.line",elementType:"geometry",stylers:[{visibility:"on"},{lightness:700}]},{featureType:"water",elementType:"all",stylers:[{color:"#7dcdcd"}]}]},function(e,t){"use strict";e.exports=[{featureType:"administrative",elementType:"labels.text.fill",stylers:[{color:"#444444"}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#f2f2f2"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"all",stylers:[{saturation:-100},{lightness:45}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"all",stylers:[{color:"#46bcec"},{visibility:"on"}]}]},function(e,t){"use strict";e.exports=[{featureType:"all",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"landscape",elementType:"all",stylers:[{visibility:"on"},{color:"#f3f4f4"}]},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{weight:.9},{visibility:"off"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#83cead"}]},{featureType:"road",elementType:"all",stylers:[{visibility:"on"},{color:"#ffffff"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"on"},{color:"#fee379"}]},{featureType:"road.arterial",elementType:"all",stylers:[{visibility:"on"},{color:"#fee379"}]},{featureType:"water",elementType:"all",stylers:[{visibility:"on"},{color:"#7fc8ed"}]}]},function(e,t){"use strict";e.exports=[{featureType:"administrative.locality",elementType:"all",stylers:[{hue:"#2c2e33"},{saturation:7},{lightness:19},{visibility:"on"}]},{featureType:"landscape",elementType:"all",stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100},{visibility:"simplified"}]},{featureType:"poi",elementType:"all",stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100},{visibility:"off"}]},{featureType:"road",elementType:"geometry",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:31},{visibility:"simplified"}]},{featureType:"road",elementType:"labels",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:31},{visibility:"on"}]},{featureType:"road.arterial",elementType:"labels",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:-2},{visibility:"simplified"}]},{featureType:"road.local",elementType:"geometry",stylers:[{hue:"#e9ebed"},{saturation:-90},{lightness:-8},{visibility:"simplified"}]},{featureType:"transit",elementType:"all",stylers:[{hue:"#e9ebed"},{saturation:10},{lightness:69},{visibility:"on"}]},{featureType:"water",elementType:"all",stylers:[{hue:"#e9ebed"},{saturation:-78},{lightness:67},{visibility:"simplified"}]}]},function(e,t){"use strict";e.exports=[{featureType:"all",elementType:"labels.text.fill",stylers:[{color:"#ffffff"}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{color:"#000000"},{lightness:13}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#144b53"},{lightness:14},{weight:1.4}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#08304b"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#0c4152"},{lightness:5}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#0b434f"},{lightness:25}]},{featureType:"road.arterial",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.arterial",elementType:"geometry.stroke",stylers:[{color:"#0b3d51"},{lightness:16}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#000000"}]},{featureType:"transit",elementType:"all",stylers:[{color:"#146474"}]},{featureType:"water",elementType:"all",stylers:[{color:"#021019"}]}]},function(e,t){"use strict";e.exports=[{featureType:"water",stylers:[{saturation:43},{lightness:-11},{hue:"#0088ff"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{hue:"#ff0000"},{saturation:-100},{lightness:99}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#808080"},{lightness:54}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{color:"#ece2d9"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#ccdca1"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#767676"}]},{featureType:"road",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]},{featureType:"poi",stylers:[{visibility:"off"}]},{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#b8cb93"}]},{featureType:"poi.park",stylers:[{visibility:"on"}]},{featureType:"poi.sports_complex",stylers:[{visibility:"on"}]},{featureType:"poi.medical",stylers:[{visibility:"on"}]},{featureType:"poi.business",stylers:[{visibility:"simplified"}]}]},function(e,t){"use strict";e.exports=[{elementType:"geometry",stylers:[{hue:"#ff4400"},{saturation:-68},{lightness:-4},{gamma:.72}]},{featureType:"road",elementType:"labels.icon"},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{hue:"#0077ff"},{gamma:3.1}]},{featureType:"water",stylers:[{hue:"#00ccff"},{gamma:.44},{saturation:-33}]},{featureType:"poi.park",stylers:[{hue:"#44ff00"},{saturation:-23}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{hue:"#007fff"},{gamma:.77},{saturation:65},{lightness:99}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{gamma:.11},{weight:5.6},{saturation:99},{hue:"#0091ff"},{lightness:-86}]},{featureType:"transit.line",elementType:"geometry",stylers:[{lightness:-48},{hue:"#ff5e00"},{gamma:1.2},{saturation:-23}]},{featureType:"transit",elementType:"labels.text.stroke",stylers:[{saturation:-64},{hue:"#ff9100"},{lightness:16},{gamma:.47},{weight:2.7}]}]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n=0&&e.end>=0&&""!==e.location){var n;t=o({},this.type,(n={},o(n,this.props.appbaseField,e.location),o(n,"from",e.start+this.unit),o(n,"to",e.end+this.unit),n))}return t}},{key:"getCoordinates",value:function(e,t){var n=this;e&&""!==e?m["default"].get("https://maps.googleapis.com/maps/api/geocode/json?address="+e).then(function(e){var r=e.data.results[0].geometry.location;n.locString=r.lat+", "+r.lng,t?t.call(n,n.defaultSelected.label):n.executeQuery()}):p.AppbaseSensorHelper.selectedSensor.set(null,!0)}},{key:"executeQuery",value:function(){if(""!==this.state.currentValue&&this.state.selected&&this.locString){var e,t={key:this.props.componentId,value:{currentValue:this.state.currentValue,start:this.state.selected.start,end:this.state.selected.end,location:this.locString,unit:this.unit}},n={key:this.props.componentId,value:o({},this.sortInfo.type,(e={},o(e,this.props.appbaseField,this.locString),o(e,"order",this.sortInfo.order),o(e,"unit",this.unit),e))};this.props.onValueChange&&this.props.onValueChange(t.value),p.AppbaseSensorHelper.selectedSensor.setSortInfo(n),p.AppbaseSensorHelper.URLParams.update(this.props.componentId,this.setURLValue(),this.props.URLParams),p.AppbaseSensorHelper.selectedSensor.set(t,!0)}}},{key:"setURLValue",value:function(){return JSON.stringify({location:this.state.currentValue,label:this.state.selected.label})}},{key:"handleChange",value:function(e){if(e){var t=e.value;this.setState({currentValue:t}),this.getCoordinates(t)}else{this.setState({currentValue:""});var n={key:this.props.componentId,value:null};this.props.onValueChange&&this.props.onValueChange(n.value),p.AppbaseSensorHelper.URLParams.update(this.props.componentId,null,this.props.URLParams),p.AppbaseSensorHelper.selectedSensor.set(n,!0)}}},{key:"loadOptions",value:function(e,t){var n=this;if(this.callback=t,e){var r=this.googleMaps||window.google.maps;this.autocompleteService=new r.places.AutocompleteService;var o={input:e};this.result={options:[]},this.autocompleteService.getPlacePredictions(o,function(e){e.forEach(function(e){n.result.options.push({label:e.description,value:e.description})}),n.state.userLocation.length&&"Use my current location"!==n.result.options[0].label&&n.result.options.unshift({label:"Use my current location",value:n.state.userLocation}),n.callback(null,n.result)})}else this.callback(null,this.result)}},{key:"handleDistanceChange",value:function(e){this.setState({selected:{start:e.start,end:e.end,label:e.label}},this.executeQuery.bind(this))}},{key:"renderValue",value:function(e){return c["default"].createElement("span",null,e.value)}},{key:"render",value:function(){var e=null;this.props.title&&(e=c["default"].createElement("h4",{className:"rbc-title"},this.props.title));var t=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return c["default"].createElement("div",{className:"rbc rbc-geodistancedropdown clearfix card thumbnail col s12 col-xs-12 "+t,style:this.props.componentStyle},c["default"].createElement("div",{className:"row"},e,c["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},c["default"].createElement(v["default"].Async,{value:this.state.currentValue,loadOptions:this.loadOptions,placeholder:this.props.placeholder,onChange:this.handleChange,filterOption:function(){return!0},valueRenderer:this.renderValue})),c["default"].createElement("div",{className:"col s12 col-xs-12"},c["default"].createElement(v["default"],{value:this.state.selected.label?this.state.selected:"",options:this.props.data,clearable:!1,searchable:!1,onChange:this.handleDistanceChange,placeholder:this.props.placeholderDropdown}))))}}]),t}(l.Component);t["default"]=_,_.propTypes={componentId:c["default"].PropTypes.string.isRequired,appbaseField:c["default"].PropTypes.string.isRequired,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]), customQuery:c["default"].PropTypes.func,defaultSelected:c["default"].PropTypes.shape({label:c["default"].PropTypes.string,location:c["default"].PropTypes.string}),placeholder:c["default"].PropTypes.string,placeholderDropdown:c["default"].PropTypes.string,autoLocation:c["default"].PropTypes.bool,unit:c["default"].PropTypes.oneOf(["mi","miles","yd","yards","ft","feet","in","inch","km","kilometers","m","meters","cm","centimeters","mm","millimeters","NM","nmi","nauticalmiles"]),data:c["default"].PropTypes.arrayOf(c["default"].PropTypes.shape({start:p.AppbaseSensorHelper.validateThreshold,end:p.AppbaseSensorHelper.validateThreshold,label:c["default"].PropTypes.string.isRequired})),onValueChange:c["default"].PropTypes.func,componentStyle:c["default"].PropTypes.object,URLParams:c["default"].PropTypes.bool},_.defaultProps={unit:"mi",placeholder:"Search...",placeholderDropdown:"Select Distance",autoLocation:!0,componentStyle:{},URLParams:!1},_.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n>8-a%1*8)){if(o=t.charCodeAt(a+=.75),o>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|o}return s}),n.atob||(n.atob=function(t){if(t=t.replace(/=+$/,""),t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,s="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?s+=String.fromCharCode(255&n>>(-2*a&6)):0)o=r.indexOf(o);return s})}()},function(e,t){"use strict";function n(){return!1}function r(){return!0}function o(){this.timeStamp=Date.now(),this.target=void 0,this.currentTarget=void 0}Object.defineProperty(t,"__esModule",{value:!0}),o.prototype={isEventObject:1,constructor:o,isDefaultPrevented:n,isPropagationStopped:n,isImmediatePropagationStopped:n,preventDefault:function(){this.isDefaultPrevented=r},stopPropagation:function(){this.isPropagationStopped=r},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=r,this.stopPropagation()},halt:function(e){e?this.stopImmediatePropagation():this.stopPropagation(),this.preventDefault()}},t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return null===e||void 0===e}function a(){return d}function i(){return f}function s(e){var t=e.type,n="function"==typeof e.stopPropagation||"boolean"==typeof e.cancelBubble;l["default"].call(this),this.nativeEvent=e;var r=i;"defaultPrevented"in e?r=e.defaultPrevented?a:i:"getPreventDefault"in e?r=e.getPreventDefault()?a:i:"returnValue"in e&&(r=e.returnValue===f?a:i),this.isDefaultPrevented=r;var o=[],s=void 0,u=void 0,c=void 0,p=h.concat();for(m.forEach(function(e){t.match(e.reg)&&(p=p.concat(e.props),e.fix&&o.push(e.fix))}),u=p.length;u;)c=p[--u],this[c]=e[c];for(!this.target&&n&&(this.target=e.srcElement||document),this.target&&3===this.target.nodeType&&(this.target=this.target.parentNode),u=o.length;u;)(s=o[--u])(this,e);this.timeStamp=e.timeStamp||Date.now()}Object.defineProperty(t,"__esModule",{value:!0});var u=n(411),l=r(u),c=n(9),p=r(c),d=!0,f=!1,h=["altKey","bubbles","cancelable","ctrlKey","currentTarget","eventPhase","metaKey","shiftKey","target","timeStamp","view","type"],m=[{reg:/^key/,props:["char","charCode","key","keyCode","which"],fix:function(e,t){o(e.which)&&(e.which=o(t.charCode)?t.keyCode:t.charCode),void 0===e.metaKey&&(e.metaKey=e.ctrlKey)}},{reg:/^touch/,props:["touches","changedTouches","targetTouches"]},{reg:/^hashchange$/,props:["newURL","oldURL"]},{reg:/^gesturechange$/i,props:["rotation","scale"]},{reg:/^(mousewheel|DOMMouseScroll)$/,props:[],fix:function(e,t){var n=void 0,r=void 0,o=void 0,a=t.wheelDelta,i=t.axis,s=t.wheelDeltaY,u=t.wheelDeltaX,l=t.detail;a&&(o=a/120),l&&(o=0-(l%3===0?l/3:l)),void 0!==i&&(i===e.HORIZONTAL_AXIS?(r=0,n=0-o):i===e.VERTICAL_AXIS&&(n=0,r=o)),void 0!==s&&(r=s/120),void 0!==u&&(n=-1*u/120),n||r||(r=o),void 0!==n&&(e.deltaX=n),void 0!==r&&(e.deltaY=r),void 0!==o&&(e.delta=o)}},{reg:/^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,props:["buttons","clientX","clientY","button","offsetX","relatedTarget","which","fromElement","toElement","offsetY","pageX","pageY","screenX","screenY"],fix:function(e,t){var n=void 0,r=void 0,a=void 0,i=e.target,s=t.button;return i&&o(e.pageX)&&!o(t.clientX)&&(n=i.ownerDocument||document,r=n.documentElement,a=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||a&&a.scrollLeft||0)-(r&&r.clientLeft||a&&a.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||a&&a.scrollTop||0)-(r&&r.clientTop||a&&a.clientTop||0)),e.which||void 0===s||(1&s?e.which=1:2&s?e.which=3:4&s?e.which=2:e.which=0),!e.relatedTarget&&e.fromElement&&(e.relatedTarget=e.fromElement===i?e.toElement:e.fromElement),e}}],y=l["default"].prototype;(0,p["default"])(s.prototype,y,{constructor:s,preventDefault:function(){var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=f,y.preventDefault.call(this)},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=d,y.stopPropagation.call(this)}}),t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){function r(t){var r=new i["default"](t);n.call(e,r)}return e.addEventListener?(e.addEventListener(t,r,!1),{remove:function(){e.removeEventListener(t,r,!1)}}):e.attachEvent?(e.attachEvent("on"+t,r),{remove:function(){e.detachEvent("on"+t,r)}}):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var a=n(412),i=r(a);e.exports=t["default"]},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;var o=t.type,a=t.body;delete t.type,delete t.body;var i;return i=o?o+"/_bulk":"/_bulk",e.performStreamingRequest({method:"POST",path:i,params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;delete t.type,delete t.id;var i=o+"/"+a;return e.performStreamingRequest({method:"DELETE",path:i,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;delete t.type,delete t.id;var i=o+"/"+a;return e.performStreamingRequest({method:"GET",path:i,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(140),o=function(e){var t=r.obj(function(e,t,n){var r=Object.keys(e)[0],o=Object.keys(e[r].mappings).filter(function(e){return"_default_"!==e});this.push(o),n()});return t.writable=!1,e.performStreamingRequest({method:"GET",path:"_mapping"}).pipe(t)};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",body:"object"});if(n!==!0)throw n;var o=t.type,a=t.id,i=t.body;delete t.type,delete t.id,delete t.body;var s;return s=a?o+"/"+a:o,e.performStreamingRequest({method:"POST",path:s,params:t,body:i})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;var o;o=t.type.constructor===Array?t.type.join():t.type;var a=t.body;delete t.type,delete t.body;var i;return i=o?o+"/_search":"/_search",e.performStreamingRequest({method:"POST",path:i,params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;return delete t.type,delete t.id,delete t.stream,t.stream===!0||"true"===t.stream?t.stream="true":(delete t.stream,t.streamonly="true"),e.performWsRequest({method:"GET",path:o+"/"+a,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;if(void 0===t.type||"string"!=typeof t.type&&t.type.constructor!==Array||""===t.type||0===t.type.length)throw new Error("fields missing: type");var o;o=t.type.constructor===Array?t.type.join():t.type;var o=t.type,a=t.body;return delete t.type,delete t.body,delete t.stream,t.streamonly="true",e.performWsRequest({method:"POST",path:o+"/_search",params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string",body:"object"});if(n!==!0)throw n;var o=t.type,a=t.id,i=t.body;delete t.type,delete t.id,delete t.body;var s=o+"/"+a+"/_update";return e.performStreamingRequest({method:"POST",path:s,params:t,body:i})};e.exports=o},function(e,t,n){"use strict";var r=n(565),o=n(34),a=function(e,t,n){var a=o.validate(t,{body:"object"});if(a!==!0)throw a;if(void 0===t.type||"string"!=typeof t.type&&t.type.constructor!==Array||""===t.type||0===t.type.length)throw new Error("fields missing: type");if(a=o.validate(t.body,{query:"object"}),a!==!0)throw a;if(t.type.constructor===Array?(this.type=t.type,this.type_string=t.type.join()):(this.type=[t.type],this.type_string=t.type),this.webhooks=[],this.client=e,this.query=t.body.query,"string"==typeof n){var i={};i.url=n,i.method="GET",this.webhooks.push(i)}else if(n.constructor===Array)this.webhooks=n;else{if(n!==Object(n))throw new Error("fields missing: second argument(webhook) is necessary");this.webhooks.push(n)}this.populateBody();var s=btoa(r(this.query)),u=".percolator/webhooks-0-"+this.type_string+"-0-"+s;return this.path=u,this.performRequest("POST")};a.prototype.populateBody=function(){this.body={},this.body.webhooks=this.webhooks,this.body.query=this.query,this.body.type=this.type},a.prototype.performRequest=function(e){var t=this.client.performStreamingRequest({method:e,path:this.path,body:this.body});return t.change=this.change.bind(this),t.stop=this.stop.bind(this),t},a.prototype.change=function(e){if(this.webhooks=[],"string"==typeof e){var t={};t.url=e,t.method="POST",this.webhooks.push(t)}else if(e.constructor===Array)this.webhooks=e;else{if(e!==Object(e))throw new Error("fields missing: one of webhook or url fields is required");this.webhooks.push(e)}return this.populateBody(),this.performRequest("POST")},a.prototype.stop=function(){return delete this.body,this.performRequest("DELETE")},e.exports=a},function(e,t,n){"use strict";var r=n(142),o=n(425),a=n(426),i=n(427),s=n(418),u=n(416),l=n(422),c=n(415),p=n(414),d=n(419),f=n(417),h=n(423),m=n(420),y=n(421),v=function g(e){if(!(this instanceof g))return new g(e);if("string"!=typeof e.url||""===e.url)throw new Error("URL not present in options.");var t=r.parse(e.url);if(this.url=t.host,this.protocol=t.protocol,this.credentials=t.auth,this.appname=e.appname||e.app,"string"!=typeof this.appname||""===this.appname)throw new Error("App name is not present in options.");if("string"!=typeof this.protocol||""===this.protocol)throw new Error("Protocol is not present in url. URL should be of the form https://scalr.api.appbase.io");if("string"==typeof e.username&&""!==e.username&&"string"==typeof e.password&&""!==e.password&&(this.credentials=e.username+":"+e.password),"string"==typeof e.credentials&&""!==e.credentials&&(this.credentials=e.credentials),"string"!=typeof this.credentials||""===this.credentials)throw new Error("Authentication information is not present. Did you add credentials?");"https:"===t.protocol?this.ws=new o("wss://"+t.host+"/"+this.appname):this.ws=new o("ws://"+t.host+"/"+this.appname),"/"===this.url.slice(-1)&&(this.url=this.url.slice(0,-1));var n={};return n.index=this.index.bind(this),n.get=this.get.bind(this),n.update=this.update.bind(this),n["delete"]=this["delete"].bind(this),n.bulk=this.bulk.bind(this),n.search=this.search.bind(this),n.getStream=this.getStream.bind(this),n.searchStream=this.searchStream.bind(this),n.searchStreamToURL=this.searchStreamToURL.bind(this),n.getTypes=this.getTypes.bind(this),n};v.prototype.performWsRequest=function(e){return new i(this,JSON.parse(JSON.stringify(e)))},v.prototype.performStreamingRequest=function(e){return new a(this,JSON.parse(JSON.stringify(e)))},v.prototype.index=function(e){return new s(this,JSON.parse(JSON.stringify(e)))},v.prototype.get=function(e){return new u(this,JSON.parse(JSON.stringify(e)))},v.prototype.update=function(e){return new l(this,JSON.parse(JSON.stringify(e)))},v.prototype["delete"]=function(e){return new c(this,JSON.parse(JSON.stringify(e)))},v.prototype.bulk=function(e){return new p(this,JSON.parse(JSON.stringify(e)))},v.prototype.search=function(e){return new d(this,JSON.parse(JSON.stringify(e)))},v.prototype.getStream=function(e){return new m(this,JSON.parse(JSON.stringify(e)))},v.prototype.searchStream=function(e){return new y(this,JSON.parse(JSON.stringify(e)))},v.prototype.searchStreamToURL=function(e,t){return new h(this,JSON.parse(JSON.stringify(e)),JSON.parse(JSON.stringify(t)))},v.prototype.getTypes=function(){return new f(this)},"undefined"!=typeof window&&(window.Appbase=v),e.exports=v},function(e,t,n){"use strict";var r="undefined"!=typeof window?window.WebSocket:n(748),o=n(36).EventEmitter,a=function(e){var t=new r(e),n=new o;return n.setMaxListeners(0),n.send=function(e){return 1===t.readyState?(t.send(JSON.stringify(e)),this):void n.on("open",function r(){t.send(JSON.stringify(e)),n.removeListener("open",r)})},t.onopen=function(){n.emit("open")},t.onmessage=function(e){var t=JSON.parse(e.data);n.emit("message",t)},t.onerror=function(e){n.emit("error",e)},t.onclose=function(e){n.emit("close",e)},n};e.exports=a},function(e,t,n){(function(t){"use strict";var r=n(553),o=n(733),a=n(113),i=n(140),s=function(e,t){if(this.client=e,this.args=t,this.method=t.method,this.path=t.path,this.params=t.params,this.body=t.body,(!this.body||"object"!=typeof this.body&&this.body.constructor!==Array)&&(this.body={}),this.body.constructor===Array){var n=this.body;this.body="";for(var r=0;r=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;ts.bottom||i.topt.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var n=this,r="object"==typeof t?t:this.props;if(r.multi){if("string"==typeof e&&(e=e.split(r.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return n.expandValue(e,r)}).filter(function(e){return e})}var o=this.expandValue(e,r);return o?[o]:[]},expandValue:function(e,t){var n=typeof e;if("string"!==n&&"number"!==n&&"boolean"!==n)return e;var r=t.options,o=t.valueKey;if(r)for(var a=0;ar&&this.focusOption(n[r+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var n=-1,r=0;r0?n-=1:n=t.length-1;else if("start"===e)n=0;else if("end"===e)n=t.length-1;else if("page_up"===e){var o=n-this.props.pageSize;n=o<0?0:o}else if("page_down"===e){var o=n+this.props.pageSize;n=o>t.length-1?t.length-1:o}n===-1&&(n=0),this.setState({focusedIndex:t[n].index,focusedOption:t[n].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return l["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},l["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var n=this,r=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:l["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var a=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return l["default"].createElement(o,{id:n._instancePrefix+"-value-"+t,instancePrefix:n._instancePrefix,disabled:n.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[n.props.valueKey],onClick:a,onRemove:n.removeValue,value:e},r(e,t),l["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(a=null),l["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:a,value:e[0]},r(e[0])))},renderInput:function(e,t){var n,r=this,i=(0,m["default"])("Select-input",this.props.inputProps.className),u=!!this.state.isOpen,c=(0,m["default"])((n={},a(n,this._instancePrefix+"-list",u),a(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),p=s({},this.props.inputProps,{role:"combobox","aria-expanded":""+u,"aria-owns":c,"aria-haspopup":""+u,"aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:i,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(p);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,h=(d.inputClassName,o(d,["inputClassName"]));return l["default"].createElement("div",s({},h,{role:"combobox","aria-expanded":u,"aria-owns":u?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:i,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?l["default"].createElement(f["default"],s({},p,{minWidth:"5"})):l["default"].createElement("div",{className:i},l["default"].createElement("input",p))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return l["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,n=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return l["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},n)},filterOptions:function N(e){var t=this.state.inputValue,n=this.props.options||[];if(this.props.filterOptions){var N="function"==typeof this.props.filterOptions?this.props.filterOptions:_["default"];return N(n,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return n},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,n){return e&&e.length?this.props.menuRenderer({focusedOption:n,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?l["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var n=e.map(function(e){return i(e[t.props.valueKey])}).join(this.props.delimiter);return l["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:n,disabled:this.props.disabled})}return e.map(function(e,n){return l["default"].createElement("input",{key:"hidden."+n,type:"hidden",ref:"value"+n,name:t.props.name,value:i(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var n=this.state.focusedOption||e;if(n&&!n.disabled){var r=t.indexOf(n);if(r!==-1)return r}for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c){var d={startTime:(new Date).getTime(),appliedQuery:u},f=this.appbaseRef[t];if(f){var h=u;h.type="*"===this.type[t]?"":this.type[t],h.preference=this.app[t],n(d),f.search(h).on("data",function(e){d.mode="historic",d.data=o.highlightModify(e,d.appliedQuery),i.emitter.emit(t,d);var n=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:d,react:s.react,queryOptions:n})}).on("error",function(e){var n={appliedQuery:d.appliedQuery,error:e,startTime:d.startTime};i.emitter.emit(t,n)}),s.stream&&r.call(this,t,u,f)}else console.error("appbaseRef is not set for "+t)}else{var m={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,m)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t){"use strict";function n(e,t){for(var n=[],r={object:null,string:""},o=Object.keys(t),a=o,i=Array.isArray(a),s=0,a=i?a:a[Symbol.iterator]();;){var u;if(i){if(s>=a.length)break;u=a[s++]}else{if(s=a.next(),s.done)break;u=s.value}var l=u,c=t[l];typeof e[l]===c&&e[l]!==r[c]||n.push(l)}for(var p="",d=0;d0)||new Error("fields missing: "+p)}e.exports={validate:n}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],i(n))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:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,u=0;u0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n), +"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;ts.bottom||i.topt.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var n=this,r="object"==typeof t?t:this.props;if(r.multi){if("string"==typeof e&&(e=e.split(r.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return n.expandValue(e,r)}).filter(function(e){return e})}var o=this.expandValue(e,r);return o?[o]:[]},expandValue:function(e,t){var n=typeof e;if("string"!==n&&"number"!==n&&"boolean"!==n)return e;var r=t.options,o=t.valueKey;if(r)for(var a=0;ar&&this.focusOption(n[r+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var n=-1,r=0;r0?n-=1:n=t.length-1;else if("start"===e)n=0;else if("end"===e)n=t.length-1;else if("page_up"===e){var o=n-this.props.pageSize;n=o<0?0:o}else if("page_down"===e){var o=n+this.props.pageSize;n=o>t.length-1?t.length-1:o}n===-1&&(n=0),this.setState({focusedIndex:t[n].index,focusedOption:t[n].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return l["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},l["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var n=this,r=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:l["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var a=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return l["default"].createElement(o,{id:n._instancePrefix+"-value-"+t,instancePrefix:n._instancePrefix,disabled:n.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[n.props.valueKey],onClick:a,onRemove:n.removeValue,value:e},r(e,t),l["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(a=null),l["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:a,value:e[0]},r(e[0])))},renderInput:function(e,t){var n,r=this,i=(0,m["default"])("Select-input",this.props.inputProps.className),u=!!this.state.isOpen,c=(0,m["default"])((n={},a(n,this._instancePrefix+"-list",u),a(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),p=s({},this.props.inputProps,{role:"combobox","aria-expanded":""+u,"aria-owns":c,"aria-haspopup":""+u,"aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:i,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(p);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,h=(d.inputClassName,o(d,["inputClassName"]));return l["default"].createElement("div",s({},h,{role:"combobox","aria-expanded":u,"aria-owns":u?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:i,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?l["default"].createElement(f["default"],s({},p,{minWidth:"5"})):l["default"].createElement("div",{className:i},l["default"].createElement("input",p))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return l["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,n=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return l["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},n)},filterOptions:function N(e){var t=this.state.inputValue,n=this.props.options||[];if(this.props.filterOptions){var N="function"==typeof this.props.filterOptions?this.props.filterOptions:_["default"];return N(n,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return n},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,n){return e&&e.length?this.props.menuRenderer({focusedOption:n,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?l["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var n=e.map(function(e){return i(e[t.props.valueKey])}).join(this.props.delimiter);return l["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:n,disabled:this.props.disabled})}return e.map(function(e,n){return l["default"].createElement("input",{key:"hidden."+n,type:"hidden",ref:"value"+n,name:t.props.name,value:i(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var n=this.state.focusedOption||e;if(n&&!n.disabled){var r=t.indexOf(n);if(r!==-1)return r}for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c)!function(){var e={startTime:(new Date).getTime(),appliedQuery:u},a=o.appbaseRef[t];if(a){var l=u;l.type="*"===o.type[t]?"":o.type[t],l.preference=o.app[t],n(e),a.search(l).on("data",function(n){e.mode="historic",e.data=o.highlightModify(n,e.appliedQuery),i.emitter.emit(t,e);var r=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:e,react:s.react,queryOptions:r})}).on("error",function(n){var r={appliedQuery:e.appliedQuery,error:n,startTime:e.startTime};i.emitter.emit(t,r)}),s.stream&&r.call(o,t,u,a)}else console.error("appbaseRef is not set for "+t)}();else{var d={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,d)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t){"use strict";function n(e,t){for(var n=[],r={object:null,string:""},o=Object.keys(t),a=o,i=Array.isArray(a),s=0,a=i?a:a[Symbol.iterator]();;){var u;if(i){if(s>=a.length)break;u=a[s++]}else{if(s=a.next(),s.done)break;u=s.value}var l=u,c=t[l];typeof e[l]===c&&e[l]!==r[c]||n.push(l)}for(var p="",d=0;d0)||new Error("fields missing: "+p)}e.exports={validate:n}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],i(n))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:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,u=0;u0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n), o||(o=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var o=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,o,i,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=i;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.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(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a];s?this[a]=s(n):"target"===a?this.target=r:this[a]=n[a]}var u=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;return u?this.isDefaultPrevented=i.thatReturnsTrue:this.isDefaultPrevented=i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse,this}var o=n(9),a=n(47),i=n(25),s=(n(5),"function"==typeof Proxy,["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),u={type:null,target:null,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};o(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=i.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=i.thatReturnsTrue)},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n-1)return!1;if(r.filterOption)return r.filterOption.call(o,e,t);if(!t)return!0;var a=String(e[r.valueKey]),s=String(e[r.labelKey]);return r.ignoreAccents&&("label"!==r.matchProp&&(a=(0,i["default"])(a)),"value"!==r.matchProp&&(s=(0,i["default"])(s))),r.ignoreCase&&("label"!==r.matchProp&&(a=a.toLowerCase()),"value"!==r.matchProp&&(s=s.toLowerCase())),"start"===r.matchPos?"label"!==r.matchProp&&a.substr(0,t.length)===t||"value"!==r.matchProp&&s.substr(0,t.length)===t:"label"!==r.matchProp&&a.indexOf(t)>=0||"value"!==r.matchProp&&s.indexOf(t)>=0})}var a=n(350),i=r(a);e.exports=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.focusedOption,n=e.instancePrefix,r=(e.labelKey,e.onFocus),o=e.onSelect,a=e.optionClassName,s=e.optionComponent,l=e.optionRenderer,c=e.options,p=e.valueArray,d=e.valueKey,f=e.onOptionRef,h=s;return c.map(function(e,s){var c=p&&p.indexOf(e)>-1,m=e===t,y=(0,i["default"])(a,{"Select-option":!0,"is-selected":c,"is-focused":m,"is-disabled":e.disabled});return u["default"].createElement(h,{className:y,instancePrefix:n,isDisabled:e.disabled,isFocused:m,isSelected:c,key:"option-"+s+"-"+e[d],onFocus:r,onSelect:o,option:e,optionIndex:s,ref:function(e){f(e,m)}},l(e,s))})}var a=n(3),i=r(a),s=n(2),u=r(s);e.exports=o},function(e,t){"use strict";var n=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];e.exports=function(e){for(var t=0;t0)if(t.ended&&!o){var i=new Error("stream.push() after EOF");e.emit("error",i)}else if(t.endEmitted&&o){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var l;!t.decoder||o||r||(n=t.decoder.write(n),l=!t.objectMode&&0===n.length),o||(t.reading=!1),l||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,o?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&d(e))),h(e,t)}else o||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length=B?e=B:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function l(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function c(e,t){var n=null;return j.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function p(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,d(e)}}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(N("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?O(f,e):f(e))}function f(e){N("emit readable"),e.emit("readable"),b(e)}function h(e,t){t.readingMore||(t.readingMore=!0,O(m,e,t))}function m(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=M(e,t.buffer,t.decoder),n}function M(e,t,n){var r;return ea.length?a.length:e;if(o+=i===a.length?a:a.slice(0,e),e-=i,0===e){i===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(i));break}++r}return t.length-=r,o}function k(e,t){var n=Y.allocUnsafe(e),r=t.head,o=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,i=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,i),e-=i,0===e){i===a.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(i));break}++o}return t.length-=o,n}function S(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,O(P,t,e))}function P(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function L(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return N("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?S(this):d(this),null;if(e=l(e,t),0===e&&t.ended)return 0===t.length&&S(this),null;var r=t.needReadable;N("need readable",r),(0===t.length||t.length-e0?T(e,t):null,null===o?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&S(this)),null!==o&&this.emit("data",o),o},a.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},a.prototype.pipe=function(e,n){function o(e){N("onunpipe"),e===d&&i()}function a(){N("onend"),e.end()}function i(){N("cleanup"),e.removeListener("close",l),e.removeListener("finish",c),e.removeListener("drain",v),e.removeListener("error",u),e.removeListener("unpipe",o),d.removeListener("end",a),d.removeListener("end",i),d.removeListener("data",s),g=!0,!f.awaitDrain||e._writableState&&!e._writableState.needDrain||v()}function s(t){N("ondata"),_=!1;var n=e.write(t);!1!==n||_||((1===f.pipesCount&&f.pipes===e||f.pipesCount>1&&L(f.pipes,e)!==-1)&&!g&&(N("false write response, pause",d._readableState.awaitDrain),d._readableState.awaitDrain++,_=!0),d.pause())}function u(t){N("onerror",t),p(),e.removeListener("error",u),0===C(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",c),p()}function c(){N("onfinish"),e.removeListener("close",l),p()}function p(){N("unpipe"),d.unpipe(e)}var d=this,f=this._readableState;switch(f.pipesCount){case 0:f.pipes=e;break;case 1:f.pipes=[f.pipes,e];break;default:f.pipes.push(e)}f.pipesCount+=1,N("pipe count=%d opts=%j",f.pipesCount,n);var h=(!n||n.end!==!1)&&e!==t.stdout&&e!==t.stderr,m=h?a:i;f.endEmitted?O(m):d.once("end",m),e.on("unpipe",o);var v=y(d);e.on("drain",v);var g=!1,_=!1;return d.on("data",s),r(e,"error",u),e.once("close",l),e.once("finish",c),e.emit("pipe",d),f.flowing||(N("pipe resume"),d.resume()),e},a.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?r:S;s.WritableState=i;var L=n(14);L.inherits=n(11);var D={deprecate:n(745)},O=n(359),E=n(15).Buffer,C=n(78);L.inherits(s,O),i.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(i.prototype,"buffer",{get:D.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var x;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(x=Function.prototype[Symbol.hasInstance],Object.defineProperty(s,Symbol.hasInstance,{value:function(e){return!!x.call(this,e)||e&&e._writableState instanceof i}})):x=function(e){return e instanceof this},s.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},s.prototype.write=function(e,t,n){var r=this._writableState,a=!1,i=E.isBuffer(e);return"function"==typeof t&&(n=t,t=null),i?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=o),r.ended?u(this,n):(i||l(this,r,e,n))&&(r.pendingcb++,a=p(this,r,i,e,t,n)),a},s.prototype.cork=function(){var e=this._writableState;e.corked++},s.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||g(this,e))},s.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},s.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},s.prototype._writev=null,s.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)}}).call(t,n(7),n(141).setImmediate)},function(e,t,n){e.exports=n(36).EventEmitter},function(e,t,n){"use strict";function r(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function o(e){var t=r(e);if("string"!=typeof t&&(g.isEncoding===b||!b(e)))throw new Error("Unknown encoding: "+e);return t||e}function a(e){this.encoding=o(e);var t;switch(this.encoding){case"utf16le":this.text=d,this.end=f,t=4;break;case"utf8":this.fillLast=l,t=4;break;case"base64":this.text=h,this.end=m,t=3;break;default:return this.write=y,void(this.end=v)}this.lastNeed=0,this.lastTotal=0,this.lastChar=_.allocUnsafe(t)}function i(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:-1}function s(e,t,n){var r=t.length-1;if(r=0?(o>0&&(e.lastNeed=o-1),o):--r=0?(o>0&&(e.lastNeed=o-2),o):--r=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0))}function u(e,t,n){if(128!==(192&t[0]))return e.lastNeed=0,"�".repeat(n);if(e.lastNeed>1&&t.length>1){if(128!==(192&t[1]))return e.lastNeed=1,"�".repeat(n+1);if(e.lastNeed>2&&t.length>2&&128!==(192&t[2]))return e.lastNeed=2,"�".repeat(n+2)}}function l(e){var t=this.lastTotal-this.lastNeed,n=u(this,e,t);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�".repeat(this.lastTotal-this.lastNeed):t}function d(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function f(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function h(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function m(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function y(e){return e.toString(this.encoding)}function v(e){return e&&e.length?this.write(e):""}var g=n(15).Buffer,_=n(78),b=g.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n&&n.and?"string"==typeof n.and&&(n.and=[n.and]):n.and=[],n.and.push("streamChanges"),this.sortObj&&this.enableSort(n);var r=h["default"].create(this.context.appbaseRef,this.context.type,n,this.props.size,this.props.from,this.props.stream,this.context.app);if(this.channelId=r.channelId,this.channelListener=r.emitter.addListener(r.channelId,function(t){if(t.error&&t.startTime>e.queryStartTime&&(e.setState({queryStart:!1,showPlaceholder:!1}),e.props.onAllData)){var n=L.prepareResultData(t);e.props.onAllData(n.res,n.err)}if(t.appliedQuery)if("historic"===t.mode&&t.startTime>e.queryStartTime){var r=!(!t.appliedQuery||!t.data||t.data.error||t.data.hits&&t.data.hits.total),o={resultFound:!!(t.appliedQuery&&t.data&&!t.data.error&&t.data.hits&&t.data.hits.total)};t.appliedQuery&&t.data&&!t.data.error&&(o.total=t.data.hits.total,o.took=t.data.took),e.setState({queryStart:!1,visibleNoResults:r,resultStats:o,showPlaceholder:!1}),e.afterChannelResponse(t)}else"streaming"===t.mode&&(e.afterChannelResponse(t),e.updateResultStats(t.data));else e.setState({showPlaceholder:!0})}),this.listenLoadingChannel(r),t){var o={key:"streamChanges",value:""};L.selectedSensor.set(o,!0)}}},{key:"updateResultStats",value:function(e){var t=this.state.resultStats;t.total=L.updateStats(t.total,e),this.setState({resultStats:t})}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"afterChannelResponse",value:function(e){var t=this,n=e.data,r=void 0,o=void 0,a=[],i=[];if(this.streamFlag=!1,"streaming"===e.mode)this.channelMethod="streaming",a=n,a.stream=!0,i=this.state.currentData,this.streamFlag=!0,o=this.setMarkersData(r);else if("historic"===e.mode){this.queryStartTime=e.startTime,this.channelMethod="historic",a=n.hits&&n.hits.hits?n.hits.hits:[];var s=this.normalizeCurrentData(e,this.state.currentData,a);a=s.newData,i=s.currentData}this.setState({rawData:r,newData:a,currentData:i,markersData:o,isLoading:!1},function(){e.allMarkers=r;var n=JSON.parse(JSON.stringify(e));n.newData=t.state.newData,n.currentData=t.state.currentData,delete n.data,n=L.prepareResultData(n,e.data);var o=t.props.onAllData?t.props.onAllData(n.res,n.err):t.defaultonAllData(n.res,n.err);t.setState({resultMarkup:o,currentData:t.combineCurrentData(a)})})}},{key:"normalizeCurrentData",value:function(e,t,n){var r=JSON.parse(JSON.stringify(e.appliedQuery)),o=JSON.stringify(r)===JSON.stringify(this.appliedQuery)?t||[]:[];return o.length?n=n.filter(function(e){var t=!0;return o.forEach(function(n){e._id+"-"+e._type==n._id+"-"+n._type&&(t=!1)}),t}):this.appliedQuery=r,{currentData:o,newData:n}}},{key:"combineCurrentData",value:function(e){return P["default"].isArray(e)?this.state.currentData.concat(e):this.streamDataModify(this.state.currentData,e)}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.createChannel(e)}},{key:"removeChannel",value:function(){this.channelId&&(h["default"].stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"render",value:function(){var e=null,t=null,n=(0,d["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-stream-active":this.props.stream,"rbc-stream-inactive":!this.props.stream,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader,"rbc-resultstats-active":this.props.showResultStats,"rbc-resultstats-inactive":!this.props.showResultStats,"rbc-noresults-active":this.props.noResults,"rbc-noresults-inactive":!this.props.noResults});return this.props.title&&(e=c["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.props.placeholder&&(t=c["default"].createElement("div",{className:"rbc-placeholder col s12 col-xs-12"},this.props.placeholder)),c["default"].createElement("div",{className:"rbc-reactiveelement-container"},c["default"].createElement("div",{className:"rbc rbc-reactiveelement card thumbnail "+n,style:this.props.componentStyle},e,this.state.resultStats&&this.state.resultStats.resultFound&&this.props.showResultStats?c["default"].createElement(M["default"],{onResultStats:this.props.onResultStats,took:this.state.resultStats.took,total:this.state.resultStats.total}):null,this.state.resultMarkup,this.state.showPlaceholder?t:null),this.props.noResults&&this.state.visibleNoResults?c["default"].createElement(b["default"],{defaultText:this.props.noResults.text}):null,this.props.initialLoader&&this.state.queryStart?c["default"].createElement(g["default"],{defaultText:this.props.initialLoader.text}):null,c["default"].createElement(y["default"],{container:"rbc-reactiveelement-container"}))}}]),t}(l.Component);t["default"]=D,D.propTypes={componentId:c["default"].PropTypes.string,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),from:L.validation.resultListFrom,onAllData:c["default"].PropTypes.func,size:L.sizeValidation,stream:c["default"].PropTypes.bool,componentStyle:c["default"].PropTypes.object,initialLoader:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),noResults:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),showResultStats:c["default"].PropTypes.bool,onResultStats:c["default"].PropTypes.func,react:c["default"].PropTypes.object,placeholder:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element])},D.defaultProps={from:0,size:20,stream:!1,showResultStats:!0,componentStyle:{}},D.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired,app:c["default"].PropTypes.any.isRequired},D.types={componentId:k.STRING,title:k.STRING,react:k.OBJECT,from:k.NUMBER,size:k.NUMBER,onAllData:k.FUNCTION,stream:k.BOOLEAN,componentStyle:k.OBJECT,initialLoader:k.STRING,noResults:k.STRING,showResultStats:k.BOOLEAN,onResultStats:k.FUNCTION,placeholder:k.STRING}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nt.height(),i=n.get(0).scrollHeight>n.height();if(!a&&!i&&n.length&&!e.props.pagination){var s=o(t.find(".rbc-title"))+o(t.find(".rbc-pagination"))*t.find(".rbc-pagination").length,u=t.height()-60-s;u>0&&n.css({height:n.height()+15,"padding-bottom":20})}};t&&t.length&&n&&n.length&&(n.css({height:"auto","padding-bottom":0}),setTimeout(a.bind(this),1e3))}},{key:"removeChannel",value:function(){this.channelId&&(m["default"].stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"createChannel",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n&&n.and?"string"==typeof n.and&&(n.and=[n.and]):n.and=[],n.and.push("streamChanges"),this.props.pagination&&(n.and.push("paginationChanges"),n.pagination=null),this.sortObj&&this.enableSort(n);var r=m["default"].create(this.context.appbaseRef,this.context.type,n,this.props.size,this.props.from,this.props.stream,this.context.app);this.channelId=r.channelId,this.channelListener=r.emitter.addListener(r.channelId,function(t){if(t.error&&t.startTime>e.queryStartTime&&(e.setState({queryStart:!1,showPlaceholder:!1}),e.props.onAllData)){var n=x.prepareResultData(t);e.props.onAllData(n.res,n.err)}if(t.appliedQuery)if("historic"===t.mode&&t.startTime>e.queryStartTime){var r=!(!(t.appliedQuery&&Object.keys(t.appliedQuery).length&&t.data)||t.data.error||t.data.hits&&t.data.hits.total),o={resultFound:!!(t.appliedQuery&&t.data&&!t.data.error&&t.data.hits&&t.data.hits.total)};t.appliedQuery&&t.data&&!t.data.error&&(o.total=t.data.hits.total,o.took=t.data.took),e.setState({queryStart:!1,visibleNoResults:r,resultStats:o,showPlaceholder:!1}),e.afterChannelResponse(t)}else"streaming"===t.mode&&(e.afterChannelResponse(t),e.updateResultStats(t.data));else e.setState({showPlaceholder:!0})}),this.listenLoadingChannel(r),t&&setTimeout(function(){var e={key:"streamChanges",value:""};x.selectedSensor.set(e,!0)},100)}},{key:"updateResultStats",value:function(e){var t=this.state.resultStats;t.total=x.updateStats(t.total,e),this.setState({resultStats:t})}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){if(e.appliedQuery){var n=!(t.state.requestOnScroll&&e.appliedQuery.body&&e.appliedQuery.body.from);t.setState({queryStart:e.queryState,showInitialLoader:n})}})}},{key:"afterChannelResponse",value:function(e){var t=this,n=e.data,r=void 0,o=void 0,a=[],i=[];if(this.streamFlag=!1,"streaming"===e.mode)this.channelMethod="streaming",a=n,a.stream=!0,i=this.state.currentData,this.streamFlag=!0,o=this.setMarkersData(r);else if("historic"===e.mode){this.queryStartTime=e.startTime,this.channelMethod="historic",a=n.hits&&n.hits.hits?n.hits.hits:[];var s=this.normalizeCurrentData(e,this.state.currentData,a);a=s.newData,i=s.currentData}this.setState({rawData:r,newData:a,currentData:i,markersData:o,isLoading:!1},function(){e.allMarkers=r;var o=JSON.parse(JSON.stringify(e));o.newData=t.state.newData,o.currentData=t.state.currentData,delete o.data,o=x.prepareResultData(o,n);var i=t.props.onAllData?t.props.onAllData(o.res,o.err):t.defaultonAllData(o.res,o.err);t.setState({resultMarkup:t.wrapMarkup(i),currentData:t.combineCurrentData(a)})})}},{key:"wrapMarkup",value:function(e){var t=null;return t=C["default"].isArray(e)?e.map(function(e,t){return p["default"].createElement("div",{key:t,className:"rbc-list-item"},e)}):e}},{key:"normalizeCurrentData",value:function(e,t,n){var r=JSON.parse(JSON.stringify(e.appliedQuery));this.state.requestOnScroll&&r&&r.body&&(delete r.body.from,delete r.body.size);var o=JSON.stringify(r)===JSON.stringify(this.appliedQuery),a=o?t||[]:[];return a.length?n=n.filter(function(e){var t=!0;return a.forEach(function(n){e._id+"-"+e._type==n._id+"-"+n._type&&(t=!1)}),t}):this.appliedQuery=r,o||j(".rbc.rbc-reactivelist").animate({scrollTop:0},100),{currentData:a,newData:n}}},{key:"combineCurrentData",value:function(e){return C["default"].isArray(e)?(e=e.map(function(e){return e.stream=!1,e}),this.state.currentData.concat(e)):this.streamDataModify(this.state.currentData,e,!1)}},{key:"enableSort",value:function(e){e.and.push(this.resultSortKey);var t={key:this.resultSortKey,value:this.sortObj};x.selectedSensor.setSortInfo(t)}},{key:"appendData",value:function(e){var t=this.state.rawData,n=t.hits.hits.concat(e.hits.hits);return t.hits.hits=C["default"].uniqBy(n,"_id"),t}},{key:"streamDataModify",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(t)if(t.stream=n,t.streamStart=new Date,t._deleted){var r=e.filter(function(e){return e._id!==t._id});e=r}else{var o=e.filter(function(e){return e._id!==t._id});e=o,e.unshift(t)}return e}},{key:"setMarkersData",value:function(e){return e?e:[]}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.createChannel(e),this.state.requestOnScroll?this.listComponent():this.setQueryForPagination()}},{key:"setQueryForPagination",value:function(){var e={queryType:"match",inputData:this.props.appbaseField,customQuery:function(){return null}},t={key:"paginationChanges",value:e};x.selectedSensor.setSensorInfo(t)}},{key:"executePaginationUpdate",value:function(){setTimeout(function(){var e={key:"paginationChanges",value:Math.random()};x.selectedSensor.set(e,!0)},100)}},{key:"paginationAt",value:function(e){var t=void 0;return!this.props.pagination||this.props.paginationAt!==e&&"both"!==this.props.paginationAt||(t=p["default"].createElement("div",{className:"rbc-pagination-container col s12 col-xs-12"},p["default"].createElement(L["default"],{className:"rbc-pagination-"+e,componentId:"pagination",onPageChange:this.props.onPageChange,title:this.props.paginationTitle}))),t}},{key:"defaultonAllData",value:function(e){var t=this,n=null;if(e){var r=e.currentData;"historic"===e.mode?r=e.currentData.concat(e.newData):"streaming"===e.mode&&(r=x.combineStreamData(e.currentData,e.newData)),r&&(n=r.map(function(e){var n=e._source;return t.props.onData?t.props.onData(e):p["default"].createElement("div",{className:"row",style:{marginTop:"20px"}},t.itemMarkup(n,e))}))}return n}},{key:"itemMarkup",value:function(e,t){return p["default"].createElement("div",{key:t._id,style:{padding:"12px",fontSize:"12px"},className:"makerInfo"},p["default"].createElement(v["default"],{data:e}))}},{key:"nextPage",value:function(){function e(){this.setState({isLoading:!0}),m["default"].nextPage(this.channelId)}this.state.resultStats.total>this.state.currentData.length&&!this.state.queryStart&&e.call(this)}},{key:"listComponent",value:function(){function e(e){var t=this;e&&e.addEventListener("scroll",function(){t.state.requestOnScroll&&j(e).scrollTop()+j(e).innerHeight()>=e.scrollHeight&&t.state.resultStats.total>t.state.currentData.length&&!t.state.queryStart&&t.nextPage()})}e.call(this,this.listParentElement),e.call(this,this.listChildElement)}},{key:"handleSortSelect",value:function(e){var t=e.target.value;this.sortObj=a({},this.props.sortOptions[t].appbaseField,{order:this.props.sortOptions[t].sortBy});var n={key:this.resultSortKey,value:this.sortObj};x.selectedSensor.set(n,!0,"sortChange")}},{key:"render",value:function(){var e=this,t=null,n=null,r=null,o=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-sort-active":this.props.sortOptions,"rbc-sort-inactive":!this.props.sortOptions,"rbc-stream-active":this.props.stream,"rbc-stream-inactive":!this.props.stream,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader,"rbc-resultstats-active":this.props.showResultStats,"rbc-resultstats-inactive":!this.props.showResultStats,"rbc-noresults-active":this.props.noResults,"rbc-noresults-inactive":!this.props.noResults,"rbc-pagination-active":this.props.pagination,"rbc-pagination-inactive":!this.props.pagination});if(this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.props.placeholder&&(n=p["default"].createElement("div",{className:"rbc-placeholder col s12 col-xs-12"},this.props.placeholder)),this.props.sortOptions){var a=this.props.sortOptions.map(function(e,t){return p["default"].createElement("option",{value:t,key:e.label},e.label)});r=p["default"].createElement("div",{className:"rbc-sortoptions input-field col"},p["default"].createElement("select",{className:"browser-default form-control",onChange:this.handleSortSelect},a))}return p["default"].createElement("div",{ className:"rbc-reactivelist-container"},p["default"].createElement("div",{ref:function(t){e.listParentElement=t},className:"rbc rbc-reactivelist card thumbnail "+o,style:this.props.componentStyle},t,r,this.props.showResultStats&&this.state.resultStats.resultFound?p["default"].createElement(S["default"],{onResultStats:this.props.onResultStats,took:this.state.resultStats.took,total:this.state.resultStats.total}):null,this.paginationAt("top"),p["default"].createElement("div",{ref:function(t){e.listChildElement=t},className:"rbc-reactivelist-scroll-container col s12 col-xs-12"},this.state.resultMarkup),this.state.isLoading?p["default"].createElement("div",{className:"rbc-loader"}):null,this.state.showPlaceholder?n:null,this.paginationAt("bottom")),this.props.noResults&&this.state.visibleNoResults?p["default"].createElement(w["default"],{defaultText:this.props.noResults}):null,this.props.initialLoader&&this.state.queryStart&&this.state.showInitialLoader?p["default"].createElement(T["default"],{defaultText:this.props.initialLoader}):null,p["default"].createElement(_["default"],{container:"rbc-reactivelist-container"}))}}]),t}(c.Component);t["default"]=Y,Y.propTypes={componentId:p["default"].PropTypes.string,appbaseField:p["default"].PropTypes.string,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),sortBy:p["default"].PropTypes.oneOf(["asc","desc","default"]),sortOptions:p["default"].PropTypes.arrayOf(p["default"].PropTypes.shape({label:p["default"].PropTypes.string,appbaseField:p["default"].PropTypes.string,sortBy:p["default"].PropTypes.string})),from:x.validation.resultListFrom,onAllData:p["default"].PropTypes.func,size:x.sizeValidation,stream:p["default"].PropTypes.bool,componentStyle:p["default"].PropTypes.object,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),noResults:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),showResultStats:p["default"].PropTypes.bool,onResultStats:p["default"].PropTypes.func,placeholder:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,paginationAt:p["default"].PropTypes.string,pagination:p["default"].PropTypes.bool},Y.defaultProps={from:0,size:20,stream:!1,componentStyle:{},showResultStats:!0,pagination:!1,paginationAt:"bottom"},Y.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired,app:p["default"].PropTypes.any.isRequired},Y.types={componentId:O.STRING,appbaseField:O.STRING,title:O.STRING,react:O.OBJECT,sortBy:O.STRING,sortOptions:O.OBJECT,from:O.NUMBER,onAllData:O.FUNCTION,onData:O.FUNCTION,size:O.NUMBER,stream:O.BOOLEAN,componentStyle:O.OBJECT,initialLoader:O.STRING,noResults:O.FUNCTION,showResultStats:O.BOOLEAN,onResultStats:O.FUNCTION,placeholder:O.STRING,pagination:O.BOOLEAN,paginationAt:O.STRING}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Bar=t.HistoGramComponent=void 0;var s=function(){function e(e,t){for(var n=0;n-1;t?this.setDefaultSelectAll():this.setState({selectedItems:this.props.defaultSelected,defaultSelectall:this.props.defaultSelectall},function(){e.updateAction.bind(e),e.props.onSelect(e.state.selectedItems)})}},{key:"setDefaultSelectAll",value:function(){this.props.items&&this.props.items.length?setTimeout(this.handleListClickAll.bind(this,this.props.selectAllLabel,!0),1e3):setTimeout(this.setDefaultSelectAll.bind(this),1e3)}},{key:"componentDidUpdate",value:function(){var e=this,t=null,n=!0;this.state.selectedItems&&(t=JSON.parse(JSON.stringify(this.state.selectedItems))),t&&t.length&&this.props.items&&this.props.items.length&&(t=t.filter(function(t){var n=e.props.items.filter(function(e){return e.key===t});return!!n.length}),t.length!==this.state.selectedItems.length&&(n=!t.length,this.props.onRemove(this.state.selectedItems,n),this.updateSelectedItems(t),t.length&&this.props.onSelect(t)))}},{key:"handleListClick",value:function(e,t){var n=void 0;t?(this.props.onRemove(this.state.selectedItems,!1),n=this.state.selectedItems,n.push(e),this.setState({selectedItems:n},this.updateAction.bind(this)),this.state.selectedItems.length&&this.props.onSelect(this.state.selectedItems)):this.handleTagClick(e)}},{key:"handleTagClick",value:function(e){var t=1===this.state.selectedItems.length;this.props.onRemove(this.state.selectedItems,t);var n=e.toString().replace(/ /g,"_"),r="ref"+n,o=this.refStore[r];o.state.status=!1;var a=this.state.selectedItems,i=a.indexOf(e);a.splice(i,1),this.setState({selectedItems:a},this.updateAction.bind(this)),this.props.onSelect(a)}},{key:"clearAll",value:function(){this.handleListClickAll(this.props.selectAllLabel,!1)}},{key:"getSelectedItems",value:function(){var e=[];return this.props.items.forEach(function(t){t.status&&e.indexOf(t.key)<0&&e.push(t.key)}),e}},{key:"handleListClickAll",value:function(e,t){var n=this;this.props.selectAll(t);var r=this.props.items.map(function(e){return e.key});r=t?r:[],this.setState({defaultSelectall:t,selectedItems:r},function(){n.updateAction.bind(n),n.props.onSelect(n.state.selectedItems,r)})}},{key:"updateSelectedItems",value:function(e){this.setState({selectedItems:e})}},{key:"updateAction",value:function(){this.state.selectedItems.length||this.props.onSelect(null)}},{key:"render",value:function(){var e=this,t=this.props.items,n=this.getSelectedItems(),r=[],o=[];return t.forEach(function(t,n){try{t.keyRef=t.key.replace(/ /g,"_")}catch(o){t.keyRef=n}var a=!("visible"in t&&!t.visible);r.push(l["default"].createElement(p["default"],{key:t.keyRef,value:t.key,doc_count:t.doc_count,countField:e.props.showCount,handleClick:e.handleListClick,visible:a,showCheckbox:e.props.showCheckbox,status:t.status||!1,ref:function(n){var r="ref"+t.keyRef;e.refStore[r]=n}}))}),this.props.selectAllLabel&&t&&t.length&&r.unshift(l["default"].createElement(p["default"],{key:"selectall",value:this.props.selectAllLabel,countField:!1,visible:!0,showCheckbox:this.props.showCheckbox,handleClick:this.handleListClickAll,status:this.props.selectAllValue,ref:function(t){e.refStore.refselectall=t}})),this.props.showTags&&n&&(n.length<=5?n.forEach(function(t){o.push(l["default"].createElement(f["default"],{key:t,value:t,onClick:e.handleTagClick}))}):o.unshift(l["default"].createElement(f["default"],{key:"Clear All",value:"Clear All",onClick:this.clearAll}))),l["default"].createElement("div",{className:"rbc-list-container col s12 col-xs-12"},o.length?l["default"].createElement("div",{className:"row rbc-tag-container"},o):null,l["default"].createElement("div",{className:"row"},r))}}]),t}(u.Component);t["default"]=h,h.propTypes={defaultSelected:l["default"].PropTypes.array,items:l["default"].PropTypes.array,onRemove:l["default"].PropTypes.func,onSelect:l["default"].PropTypes.func,selectAll:l["default"].PropTypes.func,selectAllLabel:l["default"].PropTypes.string,selectAllValue:l["default"].PropTypes.bool,showCount:l["default"].PropTypes.bool,showTags:l["default"].PropTypes.bool,defaultSelectall:l["default"].PropTypes.bool},h.defaultProps={showTags:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n-1){var n=t.channelResponse&&t.channelResponse.data&&t.channelResponse.data.hits?t.channelResponse.data.hits.total:0,r=Math.ceil(n/t.queryOptions.size)<1?1:Math.ceil(n/t.queryOptions.size),o=t.queryOptions.size?t.queryOptions.size:20,a=Math.round(t.queryOptions.from/o)+1;e.setState({totalHits:n,size:o,maxPageNumber:r,currentValue:a})}})}},{key:"handleChange",value:function(e){this.setState({currentValue:e});var t={key:this.props.componentId,value:e},n=!0;h.selectedSensor.set(t,n,"paginationChange"),this.props.onPageChange&&this.props.onPageChange(e)}},{key:"firstPage",value:function(){1!==this.state.currentValue&&this.handleChange.call(this,1)}},{key:"lastPage",value:function(){this.state.currentValue!==this.state.maxPageNumber&&this.handleChange.call(this,this.state.maxPageNumber)}},{key:"prePage",value:function(){var e=this.state.currentValue>1?this.state.currentValue-1:1;this.state.currentValue!==e&&this.handleChange.call(this,e)}},{key:"nextPage",value:function(){var e=this.state.currentValue0;r--)if(r%5===0||1===r){t=r;break}for(var o=function(t){var r=l["default"].createElement("li",{key:t,className:"rbc-page-number "+(e.state.currentValue===t?"active rbc-pagination-active":"waves-effect")},l["default"].createElement("a",{onClick:function(){return e.handleChange(t)}},t));t<=e.state.maxPageNumber&&n.push(r)},a=t;a<=t+5;a++)o(a);return l["default"].createElement("ul",{className:"pagination"},l["default"].createElement("li",{className:1===this.state.currentValue?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.firstPage},l["default"].createElement("i",{className:"fa fa-angle-double-left"}))),l["default"].createElement("li",{className:1===this.state.currentValue?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.prePage},l["default"].createElement("i",{className:"fa fa-angle-left"}))),n,l["default"].createElement("li",{className:this.state.currentValue===this.state.maxPageNumber?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-next",onClick:this.nextPage},l["default"].createElement("i",{className:"fa fa-angle-right"}))),l["default"].createElement("li",{className:this.state.currentValue===this.state.maxPageNumber?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.lastPage},l["default"].createElement("i",{className:"fa fa-angle-double-right"}))))}},{key:"render",value:function(){var e=null;this.props.title&&(e=l["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,p["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return l["default"].createElement("div",{className:"rbc rbc-pagination col s12 col-xs-12 "+t+" "+this.props.className},e,l["default"].createElement("div",{className:"col s12 col-xs-12"},this.renderPageNumber()))}}]),t}(u.Component);t["default"]=m,m.propTypes={componentId:l["default"].PropTypes.string.isRequired,title:l["default"].PropTypes.string,onPageChange:l["default"].PropTypes.func},m.defaultProps={},m.contextTypes={appbaseRef:l["default"].PropTypes.any.isRequired,type:l["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.StaticSearch=void 0;var s=function(){function e(e,t){for(var n=0;n-1)d=d||{},d=Object.assign(d,t[e]);else{r[e]=i(e);var o=a(e);o&&(d=d||{},d=Object.assign(d,o))}var u=n(e);!u||"aggSort"in u||p.push(u)}),r}function l(t){var n=o.serializeDepends.createQuery(e.serializeDepends,t);return n&&n.body?(p&&p.length&&(n.body.sort=p),d&&Object.keys(d).length&&Object.keys(d).forEach(function(e){n.body[e]=d[e]})):n={},n}function c(){var e=u(),t=l(e);return t}var p=[],d=null;return c()}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.params.get(e);if(n&&r)try{r=JSON.parse(r)}catch(o){console.log(o)}return t?r&&r.trim()?r.split(","):null:r}},{key:"update",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&(this.setOrDelete(e,t),this.applyURLUpdate())}},{key:"setOrDelete",value:function(e,t){e&&(null===t||void 0===t?this.params["delete"](e):this.params.set(e,t)); -}},{key:"applyURLUpdate",value:function(){if(history.pushState&&this.params.toString()){var e=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+this.params.toString();window.history.pushState({path:e},"",e)}}}]),e}();t.URLParams=new u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(49);t.ResponsiveStory=function(){var e=function(e){return e.height()?e.height():0},t=function(){var t=r(window).height(),n=t-15;r(".rbc.rbc-reactivelist, .rbc.rbc-reactiveelement").css({maxHeight:n});var o=[r(".rbc.rbc-singlelist"),r(".rbc.rbc-multilist"),r(".rbc.rbc-nestedlist"),r(".rbc.rbc-tagcloud")];o.forEach(function(n){if(n.length){var r=e(n.find(".rbc-title"))+e(n.find(".rbc-search-container"));n.find(".rbc-list-container").css({maxHeight:t-r-35})}}),r(".rbc-base > .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(e[t]<1||e[t]>1e3)&&(n=new Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=new Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]<=0&&(n=new Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=new Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start<=0&&(r=new Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return!isNaN(e[t])&&r>=e.defaultSelected&&o<=e.defaultSelected||(n=new Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return e[t]<0&&(n=new Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=new Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n'],post_tags:[""],fields:e}}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.defaultSearchQuery}};this.props.highlight&&(e.value.externalQuery=this.highlightQuery()),w.selectedSensor.setSensorInfo(e);var t={key:this.searchInputId,value:{queryType:"multi_match",inputData:this.props.appbaseField,customQuery:this.defaultSearchQuery}};w.selectedSensor.setSensorInfo(t)}},{key:"setValue",value:function(e){var t={key:this.searchInputId,value:e};w.URLParams.update(this.props.componentId,e,this.props.URLParams),w.selectedSensor.set(t,!0),e&&""!==e.trim()?this.setState({options:[{label:e,value:e}],isLoadingOptions:!0,currentValue:e}):this.setState({options:[],isLoadingOptions:!1,currentValue:e})}},{key:"getValue",value:function(e,t){var n=void(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0);if(M["default"].has(t,e))n=t[e];else if(e.indexOf(".")>-1){var r="",o=e.split(".");o.forEach(function(e,a){r+=e,M["default"].isArray(M["default"].get(t,r))&&(r+="["+a+"]"),o.length-1!==a?r+=".":n=M["default"].get(t,r)})}return n}},{key:"setData",value:function(e){var t=this,n=[];M["default"].isArray(this.props.appbaseField)?this.props.appbaseField:[this.props.appbaseField],e.hits.hits.map(function(e){if("string"===t.fieldType){var r=t.getValue(t.props.appbaseField.trim(),e._source);n.push({value:r,label:r})}else"object"===t.fieldType&&t.props.appbaseField.map(function(r){var o=t.getValue(r,e._source);o&&n.push({value:o,label:o})})}),this.state.currentValue&&""!==this.state.currentValue.trim()&&n.unshift({label:this.state.currentValue,value:this.state.currentValue}),n=this.removeDuplicates(n,"label"),this.setState({options:n,isLoadingOptions:!1})}},{key:"defaultSearchQuery",value:function(e){var t=null,n=void 0;return e&&(n="string"===this.fieldType?[this.props.appbaseField]:this.props.appbaseField,t={bool:{should:[{multi_match:{query:e,fields:n,type:"phrase_prefix"}},{multi_match:{query:e,fields:n}}],minimum_should_match:"1"}}),t}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.searchInputId);var n=g["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({rawData:r}),e.props.autocomplete&&e.setData(r)})}},{key:"checkDefault",value:function(){this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultValue&&this.defaultSelected!=this.defaultValue&&(this.defaultSelected=this.defaultValue,setTimeout(this.setValue.bind(this,this.defaultSelected),100),this.handleSearch({value:this.defaultSelected}))}},{key:"handleSearch",value:function(e){var t=e?e.value:null;t="null"===t?null:t;var n={key:this.props.componentId,value:t};w.selectedSensor.set(n,!0),this.setState({currentValue:t})}},{key:"handleInputChange",value:function(e){var t=e.target.value;this.setState({currentValue:t});var n={key:this.props.componentId,value:t};this.props.onValueChange&&this.props.onValueChange(n.value);var r=!0;w.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=d["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,y["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-autocomplete-active":this.props.autocomplete,"rbc-autocomplete-inactive":!this.props.autocomplete});return d["default"].createElement("div",{className:"rbc rbc-datasearch col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},e,this.props.autocomplete?d["default"].createElement(h["default"],u({isLoading:this.state.isLoadingOptions,value:this.state.currentValue,options:this.state.options,onInputChange:this.setValue,onChange:this.handleSearch,onBlurResetsInput:!1},this.props)):d["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},d["default"].createElement("input",{type:"text",className:"rbc-input",placeholder:this.props.placeholder,value:this.state.currentValue?this.state.currentValue:"",onChange:this.handleInputChange}),d["default"].createElement("span",{className:"rbc-search-icon"})))}}]),t}(p.Component);t["default"]=k,k.propTypes={componentId:d["default"].PropTypes.string.isRequired,appbaseField:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),title:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.element]),placeholder:d["default"].PropTypes.string,autocomplete:d["default"].PropTypes.bool,defaultSelected:d["default"].PropTypes.string,customQuery:d["default"].PropTypes.func,onValueChange:d["default"].PropTypes.func,react:d["default"].PropTypes.object,componentStyle:d["default"].PropTypes.object,highlight:d["default"].PropTypes.bool,highlightFields:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),URLParams:d["default"].PropTypes.bool},k.defaultProps={placeholder:"Search",autocomplete:!0,componentStyle:{},highlight:!1,URLParams:!1},k.contextTypes={appbaseRef:d["default"].PropTypes.any.isRequired,type:d["default"].PropTypes.any.isRequired},k.types={componentId:b.STRING,appbaseField:b.STRING,appbaseFieldType:b.STRING,react:b.OBJECT,title:b.STRING,placeholder:b.STRING,autocomplete:b.BOOLEAN,defaultSelected:b.STRING,customQuery:b.FUNCTION,componentStyle:b.OBJECT,highlight:b.BOOLEAN,URLParams:b.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&setTimeout(this.handleChange.bind(this,t),1e3)}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!_["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t;var n=e.state.data.filter(function(t){ -return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&(null!==e.urlParams?e.handleChange(n):setTimeout(e.handleChange.bind(e,n),1e3))}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};b.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){if(e.length>0)return e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}})}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}}},{key:"handleChange",value:function(e){var t=[];t=e.map(function(e){return e.label}),t=t.join(),this.setState({selected:t});var n={key:this.props.componentId,value:e},r=!0;this.props.onValueChange&&this.props.onValueChange(n.value),b.URLParams.update(this.props.componentId,t,this.props.URLParams),b.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return p["default"].createElement("div",{className:"rbc rbc-multidropdownrange col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"col s12 col-xs-12"},p["default"].createElement(f["default"],{options:this.state.data,value:this.state.selected,onChange:this.handleChange,clearable:!1,multi:!0,placeholder:this.props.placeholder,searchable:!0}))))}}]),t}(c.Component);t["default"]=T,T.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),placeholder:p["default"].PropTypes.string,data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},T.defaultProps={URLParams:!1},T.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},T.types={componentId:v.STRING,appbaseField:v.STRING,appbaseFieldType:v.NUMBER,data:v.OBJECT,defaultSelected:v.ARRAY,title:v.STRING,placeholder:v.STRING,customQuery:v.FUNCTION,componentStyle:v.OBJECT,URLParams:v.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&(null!==this.urlParams?this.handleChange(t):setTimeout(this.handleChange.bind(this,t),1e3))}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!v["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t,e.resetState();var n=e.props.data.filter(function(e){return t.indexOf(e.label)>-1});n&&n.length&&setTimeout(e.handleChange.bind(e,n),1e3)}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.length>0?e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}}):null}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}return null}},{key:"handleChange",value:function(e){function t(e,t,o){o.label===e.label&&(r=t,n.splice(t,1))}var n=this.state.selected,r=null,o=e;v["default"].isArray(e)||(o=[e]),o.forEach(function(e){n.forEach(function(n,r){t(n,r,e)})}),null===r&&o.forEach(function(e){n.push(e)}),this.setState({selected:n});var a={key:this.props.componentId,value:n},i=!0;this.props.onValueChange&&this.props.onValueChange(a.value),g.URLParams.update(this.props.componentId,this.getSelectedLabels(n),this.props.URLParams),g.selectedSensor.set(a,i)}},{key:"getSelectedLabels",value:function(e){return e.map(function(e){return e.label})}},{key:"resetState",value:function(){this.setState({selected:[]});var e={key:this.props.componentId,value:[]},t=!0;g.URLParams.update(this.props.componentId,null,this.props.URLParams),g.selectedSensor.set(e,t)}},{key:"handleTagClick",value:function(e){var t=this.state.selected.filter(function(t){return t.label===e});this.handleChange(t[0])}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t){return p["default"].createElement("div",{className:"rbc-list-item row",key:t.label,onClick:function(){return e.handleChange(t)}},p["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:n.indexOf(t.label)>-1,value:t.label}),p["default"].createElement("label",{className:"rbc-label"},t.label))})),t}},{key:"render",value:function(){var e=this,t=null,n=[];this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.selected&&this.state.selected.forEach(function(t){n.push(p["default"].createElement(b,{key:t.label,value:t.label,onClick:e.handleTagClick}))});var r=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return p["default"].createElement("div",{className:"rbc rbc-multirange col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},t,p["default"].createElement("div",{className:"col s12 col-xs-12 rbc-list-container"},n.length?p["default"].createElement("div",{className:"row",style:{marginTop:"0"}},n):null,this.renderButtons())))}}]),t}(c.Component);t["default"]=_;var b=function(e){return p["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},p["default"].createElement("a",{className:"close"},"×"),p["default"].createElement("span",null,e.value))};b.propTypes={onClick:p["default"].PropTypes.func.isRequired,value:p["default"].PropTypes.string.isRequired},_.propTypes={appbaseField:p["default"].PropTypes.string.isRequired,componentId:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nr;return p["default"].createElement("div",{className:"rbc-numberbox-container col s12 col-xs-12"},p["default"].createElement("div",{className:"rbc-label"},t),p["default"].createElement("div",{className:"rbc-numberbox-btn-container"},p["default"].createElement(g,{isActive:s,handleChange:o,type:"minus"}),p["default"].createElement("span",{className:"rbc-numberbox-number"},a),p["default"].createElement(g,{isActive:i,handleChange:o,type:"plus"})))},b=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),o=r.props.focused;r.urlParams=y.URLParams.get(r.props.componentId);var a=null!==r.urlParams?r.urlParams:r.props.defaultSelected;return r.state={currentValue:a?a:r.props.data.start,focused:o},r.type="term",r.handleChange=r.handleChange.bind(r),r.customQuery=r.customQuery.bind(r),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.setQueryInfo(),null!==this.urlParams?this.updateQuery(this.urlParams):setTimeout(this.handleChange.bind(this),1e3)}},{key:"componentWillReceiveProps",value:function(e){var t=this;setTimeout(function(){var n=null!==t.urlParams?t.urlParams:t.props.defaultSelected;!n&&0!==n||n===t.state.currentValue||t.setState({currentValue:n}),e.queryFormat!==t.queryFormat&&(t.queryFormat=e.queryFormat,t.updateQuery())},300)}},{key:"customQuery",value:function(e){var t=null;if(e&&(e.value||0===e.value)){var n=e.value;switch(this.props.queryFormat){case"exact":t=this.exactQuery(n);break;case"lte":t=this.lteQuery(n);break;case"gte":default:t=this.gteQuery(n)}}return t}},{key:"exactQuery",value:function(e){return a({},this.type,a({},this.props.appbaseField,e))}},{key:"gteQuery",value:function(e){return{range:a({},this.props.appbaseField,{gte:e,boost:2})}}},{key:"lteQuery",value:function(e){return{range:a({},this.props.appbaseField,{lte:e,boost:2})}}},{key:"setQueryInfo",value:function(){var e=this.props,t=e.componentId,n=e.appbaseField,r={key:t,value:{queryType:this.type,inputData:n,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};y.selectedSensor.setSensorInfo(r)}},{key:"handleChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.props,n=(t.componentId,t.data),r=n.start,o=n.end,a=this.state.currentValue;r=void 0!=r?r:a-1,o=void 0!=o?o:a+1,e>0&&ar&&(a-=1),this.setState({currentValue:a},this.updateQuery.bind(this))}},{key:"updateQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.start.currentValue,t={key:this.props.componentId,value:{value:e,queryFormat:this.props.queryFormat}};this.props.onValueChange&&this.props.onValueChange(t.value),y.URLParams.update(this.props.componentId,e,this.props.URLParams),y.selectedSensor.set(t,!0)}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.data,r=e.labelPosition,o=this.state.currentValue,a=t?p["default"].createElement(v,{title:t}):null,i=(0,f["default"])({"rbc-title-active":t,"rbc-title-inactive":!t});return p["default"].createElement("div",{className:"rbc rbc-numberbox col s12 col-xs-12 card thumbnail "+i+" rbc-label-"+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},a,p["default"].createElement(_,{handleChange:this.handleChange,value:o,label:n.label,start:n.start,end:n.end})))}}]),t}(c.Component);t["default"]=b,b.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.shape({start:y.validateThreshold,end:y.validateThreshold,label:p["default"].PropTypes.string}),defaultSelected:y.valueValidation,labelPosition:p["default"].PropTypes.oneOf(["top","bottom","left","right"]),customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,queryFormat:p["default"].PropTypes.oneOf(["exact","gte","lte"]),URLParams:p["default"].PropTypes.bool},b.defaultProps={componentStyle:{},queryFormat:"gte",URLParams:!1},b.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},b.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.NUMBER,labelPosition:m.STRING,customQuery:m.FUNCTION,componentStyle:m.OBJECT,queryFormat:m.STRING,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=n.end){var r=(n.end-n.start)%e.stepValue;if(r){t.setState({values:{min:t.state.values.min,max:n.end-r}});var o={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-r}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(o.value),S.URLParams.update(t.props.componentId,t.setURLParam(o.value),t.props.URLParams),S.selectedSensor.set(o,!0)},1e3)}else{var a={};a.min=n.start,a.max=n.end,t.setState({values:a,currentValues:a});var i={key:t.props.componentId,value:{from:a.min,to:a.max}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(i.value),S.URLParams.update(t.props.componentId,t.setURLParam(i.value),t.props.URLParams),S.selectedSensor.set(i,!0)},1e3)}}if(e.range.start!==t.state.startThreshold||e.range.end!==t.state.endThreshold){if(e.range.start<=n.start&&e.range.end>=n.end)t.setState({startThreshold:e.range.start,endThreshold:e.range.end});else{var s={min:t.state.values.min,max:t.state.values.max};t.state.values.mine.range.end&&(s.max=e.range.end),t.setState({startThreshold:e.range.start,endThreshold:e.range.end,values:s});var u={from:s.min,to:s.max},l={key:t.props.componentId,value:u};t.props.onValueChange&&t.props.onValueChange(l.value),S.URLParams.update(t.props.componentId,t.setURLParam(l.value),t.props.URLParams),S.selectedSensor.set(l,!0)}t.setRangeValue()}if(e.stepValue!==t.props.stepValue){var c=(n.end-n.start)%e.stepValue;if(c){t.setState({values:{min:t.state.values.min,max:n.end-c}});var p={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-c}};t.props.onValueChange&&t.props.onValueChange(p.value),S.URLParams.update(t.props.componentId,t.setURLParam(p.value),t.props.URLParams),S.selectedSensor.set(p,!0)}}},300)}},{key:"shouldComponentUpdate",value:function(e,t){return e.stepValue<=0||e.stepValue>Math.floor((e.range.end-e.range.start)/2)?(console.error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."),!1):!(t.values.max>t.endThreshold)}},{key:"componentWillUnmount",value:function(){this.channelId&&v["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setURLParam",value:function(e){return"from"in e&&"to"in e&&(e={start:e.from,end:e.to}),JSON.stringify(e)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField}},t={key:this.props.componentId+"-internal",value:{queryType:"range",inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};S.selectedSensor.setSensorInfo(e),S.selectedSensor.setSensorInfo(t),this.setRangeValue()}},{key:"setRangeValue",value:function(){var e={key:this.props.componentId+"-internal",value:this.props.range};this.props.onValueChange&&this.props.onValueChange(e.value),S.selectedSensor.set(e,!0)}},{key:"customQuery",value:function(e){if(e)return{range:a({},this.props.appbaseField,{gte:e.start,lte:e.end,boost:2})}}},{key:"histogramQuery",value:function(){return a({},this.props.appbaseField,{histogram:{field:this.props.appbaseField,interval:this.props.interval?this.props.interval:Math.ceil((this.props.range.end-this.props.range.start)/10)}})}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t.aggs={key:this.props.appbaseField,sort:"asc",size:1e3,customQuery:this.histogramQuery},t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.props.componentId+"-internal");var n=v["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery&&t.startTime>e.queryStartTime){e.queryStartTime=t.startTime?t.startTime:0;var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(n)}}),this.listenLoadingChannel(n)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"getSize",value:function(){return Math.min(this.props.range.end-this.props.range.start,this.maxSize)}},{key:"setData",value:function(e){try{this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}catch(t){console.log(t)}}},{key:"handleValuesChange",value:function(e,t){this.setState({values:t})}},{key:"countCalc",value:function(e,t,n){return n.map(function(e){return e.doc_count})}},{key:"addItemsToList",value:function(e){var t=this;e=k["default"].orderBy(e,["key"],["asc"]);var n=e.length,r=this.state.startThreshold?this.state.startThreshold:e[0].key,o=this.state.endThreshold?this.state.endThreshold:e[n-1].key;if(n>1){var a={counts:this.countCalc(r,o,e),startThreshold:r,endThreshold:o,values:{min:this.state.values.min,max:this.state.values.max}};this.setState(a,function(){k["default"].isEqual(a.values,t.state.currentValues)||t.handleResults(null,a.values)})}}},{key:"handleResults",value:function(e,t){var n=void 0;n=e?{min:e[0],max:e[1]}:t;var r={from:n.min,to:n.max},o={key:this.props.componentId,value:r};this.props.onValueChange&&this.props.onValueChange(o.value),S.URLParams.update(this.props.componentId,this.setURLParam(o.value),this.props.URLParams),S.selectedSensor.set(o,!0),this.setState({currentValues:n,values:n})}},{key:"render",value:function(){var e=null,t=null,n={};if(this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.counts&&this.state.counts.length&&this.props.showHistogram&&(t=p["default"].createElement(g.HistoGramComponent,{data:this.state.counts})),this.props.rangeLabels.start||this.props.rangeLabels.end){var r;r={},a(r,this.state.startThreshold,this.props.rangeLabels.start),a(r,this.state.endThreshold,this.props.rangeLabels.end),n=r}var o=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-labels-active":this.props.rangeLabels.start||this.props.rangeLabels.end,"rbc-labels-inactive":!this.props.rangeLabels.start&&!this.props.rangeLabels.end,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return p["default"].createElement("div",{className:"rbc rbc-rangeslider card thumbnail col s12 col-xs-12 "+o,style:this.props.componentStyle},e,t,p["default"].createElement("div",{className:"rbc-rangeslider-container col s12 col-xs-12"},p["default"].createElement(f["default"],{range:!0,value:[this.state.values.min,this.state.values.max],min:this.state.startThreshold,max:this.state.endThreshold,onChange:this.handleResults,step:this.props.stepValue,marks:n})),this.props.initialLoader&&this.state.queryStart?p["default"].createElement(b["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(c.Component);t["default"]=P,P.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),range:p["default"].PropTypes.shape({start:S.validateThreshold,end:S.validateThreshold}),rangeLabels:p["default"].PropTypes.shape({start:p["default"].PropTypes.string,end:p["default"].PropTypes.string}),defaultSelected:p["default"].PropTypes.shape({start:p["default"].PropTypes.number,end:p["default"].PropTypes.number}),stepValue:S.stepValidation,showHistogram:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,interval:p["default"].PropTypes.number,URLParams:p["default"].PropTypes.bool},P.defaultProps={title:null,range:{start:0,end:10},rangeLabels:{start:"",end:""},defaultSelected:{start:0,end:10},stepValue:1,showHistogram:!0,componentStyle:{},URLParams:!1},P.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},P.types={componentId:M.STRING,appbaseField:M.STRING,appbaseFieldType:M.NUMBER,title:M.STRING,react:M.OBJECT,range:M.OBJECT,rangeLabels:M.OBJECT,defaultSelected:M.OBJECT,stepValue:M.NUMBER,showHistogram:M.BOOLEAN,customQuery:M.FUNCTION,initialLoader:M.OBJECT,componentStyle:M.OBJECT,interval:M.NUMBER,URLParams:M.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(e[t]<1||e[t]>1e3)&&(n=new Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=new Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]<=0&&(n=new Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=new Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start<=0&&(r=new Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return!isNaN(e[t])&&r>=e.defaultSelected&&o<=e.defaultSelected||(n=new Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return e[t]<0&&(n=new Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=new Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n'],post_tags:[""],fields:e}}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.defaultSearchQuery}};this.props.highlight&&(e.value.externalQuery=this.highlightQuery()),w.selectedSensor.setSensorInfo(e);var t={key:this.searchInputId,value:{queryType:"multi_match",inputData:this.props.appbaseField,customQuery:this.defaultSearchQuery}};w.selectedSensor.setSensorInfo(t)}},{key:"setValue",value:function(e){var t={key:this.searchInputId,value:e};w.URLParams.update(this.props.componentId,e,this.props.URLParams),w.selectedSensor.set(t,!0),e&&""!==e.trim()?this.setState({options:[{label:e,value:e}],isLoadingOptions:!0,currentValue:e}):this.setState({options:[],isLoadingOptions:!1,currentValue:e})}},{key:"getValue",value:function(e,t){var n=void(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0);return M["default"].has(t,e)?n=t[e]:e.indexOf(".")>-1&&!function(){var r="",o=e.split(".");o.forEach(function(e,a){r+=e,M["default"].isArray(M["default"].get(t,r))&&(r+="["+a+"]"),o.length-1!==a?r+=".":n=M["default"].get(t,r)})}(),n}},{key:"setData",value:function(e){var t=this,n=[];M["default"].isArray(this.props.appbaseField)?this.props.appbaseField:[this.props.appbaseField],e.hits.hits.map(function(e){if("string"===t.fieldType){var r=t.getValue(t.props.appbaseField.trim(),e._source);n.push({value:r,label:r})}else"object"===t.fieldType&&t.props.appbaseField.map(function(r){var o=t.getValue(r,e._source);o&&n.push({value:o,label:o})})}),this.state.currentValue&&""!==this.state.currentValue.trim()&&n.unshift({label:this.state.currentValue,value:this.state.currentValue}),n=this.removeDuplicates(n,"label"),this.setState({options:n,isLoadingOptions:!1})}},{key:"defaultSearchQuery",value:function(e){var t=null,n=void 0;return e&&(n="string"===this.fieldType?[this.props.appbaseField]:this.props.appbaseField,t={bool:{should:[{multi_match:{query:e,fields:n,type:"phrase_prefix"}},{multi_match:{query:e,fields:n}}],minimum_should_match:"1"}}),t}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.searchInputId);var n=g["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({rawData:r}),e.props.autocomplete&&e.setData(r)})}},{key:"checkDefault",value:function(){this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultValue&&this.defaultSelected!=this.defaultValue&&(this.defaultSelected=this.defaultValue,setTimeout(this.setValue.bind(this,this.defaultSelected),100),this.handleSearch({value:this.defaultSelected}))}},{key:"handleSearch",value:function(e){var t=e?e.value:null;t="null"===t?null:t;var n={key:this.props.componentId,value:t};w.selectedSensor.set(n,!0),this.setState({currentValue:t})}},{key:"handleInputChange",value:function(e){var t=e.target.value;this.setState({currentValue:t});var n={key:this.props.componentId,value:t};this.props.onValueChange&&this.props.onValueChange(n.value);var r=!0;w.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=d["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,y["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-autocomplete-active":this.props.autocomplete,"rbc-autocomplete-inactive":!this.props.autocomplete});return d["default"].createElement("div",{className:"rbc rbc-datasearch col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},e,this.props.autocomplete?d["default"].createElement(h["default"],u({isLoading:this.state.isLoadingOptions,value:this.state.currentValue,options:this.state.options,onInputChange:this.setValue,onChange:this.handleSearch,onBlurResetsInput:!1},this.props)):d["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},d["default"].createElement("input",{type:"text",className:"rbc-input",placeholder:this.props.placeholder,value:this.state.currentValue?this.state.currentValue:"",onChange:this.handleInputChange}),d["default"].createElement("span",{className:"rbc-search-icon"})))}}]),t}(p.Component);t["default"]=k,k.propTypes={componentId:d["default"].PropTypes.string.isRequired,appbaseField:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),title:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.element]),placeholder:d["default"].PropTypes.string,autocomplete:d["default"].PropTypes.bool,defaultSelected:d["default"].PropTypes.string,customQuery:d["default"].PropTypes.func,onValueChange:d["default"].PropTypes.func,react:d["default"].PropTypes.object,componentStyle:d["default"].PropTypes.object,highlight:d["default"].PropTypes.bool,highlightFields:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),URLParams:d["default"].PropTypes.bool},k.defaultProps={placeholder:"Search",autocomplete:!0,componentStyle:{},highlight:!1,URLParams:!1},k.contextTypes={appbaseRef:d["default"].PropTypes.any.isRequired,type:d["default"].PropTypes.any.isRequired},k.types={componentId:b.STRING,appbaseField:b.STRING,appbaseFieldType:b.STRING,react:b.OBJECT,title:b.STRING,placeholder:b.STRING,autocomplete:b.BOOLEAN,defaultSelected:b.STRING,customQuery:b.FUNCTION,componentStyle:b.OBJECT,highlight:b.BOOLEAN,URLParams:b.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&setTimeout(this.handleChange.bind(this,t),1e3)}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!_["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t;var n=e.state.data.filter(function(t){ +return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&(null!==e.urlParams?e.handleChange(n):setTimeout(e.handleChange.bind(e,n),1e3))}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};b.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){if(e.length>0)return e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}})}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}}},{key:"handleChange",value:function(e){var t=[];t=e.map(function(e){return e.label}),t=t.join(),this.setState({selected:t});var n={key:this.props.componentId,value:e},r=!0;this.props.onValueChange&&this.props.onValueChange(n.value),b.URLParams.update(this.props.componentId,t,this.props.URLParams),b.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return p["default"].createElement("div",{className:"rbc rbc-multidropdownrange col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"col s12 col-xs-12"},p["default"].createElement(f["default"],{options:this.state.data,value:this.state.selected,onChange:this.handleChange,clearable:!1,multi:!0,placeholder:this.props.placeholder,searchable:!0}))))}}]),t}(c.Component);t["default"]=T,T.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),placeholder:p["default"].PropTypes.string,data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},T.defaultProps={URLParams:!1},T.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},T.types={componentId:v.STRING,appbaseField:v.STRING,appbaseFieldType:v.NUMBER,data:v.OBJECT,defaultSelected:v.ARRAY,title:v.STRING,placeholder:v.STRING,customQuery:v.FUNCTION,componentStyle:v.OBJECT,URLParams:v.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&(null!==this.urlParams?this.handleChange(t):setTimeout(this.handleChange.bind(this,t),1e3))}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!v["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t,e.resetState();var n=e.props.data.filter(function(e){return t.indexOf(e.label)>-1});n&&n.length&&setTimeout(e.handleChange.bind(e,n),1e3)}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.length>0?e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}}):null}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}return null}},{key:"handleChange",value:function(e){function t(e,t,o){o.label===e.label&&(r=t,n.splice(t,1))}var n=this.state.selected,r=null,o=e;v["default"].isArray(e)||(o=[e]),o.forEach(function(e){n.forEach(function(n,r){t(n,r,e)})}),null===r&&o.forEach(function(e){n.push(e)}),this.setState({selected:n});var a={key:this.props.componentId,value:n},i=!0;this.props.onValueChange&&this.props.onValueChange(a.value),g.URLParams.update(this.props.componentId,this.getSelectedLabels(n),this.props.URLParams),g.selectedSensor.set(a,i)}},{key:"getSelectedLabels",value:function(e){return e.map(function(e){return e.label})}},{key:"resetState",value:function(){this.setState({selected:[]});var e={key:this.props.componentId,value:[]},t=!0;g.URLParams.update(this.props.componentId,null,this.props.URLParams),g.selectedSensor.set(e,t)}},{key:"handleTagClick",value:function(e){var t=this.state.selected.filter(function(t){return t.label===e});this.handleChange(t[0])}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t){return p["default"].createElement("div",{className:"rbc-list-item row",key:t.label,onClick:function(){return e.handleChange(t)}},p["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:n.indexOf(t.label)>-1,value:t.label}),p["default"].createElement("label",{className:"rbc-label"},t.label))})),t}},{key:"render",value:function(){var e=this,t=null,n=[];this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.selected&&this.state.selected.forEach(function(t){n.push(p["default"].createElement(b,{key:t.label,value:t.label,onClick:e.handleTagClick}))});var r=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return p["default"].createElement("div",{className:"rbc rbc-multirange col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},t,p["default"].createElement("div",{className:"col s12 col-xs-12 rbc-list-container"},n.length?p["default"].createElement("div",{className:"row",style:{marginTop:"0"}},n):null,this.renderButtons())))}}]),t}(c.Component);t["default"]=_;var b=function(e){return p["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},p["default"].createElement("a",{className:"close"},"×"),p["default"].createElement("span",null,e.value))};b.propTypes={onClick:p["default"].PropTypes.func.isRequired,value:p["default"].PropTypes.string.isRequired},_.propTypes={appbaseField:p["default"].PropTypes.string.isRequired,componentId:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nr;return p["default"].createElement("div",{className:"rbc-numberbox-container col s12 col-xs-12"},p["default"].createElement("div",{className:"rbc-label"},t),p["default"].createElement("div",{className:"rbc-numberbox-btn-container"},p["default"].createElement(g,{isActive:s,handleChange:o,type:"minus"}),p["default"].createElement("span",{className:"rbc-numberbox-number"},a),p["default"].createElement(g,{isActive:i,handleChange:o,type:"plus"})))},b=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),o=r.props.focused;r.urlParams=y.URLParams.get(r.props.componentId);var a=null!==r.urlParams?r.urlParams:r.props.defaultSelected;return r.state={currentValue:a?a:r.props.data.start,focused:o},r.type="term",r.handleChange=r.handleChange.bind(r),r.customQuery=r.customQuery.bind(r),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.setQueryInfo(),null!==this.urlParams?this.updateQuery(this.urlParams):setTimeout(this.handleChange.bind(this),1e3)}},{key:"componentWillReceiveProps",value:function(e){var t=this;setTimeout(function(){var n=null!==t.urlParams?t.urlParams:t.props.defaultSelected;!n&&0!==n||n===t.state.currentValue||t.setState({currentValue:n}),e.queryFormat!==t.queryFormat&&(t.queryFormat=e.queryFormat,t.updateQuery())},300)}},{key:"customQuery",value:function(e){var t=null;if(e&&(e.value||0===e.value)){var n=e.value;switch(this.props.queryFormat){case"exact":t=this.exactQuery(n);break;case"lte":t=this.lteQuery(n);break;case"gte":default:t=this.gteQuery(n)}}return t}},{key:"exactQuery",value:function(e){return a({},this.type,a({},this.props.appbaseField,e))}},{key:"gteQuery",value:function(e){return{range:a({},this.props.appbaseField,{gte:e,boost:2})}}},{key:"lteQuery",value:function(e){return{range:a({},this.props.appbaseField,{lte:e,boost:2})}}},{key:"setQueryInfo",value:function(){var e=this.props,t=e.componentId,n=e.appbaseField,r={key:t,value:{queryType:this.type,inputData:n,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};y.selectedSensor.setSensorInfo(r)}},{key:"handleChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.props,n=(t.componentId,t.data),r=n.start,o=n.end,a=this.state.currentValue;r=void 0!=r?r:a-1,o=void 0!=o?o:a+1,e>0&&ar&&(a-=1),this.setState({currentValue:a},this.updateQuery.bind(this))}},{key:"updateQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.start.currentValue,t={key:this.props.componentId,value:{value:e,queryFormat:this.props.queryFormat}};this.props.onValueChange&&this.props.onValueChange(t.value),y.URLParams.update(this.props.componentId,e,this.props.URLParams),y.selectedSensor.set(t,!0)}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.data,r=e.labelPosition,o=this.state.currentValue,a=t?p["default"].createElement(v,{title:t}):null,i=(0,f["default"])({"rbc-title-active":t,"rbc-title-inactive":!t});return p["default"].createElement("div",{className:"rbc rbc-numberbox col s12 col-xs-12 card thumbnail "+i+" rbc-label-"+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},a,p["default"].createElement(_,{handleChange:this.handleChange,value:o,label:n.label,start:n.start,end:n.end})))}}]),t}(c.Component);t["default"]=b,b.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.shape({start:y.validateThreshold,end:y.validateThreshold,label:p["default"].PropTypes.string}),defaultSelected:y.valueValidation,labelPosition:p["default"].PropTypes.oneOf(["top","bottom","left","right"]),customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,queryFormat:p["default"].PropTypes.oneOf(["exact","gte","lte"]),URLParams:p["default"].PropTypes.bool},b.defaultProps={componentStyle:{},queryFormat:"gte",URLParams:!1},b.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},b.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.NUMBER,labelPosition:m.STRING,customQuery:m.FUNCTION,componentStyle:m.OBJECT,queryFormat:m.STRING,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=n.end){var r=(n.end-n.start)%e.stepValue;r?!function(){t.setState({values:{min:t.state.values.min,max:n.end-r}});var e={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-r}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(e.value),S.URLParams.update(t.props.componentId,t.setURLParam(e.value),t.props.URLParams),S.selectedSensor.set(e,!0)},1e3)}():!function(){var e={};e.min=n.start,e.max=n.end,t.setState({values:e,currentValues:e});var r={key:t.props.componentId,value:{from:e.min,to:e.max}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(r.value),S.URLParams.update(t.props.componentId,t.setURLParam(r.value),t.props.URLParams),S.selectedSensor.set(r,!0)},1e3)}()}if(e.range.start!==t.state.startThreshold||e.range.end!==t.state.endThreshold){if(e.range.start<=n.start&&e.range.end>=n.end)t.setState({startThreshold:e.range.start,endThreshold:e.range.end});else{var o={min:t.state.values.min,max:t.state.values.max};t.state.values.mine.range.end&&(o.max=e.range.end),t.setState({startThreshold:e.range.start,endThreshold:e.range.end,values:o});var a={from:o.min,to:o.max},i={key:t.props.componentId,value:a};t.props.onValueChange&&t.props.onValueChange(i.value),S.URLParams.update(t.props.componentId,t.setURLParam(i.value),t.props.URLParams),S.selectedSensor.set(i,!0)}t.setRangeValue()}if(e.stepValue!==t.props.stepValue){var s=(n.end-n.start)%e.stepValue;if(s){t.setState({values:{min:t.state.values.min,max:n.end-s}});var u={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-s}};t.props.onValueChange&&t.props.onValueChange(u.value),S.URLParams.update(t.props.componentId,t.setURLParam(u.value),t.props.URLParams),S.selectedSensor.set(u,!0)}}},300)}},{key:"shouldComponentUpdate",value:function(e,t){return e.stepValue<=0||e.stepValue>Math.floor((e.range.end-e.range.start)/2)?(console.error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."),!1):!(t.values.max>t.endThreshold)}},{key:"componentWillUnmount",value:function(){this.channelId&&v["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setURLParam",value:function(e){return"from"in e&&"to"in e&&(e={start:e.from,end:e.to}),JSON.stringify(e)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField}},t={key:this.props.componentId+"-internal",value:{queryType:"range",inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};S.selectedSensor.setSensorInfo(e),S.selectedSensor.setSensorInfo(t),this.setRangeValue()}},{key:"setRangeValue",value:function(){var e={key:this.props.componentId+"-internal",value:this.props.range};this.props.onValueChange&&this.props.onValueChange(e.value),S.selectedSensor.set(e,!0)}},{key:"customQuery",value:function(e){if(e)return{range:a({},this.props.appbaseField,{gte:e.start,lte:e.end,boost:2})}}},{key:"histogramQuery",value:function(){return a({},this.props.appbaseField,{histogram:{field:this.props.appbaseField,interval:this.props.interval?this.props.interval:Math.ceil((this.props.range.end-this.props.range.start)/10)}})}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t.aggs={key:this.props.appbaseField,sort:"asc",size:1e3,customQuery:this.histogramQuery},t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.props.componentId+"-internal");var n=v["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery&&t.startTime>e.queryStartTime){e.queryStartTime=t.startTime?t.startTime:0;var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(n)}}),this.listenLoadingChannel(n)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"getSize",value:function(){return Math.min(this.props.range.end-this.props.range.start,this.maxSize)}},{key:"setData",value:function(e){try{this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}catch(t){console.log(t)}}},{key:"handleValuesChange",value:function(e,t){this.setState({values:t})}},{key:"countCalc",value:function(e,t,n){return n.map(function(e){return e.doc_count})}},{key:"addItemsToList",value:function(e){var t=this;e=k["default"].orderBy(e,["key"],["asc"]);var n=e.length,r=this.state.startThreshold?this.state.startThreshold:e[0].key,o=this.state.endThreshold?this.state.endThreshold:e[n-1].key;n>1&&!function(){var n={counts:t.countCalc(r,o,e),startThreshold:r,endThreshold:o,values:{min:t.state.values.min,max:t.state.values.max}};t.setState(n,function(){k["default"].isEqual(n.values,t.state.currentValues)||t.handleResults(null,n.values)})}()}},{key:"handleResults",value:function(e,t){var n=void 0;n=e?{min:e[0],max:e[1]}:t;var r={from:n.min,to:n.max},o={key:this.props.componentId,value:r};this.props.onValueChange&&this.props.onValueChange(o.value),S.URLParams.update(this.props.componentId,this.setURLParam(o.value),this.props.URLParams),S.selectedSensor.set(o,!0),this.setState({currentValues:n,values:n})}},{key:"render",value:function(){var e=null,t=null,n={};if(this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.counts&&this.state.counts.length&&this.props.showHistogram&&(t=p["default"].createElement(g.HistoGramComponent,{data:this.state.counts})),this.props.rangeLabels.start||this.props.rangeLabels.end){var r;r={},a(r,this.state.startThreshold,this.props.rangeLabels.start),a(r,this.state.endThreshold,this.props.rangeLabels.end),n=r}var o=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-labels-active":this.props.rangeLabels.start||this.props.rangeLabels.end,"rbc-labels-inactive":!this.props.rangeLabels.start&&!this.props.rangeLabels.end,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return p["default"].createElement("div",{className:"rbc rbc-rangeslider card thumbnail col s12 col-xs-12 "+o,style:this.props.componentStyle},e,t,p["default"].createElement("div",{className:"rbc-rangeslider-container col s12 col-xs-12"},p["default"].createElement(f["default"],{range:!0,value:[this.state.values.min,this.state.values.max],min:this.state.startThreshold,max:this.state.endThreshold,onChange:this.handleResults,step:this.props.stepValue,marks:n})),this.props.initialLoader&&this.state.queryStart?p["default"].createElement(b["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(c.Component);t["default"]=P,P.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),range:p["default"].PropTypes.shape({start:S.validateThreshold,end:S.validateThreshold}),rangeLabels:p["default"].PropTypes.shape({start:p["default"].PropTypes.string,end:p["default"].PropTypes.string}),defaultSelected:p["default"].PropTypes.shape({start:p["default"].PropTypes.number,end:p["default"].PropTypes.number}),stepValue:S.stepValidation,showHistogram:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,interval:p["default"].PropTypes.number,URLParams:p["default"].PropTypes.bool},P.defaultProps={title:null,range:{start:0,end:10},rangeLabels:{start:"",end:""},defaultSelected:{start:0,end:10},stepValue:1,showHistogram:!0,componentStyle:{},URLParams:!1},P.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},P.types={componentId:M.STRING,appbaseField:M.STRING,appbaseFieldType:M.NUMBER,title:M.STRING,react:M.OBJECT,range:M.OBJECT,rangeLabels:M.OBJECT,defaultSelected:M.OBJECT,stepValue:M.NUMBER,showHistogram:M.BOOLEAN,customQuery:M.FUNCTION,initialLoader:M.OBJECT,componentStyle:M.OBJECT,interval:M.NUMBER,URLParams:M.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&t.forEach(function(t){null!==e.urlParams?e.handleChange(t):setTimeout(e.handleChange.bind(e,t),1e3)})}}},{key:"componentWillUpdate",value:function(){var e=this,t=null!==this.urlParams?this.urlParams:this.props.defaultSelected;if(this.defaultSelected!=t){this.defaultSelected=t,this.defaultSelected=v["default"].isArray(this.defaultSelected)?this.defaultSelected:[this.defaultSelected];var n=this.props.data.filter(function(t){return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&n.forEach(function(t){setTimeout(e.handleChange.bind(e,t),1e3)})}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.map(function(e,n){return{term:a({},t,e.value)}})}var n=null;return e&&e.length?n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}}:n}},{key:"handleChange",value:function(e){var t=this.state.selected,n=[],r=null;t.forEach(function(n,o){e.label===n.label&&(r=o,t.splice(o,1))}),null===r?this.props.multiSelect?(t.push(e),n=t):n.push(e):n=t,this.setState({selected:n});var o={key:this.props.componentId,value:n},a=!0;this.props.onValueChange&&this.props.onValueChange(o.value),g.URLParams.update(this.props.componentId,this.setURLValue(n),this.props.URLParams),g.selectedSensor.set(o,a)}},{key:"setURLValue",value:function(e){return e.map(function(e){return e.label})}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t,r){return p["default"].createElement("button",{key:r,className:"btn rbc-btn "+(n.indexOf(t.label)>-1?"rbc-btn-active":"rbc-btn-inactive"),onClick:function(){return e.handleChange(t)},title:t.title?t.title:t.label},t.label)})),t}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-multiselect-active":this.props.multiSelect,"rbc-multiselect-inactive":!this.props.multiSelect});return p["default"].createElement("div",{className:"rbc rbc-togglebutton col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"rbc-buttongroup col s12 col-xs-12"},this.renderButtons())))}}]),t}(c.Component);t["default"]=_,_.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.oneOfType([p["default"].PropTypes.array,p["default"].PropTypes.string]),multiSelect:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={multiSelect:!0,componentStyle:{},URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.KEYWORD,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,multiSelect:m.BOOLEAN,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]&&arguments[0];this.setGeoQueryInfo(),this.createChannel(e);var t=this.getMapStyle(this.props.defaultMapStyle);this.initialMapBoundQuery=!!this.props.defaultCenter,this.applyGeoQuery=this.props.applyGeoQuery?this.props.applyGeoQuery:this.props.setSearchAsMove,this.setState({currentMapStyle:t})}},{key:"componentWillReceiveProps",value:function(e){e.defaultMapStyle!==this.props.defaultMapStyle&&this.mapStyleChange(this.getMapStyle(e.defaultMapStyle))}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){e.streamProp!==e.props.stream&&(e.streamProp=e.props.stream,e.removeChannel(),e.initialize()),e.sizeProp!==e.props.size&&(e.sizeProp=e.props.size,e.removeChannel(),e.initialize(!0))},300)}},{key:"componentWillUnmount",value:function(){this.removeChannel()}},{key:"removeChannel",value:function(){this.channelId&&(_.AppbaseChannelManager.stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove()}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and?"string"==typeof t.and&&(t.and=[t.and]):t.and=[],t.or=t.or?t.or:[],t.or.push("geoQuery"),t.and.push("streamChanges");var n=_.AppbaseChannelManager.create(this.context.appbaseRef,this.context.type,t,this.props.size,this.props.from,this.props.stream);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){function n(){"historic"===t.mode&&t.startTime>this.queryStartTime?this.afterChannelResponse(t):"streaming"===t.mode&&this.afterChannelResponse(t)}function r(){if(t.error&&t.startTime>this.queryStartTime){if(this.props.onAllData){var e=_.AppbaseSensorHelper.prepareResultData(t);this.props.onAllData(e.res,e.err)}}else t.appliedQuery&&(this.state.mapBounds?this.props.autoMapRender?n.call(this):o.hits.hits.length&&n.call(this):n.call(this))}var o=t.data;r.call(e)});var r={key:"streamChanges",value:""};_.AppbaseSensorHelper.selectedSensor.set(r,!0)}},{key:"afterChannelResponse",value:function(e){var t=this,n=w.afterChannelResponse(e,this.state.rawData,this.props.appbaseField,this.state.markersData);this.reposition=!0,this.streamFlag=n.streamFlag,this.queryStartTime=n.queryStartTime?n.queryStartTime:0,this.setState({rawData:n.rawData,markersData:n.markersData},function(){if(t.props.onAllData){e.allMarkers=n.rawData;var r=JSON.parse(JSON.stringify(e));if(r.newData=n.newData,r.currentData=n.currentData,delete r.data,r=_.AppbaseSensorHelper.prepareResultData(r,e.data),t.props.onAllData){r.res&&(r.res.mapRef=t.mapRef);var o=t.props.onAllData(r.res,r.err);t.setState({externalData:o})}}t.streamFlag&&t.streamMarkerInterval()})}},{key:"setGeoQueryInfo",value:function(){var e={key:"geoQuery",value:{queryType:"geo_bounding_box",inputData:this.props.appbaseField,customQuery:this.geoCustomQuery}},t={key:"updateExecute",value:{queryType:"random",inputData:this.props.appbaseField}};_.AppbaseSensorHelper.selectedSensor.setSensorInfo(e),_.AppbaseSensorHelper.selectedSensor.setSensorInfo(t)}},{key:"geoCustomQuery",value:function(e){var t=null;return e&&(this.initialMapBoundQuery||this.searchAsMove)&&(t={geo_bounding_box:a({},this.props.appbaseField,e)},this.geoRelatedEventsChange?this.geoRelatedEventsChange=!1:this.applyGeoQuery&&(this.applyGeoQuery=!1),this.initialMapBoundQuery=!1),t}},{key:"updateExecute",value:function(){setTimeout(function(){var e={key:"updateExecute",value:Math.random()};_.AppbaseSensorHelper.selectedSensor.set(e,!0)},1e3)}},{key:"handleMarkerClick",value:function(e){var t=this;e.showInfo=!0,this.reposition=!1,this.setState({rerender:!0},function(){t.props.popoverTTL&&t.watchPopoverTTL(e)})}},{key:"handleMarkerClose",value:function(e){e.showInfo=!1,this.reposition=!1,this.setState(this.state)}},{key:"watchPopoverTTL",value:function(e){var t=this;this.popoverTTLStore=this.popoverTTLStore?this.popoverTTLStore:{},this.popoverTTLStore[e._type+e._id]?this.clearTTL(e._type+e._id):this.popoverTTLStore[e._type+e._id]=setTimeout(function(){t.handleMarkerClose(e),t.clearTTL(e._type+e._id)},1e3*this.props.popoverTTL)}},{key:"clearTTL",value:function(e){clearTimeout(this.popoverTTLStore[e]),delete this.popoverTTLStore[e]}},{key:"renderInfoWindow",value:function(e,t){var n=this,r=this.props.onPopoverTrigger?this.props.onPopoverTrigger(t):"Popver";return f["default"].createElement(h.InfoWindow,{zIndex:500,key:e+"_info_window",onCloseclick:function(){return n.handleMarkerClose(t)}},f["default"].createElement("div",null,r))}},{key:"handleOnIdle",value:function(){var e=this.mapRef?this.mapRef.getBounds():null;if(e){var t=e.getNorthEast().lat(),n=e.getSouthWest().lat(),r=e.getNorthEast().lng(),o=e.getSouthWest().lng(),a={top_left:[o,t],bottom_right:[r,n]},i={mapBounds:e};if(this.props.onIdle){var s=this.props.onIdle(this.mapRef,{boundingBoxCoordinates:a,mapBounds:e});i.externalData=s}if(this.initialMapBoundQuery||this.applyGeoQuery||this.geoRelatedEventsChange&&this.searchAsMove&&!this.searchQueryProgress){var u=!!this.initialMapBoundQuery||(this.applyGeoQuery?this.applyGeoQuery:this.searchAsMove);this.setValue(a,u)}this.setState(i)}}},{key:"handleOnDrage",value:function(){this.storeCenter=null}},{key:"setValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={key:"geoQuery",value:e};_.AppbaseSensorHelper.selectedSensor.set(n,t)}},{key:"searchAsMoveChange",value:function(e){this.searchAsMove=e,e&&this.mapRef&&(this.geoRelatedEventsChange=!0,this.handleOnIdle())}},{key:"mapStyleChange",value:function(e){this.setState({currentMapStyle:e})}},{key:"handleBoundsChanged",value:function(){var e=this;this.searchQueryProgress&&setTimeout(function(){e.searchQueryProgress=!1},1e3)}},{key:"streamMarkerInterval",value:function(){var e=this,t=this.state.markersData,n=t.filter(function(e){return e.stream&&e.streamStart});n.length?(this.isStreamDataExists=!0,setTimeout(function(){return e.streamToNormal()},1e3*this.props.streamTTL)):this.isStreamDataExists=!1}},{key:"streamToNormal",value:function(){var e=this,t=this.state.markersData,n=t.filter(function(e){return e.stream&&e.streamStart});n.length?(t=t.map(function(t){if(t.stream&&t.streamStart){var n=new Date,r=(n.getTime()-t.streamStart.getTime())/1e3;r>=e.props.streamTTL&&(delete t.stream,delete t.streamStart)}return t}),this.setState({markersData:t})):this.isStreamDataExists=!1}},{key:"getIcon",value:function(e){return e.stream?this.props.streamMarkerImage:this.props.defaultMarkerImage}},{key:"chooseIcon",value:function(e){var t=e.external_icon?e.external_icon:this.getIcon(e);t=this.props.onData?this.props.onData(e):t;var n=!!("object"===("undefined"==typeof t?"undefined":c(t))&&"path"in t);if(n&&(t=JSON.parse(JSON.stringify(t)),this.props.autoMarkerPosition)){var r=e.angleDeg?e.angleDeg:0;t.rotation=r}return t}},{key:"combineProps",value:function(e){var t=void 0,n={};return this.state.externalData&&this.state.externalData.markers&&this.state.externalData.markers[e._id]&&(t=this.state.externalData.markers[e._id],Object.keys(t).forEach(function(r){e["external_"+r]=t[r],n[r]=t[r]})),n.icon=this.chooseIcon(e),n}},{key:"generateMarkers",value:function(){var e=this,t=this,n=this.state.markersData,r={markerComponent:[],defaultCenter:null,convertedGeo:[]};return n&&n.length&&(n=n.filter(function(e){return w.identifyGeoData(e._source[t.props.appbaseField])}),r.markerComponent=n.map(function(n,o){var a=w.identifyGeoData(n._source[t.props.appbaseField]);r.convertedGeo.push(a);var i={position:a},s="marker_ref_"+o,u=void 0;if(e.props.showPopoverOn){u={};var c=e.props.showPopoverOn.split("");c[0]=c[0].toUpperCase(),c=c.join(""),u["on"+c]=e.handleMarkerClick.bind(e,n)}else u={},u.onClick=e.handleMarkerClick.bind(e,n);var p=function(){},d={onClick:e.props.markerOnClick?e.props.markerOnClick:p,onDblclick:e.props.markerOnDblclick?e.props.markerOnDblclick:p,onMouseover:e.props.onMouseover?e.props.onMouseover:p,onMouseout:e.props.onMouseout?e.props.onMouseout:p};return f["default"].createElement(h.Marker,l({},i,{key:n._id,zIndex:1,ref:s},t.combineProps(n),{onClick:function(){return d.onClick(n._source)},onDblclick:function(){return d.onDblclick(n._source)},onMouseover:function(){return d.onMouseover(n._source)},onMouseout:function(){return d.onMouseout(n._source)}},u),n.showInfo?t.renderInfoWindow(s,n):null)}),r.convertedGeo[0]&&(r.defaultCenter={lat:r.convertedGeo[0].lat,lng:r.convertedGeo[0].lng})),this.props.showMarkers||(r.markerComponent=[]),r}},{key:"externalData",value:function(){var e=this,t=[];return this.state.externalData&&Object.keys(this.state.externalData).forEach(function(n){"markers"!==n&&(t=t.concat(e.state.externalData[n]))}),t}},{key:"mapEvents",value:function(e){if(this.geoRelatedEvents.indexOf(e)>-1&&(this.geoRelatedEventsChange=!0),this.props[e]){var t=this.props[e](this.mapRef);t&&this.setState({externalData:t})}}},{key:"getStoreCenter",value:function(){return this.storeCenter?this.storeCenter:this.state.center}},{key:"render",value:function(){var e=this,t=void 0,n=void 0,r=void 0,o=null,a=null,i={},s=this.generateMarkers();t=this.props.setMarkerCluster?f["default"].createElement(y["default"],{averageCenter:!0,enableRetinaIcons:!0,gridSize:60},s.markerComponent):s.markerComponent;var u=!0;"streaming"!==this.channelMethod||this.props.streamAutoCenter||(u=!1),this.props.autoCenter&&this.reposition&&u?(a=s.defaultCenter?s.defaultCenter:this.getStoreCenter(),this.storeCenter=a,this.reposition=!1,i.center=w.normalizeCenter(a)):this.storeCenter?(a=this.storeCenter,i.center=w.normalizeCenter(a)):a=null,this.props.showSearchAsMove&&(n=f["default"].createElement(b.SearchAsMove,{searchAsMoveDefault:this.props.setSearchAsMove,searchAsMoveChange:this.searchAsMoveChange})),this.props.showMapStyles&&(r=f["default"].createElement(T.MapStyles,{defaultSelected:this.props.defaultMapStyle,mapStyleChange:this.mapStyleChange})),this.props.title&&(o=f["default"].createElement("h4",{className:"rbc-title col s12 m8 col-xs-12 col-sm-8"},this.props.title));var c=(0,g["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return f["default"].createElement("div",{className:"rbc rbc-reactivemap col s12 col-xs-12 card thumbnail "+c,style:w.mapPropsStyles(this.props.componentStyle,"component")},o,r,f["default"].createElement(h.GoogleMapLoader,{containerElement:f["default"].createElement("div",{className:"rbc-container col s12 col-xs-12",style:w.mapPropsStyles(this.props.componentStyle,"map",this.mapDefaultHeight)}),googleMapElement:f["default"].createElement(h.GoogleMap,l({ref:function(t){ e.mapRef=t}},i,w.normalizeProps(this.props),{options:{styles:this.state.currentMapStyle},defaultCenter:w.normalizeCenter(this.state.defaultCenter),onDragstart:function(){e.handleOnDrage(),e.mapEvents("onDragstart")},onIdle:function(){return e.handleOnIdle()},onClick:function(){return e.mapEvents("onClick")},onDblclick:function(){return e.mapEvents("onDblclick")},onDrag:function(){return e.mapEvents("onDrag")},onDragend:function(){return e.mapEvents("onDragend")},onMousemove:function(){return e.mapEvents("onMousemove")},onMouseout:function(){return e.mapEvents("onMouseout")},onMouseover:function(){return e.mapEvents("onMouseover")},onResize:function(){return e.mapEvents("onResize")},onRightclick:function(){return e.mapEvents("onRightclick")},onTilesloaded:function(){return e.mapEvents("onTilesloaded")},onBoundsChanged:function(){return e.mapEvents("onBoundsChanged")},onCenterChanged:function(){return e.mapEvents("onCenterChanged")},onProjectionChanged:function(){return e.mapEvents("onProjectionChanged")},onTiltChanged:function(){return e.mapEvents("onTiltChanged")},onZoomChanged:function(){return e.mapEvents("onZoomChanged")}}),t,this.externalData())}),n,f["default"].createElement(_.PoweredBy,null))}}]),t}(d.Component);t["default"]=k,k.propTypes={appbaseField:f["default"].PropTypes.string.isRequired,onIdle:f["default"].PropTypes.func,onAllData:f["default"].PropTypes.func,onData:f["default"].PropTypes.func,onPopoverTrigger:f["default"].PropTypes.func,setMarkerCluster:f["default"].PropTypes.bool,autoMarkerPosition:f["default"].PropTypes.bool,showMarkers:f["default"].PropTypes.bool,streamTTL:w.validation.streamTTL,popoverTTL:w.validation.popoverTTL,size:_.AppbaseSensorHelper.sizeValidation,from:w.validation.fromValidation,autoMapRender:f["default"].PropTypes.bool,componentStyle:f["default"].PropTypes.object,autoCenter:f["default"].PropTypes.bool,showSearchAsMove:f["default"].PropTypes.bool,setSearchAsMove:f["default"].PropTypes.bool,defaultMapStyle:f["default"].PropTypes.oneOf(["Standard","Blue Essence","Blue Water","Flat Map","Light Monochrome","Midnight Commander","Unsaturated Browns"]),title:f["default"].PropTypes.oneOfType([f["default"].PropTypes.string,f["default"].PropTypes.element]),streamAutoCenter:f["default"].PropTypes.bool,defaultMarkerImage:f["default"].PropTypes.string,streamMarkerImage:f["default"].PropTypes.string,stream:f["default"].PropTypes.bool,defaultZoom:w.validation.defaultZoom,applyGeoQuery:f["default"].PropTypes.bool,showPopoverOn:f["default"].PropTypes.oneOf(["click","mouseover"]),defaultCenter:f["default"].PropTypes.shape({lat:w.validation.validCenter,lon:w.validation.validCenter}),react:f["default"].PropTypes.object,markerOnClick:f["default"].PropTypes.func,markerOnDblclick:f["default"].PropTypes.func,onMouseover:f["default"].PropTypes.func,onMouseout:f["default"].PropTypes.func,showMapStyles:f["default"].PropTypes.bool},k.defaultProps={setMarkerCluster:!0,autoCenter:!0,showSearchAsMove:!0,setSearchAsMove:!1,showMapStyles:!0,defaultMapStyle:"Standard",from:0,size:100,streamTTL:5,streamAutoCenter:!1,autoMarkerPosition:!1,showMarkers:!0,autoMapRender:!0,defaultMarkerImage:"https://opensource.appbase.io/reactivemaps/dist/images/historic-pin.png",streamMarkerImage:"https://opensource.appbase.io/reactivemaps/dist/images/stream-pin.png",componentStyle:{},stream:!1,applyGeoQuery:!1,defaultZoom:13},k.contextTypes={appbaseRef:f["default"].PropTypes.any.isRequired,type:f["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ItemCheckboxList=void 0;var s=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0],c[this.state.selectedValue].value);this.props.mapStyleChange(e)}},{key:"render",value:function(){var e=this.state.items.map(function(e,t){return l["default"].createElement("option",{value:t,key:t},e.key)});return l["default"].createElement("div",{className:"input-field col rbc-mapstyles pull-right right"},l["default"].createElement("select",{className:"browser-default form-control",onChange:this.handleSelect,value:this.state.selectedValue,name:"mapStyles",id:"mapStyles"},e))}}]),t}(u.Component);p.propTypes={},p.defaultProps={fieldName:"MapStyles"}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.SearchAsMove=void 0;var s=function(){function e(e,t){for(var n=0;n20)return new Error("zoom value should be an integer between 0 and 20.")},validCenter:function(e,t,n){return isNaN(e[t])?new Error(t+" value must be number"):"lat"===t&&(e[t]<-90||e[t]>90)?new Error(t+" value should be between -90 and 90."):"lng"===t&&(e[t]<-180||e[t]>180)?new Error(t+" value should be between -180 and 180."):void 0},fromValidation:function(e,t,n){if(e[t]<0)return new Error(t+" value should be greater than or equal to 0.")},streamTTL:function(e,t,n){if(e[t]<0||e[t]>1e3)return new Error(t+" should be a positive integer between 0 and 1000, counted in seconds for a streaming update to be visible.")},popoverTTL:function(e,t,n){if(e[t]<.1||e[t]>60)return new Error(t+" should be a positive integer between 1 and 60, counted in seconds for a popover to be visible.")}},t.normalizeCenter=function(e){return e&&e.lon&&(e.lng=e.lon),e});t.normalizeProps=function(e){var t=JSON.parse(JSON.stringify(e));return t.defaultCenter&&(t.defaultCenter=p(t.defaultCenter)),t.center&&(t.center=p(t.center)),t},t.mapPropsStyles=function(e,t,n){var r=JSON.parse(JSON.stringify(e)),o=void 0;return"component"===t?o=r:"map"===t&&(o={height:r.height?r.height:n}),o}},function(e,t){"use strict";e.exports=[{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#e0efef"}]},{featureType:"poi",elementType:"geometry.fill",stylers:[{visibility:"on"},{hue:"#1900ff"},{color:"#c0e8e8"}]},{featureType:"road",elementType:"geometry",stylers:[{lightness:100},{visibility:"simplified"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"transit.line",elementType:"geometry",stylers:[{visibility:"on"},{lightness:700}]},{featureType:"water",elementType:"all",stylers:[{color:"#7dcdcd"}]}]},function(e,t){"use strict";e.exports=[{featureType:"administrative",elementType:"labels.text.fill",stylers:[{color:"#444444"}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#f2f2f2"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"all",stylers:[{saturation:-100},{lightness:45}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"all",stylers:[{color:"#46bcec"},{visibility:"on"}]}]},function(e,t){"use strict";e.exports=[{featureType:"all",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"landscape",elementType:"all",stylers:[{visibility:"on"},{color:"#f3f4f4"}]},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{weight:.9},{visibility:"off"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#83cead"}]},{featureType:"road",elementType:"all",stylers:[{visibility:"on"},{color:"#ffffff"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"on"},{color:"#fee379"}]},{featureType:"road.arterial",elementType:"all",stylers:[{visibility:"on"},{color:"#fee379"}]},{featureType:"water",elementType:"all",stylers:[{visibility:"on"},{color:"#7fc8ed"}]}]},function(e,t){"use strict";e.exports=[{featureType:"administrative.locality",elementType:"all",stylers:[{hue:"#2c2e33"},{saturation:7},{lightness:19},{visibility:"on"}]},{featureType:"landscape",elementType:"all",stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100},{visibility:"simplified"}]},{featureType:"poi",elementType:"all",stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100},{visibility:"off"}]},{featureType:"road",elementType:"geometry",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:31},{visibility:"simplified"}]},{featureType:"road",elementType:"labels",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:31},{visibility:"on"}]},{featureType:"road.arterial",elementType:"labels",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:-2},{visibility:"simplified"}]},{featureType:"road.local",elementType:"geometry",stylers:[{hue:"#e9ebed"},{saturation:-90},{lightness:-8},{visibility:"simplified"}]},{featureType:"transit",elementType:"all",stylers:[{hue:"#e9ebed"},{saturation:10},{lightness:69},{visibility:"on"}]},{featureType:"water",elementType:"all",stylers:[{hue:"#e9ebed"},{saturation:-78},{lightness:67},{visibility:"simplified"}]}]},function(e,t){"use strict";e.exports=[{featureType:"all",elementType:"labels.text.fill",stylers:[{color:"#ffffff"}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{color:"#000000"},{lightness:13}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#144b53"},{lightness:14},{weight:1.4}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#08304b"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#0c4152"},{lightness:5}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#0b434f"},{lightness:25}]},{featureType:"road.arterial",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.arterial",elementType:"geometry.stroke",stylers:[{color:"#0b3d51"},{lightness:16}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#000000"}]},{featureType:"transit",elementType:"all",stylers:[{color:"#146474"}]},{featureType:"water",elementType:"all",stylers:[{color:"#021019"}]}]},function(e,t){"use strict";e.exports=[{featureType:"water",stylers:[{saturation:43},{lightness:-11},{hue:"#0088ff"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{hue:"#ff0000"},{saturation:-100},{lightness:99}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#808080"},{lightness:54}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{color:"#ece2d9"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#ccdca1"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#767676"}]},{featureType:"road",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]},{featureType:"poi",stylers:[{visibility:"off"}]},{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#b8cb93"}]},{featureType:"poi.park",stylers:[{visibility:"on"}]},{featureType:"poi.sports_complex",stylers:[{visibility:"on"}]},{featureType:"poi.medical",stylers:[{visibility:"on"}]},{featureType:"poi.business",stylers:[{visibility:"simplified"}]}]},function(e,t){"use strict";e.exports=[{elementType:"geometry",stylers:[{hue:"#ff4400"},{saturation:-68},{lightness:-4},{gamma:.72}]},{featureType:"road",elementType:"labels.icon"},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{hue:"#0077ff"},{gamma:3.1}]},{featureType:"water",stylers:[{hue:"#00ccff"},{gamma:.44},{saturation:-33}]},{featureType:"poi.park",stylers:[{hue:"#44ff00"},{saturation:-23}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{hue:"#007fff"},{gamma:.77},{saturation:65},{lightness:99}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{gamma:.11},{weight:5.6},{saturation:99},{hue:"#0091ff"},{lightness:-86}]},{featureType:"transit.line",elementType:"geometry",stylers:[{lightness:-48},{hue:"#ff5e00"},{gamma:1.2},{saturation:-23}]},{featureType:"transit",elementType:"labels.text.stroke",stylers:[{saturation:-64},{hue:"#ff9100"},{lightness:16},{gamma:.47},{weight:2.7}]}]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n=0&&e.end>=0&&""!==e.location){var n;t=o({},this.type,(n={},o(n,this.props.appbaseField,e.location),o(n,"from",e.start+this.unit),o(n,"to",e.end+this.unit),n))}return t}},{key:"getCoordinates",value:function(e,t){var n=this;e&&""!==e?m["default"].get("https://maps.googleapis.com/maps/api/geocode/json?address="+e).then(function(e){var r=e.data.results[0].geometry.location;n.locString=r.lat+", "+r.lng,t?t.call(n,n.defaultSelected.label):n.executeQuery()}):p.AppbaseSensorHelper.selectedSensor.set(null,!0)}},{key:"executeQuery",value:function(){if(""!==this.state.currentValue&&this.state.selected&&this.locString){var e,t={key:this.props.componentId,value:{currentValue:this.state.currentValue,start:this.state.selected.start,end:this.state.selected.end,location:this.locString,unit:this.unit}},n={key:this.props.componentId,value:o({},this.sortInfo.type,(e={},o(e,this.props.appbaseField,this.locString),o(e,"order",this.sortInfo.order),o(e,"unit",this.unit),e))};this.props.onValueChange&&this.props.onValueChange(t.value),p.AppbaseSensorHelper.selectedSensor.setSortInfo(n),p.AppbaseSensorHelper.URLParams.update(this.props.componentId,this.setURLValue(),this.props.URLParams),p.AppbaseSensorHelper.selectedSensor.set(t,!0)}}},{key:"setURLValue",value:function(){return JSON.stringify({location:this.state.currentValue,label:this.state.selected.label})}},{key:"handleChange",value:function(e){if(e){var t=e.value;this.setState({currentValue:t}),this.getCoordinates(t)}else{this.setState({currentValue:""});var n={key:this.props.componentId,value:null};this.props.onValueChange&&this.props.onValueChange(n.value),p.AppbaseSensorHelper.URLParams.update(this.props.componentId,null,this.props.URLParams),p.AppbaseSensorHelper.selectedSensor.set(n,!0)}}},{key:"loadOptions",value:function(e,t){var n=this;if(this.callback=t,e){var r=this.googleMaps||window.google.maps;this.autocompleteService=new r.places.AutocompleteService;var o={input:e};this.result={options:[]},this.autocompleteService.getPlacePredictions(o,function(e){e.forEach(function(e){n.result.options.push({label:e.description,value:e.description})}),n.state.userLocation.length&&"Use my current location"!==n.result.options[0].label&&n.result.options.unshift({label:"Use my current location",value:n.state.userLocation}),n.callback(null,n.result)})}else this.callback(null,this.result)}},{key:"handleDistanceChange",value:function(e){this.setState({selected:{start:e.start,end:e.end,label:e.label}},this.executeQuery.bind(this))}},{key:"renderValue",value:function(e){return c["default"].createElement("span",null,e.value)}},{key:"render",value:function(){var e=null;this.props.title&&(e=c["default"].createElement("h4",{className:"rbc-title"},this.props.title));var t=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return c["default"].createElement("div",{className:"rbc rbc-geodistancedropdown clearfix card thumbnail col s12 col-xs-12 "+t,style:this.props.componentStyle},c["default"].createElement("div",{className:"row"},e,c["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},c["default"].createElement(v["default"].Async,{value:this.state.currentValue,loadOptions:this.loadOptions,placeholder:this.props.placeholder,onChange:this.handleChange,filterOption:function(){return!0},valueRenderer:this.renderValue})),c["default"].createElement("div",{className:"col s12 col-xs-12"},c["default"].createElement(v["default"],{value:this.state.selected.label?this.state.selected:"",options:this.props.data,clearable:!1,searchable:!1,onChange:this.handleDistanceChange,placeholder:this.props.placeholderDropdown}))))}}]),t}(l.Component);t["default"]=_,_.propTypes={componentId:c["default"].PropTypes.string.isRequired,appbaseField:c["default"].PropTypes.string.isRequired,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]), customQuery:c["default"].PropTypes.func,defaultSelected:c["default"].PropTypes.shape({label:c["default"].PropTypes.string,location:c["default"].PropTypes.string}),placeholder:c["default"].PropTypes.string,placeholderDropdown:c["default"].PropTypes.string,autoLocation:c["default"].PropTypes.bool,unit:c["default"].PropTypes.oneOf(["mi","miles","yd","yards","ft","feet","in","inch","km","kilometers","m","meters","cm","centimeters","mm","millimeters","NM","nmi","nauticalmiles"]),data:c["default"].PropTypes.arrayOf(c["default"].PropTypes.shape({start:p.AppbaseSensorHelper.validateThreshold,end:p.AppbaseSensorHelper.validateThreshold,label:c["default"].PropTypes.string.isRequired})),onValueChange:c["default"].PropTypes.func,componentStyle:c["default"].PropTypes.object,URLParams:c["default"].PropTypes.bool},_.defaultProps={unit:"mi",placeholder:"Search...",placeholderDropdown:"Select Distance",autoLocation:!0,componentStyle:{},URLParams:!1},_.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n>8-a%1*8)){if(o=t.charCodeAt(a+=.75),o>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|o}return s}),n.atob||(n.atob=function(t){if(t=t.replace(/=+$/,""),t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,s="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?s+=String.fromCharCode(255&n>>(-2*a&6)):0)o=r.indexOf(o);return s})}()},function(e,t){"use strict";function n(){return!1}function r(){return!0}function o(){this.timeStamp=Date.now(),this.target=void 0,this.currentTarget=void 0}Object.defineProperty(t,"__esModule",{value:!0}),o.prototype={isEventObject:1,constructor:o,isDefaultPrevented:n,isPropagationStopped:n,isImmediatePropagationStopped:n,preventDefault:function(){this.isDefaultPrevented=r},stopPropagation:function(){this.isPropagationStopped=r},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=r,this.stopPropagation()},halt:function(e){e?this.stopImmediatePropagation():this.stopPropagation(),this.preventDefault()}},t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return null===e||void 0===e}function a(){return d}function i(){return f}function s(e){var t=e.type,n="function"==typeof e.stopPropagation||"boolean"==typeof e.cancelBubble;l["default"].call(this),this.nativeEvent=e;var r=i;"defaultPrevented"in e?r=e.defaultPrevented?a:i:"getPreventDefault"in e?r=e.getPreventDefault()?a:i:"returnValue"in e&&(r=e.returnValue===f?a:i),this.isDefaultPrevented=r;var o=[],s=void 0,u=void 0,c=void 0,p=h.concat();for(m.forEach(function(e){t.match(e.reg)&&(p=p.concat(e.props),e.fix&&o.push(e.fix))}),u=p.length;u;)c=p[--u],this[c]=e[c];for(!this.target&&n&&(this.target=e.srcElement||document),this.target&&3===this.target.nodeType&&(this.target=this.target.parentNode),u=o.length;u;)(s=o[--u])(this,e);this.timeStamp=e.timeStamp||Date.now()}Object.defineProperty(t,"__esModule",{value:!0});var u=n(411),l=r(u),c=n(9),p=r(c),d=!0,f=!1,h=["altKey","bubbles","cancelable","ctrlKey","currentTarget","eventPhase","metaKey","shiftKey","target","timeStamp","view","type"],m=[{reg:/^key/,props:["char","charCode","key","keyCode","which"],fix:function(e,t){o(e.which)&&(e.which=o(t.charCode)?t.keyCode:t.charCode),void 0===e.metaKey&&(e.metaKey=e.ctrlKey)}},{reg:/^touch/,props:["touches","changedTouches","targetTouches"]},{reg:/^hashchange$/,props:["newURL","oldURL"]},{reg:/^gesturechange$/i,props:["rotation","scale"]},{reg:/^(mousewheel|DOMMouseScroll)$/,props:[],fix:function(e,t){var n=void 0,r=void 0,o=void 0,a=t.wheelDelta,i=t.axis,s=t.wheelDeltaY,u=t.wheelDeltaX,l=t.detail;a&&(o=a/120),l&&(o=0-(l%3===0?l/3:l)),void 0!==i&&(i===e.HORIZONTAL_AXIS?(r=0,n=0-o):i===e.VERTICAL_AXIS&&(n=0,r=o)),void 0!==s&&(r=s/120),void 0!==u&&(n=-1*u/120),n||r||(r=o),void 0!==n&&(e.deltaX=n),void 0!==r&&(e.deltaY=r),void 0!==o&&(e.delta=o)}},{reg:/^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,props:["buttons","clientX","clientY","button","offsetX","relatedTarget","which","fromElement","toElement","offsetY","pageX","pageY","screenX","screenY"],fix:function(e,t){var n=void 0,r=void 0,a=void 0,i=e.target,s=t.button;return i&&o(e.pageX)&&!o(t.clientX)&&(n=i.ownerDocument||document,r=n.documentElement,a=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||a&&a.scrollLeft||0)-(r&&r.clientLeft||a&&a.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||a&&a.scrollTop||0)-(r&&r.clientTop||a&&a.clientTop||0)),e.which||void 0===s||(1&s?e.which=1:2&s?e.which=3:4&s?e.which=2:e.which=0),!e.relatedTarget&&e.fromElement&&(e.relatedTarget=e.fromElement===i?e.toElement:e.fromElement),e}}],y=l["default"].prototype;(0,p["default"])(s.prototype,y,{constructor:s,preventDefault:function(){var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=f,y.preventDefault.call(this)},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=d,y.stopPropagation.call(this)}}),t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){function r(t){var r=new i["default"](t);n.call(e,r)}return e.addEventListener?(e.addEventListener(t,r,!1),{remove:function(){e.removeEventListener(t,r,!1)}}):e.attachEvent?(e.attachEvent("on"+t,r),{remove:function(){e.detachEvent("on"+t,r)}}):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var a=n(412),i=r(a);e.exports=t["default"]},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;var o=t.type,a=t.body;delete t.type,delete t.body;var i;return i=o?o+"/_bulk":"/_bulk",e.performStreamingRequest({method:"POST",path:i,params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;delete t.type,delete t.id;var i=o+"/"+a;return e.performStreamingRequest({method:"DELETE",path:i,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;delete t.type,delete t.id;var i=o+"/"+a;return e.performStreamingRequest({method:"GET",path:i,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(140),o=function(e){var t=r.obj(function(e,t,n){var r=Object.keys(e)[0],o=Object.keys(e[r].mappings).filter(function(e){return"_default_"!==e});this.push(o),n()});return t.writable=!1,e.performStreamingRequest({method:"GET",path:"_mapping"}).pipe(t)};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",body:"object"});if(n!==!0)throw n;var o=t.type,a=t.id,i=t.body;delete t.type,delete t.id,delete t.body;var s;return s=a?o+"/"+a:o,e.performStreamingRequest({method:"POST",path:s,params:t,body:i})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;var o;o=t.type.constructor===Array?t.type.join():t.type;var a=t.body;delete t.type,delete t.body;var i;return i=o?o+"/_search":"/_search",e.performStreamingRequest({method:"POST",path:i,params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;return delete t.type,delete t.id,delete t.stream,t.stream===!0||"true"===t.stream?t.stream="true":(delete t.stream,t.streamonly="true"),e.performWsRequest({method:"GET",path:o+"/"+a,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;if(void 0===t.type||"string"!=typeof t.type&&t.type.constructor!==Array||""===t.type||0===t.type.length)throw new Error("fields missing: type");var o;o=t.type.constructor===Array?t.type.join():t.type;var o=t.type,a=t.body;return delete t.type,delete t.body,delete t.stream,t.streamonly="true",e.performWsRequest({method:"POST",path:o+"/_search",params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string",body:"object"});if(n!==!0)throw n;var o=t.type,a=t.id,i=t.body;delete t.type,delete t.id,delete t.body;var s=o+"/"+a+"/_update";return e.performStreamingRequest({method:"POST",path:s,params:t,body:i})};e.exports=o},function(e,t,n){"use strict";var r=n(565),o=n(34),a=function(e,t,n){var a=o.validate(t,{body:"object"});if(a!==!0)throw a;if(void 0===t.type||"string"!=typeof t.type&&t.type.constructor!==Array||""===t.type||0===t.type.length)throw new Error("fields missing: type");if(a=o.validate(t.body,{query:"object"}),a!==!0)throw a;if(t.type.constructor===Array?(this.type=t.type,this.type_string=t.type.join()):(this.type=[t.type],this.type_string=t.type),this.webhooks=[],this.client=e,this.query=t.body.query,"string"==typeof n){var i={};i.url=n,i.method="GET",this.webhooks.push(i)}else if(n.constructor===Array)this.webhooks=n;else{if(n!==Object(n))throw new Error("fields missing: second argument(webhook) is necessary");this.webhooks.push(n)}this.populateBody();var s=btoa(r(this.query)),u=".percolator/webhooks-0-"+this.type_string+"-0-"+s;return this.path=u,this.performRequest("POST")};a.prototype.populateBody=function(){this.body={},this.body.webhooks=this.webhooks,this.body.query=this.query,this.body.type=this.type},a.prototype.performRequest=function(e){var t=this.client.performStreamingRequest({method:e,path:this.path,body:this.body});return t.change=this.change.bind(this),t.stop=this.stop.bind(this),t},a.prototype.change=function(e){if(this.webhooks=[],"string"==typeof e){var t={};t.url=e,t.method="POST",this.webhooks.push(t)}else if(e.constructor===Array)this.webhooks=e;else{if(e!==Object(e))throw new Error("fields missing: one of webhook or url fields is required");this.webhooks.push(e)}return this.populateBody(),this.performRequest("POST")},a.prototype.stop=function(){return delete this.body,this.performRequest("DELETE")},e.exports=a},function(e,t,n){"use strict";var r=n(142),o=n(425),a=n(426),i=n(427),s=n(418),u=n(416),l=n(422),c=n(415),p=n(414),d=n(419),f=n(417),h=n(423),m=n(420),y=n(421),v=function g(e){if(!(this instanceof g))return new g(e);if("string"!=typeof e.url||""===e.url)throw new Error("URL not present in options.");var t=r.parse(e.url);if(this.url=t.host,this.protocol=t.protocol,this.credentials=t.auth,this.appname=e.appname||e.app,"string"!=typeof this.appname||""===this.appname)throw new Error("App name is not present in options.");if("string"!=typeof this.protocol||""===this.protocol)throw new Error("Protocol is not present in url. URL should be of the form https://scalr.api.appbase.io");if("string"==typeof e.username&&""!==e.username&&"string"==typeof e.password&&""!==e.password&&(this.credentials=e.username+":"+e.password),"string"==typeof e.credentials&&""!==e.credentials&&(this.credentials=e.credentials),"string"!=typeof this.credentials||""===this.credentials)throw new Error("Authentication information is not present. Did you add credentials?");"https:"===t.protocol?this.ws=new o("wss://"+t.host+"/"+this.appname):this.ws=new o("ws://"+t.host+"/"+this.appname),"/"===this.url.slice(-1)&&(this.url=this.url.slice(0,-1));var n={};return n.index=this.index.bind(this),n.get=this.get.bind(this),n.update=this.update.bind(this),n["delete"]=this["delete"].bind(this),n.bulk=this.bulk.bind(this),n.search=this.search.bind(this),n.getStream=this.getStream.bind(this),n.searchStream=this.searchStream.bind(this),n.searchStreamToURL=this.searchStreamToURL.bind(this),n.getTypes=this.getTypes.bind(this),n};v.prototype.performWsRequest=function(e){return new i(this,JSON.parse(JSON.stringify(e)))},v.prototype.performStreamingRequest=function(e){return new a(this,JSON.parse(JSON.stringify(e)))},v.prototype.index=function(e){return new s(this,JSON.parse(JSON.stringify(e)))},v.prototype.get=function(e){return new u(this,JSON.parse(JSON.stringify(e)))},v.prototype.update=function(e){return new l(this,JSON.parse(JSON.stringify(e)))},v.prototype["delete"]=function(e){return new c(this,JSON.parse(JSON.stringify(e)))},v.prototype.bulk=function(e){return new p(this,JSON.parse(JSON.stringify(e)))},v.prototype.search=function(e){return new d(this,JSON.parse(JSON.stringify(e)))},v.prototype.getStream=function(e){return new m(this,JSON.parse(JSON.stringify(e)))},v.prototype.searchStream=function(e){return new y(this,JSON.parse(JSON.stringify(e)))},v.prototype.searchStreamToURL=function(e,t){return new h(this,JSON.parse(JSON.stringify(e)),JSON.parse(JSON.stringify(t)))},v.prototype.getTypes=function(){return new f(this)},"undefined"!=typeof window&&(window.Appbase=v),e.exports=v},function(e,t,n){"use strict";var r="undefined"!=typeof window?window.WebSocket:n(748),o=n(36).EventEmitter,a=function(e){var t=new r(e),n=new o;return n.setMaxListeners(0),n.send=function(e){return 1===t.readyState?(t.send(JSON.stringify(e)),this):void n.on("open",function r(){t.send(JSON.stringify(e)),n.removeListener("open",r)})},t.onopen=function(){n.emit("open")},t.onmessage=function(e){var t=JSON.parse(e.data);n.emit("message",t)},t.onerror=function(e){n.emit("error",e)},t.onclose=function(e){n.emit("close",e)},n};e.exports=a},function(e,t,n){(function(t){"use strict";var r=n(553),o=n(733),a=n(113),i=n(140),s=function(e,t){if(this.client=e,this.args=t,this.method=t.method,this.path=t.path,this.params=t.params,this.body=t.body,(!this.body||"object"!=typeof this.body&&this.body.constructor!==Array)&&(this.body={}),this.body.constructor===Array){var n=this.body;this.body="";for(var r=0;r=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;ts.bottom||i.topt.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var n=this,r="object"==typeof t?t:this.props;if(r.multi){if("string"==typeof e&&(e=e.split(r.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return n.expandValue(e,r)}).filter(function(e){return e})}var o=this.expandValue(e,r);return o?[o]:[]},expandValue:function(e,t){var n=typeof e;if("string"!==n&&"number"!==n&&"boolean"!==n)return e;var r=t.options,o=t.valueKey;if(r)for(var a=0;ar&&this.focusOption(n[r+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var n=-1,r=0;r0?n-=1:n=t.length-1;else if("start"===e)n=0;else if("end"===e)n=t.length-1;else if("page_up"===e){var o=n-this.props.pageSize;n=o<0?0:o}else if("page_down"===e){var o=n+this.props.pageSize;n=o>t.length-1?t.length-1:o}n===-1&&(n=0),this.setState({focusedIndex:t[n].index,focusedOption:t[n].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return l["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},l["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var n=this,r=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:l["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var a=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return l["default"].createElement(o,{id:n._instancePrefix+"-value-"+t,instancePrefix:n._instancePrefix,disabled:n.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[n.props.valueKey],onClick:a,onRemove:n.removeValue,value:e},r(e,t),l["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(a=null),l["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:a,value:e[0]},r(e[0])))},renderInput:function(e,t){var n,r=this,i=(0,m["default"])("Select-input",this.props.inputProps.className),u=!!this.state.isOpen,c=(0,m["default"])((n={},a(n,this._instancePrefix+"-list",u),a(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),p=s({},this.props.inputProps,{role:"combobox","aria-expanded":""+u,"aria-owns":c,"aria-haspopup":""+u,"aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:i,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(p);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,h=(d.inputClassName,o(d,["inputClassName"]));return l["default"].createElement("div",s({},h,{role:"combobox","aria-expanded":u,"aria-owns":u?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:i,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?l["default"].createElement(f["default"],s({},p,{minWidth:"5"})):l["default"].createElement("div",{className:i},l["default"].createElement("input",p))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return l["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,n=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return l["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},n)},filterOptions:function N(e){var t=this.state.inputValue,n=this.props.options||[];if(this.props.filterOptions){var N="function"==typeof this.props.filterOptions?this.props.filterOptions:_["default"];return N(n,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return n},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,n){return e&&e.length?this.props.menuRenderer({focusedOption:n,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?l["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var n=e.map(function(e){return i(e[t.props.valueKey])}).join(this.props.delimiter);return l["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:n,disabled:this.props.disabled})}return e.map(function(e,n){return l["default"].createElement("input",{key:"hidden."+n,type:"hidden",ref:"value"+n,name:t.props.name,value:i(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var n=this.state.focusedOption||e;if(n&&!n.disabled){var r=t.indexOf(n);if(r!==-1)return r}for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c){var d={startTime:(new Date).getTime(),appliedQuery:u},f=this.appbaseRef[t];if(f){var h=u;h.type="*"===this.type[t]?"":this.type[t],h.preference=this.app[t],n(d),f.search(h).on("data",function(e){d.mode="historic",d.data=o.highlightModify(e,d.appliedQuery),i.emitter.emit(t,d);var n=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:d,react:s.react,queryOptions:n})}).on("error",function(e){var n={appliedQuery:d.appliedQuery,error:e,startTime:d.startTime};i.emitter.emit(t,n)}),s.stream&&r.call(this,t,u,f)}else console.error("appbaseRef is not set for "+t)}else{var m={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,m)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t){"use strict";function n(e,t){for(var n=[],r={object:null,string:""},o=Object.keys(t),a=o,i=Array.isArray(a),s=0,a=i?a:a[Symbol.iterator]();;){var u;if(i){if(s>=a.length)break;u=a[s++]}else{if(s=a.next(),s.done)break;u=s.value}var l=u,c=t[l];typeof e[l]===c&&e[l]!==r[c]||n.push(l)}for(var p="",d=0;d0)||new Error("fields missing: "+p)}e.exports={validate:n}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],i(n))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:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,u=0;u0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n), +"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;ts.bottom||i.topt.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var n=this,r="object"==typeof t?t:this.props;if(r.multi){if("string"==typeof e&&(e=e.split(r.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return n.expandValue(e,r)}).filter(function(e){return e})}var o=this.expandValue(e,r);return o?[o]:[]},expandValue:function(e,t){var n=typeof e;if("string"!==n&&"number"!==n&&"boolean"!==n)return e;var r=t.options,o=t.valueKey;if(r)for(var a=0;ar&&this.focusOption(n[r+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var n=-1,r=0;r0?n-=1:n=t.length-1;else if("start"===e)n=0;else if("end"===e)n=t.length-1;else if("page_up"===e){var o=n-this.props.pageSize;n=o<0?0:o}else if("page_down"===e){var o=n+this.props.pageSize;n=o>t.length-1?t.length-1:o}n===-1&&(n=0),this.setState({focusedIndex:t[n].index,focusedOption:t[n].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return l["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},l["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var n=this,r=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:l["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var a=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return l["default"].createElement(o,{id:n._instancePrefix+"-value-"+t,instancePrefix:n._instancePrefix,disabled:n.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[n.props.valueKey],onClick:a,onRemove:n.removeValue,value:e},r(e,t),l["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(a=null),l["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:a,value:e[0]},r(e[0])))},renderInput:function(e,t){var n,r=this,i=(0,m["default"])("Select-input",this.props.inputProps.className),u=!!this.state.isOpen,c=(0,m["default"])((n={},a(n,this._instancePrefix+"-list",u),a(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),p=s({},this.props.inputProps,{role:"combobox","aria-expanded":""+u,"aria-owns":c,"aria-haspopup":""+u,"aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:i,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(p);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,h=(d.inputClassName,o(d,["inputClassName"]));return l["default"].createElement("div",s({},h,{role:"combobox","aria-expanded":u,"aria-owns":u?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:i,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?l["default"].createElement(f["default"],s({},p,{minWidth:"5"})):l["default"].createElement("div",{className:i},l["default"].createElement("input",p))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return l["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,n=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return l["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},n)},filterOptions:function N(e){var t=this.state.inputValue,n=this.props.options||[];if(this.props.filterOptions){var N="function"==typeof this.props.filterOptions?this.props.filterOptions:_["default"];return N(n,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return n},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,n){return e&&e.length?this.props.menuRenderer({focusedOption:n,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?l["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var n=e.map(function(e){return i(e[t.props.valueKey])}).join(this.props.delimiter);return l["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:n,disabled:this.props.disabled})}return e.map(function(e,n){return l["default"].createElement("input",{key:"hidden."+n,type:"hidden",ref:"value"+n,name:t.props.name,value:i(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var n=this.state.focusedOption||e;if(n&&!n.disabled){var r=t.indexOf(n);if(r!==-1)return r}for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c)!function(){var e={startTime:(new Date).getTime(),appliedQuery:u},a=o.appbaseRef[t];if(a){var l=u;l.type="*"===o.type[t]?"":o.type[t],l.preference=o.app[t],n(e),a.search(l).on("data",function(n){e.mode="historic",e.data=o.highlightModify(n,e.appliedQuery),i.emitter.emit(t,e);var r=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:e,react:s.react,queryOptions:r})}).on("error",function(n){var r={appliedQuery:e.appliedQuery,error:n,startTime:e.startTime};i.emitter.emit(t,r)}),s.stream&&r.call(o,t,u,a)}else console.error("appbaseRef is not set for "+t)}();else{var d={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,d)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t){"use strict";function n(e,t){for(var n=[],r={object:null,string:""},o=Object.keys(t),a=o,i=Array.isArray(a),s=0,a=i?a:a[Symbol.iterator]();;){var u;if(i){if(s>=a.length)break;u=a[s++]}else{if(s=a.next(),s.done)break;u=s.value}var l=u,c=t[l];typeof e[l]===c&&e[l]!==r[c]||n.push(l)}for(var p="",d=0;d0)||new Error("fields missing: "+p)}e.exports={validate:n}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],i(n))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:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,u=0;u0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n), o||(o=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var o=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,o,i,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=i;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.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(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a];s?this[a]=s(n):"target"===a?this.target=r:this[a]=n[a]}var u=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;return u?this.isDefaultPrevented=i.thatReturnsTrue:this.isDefaultPrevented=i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse,this}var o=n(9),a=n(47),i=n(25),s=(n(5),"function"==typeof Proxy,["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),u={type:null,target:null,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};o(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=i.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=i.thatReturnsTrue)},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n-1)return!1;if(r.filterOption)return r.filterOption.call(o,e,t);if(!t)return!0;var a=String(e[r.valueKey]),s=String(e[r.labelKey]);return r.ignoreAccents&&("label"!==r.matchProp&&(a=(0,i["default"])(a)),"value"!==r.matchProp&&(s=(0,i["default"])(s))),r.ignoreCase&&("label"!==r.matchProp&&(a=a.toLowerCase()),"value"!==r.matchProp&&(s=s.toLowerCase())),"start"===r.matchPos?"label"!==r.matchProp&&a.substr(0,t.length)===t||"value"!==r.matchProp&&s.substr(0,t.length)===t:"label"!==r.matchProp&&a.indexOf(t)>=0||"value"!==r.matchProp&&s.indexOf(t)>=0})}var a=n(350),i=r(a);e.exports=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.focusedOption,n=e.instancePrefix,r=(e.labelKey,e.onFocus),o=e.onSelect,a=e.optionClassName,s=e.optionComponent,l=e.optionRenderer,c=e.options,p=e.valueArray,d=e.valueKey,f=e.onOptionRef,h=s;return c.map(function(e,s){var c=p&&p.indexOf(e)>-1,m=e===t,y=(0,i["default"])(a,{"Select-option":!0,"is-selected":c,"is-focused":m,"is-disabled":e.disabled});return u["default"].createElement(h,{className:y,instancePrefix:n,isDisabled:e.disabled,isFocused:m,isSelected:c,key:"option-"+s+"-"+e[d],onFocus:r,onSelect:o,option:e,optionIndex:s,ref:function(e){f(e,m)}},l(e,s))})}var a=n(3),i=r(a),s=n(2),u=r(s);e.exports=o},function(e,t){"use strict";var n=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];e.exports=function(e){for(var t=0;t0)if(t.ended&&!o){var i=new Error("stream.push() after EOF");e.emit("error",i)}else if(t.endEmitted&&o){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var l;!t.decoder||o||r||(n=t.decoder.write(n),l=!t.objectMode&&0===n.length),o||(t.reading=!1),l||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,o?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&d(e))),h(e,t)}else o||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length=B?e=B:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function l(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function c(e,t){var n=null;return j.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function p(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,d(e)}}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(N("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?O(f,e):f(e))}function f(e){N("emit readable"),e.emit("readable"),b(e)}function h(e,t){t.readingMore||(t.readingMore=!0,O(m,e,t))}function m(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=M(e,t.buffer,t.decoder),n}function M(e,t,n){var r;return ea.length?a.length:e;if(o+=i===a.length?a:a.slice(0,e),e-=i,0===e){i===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(i));break}++r}return t.length-=r,o}function k(e,t){var n=Y.allocUnsafe(e),r=t.head,o=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,i=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,i),e-=i,0===e){i===a.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(i));break}++o}return t.length-=o,n}function S(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,O(P,t,e))}function P(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function L(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return N("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?S(this):d(this),null;if(e=l(e,t),0===e&&t.ended)return 0===t.length&&S(this),null;var r=t.needReadable;N("need readable",r),(0===t.length||t.length-e0?T(e,t):null,null===o?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&S(this)),null!==o&&this.emit("data",o),o},a.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},a.prototype.pipe=function(e,n){function o(e){N("onunpipe"),e===d&&i()}function a(){N("onend"),e.end()}function i(){N("cleanup"),e.removeListener("close",l),e.removeListener("finish",c),e.removeListener("drain",v),e.removeListener("error",u),e.removeListener("unpipe",o),d.removeListener("end",a),d.removeListener("end",i),d.removeListener("data",s),g=!0,!f.awaitDrain||e._writableState&&!e._writableState.needDrain||v()}function s(t){N("ondata"),_=!1;var n=e.write(t);!1!==n||_||((1===f.pipesCount&&f.pipes===e||f.pipesCount>1&&L(f.pipes,e)!==-1)&&!g&&(N("false write response, pause",d._readableState.awaitDrain),d._readableState.awaitDrain++,_=!0),d.pause())}function u(t){N("onerror",t),p(),e.removeListener("error",u),0===C(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",c),p()}function c(){N("onfinish"),e.removeListener("close",l),p()}function p(){N("unpipe"),d.unpipe(e)}var d=this,f=this._readableState;switch(f.pipesCount){case 0:f.pipes=e;break;case 1:f.pipes=[f.pipes,e];break;default:f.pipes.push(e)}f.pipesCount+=1,N("pipe count=%d opts=%j",f.pipesCount,n);var h=(!n||n.end!==!1)&&e!==t.stdout&&e!==t.stderr,m=h?a:i;f.endEmitted?O(m):d.once("end",m),e.on("unpipe",o);var v=y(d);e.on("drain",v);var g=!1,_=!1;return d.on("data",s),r(e,"error",u),e.once("close",l),e.once("finish",c),e.emit("pipe",d),f.flowing||(N("pipe resume"),d.resume()),e},a.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?r:S;s.WritableState=i;var L=n(14);L.inherits=n(11);var D={deprecate:n(745)},O=n(359),E=n(15).Buffer,C=n(78);L.inherits(s,O),i.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(i.prototype,"buffer",{get:D.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var x;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(x=Function.prototype[Symbol.hasInstance],Object.defineProperty(s,Symbol.hasInstance,{value:function(e){return!!x.call(this,e)||e&&e._writableState instanceof i}})):x=function(e){return e instanceof this},s.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},s.prototype.write=function(e,t,n){var r=this._writableState,a=!1,i=E.isBuffer(e);return"function"==typeof t&&(n=t,t=null),i?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=o),r.ended?u(this,n):(i||l(this,r,e,n))&&(r.pendingcb++,a=p(this,r,i,e,t,n)),a},s.prototype.cork=function(){var e=this._writableState;e.corked++},s.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||g(this,e))},s.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},s.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},s.prototype._writev=null,s.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)}}).call(t,n(7),n(141).setImmediate)},function(e,t,n){e.exports=n(36).EventEmitter},function(e,t,n){"use strict";function r(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function o(e){var t=r(e);if("string"!=typeof t&&(g.isEncoding===b||!b(e)))throw new Error("Unknown encoding: "+e);return t||e}function a(e){this.encoding=o(e);var t;switch(this.encoding){case"utf16le":this.text=d,this.end=f,t=4;break;case"utf8":this.fillLast=l,t=4;break;case"base64":this.text=h,this.end=m,t=3;break;default:return this.write=y,void(this.end=v)}this.lastNeed=0,this.lastTotal=0,this.lastChar=_.allocUnsafe(t)}function i(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:-1}function s(e,t,n){var r=t.length-1;if(r=0?(o>0&&(e.lastNeed=o-1),o):--r=0?(o>0&&(e.lastNeed=o-2),o):--r=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0))}function u(e,t,n){if(128!==(192&t[0]))return e.lastNeed=0,"�".repeat(n);if(e.lastNeed>1&&t.length>1){if(128!==(192&t[1]))return e.lastNeed=1,"�".repeat(n+1);if(e.lastNeed>2&&t.length>2&&128!==(192&t[2]))return e.lastNeed=2,"�".repeat(n+2)}}function l(e){var t=this.lastTotal-this.lastNeed,n=u(this,e,t);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�".repeat(this.lastTotal-this.lastNeed):t}function d(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function f(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function h(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function m(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function y(e){return e.toString(this.encoding)}function v(e){return e&&e.length?this.write(e):""}var g=n(15).Buffer,_=n(78),b=g.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n&&n.and?"string"==typeof n.and&&(n.and=[n.and]):n.and=[],n.and.push("streamChanges"),this.sortObj&&this.enableSort(n);var r=h["default"].create(this.context.appbaseRef,this.context.type,n,this.props.size,this.props.from,this.props.stream,this.context.app);if(this.channelId=r.channelId,this.channelListener=r.emitter.addListener(r.channelId,function(t){if(t.error&&t.startTime>e.queryStartTime&&(e.setState({queryStart:!1,showPlaceholder:!1}),e.props.onAllData)){var n=L.prepareResultData(t);e.props.onAllData(n.res,n.err)}if(t.appliedQuery)if("historic"===t.mode&&t.startTime>e.queryStartTime){var r=!(!t.appliedQuery||!t.data||t.data.error||t.data.hits&&t.data.hits.total),o={resultFound:!!(t.appliedQuery&&t.data&&!t.data.error&&t.data.hits&&t.data.hits.total)};t.appliedQuery&&t.data&&!t.data.error&&(o.total=t.data.hits.total,o.took=t.data.took),e.setState({queryStart:!1,visibleNoResults:r,resultStats:o,showPlaceholder:!1}),e.afterChannelResponse(t)}else"streaming"===t.mode&&(e.afterChannelResponse(t),e.updateResultStats(t.data));else e.setState({showPlaceholder:!0})}),this.listenLoadingChannel(r),t){var o={key:"streamChanges",value:""};L.selectedSensor.set(o,!0)}}},{key:"updateResultStats",value:function(e){var t=this.state.resultStats;t.total=L.updateStats(t.total,e),this.setState({resultStats:t})}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"afterChannelResponse",value:function(e){var t=this,n=e.data,r=void 0,o=void 0,a=[],i=[];if(this.streamFlag=!1,"streaming"===e.mode)this.channelMethod="streaming",a=n,a.stream=!0,i=this.state.currentData,this.streamFlag=!0,o=this.setMarkersData(r);else if("historic"===e.mode){this.queryStartTime=e.startTime,this.channelMethod="historic",a=n.hits&&n.hits.hits?n.hits.hits:[];var s=this.normalizeCurrentData(e,this.state.currentData,a);a=s.newData,i=s.currentData}this.setState({rawData:r,newData:a,currentData:i,markersData:o,isLoading:!1},function(){e.allMarkers=r;var n=JSON.parse(JSON.stringify(e));n.newData=t.state.newData,n.currentData=t.state.currentData,delete n.data,n=L.prepareResultData(n,e.data);var o=t.props.onAllData?t.props.onAllData(n.res,n.err):t.defaultonAllData(n.res,n.err);t.setState({resultMarkup:o,currentData:t.combineCurrentData(a)})})}},{key:"normalizeCurrentData",value:function(e,t,n){var r=JSON.parse(JSON.stringify(e.appliedQuery)),o=JSON.stringify(r)===JSON.stringify(this.appliedQuery)?t||[]:[];return o.length?n=n.filter(function(e){var t=!0;return o.forEach(function(n){e._id+"-"+e._type==n._id+"-"+n._type&&(t=!1)}),t}):this.appliedQuery=r,{currentData:o,newData:n}}},{key:"combineCurrentData",value:function(e){return P["default"].isArray(e)?this.state.currentData.concat(e):this.streamDataModify(this.state.currentData,e)}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.createChannel(e)}},{key:"removeChannel",value:function(){this.channelId&&(h["default"].stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"render",value:function(){var e=null,t=null,n=(0,d["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-stream-active":this.props.stream,"rbc-stream-inactive":!this.props.stream,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader,"rbc-resultstats-active":this.props.showResultStats,"rbc-resultstats-inactive":!this.props.showResultStats,"rbc-noresults-active":this.props.noResults,"rbc-noresults-inactive":!this.props.noResults});return this.props.title&&(e=c["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.props.placeholder&&(t=c["default"].createElement("div",{className:"rbc-placeholder col s12 col-xs-12"},this.props.placeholder)),c["default"].createElement("div",{className:"rbc-reactiveelement-container"},c["default"].createElement("div",{className:"rbc rbc-reactiveelement card thumbnail "+n,style:this.props.componentStyle},e,this.state.resultStats&&this.state.resultStats.resultFound&&this.props.showResultStats?c["default"].createElement(M["default"],{onResultStats:this.props.onResultStats,took:this.state.resultStats.took,total:this.state.resultStats.total}):null,this.state.resultMarkup,this.state.showPlaceholder?t:null),this.props.noResults&&this.state.visibleNoResults?c["default"].createElement(b["default"],{defaultText:this.props.noResults.text}):null,this.props.initialLoader&&this.state.queryStart?c["default"].createElement(g["default"],{defaultText:this.props.initialLoader.text}):null,c["default"].createElement(y["default"],{container:"rbc-reactiveelement-container"}))}}]),t}(l.Component);t["default"]=D,D.propTypes={componentId:c["default"].PropTypes.string,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),from:L.validation.resultListFrom,onAllData:c["default"].PropTypes.func,size:L.sizeValidation,stream:c["default"].PropTypes.bool,componentStyle:c["default"].PropTypes.object,initialLoader:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),noResults:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),showResultStats:c["default"].PropTypes.bool,onResultStats:c["default"].PropTypes.func,react:c["default"].PropTypes.object,placeholder:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element])},D.defaultProps={from:0,size:20,stream:!1,showResultStats:!0,componentStyle:{}},D.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired,app:c["default"].PropTypes.any.isRequired},D.types={componentId:k.STRING,title:k.STRING,react:k.OBJECT,from:k.NUMBER,size:k.NUMBER,onAllData:k.FUNCTION,stream:k.BOOLEAN,componentStyle:k.OBJECT,initialLoader:k.STRING,noResults:k.STRING,showResultStats:k.BOOLEAN,onResultStats:k.FUNCTION,placeholder:k.STRING}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nt.height(),i=n.get(0).scrollHeight>n.height();if(!a&&!i&&n.length&&!e.props.pagination){var s=o(t.find(".rbc-title"))+o(t.find(".rbc-pagination"))*t.find(".rbc-pagination").length,u=t.height()-60-s;u>0&&n.css({height:n.height()+15,"padding-bottom":20})}};t&&t.length&&n&&n.length&&(n.css({height:"auto","padding-bottom":0}),setTimeout(a.bind(this),1e3))}},{key:"removeChannel",value:function(){this.channelId&&(m["default"].stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"createChannel",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n&&n.and?"string"==typeof n.and&&(n.and=[n.and]):n.and=[],n.and.push("streamChanges"),this.props.pagination&&(n.and.push("paginationChanges"),n.pagination=null),this.sortObj&&this.enableSort(n);var r=m["default"].create(this.context.appbaseRef,this.context.type,n,this.props.size,this.props.from,this.props.stream,this.context.app);this.channelId=r.channelId,this.channelListener=r.emitter.addListener(r.channelId,function(t){if(t.error&&t.startTime>e.queryStartTime&&(e.setState({queryStart:!1,showPlaceholder:!1}),e.props.onAllData)){var n=x.prepareResultData(t);e.props.onAllData(n.res,n.err)}if(t.appliedQuery)if("historic"===t.mode&&t.startTime>e.queryStartTime){var r=!(!(t.appliedQuery&&Object.keys(t.appliedQuery).length&&t.data)||t.data.error||t.data.hits&&t.data.hits.total),o={resultFound:!!(t.appliedQuery&&t.data&&!t.data.error&&t.data.hits&&t.data.hits.total)};t.appliedQuery&&t.data&&!t.data.error&&(o.total=t.data.hits.total,o.took=t.data.took),e.setState({queryStart:!1,visibleNoResults:r,resultStats:o,showPlaceholder:!1}),e.afterChannelResponse(t)}else"streaming"===t.mode&&(e.afterChannelResponse(t),e.updateResultStats(t.data));else e.setState({showPlaceholder:!0})}),this.listenLoadingChannel(r),t&&setTimeout(function(){var e={key:"streamChanges",value:""};x.selectedSensor.set(e,!0)},100)}},{key:"updateResultStats",value:function(e){var t=this.state.resultStats;t.total=x.updateStats(t.total,e),this.setState({resultStats:t})}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){if(e.appliedQuery){var n=!(t.state.requestOnScroll&&e.appliedQuery.body&&e.appliedQuery.body.from);t.setState({queryStart:e.queryState,showInitialLoader:n})}})}},{key:"afterChannelResponse",value:function(e){var t=this,n=e.data,r=void 0,o=void 0,a=[],i=[];if(this.streamFlag=!1,"streaming"===e.mode)this.channelMethod="streaming",a=n,a.stream=!0,i=this.state.currentData,this.streamFlag=!0,o=this.setMarkersData(r);else if("historic"===e.mode){this.queryStartTime=e.startTime,this.channelMethod="historic",a=n.hits&&n.hits.hits?n.hits.hits:[];var s=this.normalizeCurrentData(e,this.state.currentData,a);a=s.newData,i=s.currentData}this.setState({rawData:r,newData:a,currentData:i,markersData:o,isLoading:!1},function(){e.allMarkers=r;var o=JSON.parse(JSON.stringify(e));o.newData=t.state.newData,o.currentData=t.state.currentData,delete o.data,o=x.prepareResultData(o,n);var i=t.props.onAllData?t.props.onAllData(o.res,o.err):t.defaultonAllData(o.res,o.err);t.setState({resultMarkup:t.wrapMarkup(i),currentData:t.combineCurrentData(a)})})}},{key:"wrapMarkup",value:function(e){var t=null;return t=C["default"].isArray(e)?e.map(function(e,t){return p["default"].createElement("div",{key:t,className:"rbc-list-item"},e)}):e}},{key:"normalizeCurrentData",value:function(e,t,n){var r=JSON.parse(JSON.stringify(e.appliedQuery));this.state.requestOnScroll&&r&&r.body&&(delete r.body.from,delete r.body.size);var o=JSON.stringify(r)===JSON.stringify(this.appliedQuery),a=o?t||[]:[];return a.length?n=n.filter(function(e){var t=!0;return a.forEach(function(n){e._id+"-"+e._type==n._id+"-"+n._type&&(t=!1)}),t}):this.appliedQuery=r,o||j(".rbc.rbc-reactivelist").animate({scrollTop:0},100),{currentData:a,newData:n}}},{key:"combineCurrentData",value:function(e){return C["default"].isArray(e)?(e=e.map(function(e){return e.stream=!1,e}),this.state.currentData.concat(e)):this.streamDataModify(this.state.currentData,e,!1)}},{key:"enableSort",value:function(e){e.and.push(this.resultSortKey);var t={key:this.resultSortKey,value:this.sortObj};x.selectedSensor.setSortInfo(t)}},{key:"appendData",value:function(e){var t=this.state.rawData,n=t.hits.hits.concat(e.hits.hits);return t.hits.hits=C["default"].uniqBy(n,"_id"),t}},{key:"streamDataModify",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(t)if(t.stream=n,t.streamStart=new Date,t._deleted){var r=e.filter(function(e){return e._id!==t._id});e=r}else{var o=e.filter(function(e){return e._id!==t._id});e=o,e.unshift(t)}return e}},{key:"setMarkersData",value:function(e){return e?e:[]}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.createChannel(e),this.state.requestOnScroll?this.listComponent():this.setQueryForPagination()}},{key:"setQueryForPagination",value:function(){var e={queryType:"match",inputData:this.props.appbaseField,customQuery:function(){return null}},t={key:"paginationChanges",value:e};x.selectedSensor.setSensorInfo(t)}},{key:"executePaginationUpdate",value:function(){setTimeout(function(){var e={key:"paginationChanges",value:Math.random()};x.selectedSensor.set(e,!0)},100)}},{key:"paginationAt",value:function(e){var t=void 0;return!this.props.pagination||this.props.paginationAt!==e&&"both"!==this.props.paginationAt||(t=p["default"].createElement("div",{className:"rbc-pagination-container col s12 col-xs-12"},p["default"].createElement(L["default"],{className:"rbc-pagination-"+e,componentId:"pagination",onPageChange:this.props.onPageChange,title:this.props.paginationTitle}))),t}},{key:"defaultonAllData",value:function(e){var t=this,n=null;if(e){var r=e.currentData;"historic"===e.mode?r=e.currentData.concat(e.newData):"streaming"===e.mode&&(r=x.combineStreamData(e.currentData,e.newData)),r&&(n=r.map(function(e){var n=e._source;return t.props.onData?t.props.onData(e):p["default"].createElement("div",{className:"row",style:{marginTop:"20px"}},t.itemMarkup(n,e))}))}return n}},{key:"itemMarkup",value:function(e,t){return p["default"].createElement("div",{key:t._id,style:{padding:"12px",fontSize:"12px"},className:"makerInfo"},p["default"].createElement(v["default"],{data:e}))}},{key:"nextPage",value:function(){function e(){this.setState({isLoading:!0}),m["default"].nextPage(this.channelId)}this.state.resultStats.total>this.state.currentData.length&&!this.state.queryStart&&e.call(this)}},{key:"listComponent",value:function(){function e(e){var t=this;e&&e.addEventListener("scroll",function(){t.state.requestOnScroll&&j(e).scrollTop()+j(e).innerHeight()>=e.scrollHeight&&t.state.resultStats.total>t.state.currentData.length&&!t.state.queryStart&&t.nextPage()})}e.call(this,this.listParentElement),e.call(this,this.listChildElement)}},{key:"handleSortSelect",value:function(e){var t=e.target.value;this.sortObj=a({},this.props.sortOptions[t].appbaseField,{order:this.props.sortOptions[t].sortBy});var n={key:this.resultSortKey,value:this.sortObj};x.selectedSensor.set(n,!0,"sortChange")}},{key:"render",value:function(){var e=this,t=null,n=null,r=null,o=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-sort-active":this.props.sortOptions,"rbc-sort-inactive":!this.props.sortOptions,"rbc-stream-active":this.props.stream,"rbc-stream-inactive":!this.props.stream,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader,"rbc-resultstats-active":this.props.showResultStats,"rbc-resultstats-inactive":!this.props.showResultStats,"rbc-noresults-active":this.props.noResults,"rbc-noresults-inactive":!this.props.noResults,"rbc-pagination-active":this.props.pagination,"rbc-pagination-inactive":!this.props.pagination});if(this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.props.placeholder&&(n=p["default"].createElement("div",{className:"rbc-placeholder col s12 col-xs-12"},this.props.placeholder)),this.props.sortOptions){var a=this.props.sortOptions.map(function(e,t){return p["default"].createElement("option",{value:t,key:e.label},e.label)});r=p["default"].createElement("div",{className:"rbc-sortoptions input-field col"},p["default"].createElement("select",{className:"browser-default form-control",onChange:this.handleSortSelect},a))}return p["default"].createElement("div",{ className:"rbc-reactivelist-container"},p["default"].createElement("div",{ref:function(t){e.listParentElement=t},className:"rbc rbc-reactivelist card thumbnail "+o,style:this.props.componentStyle},t,r,this.props.showResultStats&&this.state.resultStats.resultFound?p["default"].createElement(S["default"],{onResultStats:this.props.onResultStats,took:this.state.resultStats.took,total:this.state.resultStats.total}):null,this.paginationAt("top"),p["default"].createElement("div",{ref:function(t){e.listChildElement=t},className:"rbc-reactivelist-scroll-container col s12 col-xs-12"},this.state.resultMarkup),this.state.isLoading?p["default"].createElement("div",{className:"rbc-loader"}):null,this.state.showPlaceholder?n:null,this.paginationAt("bottom")),this.props.noResults&&this.state.visibleNoResults?p["default"].createElement(w["default"],{defaultText:this.props.noResults}):null,this.props.initialLoader&&this.state.queryStart&&this.state.showInitialLoader?p["default"].createElement(T["default"],{defaultText:this.props.initialLoader}):null,p["default"].createElement(_["default"],{container:"rbc-reactivelist-container"}))}}]),t}(c.Component);t["default"]=Y,Y.propTypes={componentId:p["default"].PropTypes.string,appbaseField:p["default"].PropTypes.string,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),sortBy:p["default"].PropTypes.oneOf(["asc","desc","default"]),sortOptions:p["default"].PropTypes.arrayOf(p["default"].PropTypes.shape({label:p["default"].PropTypes.string,appbaseField:p["default"].PropTypes.string,sortBy:p["default"].PropTypes.string})),from:x.validation.resultListFrom,onAllData:p["default"].PropTypes.func,size:x.sizeValidation,stream:p["default"].PropTypes.bool,componentStyle:p["default"].PropTypes.object,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),noResults:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),showResultStats:p["default"].PropTypes.bool,onResultStats:p["default"].PropTypes.func,placeholder:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,paginationAt:p["default"].PropTypes.string,pagination:p["default"].PropTypes.bool},Y.defaultProps={from:0,size:20,stream:!1,componentStyle:{},showResultStats:!0,pagination:!1,paginationAt:"bottom"},Y.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired,app:p["default"].PropTypes.any.isRequired},Y.types={componentId:O.STRING,appbaseField:O.STRING,title:O.STRING,react:O.OBJECT,sortBy:O.STRING,sortOptions:O.OBJECT,from:O.NUMBER,onAllData:O.FUNCTION,onData:O.FUNCTION,size:O.NUMBER,stream:O.BOOLEAN,componentStyle:O.OBJECT,initialLoader:O.STRING,noResults:O.FUNCTION,showResultStats:O.BOOLEAN,onResultStats:O.FUNCTION,placeholder:O.STRING,pagination:O.BOOLEAN,paginationAt:O.STRING}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Bar=t.HistoGramComponent=void 0;var s=function(){function e(e,t){for(var n=0;n-1;t?this.setDefaultSelectAll():this.setState({selectedItems:this.props.defaultSelected,defaultSelectall:this.props.defaultSelectall},function(){e.updateAction.bind(e),e.props.onSelect(e.state.selectedItems)})}},{key:"setDefaultSelectAll",value:function(){this.props.items&&this.props.items.length?setTimeout(this.handleListClickAll.bind(this,this.props.selectAllLabel,!0),1e3):setTimeout(this.setDefaultSelectAll.bind(this),1e3)}},{key:"componentDidUpdate",value:function(){var e=this,t=null,n=!0;this.state.selectedItems&&(t=JSON.parse(JSON.stringify(this.state.selectedItems))),t&&t.length&&this.props.items&&this.props.items.length&&(t=t.filter(function(t){var n=e.props.items.filter(function(e){return e.key===t});return!!n.length}),t.length!==this.state.selectedItems.length&&(n=!t.length,this.props.onRemove(this.state.selectedItems,n),this.updateSelectedItems(t),t.length&&this.props.onSelect(t)))}},{key:"handleListClick",value:function(e,t){var n=void 0;t?(this.props.onRemove(this.state.selectedItems,!1),n=this.state.selectedItems,n.push(e),this.setState({selectedItems:n},this.updateAction.bind(this)),this.state.selectedItems.length&&this.props.onSelect(this.state.selectedItems)):this.handleTagClick(e)}},{key:"handleTagClick",value:function(e){var t=1===this.state.selectedItems.length;this.props.onRemove(this.state.selectedItems,t);var n=e.toString().replace(/ /g,"_"),r="ref"+n,o=this.refStore[r];o.state.status=!1;var a=this.state.selectedItems,i=a.indexOf(e);a.splice(i,1),this.setState({selectedItems:a},this.updateAction.bind(this)),this.props.onSelect(a)}},{key:"clearAll",value:function(){this.handleListClickAll(this.props.selectAllLabel,!1)}},{key:"getSelectedItems",value:function(){var e=[];return this.props.items.forEach(function(t){t.status&&e.indexOf(t.key)<0&&e.push(t.key)}),e}},{key:"handleListClickAll",value:function(e,t){var n=this;this.props.selectAll(t);var r=this.props.items.map(function(e){return e.key});r=t?r:[],this.setState({defaultSelectall:t,selectedItems:r},function(){n.updateAction.bind(n),n.props.onSelect(n.state.selectedItems,r)})}},{key:"updateSelectedItems",value:function(e){this.setState({selectedItems:e})}},{key:"updateAction",value:function(){this.state.selectedItems.length||this.props.onSelect(null)}},{key:"render",value:function(){var e=this,t=this.props.items,n=this.getSelectedItems(),r=[],o=[];return t.forEach(function(t,n){try{t.keyRef=t.key.replace(/ /g,"_")}catch(o){t.keyRef=n}var a=!("visible"in t&&!t.visible);r.push(l["default"].createElement(p["default"],{key:t.keyRef,value:t.key,doc_count:t.doc_count,countField:e.props.showCount,handleClick:e.handleListClick,visible:a,showCheckbox:e.props.showCheckbox,status:t.status||!1,ref:function(n){var r="ref"+t.keyRef;e.refStore[r]=n}}))}),this.props.selectAllLabel&&t&&t.length&&r.unshift(l["default"].createElement(p["default"],{key:"selectall",value:this.props.selectAllLabel,countField:!1,visible:!0,showCheckbox:this.props.showCheckbox,handleClick:this.handleListClickAll,status:this.props.selectAllValue,ref:function(t){e.refStore.refselectall=t}})),this.props.showTags&&n&&(n.length<=5?n.forEach(function(t){o.push(l["default"].createElement(f["default"],{key:t,value:t,onClick:e.handleTagClick}))}):o.unshift(l["default"].createElement(f["default"],{key:"Clear All",value:"Clear All",onClick:this.clearAll}))),l["default"].createElement("div",{className:"rbc-list-container col s12 col-xs-12"},o.length?l["default"].createElement("div",{className:"row rbc-tag-container"},o):null,l["default"].createElement("div",{className:"row"},r))}}]),t}(u.Component);t["default"]=h,h.propTypes={defaultSelected:l["default"].PropTypes.array,items:l["default"].PropTypes.array,onRemove:l["default"].PropTypes.func,onSelect:l["default"].PropTypes.func,selectAll:l["default"].PropTypes.func,selectAllLabel:l["default"].PropTypes.string,selectAllValue:l["default"].PropTypes.bool,showCount:l["default"].PropTypes.bool,showTags:l["default"].PropTypes.bool,defaultSelectall:l["default"].PropTypes.bool},h.defaultProps={showTags:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n-1){var n=t.channelResponse&&t.channelResponse.data&&t.channelResponse.data.hits?t.channelResponse.data.hits.total:0,r=Math.ceil(n/t.queryOptions.size)<1?1:Math.ceil(n/t.queryOptions.size),o=t.queryOptions.size?t.queryOptions.size:20,a=Math.round(t.queryOptions.from/o)+1;e.setState({totalHits:n,size:o,maxPageNumber:r,currentValue:a})}})}},{key:"handleChange",value:function(e){this.setState({currentValue:e});var t={key:this.props.componentId,value:e},n=!0;h.selectedSensor.set(t,n,"paginationChange"),this.props.onPageChange&&this.props.onPageChange(e)}},{key:"firstPage",value:function(){1!==this.state.currentValue&&this.handleChange.call(this,1)}},{key:"lastPage",value:function(){this.state.currentValue!==this.state.maxPageNumber&&this.handleChange.call(this,this.state.maxPageNumber)}},{key:"prePage",value:function(){var e=this.state.currentValue>1?this.state.currentValue-1:1;this.state.currentValue!==e&&this.handleChange.call(this,e)}},{key:"nextPage",value:function(){var e=this.state.currentValue0;r--)if(r%5===0||1===r){t=r;break}for(var o=function(t){var r=l["default"].createElement("li",{key:t,className:"rbc-page-number "+(e.state.currentValue===t?"active rbc-pagination-active":"waves-effect")},l["default"].createElement("a",{onClick:function(){return e.handleChange(t)}},t));t<=e.state.maxPageNumber&&n.push(r)},a=t;a<=t+5;a++)o(a);return l["default"].createElement("ul",{className:"pagination"},l["default"].createElement("li",{className:1===this.state.currentValue?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.firstPage},l["default"].createElement("i",{className:"fa fa-angle-double-left"}))),l["default"].createElement("li",{className:1===this.state.currentValue?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.prePage},l["default"].createElement("i",{className:"fa fa-angle-left"}))),n,l["default"].createElement("li",{className:this.state.currentValue===this.state.maxPageNumber?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-next",onClick:this.nextPage},l["default"].createElement("i",{className:"fa fa-angle-right"}))),l["default"].createElement("li",{className:this.state.currentValue===this.state.maxPageNumber?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.lastPage},l["default"].createElement("i",{className:"fa fa-angle-double-right"}))))}},{key:"render",value:function(){var e=null;this.props.title&&(e=l["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,p["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return l["default"].createElement("div",{className:"rbc rbc-pagination col s12 col-xs-12 "+t+" "+this.props.className},e,l["default"].createElement("div",{className:"col s12 col-xs-12"},this.renderPageNumber()))}}]),t}(u.Component);t["default"]=m,m.propTypes={componentId:l["default"].PropTypes.string.isRequired,title:l["default"].PropTypes.string,onPageChange:l["default"].PropTypes.func},m.defaultProps={},m.contextTypes={appbaseRef:l["default"].PropTypes.any.isRequired,type:l["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.StaticSearch=void 0;var s=function(){function e(e,t){for(var n=0;n-1)d=d||{},d=Object.assign(d,t[e]);else{r[e]=i(e);var o=a(e);o&&(d=d||{},d=Object.assign(d,o))}var u=n(e);!u||"aggSort"in u||p.push(u)}),r}function l(t){var n=o.serializeDepends.createQuery(e.serializeDepends,t);return n&&n.body?(p&&p.length&&(n.body.sort=p),d&&Object.keys(d).length&&Object.keys(d).forEach(function(e){n.body[e]=d[e]})):n={},n}function c(){var e=u(),t=l(e);return t}var p=[],d=null;return c()}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.params.get(e);if(n&&r)try{r=JSON.parse(r)}catch(o){console.log(o)}return t?r&&r.trim()?r.split(","):null:r}},{key:"update",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&(this.setOrDelete(e,t),this.applyURLUpdate())}},{key:"setOrDelete",value:function(e,t){e&&(null===t||void 0===t?this.params["delete"](e):this.params.set(e,t)); -}},{key:"applyURLUpdate",value:function(){if(history.pushState&&this.params.toString()){var e=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+this.params.toString();window.history.pushState({path:e},"",e)}}}]),e}();t.URLParams=new u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(49);t.ResponsiveStory=function(){var e=function(e){return e.height()?e.height():0},t=function(){var t=r(window).height(),n=t-15;r(".rbc.rbc-reactivelist, .rbc.rbc-reactiveelement").css({maxHeight:n});var o=[r(".rbc.rbc-singlelist"),r(".rbc.rbc-multilist"),r(".rbc.rbc-nestedlist"),r(".rbc.rbc-tagcloud")];o.forEach(function(n){if(n.length){var r=e(n.find(".rbc-title"))+e(n.find(".rbc-search-container"));n.find(".rbc-list-container").css({maxHeight:t-r-35})}}),r(".rbc-base > .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(e[t]<1||e[t]>1e3)&&(n=new Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=new Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]<=0&&(n=new Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=new Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start<=0&&(r=new Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return!isNaN(e[t])&&r>=e.defaultSelected&&o<=e.defaultSelected||(n=new Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return e[t]<0&&(n=new Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=new Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n'],post_tags:[""],fields:e}}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.defaultSearchQuery}};this.props.highlight&&(e.value.externalQuery=this.highlightQuery()),w.selectedSensor.setSensorInfo(e);var t={key:this.searchInputId,value:{queryType:"multi_match",inputData:this.props.appbaseField,customQuery:this.defaultSearchQuery}};w.selectedSensor.setSensorInfo(t)}},{key:"setValue",value:function(e){var t={key:this.searchInputId,value:e};w.URLParams.update(this.props.componentId,e,this.props.URLParams),w.selectedSensor.set(t,!0),e&&""!==e.trim()?this.setState({options:[{label:e,value:e}],isLoadingOptions:!0,currentValue:e}):this.setState({options:[],isLoadingOptions:!1,currentValue:e})}},{key:"getValue",value:function(e,t){var n=void(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0);if(M["default"].has(t,e))n=t[e];else if(e.indexOf(".")>-1){var r="",o=e.split(".");o.forEach(function(e,a){r+=e,M["default"].isArray(M["default"].get(t,r))&&(r+="["+a+"]"),o.length-1!==a?r+=".":n=M["default"].get(t,r)})}return n}},{key:"setData",value:function(e){var t=this,n=[];M["default"].isArray(this.props.appbaseField)?this.props.appbaseField:[this.props.appbaseField],e.hits.hits.map(function(e){if("string"===t.fieldType){var r=t.getValue(t.props.appbaseField.trim(),e._source);n.push({value:r,label:r})}else"object"===t.fieldType&&t.props.appbaseField.map(function(r){var o=t.getValue(r,e._source);o&&n.push({value:o,label:o})})}),this.state.currentValue&&""!==this.state.currentValue.trim()&&n.unshift({label:this.state.currentValue,value:this.state.currentValue}),n=this.removeDuplicates(n,"label"),this.setState({options:n,isLoadingOptions:!1})}},{key:"defaultSearchQuery",value:function(e){var t=null,n=void 0;return e&&(n="string"===this.fieldType?[this.props.appbaseField]:this.props.appbaseField,t={bool:{should:[{multi_match:{query:e,fields:n,type:"phrase_prefix"}},{multi_match:{query:e,fields:n}}],minimum_should_match:"1"}}),t}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.searchInputId);var n=g["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({rawData:r}),e.props.autocomplete&&e.setData(r)})}},{key:"checkDefault",value:function(){this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultValue&&this.defaultSelected!=this.defaultValue&&(this.defaultSelected=this.defaultValue,setTimeout(this.setValue.bind(this,this.defaultSelected),100),this.handleSearch({value:this.defaultSelected}))}},{key:"handleSearch",value:function(e){var t=e?e.value:null;t="null"===t?null:t;var n={key:this.props.componentId,value:t};w.selectedSensor.set(n,!0),this.setState({currentValue:t})}},{key:"handleInputChange",value:function(e){var t=e.target.value;this.setState({currentValue:t});var n={key:this.props.componentId,value:t};this.props.onValueChange&&this.props.onValueChange(n.value);var r=!0;w.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=d["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,y["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-autocomplete-active":this.props.autocomplete,"rbc-autocomplete-inactive":!this.props.autocomplete});return d["default"].createElement("div",{className:"rbc rbc-datasearch col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},e,this.props.autocomplete?d["default"].createElement(h["default"],u({isLoading:this.state.isLoadingOptions,value:this.state.currentValue,options:this.state.options,onInputChange:this.setValue,onChange:this.handleSearch,onBlurResetsInput:!1},this.props)):d["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},d["default"].createElement("input",{type:"text",className:"rbc-input",placeholder:this.props.placeholder,value:this.state.currentValue?this.state.currentValue:"",onChange:this.handleInputChange}),d["default"].createElement("span",{className:"rbc-search-icon"})))}}]),t}(p.Component);t["default"]=k,k.propTypes={componentId:d["default"].PropTypes.string.isRequired,appbaseField:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),title:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.element]),placeholder:d["default"].PropTypes.string,autocomplete:d["default"].PropTypes.bool,defaultSelected:d["default"].PropTypes.string,customQuery:d["default"].PropTypes.func,onValueChange:d["default"].PropTypes.func,react:d["default"].PropTypes.object,componentStyle:d["default"].PropTypes.object,highlight:d["default"].PropTypes.bool,highlightFields:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),URLParams:d["default"].PropTypes.bool},k.defaultProps={placeholder:"Search",autocomplete:!0,componentStyle:{},highlight:!1,URLParams:!1},k.contextTypes={appbaseRef:d["default"].PropTypes.any.isRequired,type:d["default"].PropTypes.any.isRequired},k.types={componentId:b.STRING,appbaseField:b.STRING,appbaseFieldType:b.STRING,react:b.OBJECT,title:b.STRING,placeholder:b.STRING,autocomplete:b.BOOLEAN,defaultSelected:b.STRING,customQuery:b.FUNCTION,componentStyle:b.OBJECT,highlight:b.BOOLEAN,URLParams:b.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&setTimeout(this.handleChange.bind(this,t),1e3)}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!_["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t;var n=e.state.data.filter(function(t){ -return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&(null!==e.urlParams?e.handleChange(n):setTimeout(e.handleChange.bind(e,n),1e3))}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};b.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){if(e.length>0)return e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}})}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}}},{key:"handleChange",value:function(e){var t=[];t=e.map(function(e){return e.label}),t=t.join(),this.setState({selected:t});var n={key:this.props.componentId,value:e},r=!0;this.props.onValueChange&&this.props.onValueChange(n.value),b.URLParams.update(this.props.componentId,t,this.props.URLParams),b.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return p["default"].createElement("div",{className:"rbc rbc-multidropdownrange col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"col s12 col-xs-12"},p["default"].createElement(f["default"],{options:this.state.data,value:this.state.selected,onChange:this.handleChange,clearable:!1,multi:!0,placeholder:this.props.placeholder,searchable:!0}))))}}]),t}(c.Component);t["default"]=T,T.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),placeholder:p["default"].PropTypes.string,data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},T.defaultProps={URLParams:!1},T.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},T.types={componentId:v.STRING,appbaseField:v.STRING,appbaseFieldType:v.NUMBER,data:v.OBJECT,defaultSelected:v.ARRAY,title:v.STRING,placeholder:v.STRING,customQuery:v.FUNCTION,componentStyle:v.OBJECT,URLParams:v.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&(null!==this.urlParams?this.handleChange(t):setTimeout(this.handleChange.bind(this,t),1e3))}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!v["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t,e.resetState();var n=e.props.data.filter(function(e){return t.indexOf(e.label)>-1});n&&n.length&&setTimeout(e.handleChange.bind(e,n),1e3)}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.length>0?e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}}):null}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}return null}},{key:"handleChange",value:function(e){function t(e,t,o){o.label===e.label&&(r=t,n.splice(t,1))}var n=this.state.selected,r=null,o=e;v["default"].isArray(e)||(o=[e]),o.forEach(function(e){n.forEach(function(n,r){t(n,r,e)})}),null===r&&o.forEach(function(e){n.push(e)}),this.setState({selected:n});var a={key:this.props.componentId,value:n},i=!0;this.props.onValueChange&&this.props.onValueChange(a.value),g.URLParams.update(this.props.componentId,this.getSelectedLabels(n),this.props.URLParams),g.selectedSensor.set(a,i)}},{key:"getSelectedLabels",value:function(e){return e.map(function(e){return e.label})}},{key:"resetState",value:function(){this.setState({selected:[]});var e={key:this.props.componentId,value:[]},t=!0;g.URLParams.update(this.props.componentId,null,this.props.URLParams),g.selectedSensor.set(e,t)}},{key:"handleTagClick",value:function(e){var t=this.state.selected.filter(function(t){return t.label===e});this.handleChange(t[0])}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t){return p["default"].createElement("div",{className:"rbc-list-item row",key:t.label,onClick:function(){return e.handleChange(t)}},p["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:n.indexOf(t.label)>-1,value:t.label}),p["default"].createElement("label",{className:"rbc-label"},t.label))})),t}},{key:"render",value:function(){var e=this,t=null,n=[];this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.selected&&this.state.selected.forEach(function(t){n.push(p["default"].createElement(b,{key:t.label,value:t.label,onClick:e.handleTagClick}))});var r=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return p["default"].createElement("div",{className:"rbc rbc-multirange col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},t,p["default"].createElement("div",{className:"col s12 col-xs-12 rbc-list-container"},n.length?p["default"].createElement("div",{className:"row",style:{marginTop:"0"}},n):null,this.renderButtons())))}}]),t}(c.Component);t["default"]=_;var b=function(e){return p["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},p["default"].createElement("a",{className:"close"},"×"),p["default"].createElement("span",null,e.value))};b.propTypes={onClick:p["default"].PropTypes.func.isRequired,value:p["default"].PropTypes.string.isRequired},_.propTypes={appbaseField:p["default"].PropTypes.string.isRequired,componentId:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nr;return p["default"].createElement("div",{className:"rbc-numberbox-container col s12 col-xs-12"},p["default"].createElement("div",{className:"rbc-label"},t),p["default"].createElement("div",{className:"rbc-numberbox-btn-container"},p["default"].createElement(g,{isActive:s,handleChange:o,type:"minus"}),p["default"].createElement("span",{className:"rbc-numberbox-number"},a),p["default"].createElement(g,{isActive:i,handleChange:o,type:"plus"})))},b=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),o=r.props.focused;r.urlParams=y.URLParams.get(r.props.componentId);var a=null!==r.urlParams?r.urlParams:r.props.defaultSelected;return r.state={currentValue:a?a:r.props.data.start,focused:o},r.type="term",r.handleChange=r.handleChange.bind(r),r.customQuery=r.customQuery.bind(r),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.setQueryInfo(),null!==this.urlParams?this.updateQuery(this.urlParams):setTimeout(this.handleChange.bind(this),1e3)}},{key:"componentWillReceiveProps",value:function(e){var t=this;setTimeout(function(){var n=null!==t.urlParams?t.urlParams:t.props.defaultSelected;!n&&0!==n||n===t.state.currentValue||t.setState({currentValue:n}),e.queryFormat!==t.queryFormat&&(t.queryFormat=e.queryFormat,t.updateQuery())},300)}},{key:"customQuery",value:function(e){var t=null;if(e&&(e.value||0===e.value)){var n=e.value;switch(this.props.queryFormat){case"exact":t=this.exactQuery(n);break;case"lte":t=this.lteQuery(n);break;case"gte":default:t=this.gteQuery(n)}}return t}},{key:"exactQuery",value:function(e){return a({},this.type,a({},this.props.appbaseField,e))}},{key:"gteQuery",value:function(e){return{range:a({},this.props.appbaseField,{gte:e,boost:2})}}},{key:"lteQuery",value:function(e){return{range:a({},this.props.appbaseField,{lte:e,boost:2})}}},{key:"setQueryInfo",value:function(){var e=this.props,t=e.componentId,n=e.appbaseField,r={key:t,value:{queryType:this.type,inputData:n,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};y.selectedSensor.setSensorInfo(r)}},{key:"handleChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.props,n=(t.componentId,t.data),r=n.start,o=n.end,a=this.state.currentValue;r=void 0!=r?r:a-1,o=void 0!=o?o:a+1,e>0&&ar&&(a-=1),this.setState({currentValue:a},this.updateQuery.bind(this))}},{key:"updateQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.start.currentValue,t={key:this.props.componentId,value:{value:e,queryFormat:this.props.queryFormat}};this.props.onValueChange&&this.props.onValueChange(t.value),y.URLParams.update(this.props.componentId,e,this.props.URLParams),y.selectedSensor.set(t,!0)}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.data,r=e.labelPosition,o=this.state.currentValue,a=t?p["default"].createElement(v,{title:t}):null,i=(0,f["default"])({"rbc-title-active":t,"rbc-title-inactive":!t});return p["default"].createElement("div",{className:"rbc rbc-numberbox col s12 col-xs-12 card thumbnail "+i+" rbc-label-"+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},a,p["default"].createElement(_,{handleChange:this.handleChange,value:o,label:n.label,start:n.start,end:n.end})))}}]),t}(c.Component);t["default"]=b,b.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.shape({start:y.validateThreshold,end:y.validateThreshold,label:p["default"].PropTypes.string}),defaultSelected:y.valueValidation,labelPosition:p["default"].PropTypes.oneOf(["top","bottom","left","right"]),customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,queryFormat:p["default"].PropTypes.oneOf(["exact","gte","lte"]),URLParams:p["default"].PropTypes.bool},b.defaultProps={componentStyle:{},queryFormat:"gte",URLParams:!1},b.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},b.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.NUMBER,labelPosition:m.STRING,customQuery:m.FUNCTION,componentStyle:m.OBJECT,queryFormat:m.STRING,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=n.end){var r=(n.end-n.start)%e.stepValue;if(r){t.setState({values:{min:t.state.values.min,max:n.end-r}});var o={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-r}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(o.value),S.URLParams.update(t.props.componentId,t.setURLParam(o.value),t.props.URLParams),S.selectedSensor.set(o,!0)},1e3)}else{var a={};a.min=n.start,a.max=n.end,t.setState({values:a,currentValues:a});var i={key:t.props.componentId,value:{from:a.min,to:a.max}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(i.value),S.URLParams.update(t.props.componentId,t.setURLParam(i.value),t.props.URLParams),S.selectedSensor.set(i,!0)},1e3)}}if(e.range.start!==t.state.startThreshold||e.range.end!==t.state.endThreshold){if(e.range.start<=n.start&&e.range.end>=n.end)t.setState({startThreshold:e.range.start,endThreshold:e.range.end});else{var s={min:t.state.values.min,max:t.state.values.max};t.state.values.mine.range.end&&(s.max=e.range.end),t.setState({startThreshold:e.range.start,endThreshold:e.range.end,values:s});var u={from:s.min,to:s.max},l={key:t.props.componentId,value:u};t.props.onValueChange&&t.props.onValueChange(l.value),S.URLParams.update(t.props.componentId,t.setURLParam(l.value),t.props.URLParams),S.selectedSensor.set(l,!0)}t.setRangeValue()}if(e.stepValue!==t.props.stepValue){var c=(n.end-n.start)%e.stepValue;if(c){t.setState({values:{min:t.state.values.min,max:n.end-c}});var p={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-c}};t.props.onValueChange&&t.props.onValueChange(p.value),S.URLParams.update(t.props.componentId,t.setURLParam(p.value),t.props.URLParams),S.selectedSensor.set(p,!0)}}},300)}},{key:"shouldComponentUpdate",value:function(e,t){return e.stepValue<=0||e.stepValue>Math.floor((e.range.end-e.range.start)/2)?(console.error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."),!1):!(t.values.max>t.endThreshold)}},{key:"componentWillUnmount",value:function(){this.channelId&&v["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setURLParam",value:function(e){return"from"in e&&"to"in e&&(e={start:e.from,end:e.to}),JSON.stringify(e)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField}},t={key:this.props.componentId+"-internal",value:{queryType:"range",inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};S.selectedSensor.setSensorInfo(e),S.selectedSensor.setSensorInfo(t),this.setRangeValue()}},{key:"setRangeValue",value:function(){var e={key:this.props.componentId+"-internal",value:this.props.range};this.props.onValueChange&&this.props.onValueChange(e.value),S.selectedSensor.set(e,!0)}},{key:"customQuery",value:function(e){if(e)return{range:a({},this.props.appbaseField,{gte:e.start,lte:e.end,boost:2})}}},{key:"histogramQuery",value:function(){return a({},this.props.appbaseField,{histogram:{field:this.props.appbaseField,interval:this.props.interval?this.props.interval:Math.ceil((this.props.range.end-this.props.range.start)/10)}})}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t.aggs={key:this.props.appbaseField,sort:"asc",size:1e3,customQuery:this.histogramQuery},t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.props.componentId+"-internal");var n=v["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery&&t.startTime>e.queryStartTime){e.queryStartTime=t.startTime?t.startTime:0;var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(n)}}),this.listenLoadingChannel(n)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"getSize",value:function(){return Math.min(this.props.range.end-this.props.range.start,this.maxSize)}},{key:"setData",value:function(e){try{this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}catch(t){console.log(t)}}},{key:"handleValuesChange",value:function(e,t){this.setState({values:t})}},{key:"countCalc",value:function(e,t,n){return n.map(function(e){return e.doc_count})}},{key:"addItemsToList",value:function(e){var t=this;e=k["default"].orderBy(e,["key"],["asc"]);var n=e.length,r=this.state.startThreshold?this.state.startThreshold:e[0].key,o=this.state.endThreshold?this.state.endThreshold:e[n-1].key;if(n>1){var a={counts:this.countCalc(r,o,e),startThreshold:r,endThreshold:o,values:{min:this.state.values.min,max:this.state.values.max}};this.setState(a,function(){k["default"].isEqual(a.values,t.state.currentValues)||t.handleResults(null,a.values)})}}},{key:"handleResults",value:function(e,t){var n=void 0;n=e?{min:e[0],max:e[1]}:t;var r={from:n.min,to:n.max},o={key:this.props.componentId,value:r};this.props.onValueChange&&this.props.onValueChange(o.value),S.URLParams.update(this.props.componentId,this.setURLParam(o.value),this.props.URLParams),S.selectedSensor.set(o,!0),this.setState({currentValues:n,values:n})}},{key:"render",value:function(){var e=null,t=null,n={};if(this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.counts&&this.state.counts.length&&this.props.showHistogram&&(t=p["default"].createElement(g.HistoGramComponent,{data:this.state.counts})),this.props.rangeLabels.start||this.props.rangeLabels.end){var r;r={},a(r,this.state.startThreshold,this.props.rangeLabels.start),a(r,this.state.endThreshold,this.props.rangeLabels.end),n=r}var o=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-labels-active":this.props.rangeLabels.start||this.props.rangeLabels.end,"rbc-labels-inactive":!this.props.rangeLabels.start&&!this.props.rangeLabels.end,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return p["default"].createElement("div",{className:"rbc rbc-rangeslider card thumbnail col s12 col-xs-12 "+o,style:this.props.componentStyle},e,t,p["default"].createElement("div",{className:"rbc-rangeslider-container col s12 col-xs-12"},p["default"].createElement(f["default"],{range:!0,value:[this.state.values.min,this.state.values.max],min:this.state.startThreshold,max:this.state.endThreshold,onChange:this.handleResults,step:this.props.stepValue,marks:n})),this.props.initialLoader&&this.state.queryStart?p["default"].createElement(b["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(c.Component);t["default"]=P,P.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),range:p["default"].PropTypes.shape({start:S.validateThreshold,end:S.validateThreshold}),rangeLabels:p["default"].PropTypes.shape({start:p["default"].PropTypes.string,end:p["default"].PropTypes.string}),defaultSelected:p["default"].PropTypes.shape({start:p["default"].PropTypes.number,end:p["default"].PropTypes.number}),stepValue:S.stepValidation,showHistogram:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,interval:p["default"].PropTypes.number,URLParams:p["default"].PropTypes.bool},P.defaultProps={title:null,range:{start:0,end:10},rangeLabels:{start:"",end:""},defaultSelected:{start:0,end:10},stepValue:1,showHistogram:!0,componentStyle:{},URLParams:!1},P.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},P.types={componentId:M.STRING,appbaseField:M.STRING,appbaseFieldType:M.NUMBER,title:M.STRING,react:M.OBJECT,range:M.OBJECT,rangeLabels:M.OBJECT,defaultSelected:M.OBJECT,stepValue:M.NUMBER,showHistogram:M.BOOLEAN,customQuery:M.FUNCTION,initialLoader:M.OBJECT,componentStyle:M.OBJECT,interval:M.NUMBER,URLParams:M.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(e[t]<1||e[t]>1e3)&&(n=new Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=new Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]<=0&&(n=new Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=new Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start<=0&&(r=new Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return!isNaN(e[t])&&r>=e.defaultSelected&&o<=e.defaultSelected||(n=new Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return e[t]<0&&(n=new Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=new Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n'],post_tags:[""],fields:e}}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.defaultSearchQuery}};this.props.highlight&&(e.value.externalQuery=this.highlightQuery()),w.selectedSensor.setSensorInfo(e);var t={key:this.searchInputId,value:{queryType:"multi_match",inputData:this.props.appbaseField,customQuery:this.defaultSearchQuery}};w.selectedSensor.setSensorInfo(t)}},{key:"setValue",value:function(e){var t={key:this.searchInputId,value:e};w.URLParams.update(this.props.componentId,e,this.props.URLParams),w.selectedSensor.set(t,!0),e&&""!==e.trim()?this.setState({options:[{label:e,value:e}],isLoadingOptions:!0,currentValue:e}):this.setState({options:[],isLoadingOptions:!1,currentValue:e})}},{key:"getValue",value:function(e,t){var n=void(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0);return M["default"].has(t,e)?n=t[e]:e.indexOf(".")>-1&&!function(){var r="",o=e.split(".");o.forEach(function(e,a){r+=e,M["default"].isArray(M["default"].get(t,r))&&(r+="["+a+"]"),o.length-1!==a?r+=".":n=M["default"].get(t,r)})}(),n}},{key:"setData",value:function(e){var t=this,n=[];M["default"].isArray(this.props.appbaseField)?this.props.appbaseField:[this.props.appbaseField],e.hits.hits.map(function(e){if("string"===t.fieldType){var r=t.getValue(t.props.appbaseField.trim(),e._source);n.push({value:r,label:r})}else"object"===t.fieldType&&t.props.appbaseField.map(function(r){var o=t.getValue(r,e._source);o&&n.push({value:o,label:o})})}),this.state.currentValue&&""!==this.state.currentValue.trim()&&n.unshift({label:this.state.currentValue,value:this.state.currentValue}),n=this.removeDuplicates(n,"label"),this.setState({options:n,isLoadingOptions:!1})}},{key:"defaultSearchQuery",value:function(e){var t=null,n=void 0;return e&&(n="string"===this.fieldType?[this.props.appbaseField]:this.props.appbaseField,t={bool:{should:[{multi_match:{query:e,fields:n,type:"phrase_prefix"}},{multi_match:{query:e,fields:n}}],minimum_should_match:"1"}}),t}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.searchInputId);var n=g["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({rawData:r}),e.props.autocomplete&&e.setData(r)})}},{key:"checkDefault",value:function(){this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultValue&&this.defaultSelected!=this.defaultValue&&(this.defaultSelected=this.defaultValue,setTimeout(this.setValue.bind(this,this.defaultSelected),100),this.handleSearch({value:this.defaultSelected}))}},{key:"handleSearch",value:function(e){var t=e?e.value:null;t="null"===t?null:t;var n={key:this.props.componentId,value:t};w.selectedSensor.set(n,!0),this.setState({currentValue:t})}},{key:"handleInputChange",value:function(e){var t=e.target.value;this.setState({currentValue:t});var n={key:this.props.componentId,value:t};this.props.onValueChange&&this.props.onValueChange(n.value);var r=!0;w.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=d["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,y["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-autocomplete-active":this.props.autocomplete,"rbc-autocomplete-inactive":!this.props.autocomplete});return d["default"].createElement("div",{className:"rbc rbc-datasearch col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},e,this.props.autocomplete?d["default"].createElement(h["default"],u({isLoading:this.state.isLoadingOptions,value:this.state.currentValue,options:this.state.options,onInputChange:this.setValue,onChange:this.handleSearch,onBlurResetsInput:!1},this.props)):d["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},d["default"].createElement("input",{type:"text",className:"rbc-input",placeholder:this.props.placeholder,value:this.state.currentValue?this.state.currentValue:"",onChange:this.handleInputChange}),d["default"].createElement("span",{className:"rbc-search-icon"})))}}]),t}(p.Component);t["default"]=k,k.propTypes={componentId:d["default"].PropTypes.string.isRequired,appbaseField:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),title:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.element]),placeholder:d["default"].PropTypes.string,autocomplete:d["default"].PropTypes.bool,defaultSelected:d["default"].PropTypes.string,customQuery:d["default"].PropTypes.func,onValueChange:d["default"].PropTypes.func,react:d["default"].PropTypes.object,componentStyle:d["default"].PropTypes.object,highlight:d["default"].PropTypes.bool,highlightFields:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),URLParams:d["default"].PropTypes.bool},k.defaultProps={placeholder:"Search",autocomplete:!0,componentStyle:{},highlight:!1,URLParams:!1},k.contextTypes={appbaseRef:d["default"].PropTypes.any.isRequired,type:d["default"].PropTypes.any.isRequired},k.types={componentId:b.STRING,appbaseField:b.STRING,appbaseFieldType:b.STRING,react:b.OBJECT,title:b.STRING,placeholder:b.STRING,autocomplete:b.BOOLEAN,defaultSelected:b.STRING,customQuery:b.FUNCTION,componentStyle:b.OBJECT,highlight:b.BOOLEAN,URLParams:b.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&setTimeout(this.handleChange.bind(this,t),1e3)}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!_["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t;var n=e.state.data.filter(function(t){ +return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&(null!==e.urlParams?e.handleChange(n):setTimeout(e.handleChange.bind(e,n),1e3))}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};b.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){if(e.length>0)return e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}})}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}}},{key:"handleChange",value:function(e){var t=[];t=e.map(function(e){return e.label}),t=t.join(),this.setState({selected:t});var n={key:this.props.componentId,value:e},r=!0;this.props.onValueChange&&this.props.onValueChange(n.value),b.URLParams.update(this.props.componentId,t,this.props.URLParams),b.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return p["default"].createElement("div",{className:"rbc rbc-multidropdownrange col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"col s12 col-xs-12"},p["default"].createElement(f["default"],{options:this.state.data,value:this.state.selected,onChange:this.handleChange,clearable:!1,multi:!0,placeholder:this.props.placeholder,searchable:!0}))))}}]),t}(c.Component);t["default"]=T,T.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),placeholder:p["default"].PropTypes.string,data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},T.defaultProps={URLParams:!1},T.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},T.types={componentId:v.STRING,appbaseField:v.STRING,appbaseFieldType:v.NUMBER,data:v.OBJECT,defaultSelected:v.ARRAY,title:v.STRING,placeholder:v.STRING,customQuery:v.FUNCTION,componentStyle:v.OBJECT,URLParams:v.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&(null!==this.urlParams?this.handleChange(t):setTimeout(this.handleChange.bind(this,t),1e3))}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!v["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t,e.resetState();var n=e.props.data.filter(function(e){return t.indexOf(e.label)>-1});n&&n.length&&setTimeout(e.handleChange.bind(e,n),1e3)}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.length>0?e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}}):null}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}return null}},{key:"handleChange",value:function(e){function t(e,t,o){o.label===e.label&&(r=t,n.splice(t,1))}var n=this.state.selected,r=null,o=e;v["default"].isArray(e)||(o=[e]),o.forEach(function(e){n.forEach(function(n,r){t(n,r,e)})}),null===r&&o.forEach(function(e){n.push(e)}),this.setState({selected:n});var a={key:this.props.componentId,value:n},i=!0;this.props.onValueChange&&this.props.onValueChange(a.value),g.URLParams.update(this.props.componentId,this.getSelectedLabels(n),this.props.URLParams),g.selectedSensor.set(a,i)}},{key:"getSelectedLabels",value:function(e){return e.map(function(e){return e.label})}},{key:"resetState",value:function(){this.setState({selected:[]});var e={key:this.props.componentId,value:[]},t=!0;g.URLParams.update(this.props.componentId,null,this.props.URLParams),g.selectedSensor.set(e,t)}},{key:"handleTagClick",value:function(e){var t=this.state.selected.filter(function(t){return t.label===e});this.handleChange(t[0])}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t){return p["default"].createElement("div",{className:"rbc-list-item row",key:t.label,onClick:function(){return e.handleChange(t)}},p["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:n.indexOf(t.label)>-1,value:t.label}),p["default"].createElement("label",{className:"rbc-label"},t.label))})),t}},{key:"render",value:function(){var e=this,t=null,n=[];this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.selected&&this.state.selected.forEach(function(t){n.push(p["default"].createElement(b,{key:t.label,value:t.label,onClick:e.handleTagClick}))});var r=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return p["default"].createElement("div",{className:"rbc rbc-multirange col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},t,p["default"].createElement("div",{className:"col s12 col-xs-12 rbc-list-container"},n.length?p["default"].createElement("div",{className:"row",style:{marginTop:"0"}},n):null,this.renderButtons())))}}]),t}(c.Component);t["default"]=_;var b=function(e){return p["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},p["default"].createElement("a",{className:"close"},"×"),p["default"].createElement("span",null,e.value))};b.propTypes={onClick:p["default"].PropTypes.func.isRequired,value:p["default"].PropTypes.string.isRequired},_.propTypes={appbaseField:p["default"].PropTypes.string.isRequired,componentId:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nr;return p["default"].createElement("div",{className:"rbc-numberbox-container col s12 col-xs-12"},p["default"].createElement("div",{className:"rbc-label"},t),p["default"].createElement("div",{className:"rbc-numberbox-btn-container"},p["default"].createElement(g,{isActive:s,handleChange:o,type:"minus"}),p["default"].createElement("span",{className:"rbc-numberbox-number"},a),p["default"].createElement(g,{isActive:i,handleChange:o,type:"plus"})))},b=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),o=r.props.focused;r.urlParams=y.URLParams.get(r.props.componentId);var a=null!==r.urlParams?r.urlParams:r.props.defaultSelected;return r.state={currentValue:a?a:r.props.data.start,focused:o},r.type="term",r.handleChange=r.handleChange.bind(r),r.customQuery=r.customQuery.bind(r),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.setQueryInfo(),null!==this.urlParams?this.updateQuery(this.urlParams):setTimeout(this.handleChange.bind(this),1e3)}},{key:"componentWillReceiveProps",value:function(e){var t=this;setTimeout(function(){var n=null!==t.urlParams?t.urlParams:t.props.defaultSelected;!n&&0!==n||n===t.state.currentValue||t.setState({currentValue:n}),e.queryFormat!==t.queryFormat&&(t.queryFormat=e.queryFormat,t.updateQuery())},300)}},{key:"customQuery",value:function(e){var t=null;if(e&&(e.value||0===e.value)){var n=e.value;switch(this.props.queryFormat){case"exact":t=this.exactQuery(n);break;case"lte":t=this.lteQuery(n);break;case"gte":default:t=this.gteQuery(n)}}return t}},{key:"exactQuery",value:function(e){return a({},this.type,a({},this.props.appbaseField,e))}},{key:"gteQuery",value:function(e){return{range:a({},this.props.appbaseField,{gte:e,boost:2})}}},{key:"lteQuery",value:function(e){return{range:a({},this.props.appbaseField,{lte:e,boost:2})}}},{key:"setQueryInfo",value:function(){var e=this.props,t=e.componentId,n=e.appbaseField,r={key:t,value:{queryType:this.type,inputData:n,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};y.selectedSensor.setSensorInfo(r)}},{key:"handleChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.props,n=(t.componentId,t.data),r=n.start,o=n.end,a=this.state.currentValue;r=void 0!=r?r:a-1,o=void 0!=o?o:a+1,e>0&&ar&&(a-=1),this.setState({currentValue:a},this.updateQuery.bind(this))}},{key:"updateQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.start.currentValue,t={key:this.props.componentId,value:{value:e,queryFormat:this.props.queryFormat}};this.props.onValueChange&&this.props.onValueChange(t.value),y.URLParams.update(this.props.componentId,e,this.props.URLParams),y.selectedSensor.set(t,!0)}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.data,r=e.labelPosition,o=this.state.currentValue,a=t?p["default"].createElement(v,{title:t}):null,i=(0,f["default"])({"rbc-title-active":t,"rbc-title-inactive":!t});return p["default"].createElement("div",{className:"rbc rbc-numberbox col s12 col-xs-12 card thumbnail "+i+" rbc-label-"+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},a,p["default"].createElement(_,{handleChange:this.handleChange,value:o,label:n.label,start:n.start,end:n.end})))}}]),t}(c.Component);t["default"]=b,b.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.shape({start:y.validateThreshold,end:y.validateThreshold,label:p["default"].PropTypes.string}),defaultSelected:y.valueValidation,labelPosition:p["default"].PropTypes.oneOf(["top","bottom","left","right"]),customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,queryFormat:p["default"].PropTypes.oneOf(["exact","gte","lte"]),URLParams:p["default"].PropTypes.bool},b.defaultProps={componentStyle:{},queryFormat:"gte",URLParams:!1},b.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},b.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.NUMBER,labelPosition:m.STRING,customQuery:m.FUNCTION,componentStyle:m.OBJECT,queryFormat:m.STRING,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=n.end){var r=(n.end-n.start)%e.stepValue;r?!function(){t.setState({values:{min:t.state.values.min,max:n.end-r}});var e={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-r}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(e.value),S.URLParams.update(t.props.componentId,t.setURLParam(e.value),t.props.URLParams),S.selectedSensor.set(e,!0)},1e3)}():!function(){var e={};e.min=n.start,e.max=n.end,t.setState({values:e,currentValues:e});var r={key:t.props.componentId,value:{from:e.min,to:e.max}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(r.value),S.URLParams.update(t.props.componentId,t.setURLParam(r.value),t.props.URLParams),S.selectedSensor.set(r,!0)},1e3)}()}if(e.range.start!==t.state.startThreshold||e.range.end!==t.state.endThreshold){if(e.range.start<=n.start&&e.range.end>=n.end)t.setState({startThreshold:e.range.start,endThreshold:e.range.end});else{var o={min:t.state.values.min,max:t.state.values.max};t.state.values.mine.range.end&&(o.max=e.range.end),t.setState({startThreshold:e.range.start,endThreshold:e.range.end,values:o});var a={from:o.min,to:o.max},i={key:t.props.componentId,value:a};t.props.onValueChange&&t.props.onValueChange(i.value),S.URLParams.update(t.props.componentId,t.setURLParam(i.value),t.props.URLParams),S.selectedSensor.set(i,!0)}t.setRangeValue()}if(e.stepValue!==t.props.stepValue){var s=(n.end-n.start)%e.stepValue;if(s){t.setState({values:{min:t.state.values.min,max:n.end-s}});var u={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-s}};t.props.onValueChange&&t.props.onValueChange(u.value),S.URLParams.update(t.props.componentId,t.setURLParam(u.value),t.props.URLParams),S.selectedSensor.set(u,!0)}}},300)}},{key:"shouldComponentUpdate",value:function(e,t){return e.stepValue<=0||e.stepValue>Math.floor((e.range.end-e.range.start)/2)?(console.error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."),!1):!(t.values.max>t.endThreshold)}},{key:"componentWillUnmount",value:function(){this.channelId&&v["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setURLParam",value:function(e){return"from"in e&&"to"in e&&(e={start:e.from,end:e.to}),JSON.stringify(e)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField}},t={key:this.props.componentId+"-internal",value:{queryType:"range",inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};S.selectedSensor.setSensorInfo(e),S.selectedSensor.setSensorInfo(t),this.setRangeValue()}},{key:"setRangeValue",value:function(){var e={key:this.props.componentId+"-internal",value:this.props.range};this.props.onValueChange&&this.props.onValueChange(e.value),S.selectedSensor.set(e,!0)}},{key:"customQuery",value:function(e){if(e)return{range:a({},this.props.appbaseField,{gte:e.start,lte:e.end,boost:2})}}},{key:"histogramQuery",value:function(){return a({},this.props.appbaseField,{histogram:{field:this.props.appbaseField,interval:this.props.interval?this.props.interval:Math.ceil((this.props.range.end-this.props.range.start)/10)}})}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t.aggs={key:this.props.appbaseField,sort:"asc",size:1e3,customQuery:this.histogramQuery},t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.props.componentId+"-internal");var n=v["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery&&t.startTime>e.queryStartTime){e.queryStartTime=t.startTime?t.startTime:0;var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(n)}}),this.listenLoadingChannel(n)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"getSize",value:function(){return Math.min(this.props.range.end-this.props.range.start,this.maxSize)}},{key:"setData",value:function(e){try{this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}catch(t){console.log(t)}}},{key:"handleValuesChange",value:function(e,t){this.setState({values:t})}},{key:"countCalc",value:function(e,t,n){return n.map(function(e){return e.doc_count})}},{key:"addItemsToList",value:function(e){var t=this;e=k["default"].orderBy(e,["key"],["asc"]);var n=e.length,r=this.state.startThreshold?this.state.startThreshold:e[0].key,o=this.state.endThreshold?this.state.endThreshold:e[n-1].key;n>1&&!function(){var n={counts:t.countCalc(r,o,e),startThreshold:r,endThreshold:o,values:{min:t.state.values.min,max:t.state.values.max}};t.setState(n,function(){k["default"].isEqual(n.values,t.state.currentValues)||t.handleResults(null,n.values)})}()}},{key:"handleResults",value:function(e,t){var n=void 0;n=e?{min:e[0],max:e[1]}:t;var r={from:n.min,to:n.max},o={key:this.props.componentId,value:r};this.props.onValueChange&&this.props.onValueChange(o.value),S.URLParams.update(this.props.componentId,this.setURLParam(o.value),this.props.URLParams),S.selectedSensor.set(o,!0),this.setState({currentValues:n,values:n})}},{key:"render",value:function(){var e=null,t=null,n={};if(this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.counts&&this.state.counts.length&&this.props.showHistogram&&(t=p["default"].createElement(g.HistoGramComponent,{data:this.state.counts})),this.props.rangeLabels.start||this.props.rangeLabels.end){var r;r={},a(r,this.state.startThreshold,this.props.rangeLabels.start),a(r,this.state.endThreshold,this.props.rangeLabels.end),n=r}var o=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-labels-active":this.props.rangeLabels.start||this.props.rangeLabels.end,"rbc-labels-inactive":!this.props.rangeLabels.start&&!this.props.rangeLabels.end,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return p["default"].createElement("div",{className:"rbc rbc-rangeslider card thumbnail col s12 col-xs-12 "+o,style:this.props.componentStyle},e,t,p["default"].createElement("div",{className:"rbc-rangeslider-container col s12 col-xs-12"},p["default"].createElement(f["default"],{range:!0,value:[this.state.values.min,this.state.values.max],min:this.state.startThreshold,max:this.state.endThreshold,onChange:this.handleResults,step:this.props.stepValue,marks:n})),this.props.initialLoader&&this.state.queryStart?p["default"].createElement(b["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(c.Component);t["default"]=P,P.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),range:p["default"].PropTypes.shape({start:S.validateThreshold,end:S.validateThreshold}),rangeLabels:p["default"].PropTypes.shape({start:p["default"].PropTypes.string,end:p["default"].PropTypes.string}),defaultSelected:p["default"].PropTypes.shape({start:p["default"].PropTypes.number,end:p["default"].PropTypes.number}),stepValue:S.stepValidation,showHistogram:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,interval:p["default"].PropTypes.number,URLParams:p["default"].PropTypes.bool},P.defaultProps={title:null,range:{start:0,end:10},rangeLabels:{start:"",end:""},defaultSelected:{start:0,end:10},stepValue:1,showHistogram:!0,componentStyle:{},URLParams:!1},P.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},P.types={componentId:M.STRING,appbaseField:M.STRING,appbaseFieldType:M.NUMBER,title:M.STRING,react:M.OBJECT,range:M.OBJECT,rangeLabels:M.OBJECT,defaultSelected:M.OBJECT,stepValue:M.NUMBER,showHistogram:M.BOOLEAN,customQuery:M.FUNCTION,initialLoader:M.OBJECT,componentStyle:M.OBJECT,interval:M.NUMBER,URLParams:M.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&t.forEach(function(t){null!==e.urlParams?e.handleChange(t):setTimeout(e.handleChange.bind(e,t),1e3)})}}},{key:"componentWillUpdate",value:function(){var e=this,t=null!==this.urlParams?this.urlParams:this.props.defaultSelected;if(this.defaultSelected!=t){this.defaultSelected=t,this.defaultSelected=v["default"].isArray(this.defaultSelected)?this.defaultSelected:[this.defaultSelected];var n=this.props.data.filter(function(t){return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&n.forEach(function(t){setTimeout(e.handleChange.bind(e,t),1e3)})}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.map(function(e,n){return{term:a({},t,e.value)}})}var n=null;return e&&e.length?n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}}:n}},{key:"handleChange",value:function(e){var t=this.state.selected,n=[],r=null;t.forEach(function(n,o){e.label===n.label&&(r=o,t.splice(o,1))}),null===r?this.props.multiSelect?(t.push(e),n=t):n.push(e):n=t,this.setState({selected:n});var o={key:this.props.componentId,value:n},a=!0;this.props.onValueChange&&this.props.onValueChange(o.value),g.URLParams.update(this.props.componentId,this.setURLValue(n),this.props.URLParams),g.selectedSensor.set(o,a)}},{key:"setURLValue",value:function(e){return e.map(function(e){return e.label})}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t,r){return p["default"].createElement("button",{key:r,className:"btn rbc-btn "+(n.indexOf(t.label)>-1?"rbc-btn-active":"rbc-btn-inactive"),onClick:function(){return e.handleChange(t)},title:t.title?t.title:t.label},t.label)})),t}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-multiselect-active":this.props.multiSelect,"rbc-multiselect-inactive":!this.props.multiSelect});return p["default"].createElement("div",{className:"rbc rbc-togglebutton col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"rbc-buttongroup col s12 col-xs-12"},this.renderButtons())))}}]),t}(c.Component);t["default"]=_,_.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.oneOfType([p["default"].PropTypes.array,p["default"].PropTypes.string]),multiSelect:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={multiSelect:!0,componentStyle:{},URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.KEYWORD,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,multiSelect:m.BOOLEAN,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]&&arguments[0];this.setGeoQueryInfo(),this.createChannel(e);var t=this.getMapStyle(this.props.defaultMapStyle);this.initialMapBoundQuery=!!this.props.defaultCenter,this.applyGeoQuery=this.props.applyGeoQuery?this.props.applyGeoQuery:this.props.setSearchAsMove,this.setState({currentMapStyle:t})}},{key:"componentWillReceiveProps",value:function(e){e.defaultMapStyle!==this.props.defaultMapStyle&&this.mapStyleChange(this.getMapStyle(e.defaultMapStyle))}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){e.streamProp!==e.props.stream&&(e.streamProp=e.props.stream,e.removeChannel(),e.initialize()),e.sizeProp!==e.props.size&&(e.sizeProp=e.props.size,e.removeChannel(),e.initialize(!0))},300)}},{key:"componentWillUnmount",value:function(){this.removeChannel()}},{key:"removeChannel",value:function(){this.channelId&&(_.AppbaseChannelManager.stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove()}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and?"string"==typeof t.and&&(t.and=[t.and]):t.and=[],t.or=t.or?t.or:[],t.or.push("geoQuery"),t.and.push("streamChanges");var n=_.AppbaseChannelManager.create(this.context.appbaseRef,this.context.type,t,this.props.size,this.props.from,this.props.stream);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){function n(){"historic"===t.mode&&t.startTime>this.queryStartTime?this.afterChannelResponse(t):"streaming"===t.mode&&this.afterChannelResponse(t)}function r(){if(t.error&&t.startTime>this.queryStartTime){if(this.props.onAllData){var e=_.AppbaseSensorHelper.prepareResultData(t);this.props.onAllData(e.res,e.err)}}else t.appliedQuery&&(this.state.mapBounds?this.props.autoMapRender?n.call(this):o.hits.hits.length&&n.call(this):n.call(this))}var o=t.data;r.call(e)});var r={key:"streamChanges",value:""};_.AppbaseSensorHelper.selectedSensor.set(r,!0)}},{key:"afterChannelResponse",value:function(e){var t=this,n=w.afterChannelResponse(e,this.state.rawData,this.props.appbaseField,this.state.markersData);this.reposition=!0,this.streamFlag=n.streamFlag,this.queryStartTime=n.queryStartTime?n.queryStartTime:0,this.setState({rawData:n.rawData,markersData:n.markersData},function(){if(t.props.onAllData){e.allMarkers=n.rawData;var r=JSON.parse(JSON.stringify(e));if(r.newData=n.newData,r.currentData=n.currentData,delete r.data,r=_.AppbaseSensorHelper.prepareResultData(r,e.data),t.props.onAllData){r.res&&(r.res.mapRef=t.mapRef);var o=t.props.onAllData(r.res,r.err);t.setState({externalData:o})}}t.streamFlag&&t.streamMarkerInterval()})}},{key:"setGeoQueryInfo",value:function(){var e={key:"geoQuery",value:{queryType:"geo_bounding_box",inputData:this.props.appbaseField,customQuery:this.geoCustomQuery}},t={key:"updateExecute",value:{queryType:"random",inputData:this.props.appbaseField}};_.AppbaseSensorHelper.selectedSensor.setSensorInfo(e),_.AppbaseSensorHelper.selectedSensor.setSensorInfo(t)}},{key:"geoCustomQuery",value:function(e){var t=null;return e&&(this.initialMapBoundQuery||this.searchAsMove)&&(t={geo_bounding_box:a({},this.props.appbaseField,e)},this.geoRelatedEventsChange?this.geoRelatedEventsChange=!1:this.applyGeoQuery&&(this.applyGeoQuery=!1),this.initialMapBoundQuery=!1),t}},{key:"updateExecute",value:function(){setTimeout(function(){var e={key:"updateExecute",value:Math.random()};_.AppbaseSensorHelper.selectedSensor.set(e,!0)},1e3)}},{key:"handleMarkerClick",value:function(e){var t=this;e.showInfo=!0,this.reposition=!1,this.setState({rerender:!0},function(){t.props.popoverTTL&&t.watchPopoverTTL(e)})}},{key:"handleMarkerClose",value:function(e){e.showInfo=!1,this.reposition=!1,this.setState(this.state)}},{key:"watchPopoverTTL",value:function(e){var t=this;this.popoverTTLStore=this.popoverTTLStore?this.popoverTTLStore:{},this.popoverTTLStore[e._type+e._id]?this.clearTTL(e._type+e._id):this.popoverTTLStore[e._type+e._id]=setTimeout(function(){t.handleMarkerClose(e),t.clearTTL(e._type+e._id)},1e3*this.props.popoverTTL)}},{key:"clearTTL",value:function(e){clearTimeout(this.popoverTTLStore[e]),delete this.popoverTTLStore[e]}},{key:"renderInfoWindow",value:function(e,t){var n=this,r=this.props.onPopoverTrigger?this.props.onPopoverTrigger(t):"Popver";return f["default"].createElement(h.InfoWindow,{zIndex:500,key:e+"_info_window",onCloseclick:function(){return n.handleMarkerClose(t)}},f["default"].createElement("div",null,r))}},{key:"handleOnIdle",value:function(){var e=this.mapRef?this.mapRef.getBounds():null;if(e){var t=e.getNorthEast().lat(),n=e.getSouthWest().lat(),r=e.getNorthEast().lng(),o=e.getSouthWest().lng(),a={top_left:[o,t],bottom_right:[r,n]},i={mapBounds:e};if(this.props.onIdle){var s=this.props.onIdle(this.mapRef,{boundingBoxCoordinates:a,mapBounds:e});i.externalData=s}if(this.initialMapBoundQuery||this.applyGeoQuery||this.geoRelatedEventsChange&&this.searchAsMove&&!this.searchQueryProgress){var u=!!this.initialMapBoundQuery||(this.applyGeoQuery?this.applyGeoQuery:this.searchAsMove);this.setValue(a,u)}this.setState(i)}}},{key:"handleOnDrage",value:function(){this.storeCenter=null}},{key:"setValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={key:"geoQuery",value:e};_.AppbaseSensorHelper.selectedSensor.set(n,t)}},{key:"searchAsMoveChange",value:function(e){this.searchAsMove=e,e&&this.mapRef&&(this.geoRelatedEventsChange=!0,this.handleOnIdle())}},{key:"mapStyleChange",value:function(e){this.setState({currentMapStyle:e})}},{key:"handleBoundsChanged",value:function(){var e=this;this.searchQueryProgress&&setTimeout(function(){e.searchQueryProgress=!1},1e3)}},{key:"streamMarkerInterval",value:function(){var e=this,t=this.state.markersData,n=t.filter(function(e){return e.stream&&e.streamStart});n.length?(this.isStreamDataExists=!0,setTimeout(function(){return e.streamToNormal()},1e3*this.props.streamTTL)):this.isStreamDataExists=!1}},{key:"streamToNormal",value:function(){var e=this,t=this.state.markersData,n=t.filter(function(e){return e.stream&&e.streamStart});n.length?(t=t.map(function(t){if(t.stream&&t.streamStart){var n=new Date,r=(n.getTime()-t.streamStart.getTime())/1e3;r>=e.props.streamTTL&&(delete t.stream,delete t.streamStart)}return t}),this.setState({markersData:t})):this.isStreamDataExists=!1}},{key:"getIcon",value:function(e){return e.stream?this.props.streamMarkerImage:this.props.defaultMarkerImage}},{key:"chooseIcon",value:function(e){var t=e.external_icon?e.external_icon:this.getIcon(e);t=this.props.onData?this.props.onData(e):t;var n=!!("object"===("undefined"==typeof t?"undefined":c(t))&&"path"in t);if(n&&(t=JSON.parse(JSON.stringify(t)),this.props.autoMarkerPosition)){var r=e.angleDeg?e.angleDeg:0;t.rotation=r}return t}},{key:"combineProps",value:function(e){var t=void 0,n={};return this.state.externalData&&this.state.externalData.markers&&this.state.externalData.markers[e._id]&&(t=this.state.externalData.markers[e._id],Object.keys(t).forEach(function(r){e["external_"+r]=t[r],n[r]=t[r]})),n.icon=this.chooseIcon(e),n}},{key:"generateMarkers",value:function(){var e=this,t=this,n=this.state.markersData,r={markerComponent:[],defaultCenter:null,convertedGeo:[]};return n&&n.length&&(n=n.filter(function(e){return w.identifyGeoData(e._source[t.props.appbaseField])}),r.markerComponent=n.map(function(n,o){var a=w.identifyGeoData(n._source[t.props.appbaseField]);r.convertedGeo.push(a);var i={position:a},s="marker_ref_"+o,u=void 0;if(e.props.showPopoverOn){u={};var c=e.props.showPopoverOn.split("");c[0]=c[0].toUpperCase(),c=c.join(""),u["on"+c]=e.handleMarkerClick.bind(e,n)}else u={},u.onClick=e.handleMarkerClick.bind(e,n);var p=function(){},d={onClick:e.props.markerOnClick?e.props.markerOnClick:p,onDblclick:e.props.markerOnDblclick?e.props.markerOnDblclick:p,onMouseover:e.props.onMouseover?e.props.onMouseover:p,onMouseout:e.props.onMouseout?e.props.onMouseout:p};return f["default"].createElement(h.Marker,l({},i,{key:n._id,zIndex:1,ref:s},t.combineProps(n),{onClick:function(){return d.onClick(n._source)},onDblclick:function(){return d.onDblclick(n._source)},onMouseover:function(){return d.onMouseover(n._source)},onMouseout:function(){return d.onMouseout(n._source)}},u),n.showInfo?t.renderInfoWindow(s,n):null)}),r.convertedGeo[0]&&(r.defaultCenter={lat:r.convertedGeo[0].lat,lng:r.convertedGeo[0].lng})),this.props.showMarkers||(r.markerComponent=[]),r}},{key:"externalData",value:function(){var e=this,t=[];return this.state.externalData&&Object.keys(this.state.externalData).forEach(function(n){"markers"!==n&&(t=t.concat(e.state.externalData[n]))}),t}},{key:"mapEvents",value:function(e){if(this.geoRelatedEvents.indexOf(e)>-1&&(this.geoRelatedEventsChange=!0),this.props[e]){var t=this.props[e](this.mapRef);t&&this.setState({externalData:t})}}},{key:"getStoreCenter",value:function(){return this.storeCenter?this.storeCenter:this.state.center}},{key:"render",value:function(){var e=this,t=void 0,n=void 0,r=void 0,o=null,a=null,i={},s=this.generateMarkers();t=this.props.setMarkerCluster?f["default"].createElement(y["default"],{averageCenter:!0,enableRetinaIcons:!0,gridSize:60},s.markerComponent):s.markerComponent;var u=!0;"streaming"!==this.channelMethod||this.props.streamAutoCenter||(u=!1),this.props.autoCenter&&this.reposition&&u?(a=s.defaultCenter?s.defaultCenter:this.getStoreCenter(),this.storeCenter=a,this.reposition=!1,i.center=w.normalizeCenter(a)):this.storeCenter?(a=this.storeCenter,i.center=w.normalizeCenter(a)):a=null,this.props.showSearchAsMove&&(n=f["default"].createElement(b.SearchAsMove,{searchAsMoveDefault:this.props.setSearchAsMove,searchAsMoveChange:this.searchAsMoveChange})),this.props.showMapStyles&&(r=f["default"].createElement(T.MapStyles,{defaultSelected:this.props.defaultMapStyle,mapStyleChange:this.mapStyleChange})),this.props.title&&(o=f["default"].createElement("h4",{className:"rbc-title col s12 m8 col-xs-12 col-sm-8"},this.props.title));var c=(0,g["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return f["default"].createElement("div",{className:"rbc rbc-reactivemap col s12 col-xs-12 card thumbnail "+c,style:w.mapPropsStyles(this.props.componentStyle,"component")},o,r,f["default"].createElement(h.GoogleMapLoader,{containerElement:f["default"].createElement("div",{className:"rbc-container col s12 col-xs-12",style:w.mapPropsStyles(this.props.componentStyle,"map",this.mapDefaultHeight)}),googleMapElement:f["default"].createElement(h.GoogleMap,l({ref:function(t){ e.mapRef=t}},i,w.normalizeProps(this.props),{options:{styles:this.state.currentMapStyle},defaultCenter:w.normalizeCenter(this.state.defaultCenter),onDragstart:function(){e.handleOnDrage(),e.mapEvents("onDragstart")},onIdle:function(){return e.handleOnIdle()},onClick:function(){return e.mapEvents("onClick")},onDblclick:function(){return e.mapEvents("onDblclick")},onDrag:function(){return e.mapEvents("onDrag")},onDragend:function(){return e.mapEvents("onDragend")},onMousemove:function(){return e.mapEvents("onMousemove")},onMouseout:function(){return e.mapEvents("onMouseout")},onMouseover:function(){return e.mapEvents("onMouseover")},onResize:function(){return e.mapEvents("onResize")},onRightclick:function(){return e.mapEvents("onRightclick")},onTilesloaded:function(){return e.mapEvents("onTilesloaded")},onBoundsChanged:function(){return e.mapEvents("onBoundsChanged")},onCenterChanged:function(){return e.mapEvents("onCenterChanged")},onProjectionChanged:function(){return e.mapEvents("onProjectionChanged")},onTiltChanged:function(){return e.mapEvents("onTiltChanged")},onZoomChanged:function(){return e.mapEvents("onZoomChanged")}}),t,this.externalData())}),n,f["default"].createElement(_.PoweredBy,null))}}]),t}(d.Component);t["default"]=k,k.propTypes={appbaseField:f["default"].PropTypes.string.isRequired,onIdle:f["default"].PropTypes.func,onAllData:f["default"].PropTypes.func,onData:f["default"].PropTypes.func,onPopoverTrigger:f["default"].PropTypes.func,setMarkerCluster:f["default"].PropTypes.bool,autoMarkerPosition:f["default"].PropTypes.bool,showMarkers:f["default"].PropTypes.bool,streamTTL:w.validation.streamTTL,popoverTTL:w.validation.popoverTTL,size:_.AppbaseSensorHelper.sizeValidation,from:w.validation.fromValidation,autoMapRender:f["default"].PropTypes.bool,componentStyle:f["default"].PropTypes.object,autoCenter:f["default"].PropTypes.bool,showSearchAsMove:f["default"].PropTypes.bool,setSearchAsMove:f["default"].PropTypes.bool,defaultMapStyle:f["default"].PropTypes.oneOf(["Standard","Blue Essence","Blue Water","Flat Map","Light Monochrome","Midnight Commander","Unsaturated Browns"]),title:f["default"].PropTypes.oneOfType([f["default"].PropTypes.string,f["default"].PropTypes.element]),streamAutoCenter:f["default"].PropTypes.bool,defaultMarkerImage:f["default"].PropTypes.string,streamMarkerImage:f["default"].PropTypes.string,stream:f["default"].PropTypes.bool,defaultZoom:w.validation.defaultZoom,applyGeoQuery:f["default"].PropTypes.bool,showPopoverOn:f["default"].PropTypes.oneOf(["click","mouseover"]),defaultCenter:f["default"].PropTypes.shape({lat:w.validation.validCenter,lon:w.validation.validCenter}),react:f["default"].PropTypes.object,markerOnClick:f["default"].PropTypes.func,markerOnDblclick:f["default"].PropTypes.func,onMouseover:f["default"].PropTypes.func,onMouseout:f["default"].PropTypes.func,showMapStyles:f["default"].PropTypes.bool},k.defaultProps={setMarkerCluster:!0,autoCenter:!0,showSearchAsMove:!0,setSearchAsMove:!1,showMapStyles:!0,defaultMapStyle:"Standard",from:0,size:100,streamTTL:5,streamAutoCenter:!1,autoMarkerPosition:!1,showMarkers:!0,autoMapRender:!0,defaultMarkerImage:"https://opensource.appbase.io/reactivemaps/dist/images/historic-pin.png",streamMarkerImage:"https://opensource.appbase.io/reactivemaps/dist/images/stream-pin.png",componentStyle:{},stream:!1,applyGeoQuery:!1,defaultZoom:13},k.contextTypes={appbaseRef:f["default"].PropTypes.any.isRequired,type:f["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ItemCheckboxList=void 0;var s=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0],c[this.state.selectedValue].value);this.props.mapStyleChange(e)}},{key:"render",value:function(){var e=this.state.items.map(function(e,t){return l["default"].createElement("option",{value:t,key:t},e.key)});return l["default"].createElement("div",{className:"input-field col rbc-mapstyles pull-right right"},l["default"].createElement("select",{className:"browser-default form-control",onChange:this.handleSelect,value:this.state.selectedValue,name:"mapStyles",id:"mapStyles"},e))}}]),t}(u.Component);p.propTypes={},p.defaultProps={fieldName:"MapStyles"}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.SearchAsMove=void 0;var s=function(){function e(e,t){for(var n=0;n20)return new Error("zoom value should be an integer between 0 and 20.")},validCenter:function(e,t,n){return isNaN(e[t])?new Error(t+" value must be number"):"lat"===t&&(e[t]<-90||e[t]>90)?new Error(t+" value should be between -90 and 90."):"lng"===t&&(e[t]<-180||e[t]>180)?new Error(t+" value should be between -180 and 180."):void 0},fromValidation:function(e,t,n){if(e[t]<0)return new Error(t+" value should be greater than or equal to 0.")},streamTTL:function(e,t,n){if(e[t]<0||e[t]>1e3)return new Error(t+" should be a positive integer between 0 and 1000, counted in seconds for a streaming update to be visible.")},popoverTTL:function(e,t,n){if(e[t]<.1||e[t]>60)return new Error(t+" should be a positive integer between 1 and 60, counted in seconds for a popover to be visible.")}},t.normalizeCenter=function(e){return e&&e.lon&&(e.lng=e.lon),e});t.normalizeProps=function(e){var t=JSON.parse(JSON.stringify(e));return t.defaultCenter&&(t.defaultCenter=p(t.defaultCenter)),t.center&&(t.center=p(t.center)),t},t.mapPropsStyles=function(e,t,n){var r=JSON.parse(JSON.stringify(e)),o=void 0;return"component"===t?o=r:"map"===t&&(o={height:r.height?r.height:n}),o}},function(e,t){"use strict";e.exports=[{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#e0efef"}]},{featureType:"poi",elementType:"geometry.fill",stylers:[{visibility:"on"},{hue:"#1900ff"},{color:"#c0e8e8"}]},{featureType:"road",elementType:"geometry",stylers:[{lightness:100},{visibility:"simplified"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"transit.line",elementType:"geometry",stylers:[{visibility:"on"},{lightness:700}]},{featureType:"water",elementType:"all",stylers:[{color:"#7dcdcd"}]}]},function(e,t){"use strict";e.exports=[{featureType:"administrative",elementType:"labels.text.fill",stylers:[{color:"#444444"}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#f2f2f2"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"all",stylers:[{saturation:-100},{lightness:45}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"all",stylers:[{color:"#46bcec"},{visibility:"on"}]}]},function(e,t){"use strict";e.exports=[{featureType:"all",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"landscape",elementType:"all",stylers:[{visibility:"on"},{color:"#f3f4f4"}]},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{weight:.9},{visibility:"off"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#83cead"}]},{featureType:"road",elementType:"all",stylers:[{visibility:"on"},{color:"#ffffff"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"on"},{color:"#fee379"}]},{featureType:"road.arterial",elementType:"all",stylers:[{visibility:"on"},{color:"#fee379"}]},{featureType:"water",elementType:"all",stylers:[{visibility:"on"},{color:"#7fc8ed"}]}]},function(e,t){"use strict";e.exports=[{featureType:"administrative.locality",elementType:"all",stylers:[{hue:"#2c2e33"},{saturation:7},{lightness:19},{visibility:"on"}]},{featureType:"landscape",elementType:"all",stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100},{visibility:"simplified"}]},{featureType:"poi",elementType:"all",stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100},{visibility:"off"}]},{featureType:"road",elementType:"geometry",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:31},{visibility:"simplified"}]},{featureType:"road",elementType:"labels",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:31},{visibility:"on"}]},{featureType:"road.arterial",elementType:"labels",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:-2},{visibility:"simplified"}]},{featureType:"road.local",elementType:"geometry",stylers:[{hue:"#e9ebed"},{saturation:-90},{lightness:-8},{visibility:"simplified"}]},{featureType:"transit",elementType:"all",stylers:[{hue:"#e9ebed"},{saturation:10},{lightness:69},{visibility:"on"}]},{featureType:"water",elementType:"all",stylers:[{hue:"#e9ebed"},{saturation:-78},{lightness:67},{visibility:"simplified"}]}]},function(e,t){"use strict";e.exports=[{featureType:"all",elementType:"labels.text.fill",stylers:[{color:"#ffffff"}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{color:"#000000"},{lightness:13}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#144b53"},{lightness:14},{weight:1.4}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#08304b"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#0c4152"},{lightness:5}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#0b434f"},{lightness:25}]},{featureType:"road.arterial",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.arterial",elementType:"geometry.stroke",stylers:[{color:"#0b3d51"},{lightness:16}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#000000"}]},{featureType:"transit",elementType:"all",stylers:[{color:"#146474"}]},{featureType:"water",elementType:"all",stylers:[{color:"#021019"}]}]},function(e,t){"use strict";e.exports=[{featureType:"water",stylers:[{saturation:43},{lightness:-11},{hue:"#0088ff"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{hue:"#ff0000"},{saturation:-100},{lightness:99}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#808080"},{lightness:54}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{color:"#ece2d9"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#ccdca1"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#767676"}]},{featureType:"road",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]},{featureType:"poi",stylers:[{visibility:"off"}]},{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#b8cb93"}]},{featureType:"poi.park",stylers:[{visibility:"on"}]},{featureType:"poi.sports_complex",stylers:[{visibility:"on"}]},{featureType:"poi.medical",stylers:[{visibility:"on"}]},{featureType:"poi.business",stylers:[{visibility:"simplified"}]}]},function(e,t){"use strict";e.exports=[{elementType:"geometry",stylers:[{hue:"#ff4400"},{saturation:-68},{lightness:-4},{gamma:.72}]},{featureType:"road",elementType:"labels.icon"},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{hue:"#0077ff"},{gamma:3.1}]},{featureType:"water",stylers:[{hue:"#00ccff"},{gamma:.44},{saturation:-33}]},{featureType:"poi.park",stylers:[{hue:"#44ff00"},{saturation:-23}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{hue:"#007fff"},{gamma:.77},{saturation:65},{lightness:99}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{gamma:.11},{weight:5.6},{saturation:99},{hue:"#0091ff"},{lightness:-86}]},{featureType:"transit.line",elementType:"geometry",stylers:[{lightness:-48},{hue:"#ff5e00"},{gamma:1.2},{saturation:-23}]},{featureType:"transit",elementType:"labels.text.stroke",stylers:[{saturation:-64},{hue:"#ff9100"},{lightness:16},{gamma:.47},{weight:2.7}]}]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n=0&&e.end>=0&&""!==e.location){var n;t=o({},this.type,(n={},o(n,this.props.appbaseField,e.location),o(n,"from",e.start+this.unit),o(n,"to",e.end+this.unit),n))}return t}},{key:"getCoordinates",value:function(e,t){var n=this;e&&""!==e?m["default"].get("https://maps.googleapis.com/maps/api/geocode/json?address="+e).then(function(e){var r=e.data.results[0].geometry.location;n.locString=r.lat+", "+r.lng,t?t.call(n,n.defaultSelected.label):n.executeQuery()}):p.AppbaseSensorHelper.selectedSensor.set(null,!0)}},{key:"executeQuery",value:function(){if(""!==this.state.currentValue&&this.state.selected&&this.locString){var e,t={key:this.props.componentId,value:{currentValue:this.state.currentValue,start:this.state.selected.start,end:this.state.selected.end,location:this.locString,unit:this.unit}},n={key:this.props.componentId,value:o({},this.sortInfo.type,(e={},o(e,this.props.appbaseField,this.locString),o(e,"order",this.sortInfo.order),o(e,"unit",this.unit),e))};this.props.onValueChange&&this.props.onValueChange(t.value),p.AppbaseSensorHelper.selectedSensor.setSortInfo(n),p.AppbaseSensorHelper.URLParams.update(this.props.componentId,this.setURLValue(),this.props.URLParams),p.AppbaseSensorHelper.selectedSensor.set(t,!0)}}},{key:"setURLValue",value:function(){return JSON.stringify({location:this.state.currentValue,label:this.state.selected.label})}},{key:"handleChange",value:function(e){if(e){var t=e.value;this.setState({currentValue:t}),this.getCoordinates(t)}else{this.setState({currentValue:""});var n={key:this.props.componentId,value:null};this.props.onValueChange&&this.props.onValueChange(n.value),p.AppbaseSensorHelper.URLParams.update(this.props.componentId,null,this.props.URLParams),p.AppbaseSensorHelper.selectedSensor.set(n,!0)}}},{key:"loadOptions",value:function(e,t){var n=this;if(this.callback=t,e){var r=this.googleMaps||window.google.maps;this.autocompleteService=new r.places.AutocompleteService;var o={input:e};this.result={options:[]},this.autocompleteService.getPlacePredictions(o,function(e){e.forEach(function(e){n.result.options.push({label:e.description,value:e.description})}),n.state.userLocation.length&&"Use my current location"!==n.result.options[0].label&&n.result.options.unshift({label:"Use my current location",value:n.state.userLocation}),n.callback(null,n.result)})}else this.callback(null,this.result)}},{key:"handleDistanceChange",value:function(e){this.setState({selected:{start:e.start,end:e.end,label:e.label}},this.executeQuery.bind(this))}},{key:"renderValue",value:function(e){return c["default"].createElement("span",null,e.value)}},{key:"render",value:function(){var e=null;this.props.title&&(e=c["default"].createElement("h4",{className:"rbc-title"},this.props.title));var t=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return c["default"].createElement("div",{className:"rbc rbc-geodistancedropdown clearfix card thumbnail col s12 col-xs-12 "+t,style:this.props.componentStyle},c["default"].createElement("div",{className:"row"},e,c["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},c["default"].createElement(v["default"].Async,{value:this.state.currentValue,loadOptions:this.loadOptions,placeholder:this.props.placeholder,onChange:this.handleChange,filterOption:function(){return!0},valueRenderer:this.renderValue})),c["default"].createElement("div",{className:"col s12 col-xs-12"},c["default"].createElement(v["default"],{value:this.state.selected.label?this.state.selected:"",options:this.props.data,clearable:!1,searchable:!1,onChange:this.handleDistanceChange,placeholder:this.props.placeholderDropdown}))))}}]),t}(l.Component);t["default"]=_,_.propTypes={componentId:c["default"].PropTypes.string.isRequired,appbaseField:c["default"].PropTypes.string.isRequired,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]), customQuery:c["default"].PropTypes.func,defaultSelected:c["default"].PropTypes.shape({label:c["default"].PropTypes.string,location:c["default"].PropTypes.string}),placeholder:c["default"].PropTypes.string,placeholderDropdown:c["default"].PropTypes.string,autoLocation:c["default"].PropTypes.bool,unit:c["default"].PropTypes.oneOf(["mi","miles","yd","yards","ft","feet","in","inch","km","kilometers","m","meters","cm","centimeters","mm","millimeters","NM","nmi","nauticalmiles"]),data:c["default"].PropTypes.arrayOf(c["default"].PropTypes.shape({start:p.AppbaseSensorHelper.validateThreshold,end:p.AppbaseSensorHelper.validateThreshold,label:c["default"].PropTypes.string.isRequired})),onValueChange:c["default"].PropTypes.func,componentStyle:c["default"].PropTypes.object,URLParams:c["default"].PropTypes.bool},_.defaultProps={unit:"mi",placeholder:"Search...",placeholderDropdown:"Select Distance",autoLocation:!0,componentStyle:{},URLParams:!1},_.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n>8-a%1*8)){if(o=t.charCodeAt(a+=.75),o>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|o}return s}),n.atob||(n.atob=function(t){if(t=t.replace(/=+$/,""),t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,s="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?s+=String.fromCharCode(255&n>>(-2*a&6)):0)o=r.indexOf(o);return s})}()},function(e,t){"use strict";function n(){return!1}function r(){return!0}function o(){this.timeStamp=Date.now(),this.target=void 0,this.currentTarget=void 0}Object.defineProperty(t,"__esModule",{value:!0}),o.prototype={isEventObject:1,constructor:o,isDefaultPrevented:n,isPropagationStopped:n,isImmediatePropagationStopped:n,preventDefault:function(){this.isDefaultPrevented=r},stopPropagation:function(){this.isPropagationStopped=r},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=r,this.stopPropagation()},halt:function(e){e?this.stopImmediatePropagation():this.stopPropagation(),this.preventDefault()}},t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return null===e||void 0===e}function a(){return d}function i(){return f}function s(e){var t=e.type,n="function"==typeof e.stopPropagation||"boolean"==typeof e.cancelBubble;l["default"].call(this),this.nativeEvent=e;var r=i;"defaultPrevented"in e?r=e.defaultPrevented?a:i:"getPreventDefault"in e?r=e.getPreventDefault()?a:i:"returnValue"in e&&(r=e.returnValue===f?a:i),this.isDefaultPrevented=r;var o=[],s=void 0,u=void 0,c=void 0,p=h.concat();for(m.forEach(function(e){t.match(e.reg)&&(p=p.concat(e.props),e.fix&&o.push(e.fix))}),u=p.length;u;)c=p[--u],this[c]=e[c];for(!this.target&&n&&(this.target=e.srcElement||document),this.target&&3===this.target.nodeType&&(this.target=this.target.parentNode),u=o.length;u;)(s=o[--u])(this,e);this.timeStamp=e.timeStamp||Date.now()}Object.defineProperty(t,"__esModule",{value:!0});var u=n(411),l=r(u),c=n(9),p=r(c),d=!0,f=!1,h=["altKey","bubbles","cancelable","ctrlKey","currentTarget","eventPhase","metaKey","shiftKey","target","timeStamp","view","type"],m=[{reg:/^key/,props:["char","charCode","key","keyCode","which"],fix:function(e,t){o(e.which)&&(e.which=o(t.charCode)?t.keyCode:t.charCode),void 0===e.metaKey&&(e.metaKey=e.ctrlKey)}},{reg:/^touch/,props:["touches","changedTouches","targetTouches"]},{reg:/^hashchange$/,props:["newURL","oldURL"]},{reg:/^gesturechange$/i,props:["rotation","scale"]},{reg:/^(mousewheel|DOMMouseScroll)$/,props:[],fix:function(e,t){var n=void 0,r=void 0,o=void 0,a=t.wheelDelta,i=t.axis,s=t.wheelDeltaY,u=t.wheelDeltaX,l=t.detail;a&&(o=a/120),l&&(o=0-(l%3===0?l/3:l)),void 0!==i&&(i===e.HORIZONTAL_AXIS?(r=0,n=0-o):i===e.VERTICAL_AXIS&&(n=0,r=o)),void 0!==s&&(r=s/120),void 0!==u&&(n=-1*u/120),n||r||(r=o),void 0!==n&&(e.deltaX=n),void 0!==r&&(e.deltaY=r),void 0!==o&&(e.delta=o)}},{reg:/^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,props:["buttons","clientX","clientY","button","offsetX","relatedTarget","which","fromElement","toElement","offsetY","pageX","pageY","screenX","screenY"],fix:function(e,t){var n=void 0,r=void 0,a=void 0,i=e.target,s=t.button;return i&&o(e.pageX)&&!o(t.clientX)&&(n=i.ownerDocument||document,r=n.documentElement,a=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||a&&a.scrollLeft||0)-(r&&r.clientLeft||a&&a.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||a&&a.scrollTop||0)-(r&&r.clientTop||a&&a.clientTop||0)),e.which||void 0===s||(1&s?e.which=1:2&s?e.which=3:4&s?e.which=2:e.which=0),!e.relatedTarget&&e.fromElement&&(e.relatedTarget=e.fromElement===i?e.toElement:e.fromElement),e}}],y=l["default"].prototype;(0,p["default"])(s.prototype,y,{constructor:s,preventDefault:function(){var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=f,y.preventDefault.call(this)},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=d,y.stopPropagation.call(this)}}),t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){function r(t){var r=new i["default"](t);n.call(e,r)}return e.addEventListener?(e.addEventListener(t,r,!1),{remove:function(){e.removeEventListener(t,r,!1)}}):e.attachEvent?(e.attachEvent("on"+t,r),{remove:function(){e.detachEvent("on"+t,r)}}):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var a=n(412),i=r(a);e.exports=t["default"]},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;var o=t.type,a=t.body;delete t.type,delete t.body;var i;return i=o?o+"/_bulk":"/_bulk",e.performStreamingRequest({method:"POST",path:i,params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;delete t.type,delete t.id;var i=o+"/"+a;return e.performStreamingRequest({method:"DELETE",path:i,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;delete t.type,delete t.id;var i=o+"/"+a;return e.performStreamingRequest({method:"GET",path:i,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(140),o=function(e){var t=r.obj(function(e,t,n){var r=Object.keys(e)[0],o=Object.keys(e[r].mappings).filter(function(e){return"_default_"!==e});this.push(o),n()});return t.writable=!1,e.performStreamingRequest({method:"GET",path:"_mapping"}).pipe(t)};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",body:"object"});if(n!==!0)throw n;var o=t.type,a=t.id,i=t.body;delete t.type,delete t.id,delete t.body;var s;return s=a?o+"/"+a:o,e.performStreamingRequest({method:"POST",path:s,params:t,body:i})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;var o;o=t.type.constructor===Array?t.type.join():t.type;var a=t.body;delete t.type,delete t.body;var i;return i=o?o+"/_search":"/_search",e.performStreamingRequest({method:"POST",path:i,params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;return delete t.type,delete t.id,delete t.stream,t.stream===!0||"true"===t.stream?t.stream="true":(delete t.stream,t.streamonly="true"),e.performWsRequest({method:"GET",path:o+"/"+a,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;if(void 0===t.type||"string"!=typeof t.type&&t.type.constructor!==Array||""===t.type||0===t.type.length)throw new Error("fields missing: type");var o;o=t.type.constructor===Array?t.type.join():t.type;var o=t.type,a=t.body;return delete t.type,delete t.body,delete t.stream,t.streamonly="true",e.performWsRequest({method:"POST",path:o+"/_search",params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string",body:"object"});if(n!==!0)throw n;var o=t.type,a=t.id,i=t.body;delete t.type,delete t.id,delete t.body;var s=o+"/"+a+"/_update";return e.performStreamingRequest({method:"POST",path:s,params:t,body:i})};e.exports=o},function(e,t,n){"use strict";var r=n(565),o=n(34),a=function(e,t,n){var a=o.validate(t,{body:"object"});if(a!==!0)throw a;if(void 0===t.type||"string"!=typeof t.type&&t.type.constructor!==Array||""===t.type||0===t.type.length)throw new Error("fields missing: type");if(a=o.validate(t.body,{query:"object"}),a!==!0)throw a;if(t.type.constructor===Array?(this.type=t.type,this.type_string=t.type.join()):(this.type=[t.type],this.type_string=t.type),this.webhooks=[],this.client=e,this.query=t.body.query,"string"==typeof n){var i={};i.url=n,i.method="GET",this.webhooks.push(i)}else if(n.constructor===Array)this.webhooks=n;else{if(n!==Object(n))throw new Error("fields missing: second argument(webhook) is necessary");this.webhooks.push(n)}this.populateBody();var s=btoa(r(this.query)),u=".percolator/webhooks-0-"+this.type_string+"-0-"+s;return this.path=u,this.performRequest("POST")};a.prototype.populateBody=function(){this.body={},this.body.webhooks=this.webhooks,this.body.query=this.query,this.body.type=this.type},a.prototype.performRequest=function(e){var t=this.client.performStreamingRequest({method:e,path:this.path,body:this.body});return t.change=this.change.bind(this),t.stop=this.stop.bind(this),t},a.prototype.change=function(e){if(this.webhooks=[],"string"==typeof e){var t={};t.url=e,t.method="POST",this.webhooks.push(t)}else if(e.constructor===Array)this.webhooks=e;else{if(e!==Object(e))throw new Error("fields missing: one of webhook or url fields is required");this.webhooks.push(e)}return this.populateBody(),this.performRequest("POST")},a.prototype.stop=function(){return delete this.body,this.performRequest("DELETE")},e.exports=a},function(e,t,n){"use strict";var r=n(142),o=n(425),a=n(426),i=n(427),s=n(418),u=n(416),l=n(422),c=n(415),p=n(414),d=n(419),f=n(417),h=n(423),m=n(420),y=n(421),v=function g(e){if(!(this instanceof g))return new g(e);if("string"!=typeof e.url||""===e.url)throw new Error("URL not present in options.");var t=r.parse(e.url);if(this.url=t.host,this.protocol=t.protocol,this.credentials=t.auth,this.appname=e.appname||e.app,"string"!=typeof this.appname||""===this.appname)throw new Error("App name is not present in options.");if("string"!=typeof this.protocol||""===this.protocol)throw new Error("Protocol is not present in url. URL should be of the form https://scalr.api.appbase.io");if("string"==typeof e.username&&""!==e.username&&"string"==typeof e.password&&""!==e.password&&(this.credentials=e.username+":"+e.password),"string"==typeof e.credentials&&""!==e.credentials&&(this.credentials=e.credentials),"string"!=typeof this.credentials||""===this.credentials)throw new Error("Authentication information is not present. Did you add credentials?");"https:"===t.protocol?this.ws=new o("wss://"+t.host+"/"+this.appname):this.ws=new o("ws://"+t.host+"/"+this.appname),"/"===this.url.slice(-1)&&(this.url=this.url.slice(0,-1));var n={};return n.index=this.index.bind(this),n.get=this.get.bind(this),n.update=this.update.bind(this),n["delete"]=this["delete"].bind(this),n.bulk=this.bulk.bind(this),n.search=this.search.bind(this),n.getStream=this.getStream.bind(this),n.searchStream=this.searchStream.bind(this),n.searchStreamToURL=this.searchStreamToURL.bind(this),n.getTypes=this.getTypes.bind(this),n};v.prototype.performWsRequest=function(e){return new i(this,JSON.parse(JSON.stringify(e)))},v.prototype.performStreamingRequest=function(e){return new a(this,JSON.parse(JSON.stringify(e)))},v.prototype.index=function(e){return new s(this,JSON.parse(JSON.stringify(e)))},v.prototype.get=function(e){return new u(this,JSON.parse(JSON.stringify(e)))},v.prototype.update=function(e){return new l(this,JSON.parse(JSON.stringify(e)))},v.prototype["delete"]=function(e){return new c(this,JSON.parse(JSON.stringify(e)))},v.prototype.bulk=function(e){return new p(this,JSON.parse(JSON.stringify(e)))},v.prototype.search=function(e){return new d(this,JSON.parse(JSON.stringify(e)))},v.prototype.getStream=function(e){return new m(this,JSON.parse(JSON.stringify(e)))},v.prototype.searchStream=function(e){return new y(this,JSON.parse(JSON.stringify(e)))},v.prototype.searchStreamToURL=function(e,t){return new h(this,JSON.parse(JSON.stringify(e)),JSON.parse(JSON.stringify(t)))},v.prototype.getTypes=function(){return new f(this)},"undefined"!=typeof window&&(window.Appbase=v),e.exports=v},function(e,t,n){"use strict";var r="undefined"!=typeof window?window.WebSocket:n(748),o=n(36).EventEmitter,a=function(e){var t=new r(e),n=new o;return n.setMaxListeners(0),n.send=function(e){return 1===t.readyState?(t.send(JSON.stringify(e)),this):void n.on("open",function r(){t.send(JSON.stringify(e)),n.removeListener("open",r)})},t.onopen=function(){n.emit("open")},t.onmessage=function(e){var t=JSON.parse(e.data);n.emit("message",t)},t.onerror=function(e){n.emit("error",e)},t.onclose=function(e){n.emit("close",e)},n};e.exports=a},function(e,t,n){(function(t){"use strict";var r=n(553),o=n(733),a=n(113),i=n(140),s=function(e,t){if(this.client=e,this.args=t,this.method=t.method,this.path=t.path,this.params=t.params,this.body=t.body,(!this.body||"object"!=typeof this.body&&this.body.constructor!==Array)&&(this.body={}),this.body.constructor===Array){var n=this.body;this.body="";for(var r=0;r=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;ts.bottom||i.topt.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var n=this,r="object"==typeof t?t:this.props;if(r.multi){if("string"==typeof e&&(e=e.split(r.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return n.expandValue(e,r)}).filter(function(e){return e})}var o=this.expandValue(e,r);return o?[o]:[]},expandValue:function(e,t){var n=typeof e;if("string"!==n&&"number"!==n&&"boolean"!==n)return e;var r=t.options,o=t.valueKey;if(r)for(var a=0;ar&&this.focusOption(n[r+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var n=-1,r=0;r0?n-=1:n=t.length-1;else if("start"===e)n=0;else if("end"===e)n=t.length-1;else if("page_up"===e){var o=n-this.props.pageSize;n=o<0?0:o}else if("page_down"===e){var o=n+this.props.pageSize;n=o>t.length-1?t.length-1:o}n===-1&&(n=0),this.setState({focusedIndex:t[n].index,focusedOption:t[n].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return l["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},l["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var n=this,r=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:l["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var a=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return l["default"].createElement(o,{id:n._instancePrefix+"-value-"+t,instancePrefix:n._instancePrefix,disabled:n.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[n.props.valueKey],onClick:a,onRemove:n.removeValue,value:e},r(e,t),l["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(a=null),l["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:a,value:e[0]},r(e[0])))},renderInput:function(e,t){var n,r=this,i=(0,m["default"])("Select-input",this.props.inputProps.className),u=!!this.state.isOpen,c=(0,m["default"])((n={},a(n,this._instancePrefix+"-list",u),a(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),p=s({},this.props.inputProps,{role:"combobox","aria-expanded":""+u,"aria-owns":c,"aria-haspopup":""+u,"aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:i,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(p);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,h=(d.inputClassName,o(d,["inputClassName"]));return l["default"].createElement("div",s({},h,{role:"combobox","aria-expanded":u,"aria-owns":u?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:i,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?l["default"].createElement(f["default"],s({},p,{minWidth:"5"})):l["default"].createElement("div",{className:i},l["default"].createElement("input",p))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return l["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,n=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return l["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},n)},filterOptions:function N(e){var t=this.state.inputValue,n=this.props.options||[];if(this.props.filterOptions){var N="function"==typeof this.props.filterOptions?this.props.filterOptions:_["default"];return N(n,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return n},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,n){return e&&e.length?this.props.menuRenderer({focusedOption:n,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?l["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var n=e.map(function(e){return i(e[t.props.valueKey])}).join(this.props.delimiter);return l["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:n,disabled:this.props.disabled})}return e.map(function(e,n){return l["default"].createElement("input",{key:"hidden."+n,type:"hidden",ref:"value"+n,name:t.props.name,value:i(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var n=this.state.focusedOption||e;if(n&&!n.disabled){var r=t.indexOf(n);if(r!==-1)return r}for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c){var d={startTime:(new Date).getTime(),appliedQuery:u},f=this.appbaseRef[t];if(f){var h=u;h.type="*"===this.type[t]?"":this.type[t],h.preference=this.app[t],n(d),f.search(h).on("data",function(e){d.mode="historic",d.data=o.highlightModify(e,d.appliedQuery),i.emitter.emit(t,d);var n=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:d,react:s.react,queryOptions:n})}).on("error",function(e){var n={appliedQuery:d.appliedQuery,error:e,startTime:d.startTime};i.emitter.emit(t,n)}),s.stream&&r.call(this,t,u,f)}else console.error("appbaseRef is not set for "+t)}else{var m={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,m)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t){"use strict";function n(e,t){for(var n=[],r={object:null,string:""},o=Object.keys(t),a=o,i=Array.isArray(a),s=0,a=i?a:a[Symbol.iterator]();;){var u;if(i){if(s>=a.length)break;u=a[s++]}else{if(s=a.next(),s.done)break;u=s.value}var l=u,c=t[l];typeof e[l]===c&&e[l]!==r[c]||n.push(l)}for(var p="",d=0;d0)||new Error("fields missing: "+p)}e.exports={validate:n}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],i(n))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:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,u=0;u0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n), +"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e){var t=typeof e;return"string"===t?e:"object"===t?JSON.stringify(e):"number"===t||"boolean"===t?String(e):""}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;ts.bottom||i.topt.offsetHeight&&!(t.scrollHeight-t.offsetHeight-t.scrollTop)&&this.props.onMenuScrollToBottom()}},handleRequired:function(e,t){return!e||(t?0===e.length:0===Object.keys(e).length)},getOptionLabel:function(e){return e[this.props.labelKey]},getValueArray:function(e,t){var n=this,r="object"==typeof t?t:this.props;if(r.multi){if("string"==typeof e&&(e=e.split(r.delimiter)),!Array.isArray(e)){if(null===e||void 0===e)return[];e=[e]}return e.map(function(e){return n.expandValue(e,r)}).filter(function(e){return e})}var o=this.expandValue(e,r);return o?[o]:[]},expandValue:function(e,t){var n=typeof e;if("string"!==n&&"number"!==n&&"boolean"!==n)return e;var r=t.options,o=t.valueKey;if(r)for(var a=0;ar&&this.focusOption(n[r+1])},popValue:function(){var e=this.getValueArray(this.props.value);e.length&&e[e.length-1].clearableValue!==!1&&this.setValue(e.slice(0,e.length-1))},removeValue:function(e){var t=this.getValueArray(this.props.value);this.setValue(t.filter(function(t){return t!==e})),this.focus()},clearValue:function(e){e&&"mousedown"===e.type&&0!==e.button||(e.stopPropagation(),e.preventDefault(),this.setValue(this.getResetValue()),this.setState({isOpen:!1,inputValue:""},this.focus))},getResetValue:function(){return void 0!==this.props.resetValue?this.props.resetValue:this.props.multi?[]:null},focusOption:function(e){this.setState({focusedOption:e})},focusNextOption:function(){this.focusAdjacentOption("next")},focusPreviousOption:function(){this.focusAdjacentOption("previous")},focusPageUpOption:function(){this.focusAdjacentOption("page_up")},focusPageDownOption:function(){this.focusAdjacentOption("page_down")},focusStartOption:function(){this.focusAdjacentOption("start")},focusEndOption:function(){this.focusAdjacentOption("end")},focusAdjacentOption:function(e){var t=this._visibleOptions.map(function(e,t){return{option:e,index:t}}).filter(function(e){return!e.option.disabled});if(this._scrollToFocusedOptionOnUpdate=!0,!this.state.isOpen)return void this.setState({isOpen:!0,inputValue:"",focusedOption:this._focusedOption||(t.length?t["next"===e?0:t.length-1].option:null)});if(t.length){for(var n=-1,r=0;r0?n-=1:n=t.length-1;else if("start"===e)n=0;else if("end"===e)n=t.length-1;else if("page_up"===e){var o=n-this.props.pageSize;n=o<0?0:o}else if("page_down"===e){var o=n+this.props.pageSize;n=o>t.length-1?t.length-1:o}n===-1&&(n=0),this.setState({focusedIndex:t[n].index,focusedOption:t[n].option})}},getFocusedOption:function(){return this._focusedOption},getInputValue:function(){return this.state.inputValue},selectFocusedOption:function(){if(this._focusedOption)return this.selectValue(this._focusedOption)},renderLoading:function(){if(this.props.isLoading)return l["default"].createElement("span",{className:"Select-loading-zone","aria-hidden":"true"},l["default"].createElement("span",{className:"Select-loading"}))},renderValue:function(e,t){var n=this,r=this.props.valueRenderer||this.getOptionLabel,o=this.props.valueComponent;if(!e.length)return this.state.inputValue?null:l["default"].createElement("div",{className:"Select-placeholder"},this.props.placeholder);var a=this.props.onValueClick?this.handleValueClick:null;return this.props.multi?e.map(function(e,t){return l["default"].createElement(o,{id:n._instancePrefix+"-value-"+t,instancePrefix:n._instancePrefix,disabled:n.props.disabled||e.clearableValue===!1,key:"value-"+t+"-"+e[n.props.valueKey],onClick:a,onRemove:n.removeValue,value:e},r(e,t),l["default"].createElement("span",{className:"Select-aria-only"}," "))}):this.state.inputValue?void 0:(t&&(a=null),l["default"].createElement(o,{id:this._instancePrefix+"-value-item",disabled:this.props.disabled,instancePrefix:this._instancePrefix,onClick:a,value:e[0]},r(e[0])))},renderInput:function(e,t){var n,r=this,i=(0,m["default"])("Select-input",this.props.inputProps.className),u=!!this.state.isOpen,c=(0,m["default"])((n={},a(n,this._instancePrefix+"-list",u),a(n,this._instancePrefix+"-backspace-remove-message",this.props.multi&&!this.props.disabled&&this.state.isFocused&&!this.state.inputValue),n)),p=s({},this.props.inputProps,{role:"combobox","aria-expanded":""+u,"aria-owns":c,"aria-haspopup":""+u,"aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value","aria-labelledby":this.props["aria-labelledby"],"aria-label":this.props["aria-label"],className:i,tabIndex:this.props.tabIndex,onBlur:this.handleInputBlur,onChange:this.handleInputChange,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},required:this.state.required,value:this.state.inputValue});if(this.props.inputRenderer)return this.props.inputRenderer(p);if(this.props.disabled||!this.props.searchable){var d=this.props.inputProps,h=(d.inputClassName,o(d,["inputClassName"]));return l["default"].createElement("div",s({},h,{role:"combobox","aria-expanded":u,"aria-owns":u?this._instancePrefix+"-list":this._instancePrefix+"-value","aria-activedescendant":u?this._instancePrefix+"-option-"+t:this._instancePrefix+"-value",className:i,tabIndex:this.props.tabIndex||0,onBlur:this.handleInputBlur,onFocus:this.handleInputFocus,ref:function(e){return r.input=e},"aria-readonly":""+!!this.props.disabled,style:{border:0,width:1,display:"inline-block"}}))}return this.props.autosize?l["default"].createElement(f["default"],s({},p,{minWidth:"5"})):l["default"].createElement("div",{className:i},l["default"].createElement("input",p))},renderClear:function(){if(this.props.clearable&&this.props.value&&0!==this.props.value&&(!this.props.multi||this.props.value.length)&&!this.props.disabled&&!this.props.isLoading){var e=this.props.clearRenderer();return l["default"].createElement("span",{className:"Select-clear-zone",title:this.props.multi?this.props.clearAllText:this.props.clearValueText,"aria-label":this.props.multi?this.props.clearAllText:this.props.clearValueText,onMouseDown:this.clearValue,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEndClearValue},e)}},renderArrow:function(){var e=this.handleMouseDownOnArrow,t=this.state.isOpen,n=this.props.arrowRenderer({onMouseDown:e,isOpen:t});return l["default"].createElement("span",{className:"Select-arrow-zone",onMouseDown:e},n)},filterOptions:function N(e){var t=this.state.inputValue,n=this.props.options||[];if(this.props.filterOptions){var N="function"==typeof this.props.filterOptions?this.props.filterOptions:_["default"];return N(n,t,e,{filterOption:this.props.filterOption,ignoreAccents:this.props.ignoreAccents,ignoreCase:this.props.ignoreCase,labelKey:this.props.labelKey,matchPos:this.props.matchPos,matchProp:this.props.matchProp,valueKey:this.props.valueKey})}return n},onOptionRef:function(e,t){t&&(this.focused=e)},renderMenu:function(e,t,n){return e&&e.length?this.props.menuRenderer({focusedOption:n,focusOption:this.focusOption,instancePrefix:this._instancePrefix,labelKey:this.props.labelKey,onFocus:this.focusOption,onSelect:this.selectValue,optionClassName:this.props.optionClassName,optionComponent:this.props.optionComponent,optionRenderer:this.props.optionRenderer||this.getOptionLabel,options:e,selectValue:this.selectValue,valueArray:t,valueKey:this.props.valueKey,onOptionRef:this.onOptionRef}):this.props.noResultsText?l["default"].createElement("div",{className:"Select-noresults"},this.props.noResultsText):null},renderHiddenField:function(e){var t=this;if(this.props.name){if(this.props.joinValues){var n=e.map(function(e){return i(e[t.props.valueKey])}).join(this.props.delimiter);return l["default"].createElement("input",{type:"hidden",ref:function(e){return t.value=e},name:this.props.name,value:n,disabled:this.props.disabled})}return e.map(function(e,n){return l["default"].createElement("input",{key:"hidden."+n,type:"hidden",ref:"value"+n,name:t.props.name,value:i(e[t.props.valueKey]),disabled:t.props.disabled})})}},getFocusableOptionIndex:function(e){var t=this._visibleOptions;if(!t.length)return null;var n=this.state.focusedOption||e;if(n&&!n.disabled){var r=t.indexOf(n);if(r!==-1)return r}for(var o=0;o2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c)!function(){var e={startTime:(new Date).getTime(),appliedQuery:u},a=o.appbaseRef[t];if(a){var l=u;l.type="*"===o.type[t]?"":o.type[t],l.preference=o.app[t],n(e),a.search(l).on("data",function(n){e.mode="historic",e.data=o.highlightModify(n,e.appliedQuery),i.emitter.emit(t,e);var r=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:e,react:s.react,queryOptions:r})}).on("error",function(n){var r={appliedQuery:e.appliedQuery,error:n,startTime:e.startTime};i.emitter.emit(t,r)}),s.stream&&r.call(o,t,u,a)}else console.error("appbaseRef is not set for "+t)}();else{var d={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,d)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t){"use strict";function n(e,t){for(var n=[],r={object:null,string:""},o=Object.keys(t),a=o,i=Array.isArray(a),s=0,a=i?a:a[Symbol.iterator]();;){var u;if(i){if(s>=a.length)break;u=a[s++]}else{if(s=a.next(),s.done)break;u=s.value}var l=u,c=t[l];typeof e[l]===c&&e[l]!==r[c]||n.push(l)}for(var p="",d=0;d0)||new Error("fields missing: "+p)}e.exports={validate:n}},function(e,t){var n=e.exports={version:"2.4.0"};"number"==typeof __e&&(__e=n)},function(e,t){function n(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function r(e){return"function"==typeof e}function o(e){return"number"==typeof e}function a(e){return"object"==typeof e&&null!==e}function i(e){return void 0===e}e.exports=n,n.EventEmitter=n,n.prototype._events=void 0,n.prototype._maxListeners=void 0,n.defaultMaxListeners=10,n.prototype.setMaxListeners=function(e){if(!o(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},n.prototype.emit=function(e){var t,n,o,s,u,l;if(this._events||(this._events={}),"error"===e&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(t=arguments[1],t instanceof Error)throw t;var c=new Error('Uncaught, unspecified "error" event. ('+t+")");throw c.context=t,c}if(n=this._events[e],i(n))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:s=Array.prototype.slice.call(arguments,1),n.apply(this,s)}else if(a(n))for(s=Array.prototype.slice.call(arguments,1),l=n.slice(),o=l.length,u=0;u0&&this._events[e].length>o&&(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},n.prototype.on=n.prototype.addListener,n.prototype.once=function(e,t){function n(){this.removeListener(e,n), o||(o=!0,t.apply(this,arguments))}if(!r(t))throw TypeError("listener must be a function");var o=!1;return n.listener=t,this.on(e,n),this},n.prototype.removeListener=function(e,t){var n,o,i,s;if(!r(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;if(n=this._events[e],i=n.length,o=-1,n===t||r(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit("removeListener",e,t);else if(a(n)){for(s=i;s-- >0;)if(n[s]===t||n[s].listener&&n[s].listener===t){o=s;break}if(o<0)return this;1===n.length?(n.length=0,delete this._events[e]):n.splice(o,1),this._events.removeListener&&this.emit("removeListener",e,t)}return this},n.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(n=this._events[e],r(n))this.removeListener(e,n);else if(n)for(;n.length;)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},n.prototype.listeners=function(e){var t;return t=this._events&&this._events[e]?r(this._events[e])?[this._events[e]]:this._events[e].slice():[]},n.prototype.listenerCount=function(e){if(this._events){var t=this._events[e];if(r(t))return 1;if(t)return t.length}return 0},n.listenerCount=function(e,t){return e.listenerCount(t)}},function(e,t,n){"use strict";function r(e,t,n,r){this.dispatchConfig=e,this._targetInst=t,this.nativeEvent=n;var o=this.constructor.Interface;for(var a in o)if(o.hasOwnProperty(a)){var s=o[a];s?this[a]=s(n):"target"===a?this.target=r:this[a]=n[a]}var u=null!=n.defaultPrevented?n.defaultPrevented:n.returnValue===!1;return u?this.isDefaultPrevented=i.thatReturnsTrue:this.isDefaultPrevented=i.thatReturnsFalse,this.isPropagationStopped=i.thatReturnsFalse,this}var o=n(9),a=n(47),i=n(25),s=(n(5),"function"==typeof Proxy,["dispatchConfig","_targetInst","nativeEvent","isDefaultPrevented","isPropagationStopped","_dispatchListeners","_dispatchInstances"]),u={type:null,target:null,currentTarget:i.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};o(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var e=this.nativeEvent;e&&(e.preventDefault?e.preventDefault():"unknown"!=typeof e.returnValue&&(e.returnValue=!1),this.isDefaultPrevented=i.thatReturnsTrue)},stopPropagation:function(){var e=this.nativeEvent;e&&(e.stopPropagation?e.stopPropagation():"unknown"!=typeof e.cancelBubble&&(e.cancelBubble=!0),this.isPropagationStopped=i.thatReturnsTrue)},persist:function(){this.isPersistent=i.thatReturnsTrue},isPersistent:i.thatReturnsFalse,destructor:function(){var e=this.constructor.Interface;for(var t in e)this[t]=null;for(var n=0;n=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n-1)return!1;if(r.filterOption)return r.filterOption.call(o,e,t);if(!t)return!0;var a=String(e[r.valueKey]),s=String(e[r.labelKey]);return r.ignoreAccents&&("label"!==r.matchProp&&(a=(0,i["default"])(a)),"value"!==r.matchProp&&(s=(0,i["default"])(s))),r.ignoreCase&&("label"!==r.matchProp&&(a=a.toLowerCase()),"value"!==r.matchProp&&(s=s.toLowerCase())),"start"===r.matchPos?"label"!==r.matchProp&&a.substr(0,t.length)===t||"value"!==r.matchProp&&s.substr(0,t.length)===t:"label"!==r.matchProp&&a.indexOf(t)>=0||"value"!==r.matchProp&&s.indexOf(t)>=0})}var a=n(350),i=r(a);e.exports=o},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){var t=e.focusedOption,n=e.instancePrefix,r=(e.labelKey,e.onFocus),o=e.onSelect,a=e.optionClassName,s=e.optionComponent,l=e.optionRenderer,c=e.options,p=e.valueArray,d=e.valueKey,f=e.onOptionRef,h=s;return c.map(function(e,s){var c=p&&p.indexOf(e)>-1,m=e===t,y=(0,i["default"])(a,{"Select-option":!0,"is-selected":c,"is-focused":m,"is-disabled":e.disabled});return u["default"].createElement(h,{className:y,instancePrefix:n,isDisabled:e.disabled,isFocused:m,isSelected:c,key:"option-"+s+"-"+e[d],onFocus:r,onSelect:o,option:e,optionIndex:s,ref:function(e){f(e,m)}},l(e,s))})}var a=n(3),i=r(a),s=n(2),u=r(s);e.exports=o},function(e,t){"use strict";var n=[{base:"A",letters:/[\u0041\u24B6\uFF21\u00C0\u00C1\u00C2\u1EA6\u1EA4\u1EAA\u1EA8\u00C3\u0100\u0102\u1EB0\u1EAE\u1EB4\u1EB2\u0226\u01E0\u00C4\u01DE\u1EA2\u00C5\u01FA\u01CD\u0200\u0202\u1EA0\u1EAC\u1EB6\u1E00\u0104\u023A\u2C6F]/g},{base:"AA",letters:/[\uA732]/g},{base:"AE",letters:/[\u00C6\u01FC\u01E2]/g},{base:"AO",letters:/[\uA734]/g},{base:"AU",letters:/[\uA736]/g},{base:"AV",letters:/[\uA738\uA73A]/g},{base:"AY",letters:/[\uA73C]/g},{base:"B",letters:/[\u0042\u24B7\uFF22\u1E02\u1E04\u1E06\u0243\u0182\u0181]/g},{base:"C",letters:/[\u0043\u24B8\uFF23\u0106\u0108\u010A\u010C\u00C7\u1E08\u0187\u023B\uA73E]/g},{base:"D",letters:/[\u0044\u24B9\uFF24\u1E0A\u010E\u1E0C\u1E10\u1E12\u1E0E\u0110\u018B\u018A\u0189\uA779]/g},{base:"DZ",letters:/[\u01F1\u01C4]/g},{base:"Dz",letters:/[\u01F2\u01C5]/g},{base:"E",letters:/[\u0045\u24BA\uFF25\u00C8\u00C9\u00CA\u1EC0\u1EBE\u1EC4\u1EC2\u1EBC\u0112\u1E14\u1E16\u0114\u0116\u00CB\u1EBA\u011A\u0204\u0206\u1EB8\u1EC6\u0228\u1E1C\u0118\u1E18\u1E1A\u0190\u018E]/g},{base:"F",letters:/[\u0046\u24BB\uFF26\u1E1E\u0191\uA77B]/g},{base:"G",letters:/[\u0047\u24BC\uFF27\u01F4\u011C\u1E20\u011E\u0120\u01E6\u0122\u01E4\u0193\uA7A0\uA77D\uA77E]/g},{base:"H",letters:/[\u0048\u24BD\uFF28\u0124\u1E22\u1E26\u021E\u1E24\u1E28\u1E2A\u0126\u2C67\u2C75\uA78D]/g},{base:"I",letters:/[\u0049\u24BE\uFF29\u00CC\u00CD\u00CE\u0128\u012A\u012C\u0130\u00CF\u1E2E\u1EC8\u01CF\u0208\u020A\u1ECA\u012E\u1E2C\u0197]/g},{base:"J",letters:/[\u004A\u24BF\uFF2A\u0134\u0248]/g},{base:"K",letters:/[\u004B\u24C0\uFF2B\u1E30\u01E8\u1E32\u0136\u1E34\u0198\u2C69\uA740\uA742\uA744\uA7A2]/g},{base:"L",letters:/[\u004C\u24C1\uFF2C\u013F\u0139\u013D\u1E36\u1E38\u013B\u1E3C\u1E3A\u0141\u023D\u2C62\u2C60\uA748\uA746\uA780]/g},{base:"LJ",letters:/[\u01C7]/g},{base:"Lj",letters:/[\u01C8]/g},{base:"M",letters:/[\u004D\u24C2\uFF2D\u1E3E\u1E40\u1E42\u2C6E\u019C]/g},{base:"N",letters:/[\u004E\u24C3\uFF2E\u01F8\u0143\u00D1\u1E44\u0147\u1E46\u0145\u1E4A\u1E48\u0220\u019D\uA790\uA7A4]/g},{base:"NJ",letters:/[\u01CA]/g},{base:"Nj",letters:/[\u01CB]/g},{base:"O",letters:/[\u004F\u24C4\uFF2F\u00D2\u00D3\u00D4\u1ED2\u1ED0\u1ED6\u1ED4\u00D5\u1E4C\u022C\u1E4E\u014C\u1E50\u1E52\u014E\u022E\u0230\u00D6\u022A\u1ECE\u0150\u01D1\u020C\u020E\u01A0\u1EDC\u1EDA\u1EE0\u1EDE\u1EE2\u1ECC\u1ED8\u01EA\u01EC\u00D8\u01FE\u0186\u019F\uA74A\uA74C]/g},{base:"OI",letters:/[\u01A2]/g},{base:"OO",letters:/[\uA74E]/g},{base:"OU",letters:/[\u0222]/g},{base:"P",letters:/[\u0050\u24C5\uFF30\u1E54\u1E56\u01A4\u2C63\uA750\uA752\uA754]/g},{base:"Q",letters:/[\u0051\u24C6\uFF31\uA756\uA758\u024A]/g},{base:"R",letters:/[\u0052\u24C7\uFF32\u0154\u1E58\u0158\u0210\u0212\u1E5A\u1E5C\u0156\u1E5E\u024C\u2C64\uA75A\uA7A6\uA782]/g},{base:"S",letters:/[\u0053\u24C8\uFF33\u1E9E\u015A\u1E64\u015C\u1E60\u0160\u1E66\u1E62\u1E68\u0218\u015E\u2C7E\uA7A8\uA784]/g},{base:"T",letters:/[\u0054\u24C9\uFF34\u1E6A\u0164\u1E6C\u021A\u0162\u1E70\u1E6E\u0166\u01AC\u01AE\u023E\uA786]/g},{base:"TZ",letters:/[\uA728]/g},{base:"U",letters:/[\u0055\u24CA\uFF35\u00D9\u00DA\u00DB\u0168\u1E78\u016A\u1E7A\u016C\u00DC\u01DB\u01D7\u01D5\u01D9\u1EE6\u016E\u0170\u01D3\u0214\u0216\u01AF\u1EEA\u1EE8\u1EEE\u1EEC\u1EF0\u1EE4\u1E72\u0172\u1E76\u1E74\u0244]/g},{base:"V",letters:/[\u0056\u24CB\uFF36\u1E7C\u1E7E\u01B2\uA75E\u0245]/g},{base:"VY",letters:/[\uA760]/g},{base:"W",letters:/[\u0057\u24CC\uFF37\u1E80\u1E82\u0174\u1E86\u1E84\u1E88\u2C72]/g},{base:"X",letters:/[\u0058\u24CD\uFF38\u1E8A\u1E8C]/g},{base:"Y",letters:/[\u0059\u24CE\uFF39\u1EF2\u00DD\u0176\u1EF8\u0232\u1E8E\u0178\u1EF6\u1EF4\u01B3\u024E\u1EFE]/g},{base:"Z",letters:/[\u005A\u24CF\uFF3A\u0179\u1E90\u017B\u017D\u1E92\u1E94\u01B5\u0224\u2C7F\u2C6B\uA762]/g},{base:"a",letters:/[\u0061\u24D0\uFF41\u1E9A\u00E0\u00E1\u00E2\u1EA7\u1EA5\u1EAB\u1EA9\u00E3\u0101\u0103\u1EB1\u1EAF\u1EB5\u1EB3\u0227\u01E1\u00E4\u01DF\u1EA3\u00E5\u01FB\u01CE\u0201\u0203\u1EA1\u1EAD\u1EB7\u1E01\u0105\u2C65\u0250]/g},{base:"aa",letters:/[\uA733]/g},{base:"ae",letters:/[\u00E6\u01FD\u01E3]/g},{base:"ao",letters:/[\uA735]/g},{base:"au",letters:/[\uA737]/g},{base:"av",letters:/[\uA739\uA73B]/g},{base:"ay",letters:/[\uA73D]/g},{base:"b",letters:/[\u0062\u24D1\uFF42\u1E03\u1E05\u1E07\u0180\u0183\u0253]/g},{base:"c",letters:/[\u0063\u24D2\uFF43\u0107\u0109\u010B\u010D\u00E7\u1E09\u0188\u023C\uA73F\u2184]/g},{base:"d",letters:/[\u0064\u24D3\uFF44\u1E0B\u010F\u1E0D\u1E11\u1E13\u1E0F\u0111\u018C\u0256\u0257\uA77A]/g},{base:"dz",letters:/[\u01F3\u01C6]/g},{base:"e",letters:/[\u0065\u24D4\uFF45\u00E8\u00E9\u00EA\u1EC1\u1EBF\u1EC5\u1EC3\u1EBD\u0113\u1E15\u1E17\u0115\u0117\u00EB\u1EBB\u011B\u0205\u0207\u1EB9\u1EC7\u0229\u1E1D\u0119\u1E19\u1E1B\u0247\u025B\u01DD]/g},{base:"f",letters:/[\u0066\u24D5\uFF46\u1E1F\u0192\uA77C]/g},{base:"g",letters:/[\u0067\u24D6\uFF47\u01F5\u011D\u1E21\u011F\u0121\u01E7\u0123\u01E5\u0260\uA7A1\u1D79\uA77F]/g},{base:"h",letters:/[\u0068\u24D7\uFF48\u0125\u1E23\u1E27\u021F\u1E25\u1E29\u1E2B\u1E96\u0127\u2C68\u2C76\u0265]/g},{base:"hv",letters:/[\u0195]/g},{base:"i",letters:/[\u0069\u24D8\uFF49\u00EC\u00ED\u00EE\u0129\u012B\u012D\u00EF\u1E2F\u1EC9\u01D0\u0209\u020B\u1ECB\u012F\u1E2D\u0268\u0131]/g},{base:"j",letters:/[\u006A\u24D9\uFF4A\u0135\u01F0\u0249]/g},{base:"k",letters:/[\u006B\u24DA\uFF4B\u1E31\u01E9\u1E33\u0137\u1E35\u0199\u2C6A\uA741\uA743\uA745\uA7A3]/g},{base:"l",letters:/[\u006C\u24DB\uFF4C\u0140\u013A\u013E\u1E37\u1E39\u013C\u1E3D\u1E3B\u017F\u0142\u019A\u026B\u2C61\uA749\uA781\uA747]/g},{base:"lj",letters:/[\u01C9]/g},{base:"m",letters:/[\u006D\u24DC\uFF4D\u1E3F\u1E41\u1E43\u0271\u026F]/g},{base:"n",letters:/[\u006E\u24DD\uFF4E\u01F9\u0144\u00F1\u1E45\u0148\u1E47\u0146\u1E4B\u1E49\u019E\u0272\u0149\uA791\uA7A5]/g},{base:"nj",letters:/[\u01CC]/g},{base:"o",letters:/[\u006F\u24DE\uFF4F\u00F2\u00F3\u00F4\u1ED3\u1ED1\u1ED7\u1ED5\u00F5\u1E4D\u022D\u1E4F\u014D\u1E51\u1E53\u014F\u022F\u0231\u00F6\u022B\u1ECF\u0151\u01D2\u020D\u020F\u01A1\u1EDD\u1EDB\u1EE1\u1EDF\u1EE3\u1ECD\u1ED9\u01EB\u01ED\u00F8\u01FF\u0254\uA74B\uA74D\u0275]/g},{base:"oi",letters:/[\u01A3]/g},{base:"ou",letters:/[\u0223]/g},{base:"oo",letters:/[\uA74F]/g},{base:"p",letters:/[\u0070\u24DF\uFF50\u1E55\u1E57\u01A5\u1D7D\uA751\uA753\uA755]/g},{base:"q",letters:/[\u0071\u24E0\uFF51\u024B\uA757\uA759]/g},{base:"r",letters:/[\u0072\u24E1\uFF52\u0155\u1E59\u0159\u0211\u0213\u1E5B\u1E5D\u0157\u1E5F\u024D\u027D\uA75B\uA7A7\uA783]/g},{base:"s",letters:/[\u0073\u24E2\uFF53\u00DF\u015B\u1E65\u015D\u1E61\u0161\u1E67\u1E63\u1E69\u0219\u015F\u023F\uA7A9\uA785\u1E9B]/g},{base:"t",letters:/[\u0074\u24E3\uFF54\u1E6B\u1E97\u0165\u1E6D\u021B\u0163\u1E71\u1E6F\u0167\u01AD\u0288\u2C66\uA787]/g},{base:"tz",letters:/[\uA729]/g},{base:"u",letters:/[\u0075\u24E4\uFF55\u00F9\u00FA\u00FB\u0169\u1E79\u016B\u1E7B\u016D\u00FC\u01DC\u01D8\u01D6\u01DA\u1EE7\u016F\u0171\u01D4\u0215\u0217\u01B0\u1EEB\u1EE9\u1EEF\u1EED\u1EF1\u1EE5\u1E73\u0173\u1E77\u1E75\u0289]/g},{base:"v",letters:/[\u0076\u24E5\uFF56\u1E7D\u1E7F\u028B\uA75F\u028C]/g},{base:"vy",letters:/[\uA761]/g},{base:"w",letters:/[\u0077\u24E6\uFF57\u1E81\u1E83\u0175\u1E87\u1E85\u1E98\u1E89\u2C73]/g},{base:"x",letters:/[\u0078\u24E7\uFF58\u1E8B\u1E8D]/g},{base:"y",letters:/[\u0079\u24E8\uFF59\u1EF3\u00FD\u0177\u1EF9\u0233\u1E8F\u00FF\u1EF7\u1E99\u1EF5\u01B4\u024F\u1EFF]/g},{base:"z",letters:/[\u007A\u24E9\uFF5A\u017A\u1E91\u017C\u017E\u1E93\u1E95\u01B6\u0225\u0240\u2C6C\uA763]/g}];e.exports=function(e){for(var t=0;t0)if(t.ended&&!o){var i=new Error("stream.push() after EOF");e.emit("error",i)}else if(t.endEmitted&&o){var u=new Error("stream.unshift() after end event");e.emit("error",u)}else{var l;!t.decoder||o||r||(n=t.decoder.write(n),l=!t.objectMode&&0===n.length),o||(t.reading=!1),l||(t.flowing&&0===t.length&&!t.sync?(e.emit("data",n),e.read(0)):(t.length+=t.objectMode?1:n.length,o?t.buffer.unshift(n):t.buffer.push(n),t.needReadable&&d(e))),h(e,t)}else o||(t.reading=!1);return s(t)}function s(e){return!e.ended&&(e.needReadable||e.length=B?e=B:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function l(e,t){return e<=0||0===t.length&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=u(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}function c(e,t){var n=null;return j.isBuffer(t)||"string"==typeof t||null===t||void 0===t||e.objectMode||(n=new TypeError("Invalid non-string/buffer chunk")),n}function p(e,t){if(!t.ended){if(t.decoder){var n=t.decoder.end();n&&n.length&&(t.buffer.push(n),t.length+=t.objectMode?1:n.length)}t.ended=!0,d(e)}}function d(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(N("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?O(f,e):f(e))}function f(e){N("emit readable"),e.emit("readable"),b(e)}function h(e,t){t.readingMore||(t.readingMore=!0,O(m,e,t))}function m(e,t){for(var n=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length=t.length?(n=t.decoder?t.buffer.join(""):1===t.buffer.length?t.buffer.head.data:t.buffer.concat(t.length),t.buffer.clear()):n=M(e,t.buffer,t.decoder),n}function M(e,t,n){var r;return ea.length?a.length:e;if(o+=i===a.length?a:a.slice(0,e),e-=i,0===e){i===a.length?(++r,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=a.slice(i));break}++r}return t.length-=r,o}function k(e,t){var n=Y.allocUnsafe(e),r=t.head,o=1;for(r.data.copy(n),e-=r.data.length;r=r.next;){var a=r.data,i=e>a.length?a.length:e;if(a.copy(n,n.length-e,0,i),e-=i,0===e){i===a.length?(++o,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=a.slice(i));break}++o}return t.length-=o,n}function S(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,O(P,t,e))}function P(e,t){e.endEmitted||0!==e.length||(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function L(e,t){for(var n=0,r=e.length;n=t.highWaterMark||t.ended))return N("read: emitReadable",t.length,t.ended),0===t.length&&t.ended?S(this):d(this),null;if(e=l(e,t),0===e&&t.ended)return 0===t.length&&S(this),null;var r=t.needReadable;N("need readable",r),(0===t.length||t.length-e0?T(e,t):null,null===o?(t.needReadable=!0,e=0):t.length-=e,0===t.length&&(t.ended||(t.needReadable=!0),n!==e&&t.ended&&S(this)),null!==o&&this.emit("data",o),o},a.prototype._read=function(e){this.emit("error",new Error("_read() is not implemented"))},a.prototype.pipe=function(e,n){function o(e){N("onunpipe"),e===d&&i()}function a(){N("onend"),e.end()}function i(){N("cleanup"),e.removeListener("close",l),e.removeListener("finish",c),e.removeListener("drain",v),e.removeListener("error",u),e.removeListener("unpipe",o),d.removeListener("end",a),d.removeListener("end",i),d.removeListener("data",s),g=!0,!f.awaitDrain||e._writableState&&!e._writableState.needDrain||v()}function s(t){N("ondata"),_=!1;var n=e.write(t);!1!==n||_||((1===f.pipesCount&&f.pipes===e||f.pipesCount>1&&L(f.pipes,e)!==-1)&&!g&&(N("false write response, pause",d._readableState.awaitDrain),d._readableState.awaitDrain++,_=!0),d.pause())}function u(t){N("onerror",t),p(),e.removeListener("error",u),0===C(e,"error")&&e.emit("error",t)}function l(){e.removeListener("finish",c),p()}function c(){N("onfinish"),e.removeListener("close",l),p()}function p(){N("unpipe"),d.unpipe(e)}var d=this,f=this._readableState;switch(f.pipesCount){case 0:f.pipes=e;break;case 1:f.pipes=[f.pipes,e];break;default:f.pipes.push(e)}f.pipesCount+=1,N("pipe count=%d opts=%j",f.pipesCount,n);var h=(!n||n.end!==!1)&&e!==t.stdout&&e!==t.stderr,m=h?a:i;f.endEmitted?O(m):d.once("end",m),e.on("unpipe",o);var v=y(d);e.on("drain",v);var g=!1,_=!1;return d.on("data",s),r(e,"error",u),e.once("close",l),e.once("finish",c),e.emit("pipe",d),f.flowing||(N("pipe resume"),d.resume()),e},a.prototype.unpipe=function(e){var t=this._readableState;if(0===t.pipesCount)return this;if(1===t.pipesCount)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var n=t.pipes,r=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var o=0;o-1?r:S;s.WritableState=i;var L=n(14);L.inherits=n(11);var D={deprecate:n(745)},O=n(359),E=n(15).Buffer,C=n(78);L.inherits(s,O),i.prototype.getBuffer=function(){for(var e=this.bufferedRequest,t=[];e;)t.push(e),e=e.next;return t},function(){try{Object.defineProperty(i.prototype,"buffer",{get:D.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.")})}catch(e){}}();var x;"function"==typeof Symbol&&Symbol.hasInstance&&"function"==typeof Function.prototype[Symbol.hasInstance]?(x=Function.prototype[Symbol.hasInstance],Object.defineProperty(s,Symbol.hasInstance,{value:function(e){return!!x.call(this,e)||e&&e._writableState instanceof i}})):x=function(e){return e instanceof this},s.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))},s.prototype.write=function(e,t,n){var r=this._writableState,a=!1,i=E.isBuffer(e);return"function"==typeof t&&(n=t,t=null),i?t="buffer":t||(t=r.defaultEncoding),"function"!=typeof n&&(n=o),r.ended?u(this,n):(i||l(this,r,e,n))&&(r.pendingcb++,a=p(this,r,i,e,t,n)),a},s.prototype.cork=function(){var e=this._writableState;e.corked++},s.prototype.uncork=function(){var e=this._writableState;e.corked&&(e.corked--,e.writing||e.corked||e.finished||e.bufferProcessing||!e.bufferedRequest||g(this,e))},s.prototype.setDefaultEncoding=function(e){if("string"==typeof e&&(e=e.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((e+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+e);return this._writableState.defaultEncoding=e,this},s.prototype._write=function(e,t,n){n(new Error("_write() is not implemented"))},s.prototype._writev=null,s.prototype.end=function(e,t,n){var r=this._writableState;"function"==typeof e?(n=e,e=null,t=null):"function"==typeof t&&(n=t,t=null),null!==e&&void 0!==e&&this.write(e,t),r.corked&&(r.corked=1,this.uncork()),r.ending||r.finished||M(this,r,n)}}).call(t,n(7),n(141).setImmediate)},function(e,t,n){e.exports=n(36).EventEmitter},function(e,t,n){"use strict";function r(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function o(e){var t=r(e);if("string"!=typeof t&&(g.isEncoding===b||!b(e)))throw new Error("Unknown encoding: "+e);return t||e}function a(e){this.encoding=o(e);var t;switch(this.encoding){case"utf16le":this.text=d,this.end=f,t=4;break;case"utf8":this.fillLast=l,t=4;break;case"base64":this.text=h,this.end=m,t=3;break;default:return this.write=y,void(this.end=v)}this.lastNeed=0,this.lastTotal=0,this.lastChar=_.allocUnsafe(t)}function i(e){return e<=127?0:e>>5===6?2:e>>4===14?3:e>>3===30?4:-1}function s(e,t,n){var r=t.length-1;if(r=0?(o>0&&(e.lastNeed=o-1),o):--r=0?(o>0&&(e.lastNeed=o-2),o):--r=0?(o>0&&(2===o?o=0:e.lastNeed=o-3),o):0))}function u(e,t,n){if(128!==(192&t[0]))return e.lastNeed=0,"�".repeat(n);if(e.lastNeed>1&&t.length>1){if(128!==(192&t[1]))return e.lastNeed=1,"�".repeat(n+1);if(e.lastNeed>2&&t.length>2&&128!==(192&t[2]))return e.lastNeed=2,"�".repeat(n+2)}}function l(e){var t=this.lastTotal-this.lastNeed,n=u(this,e,t);return void 0!==n?n:this.lastNeed<=e.length?(e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal)):(e.copy(this.lastChar,t,0,e.length),void(this.lastNeed-=e.length))}function c(e,t){var n=s(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=n;var r=e.length-(n-this.lastNeed);return e.copy(this.lastChar,0,r),e.toString("utf8",t,r)}function p(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"�".repeat(this.lastTotal-this.lastNeed):t}function d(e,t){if((e.length-t)%2===0){var n=e.toString("utf16le",t);if(n){var r=n.charCodeAt(n.length-1);if(r>=55296&&r<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],n.slice(0,-1)}return n}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function f(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var n=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,n)}return t}function h(e,t){var n=(e.length-t)%3;return 0===n?e.toString("base64",t):(this.lastNeed=3-n,this.lastTotal=3,1===n?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-n))}function m(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function y(e){return e.toString(this.encoding)}function v(e){return e&&e.length?this.write(e):""}var g=n(15).Buffer,_=n(78),b=g.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};t.StringDecoder=a,a.prototype.write=function(e){if(0===e.length)return"";var t,n;if(this.lastNeed){if(t=this.fillLast(e),void 0===t)return"";n=this.lastNeed,this.lastNeed=0}else n=0;return n0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n&&n.and?"string"==typeof n.and&&(n.and=[n.and]):n.and=[],n.and.push("streamChanges"),this.sortObj&&this.enableSort(n);var r=h["default"].create(this.context.appbaseRef,this.context.type,n,this.props.size,this.props.from,this.props.stream,this.context.app);if(this.channelId=r.channelId,this.channelListener=r.emitter.addListener(r.channelId,function(t){if(t.error&&t.startTime>e.queryStartTime&&(e.setState({queryStart:!1,showPlaceholder:!1}),e.props.onAllData)){var n=L.prepareResultData(t);e.props.onAllData(n.res,n.err)}if(t.appliedQuery)if("historic"===t.mode&&t.startTime>e.queryStartTime){var r=!(!t.appliedQuery||!t.data||t.data.error||t.data.hits&&t.data.hits.total),o={resultFound:!!(t.appliedQuery&&t.data&&!t.data.error&&t.data.hits&&t.data.hits.total)};t.appliedQuery&&t.data&&!t.data.error&&(o.total=t.data.hits.total,o.took=t.data.took),e.setState({queryStart:!1,visibleNoResults:r,resultStats:o,showPlaceholder:!1}),e.afterChannelResponse(t)}else"streaming"===t.mode&&(e.afterChannelResponse(t),e.updateResultStats(t.data));else e.setState({showPlaceholder:!0})}),this.listenLoadingChannel(r),t){var o={key:"streamChanges",value:""};L.selectedSensor.set(o,!0)}}},{key:"updateResultStats",value:function(e){var t=this.state.resultStats;t.total=L.updateStats(t.total,e),this.setState({resultStats:t})}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"afterChannelResponse",value:function(e){var t=this,n=e.data,r=void 0,o=void 0,a=[],i=[];if(this.streamFlag=!1,"streaming"===e.mode)this.channelMethod="streaming",a=n,a.stream=!0,i=this.state.currentData,this.streamFlag=!0,o=this.setMarkersData(r);else if("historic"===e.mode){this.queryStartTime=e.startTime,this.channelMethod="historic",a=n.hits&&n.hits.hits?n.hits.hits:[];var s=this.normalizeCurrentData(e,this.state.currentData,a);a=s.newData,i=s.currentData}this.setState({rawData:r,newData:a,currentData:i,markersData:o,isLoading:!1},function(){e.allMarkers=r;var n=JSON.parse(JSON.stringify(e));n.newData=t.state.newData,n.currentData=t.state.currentData,delete n.data,n=L.prepareResultData(n,e.data);var o=t.props.onAllData?t.props.onAllData(n.res,n.err):t.defaultonAllData(n.res,n.err);t.setState({resultMarkup:o,currentData:t.combineCurrentData(a)})})}},{key:"normalizeCurrentData",value:function(e,t,n){var r=JSON.parse(JSON.stringify(e.appliedQuery)),o=JSON.stringify(r)===JSON.stringify(this.appliedQuery)?t||[]:[];return o.length?n=n.filter(function(e){var t=!0;return o.forEach(function(n){e._id+"-"+e._type==n._id+"-"+n._type&&(t=!1)}),t}):this.appliedQuery=r,{currentData:o,newData:n}}},{key:"combineCurrentData",value:function(e){return P["default"].isArray(e)?this.state.currentData.concat(e):this.streamDataModify(this.state.currentData,e)}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.createChannel(e)}},{key:"removeChannel",value:function(){this.channelId&&(h["default"].stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"render",value:function(){var e=null,t=null,n=(0,d["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-stream-active":this.props.stream,"rbc-stream-inactive":!this.props.stream,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader,"rbc-resultstats-active":this.props.showResultStats,"rbc-resultstats-inactive":!this.props.showResultStats,"rbc-noresults-active":this.props.noResults,"rbc-noresults-inactive":!this.props.noResults});return this.props.title&&(e=c["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.props.placeholder&&(t=c["default"].createElement("div",{className:"rbc-placeholder col s12 col-xs-12"},this.props.placeholder)),c["default"].createElement("div",{className:"rbc-reactiveelement-container"},c["default"].createElement("div",{className:"rbc rbc-reactiveelement card thumbnail "+n,style:this.props.componentStyle},e,this.state.resultStats&&this.state.resultStats.resultFound&&this.props.showResultStats?c["default"].createElement(M["default"],{onResultStats:this.props.onResultStats,took:this.state.resultStats.took,total:this.state.resultStats.total}):null,this.state.resultMarkup,this.state.showPlaceholder?t:null),this.props.noResults&&this.state.visibleNoResults?c["default"].createElement(b["default"],{defaultText:this.props.noResults.text}):null,this.props.initialLoader&&this.state.queryStart?c["default"].createElement(g["default"],{defaultText:this.props.initialLoader.text}):null,c["default"].createElement(y["default"],{container:"rbc-reactiveelement-container"}))}}]),t}(l.Component);t["default"]=D,D.propTypes={componentId:c["default"].PropTypes.string,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),from:L.validation.resultListFrom,onAllData:c["default"].PropTypes.func,size:L.sizeValidation,stream:c["default"].PropTypes.bool,componentStyle:c["default"].PropTypes.object,initialLoader:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),noResults:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),showResultStats:c["default"].PropTypes.bool,onResultStats:c["default"].PropTypes.func,react:c["default"].PropTypes.object,placeholder:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element])},D.defaultProps={from:0,size:20,stream:!1,showResultStats:!0,componentStyle:{}},D.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired,app:c["default"].PropTypes.any.isRequired},D.types={componentId:k.STRING,title:k.STRING,react:k.OBJECT,from:k.NUMBER,size:k.NUMBER,onAllData:k.FUNCTION,stream:k.BOOLEAN,componentStyle:k.OBJECT,initialLoader:k.STRING,noResults:k.STRING,showResultStats:k.BOOLEAN,onResultStats:k.FUNCTION,placeholder:k.STRING}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nt.height(),i=n.get(0).scrollHeight>n.height();if(!a&&!i&&n.length&&!e.props.pagination){var s=o(t.find(".rbc-title"))+o(t.find(".rbc-pagination"))*t.find(".rbc-pagination").length,u=t.height()-60-s;u>0&&n.css({height:n.height()+15,"padding-bottom":20})}};t&&t.length&&n&&n.length&&(n.css({height:"auto","padding-bottom":0}),setTimeout(a.bind(this),1e3))}},{key:"removeChannel",value:function(){this.channelId&&(m["default"].stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"createChannel",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n&&n.and?"string"==typeof n.and&&(n.and=[n.and]):n.and=[],n.and.push("streamChanges"),this.props.pagination&&(n.and.push("paginationChanges"),n.pagination=null),this.sortObj&&this.enableSort(n);var r=m["default"].create(this.context.appbaseRef,this.context.type,n,this.props.size,this.props.from,this.props.stream,this.context.app);this.channelId=r.channelId,this.channelListener=r.emitter.addListener(r.channelId,function(t){if(t.error&&t.startTime>e.queryStartTime&&(e.setState({queryStart:!1,showPlaceholder:!1}),e.props.onAllData)){var n=x.prepareResultData(t);e.props.onAllData(n.res,n.err)}if(t.appliedQuery)if("historic"===t.mode&&t.startTime>e.queryStartTime){var r=!(!(t.appliedQuery&&Object.keys(t.appliedQuery).length&&t.data)||t.data.error||t.data.hits&&t.data.hits.total),o={resultFound:!!(t.appliedQuery&&t.data&&!t.data.error&&t.data.hits&&t.data.hits.total)};t.appliedQuery&&t.data&&!t.data.error&&(o.total=t.data.hits.total,o.took=t.data.took),e.setState({queryStart:!1,visibleNoResults:r,resultStats:o,showPlaceholder:!1}),e.afterChannelResponse(t)}else"streaming"===t.mode&&(e.afterChannelResponse(t),e.updateResultStats(t.data));else e.setState({showPlaceholder:!0})}),this.listenLoadingChannel(r),t&&setTimeout(function(){var e={key:"streamChanges",value:""};x.selectedSensor.set(e,!0)},100)}},{key:"updateResultStats",value:function(e){var t=this.state.resultStats;t.total=x.updateStats(t.total,e),this.setState({resultStats:t})}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){if(e.appliedQuery){var n=!(t.state.requestOnScroll&&e.appliedQuery.body&&e.appliedQuery.body.from);t.setState({queryStart:e.queryState,showInitialLoader:n})}})}},{key:"afterChannelResponse",value:function(e){var t=this,n=e.data,r=void 0,o=void 0,a=[],i=[];if(this.streamFlag=!1,"streaming"===e.mode)this.channelMethod="streaming",a=n,a.stream=!0,i=this.state.currentData,this.streamFlag=!0,o=this.setMarkersData(r);else if("historic"===e.mode){this.queryStartTime=e.startTime,this.channelMethod="historic",a=n.hits&&n.hits.hits?n.hits.hits:[];var s=this.normalizeCurrentData(e,this.state.currentData,a);a=s.newData,i=s.currentData}this.setState({rawData:r,newData:a,currentData:i,markersData:o,isLoading:!1},function(){e.allMarkers=r;var o=JSON.parse(JSON.stringify(e));o.newData=t.state.newData,o.currentData=t.state.currentData,delete o.data,o=x.prepareResultData(o,n);var i=t.props.onAllData?t.props.onAllData(o.res,o.err):t.defaultonAllData(o.res,o.err);t.setState({resultMarkup:t.wrapMarkup(i),currentData:t.combineCurrentData(a)})})}},{key:"wrapMarkup",value:function(e){var t=null;return t=C["default"].isArray(e)?e.map(function(e,t){return p["default"].createElement("div",{key:t,className:"rbc-list-item"},e)}):e}},{key:"normalizeCurrentData",value:function(e,t,n){var r=JSON.parse(JSON.stringify(e.appliedQuery));this.state.requestOnScroll&&r&&r.body&&(delete r.body.from,delete r.body.size);var o=JSON.stringify(r)===JSON.stringify(this.appliedQuery),a=o?t||[]:[];return a.length?n=n.filter(function(e){var t=!0;return a.forEach(function(n){e._id+"-"+e._type==n._id+"-"+n._type&&(t=!1)}),t}):this.appliedQuery=r,o||j(".rbc.rbc-reactivelist").animate({scrollTop:0},100),{currentData:a,newData:n}}},{key:"combineCurrentData",value:function(e){return C["default"].isArray(e)?(e=e.map(function(e){return e.stream=!1,e}),this.state.currentData.concat(e)):this.streamDataModify(this.state.currentData,e,!1)}},{key:"enableSort",value:function(e){e.and.push(this.resultSortKey);var t={key:this.resultSortKey,value:this.sortObj};x.selectedSensor.setSortInfo(t)}},{key:"appendData",value:function(e){var t=this.state.rawData,n=t.hits.hits.concat(e.hits.hits);return t.hits.hits=C["default"].uniqBy(n,"_id"),t}},{key:"streamDataModify",value:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(t)if(t.stream=n,t.streamStart=new Date,t._deleted){var r=e.filter(function(e){return e._id!==t._id});e=r}else{var o=e.filter(function(e){return e._id!==t._id});e=o,e.unshift(t)}return e}},{key:"setMarkersData",value:function(e){return e?e:[]}},{key:"initialize",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.createChannel(e),this.state.requestOnScroll?this.listComponent():this.setQueryForPagination()}},{key:"setQueryForPagination",value:function(){var e={queryType:"match",inputData:this.props.appbaseField,customQuery:function(){return null}},t={key:"paginationChanges",value:e};x.selectedSensor.setSensorInfo(t)}},{key:"executePaginationUpdate",value:function(){setTimeout(function(){var e={key:"paginationChanges",value:Math.random()};x.selectedSensor.set(e,!0)},100)}},{key:"paginationAt",value:function(e){var t=void 0;return!this.props.pagination||this.props.paginationAt!==e&&"both"!==this.props.paginationAt||(t=p["default"].createElement("div",{className:"rbc-pagination-container col s12 col-xs-12"},p["default"].createElement(L["default"],{className:"rbc-pagination-"+e,componentId:"pagination",onPageChange:this.props.onPageChange,title:this.props.paginationTitle}))),t}},{key:"defaultonAllData",value:function(e){var t=this,n=null;if(e){var r=e.currentData;"historic"===e.mode?r=e.currentData.concat(e.newData):"streaming"===e.mode&&(r=x.combineStreamData(e.currentData,e.newData)),r&&(n=r.map(function(e){var n=e._source;return t.props.onData?t.props.onData(e):p["default"].createElement("div",{className:"row",style:{marginTop:"20px"}},t.itemMarkup(n,e))}))}return n}},{key:"itemMarkup",value:function(e,t){return p["default"].createElement("div",{key:t._id,style:{padding:"12px",fontSize:"12px"},className:"makerInfo"},p["default"].createElement(v["default"],{data:e}))}},{key:"nextPage",value:function(){function e(){this.setState({isLoading:!0}),m["default"].nextPage(this.channelId)}this.state.resultStats.total>this.state.currentData.length&&!this.state.queryStart&&e.call(this)}},{key:"listComponent",value:function(){function e(e){var t=this;e&&e.addEventListener("scroll",function(){t.state.requestOnScroll&&j(e).scrollTop()+j(e).innerHeight()>=e.scrollHeight&&t.state.resultStats.total>t.state.currentData.length&&!t.state.queryStart&&t.nextPage()})}e.call(this,this.listParentElement),e.call(this,this.listChildElement)}},{key:"handleSortSelect",value:function(e){var t=e.target.value;this.sortObj=a({},this.props.sortOptions[t].appbaseField,{order:this.props.sortOptions[t].sortBy});var n={key:this.resultSortKey,value:this.sortObj};x.selectedSensor.set(n,!0,"sortChange")}},{key:"render",value:function(){var e=this,t=null,n=null,r=null,o=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-sort-active":this.props.sortOptions,"rbc-sort-inactive":!this.props.sortOptions,"rbc-stream-active":this.props.stream,"rbc-stream-inactive":!this.props.stream,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader,"rbc-resultstats-active":this.props.showResultStats,"rbc-resultstats-inactive":!this.props.showResultStats,"rbc-noresults-active":this.props.noResults,"rbc-noresults-inactive":!this.props.noResults,"rbc-pagination-active":this.props.pagination,"rbc-pagination-inactive":!this.props.pagination});if(this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.props.placeholder&&(n=p["default"].createElement("div",{className:"rbc-placeholder col s12 col-xs-12"},this.props.placeholder)),this.props.sortOptions){var a=this.props.sortOptions.map(function(e,t){return p["default"].createElement("option",{value:t,key:e.label},e.label)});r=p["default"].createElement("div",{className:"rbc-sortoptions input-field col"},p["default"].createElement("select",{className:"browser-default form-control",onChange:this.handleSortSelect},a))}return p["default"].createElement("div",{ className:"rbc-reactivelist-container"},p["default"].createElement("div",{ref:function(t){e.listParentElement=t},className:"rbc rbc-reactivelist card thumbnail "+o,style:this.props.componentStyle},t,r,this.props.showResultStats&&this.state.resultStats.resultFound?p["default"].createElement(S["default"],{onResultStats:this.props.onResultStats,took:this.state.resultStats.took,total:this.state.resultStats.total}):null,this.paginationAt("top"),p["default"].createElement("div",{ref:function(t){e.listChildElement=t},className:"rbc-reactivelist-scroll-container col s12 col-xs-12"},this.state.resultMarkup),this.state.isLoading?p["default"].createElement("div",{className:"rbc-loader"}):null,this.state.showPlaceholder?n:null,this.paginationAt("bottom")),this.props.noResults&&this.state.visibleNoResults?p["default"].createElement(w["default"],{defaultText:this.props.noResults}):null,this.props.initialLoader&&this.state.queryStart&&this.state.showInitialLoader?p["default"].createElement(T["default"],{defaultText:this.props.initialLoader}):null,p["default"].createElement(_["default"],{container:"rbc-reactivelist-container"}))}}]),t}(c.Component);t["default"]=Y,Y.propTypes={componentId:p["default"].PropTypes.string,appbaseField:p["default"].PropTypes.string,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),sortBy:p["default"].PropTypes.oneOf(["asc","desc","default"]),sortOptions:p["default"].PropTypes.arrayOf(p["default"].PropTypes.shape({label:p["default"].PropTypes.string,appbaseField:p["default"].PropTypes.string,sortBy:p["default"].PropTypes.string})),from:x.validation.resultListFrom,onAllData:p["default"].PropTypes.func,size:x.sizeValidation,stream:p["default"].PropTypes.bool,componentStyle:p["default"].PropTypes.object,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),noResults:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),showResultStats:p["default"].PropTypes.bool,onResultStats:p["default"].PropTypes.func,placeholder:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,paginationAt:p["default"].PropTypes.string,pagination:p["default"].PropTypes.bool},Y.defaultProps={from:0,size:20,stream:!1,componentStyle:{},showResultStats:!0,pagination:!1,paginationAt:"bottom"},Y.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired,app:p["default"].PropTypes.any.isRequired},Y.types={componentId:O.STRING,appbaseField:O.STRING,title:O.STRING,react:O.OBJECT,sortBy:O.STRING,sortOptions:O.OBJECT,from:O.NUMBER,onAllData:O.FUNCTION,onData:O.FUNCTION,size:O.NUMBER,stream:O.BOOLEAN,componentStyle:O.OBJECT,initialLoader:O.STRING,noResults:O.FUNCTION,showResultStats:O.BOOLEAN,onResultStats:O.FUNCTION,placeholder:O.STRING,pagination:O.BOOLEAN,paginationAt:O.STRING}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.Bar=t.HistoGramComponent=void 0;var s=function(){function e(e,t){for(var n=0;n-1;t?this.setDefaultSelectAll():this.setState({selectedItems:this.props.defaultSelected,defaultSelectall:this.props.defaultSelectall},function(){e.updateAction.bind(e),e.props.onSelect(e.state.selectedItems)})}},{key:"setDefaultSelectAll",value:function(){this.props.items&&this.props.items.length?setTimeout(this.handleListClickAll.bind(this,this.props.selectAllLabel,!0),1e3):setTimeout(this.setDefaultSelectAll.bind(this),1e3)}},{key:"componentDidUpdate",value:function(){var e=this,t=null,n=!0;this.state.selectedItems&&(t=JSON.parse(JSON.stringify(this.state.selectedItems))),t&&t.length&&this.props.items&&this.props.items.length&&(t=t.filter(function(t){var n=e.props.items.filter(function(e){return e.key===t});return!!n.length}),t.length!==this.state.selectedItems.length&&(n=!t.length,this.props.onRemove(this.state.selectedItems,n),this.updateSelectedItems(t),t.length&&this.props.onSelect(t)))}},{key:"handleListClick",value:function(e,t){var n=void 0;t?(this.props.onRemove(this.state.selectedItems,!1),n=this.state.selectedItems,n.push(e),this.setState({selectedItems:n},this.updateAction.bind(this)),this.state.selectedItems.length&&this.props.onSelect(this.state.selectedItems)):this.handleTagClick(e)}},{key:"handleTagClick",value:function(e){var t=1===this.state.selectedItems.length;this.props.onRemove(this.state.selectedItems,t);var n=e.toString().replace(/ /g,"_"),r="ref"+n,o=this.refStore[r];o.state.status=!1;var a=this.state.selectedItems,i=a.indexOf(e);a.splice(i,1),this.setState({selectedItems:a},this.updateAction.bind(this)),this.props.onSelect(a)}},{key:"clearAll",value:function(){this.handleListClickAll(this.props.selectAllLabel,!1)}},{key:"getSelectedItems",value:function(){var e=[];return this.props.items.forEach(function(t){t.status&&e.indexOf(t.key)<0&&e.push(t.key)}),e}},{key:"handleListClickAll",value:function(e,t){var n=this;this.props.selectAll(t);var r=this.props.items.map(function(e){return e.key});r=t?r:[],this.setState({defaultSelectall:t,selectedItems:r},function(){n.updateAction.bind(n),n.props.onSelect(n.state.selectedItems,r)})}},{key:"updateSelectedItems",value:function(e){this.setState({selectedItems:e})}},{key:"updateAction",value:function(){this.state.selectedItems.length||this.props.onSelect(null)}},{key:"render",value:function(){var e=this,t=this.props.items,n=this.getSelectedItems(),r=[],o=[];return t.forEach(function(t,n){try{t.keyRef=t.key.replace(/ /g,"_")}catch(o){t.keyRef=n}var a=!("visible"in t&&!t.visible);r.push(l["default"].createElement(p["default"],{key:t.keyRef,value:t.key,doc_count:t.doc_count,countField:e.props.showCount,handleClick:e.handleListClick,visible:a,showCheckbox:e.props.showCheckbox,status:t.status||!1,ref:function(n){var r="ref"+t.keyRef;e.refStore[r]=n}}))}),this.props.selectAllLabel&&t&&t.length&&r.unshift(l["default"].createElement(p["default"],{key:"selectall",value:this.props.selectAllLabel,countField:!1,visible:!0,showCheckbox:this.props.showCheckbox,handleClick:this.handleListClickAll,status:this.props.selectAllValue,ref:function(t){e.refStore.refselectall=t}})),this.props.showTags&&n&&(n.length<=5?n.forEach(function(t){o.push(l["default"].createElement(f["default"],{key:t,value:t,onClick:e.handleTagClick}))}):o.unshift(l["default"].createElement(f["default"],{key:"Clear All",value:"Clear All",onClick:this.clearAll}))),l["default"].createElement("div",{className:"rbc-list-container col s12 col-xs-12"},o.length?l["default"].createElement("div",{className:"row rbc-tag-container"},o):null,l["default"].createElement("div",{className:"row"},r))}}]),t}(u.Component);t["default"]=h,h.propTypes={defaultSelected:l["default"].PropTypes.array,items:l["default"].PropTypes.array,onRemove:l["default"].PropTypes.func,onSelect:l["default"].PropTypes.func,selectAll:l["default"].PropTypes.func,selectAllLabel:l["default"].PropTypes.string,selectAllValue:l["default"].PropTypes.bool,showCount:l["default"].PropTypes.bool,showTags:l["default"].PropTypes.bool,defaultSelectall:l["default"].PropTypes.bool},h.defaultProps={showTags:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n-1){var n=t.channelResponse&&t.channelResponse.data&&t.channelResponse.data.hits?t.channelResponse.data.hits.total:0,r=Math.ceil(n/t.queryOptions.size)<1?1:Math.ceil(n/t.queryOptions.size),o=t.queryOptions.size?t.queryOptions.size:20,a=Math.round(t.queryOptions.from/o)+1;e.setState({totalHits:n,size:o,maxPageNumber:r,currentValue:a})}})}},{key:"handleChange",value:function(e){this.setState({currentValue:e});var t={key:this.props.componentId,value:e},n=!0;h.selectedSensor.set(t,n,"paginationChange"),this.props.onPageChange&&this.props.onPageChange(e)}},{key:"firstPage",value:function(){1!==this.state.currentValue&&this.handleChange.call(this,1)}},{key:"lastPage",value:function(){this.state.currentValue!==this.state.maxPageNumber&&this.handleChange.call(this,this.state.maxPageNumber)}},{key:"prePage",value:function(){var e=this.state.currentValue>1?this.state.currentValue-1:1;this.state.currentValue!==e&&this.handleChange.call(this,e)}},{key:"nextPage",value:function(){var e=this.state.currentValue0;r--)if(r%5===0||1===r){t=r;break}for(var o=function(t){var r=l["default"].createElement("li",{key:t,className:"rbc-page-number "+(e.state.currentValue===t?"active rbc-pagination-active":"waves-effect")},l["default"].createElement("a",{onClick:function(){return e.handleChange(t)}},t));t<=e.state.maxPageNumber&&n.push(r)},a=t;a<=t+5;a++)o(a);return l["default"].createElement("ul",{className:"pagination"},l["default"].createElement("li",{className:1===this.state.currentValue?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.firstPage},l["default"].createElement("i",{className:"fa fa-angle-double-left"}))),l["default"].createElement("li",{className:1===this.state.currentValue?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.prePage},l["default"].createElement("i",{className:"fa fa-angle-left"}))),n,l["default"].createElement("li",{className:this.state.currentValue===this.state.maxPageNumber?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-next",onClick:this.nextPage},l["default"].createElement("i",{className:"fa fa-angle-right"}))),l["default"].createElement("li",{className:this.state.currentValue===this.state.maxPageNumber?"disabled":"waves-effect"},l["default"].createElement("a",{className:"rbc-page-previous",onClick:this.lastPage},l["default"].createElement("i",{className:"fa fa-angle-double-right"}))))}},{key:"render",value:function(){var e=null;this.props.title&&(e=l["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,p["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return l["default"].createElement("div",{className:"rbc rbc-pagination col s12 col-xs-12 "+t+" "+this.props.className},e,l["default"].createElement("div",{className:"col s12 col-xs-12"},this.renderPageNumber()))}}]),t}(u.Component);t["default"]=m,m.propTypes={componentId:l["default"].PropTypes.string.isRequired,title:l["default"].PropTypes.string,onPageChange:l["default"].PropTypes.func},m.defaultProps={},m.contextTypes={appbaseRef:l["default"].PropTypes.any.isRequired,type:l["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.StaticSearch=void 0;var s=function(){function e(e,t){for(var n=0;n-1)d=d||{},d=Object.assign(d,t[e]);else{r[e]=i(e);var o=a(e);o&&(d=d||{},d=Object.assign(d,o))}var u=n(e);!u||"aggSort"in u||p.push(u)}),r}function l(t){var n=o.serializeDepends.createQuery(e.serializeDepends,t);return n&&n.body?(p&&p.length&&(n.body.sort=p),d&&Object.keys(d).length&&Object.keys(d).forEach(function(e){n.body[e]=d[e]})):n={},n}function c(){var e=u(),t=l(e);return t}var p=[],d=null;return c()}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=this.params.get(e);if(n&&r)try{r=JSON.parse(r)}catch(o){console.log(o)}return t?r&&r.trim()?r.split(","):null:r}},{key:"update",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];n&&(this.setOrDelete(e,t),this.applyURLUpdate())}},{key:"setOrDelete",value:function(e,t){e&&(null===t||void 0===t?this.params["delete"](e):this.params.set(e,t)); -}},{key:"applyURLUpdate",value:function(){if(history.pushState&&this.params.toString()){var e=window.location.protocol+"//"+window.location.host+window.location.pathname+"?"+this.params.toString();window.history.pushState({path:e},"",e)}}}]),e}();t.URLParams=new u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(49);t.ResponsiveStory=function(){var e=function(e){return e.height()?e.height():0},t=function(){var t=r(window).height(),n=t-15;r(".rbc.rbc-reactivelist, .rbc.rbc-reactiveelement").css({maxHeight:n});var o=[r(".rbc.rbc-singlelist"),r(".rbc.rbc-multilist"),r(".rbc.rbc-nestedlist"),r(".rbc.rbc-tagcloud")];o.forEach(function(n){if(n.length){var r=e(n.find(".rbc-title"))+e(n.find(".rbc-search-container"));n.find(".rbc-list-container").css({maxHeight:t-r-35})}}),r(".rbc-base > .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(e[t]<1||e[t]>1e3)&&(n=new Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=new Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]<=0&&(n=new Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=new Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start<=0&&(r=new Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return!isNaN(e[t])&&r>=e.defaultSelected&&o<=e.defaultSelected||(n=new Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return e[t]<0&&(n=new Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=new Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n'],post_tags:[""],fields:e}}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.defaultSearchQuery}};this.props.highlight&&(e.value.externalQuery=this.highlightQuery()),w.selectedSensor.setSensorInfo(e);var t={key:this.searchInputId,value:{queryType:"multi_match",inputData:this.props.appbaseField,customQuery:this.defaultSearchQuery}};w.selectedSensor.setSensorInfo(t)}},{key:"setValue",value:function(e){var t={key:this.searchInputId,value:e};w.URLParams.update(this.props.componentId,e,this.props.URLParams),w.selectedSensor.set(t,!0),e&&""!==e.trim()?this.setState({options:[{label:e,value:e}],isLoadingOptions:!0,currentValue:e}):this.setState({options:[],isLoadingOptions:!1,currentValue:e})}},{key:"getValue",value:function(e,t){var n=void(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0);if(M["default"].has(t,e))n=t[e];else if(e.indexOf(".")>-1){var r="",o=e.split(".");o.forEach(function(e,a){r+=e,M["default"].isArray(M["default"].get(t,r))&&(r+="["+a+"]"),o.length-1!==a?r+=".":n=M["default"].get(t,r)})}return n}},{key:"setData",value:function(e){var t=this,n=[];M["default"].isArray(this.props.appbaseField)?this.props.appbaseField:[this.props.appbaseField],e.hits.hits.map(function(e){if("string"===t.fieldType){var r=t.getValue(t.props.appbaseField.trim(),e._source);n.push({value:r,label:r})}else"object"===t.fieldType&&t.props.appbaseField.map(function(r){var o=t.getValue(r,e._source);o&&n.push({value:o,label:o})})}),this.state.currentValue&&""!==this.state.currentValue.trim()&&n.unshift({label:this.state.currentValue,value:this.state.currentValue}),n=this.removeDuplicates(n,"label"),this.setState({options:n,isLoadingOptions:!1})}},{key:"defaultSearchQuery",value:function(e){var t=null,n=void 0;return e&&(n="string"===this.fieldType?[this.props.appbaseField]:this.props.appbaseField,t={bool:{should:[{multi_match:{query:e,fields:n,type:"phrase_prefix"}},{multi_match:{query:e,fields:n}}],minimum_should_match:"1"}}),t}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.searchInputId);var n=g["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({rawData:r}),e.props.autocomplete&&e.setData(r)})}},{key:"checkDefault",value:function(){this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultValue&&this.defaultSelected!=this.defaultValue&&(this.defaultSelected=this.defaultValue,setTimeout(this.setValue.bind(this,this.defaultSelected),100),this.handleSearch({value:this.defaultSelected}))}},{key:"handleSearch",value:function(e){var t=e?e.value:null;t="null"===t?null:t;var n={key:this.props.componentId,value:t};w.selectedSensor.set(n,!0),this.setState({currentValue:t})}},{key:"handleInputChange",value:function(e){var t=e.target.value;this.setState({currentValue:t});var n={key:this.props.componentId,value:t};this.props.onValueChange&&this.props.onValueChange(n.value);var r=!0;w.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=d["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,y["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-autocomplete-active":this.props.autocomplete,"rbc-autocomplete-inactive":!this.props.autocomplete});return d["default"].createElement("div",{className:"rbc rbc-datasearch col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},e,this.props.autocomplete?d["default"].createElement(h["default"],u({isLoading:this.state.isLoadingOptions,value:this.state.currentValue,options:this.state.options,onInputChange:this.setValue,onChange:this.handleSearch,onBlurResetsInput:!1},this.props)):d["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},d["default"].createElement("input",{type:"text",className:"rbc-input",placeholder:this.props.placeholder,value:this.state.currentValue?this.state.currentValue:"",onChange:this.handleInputChange}),d["default"].createElement("span",{className:"rbc-search-icon"})))}}]),t}(p.Component);t["default"]=k,k.propTypes={componentId:d["default"].PropTypes.string.isRequired,appbaseField:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),title:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.element]),placeholder:d["default"].PropTypes.string,autocomplete:d["default"].PropTypes.bool,defaultSelected:d["default"].PropTypes.string,customQuery:d["default"].PropTypes.func,onValueChange:d["default"].PropTypes.func,react:d["default"].PropTypes.object,componentStyle:d["default"].PropTypes.object,highlight:d["default"].PropTypes.bool,highlightFields:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),URLParams:d["default"].PropTypes.bool},k.defaultProps={placeholder:"Search",autocomplete:!0,componentStyle:{},highlight:!1,URLParams:!1},k.contextTypes={appbaseRef:d["default"].PropTypes.any.isRequired,type:d["default"].PropTypes.any.isRequired},k.types={componentId:b.STRING,appbaseField:b.STRING,appbaseFieldType:b.STRING,react:b.OBJECT,title:b.STRING,placeholder:b.STRING,autocomplete:b.BOOLEAN,defaultSelected:b.STRING,customQuery:b.FUNCTION,componentStyle:b.OBJECT,highlight:b.BOOLEAN,URLParams:b.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&setTimeout(this.handleChange.bind(this,t),1e3)}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!_["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t;var n=e.state.data.filter(function(t){ -return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&(null!==e.urlParams?e.handleChange(n):setTimeout(e.handleChange.bind(e,n),1e3))}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};b.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){if(e.length>0)return e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}})}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}}},{key:"handleChange",value:function(e){var t=[];t=e.map(function(e){return e.label}),t=t.join(),this.setState({selected:t});var n={key:this.props.componentId,value:e},r=!0;this.props.onValueChange&&this.props.onValueChange(n.value),b.URLParams.update(this.props.componentId,t,this.props.URLParams),b.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return p["default"].createElement("div",{className:"rbc rbc-multidropdownrange col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"col s12 col-xs-12"},p["default"].createElement(f["default"],{options:this.state.data,value:this.state.selected,onChange:this.handleChange,clearable:!1,multi:!0,placeholder:this.props.placeholder,searchable:!0}))))}}]),t}(c.Component);t["default"]=T,T.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),placeholder:p["default"].PropTypes.string,data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},T.defaultProps={URLParams:!1},T.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},T.types={componentId:v.STRING,appbaseField:v.STRING,appbaseFieldType:v.NUMBER,data:v.OBJECT,defaultSelected:v.ARRAY,title:v.STRING,placeholder:v.STRING,customQuery:v.FUNCTION,componentStyle:v.OBJECT,URLParams:v.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&(null!==this.urlParams?this.handleChange(t):setTimeout(this.handleChange.bind(this,t),1e3))}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!v["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t,e.resetState();var n=e.props.data.filter(function(e){return t.indexOf(e.label)>-1});n&&n.length&&setTimeout(e.handleChange.bind(e,n),1e3)}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.length>0?e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}}):null}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}return null}},{key:"handleChange",value:function(e){function t(e,t,o){o.label===e.label&&(r=t,n.splice(t,1))}var n=this.state.selected,r=null,o=e;v["default"].isArray(e)||(o=[e]),o.forEach(function(e){n.forEach(function(n,r){t(n,r,e)})}),null===r&&o.forEach(function(e){n.push(e)}),this.setState({selected:n});var a={key:this.props.componentId,value:n},i=!0;this.props.onValueChange&&this.props.onValueChange(a.value),g.URLParams.update(this.props.componentId,this.getSelectedLabels(n),this.props.URLParams),g.selectedSensor.set(a,i)}},{key:"getSelectedLabels",value:function(e){return e.map(function(e){return e.label})}},{key:"resetState",value:function(){this.setState({selected:[]});var e={key:this.props.componentId,value:[]},t=!0;g.URLParams.update(this.props.componentId,null,this.props.URLParams),g.selectedSensor.set(e,t)}},{key:"handleTagClick",value:function(e){var t=this.state.selected.filter(function(t){return t.label===e});this.handleChange(t[0])}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t){return p["default"].createElement("div",{className:"rbc-list-item row",key:t.label,onClick:function(){return e.handleChange(t)}},p["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:n.indexOf(t.label)>-1,value:t.label}),p["default"].createElement("label",{className:"rbc-label"},t.label))})),t}},{key:"render",value:function(){var e=this,t=null,n=[];this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.selected&&this.state.selected.forEach(function(t){n.push(p["default"].createElement(b,{key:t.label,value:t.label,onClick:e.handleTagClick}))});var r=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return p["default"].createElement("div",{className:"rbc rbc-multirange col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},t,p["default"].createElement("div",{className:"col s12 col-xs-12 rbc-list-container"},n.length?p["default"].createElement("div",{className:"row",style:{marginTop:"0"}},n):null,this.renderButtons())))}}]),t}(c.Component);t["default"]=_;var b=function(e){return p["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},p["default"].createElement("a",{className:"close"},"×"),p["default"].createElement("span",null,e.value))};b.propTypes={onClick:p["default"].PropTypes.func.isRequired,value:p["default"].PropTypes.string.isRequired},_.propTypes={appbaseField:p["default"].PropTypes.string.isRequired,componentId:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nr;return p["default"].createElement("div",{className:"rbc-numberbox-container col s12 col-xs-12"},p["default"].createElement("div",{className:"rbc-label"},t),p["default"].createElement("div",{className:"rbc-numberbox-btn-container"},p["default"].createElement(g,{isActive:s,handleChange:o,type:"minus"}),p["default"].createElement("span",{className:"rbc-numberbox-number"},a),p["default"].createElement(g,{isActive:i,handleChange:o,type:"plus"})))},b=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),o=r.props.focused;r.urlParams=y.URLParams.get(r.props.componentId);var a=null!==r.urlParams?r.urlParams:r.props.defaultSelected;return r.state={currentValue:a?a:r.props.data.start,focused:o},r.type="term",r.handleChange=r.handleChange.bind(r),r.customQuery=r.customQuery.bind(r),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.setQueryInfo(),null!==this.urlParams?this.updateQuery(this.urlParams):setTimeout(this.handleChange.bind(this),1e3)}},{key:"componentWillReceiveProps",value:function(e){var t=this;setTimeout(function(){var n=null!==t.urlParams?t.urlParams:t.props.defaultSelected;!n&&0!==n||n===t.state.currentValue||t.setState({currentValue:n}),e.queryFormat!==t.queryFormat&&(t.queryFormat=e.queryFormat,t.updateQuery())},300)}},{key:"customQuery",value:function(e){var t=null;if(e&&(e.value||0===e.value)){var n=e.value;switch(this.props.queryFormat){case"exact":t=this.exactQuery(n);break;case"lte":t=this.lteQuery(n);break;case"gte":default:t=this.gteQuery(n)}}return t}},{key:"exactQuery",value:function(e){return a({},this.type,a({},this.props.appbaseField,e))}},{key:"gteQuery",value:function(e){return{range:a({},this.props.appbaseField,{gte:e,boost:2})}}},{key:"lteQuery",value:function(e){return{range:a({},this.props.appbaseField,{lte:e,boost:2})}}},{key:"setQueryInfo",value:function(){var e=this.props,t=e.componentId,n=e.appbaseField,r={key:t,value:{queryType:this.type,inputData:n,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};y.selectedSensor.setSensorInfo(r)}},{key:"handleChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.props,n=(t.componentId,t.data),r=n.start,o=n.end,a=this.state.currentValue;r=void 0!=r?r:a-1,o=void 0!=o?o:a+1,e>0&&ar&&(a-=1),this.setState({currentValue:a},this.updateQuery.bind(this))}},{key:"updateQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.start.currentValue,t={key:this.props.componentId,value:{value:e,queryFormat:this.props.queryFormat}};this.props.onValueChange&&this.props.onValueChange(t.value),y.URLParams.update(this.props.componentId,e,this.props.URLParams),y.selectedSensor.set(t,!0)}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.data,r=e.labelPosition,o=this.state.currentValue,a=t?p["default"].createElement(v,{title:t}):null,i=(0,f["default"])({"rbc-title-active":t,"rbc-title-inactive":!t});return p["default"].createElement("div",{className:"rbc rbc-numberbox col s12 col-xs-12 card thumbnail "+i+" rbc-label-"+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},a,p["default"].createElement(_,{handleChange:this.handleChange,value:o,label:n.label,start:n.start,end:n.end})))}}]),t}(c.Component);t["default"]=b,b.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.shape({start:y.validateThreshold,end:y.validateThreshold,label:p["default"].PropTypes.string}),defaultSelected:y.valueValidation,labelPosition:p["default"].PropTypes.oneOf(["top","bottom","left","right"]),customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,queryFormat:p["default"].PropTypes.oneOf(["exact","gte","lte"]),URLParams:p["default"].PropTypes.bool},b.defaultProps={componentStyle:{},queryFormat:"gte",URLParams:!1},b.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},b.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.NUMBER,labelPosition:m.STRING,customQuery:m.FUNCTION,componentStyle:m.OBJECT,queryFormat:m.STRING,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=n.end){var r=(n.end-n.start)%e.stepValue;if(r){t.setState({values:{min:t.state.values.min,max:n.end-r}});var o={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-r}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(o.value),S.URLParams.update(t.props.componentId,t.setURLParam(o.value),t.props.URLParams),S.selectedSensor.set(o,!0)},1e3)}else{var a={};a.min=n.start,a.max=n.end,t.setState({values:a,currentValues:a});var i={key:t.props.componentId,value:{from:a.min,to:a.max}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(i.value),S.URLParams.update(t.props.componentId,t.setURLParam(i.value),t.props.URLParams),S.selectedSensor.set(i,!0)},1e3)}}if(e.range.start!==t.state.startThreshold||e.range.end!==t.state.endThreshold){if(e.range.start<=n.start&&e.range.end>=n.end)t.setState({startThreshold:e.range.start,endThreshold:e.range.end});else{var s={min:t.state.values.min,max:t.state.values.max};t.state.values.mine.range.end&&(s.max=e.range.end),t.setState({startThreshold:e.range.start,endThreshold:e.range.end,values:s});var u={from:s.min,to:s.max},l={key:t.props.componentId,value:u};t.props.onValueChange&&t.props.onValueChange(l.value),S.URLParams.update(t.props.componentId,t.setURLParam(l.value),t.props.URLParams),S.selectedSensor.set(l,!0)}t.setRangeValue()}if(e.stepValue!==t.props.stepValue){var c=(n.end-n.start)%e.stepValue;if(c){t.setState({values:{min:t.state.values.min,max:n.end-c}});var p={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-c}};t.props.onValueChange&&t.props.onValueChange(p.value),S.URLParams.update(t.props.componentId,t.setURLParam(p.value),t.props.URLParams),S.selectedSensor.set(p,!0)}}},300)}},{key:"shouldComponentUpdate",value:function(e,t){return e.stepValue<=0||e.stepValue>Math.floor((e.range.end-e.range.start)/2)?(console.error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."),!1):!(t.values.max>t.endThreshold)}},{key:"componentWillUnmount",value:function(){this.channelId&&v["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setURLParam",value:function(e){return"from"in e&&"to"in e&&(e={start:e.from,end:e.to}),JSON.stringify(e)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField}},t={key:this.props.componentId+"-internal",value:{queryType:"range",inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};S.selectedSensor.setSensorInfo(e),S.selectedSensor.setSensorInfo(t),this.setRangeValue()}},{key:"setRangeValue",value:function(){var e={key:this.props.componentId+"-internal",value:this.props.range};this.props.onValueChange&&this.props.onValueChange(e.value),S.selectedSensor.set(e,!0)}},{key:"customQuery",value:function(e){if(e)return{range:a({},this.props.appbaseField,{gte:e.start,lte:e.end,boost:2})}}},{key:"histogramQuery",value:function(){return a({},this.props.appbaseField,{histogram:{field:this.props.appbaseField,interval:this.props.interval?this.props.interval:Math.ceil((this.props.range.end-this.props.range.start)/10)}})}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t.aggs={key:this.props.appbaseField,sort:"asc",size:1e3,customQuery:this.histogramQuery},t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.props.componentId+"-internal");var n=v["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery&&t.startTime>e.queryStartTime){e.queryStartTime=t.startTime?t.startTime:0;var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(n)}}),this.listenLoadingChannel(n)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"getSize",value:function(){return Math.min(this.props.range.end-this.props.range.start,this.maxSize)}},{key:"setData",value:function(e){try{this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}catch(t){console.log(t)}}},{key:"handleValuesChange",value:function(e,t){this.setState({values:t})}},{key:"countCalc",value:function(e,t,n){return n.map(function(e){return e.doc_count})}},{key:"addItemsToList",value:function(e){var t=this;e=k["default"].orderBy(e,["key"],["asc"]);var n=e.length,r=this.state.startThreshold?this.state.startThreshold:e[0].key,o=this.state.endThreshold?this.state.endThreshold:e[n-1].key;if(n>1){var a={counts:this.countCalc(r,o,e),startThreshold:r,endThreshold:o,values:{min:this.state.values.min,max:this.state.values.max}};this.setState(a,function(){k["default"].isEqual(a.values,t.state.currentValues)||t.handleResults(null,a.values)})}}},{key:"handleResults",value:function(e,t){var n=void 0;n=e?{min:e[0],max:e[1]}:t;var r={from:n.min,to:n.max},o={key:this.props.componentId,value:r};this.props.onValueChange&&this.props.onValueChange(o.value),S.URLParams.update(this.props.componentId,this.setURLParam(o.value),this.props.URLParams),S.selectedSensor.set(o,!0),this.setState({currentValues:n,values:n})}},{key:"render",value:function(){var e=null,t=null,n={};if(this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.counts&&this.state.counts.length&&this.props.showHistogram&&(t=p["default"].createElement(g.HistoGramComponent,{data:this.state.counts})),this.props.rangeLabels.start||this.props.rangeLabels.end){var r;r={},a(r,this.state.startThreshold,this.props.rangeLabels.start),a(r,this.state.endThreshold,this.props.rangeLabels.end),n=r}var o=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-labels-active":this.props.rangeLabels.start||this.props.rangeLabels.end,"rbc-labels-inactive":!this.props.rangeLabels.start&&!this.props.rangeLabels.end,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return p["default"].createElement("div",{className:"rbc rbc-rangeslider card thumbnail col s12 col-xs-12 "+o,style:this.props.componentStyle},e,t,p["default"].createElement("div",{className:"rbc-rangeslider-container col s12 col-xs-12"},p["default"].createElement(f["default"],{range:!0,value:[this.state.values.min,this.state.values.max],min:this.state.startThreshold,max:this.state.endThreshold,onChange:this.handleResults,step:this.props.stepValue,marks:n})),this.props.initialLoader&&this.state.queryStart?p["default"].createElement(b["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(c.Component);t["default"]=P,P.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),range:p["default"].PropTypes.shape({start:S.validateThreshold,end:S.validateThreshold}),rangeLabels:p["default"].PropTypes.shape({start:p["default"].PropTypes.string,end:p["default"].PropTypes.string}),defaultSelected:p["default"].PropTypes.shape({start:p["default"].PropTypes.number,end:p["default"].PropTypes.number}),stepValue:S.stepValidation,showHistogram:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,interval:p["default"].PropTypes.number,URLParams:p["default"].PropTypes.bool},P.defaultProps={title:null,range:{start:0,end:10},rangeLabels:{start:"",end:""},defaultSelected:{start:0,end:10},stepValue:1,showHistogram:!0,componentStyle:{},URLParams:!1},P.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},P.types={componentId:M.STRING,appbaseField:M.STRING,appbaseFieldType:M.NUMBER,title:M.STRING,react:M.OBJECT,range:M.OBJECT,rangeLabels:M.OBJECT,defaultSelected:M.OBJECT,stepValue:M.NUMBER,showHistogram:M.BOOLEAN,customQuery:M.FUNCTION,initialLoader:M.OBJECT,componentStyle:M.OBJECT,interval:M.NUMBER,URLParams:M.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(e[t]<1||e[t]>1e3)&&(n=new Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=new Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]<=0&&(n=new Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=new Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start<=0&&(r=new Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return!isNaN(e[t])&&r>=e.defaultSelected&&o<=e.defaultSelected||(n=new Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return e[t]<0&&(n=new Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=new Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n'],post_tags:[""],fields:e}}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.defaultSearchQuery}};this.props.highlight&&(e.value.externalQuery=this.highlightQuery()),w.selectedSensor.setSensorInfo(e);var t={key:this.searchInputId,value:{queryType:"multi_match",inputData:this.props.appbaseField,customQuery:this.defaultSearchQuery}};w.selectedSensor.setSensorInfo(t)}},{key:"setValue",value:function(e){var t={key:this.searchInputId,value:e};w.URLParams.update(this.props.componentId,e,this.props.URLParams),w.selectedSensor.set(t,!0),e&&""!==e.trim()?this.setState({options:[{label:e,value:e}],isLoadingOptions:!0,currentValue:e}):this.setState({options:[],isLoadingOptions:!1,currentValue:e})}},{key:"getValue",value:function(e,t){var n=void(arguments.length>2&&void 0!==arguments[2]?arguments[2]:0);return M["default"].has(t,e)?n=t[e]:e.indexOf(".")>-1&&!function(){var r="",o=e.split(".");o.forEach(function(e,a){r+=e,M["default"].isArray(M["default"].get(t,r))&&(r+="["+a+"]"),o.length-1!==a?r+=".":n=M["default"].get(t,r)})}(),n}},{key:"setData",value:function(e){var t=this,n=[];M["default"].isArray(this.props.appbaseField)?this.props.appbaseField:[this.props.appbaseField],e.hits.hits.map(function(e){if("string"===t.fieldType){var r=t.getValue(t.props.appbaseField.trim(),e._source);n.push({value:r,label:r})}else"object"===t.fieldType&&t.props.appbaseField.map(function(r){var o=t.getValue(r,e._source);o&&n.push({value:o,label:o})})}),this.state.currentValue&&""!==this.state.currentValue.trim()&&n.unshift({label:this.state.currentValue,value:this.state.currentValue}),n=this.removeDuplicates(n,"label"),this.setState({options:n,isLoadingOptions:!1})}},{key:"defaultSearchQuery",value:function(e){var t=null,n=void 0;return e&&(n="string"===this.fieldType?[this.props.appbaseField]:this.props.appbaseField,t={bool:{should:[{multi_match:{query:e,fields:n,type:"phrase_prefix"}},{multi_match:{query:e,fields:n}}],minimum_should_match:"1"}}),t}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.searchInputId);var n=g["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({rawData:r}),e.props.autocomplete&&e.setData(r)})}},{key:"checkDefault",value:function(){this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultValue&&this.defaultSelected!=this.defaultValue&&(this.defaultSelected=this.defaultValue,setTimeout(this.setValue.bind(this,this.defaultSelected),100),this.handleSearch({value:this.defaultSelected}))}},{key:"handleSearch",value:function(e){var t=e?e.value:null;t="null"===t?null:t;var n={key:this.props.componentId,value:t};w.selectedSensor.set(n,!0),this.setState({currentValue:t})}},{key:"handleInputChange",value:function(e){var t=e.target.value;this.setState({currentValue:t});var n={key:this.props.componentId,value:t};this.props.onValueChange&&this.props.onValueChange(n.value);var r=!0;w.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=d["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,y["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-autocomplete-active":this.props.autocomplete,"rbc-autocomplete-inactive":!this.props.autocomplete});return d["default"].createElement("div",{className:"rbc rbc-datasearch col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},e,this.props.autocomplete?d["default"].createElement(h["default"],u({isLoading:this.state.isLoadingOptions,value:this.state.currentValue,options:this.state.options,onInputChange:this.setValue,onChange:this.handleSearch,onBlurResetsInput:!1},this.props)):d["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},d["default"].createElement("input",{type:"text",className:"rbc-input",placeholder:this.props.placeholder,value:this.state.currentValue?this.state.currentValue:"",onChange:this.handleInputChange}),d["default"].createElement("span",{className:"rbc-search-icon"})))}}]),t}(p.Component);t["default"]=k,k.propTypes={componentId:d["default"].PropTypes.string.isRequired,appbaseField:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),title:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.element]),placeholder:d["default"].PropTypes.string,autocomplete:d["default"].PropTypes.bool,defaultSelected:d["default"].PropTypes.string,customQuery:d["default"].PropTypes.func,onValueChange:d["default"].PropTypes.func,react:d["default"].PropTypes.object,componentStyle:d["default"].PropTypes.object,highlight:d["default"].PropTypes.bool,highlightFields:d["default"].PropTypes.oneOfType([d["default"].PropTypes.string,d["default"].PropTypes.arrayOf(d["default"].PropTypes.string)]),URLParams:d["default"].PropTypes.bool},k.defaultProps={placeholder:"Search",autocomplete:!0,componentStyle:{},highlight:!1,URLParams:!1},k.contextTypes={appbaseRef:d["default"].PropTypes.any.isRequired,type:d["default"].PropTypes.any.isRequired},k.types={componentId:b.STRING,appbaseField:b.STRING,appbaseFieldType:b.STRING,react:b.OBJECT,title:b.STRING,placeholder:b.STRING,autocomplete:b.BOOLEAN,defaultSelected:b.STRING,customQuery:b.FUNCTION,componentStyle:b.OBJECT,highlight:b.BOOLEAN,URLParams:b.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&setTimeout(this.handleChange.bind(this,t),1e3)}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!_["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t;var n=e.state.data.filter(function(t){ +return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&(null!==e.urlParams?e.handleChange(n):setTimeout(e.handleChange.bind(e,n),1e3))}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};b.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){if(e.length>0)return e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}})}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}}},{key:"handleChange",value:function(e){var t=[];t=e.map(function(e){return e.label}),t=t.join(),this.setState({selected:t});var n={key:this.props.componentId,value:e},r=!0;this.props.onValueChange&&this.props.onValueChange(n.value),b.URLParams.update(this.props.componentId,t,this.props.URLParams),b.selectedSensor.set(n,r)}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return p["default"].createElement("div",{className:"rbc rbc-multidropdownrange col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"col s12 col-xs-12"},p["default"].createElement(f["default"],{options:this.state.data,value:this.state.selected,onChange:this.handleChange,clearable:!1,multi:!0,placeholder:this.props.placeholder,searchable:!0}))))}}]),t}(c.Component);t["default"]=T,T.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),placeholder:p["default"].PropTypes.string,data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},T.defaultProps={URLParams:!1},T.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},T.types={componentId:v.STRING,appbaseField:v.STRING,appbaseFieldType:v.NUMBER,data:v.OBJECT,defaultSelected:v.ARRAY,title:v.STRING,placeholder:v.STRING,customQuery:v.FUNCTION,componentStyle:v.OBJECT,URLParams:v.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!0}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&(null!==this.urlParams?this.handleChange(t):setTimeout(this.handleChange.bind(this,t),1e3))}}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){var t=null!==e.urlParams?e.urlParams:e.props.defaultSelected;if(!v["default"].isEqual(e.defaultSelected,t)){e.defaultSelected=t,e.resetState();var n=e.props.data.filter(function(e){return t.indexOf(e.label)>-1});n&&n.length&&setTimeout(e.handleChange.bind(e,n),1e3)}},300)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.length>0?e.map(function(e){return{range:a({},t,{gte:e.start,lte:e.end,boost:2})}}):null}if(e){var n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}};return n}return null}},{key:"handleChange",value:function(e){function t(e,t,o){o.label===e.label&&(r=t,n.splice(t,1))}var n=this.state.selected,r=null,o=e;v["default"].isArray(e)||(o=[e]),o.forEach(function(e){n.forEach(function(n,r){t(n,r,e)})}),null===r&&o.forEach(function(e){n.push(e)}),this.setState({selected:n});var a={key:this.props.componentId,value:n},i=!0;this.props.onValueChange&&this.props.onValueChange(a.value),g.URLParams.update(this.props.componentId,this.getSelectedLabels(n),this.props.URLParams),g.selectedSensor.set(a,i)}},{key:"getSelectedLabels",value:function(e){return e.map(function(e){return e.label})}},{key:"resetState",value:function(){this.setState({selected:[]});var e={key:this.props.componentId,value:[]},t=!0;g.URLParams.update(this.props.componentId,null,this.props.URLParams),g.selectedSensor.set(e,t)}},{key:"handleTagClick",value:function(e){var t=this.state.selected.filter(function(t){return t.label===e});this.handleChange(t[0])}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t){return p["default"].createElement("div",{className:"rbc-list-item row",key:t.label,onClick:function(){return e.handleChange(t)}},p["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:n.indexOf(t.label)>-1,value:t.label}),p["default"].createElement("label",{className:"rbc-label"},t.label))})),t}},{key:"render",value:function(){var e=this,t=null,n=[];this.props.title&&(t=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.selected&&this.state.selected.forEach(function(t){n.push(p["default"].createElement(b,{key:t.label,value:t.label,onClick:e.handleTagClick}))});var r=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return p["default"].createElement("div",{className:"rbc rbc-multirange col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},t,p["default"].createElement("div",{className:"col s12 col-xs-12 rbc-list-container"},n.length?p["default"].createElement("div",{className:"row",style:{marginTop:"0"}},n):null,this.renderButtons())))}}]),t}(c.Component);t["default"]=_;var b=function(e){return p["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},p["default"].createElement("a",{className:"close"},"×"),p["default"].createElement("span",null,e.value))};b.propTypes={onClick:p["default"].PropTypes.func.isRequired,value:p["default"].PropTypes.string.isRequired},_.propTypes={appbaseField:p["default"].PropTypes.string.isRequired,componentId:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.array,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;nr;return p["default"].createElement("div",{className:"rbc-numberbox-container col s12 col-xs-12"},p["default"].createElement("div",{className:"rbc-label"},t),p["default"].createElement("div",{className:"rbc-numberbox-btn-container"},p["default"].createElement(g,{isActive:s,handleChange:o,type:"minus"}),p["default"].createElement("span",{className:"rbc-numberbox-number"},a),p["default"].createElement(g,{isActive:i,handleChange:o,type:"plus"})))},b=function(e){function t(e,n){i(this,t);var r=s(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e)),o=r.props.focused;r.urlParams=y.URLParams.get(r.props.componentId);var a=null!==r.urlParams?r.urlParams:r.props.defaultSelected;return r.state={currentValue:a?a:r.props.data.start,focused:o},r.type="term",r.handleChange=r.handleChange.bind(r),r.customQuery=r.customQuery.bind(r),r}return u(t,e),l(t,[{key:"componentDidMount",value:function(){this.setQueryInfo(),null!==this.urlParams?this.updateQuery(this.urlParams):setTimeout(this.handleChange.bind(this),1e3)}},{key:"componentWillReceiveProps",value:function(e){var t=this;setTimeout(function(){var n=null!==t.urlParams?t.urlParams:t.props.defaultSelected;!n&&0!==n||n===t.state.currentValue||t.setState({currentValue:n}),e.queryFormat!==t.queryFormat&&(t.queryFormat=e.queryFormat,t.updateQuery())},300)}},{key:"customQuery",value:function(e){var t=null;if(e&&(e.value||0===e.value)){var n=e.value;switch(this.props.queryFormat){case"exact":t=this.exactQuery(n);break;case"lte":t=this.lteQuery(n);break;case"gte":default:t=this.gteQuery(n)}}return t}},{key:"exactQuery",value:function(e){return a({},this.type,a({},this.props.appbaseField,e))}},{key:"gteQuery",value:function(e){return{range:a({},this.props.appbaseField,{gte:e,boost:2})}}},{key:"lteQuery",value:function(e){return{range:a({},this.props.appbaseField,{lte:e,boost:2})}}},{key:"setQueryInfo",value:function(){var e=this.props,t=e.componentId,n=e.appbaseField,r={key:t,value:{queryType:this.type,inputData:n,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};y.selectedSensor.setSensorInfo(r)}},{key:"handleChange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=this.props,n=(t.componentId,t.data),r=n.start,o=n.end,a=this.state.currentValue;r=void 0!=r?r:a-1,o=void 0!=o?o:a+1,e>0&&ar&&(a-=1),this.setState({currentValue:a},this.updateQuery.bind(this))}},{key:"updateQuery",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.start.currentValue,t={key:this.props.componentId,value:{value:e,queryFormat:this.props.queryFormat}};this.props.onValueChange&&this.props.onValueChange(t.value),y.URLParams.update(this.props.componentId,e,this.props.URLParams),y.selectedSensor.set(t,!0)}},{key:"render",value:function(){var e=this.props,t=e.title,n=e.data,r=e.labelPosition,o=this.state.currentValue,a=t?p["default"].createElement(v,{title:t}):null,i=(0,f["default"])({"rbc-title-active":t,"rbc-title-inactive":!t});return p["default"].createElement("div",{className:"rbc rbc-numberbox col s12 col-xs-12 card thumbnail "+i+" rbc-label-"+r,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},a,p["default"].createElement(_,{handleChange:this.handleChange,value:o,label:n.label,start:n.start,end:n.end})))}}]),t}(c.Component);t["default"]=b,b.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.shape({start:y.validateThreshold,end:y.validateThreshold,label:p["default"].PropTypes.string}),defaultSelected:y.valueValidation,labelPosition:p["default"].PropTypes.oneOf(["top","bottom","left","right"]),customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,queryFormat:p["default"].PropTypes.oneOf(["exact","gte","lte"]),URLParams:p["default"].PropTypes.bool},b.defaultProps={componentStyle:{},queryFormat:"gte",URLParams:!1},b.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},b.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.NUMBER,title:m.STRING,data:m.OBJECT,defaultSelected:m.NUMBER,labelPosition:m.STRING,customQuery:m.FUNCTION,componentStyle:m.OBJECT,queryFormat:m.STRING,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=function(){function e(e,t){for(var n=0;n=n.end){var r=(n.end-n.start)%e.stepValue;r?!function(){t.setState({values:{min:t.state.values.min,max:n.end-r}});var e={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-r}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(e.value),S.URLParams.update(t.props.componentId,t.setURLParam(e.value),t.props.URLParams),S.selectedSensor.set(e,!0)},1e3)}():!function(){var e={};e.min=n.start,e.max=n.end,t.setState({values:e,currentValues:e});var r={key:t.props.componentId,value:{from:e.min,to:e.max}};setTimeout(function(){t.props.onValueChange&&t.props.onValueChange(r.value),S.URLParams.update(t.props.componentId,t.setURLParam(r.value),t.props.URLParams),S.selectedSensor.set(r,!0)},1e3)}()}if(e.range.start!==t.state.startThreshold||e.range.end!==t.state.endThreshold){if(e.range.start<=n.start&&e.range.end>=n.end)t.setState({startThreshold:e.range.start,endThreshold:e.range.end});else{var o={min:t.state.values.min,max:t.state.values.max};t.state.values.mine.range.end&&(o.max=e.range.end),t.setState({startThreshold:e.range.start,endThreshold:e.range.end,values:o});var a={from:o.min,to:o.max},i={key:t.props.componentId,value:a};t.props.onValueChange&&t.props.onValueChange(i.value),S.URLParams.update(t.props.componentId,t.setURLParam(i.value),t.props.URLParams),S.selectedSensor.set(i,!0)}t.setRangeValue()}if(e.stepValue!==t.props.stepValue){var s=(n.end-n.start)%e.stepValue;if(s){t.setState({values:{min:t.state.values.min,max:n.end-s}});var u={key:t.props.componentId,value:{from:t.state.values.min,to:n.end-s}};t.props.onValueChange&&t.props.onValueChange(u.value),S.URLParams.update(t.props.componentId,t.setURLParam(u.value),t.props.URLParams),S.selectedSensor.set(u,!0)}}},300)}},{key:"shouldComponentUpdate",value:function(e,t){return e.stepValue<=0||e.stepValue>Math.floor((e.range.end-e.range.start)/2)?(console.error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."),!1):!(t.values.max>t.endThreshold)}},{key:"componentWillUnmount",value:function(){this.channelId&&v["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setURLParam",value:function(e){return"from"in e&&"to"in e&&(e={start:e.from,end:e.to}),JSON.stringify(e)}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField}},t={key:this.props.componentId+"-internal",value:{queryType:"range",inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};S.selectedSensor.setSensorInfo(e),S.selectedSensor.setSensorInfo(t),this.setRangeValue()}},{key:"setRangeValue",value:function(){var e={key:this.props.componentId+"-internal",value:this.props.range};this.props.onValueChange&&this.props.onValueChange(e.value),S.selectedSensor.set(e,!0)}},{key:"customQuery",value:function(e){if(e)return{range:a({},this.props.appbaseField,{gte:e.start,lte:e.end,boost:2})}}},{key:"histogramQuery",value:function(){return a({},this.props.appbaseField,{histogram:{field:this.props.appbaseField,interval:this.props.interval?this.props.interval:Math.ceil((this.props.range.end-this.props.range.start)/10)}})}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t.aggs={key:this.props.appbaseField,sort:"asc",size:1e3,customQuery:this.histogramQuery},t&&t.and&&"string"==typeof t.and?t.and=[t.and]:t.and=t.and?t.and:[],t.and.push(this.props.componentId+"-internal");var n=v["default"].create(this.context.appbaseRef,this.context.type,t);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery&&t.startTime>e.queryStartTime){e.queryStartTime=t.startTime?t.startTime:0;var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(n)}}),this.listenLoadingChannel(n)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"getSize",value:function(){return Math.min(this.props.range.end-this.props.range.start,this.maxSize)}},{key:"setData",value:function(e){try{this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}catch(t){console.log(t)}}},{key:"handleValuesChange",value:function(e,t){this.setState({values:t})}},{key:"countCalc",value:function(e,t,n){return n.map(function(e){return e.doc_count})}},{key:"addItemsToList",value:function(e){var t=this;e=k["default"].orderBy(e,["key"],["asc"]);var n=e.length,r=this.state.startThreshold?this.state.startThreshold:e[0].key,o=this.state.endThreshold?this.state.endThreshold:e[n-1].key;n>1&&!function(){var n={counts:t.countCalc(r,o,e),startThreshold:r,endThreshold:o,values:{min:t.state.values.min,max:t.state.values.max}};t.setState(n,function(){k["default"].isEqual(n.values,t.state.currentValues)||t.handleResults(null,n.values)})}()}},{key:"handleResults",value:function(e,t){var n=void 0;n=e?{min:e[0],max:e[1]}:t;var r={from:n.min,to:n.max},o={key:this.props.componentId,value:r};this.props.onValueChange&&this.props.onValueChange(o.value),S.URLParams.update(this.props.componentId,this.setURLParam(o.value),this.props.URLParams),S.selectedSensor.set(o,!0),this.setState({currentValues:n,values:n})}},{key:"render",value:function(){var e=null,t=null,n={};if(this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title)),this.state.counts&&this.state.counts.length&&this.props.showHistogram&&(t=p["default"].createElement(g.HistoGramComponent,{data:this.state.counts})),this.props.rangeLabels.start||this.props.rangeLabels.end){var r;r={},a(r,this.state.startThreshold,this.props.rangeLabels.start),a(r,this.state.endThreshold,this.props.rangeLabels.end),n=r}var o=(0,m["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-labels-active":this.props.rangeLabels.start||this.props.rangeLabels.end,"rbc-labels-inactive":!this.props.rangeLabels.start&&!this.props.rangeLabels.end,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return p["default"].createElement("div",{className:"rbc rbc-rangeslider card thumbnail col s12 col-xs-12 "+o,style:this.props.componentStyle},e,t,p["default"].createElement("div",{className:"rbc-rangeslider-container col s12 col-xs-12"},p["default"].createElement(f["default"],{range:!0,value:[this.state.values.min,this.state.values.max],min:this.state.startThreshold,max:this.state.endThreshold,onChange:this.handleResults,step:this.props.stepValue,marks:n})),this.props.initialLoader&&this.state.queryStart?p["default"].createElement(b["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(c.Component);t["default"]=P,P.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),range:p["default"].PropTypes.shape({start:S.validateThreshold,end:S.validateThreshold}),rangeLabels:p["default"].PropTypes.shape({start:p["default"].PropTypes.string,end:p["default"].PropTypes.string}),defaultSelected:p["default"].PropTypes.shape({start:p["default"].PropTypes.number,end:p["default"].PropTypes.number}),stepValue:S.stepValidation,showHistogram:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,initialLoader:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),react:p["default"].PropTypes.object,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,interval:p["default"].PropTypes.number,URLParams:p["default"].PropTypes.bool},P.defaultProps={title:null,range:{start:0,end:10},rangeLabels:{start:"",end:""},defaultSelected:{start:0,end:10},stepValue:1,showHistogram:!0,componentStyle:{},URLParams:!1},P.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},P.types={componentId:M.STRING,appbaseField:M.STRING,appbaseFieldType:M.NUMBER,title:M.STRING,react:M.OBJECT,range:M.OBJECT,rangeLabels:M.OBJECT,defaultSelected:M.OBJECT,stepValue:M.NUMBER,showHistogram:M.BOOLEAN,customQuery:M.FUNCTION,initialLoader:M.OBJECT,componentStyle:M.OBJECT,interval:M.NUMBER,URLParams:M.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t-1});t&&t.length&&t.forEach(function(t){null!==e.urlParams?e.handleChange(t):setTimeout(e.handleChange.bind(e,t),1e3)})}}},{key:"componentWillUpdate",value:function(){var e=this,t=null!==this.urlParams?this.urlParams:this.props.defaultSelected;if(this.defaultSelected!=t){this.defaultSelected=t,this.defaultSelected=v["default"].isArray(this.defaultSelected)?this.defaultSelected:[this.defaultSelected];var n=this.props.data.filter(function(t){return e.defaultSelected.indexOf(t.label)>-1});n&&n.length&&n.forEach(function(t){setTimeout(e.handleChange.bind(e,t),1e3)})}}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.props.customQuery?this.props.customQuery:this.customQuery}};g.selectedSensor.setSensorInfo(e)}},{key:"customQuery",value:function(e){function t(t){return e.map(function(e,n){return{term:a({},t,e.value)}})}var n=null;return e&&e.length?n={bool:{should:t(this.props.appbaseField),minimum_should_match:1,boost:1}}:n}},{key:"handleChange",value:function(e){var t=this.state.selected,n=[],r=null;t.forEach(function(n,o){e.label===n.label&&(r=o,t.splice(o,1))}),null===r?this.props.multiSelect?(t.push(e),n=t):n.push(e):n=t,this.setState({selected:n});var o={key:this.props.componentId,value:n},a=!0;this.props.onValueChange&&this.props.onValueChange(o.value),g.URLParams.update(this.props.componentId,this.setURLValue(n),this.props.URLParams),g.selectedSensor.set(o,a)}},{key:"setURLValue",value:function(e){return e.map(function(e){return e.label})}},{key:"renderButtons",value:function(){var e=this,t=void 0,n=this.state.selected.map(function(e){return e.label});return this.props.data&&(t=this.props.data.map(function(t,r){return p["default"].createElement("button",{key:r,className:"btn rbc-btn "+(n.indexOf(t.label)>-1?"rbc-btn-active":"rbc-btn-inactive"),onClick:function(){return e.handleChange(t)},title:t.title?t.title:t.label},t.label)})),t}},{key:"render",value:function(){var e=null;this.props.title&&(e=p["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var t=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-multiselect-active":this.props.multiSelect,"rbc-multiselect-inactive":!this.props.multiSelect});return p["default"].createElement("div",{className:"rbc rbc-togglebutton col s12 col-xs-12 card thumbnail "+t,style:this.props.componentStyle},p["default"].createElement("div",{className:"row"},e,p["default"].createElement("div",{className:"rbc-buttongroup col s12 col-xs-12"},this.renderButtons())))}}]),t}(c.Component);t["default"]=_,_.propTypes={componentId:p["default"].PropTypes.string.isRequired,appbaseField:p["default"].PropTypes.string.isRequired,title:p["default"].PropTypes.oneOfType([p["default"].PropTypes.string,p["default"].PropTypes.element]),data:p["default"].PropTypes.any.isRequired,defaultSelected:p["default"].PropTypes.oneOfType([p["default"].PropTypes.array,p["default"].PropTypes.string]),multiSelect:p["default"].PropTypes.bool,customQuery:p["default"].PropTypes.func,onValueChange:p["default"].PropTypes.func,componentStyle:p["default"].PropTypes.object,URLParams:p["default"].PropTypes.bool},_.defaultProps={multiSelect:!0,componentStyle:{},URLParams:!1},_.contextTypes={appbaseRef:p["default"].PropTypes.any.isRequired,type:p["default"].PropTypes.any.isRequired},_.types={componentId:m.STRING,appbaseField:m.STRING,appbaseFieldType:m.KEYWORD,title:m.STRING,data:m.OBJECT,defaultSelected:m.ARRAY,multiSelect:m.BOOLEAN,customQuery:m.FUNCTION,componentStyle:m.OBJECT,URLParams:m.BOOLEAN}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var l=Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]&&arguments[0];this.setGeoQueryInfo(),this.createChannel(e);var t=this.getMapStyle(this.props.defaultMapStyle);this.initialMapBoundQuery=!!this.props.defaultCenter,this.applyGeoQuery=this.props.applyGeoQuery?this.props.applyGeoQuery:this.props.setSearchAsMove,this.setState({currentMapStyle:t})}},{key:"componentWillReceiveProps",value:function(e){e.defaultMapStyle!==this.props.defaultMapStyle&&this.mapStyleChange(this.getMapStyle(e.defaultMapStyle))}},{key:"componentWillUpdate",value:function(){var e=this;setTimeout(function(){e.streamProp!==e.props.stream&&(e.streamProp=e.props.stream,e.removeChannel(),e.initialize()),e.sizeProp!==e.props.size&&(e.sizeProp=e.props.size,e.removeChannel(),e.initialize(!0))},300)}},{key:"componentWillUnmount",value:function(){this.removeChannel()}},{key:"removeChannel",value:function(){this.channelId&&(_.AppbaseChannelManager.stopStream(this.channelId),this.channelId=null),this.channelListener&&this.channelListener.remove()}},{key:"createChannel",value:function(){var e=this,t=this.props.react?this.props.react:{};t&&t.and?"string"==typeof t.and&&(t.and=[t.and]):t.and=[],t.or=t.or?t.or:[],t.or.push("geoQuery"),t.and.push("streamChanges");var n=_.AppbaseChannelManager.create(this.context.appbaseRef,this.context.type,t,this.props.size,this.props.from,this.props.stream);this.channelId=n.channelId,this.channelListener=n.emitter.addListener(n.channelId,function(t){function n(){"historic"===t.mode&&t.startTime>this.queryStartTime?this.afterChannelResponse(t):"streaming"===t.mode&&this.afterChannelResponse(t)}function r(){if(t.error&&t.startTime>this.queryStartTime){if(this.props.onAllData){var e=_.AppbaseSensorHelper.prepareResultData(t);this.props.onAllData(e.res,e.err)}}else t.appliedQuery&&(this.state.mapBounds?this.props.autoMapRender?n.call(this):o.hits.hits.length&&n.call(this):n.call(this))}var o=t.data;r.call(e)});var r={key:"streamChanges",value:""};_.AppbaseSensorHelper.selectedSensor.set(r,!0)}},{key:"afterChannelResponse",value:function(e){var t=this,n=w.afterChannelResponse(e,this.state.rawData,this.props.appbaseField,this.state.markersData);this.reposition=!0,this.streamFlag=n.streamFlag,this.queryStartTime=n.queryStartTime?n.queryStartTime:0,this.setState({rawData:n.rawData,markersData:n.markersData},function(){if(t.props.onAllData){e.allMarkers=n.rawData;var r=JSON.parse(JSON.stringify(e));if(r.newData=n.newData,r.currentData=n.currentData,delete r.data,r=_.AppbaseSensorHelper.prepareResultData(r,e.data),t.props.onAllData){r.res&&(r.res.mapRef=t.mapRef);var o=t.props.onAllData(r.res,r.err);t.setState({externalData:o})}}t.streamFlag&&t.streamMarkerInterval()})}},{key:"setGeoQueryInfo",value:function(){var e={key:"geoQuery",value:{queryType:"geo_bounding_box",inputData:this.props.appbaseField,customQuery:this.geoCustomQuery}},t={key:"updateExecute",value:{queryType:"random",inputData:this.props.appbaseField}};_.AppbaseSensorHelper.selectedSensor.setSensorInfo(e),_.AppbaseSensorHelper.selectedSensor.setSensorInfo(t)}},{key:"geoCustomQuery",value:function(e){var t=null;return e&&(this.initialMapBoundQuery||this.searchAsMove)&&(t={geo_bounding_box:a({},this.props.appbaseField,e)},this.geoRelatedEventsChange?this.geoRelatedEventsChange=!1:this.applyGeoQuery&&(this.applyGeoQuery=!1),this.initialMapBoundQuery=!1),t}},{key:"updateExecute",value:function(){setTimeout(function(){var e={key:"updateExecute",value:Math.random()};_.AppbaseSensorHelper.selectedSensor.set(e,!0)},1e3)}},{key:"handleMarkerClick",value:function(e){var t=this;e.showInfo=!0,this.reposition=!1,this.setState({rerender:!0},function(){t.props.popoverTTL&&t.watchPopoverTTL(e)})}},{key:"handleMarkerClose",value:function(e){e.showInfo=!1,this.reposition=!1,this.setState(this.state)}},{key:"watchPopoverTTL",value:function(e){var t=this;this.popoverTTLStore=this.popoverTTLStore?this.popoverTTLStore:{},this.popoverTTLStore[e._type+e._id]?this.clearTTL(e._type+e._id):this.popoverTTLStore[e._type+e._id]=setTimeout(function(){t.handleMarkerClose(e),t.clearTTL(e._type+e._id)},1e3*this.props.popoverTTL)}},{key:"clearTTL",value:function(e){clearTimeout(this.popoverTTLStore[e]),delete this.popoverTTLStore[e]}},{key:"renderInfoWindow",value:function(e,t){var n=this,r=this.props.onPopoverTrigger?this.props.onPopoverTrigger(t):"Popver";return f["default"].createElement(h.InfoWindow,{zIndex:500,key:e+"_info_window",onCloseclick:function(){return n.handleMarkerClose(t)}},f["default"].createElement("div",null,r))}},{key:"handleOnIdle",value:function(){var e=this.mapRef?this.mapRef.getBounds():null;if(e){var t=e.getNorthEast().lat(),n=e.getSouthWest().lat(),r=e.getNorthEast().lng(),o=e.getSouthWest().lng(),a={top_left:[o,t],bottom_right:[r,n]},i={mapBounds:e};if(this.props.onIdle){var s=this.props.onIdle(this.mapRef,{boundingBoxCoordinates:a,mapBounds:e});i.externalData=s}if(this.initialMapBoundQuery||this.applyGeoQuery||this.geoRelatedEventsChange&&this.searchAsMove&&!this.searchQueryProgress){var u=!!this.initialMapBoundQuery||(this.applyGeoQuery?this.applyGeoQuery:this.searchAsMove);this.setValue(a,u)}this.setState(i)}}},{key:"handleOnDrage",value:function(){this.storeCenter=null}},{key:"setValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={key:"geoQuery",value:e};_.AppbaseSensorHelper.selectedSensor.set(n,t)}},{key:"searchAsMoveChange",value:function(e){this.searchAsMove=e,e&&this.mapRef&&(this.geoRelatedEventsChange=!0,this.handleOnIdle())}},{key:"mapStyleChange",value:function(e){this.setState({currentMapStyle:e})}},{key:"handleBoundsChanged",value:function(){var e=this;this.searchQueryProgress&&setTimeout(function(){e.searchQueryProgress=!1},1e3)}},{key:"streamMarkerInterval",value:function(){var e=this,t=this.state.markersData,n=t.filter(function(e){return e.stream&&e.streamStart});n.length?(this.isStreamDataExists=!0,setTimeout(function(){return e.streamToNormal()},1e3*this.props.streamTTL)):this.isStreamDataExists=!1}},{key:"streamToNormal",value:function(){var e=this,t=this.state.markersData,n=t.filter(function(e){return e.stream&&e.streamStart});n.length?(t=t.map(function(t){if(t.stream&&t.streamStart){var n=new Date,r=(n.getTime()-t.streamStart.getTime())/1e3;r>=e.props.streamTTL&&(delete t.stream,delete t.streamStart)}return t}),this.setState({markersData:t})):this.isStreamDataExists=!1}},{key:"getIcon",value:function(e){return e.stream?this.props.streamMarkerImage:this.props.defaultMarkerImage}},{key:"chooseIcon",value:function(e){var t=e.external_icon?e.external_icon:this.getIcon(e);t=this.props.onData?this.props.onData(e):t;var n=!!("object"===("undefined"==typeof t?"undefined":c(t))&&"path"in t);if(n&&(t=JSON.parse(JSON.stringify(t)),this.props.autoMarkerPosition)){var r=e.angleDeg?e.angleDeg:0;t.rotation=r}return t}},{key:"combineProps",value:function(e){var t=void 0,n={};return this.state.externalData&&this.state.externalData.markers&&this.state.externalData.markers[e._id]&&(t=this.state.externalData.markers[e._id],Object.keys(t).forEach(function(r){e["external_"+r]=t[r],n[r]=t[r]})),n.icon=this.chooseIcon(e),n}},{key:"generateMarkers",value:function(){var e=this,t=this,n=this.state.markersData,r={markerComponent:[],defaultCenter:null,convertedGeo:[]};return n&&n.length&&(n=n.filter(function(e){return w.identifyGeoData(e._source[t.props.appbaseField])}),r.markerComponent=n.map(function(n,o){var a=w.identifyGeoData(n._source[t.props.appbaseField]);r.convertedGeo.push(a);var i={position:a},s="marker_ref_"+o,u=void 0;if(e.props.showPopoverOn){u={};var c=e.props.showPopoverOn.split("");c[0]=c[0].toUpperCase(),c=c.join(""),u["on"+c]=e.handleMarkerClick.bind(e,n)}else u={},u.onClick=e.handleMarkerClick.bind(e,n);var p=function(){},d={onClick:e.props.markerOnClick?e.props.markerOnClick:p,onDblclick:e.props.markerOnDblclick?e.props.markerOnDblclick:p,onMouseover:e.props.onMouseover?e.props.onMouseover:p,onMouseout:e.props.onMouseout?e.props.onMouseout:p};return f["default"].createElement(h.Marker,l({},i,{key:n._id,zIndex:1,ref:s},t.combineProps(n),{onClick:function(){return d.onClick(n._source)},onDblclick:function(){return d.onDblclick(n._source)},onMouseover:function(){return d.onMouseover(n._source)},onMouseout:function(){return d.onMouseout(n._source)}},u),n.showInfo?t.renderInfoWindow(s,n):null)}),r.convertedGeo[0]&&(r.defaultCenter={lat:r.convertedGeo[0].lat,lng:r.convertedGeo[0].lng})),this.props.showMarkers||(r.markerComponent=[]),r}},{key:"externalData",value:function(){var e=this,t=[];return this.state.externalData&&Object.keys(this.state.externalData).forEach(function(n){"markers"!==n&&(t=t.concat(e.state.externalData[n]))}),t}},{key:"mapEvents",value:function(e){if(this.geoRelatedEvents.indexOf(e)>-1&&(this.geoRelatedEventsChange=!0),this.props[e]){var t=this.props[e](this.mapRef);t&&this.setState({externalData:t})}}},{key:"getStoreCenter",value:function(){return this.storeCenter?this.storeCenter:this.state.center}},{key:"render",value:function(){var e=this,t=void 0,n=void 0,r=void 0,o=null,a=null,i={},s=this.generateMarkers();t=this.props.setMarkerCluster?f["default"].createElement(y["default"],{averageCenter:!0,enableRetinaIcons:!0,gridSize:60},s.markerComponent):s.markerComponent;var u=!0;"streaming"!==this.channelMethod||this.props.streamAutoCenter||(u=!1),this.props.autoCenter&&this.reposition&&u?(a=s.defaultCenter?s.defaultCenter:this.getStoreCenter(),this.storeCenter=a,this.reposition=!1,i.center=w.normalizeCenter(a)):this.storeCenter?(a=this.storeCenter,i.center=w.normalizeCenter(a)):a=null,this.props.showSearchAsMove&&(n=f["default"].createElement(b.SearchAsMove,{searchAsMoveDefault:this.props.setSearchAsMove,searchAsMoveChange:this.searchAsMoveChange})),this.props.showMapStyles&&(r=f["default"].createElement(T.MapStyles,{defaultSelected:this.props.defaultMapStyle,mapStyleChange:this.mapStyleChange})),this.props.title&&(o=f["default"].createElement("h4",{className:"rbc-title col s12 m8 col-xs-12 col-sm-8"},this.props.title));var c=(0,g["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title});return f["default"].createElement("div",{className:"rbc rbc-reactivemap col s12 col-xs-12 card thumbnail "+c,style:w.mapPropsStyles(this.props.componentStyle,"component")},o,r,f["default"].createElement(h.GoogleMapLoader,{containerElement:f["default"].createElement("div",{className:"rbc-container col s12 col-xs-12",style:w.mapPropsStyles(this.props.componentStyle,"map",this.mapDefaultHeight)}),googleMapElement:f["default"].createElement(h.GoogleMap,l({ref:function(t){ e.mapRef=t}},i,w.normalizeProps(this.props),{options:{styles:this.state.currentMapStyle},defaultCenter:w.normalizeCenter(this.state.defaultCenter),onDragstart:function(){e.handleOnDrage(),e.mapEvents("onDragstart")},onIdle:function(){return e.handleOnIdle()},onClick:function(){return e.mapEvents("onClick")},onDblclick:function(){return e.mapEvents("onDblclick")},onDrag:function(){return e.mapEvents("onDrag")},onDragend:function(){return e.mapEvents("onDragend")},onMousemove:function(){return e.mapEvents("onMousemove")},onMouseout:function(){return e.mapEvents("onMouseout")},onMouseover:function(){return e.mapEvents("onMouseover")},onResize:function(){return e.mapEvents("onResize")},onRightclick:function(){return e.mapEvents("onRightclick")},onTilesloaded:function(){return e.mapEvents("onTilesloaded")},onBoundsChanged:function(){return e.mapEvents("onBoundsChanged")},onCenterChanged:function(){return e.mapEvents("onCenterChanged")},onProjectionChanged:function(){return e.mapEvents("onProjectionChanged")},onTiltChanged:function(){return e.mapEvents("onTiltChanged")},onZoomChanged:function(){return e.mapEvents("onZoomChanged")}}),t,this.externalData())}),n,f["default"].createElement(_.PoweredBy,null))}}]),t}(d.Component);t["default"]=k,k.propTypes={appbaseField:f["default"].PropTypes.string.isRequired,onIdle:f["default"].PropTypes.func,onAllData:f["default"].PropTypes.func,onData:f["default"].PropTypes.func,onPopoverTrigger:f["default"].PropTypes.func,setMarkerCluster:f["default"].PropTypes.bool,autoMarkerPosition:f["default"].PropTypes.bool,showMarkers:f["default"].PropTypes.bool,streamTTL:w.validation.streamTTL,popoverTTL:w.validation.popoverTTL,size:_.AppbaseSensorHelper.sizeValidation,from:w.validation.fromValidation,autoMapRender:f["default"].PropTypes.bool,componentStyle:f["default"].PropTypes.object,autoCenter:f["default"].PropTypes.bool,showSearchAsMove:f["default"].PropTypes.bool,setSearchAsMove:f["default"].PropTypes.bool,defaultMapStyle:f["default"].PropTypes.oneOf(["Standard","Blue Essence","Blue Water","Flat Map","Light Monochrome","Midnight Commander","Unsaturated Browns"]),title:f["default"].PropTypes.oneOfType([f["default"].PropTypes.string,f["default"].PropTypes.element]),streamAutoCenter:f["default"].PropTypes.bool,defaultMarkerImage:f["default"].PropTypes.string,streamMarkerImage:f["default"].PropTypes.string,stream:f["default"].PropTypes.bool,defaultZoom:w.validation.defaultZoom,applyGeoQuery:f["default"].PropTypes.bool,showPopoverOn:f["default"].PropTypes.oneOf(["click","mouseover"]),defaultCenter:f["default"].PropTypes.shape({lat:w.validation.validCenter,lon:w.validation.validCenter}),react:f["default"].PropTypes.object,markerOnClick:f["default"].PropTypes.func,markerOnDblclick:f["default"].PropTypes.func,onMouseover:f["default"].PropTypes.func,onMouseout:f["default"].PropTypes.func,showMapStyles:f["default"].PropTypes.bool},k.defaultProps={setMarkerCluster:!0,autoCenter:!0,showSearchAsMove:!0,setSearchAsMove:!1,showMapStyles:!0,defaultMapStyle:"Standard",from:0,size:100,streamTTL:5,streamAutoCenter:!1,autoMarkerPosition:!1,showMarkers:!0,autoMapRender:!0,defaultMarkerImage:"https://opensource.appbase.io/reactivemaps/dist/images/historic-pin.png",streamMarkerImage:"https://opensource.appbase.io/reactivemaps/dist/images/stream-pin.png",componentStyle:{},stream:!1,applyGeoQuery:!1,defaultZoom:13},k.contextTypes={appbaseRef:f["default"].PropTypes.any.isRequired,type:f["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.ItemCheckboxList=void 0;var s=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]&&arguments[0],c[this.state.selectedValue].value);this.props.mapStyleChange(e)}},{key:"render",value:function(){var e=this.state.items.map(function(e,t){return l["default"].createElement("option",{value:t,key:t},e.key)});return l["default"].createElement("div",{className:"input-field col rbc-mapstyles pull-right right"},l["default"].createElement("select",{className:"browser-default form-control",onChange:this.handleSelect,value:this.state.selectedValue,name:"mapStyles",id:"mapStyles"},e))}}]),t}(u.Component);p.propTypes={},p.defaultProps={fieldName:"MapStyles"}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0}),t.SearchAsMove=void 0;var s=function(){function e(e,t){for(var n=0;n20)return new Error("zoom value should be an integer between 0 and 20.")},validCenter:function(e,t,n){return isNaN(e[t])?new Error(t+" value must be number"):"lat"===t&&(e[t]<-90||e[t]>90)?new Error(t+" value should be between -90 and 90."):"lng"===t&&(e[t]<-180||e[t]>180)?new Error(t+" value should be between -180 and 180."):void 0},fromValidation:function(e,t,n){if(e[t]<0)return new Error(t+" value should be greater than or equal to 0.")},streamTTL:function(e,t,n){if(e[t]<0||e[t]>1e3)return new Error(t+" should be a positive integer between 0 and 1000, counted in seconds for a streaming update to be visible.")},popoverTTL:function(e,t,n){if(e[t]<.1||e[t]>60)return new Error(t+" should be a positive integer between 1 and 60, counted in seconds for a popover to be visible.")}},t.normalizeCenter=function(e){return e&&e.lon&&(e.lng=e.lon),e});t.normalizeProps=function(e){var t=JSON.parse(JSON.stringify(e));return t.defaultCenter&&(t.defaultCenter=p(t.defaultCenter)),t.center&&(t.center=p(t.center)),t},t.mapPropsStyles=function(e,t,n){var r=JSON.parse(JSON.stringify(e)),o=void 0;return"component"===t?o=r:"map"===t&&(o={height:r.height?r.height:n}),o}},function(e,t){"use strict";e.exports=[{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#e0efef"}]},{featureType:"poi",elementType:"geometry.fill",stylers:[{visibility:"on"},{hue:"#1900ff"},{color:"#c0e8e8"}]},{featureType:"road",elementType:"geometry",stylers:[{lightness:100},{visibility:"simplified"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"transit.line",elementType:"geometry",stylers:[{visibility:"on"},{lightness:700}]},{featureType:"water",elementType:"all",stylers:[{color:"#7dcdcd"}]}]},function(e,t){"use strict";e.exports=[{featureType:"administrative",elementType:"labels.text.fill",stylers:[{color:"#444444"}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#f2f2f2"}]},{featureType:"poi",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"road",elementType:"all",stylers:[{saturation:-100},{lightness:45}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"simplified"}]},{featureType:"road.arterial",elementType:"labels.icon",stylers:[{visibility:"off"}]},{featureType:"transit",elementType:"all",stylers:[{visibility:"off"}]},{featureType:"water",elementType:"all",stylers:[{color:"#46bcec"},{visibility:"on"}]}]},function(e,t){"use strict";e.exports=[{featureType:"all",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"landscape",elementType:"all",stylers:[{visibility:"on"},{color:"#f3f4f4"}]},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{weight:.9},{visibility:"off"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#83cead"}]},{featureType:"road",elementType:"all",stylers:[{visibility:"on"},{color:"#ffffff"}]},{featureType:"road",elementType:"labels",stylers:[{visibility:"off"}]},{featureType:"road.highway",elementType:"all",stylers:[{visibility:"on"},{color:"#fee379"}]},{featureType:"road.arterial",elementType:"all",stylers:[{visibility:"on"},{color:"#fee379"}]},{featureType:"water",elementType:"all",stylers:[{visibility:"on"},{color:"#7fc8ed"}]}]},function(e,t){"use strict";e.exports=[{featureType:"administrative.locality",elementType:"all",stylers:[{hue:"#2c2e33"},{saturation:7},{lightness:19},{visibility:"on"}]},{featureType:"landscape",elementType:"all",stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100},{visibility:"simplified"}]},{featureType:"poi",elementType:"all",stylers:[{hue:"#ffffff"},{saturation:-100},{lightness:100},{visibility:"off"}]},{featureType:"road",elementType:"geometry",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:31},{visibility:"simplified"}]},{featureType:"road",elementType:"labels",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:31},{visibility:"on"}]},{featureType:"road.arterial",elementType:"labels",stylers:[{hue:"#bbc0c4"},{saturation:-93},{lightness:-2},{visibility:"simplified"}]},{featureType:"road.local",elementType:"geometry",stylers:[{hue:"#e9ebed"},{saturation:-90},{lightness:-8},{visibility:"simplified"}]},{featureType:"transit",elementType:"all",stylers:[{hue:"#e9ebed"},{saturation:10},{lightness:69},{visibility:"on"}]},{featureType:"water",elementType:"all",stylers:[{hue:"#e9ebed"},{saturation:-78},{lightness:67},{visibility:"simplified"}]}]},function(e,t){"use strict";e.exports=[{featureType:"all",elementType:"labels.text.fill",stylers:[{color:"#ffffff"}]},{featureType:"all",elementType:"labels.text.stroke",stylers:[{color:"#000000"},{lightness:13}]},{featureType:"administrative",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"administrative",elementType:"geometry.stroke",stylers:[{color:"#144b53"},{lightness:14},{weight:1.4}]},{featureType:"landscape",elementType:"all",stylers:[{color:"#08304b"}]},{featureType:"poi",elementType:"geometry",stylers:[{color:"#0c4152"},{lightness:5}]},{featureType:"road.highway",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.highway",elementType:"geometry.stroke",stylers:[{color:"#0b434f"},{lightness:25}]},{featureType:"road.arterial",elementType:"geometry.fill",stylers:[{color:"#000000"}]},{featureType:"road.arterial",elementType:"geometry.stroke",stylers:[{color:"#0b3d51"},{lightness:16}]},{featureType:"road.local",elementType:"geometry",stylers:[{color:"#000000"}]},{featureType:"transit",elementType:"all",stylers:[{color:"#146474"}]},{featureType:"water",elementType:"all",stylers:[{color:"#021019"}]}]},function(e,t){"use strict";e.exports=[{featureType:"water",stylers:[{saturation:43},{lightness:-11},{hue:"#0088ff"}]},{featureType:"road",elementType:"geometry.fill",stylers:[{hue:"#ff0000"},{saturation:-100},{lightness:99}]},{featureType:"road",elementType:"geometry.stroke",stylers:[{color:"#808080"},{lightness:54}]},{featureType:"landscape.man_made",elementType:"geometry.fill",stylers:[{color:"#ece2d9"}]},{featureType:"poi.park",elementType:"geometry.fill",stylers:[{color:"#ccdca1"}]},{featureType:"road",elementType:"labels.text.fill",stylers:[{color:"#767676"}]},{featureType:"road",elementType:"labels.text.stroke",stylers:[{color:"#ffffff"}]},{featureType:"poi",stylers:[{visibility:"off"}]},{featureType:"landscape.natural",elementType:"geometry.fill",stylers:[{visibility:"on"},{color:"#b8cb93"}]},{featureType:"poi.park",stylers:[{visibility:"on"}]},{featureType:"poi.sports_complex",stylers:[{visibility:"on"}]},{featureType:"poi.medical",stylers:[{visibility:"on"}]},{featureType:"poi.business",stylers:[{visibility:"simplified"}]}]},function(e,t){"use strict";e.exports=[{elementType:"geometry",stylers:[{hue:"#ff4400"},{saturation:-68},{lightness:-4},{gamma:.72}]},{featureType:"road",elementType:"labels.icon"},{featureType:"landscape.man_made",elementType:"geometry",stylers:[{hue:"#0077ff"},{gamma:3.1}]},{featureType:"water",stylers:[{hue:"#00ccff"},{gamma:.44},{saturation:-33}]},{featureType:"poi.park",stylers:[{hue:"#44ff00"},{saturation:-23}]},{featureType:"water",elementType:"labels.text.fill",stylers:[{hue:"#007fff"},{gamma:.77},{saturation:65},{lightness:99}]},{featureType:"water",elementType:"labels.text.stroke",stylers:[{gamma:.11},{weight:5.6},{saturation:99},{hue:"#0091ff"},{lightness:-86}]},{featureType:"transit.line",elementType:"geometry",stylers:[{lightness:-48},{hue:"#ff5e00"},{gamma:1.2},{saturation:-23}]},{featureType:"transit",elementType:"labels.text.stroke",stylers:[{saturation:-64},{hue:"#ff9100"},{lightness:16},{gamma:.47},{weight:2.7}]}]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n=0&&e.end>=0&&""!==e.location){var n;t=o({},this.type,(n={},o(n,this.props.appbaseField,e.location),o(n,"from",e.start+this.unit),o(n,"to",e.end+this.unit),n))}return t}},{key:"getCoordinates",value:function(e,t){var n=this;e&&""!==e?m["default"].get("https://maps.googleapis.com/maps/api/geocode/json?address="+e).then(function(e){var r=e.data.results[0].geometry.location;n.locString=r.lat+", "+r.lng,t?t.call(n,n.defaultSelected.label):n.executeQuery()}):p.AppbaseSensorHelper.selectedSensor.set(null,!0)}},{key:"executeQuery",value:function(){if(""!==this.state.currentValue&&this.state.selected&&this.locString){var e,t={key:this.props.componentId,value:{currentValue:this.state.currentValue,start:this.state.selected.start,end:this.state.selected.end,location:this.locString,unit:this.unit}},n={key:this.props.componentId,value:o({},this.sortInfo.type,(e={},o(e,this.props.appbaseField,this.locString),o(e,"order",this.sortInfo.order),o(e,"unit",this.unit),e))};this.props.onValueChange&&this.props.onValueChange(t.value),p.AppbaseSensorHelper.selectedSensor.setSortInfo(n),p.AppbaseSensorHelper.URLParams.update(this.props.componentId,this.setURLValue(),this.props.URLParams),p.AppbaseSensorHelper.selectedSensor.set(t,!0)}}},{key:"setURLValue",value:function(){return JSON.stringify({location:this.state.currentValue,label:this.state.selected.label})}},{key:"handleChange",value:function(e){if(e){var t=e.value;this.setState({currentValue:t}),this.getCoordinates(t)}else{this.setState({currentValue:""});var n={key:this.props.componentId,value:null};this.props.onValueChange&&this.props.onValueChange(n.value),p.AppbaseSensorHelper.URLParams.update(this.props.componentId,null,this.props.URLParams),p.AppbaseSensorHelper.selectedSensor.set(n,!0)}}},{key:"loadOptions",value:function(e,t){var n=this;if(this.callback=t,e){var r=this.googleMaps||window.google.maps;this.autocompleteService=new r.places.AutocompleteService;var o={input:e};this.result={options:[]},this.autocompleteService.getPlacePredictions(o,function(e){e.forEach(function(e){n.result.options.push({label:e.description,value:e.description})}),n.state.userLocation.length&&"Use my current location"!==n.result.options[0].label&&n.result.options.unshift({label:"Use my current location",value:n.state.userLocation}),n.callback(null,n.result)})}else this.callback(null,this.result)}},{key:"handleDistanceChange",value:function(e){this.setState({selected:{start:e.start,end:e.end,label:e.label}},this.executeQuery.bind(this))}},{key:"renderValue",value:function(e){return c["default"].createElement("span",null,e.value)}},{key:"render",value:function(){var e=null;this.props.title&&(e=c["default"].createElement("h4",{className:"rbc-title"},this.props.title));var t=(0,f["default"])({"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder});return c["default"].createElement("div",{className:"rbc rbc-geodistancedropdown clearfix card thumbnail col s12 col-xs-12 "+t,style:this.props.componentStyle},c["default"].createElement("div",{className:"row"},e,c["default"].createElement("div",{className:"rbc-search-container col s12 col-xs-12"},c["default"].createElement(v["default"].Async,{value:this.state.currentValue,loadOptions:this.loadOptions,placeholder:this.props.placeholder,onChange:this.handleChange,filterOption:function(){return!0},valueRenderer:this.renderValue})),c["default"].createElement("div",{className:"col s12 col-xs-12"},c["default"].createElement(v["default"],{value:this.state.selected.label?this.state.selected:"",options:this.props.data,clearable:!1,searchable:!1,onChange:this.handleDistanceChange,placeholder:this.props.placeholderDropdown}))))}}]),t}(l.Component);t["default"]=_,_.propTypes={componentId:c["default"].PropTypes.string.isRequired,appbaseField:c["default"].PropTypes.string.isRequired,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]), customQuery:c["default"].PropTypes.func,defaultSelected:c["default"].PropTypes.shape({label:c["default"].PropTypes.string,location:c["default"].PropTypes.string}),placeholder:c["default"].PropTypes.string,placeholderDropdown:c["default"].PropTypes.string,autoLocation:c["default"].PropTypes.bool,unit:c["default"].PropTypes.oneOf(["mi","miles","yd","yards","ft","feet","in","inch","km","kilometers","m","meters","cm","centimeters","mm","millimeters","NM","nmi","nauticalmiles"]),data:c["default"].PropTypes.arrayOf(c["default"].PropTypes.shape({start:p.AppbaseSensorHelper.validateThreshold,end:p.AppbaseSensorHelper.validateThreshold,label:c["default"].PropTypes.string.isRequired})),onValueChange:c["default"].PropTypes.func,componentStyle:c["default"].PropTypes.object,URLParams:c["default"].PropTypes.bool},_.defaultProps={unit:"mi",placeholder:"Search...",placeholderDropdown:"Select Distance",autoLocation:!0,componentStyle:{},URLParams:!1},_.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n>8-a%1*8)){if(o=t.charCodeAt(a+=.75),o>255)throw new e("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");n=n<<8|o}return s}),n.atob||(n.atob=function(t){if(t=t.replace(/=+$/,""),t.length%4==1)throw new e("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,o,a=0,i=0,s="";o=t.charAt(i++);~o&&(n=a%4?64*n+o:o,a++%4)?s+=String.fromCharCode(255&n>>(-2*a&6)):0)o=r.indexOf(o);return s})}()},function(e,t){"use strict";function n(){return!1}function r(){return!0}function o(){this.timeStamp=Date.now(),this.target=void 0,this.currentTarget=void 0}Object.defineProperty(t,"__esModule",{value:!0}),o.prototype={isEventObject:1,constructor:o,isDefaultPrevented:n,isPropagationStopped:n,isImmediatePropagationStopped:n,preventDefault:function(){this.isDefaultPrevented=r},stopPropagation:function(){this.isPropagationStopped=r},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=r,this.stopPropagation()},halt:function(e){e?this.stopImmediatePropagation():this.stopPropagation(),this.preventDefault()}},t["default"]=o,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return null===e||void 0===e}function a(){return d}function i(){return f}function s(e){var t=e.type,n="function"==typeof e.stopPropagation||"boolean"==typeof e.cancelBubble;l["default"].call(this),this.nativeEvent=e;var r=i;"defaultPrevented"in e?r=e.defaultPrevented?a:i:"getPreventDefault"in e?r=e.getPreventDefault()?a:i:"returnValue"in e&&(r=e.returnValue===f?a:i),this.isDefaultPrevented=r;var o=[],s=void 0,u=void 0,c=void 0,p=h.concat();for(m.forEach(function(e){t.match(e.reg)&&(p=p.concat(e.props),e.fix&&o.push(e.fix))}),u=p.length;u;)c=p[--u],this[c]=e[c];for(!this.target&&n&&(this.target=e.srcElement||document),this.target&&3===this.target.nodeType&&(this.target=this.target.parentNode),u=o.length;u;)(s=o[--u])(this,e);this.timeStamp=e.timeStamp||Date.now()}Object.defineProperty(t,"__esModule",{value:!0});var u=n(411),l=r(u),c=n(9),p=r(c),d=!0,f=!1,h=["altKey","bubbles","cancelable","ctrlKey","currentTarget","eventPhase","metaKey","shiftKey","target","timeStamp","view","type"],m=[{reg:/^key/,props:["char","charCode","key","keyCode","which"],fix:function(e,t){o(e.which)&&(e.which=o(t.charCode)?t.keyCode:t.charCode),void 0===e.metaKey&&(e.metaKey=e.ctrlKey)}},{reg:/^touch/,props:["touches","changedTouches","targetTouches"]},{reg:/^hashchange$/,props:["newURL","oldURL"]},{reg:/^gesturechange$/i,props:["rotation","scale"]},{reg:/^(mousewheel|DOMMouseScroll)$/,props:[],fix:function(e,t){var n=void 0,r=void 0,o=void 0,a=t.wheelDelta,i=t.axis,s=t.wheelDeltaY,u=t.wheelDeltaX,l=t.detail;a&&(o=a/120),l&&(o=0-(l%3===0?l/3:l)),void 0!==i&&(i===e.HORIZONTAL_AXIS?(r=0,n=0-o):i===e.VERTICAL_AXIS&&(n=0,r=o)),void 0!==s&&(r=s/120),void 0!==u&&(n=-1*u/120),n||r||(r=o),void 0!==n&&(e.deltaX=n),void 0!==r&&(e.deltaY=r),void 0!==o&&(e.delta=o)}},{reg:/^mouse|contextmenu|click|mspointer|(^DOMMouseScroll$)/i,props:["buttons","clientX","clientY","button","offsetX","relatedTarget","which","fromElement","toElement","offsetY","pageX","pageY","screenX","screenY"],fix:function(e,t){var n=void 0,r=void 0,a=void 0,i=e.target,s=t.button;return i&&o(e.pageX)&&!o(t.clientX)&&(n=i.ownerDocument||document,r=n.documentElement,a=n.body,e.pageX=t.clientX+(r&&r.scrollLeft||a&&a.scrollLeft||0)-(r&&r.clientLeft||a&&a.clientLeft||0),e.pageY=t.clientY+(r&&r.scrollTop||a&&a.scrollTop||0)-(r&&r.clientTop||a&&a.clientTop||0)),e.which||void 0===s||(1&s?e.which=1:2&s?e.which=3:4&s?e.which=2:e.which=0),!e.relatedTarget&&e.fromElement&&(e.relatedTarget=e.fromElement===i?e.toElement:e.fromElement),e}}],y=l["default"].prototype;(0,p["default"])(s.prototype,y,{constructor:s,preventDefault:function(){var e=this.nativeEvent;e.preventDefault?e.preventDefault():e.returnValue=f,y.preventDefault.call(this)},stopPropagation:function(){var e=this.nativeEvent;e.stopPropagation?e.stopPropagation():e.cancelBubble=d,y.stopPropagation.call(this)}}),t["default"]=s,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){function r(t){var r=new i["default"](t);n.call(e,r)}return e.addEventListener?(e.addEventListener(t,r,!1),{remove:function(){e.removeEventListener(t,r,!1)}}):e.attachEvent?(e.attachEvent("on"+t,r),{remove:function(){e.detachEvent("on"+t,r)}}):void 0}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var a=n(412),i=r(a);e.exports=t["default"]},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;var o=t.type,a=t.body;delete t.type,delete t.body;var i;return i=o?o+"/_bulk":"/_bulk",e.performStreamingRequest({method:"POST",path:i,params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;delete t.type,delete t.id;var i=o+"/"+a;return e.performStreamingRequest({method:"DELETE",path:i,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;delete t.type,delete t.id;var i=o+"/"+a;return e.performStreamingRequest({method:"GET",path:i,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(140),o=function(e){var t=r.obj(function(e,t,n){var r=Object.keys(e)[0],o=Object.keys(e[r].mappings).filter(function(e){return"_default_"!==e});this.push(o),n()});return t.writable=!1,e.performStreamingRequest({method:"GET",path:"_mapping"}).pipe(t)};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",body:"object"});if(n!==!0)throw n;var o=t.type,a=t.id,i=t.body;delete t.type,delete t.id,delete t.body;var s;return s=a?o+"/"+a:o,e.performStreamingRequest({method:"POST",path:s,params:t,body:i})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;var o;o=t.type.constructor===Array?t.type.join():t.type;var a=t.body;delete t.type,delete t.body;var i;return i=o?o+"/_search":"/_search",e.performStreamingRequest({method:"POST",path:i,params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string"});if(n!==!0)throw n;var o=t.type,a=t.id;return delete t.type,delete t.id,delete t.stream,t.stream===!0||"true"===t.stream?t.stream="true":(delete t.stream,t.streamonly="true"),e.performWsRequest({method:"GET",path:o+"/"+a,params:t})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{body:"object"});if(n!==!0)throw n;if(void 0===t.type||"string"!=typeof t.type&&t.type.constructor!==Array||""===t.type||0===t.type.length)throw new Error("fields missing: type");var o;o=t.type.constructor===Array?t.type.join():t.type;var o=t.type,a=t.body;return delete t.type,delete t.body,delete t.stream,t.streamonly="true",e.performWsRequest({method:"POST",path:o+"/_search",params:t,body:a})};e.exports=o},function(e,t,n){"use strict";var r=n(34),o=function(e,t){var n=r.validate(t,{type:"string",id:"string",body:"object"});if(n!==!0)throw n;var o=t.type,a=t.id,i=t.body;delete t.type,delete t.id,delete t.body;var s=o+"/"+a+"/_update";return e.performStreamingRequest({method:"POST",path:s,params:t,body:i})};e.exports=o},function(e,t,n){"use strict";var r=n(565),o=n(34),a=function(e,t,n){var a=o.validate(t,{body:"object"});if(a!==!0)throw a;if(void 0===t.type||"string"!=typeof t.type&&t.type.constructor!==Array||""===t.type||0===t.type.length)throw new Error("fields missing: type");if(a=o.validate(t.body,{query:"object"}),a!==!0)throw a;if(t.type.constructor===Array?(this.type=t.type,this.type_string=t.type.join()):(this.type=[t.type],this.type_string=t.type),this.webhooks=[],this.client=e,this.query=t.body.query,"string"==typeof n){var i={};i.url=n,i.method="GET",this.webhooks.push(i)}else if(n.constructor===Array)this.webhooks=n;else{if(n!==Object(n))throw new Error("fields missing: second argument(webhook) is necessary");this.webhooks.push(n)}this.populateBody();var s=btoa(r(this.query)),u=".percolator/webhooks-0-"+this.type_string+"-0-"+s;return this.path=u,this.performRequest("POST")};a.prototype.populateBody=function(){this.body={},this.body.webhooks=this.webhooks,this.body.query=this.query,this.body.type=this.type},a.prototype.performRequest=function(e){var t=this.client.performStreamingRequest({method:e,path:this.path,body:this.body});return t.change=this.change.bind(this),t.stop=this.stop.bind(this),t},a.prototype.change=function(e){if(this.webhooks=[],"string"==typeof e){var t={};t.url=e,t.method="POST",this.webhooks.push(t)}else if(e.constructor===Array)this.webhooks=e;else{if(e!==Object(e))throw new Error("fields missing: one of webhook or url fields is required");this.webhooks.push(e)}return this.populateBody(),this.performRequest("POST")},a.prototype.stop=function(){return delete this.body,this.performRequest("DELETE")},e.exports=a},function(e,t,n){"use strict";var r=n(142),o=n(425),a=n(426),i=n(427),s=n(418),u=n(416),l=n(422),c=n(415),p=n(414),d=n(419),f=n(417),h=n(423),m=n(420),y=n(421),v=function g(e){if(!(this instanceof g))return new g(e);if("string"!=typeof e.url||""===e.url)throw new Error("URL not present in options.");var t=r.parse(e.url);if(this.url=t.host,this.protocol=t.protocol,this.credentials=t.auth,this.appname=e.appname||e.app,"string"!=typeof this.appname||""===this.appname)throw new Error("App name is not present in options.");if("string"!=typeof this.protocol||""===this.protocol)throw new Error("Protocol is not present in url. URL should be of the form https://scalr.api.appbase.io");if("string"==typeof e.username&&""!==e.username&&"string"==typeof e.password&&""!==e.password&&(this.credentials=e.username+":"+e.password),"string"==typeof e.credentials&&""!==e.credentials&&(this.credentials=e.credentials),"string"!=typeof this.credentials||""===this.credentials)throw new Error("Authentication information is not present. Did you add credentials?");"https:"===t.protocol?this.ws=new o("wss://"+t.host+"/"+this.appname):this.ws=new o("ws://"+t.host+"/"+this.appname),"/"===this.url.slice(-1)&&(this.url=this.url.slice(0,-1));var n={};return n.index=this.index.bind(this),n.get=this.get.bind(this),n.update=this.update.bind(this),n["delete"]=this["delete"].bind(this),n.bulk=this.bulk.bind(this),n.search=this.search.bind(this),n.getStream=this.getStream.bind(this),n.searchStream=this.searchStream.bind(this),n.searchStreamToURL=this.searchStreamToURL.bind(this),n.getTypes=this.getTypes.bind(this),n};v.prototype.performWsRequest=function(e){return new i(this,JSON.parse(JSON.stringify(e)))},v.prototype.performStreamingRequest=function(e){return new a(this,JSON.parse(JSON.stringify(e)))},v.prototype.index=function(e){return new s(this,JSON.parse(JSON.stringify(e)))},v.prototype.get=function(e){return new u(this,JSON.parse(JSON.stringify(e)))},v.prototype.update=function(e){return new l(this,JSON.parse(JSON.stringify(e)))},v.prototype["delete"]=function(e){return new c(this,JSON.parse(JSON.stringify(e)))},v.prototype.bulk=function(e){return new p(this,JSON.parse(JSON.stringify(e)))},v.prototype.search=function(e){return new d(this,JSON.parse(JSON.stringify(e)))},v.prototype.getStream=function(e){return new m(this,JSON.parse(JSON.stringify(e)))},v.prototype.searchStream=function(e){return new y(this,JSON.parse(JSON.stringify(e)))},v.prototype.searchStreamToURL=function(e,t){return new h(this,JSON.parse(JSON.stringify(e)),JSON.parse(JSON.stringify(t)))},v.prototype.getTypes=function(){return new f(this)},"undefined"!=typeof window&&(window.Appbase=v),e.exports=v},function(e,t,n){"use strict";var r="undefined"!=typeof window?window.WebSocket:n(748),o=n(36).EventEmitter,a=function(e){var t=new r(e),n=new o;return n.setMaxListeners(0),n.send=function(e){return 1===t.readyState?(t.send(JSON.stringify(e)),this):void n.on("open",function r(){t.send(JSON.stringify(e)),n.removeListener("open",r)})},t.onopen=function(){n.emit("open")},t.onmessage=function(e){var t=JSON.parse(e.data);n.emit("message",t)},t.onerror=function(e){n.emit("error",e)},t.onclose=function(e){n.emit("close",e)},n};e.exports=a},function(e,t,n){(function(t){"use strict";var r=n(553),o=n(733),a=n(113),i=n(140),s=function(e,t){if(this.client=e,this.args=t,this.method=t.method,this.path=t.path,this.params=t.params,this.body=t.body,(!this.body||"object"!=typeof this.body&&this.body.constructor!==Array)&&(this.body={}),this.body.constructor===Array){var n=this.body;this.body="";for(var r=0;rt;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},l=n(4),c=r(l),p=n(18),d=r(p),f=n(19),h=r(f),m=function(e){function t(){o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments),this.state={}}return a(t,e),s(t,[{key:"getBounds",value:function(){return this.state.circle.getBounds()}},{key:"getCenter",value:function(){return this.state.circle.getCenter()}},{key:"getDraggable",value:function(){return this.state.circle.getDraggable()}},{key:"getEditable",value:function(){return this.state.circle.getEditable()}},{key:"getMap",value:function(){return this.state.circle.getMap()}},{key:"getRadius",value:function(){return this.state.circle.getRadius()}},{key:"getVisible",value:function(){return this.state.circle.getVisible()}},{key:"componentWillMount",value:function(){if(d["default"]){var e=h["default"]._createCircle(this.props);this.setState({circle:e})}}},{key:"render",value:function(){return this.state.circle?c["default"].createElement(h["default"],i({circle:this.state.circle},this.props),this.props.children):c["default"].createElement("noscript",null)}}],[{key:"propTypes",value:i({},f.circleDefaultPropTypes,f.circleControlledPropTypes,f.circleEventPropTypes),enumerable:!0}]),t}(l.Component);t["default"]=m,e.exports=t["default"]},function(e,t){var n=!("undefined"==typeof window||!window.document||!window.document.createElement);e.exports=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},u=n(4),l=r(u),c=n(20),p=r(c),d=n(10),f=r(d),h=n(11),m=r(h),y=n(13),v=r(y),_=n(15),g=r(_),b=n(7),T=r(b),M={center:u.PropTypes.any,draggable:u.PropTypes.bool,editable:u.PropTypes.bool,options:u.PropTypes.object,radius:u.PropTypes.number,visible:u.PropTypes.bool};t.circleControlledPropTypes=M;var w=(0,m["default"])(M);t.circleDefaultPropTypes=w;var k={center:function(e,t){t.getCircle().setCenter(e)},draggable:function(e,t){t.getCircle().setDraggable(e)},editable:function(e,t){t.getCircle().setEditable(e)},options:function(e,t){t.getCircle().setOptions(e)},radius:function(e,t){t.getCircle().setRadius(e)},visible:function(e,t){t.getCircle().setVisible(e)}},S=(0,f["default"])(p["default"]),P=S.eventPropTypes,L=S.registerEvents,D=P;t.circleEventPropTypes=D;var O=function(e){function t(){o(this,n),s(Object.getPrototypeOf(n.prototype),"constructor",this).apply(this,arguments)}a(t,e),i(t,[{key:"getCircle",value:function(){return this.props.circle}},{key:"render",value:function(){return l["default"].createElement("noscript",null)}}],[{key:"_createCircle",value:function(e){var t=e.mapHolderRef,n=new google.maps.Circle((0,v["default"])(e,M));return n.setMap(t.getMap()),n}},{key:"propTypes",value:{mapHolderRef:u.PropTypes.instanceOf(T["default"]).isRequired,circle:u.PropTypes.object.isRequired},enumerable:!0}]);var n=t;return t=(0,g["default"])({registerEvents:L,instanceMethodName:"getCircle",updaters:k})(t)||t}(u.Component);t["default"]=O},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["center_changed","click","dblclick","drag","dragend","dragstart","mousedown","mousemove","mouseout","mouseover","mouseup","radius_changed","rightclick"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},l=n(4),c=r(l),p=n(18),d=r(p),f=n(22),h=r(f),m=function(e){function t(){o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments),this.state={}}return a(t,e),s(t,[{key:"getDirections",value:function(){return this.state.directionsRenderer.getDirections()}},{key:"getPanel",value:function(){return this.state.directionsRenderer.getPanel()}},{key:"getRouteIndex",value:function(){return this.state.directionsRenderer.getRouteIndex()}},{key:"componentWillMount",value:function(){if(d["default"]){var e=h["default"]._createDirectionsRenderer(this.props);this.setState({directionsRenderer:e})}}},{key:"render",value:function(){return this.state.directionsRenderer?c["default"].createElement(h["default"],i({directionsRenderer:this.state.directionsRenderer},this.props),this.props.children):c["default"].createElement("noscript",null)}}],[{key:"propTypes",value:i({},f.directionsRendererDefaultPropTypes,f.directionsRendererControlledPropTypes,f.directionsRendererEventPropTypes),enumerable:!0}]),t}(l.Component);t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},u=n(4),l=r(u),c=n(23),p=r(c),d=n(10),f=r(d),h=n(11),m=r(h),y=n(13),v=r(y),_=n(15),g=r(_),b=n(7),T=r(b),M={directions:u.PropTypes.any,options:u.PropTypes.object,panel:u.PropTypes.object,routeIndex:u.PropTypes.number};t.directionsRendererControlledPropTypes=M;var w=(0,m["default"])(M);t.directionsRendererDefaultPropTypes=w;var k={directions:function(e,t){t.getDirectionsRenderer().setDirections(e)},options:function(e,t){t.getDirectionsRenderer().setOptions(e)},panel:function(e,t){t.getDirectionsRenderer().setPanel(e)},routeIndex:function(e,t){t.getDirectionsRenderer().setRouteIndex(e)}},S=(0,f["default"])(p["default"]),P=S.eventPropTypes,L=S.registerEvents,D=P;t.directionsRendererEventPropTypes=D;var O=function(e){function t(){o(this,n),s(Object.getPrototypeOf(n.prototype),"constructor",this).apply(this,arguments)}a(t,e),i(t,[{key:"getDirectionsRenderer",value:function(){return this.props.directionsRenderer}},{key:"render",value:function(){var e=this.props.children;return u.Children.count(e)>0?l["default"].createElement("div",null,e):l["default"].createElement("noscript",null)}}],[{key:"_createDirectionsRenderer",value:function(e){var t=e.mapHolderRef,n=new google.maps.DirectionsRenderer((0,v["default"])(e,M));return n.setMap(t.getMap()),n}},{key:"propTypes",value:{mapHolderRef:u.PropTypes.instanceOf(T["default"]).isRequired,directionsRenderer:u.PropTypes.object.isRequired},enumerable:!0}]);var n=t;return t=(0,g["default"])({registerEvents:L,instanceMethodName:"getDirectionsRenderer",updaters:k})(t)||t}(u.Component);t["default"]=O},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["directions_changed"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},l=n(4),c=r(l),p=n(18),d=r(p),f=n(25),h=r(f),m=function(e){function t(){o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments),this.state={}}return a(t,e),s(t,[{key:"getDrawingMode",value:function(){return this.state.drawingManager.getDrawingMode()}},{key:"componentWillMount",value:function(){if(d["default"]){var e=h["default"]._createDrawingManager(this.props);this.setState({drawingManager:e})}}},{key:"render",value:function(){return this.state.drawingManager?c["default"].createElement(h["default"],i({drawingManager:this.state.drawingManager},this.props),this.props.children):c["default"].createElement("noscript",null)}}],[{key:"propTypes",value:i({},f.drawingManagerDefaultPropTypes,f.drawingManagerControlledPropTypes,f.drawingManagerEventPropTypes),enumerable:!0}]),t}(l.Component);t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},u=n(4),l=r(u),c=n(26),p=r(c),d=n(10),f=r(d),h=n(11),m=r(h),y=n(13),v=r(y),_=n(15),g=r(_),b=n(7),T=r(b),M={drawingMode:u.PropTypes.any,options:u.PropTypes.object};t.drawingManagerControlledPropTypes=M;var w=(0,m["default"])(M);t.drawingManagerDefaultPropTypes=w;var k={drawingMode:function(e,t){t.getDrawingManager().setDrawingMode(e)},options:function(e,t){t.getDrawingManager().setOptions(e)}},S=(0,f["default"])(p["default"]),P=S.eventPropTypes,L=S.registerEvents,D=P;t.drawingManagerEventPropTypes=D;var O=function(e){function t(){o(this,n),s(Object.getPrototypeOf(n.prototype),"constructor",this).apply(this,arguments)}a(t,e),i(t,[{key:"getDrawingManager",value:function(){return this.props.drawingManager}},{key:"render",value:function(){return l["default"].createElement("noscript",null)}}],[{key:"_createDrawingManager",value:function(e){var t=e.mapHolderRef,n=new google.maps.drawing.DrawingManager((0,v["default"])(e,M));return n.setMap(t.getMap()),n}},{key:"propTypes",value:{mapHolderRef:u.PropTypes.instanceOf(T["default"]).isRequired,drawingManager:u.PropTypes.object.isRequired},enumerable:!0}]);var n=t;return t=(0,g["default"])({registerEvents:L,instanceMethodName:"getDrawingManager",updaters:k})(t)||t}(u.Component);t["default"]=O},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["circlecomplete","markercomplete","overlaycomplete","polygoncomplete","polylinecomplete","rectanglecomplete"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},l=n(4),c=r(l),p=n(18),d=r(p),f=n(28),h=r(f),m=function(e){function t(){o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments),this.state={}}return a(t,e),s(t,[{key:"getContent",value:function(){}},{key:"getPosition",value:function(){return this.state.infoWindow.getPosition()}},{key:"getZIndex",value:function(){return this.state.infoWindow.getZIndex()}},{key:"componentWillMount",value:function(){if(d["default"]){var e=h["default"]._createInfoWindow(this.props);this.setState({infoWindow:e})}}},{key:"render",value:function(){return this.state.infoWindow?c["default"].createElement(h["default"],i({infoWindow:this.state.infoWindow},this.props),this.props.children):c["default"].createElement("noscript",null)}}],[{key:"propTypes",value:i({},f.infoWindowDefaultPropTypes,f.infoWindowControlledPropTypes,f.infoWindowEventPropTypes),enumerable:!0}]),t}(l.Component);t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},u=n(4),l=r(u),c=n(29),p=r(c),d=n(10),f=r(d),h=n(11),m=r(h),y=n(13),v=r(y),_=n(30),g=r(_),b=n(15),T=r(b),M=n(7),w=r(M),k={content:u.PropTypes.any,options:u.PropTypes.object,position:u.PropTypes.any,zIndex:u.PropTypes.number};t.infoWindowControlledPropTypes=k;var S=(0,m["default"])(k);t.infoWindowDefaultPropTypes=S;var P={children:function(e,t){(0,g["default"])(e,t.getInfoWindow())},content:function(e,t){t.getInfoWindow().setContent(e)},options:function(e,t){t.getInfoWindow().setOptions(e)},position:function(e,t){t.getInfoWindow().setPosition(e)},zIndex:function(e,t){t.getInfoWindow().setZIndex(e)}},L=(0,f["default"])(p["default"]),D=L.eventPropTypes,O=L.registerEvents,E=D;t.infoWindowEventPropTypes=E;var C=function(e){function t(){o(this,n),s(Object.getPrototypeOf(n.prototype),"constructor",this).apply(this,arguments)}a(t,e),i(t,[{key:"getInfoWindow",value:function(){return this.props.infoWindow}},{key:"render",value:function(){return l["default"].createElement("noscript",null)}}],[{key:"_createInfoWindow",value:function(e){var t=e.mapHolderRef,n=e.anchorHolderRef,r=new google.maps.InfoWindow((0,v["default"])(e,k));return e.children&&(0,g["default"])(e.children,r),n?r.open(t.getMap(),n.getAnchor()):r.setMap(t.getMap()),r}},{key:"propTypes",value:{mapHolderRef:u.PropTypes.instanceOf(w["default"]).isRequired,infoWindow:u.PropTypes.object.isRequired,anchorHolderRef:u.PropTypes.object},enumerable:!0}]);var n=t;return t=(0,T["default"])({registerEvents:O,instanceMethodName:"getInfoWindow",updaters:P})(t)||t}(u.Component);t["default"]=C},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["closeclick","content_changed","domready","position_changed","zindex_changed"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n=t;return"[object HTMLDivElement]"!==Object.prototype.toString.call(n)&&(n=document.createElement("div")),(0,u.render)(e,n),n}function a(e,t){if(s["default"].isValidElement(e)){var n=i.Children.only(e),r=t.getContent(),a=o(n,r);t.setContent(a)}else t.setContent(e)}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=a;var i=n(4),s=r(i),u=n(31);e.exports=t["default"]},function(e,t){e.exports=__WEBPACK_EXTERNAL_MODULE_31__},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},l=n(4),c=r(l),p=n(18),d=r(p),f=n(33),h=r(f),m=function(e){function t(){o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments),this.state={}}return a(t,e),s(t,[{key:"getDefaultViewport",value:function(){return this.state.kmlLayer.getDefaultViewport()}},{key:"getMetadata",value:function(){return this.state.kmlLayer.getMetadata()}},{key:"getStatus",value:function(){return this.state.kmlLayer.getStatus()}},{key:"getUrl",value:function(){return this.state.kmlLayer.getUrl()}},{key:"getZIndex",value:function(){return this.state.marker.getZIndex()}},{key:"componentWillMount",value:function(){if(d["default"]){var e=h["default"]._createKmlLayer(this.props);this.setState({kmlLayer:e})}}},{key:"render",value:function(){return this.state.kmlLayer?c["default"].createElement(h["default"],i({kmlLayer:this.state.kmlLayer},this.props),this.props.children):c["default"].createElement("noscript",null)}}],[{key:"propTypes",value:i({},f.kmlLayerDefaultPropTypes,f.kmlLayerControlledPropTypes,f.kmlLayerEventPropTypes),enumerable:!0}]),t}(l.Component);t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},u=n(4),l=r(u),c=n(34),p=r(c),d=n(10),f=r(d),h=n(11),m=r(h),y=n(13),v=r(y),_=n(15),g=r(_),b=n(7),T=r(b),M={defaultViewport:u.PropTypes.any,metadata:u.PropTypes.any,status:u.PropTypes.any,url:u.PropTypes.string,zIndex:u.PropTypes.number};t.kmlLayerControlledPropTypes=M;var w=(0,m["default"])(M);t.kmlLayerDefaultPropTypes=w;var k={defaultViewport:function(e,t){t.getKmlLayer().setDefaultViewport(e)},metadata:function(e,t){t.getKmlLayer().setMetadata(e)},status:function(e,t){t.getKmlLayer().setStatus(e)},url:function(e,t){t.getKmlLayer().setUrl(e)},zIndex:function(e,t){t.getKmlLayer().setZIndex(e)}},S=(0,f["default"])(p["default"]),P=S.eventPropTypes,L=S.registerEvents,D=P;t.kmlLayerEventPropTypes=D;var O=function(e){function t(){o(this,n),s(Object.getPrototypeOf(n.prototype),"constructor",this).apply(this,arguments)}a(t,e),i(t,[{key:"getKmlLayer",value:function(){return this.props.kmlLayer}},{key:"render",value:function(){var e=this.props,t=e.mapHolderRef,n=e.children;return u.Children.count(n)>0?l["default"].createElement("div",null,u.Children.map(n,function(e){return e&&l["default"].cloneElement(e,{mapHolderRef:t})})):l["default"].createElement("noscript",null)}}],[{key:"_createKmlLayer",value:function(e){var t=e.mapHolderRef,n=new google.maps.KmlLayer((0,v["default"])(e,M));return n.setMap(t.getMap()),n}},{key:"propTypes",value:{mapHolderRef:u.PropTypes.instanceOf(T["default"]).isRequired,kmlLayer:u.PropTypes.object.isRequired},enumerable:!0}]);var n=t;return t=(0,g["default"])({registerEvents:L,instanceMethodName:"getKmlLayer",updaters:k})(t)||t}(u.Component);t["default"]=O},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["click","defaultviewport_changed","status_changed"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},l=n(4),c=r(l),p=n(18),d=r(p),f=n(36),h=r(f),m=function(e){function t(){o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments),this.state={}}return a(t,e),s(t,[{key:"getAnimation",value:function(){return this.state.marker.getAnimation()}},{key:"getAttribution",value:function(){return this.state.marker.getAttribution()}},{key:"getClickable",value:function(){return this.state.marker.getClickable()}},{key:"getCursor",value:function(){return this.state.marker.getCursor()}},{key:"getDraggable",value:function(){return this.state.marker.getDraggable()}},{key:"getIcon",value:function(){return this.state.marker.getIcon()}},{key:"getLabel",value:function(){return this.state.marker.getLabel()}},{key:"getOpacity",value:function(){return this.state.marker.getOpacity()}},{key:"getPlace",value:function(){return this.state.marker.getPlace()}},{key:"getPosition",value:function(){return this.state.marker.getPosition()}},{key:"getShape",value:function(){return this.state.marker.getShape()}},{key:"getTitle",value:function(){return this.state.marker.getTitle()}},{key:"getVisible",value:function(){return this.state.marker.getVisible()}},{key:"getZIndex",value:function(){return this.state.marker.getZIndex()}},{key:"componentWillMount",value:function(){if(d["default"]){var e=h["default"]._createMarker(this.props);this.setState({marker:e})}}},{key:"componentWillUnmount",value:function(){if(d["default"]){var e=this.props.anchorHolderRef,t=this.state.marker;e&&"MarkerClusterer"===e.getAnchorType()&&e.getAnchor().removeMarker(t)}}},{key:"render",value:function(){return this.state.marker?c["default"].createElement(h["default"],i({marker:this.state.marker},this.props),this.props.children):c["default"].createElement("noscript",null)}}],[{key:"propTypes",value:i({},f.markerDefaultPropTypes,f.markerControlledPropTypes,f.markerEventPropTypes),enumerable:!0}]),t}(l.Component);t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},u=n(4),l=r(u),c=n(37),p=r(c),d=n(10),f=r(d),h=n(11),m=r(h),y=n(13),v=r(y),_=n(15),g=r(_),b=n(7),T=r(b),M={animation:u.PropTypes.any,attribution:u.PropTypes.any,clickable:u.PropTypes.bool,cursor:u.PropTypes.string,draggable:u.PropTypes.bool,icon:u.PropTypes.any,label:u.PropTypes.any,opacity:u.PropTypes.number,options:u.PropTypes.object,place:u.PropTypes.any,position:u.PropTypes.any,shape:u.PropTypes.any,title:u.PropTypes.string,visible:u.PropTypes.bool,zIndex:u.PropTypes.number};t.markerControlledPropTypes=M;var w=(0,m["default"])(M);t.markerDefaultPropTypes=w;var k={animation:function(e,t){t.getMarker().setAnimation(e)},attribution:function(e,t){t.getMarker().setAttribution(e)},clickable:function(e,t){t.getMarker().setClickable(e)},cursor:function(e,t){t.getMarker().setCursor(e)},draggable:function(e,t){t.getMarker().setDraggable(e)},icon:function(e,t){t.getMarker().setIcon(e)},label:function(e,t){t.getMarker().setLabel(e)},opacity:function(e,t){t.getMarker().setOpacity(e)},options:function(e,t){t.getMarker().setOptions(e)},place:function(e,t){t.getMarker().setPlace(e)},position:function(e,t){t.getMarker().setPosition(e)},shape:function(e,t){t.getMarker().setShape(e)},title:function(e,t){t.getMarker().setTitle(e)},visible:function(e,t){t.getMarker().setVisible(e)},zIndex:function(e,t){t.getMarker().setZIndex(e)}},S=(0,f["default"])(p["default"]),P=S.eventPropTypes,L=S.registerEvents,D=P;t.markerEventPropTypes=D;var O=function(e){function t(){o(this,n),s(Object.getPrototypeOf(n.prototype),"constructor",this).apply(this,arguments)}a(t,e),i(t,[{key:"getMarker",value:function(){return this.props.marker}},{key:"getAnchor",value:function(){return this.props.marker}},{key:"render",value:function(){var e=this,t=this.props,n=t.mapHolderRef,r=t.children;return u.Children.count(r)>0?l["default"].createElement("div",null,u.Children.map(r,function(t){return t&&l["default"].cloneElement(t,{mapHolderRef:n,anchorHolderRef:e})})):l["default"].createElement("noscript",null)}}],[{key:"_createMarker",value:function(e){var t=e.mapHolderRef,n=e.anchorHolderRef,r=new google.maps.Marker((0,v["default"])(e,M));return n?"MarkerClusterer"===n.getAnchorType()&&n.getAnchor().addMarker(r):r.setMap(t.getMap()), r}},{key:"propTypes",value:{mapHolderRef:u.PropTypes.instanceOf(T["default"]).isRequired,marker:u.PropTypes.object.isRequired},enumerable:!0}]);var n=t;return t=(0,g["default"])({registerEvents:L,instanceMethodName:"getMarker",updaters:k})(t)||t}(u.Component);t["default"]=O},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["animation_changed","click","clickable_changed","cursor_changed","dblclick","drag","dragend","draggable_changed","dragstart","flat_changed","icon_changed","mousedown","mouseout","mouseover","mouseup","position_changed","rightclick","shape_changed","title_changed","visible_changed","zindex_changed"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},l=n(4),c=r(l),p=n(18),d=r(p),f=n(39),h=r(f),m=function(e){function t(){o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments),this.state={}}return a(t,e),s(t,[{key:"getPanes",value:function(){return this.state.overlayView.getPanes()}},{key:"getProjection",value:function(){return this.state.overlayView.getProjection()}},{key:"componentWillMount",value:function(){if(d["default"]){var e=h["default"]._createOverlayView(this.props);this.setState({overlayView:e})}}},{key:"render",value:function(){return this.state.overlayView?c["default"].createElement(h["default"],i({overlayView:this.state.overlayView},this.props),this.props.children):c["default"].createElement("noscript",null)}}],[{key:"FLOAT_PANE",value:"floatPane",enumerable:!0},{key:"MAP_PANE",value:"mapPane",enumerable:!0},{key:"MARKER_LAYER",value:"markerLayer",enumerable:!0},{key:"OVERLAY_LAYER",value:"overlayLayer",enumerable:!0},{key:"OVERLAY_MOUSE_TARGET",value:"overlayMouseTarget",enumerable:!0},{key:"propTypes",value:i({},f.overlayViewDefaultPropTypes,f.overlayViewControlledPropTypes),enumerable:!0},{key:"defaultProps",value:{mapPaneName:t.OVERLAY_LAYER},enumerable:!0}]),t}(l.Component);t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},u=n(4),l=r(u),c=n(31),p=n(40),d=r(p),f=n(11),h=r(f),m=n(13),y=r(m),v=n(7),_=r(v),g={mapPaneName:u.PropTypes.string,getPixelPositionOffset:u.PropTypes.func,position:u.PropTypes.object,children:u.PropTypes.node,bounds:u.PropTypes.object};t.overlayViewControlledPropTypes=g;var b=(0,h["default"])(g);t.overlayViewDefaultPropTypes=b;var T=function(e){function t(){o(this,t),s(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments)}return a(t,e),i(t,[{key:"getOverlayView",value:function(){return this.props.overlayView}},{key:"componentDidMount",value:function(){this.getOverlayView().setMap(this.props.mapHolderRef.getMap())}},{key:"componentDidUpdate",value:function(e){this.getOverlayView().setValues(this.props),this.getOverlayView()._redraw(this.props.mapPaneName!==e.mapPaneName)}},{key:"componentWillUnmount",value:function(){this.getOverlayView().setMap(null)}},{key:"render",value:function(){return l["default"].createElement("noscript",null)}}],[{key:"_createOverlayView",value:function(e){var t=new google.maps.OverlayView;return t.setValues((0,y["default"])(e,g)),t.onAdd=function(){this._containerElement=document.createElement("div"),this._containerElement.style.position="absolute"},t.draw=function(){this._mountContainerToPane(),this._renderContent()},t.onRemove=function(){(0,c.unmountComponentAtNode)(this._containerElement),this._unmountContainerFromPane(),this._containerElement=null},t._redraw=function(e){e&&(this._unmountContainerFromPane(),this._mountContainerToPane()),this._renderContent()},t._renderContent=function(){this._containerElement&&(0,c.render)(u.Children.only(this.get("children")),this._containerElement,this._positionContainerElement.bind(this))},t._mountContainerToPane=function(){var e=this.get("mapPaneName");(0,d["default"])(!!e,"OverlayView requires a mapPaneName/defaultMapPaneName in your props instead of %s",e),this.getPanes()[e].appendChild(this._containerElement)},t._unmountContainerFromPane=function(){this._containerElement.parentNode.removeChild(this._containerElement)},t._positionContainerElement=function(){var e=void 0,t=void 0,n=this._getOffset();if(this.get("bounds")){var r=this._getPixelBounds();if(r){var o=r.sw,a=r.ne;n&&(o.x+=n.x,a.y+=n.y),e=o.x+"px",t=a.y+"px",this._containerElement.style.width=a.x-o.x+"px",this._containerElement.style.height=o.y-a.y+"px"}}else{var i=this._getPixelPosition();if(i){var s=i.x,u=i.y;n&&(s+=n.x,u+=n.y),e=s+"px",t=u+"px"}}this._containerElement.style.left=e,this._containerElement.style.top=t},t._getPixelPosition=function(){var e=this.getProjection(),t=this.get("position");if((0,d["default"])(!!t,"OverlayView requires a position/defaultPosition in your props instead of %s",t),e&&t)return t instanceof google.maps.LatLng||(t=new google.maps.LatLng(t.lat,t.lng)),e.fromLatLngToDivPixel(t)},t._getPixelBounds=function(){var e=this.getProjection(),t=this.get("bounds");if((0,d["default"])(!!t,"OverlayView requires a bounds in your props instead of %s",t),e&&t)return t instanceof google.maps.LatLngBounds||(t=new google.maps.LatLngBounds(new google.maps.LatLng(t.ne.lat,t.ne.lng),new google.maps.LatLng(t.sw.lat,t.sw.lng))),{sw:e.fromLatLngToDivPixel(this.bounds.getSouthWest()),ne:e.fromLatLngToDivPixel(this.bounds.getNorthEast())}},t._getOffset=function(){var e=this.get("getPixelPositionOffset");if(e)return e(this._containerElement.offsetWidth,this._containerElement.offsetHeight)},e.anchorHolderRef&&"MarkerClusterer"===e.anchorHolderRef.getAnchorType()&&(t.getDraggable=function(){return!!e.draggable},t.getPosition=function(){return new google.maps.LatLng(this.position)},e.anchorHolderRef.getAnchor().addMarker(t)),t}},{key:"propTypes",value:{mapHolderRef:u.PropTypes.instanceOf(_["default"]).isRequired,mapPaneName:u.PropTypes.string,overlayView:u.PropTypes.object.isRequired},enumerable:!0}]),t}(u.Component);t["default"]=T},function(e,t,n){"use strict";var r=function(e,t,n,r,o,a,i,s){if(!e){var u;if(void 0===t)u=Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,a,i,s],c=0;u=Error(t.replace(/%s/g,function(){return l[c++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}};e.exports=r},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},l=n(4),c=r(l),p=n(18),d=r(p),f=n(42),h=r(f),m=function(e){function t(){o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments),this.state={}}return a(t,e),s(t,[{key:"getDraggable",value:function(){return this.state.polygon.getDraggable()}},{key:"getEditable",value:function(){return this.state.polygon.getEditable()}},{key:"getPath",value:function(){return this.state.polygon.getPath()}},{key:"getPaths",value:function(){return this.state.polygon.getPaths()}},{key:"getVisible",value:function(){return this.state.polygon.getVisible()}},{key:"componentWillMount",value:function(){if(d["default"]){var e=h["default"]._createPolygon(this.props);this.setState({polygon:e})}}},{key:"render",value:function(){return this.state.polygon?c["default"].createElement(h["default"],i({polygon:this.state.polygon},this.props),this.props.children):c["default"].createElement("noscript",null)}}],[{key:"propTypes",value:i({},f.polygonDefaultPropTypes,f.polygonControlledPropTypes,f.polygonEventPropTypes),enumerable:!0}]),t}(l.Component);t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},u=n(4),l=r(u),c=n(43),p=r(c),d=n(10),f=r(d),h=n(11),m=r(h),y=n(13),v=r(y),_=n(15),g=r(_),b=n(7),T=r(b),M={draggable:u.PropTypes.bool,editable:u.PropTypes.bool,options:u.PropTypes.object,path:u.PropTypes.any,paths:u.PropTypes.any,visible:u.PropTypes.bool};t.polygonControlledPropTypes=M;var w=(0,m["default"])(M);t.polygonDefaultPropTypes=w;var k={draggable:function(e,t){t.getPolygon().setDraggable(e)},editable:function(e,t){t.getPolygon().setEditable(e)},options:function(e,t){t.getPolygon().setOptions(e)},path:function(e,t){t.getPolygon().setPath(e)},paths:function(e,t){t.getPolygon().setPaths(e)},visible:function(e,t){t.getPolygon().setVisible(e)}},S=(0,f["default"])(p["default"]),P=S.eventPropTypes,L=S.registerEvents,D=P;t.polygonEventPropTypes=D;var O=function(e){function t(){o(this,n),s(Object.getPrototypeOf(n.prototype),"constructor",this).apply(this,arguments)}a(t,e),i(t,[{key:"getPolygon",value:function(){return this.props.polygon}},{key:"render",value:function(){return l["default"].createElement("noscript",null)}}],[{key:"_createPolygon",value:function(e){var t=e.mapHolderRef,n=new google.maps.Polygon((0,v["default"])(e,M));return n.setMap(t.getMap()),n}},{key:"propTypes",value:{mapHolderRef:u.PropTypes.instanceOf(T["default"]).isRequired,polygon:u.PropTypes.object.isRequired},enumerable:!0}]);var n=t;return t=(0,g["default"])({registerEvents:L,instanceMethodName:"getPolygon",updaters:k})(t)||t}(u.Component);t["default"]=O},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["click","dblclick","drag","dragend","dragstart","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},l=n(4),c=r(l),p=n(18),d=r(p),f=n(45),h=r(f),m=function(e){function t(){o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments),this.state={}}return a(t,e),s(t,[{key:"getDraggable",value:function(){return this.state.polyline.getDraggable()}},{key:"getEditable",value:function(){return this.state.polyline.getEditable()}},{key:"getPath",value:function(){return this.state.polyline.getPath()}},{key:"getVisible",value:function(){return this.state.polyline.getVisible()}},{key:"componentWillMount",value:function(){if(d["default"]){var e=h["default"]._createPolyline(this.props);this.setState({polyline:e})}}},{key:"render",value:function(){return this.state.polyline?c["default"].createElement(h["default"],i({polyline:this.state.polyline},this.props),this.props.children):c["default"].createElement("noscript",null)}}],[{key:"propTypes",value:i({},f.polylineDefaultPropTypes,f.polylineControlledPropTypes,f.polylineEventPropTypes),enumerable:!0}]),t}(l.Component);t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},u=n(4),l=r(u),c=n(46),p=r(c),d=n(10),f=r(d),h=n(11),m=r(h),y=n(13),v=r(y),_=n(15),g=r(_),b=n(7),T=r(b),M={draggable:u.PropTypes.bool,editable:u.PropTypes.bool,options:u.PropTypes.object,path:u.PropTypes.any,visible:u.PropTypes.bool};t.polylineControlledPropTypes=M;var w=(0,m["default"])(M);t.polylineDefaultPropTypes=w;var k={draggable:function(e,t){t.getPolyline().setDraggable(e)},editable:function(e,t){t.getPolyline().setEditable(e)},options:function(e,t){t.getPolyline().setOptions(e)},path:function(e,t){t.getPolyline().setPath(e)},visible:function(e,t){t.getPolyline().setVisible(e)}},S=(0,f["default"])(p["default"]),P=S.eventPropTypes,L=S.registerEvents,D=P;t.polylineEventPropTypes=D;var O=function(e){function t(){o(this,n),s(Object.getPrototypeOf(n.prototype),"constructor",this).apply(this,arguments)}a(t,e),i(t,[{key:"getPolyline",value:function(){return this.props.polyline}},{key:"render",value:function(){return l["default"].createElement("noscript",null)}}],[{key:"_createPolyline",value:function(e){var t=e.mapHolderRef,n=new google.maps.Polyline((0,v["default"])(e,M));return n.setMap(t.getMap()),n}},{key:"propTypes",value:{mapHolderRef:u.PropTypes.instanceOf(T["default"]).isRequired,polyline:u.PropTypes.object.isRequired},enumerable:!0}]);var n=t;return t=(0,g["default"])({registerEvents:L,instanceMethodName:"getPolyline",updaters:k})(t)||t}(u.Component);t["default"]=O},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["click","dblclick","drag","dragend","dragstart","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},l=n(4),c=r(l),p=n(18),d=r(p),f=n(48),h=r(f),m=function(e){function t(){o(this,t),u(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments),this.state={}}return a(t,e),s(t,[{key:"getBounds",value:function(){return this.state.rectangle.getBounds()}},{key:"getDraggable",value:function(){return this.state.rectangle.getDraggable()}},{key:"getEditable",value:function(){return this.state.rectangle.getEditable()}},{key:"getVisible",value:function(){return this.state.rectangle.getVisible()}},{key:"componentWillMount",value:function(){if(d["default"]){var e=h["default"]._createRectangle(this.props);this.setState({rectangle:e})}}},{key:"render",value:function(){return this.state.rectangle?c["default"].createElement(h["default"],i({rectangle:this.state.rectangle},this.props),this.props.children):c["default"].createElement("noscript",null)}}],[{key:"propTypes",value:i({},f.rectangleDefaultPropTypes,f.rectangleControlledPropTypes,f.rectangleEventPropTypes),enumerable:!0}]),t}(l.Component);t["default"]=m,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},u=n(4),l=r(u),c=n(49),p=r(c),d=n(10),f=r(d),h=n(11),m=r(h),y=n(13),v=r(y),_=n(15),g=r(_),b=n(7),T=r(b),M={bounds:u.PropTypes.any,draggable:u.PropTypes.bool,editable:u.PropTypes.bool,options:u.PropTypes.object,visible:u.PropTypes.bool};t.rectangleControlledPropTypes=M;var w=(0,m["default"])(M);t.rectangleDefaultPropTypes=w;var k={bounds:function(e,t){t.getRectangle().setBounds(e)},draggable:function(e,t){t.getRectangle().setDraggable(e)},editable:function(e,t){t.getRectangle().setEditable(e)},options:function(e,t){t.getRectangle().setOptions(e)},visible:function(e,t){t.getRectangle().setVisible(e)}},S=(0,f["default"])(p["default"]),P=S.eventPropTypes,L=S.registerEvents,D=P;t.rectangleEventPropTypes=D;var O=function(e){function t(){o(this,n),s(Object.getPrototypeOf(n.prototype),"constructor",this).apply(this,arguments)}a(t,e),i(t,[{key:"getRectangle",value:function(){return this.props.rectangle}},{key:"render",value:function(){return l["default"].createElement("noscript",null)}}],[{key:"_createRectangle",value:function(e){var t=e.mapHolderRef,n=new google.maps.Rectangle((0,v["default"])(e,M));return n.setMap(t.getMap()),n}},{key:"propTypes",value:{mapHolderRef:u.PropTypes.instanceOf(T["default"]).isRequired,rectangle:u.PropTypes.object.isRequired},enumerable:!0}]);var n=t;return t=(0,g["default"])({registerEvents:L,instanceMethodName:"getRectangle",updaters:k})(t)||t}(u.Component);t["default"]=O},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["bounds_changed","click","dblclick","drag","dragend","dragstart","mousedown","mousemove","mouseout","mouseover","mouseup","rightclick"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)<0&&Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},c=n(4),p=r(c),d=n(18),f=r(d),h=n(51),m=r(h),y=function(e){function t(){a(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments),this.state={}}return i(t,e),u(t,[{key:"getBounds",value:function(){return this.state.searchBox.getBounds()}},{key:"getPlaces",value:function(){return this.state.searchBox.getPlaces()}},{key:"componentWillMount",value:function(){if(f["default"]){var e=this.props,t=e.classes,n=e.style,r=e.placeholder,a=o(e,["mapHolderRef","classes","style","placeholder"]),i=document.createElement("input");i.className=t,i.type="text",i.placeholder=r;for(var s in n)n.hasOwnProperty(s)&&(i.style[s]=n[s]);var u=m["default"]._createSearchBox(i,a);this.setState({inputElement:i,searchBox:u})}}},{key:"render",value:function(){var e=this.props,t=e.mapHolderRef,n=e.controlPosition;return this.state.searchBox?p["default"].createElement(m["default"],s({controlPosition:n,inputElement:this.state.inputElement,mapHolderRef:t,searchBox:this.state.searchBox},this.props),this.props.children):p["default"].createElement("noscript",null)}}],[{key:"propTypes",value:s({},h.searchBoxDefaultPropTypes,h.searchBoxControlledPropTypes,h.searchBoxEventPropTypes),enumerable:!0}]),t}(c.Component);t["default"]=y,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},u=n(4),l=r(u),c=n(52),p=r(c),d=n(10),f=r(d),h=n(11),m=r(h),y=n(13),v=r(y),_=n(15),g=r(_),b=n(7),T=r(b),M={bounds:u.PropTypes.any};t.searchBoxControlledPropTypes=M;var w=(0,m["default"])(M);t.searchBoxDefaultPropTypes=w;var k={bounds:function(e,t){t.getSearchBox().setBounds(e)}},S=(0,f["default"])(p["default"]),P=S.eventPropTypes,L=S.registerEvents,D=P;t.searchBoxEventPropTypes=D;var O=function(e){function t(){o(this,n),s(Object.getPrototypeOf(n.prototype),"constructor",this).apply(this,arguments)}a(t,e),i(t,[{key:"componentDidMount",value:function(){this._mountComponentToMap(this.props.controlPosition)}},{key:"componentDidUpdate",value:function(e){this.props.controlPosition!==e.controlPosition&&(this._unmountComponentFromMap(e.controlPosition),this._mountComponentToMap(this.props.controlPosition))}},{key:"componentWillUnmount",value:function(){this._unmountComponentFromMap(this.props.controlPosition)}},{key:"_mountComponentToMap",value:function(e){var t=this.props,n=t.mapHolderRef,r=t.inputElement;n.getMap().controls[e].push(r)}},{key:"_unmountComponentFromMap",value:function(e){var t=this.props,n=t.mapHolderRef,r=t.inputElement,o=n.getMap().controls[e].getArray().indexOf(r);n.getMap().controls[e].removeAt(o)}},{key:"getSearchBox",value:function(){return this.props.searchBox}},{key:"render",value:function(){return l["default"].createElement("noscript",null)}}],[{key:"_createSearchBox",value:function(e,t){var n=new google.maps.places.SearchBox(e,(0,v["default"])(t,M));return n}},{key:"propTypes",value:{mapHolderRef:u.PropTypes.instanceOf(T["default"]).isRequired,searchBox:u.PropTypes.object.isRequired},enumerable:!0}]);var n=t;return t=(0,g["default"])({registerEvents:L,instanceMethodName:"getSearchBox",updaters:k})(t)||t}(u.Component);t["default"]=O},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["places_changed"],e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){var n={};for(var r in e)t.indexOf(r)<0&&Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},u=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},c=n(4),p=r(c),d=n(18),f=r(d),h=n(54),m=r(h),y=function(e){function t(){a(this,t),l(Object.getPrototypeOf(t.prototype),"constructor",this).apply(this,arguments),this.state={}}return i(t,e),u(t,[{key:"getAverageCenter",value:function(){return this.state.markerClusterer.getAverageCenter()}},{key:"getBatchSizeIE",value:function(){return this.state.markerClusterer.getBatchSizeIE()}},{key:"getCalculator",value:function(){return this.state.markerClusterer.getCalculator()}},{key:"getClusterClass",value:function(){return this.state.markerClusterer.getClusterClass()}},{key:"getClusters",value:function(){return this.state.markerClusterer.getClusters()}},{key:"getEnableRetinaIcons",value:function(){return this.state.markerClusterer.getEnableRetinaIcons()}},{key:"getGridSize",value:function(){return this.state.markerClusterer.getGridSize()}},{key:"getIgnoreHidden",value:function(){return this.state.markerClusterer.getIgnoreHidden()}},{key:"getImageExtension",value:function(){return this.state.markerClusterer.getImageExtension()}},{key:"getImagePath",value:function(){return this.state.markerClusterer.getImagePath()}},{key:"getImageSize",value:function(){return this.state.markerClusterer.getImageSize()}},{key:"getMarkers",value:function(){ return this.state.markerClusterer.getMarkers()}},{key:"getMaxZoom",value:function(){return this.state.markerClusterer.getMaxZoom()}},{key:"getMinimumClusterSize",value:function(){return this.state.markerClusterer.getMinimumClusterSize()}},{key:"getStyles",value:function(){return this.state.markerClusterer.getStyles()}},{key:"getTitle",value:function(){return this.state.markerClusterer.getTitle()}},{key:"getTotalClusters",value:function(){return this.state.markerClusterer.getTotalClusters()}},{key:"getZoomOnClick",value:function(){return this.state.markerClusterer.getZoomOnClick()}},{key:"addMarker",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.state.markerClusterer.addMarker(e,t)}},{key:"addMarkers",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.state.markerClusterer.addMarkers(e,t)}},{key:"removeMarker",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.state.markerClusterer.removeMarker(e,t)}},{key:"removeMarkers",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.state.markerClusterer.removeMarkers(e,t)}},{key:"clearMarkers",value:function(){return this.state.markerClusterer.clearMarkers()}},{key:"fitMapToMarkers",value:function(){return this.state.markerClusterer.fitMapToMarkers()}},{key:"repaint",value:function(){return this.state.markerClusterer.repaint()}},{key:"componentWillMount",value:function(){if(f["default"]){var e=this.props,t=e.mapHolderRef,n=o(e,["mapHolderRef"]),r=m["default"]._createMarkerClusterer(t,n);this.setState({markerClusterer:r})}}},{key:"render",value:function(){return this.state.markerClusterer?p["default"].createElement(m["default"],s({markerClusterer:this.state.markerClusterer},this.props),this.props.children):p["default"].createElement("noscript",null)}}],[{key:"propTypes",value:s({},h.markerClusterDefaultPropTypes,h.markerClusterControlledPropTypes,h.markerClusterEventPropTypes),enumerable:!0}]),t}(c.Component);t["default"]=y,e.exports=t["default"]},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),s=function(e,t,n){for(var r=!0;r;){var o=e,a=t,i=n;r=!1,null===o&&(o=Function.prototype);var s=Object.getOwnPropertyDescriptor(o,a);if(void 0!==s){if("value"in s)return s.value;var u=s.get;if(void 0===u)return;return u.call(i)}var l=Object.getPrototypeOf(o);if(null===l)return;e=l,t=a,n=i,r=!0,s=l=void 0}},u=n(4),l=r(u),c=n(55),p=r(c),d=n(10),f=r(d),h=n(11),m=r(h),y=n(13),v=r(y),_=n(15),g=r(_),b=n(7),T=r(b),M={averageCenter:u.PropTypes.bool,batchSizeIE:u.PropTypes.number,calculator:u.PropTypes.func,clusterClass:u.PropTypes.string,enableRetinaIcons:u.PropTypes.bool,gridSize:u.PropTypes.number,ignoreHidden:u.PropTypes.bool,imageExtension:u.PropTypes.string,imagePath:u.PropTypes.string,imageSizes:u.PropTypes.array,maxZoom:u.PropTypes.number,minimumClusterSize:u.PropTypes.number,styles:u.PropTypes.array,title:u.PropTypes.string,zoomOnClick:u.PropTypes.bool};t.markerClustererControlledPropTypes=M;var w=(0,m["default"])(M);t.markerClustererDefaultPropTypes=w;var k={averageCenter:function(e,t){t.getMarkerClusterer().setAverageCenter(e)},batchSizeIE:function(e,t){t.getMarkerClusterer().setBatchSizeIE(e)},calculator:function(e,t){t.getMarkerClusterer().setCalculator(e)},enableRetinaIcons:function(e,t){t.getMarkerClusterer().setEnableRetinaIcons(e)},gridSize:function(e,t){t.getMarkerClusterer().setGridSize(e)},ignoreHidden:function(e,t){t.getMarkerClusterer().setIgnoreHidden(e)},imageExtension:function(e,t){t.getMarkerClusterer().setImageExtension(e)},imagePath:function(e,t){t.getMarkerClusterer().setImagePath(e)},imageSizes:function(e,t){t.getMarkerClusterer().setImageSizes(e)},maxZoom:function(e,t){t.getMarkerClusterer().setMaxZoom(e)},minimumClusterSize:function(e,t){t.getMarkerClusterer().setMinimumClusterSize(e)},styles:function(e,t){t.getMarkerClusterer().setStyles(e)},title:function(e,t){t.getMarkerClusterer().setTitle(e)},zoomOnClick:function(e,t){t.getMarkerClusterer().setZoomOnClick(e)}},S=(0,f["default"])(p["default"]),P=S.eventPropTypes,L=S.registerEvents,D=P;t.markerClustererEventPropTypes=D;var O=function(e){function t(){o(this,r),s(Object.getPrototypeOf(r.prototype),"constructor",this).apply(this,arguments)}a(t,e),i(t,[{key:"getMarkerClusterer",value:function(){return this.props.markerClusterer}},{key:"componentDidUpdate",value:function(e){this.props.markerClusterer.repaint()}},{key:"componentWillUnmount",value:function(){this.props.markerClusterer.setMap(null)}},{key:"getAnchor",value:function(){return this.props.markerClusterer}},{key:"getAnchorType",value:function(){return"MarkerClusterer"}},{key:"render",value:function(){var e=this,t=this.props,n=t.mapHolderRef,r=t.children;return u.Children.count(r)>0?l["default"].createElement("div",null,u.Children.map(r,function(t){return l["default"].isValidElement(t)?l["default"].cloneElement(t,{mapHolderRef:n,anchorHolderRef:e}):t})):l["default"].createElement("noscript",null)}}],[{key:"_createMarkerClusterer",value:function(e,t){var r=n(56),o=new r(e.getMap(),[],(0,v["default"])(t,M));return o}},{key:"PropTypes",value:{mapHolderRef:u.PropTypes.instanceOf(T["default"]).isRequired,markerClusterer:u.PropTypes.object.isRequired},enumerable:!0}]);var r=t;return t=(0,g["default"])({registerEvents:L,instanceMethodName:"getMarkerClusterer",updaters:k})(t)||t}(u.Component);t["default"]=O},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=["click","clusteringbegin","clusteringend","mouseout","mouseover"],e.exports=t["default"]},function(e,t){function n(e,t){e.getMarkerClusterer().extend(n,google.maps.OverlayView),this.cluster_=e,this.className_=e.getMarkerClusterer().getClusterClass(),this.styles_=t,this.center_=null,this.div_=null,this.sums_=null,this.visible_=!1,this.setMap(e.getMap())}function r(e){this.markerClusterer_=e,this.map_=e.getMap(),this.gridSize_=e.getGridSize(),this.minClusterSize_=e.getMinimumClusterSize(),this.averageCenter_=e.getAverageCenter(),this.markers_=[],this.center_=null,this.bounds_=null,this.clusterIcon_=new n(this,e.getStyles())}function o(e,t,n){this.extend(o,google.maps.OverlayView),t=t||[],n=n||{},this.markers_=[],this.clusters_=[],this.listeners_=[],this.activeMap_=null,this.ready_=!1,this.gridSize_=n.gridSize||60,this.minClusterSize_=n.minimumClusterSize||2,this.maxZoom_=n.maxZoom||null,this.styles_=n.styles||[],this.title_=n.title||"",this.zoomOnClick_=!0,void 0!==n.zoomOnClick&&(this.zoomOnClick_=n.zoomOnClick),this.averageCenter_=!1,void 0!==n.averageCenter&&(this.averageCenter_=n.averageCenter),this.ignoreHidden_=!1,void 0!==n.ignoreHidden&&(this.ignoreHidden_=n.ignoreHidden),this.enableRetinaIcons_=!1,void 0!==n.enableRetinaIcons&&(this.enableRetinaIcons_=n.enableRetinaIcons),this.imagePath_=n.imagePath||o.IMAGE_PATH,this.imageExtension_=n.imageExtension||o.IMAGE_EXTENSION,this.imageSizes_=n.imageSizes||o.IMAGE_SIZES,this.calculator_=n.calculator||o.CALCULATOR,this.batchSize_=n.batchSize||o.BATCH_SIZE,this.batchSizeIE_=n.batchSizeIE||o.BATCH_SIZE_IE,this.clusterClass_=n.clusterClass||"cluster",navigator.userAgent.toLowerCase().indexOf("msie")!==-1&&(this.batchSize_=this.batchSizeIE_),this.setupStyles_(),this.addMarkers(t,!0),this.setMap(e)}n.prototype.onAdd=function(){var e,t,n=this;this.div_=document.createElement("div"),this.div_.className=this.className_,this.visible_&&this.show(),this.getPanes().overlayMouseTarget.appendChild(this.div_),this.boundsChangedListener_=google.maps.event.addListener(this.getMap(),"bounds_changed",function(){t=e}),google.maps.event.addDomListener(this.div_,"mousedown",function(){e=!0,t=!1}),google.maps.event.addDomListener(this.div_,"click",function(r){if(e=!1,!t){var o,a,i=n.cluster_.getMarkerClusterer();google.maps.event.trigger(i,"click",n.cluster_),google.maps.event.trigger(i,"clusterclick",n.cluster_),i.getZoomOnClick()&&(a=i.getMaxZoom(),o=n.cluster_.getBounds(),i.getMap().fitBounds(o),setTimeout(function(){i.getMap().fitBounds(o),null!==a&&i.getMap().getZoom()>a&&i.getMap().setZoom(a+1)},100)),r.cancelBubble=!0,r.stopPropagation&&r.stopPropagation()}}),google.maps.event.addDomListener(this.div_,"mouseover",function(){var e=n.cluster_.getMarkerClusterer();google.maps.event.trigger(e,"mouseover",n.cluster_)}),google.maps.event.addDomListener(this.div_,"mouseout",function(){var e=n.cluster_.getMarkerClusterer();google.maps.event.trigger(e,"mouseout",n.cluster_)})},n.prototype.onRemove=function(){this.div_&&this.div_.parentNode&&(this.hide(),google.maps.event.removeListener(this.boundsChangedListener_),google.maps.event.clearInstanceListeners(this.div_),this.div_.parentNode.removeChild(this.div_),this.div_=null)},n.prototype.draw=function(){if(this.visible_){var e=this.getPosFromLatLng_(this.center_);this.div_.style.top=e.y+"px",this.div_.style.left=e.x+"px"}},n.prototype.hide=function(){this.div_&&(this.div_.style.display="none"),this.visible_=!1},n.prototype.show=function(){if(this.div_){var e="",t=this.backgroundPosition_.split(" "),n=parseInt(t[0].replace(/^\s+|\s+$/g,""),10),r=parseInt(t[1].replace(/^\s+|\s+$/g,""),10),o=this.getPosFromLatLng_(this.center_);this.div_.style.cssText=this.createCss(o),e="",this.div_.innerHTML=e+"
"+this.sums_.text+"
",this.div_.title=void 0===this.sums_.title||""===this.sums_.title?this.cluster_.getMarkerClusterer().getTitle():this.sums_.title,this.div_.style.display=""}this.visible_=!0},n.prototype.useStyle=function(e){this.sums_=e;var t=Math.max(0,e.index-1);t=Math.min(this.styles_.length-1,t);var n=this.styles_[t];this.url_=n.url,this.height_=n.height,this.width_=n.width,this.anchorText_=n.anchorText||[0,0],this.anchorIcon_=n.anchorIcon||[parseInt(this.height_/2,10),parseInt(this.width_/2,10)],this.textColor_=n.textColor||"black",this.textSize_=n.textSize||11,this.textDecoration_=n.textDecoration||"none",this.fontWeight_=n.fontWeight||"bold",this.fontStyle_=n.fontStyle||"normal",this.fontFamily_=n.fontFamily||"Arial,sans-serif",this.backgroundPosition_=n.backgroundPosition||"0 0"},n.prototype.setCenter=function(e){this.center_=e},n.prototype.createCss=function(e){var t=[];return t.push("cursor: pointer;"),t.push("position: absolute; top: "+e.y+"px; left: "+e.x+"px;"),t.push("width: "+this.width_+"px; height: "+this.height_+"px;"),t.join("")},n.prototype.getPosFromLatLng_=function(e){var t=this.getProjection().fromLatLngToDivPixel(e);return t.x-=this.anchorIcon_[1],t.y-=this.anchorIcon_[0],t.x=parseInt(t.x,10),t.y=parseInt(t.y,10),t},r.prototype.getSize=function(){return this.markers_.length},r.prototype.getMarkers=function(){return this.markers_},r.prototype.getCenter=function(){return this.center_},r.prototype.getMap=function(){return this.map_},r.prototype.getMarkerClusterer=function(){return this.markerClusterer_},r.prototype.getBounds=function(){var e,t=new google.maps.LatLngBounds(this.center_,this.center_),n=this.getMarkers();for(e=0;n.length>e;e++)t.extend(n[e].getPosition());return t},r.prototype.remove=function(){this.clusterIcon_.setMap(null),this.markers_=[],delete this.markers_},r.prototype.addMarker=function(e){var t,n,r;if(this.isMarkerAlreadyAdded_(e))return!1;if(this.center_){if(this.averageCenter_){var o=this.markers_.length+1,a=(this.center_.lat()*(o-1)+e.getPosition().lat())/o,i=(this.center_.lng()*(o-1)+e.getPosition().lng())/o;this.center_=new google.maps.LatLng(a,i),this.calculateBounds_()}}else this.center_=e.getPosition(),this.calculateBounds_();if(e.isAdded=!0,this.markers_.push(e),n=this.markers_.length,r=this.markerClusterer_.getMaxZoom(),null!==r&&this.map_.getZoom()>r)e.getMap()!==this.map_&&e.setMap(this.map_);else if(this.minClusterSize_>n)e.getMap()!==this.map_&&e.setMap(this.map_);else if(n===this.minClusterSize_)for(t=0;n>t;t++)this.markers_[t].setMap(null);else e.setMap(null);return this.updateIcon_(),!0},r.prototype.isMarkerInClusterBounds=function(e){return this.bounds_.contains(e.getPosition())},r.prototype.calculateBounds_=function(){var e=new google.maps.LatLngBounds(this.center_,this.center_);this.bounds_=this.markerClusterer_.getExtendedBounds(e)},r.prototype.updateIcon_=function(){var e=this.markers_.length,t=this.markerClusterer_.getMaxZoom();if(null!==t&&this.map_.getZoom()>t)return void this.clusterIcon_.hide();if(this.minClusterSize_>e)return void this.clusterIcon_.hide();var n=this.markerClusterer_.getStyles().length,r=this.markerClusterer_.getCalculator()(this.markers_,n);this.clusterIcon_.setCenter(this.center_),this.clusterIcon_.useStyle(r),this.clusterIcon_.show()},r.prototype.isMarkerAlreadyAdded_=function(e){var t;if(this.markers_.indexOf)return this.markers_.indexOf(e)!==-1;for(t=0;this.markers_.length>t;t++)if(e===this.markers_[t])return!0;return!1},o.prototype.onAdd=function(){var e=this;this.activeMap_=this.getMap(),this.ready_=!0,this.repaint(),this.listeners_=[google.maps.event.addListener(this.getMap(),"zoom_changed",function(){e.resetViewport_(!1),this.getZoom()!==(this.get("minZoom")||0)&&this.getZoom()!==this.get("maxZoom")||google.maps.event.trigger(this,"idle")}),google.maps.event.addListener(this.getMap(),"idle",function(){e.redraw_()})]},o.prototype.onRemove=function(){var e;for(e=0;this.markers_.length>e;e++)this.markers_[e].getMap()!==this.activeMap_&&this.markers_[e].setMap(this.activeMap_);for(e=0;this.clusters_.length>e;e++)this.clusters_[e].remove();for(this.clusters_=[],e=0;this.listeners_.length>e;e++)google.maps.event.removeListener(this.listeners_[e]);this.listeners_=[],this.activeMap_=null,this.ready_=!1},o.prototype.draw=function(){},o.prototype.setupStyles_=function(){var e,t;if(0>=this.styles_.length)for(e=0;this.imageSizes_.length>e;e++)t=this.imageSizes_[e],this.styles_.push({url:this.imagePath_+(e+1)+"."+this.imageExtension_,height:t,width:t})},o.prototype.fitMapToMarkers=function(){var e,t=this.getMarkers(),n=new google.maps.LatLngBounds;for(e=0;t.length>e;e++)n.extend(t[e].getPosition());this.getMap().fitBounds(n)},o.prototype.getGridSize=function(){return this.gridSize_},o.prototype.setGridSize=function(e){this.gridSize_=e},o.prototype.getMinimumClusterSize=function(){return this.minClusterSize_},o.prototype.setMinimumClusterSize=function(e){this.minClusterSize_=e},o.prototype.getMaxZoom=function(){return this.maxZoom_},o.prototype.setMaxZoom=function(e){this.maxZoom_=e},o.prototype.getStyles=function(){return this.styles_},o.prototype.setStyles=function(e){this.styles_=e},o.prototype.getTitle=function(){return this.title_},o.prototype.setTitle=function(e){this.title_=e},o.prototype.getZoomOnClick=function(){return this.zoomOnClick_},o.prototype.setZoomOnClick=function(e){this.zoomOnClick_=e},o.prototype.getAverageCenter=function(){return this.averageCenter_},o.prototype.setAverageCenter=function(e){this.averageCenter_=e},o.prototype.getIgnoreHidden=function(){return this.ignoreHidden_},o.prototype.setIgnoreHidden=function(e){this.ignoreHidden_=e},o.prototype.getEnableRetinaIcons=function(){return this.enableRetinaIcons_},o.prototype.setEnableRetinaIcons=function(e){this.enableRetinaIcons_=e},o.prototype.getImageExtension=function(){return this.imageExtension_},o.prototype.setImageExtension=function(e){this.imageExtension_=e},o.prototype.getImagePath=function(){return this.imagePath_},o.prototype.setImagePath=function(e){this.imagePath_=e},o.prototype.getImageSizes=function(){return this.imageSizes_},o.prototype.setImageSizes=function(e){this.imageSizes_=e},o.prototype.getCalculator=function(){return this.calculator_},o.prototype.setCalculator=function(e){this.calculator_=e},o.prototype.getBatchSizeIE=function(){return this.batchSizeIE_},o.prototype.setBatchSizeIE=function(e){this.batchSizeIE_=e},o.prototype.getClusterClass=function(){return this.clusterClass_},o.prototype.setClusterClass=function(e){this.clusterClass_=e},o.prototype.getMarkers=function(){return this.markers_},o.prototype.getTotalMarkers=function(){return this.markers_.length},o.prototype.getClusters=function(){return this.clusters_},o.prototype.getTotalClusters=function(){return this.clusters_.length},o.prototype.addMarker=function(e,t){this.pushMarkerTo_(e),t||this.redraw_()},o.prototype.addMarkers=function(e,t){var n;for(n in e)e.hasOwnProperty(n)&&this.pushMarkerTo_(e[n]);t||this.redraw_()},o.prototype.pushMarkerTo_=function(e){if(e.getDraggable()){var t=this;google.maps.event.addListener(e,"dragend",function(){t.ready_&&(this.isAdded=!1,t.repaint())})}e.isAdded=!1,this.markers_.push(e)},o.prototype.removeMarker=function(e,t){var n=this.removeMarker_(e);return!t&&n&&this.repaint(),n},o.prototype.removeMarkers=function(e,t){var n,r,o=!1;for(n=0;e.length>n;n++)r=this.removeMarker_(e[n]),o=o||r;return!t&&o&&this.repaint(),o},o.prototype.removeMarker_=function(e){var t,n=-1;if(this.markers_.indexOf)n=this.markers_.indexOf(e);else for(t=0;this.markers_.length>t;t++)if(e===this.markers_[t]){n=t;break}return n!==-1&&(e.setMap(null),this.markers_.splice(n,1),!0)},o.prototype.clearMarkers=function(){this.resetViewport_(!0),this.markers_=[]},o.prototype.repaint=function(){var e=this.clusters_.slice();this.clusters_=[],this.resetViewport_(!1),this.redraw_(),setTimeout(function(){var t;for(t=0;e.length>t;t++)e[t].remove()},0)},o.prototype.getExtendedBounds=function(e){var t=this.getProjection(),n=new google.maps.LatLng(e.getNorthEast().lat(),e.getNorthEast().lng()),r=new google.maps.LatLng(e.getSouthWest().lat(),e.getSouthWest().lng()),o=t.fromLatLngToDivPixel(n);o.x+=this.gridSize_,o.y-=this.gridSize_;var a=t.fromLatLngToDivPixel(r);a.x-=this.gridSize_,a.y+=this.gridSize_;var i=t.fromDivPixelToLatLng(o),s=t.fromDivPixelToLatLng(a);return e.extend(i),e.extend(s),e},o.prototype.redraw_=function(){this.createClusters_(0)},o.prototype.resetViewport_=function(e){var t,n;for(t=0;this.clusters_.length>t;t++)this.clusters_[t].remove();for(this.clusters_=[],t=0;this.markers_.length>t;t++)n=this.markers_[t],n.isAdded=!1,e&&n.setMap(null)},o.prototype.distanceBetweenPoints_=function(e,t){var n=6371,r=(t.lat()-e.lat())*Math.PI/180,o=(t.lng()-e.lng())*Math.PI/180,a=Math.sin(r/2)*Math.sin(r/2)+Math.cos(e.lat()*Math.PI/180)*Math.cos(t.lat()*Math.PI/180)*Math.sin(o/2)*Math.sin(o/2),i=2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)),s=n*i;return s},o.prototype.isMarkerInBounds_=function(e,t){return t.contains(e.getPosition())},o.prototype.addToClosestCluster_=function(e){var t,n,o,a,i=4e4,s=null;for(t=0;this.clusters_.length>t;t++)o=this.clusters_[t],a=o.getCenter(),a&&(n=this.distanceBetweenPoints_(a,e.getPosition()),i>n&&(i=n,s=o));s&&s.isMarkerInClusterBounds(e)?s.addMarker(e):(o=new r(this),o.addMarker(e),this.clusters_.push(o))},o.prototype.createClusters_=function(e){var t,n,r,o=this;if(this.ready_){0===e&&(google.maps.event.trigger(this,"clusteringbegin",this),void 0!==this.timerRefStatic&&(clearTimeout(this.timerRefStatic),delete this.timerRefStatic)),r=this.getMap().getZoom()>3?new google.maps.LatLngBounds(this.getMap().getBounds().getSouthWest(),this.getMap().getBounds().getNorthEast()):new google.maps.LatLngBounds(new google.maps.LatLng(85.02070771743472,(-178.48388434375)),new google.maps.LatLng((-85.08136444384544),178.00048865625));var a=this.getExtendedBounds(r),i=Math.min(e+this.batchSize_,this.markers_.length);for(t=e;i>t;t++)n=this.markers_[t],!n.isAdded&&this.isMarkerInBounds_(n,a)&&(!this.ignoreHidden_||this.ignoreHidden_&&n.getVisible())&&this.addToClosestCluster_(n);this.markers_.length>i?this.timerRefStatic=setTimeout(function(){o.createClusters_(i)},0):(delete this.timerRefStatic,google.maps.event.trigger(this,"clusteringend",this))}},o.prototype.extend=function(e,t){return function(e){var t;for(t in e.prototype)this.prototype[t]=e.prototype[t];return this}.apply(e,[t])},o.CALCULATOR=function(e,t){for(var n=0,r="",o=""+e.length,a=o;0!==a;)a=parseInt(a/10,10),n++;return n=Math.min(n,t),{text:o,index:n,title:r}},o.BATCH_SIZE=2e3,o.BATCH_SIZE_IE=500,o.IMAGE_PATH="https://raw.githubusercontent.com/googlemaps/v3-utility-library/master/markerclustererplus/images/m",o.IMAGE_EXTENSION="png",o.IMAGE_SIZES=[53,56,66,78,90],e.exports=o},function(e,t,n){var r,o;!function(){"use strict";function n(){for(var e=[],t=0;arguments.length>t;t++){var r=arguments[t];if(r){var o=typeof r;if("string"===o||"number"===o)e.push(r);else if(Array.isArray(r))e.push(n.apply(null,r));else if("object"===o)for(var i in r)a.call(r,i)&&r[i]&&e.push(i)}}return e.join(" ")}var a={}.hasOwnProperty;void 0!==e&&e.exports?e.exports=n:(r=[],o=function(){return n}.apply(t,r),!(void 0!==o&&(e.exports=o)))}()},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}var a=n(59),i=o(a),s=n(84),u=o(s),l=n(85),c=o(l),p=n(99),d=o(p),f=n(100),h=o(f),m=n(244),y=o(m),v=n(245),_=o(v),g=n(246),b=o(g),T=n(247),M=o(T),w=n(248),k=o(w),S=n(249),P=o(S),L=n(250),D=o(L),O=n(251),E=o(O),C=n(432),x=o(C),j=n(433),Y=o(j),R=n(434),A=o(R),N=n(440),I=o(N),F=n(436),H=o(F),B=n(441),V=o(B),q=n(82),W=o(q),z=n(437),U=o(z),Q=n(438),J=o(Q),G=n(442),K=o(G),$=n(65),Z=o($),X=n(83),ee=r(X),te=n(67);e.exports={SingleList:i["default"],MultiList:u["default"],SingleDropdownList:c["default"],MultiDropdownList:d["default"],RangeSlider:h["default"],TextField:y["default"],DataSearch:_["default"],SingleRange:b["default"],MultiRange:M["default"],SingleDropdownRange:k["default"],MultiDropdownRange:P["default"],ToggleButton:D["default"],DatePicker:E["default"],DateRange:x["default"],NumberBox:Y["default"],ReactiveBase:K["default"],ReactiveList:A["default"],ReactiveElement:I["default"],AppbaseChannelManager:Z["default"],AppbaseSensorHelper:te,PoweredBy:H["default"],DataController:V["default"],TYPES:ee,InitialLoader:W["default"],NoResults:U["default"],ResultStats:J["default"]}},function(e,t,n){"use strict";function r(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}function o(e){return e&&e.__esModule?e:{"default":e}}function a(e){return u["default"].createElement(c["default"],i({},e,{multipleSelect:!1}))}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e};t["default"]=a;var s=n(4),u=o(s),l=n(60),c=o(l),p=n(83),d=r(p);a.propTypes={componentId:u["default"].PropTypes.string.isRequired,appbaseField:u["default"].PropTypes.string.isRequired,title:u["default"].PropTypes.oneOfType([u["default"].PropTypes.string,u["default"].PropTypes.element]),defaultSelected:u["default"].PropTypes.string,size:u["default"].PropTypes.number,showCount:u["default"].PropTypes.bool,sortBy:u["default"].PropTypes.string,showSearch:u["default"].PropTypes.bool,placeholder:u["default"].PropTypes.string,customQuery:u["default"].PropTypes.func,initialLoader:u["default"].PropTypes.oneOfType([u["default"].PropTypes.string,u["default"].PropTypes.element]),react:u["default"].PropTypes.object,componentStyle:u["default"].PropTypes.object,showRadio:u["default"].PropTypes.bool,URLParams:u["default"].PropTypes.bool},a.defaultProps={showCount:!0,sort:"count",size:100,showSearch:!1,title:null,placeholder:"Search",componentStyle:{},showRadio:!0,URLParams:!1},a.contextTypes={appbaseRef:u["default"].PropTypes.any.isRequired,type:u["default"].PropTypes.any.isRequired},a.types={componentId:d.STRING,appbaseField:d.STRING,appbaseFieldType:d.KEYWORD,react:d.OBJECT,title:d.STRING,defaultSelected:d.STRING,size:d.NUMBER,sortBy:d.STRING,showCount:d.BOOLEAN,showSearch:d.BOOLEAN,placeholder:d.STRING,customQuery:d.FUNCTION,initialLoader:d.OBJECT,componentStyle:d.OBJECT,URLParams:d.BOOLEAN,showRadio:d.BOOLEAN}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),l=n(4),c=r(l),p=n(57),d=r(p),f=n(61),h=r(f),m=n(64),y=r(m),v=n(65),_=r(v),g=n(81),b=n(82),T=r(b),M=n(67),w=function(e){function t(e){a(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={items:[],storedItems:[],rawData:{hits:{hits:[]}},queryStart:!1,defaultSelectAll:!1},n.sortObj={aggSort:n.props.sortBy},n.previousSelectedSensor={},n.channelId=null,n.channelListener=null,n.urlParams=M.URLParams.get(n.props.componentId,n.props.multipleSelect),n.defaultSelected=null!==n.urlParams?n.urlParams:n.props.defaultSelected,n.handleSelect=n.handleSelect.bind(n),n.handleRemove=n.handleRemove.bind(n),n.filterBySearch=n.filterBySearch.bind(n),n.selectAll=n.selectAll.bind(n),n.type=n.props.multipleSelect?"Terms":"Term",n.customQuery=n.customQuery.bind(n),n.defaultCustomQuery=n.defaultCustomQuery.bind(n),n}return s(t,e),u(t,[{key:"componentDidMount",value:function(){this.size=this.props.size,this.setQueryInfo(),this.handleSelect(null===this.urlParams?"":this.urlParams),this.createChannel(!0)}},{key:"customQuery",value:function(e){var t=this.props.customQuery?this.props.customQuery:this.defaultCustomQuery;return t(e,this.state.selectAll)}},{key:"defaultCustomQuery",value:function(e,t){var n=null;if(t)n={exists:{field:[this.props.appbaseField]}};else if(e){var r=o({},this.type,o({},this.props.appbaseField,e));n=this.props.multipleSelect?e.length?r:null:r}return n}},{key:"componentWillUpdate",value:function(){var e=this;if(this.defaultValue=null!==this.urlParams?this.urlParams:this.props.defaultSelected,this.defaultSelected!==this.defaultValue){this.defaultSelected=this.defaultValue;var t=this.state.items;t=t.map(function(t){return t.key=""+t.key,t.status=!!(e.defaultSelected&&e.defaultSelected.indexOf(t.key)>-1||e.selectedValue&&e.selectedValue.indexOf(t.key)>-1),t}),this.setState({items:t,storedItems:t}),setTimeout(this.handleSelect.bind(this,this.defaultSelected),1e3)}this.sortBy!==this.props.sortBy&&(this.sortBy=this.props.sortBy,this.handleSortSelect()),this.size!==this.props.size&&(this.size=this.props.size,this.removeChannel(),this.createChannel())}},{key:"componentWillUnmount",value:function(){this.removeChannel()}},{key:"removeChannel",value:function(){this.channelId&&_["default"].stopStream(this.channelId),this.channelListener&&this.channelListener.remove(),this.loadListener&&this.loadListener.remove()}},{key:"setQueryInfo",value:function(){var e={key:this.props.componentId,value:{queryType:this.type,inputData:this.props.appbaseField,customQuery:this.customQuery}};M.selectedSensor.setSensorInfo(e)}},{key:"includeAggQuery",value:function(){var e={key:this.props.componentId+"-sort",value:this.sortObj};M.selectedSensor.setSortInfo(e)}},{key:"handleSortSelect",value:function(){this.sortObj={aggSort:this.props.sortBy};var e={key:this.props.componentId+"-sort",value:this.sortObj};M.selectedSensor.set(e,!0,"sortChange")}},{key:"createChannel",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],n=this.props.react?this.props.react:{};n.aggs={key:this.props.appbaseField,sort:this.props.sortBy,size:this.props.size,sortRef:this.props.componentId+"-sort"},n.and=n&&n.and&&"string"==typeof n.and?[n.and]:n.and?n.and:[],n.and.push(this.props.componentId+"-sort"),n.and.push("nativeListChanges"),this.includeAggQuery();var r=_["default"].create(this.context.appbaseRef,this.context.type,n);this.channelId=r.channelId,this.channelListener=r.emitter.addListener(this.channelId,function(t){if(t.error&&e.setState({queryStart:!1}),t.appliedQuery){var n=t.data,r=void 0;"streaming"===t.mode?(r=e.state.rawData,r.hits.hits.push(t.data)):"historic"===t.mode&&(r=n),e.setState({queryStart:!1,rawData:r}),e.setData(r)}}),t&&setTimeout(function(){var e={key:"nativeListChanges",value:""};M.selectedSensor.set(e,!0)},100),this.listenLoadingChannel(r)}},{key:"listenLoadingChannel",value:function(e){var t=this;this.loadListener=e.emitter.addListener(e.channelId+"-query",function(e){e.appliedQuery&&t.setState({queryStart:e.queryState})})}},{key:"setData",value:function(e){e.aggregations&&e.aggregations[this.props.appbaseField]&&e.aggregations[this.props.appbaseField].buckets&&this.addItemsToList(e.aggregations[this.props.appbaseField].buckets)}},{key:"addItemsToList",value:function(e){var t=this;e=e.map(function(e){return e.key=""+e.key,e.status=!(!t.selectedValue||t.selectedValue.indexOf(e.key)<=-1),e}),this.setState({items:e,storedItems:e})}},{key:"handleSelect",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.state.selectAll&&!t&&this.setState({selectAll:!1}),this.setValue(e,!0)}},{key:"handleRemove",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.setValue(e,t)}},{key:"setValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n={key:this.props.componentId,value:e};if(this.selectedValue=e,this.props.multipleSelect){var r=this.state.items.map(function(t){return t.status=!(!e||e.indexOf(t.key)<=-1),t});this.setState({items:r})}this.props.onValueChange&&this.props.onValueChange(n.value);var o="string"==typeof e?e.trim()?e:null:e;M.URLParams.update(this.props.componentId,o,this.props.URLParams),M.selectedSensor.set(n,t)}},{key:"selectAll",value:function(e,t,n){var r=this.state.items.map(function(t){return t.status=e,t});e&&(this.selectedValue=t),this.setState({items:r,storedItems:r,defaultSelectAll:e,selectAll:e},n)}},{key:"filterBySearch",value:function(e){if(e){var t=this.state.storedItems.map(function(t){return t.visible=!(!t.key||t.key.toLowerCase().indexOf(e.toLowerCase())<=-1),t});this.setState({items:t})}else{var n=this.state.storedItems.map(function(e){return e.visible=!0,e});this.setState({items:n})}}},{key:"render",value:function(){var e=void 0,t=null,n=null; -e=this.props.multipleSelect?c["default"].createElement(h["default"],{items:this.state.items,onSelect:this.handleSelect,onRemove:this.handleRemove,showCount:this.props.showCount,selectAll:this.selectAll,showCheckbox:this.props.showCheckbox,defaultSelected:this.defaultSelected,selectAllLabel:this.props.selectAllLabel,selectAllValue:this.state.selectAll}):c["default"].createElement(y["default"],{items:this.state.items,onSelect:this.handleSelect,onRemove:this.handleRemove,showCount:this.props.showCount,showRadio:this.props.showRadio,defaultSelected:this.defaultSelected,selectAllLabel:this.props.selectAllLabel,selectAll:this.selectAll}),this.props.showSearch&&(t=c["default"].createElement(g.StaticSearch,{placeholder:this.props.placeholder,changeCallback:this.filterBySearch})),this.props.title&&(n=c["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var r=(0,d["default"])({"rbc-search-active":this.props.showSearch,"rbc-search-inactive":!this.props.showSearch,"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-singlelist":!this.props.multipleSelect,"rbc-multilist":this.props.multipleSelect,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return c["default"].createElement("div",{className:"rbc col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},n,t,e,this.props.initialLoader&&this.state.queryStart?c["default"].createElement(T["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(l.Component);t["default"]=w,w.propTypes={appbaseField:c["default"].PropTypes.string.isRequired,componentId:c["default"].PropTypes.string.isRequired,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),size:M.sizeValidation,showCount:c["default"].PropTypes.bool,multipleSelect:c["default"].PropTypes.bool,sortBy:c["default"].PropTypes.oneOf(["asc","desc","count"]),showSearch:c["default"].PropTypes.bool,placeholder:c["default"].PropTypes.string,selectAllLabel:c["default"].PropTypes.string,customQuery:c["default"].PropTypes.func,initialLoader:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),defaultSelected:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.number,c["default"].PropTypes.array]),react:c["default"].PropTypes.object,onValueChange:c["default"].PropTypes.func,componentStyle:c["default"].PropTypes.object,showRadio:c["default"].PropTypes.bool,showCheckbox:c["default"].PropTypes.bool,URLParams:c["default"].PropTypes.bool},w.defaultProps={showCount:!0,multipleSelect:!0,sortBy:"count",size:100,showSearch:!1,title:null,placeholder:"Search",selectAllLabel:null,componentStyle:{},showRadio:!0,showCheckbox:!0,URLParams:!1},w.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),l=r(u),c=n(62),p=r(c),d=n(63),f=r(d),h=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={selectedItems:[]},n.refStore={},n.handleListClick=n.handleListClick.bind(n),n.handleTagClick=n.handleTagClick.bind(n),n.handleListClickAll=n.handleListClickAll.bind(n),n.clearAll=n.clearAll.bind(n),n}return i(t,e),s(t,[{key:"componentDidMount",value:function(){this.props.defaultSelected&&this.defaultUpdate()}},{key:"defaultUpdate",value:function(){var e=this,t=this.props.defaultSelected.indexOf(this.props.selectAllLabel)>-1;t?this.setDefaultSelectAll():this.setState({selectedItems:this.props.defaultSelected,defaultSelectall:this.props.defaultSelectall},function(){e.updateAction.bind(e),e.props.onSelect(e.state.selectedItems)})}},{key:"setDefaultSelectAll",value:function(){this.props.items&&this.props.items.length?setTimeout(this.handleListClickAll.bind(this,this.props.selectAllLabel,!0),1e3):setTimeout(this.setDefaultSelectAll.bind(this),1e3)}},{key:"componentDidUpdate",value:function(){var e=this,t=null,n=!0;this.state.selectedItems&&(t=JSON.parse(JSON.stringify(this.state.selectedItems))),t&&t.length&&this.props.items&&this.props.items.length&&(t=t.filter(function(t){var n=e.props.items.filter(function(e){return e.key===t});return!!n.length}),t.length!==this.state.selectedItems.length&&(n=!t.length,this.props.onRemove(this.state.selectedItems,n),this.updateSelectedItems(t),t.length&&this.props.onSelect(t)))}},{key:"handleListClick",value:function(e,t){var n=void 0;t?(this.props.onRemove(this.state.selectedItems,!1),n=this.state.selectedItems,n.push(e),this.setState({selectedItems:n},this.updateAction.bind(this)),this.state.selectedItems.length&&this.props.onSelect(this.state.selectedItems)):this.handleTagClick(e)}},{key:"handleTagClick",value:function(e){var t=1===this.state.selectedItems.length;this.props.onRemove(this.state.selectedItems,t);var n=(""+e).replace(/ /g,"_"),r="ref"+n,o=this.refStore[r];o.state.status=!1;var a=this.state.selectedItems,i=a.indexOf(e);a.splice(i,1),this.setState({selectedItems:a},this.updateAction.bind(this)),this.props.onSelect(a)}},{key:"clearAll",value:function(){this.handleListClickAll(this.props.selectAllLabel,!1)}},{key:"getSelectedItems",value:function(){var e=[];return this.props.items.forEach(function(t){t.status&&e.indexOf(t.key)<0&&e.push(t.key)}),e}},{key:"handleListClickAll",value:function(e,t){var n=this;this.props.selectAll(t);var r=this.props.items.map(function(e){return e.key});r=t?r:[],this.setState({defaultSelectall:t,selectedItems:r},function(){n.updateAction.bind(n),n.props.onSelect(n.state.selectedItems,r)})}},{key:"updateSelectedItems",value:function(e){this.setState({selectedItems:e})}},{key:"updateAction",value:function(){this.state.selectedItems.length||this.props.onSelect(null)}},{key:"render",value:function(){var e=this,t=this.props.items,n=this.getSelectedItems(),r=[],o=[];return t.forEach(function(t,n){try{t.keyRef=t.key.replace(/ /g,"_")}catch(o){t.keyRef=n}var a=!("visible"in t)||!!t.visible;r.push(l["default"].createElement(p["default"],{key:t.keyRef,value:t.key,doc_count:t.doc_count,countField:e.props.showCount,handleClick:e.handleListClick,visible:a,showCheckbox:e.props.showCheckbox,status:t.status||!1,ref:function(n){var r="ref"+t.keyRef;e.refStore[r]=n}}))}),this.props.selectAllLabel&&t&&t.length&&r.unshift(l["default"].createElement(p["default"],{key:"selectall",value:this.props.selectAllLabel,countField:!1,visible:!0,showCheckbox:this.props.showCheckbox,handleClick:this.handleListClickAll,status:this.props.selectAllValue,ref:function(t){e.refStore.refselectall=t}})),this.props.showTags&&n&&(n.length>5?o.unshift(l["default"].createElement(f["default"],{key:"Clear All",value:"Clear All",onClick:this.clearAll})):n.forEach(function(t){o.push(l["default"].createElement(f["default"],{key:t,value:t,onClick:e.handleTagClick}))})),l["default"].createElement("div",{className:"rbc-list-container col s12 col-xs-12"},o.length?l["default"].createElement("div",{className:"row rbc-tag-container"},o):null,l["default"].createElement("div",{className:"row"},r))}}]),t}(u.Component);t["default"]=h,h.propTypes={defaultSelected:l["default"].PropTypes.array,items:l["default"].PropTypes.array,onRemove:l["default"].PropTypes.func,onSelect:l["default"].PropTypes.func,selectAll:l["default"].PropTypes.func,selectAllLabel:l["default"].PropTypes.string,selectAllValue:l["default"].PropTypes.bool,showCount:l["default"].PropTypes.bool,showTags:l["default"].PropTypes.bool,defaultSelectall:l["default"].PropTypes.bool},h.defaultProps={showTags:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),l=r(u),c=n(57),p=r(c),d=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={initialStatus:n.props.status,status:n.props.status||!1},n.handleCheckboxChange=n.handleCheckboxChange.bind(n),n}return i(t,e),s(t,[{key:"componentDidUpdate",value:function(){this.props.status!==this.state.initialStatus&&this.setState({status:this.props.status,initialStatus:this.props.status})}},{key:"handleClick",value:function(){this.setState({status:!this.state.status}),this.props.handleClick(this.props.value,!this.state.status)}},{key:"handleCheckboxChange",value:function(e){this.setState({status:e.target.checked})}},{key:"render",value:function(){var e=void 0;this.props.countField&&(e=l["default"].createElement("span",{className:"rbc-count"}," ",this.props.doc_count," "));var t=(0,p["default"])({"rbc-count-active":this.props.countField,"rbc-count-inactive":!this.props.countField,"rbc-checkbox-active":this.props.showCheckbox,"rbc-checkbox-inactive":!this.props.showCheckbox,"rbc-list-item-active":this.state.status,"rbc-list-item-inactive":!this.state.status});return l["default"].createElement("div",{onClick:this.handleClick.bind(this),className:"rbc-list-item row "+t},l["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:this.state.status,onChange:this.handleCheckboxChange}),l["default"].createElement("label",{className:"rbc-label"},this.props.value," ",e))}}]),t}(u.Component);t["default"]=d,d.propTypes={status:l["default"].PropTypes.bool,handleClick:l["default"].PropTypes.func,value:l["default"].PropTypes.string,countField:l["default"].PropTypes.bool,doc_count:l["default"].PropTypes.number}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return i["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},i["default"].createElement("a",{href:"javascript:void(0)",className:"close"},"×"),i["default"].createElement("span",null,e.value))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var a=n(4),i=r(a)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),l=r(u),c=n(57),p=r(c),d=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={selectedItem:[]},n.defaultSelected=n.props.defaultSelected,n.defaultAllowed=!0,n.handleClick=n.handleClick.bind(n),n.handleListClickAll=n.handleListClickAll.bind(n),n}return i(t,e),s(t,[{key:"componentWillUpdate",value:function(){this.defaultSelected!=this.props.defaultSelected&&(this.defaultSelected=this.props.defaultSelected,this.defaultSelection())}},{key:"componentDidUpdate",value:function(){this.props.items.length&&this.defaultAllowed&&(this.defaultAllowed=!1,this.defaultSelection())}},{key:"defaultSelection",value:function(){this.props.defaultSelected&&(this.props.defaultSelected===this.props.selectAllLabel?this.handleListClickAll(this.props.selectAllLabel):this.handleClick(this.props.defaultSelected))}},{key:"handleListClickAll",value:function(e){var t=this,n=this.props.items.map(function(e){return e.key});this.props.selectAll(e,n),this.setState({selectedItem:e},function(){t.props.onSelect(n,e)})}},{key:"handleClick",value:function(e){this.props.onRemove(this.state.selectedItem),this.props.onSelect(e),this.setState({selectedItem:e})}},{key:"renderItemsComponent",value:function(){var e=this,t=this.props.items,n=[];return t.forEach(function(t){var r=!t.hasOwnProperty("visible")||!!t.visible;n.push(l["default"].createElement(f,{key:t.key,value:t.key,doc_count:t.doc_count,countField:e.props.showCount,handleClick:e.handleClick,visible:r,showRadio:e.props.showRadio,selectedItem:e.state.selectedItem}))}),this.props.selectAllLabel&&t&&t.length&&n.unshift(l["default"].createElement(f,{key:"selectall",visible:!0,value:this.props.selectAllLabel,countField:!1,showRadio:this.props.showRadio,handleClick:this.handleListClickAll,selectedItem:this.state.selectedItem,ref:"refselectall"})),n}},{key:"render",value:function(){return l["default"].createElement("div",{className:"rbc-list-container col s12 col-xs-12"},this.renderItemsComponent())}}]),t}(u.Component);t["default"]=d;var f=function(e){function t(e){return o(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return i(t,e),s(t,[{key:"renderItem",value:function(){var e=void 0;this.props.countField&&(e=l["default"].createElement("span",{className:"rbc-count"}," (",this.props.doc_count,") "));var t=l["default"].createElement("a",{href:"javascript:void(0)",className:"col s12 col-xs-12"},l["default"].createElement("span",null," ",this.props.value," "),e);return this.props.value===this.props.selectedItem&&(t=l["default"].createElement("a",{href:"javascript:void(0)",className:"col s12 col-xs-12"},l["default"].createElement("strong",null,l["default"].createElement("span",null," ",this.props.value," "),e))),t}},{key:"renderCount",value:function(){var e=void 0;return this.props.countField&&(e=l["default"].createElement("span",{className:"rbc-count"}," ",this.props.doc_count," ")),e}},{key:"render",value:function(){var e=this,t=(0,p["default"])({"rbc-count-active":this.props.countField,"rbc-count-inactive":!this.props.countField,"rbc-item-show":this.props.visible,"rbc-item-hide":!this.props.visible,"rbc-radio-active":this.props.showRadio,"rbc-radio-inactive":!this.props.showRadio,"rbc-list-item-active":this.props.value===this.props.selectedItem,"rbc-list-item-inactive":this.props.value!==this.props.selectedItem});return l["default"].createElement("div",{className:"rbc-list-item row "+t,onClick:function(){return e.props.handleClick(e.props.value)}},l["default"].createElement("input",{type:"radio",className:"rbc-radio-item",checked:this.props.value===this.props.selectedItem,value:this.props.value}),l["default"].createElement("label",{className:"rbc-label"},this.props.value," ",this.renderCount()))}}]),t}(u.Component)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(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}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(66),l=o(u),c=n(74),p=n(71),d=r(p),f=n(67),h=function(){function e(){i(this,e),this.emitter=new c.EventEmitter,this.channels={},this.streamRef={},this.queryOptions={},this.appbaseRef={},this.type={},this.app={},this.receive=this.receive.bind(this),this.nextPage=this.nextPage.bind(this),this.paginationChanges=this.paginationChanges.bind(this),this.sortChanges=this.sortChanges.bind(this)}return s(e,[{key:"highlightModify",value:function(e,t){return t&&t.body&&t.body.highlight&&e&&e.hits&&e.hits.hits&&e.hits.hits.length&&(e.hits.hits=e.hits.hits.map(this.highlightItem)),e}},{key:"highlightItem",value:function(e){return e.highlight&&Object.keys(e.highlight).forEach(function(t){var n=e.highlight[t][0];d["default"].set(e._source,t,n)}),e}},{key:"receive",value:function(e,t){function n(e){var n=JSON.parse(JSON.stringify(e));n.queryState=!0,i.emitter.emit(t+"-query",n)}function r(e,t,n){var r=this;this.streamRef[e]&&this.streamRef[e].stop();var o=JSON.parse(JSON.stringify(t));o.type=this.type[e],o.body&&(delete o.body.from,delete o.body.size,delete o.body.sort),this.streamRef[e]=n.searchStream(o).on("data",function(n){n=r.highlightItem(n,t);var o={mode:"streaming",data:n,appliedQuery:t};i.emitter.emit(e,o)}).on("error",function(e){console.log(e)})}var o=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c){var d={startTime:(new Date).getTime(),appliedQuery:u},f=this.appbaseRef[t];if(f){var h=u;h.type="*"===this.type[t]?"":this.type[t],h.preference=this.app[t],n(d),f.search(h).on("data",function(e){d.mode="historic",d.data=o.highlightModify(e,d.appliedQuery),i.emitter.emit(t,d);var n=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:d,react:s.react,queryOptions:n})}).on("error",function(e){var n={appliedQuery:d.appliedQuery,error:e,startTime:d.startTime};i.emitter.emit(t,n)}),s.stream&&r.call(this,t,u,f)}else console.error("appbaseRef is not set for "+t)}else{var m={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,m)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var o=n(67);t.queryBuild=function(e,t){function n(e){var t=o.selectedSensor.get(e,"sortInfo");return t}function a(e){var t=null,n=o.selectedSensor.get(e,"sensorInfo");return n&&n.externalQuery&&(t=n.externalQuery),t}function i(e){var n=o.selectedSensor.get(e,"sensorInfo"),r=null;if(n&&n.customQuery){var a=e in t?t[e]:o.selectedSensor.get(e);r=n.customQuery(a)}else t[e]&&(r={},r[n.queryType]={},"match_all"!==n.queryType&&(r[n.queryType][n.inputData]=t[e]));return r}function s(t){var o=e.react[t],a=void 0,i=void 0,s=void 0;if(o.customQuery)s=o.customQuery(o);else{if(o.sortRef){var u=n(o.sortRef);u&&u.aggSort&&(o.sort=u.aggSort)}"count"===o.sort?(a="desc",i="_count"):"asc"!==o.sort&&"desc"!==o.sort||(a=o.sort,i="_term"),s=r({},o.key,{terms:{field:o.key}}),o.size&&(s[o.key].terms.size=o.size),o.sort&&(s[o.key].terms.order=r({},i,a))}return s}function u(){var r={};return e.serializeDepends.dependsList.forEach(function(e){if("aggs"===e)r[e]=s(e);else if(e&&e.indexOf("channel-options-")>-1)d=d||{},d=Object.assign(d,t[e]);else{r[e]=i(e);var o=a(e);o&&(d=d||{},d=Object.assign(d,o))}var u=n(e);!u||"aggSort"in u||p.push(u)}),r}function l(t){var n=o.serializeDepends.createQuery(e.serializeDepends,t);return n&&n.body?(p&&p.length&&(n.body.sort=p),d&&Object.keys(d).length&&Object.keys(d).forEach(function(e){n.body[e]=d[e]})):n={},n}function c(){var e=u(),t=l(e);return t}var p=[],d=null;return c()}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){var e=this;this.sensorInfo={},this.selectedSensor={},this.paginationInfo={},this.selectedPagination={},this.sortInfo={},this.selectedSort={};var t=function(t,n){return n?e[n][t]:t?e.selectedSensor[t]:e.selectedSensor},n=function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sensorChange",o=void 0;switch(r){case"sortChange":e.sortInfo[t.key]=t.value,o=e.sortInfo;break;case"paginationChange":e.selectedPagination[t.key]=t.value,o=t;break;case"sensorChange":default:e.selectedSensor[t.key]=t.value,o=e.selectedSensor}n&&f.emit(r,o)},r=function(t){e.sensorInfo[t.key]=t.value},o=function(t){e.sortInfo[t.key]=t.value},a=function(t){e.paginationInfo[t.key]=t.value};return{get:t,set:n,setSensorInfo:r,setSortInfo:o,setPaginationInfo:a}}Object.defineProperty(t,"__esModule",{value:!0}),t.updateStats=t.combineStreamData=t.prepareResultData=t.serializeDepends=t.selectedSensor=t.WatchForDependencyChange=t.sensorEmitter=void 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},s=n(68);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var u=n(70);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var l=n(74),c=n(71),p=r(c),d=0,f=t.sensorEmitter=new l.EventEmitter,h=(t.WatchForDependencyChange=function(e,t,n,r,o,a){d+=1,this.random=d;var s={},u=function(e){Object.prototype.hasOwnProperty.call(t,e)||(t[e]="")},l=function(e,o){t[o]=s[o]&&"object"===i(s[o])?JSON.parse(JSON.stringify(s[o])):s[o],n(o,r)};this.init=function(){e.forEach(function(n){n.indexOf("channel-options-")>-1||n.indexOf("aggs")>-1||(u(n),"object"===i(s[n])?p["default"].isEqual(s[n],t[n])||l(e,n):s[n]!==t[n]&&l(e,n))})},this.start=function(){var t=this;this.sensorListener=f.addListener("sensorChange",function(n){var r=!1;Object.keys(n).forEach(function(t){t.indexOf("channel-options-")<0&&e.indexOf(t)>-1&&(r=!0)}),r&&(s=n,t.init())}),this.paginationListener=f.addListener("paginationChange",function(t){o&&e.indexOf(t.key)>-1&&o(t.value,r)}),this.sortListener=f.addListener("sortChange",function(){a&&a(r)})},this.stop=function(){this.sensorListener&&this.sensorListener.remove(),this.paginationListener&&this.paginationListener.remove(),this.sortListener&&this.sortListener.remove()}},t.selectedSensor=new a,function(){var e=["and","or","not"];this.serialize=function(t){function n(e){function t(e){u.indexOf(e)<0&&u.push(e)}"string"==typeof e?t(e):e.forEach(function(e){t(e)})}function r(t,r){return Object.keys(t).forEach(function(o){l+=1;var i=a(o,r,t[o],l);s.push(i),e.indexOf(o)<0&&n(o)}),s}function o(e,t){l+=1;var o={parentId:t,componentId:l,leaf:!1,components:null};return"[object Array]"===Object.prototype.toString.call(e)?(o.components=e,o.leaf=!0,n(e)):"string"==typeof e?(o.components=e,o.leaf=!0,n(e)):r(e,t),o}function a(t,n,r,a){var i=!0;if(e.indexOf(t)>-1){var u=o(r,a);i=!1,s.push(u)}return{parentId:n,componentId:a,conjunction:t,components:t,leaf:i}}function i(){return s=r(t,0),{queries:s,dependsList:u}}var s=[],u=[],l=0;return i()},this.createQuery=function(t,n){function r(e){var t=[],r=null,o=d.filter(function(t){return t.componentId===e.parentId});"[object Array]"===Object.prototype.toString.call(e.components)?e.components.forEach(function(e){n[e]&&(r?r.push(n[e]):(r=[],r.push(n[e])))}):"string"==typeof e.components&&n[e.components]&&(r=n[e.components]),t=o&&o.length?o[0].query?p(o[0].query,o[0].conjunction,r):c(o[0].conjunction,r):r,t&&(d=d.map(function(n){return o.length&&n.componentId===o[0].componentId?n.query=t:0===e.parentId&&n.componentId===e.componentId&&(n.query=t),n}))}function a(e){var t=d.filter(function(t){return!t.checked&&t.parentId===e}),n=!t.length;return n}function i(){var e={},t=null;d.forEach(function(n){0===n.parentId&&("aggs"!==n.conjunction?e=Object.assign(e,n.query):"aggs"===n.conjunction&&(t=n.query))});var n=null;return e&&Object.keys(e).length&&(n={body:{query:{bool:e}}}),t&&(n?n.body.aggs=t:n={body:{aggs:t}}),n}function s(){var e=!1;return d.forEach(function(t){!t.checked&&a(t.componentId)&&(t.checked=!0,e=!0,r(t))}),e?s():i()}function u(){return s()}function l(e){var t=null;switch(e){case"and":t="must";break;case"or":t="should";break;case"not":t="must_not";break;default:t="must"}return t}function c(t,n){if(!n)return null;var r=n,a=l(t);return e.indexOf(t)>-1&&(r=o({},a,n)),r}function p(e,t,n){if(!n)return null;var r=l(t),a=e&&e[r]?e[r]:[];return o({},r,a.concat(n))}var d=t.queries.map(function(e){return e.checked=!1,delete e.query,e});return u()}});t.serializeDepends=new h,t.prepareResultData=function(e,t){var n={err:null,res:null};return e.error?n.err=e:(n.res={mode:e.mode,newData:e.newData,currentData:e.currentData,appliedQuery:e.appliedQuery},t&&(n.res.took=t.took?t.took:0,n.res.total=t.hits&&t.hits.total?t.hits.total:0)),n},t.combineStreamData=function(e,t){if(t)if(t._deleted){var n=e.filter(function(e){return e._id!==t._id});e=n}else{var r=e.filter(function(e){return e._id!==t._id});e=r,e.unshift(t)}return e},t.updateStats=function(e,t){return t&&(t._deleted?e-=1:t._updated||(e+=1)),e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(69);t.ResponsiveStory=function(){var e=function(e){return e.height()?e.height():0},t=function(){var t=r(window).height(),n=t-15;r(".rbc.rbc-reactivelist, .rbc.rbc-reactiveelement").css({maxHeight:n});var o=[r(".rbc.rbc-singlelist"),r(".rbc.rbc-multilist"),r(".rbc.rbc-nestedlist"),r(".rbc.rbc-tagcloud")];o.forEach(function(n){if(n.length){var r=e(n.find(".rbc-title"))+e(n.find(".rbc-search-container"));n.find(".rbc-list-container").css({maxHeight:t-r-35})}}),r(".rbc-base > .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(1>e[t]||e[t]>1e3)&&(n=Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]>0||(n=Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start>0||(r=Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return(isNaN(e[t])||e.defaultSelected>r||o>e.defaultSelected)&&(n=Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return 0>e[t]&&(n=Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){var r,o;!function(t,n){"use strict";"object"==typeof e&&"object"==typeof e.exports?e.exports=t.document?n(t,!0):function(e){if(!e.document)throw Error("jQuery requires a window with a document");return n(e)}:n(t)}("undefined"!=typeof window?window:this,function(n,a){"use strict";function i(e,t){t=t||ie;var n=t.createElement("script");n.text=e,t.head.appendChild(n).parentNode.removeChild(n)}function s(e){var t=!!e&&"length"in e&&e.length,n=ge.type(e);return"function"!==n&&!ge.isWindow(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function u(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}function l(e,t,n){return ge.isFunction(t)?ge.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?ge.grep(e,function(e){return e===t!==n}):"string"!=typeof t?ge.grep(e,function(e){return pe.call(t,e)>-1!==n}):Oe.test(t)?ge.filter(t,e,n):(t=ge.filter(t,e),ge.grep(e,function(e){return pe.call(t,e)>-1!==n&&1===e.nodeType; +e=this.props.multipleSelect?c["default"].createElement(h["default"],{items:this.state.items,onSelect:this.handleSelect,onRemove:this.handleRemove,showCount:this.props.showCount,selectAll:this.selectAll,showCheckbox:this.props.showCheckbox,defaultSelected:this.defaultSelected,selectAllLabel:this.props.selectAllLabel,selectAllValue:this.state.selectAll}):c["default"].createElement(y["default"],{items:this.state.items,onSelect:this.handleSelect,onRemove:this.handleRemove,showCount:this.props.showCount,showRadio:this.props.showRadio,defaultSelected:this.defaultSelected,selectAllLabel:this.props.selectAllLabel,selectAll:this.selectAll}),this.props.showSearch&&(t=c["default"].createElement(g.StaticSearch,{placeholder:this.props.placeholder,changeCallback:this.filterBySearch})),this.props.title&&(n=c["default"].createElement("h4",{className:"rbc-title col s12 col-xs-12"},this.props.title));var r=(0,d["default"])({"rbc-search-active":this.props.showSearch,"rbc-search-inactive":!this.props.showSearch,"rbc-title-active":this.props.title,"rbc-title-inactive":!this.props.title,"rbc-placeholder-active":this.props.placeholder,"rbc-placeholder-inactive":!this.props.placeholder,"rbc-singlelist":!this.props.multipleSelect,"rbc-multilist":this.props.multipleSelect,"rbc-initialloader-active":this.props.initialLoader,"rbc-initialloader-inactive":!this.props.initialLoader});return c["default"].createElement("div",{className:"rbc col s12 col-xs-12 card thumbnail "+r,style:this.props.componentStyle},n,t,e,this.props.initialLoader&&this.state.queryStart?c["default"].createElement(T["default"],{defaultText:this.props.initialLoader}):null)}}]),t}(l.Component);t["default"]=w,w.propTypes={appbaseField:c["default"].PropTypes.string.isRequired,componentId:c["default"].PropTypes.string.isRequired,title:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),size:M.sizeValidation,showCount:c["default"].PropTypes.bool,multipleSelect:c["default"].PropTypes.bool,sortBy:c["default"].PropTypes.oneOf(["asc","desc","count"]),showSearch:c["default"].PropTypes.bool,placeholder:c["default"].PropTypes.string,selectAllLabel:c["default"].PropTypes.string,customQuery:c["default"].PropTypes.func,initialLoader:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.element]),defaultSelected:c["default"].PropTypes.oneOfType([c["default"].PropTypes.string,c["default"].PropTypes.number,c["default"].PropTypes.array]),react:c["default"].PropTypes.object,onValueChange:c["default"].PropTypes.func,componentStyle:c["default"].PropTypes.object,showRadio:c["default"].PropTypes.bool,showCheckbox:c["default"].PropTypes.bool,URLParams:c["default"].PropTypes.bool},w.defaultProps={showCount:!0,multipleSelect:!0,sortBy:"count",size:100,showSearch:!1,title:null,placeholder:"Search",selectAllLabel:null,componentStyle:{},showRadio:!0,showCheckbox:!0,URLParams:!1},w.contextTypes={appbaseRef:c["default"].PropTypes.any.isRequired,type:c["default"].PropTypes.any.isRequired}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),l=r(u),c=n(62),p=r(c),d=n(63),f=r(d),h=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={selectedItems:[]},n.refStore={},n.handleListClick=n.handleListClick.bind(n),n.handleTagClick=n.handleTagClick.bind(n),n.handleListClickAll=n.handleListClickAll.bind(n),n.clearAll=n.clearAll.bind(n),n}return i(t,e),s(t,[{key:"componentDidMount",value:function(){this.props.defaultSelected&&this.defaultUpdate()}},{key:"defaultUpdate",value:function(){var e=this,t=this.props.defaultSelected.indexOf(this.props.selectAllLabel)>-1;t?this.setDefaultSelectAll():this.setState({selectedItems:this.props.defaultSelected,defaultSelectall:this.props.defaultSelectall},function(){e.updateAction.bind(e),e.props.onSelect(e.state.selectedItems)})}},{key:"setDefaultSelectAll",value:function(){this.props.items&&this.props.items.length?setTimeout(this.handleListClickAll.bind(this,this.props.selectAllLabel,!0),1e3):setTimeout(this.setDefaultSelectAll.bind(this),1e3)}},{key:"componentDidUpdate",value:function(){var e=this,t=null,n=!0;this.state.selectedItems&&(t=JSON.parse(JSON.stringify(this.state.selectedItems))),t&&t.length&&this.props.items&&this.props.items.length&&(t=t.filter(function(t){var n=e.props.items.filter(function(e){return e.key===t});return!!n.length}),t.length!==this.state.selectedItems.length&&(n=!t.length,this.props.onRemove(this.state.selectedItems,n),this.updateSelectedItems(t),t.length&&this.props.onSelect(t)))}},{key:"handleListClick",value:function(e,t){var n=void 0;t?(this.props.onRemove(this.state.selectedItems,!1),n=this.state.selectedItems,n.push(e),this.setState({selectedItems:n},this.updateAction.bind(this)),this.state.selectedItems.length&&this.props.onSelect(this.state.selectedItems)):this.handleTagClick(e)}},{key:"handleTagClick",value:function(e){var t=1===this.state.selectedItems.length;this.props.onRemove(this.state.selectedItems,t);var n=(""+e).replace(/ /g,"_"),r="ref"+n,o=this.refStore[r];o.state.status=!1;var a=this.state.selectedItems,i=a.indexOf(e);a.splice(i,1),this.setState({selectedItems:a},this.updateAction.bind(this)),this.props.onSelect(a)}},{key:"clearAll",value:function(){this.handleListClickAll(this.props.selectAllLabel,!1)}},{key:"getSelectedItems",value:function(){var e=[];return this.props.items.forEach(function(t){t.status&&e.indexOf(t.key)<0&&e.push(t.key)}),e}},{key:"handleListClickAll",value:function(e,t){var n=this;this.props.selectAll(t);var r=this.props.items.map(function(e){return e.key});r=t?r:[],this.setState({defaultSelectall:t,selectedItems:r},function(){n.updateAction.bind(n),n.props.onSelect(n.state.selectedItems,r)})}},{key:"updateSelectedItems",value:function(e){this.setState({selectedItems:e})}},{key:"updateAction",value:function(){this.state.selectedItems.length||this.props.onSelect(null)}},{key:"render",value:function(){var e=this,t=this.props.items,n=this.getSelectedItems(),r=[],o=[];return t.forEach(function(t,n){try{t.keyRef=t.key.replace(/ /g,"_")}catch(o){t.keyRef=n}var a=!("visible"in t)||!!t.visible;r.push(l["default"].createElement(p["default"],{key:t.keyRef,value:t.key,doc_count:t.doc_count,countField:e.props.showCount,handleClick:e.handleListClick,visible:a,showCheckbox:e.props.showCheckbox,status:t.status||!1,ref:function(n){var r="ref"+t.keyRef;e.refStore[r]=n}}))}),this.props.selectAllLabel&&t&&t.length&&r.unshift(l["default"].createElement(p["default"],{key:"selectall",value:this.props.selectAllLabel,countField:!1,visible:!0,showCheckbox:this.props.showCheckbox,handleClick:this.handleListClickAll,status:this.props.selectAllValue,ref:function(t){e.refStore.refselectall=t}})),this.props.showTags&&n&&(n.length>5?o.unshift(l["default"].createElement(f["default"],{key:"Clear All",value:"Clear All",onClick:this.clearAll})):n.forEach(function(t){o.push(l["default"].createElement(f["default"],{key:t,value:t,onClick:e.handleTagClick}))})),l["default"].createElement("div",{className:"rbc-list-container col s12 col-xs-12"},o.length?l["default"].createElement("div",{className:"row rbc-tag-container"},o):null,l["default"].createElement("div",{className:"row"},r))}}]),t}(u.Component);t["default"]=h,h.propTypes={defaultSelected:l["default"].PropTypes.array,items:l["default"].PropTypes.array,onRemove:l["default"].PropTypes.func,onSelect:l["default"].PropTypes.func,selectAll:l["default"].PropTypes.func,selectAllLabel:l["default"].PropTypes.string,selectAllValue:l["default"].PropTypes.bool,showCount:l["default"].PropTypes.bool,showTags:l["default"].PropTypes.bool,defaultSelectall:l["default"].PropTypes.bool},h.defaultProps={showTags:!0}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),l=r(u),c=n(57),p=r(c),d=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={initialStatus:n.props.status,status:n.props.status||!1},n.handleCheckboxChange=n.handleCheckboxChange.bind(n),n}return i(t,e),s(t,[{key:"componentDidUpdate",value:function(){this.props.status!==this.state.initialStatus&&this.setState({status:this.props.status,initialStatus:this.props.status})}},{key:"handleClick",value:function(){this.setState({status:!this.state.status}),this.props.handleClick(this.props.value,!this.state.status)}},{key:"handleCheckboxChange",value:function(e){this.setState({status:e.target.checked})}},{key:"render",value:function(){var e=void 0;this.props.countField&&(e=l["default"].createElement("span",{className:"rbc-count"}," ",this.props.doc_count," "));var t=(0,p["default"])({"rbc-count-active":this.props.countField,"rbc-count-inactive":!this.props.countField,"rbc-checkbox-active":this.props.showCheckbox,"rbc-checkbox-inactive":!this.props.showCheckbox,"rbc-list-item-active":this.state.status,"rbc-list-item-inactive":!this.state.status});return l["default"].createElement("div",{onClick:this.handleClick.bind(this),className:"rbc-list-item row "+t},l["default"].createElement("input",{type:"checkbox",className:"rbc-checkbox-item",checked:this.state.status,onChange:this.handleCheckboxChange}),l["default"].createElement("label",{className:"rbc-label"},this.props.value," ",e))}}]),t}(u.Component);t["default"]=d,d.propTypes={status:l["default"].PropTypes.bool,handleClick:l["default"].PropTypes.func,value:l["default"].PropTypes.string,countField:l["default"].PropTypes.bool,doc_count:l["default"].PropTypes.number}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e){return i["default"].createElement("span",{onClick:function(){return e.onClick(e.value)},className:"rbc-tag-item col"},i["default"].createElement("a",{href:"javascript:void(0)",className:"close"},"×"),i["default"].createElement("span",null,e.value))}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=o;var a=n(4),i=r(a)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(4),l=r(u),c=n(57),p=r(c),d=function(e){function t(e){o(this,t);var n=a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.state={selectedItem:[]},n.defaultSelected=n.props.defaultSelected,n.defaultAllowed=!0,n.handleClick=n.handleClick.bind(n),n.handleListClickAll=n.handleListClickAll.bind(n),n}return i(t,e),s(t,[{key:"componentWillUpdate",value:function(){this.defaultSelected!=this.props.defaultSelected&&(this.defaultSelected=this.props.defaultSelected,this.defaultSelection())}},{key:"componentDidUpdate",value:function(){this.props.items.length&&this.defaultAllowed&&(this.defaultAllowed=!1,this.defaultSelection())}},{key:"defaultSelection",value:function(){this.props.defaultSelected&&(this.props.defaultSelected===this.props.selectAllLabel?this.handleListClickAll(this.props.selectAllLabel):this.handleClick(this.props.defaultSelected))}},{key:"handleListClickAll",value:function(e){var t=this,n=this.props.items.map(function(e){return e.key});this.props.selectAll(e,n),this.setState({selectedItem:e},function(){t.props.onSelect(n,e)})}},{key:"handleClick",value:function(e){this.props.onRemove(this.state.selectedItem),this.props.onSelect(e),this.setState({selectedItem:e})}},{key:"renderItemsComponent",value:function(){var e=this,t=this.props.items,n=[];return t.forEach(function(t){var r=!t.hasOwnProperty("visible")||!!t.visible;n.push(l["default"].createElement(f,{key:t.key,value:t.key,doc_count:t.doc_count,countField:e.props.showCount,handleClick:e.handleClick,visible:r,showRadio:e.props.showRadio,selectedItem:e.state.selectedItem}))}),this.props.selectAllLabel&&t&&t.length&&n.unshift(l["default"].createElement(f,{key:"selectall",visible:!0,value:this.props.selectAllLabel,countField:!1,showRadio:this.props.showRadio,handleClick:this.handleListClickAll,selectedItem:this.state.selectedItem,ref:"refselectall"})),n}},{key:"render",value:function(){return l["default"].createElement("div",{className:"rbc-list-container col s12 col-xs-12"},this.renderItemsComponent())}}]),t}(u.Component);t["default"]=d;var f=function(e){function t(e){return o(this,t),a(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e))}return i(t,e),s(t,[{key:"renderItem",value:function(){var e=void 0;this.props.countField&&(e=l["default"].createElement("span",{className:"rbc-count"}," (",this.props.doc_count,") "));var t=l["default"].createElement("a",{href:"javascript:void(0)",className:"col s12 col-xs-12"},l["default"].createElement("span",null," ",this.props.value," "),e);return this.props.value===this.props.selectedItem&&(t=l["default"].createElement("a",{href:"javascript:void(0)",className:"col s12 col-xs-12"},l["default"].createElement("strong",null,l["default"].createElement("span",null," ",this.props.value," "),e))),t}},{key:"renderCount",value:function(){var e=void 0;return this.props.countField&&(e=l["default"].createElement("span",{className:"rbc-count"}," ",this.props.doc_count," ")),e}},{key:"render",value:function(){var e=this,t=(0,p["default"])({"rbc-count-active":this.props.countField,"rbc-count-inactive":!this.props.countField,"rbc-item-show":this.props.visible,"rbc-item-hide":!this.props.visible,"rbc-radio-active":this.props.showRadio,"rbc-radio-inactive":!this.props.showRadio,"rbc-list-item-active":this.props.value===this.props.selectedItem,"rbc-list-item-inactive":this.props.value!==this.props.selectedItem});return l["default"].createElement("div",{className:"rbc-list-item row "+t,onClick:function(){return e.props.handleClick(e.props.value)}},l["default"].createElement("input",{type:"radio",className:"rbc-radio-item",checked:this.props.value===this.props.selectedItem,value:this.props.value}),l["default"].createElement("label",{className:"rbc-label"},this.props.value," ",this.renderCount()))}}]),t}(u.Component)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(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}function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;t.length>n;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=n(66),l=o(u),c=n(74),p=n(71),d=r(p),f=n(67),h=function(){function e(){i(this,e),this.emitter=new c.EventEmitter,this.channels={},this.streamRef={},this.queryOptions={},this.appbaseRef={},this.type={},this.app={},this.receive=this.receive.bind(this),this.nextPage=this.nextPage.bind(this),this.paginationChanges=this.paginationChanges.bind(this),this.sortChanges=this.sortChanges.bind(this)}return s(e,[{key:"highlightModify",value:function(e,t){return t&&t.body&&t.body.highlight&&e&&e.hits&&e.hits.hits&&e.hits.hits.length&&(e.hits.hits=e.hits.hits.map(this.highlightItem)),e}},{key:"highlightItem",value:function(e){return e.highlight&&Object.keys(e.highlight).forEach(function(t){var n=e.highlight[t][0];d["default"].set(e._source,t,n)}),e}},{key:"receive",value:function(e,t){function n(e){var n=JSON.parse(JSON.stringify(e));n.queryState=!0,i.emitter.emit(t+"-query",n)}function r(e,t,n){var r=this;this.streamRef[e]&&this.streamRef[e].stop();var o=JSON.parse(JSON.stringify(t));o.type=this.type[e],o.body&&(delete o.body.from,delete o.body.size,delete o.body.sort),this.streamRef[e]=n.searchStream(o).on("data",function(n){n=r.highlightItem(n,t);var o={mode:"streaming",data:n,appliedQuery:t};i.emitter.emit(e,o)}).on("error",function(e){console.log(e)})}var o=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=this,s=this.channels[t],u=void 0;a?u=l.queryBuild(s,a):(u=l.queryBuild(s,s.previousSelectedSensor),this.queryOptions[t]=s.previousSelectedSensor["channel-options-"+t]);var c=!0;try{c=!(!u||!Object.keys(u).length)}catch(p){console.log(p)}if(c)!function(){var e={startTime:(new Date).getTime(),appliedQuery:u},a=o.appbaseRef[t];if(a){var l=u;l.type="*"===o.type[t]?"":o.type[t],l.preference=o.app[t],n(e),a.search(l).on("data",function(n){e.mode="historic",e.data=o.highlightModify(n,e.appliedQuery),i.emitter.emit(t,e);var r=i.queryOptions&&i.queryOptions[t]?i.queryOptions[t]:{};i.emitter.emit("global",{channelResponse:e,react:s.react,queryOptions:r})}).on("error",function(n){var r={appliedQuery:e.appliedQuery,error:n,startTime:e.startTime};i.emitter.emit(t,r)}),s.stream&&r.call(o,t,u,a)}else console.error("appbaseRef is not set for "+t)}();else{var d={mode:"historic",startTime:(new Date).getTime(),appliedQuery:u,data:{_shards:{},hits:{hits:[]}}};i.emitter.emit(t,d)}}},{key:"stopStream",value:function(e){this.streamRef[e]&&this.streamRef[e].stop(),this.channels[e]&&this.channels[e].watchDependency&&(this.channels[e].watchDependency.stop(),delete this.channels[e])}},{key:"nextPage",value:function(e){var t=JSON.parse(JSON.stringify(this.channels[e].previousSelectedSensor)),n={size:this.queryOptions[e].size,from:this.queryOptions[e].from+this.queryOptions[e].size};t["channel-options-"+e]=JSON.parse(JSON.stringify(n)),this.queryOptions[e]=n,this.receive("channel-options-"+e,e,t)}},{key:"paginationChanges",value:function(e,t){var n=JSON.parse(JSON.stringify(this.channels[t].previousSelectedSensor)),r={size:this.queryOptions[t].size,from:this.getFrom(e,t)};n["channel-options-"+t]=JSON.parse(JSON.stringify(r)),this.queryOptions[t]=r,this.receive("channel-options-"+t,t,n)}},{key:"getFrom",value:function(e,t){return 1!==e?this.queryOptions[t].size*(e-1)+1:0}},{key:"sortChanges",value:function(e){this.receive("channel-options-"+e,e)}},{key:"create",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:100,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,i=this,s=arguments.length>5&&void 0!==arguments[5]&&arguments[5],u=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"reactivebase",l=btoa(JSON.stringify(n)),c={size:r,from:o};this.queryOptions[l]=c,this.type[l]=t,this.app[l]=u,this.appbaseRef[l]=e,n["channel-options-"+l]=c;var p=a({},"channel-options-"+l,c),d={key:"channel-options-"+l,value:c},h=f.serializeDepends.serialize(n);return f.selectedSensor.set(d),l in this.channels&&s===this.channels[l].stream||(this.channels[l]={react:n,size:r,from:o,stream:s,previousSelectedSensor:p,serializeDepends:h,watchDependency:new f.WatchForDependencyChange(h.dependsList,p,this.receive,l,this.paginationChanges,this.sortChanges)},this.channels[l].watchDependency.start()),setTimeout(function(){"aggs"in n&&i.receive("aggs",l)},100),{channelId:l,emitter:this.emitter}}}]),e}(),m=new h;t["default"]=m},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}Object.defineProperty(t,"__esModule",{value:!0});var o=n(67);t.queryBuild=function(e,t){function n(e){var t=o.selectedSensor.get(e,"sortInfo");return t}function a(e){var t=null,n=o.selectedSensor.get(e,"sensorInfo");return n&&n.externalQuery&&(t=n.externalQuery),t}function i(e){var n=o.selectedSensor.get(e,"sensorInfo"),r=null;if(n&&n.customQuery){var a=e in t?t[e]:o.selectedSensor.get(e);r=n.customQuery(a)}else t[e]&&(r={},r[n.queryType]={},"match_all"!==n.queryType&&(r[n.queryType][n.inputData]=t[e]));return r}function s(t){var o=e.react[t],a=void 0,i=void 0,s=void 0;if(o.customQuery)s=o.customQuery(o);else{if(o.sortRef){var u=n(o.sortRef);u&&u.aggSort&&(o.sort=u.aggSort)}"count"===o.sort?(a="desc",i="_count"):"asc"!==o.sort&&"desc"!==o.sort||(a=o.sort,i="_term"),s=r({},o.key,{terms:{field:o.key}}),o.size&&(s[o.key].terms.size=o.size),o.sort&&(s[o.key].terms.order=r({},i,a))}return s}function u(){var r={};return e.serializeDepends.dependsList.forEach(function(e){if("aggs"===e)r[e]=s(e);else if(e&&e.indexOf("channel-options-")>-1)d=d||{},d=Object.assign(d,t[e]);else{r[e]=i(e);var o=a(e);o&&(d=d||{},d=Object.assign(d,o))}var u=n(e);!u||"aggSort"in u||p.push(u)}),r}function l(t){var n=o.serializeDepends.createQuery(e.serializeDepends,t);return n&&n.body?(p&&p.length&&(n.body.sort=p),d&&Object.keys(d).length&&Object.keys(d).forEach(function(e){n.body[e]=d[e]})):n={},n}function c(){var e=u(),t=l(e);return t}var p=[],d=null;return c()}},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(){var e=this;this.sensorInfo={},this.selectedSensor={},this.paginationInfo={},this.selectedPagination={},this.sortInfo={},this.selectedSort={};var t=function(t,n){return n?e[n][t]:t?e.selectedSensor[t]:e.selectedSensor},n=function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"sensorChange",o=void 0;switch(r){case"sortChange":e.sortInfo[t.key]=t.value,o=e.sortInfo;break;case"paginationChange":e.selectedPagination[t.key]=t.value,o=t;break;case"sensorChange":default:e.selectedSensor[t.key]=t.value,o=e.selectedSensor}n&&f.emit(r,o)},r=function(t){e.sensorInfo[t.key]=t.value},o=function(t){e.sortInfo[t.key]=t.value},a=function(t){e.paginationInfo[t.key]=t.value};return{get:t,set:n,setSensorInfo:r,setSortInfo:o,setPaginationInfo:a}}Object.defineProperty(t,"__esModule",{value:!0}),t.updateStats=t.combineStreamData=t.prepareResultData=t.serializeDepends=t.selectedSensor=t.WatchForDependencyChange=t.sensorEmitter=void 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},s=n(68);Object.keys(s).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return s[e]}})});var u=n(70);Object.keys(u).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return u[e]}})});var l=n(74),c=n(71),p=r(c),d=0,f=t.sensorEmitter=new l.EventEmitter,h=(t.WatchForDependencyChange=function(e,t,n,r,o,a){d+=1,this.random=d;var s={},u=function(e){Object.prototype.hasOwnProperty.call(t,e)||(t[e]="")},l=function(e,o){t[o]=s[o]&&"object"===i(s[o])?JSON.parse(JSON.stringify(s[o])):s[o],n(o,r)};this.init=function(){e.forEach(function(n){n.indexOf("channel-options-")>-1||n.indexOf("aggs")>-1||(u(n),"object"===i(s[n])?p["default"].isEqual(s[n],t[n])||l(e,n):s[n]!==t[n]&&l(e,n))})},this.start=function(){var t=this;this.sensorListener=f.addListener("sensorChange",function(n){var r=!1;Object.keys(n).forEach(function(t){t.indexOf("channel-options-")<0&&e.indexOf(t)>-1&&(r=!0)}),r&&(s=n,t.init())}),this.paginationListener=f.addListener("paginationChange",function(t){o&&e.indexOf(t.key)>-1&&o(t.value,r)}),this.sortListener=f.addListener("sortChange",function(){a&&a(r)})},this.stop=function(){this.sensorListener&&this.sensorListener.remove(),this.paginationListener&&this.paginationListener.remove(),this.sortListener&&this.sortListener.remove()}},t.selectedSensor=new a,function(){var e=["and","or","not"];this.serialize=function(t){function n(e){function t(e){u.indexOf(e)<0&&u.push(e)}"string"==typeof e?t(e):e.forEach(function(e){t(e)})}function r(t,r){return Object.keys(t).forEach(function(o){l+=1;var i=a(o,r,t[o],l);s.push(i),e.indexOf(o)<0&&n(o)}),s}function o(e,t){l+=1;var o={parentId:t,componentId:l,leaf:!1,components:null};return"[object Array]"===Object.prototype.toString.call(e)?(o.components=e,o.leaf=!0,n(e)):"string"==typeof e?(o.components=e,o.leaf=!0,n(e)):r(e,t),o}function a(t,n,r,a){var i=!0;if(e.indexOf(t)>-1){var u=o(r,a);i=!1,s.push(u)}return{parentId:n,componentId:a,conjunction:t,components:t,leaf:i}}function i(){return s=r(t,0),{queries:s,dependsList:u}}var s=[],u=[],l=0;return i()},this.createQuery=function(t,n){function r(e){var t=[],r=null,o=d.filter(function(t){return t.componentId===e.parentId});"[object Array]"===Object.prototype.toString.call(e.components)?e.components.forEach(function(e){n[e]&&(r?r.push(n[e]):(r=[],r.push(n[e])))}):"string"==typeof e.components&&n[e.components]&&(r=n[e.components]),t=o&&o.length?o[0].query?p(o[0].query,o[0].conjunction,r):c(o[0].conjunction,r):r,t&&(d=d.map(function(n){return o.length&&n.componentId===o[0].componentId?n.query=t:0===e.parentId&&n.componentId===e.componentId&&(n.query=t),n}))}function a(e){var t=d.filter(function(t){return!t.checked&&t.parentId===e}),n=!t.length;return n}function i(){var e={},t=null;d.forEach(function(n){0===n.parentId&&("aggs"!==n.conjunction?e=Object.assign(e,n.query):"aggs"===n.conjunction&&(t=n.query))});var n=null;return e&&Object.keys(e).length&&(n={body:{query:{bool:e}}}),t&&(n?n.body.aggs=t:n={body:{aggs:t}}),n}function s(){var e=!1;return d.forEach(function(t){!t.checked&&a(t.componentId)&&(t.checked=!0,e=!0,r(t))}),e?s():i()}function u(){return s()}function l(e){var t=null;switch(e){case"and":t="must";break;case"or":t="should";break;case"not":t="must_not";break;default:t="must"}return t}function c(t,n){if(!n)return null;var r=n,a=l(t);return e.indexOf(t)>-1&&(r=o({},a,n)),r}function p(e,t,n){if(!n)return null;var r=l(t),a=e&&e[r]?e[r]:[];return o({},r,a.concat(n))}var d=t.queries.map(function(e){return e.checked=!1,delete e.query,e});return u()}});t.serializeDepends=new h,t.prepareResultData=function(e,t){var n={err:null,res:null};return e.error?n.err=e:(n.res={mode:e.mode,newData:e.newData,currentData:e.currentData,appliedQuery:e.appliedQuery},t&&(n.res.took=t.took?t.took:0,n.res.total=t.hits&&t.hits.total?t.hits.total:0)),n},t.combineStreamData=function(e,t){if(t)if(t._deleted){var n=e.filter(function(e){return e._id!==t._id});e=n}else{var r=e.filter(function(e){return e._id!==t._id});e=r,e.unshift(t)}return e},t.updateStats=function(e,t){return t&&(t._deleted?e-=1:t._updated||(e+=1)),e}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(69);t.ResponsiveStory=function(){var e=function(e){return e.height()?e.height():0},t=function(){var t=r(window).height(),n=t-15;r(".rbc.rbc-reactivelist, .rbc.rbc-reactiveelement").css({maxHeight:n});var o=[r(".rbc.rbc-singlelist"),r(".rbc.rbc-multilist"),r(".rbc.rbc-nestedlist"),r(".rbc.rbc-tagcloud")];o.forEach(function(n){if(n.length){var r=e(n.find(".rbc-title"))+e(n.find(".rbc-search-container"));n.find(".rbc-list-container").css({maxHeight:t-r-35})}}),r(".rbc-base > .row").css({"margin-bottom":0}),r(".rbc-reactivemap .rbc-container").css({maxHeight:t})};t(),r(window).resize(function(){t()})},t.sizeValidation=function(e,t){var n=null;return(1>e[t]||e[t]>1e3)&&(n=Error("Size value is invalid, it should be between 1 and 1000.")),n},t.stepValidation=function(e,t){var n=null;return e[t]>Math.floor((e.range.end-e.range.start)/2)?n=Error("Step value is invalid, it should be less than or equal to "+Math.floor((e.range.end-e.range.start)/2)+"."):e[t]>0||(n=Error("Step value is invalid, it should be greater than 0.")),n},t.validateThreshold=function(e,t,n){var r=null;return!isNaN(e[t])&&e.end>e.start||(r=Error("Threshold value validation has failed, end value should be greater than start value.")),"GeoDistanceDropdown"!==n&&"GeoDistanceSlider"!==n||e.start>0||(r=Error("Threshold value is invalid, it should be greater than 0.")),r},t.valueValidation=function(e,t){var n=null,r=e.data.end?e.data.end:e.defaultSelected,o=e.data.start?e.data.start:e.defaultSelected;return(isNaN(e[t])||e.defaultSelected>r||o>e.defaultSelected)&&(n=Error("Default value validation has failed, Default value should be between start and end values.")),n},t.validation={resultListFrom:function(e,t){var n=null;return 0>e[t]&&(n=Error("From value is invalid, it should be greater than or equal to 0.")),n}},t.reactiveBaseValidation=function(e,t){var n=null;return e.credentials||(n=Error("ReactiveBase expects credentials as a prop instead of username:password.")),n},t.dateFormat={epoch_millis:"x",epoch_seconds:"X",date:"YYYY-MM-DD",date_time:"YYYY-MM-DDTHH:mm:ss.SSSZZ",date_time_no_millis:"YYYY-MM-DDTHH:mm:ssZZ",basic_date:"YYYYMMDD",basic_date_time:"YYYYMMDDTHHmmss.SSSZ",basic_date_time_no_millis:"YYYYMMDDTHHmmssZ",basic_time:"HHmmss.SSSZ",basic_time_no_millis:"HHmmssZ"}},function(e,t,n){var r,o;!function(t,n){"use strict";"object"==typeof e&&"object"==typeof e.exports?e.exports=t.document?n(t,!0):function(e){if(!e.document)throw Error("jQuery requires a window with a document");return n(e)}:n(t)}("undefined"!=typeof window?window:this,function(n,a){"use strict";function i(e,t){t=t||ie;var n=t.createElement("script");n.text=e,t.head.appendChild(n).parentNode.removeChild(n)}function s(e){var t=!!e&&"length"in e&&e.length,n=ge.type(e);return"function"!==n&&!ge.isWindow(e)&&("array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e)}function u(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}function l(e,t,n){return ge.isFunction(t)?ge.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?ge.grep(e,function(e){return e===t!==n}):"string"!=typeof t?ge.grep(e,function(e){return pe.call(t,e)>-1!==n}):Oe.test(t)?ge.filter(t,e,n):(t=ge.filter(t,e),ge.grep(e,function(e){return pe.call(t,e)>-1!==n&&1===e.nodeType; }))}function c(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function p(e){var t={};return ge.each(e.match(Re)||[],function(e,n){t[n]=!0}),t}function d(e){return e}function f(e){throw e}function h(e,t,n,r){var o;try{e&&ge.isFunction(o=e.promise)?o.call(e).done(t).fail(n):e&&ge.isFunction(o=e.then)?o.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}function m(){ie.removeEventListener("DOMContentLoaded",m),n.removeEventListener("load",m),ge.ready()}function y(){this.expando=ge.expando+y.uid++}function v(e){return"true"===e||"false"!==e&&("null"===e?null:e===+e+""?+e:Ve.test(e)?JSON.parse(e):e)}function _(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(qe,"-$&").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n=v(n)}catch(o){}Be.set(e,t,n)}else n=void 0;return n}function g(e,t,n,r){var o,a=1,i=20,s=r?function(){return r.cur()}:function(){return ge.css(e,t,"")},u=s(),l=n&&n[3]||(ge.cssNumber[t]?"":"px"),c=(ge.cssNumber[t]||"px"!==l&&+u)&&ze.exec(ge.css(e,t));if(c&&c[3]!==l){l=l||c[3],n=n||[],c=+u||1;do a=a||".5",c/=a,ge.style(e,t,c+l);while(a!==(a=s()/u)&&1!==a&&--i)}return n&&(c=+c||+u||0,o=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=o)),o}function b(e){var t,n=e.ownerDocument,r=e.nodeName,o=Ge[r];return o?o:(t=n.body.appendChild(n.createElement(r)),o=ge.css(t,"display"),t.parentNode.removeChild(t),"none"===o&&(o="block"),Ge[r]=o,o)}function T(e,t){for(var n,r,o=[],a=0,i=e.length;i>a;a++)r=e[a],r.style&&(n=r.style.display,t?("none"===n&&(o[a]=He.get(r,"display")||null,o[a]||(r.style.display="")),""===r.style.display&&Qe(r)&&(o[a]=b(r))):"none"!==n&&(o[a]="none",He.set(r,"display",n)));for(a=0;i>a;a++)null!=o[a]&&(e[a].style.display=o[a]);return e}function M(e,t){var n;return n=void 0!==e.getElementsByTagName?e.getElementsByTagName(t||"*"):void 0!==e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&u(e,t)?ge.merge([e],n):n}function w(e,t){for(var n=0,r=e.length;r>n;n++)He.set(e[n],"globalEval",!t||He.get(t[n],"globalEval"))}function k(e,t,n,r,o){for(var a,i,s,u,l,c,p=t.createDocumentFragment(),d=[],f=0,h=e.length;h>f;f++)if(a=e[f],a||0===a)if("object"===ge.type(a))ge.merge(d,a.nodeType?[a]:a);else if(et.test(a)){for(i=i||p.appendChild(t.createElement("div")),s=($e.exec(a)||["",""])[1].toLowerCase(),u=Xe[s]||Xe._default,i.innerHTML=u[1]+ge.htmlPrefilter(a)+u[2],c=u[0];c--;)i=i.lastChild;ge.merge(d,i.childNodes),i=p.firstChild,i.textContent=""}else d.push(t.createTextNode(a));for(p.textContent="",f=0;a=d[f++];)if(r&&ge.inArray(a,r)>-1)o&&o.push(a);else if(l=ge.contains(a.ownerDocument,a),i=M(p.appendChild(a),"script"),l&&w(i),n)for(c=0;a=i[c++];)Ze.test(a.type||"")&&n.push(a);return p}function S(){return!0}function P(){return!1}function L(){try{return ie.activeElement}catch(e){}}function D(e,t,n,r,o,a){var i,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)D(e,s,n,r,t[s],a);return e}if(null==r&&null==o?(o=n,r=n=void 0):null==o&&("string"==typeof n?(o=r,r=void 0):(o=r,r=n,n=void 0)),o===!1)o=P;else if(!o)return e;return 1===a&&(i=o,o=function(e){return ge().off(e),i.apply(this,arguments)},o.guid=i.guid||(i.guid=ge.guid++)),e.each(function(){ge.event.add(this,t,o,r,n)})}function O(e,t){return u(e,"table")&&u(11!==t.nodeType?t:t.firstChild,"tr")?ge(">tbody",e)[0]||e:e}function E(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function C(e){var t=ut.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function x(e,t){var n,r,o,a,i,s,u,l;if(1===t.nodeType){if(He.hasData(e)&&(a=He.access(e),i=He.set(t,a),l=a.events)){delete i.handle,i.events={};for(o in l)for(n=0,r=l[o].length;r>n;n++)ge.event.add(t,o,l[o][n])}Be.hasData(e)&&(s=Be.access(e),u=ge.extend({},s),Be.set(t,u))}}function j(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Ke.test(e.type)?t.checked=e.checked:"input"!==n&&"textarea"!==n||(t.defaultValue=e.defaultValue)}function Y(e,t,n,r){t=le.apply([],t);var o,a,s,u,l,c,p=0,d=e.length,f=d-1,h=t[0],m=ge.isFunction(h);if(m||d>1&&"string"==typeof h&&!ve.checkClone&&st.test(h))return e.each(function(o){var a=e.eq(o);m&&(t[0]=h.call(this,o,a.html())),Y(a,t,n,r)});if(d&&(o=k(t,e[0].ownerDocument,!1,e,r),a=o.firstChild,1===o.childNodes.length&&(o=a),a||r)){for(s=ge.map(M(o,"script"),E),u=s.length;d>p;p++)l=o,p!==f&&(l=ge.clone(l,!0,!0),u&&ge.merge(s,M(l,"script"))),n.call(e[p],l,p);if(u)for(c=s[s.length-1].ownerDocument,ge.map(s,C),p=0;u>p;p++)l=s[p],Ze.test(l.type||"")&&!He.access(l,"globalEval")&&ge.contains(c,l)&&(l.src?ge._evalUrl&&ge._evalUrl(l.src):i(l.textContent.replace(lt,""),c))}return e}function R(e,t,n){for(var r,o=t?ge.filter(t,e):e,a=0;null!=(r=o[a]);a++)n||1!==r.nodeType||ge.cleanData(M(r)),r.parentNode&&(n&&ge.contains(r.ownerDocument,r)&&w(M(r,"script")),r.parentNode.removeChild(r));return e}function A(e,t,n){var r,o,a,i,s=e.style;return n=n||dt(e),n&&(i=n.getPropertyValue(t)||n[t],""!==i||ge.contains(e.ownerDocument,e)||(i=ge.style(e,t)),!ve.pixelMarginRight()&&pt.test(i)&&ct.test(t)&&(r=s.width,o=s.minWidth,a=s.maxWidth,s.minWidth=s.maxWidth=s.width=i,i=n.width,s.width=r,s.minWidth=o,s.maxWidth=a)),void 0!==i?i+"":i}function N(e,t){return{get:function(){return e()?void delete this.get:(this.get=t).apply(this,arguments)}}}function I(e){if(e in _t)return e;for(var t=e[0].toUpperCase()+e.slice(1),n=vt.length;n--;)if(e=vt[n]+t,e in _t)return e}function F(e){var t=ge.cssProps[e];return t||(t=ge.cssProps[e]=I(e)||e),t}function H(e,t,n){var r=ze.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function B(e,t,n,r,o){var a,i=0;for(a=n===(r?"border":"content")?4:"width"===t?1:0;4>a;a+=2)"margin"===n&&(i+=ge.css(e,n+Ue[a],!0,o)),r?("content"===n&&(i-=ge.css(e,"padding"+Ue[a],!0,o)),"margin"!==n&&(i-=ge.css(e,"border"+Ue[a]+"Width",!0,o))):(i+=ge.css(e,"padding"+Ue[a],!0,o),"padding"!==n&&(i+=ge.css(e,"border"+Ue[a]+"Width",!0,o)));return i}function V(e,t,n){var r,o=dt(e),a=A(e,t,o),i="border-box"===ge.css(e,"boxSizing",!1,o);return pt.test(a)?a:(r=i&&(ve.boxSizingReliable()||a===e.style[t]),"auto"===a&&(a=e["offset"+t[0].toUpperCase()+t.slice(1)]),a=parseFloat(a)||0,a+B(e,t,n||(i?"border":"content"),r,o)+"px")}function q(e,t,n,r,o){return new q.prototype.init(e,t,n,r,o)}function W(){bt&&(ie.hidden===!1&&n.requestAnimationFrame?n.requestAnimationFrame(W):n.setTimeout(W,ge.fx.interval),ge.fx.tick())}function z(){return n.setTimeout(function(){gt=void 0}),gt=ge.now()}function U(e,t){var n,r=0,o={height:e};for(t=t?1:0;4>r;r+=2-t)n=Ue[r],o["margin"+n]=o["padding"+n]=e;return t&&(o.opacity=o.width=e),o}function Q(e,t,n){for(var r,o=(K.tweeners[t]||[]).concat(K.tweeners["*"]),a=0,i=o.length;i>a;a++)if(r=o[a].call(n,t,e))return r}function J(e,t,n){var r,o,a,i,s,u,l,c,p="width"in t||"height"in t,d=this,f={},h=e.style,m=e.nodeType&&Qe(e),y=He.get(e,"fxshow");n.queue||(i=ge._queueHooks(e,"fx"),null==i.unqueued&&(i.unqueued=0,s=i.empty.fire,i.empty.fire=function(){i.unqueued||s()}),i.unqueued++,d.always(function(){d.always(function(){i.unqueued--,ge.queue(e,"fx").length||i.empty.fire()})}));for(r in t)if(o=t[r],Tt.test(o)){if(delete t[r],a=a||"toggle"===o,o===(m?"hide":"show")){if("show"!==o||!y||void 0===y[r])continue;m=!0}f[r]=y&&y[r]||ge.style(e,r)}if(u=!ge.isEmptyObject(t),u||!ge.isEmptyObject(f)){p&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],l=y&&y.display,null==l&&(l=He.get(e,"display")),c=ge.css(e,"display"),"none"===c&&(l?c=l:(T([e],!0),l=e.style.display||l,c=ge.css(e,"display"),T([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===ge.css(e,"float")&&(u||(d.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",d.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1;for(r in f)u||(y?"hidden"in y&&(m=y.hidden):y=He.access(e,"fxshow",{display:l}),a&&(y.hidden=!m),m&&T([e],!0),d.done(function(){m||T([e]),He.remove(e,"fxshow");for(r in f)ge.style(e,r,f[r])})),u=Q(m?y[r]:0,r,d),r in y||(y[r]=u.start,m&&(u.end=u.start,u.start=0))}}function G(e,t){var n,r,o,a,i;for(n in e)if(r=ge.camelCase(n),o=t[r],a=e[n],Array.isArray(a)&&(o=a[1],a=e[n]=a[0]),n!==r&&(e[r]=a,delete e[n]),i=ge.cssHooks[r],i&&"expand"in i){a=i.expand(a),delete e[r];for(n in a)n in e||(e[n]=a[n],t[n]=o)}else t[r]=o}function K(e,t,n){var r,o,a=0,i=K.prefilters.length,s=ge.Deferred().always(function(){delete u.elem}),u=function(){if(o)return!1;for(var t=gt||z(),n=Math.max(0,l.startTime+l.duration-t),r=n/l.duration||0,a=1-r,i=0,u=l.tweens.length;u>i;i++)l.tweens[i].run(a);return s.notifyWith(e,[l,a,n]),1>a&&u?n:(u||s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l]),!1)},l=s.promise({elem:e,props:ge.extend({},t),opts:ge.extend(!0,{specialEasing:{},easing:ge.easing._default},n),originalProperties:t,originalOptions:n,startTime:gt||z(),duration:n.duration,tweens:[],createTween:function(t,n){var r=ge.Tween(e,l.opts,t,n,l.opts.specialEasing[t]||l.opts.easing);return l.tweens.push(r),r},stop:function(t){var n=0,r=t?l.tweens.length:0;if(o)return this;for(o=!0;r>n;n++)l.tweens[n].run(1);return t?(s.notifyWith(e,[l,1,0]),s.resolveWith(e,[l,t])):s.rejectWith(e,[l,t]),this}}),c=l.props;for(G(c,l.opts.specialEasing);i>a;a++)if(r=K.prefilters[a].call(l,e,c,l.opts))return ge.isFunction(r.stop)&&(ge._queueHooks(l.elem,l.opts.queue).stop=ge.proxy(r.stop,r)),r;return ge.map(c,Q,l),ge.isFunction(l.opts.start)&&l.opts.start.call(e,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),ge.fx.timer(ge.extend(u,{elem:e,anim:l,queue:l.opts.queue})),l}function $(e){var t=e.match(Re)||[];return t.join(" ")}function Z(e){return e.getAttribute&&e.getAttribute("class")||""}function X(e,t,n,r){var o;if(Array.isArray(t))ge.each(t,function(t,o){n||xt.test(e)?r(e,o):X(e+"["+("object"==typeof o&&null!=o?t:"")+"]",o,n,r)});else if(n||"object"!==ge.type(t))r(e,t);else for(o in t)X(e+"["+o+"]",t[o],n,r)}function ee(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,o=0,a=t.toLowerCase().match(Re)||[];if(ge.isFunction(n))for(;r=a[o++];)"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function te(e,t,n,r){function o(s){var u;return a[s]=!0,ge.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||i||a[l]?i?!(u=l):void 0:(t.dataTypes.unshift(l),o(l),!1)}),u}var a={},i=e===Wt;return o(t.dataTypes[0])||!a["*"]&&o("*")}function ne(e,t){var n,r,o=ge.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((o[n]?e:r||(r={}))[n]=t[n]);return r&&ge.extend(!0,e,r),e}function re(e,t,n){for(var r,o,a,i,s=e.contents,u=e.dataTypes;"*"===u[0];)u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(o in s)if(s[o]&&s[o].test(r)){u.unshift(o);break}if(u[0]in n)a=u[0];else{for(o in n){if(!u[0]||e.converters[o+" "+u[0]]){a=o;break}i||(i=o)}a=a||i}if(a)return a!==u[0]&&u.unshift(a),n[a]}function oe(e,t,n,r){var o,a,i,s,u,l={},c=e.dataTypes.slice();if(c[1])for(i in e.converters)l[i.toLowerCase()]=e.converters[i];for(a=c.shift();a;)if(e.responseFields[a]&&(n[e.responseFields[a]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=a,a=c.shift())if("*"===a)a=u;else if("*"!==u&&u!==a){if(i=l[u+" "+a]||l["* "+a],!i)for(o in l)if(s=o.split(" "),s[1]===a&&(i=l[u+" "+s[0]]||l["* "+s[0]])){i===!0?i=l[o]:l[o]!==!0&&(a=s[0],c.unshift(s[1]));break}if(i!==!0)if(i&&e["throws"])t=i(t);else try{t=i(t)}catch(p){return{state:"parsererror",error:i?p:"No conversion from "+u+" to "+a}}}return{state:"success",data:t}}var ae=[],ie=n.document,se=Object.getPrototypeOf,ue=ae.slice,le=ae.concat,ce=ae.push,pe=ae.indexOf,de={},fe=de.toString,he=de.hasOwnProperty,me=he.toString,ye=me.call(Object),ve={},_e="3.2.1",ge=function(e,t){return new ge.fn.init(e,t)},be=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,Te=/^-ms-/,Me=/-([a-z])/g,we=function(e,t){return t.toUpperCase()};ge.fn=ge.prototype={jquery:_e,constructor:ge,length:0,toArray:function(){return ue.call(this)},get:function(e){return null==e?ue.call(this):0>e?this[e+this.length]:this[e]},pushStack:function(e){var t=ge.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return ge.each(this,e)},map:function(e){return this.pushStack(ge.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(ue.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:ce,sort:ae.sort,splice:ae.splice},ge.extend=ge.fn.extend=function(){var e,t,n,r,o,a,i=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof i&&(l=i,i=arguments[s]||{},s++),"object"==typeof i||ge.isFunction(i)||(i={}),s===u&&(i=this,s--);u>s;s++)if(null!=(e=arguments[s]))for(t in e)n=i[t],r=e[t],i!==r&&(l&&r&&(ge.isPlainObject(r)||(o=Array.isArray(r)))?(o?(o=!1,a=n&&Array.isArray(n)?n:[]):a=n&&ge.isPlainObject(n)?n:{},i[t]=ge.extend(l,a,r)):void 0!==r&&(i[t]=r));return i},ge.extend({expando:"jQuery"+(_e+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw Error(e)},noop:function(){},isFunction:function(e){return"function"===ge.type(e)},isWindow:function(e){return null!=e&&e===e.window},isNumeric:function(e){var t=ge.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==fe.call(e))&&(!(t=se(e))||(n=he.call(t,"constructor")&&t.constructor,"function"==typeof n&&me.call(n)===ye))},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?de[fe.call(e)]||"object":typeof e},globalEval:function(e){i(e)},camelCase:function(e){return e.replace(Te,"ms-").replace(Me,we)},each:function(e,t){var n,r=0;if(s(e))for(n=e.length;n>r&&t.call(e[r],r,e[r])!==!1;r++);else for(r in e)if(t.call(e[r],r,e[r])===!1)break;return e},trim:function(e){return null==e?"":(e+"").replace(be,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(s(Object(e))?ge.merge(n,"string"==typeof e?[e]:e):ce.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:pe.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,o=e.length;n>r;r++)e[o++]=t[r];return e.length=o,e},grep:function(e,t,n){for(var r,o=[],a=0,i=e.length,s=!n;i>a;a++)r=!t(e[a],a),r!==s&&o.push(e[a]);return o},map:function(e,t,n){var r,o,a=0,i=[];if(s(e))for(r=e.length;r>a;a++)o=t(e[a],a,n),null!=o&&i.push(o);else for(a in e)o=t(e[a],a,n),null!=o&&i.push(o);return le.apply([],i)},guid:1,proxy:function(e,t){var n,r,o;if("string"==typeof t&&(n=e[t],t=e,e=n),ge.isFunction(e))return r=ue.call(arguments,2),o=function(){return e.apply(t||this,r.concat(ue.call(arguments)))},o.guid=e.guid=e.guid||ge.guid++,o},now:Date.now,support:ve}),"function"==typeof Symbol&&(ge.fn[Symbol.iterator]=ae[Symbol.iterator]),ge.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){de["[object "+t+"]"]=t.toLowerCase()});var ke=function(e){function t(e,t,n,r){var o,a,i,s,u,l,c,d=t&&t.ownerDocument,h=t?t.nodeType:9;if(n=n||[],"string"!=typeof e||!e||1!==h&&9!==h&&11!==h)return n;if(!r&&((t?t.ownerDocument||t:B)!==j&&x(t),t=t||j,R)){if(11!==h&&(u=ve.exec(e)))if(o=u[1]){if(9===h){if(!(i=t.getElementById(o)))return n;if(i.id===o)return n.push(i),n}else if(d&&(i=d.getElementById(o))&&F(t,i)&&i.id===o)return n.push(i),n}else{if(u[2])return Z.apply(n,t.getElementsByTagName(e)),n;if((o=u[3])&&M.getElementsByClassName&&t.getElementsByClassName)return Z.apply(n,t.getElementsByClassName(o)),n}if(M.qsa&&!U[e+" "]&&(!A||!A.test(e))){if(1!==h)d=t,c=e;else if("object"!==t.nodeName.toLowerCase()){for((s=t.getAttribute("id"))?s=s.replace(Te,Me):t.setAttribute("id",s=H),l=P(e),a=l.length;a--;)l[a]="#"+s+" "+f(l[a]);c=l.join(","),d=_e.test(e)&&p(t.parentNode)||t}if(c)try{return Z.apply(n,d.querySelectorAll(c)),n}catch(m){}finally{s===H&&t.removeAttribute("id")}}}return D(e.replace(se,"$1"),t,n,r)}function n(){function e(n,r){return t.push(n+" ")>w.cacheLength&&delete e[t.shift()],e[n+" "]=r}var t=[];return e}function r(e){return e[H]=!0,e}function o(e){var t=j.createElement("fieldset");try{return!!e(t)}catch(n){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function a(e,t){for(var n=e.split("|"),r=n.length;r--;)w.attrHandle[n[r]]=t}function i(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)for(;n=n.nextSibling;)if(n===t)return-1;return e?1:-1}function s(e){return function(t){var n=t.nodeName.toLowerCase();return"input"===n&&t.type===e}}function u(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function l(e){return function(t){return"form"in t?t.parentNode&&t.disabled===!1?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ke(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function c(e){return r(function(t){return t=+t,r(function(n,r){for(var o,a=e([],n.length,t),i=a.length;i--;)n[o=a[i]]&&(n[o]=!(r[o]=n[o]))})})}function p(e){return e&&void 0!==e.getElementsByTagName&&e}function d(){}function f(e){for(var t=0,n=e.length,r="";n>t;t++)r+=e[t].value;return r}function h(e,t,n){var r=t.dir,o=t.next,a=o||r,i=n&&"parentNode"===a,s=q++;return t.first?function(t,n,o){for(;t=t[r];)if(1===t.nodeType||i)return e(t,n,o);return!1}:function(t,n,u){var l,c,p,d=[V,s];if(u){for(;t=t[r];)if((1===t.nodeType||i)&&e(t,n,u))return!0}else for(;t=t[r];)if(1===t.nodeType||i)if(p=t[H]||(t[H]={}),c=p[t.uniqueID]||(p[t.uniqueID]={}),o&&o===t.nodeName.toLowerCase())t=t[r]||t;else{if((l=c[a])&&l[0]===V&&l[1]===s)return d[2]=l[2];if(c[a]=d,d[2]=e(t,n,u))return!0}return!1}}function m(e){return e.length>1?function(t,n,r){for(var o=e.length;o--;)if(!e[o](t,n,r))return!1;return!0}:e[0]}function y(e,n,r){for(var o=0,a=n.length;a>o;o++)t(e,n[o],r);return r}function v(e,t,n,r,o){for(var a,i=[],s=0,u=e.length,l=null!=t;u>s;s++)(a=e[s])&&(n&&!n(a,r,o)||(i.push(a),l&&t.push(s)));return i}function _(e,t,n,o,a,i){return o&&!o[H]&&(o=_(o)),a&&!a[H]&&(a=_(a,i)),r(function(r,i,s,u){var l,c,p,d=[],f=[],h=i.length,m=r||y(t||"*",s.nodeType?[s]:s,[]),_=!e||!r&&t?m:v(m,d,e,s,u),g=n?a||(r?e:h||o)?[]:i:_;if(n&&n(_,g,s,u),o)for(l=v(g,f),o(l,[],s,u),c=l.length;c--;)(p=l[c])&&(g[f[c]]=!(_[f[c]]=p));if(r){if(a||e){if(a){for(l=[],c=g.length;c--;)(p=g[c])&&l.push(_[c]=p);a(null,g=[],l,u)}for(c=g.length;c--;)(p=g[c])&&(l=a?ee(r,p):d[c])>-1&&(r[l]=!(i[l]=p))}}else g=v(g===i?g.splice(h,g.length):g),a?a(null,i,g,u):Z.apply(i,g)})}function g(e){for(var t,n,r,o=e.length,a=w.relative[e[0].type],i=a||w.relative[" "],s=a?1:0,u=h(function(e){return e===t},i,!0),l=h(function(e){return ee(t,e)>-1},i,!0),c=[function(e,n,r){var o=!a&&(r||n!==O)||((t=n).nodeType?u(e,n,r):l(e,n,r));return t=null,o}];o>s;s++)if(n=w.relative[e[s].type])c=[h(m(c),n)];else{if(n=w.filter[e[s].type].apply(null,e[s].matches),n[H]){for(r=++s;o>r&&!w.relative[e[r].type];r++);return _(s>1&&m(c),s>1&&f(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace(se,"$1"),n,r>s&&g(e.slice(s,r)),o>r&&g(e=e.slice(r)),o>r&&f(e))}c.push(n)}return m(c)}function b(e,n){var o=n.length>0,a=e.length>0,i=function(r,i,s,u,l){var c,p,d,f=0,h="0",m=r&&[],y=[],_=O,g=r||a&&w.find.TAG("*",l),b=V+=null==_?1:Math.random()||.1,T=g.length;for(l&&(O=i===j||i||l);h!==T&&null!=(c=g[h]);h++){if(a&&c){for(p=0,i||c.ownerDocument===j||(x(c),s=!R);d=e[p++];)if(d(c,i||j,s)){u.push(c);break}l&&(V=b)}o&&((c=!d&&c)&&f--,r&&m.push(c))}if(f+=h,o&&h!==f){for(p=0;d=n[p++];)d(m,y,i,s);if(r){if(f>0)for(;h--;)m[h]||y[h]||(y[h]=K.call(u));y=v(y)}Z.apply(u,y),l&&!r&&y.length>0&&f+n.length>1&&t.uniqueSort(u)}return l&&(V=b,O=_),m};return o?r(i):i}var T,M,w,k,S,P,L,D,O,E,C,x,j,Y,R,A,N,I,F,H="sizzle"+1*new Date,B=e.document,V=0,q=0,W=n(),z=n(),U=n(),Q=function(e,t){return e===t&&(C=!0),0},J={}.hasOwnProperty,G=[],K=G.pop,$=G.push,Z=G.push,X=G.slice,ee=function(e,t){for(var n=0,r=e.length;r>n;n++)if(e[n]===t)return n;return-1},te="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",ne="[\\x20\\t\\r\\n\\f]",re="(?:\\\\.|[\\w-]|[^\0-\\xa0])+",oe="\\["+ne+"*("+re+")(?:"+ne+"*([*^$|!~]?=)"+ne+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+re+"))|)"+ne+"*\\]",ae=":("+re+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+oe+")*)|.*)\\)|)",ie=RegExp(ne+"+","g"),se=RegExp("^"+ne+"+|((?:^|[^\\\\])(?:\\\\.)*)"+ne+"+$","g"),ue=RegExp("^"+ne+"*,"+ne+"*"),le=RegExp("^"+ne+"*([>+~]|"+ne+")"+ne+"*"),ce=RegExp("="+ne+"*([^\\]'\"]*?)"+ne+"*\\]","g"),pe=RegExp(ae),de=RegExp("^"+re+"$"),fe={ID:RegExp("^#("+re+")"),CLASS:RegExp("^\\.("+re+")"),TAG:RegExp("^("+re+"|[*])"),ATTR:RegExp("^"+oe),PSEUDO:RegExp("^"+ae),CHILD:RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+ne+"*(even|odd|(([+-]|)(\\d*)n|)"+ne+"*(?:([+-]|)"+ne+"*(\\d+)|))"+ne+"*\\)|)","i"),bool:RegExp("^(?:"+te+")$","i"),needsContext:RegExp("^"+ne+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+ne+"*((?:-\\d)?\\d*)"+ne+"*\\)|)(?=[^-]|$)","i")},he=/^(?:input|select|textarea|button)$/i,me=/^h\d$/i,ye=/^[^{]+\{\s*\[native \w/,ve=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,_e=/[+~]/,ge=RegExp("\\\\([\\da-f]{1,6}"+ne+"?|("+ne+")|.)","ig"),be=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:0>r?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},Te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,Me=function(e,t){return t?"\0"===e?"�":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},we=function(){x()},ke=h(function(e){return e.disabled===!0&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{Z.apply(G=X.call(B.childNodes),B.childNodes)}catch(Se){Z={apply:G.length?function(e,t){$.apply(e,X.call(t))}:function(e,t){for(var n=e.length,r=0;e[n++]=t[r++];);e.length=n-1}}}M=t.support={},S=t.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},x=t.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:B;return r!==j&&9===r.nodeType&&r.documentElement?(j=r,Y=j.documentElement,R=!S(j),B!==j&&(n=j.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",we,!1):n.attachEvent&&n.attachEvent("onunload",we)),M.attributes=o(function(e){return e.className="i",!e.getAttribute("className")}),M.getElementsByTagName=o(function(e){return e.appendChild(j.createComment("")),!e.getElementsByTagName("*").length}),M.getElementsByClassName=ye.test(j.getElementsByClassName),M.getById=o(function(e){return Y.appendChild(e).id=H,!j.getElementsByName||!j.getElementsByName(H).length}),M.getById?(w.filter.ID=function(e){var t=e.replace(ge,be);return function(e){return e.getAttribute("id")===t}},w.find.ID=function(e,t){if(void 0!==t.getElementById&&R){var n=t.getElementById(e);return n?[n]:[]}}):(w.filter.ID=function(e){var t=e.replace(ge,be);return function(e){var n=void 0!==e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},w.find.ID=function(e,t){if(void 0!==t.getElementById&&R){var n,r,o,a=t.getElementById(e);if(a){if(n=a.getAttributeNode("id"),n&&n.value===e)return[a];for(o=t.getElementsByName(e),r=0;a=o[r++];)if(n=a.getAttributeNode("id"),n&&n.value===e)return[a]}return[]}}),w.find.TAG=M.getElementsByTagName?function(e,t){return void 0!==t.getElementsByTagName?t.getElementsByTagName(e):M.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],o=0,a=t.getElementsByTagName(e);if("*"===e){for(;n=a[o++];)1===n.nodeType&&r.push(n);return r}return a},w.find.CLASS=M.getElementsByClassName&&function(e,t){if(void 0!==t.getElementsByClassName&&R)return t.getElementsByClassName(e)},N=[],A=[],(M.qsa=ye.test(j.querySelectorAll))&&(o(function(e){Y.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&A.push("[*^$]="+ne+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||A.push("\\["+ne+"*(?:value|"+te+")"),e.querySelectorAll("[id~="+H+"-]").length||A.push("~="),e.querySelectorAll(":checked").length||A.push(":checked"),e.querySelectorAll("a#"+H+"+*").length||A.push(".#.+[+~]")}),o(function(e){e.innerHTML="";var t=j.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&A.push("name"+ne+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&A.push(":enabled",":disabled"),Y.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&A.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),A.push(",.*:")})),(M.matchesSelector=ye.test(I=Y.matches||Y.webkitMatchesSelector||Y.mozMatchesSelector||Y.oMatchesSelector||Y.msMatchesSelector))&&o(function(e){M.disconnectedMatch=I.call(e,"*"),I.call(e,"[s!='']:x"),N.push("!=",ae)}),A=A.length&&RegExp(A.join("|")),N=N.length&&RegExp(N.join("|")),t=ye.test(Y.compareDocumentPosition),F=t||ye.test(Y.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)for(;t=t.parentNode;)if(t===e)return!0;return!1},Q=t?function(e,t){if(e===t)return C=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n?n:(n=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1,1&n||!M.sortDetached&&t.compareDocumentPosition(e)===n?e===j||e.ownerDocument===B&&F(B,e)?-1:t===j||t.ownerDocument===B&&F(B,t)?1:E?ee(E,e)-ee(E,t):0:4&n?-1:1)}:function(e,t){if(e===t)return C=!0,0;var n,r=0,o=e.parentNode,a=t.parentNode,s=[e],u=[t];if(!o||!a)return e===j?-1:t===j?1:o?-1:a?1:E?ee(E,e)-ee(E,t):0;if(o===a)return i(e,t);for(n=e;n=n.parentNode;)s.unshift(n);for(n=t;n=n.parentNode;)u.unshift(n);for(;s[r]===u[r];)r++;return r?i(s[r],u[r]):s[r]===B?-1:u[r]===B?1:0},j):j},t.matches=function(e,n){return t(e,null,null,n)},t.matchesSelector=function(e,n){if((e.ownerDocument||e)!==j&&x(e),n=n.replace(ce,"='$1']"),M.matchesSelector&&R&&!U[n+" "]&&(!N||!N.test(n))&&(!A||!A.test(n)))try{var r=I.call(e,n);if(r||M.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(o){}return t(n,j,null,[e]).length>0},t.contains=function(e,t){return(e.ownerDocument||e)!==j&&x(e),F(e,t)},t.attr=function(e,t){(e.ownerDocument||e)!==j&&x(e);var n=w.attrHandle[t.toLowerCase()],r=n&&J.call(w.attrHandle,t.toLowerCase())?n(e,t,!R):void 0;return void 0!==r?r:M.attributes||!R?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},t.escape=function(e){return(e+"").replace(Te,Me)},t.error=function(e){throw Error("Syntax error, unrecognized expression: "+e)},t.uniqueSort=function(e){var t,n=[],r=0,o=0;if(C=!M.detectDuplicates,E=!M.sortStable&&e.slice(0),e.sort(Q),C){for(;t=e[o++];)t===e[o]&&(r=n.push(o));for(;r--;)e.splice(n[r],1)}return E=null,e},k=t.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=k(e)}else if(3===o||4===o)return e.nodeValue}else for(;t=e[r++];)n+=k(t);return n},w=t.selectors={cacheLength:50,createPseudo:r,match:fe,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(ge,be),e[3]=(e[3]||e[4]||e[5]||"").replace(ge,be),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||t.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&t.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return fe.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&pe.test(n)&&(t=P(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(ge,be).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=W[e+" "];return t||(t=RegExp("(^|"+ne+")"+e+"("+ne+"|$)"))&&W(e,function(e){return t.test("string"==typeof e.className&&e.className||void 0!==e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,n,r){return function(o){var a=t.attr(o,e);return null==a?"!="===n:!n||(a+="","="===n?a===r:"!="===n?a!==r:"^="===n?r&&0===a.indexOf(r):"*="===n?r&&a.indexOf(r)>-1:"$="===n?r&&a.slice(-r.length)===r:"~="===n?(" "+a.replace(ie," ")+" ").indexOf(r)>-1:"|="===n&&(a===r||a.slice(0,r.length+1)===r+"-"))}},CHILD:function(e,t,n,r,o){var a="nth"!==e.slice(0,3),i="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===o?function(e){return!!e.parentNode}:function(t,n,u){var l,c,p,d,f,h,m=a!==i?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),_=!u&&!s,g=!1;if(y){if(a){for(;m;){for(d=t;d=d[m];)if(s?d.nodeName.toLowerCase()===v:1===d.nodeType)return!1;h=m="only"===e&&!h&&"nextSibling"}return!0}if(h=[i?y.firstChild:y.lastChild],i&&_){for(d=y,p=d[H]||(d[H]={}),c=p[d.uniqueID]||(p[d.uniqueID]={}),l=c[e]||[],f=l[0]===V&&l[1],g=f&&l[2],d=f&&y.childNodes[f];d=++f&&d&&d[m]||(g=f=0)||h.pop();)if(1===d.nodeType&&++g&&d===t){c[e]=[V,f,g];break}}else if(_&&(d=t,p=d[H]||(d[H]={}),c=p[d.uniqueID]||(p[d.uniqueID]={}),l=c[e]||[],f=l[0]===V&&l[1],g=f),g===!1)for(;(d=++f&&d&&d[m]||(g=f=0)||h.pop())&&((s?d.nodeName.toLowerCase()!==v:1!==d.nodeType)||!++g||(_&&(p=d[H]||(d[H]={}),c=p[d.uniqueID]||(p[d.uniqueID]={}),c[e]=[V,g]),d!==t)););return g-=o,g===r||g%r===0&&g/r>=0}}},PSEUDO:function(e,n){var o,a=w.pseudos[e]||w.setFilters[e.toLowerCase()]||t.error("unsupported pseudo: "+e);return a[H]?a(n):a.length>1?(o=[e,e,"",n],w.setFilters.hasOwnProperty(e.toLowerCase())?r(function(e,t){for(var r,o=a(e,n),i=o.length;i--;)r=ee(e,o[i]),e[r]=!(t[r]=o[i])}):function(e){return a(e,0,o)}):a}},pseudos:{not:r(function(e){var t=[],n=[],o=L(e.replace(se,"$1"));return o[H]?r(function(e,t,n,r){for(var a,i=o(e,null,r,[]),s=e.length;s--;)(a=i[s])&&(e[s]=!(t[s]=a))}):function(e,r,a){return t[0]=e,o(t,null,a,n),t[0]=null,!n.pop()}}),has:r(function(e){return function(n){return t(e,n).length>0}}),contains:r(function(e){return e=e.replace(ge,be),function(t){return(t.textContent||t.innerText||k(t)).indexOf(e)>-1}}),lang:r(function(e){return de.test(e||"")||t.error("unsupported lang: "+e),e=e.replace(ge,be).toLowerCase(),function(t){var n;do if(n=R?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return n=n.toLowerCase(),n===e||0===n.indexOf(e+"-");while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===Y},focus:function(e){return e===j.activeElement&&(!j.hasFocus||j.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:l(!1),disabled:l(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.selected===!0},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(6>e.nodeType)return!1;return!0},parent:function(e){return!w.pseudos.empty(e)},header:function(e){return me.test(e.nodeName)},input:function(e){return he.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:c(function(){return[0]}),last:c(function(e,t){return[t-1]}),eq:c(function(e,t,n){return[0>n?n+t:n]}),even:c(function(e,t){for(var n=0;t>n;n+=2)e.push(n);return e}),odd:c(function(e,t){for(var n=1;t>n;n+=2)e.push(n);return e}),lt:c(function(e,t,n){for(var r=0>n?n+t:n;--r>=0;)e.push(r); return e}),gt:c(function(e,t,n){for(var r=0>n?n+t:n;++r2&&"ID"===(i=a[0]).type&&9===t.nodeType&&R&&w.relative[a[1].type]){if(t=(w.find.ID(i.matches[0].replace(ge,be),t)||[])[0],!t)return n;l&&(t=t.parentNode),e=e.slice(a.shift().value.length)}for(o=fe.needsContext.test(e)?0:a.length;o--&&(i=a[o],!w.relative[s=i.type]);)if((u=w.find[s])&&(r=u(i.matches[0].replace(ge,be),_e.test(a[0].type)&&p(t.parentNode)||t))){if(a.splice(o,1),e=r.length&&f(a),!e)return Z.apply(n,r),n;break}}return(l||L(e,c))(r,t,!R,n,!t||_e.test(e)&&p(t.parentNode)||t),n},M.sortStable=H.split("").sort(Q).join("")===H,M.detectDuplicates=!!C,x(),M.sortDetached=o(function(e){return 1&e.compareDocumentPosition(j.createElement("fieldset"))}),o(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||a("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),M.attributes&&o(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||a("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),o(function(e){return null==e.getAttribute("disabled")})||a(te,function(e,t,n){var r;if(!n)return e[t]===!0?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),t}(n);ge.find=ke,ge.expr=ke.selectors,ge.expr[":"]=ge.expr.pseudos,ge.uniqueSort=ge.unique=ke.uniqueSort,ge.text=ke.getText,ge.isXMLDoc=ke.isXML,ge.contains=ke.contains,ge.escapeSelector=ke.escape;var Se=function(e,t,n){for(var r=[],o=void 0!==n;(e=e[t])&&9!==e.nodeType;)if(1===e.nodeType){if(o&&ge(e).is(n))break;r.push(e)}return r},Pe=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},Le=ge.expr.match.needsContext,De=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i,Oe=/^.[^:#\[\.,]*$/;ge.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?ge.find.matchesSelector(r,e)?[r]:[]:ge.find.matches(e,ge.grep(t,function(e){return 1===e.nodeType}))},ge.fn.extend({find:function(e){var t,n,r=this.length,o=this;if("string"!=typeof e)return this.pushStack(ge(e).filter(function(){for(t=0;r>t;t++)if(ge.contains(o[t],this))return!0}));for(n=this.pushStack([]),t=0;r>t;t++)ge.find(e,o[t],n);return r>1?ge.uniqueSort(n):n},filter:function(e){return this.pushStack(l(this,e||[],!1))},not:function(e){return this.pushStack(l(this,e||[],!0))},is:function(e){return!!l(this,"string"==typeof e&&Le.test(e)?ge(e):e||[],!1).length}});var Ee,Ce=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/,xe=ge.fn.init=function(e,t,n){var r,o;if(!e)return this;if(n=n||Ee,"string"==typeof e){if(r="<"!==e[0]||">"!==e[e.length-1]||3>e.length?Ce.exec(e):[null,e,null],!r||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof ge?t[0]:t,ge.merge(this,ge.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:ie,!0)),De.test(r[1])&&ge.isPlainObject(t))for(r in t)ge.isFunction(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return o=ie.getElementById(r[2]),o&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):ge.isFunction(e)?void 0!==n.ready?n.ready(e):e(ge):ge.makeArray(e,this)};xe.prototype=ge.fn,Ee=ge(ie);var je=/^(?:parents|prev(?:Until|All))/,Ye={children:!0,contents:!0,next:!0,prev:!0};ge.fn.extend({has:function(e){var t=ge(e,this),n=t.length;return this.filter(function(){for(var e=0;n>e;e++)if(ge.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,o=this.length,a=[],i="string"!=typeof e&&ge(e);if(!Le.test(e))for(;o>r;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(11>n.nodeType&&(i?i.index(n)>-1:1===n.nodeType&&ge.find.matchesSelector(n,e))){a.push(n);break}return this.pushStack(a.length>1?ge.uniqueSort(a):a)},index:function(e){return e?"string"==typeof e?pe.call(ge(e),this[0]):pe.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(ge.uniqueSort(ge.merge(this.get(),ge(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),ge.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return Se(e,"parentNode")},parentsUntil:function(e,t,n){return Se(e,"parentNode",n)},next:function(e){return c(e,"nextSibling")},prev:function(e){return c(e,"previousSibling")},nextAll:function(e){return Se(e,"nextSibling")},prevAll:function(e){return Se(e,"previousSibling")},nextUntil:function(e,t,n){return Se(e,"nextSibling",n)},prevUntil:function(e,t,n){return Se(e,"previousSibling",n)},siblings:function(e){return Pe((e.parentNode||{}).firstChild,e)},children:function(e){return Pe(e.firstChild)},contents:function(e){return u(e,"iframe")?e.contentDocument:(u(e,"template")&&(e=e.content||e),ge.merge([],e.childNodes))}},function(e,t){ge.fn[e]=function(n,r){var o=ge.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(o=ge.filter(r,o)),this.length>1&&(Ye[e]||ge.uniqueSort(o),je.test(e)&&o.reverse()),this.pushStack(o)}});var Re=/[^\x20\t\r\n\f]+/g;ge.Callbacks=function(e){e="string"==typeof e?p(e):ge.extend({},e);var t,n,r,o,a=[],i=[],s=-1,u=function(){for(o=o||e.once,r=t=!0;i.length;s=-1)for(n=i.shift();++s-1;)a.splice(n,1),n>s||s--}),this},has:function(e){return e?ge.inArray(e,a)>-1:a.length>0},empty:function(){return a&&(a=[]),this},disable:function(){return o=i=[],a=n="",this},disabled:function(){return!a},lock:function(){return o=i=[],n||t||(a=n=""),this},locked:function(){return!!o},fireWith:function(e,n){return o||(n=n||[],n=[e,n.slice?n.slice():n],i.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l},ge.extend({Deferred:function(e){var t=[["notify","progress",ge.Callbacks("memory"),ge.Callbacks("memory"),2],["resolve","done",ge.Callbacks("once memory"),ge.Callbacks("once memory"),0,"resolved"],["reject","fail",ge.Callbacks("once memory"),ge.Callbacks("once memory"),1,"rejected"]],r="pending",o={state:function(){return r},always:function(){return a.done(arguments).fail(arguments),this},"catch":function(e){return o.then(null,e)},pipe:function(){var e=arguments;return ge.Deferred(function(n){ge.each(t,function(t,r){var o=ge.isFunction(e[r[4]])&&e[r[4]];a[r[1]](function(){var e=o&&o.apply(this,arguments);e&&ge.isFunction(e.promise)?e.promise().progress(n.notify).done(n.resolve).fail(n.reject):n[r[0]+"With"](this,o?[e]:arguments)})}),e=null}).promise()},then:function(e,r,o){function a(e,t,r,o){return function(){var s=this,u=arguments,l=function(){var n,l;if(e>=i){if(n=r.apply(s,u),n===t.promise())throw new TypeError("Thenable self-resolution");l=n&&("object"==typeof n||"function"==typeof n)&&n.then,ge.isFunction(l)?o?l.call(n,a(i,t,d,o),a(i,t,f,o)):(i++,l.call(n,a(i,t,d,o),a(i,t,f,o),a(i,t,d,t.notifyWith))):(r!==d&&(s=void 0,u=[n]),(o||t.resolveWith)(s,u))}},c=o?l:function(){try{l()}catch(n){ge.Deferred.exceptionHook&&ge.Deferred.exceptionHook(n,c.stackTrace),i>e+1||(r!==f&&(s=void 0,u=[n]),t.rejectWith(s,u))}};e?c():(ge.Deferred.getStackHook&&(c.stackTrace=ge.Deferred.getStackHook()),n.setTimeout(c))}}var i=0;return ge.Deferred(function(n){t[0][3].add(a(0,n,ge.isFunction(o)?o:d,n.notifyWith)),t[1][3].add(a(0,n,ge.isFunction(e)?e:d)),t[2][3].add(a(0,n,ge.isFunction(r)?r:f))}).promise()},promise:function(e){return null!=e?ge.extend(e,o):o}},a={};return ge.each(t,function(e,n){var i=n[2],s=n[5];o[n[1]]=i.add,s&&i.add(function(){r=s},t[3-e][2].disable,t[0][2].lock),i.add(n[3].fire),a[n[0]]=function(){return a[n[0]+"With"](this===a?void 0:this,arguments),this},a[n[0]+"With"]=i.fireWith}),o.promise(a),e&&e.call(a,a),a},when:function(e){var t=arguments.length,n=t,r=Array(n),o=ue.call(arguments),a=ge.Deferred(),i=function(e){return function(n){r[e]=this,o[e]=arguments.length>1?ue.call(arguments):n,--t||a.resolveWith(r,o)}};if(1>=t&&(h(e,a.done(i(n)).resolve,a.reject,!t),"pending"===a.state()||ge.isFunction(o[n]&&o[n].then)))return a.then();for(;n--;)h(o[n],i(n),a.reject);return a.promise()}});var Ae=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;ge.Deferred.exceptionHook=function(e,t){n.console&&n.console.warn&&e&&Ae.test(e.name)&&n.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},ge.readyException=function(e){n.setTimeout(function(){throw e})};var Ne=ge.Deferred();ge.fn.ready=function(e){return Ne.then(e)["catch"](function(e){ge.readyException(e)}),this},ge.extend({isReady:!1,readyWait:1,ready:function(e){(e===!0?--ge.readyWait:ge.isReady)||(ge.isReady=!0,e!==!0&&--ge.readyWait>0||Ne.resolveWith(ie,[ge]))}}),ge.ready.then=Ne.then,"complete"===ie.readyState||"loading"!==ie.readyState&&!ie.documentElement.doScroll?n.setTimeout(ge.ready):(ie.addEventListener("DOMContentLoaded",m),n.addEventListener("load",m));var Ie=function(e,t,n,r,o,a,i){var s=0,u=e.length,l=null==n;if("object"===ge.type(n)){o=!0;for(s in n)Ie(e,t,s,n[s],!0,a,i)}else if(void 0!==r&&(o=!0,ge.isFunction(r)||(i=!0),l&&(i?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(ge(e),n)})),t))for(;u>s;s++)t(e[s],n,i?r:r.call(e[s],s,t(e[s],n)));return o?e:l?t.call(e):u?t(e[0],n):a},Fe=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};y.uid=1,y.prototype={cache:function(e){var t=e[this.expando];return t||(t={},Fe(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,o=this.cache(e);if("string"==typeof t)o[ge.camelCase(t)]=n;else for(r in t)o[ge.camelCase(r)]=t[r];return o},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][ge.camelCase(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){Array.isArray(t)?t=t.map(ge.camelCase):(t=ge.camelCase(t),t=t in r?[t]:t.match(Re)||[]),n=t.length;for(;n--;)delete r[t[n]]}(void 0===t||ge.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!ge.isEmptyObject(t)}};var He=new y,Be=new y,Ve=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,qe=/[A-Z]/g;ge.extend({hasData:function(e){return Be.hasData(e)||He.hasData(e)},data:function(e,t,n){return Be.access(e,t,n)},removeData:function(e,t){Be.remove(e,t)},_data:function(e,t,n){return He.access(e,t,n)},_removeData:function(e,t){He.remove(e,t)}}),ge.fn.extend({data:function(e,t){var n,r,o,a=this[0],i=a&&a.attributes;if(void 0===e){if(this.length&&(o=Be.get(a),1===a.nodeType&&!He.get(a,"hasDataAttrs"))){for(n=i.length;n--;)i[n]&&(r=i[n].name,0===r.indexOf("data-")&&(r=ge.camelCase(r.slice(5)),_(a,r,o[r])));He.set(a,"hasDataAttrs",!0)}return o}return"object"==typeof e?this.each(function(){Be.set(this,e)}):Ie(this,function(t){var n;if(a&&void 0===t){if(n=Be.get(a,e),void 0!==n)return n;if(n=_(a,e),void 0!==n)return n}else this.each(function(){Be.set(this,e,t)})},null,t,arguments.length>1,null,!0)},removeData:function(e){return this.each(function(){Be.remove(this,e)})}}),ge.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=He.get(e,t),n&&(!r||Array.isArray(n)?r=He.access(e,t,ge.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=ge.queue(e,t),r=n.length,o=n.shift(),a=ge._queueHooks(e,t),i=function(){ge.dequeue(e,t)};"inprogress"===o&&(o=n.shift(),r--),o&&("fx"===t&&n.unshift("inprogress"),delete a.stop,o.call(e,i,a)),!r&&a&&a.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return He.get(e,n)||He.access(e,n,{empty:ge.Callbacks("once memory").add(function(){He.remove(e,[t+"queue",n])})})}}),ge.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),n>arguments.length?ge.queue(this[0],e):void 0===t?this:this.each(function(){var n=ge.queue(this,e,t);ge._queueHooks(this,e),"fx"===e&&"inprogress"!==n[0]&&ge.dequeue(this,e)})},dequeue:function(e){return this.each(function(){ge.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,o=ge.Deferred(),a=this,i=this.length,s=function(){--r||o.resolveWith(a,[a])};for("string"!=typeof e&&(t=e,e=void 0),e=e||"fx";i--;)n=He.get(a[i],e+"queueHooks"),n&&n.empty&&(r++,n.empty.add(s));return s(),o.promise(t)}});var We=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,ze=RegExp("^(?:([+-])=|)("+We+")([a-z%]*)$","i"),Ue=["Top","Right","Bottom","Left"],Qe=function(e,t){return e=t||e,"none"===e.style.display||""===e.style.display&&ge.contains(e.ownerDocument,e)&&"none"===ge.css(e,"display")},Je=function(e,t,n,r){var o,a,i={};for(a in t)i[a]=e.style[a],e.style[a]=t[a];o=n.apply(e,r||[]);for(a in t)e.style[a]=i[a];return o},Ge={};ge.fn.extend({show:function(){return T(this,!0)},hide:function(){return T(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){Qe(this)?ge(this).show():ge(this).hide()})}});var Ke=/^(?:checkbox|radio)$/i,$e=/<([a-z][^\/\0>\x20\t\r\n\f]+)/i,Ze=/^$|\/(?:java|ecma)script/i,Xe={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};Xe.optgroup=Xe.option,Xe.tbody=Xe.tfoot=Xe.colgroup=Xe.caption=Xe.thead,Xe.th=Xe.td;var et=/<|&#?\w+;/;!function(){var e=ie.createDocumentFragment(),t=e.appendChild(ie.createElement("div")),n=ie.createElement("input");n.setAttribute("type","radio"),n.setAttribute("checked","checked"),n.setAttribute("name","t"),t.appendChild(n),ve.checkClone=t.cloneNode(!0).cloneNode(!0).lastChild.checked,t.innerHTML="",ve.noCloneChecked=!!t.cloneNode(!0).lastChild.defaultValue}();var tt=ie.documentElement,nt=/^key/,rt=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,ot=/^([^.]*)(?:\.(.+)|)/;ge.event={global:{},add:function(e,t,n,r,o){var a,i,s,u,l,c,p,d,f,h,m,y=He.get(e);if(y)for(n.handler&&(a=n,n=a.handler,o=a.selector),o&&ge.find.matchesSelector(tt,o),n.guid||(n.guid=ge.guid++),(u=y.events)||(u=y.events={}),(i=y.handle)||(i=y.handle=function(t){return void 0!==ge&&ge.event.triggered!==t.type?ge.event.dispatch.apply(e,arguments):void 0}),t=(t||"").match(Re)||[""],l=t.length;l--;)s=ot.exec(t[l])||[],f=m=s[1],h=(s[2]||"").split(".").sort(),f&&(p=ge.event.special[f]||{},f=(o?p.delegateType:p.bindType)||f,p=ge.event.special[f]||{},c=ge.extend({type:f,origType:m,data:r,handler:n,guid:n.guid,selector:o,needsContext:o&&ge.expr.match.needsContext.test(o),namespace:h.join(".")},a),(d=u[f])||(d=u[f]=[],d.delegateCount=0,p.setup&&p.setup.call(e,r,h,i)!==!1||e.addEventListener&&e.addEventListener(f,i)),p.add&&(p.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),o?d.splice(d.delegateCount++,0,c):d.push(c),ge.event.global[f]=!0)},remove:function(e,t,n,r,o){var a,i,s,u,l,c,p,d,f,h,m,y=He.hasData(e)&&He.get(e);if(y&&(u=y.events)){for(t=(t||"").match(Re)||[""],l=t.length;l--;)if(s=ot.exec(t[l])||[],f=m=s[1],h=(s[2]||"").split(".").sort(),f){for(p=ge.event.special[f]||{},f=(r?p.delegateType:p.bindType)||f,d=u[f]||[],s=s[2]&&RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),i=a=d.length;a--;)c=d[a],!o&&m!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(d.splice(a,1),c.selector&&d.delegateCount--,p.remove&&p.remove.call(e,c));i&&!d.length&&(p.teardown&&p.teardown.call(e,h,y.handle)!==!1||ge.removeEvent(e,f,y.handle),delete u[f])}else for(f in u)ge.event.remove(e,f+t[l],n,r,!0);ge.isEmptyObject(u)&&He.remove(e,"handle events")}},dispatch:function(e){var t,n,r,o,a,i,s=ge.event.fix(e),u=Array(arguments.length),l=(He.get(this,"events")||{})[s.type]||[],c=ge.event.special[s.type]||{};for(u[0]=s,t=1;arguments.length>t;t++)u[t]=arguments[t];if(s.delegateTarget=this,!c.preDispatch||c.preDispatch.call(this,s)!==!1){for(i=ge.event.handlers.call(this,s,l),t=0;(o=i[t++])&&!s.isPropagationStopped();)for(s.currentTarget=o.elem,n=0;(a=o.handlers[n++])&&!s.isImmediatePropagationStopped();)s.rnamespace&&!s.rnamespace.test(a.namespace)||(s.handleObj=a,s.data=a.data,r=((ge.event.special[a.origType]||{}).handle||a.handler).apply(o.elem,u),void 0!==r&&(s.result=r)===!1&&(s.preventDefault(),s.stopPropagation()));return c.postDispatch&&c.postDispatch.call(this,s),s.result}},handlers:function(e,t){var n,r,o,a,i,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&("click"!==e.type||1>e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||l.disabled!==!0)){for(a=[],i={},n=0;u>n;n++)r=t[n],o=r.selector+" ",void 0===i[o]&&(i[o]=r.needsContext?ge(o,this).index(l)>-1:ge.find(o,this,null,[l]).length),i[o]&&a.push(r);a.length&&s.push({elem:l,handlers:a})}return l=this,t.length>u&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(e,t){Object.defineProperty(ge.Event.prototype,e,{enumerable:!0,configurable:!0,get:ge.isFunction(t)?function(){if(this.originalEvent)return t(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[e]},set:function(t){Object.defineProperty(this,e,{enumerable:!0,configurable:!0,writable:!0,value:t})}})},fix:function(e){return e[ge.expando]?e:new ge.Event(e)},special:{load:{noBubble:!0},focus:{trigger:function(){if(this!==L()&&this.focus)return this.focus(),!1},delegateType:"focusin"},blur:{trigger:function(){if(this===L()&&this.blur)return this.blur(),!1},delegateType:"focusout"},click:{trigger:function(){if("checkbox"===this.type&&this.click&&u(this,"input"))return this.click(),!1},_default:function(e){return u(e.target,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},ge.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},ge.Event=function(e,t){return this instanceof ge.Event?(e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&e.returnValue===!1?S:P,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&ge.extend(this,t),this.timeStamp=e&&e.timeStamp||ge.now(),void(this[ge.expando]=!0)):new ge.Event(e,t)},ge.Event.prototype={constructor:ge.Event,isDefaultPrevented:P,isPropagationStopped:P,isImmediatePropagationStopped:P,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=S,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=S,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=S,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},ge.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&nt.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&rt.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},ge.event.addProp),ge.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,t){ge.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,o=e.relatedTarget,a=e.handleObj;return o&&(o===r||ge.contains(r,o))||(e.type=a.origType,n=a.handler.apply(this,arguments),e.type=t),n}}}),ge.fn.extend({on:function(e,t,n,r){return D(this,e,t,n,r)},one:function(e,t,n,r){return D(this,e,t,n,r,1)},off:function(e,t,n){var r,o;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,ge(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(o in e)this.off(o,t,e[o]);return this}return t!==!1&&"function"!=typeof t||(n=t,t=void 0),n===!1&&(n=P),this.each(function(){ge.event.remove(this,e,n,t)})}});var at=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([a-z][^\/\0>\x20\t\r\n\f]*)[^>]*)\/>/gi,it=/\s*$/g;ge.extend({htmlPrefilter:function(e){return e.replace(at,"<$1>")},clone:function(e,t,n){var r,o,a,i,s=e.cloneNode(!0),u=ge.contains(e.ownerDocument,e);if(!(ve.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||ge.isXMLDoc(e)))for(i=M(s),a=M(e),r=0,o=a.length;o>r;r++)j(a[r],i[r]);if(t)if(n)for(a=a||M(e),i=i||M(s),r=0,o=a.length;o>r;r++)x(a[r],i[r]);else x(e,s);return i=M(s,"script"),i.length>0&&w(i,!u&&M(e,"script")),s},cleanData:function(e){for(var t,n,r,o=ge.event.special,a=0;void 0!==(n=e[a]);a++)if(Fe(n)){if(t=n[He.expando]){if(t.events)for(r in t.events)o[r]?ge.event.remove(n,r):ge.removeEvent(n,r,t.handle);n[He.expando]=void 0}n[Be.expando]&&(n[Be.expando]=void 0)}}}),ge.fn.extend({detach:function(e){return R(this,e,!0)},remove:function(e){return R(this,e)},text:function(e){return Ie(this,function(e){return void 0===e?ge.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Y(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=O(this,e);t.appendChild(e)}})},prepend:function(){return Y(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=O(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Y(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Y(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(ge.cleanData(M(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return ge.clone(this,e,t)})},html:function(e){return Ie(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!it.test(e)&&!Xe[($e.exec(e)||["",""])[1].toLowerCase()]){e=ge.htmlPrefilter(e);try{for(;r>n;n++)t=this[n]||{},1===t.nodeType&&(ge.cleanData(M(t,!1)),t.innerHTML=e);t=0}catch(o){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var e=[];return Y(this,arguments,function(t){var n=this.parentNode;ge.inArray(this,e)<0&&(ge.cleanData(M(this)),n&&n.replaceChild(t,this))},e)}}),ge.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){ge.fn[e]=function(e){for(var n,r=[],o=ge(e),a=o.length-1,i=0;a>=i;i++)n=i===a?this:this.clone(!0),ge(o[i])[t](n),ce.apply(r,n.get());return this.pushStack(r)}});var ct=/^margin/,pt=RegExp("^("+We+")(?!px)[a-z%]+$","i"),dt=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=n),t.getComputedStyle(e)};!function(){function e(){if(s){s.style.cssText="box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%",s.innerHTML="",tt.appendChild(i);var e=n.getComputedStyle(s);t="1%"!==e.top,a="2px"===e.marginLeft,r="4px"===e.width,s.style.marginRight="50%",o="4px"===e.marginRight,tt.removeChild(i),s=null}}var t,r,o,a,i=ie.createElement("div"),s=ie.createElement("div");s.style&&(s.style.backgroundClip="content-box",s.cloneNode(!0).style.backgroundClip="",ve.clearCloneStyle="content-box"===s.style.backgroundClip,i.style.cssText="border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute",i.appendChild(s),ge.extend(ve,{pixelPosition:function(){return e(),t},boxSizingReliable:function(){return e(),r},pixelMarginRight:function(){return e(),o},reliableMarginLeft:function(){return e(),a}}))}();var ft=/^(none|table(?!-c[ea]).+)/,ht=/^--/,mt={position:"absolute",visibility:"hidden",display:"block"},yt={letterSpacing:"0",fontWeight:"400"},vt=["Webkit","Moz","ms"],_t=ie.createElement("div").style;ge.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=A(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var o,a,i,s=ge.camelCase(t),u=ht.test(t),l=e.style;return u||(t=F(s)),i=ge.cssHooks[t]||ge.cssHooks[s],void 0===n?i&&"get"in i&&void 0!==(o=i.get(e,!1,r))?o:l[t]:(a=typeof n,"string"===a&&(o=ze.exec(n))&&o[1]&&(n=g(e,t,o),a="number"),null!=n&&n===n&&("number"===a&&(n+=o&&o[3]||(ge.cssNumber[s]?"":"px")),ve.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),i&&"set"in i&&void 0===(n=i.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n)),void 0)}},css:function(e,t,n,r){var o,a,i,s=ge.camelCase(t),u=ht.test(t);return u||(t=F(s)),i=ge.cssHooks[t]||ge.cssHooks[s],i&&"get"in i&&(o=i.get(e,!0,n)),void 0===o&&(o=A(e,t,r)),"normal"===o&&t in yt&&(o=yt[t]),""===n||n?(a=parseFloat(o),n===!0||isFinite(a)?a||0:o):o}}),ge.each(["height","width"],function(e,t){ge.cssHooks[t]={get:function(e,n,r){if(n)return!ft.test(ge.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?V(e,t,r):Je(e,mt,function(){return V(e,t,r)})},set:function(e,n,r){var o,a=r&&dt(e),i=r&&B(e,t,r,"border-box"===ge.css(e,"boxSizing",!1,a),a);return i&&(o=ze.exec(n))&&"px"!==(o[3]||"px")&&(e.style[t]=n,n=ge.css(e,t)),H(e,n,i)}}}),ge.cssHooks.marginLeft=N(ve.reliableMarginLeft,function(e,t){if(t)return(parseFloat(A(e,"marginLeft"))||e.getBoundingClientRect().left-Je(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),ge.each({margin:"",padding:"",border:"Width"},function(e,t){ge.cssHooks[e+t]={expand:function(n){for(var r=0,o={},a="string"==typeof n?n.split(" "):[n];4>r;r++)o[e+Ue[r]+t]=a[r]||a[r-2]||a[0];return o}},ct.test(e)||(ge.cssHooks[e+t].set=H)}),ge.fn.extend({css:function(e,t){return Ie(this,function(e,t,n){var r,o,a={},i=0;if(Array.isArray(t)){for(r=dt(e),o=t.length;o>i;i++)a[t[i]]=ge.css(e,t[i],!1,r);return a}return void 0!==n?ge.style(e,t,n):ge.css(e,t)},e,t,arguments.length>1)}}),ge.Tween=q,q.prototype={constructor:q,init:function(e,t,n,r,o,a){this.elem=e,this.prop=n,this.easing=o||ge.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=a||(ge.cssNumber[n]?"":"px")},cur:function(){var e=q.propHooks[this.prop];return e&&e.get?e.get(this):q.propHooks._default.get(this)},run:function(e){var t,n=q.propHooks[this.prop];return this.pos=t=this.options.duration?ge.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):q.propHooks._default.set(this),this}},q.prototype.init.prototype=q.prototype,q.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=ge.css(e.elem,e.prop,""),t&&"auto"!==t?t:0)},set:function(e){ge.fx.step[e.prop]?ge.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[ge.cssProps[e.prop]]&&!ge.cssHooks[e.prop]?e.elem[e.prop]=e.now:ge.style(e.elem,e.prop,e.now+e.unit)}}},q.propHooks.scrollTop=q.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},ge.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},ge.fx=q.prototype.init,ge.fx.step={};var gt,bt,Tt=/^(?:toggle|show|hide)$/,Mt=/queueHooks$/;ge.Animation=ge.extend(K,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return g(n.elem,e,ze.exec(t),n),n}]},tweener:function(e,t){ge.isFunction(e)?(t=e,e=["*"]):e=e.match(Re);for(var n,r=0,o=e.length;o>r;r++)n=e[r],K.tweeners[n]=K.tweeners[n]||[],K.tweeners[n].unshift(t)},prefilters:[J],prefilter:function(e,t){t?K.prefilters.unshift(e):K.prefilters.push(e)}}),ge.speed=function(e,t,n){var r=e&&"object"==typeof e?ge.extend({},e):{complete:n||!n&&t||ge.isFunction(e)&&e,duration:e,easing:n&&t||t&&!ge.isFunction(t)&&t};return ge.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration=r.duration in ge.fx.speeds?ge.fx.speeds[r.duration]:ge.fx.speeds._default),null!=r.queue&&r.queue!==!0||(r.queue="fx"),r.old=r.complete,r.complete=function(){ge.isFunction(r.old)&&r.old.call(this),r.queue&&ge.dequeue(this,r.queue)},r},ge.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Qe).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var o=ge.isEmptyObject(e),a=ge.speed(t,n,r),i=function(){var t=K(this,ge.extend({},e),a);(o||He.get(this,"finish"))&&t.stop(!0)};return i.finish=i,o||a.queue===!1?this.each(i):this.queue(a.queue,i)},stop:function(e,t,n){var r=function(e){var t=e.stop;delete e.stop,t(n)};return"string"!=typeof e&&(n=t,t=e,e=void 0),t&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,o=null!=e&&e+"queueHooks",a=ge.timers,i=He.get(this);if(o)i[o]&&i[o].stop&&r(i[o]);else for(o in i)i[o]&&i[o].stop&&Mt.test(o)&&r(i[o]);for(o=a.length;o--;)a[o].elem!==this||null!=e&&a[o].queue!==e||(a[o].anim.stop(n),t=!1,a.splice(o,1));!t&&n||ge.dequeue(this,e)})},finish:function(e){return e!==!1&&(e=e||"fx"),this.each(function(){var t,n=He.get(this),r=n[e+"queue"],o=n[e+"queueHooks"],a=ge.timers,i=r?r.length:0;for(n.finish=!0,ge.queue(this,e,[]),o&&o.stop&&o.stop.call(this,!0),t=a.length;t--;)a[t].elem===this&&a[t].queue===e&&(a[t].anim.stop(!0),a.splice(t,1));for(t=0;i>t;t++)r[t]&&r[t].finish&&r[t].finish.call(this);delete n.finish})}}),ge.each(["toggle","show","hide"],function(e,t){var n=ge.fn[t];ge.fn[t]=function(e,r,o){return null==e||"boolean"==typeof e?n.apply(this,arguments):this.animate(U(t,!0),e,r,o)}}),ge.each({slideDown:U("show"),slideUp:U("hide"),slideToggle:U("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){ge.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),ge.timers=[],ge.fx.tick=function(){var e,t=0,n=ge.timers;for(gt=ge.now();n.length>t;t++)e=n[t],e()||n[t]!==e||n.splice(t--,1);n.length||ge.fx.stop(),gt=void 0},ge.fx.timer=function(e){ge.timers.push(e),ge.fx.start()},ge.fx.interval=13,ge.fx.start=function(){bt||(bt=!0,W())},ge.fx.stop=function(){ -bt=null},ge.fx.speeds={slow:600,fast:200,_default:400},ge.fn.delay=function(e,t){return e=ge.fx?ge.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,r){var o=n.setTimeout(t,e);r.stop=function(){n.clearTimeout(o)}})},function(){var e=ie.createElement("input"),t=ie.createElement("select"),n=t.appendChild(ie.createElement("option"));e.type="checkbox",ve.checkOn=""!==e.value,ve.optSelected=n.selected,e=ie.createElement("input"),e.value="t",e.type="radio",ve.radioValue="t"===e.value}();var wt,kt=ge.expr.attrHandle;ge.fn.extend({attr:function(e,t){return Ie(this,ge.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){ge.removeAttr(this,e)})}}),ge.extend({attr:function(e,t,n){var r,o,a=e.nodeType;if(3!==a&&8!==a&&2!==a)return void 0===e.getAttribute?ge.prop(e,t,n):(1===a&&ge.isXMLDoc(e)||(o=ge.attrHooks[t.toLowerCase()]||(ge.expr.match.bool.test(t)?wt:void 0)),void 0!==n?null===n?void ge.removeAttr(e,t):o&&"set"in o&&void 0!==(r=o.set(e,n,t))?r:(e.setAttribute(t,n+""),n):o&&"get"in o&&null!==(r=o.get(e,t))?r:(r=ge.find.attr(e,t),null==r?void 0:r))},attrHooks:{type:{set:function(e,t){if(!ve.radioValue&&"radio"===t&&u(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,o=t&&t.match(Re);if(o&&1===e.nodeType)for(;n=o[r++];)e.removeAttribute(n)}}),wt={set:function(e,t,n){return t===!1?ge.removeAttr(e,n):e.setAttribute(n,n),n}},ge.each(ge.expr.match.bool.source.match(/\w+/g),function(e,t){var n=kt[t]||ge.find.attr;kt[t]=function(e,t,r){var o,a,i=t.toLowerCase();return r||(a=kt[i],kt[i]=o,o=null!=n(e,t,r)?i:null,kt[i]=a),o}});var St=/^(?:input|select|textarea|button)$/i,Pt=/^(?:a|area)$/i;ge.fn.extend({prop:function(e,t){return Ie(this,ge.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[ge.propFix[e]||e]})}}),ge.extend({prop:function(e,t,n){var r,o,a=e.nodeType;if(3!==a&&8!==a&&2!==a)return 1===a&&ge.isXMLDoc(e)||(t=ge.propFix[t]||t,o=ge.propHooks[t]),void 0!==n?o&&"set"in o&&void 0!==(r=o.set(e,n,t))?r:e[t]=n:o&&"get"in o&&null!==(r=o.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=ge.find.attr(e,"tabindex");return t?parseInt(t,10):St.test(e.nodeName)||Pt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),ve.optSelected||(ge.propHooks.selected={get:function(e){return null},set:function(e){}}),ge.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){ge.propFix[this.toLowerCase()]=this}),ge.fn.extend({addClass:function(e){var t,n,r,o,a,i,s,u=0;if(ge.isFunction(e))return this.each(function(t){ge(this).addClass(e.call(this,t,Z(this)))});if("string"==typeof e&&e)for(t=e.match(Re)||[];n=this[u++];)if(o=Z(n),r=1===n.nodeType&&" "+$(o)+" "){for(i=0;a=t[i++];)r.indexOf(" "+a+" ")<0&&(r+=a+" ");s=$(r),o!==s&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,o,a,i,s,u=0;if(ge.isFunction(e))return this.each(function(t){ge(this).removeClass(e.call(this,t,Z(this)))});if(!arguments.length)return this.attr("class","");if("string"==typeof e&&e)for(t=e.match(Re)||[];n=this[u++];)if(o=Z(n),r=1===n.nodeType&&" "+$(o)+" "){for(i=0;a=t[i++];)for(;r.indexOf(" "+a+" ")>-1;)r=r.replace(" "+a+" "," ");s=$(r),o!==s&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e;return"boolean"==typeof t&&"string"===n?t?this.addClass(e):this.removeClass(e):this.each(ge.isFunction(e)?function(n){ge(this).toggleClass(e.call(this,n,Z(this),t),t)}:function(){var t,r,o,a;if("string"===n)for(r=0,o=ge(this),a=e.match(Re)||[];t=a[r++];)o.hasClass(t)?o.removeClass(t):o.addClass(t);else void 0!==e&&"boolean"!==n||(t=Z(this),t&&He.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||e===!1?"":He.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;for(t=" "+e+" ";n=this[r++];)if(1===n.nodeType&&(" "+$(Z(n))+" ").indexOf(t)>-1)return!0;return!1}});var Lt=/\r/g;ge.fn.extend({val:function(e){var t,n,r,o=this[0];{if(arguments.length)return r=ge.isFunction(e),this.each(function(n){var o;1===this.nodeType&&(o=r?e.call(this,n,ge(this).val()):e,null==o?o="":"number"==typeof o?o+="":Array.isArray(o)&&(o=ge.map(o,function(e){return null==e?"":e+""})),t=ge.valHooks[this.type]||ge.valHooks[this.nodeName.toLowerCase()],t&&"set"in t&&void 0!==t.set(this,o,"value")||(this.value=o))});if(o)return t=ge.valHooks[o.type]||ge.valHooks[o.nodeName.toLowerCase()],t&&"get"in t&&void 0!==(n=t.get(o,"value"))?n:(n=o.value,"string"==typeof n?n.replace(Lt,""):null==n?"":n)}}}),ge.extend({valHooks:{option:{get:function(e){var t=ge.find.attr(e,"value");return null!=t?t:$(ge.text(e))}},select:{get:function(e){var t,n,r,o=e.options,a=e.selectedIndex,i="select-one"===e.type,s=i?null:[],l=i?a+1:o.length;for(r=0>a?l:i?a:0;l>r;r++)if(n=o[r],(n.selected||r===a)&&!n.disabled&&(!n.parentNode.disabled||!u(n.parentNode,"optgroup"))){if(t=ge(n).val(),i)return t;s.push(t)}return s},set:function(e,t){for(var n,r,o=e.options,a=ge.makeArray(t),i=o.length;i--;)r=o[i],(r.selected=ge.inArray(ge.valHooks.option.get(r),a)>-1)&&(n=!0);return n||(e.selectedIndex=-1),a}}}}),ge.each(["radio","checkbox"],function(){ge.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=ge.inArray(ge(e).val(),t)>-1}},ve.checkOn||(ge.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})});var Dt=/^(?:focusinfocus|focusoutblur)$/;ge.extend(ge.event,{trigger:function(e,t,r,o){var a,i,s,u,l,c,p,d=[r||ie],f=he.call(e,"type")?e.type:e,h=he.call(e,"namespace")?e.namespace.split("."):[];if(i=s=r=r||ie,3!==r.nodeType&&8!==r.nodeType&&!Dt.test(f+ge.event.triggered)&&(f.indexOf(".")>-1&&(h=f.split("."),f=h.shift(),h.sort()),l=f.indexOf(":")<0&&"on"+f,e=e[ge.expando]?e:new ge.Event(f,"object"==typeof e&&e),e.isTrigger=o?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=r),t=null==t?[e]:ge.makeArray(t,[e]),p=ge.event.special[f]||{},o||!p.trigger||p.trigger.apply(r,t)!==!1)){if(!o&&!p.noBubble&&!ge.isWindow(r)){for(u=p.delegateType||f,Dt.test(u+f)||(i=i.parentNode);i;i=i.parentNode)d.push(i),s=i;s===(r.ownerDocument||ie)&&d.push(s.defaultView||s.parentWindow||n)}for(a=0;(i=d[a++])&&!e.isPropagationStopped();)e.type=a>1?u:p.bindType||f,c=(He.get(i,"events")||{})[e.type]&&He.get(i,"handle"),c&&c.apply(i,t),c=l&&i[l],c&&c.apply&&Fe(i)&&(e.result=c.apply(i,t),e.result===!1&&e.preventDefault());return e.type=f,o||e.isDefaultPrevented()||p._default&&p._default.apply(d.pop(),t)!==!1||!Fe(r)||l&&ge.isFunction(r[f])&&!ge.isWindow(r)&&(s=r[l],s&&(r[l]=null),ge.event.triggered=f,r[f](),ge.event.triggered=void 0,s&&(r[l]=s)),e.result}},simulate:function(e,t,n){var r=ge.extend(new ge.Event,n,{type:e,isSimulated:!0});ge.event.trigger(r,null,t)}}),ge.fn.extend({trigger:function(e,t){return this.each(function(){ge.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return ge.event.trigger(e,t,n,!0)}}),ge.each("blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),function(e,t){ge.fn[t]=function(e,n){return arguments.length>0?this.on(t,null,e,n):this.trigger(t)}}),ge.fn.extend({hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),ve.focusin="onfocusin"in n,ve.focusin||ge.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){ge.event.simulate(t,e.target,ge.event.fix(e))};ge.event.special[t]={setup:function(){var r=this.ownerDocument||this,o=He.access(r,t);o||r.addEventListener(e,n,!0),He.access(r,t,(o||0)+1)},teardown:function(){var r=this.ownerDocument||this,o=He.access(r,t)-1;o?He.access(r,t,o):(r.removeEventListener(e,n,!0),He.remove(r,t))}}});var Ot=n.location,Et=ge.now(),Ct=/\?/;ge.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new n.DOMParser).parseFromString(e,"text/xml")}catch(r){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||ge.error("Invalid XML: "+e),t};var xt=/\[\]$/,jt=/\r?\n/g,Yt=/^(?:submit|button|image|reset|file)$/i,Rt=/^(?:input|select|textarea|keygen)/i;ge.param=function(e,t){var n,r=[],o=function(e,t){var n=ge.isFunction(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!ge.isPlainObject(e))ge.each(e,function(){o(this.name,this.value)});else for(n in e)X(n,e[n],t,o);return r.join("&")},ge.fn.extend({serialize:function(){return ge.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=ge.prop(this,"elements");return e?ge.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!ge(this).is(":disabled")&&Rt.test(this.nodeName)&&!Yt.test(e)&&(this.checked||!Ke.test(e))}).map(function(e,t){var n=ge(this).val();return null==n?null:Array.isArray(n)?ge.map(n,function(e){return{name:t.name,value:e.replace(jt,"\r\n")}}):{name:t.name,value:n.replace(jt,"\r\n")}}).get()}});var At=/%20/g,Nt=/#.*$/,It=/([?&])_=[^&]*/,Ft=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ht=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Bt=/^(?:GET|HEAD)$/,Vt=/^\/\//,qt={},Wt={},zt="*/".concat("*"),Ut=ie.createElement("a");Ut.href=Ot.href,ge.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ot.href,type:"GET",isLocal:Ht.test(Ot.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":zt,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":ge.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?ne(ne(e,ge.ajaxSettings),t):ne(ge.ajaxSettings,e)},ajaxPrefilter:ee(qt),ajaxTransport:ee(Wt),ajax:function(e,t){function r(e,t,r,s){var l,d,f,b,T,M=t;c||(c=!0,u&&n.clearTimeout(u),o=void 0,i=s||"",w.readyState=e>0?4:0,l=e>=200&&300>e||304===e,r&&(b=re(h,w,r)),b=oe(h,b,w,l),l?(h.ifModified&&(T=w.getResponseHeader("Last-Modified"),T&&(ge.lastModified[a]=T),T=w.getResponseHeader("etag"),T&&(ge.etag[a]=T)),204===e||"HEAD"===h.type?M="nocontent":304===e?M="notmodified":(M=b.state,d=b.data,f=b.error,l=!f)):(f=M,!e&&M||(M="error",0>e&&(e=0))),w.status=e,w.statusText=(t||M)+"",l?v.resolveWith(m,[d,M,w]):v.rejectWith(m,[w,M,f]),w.statusCode(g),g=void 0,p&&y.trigger(l?"ajaxSuccess":"ajaxError",[w,h,l?d:f]),_.fireWith(m,[w,M]),p&&(y.trigger("ajaxComplete",[w,h]),--ge.active||ge.event.trigger("ajaxStop")))}"object"==typeof e&&(t=e,e=void 0),t=t||{};var o,a,i,s,u,l,c,p,d,f,h=ge.ajaxSetup({},t),m=h.context||h,y=h.context&&(m.nodeType||m.jquery)?ge(m):ge.event,v=ge.Deferred(),_=ge.Callbacks("once memory"),g=h.statusCode||{},b={},T={},M="canceled",w={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s)for(s={};t=Ft.exec(i);)s[t[1].toLowerCase()]=t[2];t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?i:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)w.always(e[w.status]);else for(t in e)g[t]=[g[t],e[t]];return this},abort:function(e){var t=e||M;return o&&o.abort(t),r(0,t),this}};if(v.promise(w),h.url=((e||h.url||Ot.href)+"").replace(Vt,Ot.protocol+"//"),h.type=t.method||t.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(Re)||[""],null==h.crossDomain){l=ie.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Ut.protocol+"//"+Ut.host!=l.protocol+"//"+l.host}catch(k){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=ge.param(h.data,h.traditional)),te(qt,h,t,w),c)return w;p=ge.event&&h.global,p&&0===ge.active++&&ge.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Bt.test(h.type),a=h.url.replace(Nt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(At,"+")):(f=h.url.slice(a.length),h.data&&(a+=(Ct.test(a)?"&":"?")+h.data,delete h.data),h.cache===!1&&(a=a.replace(It,"$1"),f=(Ct.test(a)?"&":"?")+"_="+Et++ +f),h.url=a+f),h.ifModified&&(ge.lastModified[a]&&w.setRequestHeader("If-Modified-Since",ge.lastModified[a]),ge.etag[a]&&w.setRequestHeader("If-None-Match",ge.etag[a])),(h.data&&h.hasContent&&h.contentType!==!1||t.contentType)&&w.setRequestHeader("Content-Type",h.contentType),w.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+zt+"; q=0.01":""):h.accepts["*"]);for(d in h.headers)w.setRequestHeader(d,h.headers[d]);if(h.beforeSend&&(h.beforeSend.call(m,w,h)===!1||c))return w.abort();if(M="abort",_.add(h.complete),w.done(h.success),w.fail(h.error),o=te(Wt,h,t,w)){if(w.readyState=1,p&&y.trigger("ajaxSend",[w,h]),c)return w;h.async&&h.timeout>0&&(u=n.setTimeout(function(){w.abort("timeout")},h.timeout));try{c=!1,o.send(b,r)}catch(k){if(c)throw k;r(-1,k)}}else r(-1,"No Transport");return w},getJSON:function(e,t,n){return ge.get(e,t,n,"json")},getScript:function(e,t){return ge.get(e,void 0,t,"script")}}),ge.each(["get","post"],function(e,t){ge[t]=function(e,n,r,o){return ge.isFunction(n)&&(o=o||r,r=n,n=void 0),ge.ajax(ge.extend({url:e,type:t,dataType:o,data:n,success:r},ge.isPlainObject(e)&&e))}}),ge._evalUrl=function(e){return ge.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},ge.fn.extend({wrapAll:function(e){var t;return this[0]&&(ge.isFunction(e)&&(e=e.call(this[0])),t=ge(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){for(var e=this;e.firstElementChild;)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return this.each(ge.isFunction(e)?function(t){ge(this).wrapInner(e.call(this,t))}:function(){var t=ge(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=ge.isFunction(e);return this.each(function(n){ge(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){ge(this).replaceWith(this.childNodes)}),this}}),ge.expr.pseudos.hidden=function(e){return!ge.expr.pseudos.visible(e)},ge.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},ge.ajaxSettings.xhr=function(){try{return new n.XMLHttpRequest}catch(e){}};var Qt={0:200,1223:204},Jt=ge.ajaxSettings.xhr();ve.cors=!!Jt&&"withCredentials"in Jt,ve.ajax=Jt=!!Jt,ge.ajaxTransport(function(e){var t,r;if(ve.cors||Jt&&!e.crossDomain)return{send:function(o,a){var i,s=e.xhr();if(s.open(e.type,e.url,e.async,e.username,e.password),e.xhrFields)for(i in e.xhrFields)s[i]=e.xhrFields[i];e.mimeType&&s.overrideMimeType&&s.overrideMimeType(e.mimeType),e.crossDomain||o["X-Requested-With"]||(o["X-Requested-With"]="XMLHttpRequest");for(i in o)s.setRequestHeader(i,o[i]);t=function(e){return function(){t&&(t=r=s.onload=s.onerror=s.onabort=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?a(0,"error"):a(s.status,s.statusText):a(Qt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=t(),r=s.onerror=t("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&n.setTimeout(function(){t&&r()})},t=t("abort");try{s.send(e.hasContent&&e.data||null)}catch(u){if(t)throw u}},abort:function(){t&&t()}}}),ge.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),ge.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return ge.globalEval(e),e}}}),ge.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),ge.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(r,o){t=ge("