@appbaseio/reactivesearch-vue 1.26.0 → 1.27.0-gamma.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +1687 -436
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +5 -5
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{ComponentWrapper-32481890.js → ComponentWrapper-10bad289.js} +1 -1
  6. package/dist/cjs/DataSearch-37dfdf39.js +2154 -0
  7. package/dist/cjs/DataSearch.js +18 -2101
  8. package/dist/cjs/{DropDown-cf9bfffc.js → DropDown-0076babc.js} +16 -11
  9. package/dist/cjs/DynamicRangeSlider.js +40 -7
  10. package/dist/cjs/{Input-3cc3fa59.js → Input-a9ee53ed.js} +1 -1
  11. package/dist/cjs/MultiDropdownList.js +6 -5
  12. package/dist/cjs/MultiList.js +16 -11
  13. package/dist/cjs/MultiRange.js +2 -2
  14. package/dist/cjs/RangeInput.js +7 -3
  15. package/dist/cjs/RangeSlider.js +2 -2
  16. package/dist/cjs/ReactiveBase.js +1 -1
  17. package/dist/cjs/ReactiveComponent.js +2 -2
  18. package/dist/cjs/ReactiveList.js +13 -3
  19. package/dist/cjs/SelectedFilters.js +1 -1
  20. package/dist/cjs/SingleDropdownList.js +5 -4
  21. package/dist/cjs/SingleList.js +3 -3
  22. package/dist/cjs/SingleRange.js +2 -2
  23. package/dist/cjs/StateProvider.js +1 -1
  24. package/dist/cjs/ToggleButton.js +2 -2
  25. package/dist/cjs/{index-89c39a9e.js → index-4509aa45.js} +10 -4
  26. package/dist/cjs/index.js +11 -10
  27. package/dist/cjs/install-b7a80fc1.js +1196 -0
  28. package/dist/cjs/install.js +25 -30
  29. package/dist/cjs/version.js +1 -1
  30. package/dist/es/{ComponentWrapper-4f85a67e.js → ComponentWrapper-0f3431d1.js} +1 -1
  31. package/dist/es/DataSearch-77325036.js +2141 -0
  32. package/dist/es/DataSearch.js +17 -2100
  33. package/dist/es/{DropDown-c8da0a2c.js → DropDown-0dd8f2a3.js} +16 -11
  34. package/dist/es/DynamicRangeSlider.js +40 -7
  35. package/dist/es/{Input-08bb1bcf.js → Input-10b1d62d.js} +1 -1
  36. package/dist/es/MultiDropdownList.js +6 -5
  37. package/dist/es/MultiList.js +16 -11
  38. package/dist/es/MultiRange.js +2 -2
  39. package/dist/es/RangeInput.js +7 -3
  40. package/dist/es/RangeSlider.js +2 -2
  41. package/dist/es/ReactiveBase.js +1 -1
  42. package/dist/es/ReactiveComponent.js +2 -2
  43. package/dist/es/ReactiveList.js +13 -3
  44. package/dist/es/SelectedFilters.js +1 -1
  45. package/dist/es/SingleDropdownList.js +5 -4
  46. package/dist/es/SingleList.js +3 -3
  47. package/dist/es/SingleRange.js +2 -2
  48. package/dist/es/StateProvider.js +1 -1
  49. package/dist/es/ToggleButton.js +2 -2
  50. package/dist/es/{index-cb1950b6.js → index-78920565.js} +10 -4
  51. package/dist/es/index.js +7 -7
  52. package/dist/es/install-86388b0e.js +1189 -0
  53. package/dist/es/install.js +23 -32
  54. package/dist/es/version.js +1 -1
  55. package/package.json +3 -3
