@appbaseio/reactivesearch-vue 3.0.0-rc.5.alpha.5 → 3.0.0-rc.6.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 (67) hide show
  1. package/dist/@appbaseio/reactivesearch-vue.umd.js +39769 -35283
  2. package/dist/@appbaseio/reactivesearch-vue.umd.js.map +1 -1
  3. package/dist/@appbaseio/reactivesearch-vue.umd.min.js +32 -32
  4. package/dist/@appbaseio/reactivesearch-vue.umd.min.js.map +1 -1
  5. package/dist/cjs/{Button-d4da7470.js → Button-9e179864.js} +13 -6
  6. package/dist/cjs/{ComponentWrapper-9146d811.js → ComponentWrapper-0b9ffb1a.js} +3 -0
  7. package/dist/cjs/DropDown-aef75c14.js +702 -0
  8. package/dist/cjs/DynamicRangeSlider.js +1 -1
  9. package/dist/cjs/{Input-497be42a.js → Input-56eba499.js} +71 -1
  10. package/dist/cjs/MultiDropdownList.js +6 -6
  11. package/dist/cjs/MultiList.js +3 -3
  12. package/dist/cjs/MultiRange.js +2 -2
  13. package/dist/cjs/{Pagination-b953a80a.js → Pagination-58a0cf3f.js} +2 -2
  14. package/dist/cjs/RangeInput.js +3 -3
  15. package/dist/cjs/RangeSlider.js +2 -2
  16. package/dist/cjs/ReactiveBase.js +4 -4
  17. package/dist/cjs/ReactiveComponent.js +2 -2
  18. package/dist/cjs/ReactiveGoogleMap.js +6 -5
  19. package/dist/cjs/ReactiveList.js +4 -4
  20. package/dist/cjs/ResultCard.js +1 -1
  21. package/dist/cjs/ResultList.js +1 -1
  22. package/dist/cjs/SelectedFilters.js +3 -2
  23. package/dist/cjs/SingleDropdownList.js +6 -6
  24. package/dist/cjs/SingleList.js +3 -3
  25. package/dist/cjs/SingleRange.js +2 -2
  26. package/dist/cjs/ToggleButton.js +4 -3
  27. package/dist/cjs/index.js +14 -13
  28. package/dist/cjs/install-7fb595b8.js +3842 -0
  29. package/dist/cjs/install.js +9 -9
  30. package/dist/cjs/version.js +1 -1
  31. package/dist/cjs/{vueTypes-1bf00978.js → vueTypes-a5f1745e.js} +18 -0
  32. package/dist/es/{Button-fd869491.js → Button-c2ff5178.js} +13 -6
  33. package/dist/es/{ComponentWrapper-8a3c388d.js → ComponentWrapper-a2635cfc.js} +3 -0
  34. package/dist/es/DropDown-39fedff8.js +693 -0
  35. package/dist/es/DynamicRangeSlider.js +1 -1
  36. package/dist/es/{Input-f7499ef8.js → Input-11d211d2.js} +71 -2
  37. package/dist/es/MultiDropdownList.js +6 -6
  38. package/dist/es/MultiList.js +3 -3
  39. package/dist/es/MultiRange.js +2 -2
  40. package/dist/es/{Pagination-c2745bec.js → Pagination-ae401c33.js} +2 -2
  41. package/dist/es/RangeInput.js +3 -3
  42. package/dist/es/RangeSlider.js +2 -2
  43. package/dist/es/ReactiveBase.js +4 -4
  44. package/dist/es/ReactiveComponent.js +2 -2
  45. package/dist/es/ReactiveGoogleMap.js +6 -5
  46. package/dist/es/ReactiveList.js +4 -4
  47. package/dist/es/ResultCard.js +1 -1
  48. package/dist/es/ResultList.js +1 -1
  49. package/dist/es/SelectedFilters.js +3 -2
  50. package/dist/es/SingleDropdownList.js +6 -6
  51. package/dist/es/SingleList.js +3 -3
  52. package/dist/es/SingleRange.js +2 -2
  53. package/dist/es/ToggleButton.js +4 -3
  54. package/dist/es/index.js +11 -11
  55. package/dist/es/install-3f345819.js +3834 -0
  56. package/dist/es/install.js +9 -9
  57. package/dist/es/version.js +1 -1
  58. package/dist/es/{vueTypes-f1923c72.js → vueTypes-09cab4d3.js} +18 -0
  59. package/package.json +7 -5
  60. package/dist/cjs/CancelSvg-ab0f8b23.js +0 -409
  61. package/dist/cjs/DropDown-e7125b72.js +0 -299
  62. package/dist/cjs/SearchBox.js +0 -1853
  63. package/dist/cjs/install-3c4520bf.js +0 -874
  64. package/dist/es/CancelSvg-e7ae49e9.js +0 -401
  65. package/dist/es/DropDown-13afb4d2.js +0 -295
  66. package/dist/es/SearchBox.js +0 -1847
  67. package/dist/es/install-ff8b0750.js +0 -868