@@ -0,0 +1,2141 @@
1
+ import { helper, Actions, causes } from '@appbaseio/reactivecore';
2
+ import { _ as _taggedTemplateLiteralLoose, a as _extends } from './_rollupPluginBabelHelpers-0f24d612.js';
3
+ import VueTypes from 'vue-types';
4
+ import { componentTypes } from '@appbaseio/reactivecore/lib/utils/constants';
5
+ import { getQueryOptions } from '@appbaseio/reactivecore/lib/utils/helper';
6
+ import styled, { css, cx, injectGlobal } from '@appbaseio/vue-emotion';
7
+ import { t as types } from './vueTypes-687b2304.js';
8
+ import { g as getComponent, h as hasCustomRenderer, f as updateCustomQuery, u as updateDefaultQuery, i as isQueryIdentical, j as getQuerySuggestionsComponent, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, m as hasQuerySuggestionsRenderer, c as connect } from './index-78920565.js';
9
+ import { C as ComponentWrapper } from './ComponentWrapper-0f3431d1.js';
10
+ import { T as Title } from './Title-3522ff56.js';
11
+ import { F as Flex } from './Flex-8770345d.js';
12
+ import hotkeys from 'hotkeys-js';
13
+ import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './CancelSvg-c2c03a35.js';
14
+ import { n as noSuggestions, s as suggestionsContainer, I as Input, a as suggestions } from './Input-10b1d62d.js';
15
+ import { C as Container } from './Container-18b03fde.js';
16
+ import Highlight from 'vue-highlight-words';
17
+
18
+ var _templateObject;
19
+ var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: stretch;\n width: 100%;\n"])));
20
+ InputGroup.defaultProps = {
21
+ className: 'input-group'
22
+ };
23
+
24
+ var _templateObject$1;
25
+ var InputAddon = styled('span')(_templateObject$1 || (_templateObject$1 = _taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #fafafa;\n border: 1px solid #ccc;\n border-radius: 2px;\n color: rgba(0, 0, 0, 0.85);\n font-size: 14px;\n font-weight: 400;\n padding: 0 11px;\n position: relative;\n transition: all 0.3s;\n box-sizing: border-box;\n overflow: hidden;\n\n &:first-of-type {\n border-right: none;\n }\n &:last-of-type {\n border-left: none;\n }\n"])));
26
+ InputAddon.defaultProps = {
27
+ className: 'input-addon'
28
+ };
29
+
30
+ var getClassName = helper.getClassName;
31
+ var SuggestionWrapper = {
32
+ name: 'SuggestionWrapper',
33
+ props: {
34
+ innerClassName: types.string,
35
+ themePreset: types.themePreset,
36
+ innerClass: types.style
37
+ },
38
+ render: function render() {
39
+ var h = arguments[0];
40
+ var _this$$props = this.$props,
41
+ themePreset = _this$$props.themePreset,
42
+ innerClass = _this$$props.innerClass,
43
+ innerClassName = _this$$props.innerClassName;
44
+ return h("div", {
45
+ "class": noSuggestions(themePreset) + " " + getClassName(innerClass, innerClassName || '')
46
+ }, [h("li", [this.$scopedSlots["default"]()])]);
47
+ }
48
+ };
49
+
50
+ var _templateObject$2;
51
+ var highlightStyle = {
52
+ fontWeight: 600,
53
+ padding: 0,
54
+ backgroundColor: 'transparent',
55
+ color: 'inherit'
56
+ };
57
+ var PredictiveSuggestion = styled('span')(_templateObject$2 || (_templateObject$2 = _taggedTemplateLiteralLoose(["\n\t.highlight {\n\t\tbackground: transparent;\n\t\tcolor: inherit;\n\t\tfont-weight: 600;\n\t\tpadding: 0;\n\t}\n"])));
58
+ var SuggestionItem = {
59
+ name: 'SuggestionItem',
60
+ props: {
61
+ currentValue: types.string,
62
+ suggestion: types.any
63
+ },
64
+ render: function render() {
65
+ var h = arguments[0];
66
+ var _this$suggestion = this.suggestion,
67
+ label = _this$suggestion.label,
68
+ value = _this$suggestion.value,
69
+ title = _this$suggestion.title,
70
+ description = _this$suggestion.description,
71
+ image = _this$suggestion.image,
72
+ isPredictiveSuggestion = _this$suggestion.isPredictiveSuggestion,
73
+ _suggestion_type = _this$suggestion._suggestion_type,
74
+ _category = _this$suggestion._category;
75
+
76
+ if (label) {
77
+ // label has highest precedence
78
+ return typeof label === 'string' ? h("div", {
79
+ "class": "trim"
80
+ }, [(_category ? false : isPredictiveSuggestion // eslint-disable-next-line
81
+ || !!_suggestion_type) ? h(PredictiveSuggestion, {
82
+ "domProps": {
83
+ "innerHTML": label
84
+ }
85
+ }) : h(Highlight, {
86
+ "attrs": {
87
+ "searchWords": _category ? [_category] : this.currentValue.split(' '),
88
+ "textToHighlight": label,
89
+ "autoEscape": true,
90
+ "highlightStyle": highlightStyle
91
+ }
92
+ })]) : label;
93
+ }
94
+
95
+ if (title || image || description) {
96
+ return h(Flex, {
97
+ "attrs": {
98
+ "alignItems": "center",
99
+ "css": {
100
+ width: '100%'
101
+ }
102
+ }
103
+ }, [image && h("div", {
104
+ "attrs": {
105
+ "css": {
106
+ margin: 'auto',
107
+ marginRight: 10
108
+ }
109
+ }
110
+ }, [h("img", {
111
+ "attrs": {
112
+ "src": image,
113
+ "alt": " ",
114
+ "height": "50px",
115
+ "width": "50px",
116
+ "css": {
117
+ objectFit: 'contain'
118
+ }
119
+ }
120
+ })]), h(Flex, {
121
+ "attrs": {
122
+ "direction": "column",
123
+ "css": {
124
+ width: image ? 'calc(100% - 60px)' : '100%'
125
+ }
126
+ }
127
+ }, [title && h("div", {
128
+ "class": "trim"
129
+ }, [h(Highlight, {
130
+ "attrs": {
131
+ "searchWords": this.currentValue.split(' '),
132
+ "textToHighlight": title,
133
+ "highlightStyle": highlightStyle
134
+ },
135
+ "class": css({
136
+ fontSize: '1rem'
137
+ })
138
+ })]), description && h("div", {
139
+ "class": cx('trim', css({
140
+ marginTop: 3
141
+ }))
142
+ }, [h(Highlight, {
143
+ "attrs": {
144
+ "searchWords": this.currentValue.split(' '),
145
+ "textToHighlight": description,
146
+ "highlightStyle": highlightStyle
147
+ }
148
+ })])])]);
149
+ }
150
+
151
+ return value;
152
+ }
153
+ };
154
+
155
+ var SearchSvg = {
156
+ name: 'SearchSvg',
157
+ props: ['styles'],
158
+ render: function render() {
159
+ var h = arguments[0];
160
+ return h("svg", {
161
+ "attrs": {
162
+ "alt": "Search",
163
+ "height": "12",
164
+ "xmlns": "http://www.w3.org/2000/svg",
165
+ "viewBox": "0 0 15 15"
166
+ },
167
+ "class": "search-icon",
168
+ "style": _extends({
169
+ transform: 'scale(1.35)',
170
+ position: 'relative'
171
+ }, this.$props.styles ? this.$props.styles : {})
172
+ }, [h("title", ["Search"]), h("path", {
173
+ "attrs": {
174
+ "d": 'M6.02945,10.20327a4.17382,4.17382,0,1,1,4.17382-4.17382A4.15609,4.15609,0,0,1,6.02945,10.20327Zm9.69195,4.2199L10.8989,9.59979A5.88021,5.88021,0,0,0,12.058,6.02856,6.00467,6.00467,0,1,0,9.59979,10.8989l4.82338,4.82338a.89729.89729,0,0,0,1.29912,0,.89749.89749,0,0,0-.00087-1.29909Z'
175
+ }
176
+ })]);
177
+ }
178
+ };
179
+
180
+ var _templateObject$3;
181
+
182
+ injectGlobal(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteralLoose(["\n\t#el_TvxDfTAtKp {\n\t\tstroke: none;\n\t\tstroke-width: 1;\n\t\tfill: none;\n\t}\n\t#el_D93PK3GbmJ {\n\t\t-webkit-transform: translate(163px, 131px);\n\t\ttransform: translate(163px, 131px);\n\t\tfill: #d8d8d8;\n\t}\n"])));
183
+ var MicSvg = {
184
+ name: 'MicSvg',
185
+ props: ['className'],
186
+ render: function render() {
187
+ var h = arguments[0];
188
+ return h("svg", {
189
+ "attrs": {
190
+ "viewBox": "0 0 480 480",
191
+ "xmlns": "http://www.w3.org/2000/svg",
192
+ "id": "el_xS0FRzQjJ",
193
+ "width": 28,
194
+ "height": 28,
195
+ "className": this.$props.className
196
+ },
197
+ "style": {
198
+ transform: 'scale(1.5)'
199
+ }
200
+ }, [h("g", {
201
+ "attrs": {
202
+ "id": "el_TvxDfTAtKp",
203
+ "fillRule": "evenodd"
204
+ }
205
+ }, [h("g", {
206
+ "attrs": {
207
+ "id": "el_D93PK3GbmJ",
208
+ "fillRule": "nonzero"
209
+ },
210
+ "style": {
211
+ fill: '#595959'
212
+ }
213
+ }, [h("path", {
214
+ "attrs": {
215
+ "d": "M142.731204,111 C137.280427,111 132.719573,114.852 131.82965,120.095 C127.268796,145.24 104.464526,164.5 76.9881611,164.5 C49.5117965,164.5 26.7075263,145.24 22.1466723,120.095 C21.2567496,114.852 16.6958955,111 11.2451187,111 C4.45945784,111 -0.880078594,116.778 0.121084488,123.198 C5.57186127,155.298 32.2695435,180.443 65.8641269,185.044 L65.8641269,207.3 C65.8641269,213.185 70.8699423,218 76.9881611,218 C83.10638,218 88.1121954,213.185 88.1121954,207.3 L88.1121954,185.044 C121.706779,180.443 148.404461,155.298 153.855238,123.198 C154.967641,116.778 149.516864,111 142.731204,111 Z",
216
+ "id": "el_uly3EwA2O3"
217
+ }
218
+ }), h("path", {
219
+ "attrs": {
220
+ "d": "M76.9864699,147.789474 C98.090352,147.789474 115.126016,131.286316 115.126016,110.842105 L115.126016,36.9473684 C115.126016,16.5031579 98.090352,-2.84217094e-14 76.9864699,-2.84217094e-14 C55.8825877,-2.84217094e-14 38.8469239,16.5031579 38.8469239,36.9473684 L38.8469239,110.842105 C38.8469239,131.286316 55.8825877,147.789474 76.9864699,147.789474 Z",
221
+ "id": "el_tnDbR4ytu4"
222
+ }
223
+ })])])]);
224
+ }
225
+ };
226
+
227
+ var _templateObject$4;
228
+
229
+ injectGlobal(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n\t#el_X81iT9kZYo {\n\t\tstroke: none;\n\t\tstroke-width: 1;\n\t\tfill: none;\n\t}\n\t#el_gMpyalCphp {\n\t\t-webkit-transform: translate(163px, 131px);\n\t\ttransform: translate(163px, 131px);\n\t}\n\t#el_c7H-3u-D4l {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_qhFcdAAFwo {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_M8X8g37WOI {\n\t\tstroke: #e83137;\n\t\tstroke-width: 21;\n\t}\n"])));
230
+ var MuteSvg = {
231
+ name: 'MuteSvg',
232
+ props: ['className'],
233
+ render: function render() {
234
+ var h = arguments[0];
235
+ return h("svg", {
236
+ "style": {
237
+ transform: 'scale(1.5)'
238
+ },
239
+ "attrs": {
240
+ "viewBox": "0 0 480 480",
241
+ "xmlns": "http://www.w3.org/2000/svg",
242
+ "id": "el_D1rEpH2zj",
243
+ "width": 28,
244
+ "height": 28,
245
+ "className": this.$props.className
246
+ }
247
+ }, [h("g", {
248
+ "attrs": {
249
+ "id": "el_X81iT9kZYo",
250
+ "fillRule": "evenodd"
251
+ }
252
+ }, [h("g", {
253
+ "attrs": {
254
+ "id": "el_gMpyalCphp"
255
+ }
256
+ }, [h("path", {
257
+ "attrs": {
258
+ "d": "M142.731204,111 C137.280427,111 132.719573,114.852 131.82965,120.095 C127.268796,145.24 104.464526,164.5 76.9881611,164.5 C49.5117965,164.5 26.7075263,145.24 22.1466723,120.095 C21.2567496,114.852 16.6958955,111 11.2451187,111 C4.45945784,111 -0.880078594,116.778 0.121084488,123.198 C5.57186127,155.298 32.2695435,180.443 65.8641269,185.044 L65.8641269,207.3 C65.8641269,213.185 70.8699423,218 76.9881611,218 C83.10638,218 88.1121954,213.185 88.1121954,207.3 L88.1121954,185.044 C121.706779,180.443 148.404461,155.298 153.855238,123.198 C154.967641,116.778 149.516864,111 142.731204,111 Z",
259
+ "id": "el_c7H-3u-D4l",
260
+ "fillRule": "nonzero"
261
+ },
262
+ "style": {
263
+ fill: '#595959'
264
+ }
265
+ }), h("path", {
266
+ "attrs": {
267
+ "d": "M76.9864699,147.789474 C98.090352,147.789474 115.126016,131.286316 115.126016,110.842105 L115.126016,36.9473684 C115.126016,16.5031579 98.090352,-2.84217094e-14 76.9864699,-2.84217094e-14 C55.8825877,-2.84217094e-14 38.8469239,16.5031579 38.8469239,36.9473684 L38.8469239,110.842105 C38.8469239,131.286316 55.8825877,147.789474 76.9864699,147.789474 Z",
268
+ "id": "el_qhFcdAAFwo",
269
+ "fillRule": "nonzero"
270
+ },
271
+ "style": {
272
+ fill: '#595959'
273
+ }
274
+ }), h("path", {
275
+ "attrs": {
276
+ "d": "M11.5,206.5 L142.5,12.5",
277
+ "id": "el_M8X8g37WOI",
278
+ "strokeLinecap": "round",
279
+ "strokeLinejoin": "round"
280
+ }
281
+ })])])]);
282
+ }
283
+ };
284
+
285
+ var _templateObject$5;
286
+
287
+ injectGlobal(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n\t@-webkit-keyframes kf_el_6WKby7wXqV_an_qqO-rxbNc {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t13.89% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_6WKby7wXqV_an_qqO-rxbNc {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t13.89% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_Wi-my975tM_an_XhXP1epXB {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t27.78% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_Wi-my975tM_an_XhXP1epXB {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t27.78% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_DkfFFTaFxy8_an_T2XxzvIaA {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t41.67% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_DkfFFTaFxy8_an_T2XxzvIaA {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t41.67% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_34IgwiMB5rf_an_TPom3H2LI {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t55.56% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_34IgwiMB5rf_an_TPom3H2LI {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t55.56% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_DeebuCsPTGA_an_aYTRBE7Na {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t69.44% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_DeebuCsPTGA_an_aYTRBE7Na {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t69.44% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_ZOjjrPTvyrv_an_l_BjBNzXw {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t83.33% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_ZOjjrPTvyrv_an_l_BjBNzXw {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t83.33% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@-webkit-keyframes kf_el_2FATegVmf0K_an_wLg4ofuFx {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t97.22% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t@keyframes kf_el_2FATegVmf0K_an_wLg4ofuFx {\n\t\t0% {\n\t\t\topacity: 0;\n\t\t}\n\t\t97.22% {\n\t\t\topacity: 1;\n\t\t}\n\t\t100% {\n\t\t\topacity: 1;\n\t\t}\n\t}\n\t#el_hiibMG0x- * {\n\t\t-webkit-animation-duration: 1.2s;\n\t\tanimation-duration: 1.2s;\n\t\t-webkit-animation-iteration-count: infinite;\n\t\tanimation-iteration-count: infinite;\n\t\t-webkit-animation-timing-function: cubic-bezier(0, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0, 0, 1, 1);\n\t}\n\t#el_QJeJ_2CDw5 {\n\t\tstroke: none;\n\t\tstroke-width: 1;\n\t\tfill: none;\n\t}\n\t#el_UYYCfubTRf {\n\t\t-webkit-transform: translate(163px, 123px);\n\t\ttransform: translate(163px, 123px);\n\t}\n\t#el_uzZNtK32Zi {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_EYKQ2N9Kgy {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_6SDP2LAgKC {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t}\n\t#el_-Vm65Ltfy7 {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_q04iZcSim4 {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_6WKby7wXqV {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_6WKby7wXqV_an_qqO-rxbNc;\n\t\tanimation-name: kf_el_6WKby7wXqV_an_qqO-rxbNc;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_9bggsfQOtU {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_NKxqi9eIym {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_Wi-my975tM {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_Wi-my975tM_an_XhXP1epXB;\n\t\tanimation-name: kf_el_Wi-my975tM_an_XhXP1epXB;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_zclQ34fvf7 {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_1OsvRT8HkeZ {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_DkfFFTaFxy8 {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_DkfFFTaFxy8_an_T2XxzvIaA;\n\t\tanimation-name: kf_el_DkfFFTaFxy8_an_T2XxzvIaA;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_aa9sjx4H0vA {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_tea114vWg0J {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_34IgwiMB5rf {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_34IgwiMB5rf_an_TPom3H2LI;\n\t\tanimation-name: kf_el_34IgwiMB5rf_an_TPom3H2LI;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_z5u6RAFhx7d {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_7nfuWmA5Uhy {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_DeebuCsPTGA {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_DeebuCsPTGA_an_aYTRBE7Na;\n\t\tanimation-name: kf_el_DeebuCsPTGA_an_aYTRBE7Na;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el__ZcqlS20zcw {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_8DnEQnD7VWV {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_ZOjjrPTvyrv {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_ZOjjrPTvyrv_an_l_BjBNzXw;\n\t\tanimation-name: kf_el_ZOjjrPTvyrv_an_l_BjBNzXw;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_FYYKCI_u24e {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_XZty4MnTp5Y {\n\t\tfill: #d8d8d8;\n\t}\n\t#el_2FATegVmf0K {\n\t\t-webkit-transform: translate(37.846924px, 0px);\n\t\ttransform: translate(37.846924px, 0px);\n\t\t-webkit-animation-fill-mode: backwards;\n\t\tanimation-fill-mode: backwards;\n\t\topacity: 0;\n\t\t-webkit-animation-name: kf_el_2FATegVmf0K_an_wLg4ofuFx;\n\t\tanimation-name: kf_el_2FATegVmf0K_an_wLg4ofuFx;\n\t\t-webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t\tanimation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n\t}\n\t#el_RMT1KUfbdF8 {\n\t\tfill: #0B6AFF;\n\t}\n\t#el_RgLcovvFiO1 {\n\t\tfill: #d8d8d8;\n\t}\n"])));
288
+ var ListenSvg = {
289
+ name: 'ListenSvg',
290
+ props: ['className'],
291
+ render: function render() {
292
+ var h = arguments[0];
293
+ return h("svg", {
294
+ "attrs": {
295
+ "viewBox": "0 0 480 480",
296
+ "xmlns": "http://www.w3.org/2000/svg",
297
+ "xmlnsXlink": "http://www.w3.org/1999/xlink",
298
+ "id": "el_hiibMG0x-",
299
+ "width": 28,
300
+ "height": 29,
301
+ "className": this.$props.className
302
+ },
303
+ "style": {
304
+ transform: 'scale(1.5)'
305
+ }
306
+ }, [h("defs", [h("path", {
307
+ "attrs": {
308
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
309
+ "id": "path-1"
310
+ }
311
+ }), h("path", {
312
+ "attrs": {
313
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
314
+ "id": "path-3"
315
+ }
316
+ }), h("path", {
317
+ "attrs": {
318
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
319
+ "id": "path-5"
320
+ }
321
+ }), h("path", {
322
+ "attrs": {
323
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
324
+ "id": "path-7"
325
+ }
326
+ }), h("path", {
327
+ "attrs": {
328
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
329
+ "id": "path-9"
330
+ }
331
+ }), h("path", {
332
+ "attrs": {
333
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
334
+ "id": "path-11"
335
+ }
336
+ }), h("path", {
337
+ "attrs": {
338
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
339
+ "id": "path-13"
340
+ }
341
+ }), h("path", {
342
+ "attrs": {
343
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
344
+ "id": "path-15"
345
+ }
346
+ })]), h("g", {
347
+ "attrs": {
348
+ "id": "el_QJeJ_2CDw5",
349
+ "fillRule": "evenodd"
350
+ }
351
+ }, [h("g", {
352
+ "attrs": {
353
+ "id": "el_UYYCfubTRf"
354
+ }
355
+ }, [h("path", {
356
+ "attrs": {
357
+ "d": "M142.731204,111 C137.280427,111 132.719573,114.852 131.82965,120.095 C127.268796,145.24 104.464526,164.5 76.9881611,164.5 C49.5117965,164.5 26.7075263,145.24 22.1466723,120.095 C21.2567496,114.852 16.6958955,111 11.2451187,111 C4.45945784,111 -0.880078594,116.778 0.121084488,123.198 C5.57186127,155.298 32.2695435,180.443 65.8641269,185.044 L65.8641269,207.3 C65.8641269,213.185 70.8699423,218 76.9881611,218 C83.10638,218 88.1121954,213.185 88.1121954,207.3 L88.1121954,185.044 C121.706779,180.443 148.404461,155.298 153.855238,123.198 C154.967641,116.778 149.516864,111 142.731204,111 Z",
358
+ "id": "el_uzZNtK32Zi",
359
+ "fillRule": "nonzero"
360
+ },
361
+ "style": {
362
+ fill: '#0B6AFF'
363
+ }
364
+ }), h("path", {
365
+ "attrs": {
366
+ "d": "M76.9864699,147.789474 C98.090352,147.789474 115.126016,131.286316 115.126016,110.842105 L115.126016,36.9473684 C115.126016,16.5031579 98.090352,0 76.9864699,0 C55.8825877,0 38.8469239,16.5031579 38.8469239,36.9473684 L38.8469239,110.842105 C38.8469239,131.286316 55.8825877,147.789474 76.9864699,147.789474 Z",
367
+ "id": "el_EYKQ2N9Kgy",
368
+ "fillRule": "nonzero"
369
+ }
370
+ }), h("g", {
371
+ "attrs": {
372
+ "id": "el_6SDP2LAgKC"
373
+ }
374
+ }, [h("mask", {
375
+ "attrs": {
376
+ "id": "mask-2",
377
+ "fill": "#fff"
378
+ }
379
+ }, [h("use", {
380
+ "attrs": {
381
+ "xlink:href": "#path-1"
382
+ }
383
+ })]), h("path", {
384
+ "attrs": {
385
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
386
+ "id": "el_-Vm65Ltfy7",
387
+ "fillRule": "nonzero",
388
+ "mask": "url(#mask-2)"
389
+ }
390
+ }), h("rect", {
391
+ "attrs": {
392
+ "id": "el_q04iZcSim4",
393
+ "mask": "url(#mask-2)",
394
+ "x": "0.279",
395
+ "width": "77",
396
+ "height": "130"
397
+ }
398
+ })]), h("g", {
399
+ "attrs": {
400
+ "id": "el_6WKby7wXqV"
401
+ }
402
+ }, [h("mask", {
403
+ "attrs": {
404
+ "id": "mask-4",
405
+ "fill": "#fff"
406
+ }
407
+ }, [h("use", {
408
+ "attrs": {
409
+ "xlink:href": "#path-3"
410
+ }
411
+ })]), h("path", {
412
+ "attrs": {
413
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
414
+ "id": "el_9bggsfQOtU",
415
+ "fillRule": "nonzero",
416
+ "mask": "url(#mask-4)"
417
+ }
418
+ }), h("rect", {
419
+ "attrs": {
420
+ "id": "el_NKxqi9eIym",
421
+ "mask": "url(#mask-4)",
422
+ "x": "0.279",
423
+ "width": "77",
424
+ "height": "115"
425
+ }
426
+ })]), h("g", {
427
+ "attrs": {
428
+ "id": "el_Wi-my975tM"
429
+ }
430
+ }, [h("mask", {
431
+ "attrs": {
432
+ "id": "mask-6",
433
+ "fill": "#fff"
434
+ }
435
+ }, [h("use", {
436
+ "attrs": {
437
+ "xlink:href": "#path-5"
438
+ }
439
+ })]), h("path", {
440
+ "attrs": {
441
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
442
+ "id": "el_zclQ34fvf7",
443
+ "fillRule": "nonzero",
444
+ "mask": "url(#mask-6)"
445
+ }
446
+ }), h("rect", {
447
+ "attrs": {
448
+ "id": "el_1OsvRT8HkeZ",
449
+ "mask": "url(#mask-6)",
450
+ "x": "0.279",
451
+ "width": "77",
452
+ "height": "100"
453
+ }
454
+ })]), h("g", {
455
+ "attrs": {
456
+ "id": "el_DkfFFTaFxy8"
457
+ }
458
+ }, [h("mask", {
459
+ "attrs": {
460
+ "id": "mask-8",
461
+ "fill": "#fff"
462
+ }
463
+ }, [h("use", {
464
+ "attrs": {
465
+ "xlink:href": "#path-7"
466
+ }
467
+ })]), h("path", {
468
+ "attrs": {
469
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
470
+ "id": "el_aa9sjx4H0vA",
471
+ "fillRule": "nonzero",
472
+ "mask": "url(#mask-8)"
473
+ }
474
+ }), h("rect", {
475
+ "attrs": {
476
+ "id": "el_tea114vWg0J",
477
+ "mask": "url(#mask-8)",
478
+ "x": "0.279",
479
+ "width": "77",
480
+ "height": "85"
481
+ }
482
+ })]), h("g", {
483
+ "attrs": {
484
+ "id": "el_34IgwiMB5rf"
485
+ }
486
+ }, [h("mask", {
487
+ "attrs": {
488
+ "id": "mask-10",
489
+ "fill": "#fff"
490
+ }
491
+ }, [h("use", {
492
+ "attrs": {
493
+ "xlink:href": "#path-9"
494
+ }
495
+ })]), h("path", {
496
+ "attrs": {
497
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
498
+ "id": "el_z5u6RAFhx7d",
499
+ "fillRule": "nonzero",
500
+ "mask": "url(#mask-10)"
501
+ }
502
+ }), h("rect", {
503
+ "attrs": {
504
+ "id": "el_7nfuWmA5Uhy",
505
+ "mask": "url(#mask-10)",
506
+ "x": "0.279",
507
+ "width": "77",
508
+ "height": "70"
509
+ }
510
+ })]), h("g", {
511
+ "attrs": {
512
+ "id": "el_DeebuCsPTGA"
513
+ }
514
+ }, [h("mask", {
515
+ "attrs": {
516
+ "id": "mask-12",
517
+ "fill": "#fff"
518
+ }
519
+ }, [h("use", {
520
+ "attrs": {
521
+ "xlink:href": "#path-11"
522
+ }
523
+ })]), h("path", {
524
+ "attrs": {
525
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
526
+ "id": "el__ZcqlS20zcw",
527
+ "fillRule": "nonzero",
528
+ "mask": "url(#mask-12)"
529
+ }
530
+ }), h("rect", {
531
+ "attrs": {
532
+ "id": "el_8DnEQnD7VWV",
533
+ "mask": "url(#mask-12)",
534
+ "x": "0.279",
535
+ "width": "77",
536
+ "height": "55"
537
+ }
538
+ })]), h("g", {
539
+ "attrs": {
540
+ "id": "el_ZOjjrPTvyrv"
541
+ }
542
+ }, [h("mask", {
543
+ "attrs": {
544
+ "id": "mask-14",
545
+ "fill": "#fff"
546
+ }
547
+ }, [h("use", {
548
+ "attrs": {
549
+ "xlink:href": "#path-13"
550
+ }
551
+ })]), h("path", {
552
+ "attrs": {
553
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
554
+ "id": "el_FYYKCI_u24e",
555
+ "fillRule": "nonzero",
556
+ "mask": "url(#mask-14)"
557
+ }
558
+ }), h("rect", {
559
+ "attrs": {
560
+ "id": "el_XZty4MnTp5Y",
561
+ "mask": "url(#mask-14)",
562
+ "x": "0.279",
563
+ "width": "77",
564
+ "height": "40"
565
+ }
566
+ })]), h("g", {
567
+ "attrs": {
568
+ "id": "el_2FATegVmf0K"
569
+ }
570
+ }, [h("mask", {
571
+ "attrs": {
572
+ "id": "mask-16",
573
+ "fill": "#fff"
574
+ }
575
+ }, [h("use", {
576
+ "attrs": {
577
+ "xlink:href": "#path-15"
578
+ }
579
+ })]), h("path", {
580
+ "attrs": {
581
+ "d": "M38.779092,147.789474 C60.0824253,147.789474 77.279092,131.286316 77.279092,110.842105 L77.279092,36.9473684 C77.279092,16.5031579 60.0824253,0 38.779092,0 C17.4757586,0 0.279091964,16.5031579 0.279091964,36.9473684 L0.279091964,110.842105 C0.279091964,131.286316 17.4757586,147.789474 38.779092,147.789474 Z",
582
+ "id": "el_RMT1KUfbdF8",
583
+ "fillRule": "nonzero",
584
+ "mask": "url(#mask-16)"
585
+ }
586
+ }), h("rect", {
587
+ "attrs": {
588
+ "id": "el_RgLcovvFiO1",
589
+ "mask": "url(#mask-16)",
590
+ "x": "0.279",
591
+ "width": "77",
592
+ "height": "25"
593
+ }
594
+ })])])])]);
595
+ }
596
+ };
597
+
598
+ var STATUS = {
599
+ inactive: 'INACTIVE',
600
+ stopped: 'STOPPED',
601
+ active: 'ACTIVE',
602
+ denied: 'DENIED'
603
+ };
604
+ var Mic = {
605
+ name: 'Mic',
606
+ props: {
607
+ children: types.title,
608
+ lang: VueTypes.string.def('en-US'),
609
+ iconPosition: VueTypes.string.def('left'),
610
+ handleResult: types.func,
611
+ onNoMatch: types.func,
612
+ onError: types.func,
613
+ getInstance: types.func,
614
+ render: types.func,
615
+ className: types.string,
616
+ applyClearStyle: VueTypes.bool,
617
+ showIcon: VueTypes.bool
618
+ },
619
+ methods: {
620
+ getComponent: function getComponent$1() {
621
+ var status = this.$data.status;
622
+ var data = {
623
+ handleClick: this.handleClick,
624
+ status: status
625
+ };
626
+ return getComponent(data, this);
627
+ },
628
+ stopMic: function stopMic() {
629
+ if (this.instance) {
630
+ this.status = STATUS.inactive;
631
+ this.instance.stop();
632
+ this.instance = null;
633
+ }
634
+ },
635
+ handleClick: function handleClick() {
636
+ var _this = this;
637
+
638
+ this.results = [];
639
+
640
+ if (window && window.SpeechRecognition) {
641
+ var status = this.$data.status;
642
+
643
+ if (status === STATUS.active) {
644
+ this.status = STATUS.inactive;
645
+ }
646
+
647
+ var _this$$props = this.$props,
648
+ handleResult = _this$$props.handleResult,
649
+ onNoMatch = _this$$props.onNoMatch,
650
+ onError = _this$$props.onError,
651
+ lang = _this$$props.lang,
652
+ getInstance = _this$$props.getInstance;
653
+ var _window = window,
654
+ SpeechRecognition = _window.SpeechRecognition;
655
+
656
+ if (this.instance && this.status !== STATUS.denied) {
657
+ this.status = STATUS.inactive;
658
+ this.instance.stop();
659
+ this.instance = null;
660
+ return;
661
+ }
662
+
663
+ this.instance = new SpeechRecognition();
664
+ this.instance.continuous = true;
665
+ this.instance.interimResults = true;
666
+ this.instance.lang = lang;
667
+
668
+ if (getInstance) {
669
+ getInstance(this.instance);
670
+ }
671
+
672
+ this.instance.start();
673
+
674
+ this.instance.onstart = function () {
675
+ _this.status = STATUS.active;
676
+ };
677
+
678
+ this.instance.onresult = function (_ref) {
679
+ var results = _ref.results,
680
+ timeStamp = _ref.timeStamp;
681
+
682
+ _this.stopMic();
683
+
684
+ if (handleResult) {
685
+ handleResult({
686
+ results: results,
687
+ timeStamp: timeStamp
688
+ });
689
+ }
690
+
691
+ _this.results.push({
692
+ results: results,
693
+ timeStamp: timeStamp
694
+ });
695
+ };
696
+
697
+ this.instance.onnomatch = function (e) {
698
+ return onNoMatch ? onNoMatch(e) : console.warn(e);
699
+ };
700
+
701
+ this.instance.onerror = function (e) {
702
+ if (e.error === 'no-speech' || e.error === 'audio-capture') {
703
+ _this.status = STATUS.inactive;
704
+ } else if (e.error === 'not-allowed') {
705
+ _this.status = STATUS.denied;
706
+ }
707
+
708
+ console.error(e);
709
+
710
+ if (onError) {
711
+ onError(e);
712
+ }
713
+ };
714
+ /* Below Two methods run when Continuous is False */
715
+
716
+
717
+ this.instance.onspeechend = function () {
718
+ _this.status = STATUS.inactive;
719
+ };
720
+
721
+ this.instance.onaudioend = function () {
722
+ _this.status = STATUS.inactive;
723
+ };
724
+ }
725
+ }
726
+ },
727
+ computed: {
728
+ hasCustomRenderer: function hasCustomRenderer$1() {
729
+ return hasCustomRenderer(this);
730
+ },
731
+ Icon: function Icon() {
732
+ var h = this.$createElement;
733
+ var status = this.$data.status;
734
+ var className = this.$props.className;
735
+
736
+ switch (status) {
737
+ case STATUS.active:
738
+ return h(ListenSvg, {
739
+ "attrs": {
740
+ "className": className
741
+ },
742
+ "nativeOn": {
743
+ "click": this.handleClick
744
+ }
745
+ });
746
+
747
+ case STATUS.stopped:
748
+ case STATUS.denied:
749
+ return h(MuteSvg, {
750
+ "attrs": {
751
+ "className": className
752
+ },
753
+ "nativeOn": {
754
+ "click": this.handleClick
755
+ }
756
+ });
757
+
758
+ default:
759
+ return h(MicSvg, {
760
+ "attrs": {
761
+ "className": className
762
+ },
763
+ "nativeOn": {
764
+ "click": this.handleClick
765
+ }
766
+ });
767
+ }
768
+ }
769
+ },
770
+ data: function data() {
771
+ return {
772
+ status: STATUS.inactive
773
+ };
774
+ },
775
+ created: function created() {
776
+ this.results = [];
777
+
778
+ if (typeof window !== 'undefined') {
779
+ window.SpeechRecognition = window.webkitSpeechRecognition || window.SpeechRecognition || null;
780
+
781
+ if (!window.SpeechRecognition) {
782
+ console.error('SpeechRecognition is not supported in this browser. Please check the browser compatibility at https://developer.mozilla.org/en-US/docs/Web/API/SpeechRecognition#Browser_compatibility.');
783
+ }
784
+ }
785
+ },
786
+ render: function render() {
787
+ var h = arguments[0];
788
+
789
+ if (this.hasCustomRenderer) {
790
+ return this.getComponent();
791
+ }
792
+
793
+ return h(IconWrapper, [this.Icon]);
794
+ }
795
+ };
796
+
797
+ var CustomSvg = {
798
+ name: 'CustomSvg',
799
+ props: {
800
+ className: String,
801
+ icon: Function,
802
+ type: String
803
+ },
804
+ data: function data() {
805
+ return {
806
+ customIcon: this.$props.icon && typeof this.$props.icon === 'function' ? this.$props.icon() : null
807
+ };
808
+ },
809
+ render: function render() {
810
+ var h = arguments[0];
811
+
812
+ if (this.customIcon) {
813
+ return h("div", {
814
+ "class": this.$props.className
815
+ }, [this.customIcon]);
816
+ }
817
+
818
+ if (this.$props.type === 'recent-search-icon') {
819
+ return h("svg", {
820
+ "attrs": {
821
+ "xmlns": "http://www.w3.org/2000/svg",
822
+ "alt": "Recent Search",
823
+ "height": "20",
824
+ "width": "20",
825
+ "viewBox": "0 0 24 24"
826
+ },
827
+ "style": {
828
+ fill: '#707070'
829
+ },
830
+ "class": this.$props.className
831
+ }, [h("path", {
832
+ "attrs": {
833
+ "d": "M0 0h24v24H0z",
834
+ "fill": "none"
835
+ }
836
+ }), h("path", {
837
+ "attrs": {
838
+ "d": "M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"
839
+ }
840
+ })]);
841
+ }
842
+
843
+ if (this.$props.type === 'promoted-search-icon') {
844
+ return h("svg", {
845
+ "attrs": {
846
+ "xmlns": "http://www.w3.org/2000/svg",
847
+ "width": "20",
848
+ "alt": "promoted search",
849
+ "height": "20",
850
+ "viewBox": "0 0 24 24"
851
+ },
852
+ "class": this.$props.className,
853
+ "style": {
854
+ fill: '#707070'
855
+ }
856
+ }, [h("path", {
857
+ "attrs": {
858
+ "d": "M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z"
859
+ }
860
+ })]);
861
+ }
862
+
863
+ if (this.$props.type === 'popular-search-icon') {
864
+ return h("svg", {
865
+ "attrs": {
866
+ "xmlns": "http://www.w3.org/2000/svg",
867
+ "alt": "Popular Search",
868
+ "height": "20",
869
+ "width": "20",
870
+ "viewBox": "0 0 24 24"
871
+ },
872
+ "style": {
873
+ fill: '#707070'
874
+ },
875
+ "class": this.$props.className
876
+ }, [h("path", {
877
+ "attrs": {
878
+ "d": "M0 0h24v24H0z",
879
+ "fill": "none"
880
+ }
881
+ }), h("path", {
882
+ "attrs": {
883
+ "d": "M16 6l2.29 2.29-4.88 4.88-4-4L2 16.59 3.41 18l6-6 4 4 6.3-6.29L22 12V6z"
884
+ }
885
+ })]);
886
+ }
887
+
888
+ return h(SearchSvg, {
889
+ "attrs": {
890
+ "styles": {
891
+ position: 'relative',
892
+ fill: '#707070',
893
+ left: '3px',
894
+ marginRight: '8px'
895
+ }
896
+ }
897
+ });
898
+ }
899
+ };
900
+
901
+ var updateQuery = Actions.updateQuery,
902
+ setQueryOptions = Actions.setQueryOptions,
903
+ setCustomQuery = Actions.setCustomQuery,
904
+ setDefaultQuery = Actions.setDefaultQuery,
905
+ setCustomHighlightOptions = Actions.setCustomHighlightOptions,
906
+ recordSuggestionClick = Actions.recordSuggestionClick,
907
+ loadPopularSuggestions = Actions.loadPopularSuggestions,
908
+ getRecentSearches = Actions.getRecentSearches;
909
+ var debounce = helper.debounce,
910
+ checkValueChange = helper.checkValueChange,
911
+ getClassName$1 = helper.getClassName,
912
+ getOptionsFromQuery = helper.getOptionsFromQuery,
913
+ isEqual = helper.isEqual,
914
+ getCompositeAggsQuery = helper.getCompositeAggsQuery,
915
+ withClickIds = helper.withClickIds,
916
+ getResultStats = helper.getResultStats,
917
+ handleOnSuggestions = helper.handleOnSuggestions,
918
+ getTopSuggestions = helper.getTopSuggestions,
919
+ normalizeDataField = helper.normalizeDataField;
920
+ var DataSearch = {
921
+ name: 'DataSearch',
922
+ data: function data() {
923
+ var props = this.$props;
924
+ this.__state = {
925
+ currentValue: '',
926
+ isOpen: false,
927
+ normalizedSuggestions: [],
928
+ isPending: false
929
+ };
930
+ this.internalComponent = props.componentId + "__internal";
931
+ return this.__state;
932
+ },
933
+ inject: {
934
+ theme: {
935
+ from: 'theme_reactivesearch'
936
+ }
937
+ },
938
+ created: function created() {
939
+ var _this$$props = this.$props,
940
+ enableQuerySuggestions = _this$$props.enableQuerySuggestions,
941
+ renderQuerySuggestions = _this$$props.renderQuerySuggestions,
942
+ enableRecentSearches = _this$$props.enableRecentSearches,
943
+ distinctField = _this$$props.distinctField,
944
+ distinctFieldConfig = _this$$props.distinctFieldConfig,
945
+ index = _this$$props.index; // TODO: Remove in 2.0
946
+
947
+ if (enableQuerySuggestions) {
948
+ console.warn('Warning(ReactiveSearch): The `enableQuerySuggestions` prop has been marked as deprecated, please use the `enablePopularSuggestions` prop instead.');
949
+ } // TODO: Remove in 2.0
950
+
951
+
952
+ if (renderQuerySuggestions) {
953
+ console.warn('Warning(ReactiveSearch): The `renderQuerySuggestions` prop has been marked as deprecated, please use the `renderPopularSuggestions` prop instead.');
954
+ }
955
+
956
+ if (this.enableAppbase && this.aggregationField && this.aggregationField !== '') {
957
+ console.warn('Warning(ReactiveSearch): The `aggregationField` prop has been marked as deprecated, please use the `distinctField` prop instead.');
958
+ }
959
+
960
+ if (!this.enableAppbase && (distinctField || distinctFieldConfig)) {
961
+ console.warn('Warning(ReactiveSearch): In order to use the `distinctField` and `distinctFieldConfig` props, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
962
+ }
963
+
964
+ if (!this.enableAppbase && index) {
965
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
966
+ }
967
+
968
+ this.loadPopularSuggestions(this.$props.componentId);
969
+ this.currentValue = this.selectedValue || '';
970
+
971
+ if (enableRecentSearches) {
972
+ this.getRecentSearches();
973
+ }
974
+
975
+ this.handleTextChange = debounce(this.handleText, this.$props.debounce); // Set custom and default queries in store
976
+
977
+ updateCustomQuery(this.componentId, this.setCustomQuery, this.$props, this.currentValue);
978
+ updateDefaultQuery(this.componentId, this.setDefaultQuery, this.$props, this.currentValue);
979
+ },
980
+ computed: {
981
+ suggestionsList: function suggestionsList() {
982
+ var suggestionsList = [];
983
+
984
+ if (!this.$data.currentValue && this.$props.defaultSuggestions && this.$props.defaultSuggestions.length) {
985
+ suggestionsList = this.$props.defaultSuggestions;
986
+ } else if (this.$data.currentValue) {
987
+ suggestionsList = this.normalizedSuggestions;
988
+ }
989
+
990
+ return withClickIds(suggestionsList);
991
+ },
992
+ topSuggestions: function topSuggestions() {
993
+ if (!this.currentValue) {
994
+ return [];
995
+ }
996
+
997
+ return this.enableQuerySuggestions || this.enablePopularSuggestions ? this.normalizedPopularSuggestions : [];
998
+ },
999
+ normalizedRecentSearches: function normalizedRecentSearches() {
1000
+ return this.recentSearches || [];
1001
+ },
1002
+ normalizedPopularSuggestions: function normalizedPopularSuggestions() {
1003
+ return getTopSuggestions( // use default popular suggestions if value is empty
1004
+ this.currentValue ? this.popularSuggestions : this.defaultPopularSuggestions || [], this.currentValue, this.showDistinctSuggestions);
1005
+ },
1006
+ defaultSearchSuggestions: function defaultSearchSuggestions() {
1007
+ var isPopularSuggestionsEnabled = this.enableQuerySuggestions || this.enablePopularSuggestions;
1008
+
1009
+ if (this.currentValue) {
1010
+ return [];
1011
+ }
1012
+
1013
+ var customDefaultPopularSuggestions = (this.defaultPopularSuggestions || []).map(function (suggestion) {
1014
+ return _extends({}, suggestion, {
1015
+ _popular_suggestion: true
1016
+ });
1017
+ });
1018
+ var customNormalizedRecentSearches = (this.normalizedRecentSearches || []).map(function (search) {
1019
+ return _extends({}, search, {
1020
+ _recent_search: true
1021
+ });
1022
+ });
1023
+ var defaultSuggestions = isPopularSuggestionsEnabled ? [].concat(customNormalizedRecentSearches, customDefaultPopularSuggestions || []) : customNormalizedRecentSearches;
1024
+ return getTopSuggestions( // use default popular suggestions if value is empty
1025
+ defaultSuggestions, this.currentValue, this.showDistinctSuggestions);
1026
+ },
1027
+ hasCustomRenderer: function hasCustomRenderer$1() {
1028
+ return hasCustomRenderer(this);
1029
+ },
1030
+ stats: function stats() {
1031
+ return getResultStats(this);
1032
+ }
1033
+ },
1034
+ props: {
1035
+ options: types.options,
1036
+ autoFocus: VueTypes.bool,
1037
+ autosuggest: VueTypes.bool.def(true),
1038
+ beforeValueChange: types.func,
1039
+ className: VueTypes.string.def(''),
1040
+ clearIcon: types.children,
1041
+ componentId: types.stringRequired,
1042
+ customHighlight: types.func,
1043
+ customQuery: types.func,
1044
+ defaultQuery: types.func,
1045
+ dataField: VueTypes.oneOfType([VueTypes.string, VueTypes.shape({
1046
+ field: VueTypes.string,
1047
+ weight: VueTypes.number
1048
+ }), VueTypes.arrayOf(VueTypes.string), VueTypes.arrayOf({
1049
+ field: VueTypes.string,
1050
+ weight: VueTypes.number
1051
+ })]),
1052
+ aggregationField: types.string,
1053
+ aggregationSize: VueTypes.number,
1054
+ size: VueTypes.number,
1055
+ debounce: VueTypes.number.def(0),
1056
+ defaultValue: types.string,
1057
+ excludeFields: types.excludeFields,
1058
+ value: types.value,
1059
+ defaultSuggestions: types.suggestions,
1060
+ enableSynonyms: VueTypes.bool.def(true),
1061
+ enableQuerySuggestions: VueTypes.bool.def(false),
1062
+ enablePopularSuggestions: VueTypes.bool.def(false),
1063
+ enableRecentSearches: VueTypes.bool.def(false),
1064
+ fieldWeights: types.fieldWeights,
1065
+ filterLabel: types.string,
1066
+ fuzziness: types.fuzziness,
1067
+ highlight: VueTypes.bool,
1068
+ highlightField: types.stringOrArray,
1069
+ icon: types.children,
1070
+ iconPosition: VueTypes.oneOf(['left', 'right']).def('left'),
1071
+ includeFields: types.includeFields,
1072
+ innerClass: types.style,
1073
+ innerRef: VueTypes.string.def('searchInputField'),
1074
+ render: types.func,
1075
+ renderQuerySuggestions: types.func,
1076
+ renderPopularSuggestions: types.func,
1077
+ parseSuggestion: types.func,
1078
+ renderNoSuggestion: types.title,
1079
+ renderError: types.title,
1080
+ placeholder: VueTypes.string.def('Search'),
1081
+ queryFormat: VueTypes.oneOf(['and', 'or']).def('or'),
1082
+ react: types.react,
1083
+ showClear: VueTypes.bool.def(true),
1084
+ showDistinctSuggestions: VueTypes.bool.def(true),
1085
+ showFilter: VueTypes.bool.def(true),
1086
+ showIcon: VueTypes.bool.def(true),
1087
+ title: types.title,
1088
+ theme: types.style,
1089
+ URLParams: VueTypes.bool.def(false),
1090
+ strictSelection: VueTypes.bool.def(false),
1091
+ nestedField: types.string,
1092
+ enablePredictiveSuggestions: VueTypes.bool.def(false),
1093
+ recentSearchesIcon: VueTypes.any,
1094
+ popularSearchesIcon: VueTypes.any,
1095
+ // mic props
1096
+ showVoiceSearch: VueTypes.bool.def(false),
1097
+ getMicInstance: types.func,
1098
+ renderMic: types.func,
1099
+ distinctField: types.string,
1100
+ distinctFieldConfig: types.props,
1101
+ //
1102
+ focusShortcuts: VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, VueTypes.number])).def(['/']),
1103
+ addonBefore: VueTypes.any,
1104
+ addonAfter: VueTypes.any,
1105
+ expandSuggestionsContainer: VueTypes.bool.def(true),
1106
+ index: VueTypes.string
1107
+ },
1108
+ beforeMount: function beforeMount() {
1109
+ if (this.$props.highlight) {
1110
+ if (this.customHighlight && typeof this.customHighlight === 'function') {
1111
+ this.setCustomHighlightOptions(this.componentId, this.customHighlight(this.$props));
1112
+ }
1113
+
1114
+ var queryOptions = DataSearch.highlightQuery(this.$props) || {};
1115
+ this.queryOptions = _extends({}, queryOptions, this.getBasicQueryOptions());
1116
+ this.setQueryOptions(this.$props.componentId, this.queryOptions);
1117
+ } else {
1118
+ this.queryOptions = this.getBasicQueryOptions();
1119
+ this.setQueryOptions(this.$props.componentId, this.queryOptions);
1120
+ }
1121
+
1122
+ if (this.selectedValue) {
1123
+ this.setValue(this.selectedValue, true);
1124
+ } else if (this.$props.value) {
1125
+ this.setValue(this.$props.value, true);
1126
+ } else if (this.$props.defaultValue) {
1127
+ this.setValue(this.$props.defaultValue, true);
1128
+ }
1129
+ },
1130
+ mounted: function mounted() {
1131
+ this.listenForFocusShortcuts();
1132
+ },
1133
+ watch: {
1134
+ highlight: function highlight() {
1135
+ this.updateQueryOptions();
1136
+ },
1137
+ dataField: function dataField() {
1138
+ this.updateQueryOptions();
1139
+ this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1140
+ },
1141
+ highlightField: function highlightField() {
1142
+ this.updateQueryOptions();
1143
+ },
1144
+ fieldWeights: function fieldWeights() {
1145
+ this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1146
+ },
1147
+ fuzziness: function fuzziness() {
1148
+ this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1149
+ },
1150
+ queryFormat: function queryFormat() {
1151
+ this.updateQueryHandler(this.$props.componentId, this.$data.currentValue, this.$props);
1152
+ },
1153
+ defaultValue: function defaultValue(newVal) {
1154
+ this.setValue(newVal, true, this.$props);
1155
+ },
1156
+ value: function value(newVal, oldVal) {
1157
+ if (!isEqual(newVal, oldVal)) {
1158
+ this.setValue(newVal, true, this.$props, undefined, false);
1159
+ }
1160
+ },
1161
+ defaultQuery: function defaultQuery(newVal, oldVal) {
1162
+ if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
1163
+ this.updateDefaultQueryHandler(this.$data.currentValue, this.$props);
1164
+ }
1165
+ },
1166
+ customQuery: function customQuery(newVal, oldVal) {
1167
+ if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
1168
+ this.updateQueryHandler(this.componentId, this.$data.currentValue, this.$props);
1169
+ }
1170
+ },
1171
+ suggestions: function suggestions(newVal) {
1172
+ if (Array.isArray(newVal) && this.$data.currentValue.trim().length) {
1173
+ // shallow check allows us to set suggestions even if the next set
1174
+ // of suggestions are same as the current one
1175
+ this.$emit('suggestions', newVal);
1176
+ this.normalizedSuggestions = this.onSuggestions(newVal);
1177
+ }
1178
+ },
1179
+ selectedValue: function selectedValue(newVal, oldVal) {
1180
+ if (oldVal !== newVal && this.$data.currentValue !== newVal) {
1181
+ if (!newVal && this.$data.currentValue) {
1182
+ // selected value is cleared, call onValueSelected
1183
+ this.onValueSelectedHandler('', causes.CLEAR_VALUE);
1184
+ }
1185
+
1186
+ this.setValue(newVal || '', true, this.$props);
1187
+ }
1188
+ },
1189
+ focusShortcuts: function focusShortcuts() {
1190
+ this.listenForFocusShortcuts();
1191
+ }
1192
+ },
1193
+ methods: {
1194
+ handleText: function handleText(value) {
1195
+ if (this.$props.autosuggest) {
1196
+ this.updateDefaultQueryHandler(value, this.$props);
1197
+ } else {
1198
+ this.updateQueryHandler(this.$props.componentId, value, this.$props);
1199
+ }
1200
+ },
1201
+ validateDataField: function validateDataField() {
1202
+ var propName = 'dataField';
1203
+ var componentName = DataSearch.name;
1204
+ var props = this.$props;
1205
+ var requiredError = propName + " supplied to " + componentName + " is required. Validation failed.";
1206
+ var propValue = props[propName];
1207
+
1208
+ if (!this.enableAppbase) {
1209
+ if (!propValue) {
1210
+ console.error(requiredError);
1211
+ return;
1212
+ }
1213
+
1214
+ if (typeof propValue !== 'string' && typeof propValue !== 'object' && !Array.isArray(propValue)) {
1215
+ console.error("Invalid " + propName + " supplied to " + componentName + ". Validation failed.");
1216
+ return;
1217
+ }
1218
+
1219
+ if (Array.isArray(propValue) && propValue.length === 0) {
1220
+ console.error(requiredError);
1221
+ }
1222
+ }
1223
+ },
1224
+ updateQueryOptions: function updateQueryOptions() {
1225
+ if (this.customHighlight && typeof this.customHighlight === 'function') {
1226
+ this.setCustomHighlightOptions(this.componentId, this.customHighlight(this.$props));
1227
+ }
1228
+
1229
+ var queryOptions = DataSearch.highlightQuery(this.$props) || {};
1230
+ this.queryOptions = _extends({}, queryOptions, this.getBasicQueryOptions());
1231
+ this.setQueryOptions(this.$props.componentId, this.queryOptions);
1232
+ },
1233
+ getComponent: function getComponent$1(downshiftProps, isQuerySuggestionsRender) {
1234
+ if (downshiftProps === void 0) {
1235
+ downshiftProps = {};
1236
+ }
1237
+
1238
+ if (isQuerySuggestionsRender === void 0) {
1239
+ isQuerySuggestionsRender = false;
1240
+ }
1241
+
1242
+ var currentValue = this.$data.currentValue;
1243
+ var data = {
1244
+ error: this.error,
1245
+ loading: this.isLoading,
1246
+ downshiftProps: downshiftProps,
1247
+ data: this.suggestionsList,
1248
+ promotedData: this.promotedResults,
1249
+ aggregationData: this.aggregationData,
1250
+ rawData: this.rawData,
1251
+ customData: this.customData,
1252
+ value: currentValue,
1253
+ triggerClickAnalytics: this.triggerClickAnalytics,
1254
+ resultStats: this.stats,
1255
+ querySuggestions: this.normalizedPopularSuggestions,
1256
+ popularSuggestions: this.normalizedPopularSuggestions
1257
+ };
1258
+
1259
+ if (isQuerySuggestionsRender) {
1260
+ return getQuerySuggestionsComponent({
1261
+ downshiftProps: downshiftProps,
1262
+ data: this.normalizedPopularSuggestions,
1263
+ value: currentValue,
1264
+ loading: this.isLoading,
1265
+ error: this.error
1266
+ }, this);
1267
+ }
1268
+
1269
+ return getComponent(data, this);
1270
+ },
1271
+ // returns size and aggs property
1272
+ getBasicQueryOptions: function getBasicQueryOptions() {
1273
+ var aggregationField = this.$props.aggregationField;
1274
+ var queryOptions = getQueryOptions(this.$props);
1275
+
1276
+ if (aggregationField) {
1277
+ queryOptions.aggs = getCompositeAggsQuery({
1278
+ props: this.$props,
1279
+ showTopHits: true
1280
+ }).aggs;
1281
+ }
1282
+
1283
+ return queryOptions;
1284
+ },
1285
+ onSuggestions: function onSuggestions(results) {
1286
+ return handleOnSuggestions(results, this.$data.currentValue, this);
1287
+ },
1288
+ handleSearchIconClick: function handleSearchIconClick() {
1289
+ var currentValue = this.currentValue;
1290
+
1291
+ if (currentValue.trim()) {
1292
+ this.isPending = false;
1293
+ this.setValue(currentValue, true);
1294
+ this.onValueSelectedHandler(currentValue, causes.SEARCH_ICON_CLICK);
1295
+ }
1296
+ },
1297
+ setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen) {
1298
+ var _this = this;
1299
+
1300
+ if (isDefaultValue === void 0) {
1301
+ isDefaultValue = false;
1302
+ }
1303
+
1304
+ if (props === void 0) {
1305
+ props = this.$props;
1306
+ }
1307
+
1308
+ if (toggleIsOpen === void 0) {
1309
+ toggleIsOpen = true;
1310
+ }
1311
+
1312
+ var performUpdate = function performUpdate() {
1313
+ // Refresh recent searches when value becomes empty
1314
+ if (!value && _this.currentValue && _this.enableRecentSearches) {
1315
+ _this.getRecentSearches();
1316
+ }
1317
+
1318
+ _this.currentValue = value;
1319
+
1320
+ if (isDefaultValue) {
1321
+ if (_this.$props.autosuggest) {
1322
+ if (toggleIsOpen) {
1323
+ _this.isOpen = false;
1324
+ }
1325
+
1326
+ _this.updateDefaultQueryHandler(value, _this.$props);
1327
+ } // in case of strict selection only SUGGESTION_SELECT should be able
1328
+ // to set the query otherwise the value should reset
1329
+
1330
+
1331
+ if (props.strictSelection) {
1332
+ if (cause === causes.SUGGESTION_SELECT || value === '') {
1333
+ _this.updateQueryHandler(props.componentId, value, props);
1334
+ } else {
1335
+ _this.setValue('', true);
1336
+ }
1337
+ } else {
1338
+ _this.updateQueryHandler(props.componentId, value, props);
1339
+ }
1340
+ } else {
1341
+ // debounce for handling text while typing
1342
+ _this.handleTextChange(value);
1343
+ }
1344
+
1345
+ _this.$emit('valueChange', value);
1346
+
1347
+ _this.$emit('value-change', value); // Set the already fetched suggestions if query is same as used last to fetch the hits
1348
+
1349
+
1350
+ if (value === _this.lastUsedQuery) {
1351
+ _this.suggestions = _this.onSuggestions(_this.suggestions); // invoke on suggestions
1352
+
1353
+ _this.$emit('suggestions', _this.suggestions);
1354
+ } else if (!value) {
1355
+ // reset suggestions
1356
+ _this.suggestions = []; // invoke on suggestions
1357
+
1358
+ _this.$emit('suggestions', _this.suggestions);
1359
+ }
1360
+ };
1361
+
1362
+ checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1363
+ },
1364
+ updateDefaultQueryHandler: function updateDefaultQueryHandler(value, props) {
1365
+ var defaultQueryOptions;
1366
+ var query = DataSearch.defaultQuery(value, props);
1367
+
1368
+ if (this.defaultQuery) {
1369
+ var defaultQueryToBeSet = this.defaultQuery(value, props) || {};
1370
+
1371
+ if (defaultQueryToBeSet.query) {
1372
+ query = defaultQueryToBeSet.query;
1373
+ }
1374
+
1375
+ defaultQueryOptions = getOptionsFromQuery(defaultQueryToBeSet); // Update calculated default query in store
1376
+
1377
+ updateDefaultQuery(props.componentId, this.setDefaultQuery, props, value);
1378
+ }
1379
+
1380
+ this.setQueryOptions(this.internalComponent, _extends({}, this.queryOptions, defaultQueryOptions), false);
1381
+ this.updateQuery({
1382
+ componentId: this.internalComponent,
1383
+ query: query,
1384
+ value: value,
1385
+ componentType: componentTypes.dataSearch
1386
+ });
1387
+ },
1388
+ updateQueryHandler: function updateQueryHandler(componentId, value, props) {
1389
+ var customQuery = props.customQuery,
1390
+ filterLabel = props.filterLabel,
1391
+ showFilter = props.showFilter,
1392
+ URLParams = props.URLParams;
1393
+ var customQueryOptions;
1394
+ var defaultQueryTobeSet = DataSearch.defaultQuery(value, props);
1395
+ var query = defaultQueryTobeSet;
1396
+
1397
+ if (customQuery) {
1398
+ var customQueryTobeSet = customQuery(value, props);
1399
+ var queryTobeSet = customQueryTobeSet.query;
1400
+
1401
+ if (queryTobeSet) {
1402
+ query = queryTobeSet;
1403
+ }
1404
+
1405
+ customQueryOptions = getOptionsFromQuery(customQueryTobeSet);
1406
+ updateCustomQuery(props.componentId, this.setCustomQuery, props, value);
1407
+ this.setQueryOptions(componentId, _extends({}, this.queryOptions, customQueryOptions), false);
1408
+ }
1409
+
1410
+ if (!this.isPending) {
1411
+ this.updateQuery({
1412
+ componentId: componentId,
1413
+ query: query,
1414
+ value: value,
1415
+ label: filterLabel,
1416
+ showFilter: showFilter,
1417
+ URLParams: URLParams,
1418
+ componentType: 'DATASEARCH'
1419
+ });
1420
+ }
1421
+ },
1422
+ // need to review
1423
+ handleFocus: function handleFocus(event) {
1424
+ this.isOpen = true;
1425
+ this.$emit('focus', event);
1426
+ },
1427
+ handleVoiceResults: function handleVoiceResults(_ref) {
1428
+ var results = _ref.results;
1429
+
1430
+ if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
1431
+ this.isPending = false;
1432
+ this.setValue(results[0][0].transcript.trim(), true);
1433
+ }
1434
+ },
1435
+ triggerQuery: function triggerQuery(_temp) {
1436
+ var _ref2 = _temp === void 0 ? false : _temp,
1437
+ _ref2$isOpen = _ref2.isOpen,
1438
+ isOpen = _ref2$isOpen === void 0 ? false : _ref2$isOpen;
1439
+
1440
+ var value = this.$props.value;
1441
+
1442
+ if (value !== undefined) {
1443
+ this.isPending = false;
1444
+ this.setValue(this.$props.value, !isOpen);
1445
+ }
1446
+ },
1447
+ triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
1448
+ // click analytics would only work client side and after javascript loads
1449
+ var docId = documentId;
1450
+
1451
+ if (!docId) {
1452
+ var hitData = this.suggestionsList.find(function (hit) {
1453
+ return hit._click_id === searchPosition;
1454
+ });
1455
+
1456
+ if (hitData && hitData.source && hitData.source._id) {
1457
+ docId = hitData.source._id;
1458
+ }
1459
+ }
1460
+
1461
+ this.recordSuggestionClick(searchPosition, docId);
1462
+ },
1463
+ clearValue: function clearValue() {
1464
+ this.isPending = false;
1465
+ this.setValue('', true);
1466
+ this.onValueSelectedHandler('', causes.CLEAR_VALUE);
1467
+ },
1468
+ handleKeyDown: function handleKeyDown(event, highlightedIndex) {
1469
+ var value = this.$props.value;
1470
+
1471
+ if (value !== undefined) {
1472
+ this.isPending = true;
1473
+ } // if a suggestion was selected, delegate the handling to suggestion handler
1474
+
1475
+
1476
+ if (event.key === 'Enter' && highlightedIndex === null) {
1477
+ this.setValue(event.target.value, true);
1478
+ this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
1479
+ } // Need to review
1480
+
1481
+
1482
+ this.$emit('keyDown', event, this.triggerQuery);
1483
+ this.$emit('key-down', event, this.triggerQuery);
1484
+ },
1485
+ onInputChange: function onInputChange(e) {
1486
+ var inputValue = e.target.value;
1487
+
1488
+ if (!this.$data.isOpen) {
1489
+ this.isOpen = true;
1490
+ }
1491
+
1492
+ var value = this.$props.value;
1493
+
1494
+ if (value === undefined) {
1495
+ this.setValue(inputValue);
1496
+ } else {
1497
+ this.isPending = true;
1498
+ this.$emit('change', inputValue, this.triggerQuery, e);
1499
+ }
1500
+ },
1501
+ onSuggestionSelected: function onSuggestionSelected(suggestion) {
1502
+ var value = this.$props.value; // Record analytics for selected suggestions
1503
+
1504
+ this.triggerClickAnalytics(suggestion._click_id);
1505
+
1506
+ if (value === undefined) {
1507
+ this.setValue(suggestion.value, true, this.$props, causes.SUGGESTION_SELECT);
1508
+ } else {
1509
+ this.isPending = false;
1510
+ this.$emit('change', suggestion.value, this.triggerQuery);
1511
+ }
1512
+
1513
+ this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT, suggestion.source);
1514
+ },
1515
+ onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
1516
+ if (currentValue === void 0) {
1517
+ currentValue = this.$data.currentValue;
1518
+ }
1519
+
1520
+ for (var _len = arguments.length, cause = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1521
+ cause[_key - 1] = arguments[_key];
1522
+ }
1523
+
1524
+ this.$emit.apply(this, ['valueSelected', currentValue].concat(cause));
1525
+ this.$emit.apply(this, ['value-selected', currentValue].concat(cause));
1526
+ },
1527
+ handleStateChange: function handleStateChange(changes) {
1528
+ var isOpen = changes.isOpen;
1529
+ this.isOpen = isOpen;
1530
+ },
1531
+ getBackgroundColor: function getBackgroundColor(highlightedIndex, index) {
1532
+ var isDark = this.themePreset === 'dark';
1533
+
1534
+ if (isDark) {
1535
+ return highlightedIndex === index ? '#555' : '#424242';
1536
+ }
1537
+
1538
+ return highlightedIndex === index ? '#eee' : '#fff';
1539
+ },
1540
+ renderIcon: function renderIcon() {
1541
+ var h = this.$createElement;
1542
+
1543
+ if (this.$props.showIcon) {
1544
+ return this.$props.icon || h(SearchSvg);
1545
+ }
1546
+
1547
+ return null;
1548
+ },
1549
+ renderErrorComponent: function renderErrorComponent() {
1550
+ var h = this.$createElement;
1551
+ var renderError = this.$scopedSlots.renderError || this.$props.renderError;
1552
+
1553
+ if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
1554
+ return h(SuggestionWrapper, {
1555
+ "attrs": {
1556
+ "innerClass": this.$props.innerClass,
1557
+ "innerClassName": "error",
1558
+ "theme": this.theme,
1559
+ "themePreset": this.themePreset
1560
+ }
1561
+ }, [isFunction(renderError) ? renderError(this.error) : renderError]);
1562
+ }
1563
+
1564
+ return null;
1565
+ },
1566
+ renderCancelIcon: function renderCancelIcon() {
1567
+ var h = this.$createElement;
1568
+
1569
+ if (this.$props.showClear) {
1570
+ return this.$props.clearIcon || h(CancelSvg);
1571
+ }
1572
+
1573
+ return null;
1574
+ },
1575
+ renderNoSuggestions: function renderNoSuggestions(finalSuggestionsList) {
1576
+ if (finalSuggestionsList === void 0) {
1577
+ finalSuggestionsList = [];
1578
+ }
1579
+
1580
+ var h = this.$createElement;
1581
+ var _this$$props2 = this.$props,
1582
+ theme = _this$$props2.theme,
1583
+ innerClass = _this$$props2.innerClass;
1584
+ var renderNoSuggestion = this.$scopedSlots.renderNoSuggestion || this.$props.renderNoSuggestion;
1585
+ var renderError = this.$scopedSlots.renderError || this.$props.renderError;
1586
+ var _this$$data = this.$data,
1587
+ isOpen = _this$$data.isOpen,
1588
+ currentValue = _this$$data.currentValue;
1589
+
1590
+ if (renderNoSuggestion && isOpen && !finalSuggestionsList.length && !this.isLoading && currentValue && !(renderError && this.error)) {
1591
+ return h(SuggestionWrapper, {
1592
+ "attrs": {
1593
+ "innerClass": innerClass,
1594
+ "themePreset": this.themePreset,
1595
+ "theme": theme,
1596
+ "innerClassName": "noSuggestion"
1597
+ },
1598
+ "scopedSlots": {
1599
+ "default": function _default() {
1600
+ return typeof renderNoSuggestion === 'function' ? renderNoSuggestion(currentValue) : renderNoSuggestion;
1601
+ }
1602
+ }
1603
+ });
1604
+ }
1605
+
1606
+ return null;
1607
+ },
1608
+ renderInputAddonBefore: function renderInputAddonBefore() {
1609
+ var h = this.$createElement;
1610
+ var addonBefore = this.$scopedSlots.addonBefore;
1611
+
1612
+ if (addonBefore) {
1613
+ return h(InputAddon, [addonBefore()]);
1614
+ }
1615
+
1616
+ return null;
1617
+ },
1618
+ renderInputAddonAfter: function renderInputAddonAfter() {
1619
+ var h = this.$createElement;
1620
+ var addonAfter = this.$scopedSlots.addonAfter;
1621
+
1622
+ if (addonAfter) {
1623
+ return h(InputAddon, [addonAfter()]);
1624
+ }
1625
+
1626
+ return null;
1627
+ },
1628
+ renderIcons: function renderIcons() {
1629
+ var h = this.$createElement;
1630
+ var _this$$props3 = this.$props,
1631
+ iconPosition = _this$$props3.iconPosition,
1632
+ showClear = _this$$props3.showClear,
1633
+ innerClass = _this$$props3.innerClass,
1634
+ getMicInstance = _this$$props3.getMicInstance,
1635
+ showVoiceSearch = _this$$props3.showVoiceSearch,
1636
+ showIcon = _this$$props3.showIcon;
1637
+ var renderMic = this.$scopedSlots.renderMic || this.$props.renderMic;
1638
+ var currentValue = this.$data.currentValue;
1639
+ return h("div", [h(IconGroup, {
1640
+ "attrs": {
1641
+ "groupPosition": "right",
1642
+ "positionType": "absolute"
1643
+ }
1644
+ }, [currentValue && showClear && h(IconWrapper, {
1645
+ "on": {
1646
+ "click": this.clearValue
1647
+ },
1648
+ "attrs": {
1649
+ "showIcon": showIcon,
1650
+ "isClearIcon": true
1651
+ }
1652
+ }, [this.renderCancelIcon()]), showVoiceSearch && h(Mic, {
1653
+ "attrs": {
1654
+ "getInstance": getMicInstance,
1655
+ "render": renderMic,
1656
+ "handleResult": this.handleVoiceResults,
1657
+ "className": getClassName$1(innerClass, 'mic') || null
1658
+ }
1659
+ }), iconPosition === 'right' && showIcon && h(IconWrapper, {
1660
+ "on": {
1661
+ "click": this.handleSearchIconClick
1662
+ }
1663
+ }, [this.renderIcon()])]), h(IconGroup, {
1664
+ "attrs": {
1665
+ "groupPosition": "left",
1666
+ "positionType": "absolute"
1667
+ }
1668
+ }, [iconPosition === 'left' && showIcon && h(IconWrapper, {
1669
+ "on": {
1670
+ "click": this.handleSearchIconClick
1671
+ }
1672
+ }, [this.renderIcon()])])]);
1673
+ },
1674
+ focusSearchBox: function focusSearchBox(event) {
1675
+ var _this$$refs, _this$$refs$this$$pro;
1676
+
1677
+ var elt = event.target || event.srcElement;
1678
+ var tagName = elt.tagName;
1679
+
1680
+ if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
1681
+ // already in an input
1682
+ return;
1683
+ }
1684
+
1685
+ (_this$$refs = this.$refs) == null ? void 0 : (_this$$refs$this$$pro = _this$$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.focus(); // eslint-disable-line
1686
+ },
1687
+ listenForFocusShortcuts: function listenForFocusShortcuts() {
1688
+ var _this2 = this;
1689
+
1690
+ var _this$$props$focusSho = this.$props.focusShortcuts,
1691
+ focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
1692
+
1693
+ if (isEmpty(focusShortcuts)) {
1694
+ return;
1695
+ }
1696
+
1697
+ var shortcutsString = parseFocusShortcuts(focusShortcuts).join(','); // handler for alphabets and other key combinations
1698
+
1699
+ hotkeys(shortcutsString, // eslint-disable-next-line no-unused-vars
1700
+
1701
+ /* eslint-disable no-shadow */
1702
+ function (event, handler) {
1703
+ // Prevent the default refresh event under WINDOWS system
1704
+ event.preventDefault();
1705
+
1706
+ _this2.focusSearchBox(event);
1707
+ }); // if one of modifier keys are used, they are handled below
1708
+
1709
+ hotkeys('*', function (event) {
1710
+ var modifierKeys = extractModifierKeysFromFocusShortcuts(focusShortcuts);
1711
+ if (modifierKeys.length === 0) return;
1712
+
1713
+ for (var index = 0; index < modifierKeys.length; index += 1) {
1714
+ var element = modifierKeys[index];
1715
+
1716
+ if (hotkeys[element]) {
1717
+ _this2.focusSearchBox(event);
1718
+
1719
+ break;
1720
+ }
1721
+ }
1722
+ });
1723
+ }
1724
+ },
1725
+ render: function render() {
1726
+ var _this3 = this;
1727
+
1728
+ var h = arguments[0];
1729
+ var _this$$props4 = this.$props,
1730
+ theme = _this$$props4.theme,
1731
+ size = _this$$props4.size,
1732
+ expandSuggestionsContainer = _this$$props4.expandSuggestionsContainer;
1733
+ var _this$$scopedSlots = this.$scopedSlots,
1734
+ recentSearchesIcon = _this$$scopedSlots.recentSearchesIcon,
1735
+ popularSearchesIcon = _this$$scopedSlots.popularSearchesIcon;
1736
+ var hasSuggestions = this.currentValue ? this.suggestionsList.length || this.topSuggestions.length : this.defaultSearchSuggestions.length;
1737
+ return h(Container, {
1738
+ "class": this.$props.className
1739
+ }, [this.$props.title && h(Title, {
1740
+ "class": getClassName$1(this.$props.innerClass, 'title') || ''
1741
+ }, [this.$props.title]), this.$props.defaultSuggestions || this.$props.autosuggest ? h(Downshift, {
1742
+ "attrs": {
1743
+ "id": this.$props.componentId + "-downshift",
1744
+ "handleChange": this.onSuggestionSelected,
1745
+ "handleMouseup": this.handleStateChange,
1746
+ "isOpen": this.$data.isOpen
1747
+ },
1748
+ "scopedSlots": {
1749
+ "default": function _default(_ref3) {
1750
+ var getInputEvents = _ref3.getInputEvents,
1751
+ getInputProps = _ref3.getInputProps,
1752
+ getItemProps = _ref3.getItemProps,
1753
+ getItemEvents = _ref3.getItemEvents,
1754
+ isOpen = _ref3.isOpen,
1755
+ highlightedIndex = _ref3.highlightedIndex,
1756
+ setHighlightedIndex = _ref3.setHighlightedIndex;
1757
+
1758
+ var renderSuggestionsContainer = function renderSuggestionsContainer() {
1759
+ return h("div", [_this3.hasCustomRenderer && _this3.getComponent({
1760
+ isOpen: isOpen,
1761
+ getItemProps: getItemProps,
1762
+ getItemEvents: getItemEvents,
1763
+ highlightedIndex: highlightedIndex
1764
+ }), _this3.renderErrorComponent(), !_this3.hasCustomRenderer && isOpen && hasSuggestions ? h("ul", {
1765
+ "class": suggestions(_this3.themePreset, theme) + " " + getClassName$1(_this3.$props.innerClass, 'list')
1766
+ }, [_this3.suggestionsList.slice(0, size || 10).map(function (item, index) {
1767
+ return h("li", {
1768
+ "domProps": _extends({}, getItemProps({
1769
+ item: item
1770
+ })),
1771
+ "on": _extends({}, getItemEvents({
1772
+ item: item
1773
+ })),
1774
+ "key": index + 1 + "-" + item.value,
1775
+ "style": {
1776
+ backgroundColor: _this3.getBackgroundColor(highlightedIndex, index)
1777
+ }
1778
+ }, [h(SuggestionItem, {
1779
+ "attrs": {
1780
+ "currentValue": _this3.currentValue,
1781
+ "suggestion": item
1782
+ }
1783
+ })]);
1784
+ }), _this3.defaultSearchSuggestions.map(function (sugg, index) {
1785
+ return h("li", {
1786
+ "domProps": _extends({}, getItemProps({
1787
+ item: sugg
1788
+ })),
1789
+ "on": _extends({}, getItemEvents({
1790
+ item: sugg
1791
+ })),
1792
+ "key": _this3.suggestionsList.length + index + 1 + "-" + sugg.value,
1793
+ "style": {
1794
+ backgroundColor: _this3.getBackgroundColor(highlightedIndex, _this3.suggestionsList.length + index),
1795
+ justifyContent: 'flex-start'
1796
+ }
1797
+ }, [h("div", {
1798
+ "style": {
1799
+ padding: '0 10px 0 0'
1800
+ }
1801
+ }, [sugg.source && sugg.source._recent_search && h(CustomSvg, {
1802
+ "attrs": {
1803
+ "className": getClassName$1(_this3.$props.innerClass, 'recent-search-icon') || null,
1804
+ "icon": recentSearchesIcon,
1805
+ "type": "recent-search-icon"
1806
+ }
1807
+ }), sugg.source && sugg.source._popular_suggestion && h(CustomSvg, {
1808
+ "attrs": {
1809
+ "className": getClassName$1(_this3.$props.innerClass, 'popular-search-icon') || null,
1810
+ "icon": popularSearchesIcon,
1811
+ "type": "popular-search-icon"
1812
+ }
1813
+ })]), h(SuggestionItem, {
1814
+ "attrs": {
1815
+ "currentValue": _this3.currentValue,
1816
+ "suggestion": sugg
1817
+ }
1818
+ })]);
1819
+ }), hasQuerySuggestionsRenderer(_this3) ? _this3.getComponent({
1820
+ isOpen: isOpen,
1821
+ getItemProps: getItemProps,
1822
+ getItemEvents: getItemEvents,
1823
+ highlightedIndex: highlightedIndex
1824
+ }, true) : _this3.topSuggestions.map(function (sugg, index) {
1825
+ return h("li", {
1826
+ "domProps": _extends({}, getItemProps({
1827
+ item: sugg
1828
+ })),
1829
+ "on": _extends({}, getItemEvents({
1830
+ item: sugg
1831
+ })),
1832
+ "key": _this3.suggestionsList.length + index + 1 + "-" + sugg.value,
1833
+ "style": {
1834
+ backgroundColor: _this3.getBackgroundColor(highlightedIndex, _this3.suggestionsList.length + index),
1835
+ justifyContent: 'flex-start'
1836
+ }
1837
+ }, [h("div", {
1838
+ "style": {
1839
+ padding: '0 10px 0 0'
1840
+ }
1841
+ }, [h(CustomSvg, {
1842
+ "attrs": {
1843
+ "className": getClassName$1(_this3.$props.innerClass, 'popular-search-icon') || null,
1844
+ "icon": popularSearchesIcon,
1845
+ "type": "popular-search-icon"
1846
+ }
1847
+ })]), h(SuggestionItem, {
1848
+ "attrs": {
1849
+ "currentValue": _this3.currentValue,
1850
+ "suggestion": sugg
1851
+ }
1852
+ })]);
1853
+ })]) : _this3.renderNoSuggestions(_this3.suggestionsList)]);
1854
+ };
1855
+
1856
+ return h("div", {
1857
+ "class": suggestionsContainer
1858
+ }, [h(InputGroup, [_this3.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
1859
+ "attrs": {
1860
+ "id": _this3.$props.componentId + "-input",
1861
+ "showIcon": _this3.$props.showIcon,
1862
+ "showClear": _this3.$props.showClear,
1863
+ "iconPosition": _this3.$props.iconPosition,
1864
+ "placeholder": _this3.$props.placeholder,
1865
+ "autoFocus": _this3.$props.autoFocus,
1866
+ "themePreset": _this3.themePreset,
1867
+ "autocomplete": "off"
1868
+ },
1869
+ "ref": _this3.$props.innerRef,
1870
+ "class": getClassName$1(_this3.$props.innerClass, 'input'),
1871
+ "on": _extends({}, getInputEvents({
1872
+ onInput: _this3.onInputChange,
1873
+ onBlur: function onBlur(e) {
1874
+ _this3.$emit('blur', e, _this3.triggerQuery);
1875
+ },
1876
+ onFocus: _this3.handleFocus,
1877
+ onKeyPress: function onKeyPress(e) {
1878
+ _this3.$emit('keyPress', e, _this3.triggerQuery);
1879
+
1880
+ _this3.$emit('key-press', e, _this3.triggerQuery);
1881
+ },
1882
+ onKeyDown: function onKeyDown(e) {
1883
+ return _this3.handleKeyDown(e, highlightedIndex);
1884
+ },
1885
+ onKeyUp: function onKeyUp(e) {
1886
+ _this3.$emit('keyUp', e, _this3.triggerQuery);
1887
+
1888
+ _this3.$emit('key-up', e, _this3.triggerQuery);
1889
+ },
1890
+ onClick: function onClick() {
1891
+ setHighlightedIndex(null);
1892
+ }
1893
+ })),
1894
+ "domProps": _extends({}, getInputProps({
1895
+ value: _this3.$data.currentValue === null ? '' : _this3.$data.currentValue
1896
+ }))
1897
+ }), _this3.renderIcons(), !expandSuggestionsContainer && renderSuggestionsContainer()]), ' ', _this3.renderInputAddonAfter()]), expandSuggestionsContainer && renderSuggestionsContainer()]);
1898
+ }
1899
+ }
1900
+ }) : h("div", {
1901
+ "class": suggestionsContainer
1902
+ }, [h(InputGroup, [this.renderInputAddonBefore(), h(InputWrapper, [h(Input, {
1903
+ "class": getClassName$1(this.$props.innerClass, 'input') || '',
1904
+ "attrs": {
1905
+ "placeholder": this.$props.placeholder,
1906
+ "iconPosition": this.$props.iconPosition,
1907
+ "showIcon": this.$props.showIcon,
1908
+ "showClear": this.$props.showClear,
1909
+ "themePreset": this.themePreset
1910
+ },
1911
+ "on": _extends({}, {
1912
+ blur: function blur(e) {
1913
+ _this3.$emit('blur', e, _this3.triggerQuery);
1914
+ },
1915
+ keypress: function keypress(e) {
1916
+ _this3.$emit('keyPress', e, _this3.triggerQuery);
1917
+
1918
+ _this3.$emit('key-press', e, _this3.triggerQuery);
1919
+ },
1920
+ input: this.onInputChange,
1921
+ focus: function focus(e) {
1922
+ _this3.$emit('focus', e, _this3.triggerQuery);
1923
+ },
1924
+ keydown: function keydown(e) {
1925
+ _this3.$emit('keyDown', e, _this3.triggerQuery);
1926
+
1927
+ _this3.$emit('key-down', e, _this3.triggerQuery);
1928
+ },
1929
+ keyup: function keyup(e) {
1930
+ _this3.$emit('keyUp', e, _this3.triggerQuery);
1931
+
1932
+ _this3.$emit('key-up', e, _this3.triggerQuery);
1933
+ }
1934
+ }),
1935
+ "domProps": _extends({}, {
1936
+ autofocus: this.$props.autoFocus,
1937
+ value: this.$data.currentValue ? this.$data.currentValue : ''
1938
+ }),
1939
+ "ref": this.$props.innerRef
1940
+ }), this.renderIcons()]), this.renderInputAddonAfter()])])]);
1941
+ },
1942
+ destroyed: function destroyed() {
1943
+ document.removeEventListener('keydown', this.onKeyDown);
1944
+ }
1945
+ };
1946
+
1947
+ DataSearch.defaultQuery = function (value, props) {
1948
+ var finalQuery = null;
1949
+
1950
+ if (value) {
1951
+ var fields = normalizeDataField(props.dataField, props.fieldWeights);
1952
+ finalQuery = {
1953
+ bool: {
1954
+ should: DataSearch.shouldQuery(value, fields, props),
1955
+ minimum_should_match: '1'
1956
+ }
1957
+ };
1958
+ }
1959
+
1960
+ if (value === '') {
1961
+ finalQuery = null;
1962
+ }
1963
+
1964
+ if (finalQuery && props.nestedField) {
1965
+ return {
1966
+ query: {
1967
+ nested: {
1968
+ path: props.nestedField,
1969
+ query: finalQuery
1970
+ }
1971
+ }
1972
+ };
1973
+ }
1974
+
1975
+ return finalQuery;
1976
+ };
1977
+
1978
+ DataSearch.shouldQuery = function (value, dataFields, props) {
1979
+ var finalQuery = [];
1980
+ var phrasePrefixFields = [];
1981
+ var fields = dataFields.map(function (dataField) {
1982
+ var queryField = "" + dataField.field + (dataField.weight ? "^" + dataField.weight : '');
1983
+
1984
+ if (!(dataField.field.endsWith('.keyword') || dataField.field.endsWith('.autosuggest') || dataField.field.endsWith('.search'))) {
1985
+ phrasePrefixFields.push(queryField);
1986
+ }
1987
+
1988
+ return queryField;
1989
+ });
1990
+
1991
+ if (props.searchOperators || props.queryString) {
1992
+ return {
1993
+ query: value,
1994
+ fields: fields,
1995
+ default_operator: props.queryFormat
1996
+ };
1997
+ }
1998
+
1999
+ if (props.queryFormat === 'and') {
2000
+ finalQuery.push({
2001
+ multi_match: {
2002
+ query: value,
2003
+ fields: fields,
2004
+ type: 'cross_fields',
2005
+ operator: 'and'
2006
+ }
2007
+ });
2008
+ finalQuery.push({
2009
+ multi_match: {
2010
+ query: value,
2011
+ fields: fields,
2012
+ type: 'phrase',
2013
+ operator: 'and'
2014
+ }
2015
+ });
2016
+
2017
+ if (phrasePrefixFields.length > 0) {
2018
+ finalQuery.push({
2019
+ multi_match: {
2020
+ query: value,
2021
+ fields: phrasePrefixFields,
2022
+ type: 'phrase_prefix',
2023
+ operator: 'and'
2024
+ }
2025
+ });
2026
+ }
2027
+
2028
+ return finalQuery;
2029
+ }
2030
+
2031
+ finalQuery.push({
2032
+ multi_match: {
2033
+ query: value,
2034
+ fields: fields,
2035
+ type: 'best_fields',
2036
+ operator: 'or',
2037
+ fuzziness: props.fuzziness ? props.fuzziness : 0
2038
+ }
2039
+ });
2040
+ finalQuery.push({
2041
+ multi_match: {
2042
+ query: value,
2043
+ fields: fields,
2044
+ type: 'phrase',
2045
+ operator: 'or'
2046
+ }
2047
+ });
2048
+
2049
+ if (phrasePrefixFields.length > 0) {
2050
+ finalQuery.push({
2051
+ multi_match: {
2052
+ query: value,
2053
+ fields: phrasePrefixFields,
2054
+ type: 'phrase_prefix',
2055
+ operator: 'or'
2056
+ }
2057
+ });
2058
+ }
2059
+
2060
+ return finalQuery;
2061
+ };
2062
+
2063
+ DataSearch.highlightQuery = function (props) {
2064
+ if (props.customHighlight) {
2065
+ return props.customHighlight(props);
2066
+ }
2067
+
2068
+ if (!props.highlight) {
2069
+ return null;
2070
+ }
2071
+
2072
+ var fields = {};
2073
+ var highlightField = props.highlightField ? props.highlightField : props.dataField;
2074
+
2075
+ if (typeof highlightField === 'string') {
2076
+ fields[highlightField] = {};
2077
+ } else if (Array.isArray(highlightField)) {
2078
+ highlightField.forEach(function (item) {
2079
+ fields[item] = {};
2080
+ });
2081
+ }
2082
+
2083
+ return {
2084
+ highlight: _extends({
2085
+ pre_tags: ['<mark>'],
2086
+ post_tags: ['</mark>'],
2087
+ fields: fields
2088
+ }, props.highlightField && {
2089
+ require_field_match: false
2090
+ })
2091
+ };
2092
+ };
2093
+
2094
+ var mapStateToProps = function mapStateToProps(state, props) {
2095
+ return {
2096
+ selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
2097
+ suggestions: state.hits[props.componentId] && state.hits[props.componentId].hits,
2098
+ rawData: state.rawData[props.componentId],
2099
+ aggregationData: state.compositeAggregations[props.componentId] || [],
2100
+ isLoading: !!state.isLoading[props.componentId + "_active"],
2101
+ themePreset: state.config.themePreset,
2102
+ error: state.error[props.componentId],
2103
+ analytics: state.analytics,
2104
+ enableAppbase: state.config.enableAppbase,
2105
+ headers: state.appbaseRef.headers,
2106
+ promotedResults: state.promotedResults[props.componentId] || [],
2107
+ customData: state.customData[props.componentId],
2108
+ time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
2109
+ total: state.hits[props.componentId] && state.hits[props.componentId].total,
2110
+ hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
2111
+ popularSuggestions: state.querySuggestions[props.componentId],
2112
+ defaultPopularSuggestions: state.defaultPopularSuggestions[props.componentId],
2113
+ componentProps: state.props[props.componentId],
2114
+ lastUsedQuery: state.queryToHits[props.componentId],
2115
+ recentSearches: state.recentSearches.data
2116
+ };
2117
+ };
2118
+
2119
+ var mapDispatchToProps = {
2120
+ setQueryOptions: setQueryOptions,
2121
+ updateQuery: updateQuery,
2122
+ setCustomQuery: setCustomQuery,
2123
+ setDefaultQuery: setDefaultQuery,
2124
+ setCustomHighlightOptions: setCustomHighlightOptions,
2125
+ recordSuggestionClick: recordSuggestionClick,
2126
+ loadPopularSuggestions: loadPopularSuggestions,
2127
+ getRecentSearches: getRecentSearches
2128
+ };
2129
+ var DSConnected = ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(DataSearch), {
2130
+ componentType: componentTypes.dataSearch,
2131
+ internalComponent: true
2132
+ });
2133
+
2134
+ DataSearch.install = function (Vue) {
2135
+ Vue.component(DataSearch.name, DSConnected);
2136
+ }; // Add componentType for SSR
2137
+
2138
+
2139
+ DataSearch.componentType = componentTypes.dataSearch;
2140
+
2141
+ export { CustomSvg as C, DataSearch as D, InputAddon as I, Mic as M, SearchSvg as S, SuggestionWrapper as a, InputGroup as b, SuggestionItem as c };