@@ -0,0 +1,3834 @@
1
+ import { helper, Actions, causes } from '@appbaseio/reactivecore';
2
+ import { SEARCH_COMPONENTS_MODES, componentTypes, AI_LOCAL_CACHE_KEY, AI_ROLES, TREELIST_VALUES_PATH_SEPARATOR } from '@appbaseio/reactivecore/lib/utils/constants';
3
+ import _transformOn from '@vue/babel-helper-vue-transform-on';
4
+ import { _ as _taggedTemplateLiteralLoose, a as _extends, b as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-ded08042.js';
5
+ import { createVNode, createTextVNode, defineComponent, ref, watch, isVNode, mergeProps, h } from 'vue';
6
+ import VueTypes from 'vue-types';
7
+ import { getQueryOptions, getObjectFromLocalStorage, suggestionTypes, getClassName as getClassName$2, setObjectInLocalStorage, recLookup, updateCustomQuery as updateCustomQuery$1, updateDefaultQuery as updateDefaultQuery$1, transformTreeListLocalStateIntoQueryComptaibleFormat, isEqual as isEqual$1, transformRawTreeListData, setDeep, getComponent as getComponent$1, getOptionsFromQuery, checkValueChange as checkValueChange$1, getAggsQuery, updateInternalQuery, isFunction as isFunction$1 } from '@appbaseio/reactivecore/lib/utils/helper';
8
+ import { styled } from '@appbaseio/vue-emotion';
9
+ import { css, keyframes } from '@emotion/css';
10
+ import { lighten } from 'polished';
11
+ import { B as Button } from './Button-c2ff5178.js';
12
+ import { t as types } from './vueTypes-09cab4d3.js';
13
+ import { RLConnected as ReactiveList } from './ReactiveList.js';
14
+ import { getInternalComponentID } from '@appbaseio/reactivecore/lib/utils/transform';
15
+ import { g as getComponent, h as hasCustomRenderer, f as decodeHtml, i as isQueryIdentical, u as updateDefaultQuery, j as updateCustomQuery, a as isFunction, k as isEmpty, p as parseFocusShortcuts, l as extractModifierKeysFromFocusShortcuts, c as connect } from './index-882489e1.js';
16
+ import { C as ComponentWrapper } from './ComponentWrapper-a2635cfc.js';
17
+ import { P as PreferencesConsumer } from './PreferencesConsumer-b058d14e.js';
18
+ import { T as Title } from './Title-863dfa42.js';
19
+ import { L as ListItem } from './ListItem-e3c6acf4.js';
20
+ import { F as Flex } from './Flex-25792bc3.js';
21
+ import { recordAISessionUsefulness } from '@appbaseio/reactivecore/lib/actions/analytics';
22
+ import ReactiveBase from './ReactiveBase.js';
23
+ import hotkeys from 'hotkeys-js';
24
+ import { Remarkable } from 'remarkable';
25
+ import { I as IconWrapper, C as CancelSvg, a as IconGroup, D as Downshift, b as InputWrapper } from './DropDown-39fedff8.js';
26
+ import { n as noSuggestions, T as TextArea, I as Input, s as suggestionsContainer, a as suggestions } from './Input-11d211d2.js';
27
+ import { C as Container } from './Container-d00219f7.js';
28
+ import Highlight from 'vue-highlight-words';
29
+ import { fetchAIResponse } from '@appbaseio/reactivecore/lib/actions/query';
30
+ import { replaceDiacritics } from '@appbaseio/reactivecore/lib/utils/suggestions';
31
+ import { C as Checkbox, R as Radio } from './FormControlList-fe6eaee4.js';
32
+ import { s as sanitizeObject } from './utils-d7dd4f4e.js';
33
+ import { ListConnected as SingleList } from './SingleList.js';
34
+ import { ListConnected as MultiList } from './MultiList.js';
35
+ import types$1 from '@appbaseio/reactivecore/lib/utils/types';
36
+ import { ListConnected as SingleDropdownList } from './SingleDropdownList.js';
37
+ import { ListConnected as MultiDropdownList } from './MultiDropdownList.js';
38
+ import { TBConnected as ToggleButton } from './ToggleButton.js';
39
+ import ReactiveComponent from './ReactiveComponent.js';
40
+ import { RangeConnected as DynamicRangeSlider } from './DynamicRangeSlider.js';
41
+ import { RangeConnected as SingleRange } from './SingleRange.js';
42
+ import { RangeConnected as MultiRange } from './MultiRange.js';
43
+ import { RangeConnected as RangeSlider } from './RangeSlider.js';
44
+ import { RangeConnected as RangeInput } from './RangeInput.js';
45
+ import SelectedFilters from './SelectedFilters.js';
46
+ import ResultCard from './ResultCard.js';
47
+ import ResultList from './ResultList.js';
48
+ import StateProvider from './StateProvider.js';
49
+
50
+ var _templateObject;
51
+ var InputGroup = styled('div')(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: stretch;\n\twidth: 100%;\n"])));
52
+ InputGroup.defaultProps = {
53
+ className: 'input-group'
54
+ };
55
+
56
+ var _templateObject$1;
57
+ 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"])));
58
+ InputAddon.defaultProps = {
59
+ className: 'input-addon'
60
+ };
61
+
62
+ var getClassName = helper.getClassName;
63
+ var SuggestionWrapper = {
64
+ name: 'SuggestionWrapper',
65
+ props: {
66
+ innerClassName: types.string,
67
+ themePreset: types.themePreset,
68
+ innerClass: types.style
69
+ },
70
+ render: function render() {
71
+ var _this$$props = this.$props,
72
+ themePreset = _this$$props.themePreset,
73
+ innerClass = _this$$props.innerClass,
74
+ innerClassName = _this$$props.innerClassName;
75
+ return createVNode("div", {
76
+ "class": noSuggestions(themePreset) + " " + getClassName(innerClass, innerClassName || '')
77
+ }, [createVNode("li", null, [this.$slots["default"]()])]);
78
+ }
79
+ };
80
+
81
+ var _templateObject$2;
82
+ var highlightStyle = {
83
+ fontWeight: 600,
84
+ padding: 0,
85
+ backgroundColor: 'transparent',
86
+ color: 'inherit'
87
+ };
88
+ 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"])));
89
+ var SuggestionItem = {
90
+ name: 'SuggestionItem',
91
+ props: {
92
+ currentValue: types.string,
93
+ suggestion: types.any
94
+ },
95
+ render: function render() {
96
+ var _this = this;
97
+ var _this$suggestion = this.suggestion,
98
+ label = _this$suggestion.label,
99
+ value = _this$suggestion.value,
100
+ title = _this$suggestion.title,
101
+ description = _this$suggestion.description,
102
+ image = _this$suggestion.image,
103
+ isPredictiveSuggestion = _this$suggestion.isPredictiveSuggestion,
104
+ _suggestion_type = _this$suggestion._suggestion_type,
105
+ _category = _this$suggestion._category;
106
+ if (label) {
107
+ // label has highest precedence
108
+ return typeof label === 'string' ? createVNode("div", {
109
+ "class": "trim"
110
+ }, [(_category ? false : isPredictiveSuggestion
111
+ // eslint-disable-next-line
112
+ || !!_suggestion_type) ? createVNode(PredictiveSuggestion, {
113
+ "innerHTML": label
114
+ }, null) : createVNode(Highlight, {
115
+ "searchWords": _category ? [_category] : this.currentValue.split(' '),
116
+ "textToHighlight": label,
117
+ "autoEscape": true,
118
+ "highlightStyle": highlightStyle
119
+ }, null)]) : label;
120
+ }
121
+ if (title || image || description) {
122
+ return createVNode(Flex, {
123
+ "alignItems": "center",
124
+ "css": {
125
+ width: '100%'
126
+ }
127
+ }, {
128
+ "default": function _default() {
129
+ return [image && createVNode("div", {
130
+ "css": {
131
+ margin: 'auto',
132
+ marginRight: 10
133
+ }
134
+ }, [createVNode("img", {
135
+ "src": image,
136
+ "alt": " ",
137
+ "height": "50px",
138
+ "width": "50px",
139
+ "css": {
140
+ objectFit: 'contain'
141
+ }
142
+ }, null)]), createVNode(Flex, {
143
+ "direction": "column",
144
+ "css": {
145
+ width: image ? 'calc(100% - 60px)' : '100%'
146
+ }
147
+ }, {
148
+ "default": function _default() {
149
+ return [title && createVNode("div", {
150
+ "class": "trim"
151
+ }, [createVNode(Highlight, {
152
+ "searchWords": _this.currentValue.split(' '),
153
+ "textToHighlight": title,
154
+ "highlightStyle": highlightStyle,
155
+ "class": css({
156
+ fontSize: '1rem'
157
+ })
158
+ }, null)]), description && createVNode("div", {
159
+ "class": ['trim', css({
160
+ marginTop: 3
161
+ })]
162
+ }, [createVNode(Highlight, {
163
+ "searchWords": _this.currentValue.split(' '),
164
+ "textToHighlight": description,
165
+ "highlightStyle": highlightStyle
166
+ }, null)])];
167
+ }
168
+ })];
169
+ }
170
+ });
171
+ }
172
+ return value;
173
+ }
174
+ };
175
+
176
+ var SearchSvg = {
177
+ name: 'SearchSvg',
178
+ props: ['styles'],
179
+ render: function render() {
180
+ return createVNode("svg", {
181
+ "alt": "Search",
182
+ "class": "search-icon",
183
+ "height": "12",
184
+ "xmlns": "http://www.w3.org/2000/svg",
185
+ "viewBox": "0 0 15 15",
186
+ "style": _extends({
187
+ transform: 'scale(1.35)',
188
+ position: 'relative'
189
+ }, this.$props.styles ? this.$props.styles : {})
190
+ }, [createVNode("title", null, [createTextVNode("Search")]), createVNode("path", {
191
+ "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'
192
+ }, null)]);
193
+ }
194
+ };
195
+
196
+ function styleInject(css, ref) {
197
+ if (ref === void 0) ref = {};
198
+ var insertAt = ref.insertAt;
199
+ if (!css || typeof document === 'undefined') {
200
+ return;
201
+ }
202
+ var head = document.head || document.getElementsByTagName('head')[0];
203
+ var style = document.createElement('style');
204
+ style.type = 'text/css';
205
+ if (insertAt === 'top') {
206
+ if (head.firstChild) {
207
+ head.insertBefore(style, head.firstChild);
208
+ } else {
209
+ head.appendChild(style);
210
+ }
211
+ } else {
212
+ head.appendChild(style);
213
+ }
214
+ if (style.styleSheet) {
215
+ style.styleSheet.cssText = css;
216
+ } else {
217
+ style.appendChild(document.createTextNode(css));
218
+ }
219
+ }
220
+
221
+ var css_248z = "#el_TvxDfTAtKp {\n stroke: none;\n stroke-width: 1;\n fill: none;\n}\n#el_D93PK3GbmJ {\n -webkit-transform: translate(163px, 131px);\n transform: translate(163px, 131px);\n fill: #d8d8d8;\n}\n";
222
+ styleInject(css_248z);
223
+
224
+ var MicSvg = {
225
+ name: 'MicSvg',
226
+ props: ['className'],
227
+ render: function render() {
228
+ return createVNode("svg", {
229
+ "viewBox": "0 0 480 480",
230
+ "xmlns": "http://www.w3.org/2000/svg",
231
+ "id": "el_xS0FRzQjJ",
232
+ "width": 28,
233
+ "height": 28,
234
+ "className": this.$props.className,
235
+ "style": {
236
+ transform: 'scale(1.5)'
237
+ }
238
+ }, [createVNode("g", {
239
+ "id": "el_TvxDfTAtKp",
240
+ "fillRule": "evenodd"
241
+ }, [createVNode("g", {
242
+ "id": "el_D93PK3GbmJ",
243
+ "fillRule": "nonzero",
244
+ "style": {
245
+ fill: '#595959'
246
+ }
247
+ }, [createVNode("path", {
248
+ "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",
249
+ "id": "el_uly3EwA2O3"
250
+ }, null), createVNode("path", {
251
+ "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",
252
+ "id": "el_tnDbR4ytu4"
253
+ }, null)])])]);
254
+ }
255
+ };
256
+
257
+ var css_248z$1 = "#el_X81iT9kZYo {\n stroke: none;\n stroke-width: 1;\n fill: none;\n}\n#el_gMpyalCphp {\n -webkit-transform: translate(163px, 131px);\n transform: translate(163px, 131px);\n}\n#el_c7H-3u-D4l {\n fill: #d8d8d8;\n}\n#el_qhFcdAAFwo {\n fill: #d8d8d8;\n}\n#el_M8X8g37WOI {\n stroke: #e83137;\n stroke-width: 21;\n}\n";
258
+ styleInject(css_248z$1);
259
+
260
+ var MuteSvg = {
261
+ name: 'MuteSvg',
262
+ props: ['className'],
263
+ render: function render() {
264
+ return createVNode("svg", {
265
+ "style": {
266
+ transform: 'scale(1.5)'
267
+ },
268
+ "viewBox": "0 0 480 480",
269
+ "xmlns": "http://www.w3.org/2000/svg",
270
+ "id": "el_D1rEpH2zj",
271
+ "width": 28,
272
+ "height": 28,
273
+ "className": this.$props.className
274
+ }, [createVNode("g", {
275
+ "id": "el_X81iT9kZYo",
276
+ "fillRule": "evenodd"
277
+ }, [createVNode("g", {
278
+ "id": "el_gMpyalCphp"
279
+ }, [createVNode("path", {
280
+ "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",
281
+ "id": "el_c7H-3u-D4l",
282
+ "fillRule": "nonzero",
283
+ "style": {
284
+ fill: '#595959'
285
+ }
286
+ }, null), createVNode("path", {
287
+ "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",
288
+ "id": "el_qhFcdAAFwo",
289
+ "fillRule": "nonzero",
290
+ "style": {
291
+ fill: '#595959'
292
+ }
293
+ }, null), createVNode("path", {
294
+ "d": "M11.5,206.5 L142.5,12.5",
295
+ "id": "el_M8X8g37WOI",
296
+ "strokeLinecap": "round",
297
+ "strokeLinejoin": "round"
298
+ }, null)])])]);
299
+ }
300
+ };
301
+
302
+ var css_248z$2 = "@-webkit-keyframes kf_el_6WKby7wXqV_an_qqO-rxbNc {\n 0% {\n opacity: 0;\n }\n 13.89% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes kf_el_6WKby7wXqV_an_qqO-rxbNc {\n 0% {\n opacity: 0;\n }\n 13.89% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n@-webkit-keyframes kf_el_Wi-my975tM_an_XhXP1epXB {\n 0% {\n opacity: 0;\n }\n 27.78% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes kf_el_Wi-my975tM_an_XhXP1epXB {\n 0% {\n opacity: 0;\n }\n 27.78% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n@-webkit-keyframes kf_el_DkfFFTaFxy8_an_T2XxzvIaA {\n 0% {\n opacity: 0;\n }\n 41.67% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes kf_el_DkfFFTaFxy8_an_T2XxzvIaA {\n 0% {\n opacity: 0;\n }\n 41.67% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n@-webkit-keyframes kf_el_34IgwiMB5rf_an_TPom3H2LI {\n 0% {\n opacity: 0;\n }\n 55.56% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes kf_el_34IgwiMB5rf_an_TPom3H2LI {\n 0% {\n opacity: 0;\n }\n 55.56% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n@-webkit-keyframes kf_el_DeebuCsPTGA_an_aYTRBE7Na {\n 0% {\n opacity: 0;\n }\n 69.44% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes kf_el_DeebuCsPTGA_an_aYTRBE7Na {\n 0% {\n opacity: 0;\n }\n 69.44% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n@-webkit-keyframes kf_el_ZOjjrPTvyrv_an_l_BjBNzXw {\n 0% {\n opacity: 0;\n }\n 83.33% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes kf_el_ZOjjrPTvyrv_an_l_BjBNzXw {\n 0% {\n opacity: 0;\n }\n 83.33% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n@-webkit-keyframes kf_el_2FATegVmf0K_an_wLg4ofuFx {\n 0% {\n opacity: 0;\n }\n 97.22% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n@keyframes kf_el_2FATegVmf0K_an_wLg4ofuFx {\n 0% {\n opacity: 0;\n }\n 97.22% {\n opacity: 1;\n }\n 100% {\n opacity: 1;\n }\n}\n#el_hiibMG0x- * {\n -webkit-animation-duration: 1.2s;\n animation-duration: 1.2s;\n -webkit-animation-iteration-count: infinite;\n animation-iteration-count: infinite;\n -webkit-animation-timing-function: cubic-bezier(0, 0, 1, 1);\n animation-timing-function: cubic-bezier(0, 0, 1, 1);\n}\n#el_QJeJ_2CDw5 {\n stroke: none;\n stroke-width: 1;\n fill: none;\n}\n#el_UYYCfubTRf {\n -webkit-transform: translate(163px, 123px);\n transform: translate(163px, 123px);\n}\n#el_uzZNtK32Zi {\n fill: #d8d8d8;\n}\n#el_EYKQ2N9Kgy {\n fill: #d8d8d8;\n}\n#el_6SDP2LAgKC {\n -webkit-transform: translate(37.846924px, 0px);\n transform: translate(37.846924px, 0px);\n}\n#el_-Vm65Ltfy7 {\n fill: #0B6AFF;\n}\n#el_q04iZcSim4 {\n fill: #d8d8d8;\n}\n#el_6WKby7wXqV {\n -webkit-transform: translate(37.846924px, 0px);\n transform: translate(37.846924px, 0px);\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n opacity: 0;\n -webkit-animation-name: kf_el_6WKby7wXqV_an_qqO-rxbNc;\n animation-name: kf_el_6WKby7wXqV_an_qqO-rxbNc;\n -webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n}\n#el_9bggsfQOtU {\n fill: #0B6AFF;\n}\n#el_NKxqi9eIym {\n fill: #d8d8d8;\n}\n#el_Wi-my975tM {\n -webkit-transform: translate(37.846924px, 0px);\n transform: translate(37.846924px, 0px);\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n opacity: 0;\n -webkit-animation-name: kf_el_Wi-my975tM_an_XhXP1epXB;\n animation-name: kf_el_Wi-my975tM_an_XhXP1epXB;\n -webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n}\n#el_zclQ34fvf7 {\n fill: #0B6AFF;\n}\n#el_1OsvRT8HkeZ {\n fill: #d8d8d8;\n}\n#el_DkfFFTaFxy8 {\n -webkit-transform: translate(37.846924px, 0px);\n transform: translate(37.846924px, 0px);\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n opacity: 0;\n -webkit-animation-name: kf_el_DkfFFTaFxy8_an_T2XxzvIaA;\n animation-name: kf_el_DkfFFTaFxy8_an_T2XxzvIaA;\n -webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n}\n#el_aa9sjx4H0vA {\n fill: #0B6AFF;\n}\n#el_tea114vWg0J {\n fill: #d8d8d8;\n}\n#el_34IgwiMB5rf {\n -webkit-transform: translate(37.846924px, 0px);\n transform: translate(37.846924px, 0px);\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n opacity: 0;\n -webkit-animation-name: kf_el_34IgwiMB5rf_an_TPom3H2LI;\n animation-name: kf_el_34IgwiMB5rf_an_TPom3H2LI;\n -webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n}\n#el_z5u6RAFhx7d {\n fill: #0B6AFF;\n}\n#el_7nfuWmA5Uhy {\n fill: #d8d8d8;\n}\n#el_DeebuCsPTGA {\n -webkit-transform: translate(37.846924px, 0px);\n transform: translate(37.846924px, 0px);\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n opacity: 0;\n -webkit-animation-name: kf_el_DeebuCsPTGA_an_aYTRBE7Na;\n animation-name: kf_el_DeebuCsPTGA_an_aYTRBE7Na;\n -webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n}\n#el__ZcqlS20zcw {\n fill: #0B6AFF;\n}\n#el_8DnEQnD7VWV {\n fill: #d8d8d8;\n}\n#el_ZOjjrPTvyrv {\n -webkit-transform: translate(37.846924px, 0px);\n transform: translate(37.846924px, 0px);\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n opacity: 0;\n -webkit-animation-name: kf_el_ZOjjrPTvyrv_an_l_BjBNzXw;\n animation-name: kf_el_ZOjjrPTvyrv_an_l_BjBNzXw;\n -webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n}\n#el_FYYKCI_u24e {\n fill: #0B6AFF;\n}\n#el_XZty4MnTp5Y {\n fill: #d8d8d8;\n}\n#el_2FATegVmf0K {\n -webkit-transform: translate(37.846924px, 0px);\n transform: translate(37.846924px, 0px);\n -webkit-animation-fill-mode: backwards;\n animation-fill-mode: backwards;\n opacity: 0;\n -webkit-animation-name: kf_el_2FATegVmf0K_an_wLg4ofuFx;\n animation-name: kf_el_2FATegVmf0K_an_wLg4ofuFx;\n -webkit-animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n animation-timing-function: cubic-bezier(0.42, 0, 1, 1);\n}\n#el_RMT1KUfbdF8 {\n fill: #0B6AFF;\n}\n#el_RgLcovvFiO1 {\n fill: #d8d8d8;\n}\n";
303
+ styleInject(css_248z$2);
304
+
305
+ var ListenSvg = {
306
+ name: 'ListenSvg',
307
+ props: ['className'],
308
+ render: function render() {
309
+ return createVNode("svg", {
310
+ "viewBox": "0 0 480 480",
311
+ "xmlns": "http://www.w3.org/2000/svg",
312
+ "xmlnsXlink": "http://www.w3.org/1999/xlink",
313
+ "id": "el_hiibMG0x-",
314
+ "width": 28,
315
+ "height": 29,
316
+ "className": this.$props.className,
317
+ "style": {
318
+ transform: 'scale(1.5)'
319
+ }
320
+ }, [createVNode("defs", null, [createVNode("path", {
321
+ "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",
322
+ "id": "path-1"
323
+ }, null), createVNode("path", {
324
+ "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",
325
+ "id": "path-3"
326
+ }, null), createVNode("path", {
327
+ "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",
328
+ "id": "path-5"
329
+ }, null), createVNode("path", {
330
+ "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",
331
+ "id": "path-7"
332
+ }, null), createVNode("path", {
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-9"
335
+ }, null), createVNode("path", {
336
+ "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",
337
+ "id": "path-11"
338
+ }, null), createVNode("path", {
339
+ "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",
340
+ "id": "path-13"
341
+ }, null), createVNode("path", {
342
+ "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",
343
+ "id": "path-15"
344
+ }, null)]), createVNode("g", {
345
+ "id": "el_QJeJ_2CDw5",
346
+ "fillRule": "evenodd"
347
+ }, [createVNode("g", {
348
+ "id": "el_UYYCfubTRf"
349
+ }, [createVNode("path", {
350
+ "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",
351
+ "id": "el_uzZNtK32Zi",
352
+ "fillRule": "nonzero",
353
+ "style": {
354
+ fill: '#0B6AFF'
355
+ }
356
+ }, null), createVNode("path", {
357
+ "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",
358
+ "id": "el_EYKQ2N9Kgy",
359
+ "fillRule": "nonzero"
360
+ }, null), createVNode("g", {
361
+ "id": "el_6SDP2LAgKC"
362
+ }, [createVNode("mask", {
363
+ "id": "mask-2",
364
+ "fill": "#fff"
365
+ }, [createVNode("use", {
366
+ "xlink:href": "#path-1"
367
+ }, null)]), createVNode("path", {
368
+ "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",
369
+ "id": "el_-Vm65Ltfy7",
370
+ "fillRule": "nonzero",
371
+ "mask": "url(#mask-2)"
372
+ }, null), createVNode("rect", {
373
+ "id": "el_q04iZcSim4",
374
+ "mask": "url(#mask-2)",
375
+ "x": "0.279",
376
+ "width": "77",
377
+ "height": "130"
378
+ }, null)]), createVNode("g", {
379
+ "id": "el_6WKby7wXqV"
380
+ }, [createVNode("mask", {
381
+ "id": "mask-4",
382
+ "fill": "#fff"
383
+ }, [createVNode("use", {
384
+ "xlink:href": "#path-3"
385
+ }, null)]), createVNode("path", {
386
+ "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",
387
+ "id": "el_9bggsfQOtU",
388
+ "fillRule": "nonzero",
389
+ "mask": "url(#mask-4)"
390
+ }, null), createVNode("rect", {
391
+ "id": "el_NKxqi9eIym",
392
+ "mask": "url(#mask-4)",
393
+ "x": "0.279",
394
+ "width": "77",
395
+ "height": "115"
396
+ }, null)]), createVNode("g", {
397
+ "id": "el_Wi-my975tM"
398
+ }, [createVNode("mask", {
399
+ "id": "mask-6",
400
+ "fill": "#fff"
401
+ }, [createVNode("use", {
402
+ "xlink:href": "#path-5"
403
+ }, null)]), createVNode("path", {
404
+ "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",
405
+ "id": "el_zclQ34fvf7",
406
+ "fillRule": "nonzero",
407
+ "mask": "url(#mask-6)"
408
+ }, null), createVNode("rect", {
409
+ "id": "el_1OsvRT8HkeZ",
410
+ "mask": "url(#mask-6)",
411
+ "x": "0.279",
412
+ "width": "77",
413
+ "height": "100"
414
+ }, null)]), createVNode("g", {
415
+ "id": "el_DkfFFTaFxy8"
416
+ }, [createVNode("mask", {
417
+ "id": "mask-8",
418
+ "fill": "#fff"
419
+ }, [createVNode("use", {
420
+ "xlink:href": "#path-7"
421
+ }, null)]), createVNode("path", {
422
+ "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",
423
+ "id": "el_aa9sjx4H0vA",
424
+ "fillRule": "nonzero",
425
+ "mask": "url(#mask-8)"
426
+ }, null), createVNode("rect", {
427
+ "id": "el_tea114vWg0J",
428
+ "mask": "url(#mask-8)",
429
+ "x": "0.279",
430
+ "width": "77",
431
+ "height": "85"
432
+ }, null)]), createVNode("g", {
433
+ "id": "el_34IgwiMB5rf"
434
+ }, [createVNode("mask", {
435
+ "id": "mask-10",
436
+ "fill": "#fff"
437
+ }, [createVNode("use", {
438
+ "xlink:href": "#path-9"
439
+ }, null)]), createVNode("path", {
440
+ "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",
441
+ "id": "el_z5u6RAFhx7d",
442
+ "fillRule": "nonzero",
443
+ "mask": "url(#mask-10)"
444
+ }, null), createVNode("rect", {
445
+ "id": "el_7nfuWmA5Uhy",
446
+ "mask": "url(#mask-10)",
447
+ "x": "0.279",
448
+ "width": "77",
449
+ "height": "70"
450
+ }, null)]), createVNode("g", {
451
+ "id": "el_DeebuCsPTGA"
452
+ }, [createVNode("mask", {
453
+ "id": "mask-12",
454
+ "fill": "#fff"
455
+ }, [createVNode("use", {
456
+ "xlink:href": "#path-11"
457
+ }, null)]), createVNode("path", {
458
+ "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",
459
+ "id": "el__ZcqlS20zcw",
460
+ "fillRule": "nonzero",
461
+ "mask": "url(#mask-12)"
462
+ }, null), createVNode("rect", {
463
+ "id": "el_8DnEQnD7VWV",
464
+ "mask": "url(#mask-12)",
465
+ "x": "0.279",
466
+ "width": "77",
467
+ "height": "55"
468
+ }, null)]), createVNode("g", {
469
+ "id": "el_ZOjjrPTvyrv"
470
+ }, [createVNode("mask", {
471
+ "id": "mask-14",
472
+ "fill": "#fff"
473
+ }, [createVNode("use", {
474
+ "xlink:href": "#path-13"
475
+ }, null)]), createVNode("path", {
476
+ "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",
477
+ "id": "el_FYYKCI_u24e",
478
+ "fillRule": "nonzero",
479
+ "mask": "url(#mask-14)"
480
+ }, null), createVNode("rect", {
481
+ "id": "el_XZty4MnTp5Y",
482
+ "mask": "url(#mask-14)",
483
+ "x": "0.279",
484
+ "width": "77",
485
+ "height": "40"
486
+ }, null)]), createVNode("g", {
487
+ "id": "el_2FATegVmf0K"
488
+ }, [createVNode("mask", {
489
+ "id": "mask-16",
490
+ "fill": "#fff"
491
+ }, [createVNode("use", {
492
+ "xlink:href": "#path-15"
493
+ }, null)]), createVNode("path", {
494
+ "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",
495
+ "id": "el_RMT1KUfbdF8",
496
+ "fillRule": "nonzero",
497
+ "mask": "url(#mask-16)"
498
+ }, null), createVNode("rect", {
499
+ "id": "el_RgLcovvFiO1",
500
+ "mask": "url(#mask-16)",
501
+ "x": "0.279",
502
+ "width": "77",
503
+ "height": "25"
504
+ }, null)])])])]);
505
+ }
506
+ };
507
+
508
+ var STATUS = {
509
+ inactive: 'INACTIVE',
510
+ stopped: 'STOPPED',
511
+ active: 'ACTIVE',
512
+ denied: 'DENIED'
513
+ };
514
+ var Mic = {
515
+ name: 'Mic',
516
+ props: {
517
+ children: types.title,
518
+ lang: VueTypes.string.def('en-US'),
519
+ iconPosition: VueTypes.string.def('left'),
520
+ handleResult: types.func,
521
+ onNoMatch: types.func,
522
+ onError: types.func,
523
+ getInstance: types.func,
524
+ render: types.func,
525
+ className: types.string,
526
+ applyClearStyle: VueTypes.bool,
527
+ showIcon: VueTypes.bool
528
+ },
529
+ methods: {
530
+ getComponent: function getComponent$1() {
531
+ var status = this.$data.status;
532
+ var data = {
533
+ handleClick: this.handleClick,
534
+ status: status
535
+ };
536
+ return getComponent(data, this);
537
+ },
538
+ stopMic: function stopMic() {
539
+ if (this.instance) {
540
+ this.status = STATUS.inactive;
541
+ this.instance.stop();
542
+ this.instance = null;
543
+ }
544
+ },
545
+ handleClick: function handleClick() {
546
+ var _this = this;
547
+ this.results = [];
548
+ if (window && window.SpeechRecognition) {
549
+ var status = this.$data.status;
550
+ if (status === STATUS.active) {
551
+ this.status = STATUS.inactive;
552
+ }
553
+ var _this$$props = this.$props,
554
+ handleResult = _this$$props.handleResult,
555
+ onNoMatch = _this$$props.onNoMatch,
556
+ onError = _this$$props.onError,
557
+ lang = _this$$props.lang,
558
+ getInstance = _this$$props.getInstance;
559
+ var _window = window,
560
+ SpeechRecognition = _window.SpeechRecognition;
561
+ if (this.instance && this.status !== STATUS.denied) {
562
+ this.status = STATUS.inactive;
563
+ this.instance.stop();
564
+ this.instance = null;
565
+ return;
566
+ }
567
+ this.instance = new SpeechRecognition();
568
+ this.instance.continuous = true;
569
+ this.instance.interimResults = false;
570
+ this.instance.lang = lang;
571
+ if (getInstance) {
572
+ getInstance(this.instance);
573
+ }
574
+ this.instance.start();
575
+ this.instance.onstart = function () {
576
+ _this.status = STATUS.active;
577
+ };
578
+ this.instance.onresult = function (_ref) {
579
+ var results = _ref.results,
580
+ timeStamp = _ref.timeStamp;
581
+ _this.stopMic();
582
+ if (handleResult) {
583
+ handleResult({
584
+ results: results,
585
+ timeStamp: timeStamp
586
+ });
587
+ }
588
+ _this.results.push({
589
+ results: results,
590
+ timeStamp: timeStamp
591
+ });
592
+ };
593
+ this.instance.onnomatch = function (e) {
594
+ return onNoMatch ? onNoMatch(e) : console.warn(e);
595
+ };
596
+ this.instance.onerror = function (e) {
597
+ if (e.error === 'no-speech' || e.error === 'audio-capture') {
598
+ _this.status = STATUS.inactive;
599
+ } else if (e.error === 'not-allowed') {
600
+ _this.status = STATUS.denied;
601
+ }
602
+ console.error(e);
603
+ if (onError) {
604
+ onError(e);
605
+ }
606
+ };
607
+
608
+ /* Below Two methods run when Continuous is False */
609
+ this.instance.onspeechend = function () {
610
+ _this.status = STATUS.inactive;
611
+ };
612
+ this.instance.onaudioend = function () {
613
+ _this.status = STATUS.inactive;
614
+ };
615
+ }
616
+ }
617
+ },
618
+ computed: {
619
+ hasCustomRenderer: function hasCustomRenderer$1() {
620
+ return hasCustomRenderer(this);
621
+ },
622
+ Icon: function Icon() {
623
+ var status = this.$data.status;
624
+ var className = this.$props.className;
625
+ switch (status) {
626
+ case STATUS.active:
627
+ return createVNode(ListenSvg, {
628
+ "className": className,
629
+ "onClick": this.handleClick
630
+ }, null);
631
+ case STATUS.stopped:
632
+ case STATUS.denied:
633
+ return createVNode(MuteSvg, {
634
+ "className": className,
635
+ "onClick": this.handleClick
636
+ }, null);
637
+ default:
638
+ return createVNode(MicSvg, {
639
+ "className": className,
640
+ "onClick": this.handleClick
641
+ }, null);
642
+ }
643
+ }
644
+ },
645
+ data: function data() {
646
+ return {
647
+ status: STATUS.inactive
648
+ };
649
+ },
650
+ created: function created() {
651
+ this.results = [];
652
+ if (typeof window !== 'undefined') {
653
+ window.SpeechRecognition = window.webkitSpeechRecognition || window.SpeechRecognition || null;
654
+ if (!window.SpeechRecognition) {
655
+ 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.');
656
+ }
657
+ }
658
+ },
659
+ render: function render() {
660
+ var _this2 = this;
661
+ if (this.hasCustomRenderer) {
662
+ return this.getComponent();
663
+ }
664
+ return createVNode(IconWrapper, null, {
665
+ "default": function _default() {
666
+ return [_this2.Icon];
667
+ }
668
+ });
669
+ }
670
+ };
671
+
672
+ var CustomSvg = {
673
+ name: 'CustomSvg',
674
+ props: {
675
+ className: String,
676
+ icon: Function,
677
+ type: String
678
+ },
679
+ data: function data() {
680
+ return {
681
+ customIcon: this.$props.icon && typeof this.$props.icon === 'function' ? this.$props.icon() : null
682
+ };
683
+ },
684
+ render: function render() {
685
+ if (this.customIcon) {
686
+ return createVNode("div", {
687
+ "class": this.$props.className
688
+ }, [this.customIcon]);
689
+ }
690
+ if (this.$props.type === 'recent-search-icon') {
691
+ return createVNode("svg", {
692
+ "xmlns": "http://www.w3.org/2000/svg",
693
+ "alt": "Recent Search",
694
+ "height": "20",
695
+ "width": "20",
696
+ "viewBox": "0 0 24 24",
697
+ "style": {
698
+ fill: '#707070'
699
+ },
700
+ "class": this.$props.className
701
+ }, [createVNode("path", {
702
+ "d": "M0 0h24v24H0z",
703
+ "fill": "none"
704
+ }, null), createVNode("path", {
705
+ "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"
706
+ }, null)]);
707
+ }
708
+ if (this.$props.type === 'promoted-search-icon') {
709
+ return createVNode("svg", {
710
+ "xmlns": "http://www.w3.org/2000/svg",
711
+ "width": "20",
712
+ "alt": "promoted search",
713
+ "height": "20",
714
+ "viewBox": "0 0 24 24",
715
+ "class": this.$props.className,
716
+ "style": {
717
+ fill: '#707070'
718
+ }
719
+ }, [createVNode("path", {
720
+ "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"
721
+ }, null)]);
722
+ }
723
+ if (this.$props.type === 'popular-search-icon') {
724
+ return createVNode("svg", {
725
+ "xmlns": "http://www.w3.org/2000/svg",
726
+ "alt": "Popular Search",
727
+ "height": "20",
728
+ "width": "20",
729
+ "viewBox": "0 0 24 24",
730
+ "style": {
731
+ fill: '#707070'
732
+ },
733
+ "class": this.$props.className
734
+ }, [createVNode("path", {
735
+ "d": "M0 0h24v24H0z",
736
+ "fill": "none"
737
+ }, null), createVNode("path", {
738
+ "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"
739
+ }, null)]);
740
+ }
741
+ return createVNode(SearchSvg, {
742
+ "styles": {
743
+ position: 'relative',
744
+ fill: '#707070',
745
+ left: '3px',
746
+ marginRight: '8px'
747
+ }
748
+ }, null);
749
+ }
750
+ };
751
+
752
+ var _templateObject$3;
753
+ var AutofillSvgIcon = styled('button')(_templateObject$3 || (_templateObject$3 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tmargin-left: auto;\n\tposition: relative;\n\tright: -3px;\n\tborder: none;\n\toutline: none;\n\tbackground: transparent;\n\tpadding: 0;\n\tz-index: 111000;\n\n\tsvg {\n\t\tcursor: pointer;\n\t\tfill: #707070;\n\t\theight: 20px;\n\t}\n\n\t&:hover {\n\t\tsvg {\n\t\t\tfill: #1c1a1a;\n\t\t}\n\t}\n"])));
754
+ var AutoFillSvg = {
755
+ name: 'AutoFillSvg',
756
+ render: function render() {
757
+ return createVNode(AutofillSvgIcon, {
758
+ "onClick": this.$attrs.click
759
+ }, {
760
+ "default": function _default() {
761
+ return [createVNode("svg", {
762
+ "viewBox": "0 0 24 24"
763
+ }, [createVNode("path", {
764
+ "d": "M8 17v-7.586l8.293 8.293c0.391 0.391 1.024 0.391 1.414 0s0.391-1.024 0-1.414l-8.293-8.293h7.586c0.552 0 1-0.448 1-1s-0.448-1-1-1h-10c-0.552 0-1 0.448-1 1v10c0 0.552 0.448 1 1 1s1-0.448 1-1z"
765
+ }, null)])];
766
+ }
767
+ });
768
+ },
769
+ methods: {
770
+ clicked: function clicked(e) {
771
+ e.stopPropagation();
772
+ window.console.log('hey', e);
773
+ }
774
+ }
775
+ };
776
+
777
+ var _templateObject$4, _templateObject2;
778
+ var TagsContainer = styled('div')(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tmargin-top: 10px;\n\twidth: 100%;\n"])));
779
+ var TagItem = styled('span')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n\tcursor: default;\n\tbox-sizing: border-box;\n\tmargin: 0 4px 4px 0;\n\tcolor: #000000d9;\n\tfont-size: 14px;\n\tfont-variant: tabular-nums;\n\tline-height: 1.5715;\n\tlist-style: none;\n\tfont-feature-settings: 'tnum';\n\tdisplay: inline-block;\n\theight: auto;\n\tpadding: 0 2px 0 7px;\n\tfont-size: 12px;\n\tline-height: 22px;\n\twhite-space: nowrap;\n\tbackground: #fafafa;\n\tborder: 1px solid #d9d9d9;\n\tborder-radius: 2px;\n\topacity: 1;\n\ttransition: all 0.3s;\n\n\tspan.close-icon {\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\theight: 15px;\n\t\t\tposition: relative;\n\t\t\ttop: 4px;\n\t\t\tfill: #262626;\n\t\t}\n\t}\n"])));
780
+
781
+ var _templateObject$5, _templateObject2$1, _templateObject3;
782
+ var skeletonAnimation = keyframes(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteralLoose(["\n 0% {\n background-position: 100% 0;\n }\n 100% {\n background-position: -200% 0;\n }\n"])));
783
+ var SkeletonLoader = styled('div')(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 10px;\n"])));
784
+ var SkeletonLine = styled('div')(_templateObject3 || (_templateObject3 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\theight: 20px;\n\tbackground: linear-gradient(\n\t\t90deg,\n\t\trgba(220, 220, 220, 0.5) 25%,\n\t\trgba(240, 240, 240, 0.9) 50%,\n\t\trgba(220, 220, 220, 0.5) 75%\n\t);\n\tbackground-size: 200% 100%;\n\tanimation: ", " 1.5s infinite;\n"])), skeletonAnimation);
785
+ var HorizontalSkeletonLoader = defineComponent({
786
+ name: 'HorizontalSkeletonLoader',
787
+ render: function render() {
788
+ return createVNode(SkeletonLoader, null, {
789
+ "default": function _default() {
790
+ return [createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null), createVNode(SkeletonLine, null, null)];
791
+ }
792
+ });
793
+ }
794
+ });
795
+
796
+ var _templateObject$6, _templateObject2$2, _templateObject3$1, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11;
797
+ var Chatbox = styled('div')(_templateObject$6 || (_templateObject$6 = _taggedTemplateLiteralLoose(["\n\tposition: relative;\n\tmargin: 0 auto;\n\tpadding: 10px;\n\tbackground-color: #fafafa;\n\twidth: 100%;\n\tbox-shadow: rgb(0 0 0 / 20%) 0px 0px 6px;\n\tborder-radius: 6px;\n\tmargin-bottom: 20px;\n\tbackground-color: ", ";\n"])), function (props) {
798
+ return props.theme && props.theme.colors ? props.theme.colors.backgroundColor : '#fff';
799
+ });
800
+ var ChatContainer = styled('div')(_templateObject2$2 || (_templateObject2$2 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tflex-direction: column;\n\theight: 100%;\n\tposition: relative;\n\t.--ai-answer-error-container {\n\t\ttext-align: center;\n\t\tposition: absolute;\n\t\tbottom: 0px;\n\t\t", ";\n\t\tz-index: 1;\n\t\tleft: 50%;\n\t\ttransform: translateX(-50%);\n\t\twidth: 100%;\n\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tpadding: 10px;\n\t\t\tbackground-color: ", ";\n\t\t\tbox-shadow: 0 -5px 5px -2px\n\t\t\t\t", ";\n\n\t\t\tspan {\n\t\t\t\tmargin-bottom: 5px;\n\t\t\t}\n\n\t\t\tbutton {\n\t\t\t}\n\t\t}\n\t}\n\n\t", ";\n"])), function (props) {
801
+ return props.showInput ? 'bottom: 48px;' : '';
802
+ }, function (props) {
803
+ return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
804
+ }, function (props) {
805
+ return props.theme && props.theme.colors && props.theme.colors.backgroundColor ? props.theme.colors.backgroundColor : '#fff';
806
+ }, function (props) {
807
+ return props.showInput ? ".--ai-answer-feedback-container {\n\t\tmargin-top: 15px;\n\t\tmargin-bottom: -10px;\n\t}" : ".--ai-answer-feedback-container {\n\t\tmargin-top: 4px;\n\t}";
808
+ });
809
+ var MessagesContainer = styled('div')(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteralLoose(["\n\tmax-height: 400px;\n overflow-y: auto;\n\tpadding: 10px;\n\tdisplay: flex;\n\tflex-direction: column;\n\tmin-height: 200px;\n\n}};\n"])));
810
+ var typingDots = keyframes(_templateObject4 || (_templateObject4 = _taggedTemplateLiteralLoose(["\n 0% {\n transform: translateY(0);\n }\n 50% {\n transform: translateY(-70%);\n }\n 100% {\n transform: translateY(0);\n }\n"])));
811
+ var TypingIndicator = styled('div')(_templateObject5 || (_templateObject5 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: center;\n\tmargin: 5px !important;\n"])));
812
+ var TypingDot = styled('div')(_templateObject6 || (_templateObject6 = _taggedTemplateLiteralLoose(["\n\twidth: 6px;\n\theight: 6px;\n\tbackground-color: ", ";\n\tborder-radius: 50%;\n\tmargin: 0 2px !important;\n\tanimation: ", " 1s infinite;\n\t&:nth-child(2) {\n\t\tanimation-delay: 0.2s;\n\t}\n\t&:nth-child(3) {\n\t\tanimation-delay: 0.4s;\n\t}\n"])), function (props) {
813
+ var finalColor;
814
+ if (props.isSender) {
815
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
816
+ } else {
817
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.borderColor : props.theme.colors.textColor;
818
+ }
819
+ return finalColor;
820
+ }, typingDots);
821
+ var resetCSS = function resetCSS(props) {
822
+ return "\n\thtml,\n\tbody,\n\tdiv,\n\tspan,\n\tapplet,\n\tobject,\n\tiframe,\n\th1,\n\th2,\n\th3,\n\th4,\n\th5,\n\th6,\n\tp,\n\tblockquote,\n\tpre,\n\ta,\n\tabbr,\n\tacronym,\n\taddress,\n\tbig,\n\tcite,\n\tcode,\n\tdel,\n\tdfn,\n\tem,\n\timg,\n\tins,\n\tkbd,\n\tq,\n\ts,\n\tsamp,\n\tsmall,\n\tstrike,\n\tstrong,\n\tsub,\n\tsup,\n\ttt,\n\tvar,\n\tb,\n\tu,\n\ti,\n\tcenter,\n\tdl,\n\tdt,\n\tdd,\n\tol,\n\tul,\n\tli,\n\tfieldset,\n\tform,\n\tlabel,\n\tlegend,\n\ttable,\n\tcaption,\n\ttbody,\n\ttfoot,\n\tthead,\n\ttr,\n\tth,\n\ttd,\n\tarticle,\n\taside,\n\tcanvas,\n\tdetails,\n\tembed,\n\tfigure,\n\tfigcaption,\n\tfooter,\n\theader,\n\thgroup,\n\tmenu,\n\tnav,\n\toutput,\n\truby,\n\tsection,\n\tsummary,\n\ttime,\n\tmark,\n\taudio,\n\tvideo {\n\t\tmargin: 0;\n\t\tpadding: 0;\n\t\tborder: 0;\n\t\tfont-size: 100%;\n\t\tfont: inherit;\n\t\tvertical-align: baseline;\n\t\toverflow-wrap: anywhere;\n\t}\n\tpre {\n\t\tmargin: 10px auto;\n\t}\n\ttable {\n\t\tmargin: 10px auto;\n\t\tborder-collapse: collapse;\n\t\tborder-spacing: 0;\n\t}\n\ttr {\n\t\tborder-bottom: 1px solid #ccc;\n\t}\n\tth,\n\ttd {\n\t\ttext-align: left;\n\t\tpadding: 4px;\n\t\tborder: 1px solid;\n\t\tborder-collapse: collapse;\n\t}\n\tpre,\n\tcode {\n\t\tpadding: 0.6em 0.4em;\n\t\tbackground: " + (
823
+ // eslint-disable-next-line no-nested-ternary
824
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor : props.theme.colors.borderColor) + ";\n\t}\n\n\tcode {\n\t\tline-height: normal;\n\n\t\tcolor: " + (
825
+ // eslint-disable-next-line no-nested-ternary
826
+ props.isSender ? props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor : props.theme.colors.primaryTextColor) + ";\n\t\tborder-radius: 3px;\n\t\tfont-size: 85%;\n\t\tpadding: 0.2em 0.4em;\n\t\tmargin-top: 5px;\n\t\tdisplay: inline-block;\n\t\toverflow: auto;\n\t\twidth: fit-content;\n\t\tmax-width: 100%;\n\t}\n\tul,\n\tol {\n\t\tlist-style-position: inside;\n\n\t}\n\n\tli{\n\t\tdisplay: unset;\n\t\tcursor: default;\n\t\tpadding: initial;\n\n\t\t&:hover{\n\t\t\tbackground-color: initial;\n\t\t}\n\t}\n";
827
+ };
828
+ var messageBGColor = function messageBGColor(props) {
829
+ var finalBGColor;
830
+ if (props.isSender) {
831
+ finalBGColor = props.themePreset !== 'dark' ? props.theme.colors.primaryColor : props.theme.colors.borderColor;
832
+ } else {
833
+ finalBGColor = props.themePreset !== 'dark' ? lighten(0.53, props.theme.colors.borderColor) : props.theme.colors.backgroundColor;
834
+ }
835
+ return finalBGColor;
836
+ };
837
+ var Message = styled('div')(_templateObject7 || (_templateObject7 = _taggedTemplateLiteralLoose(["\n\tbackground-color: ", ";\n\tcolor: ", ";\n\tborder: 1px solid\n\t\t", ";\n\tpadding: 10px;\n\tborder-radius: 7px;\n\tmargin-bottom: 10px;\n\tmax-width: 80%;\n\talign-self: ", ";\n\tdisplay: inline-block;\n\tposition: relative;\n\toverflow-wrap: anywhere;\n\t", "\n"])), function (props) {
838
+ return messageBGColor(props);
839
+ }, function (props) {
840
+ var finalColor;
841
+ if (props.isSender) {
842
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.primaryTextColor : props.theme.colors.textColor;
843
+ } else {
844
+ finalColor = props.themePreset !== 'dark' ? props.theme.colors.borderColor : props.theme.colors.textColor;
845
+ }
846
+ return finalColor;
847
+ }, function (props) {
848
+ return props.themePreset === 'dark' ? 'currentColor' : messageBGColor(props);
849
+ }, function (props) {
850
+ return props.isSender ? 'flex-end' : 'flex-start';
851
+ }, function (props) {
852
+ return resetCSS(props);
853
+ });
854
+ var MessageInputContainer = styled('form')(_templateObject8 || (_templateObject8 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tpadding-top: 12px;\n\talign-items: stretch;\n\tmargin-top: 10px;\n\t.ai-enter-button-wrapper {\n\t\talign-self: baseline;\n\t\theight: 41px;\n\t}\n"])));
855
+ var MessageInput = styled(TextArea)(_templateObject9 || (_templateObject9 = _taggedTemplateLiteralLoose(["\n\twidth: 100%;\n\tborder-radius: 5px;\n\tborder: 1px solid #ccc;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\n\t::placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t:-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\n\t::-ms-input-placeholder {\n\t\tcolor: ", ";\n\t}\n\t", "\n"])), function (props) {
856
+ return props.themePreset === 'dark' ? props.theme.colors.borderColor : '#fff';
857
+ }, function (props) {
858
+ return props.themePreset === 'dark' ? props.theme.colors.titleColor : props.theme.colors.textColor;
859
+ }, function (props) {
860
+ return props.theme.colors.textColor;
861
+ }, function (props) {
862
+ return props.theme.colors.textColor;
863
+ }, function (props) {
864
+ return props.theme.colors.textColor;
865
+ }, function (_ref) {
866
+ var enterButton = _ref.enterButton;
867
+ return enterButton && "\n\t\t border-top-right-radius: 0;\n border-bottom-right-radius: 0;\n\t";
868
+ });
869
+ var SendButton = styled(Button)(_templateObject10 || (_templateObject10 = _taggedTemplateLiteralLoose(["\n\tborder: none;\n\tcolor: #ffffff;\n\tcursor: pointer;\n\tfont-size: 16px;\n\tmargin-left: 8px;\n\toutline: none;\n\tpadding: 10px;\n\ttext-align: center;\n"])));
870
+ var AIFeedbackContainer = styled('div')(_templateObject11 || (_templateObject11 = _taggedTemplateLiteralLoose(["\n\t.--feedback-svgs-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tjustify-content: flex-end;\n\t\tgap: 5px;\n\n\t\tsvg {\n\t\t\tcursor: pointer;\n\t\t\ttransition: all ease-in 0.1s;\n\t\t\t&.selected {\n\t\t\t\ttransform: scale(1.1);\n\t\t\t\tcursor: default;\n\t\t\t}\n\n\t\t\t&:hover {\n\t\t\t\ttransform: scale(1.1);\n\t\t\t}\n\t\t}\n\t}\n\n\t.--feedback-input-wrapper {\n\t\tdisplay: flex;\n\t\tgap: 7px;\n\t}\n"])));
871
+
872
+ var _templateObject$7, _templateObject2$3, _templateObject3$2, _templateObject4$1, _templateObject5$1, _templateObject6$1, _templateObject7$1;
873
+ var fadeInFromBottom = keyframes(_templateObject$7 || (_templateObject$7 = _taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
874
+ var fadeInFromTop = keyframes(_templateObject2$3 || (_templateObject2$3 = _taggedTemplateLiteralLoose(["\n 0% {\n opacity: 0;\n transform: translateY(-20px);\n }\n 100% {\n opacity: 1;\n transform: translateY(0);\n }\n"])));
875
+ var SearchBoxAISection = styled('div')(_templateObject3$2 || (_templateObject3$2 = _taggedTemplateLiteralLoose(["\n\tpadding: 10px;\n\tborder-radius: 4px;\n\tmin-height: 200px;\n\tpadding-top: 20px;\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\tjustify-content: space-between;\n\tbackground-color: ", ";\n\tcolor: ", ";\n\t.--ai-answer-error-container {\n\t\tposition: absolute;\n\t\ttop: 50%;\n\t\tleft: 50%;\n\t\ttransform: translate(-50%, -50%);\n\t\t.--default-error-element {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tgap: 10px;\n\t\t}\n\t}\n"])), function (_ref) {
876
+ var themePreset = _ref.themePreset,
877
+ theme = _ref.theme;
878
+ return themePreset === 'dark' ? '#424242' : theme.colors.backgroundColor;
879
+ }, function (_ref2) {
880
+ var theme = _ref2.theme;
881
+ return theme.colors.textColor;
882
+ });
883
+ var Question = styled('div')(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteralLoose(["\n\tfont-weight: bold;\n\tmargin-bottom: 5px;\n\tanimation: ", " 0.5s ease-out;\n"])), fadeInFromTop);
884
+ var Answer = styled('div')(_templateObject5$1 || (_templateObject5$1 = _taggedTemplateLiteralLoose(["\n\t", "\n\tposition: relative;\n\tmargin-bottom: 5px;\n\tmin-height: 100px;\n\toverflow: auto;\n\twhite-space: pre-wrap;\n\tpre {\n\t\twhite-space: pre-wrap;\n\t}\n\tcode,\n\tpre {\n\t\tdisplay: revert;\n\t}\n"])), function (props) {
885
+ return resetCSS(props);
886
+ });
887
+ var Footer = styled('div')(_templateObject6$1 || (_templateObject6$1 = _taggedTemplateLiteralLoose(["\n\tcolor: #777;\n\tdisplay: inline-flex;\n\talign-items: center;\n\tgap: 1rem;\n\tflex-wrap: wrap;\n\tanimation: ", " 0.5s ease-out;\n\tpadding: 10px 0;\n\tbackground: white;\n\tbackground-color: ", ";\n\tcolor: ", ";\n"])), fadeInFromBottom, function (_ref3) {
888
+ var themePreset = _ref3.themePreset,
889
+ theme = _ref3.theme;
890
+ return themePreset === 'dark' ? '#424242' : theme.colors.backgroundColor;
891
+ }, function (_ref4) {
892
+ var theme = _ref4.theme;
893
+ return theme.colors.textColor;
894
+ });
895
+ var SourceTags = styled('div')(_templateObject7$1 || (_templateObject7$1 = _taggedTemplateLiteralLoose(["\n\tdisplay: flex;\n\tgap: 8px;\n\tflex-wrap: wrap;\n\t.--ai-source-tag {\n\t\tdisplay: inline-block;\n\t\tmax-width: 200px;\n\t\twhite-space: nowrap;\n\t\toverflow: hidden;\n\t\ttext-overflow: ellipsis;\n\t}\n"])));
896
+
897
+ var ThumbsUpSvg = {
898
+ name: 'ThumbsUpSvg',
899
+ props: ['clickHandler', 'className'],
900
+ render: function render() {
901
+ return createVNode("svg", {
902
+ "stroke": "currentColor",
903
+ "fill": "none",
904
+ "strokeWidth": "2",
905
+ "viewBox": "0 0 24 24",
906
+ "strokeLinecap": "round",
907
+ "strokeLinejoin": "round",
908
+ "class": this.$props.className,
909
+ "height": "1em",
910
+ "width": "1em",
911
+ "xmlns": "http://www.w3.org/2000/svg",
912
+ "onClick": this.$props.clickHandler
913
+ }, [createVNode("path", {
914
+ "d": "M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3"
915
+ }, null)]);
916
+ }
917
+ };
918
+
919
+ var ThumbsDownSvg = {
920
+ name: 'ThumbsDownSvg',
921
+ props: ['clickHandler', 'className'],
922
+ render: function render() {
923
+ return createVNode("svg", {
924
+ "stroke": "currentColor",
925
+ "fill": "none",
926
+ "strokeWidth": "2",
927
+ "viewBox": "0 0 24 24",
928
+ "strokeLinecap": "round",
929
+ "strokeLinejoin": "round",
930
+ "class": this.$props.className,
931
+ "height": "1em",
932
+ "width": "1em",
933
+ "xmlns": "http://www.w3.org/2000/svg",
934
+ "onClick": this.$props.clickHandler
935
+ }, [createVNode("path", {
936
+ "d": "M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17"
937
+ }, null), ' ']);
938
+ }
939
+ };
940
+
941
+ var AIFeedback = defineComponent({
942
+ name: 'FeedbackComponent',
943
+ props: {
944
+ onFeedbackSubmit: {
945
+ type: Function,
946
+ "default": function _default() {}
947
+ },
948
+ hideUI: {
949
+ type: Boolean,
950
+ "default": false
951
+ },
952
+ overrideState: {
953
+ type: Object,
954
+ "default": function _default() {
955
+ return {};
956
+ }
957
+ }
958
+ },
959
+ setup: function setup(props, _ref) {
960
+ var emit = _ref.emit;
961
+ var showInput = ref(false);
962
+ var feedbackType = ref(null);
963
+ var feedbackText = ref('');
964
+ var feedbackRecorded = ref(false);
965
+ var handleButtonClick = function handleButtonClick(type) {
966
+ if (feedbackType.value === type) {
967
+ feedbackType.value = null;
968
+ showInput.value = false;
969
+ } else {
970
+ feedbackType.value = type;
971
+ showInput.value = true;
972
+ }
973
+ };
974
+ var handleInputChange = function handleInputChange(e) {
975
+ feedbackText.value = e.target.value;
976
+ };
977
+ var handleSubmit = function handleSubmit() {
978
+ emit('feedback-submit', feedbackType.value === 'positive', feedbackText.value);
979
+ feedbackText.value = '';
980
+ showInput.value = false;
981
+ feedbackRecorded.value = true;
982
+ };
983
+ var handleCancel = function handleCancel() {
984
+ feedbackType.value = null;
985
+ feedbackText.value = '';
986
+ showInput.value = false;
987
+ };
988
+ watch(function () {
989
+ return props.overrideState;
990
+ }, function (newValue) {
991
+ if (newValue && newValue.isRecorded) {
992
+ feedbackRecorded.value = true;
993
+ feedbackType.value = newValue.feedbackType || 'positive';
994
+ }
995
+ });
996
+ if (props.overrideState && props.overrideState.isRecorded) {
997
+ feedbackRecorded.value = true;
998
+ feedbackType.value = props.overrideState.feedbackType || 'positive';
999
+ }
1000
+ return {
1001
+ showInput: showInput,
1002
+ feedbackType: feedbackType,
1003
+ feedbackText: feedbackText,
1004
+ feedbackRecorded: feedbackRecorded,
1005
+ handleButtonClick: handleButtonClick,
1006
+ handleInputChange: handleInputChange,
1007
+ handleSubmit: handleSubmit,
1008
+ handleCancel: handleCancel
1009
+ };
1010
+ },
1011
+ render: function render() {
1012
+ var _this = this;
1013
+ if (this.$props.hideUI) {
1014
+ return null;
1015
+ }
1016
+ if (this.feedbackRecorded) {
1017
+ return createVNode(AIFeedbackContainer, null, {
1018
+ "default": function _default() {
1019
+ return [createVNode("div", {
1020
+ "class": "--feedback-svgs-wrapper"
1021
+ }, [_this.feedbackType === 'positive' ? createVNode(ThumbsUpSvg, {
1022
+ "class": "selected"
1023
+ }, null) : createVNode(ThumbsDownSvg, {
1024
+ "class": "selected"
1025
+ }, null)])];
1026
+ }
1027
+ });
1028
+ }
1029
+ return createVNode(AIFeedbackContainer, null, {
1030
+ "default": function _default() {
1031
+ return [!_this.showInput && createVNode("div", {
1032
+ "class": "--feedback-svgs-wrapper"
1033
+ }, [createVNode(ThumbsUpSvg, {
1034
+ "class": _this.feedbackType === 'positive' ? 'selected' : '',
1035
+ "onClick": function onClick() {
1036
+ return _this.handleButtonClick('positive');
1037
+ }
1038
+ }, null), createVNode(ThumbsDownSvg, {
1039
+ "class": _this.feedbackType === 'negative' ? 'selected' : '',
1040
+ "onClick": function onClick() {
1041
+ return _this.handleButtonClick('negative');
1042
+ }
1043
+ }, null)]), _this.showInput && createVNode("div", {
1044
+ "class": "--feedback-input-wrapper"
1045
+ }, [createVNode(Input, {
1046
+ "show": _this.showInput,
1047
+ "placeholder": _this.feedbackType === 'positive' ? 'What do you like about the response?' : 'What was the issue with the response? How can it be improved?',
1048
+ "value": _this.feedbackText,
1049
+ "onInput": _this.handleInputChange
1050
+ }, null), createVNode(Button, {
1051
+ "primary": true,
1052
+ "onClick": _this.handleSubmit
1053
+ }, {
1054
+ "default": function _default() {
1055
+ return [createTextVNode("Submit")];
1056
+ }
1057
+ }), createVNode(Button, {
1058
+ "onClick": _this.handleCancel
1059
+ }, {
1060
+ "default": function _default() {
1061
+ return [createTextVNode("Cancel")];
1062
+ }
1063
+ })])];
1064
+ }
1065
+ });
1066
+ }
1067
+ });
1068
+
1069
+ var _excluded = ["_source"];
1070
+ function _isSlot(s) {
1071
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
1072
+ }
1073
+ var md = new Remarkable();
1074
+ md.set({
1075
+ html: true,
1076
+ breaks: true,
1077
+ xhtmlOut: true
1078
+ });
1079
+ var _dropdownULRef = 'dropdownULRef';
1080
+ var _inputGroupRef = 'inputGroupRef';
1081
+ var updateQuery = Actions.updateQuery,
1082
+ setCustomQuery = Actions.setCustomQuery,
1083
+ setDefaultQuery = Actions.setDefaultQuery,
1084
+ recordSuggestionClick = Actions.recordSuggestionClick;
1085
+ var _debounce = helper.debounce,
1086
+ checkValueChange = helper.checkValueChange,
1087
+ getClassName$1 = helper.getClassName,
1088
+ isEqual = helper.isEqual,
1089
+ getCompositeAggsQuery = helper.getCompositeAggsQuery,
1090
+ withClickIds = helper.withClickIds,
1091
+ getResultStats = helper.getResultStats;
1092
+ var SearchBox = defineComponent({
1093
+ name: 'SearchBox',
1094
+ isTagsMode: false,
1095
+ data: function data() {
1096
+ var props = this.$props;
1097
+ this.__state = {
1098
+ currentValue: '',
1099
+ selectedTags: [],
1100
+ isOpen: false,
1101
+ normalizedSuggestions: [],
1102
+ showAIScreen: false,
1103
+ showAIScreenFooter: false,
1104
+ showFeedbackComponent: false,
1105
+ feedbackState: null
1106
+ };
1107
+ this.internalComponent = props.componentId + "__internal";
1108
+ return this.__state;
1109
+ },
1110
+ inject: {
1111
+ theme: {
1112
+ from: 'theme_reactivesearch'
1113
+ }
1114
+ },
1115
+ created: function created() {
1116
+ var mode = this.$props.mode;
1117
+ if (mode === SEARCH_COMPONENTS_MODES.TAG) {
1118
+ this.$options.isTagsMode = true;
1119
+ }
1120
+ if (this.$options.isTagsMode) {
1121
+ console.warn('Warning(ReactiveSearch): The `categoryField` prop is not supported when `mode` prop is set to `tag`');
1122
+ }
1123
+ this.currentValue = decodeHtml(this.selectedValue || this.value || this.defaultValue || '');
1124
+ if (this.$options.isTagsMode) {
1125
+ this.currentValue = '';
1126
+ }
1127
+ this.handleTextChange = _debounce(this.handleText, this.$props.debounce);
1128
+
1129
+ // Set custom and default queries in store
1130
+ this.triggerCustomQuery(this.currentValue, this.selectedCategory);
1131
+ this.triggerDefaultQuery(this.currentValue);
1132
+ if (this.selectedValue) {
1133
+ this.setValue(this.selectedValue, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
1134
+ } else if (this.$props.value) {
1135
+ this.setValue(this.$props.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
1136
+ } else if (this.$props.defaultValue) {
1137
+ this.setValue(this.$props.defaultValue, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined);
1138
+ }
1139
+ },
1140
+ computed: {
1141
+ hasCustomRenderer: function hasCustomRenderer$1() {
1142
+ return hasCustomRenderer(this);
1143
+ },
1144
+ stats: function stats() {
1145
+ return getResultStats(this);
1146
+ }
1147
+ },
1148
+ props: {
1149
+ autoFocus: VueTypes.bool,
1150
+ autosuggest: VueTypes.bool.def(true),
1151
+ beforeValueChange: types.func,
1152
+ className: VueTypes.string.def(''),
1153
+ clearIcon: types.children,
1154
+ componentId: types.stringRequired,
1155
+ customHighlight: types.func,
1156
+ customQuery: types.func,
1157
+ defaultQuery: types.func,
1158
+ dataField: VueTypes.oneOfType([VueTypes.string, VueTypes.shape({
1159
+ field: VueTypes.string,
1160
+ weight: VueTypes.number
1161
+ }), VueTypes.arrayOf(VueTypes.string), VueTypes.arrayOf({
1162
+ field: VueTypes.string,
1163
+ weight: VueTypes.number
1164
+ })]),
1165
+ aggregationField: types.string,
1166
+ aggregationSize: VueTypes.number,
1167
+ size: VueTypes.number,
1168
+ debounce: VueTypes.number.def(0),
1169
+ defaultValue: types.string,
1170
+ excludeFields: types.excludeFields,
1171
+ value: VueTypes.oneOfType([VueTypes.arrayOf(VueTypes.string), types.value]),
1172
+ defaultSuggestions: types.suggestions,
1173
+ enableSynonyms: VueTypes.bool.def(true),
1174
+ enableQuerySuggestions: VueTypes.bool.def(false),
1175
+ enablePopularSuggestions: VueTypes.bool.def(false),
1176
+ enableRecentSuggestions: VueTypes.bool.def(false),
1177
+ fieldWeights: types.fieldWeights,
1178
+ filterLabel: types.string,
1179
+ fuzziness: types.fuzziness,
1180
+ highlight: VueTypes.bool,
1181
+ highlightField: types.stringOrArray,
1182
+ icon: types.children,
1183
+ iconPosition: VueTypes.oneOf(['left', 'right']).def('left'),
1184
+ includeFields: types.includeFields,
1185
+ innerClass: types.style,
1186
+ innerRef: VueTypes.string.def('searchInputField'),
1187
+ render: types.func,
1188
+ renderNoSuggestion: types.title,
1189
+ renderError: types.title,
1190
+ placeholder: VueTypes.string.def('Search'),
1191
+ queryFormat: VueTypes.oneOf(['and', 'or']).def('or'),
1192
+ react: types.react,
1193
+ showClear: VueTypes.bool.def(true),
1194
+ showDistinctSuggestions: VueTypes.bool.def(true),
1195
+ showFilter: VueTypes.bool.def(true),
1196
+ showIcon: VueTypes.bool.def(true),
1197
+ title: types.title,
1198
+ URLParams: VueTypes.bool.def(false),
1199
+ strictSelection: VueTypes.bool.def(false),
1200
+ nestedField: types.string,
1201
+ enablePredictiveSuggestions: VueTypes.bool.def(false),
1202
+ recentSearchesIcon: VueTypes.any,
1203
+ popularSearchesIcon: VueTypes.any,
1204
+ // mic props
1205
+ showVoiceSearch: VueTypes.bool.def(false),
1206
+ getMicInstance: types.func,
1207
+ renderMic: types.func,
1208
+ distinctField: types.string,
1209
+ distinctFieldConfig: types.props,
1210
+ //
1211
+ focusShortcuts: VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, VueTypes.number])).def(['/']),
1212
+ addonBefore: VueTypes.any,
1213
+ addonAfter: VueTypes.any,
1214
+ expandSuggestionsContainer: VueTypes.bool.def(true),
1215
+ index: VueTypes.string,
1216
+ popularSuggestionsConfig: VueTypes.object,
1217
+ recentSuggestionsConfig: VueTypes.object,
1218
+ applyStopwords: VueTypes.bool,
1219
+ customStopwords: types.stringArray,
1220
+ onData: types.func,
1221
+ renderItem: types.func,
1222
+ enterButton: VueTypes.bool.def(false),
1223
+ renderEnterButton: VueTypes.any,
1224
+ mode: VueTypes.oneOf(['select', 'tag']).def('select'),
1225
+ renderSelectedTags: VueTypes.any,
1226
+ searchboxId: VueTypes.string,
1227
+ endpoint: types.endpointConfig,
1228
+ enableAI: VueTypes.bool.def(false),
1229
+ AIConfig: types.AIConfig,
1230
+ AIUIConfig: types.AIUIConfig
1231
+ },
1232
+ mounted: function mounted() {
1233
+ this.listenForFocusShortcuts();
1234
+ },
1235
+ watch: {
1236
+ dataField: function dataField(newVal, oldVal) {
1237
+ if (!isEqual(newVal, oldVal)) {
1238
+ this.triggerCustomQuery(this.$data.currentValue);
1239
+ }
1240
+ },
1241
+ fieldWeights: function fieldWeights() {
1242
+ this.triggerCustomQuery(this.$data.currentValue);
1243
+ },
1244
+ fuzziness: function fuzziness() {
1245
+ this.triggerCustomQuery(this.$data.currentValue);
1246
+ },
1247
+ queryFormat: function queryFormat() {
1248
+ this.triggerCustomQuery(this.$data.currentValue);
1249
+ },
1250
+ defaultValue: function defaultValue(newVal) {
1251
+ this.setValue(newVal, true, this.$props);
1252
+ },
1253
+ value: function value(newVal, oldVal) {
1254
+ if (!isEqual(newVal, oldVal)) {
1255
+ this.setValue(newVal, true, this.$props, newVal === '' ? causes.CLEAR_VALUE : undefined, false);
1256
+ }
1257
+ },
1258
+ defaultQuery: function defaultQuery(newVal, oldVal) {
1259
+ if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
1260
+ this.triggerDefaultQuery(this.$data.currentValue);
1261
+ }
1262
+ },
1263
+ customQuery: function customQuery(newVal, oldVal) {
1264
+ if (!isQueryIdentical(newVal, oldVal, this.$data.currentValue, this.$props)) {
1265
+ this.triggerCustomQuery(this.$data.currentValue);
1266
+ }
1267
+ },
1268
+ suggestions: function suggestions(newVal) {
1269
+ var suggestionsList = [];
1270
+ if (Array.isArray(newVal) && newVal.length) {
1271
+ suggestionsList = [].concat(withClickIds(newVal));
1272
+ } else if (Array.isArray(this.$props.defaultSuggestions) && this.$props.defaultSuggestions.length) {
1273
+ suggestionsList = [].concat(withClickIds(this.$props.defaultSuggestions));
1274
+ }
1275
+ this.normalizedSuggestions = suggestionsList;
1276
+ this.handleTextAreaHeightChange();
1277
+ },
1278
+ selectedValue: function selectedValue(newVal, oldVal) {
1279
+ if (!isEqual(newVal, oldVal) && (this.$options.isTagsMode ? !isEqual(this.$data.selectedTags, newVal) : this.$data.currentValue !== newVal)) {
1280
+ if (!newVal && this.$data.currentValue) {
1281
+ // selected value is cleared, call onValueSelected
1282
+ this.onValueSelectedHandler('', causes.CLEAR_VALUE);
1283
+ }
1284
+ if (this.$options.isTagsMode) {
1285
+ // handling reset of tags through SelectedFilters or URL
1286
+ this.selectedTags = [];
1287
+ }
1288
+ var cause = !newVal ? causes.CLEAR_VALUE : undefined;
1289
+ if (this.$options.isTagsMode) {
1290
+ cause = causes.SUGGESTION_SELECT;
1291
+ }
1292
+ this.setValue(newVal || '', true, this.$props, cause);
1293
+ }
1294
+ },
1295
+ focusShortcuts: function focusShortcuts() {
1296
+ this.listenForFocusShortcuts();
1297
+ },
1298
+ rawData: function rawData(newVal) {
1299
+ this.$emit('on-data', {
1300
+ data: this.normalizedSuggestions,
1301
+ rawData: newVal,
1302
+ aggregationData: this.aggregationData,
1303
+ loading: this.isLoading,
1304
+ error: this.isError
1305
+ });
1306
+ },
1307
+ aggregationData: function aggregationData(newVal) {
1308
+ this.$emit('on-data', {
1309
+ data: this.normalizedSuggestions,
1310
+ rawData: this.rawData,
1311
+ aggregationData: newVal,
1312
+ loading: this.isLoading,
1313
+ error: this.isError
1314
+ });
1315
+ },
1316
+ loading: function loading(newVal) {
1317
+ this.$emit('on-data', {
1318
+ data: this.normalizedSuggestions,
1319
+ rawData: this.rawData,
1320
+ aggregationData: this.aggregationData,
1321
+ loading: newVal,
1322
+ error: this.isError
1323
+ });
1324
+ },
1325
+ error: function error(newVal) {
1326
+ this.$emit('on-data', {
1327
+ data: this.normalizedSuggestions,
1328
+ rawData: this.rawData,
1329
+ aggregationData: this.aggregationData,
1330
+ loading: this.isLoading,
1331
+ error: newVal
1332
+ });
1333
+ },
1334
+ debounce: function debounce(newVal, oldVal) {
1335
+ if (!isEqual(newVal, oldVal)) {
1336
+ this.handleTextChange = _debounce(this.handleText, newVal);
1337
+ }
1338
+ },
1339
+ isAITyping: function isAITyping(newVal, oldVal) {
1340
+ var _this = this;
1341
+ var scrollAIContainer = function scrollAIContainer() {
1342
+ var dropdownEle = _this.$refs[_dropdownULRef];
1343
+ if (dropdownEle) {
1344
+ dropdownEle.scrollTo({
1345
+ top: dropdownEle.scrollHeight,
1346
+ behavior: 'smooth'
1347
+ });
1348
+ }
1349
+ };
1350
+ if (!newVal && oldVal) {
1351
+ this.showAIScreenFooter = true;
1352
+ if (this.$props.AIUIConfig && typeof this.$props.AIUIConfig.showFeedback === 'boolean' ? this.$props.AIUIConfig.showFeedback : true) {
1353
+ this.showFeedbackComponent = true;
1354
+ }
1355
+ setTimeout(function () {
1356
+ scrollAIContainer();
1357
+ }, 500);
1358
+ } else if (newVal) {
1359
+ this.scrollTimerRef = setTimeout(function () {
1360
+ scrollAIContainer();
1361
+ }, 2000);
1362
+ }
1363
+ },
1364
+ showAIScreen: function showAIScreen(newVal) {
1365
+ if (newVal) {
1366
+ var _this$$refs;
1367
+ if ((_this$$refs = this.$refs) != null && _this$$refs[this.$props.innerRef] && this.$refs[this.$props.innerRef].$el) {
1368
+ this.$refs[this.$props.innerRef].$el.blur();
1369
+ }
1370
+ } else {
1371
+ this.feedbackState = null;
1372
+ this.showFeedbackComponent = false;
1373
+ }
1374
+ },
1375
+ currentValue: function currentValue() {
1376
+ this.handleTextAreaHeightChange();
1377
+ }
1378
+ },
1379
+ methods: {
1380
+ handleText: function handleText(value, cause) {
1381
+ if (cause === causes.CLEAR_VALUE) {
1382
+ this.triggerCustomQuery(value);
1383
+ this.triggerDefaultQuery(value);
1384
+ } else if (this.$props.autosuggest) {
1385
+ this.triggerDefaultQuery(value);
1386
+ } else if (!this.$props.enterButton) {
1387
+ this.triggerCustomQuery(value);
1388
+ }
1389
+ },
1390
+ getComponent: function getComponent$1(downshiftProps) {
1391
+ if (downshiftProps === void 0) {
1392
+ downshiftProps = {};
1393
+ }
1394
+ var currentValue = this.$data.currentValue;
1395
+ var data = {
1396
+ error: this.error,
1397
+ loading: this.isLoading,
1398
+ downshiftProps: downshiftProps,
1399
+ data: this.normalizedSuggestions,
1400
+ rawData: this.rawData,
1401
+ value: currentValue,
1402
+ resultStats: this.stats,
1403
+ AIData: {
1404
+ question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
1405
+ answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
1406
+ documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
1407
+ showAIScreen: this.showAIScreen,
1408
+ sources: this.getAISourceObjects(),
1409
+ isAILoading: this.isAIResponseLoading,
1410
+ AIError: this.AIResponseError
1411
+ }
1412
+ };
1413
+ return createVNode("div", {
1414
+ "ref": _dropdownULRef
1415
+ }, [getComponent(data, this)]);
1416
+ },
1417
+ // returns size and aggs property
1418
+ getBasicQueryOptions: function getBasicQueryOptions() {
1419
+ var aggregationField = this.$props.aggregationField;
1420
+ var queryOptions = getQueryOptions(this.$props);
1421
+ if (aggregationField) {
1422
+ queryOptions.aggs = getCompositeAggsQuery({
1423
+ props: this.$props,
1424
+ showTopHits: true
1425
+ }).aggs;
1426
+ }
1427
+ return queryOptions;
1428
+ },
1429
+ handleSearchIconClick: function handleSearchIconClick() {
1430
+ var currentValue = this.currentValue;
1431
+ if (currentValue.trim()) {
1432
+ this.setValue(currentValue, true);
1433
+ this.onValueSelectedHandler(currentValue, causes.SEARCH_ICON_CLICK);
1434
+ }
1435
+ },
1436
+ setValue: function setValue(value, isDefaultValue, props, cause, toggleIsOpen, categoryValue) {
1437
+ var _this2 = this;
1438
+ if (isDefaultValue === void 0) {
1439
+ isDefaultValue = false;
1440
+ }
1441
+ if (props === void 0) {
1442
+ props = this.$props;
1443
+ }
1444
+ if (toggleIsOpen === void 0) {
1445
+ toggleIsOpen = true;
1446
+ }
1447
+ if (categoryValue === void 0) {
1448
+ categoryValue = undefined;
1449
+ }
1450
+ var performUpdate = function performUpdate() {
1451
+ if (_this2.$options.isTagsMode && isEqual(value, _this2.selectedTags)) {
1452
+ return;
1453
+ }
1454
+ if (_this2.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1455
+ if (Array.isArray(_this2.selectedTags) && _this2.selectedTags.length) {
1456
+ // check if value already present in selectedTags
1457
+ if (typeof value === 'string' && _this2.selectedTags.includes(value)) {
1458
+ _this2.isOpen = false;
1459
+ return;
1460
+ }
1461
+ _this2.selectedTags = [].concat(_this2.selectedTags);
1462
+ if (typeof value === 'string' && !!value) {
1463
+ _this2.selectedTags.push(value);
1464
+ } else if (Array.isArray(value) && !isEqual(_this2.selectedTags, value)) {
1465
+ _this2.selectedTags = value;
1466
+ }
1467
+ } else if (value) {
1468
+ _this2.selectedTags = typeof value !== 'string' ? value : [].concat(value);
1469
+ }
1470
+ _this2.currentValue = '';
1471
+ } else {
1472
+ _this2.currentValue = decodeHtml(value);
1473
+ }
1474
+ var queryHandlerValue = value;
1475
+ if (_this2.$options.isTagsMode && cause === causes.SUGGESTION_SELECT) {
1476
+ queryHandlerValue = Array.isArray(_this2.selectedTags) && _this2.selectedTags.length ? _this2.selectedTags : undefined;
1477
+ }
1478
+ if (isDefaultValue) {
1479
+ if (_this2.$props.autosuggest) {
1480
+ if (toggleIsOpen) {
1481
+ _this2.isOpen = false;
1482
+ }
1483
+ if (typeof _this2.currentValue === 'string') _this2.triggerDefaultQuery(_this2.currentValue, props.enableAI ? {
1484
+ enableAI: true
1485
+ } : {});
1486
+ } // in case of strict selection only SUGGESTION_SELECT should be able
1487
+ // to set the query otherwise the value should reset
1488
+ if (props.strictSelection) {
1489
+ if (cause === causes.SUGGESTION_SELECT || (_this2.$options.isTagsMode ? _this2.selectedTags.length === 0 : value === '')) {
1490
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
1491
+ } else {
1492
+ _this2.setValue('', true);
1493
+ }
1494
+ } else if (props.value === undefined || cause === causes.SUGGESTION_SELECT || cause === causes.CLEAR_VALUE) {
1495
+ _this2.triggerCustomQuery(queryHandlerValue, _this2.$options.isTagsMode ? undefined : categoryValue);
1496
+ }
1497
+ } else {
1498
+ // debounce for handling text while typing
1499
+ _this2.handleTextChange(value, cause);
1500
+ }
1501
+ _this2.$emit('valueChange', value);
1502
+ _this2.$emit('value-change', value);
1503
+ };
1504
+ checkValueChange(props.componentId, value, props.beforeValueChange, performUpdate);
1505
+ },
1506
+ triggerDefaultQuery: function triggerDefaultQuery(paramValue, meta) {
1507
+ if (meta === void 0) {
1508
+ meta = {};
1509
+ }
1510
+ if (!this.$props.autosuggest) {
1511
+ return;
1512
+ }
1513
+ var value = typeof paramValue !== 'string' ? this.currentValue : paramValue;
1514
+ var query = SearchBox.defaultQuery(value, this.$props);
1515
+ if (this.defaultQuery) {
1516
+ var defaultQueryToBeSet = this.defaultQuery(value, this.$props) || {};
1517
+ if (defaultQueryToBeSet.query) {
1518
+ query = defaultQueryToBeSet.query;
1519
+ }
1520
+
1521
+ // Update calculated default query in store
1522
+ updateDefaultQuery(this.$props.componentId, this.setDefaultQuery, this.$props, value);
1523
+ }
1524
+ this.updateQuery({
1525
+ componentId: this.internalComponent,
1526
+ query: query,
1527
+ value: value,
1528
+ componentType: componentTypes.searchBox,
1529
+ meta: meta
1530
+ });
1531
+ },
1532
+ triggerCustomQuery: function triggerCustomQuery(paramValue, categoryValue) {
1533
+ if (categoryValue === void 0) {
1534
+ categoryValue = undefined;
1535
+ }
1536
+ var _this$$props = this.$props,
1537
+ customQuery = _this$$props.customQuery,
1538
+ filterLabel = _this$$props.filterLabel,
1539
+ showFilter = _this$$props.showFilter,
1540
+ URLParams = _this$$props.URLParams;
1541
+ var value = typeof paramValue !== 'string' ? this.$data.currentValue : paramValue;
1542
+ if (this.$options.isTagsMode) {
1543
+ value = paramValue;
1544
+ }
1545
+ var defaultQueryTobeSet = SearchBox.defaultQuery("" + value + (categoryValue ? " in " + categoryValue : ''), this.$props);
1546
+ var query = defaultQueryTobeSet;
1547
+ if (customQuery) {
1548
+ var customQueryTobeSet = customQuery(value, this.$props);
1549
+ var queryTobeSet = customQueryTobeSet.query;
1550
+ if (queryTobeSet) {
1551
+ query = queryTobeSet;
1552
+ }
1553
+ updateCustomQuery(this.$props.componentId, this.setCustomQuery, this.$props, value);
1554
+ }
1555
+ this.updateQuery({
1556
+ componentId: this.$props.componentId,
1557
+ query: query,
1558
+ value: value,
1559
+ label: filterLabel,
1560
+ showFilter: showFilter,
1561
+ URLParams: URLParams,
1562
+ componentType: componentTypes.searchBox,
1563
+ category: categoryValue
1564
+ });
1565
+ },
1566
+ handleFocus: function handleFocus(event) {
1567
+ if (this.$props.autosuggest) {
1568
+ this.isOpen = true;
1569
+ }
1570
+ this.$emit('focus', event);
1571
+ },
1572
+ handleVoiceResults: function handleVoiceResults(_ref) {
1573
+ var results = _ref.results;
1574
+ if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
1575
+ this.setValue(results[0][0].transcript.trim(), true);
1576
+ }
1577
+ },
1578
+ triggerQuery: function triggerQuery(_ref2) {
1579
+ var _ref2$isOpen = _ref2.isOpen,
1580
+ isOpen = _ref2$isOpen === void 0 ? undefined : _ref2$isOpen,
1581
+ _ref2$customQuery = _ref2.customQuery,
1582
+ customQuery = _ref2$customQuery === void 0 ? true : _ref2$customQuery,
1583
+ _ref2$defaultQuery = _ref2.defaultQuery,
1584
+ defaultQuery = _ref2$defaultQuery === void 0 ? true : _ref2$defaultQuery,
1585
+ _ref2$value = _ref2.value,
1586
+ value = _ref2$value === void 0 ? undefined : _ref2$value,
1587
+ _ref2$categoryValue = _ref2.categoryValue,
1588
+ categoryValue = _ref2$categoryValue === void 0 ? undefined : _ref2$categoryValue;
1589
+ if (typeof isOpen === 'boolean') {
1590
+ this.isOpen = isOpen;
1591
+ }
1592
+ if (customQuery) {
1593
+ this.triggerCustomQuery(value, categoryValue);
1594
+ }
1595
+ if (defaultQuery) {
1596
+ this.triggerDefaultQuery(value);
1597
+ }
1598
+ },
1599
+ triggerClickAnalytics: function triggerClickAnalytics(searchPosition, documentId) {
1600
+ // click analytics would only work client side and after javascript loads
1601
+ var docId = documentId;
1602
+ if (!docId) {
1603
+ var hitData = this.normalizedSuggestions.find(function (hit) {
1604
+ return hit._click_id === searchPosition;
1605
+ });
1606
+ if (hitData && hitData.source && hitData.source._id) {
1607
+ docId = hitData.source._id;
1608
+ }
1609
+ }
1610
+ this.recordSuggestionClick(searchPosition, docId);
1611
+ },
1612
+ clearValue: function clearValue() {
1613
+ this.setValue('', false, this.$props, !this.$options.isTagsMode ? causes.CLEAR_VALUE : undefined, false);
1614
+ this.onValueSelectedHandler('', !this.$options.isTagsMode ? causes.CLEAR_VALUE : undefined);
1615
+ },
1616
+ handleKeyDown: function handleKeyDown(event, highlightedIndex) {
1617
+ if (highlightedIndex === void 0) {
1618
+ highlightedIndex = null;
1619
+ }
1620
+ // if a suggestion was selected, delegate the handling to suggestion handler
1621
+ if (event.key === 'Enter') {
1622
+ if (this.$props.autosuggest === false) {
1623
+ this.enterButtonOnClick();
1624
+ } else if (highlightedIndex === null) {
1625
+ this.setValue(event.target.value, true, this.$props, this.$options.isTagsMode ? causes.SUGGESTION_SELECT : undefined,
1626
+ // to handle tags
1627
+ !this.$props.enableAI);
1628
+ if (this.$props.enableAI && !this.showAIScreen) {
1629
+ this.showAIScreen = true;
1630
+ }
1631
+ this.onValueSelectedHandler(event.target.value, causes.ENTER_PRESS);
1632
+ }
1633
+ }
1634
+
1635
+ // Need to review
1636
+ this.$emit('keyDown', event, this.triggerQuery);
1637
+ this.$emit('key-down', event, this.triggerQuery);
1638
+ },
1639
+ onInputChange: function onInputChange(e) {
1640
+ var _this3 = this;
1641
+ var inputValue = e.target.value;
1642
+ if (!this.$data.isOpen && this.$props.autosuggest) {
1643
+ this.isOpen = true;
1644
+ }
1645
+ if (this.showAIScreen) {
1646
+ this.showAIScreen = false;
1647
+ }
1648
+ var value = this.$props.value;
1649
+ if (value === undefined) {
1650
+ this.setValue(inputValue, false, this.$props, undefined);
1651
+ } else {
1652
+ this.$emit('change', inputValue, function (_ref3) {
1653
+ var isOpen = _ref3.isOpen;
1654
+ return _this3.triggerQuery({
1655
+ defaultQuery: true,
1656
+ customQuery: true,
1657
+ value: inputValue,
1658
+ isOpen: isOpen
1659
+ });
1660
+ }, e);
1661
+ }
1662
+ },
1663
+ onSuggestionSelected: function onSuggestionSelected(suggestion) {
1664
+ var _this4 = this;
1665
+ if (!this.$props.enableAI) this.isOpen = false;else {
1666
+ this.showAIScreen = true;
1667
+ }
1668
+ var value = this.$props.value;
1669
+ // Record analytics for selected suggestions
1670
+ this.triggerClickAnalytics(suggestion._click_id);
1671
+ if (value === undefined) {
1672
+ this.setValue(suggestion.value, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
1673
+ } else {
1674
+ var emitValue = suggestion.value;
1675
+ if (this.$options.isTagsMode) {
1676
+ emitValue = Array.isArray(this.selectedTags) ? [].concat(this.selectedTags) : [];
1677
+ if (this.selectedTags.includes(suggestion.value)) {
1678
+ // avoid duplicates in tags array
1679
+ this.isOpen = false;
1680
+ return;
1681
+ }
1682
+ emitValue.push(suggestion.value);
1683
+ }
1684
+ this.setValue(emitValue, true, this.$props, causes.SUGGESTION_SELECT, false, suggestion._category);
1685
+ this.$emit('change', emitValue, function (_ref4) {
1686
+ var isOpen = _ref4.isOpen;
1687
+ return _this4.triggerQuery(_extends({
1688
+ isOpen: isOpen,
1689
+ value: emitValue
1690
+ }, !_this4.$options.isTagsMode && {
1691
+ categoryValue: suggestion._category
1692
+ }));
1693
+ });
1694
+ }
1695
+ this.onValueSelectedHandler(suggestion.value, causes.SUGGESTION_SELECT, suggestion.source);
1696
+ },
1697
+ onValueSelectedHandler: function onValueSelectedHandler(currentValue) {
1698
+ if (currentValue === void 0) {
1699
+ currentValue = this.$data.currentValue;
1700
+ }
1701
+ for (var _len = arguments.length, cause = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1702
+ cause[_key - 1] = arguments[_key];
1703
+ }
1704
+ this.$emit.apply(this, ['valueSelected', currentValue].concat(cause));
1705
+ this.$emit.apply(this, ['value-selected', currentValue].concat(cause));
1706
+ },
1707
+ handleStateChange: function handleStateChange(changes) {
1708
+ var isOpen = changes.isOpen;
1709
+ this.isOpen = isOpen;
1710
+ },
1711
+ getBackgroundColor: function getBackgroundColor(highlightedIndex, index) {
1712
+ var isDark = this.themePreset === 'dark';
1713
+ if (isDark) {
1714
+ return highlightedIndex === index ? '#555' : '#424242';
1715
+ }
1716
+ return highlightedIndex === index ? '#eee' : '#fff';
1717
+ },
1718
+ renderIcon: function renderIcon() {
1719
+ if (this.$props.showIcon) {
1720
+ return this.$props.icon || createVNode(SearchSvg, null, null);
1721
+ }
1722
+ return null;
1723
+ },
1724
+ renderErrorComponent: function renderErrorComponent(isAIError) {
1725
+ var _this5 = this;
1726
+ if (isAIError === void 0) {
1727
+ isAIError = false;
1728
+ }
1729
+ var renderError = this.$slots.renderError || this.$props.renderError;
1730
+ if (isAIError) {
1731
+ if (this.showAIScreen && this.AIResponseError && !this.isAIResponseLoading) {
1732
+ if (renderError) {
1733
+ return createVNode("div", {
1734
+ "class": "--ai-answer-error-container " + (getClassName$1(this.$props.innerClass, 'ai-error') || '')
1735
+ }, [renderError(this.AIResponseError)]);
1736
+ }
1737
+ return createVNode("div", {
1738
+ "class": "--ai-answer-error-container " + (getClassName$1(this.$props.innerClass, 'ai-error') || '')
1739
+ }, [createVNode("div", {
1740
+ "class": "--default-error-element"
1741
+ }, [createVNode("span", null, [typeof this.AIResponseError === 'string' ? this.AIResponseError : this.AIResponseError.message ? this.AIResponseError.message : 'There was an error in generating the response.', this.AIResponseError.code ? "Code:\n\t\t\t\t\t\t\t" + this.AIResponseError.code : ''])])]);
1742
+ }
1743
+ }
1744
+ if (this.error && renderError && this.$data.currentValue && !this.isLoading) {
1745
+ return createVNode(SuggestionWrapper, {
1746
+ "innerClass": this.$props.innerClass,
1747
+ "innerClassName": "error",
1748
+ "theme": this.theme,
1749
+ "themePreset": this.themePreset
1750
+ }, {
1751
+ "default": function _default() {
1752
+ return [isFunction(renderError) ? renderError(_this5.error) : renderError];
1753
+ }
1754
+ });
1755
+ }
1756
+ return null;
1757
+ },
1758
+ renderCancelIcon: function renderCancelIcon() {
1759
+ if (this.$props.showClear) {
1760
+ return this.$props.clearIcon || createVNode(CancelSvg, null, null);
1761
+ }
1762
+ return null;
1763
+ },
1764
+ renderNoSuggestions: function renderNoSuggestions(finalSuggestionsList) {
1765
+ if (finalSuggestionsList === void 0) {
1766
+ finalSuggestionsList = [];
1767
+ }
1768
+ var innerClass = this.$props.innerClass;
1769
+ var renderNoSuggestion = this.$slots.renderNoSuggestion || this.$props.renderNoSuggestion;
1770
+ var renderError = this.$slots.renderError || this.$props.renderError;
1771
+ var _this$$data = this.$data,
1772
+ isOpen = _this$$data.isOpen,
1773
+ currentValue = _this$$data.currentValue;
1774
+ if (renderNoSuggestion && isOpen && !finalSuggestionsList.length && !this.isLoading && currentValue && !(renderError && this.error)) {
1775
+ return createVNode(SuggestionWrapper, {
1776
+ "innerClass": innerClass,
1777
+ "themePreset": this.themePreset,
1778
+ "theme": this.theme,
1779
+ "innerClassName": "noSuggestion"
1780
+ }, {
1781
+ "default": function _default() {
1782
+ return typeof renderNoSuggestion === 'function' ? renderNoSuggestion(currentValue) : renderNoSuggestion;
1783
+ }
1784
+ });
1785
+ }
1786
+ return null;
1787
+ },
1788
+ renderInputAddonBefore: function renderInputAddonBefore() {
1789
+ var addonBefore = this.$slots.addonBefore;
1790
+ if (addonBefore) {
1791
+ var _slot;
1792
+ return createVNode(InputAddon, {
1793
+ "class": "addon-before"
1794
+ }, _isSlot(_slot = addonBefore()) ? _slot : {
1795
+ "default": function _default() {
1796
+ return [_slot];
1797
+ }
1798
+ });
1799
+ }
1800
+ return null;
1801
+ },
1802
+ renderInputAddonAfter: function renderInputAddonAfter() {
1803
+ var addonAfter = this.$slots.addonAfter;
1804
+ if (addonAfter) {
1805
+ var _slot2;
1806
+ return createVNode(InputAddon, {
1807
+ "class": "addon-after"
1808
+ }, _isSlot(_slot2 = addonAfter()) ? _slot2 : {
1809
+ "default": function _default() {
1810
+ return [_slot2];
1811
+ }
1812
+ });
1813
+ }
1814
+ return null;
1815
+ },
1816
+ enterButtonOnClick: function enterButtonOnClick() {
1817
+ this.showAIScreen = false;
1818
+ this.triggerQuery({
1819
+ isOpen: false,
1820
+ value: this.currentValue,
1821
+ customQuery: true
1822
+ });
1823
+ },
1824
+ renderEnterButtonElement: function renderEnterButtonElement() {
1825
+ var _this6 = this;
1826
+ var _this$$props2 = this.$props,
1827
+ enterButton = _this$$props2.enterButton,
1828
+ innerClass = _this$$props2.innerClass;
1829
+ var renderEnterButton = this.$slots.renderEnterButton;
1830
+ if (enterButton) {
1831
+ var getEnterButtonMarkup = function getEnterButtonMarkup() {
1832
+ if (renderEnterButton) {
1833
+ return renderEnterButton(_this6.enterButtonOnClick);
1834
+ }
1835
+ return createVNode(Button, {
1836
+ "class": "enter-btn " + getClassName$1(innerClass, 'enter-button'),
1837
+ "primary": true,
1838
+ "onClick": _this6.enterButtonOnClick
1839
+ }, {
1840
+ "default": function _default() {
1841
+ return [createTextVNode("Search")];
1842
+ }
1843
+ });
1844
+ };
1845
+ return createVNode("div", {
1846
+ "class": "enter-button-wrapper"
1847
+ }, [getEnterButtonMarkup()]);
1848
+ }
1849
+ return null;
1850
+ },
1851
+ renderIcons: function renderIcons() {
1852
+ var _this7 = this;
1853
+ var _slot3, _slot4, _slot5;
1854
+ var _this$$props3 = this.$props,
1855
+ iconPosition = _this$$props3.iconPosition,
1856
+ showClear = _this$$props3.showClear,
1857
+ innerClass = _this$$props3.innerClass,
1858
+ getMicInstance = _this$$props3.getMicInstance,
1859
+ showVoiceSearch = _this$$props3.showVoiceSearch,
1860
+ showIcon = _this$$props3.showIcon;
1861
+ var renderMic = this.$slots.renderMic || this.$props.renderMic;
1862
+ var currentValue = this.$data.currentValue;
1863
+ return createVNode("div", null, [createVNode(IconGroup, {
1864
+ "groupPosition": "right",
1865
+ "positionType": "absolute"
1866
+ }, {
1867
+ "default": function _default() {
1868
+ return [currentValue && showClear && createVNode(IconWrapper, {
1869
+ "onClick": _this7.clearValue,
1870
+ "showIcon": showIcon,
1871
+ "isClearIcon": true
1872
+ }, _isSlot(_slot3 = _this7.renderCancelIcon()) ? _slot3 : {
1873
+ "default": function _default() {
1874
+ return [_slot3];
1875
+ }
1876
+ }), showVoiceSearch && createVNode(Mic, {
1877
+ "getInstance": getMicInstance,
1878
+ "render": renderMic,
1879
+ "handleResult": _this7.handleVoiceResults,
1880
+ "className": getClassName$1(innerClass, 'mic') || null
1881
+ }, null), iconPosition === 'right' && showIcon && createVNode(IconWrapper, {
1882
+ "onClick": _this7.handleSearchIconClick
1883
+ }, _isSlot(_slot4 = _this7.renderIcon()) ? _slot4 : {
1884
+ "default": function _default() {
1885
+ return [_slot4];
1886
+ }
1887
+ })];
1888
+ }
1889
+ }), createVNode(IconGroup, {
1890
+ "groupPosition": "left",
1891
+ "positionType": "absolute"
1892
+ }, {
1893
+ "default": function _default() {
1894
+ return [iconPosition === 'left' && showIcon && createVNode(IconWrapper, {
1895
+ "onClick": _this7.handleSearchIconClick
1896
+ }, _isSlot(_slot5 = _this7.renderIcon()) ? _slot5 : {
1897
+ "default": function _default() {
1898
+ return [_slot5];
1899
+ }
1900
+ })];
1901
+ }
1902
+ })]);
1903
+ },
1904
+ focusSearchBox: function focusSearchBox(event) {
1905
+ var _this$$refs2, _this$$refs2$this$$pr;
1906
+ var elt = event.target || event.srcElement;
1907
+ var tagName = elt.tagName;
1908
+ if (elt.isContentEditable || tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA') {
1909
+ // already in an input
1910
+ return;
1911
+ }
1912
+ (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$this$$pr = _this$$refs2[this.$props.innerRef]) == null ? void 0 : _this$$refs2$this$$pr.focus(); // eslint-disable-line
1913
+ },
1914
+ listenForFocusShortcuts: function listenForFocusShortcuts() {
1915
+ var _this8 = this;
1916
+ var _this$$props$focusSho = this.$props.focusShortcuts,
1917
+ focusShortcuts = _this$$props$focusSho === void 0 ? ['/'] : _this$$props$focusSho;
1918
+ if (isEmpty(focusShortcuts)) {
1919
+ return;
1920
+ }
1921
+ var shortcutsString = parseFocusShortcuts(focusShortcuts).join(',');
1922
+
1923
+ // handler for alphabets and other key combinations
1924
+ hotkeys(shortcutsString,
1925
+ // eslint-disable-next-line no-unused-vars
1926
+ /* eslint-disable no-shadow */
1927
+ function (event, handler) {
1928
+ // Prevent the default refresh event under WINDOWS system
1929
+ event.preventDefault();
1930
+ _this8.focusSearchBox(event);
1931
+ });
1932
+
1933
+ // if one of modifier keys are used, they are handled below
1934
+ hotkeys('*', function (event) {
1935
+ var modifierKeys = extractModifierKeysFromFocusShortcuts(focusShortcuts);
1936
+ if (modifierKeys.length === 0) return;
1937
+ for (var index = 0; index < modifierKeys.length; index += 1) {
1938
+ var element = modifierKeys[index];
1939
+ if (hotkeys[element]) {
1940
+ _this8.focusSearchBox(event);
1941
+ break;
1942
+ }
1943
+ }
1944
+ });
1945
+ },
1946
+ onAutofillClick: function onAutofillClick(suggestion) {
1947
+ var value = suggestion.value;
1948
+ this.isOpen = true;
1949
+ this.currentValue = decodeHtml(value);
1950
+ this.triggerDefaultQuery(value);
1951
+ },
1952
+ renderAutoFill: function renderAutoFill(suggestion) {
1953
+ var _this9 = this;
1954
+ var handleAutoFillClick = function handleAutoFillClick(e) {
1955
+ e.stopPropagation();
1956
+ _this9.onAutofillClick(suggestion);
1957
+ };
1958
+ /* 👇 avoid showing autofill for category suggestions👇 */
1959
+ return suggestion._category ? null : createVNode(AutoFillSvg, {
1960
+ "onClick": handleAutoFillClick
1961
+ }, null);
1962
+ },
1963
+ renderTag: function renderTag(item) {
1964
+ var _this10 = this;
1965
+ var innerClass = this.$props.innerClass;
1966
+ return createVNode(TagItem, {
1967
+ "class": getClassName$1(innerClass, 'selected-tag') || ''
1968
+ }, {
1969
+ "default": function _default() {
1970
+ return [createVNode("span", null, [item]), createVNode("span", {
1971
+ "role": "img",
1972
+ "aria-label": "delete-tag",
1973
+ "class": "close-icon",
1974
+ "onClick": function onClick() {
1975
+ return _this10.clearTag(item);
1976
+ }
1977
+ }, [createVNode(CancelSvg, null, null)])];
1978
+ }
1979
+ });
1980
+ },
1981
+ clearAllTags: function clearAllTags() {
1982
+ this.selectedTags = [];
1983
+ this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
1984
+ if (this.$props.value !== undefined) {
1985
+ this.$emit('change', this.selectedTags, this.triggerQuery);
1986
+ }
1987
+ },
1988
+ clearTag: function clearTag(tagValue) {
1989
+ this.selectedTags = [].concat(this.selectedTags.filter(function (tag) {
1990
+ return tag !== tagValue;
1991
+ }));
1992
+ this.setValue('', true, this.$props, causes.SUGGESTION_SELECT);
1993
+ if (this.$props.value !== undefined) {
1994
+ this.$emit('change', this.selectedTags, this.triggerQuery);
1995
+ }
1996
+ },
1997
+ renderTags: function renderTags() {
1998
+ var _this11 = this;
1999
+ if (!Array.isArray(this.selectedTags)) {
2000
+ return null;
2001
+ }
2002
+ var tagsList = [].concat(this.selectedTags);
2003
+ var shouldRenderClearAllTag = tagsList.length > 1;
2004
+ var renderSelectedTags = this.$slots.renderSelectedTags || this.$props.renderSelectedTags;
2005
+ return renderSelectedTags ? renderSelectedTags({
2006
+ values: this.selectedTags,
2007
+ handleClear: this.clearTag,
2008
+ handleClearAll: this.clearAllTags
2009
+ }) : createVNode(TagsContainer, null, {
2010
+ "default": function _default() {
2011
+ return [tagsList.map(function (item) {
2012
+ return _this11.renderTag(item);
2013
+ }), shouldRenderClearAllTag && createVNode(TagItem, {
2014
+ "class": getClassName$1(_this11.$props.innerClass, 'selected-tag') || ''
2015
+ }, {
2016
+ "default": function _default() {
2017
+ return [createVNode("span", null, [createTextVNode("Clear All")]), createVNode("span", {
2018
+ "role": "img",
2019
+ "aria-label": "delete-tag",
2020
+ "class": "close-icon",
2021
+ "onClick": _this11.clearAllTags
2022
+ }, [createVNode(CancelSvg, null, null)])];
2023
+ }
2024
+ })];
2025
+ }
2026
+ });
2027
+ },
2028
+ getAISourceObjects: function getAISourceObjects() {
2029
+ var localCache = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) && getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY)[this.componentId];
2030
+ var sourceObjects = [];
2031
+ if (!this.AIResponse) return sourceObjects;
2032
+ var docIds = this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [];
2033
+ if (localCache && localCache.meta && localCache.meta.hits && localCache.meta.hits.hits) {
2034
+ docIds.forEach(function (id) {
2035
+ var foundSourceObj = localCache.meta.hits.hits.find(function (hit) {
2036
+ return hit._id === id;
2037
+ }) || {};
2038
+ if (foundSourceObj) {
2039
+ var _foundSourceObj$_sour = foundSourceObj._source,
2040
+ _source = _foundSourceObj$_sour === void 0 ? {} : _foundSourceObj$_sour,
2041
+ rest = _objectWithoutPropertiesLoose(foundSourceObj, _excluded);
2042
+ sourceObjects.push(_extends({}, rest, _source));
2043
+ }
2044
+ });
2045
+ } else {
2046
+ sourceObjects.push.apply(sourceObjects, docIds.map(function (id) {
2047
+ return {
2048
+ _id: id
2049
+ };
2050
+ }));
2051
+ }
2052
+ return sourceObjects;
2053
+ },
2054
+ renderAIScreenLoader: function renderAIScreenLoader() {
2055
+ var _this$$props$AIUIConf = this.$props.AIUIConfig,
2056
+ AIUIConfig = _this$$props$AIUIConf === void 0 ? {} : _this$$props$AIUIConf;
2057
+ var _ref5 = AIUIConfig || {},
2058
+ loaderMessage = _ref5.loaderMessage;
2059
+ if (loaderMessage) {
2060
+ return loaderMessage;
2061
+ }
2062
+ if (this.$slots.AILoaderMessage) {
2063
+ return this.$slots.AILoaderMessage();
2064
+ }
2065
+ return createVNode(HorizontalSkeletonLoader, null, null);
2066
+ },
2067
+ renderAIScreenFooter: function renderAIScreenFooter() {
2068
+ var _slot6;
2069
+ var _this12 = this;
2070
+ var _this$$props$AIUIConf2 = this.$props.AIUIConfig,
2071
+ AIUIConfig = _this$$props$AIUIConf2 === void 0 ? {} : _this$$props$AIUIConf2;
2072
+ var _ref6 = AIUIConfig || {},
2073
+ _ref6$showSourceDocum = _ref6.showSourceDocuments,
2074
+ showSourceDocuments = _ref6$showSourceDocum === void 0 ? true : _ref6$showSourceDocum,
2075
+ _ref6$sourceDocumentL = _ref6.sourceDocumentLabel,
2076
+ sourceDocumentLabel = _ref6$sourceDocumentL === void 0 ? '_id' : _ref6$sourceDocumentL,
2077
+ _ref6$onSourceClick = _ref6.onSourceClick,
2078
+ onSourceClick = _ref6$onSourceClick === void 0 ? function () {} : _ref6$onSourceClick;
2079
+ return showSourceDocuments && this.showAIScreenFooter && this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds ? createVNode(Footer, {
2080
+ "themePreset": this.$props.themePreset
2081
+ }, {
2082
+ "default": function _default() {
2083
+ return [createTextVNode("Summary generated using the following sources:"), ' ', createVNode(SourceTags, null, _isSlot(_slot6 = _this12.getAISourceObjects().map(function (el) {
2084
+ return createVNode(Button, {
2085
+ "class": "--ai-source-tag " + (getClassName$1(_this12.$props.innerClass, 'ai-source-tag') || ''),
2086
+ "title": el[sourceDocumentLabel],
2087
+ "info": true,
2088
+ "onClick": function onClick() {
2089
+ return onSourceClick && onSourceClick(el);
2090
+ }
2091
+ }, {
2092
+ "default": function _default() {
2093
+ return [el[sourceDocumentLabel]];
2094
+ }
2095
+ });
2096
+ })) ? _slot6 : {
2097
+ "default": function _default() {
2098
+ return [_slot6];
2099
+ }
2100
+ })];
2101
+ }
2102
+ }) : null;
2103
+ },
2104
+ renderAIScreen: function renderAIScreen() {
2105
+ var _this13 = this;
2106
+ var customAIRenderer = this.$props.renderAIAnswer || this.$slots.renderAIAnswer;
2107
+ if (customAIRenderer) {
2108
+ return customAIRenderer({
2109
+ question: this.AIResponse && this.AIResponse.response && this.AIResponse.response.question,
2110
+ answer: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text,
2111
+ documentIds: this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.documentIds || [],
2112
+ loading: this.isAIResponseLoading || this.isLoading,
2113
+ sources: this.getAISourceObjects(),
2114
+ error: this.AIResponseError
2115
+ });
2116
+ }
2117
+ if (this.isAIResponseLoading || this.isLoading) {
2118
+ return this.renderAIScreenLoader();
2119
+ }
2120
+ return createVNode("div", null, [createVNode(Answer, {
2121
+ "innerHTML": md.render(this.AIResponse && this.AIResponse.response && this.AIResponse.response.answer && this.AIResponse.response.answer.text)
2122
+ }, null), this.renderAIScreenFooter(), this.showFeedbackComponent && createVNode("div", {
2123
+ "class": "" + (getClassName$1(this.$props.innerClass, 'ai-feedback') || '')
2124
+ }, [createVNode(AIFeedback, {
2125
+ "overrideState": this.feedbackState,
2126
+ "hideUI": this.isAIResponseLoading || this.isLoading || !this.sessionIdFromStore,
2127
+ "key": this.sessionIdFromStore,
2128
+ "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2129
+ _this13.feedbackState = {
2130
+ isRecorded: true,
2131
+ feedbackType: useful ? 'positive' : 'negative'
2132
+ };
2133
+ _this13.recordAISessionUsefulness(_this13.sessionIdFromStore, {
2134
+ useful: useful,
2135
+ reason: reason
2136
+ });
2137
+ }
2138
+ }, null)])]);
2139
+ },
2140
+ handleTextAreaHeightChange: function handleTextAreaHeightChange() {
2141
+ var _this$$refs$this$$pro, _this$$refs$_inputGro;
2142
+ var textArea = (_this$$refs$this$$pro = this.$refs[this.$props.innerRef]) == null ? void 0 : _this$$refs$this$$pro.$el;
2143
+ var inputGroupEle = (_this$$refs$_inputGro = this.$refs[_inputGroupRef]) == null ? void 0 : _this$$refs$_inputGro.$el;
2144
+ if (textArea) {
2145
+ textArea.style.height = '42px';
2146
+ var lineHeight = parseInt(getComputedStyle(textArea).lineHeight, 10);
2147
+ var maxHeight = lineHeight * 4; // max height for 3 lines
2148
+ var height = Math.min(textArea.scrollHeight, maxHeight);
2149
+ textArea.style.height = height + "px";
2150
+ textArea.style.overflowY = height === maxHeight ? 'auto' : 'hidden';
2151
+ var dropdownEle = this.$refs[_dropdownULRef];
2152
+ if (dropdownEle) {
2153
+ dropdownEle.style.top = "" + textArea.style.height;
2154
+ }
2155
+ if (inputGroupEle) {
2156
+ inputGroupEle.style.height = "" + textArea.style.height;
2157
+ }
2158
+ }
2159
+ },
2160
+ askButtonOnClick: function askButtonOnClick() {
2161
+ this.showAIScreen = true;
2162
+ this.isOpen = true;
2163
+ this.triggerDefaultQuery(this.currentValue, {
2164
+ enableAI: true
2165
+ });
2166
+ },
2167
+ renderAskButtonElement: function renderAskButtonElement() {
2168
+ var _this14 = this;
2169
+ var _this$$props4 = this.$props,
2170
+ AIUIConfig = _this$$props4.AIUIConfig,
2171
+ innerClass = _this$$props4.innerClass;
2172
+ var _ref7 = AIUIConfig || {},
2173
+ askButton = _ref7.askButton;
2174
+ var renderAskButton = this.$slots.renderAskButton;
2175
+ if (askButton) {
2176
+ var getEnterButtonMarkup = function getEnterButtonMarkup() {
2177
+ if (renderAskButton) {
2178
+ return renderAskButton(_this14.askButtonOnClick);
2179
+ }
2180
+ return createVNode(Button, {
2181
+ "class": "enter-btn " + getClassName$1(innerClass, 'ask-button'),
2182
+ "info": true,
2183
+ "onClick": _this14.askButtonOnClick
2184
+ }, {
2185
+ "default": function _default() {
2186
+ return [createTextVNode("Ask")];
2187
+ }
2188
+ });
2189
+ };
2190
+ return createVNode("div", {
2191
+ "class": "enter-button-wrapper"
2192
+ }, [getEnterButtonMarkup()]);
2193
+ }
2194
+ return null;
2195
+ }
2196
+ },
2197
+ render: function render() {
2198
+ var _this15 = this;
2199
+ var expandSuggestionsContainer = this.$props.expandSuggestionsContainer;
2200
+ var _this$$slots = this.$slots,
2201
+ recentSearchesIcon = _this$$slots.recentSearchesIcon,
2202
+ popularSearchesIcon = _this$$slots.popularSearchesIcon;
2203
+ var hasSuggestions = Array.isArray(this.normalizedSuggestions) && this.normalizedSuggestions.length;
2204
+ var renderItem = this.$slots.renderItem || this.$props.renderItem;
2205
+ return createVNode(Container, {
2206
+ "class": this.$props.className
2207
+ }, {
2208
+ "default": function _default() {
2209
+ return [_this15.$props.title && createVNode(Title, {
2210
+ "class": getClassName$1(_this15.$props.innerClass, 'title') || ''
2211
+ }, {
2212
+ "default": function _default() {
2213
+ return [_this15.$props.title];
2214
+ }
2215
+ }), _this15.$props.autosuggest ? createVNode(Downshift, {
2216
+ "id": _this15.$props.componentId + "-downshift",
2217
+ "handleChange": _this15.onSuggestionSelected,
2218
+ "handleMouseup": _this15.handleStateChange,
2219
+ "isOpen": _this15.$data.isOpen
2220
+ }, {
2221
+ "default": function _default(_ref8) {
2222
+ var getInputEvents = _ref8.getInputEvents,
2223
+ getInputProps = _ref8.getInputProps,
2224
+ getItemProps = _ref8.getItemProps,
2225
+ getItemEvents = _ref8.getItemEvents,
2226
+ isOpen = _ref8.isOpen,
2227
+ highlightedIndex = _ref8.highlightedIndex,
2228
+ setHighlightedIndex = _ref8.setHighlightedIndex;
2229
+ var renderSuggestionsDropdown = function renderSuggestionsDropdown() {
2230
+ var getIcon = function getIcon(iconType) {
2231
+ switch (iconType) {
2232
+ case suggestionTypes.Recent:
2233
+ return recentSearchesIcon;
2234
+ case suggestionTypes.Popular:
2235
+ return popularSearchesIcon;
2236
+ default:
2237
+ return null;
2238
+ }
2239
+ };
2240
+ return createVNode("div", null, [_this15.hasCustomRenderer && _this15.getComponent({
2241
+ isOpen: isOpen,
2242
+ getItemProps: getItemProps,
2243
+ getItemEvents: getItemEvents,
2244
+ highlightedIndex: highlightedIndex
2245
+ }), _this15.renderErrorComponent(), !_this15.hasCustomRenderer && isOpen && hasSuggestions ? createVNode("ul", {
2246
+ "class": suggestions(_this15.themePreset, _this15.theme) + " " + getClassName$1(_this15.$props.innerClass, 'list'),
2247
+ "ref": _dropdownULRef
2248
+ }, [_this15.showAIScreen && createVNode(SearchBoxAISection, {
2249
+ "themePreset": _this15.$props.themePreset
2250
+ }, {
2251
+ "default": function _default() {
2252
+ return [_this15.renderAIScreen(), ' ', _this15.renderErrorComponent(true)];
2253
+ }
2254
+ }), !_this15.showAIScreen && _this15.normalizedSuggestions.map(function (item, index) {
2255
+ return renderItem ? createVNode("li", mergeProps(getItemProps({
2256
+ item: item
2257
+ }), getItemEvents({
2258
+ item: item
2259
+ }), {
2260
+ "key": index + 1 + "-" + item.value,
2261
+ "style": {
2262
+ backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
2263
+ justifyContent: 'flex-start',
2264
+ alignItems: 'center'
2265
+ }
2266
+ }), [renderItem(item)]) : createVNode("li", mergeProps(getItemProps({
2267
+ item: item
2268
+ }), _transformOn(getItemEvents({
2269
+ item: item
2270
+ })), {
2271
+ "key": index + 1 + "-" + item.value,
2272
+ "style": {
2273
+ backgroundColor: _this15.getBackgroundColor(highlightedIndex, index),
2274
+ justifyContent: 'flex-start',
2275
+ alignItems: 'center'
2276
+ }
2277
+ }), [createVNode("div", {
2278
+ "style": {
2279
+ padding: '0 10px 0 0',
2280
+ display: 'flex'
2281
+ }
2282
+ }, [createVNode(CustomSvg, {
2283
+ "className": getClassName$1(_this15.$props.innerClass, item._suggestion_type + "-search-icon") || null,
2284
+ "icon": getIcon(item._suggestion_type),
2285
+ "type": item._suggestion_type + "-search-icon"
2286
+ }, null)]), createVNode(SuggestionItem, {
2287
+ "currentValue": _this15.currentValue,
2288
+ "suggestion": item
2289
+ }, null), _this15.renderAutoFill(item)]);
2290
+ })]) : _this15.renderNoSuggestions(_this15.normalizedSuggestions)]);
2291
+ };
2292
+ return createVNode("div", {
2293
+ "class": suggestionsContainer
2294
+ }, [createVNode(InputGroup, {
2295
+ "ref": _inputGroupRef
2296
+ }, {
2297
+ "default": function _default() {
2298
+ return [_this15.renderInputAddonBefore(), createVNode(InputWrapper, null, {
2299
+ "default": function _default() {
2300
+ return [createVNode(TextArea, mergeProps(_transformOn(getInputEvents({
2301
+ onInput: _this15.onInputChange,
2302
+ onBlur: function onBlur(e) {
2303
+ _this15.$emit('blur', e, _this15.triggerQuery);
2304
+ },
2305
+ onFocus: _this15.handleFocus,
2306
+ onKeyPress: function onKeyPress(e) {
2307
+ _this15.$emit('keyPress', e, _this15.triggerQuery);
2308
+ _this15.$emit('key-press', e, _this15.triggerQuery);
2309
+ },
2310
+ onKeyDown: function onKeyDown(e) {
2311
+ return _this15.handleKeyDown(e, highlightedIndex);
2312
+ },
2313
+ onKeyUp: function onKeyUp(e) {
2314
+ _this15.$emit('keyUp', e, _this15.triggerQuery);
2315
+ _this15.$emit('key-up', e, _this15.triggerQuery);
2316
+ },
2317
+ onClick: function onClick() {
2318
+ setHighlightedIndex(null);
2319
+ }
2320
+ })), {
2321
+ "id": _this15.$props.componentId + "-input",
2322
+ "showIcon": _this15.$props.showIcon,
2323
+ "showClear": _this15.$props.showClear,
2324
+ "iconPosition": _this15.$props.iconPosition,
2325
+ "ref": _this15.$props.innerRef,
2326
+ "class": getClassName$1(_this15.$props.innerClass, 'input'),
2327
+ "placeholder": _this15.$props.placeholder,
2328
+ "autoFocus": _this15.$props.autoFocus,
2329
+ "showFocusShortcutsIcon": _this15.$props.showFocusShortcutsIcon,
2330
+ "showVoiceSearch": _this15.$props.showVoiceSearch
2331
+ }, getInputProps({
2332
+ value: _this15.$data.currentValue === null ? '' : _this15.$data.currentValue
2333
+ }), {
2334
+ "themePreset": _this15.themePreset,
2335
+ "autocomplete": "off"
2336
+ }), null), _this15.renderIcons(), !expandSuggestionsContainer && renderSuggestionsDropdown()];
2337
+ }
2338
+ }), _this15.renderInputAddonAfter(), _this15.renderAskButtonElement(), _this15.renderEnterButtonElement()];
2339
+ }
2340
+ }), expandSuggestionsContainer && renderSuggestionsDropdown(), _this15.renderTags()]);
2341
+ }
2342
+ }) : createVNode("div", {
2343
+ "class": suggestionsContainer
2344
+ }, [createVNode(InputGroup, {
2345
+ "ref": _inputGroupRef
2346
+ }, {
2347
+ "default": function _default() {
2348
+ return [_this15.renderInputAddonBefore(), createVNode(InputWrapper, null, {
2349
+ "default": function _default() {
2350
+ return [createVNode(TextArea, mergeProps(_transformOn({
2351
+ blur: function blur(e) {
2352
+ _this15.$emit('blur', e, _this15.triggerQuery);
2353
+ },
2354
+ keypress: function keypress(e) {
2355
+ _this15.$emit('keyPress', e, _this15.triggerQuery);
2356
+ _this15.$emit('key-press', e, _this15.triggerQuery);
2357
+ },
2358
+ input: _this15.onInputChange,
2359
+ focus: function focus(e) {
2360
+ _this15.$emit('focus', e, _this15.triggerQuery);
2361
+ },
2362
+ keydown: _this15.handleKeyDown,
2363
+ keyup: function keyup(e) {
2364
+ _this15.$emit('keyUp', e, _this15.triggerQuery);
2365
+ _this15.$emit('key-up', e, _this15.triggerQuery);
2366
+ }
2367
+ }), {
2368
+ "class": getClassName$1(_this15.$props.innerClass, 'input') || '',
2369
+ "placeholder": _this15.$props.placeholder,
2370
+ "autofocus": _this15.$props.autoFocus,
2371
+ "value": _this15.$data.currentValue ? _this15.$data.currentValue : '',
2372
+ "iconPosition": _this15.$props.iconPosition,
2373
+ "showIcon": _this15.$props.showIcon,
2374
+ "showClear": _this15.$props.showClear,
2375
+ "ref": _this15.$props.innerRef,
2376
+ "themePreset": _this15.themePreset
2377
+ }), null), _this15.renderIcons()];
2378
+ }
2379
+ }), _this15.renderInputAddonAfter(), _this15.renderEnterButtonElement()];
2380
+ }
2381
+ })])];
2382
+ }
2383
+ });
2384
+ },
2385
+ destroyed: function destroyed() {
2386
+ document.removeEventListener('keydown', this.onKeyDown);
2387
+ }
2388
+ });
2389
+ SearchBox.hasInternalComponent = function () {
2390
+ return true;
2391
+ };
2392
+ SearchBox.defaultQuery = function (value, props) {
2393
+ var finalQuery = null;
2394
+ finalQuery = {
2395
+ bool: {
2396
+ should: SearchBox.shouldQuery(value, props),
2397
+ minimum_should_match: '1'
2398
+ }
2399
+ };
2400
+ if (finalQuery && props.nestedField) {
2401
+ return {
2402
+ query: {
2403
+ nested: {
2404
+ path: props.nestedField,
2405
+ query: finalQuery
2406
+ }
2407
+ }
2408
+ };
2409
+ }
2410
+ return finalQuery;
2411
+ };
2412
+ SearchBox.shouldQuery = function (value, props) {
2413
+ return {
2414
+ query: {
2415
+ queryFormat: props.queryFormat,
2416
+ dataField: props.dataField,
2417
+ value: value,
2418
+ nestedField: props.nestedField,
2419
+ queryString: props.queryString,
2420
+ searchOperators: props.searchOperators
2421
+ }
2422
+ };
2423
+ };
2424
+ var mapStateToProps = function mapStateToProps(state, props) {
2425
+ return {
2426
+ selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
2427
+ selectedCategory: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].category || null,
2428
+ suggestions: state.hits[props.componentId] && state.hits[props.componentId].hits,
2429
+ rawData: state.rawData[props.componentId],
2430
+ aggregationData: state.compositeAggregations[props.componentId] || [],
2431
+ themePreset: state.config.themePreset,
2432
+ isLoading: !!state.isLoading["" + props.componentId],
2433
+ error: state.error[props.componentId],
2434
+ time: state.hits[props.componentId] && state.hits[props.componentId].time || 0,
2435
+ total: state.hits[props.componentId] && state.hits[props.componentId].total,
2436
+ hidden: state.hits[props.componentId] && state.hits[props.componentId].hidden,
2437
+ AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response || null,
2438
+ isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
2439
+ AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
2440
+ sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || '',
2441
+ isAITyping: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.isTyping || false
2442
+ };
2443
+ };
2444
+ var mapDispatchToProps = {
2445
+ updateQuery: updateQuery,
2446
+ setCustomQuery: setCustomQuery,
2447
+ setDefaultQuery: setDefaultQuery,
2448
+ recordSuggestionClick: recordSuggestionClick,
2449
+ recordAISessionUsefulness: recordAISessionUsefulness
2450
+ };
2451
+ var SBConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps, mapDispatchToProps)(SearchBox), {
2452
+ componentType: componentTypes.searchBox,
2453
+ internalComponent: true
2454
+ }));
2455
+ SBConnected.name = SearchBox.name;
2456
+ SBConnected.defaultQuery = SearchBox.defaultQuery;
2457
+ SBConnected.shouldQuery = SearchBox.shouldQuery;
2458
+ SBConnected.hasInternalComponent = SearchBox.hasInternalComponent;
2459
+ SBConnected.install = function (Vue) {
2460
+ Vue.component(SBConnected.name, SBConnected);
2461
+ };
2462
+ // Add componentType for SSR
2463
+ SBConnected.componentType = componentTypes.searchBox;
2464
+
2465
+ function _isSlot$1(s) {
2466
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
2467
+ }
2468
+ var md$1 = new Remarkable();
2469
+ md$1.set({
2470
+ html: true,
2471
+ breaks: true,
2472
+ xhtmlOut: true
2473
+ });
2474
+ var _inputWrapperRef = 'inputWrapperRef';
2475
+ var _inputRef = 'inputRef';
2476
+ var _errorContainerRef = 'errorContainerRef';
2477
+ var AIAnswer = defineComponent({
2478
+ name: 'AIAnswer',
2479
+ data: function data() {
2480
+ var props = this.$props;
2481
+ this.__state = {
2482
+ messages: [],
2483
+ inputMessage: '',
2484
+ AISessionId: '',
2485
+ error: null
2486
+ };
2487
+ this.internalComponent = props.componentId + "__internal";
2488
+ return this.__state;
2489
+ },
2490
+ inject: {
2491
+ theme: {
2492
+ from: 'theme_reactivesearch'
2493
+ }
2494
+ },
2495
+ created: function created() {},
2496
+ computed: {
2497
+ hasCustomRenderer: function hasCustomRenderer$1() {
2498
+ return hasCustomRenderer(this);
2499
+ },
2500
+ isLoadingState: function isLoadingState() {
2501
+ return this.isAIResponseLoading || this.isLoading;
2502
+ },
2503
+ shouldShowComponent: function shouldShowComponent() {
2504
+ return this.showComponent;
2505
+ }
2506
+ },
2507
+ props: {
2508
+ componentId: types.string.isRequired,
2509
+ showVoiceInput: VueTypes.bool.def(false),
2510
+ showFeedback: VueTypes.bool.def(true),
2511
+ showIcon: VueTypes.bool.def(true),
2512
+ onData: types.func,
2513
+ innerRef: VueTypes.string.def('AISearchInputField'),
2514
+ react: types.react,
2515
+ enableAI: VueTypes.bool.def(true),
2516
+ AIConfig: types.AIConfig,
2517
+ iconPosition: types.iconPosition.def('left'),
2518
+ themePreset: types.themePreset,
2519
+ theme: types.style,
2520
+ icon: types.children,
2521
+ iconURL: VueTypes.string.def(''),
2522
+ renderMic: types.func,
2523
+ getMicInstance: types.func,
2524
+ innerClass: types.style,
2525
+ placeholder: VueTypes.string.def('Ask a question'),
2526
+ title: types.title,
2527
+ AIResponse: types.componentObject,
2528
+ isAIResponseLoading: VueTypes.bool.def(false),
2529
+ AIResponseError: types.componentObject,
2530
+ getAIResponse: types.func.isRequired,
2531
+ enterButton: types.bool,
2532
+ renderEnterButton: types.title,
2533
+ showInput: VueTypes.bool.def(true),
2534
+ clearSessionOnDestroy: VueTypes.bool.def(true),
2535
+ rawData: types.rawData,
2536
+ render: types.func,
2537
+ onError: types.func,
2538
+ renderError: types.title,
2539
+ isLoading: types.boolRequired,
2540
+ sessionIdFromStore: VueTypes.string,
2541
+ showComponent: types.boolRequired
2542
+ },
2543
+ mounted: function mounted() {},
2544
+ watch: {
2545
+ AIResponse: function AIResponse(newVal) {
2546
+ if (newVal) {
2547
+ this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
2548
+ var messagesHistory = newVal.messages,
2549
+ response = newVal.response;
2550
+ var finalMessages = [];
2551
+ if (response && response.error) {
2552
+ this.error = {
2553
+ message: response.error
2554
+ };
2555
+ }
2556
+
2557
+ // pushing message history so far
2558
+ if (messagesHistory && messagesHistory && Array.isArray(messagesHistory)) {
2559
+ finalMessages.push.apply(finalMessages, messagesHistory.filter(function (msg) {
2560
+ return msg.role !== AI_ROLES.SYSTEM;
2561
+ }));
2562
+ }
2563
+ // fresh response
2564
+ if (response && response.answer) ;
2565
+ this.messages = finalMessages;
2566
+ } else if (!newVal && !this.error) {
2567
+ this.messages = [];
2568
+ }
2569
+ },
2570
+ rawData: function rawData(newVal) {
2571
+ this.$emit('on-data', {
2572
+ data: this.messages,
2573
+ rawData: newVal,
2574
+ loading: this.$props.isAIResponseLoading || this.$props.isLoading,
2575
+ error: this.$props.AIResponseError
2576
+ });
2577
+ },
2578
+ isAIResponseLoading: function isAIResponseLoading(newVal) {
2579
+ this.isLoadingState = newVal;
2580
+ this.$emit('on-data', {
2581
+ data: this.messages,
2582
+ rawData: this.$props.rawData,
2583
+ loading: newVal || this.$props.isLoading,
2584
+ error: this.$props.AIResponseError
2585
+ });
2586
+ },
2587
+ isLoading: function isLoading(newVal) {
2588
+ this.isLoadingState = newVal;
2589
+ this.$emit('on-data', {
2590
+ data: this.messages,
2591
+ rawData: this.$props.rawData,
2592
+ loading: newVal || this.$props.isLoading,
2593
+ error: this.$props.AIResponseError
2594
+ });
2595
+ },
2596
+ sessionIdFromStore: function sessionIdFromStore(newVal) {
2597
+ if (newVal) {
2598
+ this.sessionId = newVal;
2599
+ }
2600
+ },
2601
+ AIResponseError: function AIResponseError(newVal) {
2602
+ this.error = newVal;
2603
+ this.AISessionId = ((getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {})[this.$props.componentId] || {}).sessionId || null;
2604
+ this.$emit('on-data', {
2605
+ data: this.messages,
2606
+ rawData: this.$props.rawData,
2607
+ loading: this.$props.isAIResponseLoading || this.$props.isLoading,
2608
+ error: newVal
2609
+ });
2610
+ },
2611
+ messages: function messages() {
2612
+ this.scrollToBottom();
2613
+ }
2614
+ },
2615
+ methods: {
2616
+ scrollToBottom: function scrollToBottom() {
2617
+ var _this = this;
2618
+ this.$nextTick(function () {
2619
+ var _this$$refs;
2620
+ var messageContainer = (_this$$refs = _this.$refs) == null ? void 0 : _this$$refs[_this.$props.innerRef];
2621
+ if (messageContainer && messageContainer.$el) {
2622
+ messageContainer.$el.scrollTo({
2623
+ top: messageContainer.$el.scrollHeight,
2624
+ behavior: 'smooth'
2625
+ });
2626
+ }
2627
+ });
2628
+ },
2629
+ handleMessageInputChange: function handleMessageInputChange(e) {
2630
+ this.inputMessage = e.target.value;
2631
+ this.handleTextAreaHeightChange();
2632
+ },
2633
+ handleSendMessage: function handleSendMessage(e, isRetry, text) {
2634
+ if (isRetry === void 0) {
2635
+ isRetry = false;
2636
+ }
2637
+ if (text === void 0) {
2638
+ text = this.inputMessage;
2639
+ }
2640
+ if (typeof e === 'object' && e !== null) e.preventDefault();
2641
+ if (text.trim()) {
2642
+ if (this.isLoadingState) {
2643
+ return;
2644
+ }
2645
+ if (this.AISessionId) {
2646
+ if (!isRetry) this.messages = [].concat(this.messages, [{
2647
+ content: text,
2648
+ role: AI_ROLES.USER
2649
+ }]);
2650
+ this.getAIResponse(this.AISessionId, this.componentId, text);
2651
+ } else {
2652
+ console.error("AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISession to function. Try reloading the App.");
2653
+ this.error = {
2654
+ message: "AISessionId for " + this.$props.componentId + " is missing! AIAnswer component requires an AISession to function. Trying reloading the App."
2655
+ };
2656
+ }
2657
+ this.inputMessage = '';
2658
+ }
2659
+ },
2660
+ handleRetryRequest: function handleRetryRequest() {
2661
+ if (this.messages && !this.isLoadingState) {
2662
+ var _this$messages;
2663
+ var lastUserRequestMessage = (_this$messages = this.messages[this.messages.length - 1]) == null ? void 0 : _this$messages.content;
2664
+ if (this.AISessionId) {
2665
+ this.getAIResponse(this.AISessionId, this.componentId, lastUserRequestMessage);
2666
+ this.inputMessage = '';
2667
+ } else {
2668
+ console.error("AISessionId for " + this.componentId + " is missing! AIAnswer component requires an AISession to function. Try reloading the App.");
2669
+ }
2670
+ }
2671
+ },
2672
+ renderErrorComponent: function renderErrorComponent() {
2673
+ var renderError = this.$slots.renderError || this.$props.renderError;
2674
+ if (this.error && !this.isLoadingState) {
2675
+ var _this$error, _this$error2;
2676
+ if (renderError) {
2677
+ return createVNode("div", {
2678
+ "ref": _errorContainerRef,
2679
+ "class": "--ai-answer-error-container " + (getClassName$2(this.$props.innerClass, 'ai-error') || '')
2680
+ }, [isFunction(renderError) ? renderError(this.error, this.handleRetryRequest) : renderError]);
2681
+ }
2682
+ return createVNode("div", {
2683
+ "ref": _errorContainerRef,
2684
+ "class": "--ai-answer-error-container " + (getClassName$2(this.$props.innerClass, 'ai-error') || '')
2685
+ }, [createVNode("div", {
2686
+ "class": "--default-error-element"
2687
+ }, [createVNode("span", null, [(_this$error = this.error) != null && _this$error.message ? this.error.message : 'There was an error in generating the response.', ' ', (_this$error2 = this.error) != null && _this$error2.code ? "Code:\n\t\t\t\t\t\t\t" + this.error.code : '']), this.AISessionId && createVNode(Button, {
2688
+ "primary": true,
2689
+ "onClick": this.handleRetryRequest
2690
+ }, {
2691
+ "default": function _default() {
2692
+ return [createTextVNode("Try again")];
2693
+ }
2694
+ })])]);
2695
+ }
2696
+ return null;
2697
+ },
2698
+ handleKeyPress: function handleKeyPress(e) {
2699
+ if (e.key === 'Enter') {
2700
+ this.handleSendMessage(e);
2701
+ this.inputMessage = '';
2702
+ }
2703
+ },
2704
+ renderIcon: function renderIcon() {
2705
+ if (this.$props.showIcon) {
2706
+ if (this.$props.icon) {
2707
+ return this.$props.icon;
2708
+ }
2709
+ if (this.$slots.icon) {
2710
+ return this.$slots.icon();
2711
+ }
2712
+ if (this.$props.iconURL) {
2713
+ return createVNode("img", {
2714
+ "style": {
2715
+ maxHeight: '25px'
2716
+ },
2717
+ "src": this.$props.iconURL,
2718
+ "alt": "search-icon"
2719
+ }, null);
2720
+ }
2721
+ return createVNode(SearchSvg, null, null);
2722
+ }
2723
+ return null;
2724
+ },
2725
+ shouldMicRender: function shouldMicRender(showVoiceSearch) {
2726
+ // checks for SSR
2727
+ if (typeof window === 'undefined') return false;
2728
+ return showVoiceSearch && (window.webkitSpeechRecognition || window.SpeechRecognition);
2729
+ },
2730
+ handleVoiceResults: function handleVoiceResults(_ref) {
2731
+ var results = _ref.results;
2732
+ if (results && results[0] && results[0].isFinal && results[0][0] && results[0][0].transcript && results[0][0].transcript.trim()) {
2733
+ this.handleSendMessage(null, false, results[0][0].transcript.trim());
2734
+ }
2735
+ },
2736
+ renderIcons: function renderIcons() {
2737
+ var _this2 = this;
2738
+ var _slot, _slot2;
2739
+ var _this$$props = this.$props,
2740
+ getMicInstance = _this$$props.getMicInstance,
2741
+ showVoiceInput = _this$$props.showVoiceInput,
2742
+ iconPosition = _this$$props.iconPosition,
2743
+ innerClass = _this$$props.innerClass;
2744
+ var renderMic = this.$slots.renderMic || this.$props.renderMic;
2745
+ return createVNode("div", null, [createVNode(IconGroup, {
2746
+ "enableAI": true,
2747
+ "groupPosition": "right",
2748
+ "positionType": "absolute"
2749
+ }, {
2750
+ "default": function _default() {
2751
+ return [_this2.shouldMicRender(showVoiceInput) && createVNode(Mic, {
2752
+ "getInstance": getMicInstance,
2753
+ "render": renderMic,
2754
+ "handleResult": _this2.handleVoiceResults,
2755
+ "class": getClassName$2(innerClass, 'ai-search-mic') || null
2756
+ }, null), iconPosition === 'right' && createVNode(IconWrapper, null, _isSlot$1(_slot = _this2.renderIcon()) ? _slot : {
2757
+ "default": function _default() {
2758
+ return [_slot];
2759
+ }
2760
+ })];
2761
+ }
2762
+ }), createVNode(IconGroup, {
2763
+ "enableAI": true,
2764
+ "groupPosition": "left",
2765
+ "positionType": "absolute"
2766
+ }, {
2767
+ "default": function _default() {
2768
+ return [iconPosition === 'left' && createVNode(IconWrapper, null, _isSlot$1(_slot2 = _this2.renderIcon()) ? _slot2 : {
2769
+ "default": function _default() {
2770
+ return [_slot2];
2771
+ }
2772
+ })];
2773
+ }
2774
+ })]);
2775
+ },
2776
+ enterButtonOnClick: function enterButtonOnClick(e) {
2777
+ this.handleSendMessage(e);
2778
+ },
2779
+ renderEnterButtonElement: function renderEnterButtonElement() {
2780
+ var _this3 = this;
2781
+ var _this$$props2 = this.$props,
2782
+ enterButton = _this$$props2.enterButton,
2783
+ innerClass = _this$$props2.innerClass;
2784
+ var renderEnterButton = this.$slots.renderEnterButton;
2785
+ if (enterButton) {
2786
+ var getEnterButtonMarkup = function getEnterButtonMarkup() {
2787
+ if (renderEnterButton) {
2788
+ return renderEnterButton(_this3.enterButtonOnClick);
2789
+ }
2790
+ return createVNode(SendButton, {
2791
+ "primary": true,
2792
+ "type": "submit",
2793
+ "tabIndex": 0,
2794
+ "onClick": _this3.handleSendMessage,
2795
+ "onKeyPress": _this3.handleKeyPress,
2796
+ "class": "enter-btn " + getClassName$2(innerClass, 'ai-enter-button')
2797
+ }, {
2798
+ "default": function _default() {
2799
+ return [createTextVNode("Send")];
2800
+ }
2801
+ });
2802
+ };
2803
+ return createVNode("div", {
2804
+ "class": "ai-enter-button-wrapper"
2805
+ }, [getEnterButtonMarkup()]);
2806
+ }
2807
+ return null;
2808
+ },
2809
+ getComponent: function getComponent$1() {
2810
+ var data = {
2811
+ error: this.AIResponseError,
2812
+ loading: this.isAIResponseLoading,
2813
+ data: this.messages,
2814
+ rawData: this.rawData
2815
+ };
2816
+ return getComponent(data, this);
2817
+ },
2818
+ handleTextAreaHeightChange: function handleTextAreaHeightChange() {
2819
+ var _this$$refs2, _this$$refs2$_inputRe, _this$$refs3, _this$$refs3$_inputWr, _this$$refs4;
2820
+ var textArea = (_this$$refs2 = this.$refs) == null ? void 0 : (_this$$refs2$_inputRe = _this$$refs2[_inputRef]) == null ? void 0 : _this$$refs2$_inputRe.$el;
2821
+ var inputWrapper = (_this$$refs3 = this.$refs) == null ? void 0 : (_this$$refs3$_inputWr = _this$$refs3[_inputWrapperRef]) == null ? void 0 : _this$$refs3$_inputWr.$el;
2822
+ var errorContainer = (_this$$refs4 = this.$refs) == null ? void 0 : _this$$refs4[_errorContainerRef];
2823
+ if (textArea) {
2824
+ textArea.style.height = '42px';
2825
+ var lineHeight = parseInt(getComputedStyle(textArea).lineHeight, 10);
2826
+ var maxHeight = lineHeight * 11; // max height for 10 lines
2827
+ var height = Math.min(textArea.scrollHeight, maxHeight);
2828
+ textArea.style.height = height + "px";
2829
+ textArea.style.overflowY = height === maxHeight ? 'auto' : 'hidden';
2830
+ // wrapper around input/ textarea
2831
+ inputWrapper.style.height = height + "px";
2832
+ // adjust error-container
2833
+
2834
+ if (errorContainer) {
2835
+ errorContainer.style.bottom = height + "px";
2836
+ }
2837
+ this.$forceUpdate();
2838
+ }
2839
+ }
2840
+ },
2841
+ beforeUnmount: function beforeUnmount() {
2842
+ if (this.$props.clearSessionOnDestroy) {
2843
+ // cleanup logic
2844
+ // final Object to store in local storage cache
2845
+ var finalCacheObj = getObjectFromLocalStorage(AI_LOCAL_CACHE_KEY) || {};
2846
+ // delete current component's cache
2847
+ delete finalCacheObj[this.$props.componentId];
2848
+ // update local cache
2849
+ setObjectInLocalStorage(AI_LOCAL_CACHE_KEY, finalCacheObj);
2850
+ }
2851
+ },
2852
+ render: function render() {
2853
+ var _slot3;
2854
+ var _this4 = this;
2855
+ var props = this.$props;
2856
+ if (!this.shouldShowComponent) {
2857
+ return null;
2858
+ }
2859
+ return createVNode(Chatbox, null, {
2860
+ "default": function _default() {
2861
+ return [_this4.$props.title && createVNode(Title, {
2862
+ "class": getClassName$2(_this4.$props.innerClass, 'title') || ''
2863
+ }, {
2864
+ "default": function _default() {
2865
+ return [_this4.$props.title];
2866
+ }
2867
+ }), createVNode(ChatContainer, {
2868
+ "theme": props.theme,
2869
+ "showInput": props.showInput
2870
+ }, {
2871
+ "default": function _default() {
2872
+ return [_this4.hasCustomRenderer && createVNode(MessagesContainer, {
2873
+ "themePreset": _this4.themePreset,
2874
+ "theme": props.theme,
2875
+ "ref": _this4.$props.innerRef,
2876
+ "class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
2877
+ }, _isSlot$1(_slot3 = _this4.getComponent()) ? _slot3 : {
2878
+ "default": function _default() {
2879
+ return [_slot3];
2880
+ }
2881
+ }), !_this4.hasCustomRenderer && createVNode(MessagesContainer, {
2882
+ "themePreset": _this4.themePreset,
2883
+ "theme": props.theme,
2884
+ "ref": _this4.$props.innerRef,
2885
+ "class": "--ai-message-container " + (getClassName$2(props.innerClass, 'ai-message-container') || '')
2886
+ }, {
2887
+ "default": function _default() {
2888
+ return [_this4.messages.map(function (message, index) {
2889
+ return createVNode(Message, {
2890
+ "key": index,
2891
+ "isSender": message.role === AI_ROLES.USER,
2892
+ "innerHTML": md$1.render(message.content),
2893
+ "themePreset": _this4.themePreset,
2894
+ "theme": props.theme,
2895
+ "class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || '')
2896
+ }, null);
2897
+ }), _this4.isLoadingState && createVNode(Message, {
2898
+ "themePreset": _this4.themePreset,
2899
+ "theme": props.theme,
2900
+ "isSender": false,
2901
+ "class": "--ai-answer-message " + (getClassName$2(props.innerClass, 'ai-message') || null)
2902
+ }, {
2903
+ "default": function _default() {
2904
+ return [createVNode(TypingIndicator, null, {
2905
+ "default": function _default() {
2906
+ return [createVNode(TypingDot, {
2907
+ "themePreset": _this4.themePreset
2908
+ }, null), createVNode(TypingDot, {
2909
+ "themePreset": _this4.themePreset
2910
+ }, null), createVNode(TypingDot, {
2911
+ "themePreset": _this4.themePreset
2912
+ }, null)];
2913
+ }
2914
+ })];
2915
+ }
2916
+ })];
2917
+ }
2918
+ }), _this4.renderErrorComponent(), ' ', props.showFeedback && createVNode("div", {
2919
+ "class": "--ai-answer-feedback-container " + (getClassName$2(props.innerClass, 'ai-feedback') || '')
2920
+ }, [createVNode(AIFeedback, {
2921
+ "hideUI": _this4.isLoadingState || !_this4.sessionId,
2922
+ "key": _this4.sessionId,
2923
+ "onFeedbackSubmit": function onFeedbackSubmit(useful, reason) {
2924
+ _this4.trackUsefullness(_this4.sessionId, {
2925
+ useful: useful,
2926
+ reason: reason
2927
+ });
2928
+ }
2929
+ }, null)]), props.showInput && createVNode(MessageInputContainer, {
2930
+ "class": "--ai-input-container",
2931
+ "onSubmit": _this4.handleSendMessage
2932
+ }, {
2933
+ "default": function _default() {
2934
+ return [createVNode(InputGroup, {
2935
+ "enableAI": true,
2936
+ "isOpen": false
2937
+ }, {
2938
+ "default": function _default() {
2939
+ return [createVNode(InputWrapper, {
2940
+ "ref": _inputWrapperRef
2941
+ }, {
2942
+ "default": function _default() {
2943
+ return [createVNode(MessageInput, {
2944
+ "ref": _inputRef,
2945
+ "type": "text",
2946
+ "placeholder": props.placeholder,
2947
+ "enterButton": props.enterButton,
2948
+ "value": _this4.inputMessage,
2949
+ "onInput": _this4.handleMessageInputChange,
2950
+ "onKeyPress": _this4.handleKeyPress,
2951
+ "id": props.componentId + "-ai-input",
2952
+ "showIcon": props.showIcon,
2953
+ "iconPosition": props.iconPosition,
2954
+ "themePreset": _this4.themePreset,
2955
+ "disabled": _this4.isLoadingState,
2956
+ "class": getClassName$2(props.innerClass, 'ai-input') || null
2957
+ }, null), ' ', _this4.renderIcons()];
2958
+ }
2959
+ })];
2960
+ }
2961
+ }), _this4.renderEnterButtonElement()];
2962
+ }
2963
+ }), ' '];
2964
+ }
2965
+ })];
2966
+ }
2967
+ });
2968
+ }
2969
+ });
2970
+ AIAnswer.hasInternalComponent = function () {
2971
+ return true;
2972
+ };
2973
+ var mapStateToProps$1 = function mapStateToProps(state, props) {
2974
+ var dependencyComponent = Object.values(props.react)[0];
2975
+ if (Array.isArray(dependencyComponent)) {
2976
+ // eslint-disable-next-line prefer-destructuring
2977
+ dependencyComponent = dependencyComponent[0];
2978
+ }
2979
+ var showComponent = state.selectedValues[dependencyComponent] && state.selectedValues[dependencyComponent].value;
2980
+ return {
2981
+ showComponent: showComponent,
2982
+ AIResponse: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response,
2983
+ isAIResponseLoading: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].isLoading,
2984
+ AIResponseError: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].error,
2985
+ rawData: state.rawData[props.componentId],
2986
+ themePreset: state.config.themePreset,
2987
+ isLoading: state.isLoading[props.componentId] || false,
2988
+ sessionIdFromStore: state.AIResponses[props.componentId] && state.AIResponses[props.componentId].response && state.AIResponses[props.componentId].response.sessionId || ''
2989
+ };
2990
+ };
2991
+ var mapDispatchToProps$1 = {
2992
+ getAIResponse: fetchAIResponse,
2993
+ trackUsefullness: recordAISessionUsefulness
2994
+ };
2995
+ var AIConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$1, mapDispatchToProps$1)(AIAnswer), {
2996
+ componentType: componentTypes.AIAnswer,
2997
+ internalComponent: true
2998
+ }));
2999
+ AIConnected.name = AIAnswer.name;
3000
+ AIConnected.hasInternalComponent = AIAnswer.hasInternalComponent;
3001
+ AIConnected.install = function (Vue) {
3002
+ Vue.component(AIConnected.name, AIConnected);
3003
+ };
3004
+ // Add componentType for SSR
3005
+ AIConnected.componentType = componentTypes.AIAnswer;
3006
+
3007
+ var _templateObject$8, _templateObject2$4;
3008
+ var HierarchicalMenuList = styled('ul')(_templateObject$8 || (_templateObject$8 = _taggedTemplateLiteralLoose(["\n\tlist-style: none;\n\tpadding: 0;\n\tmargin: 0;\n\tmax-height: 0;\n\toverflow: hidden;\n\n\t&.--open {\n\t\tmax-height: 100%;\n\t}\n"])));
3009
+ var HierarchicalMenuListItem = styled('li')(_templateObject2$4 || (_templateObject2$4 = _taggedTemplateLiteralLoose(["\n\tfont-weight: 400;\n\tline-height: 1.5;\n\tbox-sizing: border-box;\n\n\ta {\n\t\tcolor: #424242;\n\t\ttext-decoration: none;\n\t\tgap: 5px;\n\t\t.--leaf-icon,\n\t\t.--folder-icon {\n\t\t\tline-height: 15px;\n\t\t\tsvg {\n\t\t\t\theight: 15px;\n\t\t\t}\n\t\t}\n\n\t\tinput {\n\t\t\tmargin: 0;\n\t\t\tcursor: pointer;\n\t\t}\n\t}\n\n\t.--switcher-icon {\n\t\ttransition: all 0.2s ease-in;\n\t\tmargin-right: 2px;\n\t}\n\t.--list-child {\n\t\tpadding-left: 1rem;\n\t\tposition: relative;\n\t\t&:before {\n\t\t\theight: 100%;\n\t\t\tcontent: '';\n\t\t\tposition: absolute;\n\t\t\tborder-left: 1px solid #787878;\n\t\t\twidth: 0;\n\t\t\tleft: 19px;\n\t\t\t", ";\n\t\t}\n\n\t\t&.--show-switcher-icon {\n\t\t\tpadding-left: 36px;\n\t\t}\n\t}\n\t.--list-item-label {\n\t\tline-height: 100%;\n\t}\n\t.--list-item-count {\n\t\tmargin-left: 10px;\n\t\tpadding: 0.1rem 0.4rem;\n\t\tfont-size: 0.8rem;\n\t\tcolor: #424242;\n\t\tbackground-color: #dee1e6;\n\t\tborder-radius: 8px;\n\t}\n\t&.-selected-item {\n\t\tfont-weight: 700 !important;\n\t}\n\t&.-expanded-item {\n\t\t& > a {\n\t\t\t& div > .--switcher-icon {\n\t\t\t\ttransform: rotate(90deg);\n\t\t\t}\n\t\t}\n\t}\n\t.--list-item-label-count-wrapper {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\t&:hover {\n\t\t\t.--list-item-count,\n\t\t\t.--list-item-label {\n\t\t\t\tfont-weight: 700;\n\t\t\t}\n\t\t}\n\t}\n"])), function (props) {
3010
+ return !props.showLine && "\n\t\t\t\t\tdisplay: none;\n\t\t\t\t";
3011
+ });
3012
+
3013
+ var HierarchicalMenuListItemComponent = {
3014
+ name: 'HierarchicalMenuListItemComponent',
3015
+ data: function data() {
3016
+ return {
3017
+ isExpanded: false,
3018
+ newParentPath: ''
3019
+ };
3020
+ },
3021
+ created: function created() {
3022
+ var listItemLabel = this.listItem.key;
3023
+ var newParentPath = listItemLabel;
3024
+ if (this.parentPath) {
3025
+ newParentPath = "" + this.parentPath + TREELIST_VALUES_PATH_SEPARATOR + listItemLabel;
3026
+ }
3027
+ this.newParentPath = newParentPath;
3028
+ this.isExpanded = !!recLookup(this.selectedValues, newParentPath, TREELIST_VALUES_PATH_SEPARATOR);
3029
+ },
3030
+ watch: {
3031
+ listItem: function listItem(newVal) {
3032
+ if (newVal.initiallyExpanded) {
3033
+ this.isExpanded = newVal.initiallyExpanded;
3034
+ }
3035
+ },
3036
+ selectedValues: function selectedValues(newVal) {
3037
+ this.isExpanded = !!recLookup(newVal, this.newParentPath, TREELIST_VALUES_PATH_SEPARATOR);
3038
+ }
3039
+ },
3040
+ props: {
3041
+ parentPath: types$1.string,
3042
+ selectedValues: types$1.rawData,
3043
+ mode: types$1.string,
3044
+ searchTerm: types$1.string,
3045
+ listItem: types$1.rawData,
3046
+ showLine: types$1.bool,
3047
+ renderItem: types$1.func,
3048
+ handleListItemClick: types$1.func,
3049
+ renderSwitcherIcon: types$1.func,
3050
+ showCheckbox: VueTypes.bool,
3051
+ innerClass: types$1.style,
3052
+ showRadio: VueTypes.bool,
3053
+ renderIcon: types$1.func,
3054
+ showCount: VueTypes.bool,
3055
+ showSwitcherIcon: types$1.bool,
3056
+ switcherIcon: types$1.children
3057
+ },
3058
+ render: function render() {
3059
+ var _this = this;
3060
+ var _this$$props = this.$props,
3061
+ selectedValues = _this$$props.selectedValues,
3062
+ mode = _this$$props.mode,
3063
+ searchTerm = _this$$props.searchTerm,
3064
+ listItem = _this$$props.listItem,
3065
+ parentPath = _this$$props.parentPath,
3066
+ showLine = _this$$props.showLine,
3067
+ renderItem = _this$$props.renderItem,
3068
+ handleListItemClick = _this$$props.handleListItemClick,
3069
+ showCheckbox = _this$$props.showCheckbox,
3070
+ innerClass = _this$$props.innerClass,
3071
+ showRadio = _this$$props.showRadio,
3072
+ renderIcon = _this$$props.renderIcon,
3073
+ showCount = _this$$props.showCount,
3074
+ showSwitcherIcon = _this$$props.showSwitcherIcon;
3075
+ if (!(listItem instanceof Object) || Object.keys(listItem).length === 0) {
3076
+ return null;
3077
+ }
3078
+ var listItemLabel = listItem.key;
3079
+ var listItemCount = listItem.count;
3080
+ var isLeafNode = !(Array.isArray(listItem.list) && listItem.list.length > 0);
3081
+ var renderSwitcherIcon = function renderSwitcherIcon(isExpandedProp) {
3082
+ if (showSwitcherIcon === false) {
3083
+ return null;
3084
+ }
3085
+ var switcherIcon = _this.$props.switcherIcon;
3086
+ if (switcherIcon) return switcherIcon(isExpandedProp);
3087
+ return (
3088
+ /* eslint-disable jsx-a11y/click-events-have-key-events
3089
+ , jsx-a11y/no-static-element-interactions,jsx-a11y/no-noninteractive-tabindex */
3090
+ createVNode("span", {
3091
+ "tabIndex": "0",
3092
+ "onClick": function onClick(e) {
3093
+ e.stopPropagation();
3094
+ _this.isExpanded = !_this.isExpanded;
3095
+ },
3096
+ "class": "--switcher-icon"
3097
+ }, [createTextVNode("\u27A4")])
3098
+ );
3099
+ };
3100
+ var isSelected = false;
3101
+ if (mode === 'single') {
3102
+ if (recLookup(selectedValues, this.newParentPath, TREELIST_VALUES_PATH_SEPARATOR) === true) {
3103
+ isSelected = true;
3104
+ }
3105
+ } else {
3106
+ isSelected = !!recLookup(selectedValues, this.newParentPath, TREELIST_VALUES_PATH_SEPARATOR);
3107
+ }
3108
+ return createVNode(HierarchicalMenuListItem, {
3109
+ "class": (isSelected ? '-selected-item' : '') + " " + (this.isExpanded ? '-expanded-item' : ''),
3110
+ "key": this.newParentPath,
3111
+ "showLine": showLine
3112
+ }, {
3113
+ "default": function _default() {
3114
+ return [createVNode(ListItem, {
3115
+ "isTreeListItem": true,
3116
+ "onClick": function onClick() {
3117
+ handleListItemClick(listItemLabel, parentPath);
3118
+ },
3119
+ "style": {
3120
+ textDecoration: 'none'
3121
+ }
3122
+ }, {
3123
+ "default": function _default() {
3124
+ return [renderItem ? renderItem(listItemLabel, listItemCount, isSelected) : createVNode(Flex, {
3125
+ "alignItems": "center",
3126
+ "gap": "5px"
3127
+ }, {
3128
+ "default": function _default() {
3129
+ return [!isLeafNode && renderSwitcherIcon(isSelected), mode === 'multiple' && showCheckbox && createVNode(Flex, {
3130
+ "alignItems": "center",
3131
+ "gap": "5px"
3132
+ }, {
3133
+ "default": function _default() {
3134
+ return [createVNode(Checkbox, {
3135
+ "type": "checkbox",
3136
+ "class": getClassName$2(innerClass, 'checkbox') || null,
3137
+ "checked": isSelected,
3138
+ "id": listItemLabel + "-checkbox-" + _this.newParentPath,
3139
+ "name": listItemLabel + "-checkbox-" + _this.newParentPath,
3140
+ "show": true,
3141
+ "readOnly": true
3142
+ }, null), createVNode("label", {
3143
+ "style": {
3144
+ width: '26px',
3145
+ marginTop: 0,
3146
+ marginBottom: 0,
3147
+ marginRight: '-9px',
3148
+ left: '-3px'
3149
+ },
3150
+ "htmlFor": listItemLabel + "-checkbox-" + _this.newParentPath,
3151
+ "onClick": function onClick(e) {
3152
+ e.stopPropagation();
3153
+ }
3154
+ }, null)];
3155
+ }
3156
+ }), mode === 'single' && showRadio && createVNode(Flex, {
3157
+ "alignItems": "center",
3158
+ "gap": "5px"
3159
+ }, {
3160
+ "default": function _default() {
3161
+ return [createVNode(Radio, {
3162
+ "checked": isSelected,
3163
+ "class": getClassName$2(innerClass, 'radio') || null,
3164
+ "id": listItemLabel + "-radio-" + _this.newParentPath,
3165
+ "name": listItemLabel + "-radio-" + _this.newParentPath,
3166
+ "show": true,
3167
+ "readOnly": true,
3168
+ "type": "radio"
3169
+ }, null), createVNode("label", {
3170
+ "style": {
3171
+ width: '26px',
3172
+ marginTop: 0,
3173
+ marginBottom: 0,
3174
+ marginRight: '-9px',
3175
+ left: '-3px'
3176
+ },
3177
+ "htmlFor": listItemLabel + "-radio-" + _this.newParentPath,
3178
+ "onClick": function onClick(e) {
3179
+ e.stopPropagation();
3180
+ }
3181
+ }, null)];
3182
+ }
3183
+ }), ' ', renderIcon(isLeafNode), createVNode("div", {
3184
+ "class": "--list-item-label-count-wrapper"
3185
+ }, [createVNode("span", {
3186
+ "class": "--list-item-label " + (getClassName$2(innerClass, 'label') || '')
3187
+ }, [listItemLabel]), showCount && createVNode("span", {
3188
+ "class": "--list-item-count " + (getClassName$2(innerClass, 'count') || '')
3189
+ }, [listItemCount])])];
3190
+ }
3191
+ })];
3192
+ }
3193
+ }), isLeafNode === false && createVNode("div", {
3194
+ "class": "--list-child " + (showSwitcherIcon ? ' --show-switcher-icon' : '')
3195
+ }, [createVNode(HierarchicalMenuComponent, {
3196
+ "key": _this.newParentPath + "-" + listItemLabel + "-" + listItemCount,
3197
+ "listArray": listItem.list,
3198
+ "parentPath": _this.newParentPath,
3199
+ "isExpanded": _this.isExpanded,
3200
+ "listItemProps": {
3201
+ mode: mode,
3202
+ selectedValues: selectedValues,
3203
+ searchTerm: searchTerm,
3204
+ showLine: showLine,
3205
+ renderItem: renderItem,
3206
+ handleListItemClick: handleListItemClick,
3207
+ renderSwitcherIcon: renderSwitcherIcon,
3208
+ showCheckbox: showCheckbox,
3209
+ innerClass: innerClass,
3210
+ showRadio: showRadio,
3211
+ renderIcon: renderIcon,
3212
+ showCount: showCount,
3213
+ showSwitcherIcon: showSwitcherIcon,
3214
+ switcherIcon: _this.$props.switcherIcon
3215
+ }
3216
+ }, null)])];
3217
+ }
3218
+ });
3219
+ }
3220
+ };
3221
+
3222
+ function _isSlot$2(s) {
3223
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
3224
+ }
3225
+ var HierarchicalMenuComponent = {
3226
+ name: 'HierarchicalMenuComponent',
3227
+ props: {
3228
+ listArray: VueTypes.arrayOf(VueTypes.object),
3229
+ // array of objects
3230
+ parentPath: VueTypes.string.def(''),
3231
+ isExpanded: VueTypes.bool.def(false),
3232
+ listItemProps: types$1.rawData
3233
+ },
3234
+ render: function render() {
3235
+ var _slot;
3236
+ var _this$$props = this.$props,
3237
+ listArray = _this$$props.listArray,
3238
+ isExpanded = _this$$props.isExpanded,
3239
+ parentPath = _this$$props.parentPath,
3240
+ listItemProps = _this$$props.listItemProps;
3241
+ if (!Array.isArray(listArray) || listArray.length === 0) {
3242
+ return null;
3243
+ }
3244
+ return createVNode(HierarchicalMenuList, {
3245
+ "class": "" + (isExpanded ? '--open' : ''),
3246
+ "isSelected": isExpanded
3247
+ }, _isSlot$2(_slot = listArray.map(function (listItem) {
3248
+ return createVNode(HierarchicalMenuListItemComponent, mergeProps({
3249
+ "key": parentPath + "__" + JSON.stringify(listItem),
3250
+ "parentPath": parentPath,
3251
+ "listItem": listItem
3252
+ }, listItemProps), null);
3253
+ })) ? _slot : {
3254
+ "default": function _default() {
3255
+ return [_slot];
3256
+ }
3257
+ });
3258
+ }
3259
+ };
3260
+
3261
+ function _isSlot$3(s) {
3262
+ return typeof s === 'function' || Object.prototype.toString.call(s) === '[object Object]' && !isVNode(s);
3263
+ }
3264
+ var updateQueryAction = Actions.updateQuery,
3265
+ setQueryOptions = Actions.setQueryOptions;
3266
+ var transformValueIntoLocalState = function transformValueIntoLocalState(valueArray) {
3267
+ var valueToSet = {};
3268
+ if (valueArray.length) {
3269
+ var newSelectedValues = {};
3270
+ valueArray.forEach(function (valueItem) {
3271
+ setDeep(newSelectedValues, valueItem.split(' > '), !recLookup(newSelectedValues, valueItem.split(' > '), TREELIST_VALUES_PATH_SEPARATOR), true);
3272
+ });
3273
+ valueToSet = newSelectedValues;
3274
+ }
3275
+ return valueToSet;
3276
+ };
3277
+ var TreeList = {
3278
+ name: 'TreeList',
3279
+ props: {
3280
+ selectedValue: types.selectedValue,
3281
+ error: types.title,
3282
+ rawData: types.rawData,
3283
+ aggregationData: types.rawData,
3284
+ themePreset: types.themePreset,
3285
+ updateQueryAction: types.funcRequired,
3286
+ setQueryOptions: types.funcRequired,
3287
+ // component props
3288
+ componentId: types.string.isRequired,
3289
+ className: types.string,
3290
+ style: types.style,
3291
+ showRadio: VueTypes.bool.def(false),
3292
+ showCheckbox: types.bool.def(false),
3293
+ mode: VueTypes.oneOf(['single', 'multiple']).def('multiple'),
3294
+ showCount: VueTypes.bool.def(false),
3295
+ showSearch: VueTypes.bool.def(false),
3296
+ showIcon: VueTypes.bool.def(false),
3297
+ icon: types.children,
3298
+ showLeafIcon: VueTypes.bool.def(false),
3299
+ leafIcon: types.children,
3300
+ showLine: VueTypes.bool.def(false),
3301
+ switcherIcon: types.func,
3302
+ render: types.func,
3303
+ renderItem: types.func,
3304
+ innerClass: types.style,
3305
+ placeholder: types.string,
3306
+ title: types.title,
3307
+ isLoading: types.bool,
3308
+ dataField: types.stringArray.isRequired,
3309
+ onQueryChange: types.func,
3310
+ defaultValue: types.stringArray,
3311
+ value: types.stringArray,
3312
+ customQuery: types.func,
3313
+ defaultQuery: types.func,
3314
+ enableAppbase: types.bool,
3315
+ index: types.string,
3316
+ showFilter: types.bool,
3317
+ URLParams: types.bool,
3318
+ filterLabel: types.string,
3319
+ onChange: types.func,
3320
+ onValueChange: types.func,
3321
+ beforeValueChange: types.func,
3322
+ sortBy: types.sortByWithCount.def('count'),
3323
+ onError: types.func,
3324
+ showSwitcherIcon: types.bool.def(true),
3325
+ renderError: types.title,
3326
+ renderNoResults: types.func,
3327
+ loader: types.title,
3328
+ aggergationSize: types.number,
3329
+ endpoint: types.endpoint,
3330
+ queryFormat: types.queryFormatSearch.def('or'),
3331
+ size: types.number.def(100),
3332
+ nestedField: types.string,
3333
+ react: types.react,
3334
+ transformData: types.func,
3335
+ selectAllLabel: types.string,
3336
+ showMissing: VueTypes.bool.def(false),
3337
+ missingLabel: VueTypes.string.def('N/A')
3338
+ },
3339
+ data: function data() {
3340
+ var props = this.$props;
3341
+ this.__state = {
3342
+ selectedValues: {},
3343
+ searchTerm: '',
3344
+ aggregationData: []
3345
+ };
3346
+ this.internalComponent = props.componentId + "__internal";
3347
+ return this.__state;
3348
+ },
3349
+ created: function created() {
3350
+ var props = this.$props;
3351
+ var componentId = props.componentId;
3352
+ var defaultValue = this.defaultValue || this.value;
3353
+ var currentValueArray = this.selectedValue || defaultValue || [];
3354
+ // update local state for selected values
3355
+ if (currentValueArray.length) {
3356
+ var newSelectedValues = transformValueIntoLocalState(currentValueArray);
3357
+ this.setValue(newSelectedValues, true);
3358
+ }
3359
+
3360
+ // Set custom and default queries in store
3361
+ updateCustomQuery$1(componentId, props, currentValueArray);
3362
+ updateDefaultQuery$1(componentId, props, currentValueArray);
3363
+ this.updateQueryOptions();
3364
+ },
3365
+ mounted: function mounted() {
3366
+ var _this$$props = this.$props,
3367
+ enableAppbase = _this$$props.enableAppbase,
3368
+ index = _this$$props.index;
3369
+ if (!enableAppbase && index) {
3370
+ console.warn('Warning(ReactiveSearch): In order to use the `index` prop, the `enableAppbase` prop must be set to true in `ReactiveBase`.');
3371
+ }
3372
+ },
3373
+ watch: {
3374
+ defaultQuery: function defaultQuery() {
3375
+ this.updateDefaultQuery();
3376
+ this.updateQuery([]);
3377
+ },
3378
+ customQuery: function customQuery() {
3379
+ var valueArray = transformTreeListLocalStateIntoQueryComptaibleFormat(this.$data.selectedValues) || [];
3380
+ this.updateQuery(valueArray);
3381
+ },
3382
+ sortBy: function sortBy() {
3383
+ this.updateQueryOptions();
3384
+ },
3385
+ dataField: function dataField() {
3386
+ var valueArray = transformTreeListLocalStateIntoQueryComptaibleFormat(this.$data.selectedValues) || [];
3387
+ this.updateQueryOptions();
3388
+ this.updateQuery(valueArray);
3389
+ },
3390
+ value: function value(newVal, oldVal) {
3391
+ if (!isEqual$1(newVal, oldVal)) {
3392
+ this.setValue(newVal);
3393
+ }
3394
+ },
3395
+ selectedValue: function selectedValue(newVal) {
3396
+ if (!isEqual$1(transformTreeListLocalStateIntoQueryComptaibleFormat(this.$data.selectedValues), newVal)) {
3397
+ var _this$$props2 = this.$props,
3398
+ value = _this$$props2.value,
3399
+ onChange = _this$$props2.onChange;
3400
+ var valueToSet = [];
3401
+ if (Array.isArray(newVal) && newVal.length) {
3402
+ valueToSet = newVal;
3403
+ }
3404
+ if (value === undefined) {
3405
+ this.setValue(valueToSet);
3406
+ } else if (onChange && !isEqual$1(value, valueToSet)) {
3407
+ onChange(valueToSet);
3408
+ }
3409
+ }
3410
+ },
3411
+ aggregationData: function aggregationData(newVal, oldVal) {
3412
+ if (newVal && !isEqual$1(newVal, oldVal)) {
3413
+ this.$data.aggregationData = newVal;
3414
+ }
3415
+ }
3416
+ },
3417
+ computed: {
3418
+ hasCustomRenderer: function hasCustomRenderer$1() {
3419
+ return hasCustomRenderer(this);
3420
+ }
3421
+ },
3422
+ methods: {
3423
+ renderIcon: function renderIcon(isLeafNode) {
3424
+ var _this$$props3 = this.$props,
3425
+ showIcon = _this$$props3.showIcon,
3426
+ showLeafIcon = _this$$props3.showLeafIcon,
3427
+ icon = _this$$props3.icon;
3428
+ if (isLeafNode) {
3429
+ if (!showLeafIcon) return null;
3430
+ var _ref = this.$slots || this.$props,
3431
+ leafIcon = _ref.leafIcon;
3432
+ if (leafIcon) return leafIcon();
3433
+ return createVNode("span", {
3434
+ "role": "img",
3435
+ "aria-label": "file",
3436
+ "class": "--leaf-icon"
3437
+ }, [createVNode("svg", {
3438
+ "viewBox": "64 64 896 896",
3439
+ "focusable": "false",
3440
+ "data-icon": "file",
3441
+ "width": "1em",
3442
+ "height": "1em",
3443
+ "fill": "currentColor",
3444
+ "aria-hidden": "true"
3445
+ }, [createVNode("path", {
3446
+ "d": "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326zm1.8 562H232V136h302v216a42 42 0 0042 42h216v494z"
3447
+ }, null)])]);
3448
+ }
3449
+ if (!showIcon) return null;
3450
+ if (icon) {
3451
+ return icon;
3452
+ }
3453
+ if (this.$slots.icon) {
3454
+ return this.$slots.icon();
3455
+ }
3456
+ return createVNode("span", {
3457
+ "role": "img",
3458
+ "aria-label": "folder-open",
3459
+ "class": "--folder-icon"
3460
+ }, [createVNode("svg", {
3461
+ "viewBox": "64 64 896 896",
3462
+ "focusable": "false",
3463
+ "data-icon": "folder-open",
3464
+ "width": "1em",
3465
+ "height": "1em",
3466
+ "fill": "currentColor",
3467
+ "aria-hidden": "true"
3468
+ }, [createVNode("path", {
3469
+ "d": "M928 444H820V330.4c0-17.7-14.3-32-32-32H473L355.7 186.2a8.15 8.15 0 00-5.5-2.2H96c-17.7 0-32 14.3-32 32v592c0 17.7 14.3 32 32 32h698c13 0 24.8-7.9 29.7-20l134-332c1.5-3.8 2.3-7.9 2.3-12 0-17.7-14.3-32-32-32zM136 256h188.5l119.6 114.4H748V444H238c-13 0-24.8 7.9-29.7 20L136 643.2V256zm635.3 512H159l103.3-256h612.4L771.3 768z"
3470
+ }, null)])]);
3471
+ },
3472
+ getTransformedData: function getTransformedData() {
3473
+ var _this$$props4 = this.$props,
3474
+ dataField = _this$$props4.dataField,
3475
+ showSearch = _this$$props4.showSearch;
3476
+ var transformedData = transformRawTreeListData(this.$data.aggregationData, dataField);
3477
+ var filteredData = [];
3478
+ if (showSearch && this.searchTerm) {
3479
+ filteredData = this.filterDataBasedOnSearchTerm(transformedData, '');
3480
+ }
3481
+ return filteredData.length ? filteredData : transformedData;
3482
+ },
3483
+ handleInputChange: function handleInputChange(e) {
3484
+ var value = e.target.value;
3485
+ this.searchTerm = value;
3486
+ },
3487
+ renderSearch: function renderSearch() {
3488
+ var _this$$props5 = this.$props,
3489
+ showSearch = _this$$props5.showSearch,
3490
+ innerClass = _this$$props5.innerClass,
3491
+ placeholder = _this$$props5.placeholder,
3492
+ componentId = _this$$props5.componentId,
3493
+ themePreset = _this$$props5.themePreset;
3494
+ if (showSearch) {
3495
+ return createVNode(Input, {
3496
+ "class": getClassName$2(innerClass, 'input') || null,
3497
+ "onInput": this.handleInputChange,
3498
+ "value": this.searchTerm,
3499
+ "placeholder": placeholder || 'Search',
3500
+ "style": {
3501
+ margin: '0 0 8px'
3502
+ },
3503
+ "aria-label": componentId + "-search",
3504
+ "themePreset": themePreset
3505
+ }, null);
3506
+ }
3507
+ return null;
3508
+ },
3509
+ handleListItemClick: function handleListItemClick(key, parentPath) {
3510
+ var path = key;
3511
+ if (parentPath) {
3512
+ path = "" + parentPath + TREELIST_VALUES_PATH_SEPARATOR + key;
3513
+ }
3514
+ var newSelectedValues = _extends({}, this.selectedValues);
3515
+ if (this.$props.mode === 'single') {
3516
+ newSelectedValues = {};
3517
+ setDeep(newSelectedValues, path.split(TREELIST_VALUES_PATH_SEPARATOR), true, true);
3518
+ } else {
3519
+ var newValue = !recLookup(newSelectedValues, path, TREELIST_VALUES_PATH_SEPARATOR);
3520
+ setDeep(newSelectedValues, path.split(TREELIST_VALUES_PATH_SEPARATOR), newValue, true);
3521
+ }
3522
+ newSelectedValues = sanitizeObject(_extends({}, newSelectedValues));
3523
+ if (this.$props.value === undefined) {
3524
+ this.setValue(newSelectedValues);
3525
+ } else if (this.$props.onChange) {
3526
+ var valueToSet = transformTreeListLocalStateIntoQueryComptaibleFormat(newSelectedValues);
3527
+ this.$props.onChange(valueToSet);
3528
+ }
3529
+ },
3530
+ filterDataBasedOnSearchTerm: function filterDataBasedOnSearchTerm(listArray, parentPath) {
3531
+ var _this = this;
3532
+ if (!(listArray && Array.isArray(listArray) && listArray.length)) {
3533
+ return null;
3534
+ }
3535
+ var result = [];
3536
+ listArray.forEach(function (ele) {
3537
+ var isLeafItem = !ele.list;
3538
+ var newParentPath = ele.key;
3539
+ if (parentPath) {
3540
+ newParentPath = parentPath + "." + ele.key;
3541
+ }
3542
+ var keyHasSearchTerm = replaceDiacritics(ele.key).toLowerCase().includes(replaceDiacritics(_this.$data.searchTerm).toLowerCase()) || recLookup(_this.$data.selectedValues, newParentPath, TREELIST_VALUES_PATH_SEPARATOR);
3543
+ if (isLeafItem && keyHasSearchTerm) {
3544
+ result.push(_extends({}, ele, {
3545
+ initiallyExpanded: keyHasSearchTerm
3546
+ }));
3547
+ } else if (!isLeafItem) {
3548
+ var filteredChildrenItems = _this.filterDataBasedOnSearchTerm(ele.list, newParentPath);
3549
+ if (keyHasSearchTerm || !!filteredChildrenItems.length) {
3550
+ result.push(_extends({}, ele, {
3551
+ initiallyExpanded: keyHasSearchTerm || !!filteredChildrenItems.length,
3552
+ list: filteredChildrenItems
3553
+ }));
3554
+ }
3555
+ }
3556
+ });
3557
+ return result;
3558
+ },
3559
+ getComponent: function getComponent() {
3560
+ var _this$$props6 = this.$props,
3561
+ rawData = _this$$props6.rawData,
3562
+ error = _this$$props6.error,
3563
+ isLoading = _this$$props6.isLoading;
3564
+ var data = {
3565
+ data: this.getTransformedData(),
3566
+ rawData: rawData,
3567
+ error: error,
3568
+ handleClick: this.handleListItemClick,
3569
+ value: this.$data.selectedValues,
3570
+ loading: isLoading,
3571
+ PATH_SEPARATOR: TREELIST_VALUES_PATH_SEPARATOR
3572
+ };
3573
+ return this.$slots.render(data) || getComponent$1(data, this.$props);
3574
+ },
3575
+ getDefaultQuery: function getDefaultQuery(value) {
3576
+ var _this2 = this;
3577
+ var query = null;
3578
+ var type = 'term';
3579
+ var booleanAggregator = this.$props.queryFormat === 'or' ? 'should' : 'must';
3580
+ if (!Array.isArray(value) || value.length === 0) {
3581
+ return null;
3582
+ }
3583
+ if (value) {
3584
+ var _bool;
3585
+ // adds a sub-query with must as an array of objects for each term/value
3586
+ var queryArray = value.map(function (item) {
3587
+ return {
3588
+ bool: {
3589
+ must: item.split(' > ').map(function (subItem, i) {
3590
+ var _type, _ref2;
3591
+ return _ref2 = {}, _ref2[type] = (_type = {}, _type[_this2.$props.dataField[i]] = subItem, _type), _ref2;
3592
+ })
3593
+ }
3594
+ };
3595
+ });
3596
+ var listQuery = {
3597
+ bool: (_bool = {}, _bool[booleanAggregator] = queryArray, _bool)
3598
+ };
3599
+ query = value.length ? listQuery : null;
3600
+ }
3601
+ if (query && this.$props.nestedField) {
3602
+ return {
3603
+ nested: {
3604
+ path: this.$props.nestedField,
3605
+ query: query
3606
+ }
3607
+ };
3608
+ }
3609
+ return query;
3610
+ },
3611
+ updateQuery: function updateQuery(value) {
3612
+ var customQuery = this.$props.customQuery;
3613
+ var query = this.getDefaultQuery(value);
3614
+ var customQueryOptions;
3615
+ if (customQuery) {
3616
+ var _ref3 = customQuery(value, this.$props) || {};
3617
+ query = _ref3.query;
3618
+ customQueryOptions = getOptionsFromQuery(customQuery(value, this.$props));
3619
+ updateCustomQuery$1(this.$props.componentId, this.$props, value);
3620
+ }
3621
+ this.setQueryOptions(this.$props.componentId, _extends({}, this.generateQueryOptions(), customQueryOptions));
3622
+ this.updateQueryAction({
3623
+ componentId: this.$props.componentId,
3624
+ query: query,
3625
+ value: value,
3626
+ label: this.$props.filterLabel,
3627
+ showFilter: this.$props.showFilter,
3628
+ URLParams: this.$props.URLParams,
3629
+ componentType: componentTypes.treeList
3630
+ });
3631
+ },
3632
+ setValue: function setValue(value, hasMountedParam) {
3633
+ var _this3 = this;
3634
+ if (hasMountedParam === void 0) {
3635
+ hasMountedParam = true;
3636
+ }
3637
+ var finalValues = Array.isArray(value) === false ? transformTreeListLocalStateIntoQueryComptaibleFormat(value) : value;
3638
+ var performUpdate = function performUpdate() {
3639
+ var handleUpdates = function handleUpdates() {
3640
+ _this3.updateQuery(finalValues);
3641
+ if (_this3.$props.onValueChange) _this3.$props.onValueChange(finalValues);
3642
+ };
3643
+ if (hasMountedParam) {
3644
+ _this3.selectedValues = Array.isArray(value) ? transformValueIntoLocalState(value) : value;
3645
+ handleUpdates();
3646
+ } else {
3647
+ handleUpdates();
3648
+ }
3649
+ };
3650
+ checkValueChange$1(this.$props.componentId, finalValues, this.$props.beforeValueChange, performUpdate);
3651
+ },
3652
+ generateQueryOptions: function generateQueryOptions() {
3653
+ var queryOptions = getQueryOptions(this.$props);
3654
+ var valueArray = transformTreeListLocalStateIntoQueryComptaibleFormat(this.selectedValues);
3655
+ return getAggsQuery(valueArray, queryOptions, this.$props);
3656
+ },
3657
+ updateDefaultQuery: function updateDefaultQuery(queryOptions) {
3658
+ var value = transformTreeListLocalStateIntoQueryComptaibleFormat(this.selectedValues);
3659
+ // Update default query for RS API
3660
+ updateDefaultQuery$1(this.$props.componentId, this.$props, value);
3661
+ updateInternalQuery(getInternalComponentID(this.$props.componentId), queryOptions, value, this.$props, this.generateQueryOptions(), null);
3662
+ },
3663
+ updateQueryOptions: function updateQueryOptions() {
3664
+ // for a new query due to other changes don't append after to get fresh results
3665
+ var queryOptions = this.generateQueryOptions(this.$props, {}, transformTreeListLocalStateIntoQueryComptaibleFormat(this.$data.selectedValues));
3666
+ if (this.$props.defaultQuery) {
3667
+ // eslint-disable-next-line no-use-before-define
3668
+ this.updateDefaultQuery(queryOptions);
3669
+ } else {
3670
+ this.setQueryOptions(getInternalComponentID(this.$props.componentId), queryOptions);
3671
+ }
3672
+ }
3673
+ },
3674
+ render: function render() {
3675
+ var _this4 = this;
3676
+ var props = this.$props;
3677
+ var style = props.style,
3678
+ className = props.className,
3679
+ mode = props.mode,
3680
+ showLine = props.showLine,
3681
+ renderItem = props.renderItem,
3682
+ showCheckbox = props.showCheckbox,
3683
+ innerClass = props.innerClass,
3684
+ showRadio = props.showRadio,
3685
+ showCount = props.showCount,
3686
+ showSwitcherIcon = props.showSwitcherIcon,
3687
+ switcherIcon = props.switcherIcon,
3688
+ title = props.title,
3689
+ loader = props.loader,
3690
+ renderError = props.renderError;
3691
+ if (this.isLoading) {
3692
+ return (this.$slots.loader ? this.$slots.loader() : loader) || null;
3693
+ }
3694
+ if (this.error) {
3695
+ if (this.$slots.renderError) {
3696
+ return this.$slots.renderError(this.error);
3697
+ }
3698
+ return isFunction$1(renderError) ? renderError(this.error) : renderError;
3699
+ }
3700
+ var transformedData = this.getTransformedData();
3701
+ if (!transformedData || transformedData.length === 0) {
3702
+ return this.$slots.renderNoResults ? this.$slots.renderNoResults() : null;
3703
+ }
3704
+ return createVNode(Container, {
3705
+ "style": style,
3706
+ "class": className
3707
+ }, {
3708
+ "default": function _default() {
3709
+ return [props.title && createVNode(Title, {
3710
+ "class": getClassName$2(innerClass, 'title') || null
3711
+ }, _isSlot$3(title) ? title : {
3712
+ "default": function _default() {
3713
+ return [title];
3714
+ }
3715
+ }), _this4.renderSearch(), _this4.hasCustomRenderer ? _this4.getComponent() : createVNode(HierarchicalMenuComponent, {
3716
+ "key": "initial-node",
3717
+ "listArray": transformedData,
3718
+ "parentPath": "",
3719
+ "isExpanded": true,
3720
+ "listItemProps": {
3721
+ mode: mode,
3722
+ selectedValues: _this4.selectedValues,
3723
+ searchTerm: _this4.searchTerm,
3724
+ showLine: showLine,
3725
+ renderItem: renderItem != null ? renderItem : _this4.$slots.renderItem,
3726
+ handleListItemClick: _this4.handleListItemClick,
3727
+ showCheckbox: showCheckbox,
3728
+ innerClass: innerClass,
3729
+ showRadio: showRadio,
3730
+ renderIcon: _this4.renderIcon,
3731
+ showCount: showCount,
3732
+ showSwitcherIcon: showSwitcherIcon,
3733
+ switcherIcon: switcherIcon != null ? switcherIcon : _this4.$slots.switcherIcon
3734
+ }
3735
+ }, null)];
3736
+ }
3737
+ });
3738
+ }
3739
+ };
3740
+ var mapStateToProps$2 = function mapStateToProps(state, props) {
3741
+ return {
3742
+ selectedValue: state.selectedValues[props.componentId] && state.selectedValues[props.componentId].value || null,
3743
+ rawData: state.rawData[props.componentId] || {},
3744
+ aggregationData: props.nestedField && state.aggregations[props.componentId] ? state.aggregations[props.componentId].reactivesearch_nested : state.aggregations[props.componentId] || {},
3745
+ themePreset: state.config.themePreset,
3746
+ error: state.error[props.componentId],
3747
+ isLoading: state.isLoading[props.componentId],
3748
+ enableAppbase: state.config.enableAppbase
3749
+ };
3750
+ };
3751
+ var mapDispatchtoProps = {
3752
+ setQueryOptions: setQueryOptions,
3753
+ updateQueryAction: updateQueryAction
3754
+ };
3755
+ TreeList.hasInternalComponent = function () {
3756
+ return true;
3757
+ };
3758
+ var TreeListConnected = PreferencesConsumer(ComponentWrapper(connect(mapStateToProps$2, mapDispatchtoProps)(TreeList), {
3759
+ componentType: componentTypes.treeList,
3760
+ internalComponent: TreeList.hasInternalComponent()
3761
+ }));
3762
+ TreeListConnected.name = TreeList.name;
3763
+ TreeListConnected.install = function (Vue) {
3764
+ Vue.component(TreeListConnected.name, TreeListConnected);
3765
+ };
3766
+
3767
+ // Add componentType for SSR
3768
+ TreeListConnected.componentType = componentTypes.treeList;
3769
+
3770
+ var RcConnected = PreferencesConsumer({
3771
+ name: 'RcConnected',
3772
+ render: function render() {
3773
+ var component = ReactiveComponent;
3774
+ switch (this.$attrs.componentType) {
3775
+ case componentTypes.reactiveList:
3776
+ component = ReactiveList;
3777
+ break;
3778
+ case componentTypes.searchBox:
3779
+ component = SBConnected;
3780
+ break;
3781
+ // list components
3782
+ case componentTypes.singleList:
3783
+ component = SingleList;
3784
+ break;
3785
+ case componentTypes.multiList:
3786
+ component = MultiList;
3787
+ break;
3788
+ case componentTypes.singleDropdownList:
3789
+ component = SingleDropdownList;
3790
+ break;
3791
+ case componentTypes.multiDropdownList:
3792
+ component = MultiDropdownList;
3793
+ break;
3794
+ // basic components
3795
+ case componentTypes.toggleButton:
3796
+ component = ToggleButton;
3797
+ break;
3798
+ // range components
3799
+ case componentTypes.dynamicRangeSlider:
3800
+ component = DynamicRangeSlider;
3801
+ break;
3802
+ case componentTypes.singleRange:
3803
+ component = SingleRange;
3804
+ break;
3805
+ case componentTypes.multiRange:
3806
+ component = MultiRange;
3807
+ break;
3808
+ case componentTypes.rangeSlider:
3809
+ component = RangeSlider;
3810
+ break;
3811
+ case componentTypes.rangeInput:
3812
+ component = RangeInput;
3813
+ break;
3814
+ }
3815
+ return h(component, null, this.$slots);
3816
+ }
3817
+ });
3818
+ RcConnected.name = ReactiveComponent.name;
3819
+ RcConnected.hasInternalComponent = ReactiveComponent.hasInternalComponent;
3820
+ // Add componentType for SSR
3821
+ RcConnected.componentType = componentTypes.reactiveComponent;
3822
+ RcConnected.install = function (Vue) {
3823
+ Vue.component(RcConnected.name, RcConnected);
3824
+ };
3825
+
3826
+ var components = [ReactiveList, ResultCard, ResultList, ReactiveBase, SBConnected, SingleList, MultiList, SingleRange, MultiRange, RangeSlider, DynamicRangeSlider, ReactiveComponent, RcConnected, SelectedFilters, ToggleButton, SingleDropdownList, MultiDropdownList, StateProvider, RangeInput, TreeListConnected, AIConnected];
3827
+ function install (Vue) {
3828
+ components.map(function (component) {
3829
+ Vue.use(component);
3830
+ return null;
3831
+ });
3832
+ }
3833
+
3834
+ export { AIConnected as A, RcConnected as R, SBConnected as S, TreeListConnected as T, install as i };