react-instantsearch 7.26.1 → 7.28.0
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.
- package/dist/cjs/components/AutocompleteSearch.js +18 -11
- package/dist/cjs/components/Carousel.js +24 -17
- package/dist/cjs/components/index.js +5 -5
- package/dist/cjs/index.js +8 -88
- package/dist/cjs/lib/useStickToBottom.js +17 -11
- package/dist/cjs/types/PartialKeys.js +3 -0
- package/dist/cjs/types/Translatable.js +3 -0
- package/dist/cjs/types/index.js +6 -0
- package/dist/cjs/ui/Breadcrumb.js +31 -24
- package/dist/cjs/ui/ClearRefinements.js +19 -12
- package/dist/cjs/ui/CurrentRefinements.js +32 -26
- package/dist/cjs/ui/HierarchicalMenu.js +35 -28
- package/dist/cjs/ui/Highlight.js +20 -13
- package/dist/cjs/ui/HitsPerPage.js +21 -14
- package/dist/cjs/ui/InfiniteHits.js +38 -31
- package/dist/cjs/ui/InternalHighlight.js +14 -8
- package/dist/cjs/ui/Menu.js +32 -25
- package/dist/cjs/ui/Pagination.js +39 -32
- package/dist/cjs/ui/PoweredBy.js +23 -16
- package/dist/cjs/ui/RangeInput.js +34 -27
- package/dist/cjs/ui/RefinementList.js +40 -33
- package/dist/cjs/ui/ReverseHighlight.js +20 -13
- package/dist/cjs/ui/SearchBox.js +43 -36
- package/dist/cjs/ui/ShowMoreButton.js +13 -6
- package/dist/cjs/ui/Snippet.js +20 -13
- package/dist/cjs/ui/SortBy.js +21 -14
- package/dist/cjs/ui/Stats.js +18 -11
- package/dist/cjs/ui/ToggleRefinement.js +23 -16
- package/dist/cjs/ui/lib/capitalize.js +9 -2
- package/dist/cjs/ui/lib/index.js +6 -7
- package/dist/cjs/ui/lib/isModifierClick.js +9 -2
- package/dist/cjs/widgets/Autocomplete.js +262 -120
- package/dist/cjs/widgets/Breadcrumb.js +17 -10
- package/dist/cjs/widgets/Chat.js +69 -47
- package/dist/cjs/widgets/ClearRefinements.js +17 -10
- package/dist/cjs/widgets/CurrentRefinements.js +17 -10
- package/dist/cjs/widgets/FilterSuggestions.js +20 -13
- package/dist/cjs/widgets/FrequentlyBoughtTogether.js +23 -16
- package/dist/cjs/widgets/HierarchicalMenu.js +18 -11
- package/dist/cjs/widgets/Highlight.js +19 -12
- package/dist/cjs/widgets/Hits.js +24 -17
- package/dist/cjs/widgets/HitsPerPage.js +17 -10
- package/dist/cjs/widgets/InfiniteHits.js +17 -10
- package/dist/cjs/widgets/LookingSimilar.js +23 -16
- package/dist/cjs/widgets/Menu.js +18 -11
- package/dist/cjs/widgets/Pagination.js +18 -11
- package/dist/cjs/widgets/PoweredBy.js +16 -9
- package/dist/cjs/widgets/RangeInput.js +17 -10
- package/dist/cjs/widgets/RefinementList.js +23 -16
- package/dist/cjs/widgets/RelatedProducts.js +23 -16
- package/dist/cjs/widgets/ReverseHighlight.js +19 -12
- package/dist/cjs/widgets/SearchBox.js +20 -13
- package/dist/cjs/widgets/Snippet.js +19 -12
- package/dist/cjs/widgets/SortBy.js +17 -10
- package/dist/cjs/widgets/Stats.js +17 -10
- package/dist/cjs/widgets/ToggleRefinement.js +17 -10
- package/dist/cjs/widgets/TrendingItems.js +23 -16
- package/dist/cjs/widgets/chat/tools/SearchIndexTool.js +32 -25
- package/dist/cjs/widgets/index.js +29 -76
- package/dist/cjs/widgets/index.umd.js +58 -59
- package/dist/es/widgets/Autocomplete.d.ts +13 -4
- package/dist/es/widgets/Autocomplete.js +167 -32
- package/dist/es/widgets/Chat.js +17 -4
- package/dist/umd/ReactInstantSearch.js +1222 -1012
- package/dist/umd/ReactInstantSearch.min.js +3 -3
- package/package.json +5 -5
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! React InstantSearch 7.
|
|
1
|
+
/*! React InstantSearch 7.28.0 | © Algolia, Inc. and contributors; MIT License | https://github.com/algolia/instantsearch */
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
26
26
|
|
|
27
|
-
var version$2 = '7.
|
|
27
|
+
var version$2 = '7.28.0';
|
|
28
28
|
|
|
29
29
|
function getDefaultExportFromCjs (x) {
|
|
30
30
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
@@ -10081,7 +10081,7 @@
|
|
|
10081
10081
|
};
|
|
10082
10082
|
}
|
|
10083
10083
|
|
|
10084
|
-
var version = '4.
|
|
10084
|
+
var version = '4.92.0';
|
|
10085
10085
|
|
|
10086
10086
|
function hydrateSearchClient(client, results) {
|
|
10087
10087
|
if (!results) {
|
|
@@ -13192,6 +13192,7 @@
|
|
|
13192
13192
|
var sendEvent;
|
|
13193
13193
|
var setInput;
|
|
13194
13194
|
var setOpen;
|
|
13195
|
+
var focusInput;
|
|
13195
13196
|
var setIsClearing;
|
|
13196
13197
|
var agentId = 'agentId' in options ? options.agentId : undefined;
|
|
13197
13198
|
// Extract suggestions from the last assistant message's data-suggestions part
|
|
@@ -13348,6 +13349,9 @@
|
|
|
13348
13349
|
open = o;
|
|
13349
13350
|
render();
|
|
13350
13351
|
};
|
|
13352
|
+
focusInput = function focusInput() {
|
|
13353
|
+
setOpen(true);
|
|
13354
|
+
};
|
|
13351
13355
|
setInput = function setInput(i) {
|
|
13352
13356
|
input = i;
|
|
13353
13357
|
render();
|
|
@@ -13409,6 +13413,7 @@
|
|
|
13409
13413
|
setIndexUiState: parent.setIndexUiState.bind(parent),
|
|
13410
13414
|
setInput: setInput,
|
|
13411
13415
|
setOpen: setOpen,
|
|
13416
|
+
focusInput: focusInput,
|
|
13412
13417
|
setMessages: setMessages,
|
|
13413
13418
|
suggestions: getSuggestionsFromMessages(_chatInstance.messages),
|
|
13414
13419
|
isClearing: isClearing,
|
|
@@ -15519,6 +15524,11 @@
|
|
|
15519
15524
|
return useConnector(connectPagination, props, additionalWidgetProperties);
|
|
15520
15525
|
}
|
|
15521
15526
|
|
|
15527
|
+
/**
|
|
15528
|
+
* Logs a warning
|
|
15529
|
+
* This is used to log issues in development environment only.
|
|
15530
|
+
*/ var warn = noop;
|
|
15531
|
+
|
|
15522
15532
|
function toArray(value) {
|
|
15523
15533
|
return Array.isArray(value) ? value : [
|
|
15524
15534
|
value
|
|
@@ -17820,12 +17830,14 @@
|
|
|
17820
17830
|
function createAutocompleteComponent(param) {
|
|
17821
17831
|
var createElement = param.createElement;
|
|
17822
17832
|
return function Autocomplete(userProps) {
|
|
17823
|
-
var children = userProps.children, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames, props = _object_without_propertiesExports._(userProps, [
|
|
17833
|
+
var children = userProps.children, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames, rootRef = userProps.rootRef, props = _object_without_propertiesExports._(userProps, [
|
|
17824
17834
|
"children",
|
|
17825
|
-
"classNames"
|
|
17835
|
+
"classNames",
|
|
17836
|
+
"rootRef"
|
|
17826
17837
|
]);
|
|
17827
17838
|
return /*#__PURE__*/ createElement("div", _object_spreadExports._({
|
|
17828
|
-
className: cx('ais-Autocomplete', classNames.root)
|
|
17839
|
+
className: cx('ais-Autocomplete', classNames.root),
|
|
17840
|
+
ref: rootRef
|
|
17829
17841
|
}, props), children);
|
|
17830
17842
|
};
|
|
17831
17843
|
}
|
|
@@ -18010,8 +18022,8 @@
|
|
|
18010
18022
|
function createAutocompleteIndexComponent(param) {
|
|
18011
18023
|
var createElement = param.createElement;
|
|
18012
18024
|
return function AutocompleteIndex(userProps) {
|
|
18013
|
-
var items = userProps.items, HeaderComponent = userProps.HeaderComponent, ItemComponent = userProps.ItemComponent, getItemProps = userProps.getItemProps, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames;
|
|
18014
|
-
if (items.length === 0) {
|
|
18025
|
+
var items = userProps.items, HeaderComponent = userProps.HeaderComponent, ItemComponent = userProps.ItemComponent, NoResultsComponent = userProps.NoResultsComponent, getItemProps = userProps.getItemProps, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames;
|
|
18026
|
+
if (items.length === 0 && !NoResultsComponent) {
|
|
18015
18027
|
return null;
|
|
18016
18028
|
}
|
|
18017
18029
|
return /*#__PURE__*/ createElement("div", {
|
|
@@ -18020,7 +18032,9 @@
|
|
|
18020
18032
|
className: cx('ais-AutocompleteIndexHeader', classNames.header)
|
|
18021
18033
|
}, /*#__PURE__*/ createElement(HeaderComponent, {
|
|
18022
18034
|
items: items
|
|
18023
|
-
})), /*#__PURE__*/ createElement("
|
|
18035
|
+
})), items.length === 0 && NoResultsComponent ? /*#__PURE__*/ createElement("div", {
|
|
18036
|
+
className: cx('ais-AutocompleteIndexNoResults', classNames.noResults)
|
|
18037
|
+
}, /*#__PURE__*/ createElement(NoResultsComponent, null)) : /*#__PURE__*/ createElement("ol", {
|
|
18024
18038
|
className: cx('ais-AutocompleteIndexList', classNames.list)
|
|
18025
18039
|
}, items.map(function(item, index) {
|
|
18026
18040
|
var _getItemProps = getItemProps(item, index), className = _getItemProps.className, onSelect = _getItemProps.onSelect, onApply = _getItemProps.onApply, itemProps = _object_without_propertiesExports._(_getItemProps, [
|
|
@@ -18063,983 +18077,1004 @@
|
|
|
18063
18077
|
};
|
|
18064
18078
|
}
|
|
18065
18079
|
|
|
18066
|
-
function
|
|
18080
|
+
function SparklesIcon(param) {
|
|
18067
18081
|
var createElement = param.createElement;
|
|
18068
|
-
return
|
|
18069
|
-
|
|
18070
|
-
|
|
18071
|
-
|
|
18072
|
-
|
|
18073
|
-
|
|
18074
|
-
|
|
18075
|
-
|
|
18076
|
-
|
|
18077
|
-
|
|
18078
|
-
|
|
18079
|
-
|
|
18080
|
-
|
|
18081
|
-
|
|
18082
|
-
|
|
18083
|
-
}, /*#__PURE__*/ createElement("button", {
|
|
18084
|
-
className: cx('ais-AutocompleteItemActionButton', 'ais-AutocompleteRecentSearchItemDeleteButton', classNames.deleteButton),
|
|
18085
|
-
title: "Remove ".concat(item.query, " from recent searches"),
|
|
18086
|
-
onClick: function onClick(evt) {
|
|
18087
|
-
evt.stopPropagation();
|
|
18088
|
-
onRemoveRecentSearch();
|
|
18089
|
-
}
|
|
18090
|
-
}, /*#__PURE__*/ createElement(TrashIcon, {
|
|
18091
|
-
createElement: createElement
|
|
18092
|
-
})), /*#__PURE__*/ createElement("button", {
|
|
18093
|
-
className: cx('ais-AutocompleteItemActionButton', 'ais-AutocompleteRecentSearchItemApplyButton', classNames.applyButton),
|
|
18094
|
-
title: "Apply ".concat(item.query, " as search"),
|
|
18095
|
-
onClick: function onClick(evt) {
|
|
18096
|
-
evt.stopPropagation();
|
|
18097
|
-
onApply();
|
|
18098
|
-
}
|
|
18099
|
-
}, /*#__PURE__*/ createElement(ApplyIcon, {
|
|
18100
|
-
createElement: createElement
|
|
18101
|
-
}))));
|
|
18102
|
-
};
|
|
18082
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
18083
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18084
|
+
fill: "none",
|
|
18085
|
+
viewBox: "0 0 20 20"
|
|
18086
|
+
}, /*#__PURE__*/ createElement("path", {
|
|
18087
|
+
fill: "currentColor",
|
|
18088
|
+
fillRule: "evenodd",
|
|
18089
|
+
d: "M10 1.875c.27 0 .51.173.594.43l1.593 4.844a1.043 1.043 0 0 0 .664.664l4.844 1.593a.625.625 0 0 1 0 1.188l-4.844 1.593a1.043 1.043 0 0 0-.664.664l-1.593 4.844a.625.625 0 0 1-1.188 0l-1.593-4.844a1.042 1.042 0 0 0-.664-.664l-4.844-1.593a.625.625 0 0 1 0-1.188l4.844-1.593a1.042 1.042 0 0 0 .664-.664l1.593-4.844a.625.625 0 0 1 .594-.43ZM9 7.539A2.292 2.292 0 0 1 7.54 9L4.5 10l3.04 1A2.292 2.292 0 0 1 9 12.46l1 3.04 1-3.04A2.293 2.293 0 0 1 12.46 11l3.04-1-3.04-1A2.292 2.292 0 0 1 11 7.54L10 4.5 9 7.54ZM4.167 1.875c.345 0 .625.28.625.625v3.333a.625.625 0 0 1-1.25 0V2.5c0-.345.28-.625.625-.625ZM15.833 13.542c.345 0 .625.28.625.625V17.5a.625.625 0 1 1-1.25 0v-3.333c0-.345.28-.625.625-.625Z",
|
|
18090
|
+
clipRule: "evenodd"
|
|
18091
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
18092
|
+
fill: "currentColor",
|
|
18093
|
+
fillRule: "evenodd",
|
|
18094
|
+
d: "M1.875 4.167c0-.346.28-.625.625-.625h3.333a.625.625 0 1 1 0 1.25H2.5a.625.625 0 0 1-.625-.625ZM13.542 15.833c0-.345.28-.625.625-.625H17.5a.625.625 0 0 1 0 1.25h-3.333a.625.625 0 0 1-.625-.625Z",
|
|
18095
|
+
clipRule: "evenodd"
|
|
18096
|
+
}));
|
|
18103
18097
|
}
|
|
18104
|
-
|
|
18105
|
-
function createAutocompleteSearchComponent(param) {
|
|
18098
|
+
function ArrowUpIcon(param) {
|
|
18106
18099
|
var createElement = param.createElement;
|
|
18107
|
-
return
|
|
18108
|
-
|
|
18109
|
-
|
|
18110
|
-
|
|
18111
|
-
|
|
18112
|
-
|
|
18113
|
-
|
|
18114
|
-
|
|
18115
|
-
|
|
18116
|
-
|
|
18117
|
-
|
|
18118
|
-
|
|
18119
|
-
var _inputRef_current;
|
|
18120
|
-
return (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
18121
|
-
}
|
|
18122
|
-
}, /*#__PURE__*/ createElement("div", {
|
|
18123
|
-
className: "ais-AutocompleteInputWrapperPrefix"
|
|
18124
|
-
}, /*#__PURE__*/ createElement("label", {
|
|
18125
|
-
className: "ais-AutocompleteLabel",
|
|
18126
|
-
"aria-label": "Submit",
|
|
18127
|
-
htmlFor: inputProps.id,
|
|
18128
|
-
id: "".concat(inputProps.id, "-label")
|
|
18129
|
-
}, /*#__PURE__*/ createElement("button", {
|
|
18130
|
-
className: "ais-AutocompleteSubmitButton",
|
|
18131
|
-
type: "submit",
|
|
18132
|
-
title: "Submit"
|
|
18133
|
-
}, /*#__PURE__*/ createElement(SubmitIcon, {
|
|
18134
|
-
createElement: createElement
|
|
18135
|
-
}))), /*#__PURE__*/ createElement("div", {
|
|
18136
|
-
className: "ais-AutocompleteLoadingIndicator",
|
|
18137
|
-
hidden: !isSearchStalled
|
|
18138
|
-
}, /*#__PURE__*/ createElement(LoadingIcon, {
|
|
18139
|
-
createElement: createElement
|
|
18140
|
-
}))), /*#__PURE__*/ createElement("div", {
|
|
18141
|
-
className: "ais-AutocompleteInputWrapper"
|
|
18142
|
-
}, /*#__PURE__*/ createElement("input", _object_spreadExports._({
|
|
18143
|
-
className: "ais-AutocompleteInput",
|
|
18144
|
-
"aria-autocomplete": "both",
|
|
18145
|
-
"aria-labelledby": "".concat(inputProps.id, "-label"),
|
|
18146
|
-
autoComplete: "off",
|
|
18147
|
-
autoCorrect: "off",
|
|
18148
|
-
autoCapitalize: "off",
|
|
18149
|
-
enterKeyHint: "search",
|
|
18150
|
-
spellCheck: "false",
|
|
18151
|
-
maxLength: 512,
|
|
18152
|
-
type: "search",
|
|
18153
|
-
value: query
|
|
18154
|
-
}, inputProps))), /*#__PURE__*/ createElement("div", {
|
|
18155
|
-
className: "ais-AutocompleteInputWrapperSuffix"
|
|
18156
|
-
}, /*#__PURE__*/ createElement("button", {
|
|
18157
|
-
className: "ais-AutocompleteClearButton",
|
|
18158
|
-
type: "reset",
|
|
18159
|
-
title: "Clear",
|
|
18160
|
-
hidden: query.length === 0 || isSearchStalled,
|
|
18161
|
-
onClick: onClear
|
|
18162
|
-
}, /*#__PURE__*/ createElement(ClearIcon, {
|
|
18163
|
-
createElement: createElement
|
|
18164
|
-
}))));
|
|
18165
|
-
};
|
|
18100
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
18101
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18102
|
+
viewBox: "0 0 24 24",
|
|
18103
|
+
fill: "none",
|
|
18104
|
+
stroke: "currentColor",
|
|
18105
|
+
strokeLinecap: "round",
|
|
18106
|
+
strokeLinejoin: "round"
|
|
18107
|
+
}, /*#__PURE__*/ createElement("path", {
|
|
18108
|
+
d: "m5 12 7-7 7 7"
|
|
18109
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
18110
|
+
d: "M12 19V5"
|
|
18111
|
+
}));
|
|
18166
18112
|
}
|
|
18167
|
-
|
|
18168
|
-
function createAutocompleteSuggestionComponent(param) {
|
|
18113
|
+
function ArrowRightIcon(param) {
|
|
18169
18114
|
var createElement = param.createElement;
|
|
18170
|
-
return
|
|
18171
|
-
|
|
18172
|
-
|
|
18173
|
-
|
|
18174
|
-
|
|
18175
|
-
|
|
18176
|
-
|
|
18177
|
-
|
|
18178
|
-
|
|
18179
|
-
|
|
18180
|
-
|
|
18181
|
-
|
|
18182
|
-
className: cx('ais-AutocompleteItemContentBody', 'ais-AutocompleteSuggestionItemContentBody', classNames.content)
|
|
18183
|
-
}, children)), /*#__PURE__*/ createElement("div", {
|
|
18184
|
-
className: cx('ais-AutocompleteItemActions', 'ais-AutocompleteSuggestionItemActions', classNames.actions)
|
|
18185
|
-
}, /*#__PURE__*/ createElement("button", {
|
|
18186
|
-
className: cx('ais-AutocompleteItemActionButton', 'ais-AutocompleteSuggestionItemApplyButton', classNames.applyButton),
|
|
18187
|
-
type: "button",
|
|
18188
|
-
title: "Apply ".concat(item.query, " as search"),
|
|
18189
|
-
onClick: function onClick(evt) {
|
|
18190
|
-
evt.stopPropagation();
|
|
18191
|
-
onApply();
|
|
18192
|
-
}
|
|
18193
|
-
}, /*#__PURE__*/ createElement(ApplyIcon, {
|
|
18194
|
-
createElement: createElement
|
|
18195
|
-
}))));
|
|
18196
|
-
};
|
|
18115
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
18116
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18117
|
+
viewBox: "0 0 24 24",
|
|
18118
|
+
fill: "none",
|
|
18119
|
+
stroke: "currentColor",
|
|
18120
|
+
strokeLinecap: "round",
|
|
18121
|
+
strokeLinejoin: "round"
|
|
18122
|
+
}, /*#__PURE__*/ createElement("path", {
|
|
18123
|
+
d: "M5 12h14"
|
|
18124
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
18125
|
+
d: "m12 5 7 7-7 7"
|
|
18126
|
+
}));
|
|
18197
18127
|
}
|
|
18198
|
-
|
|
18199
|
-
|
|
18200
|
-
|
|
18201
|
-
|
|
18202
|
-
|
|
18203
|
-
|
|
18204
|
-
|
|
18205
|
-
|
|
18206
|
-
|
|
18128
|
+
function ChevronUpIcon(param) {
|
|
18129
|
+
var createElement = param.createElement;
|
|
18130
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
18131
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18132
|
+
viewBox: "0 0 24 24",
|
|
18133
|
+
fill: "none",
|
|
18134
|
+
stroke: "currentColor",
|
|
18135
|
+
strokeLinecap: "round",
|
|
18136
|
+
strokeLinejoin: "round"
|
|
18137
|
+
}, /*#__PURE__*/ createElement("path", {
|
|
18138
|
+
d: "m18 15-6-6-6 6"
|
|
18139
|
+
}));
|
|
18207
18140
|
}
|
|
18208
|
-
|
|
18209
|
-
|
|
18210
|
-
|
|
18211
|
-
|
|
18212
|
-
|
|
18213
|
-
|
|
18214
|
-
|
|
18215
|
-
|
|
18216
|
-
|
|
18217
|
-
|
|
18218
|
-
|
|
18219
|
-
|
|
18220
|
-
indices: indices,
|
|
18221
|
-
indicesConfig: indicesConfig,
|
|
18222
|
-
getElementId: getElementId
|
|
18223
|
-
});
|
|
18224
|
-
}, [
|
|
18225
|
-
indices,
|
|
18226
|
-
indicesConfig,
|
|
18227
|
-
getElementId
|
|
18228
|
-
]), items = _useMemo.items, itemsIds = _useMemo.itemsIds;
|
|
18229
|
-
useEffect(function() {
|
|
18230
|
-
// In detached mode, we don't close the panel on body click
|
|
18231
|
-
// because the overlay handles closing
|
|
18232
|
-
if (isDetached) {
|
|
18233
|
-
return function() {};
|
|
18234
|
-
}
|
|
18235
|
-
var onBodyClick = function onBodyClick(event) {
|
|
18236
|
-
var _unwrapRef;
|
|
18237
|
-
if ((_unwrapRef = unwrapRef(rootRef)) === null || _unwrapRef === void 0 ? void 0 : _unwrapRef.contains(event.target)) {
|
|
18238
|
-
return;
|
|
18239
|
-
}
|
|
18240
|
-
setIsOpen(false);
|
|
18241
|
-
};
|
|
18242
|
-
document.body.addEventListener('click', onBodyClick);
|
|
18243
|
-
return function() {
|
|
18244
|
-
document.body.removeEventListener('click', onBodyClick);
|
|
18245
|
-
};
|
|
18246
|
-
}, [
|
|
18247
|
-
rootRef,
|
|
18248
|
-
isDetached
|
|
18249
|
-
]);
|
|
18250
|
-
var getNextActiveDescendant = function getNextActiveDescendant(key) {
|
|
18251
|
-
switch(key){
|
|
18252
|
-
case 'ArrowUp':
|
|
18253
|
-
{
|
|
18254
|
-
var prevIndex = itemsIds.indexOf(activeDescendant || '') - 1;
|
|
18255
|
-
return itemsIds[prevIndex] || itemsIds[itemsIds.length - 1];
|
|
18256
|
-
}
|
|
18257
|
-
case 'ArrowDown':
|
|
18258
|
-
{
|
|
18259
|
-
var nextIndex = itemsIds.indexOf(activeDescendant || '') + 1;
|
|
18260
|
-
return itemsIds[nextIndex] || itemsIds[0];
|
|
18261
|
-
}
|
|
18262
|
-
default:
|
|
18263
|
-
return undefined;
|
|
18264
|
-
}
|
|
18265
|
-
};
|
|
18266
|
-
var submit = function submit() {
|
|
18267
|
-
var override = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
18268
|
-
var _override_activeDescendant;
|
|
18269
|
-
if (isOpen) {
|
|
18270
|
-
setIsOpen(false);
|
|
18271
|
-
} else {
|
|
18272
|
-
var _inputRef_current;
|
|
18273
|
-
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.blur();
|
|
18274
|
-
}
|
|
18275
|
-
var actualDescendant = (_override_activeDescendant = override.activeDescendant) !== null && _override_activeDescendant !== void 0 ? _override_activeDescendant : activeDescendant;
|
|
18276
|
-
if (!actualDescendant && override.query) {
|
|
18277
|
-
onRefine(override.query);
|
|
18278
|
-
}
|
|
18279
|
-
if (actualDescendant && items.has(actualDescendant)) {
|
|
18280
|
-
var _ref;
|
|
18281
|
-
var _items_get = items.get(actualDescendant), item = _items_get.item, _items_get_config = _items_get.config, indexOnSelect = _items_get_config.onSelect, getQuery = _items_get_config.getQuery, getURL = _items_get_config.getURL;
|
|
18282
|
-
var actualOnSelect = indexOnSelect !== null && indexOnSelect !== void 0 ? indexOnSelect : globalOnSelect;
|
|
18283
|
-
actualOnSelect({
|
|
18284
|
-
item: item,
|
|
18285
|
-
query: (_ref = getQuery === null || getQuery === void 0 ? void 0 : getQuery(item)) !== null && _ref !== void 0 ? _ref : '',
|
|
18286
|
-
url: getURL === null || getURL === void 0 ? void 0 : getURL(item),
|
|
18287
|
-
setQuery: function setQuery(query) {
|
|
18288
|
-
return onRefine(query);
|
|
18289
|
-
}
|
|
18290
|
-
});
|
|
18291
|
-
setActiveDescendant(undefined);
|
|
18292
|
-
}
|
|
18293
|
-
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
|
|
18294
|
-
};
|
|
18295
|
-
return {
|
|
18296
|
-
getInputProps: function getInputProps() {
|
|
18297
|
-
return {
|
|
18298
|
-
id: getElementId('input'),
|
|
18299
|
-
ref: inputRef,
|
|
18300
|
-
role: 'combobox',
|
|
18301
|
-
'aria-autocomplete': 'list',
|
|
18302
|
-
'aria-expanded': isOpen,
|
|
18303
|
-
'aria-haspopup': 'grid',
|
|
18304
|
-
'aria-controls': getElementId('panel'),
|
|
18305
|
-
'aria-activedescendant': activeDescendant,
|
|
18306
|
-
placeholder: placeholder,
|
|
18307
|
-
onFocus: function onFocus() {
|
|
18308
|
-
return setIsOpen(true);
|
|
18309
|
-
},
|
|
18310
|
-
onKeyDown: function onKeyDown(event) {
|
|
18311
|
-
switch(event.key){
|
|
18312
|
-
case 'Escape':
|
|
18313
|
-
{
|
|
18314
|
-
if (isOpen) {
|
|
18315
|
-
setIsOpen(false);
|
|
18316
|
-
event.preventDefault();
|
|
18317
|
-
} else {
|
|
18318
|
-
setActiveDescendant(undefined);
|
|
18319
|
-
}
|
|
18320
|
-
break;
|
|
18321
|
-
}
|
|
18322
|
-
case 'ArrowUp':
|
|
18323
|
-
case 'ArrowDown':
|
|
18324
|
-
{
|
|
18325
|
-
var _document_getElementById;
|
|
18326
|
-
setIsOpen(true);
|
|
18327
|
-
var nextActiveDescendant = getNextActiveDescendant(event.key);
|
|
18328
|
-
setActiveDescendant(nextActiveDescendant);
|
|
18329
|
-
(_document_getElementById = document.getElementById(nextActiveDescendant)) === null || _document_getElementById === void 0 ? void 0 : _document_getElementById.scrollIntoView(false);
|
|
18330
|
-
event.preventDefault();
|
|
18331
|
-
break;
|
|
18332
|
-
}
|
|
18333
|
-
case 'Enter':
|
|
18334
|
-
{
|
|
18335
|
-
submit({
|
|
18336
|
-
query: event.target.value
|
|
18337
|
-
});
|
|
18338
|
-
break;
|
|
18339
|
-
}
|
|
18340
|
-
case 'Tab':
|
|
18341
|
-
// In detached mode, Tab doesn't close the panel
|
|
18342
|
-
if (!isDetached) {
|
|
18343
|
-
setIsOpen(false);
|
|
18344
|
-
}
|
|
18345
|
-
break;
|
|
18346
|
-
default:
|
|
18347
|
-
setIsOpen(true);
|
|
18348
|
-
return;
|
|
18349
|
-
}
|
|
18350
|
-
},
|
|
18351
|
-
onKeyUp: function onKeyUp(event) {
|
|
18352
|
-
switch(event.key){
|
|
18353
|
-
case 'ArrowLeft':
|
|
18354
|
-
case 'ArrowUp':
|
|
18355
|
-
case 'ArrowRight':
|
|
18356
|
-
case 'ArrowDown':
|
|
18357
|
-
case 'Escape':
|
|
18358
|
-
case 'Return':
|
|
18359
|
-
event.preventDefault();
|
|
18360
|
-
return;
|
|
18361
|
-
default:
|
|
18362
|
-
setActiveDescendant(undefined);
|
|
18363
|
-
break;
|
|
18364
|
-
}
|
|
18365
|
-
}
|
|
18366
|
-
};
|
|
18367
|
-
},
|
|
18368
|
-
getItemProps: function getItemProps(item, index) {
|
|
18369
|
-
var id = getElementId('item', item.__indexName, index);
|
|
18370
|
-
return {
|
|
18371
|
-
id: id,
|
|
18372
|
-
role: 'row',
|
|
18373
|
-
'aria-selected': id === activeDescendant,
|
|
18374
|
-
onSelect: function onSelect() {
|
|
18375
|
-
return submit({
|
|
18376
|
-
activeDescendant: id
|
|
18377
|
-
});
|
|
18378
|
-
},
|
|
18379
|
-
onApply: function onApply1() {
|
|
18380
|
-
var _ref;
|
|
18381
|
-
var _items_get = items.get(id), currentItem = _items_get.item, getQuery = _items_get.config.getQuery;
|
|
18382
|
-
onApply((_ref = getQuery === null || getQuery === void 0 ? void 0 : getQuery(currentItem)) !== null && _ref !== void 0 ? _ref : '');
|
|
18383
|
-
}
|
|
18384
|
-
};
|
|
18385
|
-
},
|
|
18386
|
-
getPanelProps: function getPanelProps() {
|
|
18387
|
-
return {
|
|
18388
|
-
hidden: !isOpen,
|
|
18389
|
-
id: getElementId('panel'),
|
|
18390
|
-
role: 'grid',
|
|
18391
|
-
'aria-labelledby': getElementId('input')
|
|
18392
|
-
};
|
|
18393
|
-
},
|
|
18394
|
-
getRootProps: function getRootProps() {
|
|
18395
|
-
return {
|
|
18396
|
-
ref: rootRef
|
|
18397
|
-
};
|
|
18398
|
-
},
|
|
18399
|
-
isOpen: isOpen,
|
|
18400
|
-
setIsOpen: setIsOpen,
|
|
18401
|
-
focusInput: function focusInput() {
|
|
18402
|
-
var _inputRef_current;
|
|
18403
|
-
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
18404
|
-
}
|
|
18405
|
-
};
|
|
18406
|
-
};
|
|
18407
|
-
}
|
|
18408
|
-
function buildItems(param) {
|
|
18409
|
-
var _loop = function _loop(i) {
|
|
18410
|
-
var _indices_i;
|
|
18411
|
-
var currentIndexConfig = find(indicesConfig, function(config) {
|
|
18412
|
-
return config.indexName === indices[i].indexName;
|
|
18413
|
-
});
|
|
18414
|
-
var hits = ((_indices_i = indices[i]) === null || _indices_i === void 0 ? void 0 : _indices_i.hits) || [];
|
|
18415
|
-
for(var position = 0; position < hits.length; position++){
|
|
18416
|
-
var itemId = getElementId('item', (currentIndexConfig === null || currentIndexConfig === void 0 ? void 0 : currentIndexConfig.indexName) || indices[i].indexName, position);
|
|
18417
|
-
items.set(itemId, {
|
|
18418
|
-
item: hits[position],
|
|
18419
|
-
config: currentIndexConfig
|
|
18420
|
-
});
|
|
18421
|
-
itemsIds.push(itemId);
|
|
18422
|
-
}
|
|
18423
|
-
};
|
|
18424
|
-
var indices = param.indices, indicesConfig = param.indicesConfig, getElementId = param.getElementId;
|
|
18425
|
-
var itemsIds = [];
|
|
18426
|
-
var items = new Map();
|
|
18427
|
-
for(var i = 0; i < indices.length; i++)_loop(i);
|
|
18428
|
-
return {
|
|
18429
|
-
items: items,
|
|
18430
|
-
itemsIds: itemsIds
|
|
18431
|
-
};
|
|
18432
|
-
}
|
|
18433
|
-
function createGetElementId(autocompleteId) {
|
|
18434
|
-
return function getElementId() {
|
|
18435
|
-
for(var _len = arguments.length, suffixes = new Array(_len), _key = 0; _key < _len; _key++){
|
|
18436
|
-
suffixes[_key] = arguments[_key];
|
|
18437
|
-
}
|
|
18438
|
-
var prefix = 'autocomplete';
|
|
18439
|
-
return "".concat(prefix).concat(autocompleteId).concat(suffixes.join(':'));
|
|
18440
|
-
};
|
|
18141
|
+
function ChevronDownIcon(param) {
|
|
18142
|
+
var createElement = param.createElement;
|
|
18143
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
18144
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18145
|
+
viewBox: "0 0 24 24",
|
|
18146
|
+
fill: "none",
|
|
18147
|
+
stroke: "currentColor",
|
|
18148
|
+
strokeLinecap: "round",
|
|
18149
|
+
strokeLinejoin: "round"
|
|
18150
|
+
}, /*#__PURE__*/ createElement("path", {
|
|
18151
|
+
d: "m6 9 6 6 6-6"
|
|
18152
|
+
}));
|
|
18441
18153
|
}
|
|
18442
|
-
|
|
18443
|
-
|
|
18444
|
-
|
|
18445
|
-
|
|
18446
|
-
|
|
18154
|
+
function CloseIcon(param) {
|
|
18155
|
+
var createElement = param.createElement;
|
|
18156
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
18157
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18158
|
+
viewBox: "0 0 24 24",
|
|
18159
|
+
fill: "none",
|
|
18160
|
+
stroke: "currentColor",
|
|
18161
|
+
strokeLinecap: "round",
|
|
18162
|
+
strokeLinejoin: "round"
|
|
18163
|
+
}, /*#__PURE__*/ createElement("path", {
|
|
18164
|
+
d: "M18 6 6 18"
|
|
18165
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
18166
|
+
d: "m6 6 12 12"
|
|
18167
|
+
}));
|
|
18447
18168
|
}
|
|
18448
|
-
|
|
18449
|
-
|
|
18450
|
-
|
|
18451
|
-
|
|
18452
|
-
|
|
18453
|
-
|
|
18454
|
-
|
|
18455
|
-
|
|
18456
|
-
|
|
18457
|
-
|
|
18458
|
-
|
|
18459
|
-
|
|
18460
|
-
|
|
18461
|
-
|
|
18462
|
-
|
|
18463
|
-
|
|
18464
|
-
|
|
18465
|
-
|
|
18466
|
-
});
|
|
18467
|
-
return function() {
|
|
18468
|
-
storage.unregisterUpdateListener();
|
|
18469
|
-
};
|
|
18470
|
-
}, [
|
|
18471
|
-
storage
|
|
18472
|
-
]);
|
|
18473
|
-
if (!showRecent) {
|
|
18474
|
-
return {
|
|
18475
|
-
storage: {
|
|
18476
|
-
onAdd: function onAdd() {},
|
|
18477
|
-
onRemove: function onRemove() {}
|
|
18478
|
-
},
|
|
18479
|
-
storageHits: [],
|
|
18480
|
-
indicesForPropGetters: indices,
|
|
18481
|
-
indicesConfigForPropGetters: indicesConfig
|
|
18482
|
-
};
|
|
18483
|
-
}
|
|
18484
|
-
var storageHits = snapshot.getAll(query).map(function(value) {
|
|
18485
|
-
return {
|
|
18486
|
-
objectID: value,
|
|
18487
|
-
query: value,
|
|
18488
|
-
__indexName: 'recent-searches',
|
|
18489
|
-
_highlightResult: getHighlightedAttribute({
|
|
18490
|
-
item: {
|
|
18491
|
-
query: value
|
|
18492
|
-
},
|
|
18493
|
-
query: query || ''
|
|
18494
|
-
})
|
|
18495
|
-
};
|
|
18496
|
-
});
|
|
18497
|
-
var indicesForPropGetters = _to_consumable_arrayExports._(indices.map(function(index) {
|
|
18498
|
-
return index.indexName === suggestionsIndexName ? _object_spread_propsExports._(_object_spreadExports._({}, index), {
|
|
18499
|
-
hits: index.hits.filter(function(hit) {
|
|
18500
|
-
return !find(storageHits, function(storageHit) {
|
|
18501
|
-
return storageHit.query === hit.query;
|
|
18502
|
-
});
|
|
18503
|
-
})
|
|
18504
|
-
}) : index;
|
|
18505
|
-
}));
|
|
18506
|
-
var indicesConfigForPropGetters = _to_consumable_arrayExports._(indicesConfig);
|
|
18507
|
-
indicesForPropGetters.unshift({
|
|
18508
|
-
indexName: 'recent-searches',
|
|
18509
|
-
indexId: 'recent-searches',
|
|
18510
|
-
hits: storageHits
|
|
18511
|
-
});
|
|
18512
|
-
indicesConfigForPropGetters.unshift({
|
|
18513
|
-
indexName: 'recent-searches',
|
|
18514
|
-
// @ts-expect-error - we know it has query as it's generated from storageHits
|
|
18515
|
-
getQuery: function getQuery(item) {
|
|
18516
|
-
return item.query;
|
|
18517
|
-
}
|
|
18518
|
-
});
|
|
18519
|
-
return {
|
|
18520
|
-
storage: storage,
|
|
18521
|
-
storageHits: storageHits,
|
|
18522
|
-
indicesForPropGetters: indicesForPropGetters,
|
|
18523
|
-
indicesConfigForPropGetters: indicesConfigForPropGetters
|
|
18524
|
-
};
|
|
18525
|
-
};
|
|
18169
|
+
function MaximizeIcon(param) {
|
|
18170
|
+
var createElement = param.createElement;
|
|
18171
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
18172
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18173
|
+
viewBox: "0 0 24 24",
|
|
18174
|
+
fill: "none",
|
|
18175
|
+
stroke: "currentColor",
|
|
18176
|
+
strokeLinecap: "round",
|
|
18177
|
+
strokeLinejoin: "round"
|
|
18178
|
+
}, /*#__PURE__*/ createElement("path", {
|
|
18179
|
+
d: "M15 3h6v6"
|
|
18180
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
18181
|
+
d: "m21 3-7 7"
|
|
18182
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
18183
|
+
d: "m3 21 7-7"
|
|
18184
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
18185
|
+
d: "M9 21H3v-6"
|
|
18186
|
+
}));
|
|
18526
18187
|
}
|
|
18527
|
-
|
|
18528
|
-
|
|
18529
|
-
|
|
18530
|
-
|
|
18531
|
-
|
|
18532
|
-
|
|
18533
|
-
|
|
18534
|
-
|
|
18535
|
-
|
|
18536
|
-
}
|
|
18188
|
+
function MinimizeIcon(param) {
|
|
18189
|
+
var createElement = param.createElement;
|
|
18190
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
18191
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18192
|
+
viewBox: "0 0 24 24",
|
|
18193
|
+
fill: "none",
|
|
18194
|
+
stroke: "currentColor",
|
|
18195
|
+
strokeLinecap: "round",
|
|
18196
|
+
strokeLinejoin: "round"
|
|
18197
|
+
}, /*#__PURE__*/ createElement("path", {
|
|
18198
|
+
d: "m14 10 7-7"
|
|
18199
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
18200
|
+
d: "M20 10h-6V4"
|
|
18201
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
18202
|
+
d: "m3 21 7-7"
|
|
18203
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
18204
|
+
d: "M4 14h6v6"
|
|
18205
|
+
}));
|
|
18537
18206
|
}
|
|
18538
|
-
function
|
|
18539
|
-
var
|
|
18540
|
-
|
|
18541
|
-
|
|
18542
|
-
|
|
18543
|
-
|
|
18544
|
-
|
|
18545
|
-
|
|
18546
|
-
|
|
18547
|
-
|
|
18548
|
-
|
|
18549
|
-
|
|
18550
|
-
|
|
18551
|
-
|
|
18552
|
-
|
|
18553
|
-
|
|
18207
|
+
function StopIcon(param) {
|
|
18208
|
+
var createElement = param.createElement;
|
|
18209
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
18210
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18211
|
+
viewBox: "0 0 24 24",
|
|
18212
|
+
fill: "none",
|
|
18213
|
+
stroke: "currentColor",
|
|
18214
|
+
strokeLinecap: "round",
|
|
18215
|
+
strokeLinejoin: "round"
|
|
18216
|
+
}, /*#__PURE__*/ createElement("circle", {
|
|
18217
|
+
cx: "12",
|
|
18218
|
+
cy: "12",
|
|
18219
|
+
r: "10"
|
|
18220
|
+
}), /*#__PURE__*/ createElement("rect", {
|
|
18221
|
+
x: "9",
|
|
18222
|
+
y: "9",
|
|
18223
|
+
width: "6",
|
|
18224
|
+
height: "6",
|
|
18225
|
+
rx: "1"
|
|
18226
|
+
}));
|
|
18554
18227
|
}
|
|
18555
|
-
function
|
|
18556
|
-
var
|
|
18557
|
-
|
|
18558
|
-
|
|
18559
|
-
|
|
18560
|
-
|
|
18561
|
-
|
|
18562
|
-
|
|
18563
|
-
|
|
18564
|
-
}
|
|
18565
|
-
|
|
18566
|
-
|
|
18567
|
-
|
|
18568
|
-
|
|
18569
|
-
|
|
18570
|
-
|
|
18571
|
-
|
|
18572
|
-
|
|
18573
|
-
getItems: function getItems() {
|
|
18574
|
-
var items = window.localStorage.getItem(key);
|
|
18575
|
-
return items ? JSON.parse(items) : [];
|
|
18576
|
-
}
|
|
18577
|
-
};
|
|
18228
|
+
function ReloadIcon(param) {
|
|
18229
|
+
var createElement = param.createElement;
|
|
18230
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
18231
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18232
|
+
viewBox: "0 0 24 24",
|
|
18233
|
+
fill: "none",
|
|
18234
|
+
stroke: "currentColor",
|
|
18235
|
+
strokeLinecap: "round",
|
|
18236
|
+
strokeLinejoin: "round"
|
|
18237
|
+
}, /*#__PURE__*/ createElement("path", {
|
|
18238
|
+
d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8"
|
|
18239
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
18240
|
+
d: "M21 3v5h-5"
|
|
18241
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
18242
|
+
d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16"
|
|
18243
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
18244
|
+
d: "M3 21v-5h5"
|
|
18245
|
+
}));
|
|
18578
18246
|
}
|
|
18579
|
-
function
|
|
18580
|
-
var
|
|
18581
|
-
|
|
18582
|
-
|
|
18583
|
-
|
|
18584
|
-
|
|
18585
|
-
|
|
18586
|
-
|
|
18587
|
-
|
|
18588
|
-
|
|
18589
|
-
|
|
18590
|
-
|
|
18591
|
-
|
|
18592
|
-
|
|
18593
|
-
|
|
18594
|
-
|
|
18595
|
-
|
|
18596
|
-
|
|
18597
|
-
|
|
18598
|
-
},
|
|
18599
|
-
unregisterUpdateListener: function unregisterUpdateListener() {
|
|
18600
|
-
updateListener = null;
|
|
18601
|
-
},
|
|
18602
|
-
getSnapshot: function getSnapshot() {
|
|
18603
|
-
return {
|
|
18604
|
-
getAll: function getAll() {
|
|
18605
|
-
var query = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : '';
|
|
18606
|
-
return storage.getItems().filter(function(q) {
|
|
18607
|
-
return q.includes(query);
|
|
18608
|
-
}).slice(0, limit);
|
|
18609
|
-
}
|
|
18610
|
-
};
|
|
18611
|
-
}
|
|
18612
|
-
};
|
|
18247
|
+
function CopyIcon(param) {
|
|
18248
|
+
var createElement = param.createElement;
|
|
18249
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
18250
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18251
|
+
viewBox: "0 0 24 24",
|
|
18252
|
+
fill: "none",
|
|
18253
|
+
stroke: "currentColor",
|
|
18254
|
+
strokeLinecap: "round",
|
|
18255
|
+
strokeLinejoin: "round"
|
|
18256
|
+
}, /*#__PURE__*/ createElement("rect", {
|
|
18257
|
+
width: "14",
|
|
18258
|
+
height: "14",
|
|
18259
|
+
x: "8",
|
|
18260
|
+
y: "8",
|
|
18261
|
+
rx: "2",
|
|
18262
|
+
ry: "2"
|
|
18263
|
+
}), /*#__PURE__*/ createElement("path", {
|
|
18264
|
+
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"
|
|
18265
|
+
}));
|
|
18613
18266
|
}
|
|
18614
|
-
|
|
18615
|
-
|
|
18616
|
-
|
|
18617
|
-
|
|
18618
|
-
|
|
18619
|
-
|
|
18267
|
+
function MenuIcon(param) {
|
|
18268
|
+
var createElement = param.createElement;
|
|
18269
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
18270
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18271
|
+
viewBox: "0 0 24 24",
|
|
18272
|
+
fill: "none",
|
|
18273
|
+
stroke: "currentColor",
|
|
18274
|
+
strokeLinecap: "round",
|
|
18275
|
+
strokeLinejoin: "round"
|
|
18276
|
+
}, /*#__PURE__*/ createElement("circle", {
|
|
18277
|
+
cx: "12",
|
|
18278
|
+
cy: "12",
|
|
18279
|
+
r: "1"
|
|
18280
|
+
}), /*#__PURE__*/ createElement("circle", {
|
|
18281
|
+
cx: "12",
|
|
18282
|
+
cy: "5",
|
|
18283
|
+
r: "1"
|
|
18284
|
+
}), /*#__PURE__*/ createElement("circle", {
|
|
18285
|
+
cx: "12",
|
|
18286
|
+
cy: "19",
|
|
18287
|
+
r: "1"
|
|
18288
|
+
}));
|
|
18620
18289
|
}
|
|
18621
|
-
|
|
18622
|
-
|
|
18623
|
-
|
|
18624
|
-
|
|
18290
|
+
function LoadingSpinnerIcon(param) {
|
|
18291
|
+
var createElement = param.createElement;
|
|
18292
|
+
return /*#__PURE__*/ createElement("svg", {
|
|
18293
|
+
viewBox: "12 12 24 24",
|
|
18294
|
+
role: "status",
|
|
18295
|
+
"aria-busy": "true",
|
|
18296
|
+
"aria-live": "polite"
|
|
18297
|
+
}, /*#__PURE__*/ createElement("title", null, "Loading spinner"), /*#__PURE__*/ createElement("circle", {
|
|
18298
|
+
cx: "24",
|
|
18299
|
+
cy: "24",
|
|
18300
|
+
r: "11",
|
|
18301
|
+
fill: "none",
|
|
18302
|
+
stroke: "currentColor"
|
|
18303
|
+
}));
|
|
18625
18304
|
}
|
|
18626
|
-
function
|
|
18305
|
+
function ChevronLeftIcon(param) {
|
|
18627
18306
|
var createElement = param.createElement;
|
|
18628
18307
|
return /*#__PURE__*/ createElement("svg", {
|
|
18629
|
-
|
|
18630
|
-
|
|
18631
|
-
|
|
18632
|
-
|
|
18308
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18309
|
+
viewBox: "0 0 24 24",
|
|
18310
|
+
fill: "none",
|
|
18311
|
+
stroke: "currentColor",
|
|
18312
|
+
strokeLinecap: "round",
|
|
18313
|
+
strokeLinejoin: "round"
|
|
18633
18314
|
}, /*#__PURE__*/ createElement("path", {
|
|
18634
|
-
|
|
18635
|
-
clipRule: "evenodd",
|
|
18636
|
-
fill: "currentColor",
|
|
18637
|
-
d: "M7.13809 0.744078C7.39844 1.06951 7.39844 1.59715 7.13809 1.92259L2.27616 8L7.13809 14.0774C7.39844 14.4028 7.39844 14.9305 7.13809 15.2559C6.87774 15.5814 6.45563 15.5814 6.19528 15.2559L0.861949 8.58926C0.6016 8.26382 0.6016 7.73618 0.861949 7.41074L6.19528 0.744078C6.45563 0.418641 6.87774 0.418641 7.13809 0.744078Z"
|
|
18315
|
+
d: "m15 18-6-6 6-6"
|
|
18638
18316
|
}));
|
|
18639
18317
|
}
|
|
18640
|
-
function
|
|
18318
|
+
function ChevronRightIcon(param) {
|
|
18641
18319
|
var createElement = param.createElement;
|
|
18642
18320
|
return /*#__PURE__*/ createElement("svg", {
|
|
18643
|
-
|
|
18644
|
-
|
|
18645
|
-
|
|
18646
|
-
|
|
18321
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
18322
|
+
viewBox: "0 0 24 24",
|
|
18323
|
+
fill: "none",
|
|
18324
|
+
stroke: "currentColor",
|
|
18325
|
+
strokeLinecap: "round",
|
|
18326
|
+
strokeLinejoin: "round"
|
|
18647
18327
|
}, /*#__PURE__*/ createElement("path", {
|
|
18648
|
-
|
|
18649
|
-
clipRule: "evenodd",
|
|
18650
|
-
fill: "currentColor",
|
|
18651
|
-
d: "M0.861908 15.2559C0.601559 14.9305 0.601559 14.4028 0.861908 14.0774L5.72384 8L0.861908 1.92259C0.601559 1.59715 0.601559 1.06952 0.861908 0.744079C1.12226 0.418642 1.54437 0.418642 1.80472 0.744079L7.13805 7.41074C7.3984 7.73618 7.3984 8.26382 7.13805 8.58926L1.80472 15.2559C1.54437 15.5814 1.12226 15.5814 0.861908 15.2559Z"
|
|
18328
|
+
d: "m9 18 6-6-6-6"
|
|
18652
18329
|
}));
|
|
18653
18330
|
}
|
|
18654
|
-
|
|
18655
|
-
|
|
18656
|
-
|
|
18657
|
-
|
|
18658
|
-
|
|
18659
|
-
|
|
18660
|
-
|
|
18661
|
-
|
|
18662
|
-
|
|
18663
|
-
|
|
18664
|
-
|
|
18665
|
-
|
|
18666
|
-
|
|
18667
|
-
|
|
18668
|
-
|
|
18669
|
-
|
|
18670
|
-
|
|
18671
|
-
|
|
18672
|
-
|
|
18673
|
-
|
|
18674
|
-
|
|
18675
|
-
|
|
18676
|
-
|
|
18677
|
-
|
|
18678
|
-
|
|
18679
|
-
|
|
18680
|
-
|
|
18681
|
-
|
|
18682
|
-
|
|
18683
|
-
|
|
18684
|
-
|
|
18685
|
-
|
|
18686
|
-
|
|
18687
|
-
|
|
18688
|
-
|
|
18689
|
-
|
|
18690
|
-
|
|
18691
|
-
|
|
18692
|
-
|
|
18693
|
-
|
|
18694
|
-
|
|
18695
|
-
|
|
18696
|
-
|
|
18331
|
+
|
|
18332
|
+
function createAutocompletePromptSuggestionComponent(param) {
|
|
18333
|
+
var createElement = param.createElement;
|
|
18334
|
+
return function AutocompletePromptSuggestion(userProps) {
|
|
18335
|
+
var item = userProps.item, onSelect = userProps.onSelect, children = userProps.children, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames;
|
|
18336
|
+
var label = item.label || item.prompt;
|
|
18337
|
+
return /*#__PURE__*/ createElement("div", {
|
|
18338
|
+
onClick: onSelect,
|
|
18339
|
+
className: cx('ais-AutocompleteItemWrapper', 'ais-AutocompletePromptSuggestionWrapper', classNames.root)
|
|
18340
|
+
}, /*#__PURE__*/ createElement("div", {
|
|
18341
|
+
className: cx('ais-AutocompleteItemContent', 'ais-AutocompletePromptSuggestionItemContent', classNames.content)
|
|
18342
|
+
}, /*#__PURE__*/ createElement("div", {
|
|
18343
|
+
className: cx('ais-AutocompleteItemIcon', 'ais-AutocompletePromptSuggestionItemIcon', classNames.icon)
|
|
18344
|
+
}, /*#__PURE__*/ createElement(SparklesIcon, {
|
|
18345
|
+
createElement: createElement
|
|
18346
|
+
})), /*#__PURE__*/ createElement("div", {
|
|
18347
|
+
className: cx('ais-AutocompleteItemContentBody', 'ais-AutocompletePromptSuggestionItemContentBody', classNames.body)
|
|
18348
|
+
}, children !== null && children !== void 0 ? children : label)));
|
|
18349
|
+
};
|
|
18350
|
+
}
|
|
18351
|
+
|
|
18352
|
+
function createAutocompleteRecentSearchComponent(param) {
|
|
18353
|
+
var createElement = param.createElement;
|
|
18354
|
+
return function AutocompleteRecentSearch(userProps) {
|
|
18355
|
+
var item = userProps.item, children = userProps.children, onSelect = userProps.onSelect, onRemoveRecentSearch = userProps.onRemoveRecentSearch, onApply = userProps.onApply, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames;
|
|
18356
|
+
return /*#__PURE__*/ createElement("div", {
|
|
18357
|
+
onClick: onSelect,
|
|
18358
|
+
className: cx('ais-AutocompleteItemWrapper ais-AutocompleteRecentSearchWrapper', classNames.root)
|
|
18359
|
+
}, /*#__PURE__*/ createElement("div", {
|
|
18360
|
+
className: cx('ais-AutocompleteItemContent', 'ais-AutocompleteRecentSearchItemContent', classNames.content)
|
|
18361
|
+
}, /*#__PURE__*/ createElement("div", {
|
|
18362
|
+
className: cx('ais-AutocompleteItemIcon', 'ais-AutocompleteRecentSearchItemIcon', classNames.content)
|
|
18363
|
+
}, /*#__PURE__*/ createElement(ClockIcon, {
|
|
18364
|
+
createElement: createElement
|
|
18365
|
+
})), /*#__PURE__*/ createElement("div", {
|
|
18366
|
+
className: cx('ais-AutocompleteItemContentBody', 'ais-AutocompleteRecentSearchItemContentBody', classNames.content)
|
|
18367
|
+
}, children)), /*#__PURE__*/ createElement("div", {
|
|
18368
|
+
className: cx('ais-AutocompleteItemActions', 'ais-AutocompleteRecentSearchItemActions', classNames.actions)
|
|
18369
|
+
}, /*#__PURE__*/ createElement("button", {
|
|
18370
|
+
className: cx('ais-AutocompleteItemActionButton', 'ais-AutocompleteRecentSearchItemDeleteButton', classNames.deleteButton),
|
|
18371
|
+
title: "Remove ".concat(item.query, " from recent searches"),
|
|
18372
|
+
onClick: function onClick(evt) {
|
|
18373
|
+
evt.stopPropagation();
|
|
18374
|
+
onRemoveRecentSearch();
|
|
18697
18375
|
}
|
|
18698
|
-
}
|
|
18699
|
-
|
|
18700
|
-
|
|
18701
|
-
|
|
18376
|
+
}, /*#__PURE__*/ createElement(TrashIcon, {
|
|
18377
|
+
createElement: createElement
|
|
18378
|
+
})), /*#__PURE__*/ createElement("button", {
|
|
18379
|
+
className: cx('ais-AutocompleteItemActionButton', 'ais-AutocompleteRecentSearchItemApplyButton', classNames.applyButton),
|
|
18380
|
+
title: "Apply ".concat(item.query, " as search"),
|
|
18381
|
+
onClick: function onClick(evt) {
|
|
18382
|
+
evt.stopPropagation();
|
|
18383
|
+
onApply();
|
|
18384
|
+
}
|
|
18385
|
+
}, /*#__PURE__*/ createElement(ApplyIcon, {
|
|
18386
|
+
createElement: createElement
|
|
18387
|
+
}))));
|
|
18388
|
+
};
|
|
18389
|
+
}
|
|
18390
|
+
|
|
18391
|
+
function createAutocompleteSearchComponent(param) {
|
|
18392
|
+
var createElement = param.createElement;
|
|
18393
|
+
return function AutocompleteSearch(userProps) {
|
|
18394
|
+
var inputProps = userProps.inputProps, onClear = userProps.onClear, query = userProps.query, isSearchStalled = userProps.isSearchStalled;
|
|
18395
|
+
var inputRef = inputProps.ref;
|
|
18396
|
+
return /*#__PURE__*/ createElement("form", {
|
|
18397
|
+
className: "ais-AutocompleteForm",
|
|
18398
|
+
action: "",
|
|
18399
|
+
noValidate: true,
|
|
18400
|
+
role: "search",
|
|
18401
|
+
onSubmit: function onSubmit(e) {
|
|
18402
|
+
return e.preventDefault();
|
|
18403
|
+
},
|
|
18404
|
+
onReset: function onReset() {
|
|
18405
|
+
var _inputRef_current;
|
|
18406
|
+
return (_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
18407
|
+
}
|
|
18408
|
+
}, /*#__PURE__*/ createElement("div", {
|
|
18409
|
+
className: "ais-AutocompleteInputWrapperPrefix"
|
|
18410
|
+
}, /*#__PURE__*/ createElement("label", {
|
|
18411
|
+
className: "ais-AutocompleteLabel",
|
|
18412
|
+
"aria-label": "Submit",
|
|
18413
|
+
htmlFor: inputProps.id,
|
|
18414
|
+
id: "".concat(inputProps.id, "-label")
|
|
18415
|
+
}, /*#__PURE__*/ createElement("button", {
|
|
18416
|
+
className: "ais-AutocompleteSubmitButton",
|
|
18417
|
+
type: "submit",
|
|
18418
|
+
title: "Submit"
|
|
18419
|
+
}, /*#__PURE__*/ createElement(SubmitIcon, {
|
|
18420
|
+
createElement: createElement
|
|
18421
|
+
}))), /*#__PURE__*/ createElement("div", {
|
|
18422
|
+
className: "ais-AutocompleteLoadingIndicator",
|
|
18423
|
+
hidden: !isSearchStalled
|
|
18424
|
+
}, /*#__PURE__*/ createElement(LoadingIcon, {
|
|
18425
|
+
createElement: createElement
|
|
18426
|
+
}))), /*#__PURE__*/ createElement("div", {
|
|
18427
|
+
className: "ais-AutocompleteInputWrapper"
|
|
18428
|
+
}, /*#__PURE__*/ createElement("input", _object_spreadExports._({
|
|
18429
|
+
className: "ais-AutocompleteInput",
|
|
18430
|
+
"aria-autocomplete": "both",
|
|
18431
|
+
"aria-labelledby": "".concat(inputProps.id, "-label"),
|
|
18432
|
+
autoComplete: "off",
|
|
18433
|
+
autoCorrect: "off",
|
|
18434
|
+
autoCapitalize: "off",
|
|
18435
|
+
enterKeyHint: "search",
|
|
18436
|
+
spellCheck: "false",
|
|
18437
|
+
maxLength: 512,
|
|
18438
|
+
type: "search",
|
|
18439
|
+
value: query
|
|
18440
|
+
}, inputProps))), /*#__PURE__*/ createElement("div", {
|
|
18441
|
+
className: "ais-AutocompleteInputWrapperSuffix"
|
|
18442
|
+
}, /*#__PURE__*/ createElement("button", {
|
|
18443
|
+
className: "ais-AutocompleteClearButton",
|
|
18444
|
+
type: "reset",
|
|
18445
|
+
title: "Clear",
|
|
18446
|
+
hidden: query.length === 0 || isSearchStalled,
|
|
18447
|
+
onClick: onClear
|
|
18448
|
+
}, /*#__PURE__*/ createElement(ClearIcon, {
|
|
18449
|
+
createElement: createElement
|
|
18450
|
+
}))));
|
|
18451
|
+
};
|
|
18452
|
+
}
|
|
18453
|
+
|
|
18454
|
+
function createAutocompleteSuggestionComponent(param) {
|
|
18455
|
+
var createElement = param.createElement;
|
|
18456
|
+
return function AutocompleteSuggestion(userProps) {
|
|
18457
|
+
var item = userProps.item, children = userProps.children, onSelect = userProps.onSelect, onApply = userProps.onApply, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames;
|
|
18458
|
+
return /*#__PURE__*/ createElement("div", {
|
|
18459
|
+
onClick: onSelect,
|
|
18460
|
+
className: cx('ais-AutocompleteItemWrapper', 'ais-AutocompleteSuggestionWrapper', classNames.root)
|
|
18461
|
+
}, /*#__PURE__*/ createElement("div", {
|
|
18462
|
+
className: cx('ais-AutocompleteItemContent', 'ais-AutocompleteSuggestionItemContent', classNames.content)
|
|
18463
|
+
}, /*#__PURE__*/ createElement("div", {
|
|
18464
|
+
className: cx('ais-AutocompleteItemIcon', 'ais-AutocompleteSuggestionItemIcon', classNames.content)
|
|
18465
|
+
}, /*#__PURE__*/ createElement(SubmitIcon, {
|
|
18466
|
+
createElement: createElement
|
|
18467
|
+
})), /*#__PURE__*/ createElement("div", {
|
|
18468
|
+
className: cx('ais-AutocompleteItemContentBody', 'ais-AutocompleteSuggestionItemContentBody', classNames.content)
|
|
18469
|
+
}, children)), /*#__PURE__*/ createElement("div", {
|
|
18470
|
+
className: cx('ais-AutocompleteItemActions', 'ais-AutocompleteSuggestionItemActions', classNames.actions)
|
|
18471
|
+
}, /*#__PURE__*/ createElement("button", {
|
|
18472
|
+
className: cx('ais-AutocompleteItemActionButton', 'ais-AutocompleteSuggestionItemApplyButton', classNames.applyButton),
|
|
18473
|
+
type: "button",
|
|
18474
|
+
title: "Apply ".concat(item.query, " as search"),
|
|
18475
|
+
onClick: function onClick(evt) {
|
|
18476
|
+
evt.stopPropagation();
|
|
18477
|
+
onApply();
|
|
18702
18478
|
}
|
|
18479
|
+
}, /*#__PURE__*/ createElement(ApplyIcon, {
|
|
18480
|
+
createElement: createElement
|
|
18481
|
+
}))));
|
|
18482
|
+
};
|
|
18483
|
+
}
|
|
18484
|
+
|
|
18485
|
+
function find(array, predicate) {
|
|
18486
|
+
for(var index = 0; index < array.length; index++){
|
|
18487
|
+
var item = array[index];
|
|
18488
|
+
if (predicate(item, index, array)) {
|
|
18489
|
+
return item;
|
|
18703
18490
|
}
|
|
18704
|
-
|
|
18705
|
-
|
|
18706
|
-
|
|
18491
|
+
}
|
|
18492
|
+
return undefined;
|
|
18493
|
+
}
|
|
18494
|
+
|
|
18495
|
+
function createAutocompletePropGetters(param) {
|
|
18496
|
+
var useEffect = param.useEffect, useId = param.useId, useMemo = param.useMemo, useRef = param.useRef, useState = param.useState;
|
|
18497
|
+
return function usePropGetters(param) {
|
|
18498
|
+
var indices = param.indices, indicesConfig = param.indicesConfig, onRefine = param.onRefine, globalOnSelect = param.onSelect, onApply = param.onApply, onSubmit = param.onSubmit, placeholder = param.placeholder, _param_isDetached = param.isDetached, isDetached = _param_isDetached === void 0 ? false : _param_isDetached, _param_shouldHidePanel = param.shouldHidePanel, shouldHidePanel = _param_shouldHidePanel === void 0 ? false : _param_shouldHidePanel, _param_autoFocus = param.autoFocus, autoFocus = _param_autoFocus === void 0 ? false : _param_autoFocus;
|
|
18499
|
+
var getElementId = createGetElementId(useId());
|
|
18500
|
+
var inputRef = useRef(null);
|
|
18501
|
+
var rootRef = useRef(null);
|
|
18502
|
+
var _useState = _sliced_to_arrayExports._(useState(autoFocus), 2), isOpen = _useState[0], setIsOpen = _useState[1];
|
|
18503
|
+
var _useState1 = _sliced_to_arrayExports._(useState(undefined), 2), activeDescendant = _useState1[0], setActiveDescendant = _useState1[1];
|
|
18504
|
+
var _useMemo = useMemo(function() {
|
|
18505
|
+
return buildItems({
|
|
18506
|
+
indices: indices,
|
|
18507
|
+
indicesConfig: indicesConfig,
|
|
18508
|
+
getElementId: getElementId
|
|
18509
|
+
});
|
|
18510
|
+
}, [
|
|
18511
|
+
indices,
|
|
18512
|
+
indicesConfig,
|
|
18513
|
+
getElementId
|
|
18514
|
+
]), items = _useMemo.items, itemsIds = _useMemo.itemsIds;
|
|
18515
|
+
useEffect(function() {
|
|
18516
|
+
// In detached mode, we don't close the panel on body click
|
|
18517
|
+
// because the overlay handles closing
|
|
18518
|
+
if (isDetached) {
|
|
18519
|
+
return function() {};
|
|
18707
18520
|
}
|
|
18708
|
-
var
|
|
18709
|
-
|
|
18710
|
-
|
|
18711
|
-
|
|
18712
|
-
|
|
18713
|
-
|
|
18521
|
+
var onBodyClick = function onBodyClick(event) {
|
|
18522
|
+
var _unwrapRef;
|
|
18523
|
+
if ((_unwrapRef = unwrapRef(rootRef)) === null || _unwrapRef === void 0 ? void 0 : _unwrapRef.contains(event.target)) {
|
|
18524
|
+
return;
|
|
18525
|
+
}
|
|
18526
|
+
setIsOpen(false);
|
|
18527
|
+
};
|
|
18528
|
+
document.body.addEventListener('click', onBodyClick);
|
|
18529
|
+
return function() {
|
|
18530
|
+
document.body.removeEventListener('click', onBodyClick);
|
|
18531
|
+
};
|
|
18532
|
+
}, [
|
|
18533
|
+
rootRef,
|
|
18534
|
+
isDetached
|
|
18535
|
+
]);
|
|
18536
|
+
var getNextActiveDescendant = function getNextActiveDescendant(key) {
|
|
18537
|
+
switch(key){
|
|
18538
|
+
case 'ArrowUp':
|
|
18539
|
+
{
|
|
18540
|
+
var prevIndex = itemsIds.indexOf(activeDescendant || '') - 1;
|
|
18541
|
+
return itemsIds[prevIndex] || itemsIds[itemsIds.length - 1];
|
|
18542
|
+
}
|
|
18543
|
+
case 'ArrowDown':
|
|
18544
|
+
{
|
|
18545
|
+
var nextIndex = itemsIds.indexOf(activeDescendant || '') + 1;
|
|
18546
|
+
return itemsIds[nextIndex] || itemsIds[0];
|
|
18547
|
+
}
|
|
18548
|
+
default:
|
|
18549
|
+
return undefined;
|
|
18714
18550
|
}
|
|
18715
|
-
|
|
18716
|
-
|
|
18551
|
+
};
|
|
18552
|
+
var submit = function submit() {
|
|
18553
|
+
var override = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
18554
|
+
var _override_activeDescendant;
|
|
18555
|
+
if (isOpen) {
|
|
18556
|
+
setIsOpen(false);
|
|
18557
|
+
} else {
|
|
18558
|
+
var _inputRef_current;
|
|
18559
|
+
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.blur();
|
|
18717
18560
|
}
|
|
18718
|
-
|
|
18719
|
-
|
|
18720
|
-
|
|
18721
|
-
}
|
|
18722
|
-
return /*#__PURE__*/ createElement("div", _object_spread_propsExports._(_object_spreadExports._({}, props), {
|
|
18723
|
-
className: cx(cssClasses.root)
|
|
18724
|
-
}), HeaderComponent && /*#__PURE__*/ createElement(HeaderComponent, {
|
|
18725
|
-
canScrollLeft: canScrollLeft,
|
|
18726
|
-
canScrollRight: canScrollRight,
|
|
18727
|
-
scrollLeft: scrollLeft,
|
|
18728
|
-
scrollRight: scrollRight
|
|
18729
|
-
}), showNavigation && /*#__PURE__*/ createElement("button", {
|
|
18730
|
-
ref: previousButtonRef,
|
|
18731
|
-
title: translations.previousButtonTitle,
|
|
18732
|
-
"aria-label": translations.previousButtonLabel,
|
|
18733
|
-
hidden: true,
|
|
18734
|
-
"aria-controls": carouselIdRef.current,
|
|
18735
|
-
className: cx(cssClasses.navigation, cssClasses.navigationPrevious),
|
|
18736
|
-
onClick: function onClick(event) {
|
|
18737
|
-
event.preventDefault();
|
|
18738
|
-
scrollLeft();
|
|
18561
|
+
var actualDescendant = (_override_activeDescendant = override.activeDescendant) !== null && _override_activeDescendant !== void 0 ? _override_activeDescendant : activeDescendant;
|
|
18562
|
+
if (!actualDescendant && override.query) {
|
|
18563
|
+
onRefine(override.query);
|
|
18739
18564
|
}
|
|
18740
|
-
|
|
18741
|
-
|
|
18742
|
-
|
|
18743
|
-
|
|
18744
|
-
|
|
18745
|
-
|
|
18746
|
-
|
|
18747
|
-
|
|
18748
|
-
|
|
18749
|
-
|
|
18750
|
-
|
|
18751
|
-
|
|
18752
|
-
|
|
18753
|
-
event.preventDefault();
|
|
18754
|
-
scrollLeft();
|
|
18755
|
-
} else if (event.key === 'ArrowRight') {
|
|
18756
|
-
event.preventDefault();
|
|
18757
|
-
scrollRight();
|
|
18758
|
-
}
|
|
18565
|
+
if (actualDescendant && items.has(actualDescendant)) {
|
|
18566
|
+
var _ref;
|
|
18567
|
+
var _items_get = items.get(actualDescendant), item = _items_get.item, _items_get_config = _items_get.config, indexOnSelect = _items_get_config.onSelect, getQuery = _items_get_config.getQuery, getURL = _items_get_config.getURL;
|
|
18568
|
+
var actualOnSelect = indexOnSelect !== null && indexOnSelect !== void 0 ? indexOnSelect : globalOnSelect;
|
|
18569
|
+
actualOnSelect({
|
|
18570
|
+
item: item,
|
|
18571
|
+
query: (_ref = getQuery === null || getQuery === void 0 ? void 0 : getQuery(item)) !== null && _ref !== void 0 ? _ref : '',
|
|
18572
|
+
url: getURL === null || getURL === void 0 ? void 0 : getURL(item),
|
|
18573
|
+
setQuery: function setQuery(query) {
|
|
18574
|
+
return onRefine(query);
|
|
18575
|
+
}
|
|
18576
|
+
});
|
|
18577
|
+
setActiveDescendant(undefined);
|
|
18759
18578
|
}
|
|
18760
|
-
|
|
18761
|
-
|
|
18762
|
-
|
|
18763
|
-
|
|
18764
|
-
|
|
18765
|
-
|
|
18766
|
-
|
|
18767
|
-
|
|
18768
|
-
|
|
18769
|
-
|
|
18770
|
-
|
|
18771
|
-
|
|
18772
|
-
|
|
18773
|
-
|
|
18774
|
-
|
|
18775
|
-
|
|
18776
|
-
|
|
18777
|
-
|
|
18778
|
-
|
|
18779
|
-
|
|
18780
|
-
|
|
18781
|
-
|
|
18782
|
-
|
|
18783
|
-
|
|
18784
|
-
|
|
18579
|
+
onSubmit === null || onSubmit === void 0 ? void 0 : onSubmit();
|
|
18580
|
+
};
|
|
18581
|
+
return {
|
|
18582
|
+
getInputProps: function getInputProps() {
|
|
18583
|
+
return {
|
|
18584
|
+
id: getElementId('input'),
|
|
18585
|
+
ref: inputRef,
|
|
18586
|
+
role: 'combobox',
|
|
18587
|
+
autoFocus: autoFocus,
|
|
18588
|
+
'aria-autocomplete': 'list',
|
|
18589
|
+
'aria-expanded': isOpen,
|
|
18590
|
+
'aria-haspopup': 'grid',
|
|
18591
|
+
'aria-controls': getElementId('panel'),
|
|
18592
|
+
'aria-activedescendant': activeDescendant,
|
|
18593
|
+
placeholder: placeholder,
|
|
18594
|
+
onFocus: function onFocus() {
|
|
18595
|
+
return setIsOpen(true);
|
|
18596
|
+
},
|
|
18597
|
+
onKeyDown: function onKeyDown(event) {
|
|
18598
|
+
switch(event.key){
|
|
18599
|
+
case 'Escape':
|
|
18600
|
+
{
|
|
18601
|
+
if (isOpen) {
|
|
18602
|
+
setIsOpen(false);
|
|
18603
|
+
event.preventDefault();
|
|
18604
|
+
} else {
|
|
18605
|
+
setActiveDescendant(undefined);
|
|
18606
|
+
}
|
|
18607
|
+
break;
|
|
18608
|
+
}
|
|
18609
|
+
case 'ArrowUp':
|
|
18610
|
+
case 'ArrowDown':
|
|
18611
|
+
{
|
|
18612
|
+
var _document_getElementById;
|
|
18613
|
+
setIsOpen(true);
|
|
18614
|
+
var nextActiveDescendant = getNextActiveDescendant(event.key);
|
|
18615
|
+
setActiveDescendant(nextActiveDescendant);
|
|
18616
|
+
(_document_getElementById = document.getElementById(nextActiveDescendant)) === null || _document_getElementById === void 0 ? void 0 : _document_getElementById.scrollIntoView(false);
|
|
18617
|
+
event.preventDefault();
|
|
18618
|
+
break;
|
|
18619
|
+
}
|
|
18620
|
+
case 'Enter':
|
|
18621
|
+
{
|
|
18622
|
+
submit({
|
|
18623
|
+
query: event.target.value
|
|
18624
|
+
});
|
|
18625
|
+
break;
|
|
18626
|
+
}
|
|
18627
|
+
case 'Tab':
|
|
18628
|
+
// In detached mode, Tab doesn't close the panel
|
|
18629
|
+
if (!isDetached) {
|
|
18630
|
+
setIsOpen(false);
|
|
18631
|
+
}
|
|
18632
|
+
break;
|
|
18633
|
+
default:
|
|
18634
|
+
setIsOpen(true);
|
|
18635
|
+
return;
|
|
18636
|
+
}
|
|
18637
|
+
},
|
|
18638
|
+
onKeyUp: function onKeyUp(event) {
|
|
18639
|
+
switch(event.key){
|
|
18640
|
+
case 'ArrowLeft':
|
|
18641
|
+
case 'ArrowUp':
|
|
18642
|
+
case 'ArrowRight':
|
|
18643
|
+
case 'ArrowDown':
|
|
18644
|
+
case 'Escape':
|
|
18645
|
+
case 'Return':
|
|
18646
|
+
event.preventDefault();
|
|
18647
|
+
return;
|
|
18648
|
+
default:
|
|
18649
|
+
setActiveDescendant(undefined);
|
|
18650
|
+
break;
|
|
18651
|
+
}
|
|
18652
|
+
}
|
|
18653
|
+
};
|
|
18654
|
+
},
|
|
18655
|
+
getItemProps: function getItemProps(item, index) {
|
|
18656
|
+
var id = getElementId('item', item.__indexName, index);
|
|
18657
|
+
return {
|
|
18658
|
+
id: id,
|
|
18659
|
+
role: 'row',
|
|
18660
|
+
'aria-selected': id === activeDescendant,
|
|
18661
|
+
onSelect: function onSelect() {
|
|
18662
|
+
return submit({
|
|
18663
|
+
activeDescendant: id
|
|
18664
|
+
});
|
|
18665
|
+
},
|
|
18666
|
+
onApply: function onApply1() {
|
|
18667
|
+
var _ref;
|
|
18668
|
+
var _items_get = items.get(id), currentItem = _items_get.item, getQuery = _items_get.config.getQuery;
|
|
18669
|
+
onApply((_ref = getQuery === null || getQuery === void 0 ? void 0 : getQuery(currentItem)) !== null && _ref !== void 0 ? _ref : '');
|
|
18670
|
+
}
|
|
18671
|
+
};
|
|
18672
|
+
},
|
|
18673
|
+
getPanelProps: function getPanelProps() {
|
|
18674
|
+
return {
|
|
18675
|
+
hidden: !isOpen || shouldHidePanel,
|
|
18676
|
+
id: getElementId('panel'),
|
|
18677
|
+
role: 'grid',
|
|
18678
|
+
'aria-labelledby': getElementId('input')
|
|
18679
|
+
};
|
|
18680
|
+
},
|
|
18681
|
+
getRootProps: function getRootProps() {
|
|
18682
|
+
return {
|
|
18683
|
+
ref: rootRef
|
|
18684
|
+
};
|
|
18685
|
+
},
|
|
18686
|
+
isOpen: isOpen,
|
|
18687
|
+
setIsOpen: setIsOpen,
|
|
18688
|
+
focusInput: function focusInput() {
|
|
18689
|
+
var _inputRef_current;
|
|
18690
|
+
(_inputRef_current = inputRef.current) === null || _inputRef_current === void 0 ? void 0 : _inputRef_current.focus();
|
|
18785
18691
|
}
|
|
18786
|
-
}
|
|
18787
|
-
createElement: createElement
|
|
18788
|
-
})));
|
|
18692
|
+
};
|
|
18789
18693
|
};
|
|
18790
18694
|
}
|
|
18791
|
-
|
|
18792
|
-
|
|
18793
|
-
|
|
18794
|
-
|
|
18795
|
-
|
|
18796
|
-
|
|
18797
|
-
|
|
18798
|
-
|
|
18799
|
-
|
|
18800
|
-
|
|
18801
|
-
|
|
18802
|
-
|
|
18803
|
-
|
|
18804
|
-
|
|
18805
|
-
|
|
18806
|
-
|
|
18807
|
-
|
|
18808
|
-
|
|
18809
|
-
|
|
18810
|
-
|
|
18811
|
-
|
|
18812
|
-
|
|
18813
|
-
|
|
18814
|
-
|
|
18815
|
-
fill: "none",
|
|
18816
|
-
stroke: "currentColor",
|
|
18817
|
-
strokeLinecap: "round",
|
|
18818
|
-
strokeLinejoin: "round"
|
|
18819
|
-
}, /*#__PURE__*/ createElement("path", {
|
|
18820
|
-
d: "m5 12 7-7 7 7"
|
|
18821
|
-
}), /*#__PURE__*/ createElement("path", {
|
|
18822
|
-
d: "M12 19V5"
|
|
18823
|
-
}));
|
|
18824
|
-
}
|
|
18825
|
-
function ArrowRightIcon(param) {
|
|
18826
|
-
var createElement = param.createElement;
|
|
18827
|
-
return /*#__PURE__*/ createElement("svg", {
|
|
18828
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
18829
|
-
viewBox: "0 0 24 24",
|
|
18830
|
-
fill: "none",
|
|
18831
|
-
stroke: "currentColor",
|
|
18832
|
-
strokeLinecap: "round",
|
|
18833
|
-
strokeLinejoin: "round"
|
|
18834
|
-
}, /*#__PURE__*/ createElement("path", {
|
|
18835
|
-
d: "M5 12h14"
|
|
18836
|
-
}), /*#__PURE__*/ createElement("path", {
|
|
18837
|
-
d: "m12 5 7 7-7 7"
|
|
18838
|
-
}));
|
|
18839
|
-
}
|
|
18840
|
-
function ChevronUpIcon(param) {
|
|
18841
|
-
var createElement = param.createElement;
|
|
18842
|
-
return /*#__PURE__*/ createElement("svg", {
|
|
18843
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
18844
|
-
viewBox: "0 0 24 24",
|
|
18845
|
-
fill: "none",
|
|
18846
|
-
stroke: "currentColor",
|
|
18847
|
-
strokeLinecap: "round",
|
|
18848
|
-
strokeLinejoin: "round"
|
|
18849
|
-
}, /*#__PURE__*/ createElement("path", {
|
|
18850
|
-
d: "m18 15-6-6-6 6"
|
|
18851
|
-
}));
|
|
18852
|
-
}
|
|
18853
|
-
function ChevronDownIcon(param) {
|
|
18854
|
-
var createElement = param.createElement;
|
|
18855
|
-
return /*#__PURE__*/ createElement("svg", {
|
|
18856
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
18857
|
-
viewBox: "0 0 24 24",
|
|
18858
|
-
fill: "none",
|
|
18859
|
-
stroke: "currentColor",
|
|
18860
|
-
strokeLinecap: "round",
|
|
18861
|
-
strokeLinejoin: "round"
|
|
18862
|
-
}, /*#__PURE__*/ createElement("path", {
|
|
18863
|
-
d: "m6 9 6 6 6-6"
|
|
18864
|
-
}));
|
|
18695
|
+
function buildItems(param) {
|
|
18696
|
+
var _loop = function _loop(i) {
|
|
18697
|
+
var _indices_i;
|
|
18698
|
+
var currentIndexConfig = find(indicesConfig, function(config) {
|
|
18699
|
+
return config.indexName === indices[i].indexName;
|
|
18700
|
+
});
|
|
18701
|
+
var hits = ((_indices_i = indices[i]) === null || _indices_i === void 0 ? void 0 : _indices_i.hits) || [];
|
|
18702
|
+
for(var position = 0; position < hits.length; position++){
|
|
18703
|
+
var itemId = getElementId('item', (currentIndexConfig === null || currentIndexConfig === void 0 ? void 0 : currentIndexConfig.indexName) || indices[i].indexName, position);
|
|
18704
|
+
items.set(itemId, {
|
|
18705
|
+
item: hits[position],
|
|
18706
|
+
config: currentIndexConfig
|
|
18707
|
+
});
|
|
18708
|
+
itemsIds.push(itemId);
|
|
18709
|
+
}
|
|
18710
|
+
};
|
|
18711
|
+
var indices = param.indices, indicesConfig = param.indicesConfig, getElementId = param.getElementId;
|
|
18712
|
+
var itemsIds = [];
|
|
18713
|
+
var items = new Map();
|
|
18714
|
+
for(var i = 0; i < indices.length; i++)_loop(i);
|
|
18715
|
+
return {
|
|
18716
|
+
items: items,
|
|
18717
|
+
itemsIds: itemsIds
|
|
18718
|
+
};
|
|
18865
18719
|
}
|
|
18866
|
-
function
|
|
18867
|
-
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
|
|
18871
|
-
|
|
18872
|
-
|
|
18873
|
-
|
|
18874
|
-
strokeLinejoin: "round"
|
|
18875
|
-
}, /*#__PURE__*/ createElement("path", {
|
|
18876
|
-
d: "M18 6 6 18"
|
|
18877
|
-
}), /*#__PURE__*/ createElement("path", {
|
|
18878
|
-
d: "m6 6 12 12"
|
|
18879
|
-
}));
|
|
18720
|
+
function createGetElementId(autocompleteId) {
|
|
18721
|
+
return function getElementId() {
|
|
18722
|
+
for(var _len = arguments.length, suffixes = new Array(_len), _key = 0; _key < _len; _key++){
|
|
18723
|
+
suffixes[_key] = arguments[_key];
|
|
18724
|
+
}
|
|
18725
|
+
var prefix = 'autocomplete';
|
|
18726
|
+
return "".concat(prefix).concat(autocompleteId).concat(suffixes.join(':'));
|
|
18727
|
+
};
|
|
18880
18728
|
}
|
|
18881
|
-
|
|
18882
|
-
|
|
18883
|
-
|
|
18884
|
-
|
|
18885
|
-
|
|
18886
|
-
fill: "none",
|
|
18887
|
-
stroke: "currentColor",
|
|
18888
|
-
strokeLinecap: "round",
|
|
18889
|
-
strokeLinejoin: "round"
|
|
18890
|
-
}, /*#__PURE__*/ createElement("path", {
|
|
18891
|
-
d: "M15 3h6v6"
|
|
18892
|
-
}), /*#__PURE__*/ createElement("path", {
|
|
18893
|
-
d: "m21 3-7 7"
|
|
18894
|
-
}), /*#__PURE__*/ createElement("path", {
|
|
18895
|
-
d: "m3 21 7-7"
|
|
18896
|
-
}), /*#__PURE__*/ createElement("path", {
|
|
18897
|
-
d: "M9 21H3v-6"
|
|
18898
|
-
}));
|
|
18729
|
+
/**
|
|
18730
|
+
* Returns the framework-agnostic value of a ref.
|
|
18731
|
+
*/ function unwrapRef(ref) {
|
|
18732
|
+
return ref.current && _type_ofExports._(ref.current) === 'object' && 'base' in ref.current ? ref.current.base // Preact
|
|
18733
|
+
: ref.current; // React
|
|
18899
18734
|
}
|
|
18900
|
-
|
|
18901
|
-
|
|
18902
|
-
|
|
18903
|
-
|
|
18904
|
-
|
|
18905
|
-
|
|
18906
|
-
|
|
18907
|
-
|
|
18908
|
-
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
18735
|
+
|
|
18736
|
+
function createAutocompleteStorage(param) {
|
|
18737
|
+
var useEffect = param.useEffect, useMemo = param.useMemo, useState = param.useState;
|
|
18738
|
+
return function useStorage(param) {
|
|
18739
|
+
var showRecent = param.showRecent, query = param.query, indices = param.indices, indicesConfig = param.indicesConfig, suggestionsIndexName = param.suggestionsIndexName;
|
|
18740
|
+
var storageKey = showRecent && (typeof showRecent === "undefined" ? "undefined" : _type_ofExports._(showRecent)) === 'object' ? showRecent.storageKey : undefined;
|
|
18741
|
+
var storage = useMemo(function() {
|
|
18742
|
+
return createStorage({
|
|
18743
|
+
limit: 5,
|
|
18744
|
+
storageKey: storageKey
|
|
18745
|
+
});
|
|
18746
|
+
}, [
|
|
18747
|
+
storageKey
|
|
18748
|
+
]);
|
|
18749
|
+
var _useState = _sliced_to_arrayExports._(useState(storage.getSnapshot()), 2), snapshot = _useState[0], setSnapshot = _useState[1];
|
|
18750
|
+
useEffect(function() {
|
|
18751
|
+
storage.registerUpdateListener(function() {
|
|
18752
|
+
setSnapshot(storage.getSnapshot());
|
|
18753
|
+
});
|
|
18754
|
+
return function() {
|
|
18755
|
+
storage.unregisterUpdateListener();
|
|
18756
|
+
};
|
|
18757
|
+
}, [
|
|
18758
|
+
storage
|
|
18759
|
+
]);
|
|
18760
|
+
if (!showRecent) {
|
|
18761
|
+
return {
|
|
18762
|
+
storage: {
|
|
18763
|
+
onAdd: function onAdd() {},
|
|
18764
|
+
onRemove: function onRemove() {}
|
|
18765
|
+
},
|
|
18766
|
+
storageHits: [],
|
|
18767
|
+
indicesForPropGetters: indices,
|
|
18768
|
+
indicesConfigForPropGetters: indicesConfig
|
|
18769
|
+
};
|
|
18770
|
+
}
|
|
18771
|
+
var storageHits = snapshot.getAll(query).map(function(value) {
|
|
18772
|
+
return {
|
|
18773
|
+
objectID: value,
|
|
18774
|
+
query: value,
|
|
18775
|
+
__indexName: 'recent-searches',
|
|
18776
|
+
_highlightResult: getHighlightedAttribute({
|
|
18777
|
+
item: {
|
|
18778
|
+
query: value
|
|
18779
|
+
},
|
|
18780
|
+
query: query || ''
|
|
18781
|
+
})
|
|
18782
|
+
};
|
|
18783
|
+
});
|
|
18784
|
+
var indicesForPropGetters = _to_consumable_arrayExports._(indices.map(function(index) {
|
|
18785
|
+
return index.indexName === suggestionsIndexName ? _object_spread_propsExports._(_object_spreadExports._({}, index), {
|
|
18786
|
+
hits: index.hits.filter(function(hit) {
|
|
18787
|
+
return !find(storageHits, function(storageHit) {
|
|
18788
|
+
return storageHit.query === hit.query;
|
|
18789
|
+
});
|
|
18790
|
+
})
|
|
18791
|
+
}) : index;
|
|
18792
|
+
}));
|
|
18793
|
+
var indicesConfigForPropGetters = _to_consumable_arrayExports._(indicesConfig);
|
|
18794
|
+
indicesForPropGetters.unshift({
|
|
18795
|
+
indexName: 'recent-searches',
|
|
18796
|
+
indexId: 'recent-searches',
|
|
18797
|
+
hits: storageHits
|
|
18798
|
+
});
|
|
18799
|
+
indicesConfigForPropGetters.unshift({
|
|
18800
|
+
indexName: 'recent-searches',
|
|
18801
|
+
// @ts-expect-error - we know it has query as it's generated from storageHits
|
|
18802
|
+
getQuery: function getQuery(item) {
|
|
18803
|
+
return item.query;
|
|
18804
|
+
}
|
|
18805
|
+
});
|
|
18806
|
+
return {
|
|
18807
|
+
storage: storage,
|
|
18808
|
+
storageHits: storageHits,
|
|
18809
|
+
indicesForPropGetters: indicesForPropGetters,
|
|
18810
|
+
indicesConfigForPropGetters: indicesConfigForPropGetters
|
|
18811
|
+
};
|
|
18812
|
+
};
|
|
18918
18813
|
}
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
18925
|
-
|
|
18926
|
-
|
|
18927
|
-
|
|
18928
|
-
}
|
|
18929
|
-
cx: "12",
|
|
18930
|
-
cy: "12",
|
|
18931
|
-
r: "10"
|
|
18932
|
-
}), /*#__PURE__*/ createElement("rect", {
|
|
18933
|
-
x: "9",
|
|
18934
|
-
y: "9",
|
|
18935
|
-
width: "6",
|
|
18936
|
-
height: "6",
|
|
18937
|
-
rx: "1"
|
|
18938
|
-
}));
|
|
18814
|
+
var LOCAL_STORAGE_KEY_TEST = 'test-localstorage-support';
|
|
18815
|
+
var LOCAL_STORAGE_KEY = 'autocomplete-recent-searches';
|
|
18816
|
+
function isLocalStorageSupported() {
|
|
18817
|
+
try {
|
|
18818
|
+
localStorage.setItem(LOCAL_STORAGE_KEY_TEST, '');
|
|
18819
|
+
localStorage.removeItem(LOCAL_STORAGE_KEY_TEST);
|
|
18820
|
+
return true;
|
|
18821
|
+
} catch (error) {
|
|
18822
|
+
return false;
|
|
18823
|
+
}
|
|
18939
18824
|
}
|
|
18940
|
-
function
|
|
18941
|
-
var
|
|
18942
|
-
|
|
18943
|
-
|
|
18944
|
-
|
|
18945
|
-
|
|
18946
|
-
|
|
18947
|
-
|
|
18948
|
-
|
|
18949
|
-
|
|
18950
|
-
|
|
18951
|
-
|
|
18952
|
-
|
|
18953
|
-
|
|
18954
|
-
|
|
18955
|
-
}
|
|
18956
|
-
d: "M3 21v-5h5"
|
|
18957
|
-
}));
|
|
18825
|
+
function getHighlightedAttribute(param) {
|
|
18826
|
+
var item = param.item, query = param.query;
|
|
18827
|
+
if (!query.trim().length) {
|
|
18828
|
+
return {
|
|
18829
|
+
query: {
|
|
18830
|
+
matchLevel: 'none'
|
|
18831
|
+
}
|
|
18832
|
+
};
|
|
18833
|
+
}
|
|
18834
|
+
return {
|
|
18835
|
+
query: {
|
|
18836
|
+
value: item.query.replace(new RegExp(query.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'gi'), function(match) {
|
|
18837
|
+
return "<mark>".concat(match, "</mark>");
|
|
18838
|
+
})
|
|
18839
|
+
}
|
|
18840
|
+
};
|
|
18958
18841
|
}
|
|
18959
|
-
function
|
|
18960
|
-
var
|
|
18961
|
-
|
|
18962
|
-
|
|
18963
|
-
|
|
18964
|
-
|
|
18965
|
-
|
|
18966
|
-
|
|
18967
|
-
|
|
18968
|
-
}
|
|
18969
|
-
|
|
18970
|
-
|
|
18971
|
-
|
|
18972
|
-
|
|
18973
|
-
|
|
18974
|
-
|
|
18975
|
-
|
|
18976
|
-
|
|
18977
|
-
|
|
18842
|
+
function getLocalStorage() {
|
|
18843
|
+
var key = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : LOCAL_STORAGE_KEY;
|
|
18844
|
+
if (!isLocalStorageSupported()) {
|
|
18845
|
+
return {
|
|
18846
|
+
setItems: function setItems() {},
|
|
18847
|
+
getItems: function getItems() {
|
|
18848
|
+
return [];
|
|
18849
|
+
}
|
|
18850
|
+
};
|
|
18851
|
+
}
|
|
18852
|
+
return {
|
|
18853
|
+
setItems: function setItems(items) {
|
|
18854
|
+
try {
|
|
18855
|
+
window.localStorage.setItem(key, JSON.stringify(items));
|
|
18856
|
+
} catch (unused) {
|
|
18857
|
+
// do nothing, this likely means the storage is full
|
|
18858
|
+
}
|
|
18859
|
+
},
|
|
18860
|
+
getItems: function getItems() {
|
|
18861
|
+
var items = window.localStorage.getItem(key);
|
|
18862
|
+
return items ? JSON.parse(items) : [];
|
|
18863
|
+
}
|
|
18864
|
+
};
|
|
18978
18865
|
}
|
|
18979
|
-
function
|
|
18980
|
-
var
|
|
18981
|
-
|
|
18982
|
-
|
|
18983
|
-
|
|
18984
|
-
|
|
18985
|
-
|
|
18986
|
-
|
|
18987
|
-
|
|
18988
|
-
|
|
18989
|
-
|
|
18990
|
-
|
|
18991
|
-
|
|
18992
|
-
|
|
18993
|
-
|
|
18994
|
-
|
|
18995
|
-
|
|
18996
|
-
|
|
18997
|
-
|
|
18998
|
-
|
|
18999
|
-
|
|
19000
|
-
|
|
18866
|
+
function createStorage(param) {
|
|
18867
|
+
var _param_limit = param.limit, limit = _param_limit === void 0 ? 5 : _param_limit, storageKey = param.storageKey;
|
|
18868
|
+
var storage = getLocalStorage(storageKey);
|
|
18869
|
+
var updateListener = null;
|
|
18870
|
+
return {
|
|
18871
|
+
onAdd: function onAdd(query) {
|
|
18872
|
+
this.onRemove(query);
|
|
18873
|
+
storage.setItems([
|
|
18874
|
+
query
|
|
18875
|
+
].concat(_to_consumable_arrayExports._(storage.getItems())));
|
|
18876
|
+
},
|
|
18877
|
+
onRemove: function onRemove(query) {
|
|
18878
|
+
storage.setItems(storage.getItems().filter(function(q) {
|
|
18879
|
+
return q !== query;
|
|
18880
|
+
}));
|
|
18881
|
+
updateListener === null || updateListener === void 0 ? void 0 : updateListener();
|
|
18882
|
+
},
|
|
18883
|
+
registerUpdateListener: function registerUpdateListener(callback) {
|
|
18884
|
+
updateListener = callback;
|
|
18885
|
+
},
|
|
18886
|
+
unregisterUpdateListener: function unregisterUpdateListener() {
|
|
18887
|
+
updateListener = null;
|
|
18888
|
+
},
|
|
18889
|
+
getSnapshot: function getSnapshot() {
|
|
18890
|
+
return {
|
|
18891
|
+
getAll: function getAll() {
|
|
18892
|
+
var query = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : '';
|
|
18893
|
+
return storage.getItems().filter(function(q) {
|
|
18894
|
+
return q.includes(query);
|
|
18895
|
+
}).slice(0, limit);
|
|
18896
|
+
}
|
|
18897
|
+
};
|
|
18898
|
+
}
|
|
18899
|
+
};
|
|
19001
18900
|
}
|
|
19002
|
-
|
|
19003
|
-
|
|
19004
|
-
|
|
19005
|
-
|
|
19006
|
-
|
|
19007
|
-
|
|
19008
|
-
"aria-live": "polite"
|
|
19009
|
-
}, /*#__PURE__*/ createElement("title", null, "Loading spinner"), /*#__PURE__*/ createElement("circle", {
|
|
19010
|
-
cx: "24",
|
|
19011
|
-
cy: "24",
|
|
19012
|
-
r: "11",
|
|
19013
|
-
fill: "none",
|
|
19014
|
-
stroke: "currentColor"
|
|
19015
|
-
}));
|
|
18901
|
+
|
|
18902
|
+
function createDefaultItemComponent(param) {
|
|
18903
|
+
var createElement = param.createElement, Fragment = param.Fragment;
|
|
18904
|
+
return function DefaultItem(userProps) {
|
|
18905
|
+
return /*#__PURE__*/ createElement(Fragment, null, JSON.stringify(userProps.item, null, 2));
|
|
18906
|
+
};
|
|
19016
18907
|
}
|
|
19017
|
-
|
|
18908
|
+
|
|
18909
|
+
var lastCarouselId = 0;
|
|
18910
|
+
function generateCarouselId() {
|
|
18911
|
+
return "ais-Carousel-".concat(lastCarouselId++);
|
|
18912
|
+
}
|
|
18913
|
+
function PreviousIconDefaultComponent(param) {
|
|
19018
18914
|
var createElement = param.createElement;
|
|
19019
18915
|
return /*#__PURE__*/ createElement("svg", {
|
|
19020
|
-
|
|
19021
|
-
|
|
19022
|
-
|
|
19023
|
-
|
|
19024
|
-
strokeLinecap: "round",
|
|
19025
|
-
strokeLinejoin: "round"
|
|
18916
|
+
width: "8",
|
|
18917
|
+
height: "16",
|
|
18918
|
+
viewBox: "0 0 8 16",
|
|
18919
|
+
fill: "none"
|
|
19026
18920
|
}, /*#__PURE__*/ createElement("path", {
|
|
19027
|
-
|
|
18921
|
+
fillRule: "evenodd",
|
|
18922
|
+
clipRule: "evenodd",
|
|
18923
|
+
fill: "currentColor",
|
|
18924
|
+
d: "M7.13809 0.744078C7.39844 1.06951 7.39844 1.59715 7.13809 1.92259L2.27616 8L7.13809 14.0774C7.39844 14.4028 7.39844 14.9305 7.13809 15.2559C6.87774 15.5814 6.45563 15.5814 6.19528 15.2559L0.861949 8.58926C0.6016 8.26382 0.6016 7.73618 0.861949 7.41074L6.19528 0.744078C6.45563 0.418641 6.87774 0.418641 7.13809 0.744078Z"
|
|
19028
18925
|
}));
|
|
19029
18926
|
}
|
|
19030
|
-
function
|
|
18927
|
+
function NextIconDefaultComponent(param) {
|
|
19031
18928
|
var createElement = param.createElement;
|
|
19032
18929
|
return /*#__PURE__*/ createElement("svg", {
|
|
19033
|
-
|
|
19034
|
-
|
|
19035
|
-
|
|
19036
|
-
|
|
19037
|
-
strokeLinecap: "round",
|
|
19038
|
-
strokeLinejoin: "round"
|
|
18930
|
+
width: "8",
|
|
18931
|
+
height: "16",
|
|
18932
|
+
viewBox: "0 0 8 16",
|
|
18933
|
+
fill: "none"
|
|
19039
18934
|
}, /*#__PURE__*/ createElement("path", {
|
|
19040
|
-
|
|
18935
|
+
fillRule: "evenodd",
|
|
18936
|
+
clipRule: "evenodd",
|
|
18937
|
+
fill: "currentColor",
|
|
18938
|
+
d: "M0.861908 15.2559C0.601559 14.9305 0.601559 14.4028 0.861908 14.0774L5.72384 8L0.861908 1.92259C0.601559 1.59715 0.601559 1.06952 0.861908 0.744079C1.12226 0.418642 1.54437 0.418642 1.80472 0.744079L7.13805 7.41074C7.3984 7.73618 7.3984 8.26382 7.13805 8.58926L1.80472 15.2559C1.54437 15.5814 1.12226 15.5814 0.861908 15.2559Z"
|
|
19041
18939
|
}));
|
|
19042
18940
|
}
|
|
18941
|
+
function createCarouselComponent(param) {
|
|
18942
|
+
var createElement = param.createElement, Fragment = param.Fragment;
|
|
18943
|
+
return function Carousel(userProps) {
|
|
18944
|
+
var listRef = userProps.listRef, nextButtonRef = userProps.nextButtonRef, previousButtonRef = userProps.previousButtonRef, carouselIdRef = userProps.carouselIdRef, canScrollLeft = userProps.canScrollLeft, canScrollRight = userProps.canScrollRight, setCanScrollLeft = userProps.setCanScrollLeft, setCanScrollRight = userProps.setCanScrollRight, _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames, tmp = userProps.itemComponent, ItemComponent = tmp === void 0 ? createDefaultItemComponent({
|
|
18945
|
+
createElement: createElement,
|
|
18946
|
+
Fragment: Fragment
|
|
18947
|
+
}) : tmp, tmp1 = userProps.previousIconComponent, PreviousIcon = tmp1 === void 0 ? PreviousIconDefaultComponent : tmp1, tmp2 = userProps.nextIconComponent, NextIcon = tmp2 === void 0 ? NextIconDefaultComponent : tmp2, HeaderComponent = userProps.headerComponent, _userProps_showNavigation = userProps.showNavigation, showNavigation = _userProps_showNavigation === void 0 ? true : _userProps_showNavigation, items = userProps.items, userTranslations = userProps.translations, sendEvent = userProps.sendEvent, props = _object_without_propertiesExports._(userProps, [
|
|
18948
|
+
"listRef",
|
|
18949
|
+
"nextButtonRef",
|
|
18950
|
+
"previousButtonRef",
|
|
18951
|
+
"carouselIdRef",
|
|
18952
|
+
"canScrollLeft",
|
|
18953
|
+
"canScrollRight",
|
|
18954
|
+
"setCanScrollLeft",
|
|
18955
|
+
"setCanScrollRight",
|
|
18956
|
+
"classNames",
|
|
18957
|
+
"itemComponent",
|
|
18958
|
+
"previousIconComponent",
|
|
18959
|
+
"nextIconComponent",
|
|
18960
|
+
"headerComponent",
|
|
18961
|
+
"showNavigation",
|
|
18962
|
+
"items",
|
|
18963
|
+
"translations",
|
|
18964
|
+
"sendEvent"
|
|
18965
|
+
]);
|
|
18966
|
+
var translations = _object_spreadExports._({
|
|
18967
|
+
listLabel: 'Items',
|
|
18968
|
+
nextButtonLabel: 'Next',
|
|
18969
|
+
nextButtonTitle: 'Next',
|
|
18970
|
+
previousButtonLabel: 'Previous',
|
|
18971
|
+
previousButtonTitle: 'Previous'
|
|
18972
|
+
}, userTranslations);
|
|
18973
|
+
var cssClasses = {
|
|
18974
|
+
root: cx('ais-Carousel', classNames.root),
|
|
18975
|
+
list: cx('ais-Carousel-list', classNames.list),
|
|
18976
|
+
item: cx('ais-Carousel-item', classNames.item),
|
|
18977
|
+
navigation: cx('ais-Carousel-navigation', classNames.navigation),
|
|
18978
|
+
navigationNext: cx('ais-Carousel-navigation--next', classNames.navigationNext),
|
|
18979
|
+
navigationPrevious: cx('ais-Carousel-navigation--previous', classNames.navigationPrevious)
|
|
18980
|
+
};
|
|
18981
|
+
function scrollLeft() {
|
|
18982
|
+
if (listRef.current) {
|
|
18983
|
+
listRef.current.scrollLeft -= listRef.current.offsetWidth * 0.75;
|
|
18984
|
+
}
|
|
18985
|
+
}
|
|
18986
|
+
function scrollRight() {
|
|
18987
|
+
if (listRef.current) {
|
|
18988
|
+
listRef.current.scrollLeft += listRef.current.offsetWidth * 0.75;
|
|
18989
|
+
}
|
|
18990
|
+
}
|
|
18991
|
+
function updateNavigationButtonsProps() {
|
|
18992
|
+
if (!listRef.current) {
|
|
18993
|
+
return;
|
|
18994
|
+
}
|
|
18995
|
+
var isLeftHidden = listRef.current.scrollLeft <= 0;
|
|
18996
|
+
var isRightHidden = listRef.current.scrollLeft + listRef.current.clientWidth >= listRef.current.scrollWidth;
|
|
18997
|
+
setCanScrollLeft(!isLeftHidden);
|
|
18998
|
+
setCanScrollRight(!isRightHidden);
|
|
18999
|
+
if (previousButtonRef.current) {
|
|
19000
|
+
previousButtonRef.current.hidden = isLeftHidden;
|
|
19001
|
+
}
|
|
19002
|
+
if (nextButtonRef.current) {
|
|
19003
|
+
nextButtonRef.current.hidden = isRightHidden;
|
|
19004
|
+
}
|
|
19005
|
+
}
|
|
19006
|
+
if (items.length === 0) {
|
|
19007
|
+
return null;
|
|
19008
|
+
}
|
|
19009
|
+
return /*#__PURE__*/ createElement("div", _object_spread_propsExports._(_object_spreadExports._({}, props), {
|
|
19010
|
+
className: cx(cssClasses.root)
|
|
19011
|
+
}), HeaderComponent && /*#__PURE__*/ createElement(HeaderComponent, {
|
|
19012
|
+
canScrollLeft: canScrollLeft,
|
|
19013
|
+
canScrollRight: canScrollRight,
|
|
19014
|
+
scrollLeft: scrollLeft,
|
|
19015
|
+
scrollRight: scrollRight
|
|
19016
|
+
}), showNavigation && /*#__PURE__*/ createElement("button", {
|
|
19017
|
+
ref: previousButtonRef,
|
|
19018
|
+
title: translations.previousButtonTitle,
|
|
19019
|
+
"aria-label": translations.previousButtonLabel,
|
|
19020
|
+
hidden: true,
|
|
19021
|
+
"aria-controls": carouselIdRef.current,
|
|
19022
|
+
className: cx(cssClasses.navigation, cssClasses.navigationPrevious),
|
|
19023
|
+
onClick: function onClick(event) {
|
|
19024
|
+
event.preventDefault();
|
|
19025
|
+
scrollLeft();
|
|
19026
|
+
}
|
|
19027
|
+
}, /*#__PURE__*/ createElement(PreviousIcon, {
|
|
19028
|
+
createElement: createElement
|
|
19029
|
+
})), /*#__PURE__*/ createElement("ol", {
|
|
19030
|
+
className: cx(cssClasses.list),
|
|
19031
|
+
ref: listRef,
|
|
19032
|
+
tabIndex: 0,
|
|
19033
|
+
id: carouselIdRef.current,
|
|
19034
|
+
"aria-roledescription": "carousel",
|
|
19035
|
+
"aria-label": translations.listLabel,
|
|
19036
|
+
"aria-live": "polite",
|
|
19037
|
+
onScroll: updateNavigationButtonsProps,
|
|
19038
|
+
onKeyDown: function onKeyDown(event) {
|
|
19039
|
+
if (event.key === 'ArrowLeft') {
|
|
19040
|
+
event.preventDefault();
|
|
19041
|
+
scrollLeft();
|
|
19042
|
+
} else if (event.key === 'ArrowRight') {
|
|
19043
|
+
event.preventDefault();
|
|
19044
|
+
scrollRight();
|
|
19045
|
+
}
|
|
19046
|
+
}
|
|
19047
|
+
}, items.map(function(item, index) {
|
|
19048
|
+
return /*#__PURE__*/ createElement("li", {
|
|
19049
|
+
key: item.objectID,
|
|
19050
|
+
className: cx(cssClasses.item),
|
|
19051
|
+
"aria-roledescription": "slide",
|
|
19052
|
+
"aria-label": "".concat(index + 1, " of ").concat(items.length),
|
|
19053
|
+
onClick: function onClick() {
|
|
19054
|
+
sendEvent('click:internal', item, 'Item Clicked');
|
|
19055
|
+
},
|
|
19056
|
+
onAuxClick: function onAuxClick() {
|
|
19057
|
+
sendEvent('click:internal', item, 'Item Clicked');
|
|
19058
|
+
}
|
|
19059
|
+
}, /*#__PURE__*/ createElement(ItemComponent, {
|
|
19060
|
+
item: item,
|
|
19061
|
+
sendEvent: sendEvent
|
|
19062
|
+
}));
|
|
19063
|
+
})), showNavigation && /*#__PURE__*/ createElement("button", {
|
|
19064
|
+
ref: nextButtonRef,
|
|
19065
|
+
title: translations.nextButtonTitle,
|
|
19066
|
+
"aria-label": translations.nextButtonLabel,
|
|
19067
|
+
"aria-controls": carouselIdRef.current,
|
|
19068
|
+
className: cx(cssClasses.navigation, cssClasses.navigationNext),
|
|
19069
|
+
onClick: function onClick(event) {
|
|
19070
|
+
event.preventDefault();
|
|
19071
|
+
scrollRight();
|
|
19072
|
+
}
|
|
19073
|
+
}, /*#__PURE__*/ createElement(NextIcon, {
|
|
19074
|
+
createElement: createElement
|
|
19075
|
+
})));
|
|
19076
|
+
};
|
|
19077
|
+
}
|
|
19043
19078
|
|
|
19044
19079
|
function createChatHeaderComponent(param) {
|
|
19045
19080
|
var createElement = param.createElement;
|
|
@@ -19113,6 +19148,18 @@
|
|
|
19113
19148
|
};
|
|
19114
19149
|
}
|
|
19115
19150
|
|
|
19151
|
+
var getTextContent = function getTextContent(message) {
|
|
19152
|
+
return message.parts.map(function(part) {
|
|
19153
|
+
return 'text' in part ? part.text : '';
|
|
19154
|
+
}).join('');
|
|
19155
|
+
};
|
|
19156
|
+
var hasTextContent = function hasTextContent(message) {
|
|
19157
|
+
return getTextContent(message).trim() !== '';
|
|
19158
|
+
};
|
|
19159
|
+
var isPartText = function isPartText(part) {
|
|
19160
|
+
return part.type === 'text';
|
|
19161
|
+
};
|
|
19162
|
+
|
|
19116
19163
|
function n(){return n=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);}return e},n.apply(this,arguments)}const o=["allowFullScreen","allowTransparency","autoComplete","autoFocus","autoPlay","cellPadding","cellSpacing","charSet","classId","colSpan","contentEditable","contextMenu","crossOrigin","encType","formAction","formEncType","formMethod","formNoValidate","formTarget","frameBorder","hrefLang","inputMode","keyParams","keyType","marginHeight","marginWidth","maxLength","mediaGroup","minLength","noValidate","radioGroup","readOnly","rowSpan","spellCheck","srcDoc","srcLang","srcSet","tabIndex","useMap"].reduce((e,n)=>(e[n.toLowerCase()]=n,e),{class:"className",for:"htmlFor"}),a={amp:"&",apos:"'",gt:">",lt:"<",nbsp:" ",quot:"“"},c=["style","script","pre"],i=["src","href","data","formAction","srcDoc","action"],u=/([-A-Z0-9_:]+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|(?:\{((?:\\.|{[^}]*?}|[^}])*)\})))?/gi,l=/\n{2,}$/,s=/^(\s*>[\s\S]*?)(?=\n\n|$)/,f=/^ *> ?/gm,_=/^(?:\[!([^\]]*)\]\n)?([\s\S]*)/,d=/^ {2,}\n/,p=/^(?:([-*_])( *\1){2,}) *(?:\n *)+\n/,y=/^(?: {1,3})?(`{3,}|~{3,}) *(\S+)? *([^\n]*?)?\n([\s\S]*?)(?:\1\n?|$)/,h=/^(?: {4}[^\n]+\n*)+(?:\n *)+\n?/,g=/^(`+)((?:\\`|(?!\1)`|[^`])+)\1/,m=/^(?:\n *)*\n/,k=/\r\n?/g,x=/^\[\^([^\]]+)](:(.*)((\n+ {4,}.*)|(\n(?!\[\^).+))*)/,q=/^\[\^([^\]]+)]/,v=/\f/g,b=/^---[ \t]*\n(.|\n)*\n---[ \t]*\n/,$=/^\s*?\[(x|\s)\]/,S=/^ *(#{1,6}) *([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,z=/^ *(#{1,6}) +([^\n]+?)(?: +#*)?(?:\n *)*(?:\n|$)/,E=/^([^\n]+)\n *(=|-)\2{2,} *\n/,A=/^ *(?!<[a-z][^ >/]* ?\/>)<([a-z][^ >/]*) ?((?:[^>]*[^/])?)>\n?(\s*(?:<\1[^>]*?>[\s\S]*?<\/\1>|(?!<\1\b)[\s\S])*?)<\/\1>(?!<\/\1>)\n*/i,R=/&([a-z0-9]+|#[0-9]{1,6}|#x[0-9a-fA-F]{1,6});/gi,B=/^<!--[\s\S]*?(?:-->)/,L=/^(data|aria|x)-[a-z_][a-z\d_.-]*$/,O=/^ *<([a-z][a-z0-9:]*)(?:\s+((?:<.*?>|[^>])*))?\/?>(?!<\/\1>)(\s*\n)?/i,j=/^\{.*\}$/,C=/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,I=/^<([^ >]+[:@\/][^ >]+)>/,T=/-([a-z])?/gi,M=/^(\|.*)\n(?: *(\|? *[-:]+ *\|[-| :]*)\n((?:.*\|.*\n)*))?\n?/,w=/^[^\n]+(?: \n|\n{2,})/,D=/^\[([^\]]*)\]:\s+<?([^\s>]+)>?\s*("([^"]*)")?/,F=/^!\[([^\]]*)\] ?\[([^\]]*)\]/,P=/^\[([^\]]*)\] ?\[([^\]]*)\]/,Z=/(\n|^[-*]\s|^#|^ {2,}|^-{2,}|^>\s)/,N=/\t/g,G=/(^ *\||\| *$)/g,U=/^ *:-+: *$/,V=/^ *:-+ *$/,H=/^ *-+: *$/,Q=e=>`(?=[\\s\\S]+?\\1${e?"\\1":""})`,W="((?:\\[.*?\\][([].*?[)\\]]|<.*?>(?:.*?<.*?>)?|`.*?`|\\\\\\1|[\\s\\S])+?)",J=RegExp(`^([*_])\\1${Q(1)}${W}\\1\\1(?!\\1)`),K=RegExp(`^([*_])${Q(0)}${W}\\1(?!\\1)`),X=RegExp(`^(==)${Q(0)}${W}\\1`),Y=RegExp(`^(~~)${Q(0)}${W}\\1`),ee=/^(:[a-zA-Z0-9-_]+:)/,ne=/^\\([^0-9A-Za-z\s])/,re=/\\([^0-9A-Za-z\s])/g,te=/^[\s\S](?:(?! \n|[0-9]\.|http)[^=*_~\-\n:<`\\\[!])*/,oe=/^\n+/,ae=/^([ \t]*)/,ce=/(?:^|\n)( *)$/,ie="(?:\\d+\\.)",ue="(?:[*+-])";function le(e){return "( *)("+(1===e?ie:ue)+") +"}const se=le(1),fe=le(2);function _e(e){return RegExp("^"+(1===e?se:fe))}const de=_e(1),pe=_e(2);function ye(e){return RegExp("^"+(1===e?se:fe)+"[^\\n]*(?:\\n(?!\\1"+(1===e?ie:ue)+" )[^\\n]*)*(\\n|$)","gm")}const he=ye(1),ge=ye(2);function me(e){const n=1===e?ie:ue;return RegExp("^( *)("+n+") [\\s\\S]+?(?:\\n{2,}(?! )(?!\\1"+n+" (?!"+n+" ))\\n*|\\s*\\n*$)")}const ke=me(1),xe=me(2);function qe(e,n){const r=1===n,t=r?ke:xe,o=r?he:ge,a=r?de:pe;return {t:e=>a.test(e),o:je(function(e,n){const r=ce.exec(n.prevCapture);return r&&(n.list||!n.inline&&!n.simple)?t.exec(e=r[1]+e):null}),i:1,u(e,n,t){const c=r?+e[2]:void 0,i=e[0].replace(l,"\n").match(o);let u=!1;return {items:i.map(function(e,r){const o=a.exec(e)[0].length,c=RegExp("^ {1,"+o+"}","gm"),l=e.replace(c,"").replace(a,""),s=r===i.length-1,f=-1!==l.indexOf("\n\n")||s&&u;u=f;const _=t.inline,d=t.list;let p;t.list=!0,f?(t.inline=!1,p=Se(l)+"\n\n"):(t.inline=!0,p=Se(l));const y=n(p,t);return t.inline=_,t.list=d,y}),ordered:r,start:c}},l:(n,r,t)=>e(n.ordered?"ol":"ul",{key:t.key,start:"20"===n.type?n.start:void 0},n.items.map(function(n,o){return e("li",{key:o},r(n,t))}))}}const ve=RegExp("^\\[((?:\\[[^\\[\\]]*(?:\\[[^\\[\\]]*\\][^\\[\\]]*)*\\]|[^\\[\\]])*)\\]\\(\\s*<?((?:\\([^)]*\\)|[^\\s\\\\]|\\\\.)*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*\\)"),be=/^!\[(.*?)\]\( *((?:\([^)]*\)|[^() ])*) *"?([^)"]*)?"?\)/;function $e(e){return "string"==typeof e}function Se(e){let n=e.length;for(;n>0&&e[n-1]<=" ";)n--;return e.slice(0,n)}function ze(e,n){return e.startsWith(n)}function Ee(e,n,r){if(Array.isArray(r)){for(let n=0;n<r.length;n++)if(ze(e,r[n]))return !0;return !1}return r(e,n)}function Ae(e){return e.replace(/[ÀÁÂÃÄÅàáâãä忯]/g,"a").replace(/[çÇ]/g,"c").replace(/[ðÐ]/g,"d").replace(/[ÈÉÊËéèêë]/g,"e").replace(/[ÏïÎîÍíÌì]/g,"i").replace(/[Ññ]/g,"n").replace(/[øØœŒÕõÔôÓóÒò]/g,"o").replace(/[ÜüÛûÚúÙù]/g,"u").replace(/[ŸÿÝý]/g,"y").replace(/[^a-z0-9- ]/gi,"").replace(/ /gi,"-").toLowerCase()}function Re(e){return H.test(e)?"right":U.test(e)?"center":V.test(e)?"left":null}function Be(e,n,r,t){const o=r.inTable;r.inTable=!0;let a=[[]],c="";function i(){if(!c)return;const e=a[a.length-1];e.push.apply(e,n(c,r)),c="";}return e.trim().split(/(`[^`]*`|\\\||\|)/).filter(Boolean).forEach((e,n,r)=>{"|"===e.trim()&&(i(),t)?0!==n&&n!==r.length-1&&a.push([]):c+=e;}),i(),r.inTable=o,a}function Le(e,n,r){r.inline=!0;const t=e[2]?e[2].replace(G,"").split("|").map(Re):[],o=e[3]?function(e,n,r){return e.trim().split("\n").map(function(e){return Be(e,n,r,!0)})}(e[3],n,r):[],a=Be(e[1],n,r,!!o.length);return r.inline=!1,o.length?{align:t,cells:o,header:a,type:"25"}:{children:a,type:"21"}}function Oe(e,n){return null==e.align[n]?{}:{textAlign:e.align[n]}}function je(e){return e.inline=1,e}function Ce(e){return je(function(n,r){return r.inline?e.exec(n):null})}function Ie(e){return je(function(n,r){return r.inline||r.simple?e.exec(n):null})}function Te(e){return function(n,r){return r.inline||r.simple?null:e.exec(n)}}function Me(e){return je(function(n){return e.exec(n)})}const we=/(javascript|vbscript|data(?!:image)):/i;function De(e){try{const n=decodeURIComponent(e).replace(/[^A-Za-z0-9/:]/g,"");if(we.test(n))return null}catch(e){return null}return e}function Fe(e){return e?e.replace(re,"$1"):e}function Pe(e,n,r){const t=r.inline||!1,o=r.simple||!1;r.inline=!0,r.simple=!0;const a=e(n,r);return r.inline=t,r.simple=o,a}function Ze(e,n,r){const t=r.inline||!1,o=r.simple||!1;r.inline=!1,r.simple=!0;const a=e(n,r);return r.inline=t,r.simple=o,a}function Ne(e,n,r){const t=r.inline||!1;r.inline=!1;const o=e(n,r);return r.inline=t,o}const Ge=(e,n,r)=>({children:Pe(n,e[2],r)});function Ue(){return {}}function Ve(){return null}function He(...e){return e.filter(Boolean).join(" ")}function Qe(e,n,r){let t=e;const o=n.split(".");for(;o.length&&(t=t[o[0]],void 0!==t);)o.shift();return t||r}function We(r="",t={}){t.overrides=t.overrides||{},t.namedCodesToUnicode=t.namedCodesToUnicode?n({},a,t.namedCodesToUnicode):a;const l=t.slugify||Ae,G=t.sanitizer||De,U=t.createElement||React__namespace.createElement,V=[s,y,h,t.enforceAtxHeadings?z:S,E,M,ke,xe],H=[...V,w,A,B,O];function Q(e,n){for(let r=0;r<e.length;r++)if(e[r].test(n))return !0;return !1}function W(e,r,...o){const a=Qe(t.overrides,e+".props",{});return U(function(e,n){const r=Qe(n,e);return r?"function"==typeof r||"object"==typeof r&&"render"in r?r:Qe(n,e+".component",e):e}(e,t.overrides),n({},r,a,{className:He(null==r?void 0:r.className,a.className)||void 0}),...o)}function re(e){e=e.replace(b,"");let n=!1;t.forceInline?n=!0:t.forceBlock||(n=!1===Z.test(e));const r=fe(se(n?e:Se(e).replace(oe,"")+"\n\n",{inline:n}));for(;$e(r[r.length-1])&&!r[r.length-1].trim();)r.pop();if(null===t.wrapper)return r;const o=t.wrapper||(n?"span":"div");let a;if(r.length>1||t.forceWrapper)a=r;else {if(1===r.length)return a=r[0],"string"==typeof a?W("span",{key:"outer"},a):a;a=null;}return U(o,{key:"outer"},a)}function ce(e,n){if(!n||!n.trim())return null;const r=n.match(u);return r?r.reduce(function(n,r){const t=r.indexOf("=");if(-1!==t){const a=function(e){return -1!==e.indexOf("-")&&null===e.match(L)&&(e=e.replace(T,function(e,n){return n.toUpperCase()})),e}(r.slice(0,t)).trim(),c=function(e){const n=e[0];return ('"'===n||"'"===n)&&e.length>=2&&e[e.length-1]===n?e.slice(1,-1):e}(r.slice(t+1).trim()),u=o[a]||a;if("ref"===u)return n;const l=n[u]=function(e,n,r,t){return "style"===n?function(e){const n=[];let r="",t=!1,o=!1,a="";if(!e)return n;for(let c=0;c<e.length;c++){const i=e[c];if('"'!==i&&"'"!==i||t||(o?i===a&&(o=!1,a=""):(o=!0,a=i)),"("===i&&r.endsWith("url")?t=!0:")"===i&&t&&(t=!1),";"!==i||o||t)r+=i;else {const e=r.trim();if(e){const r=e.indexOf(":");if(r>0){const t=e.slice(0,r).trim(),o=e.slice(r+1).trim();n.push([t,o]);}}r="";}}const c=r.trim();if(c){const e=c.indexOf(":");if(e>0){const r=c.slice(0,e).trim(),t=c.slice(e+1).trim();n.push([r,t]);}}return n}(r).reduce(function(n,[r,o]){return n[r.replace(/(-[a-z])/g,e=>e[1].toUpperCase())]=t(o,e,r),n},{}):-1!==i.indexOf(n)?t(Fe(r),e,n):(r.match(j)&&(r=Fe(r.slice(1,r.length-1))),"true"===r||"false"!==r&&r)}(e,a,c,G);"string"==typeof l&&(A.test(l)||O.test(l))&&(n[u]=re(l.trim()));}else "style"!==r&&(n[o[r]||r]=!0);return n},{}):null}const ie=[],ue={},le={0:{t:[">"],o:Te(s),i:1,u(e,n,r){const[,t,o]=e[0].replace(f,"").match(_);return {alert:t,children:n(o,r)}},l(e,n,r){const t={key:r.key};return e.alert&&(t.className="markdown-alert-"+l(e.alert.toLowerCase(),Ae),e.children.unshift({attrs:{},children:[{type:"27",text:e.alert}],noInnerParse:!0,type:"11",tag:"header"})),W("blockquote",t,n(e.children,r))}},1:{t:[" "],o:Me(d),i:1,u:Ue,l:(e,n,r)=>W("br",{key:r.key})},2:{t:["--","__","**","- ","* ","_ "],o:Te(p),i:1,u:Ue,l:(e,n,r)=>W("hr",{key:r.key})},3:{t:[" "],o:Te(h),i:0,u:e=>({lang:void 0,text:Fe(Se(e[0].replace(/^ {4}/gm,"")))}),l:(e,r,t)=>W("pre",{key:t.key},W("code",n({},e.attrs,{className:e.lang?"lang-"+e.lang:""}),e.text))},4:{t:["```","~~~"],o:Te(y),i:0,u:e=>({attrs:ce("code",e[3]||""),lang:e[2]||void 0,text:e[4],type:"3"})},5:{t:["`"],o:Ie(g),i:3,u:e=>({text:Fe(e[2])}),l:(e,n,r)=>W("code",{key:r.key},e.text)},6:{t:["[^"],o:Te(x),i:0,u:e=>(ie.push({footnote:e[2],identifier:e[1]}),{}),l:Ve},7:{t:["[^"],o:Ce(q),i:1,u:e=>({target:"#"+l(e[1],Ae),text:e[1]}),l:(e,n,r)=>W("a",{key:r.key,href:G(e.target,"a","href")},W("sup",{key:r.key},e.text))},8:{t:["[ ]","[x]"],o:Ce($),i:1,u:e=>({completed:"x"===e[1].toLowerCase()}),l:(e,n,r)=>W("input",{checked:e.completed,key:r.key,readOnly:!0,type:"checkbox"})},9:{t:["#"],o:Te(t.enforceAtxHeadings?z:S),i:1,u:(e,n,r)=>({children:Pe(n,e[2],r),id:l(e[2],Ae),level:e[1].length}),l:(e,n,r)=>W("h"+e.level,{id:e.id,key:r.key},n(e.children,r))},10:{t:e=>{const n=e.indexOf("\n");return n>0&&n<e.length-1&&("="===e[n+1]||"-"===e[n+1])},o:Te(E),i:0,u:(e,n,r)=>({children:Pe(n,e[1],r),level:"="===e[2]?1:2,type:"9"})},11:{t:["<"],o:Me(A),i:1,u(e,n,r){const[,t]=e[3].match(ae),o=RegExp("^"+t,"gm"),a=e[3].replace(o,""),i=Q(H,a)?Ne:Pe,u=e[1].toLowerCase(),l=-1!==c.indexOf(u),s=(l?u:e[1]).trim(),f={attrs:ce(s,e[2]),noInnerParse:l,tag:s};if(r.inAnchor=r.inAnchor||"a"===u,l)f.text=e[3];else {const e=r.inHTML;r.inHTML=!0,f.children=i(n,a,r),r.inHTML=e;}return r.inAnchor=!1,f},l:(e,r,t)=>W(e.tag,n({key:t.key},e.attrs),e.text||(e.children?r(e.children,t):""))},13:{t:["<"],o:Me(O),i:1,u(e){const n=e[1].trim();return {attrs:ce(n,e[2]||""),tag:n}},l:(e,r,t)=>W(e.tag,n({},e.attrs,{key:t.key}))},12:{t:["\x3c!--"],o:Me(B),i:1,u:()=>({}),l:Ve},14:{t:["!["],o:Ie(be),i:1,u:e=>({alt:Fe(e[1]),target:Fe(e[2]),title:Fe(e[3])}),l:(e,n,r)=>W("img",{key:r.key,alt:e.alt||void 0,title:e.title||void 0,src:G(e.target,"img","src")})},15:{t:["["],o:Ce(ve),i:3,u:(e,n,r)=>({children:Ze(n,e[1],r),target:Fe(e[2]),title:Fe(e[3])}),l:(e,n,r)=>W("a",{key:r.key,href:G(e.target,"a","href"),title:e.title},n(e.children,r))},16:{t:["<"],o:Ce(I),i:0,u(e){let n=e[1],r=!1;return -1!==n.indexOf("@")&&-1===n.indexOf("//")&&(r=!0,n=n.replace("mailto:","")),{children:[{text:n,type:"27"}],target:r?"mailto:"+n:n,type:"15"}}},17:{t:(e,n)=>!n.inAnchor&&!t.disableAutoLink&&(ze(e,"http://")||ze(e,"https://")),o:Ce(C),i:0,u:e=>({children:[{text:e[1],type:"27"}],target:e[1],title:void 0,type:"15"})},20:qe(W,1),33:qe(W,2),19:{t:["\n"],o:Te(m),i:3,u:Ue,l:()=>"\n"},21:{o:je(function(e,n){if(n.inline||n.simple||n.inHTML&&-1===e.indexOf("\n\n")&&-1===n.prevCapture.indexOf("\n\n"))return null;let r="",t=0;for(;;){const n=e.indexOf("\n",t),o=e.slice(t,-1===n?void 0:n+1);if(Q(V,o))break;if(r+=o,-1===n||!o.trim())break;t=n+1;}const o=Se(r);return ""===o?null:[r,,o]}),i:3,u:Ge,l:(e,n,r)=>W("p",{key:r.key},n(e.children,r))},22:{t:["["],o:Ce(D),i:0,u:e=>(ue[e[1]]={target:e[2],title:e[4]},{}),l:Ve},23:{t:["!["],o:Ie(F),i:0,u:e=>({alt:e[1]?Fe(e[1]):void 0,ref:e[2]}),l:(e,n,r)=>ue[e.ref]?W("img",{key:r.key,alt:e.alt,src:G(ue[e.ref].target,"img","src"),title:ue[e.ref].title}):null},24:{t:e=>"["===e[0]&&-1===e.indexOf("]("),o:Ce(P),i:0,u:(e,n,r)=>({children:n(e[1],r),fallbackChildren:e[0],ref:e[2]}),l:(e,n,r)=>ue[e.ref]?W("a",{key:r.key,href:G(ue[e.ref].target,"a","href"),title:ue[e.ref].title},n(e.children,r)):W("span",{key:r.key},e.fallbackChildren)},25:{t:["|"],o:Te(M),i:1,u:Le,l(e,n,r){const t=e;return W("table",{key:r.key},W("thead",null,W("tr",null,t.header.map(function(e,o){return W("th",{key:o,style:Oe(t,o)},n(e,r))}))),W("tbody",null,t.cells.map(function(e,o){return W("tr",{key:o},e.map(function(e,o){return W("td",{key:o,style:Oe(t,o)},n(e,r))}))})))}},27:{o:je(function(e,n){let r;return ze(e,":")&&(r=ee.exec(e)),r||te.exec(e)}),i:4,u(e){const n=e[0];return {text:-1===n.indexOf("&")?n:n.replace(R,(e,n)=>t.namedCodesToUnicode[n]||e)}},l:e=>e.text},28:{t:["**","__"],o:Ie(J),i:2,u:(e,n,r)=>({children:n(e[2],r)}),l:(e,n,r)=>W("strong",{key:r.key},n(e.children,r))},29:{t:e=>{const n=e[0];return ("*"===n||"_"===n)&&e[1]!==n},o:Ie(K),i:3,u:(e,n,r)=>({children:n(e[2],r)}),l:(e,n,r)=>W("em",{key:r.key},n(e.children,r))},30:{t:["\\"],o:Ie(ne),i:1,u:e=>({text:e[1],type:"27"})},31:{t:["=="],o:Ie(X),i:3,u:Ge,l:(e,n,r)=>W("mark",{key:r.key},n(e.children,r))},32:{t:["~~"],o:Ie(Y),i:3,u:Ge,l:(e,n,r)=>W("del",{key:r.key},n(e.children,r))}};!0===t.disableParsingRawHTML&&(delete le[11],delete le[13]);const se=function(e){var n=Object.keys(e);function r(t,o){var a=[];if(o.prevCapture=o.prevCapture||"",t.trim())for(;t;)for(var c=0;c<n.length;){var i=n[c],u=e[i];if(!u.t||Ee(t,o,u.t)){var l=u.o(t,o);if(l&&l[0]){t=t.substring(l[0].length);var s=u.u(l,r,o);o.prevCapture+=l[0],s.type||(s.type=i),a.push(s);break}c++;}else c++;}return o.prevCapture="",a}return n.sort(function(n,r){return e[n].i-e[r].i||(n<r?-1:1)}),function(e,n){return r(function(e){return e.replace(k,"\n").replace(v,"").replace(N," ")}(e),n)}}(le),fe=function(e,n){return function r(t,o={}){if(Array.isArray(t)){const e=o.key,n=[];let a=!1;for(let e=0;e<t.length;e++){o.key=e;const c=r(t[e],o),i=$e(c);i&&a?n[n.length-1]+=c:null!==c&&n.push(c),a=i;}return o.key=e,n}return function(r,t,o){const a=e[r.type].l;return n?n(()=>a(r,t,o),r,t,o):a(r,t,o)}(t,r,o)}}(le,t.renderRule),_e=re(r);return ie.length?W("div",null,_e,W("footer",{key:"footer"},ie.map(function(e){return W("div",{id:l(e.identifier,Ae),key:e.identifier},e.identifier,fe(se(e.footnote,{inline:!0})))}))):_e}
|
|
19117
19164
|
|
|
19118
19165
|
function startsWith(str, prefix) {
|
|
@@ -19127,9 +19174,10 @@
|
|
|
19127
19174
|
createElement: createElement
|
|
19128
19175
|
});
|
|
19129
19176
|
return function ChatMessage(userProps) {
|
|
19130
|
-
var _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames, message = userProps.message, _userProps_side = userProps.side, side = _userProps_side === void 0 ? 'left' : _userProps_side, _userProps_variant = userProps.variant, variant = _userProps_variant === void 0 ? 'subtle' : _userProps_variant, _userProps_actions = userProps.actions, actions = _userProps_actions === void 0 ? [] : _userProps_actions, _userProps_autoHideActions = userProps.autoHideActions, autoHideActions = _userProps_autoHideActions === void 0 ? false : _userProps_autoHideActions, LeadingComponent = userProps.leadingComponent, ActionsComponent = userProps.actionsComponent, FooterComponent = userProps.footerComponent, _userProps_tools = userProps.tools, tools = _userProps_tools === void 0 ? {} : _userProps_tools, indexUiState = userProps.indexUiState, setIndexUiState = userProps.setIndexUiState, onClose = userProps.onClose, userTranslations = userProps.translations, suggestionsElement = userProps.suggestionsElement, props = _object_without_propertiesExports._(userProps, [
|
|
19177
|
+
var _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames, message = userProps.message, status = userProps.status, _userProps_side = userProps.side, side = _userProps_side === void 0 ? 'left' : _userProps_side, _userProps_variant = userProps.variant, variant = _userProps_variant === void 0 ? 'subtle' : _userProps_variant, _userProps_actions = userProps.actions, actions = _userProps_actions === void 0 ? [] : _userProps_actions, _userProps_autoHideActions = userProps.autoHideActions, autoHideActions = _userProps_autoHideActions === void 0 ? false : _userProps_autoHideActions, LeadingComponent = userProps.leadingComponent, ActionsComponent = userProps.actionsComponent, FooterComponent = userProps.footerComponent, _userProps_tools = userProps.tools, tools = _userProps_tools === void 0 ? {} : _userProps_tools, indexUiState = userProps.indexUiState, setIndexUiState = userProps.setIndexUiState, onClose = userProps.onClose, userTranslations = userProps.translations, suggestionsElement = userProps.suggestionsElement, props = _object_without_propertiesExports._(userProps, [
|
|
19131
19178
|
"classNames",
|
|
19132
19179
|
"message",
|
|
19180
|
+
"status",
|
|
19133
19181
|
"side",
|
|
19134
19182
|
"variant",
|
|
19135
19183
|
"actions",
|
|
@@ -19149,7 +19197,7 @@
|
|
|
19149
19197
|
actionsLabel: 'Message actions'
|
|
19150
19198
|
}, userTranslations);
|
|
19151
19199
|
var hasLeading = Boolean(LeadingComponent);
|
|
19152
|
-
var
|
|
19200
|
+
var showActions = Boolean(actions.length > 0 || ActionsComponent) && status === 'ready';
|
|
19153
19201
|
var cssClasses = {
|
|
19154
19202
|
root: cx('ais-ChatMessage', "ais-ChatMessage--".concat(side), "ais-ChatMessage--".concat(variant), autoHideActions && 'ais-ChatMessage--auto-hide-actions', classNames.root),
|
|
19155
19203
|
container: cx('ais-ChatMessage-container', classNames.container),
|
|
@@ -19219,7 +19267,7 @@
|
|
|
19219
19267
|
className: cx(cssClasses.content)
|
|
19220
19268
|
}, /*#__PURE__*/ createElement("div", {
|
|
19221
19269
|
className: cx(cssClasses.message)
|
|
19222
|
-
}, message.parts.map(renderMessagePart)), suggestionsElement,
|
|
19270
|
+
}, message.parts.map(renderMessagePart)), suggestionsElement, showActions && /*#__PURE__*/ createElement("div", {
|
|
19223
19271
|
className: cx(cssClasses.actions),
|
|
19224
19272
|
"aria-label": translations.actionsLabel
|
|
19225
19273
|
}, ActionsComponent ? /*#__PURE__*/ createElement(ActionsComponent, {
|
|
@@ -19326,14 +19374,6 @@
|
|
|
19326
19374
|
};
|
|
19327
19375
|
}
|
|
19328
19376
|
|
|
19329
|
-
var getTextContent = function getTextContent(message) {
|
|
19330
|
-
return message.parts.map(function(part) {
|
|
19331
|
-
return 'text' in part ? part.text : '';
|
|
19332
|
-
}).join('');
|
|
19333
|
-
};
|
|
19334
|
-
var hasTextContent = function hasTextContent(message) {
|
|
19335
|
-
return getTextContent(message).trim() !== '';
|
|
19336
|
-
};
|
|
19337
19377
|
var copyToClipboard = function copyToClipboard(message) {
|
|
19338
19378
|
navigator.clipboard.writeText(getTextContent(message));
|
|
19339
19379
|
};
|
|
@@ -19344,7 +19384,7 @@
|
|
|
19344
19384
|
Fragment: Fragment
|
|
19345
19385
|
});
|
|
19346
19386
|
return function DefaultMessage(param) {
|
|
19347
|
-
var message = param.message, userMessageProps = param.userMessageProps, assistantMessageProps = param.assistantMessageProps, tools = param.tools, indexUiState = param.indexUiState, setIndexUiState = param.setIndexUiState, onReload = param.onReload, onClose = param.onClose, actionsComponent = param.actionsComponent, classNames = param.classNames, messageTranslations = param.messageTranslations, translations = param.translations, suggestionsElement = param.suggestionsElement;
|
|
19387
|
+
var message = param.message, status = param.status, userMessageProps = param.userMessageProps, assistantMessageProps = param.assistantMessageProps, tools = param.tools, indexUiState = param.indexUiState, setIndexUiState = param.setIndexUiState, onReload = param.onReload, onClose = param.onClose, actionsComponent = param.actionsComponent, classNames = param.classNames, messageTranslations = param.messageTranslations, translations = param.translations, suggestionsElement = param.suggestionsElement;
|
|
19348
19388
|
var defaultAssistantActions = _to_consumable_arrayExports._(hasTextContent(message) ? [
|
|
19349
19389
|
{
|
|
19350
19390
|
title: translations.copyToClipboardLabel,
|
|
@@ -19374,6 +19414,7 @@
|
|
|
19374
19414
|
side: message.role === 'user' ? 'right' : 'left',
|
|
19375
19415
|
variant: message.role === 'user' ? 'neutral' : 'subtle',
|
|
19376
19416
|
message: message,
|
|
19417
|
+
status: status,
|
|
19377
19418
|
tools: tools,
|
|
19378
19419
|
indexUiState: indexUiState,
|
|
19379
19420
|
setIndexUiState: setIndexUiState,
|
|
@@ -19403,6 +19444,7 @@
|
|
|
19403
19444
|
createElement: createElement
|
|
19404
19445
|
});
|
|
19405
19446
|
return function ChatMessages(userProps) {
|
|
19447
|
+
var _lastMessage_parts;
|
|
19406
19448
|
var _userProps_classNames = userProps.classNames, classNames = _userProps_classNames === void 0 ? {} : _userProps_classNames, _userProps_messageClassNames = userProps.messageClassNames, messageClassNames = _userProps_messageClassNames === void 0 ? {} : _userProps_messageClassNames, messageTranslations = userProps.messageTranslations, _userProps_messages = userProps.messages, messages = _userProps_messages === void 0 ? [] : _userProps_messages, MessageComponent = userProps.messageComponent, LoaderComponent = userProps.loaderComponent, ErrorComponent = userProps.errorComponent, ActionsComponent = userProps.actionsComponent, tools = userProps.tools, indexUiState = userProps.indexUiState, setIndexUiState = userProps.setIndexUiState, _userProps_status = userProps.status, status = _userProps_status === void 0 ? 'ready' : _userProps_status, _userProps_hideScrollToBottom = userProps.hideScrollToBottom, hideScrollToBottom = _userProps_hideScrollToBottom === void 0 ? false : _userProps_hideScrollToBottom, onReload = userProps.onReload, onClose = userProps.onClose, userTranslations = userProps.translations, userMessageProps = userProps.userMessageProps, assistantMessageProps = userProps.assistantMessageProps, _userProps_isClearing = userProps.isClearing, isClearing = _userProps_isClearing === void 0 ? false : _userProps_isClearing, onClearTransitionEnd = userProps.onClearTransitionEnd, isScrollAtBottom = userProps.isScrollAtBottom, scrollRef = userProps.scrollRef, contentRef = userProps.contentRef, onScrollToBottom = userProps.onScrollToBottom, suggestionsElement = userProps.suggestionsElement, props = _object_without_propertiesExports._(userProps, [
|
|
19407
19449
|
"classNames",
|
|
19408
19450
|
"messageClassNames",
|
|
@@ -19442,6 +19484,12 @@
|
|
|
19442
19484
|
scrollToBottom: cx('ais-ChatMessages-scrollToBottom', classNames.scrollToBottom),
|
|
19443
19485
|
scrollToBottomHidden: cx('ais-ChatMessages-scrollToBottom--hidden', classNames.scrollToBottomHidden)
|
|
19444
19486
|
};
|
|
19487
|
+
var lastMessage = messages[messages.length - 1];
|
|
19488
|
+
var lastPart = lastMessage === null || lastMessage === void 0 ? void 0 : (_lastMessage_parts = lastMessage.parts) === null || _lastMessage_parts === void 0 ? void 0 : _lastMessage_parts[lastMessage.parts.length - 1];
|
|
19489
|
+
var isWaitingForResponse = status === 'submitted';
|
|
19490
|
+
var isStreamingWithNoContent = status === 'streaming' && !lastPart;
|
|
19491
|
+
var isStreamingNonTextContent = status === 'streaming' && lastPart && !isPartText(lastPart);
|
|
19492
|
+
var showLoader = isWaitingForResponse || isStreamingWithNoContent || isStreamingNonTextContent;
|
|
19445
19493
|
var DefaultMessage = MessageComponent || DefaultMessageComponent;
|
|
19446
19494
|
var DefaultLoader = LoaderComponent || DefaultLoaderComponent;
|
|
19447
19495
|
var DefaultError = ErrorComponent || DefaultErrorComponent;
|
|
@@ -19464,6 +19512,7 @@
|
|
|
19464
19512
|
return /*#__PURE__*/ createElement(DefaultMessage, {
|
|
19465
19513
|
key: message.id,
|
|
19466
19514
|
message: message,
|
|
19515
|
+
status: status,
|
|
19467
19516
|
userMessageProps: userMessageProps,
|
|
19468
19517
|
assistantMessageProps: assistantMessageProps,
|
|
19469
19518
|
tools: tools,
|
|
@@ -19477,7 +19526,7 @@
|
|
|
19477
19526
|
messageTranslations: messageTranslations,
|
|
19478
19527
|
suggestionsElement: status === 'ready' && message.role === 'assistant' && index === messages.length - 1 ? suggestionsElement : undefined
|
|
19479
19528
|
});
|
|
19480
|
-
}),
|
|
19529
|
+
}), showLoader && /*#__PURE__*/ createElement(DefaultLoader, {
|
|
19481
19530
|
translations: {
|
|
19482
19531
|
loaderText: translations.loaderText
|
|
19483
19532
|
}
|
|
@@ -20722,6 +20771,17 @@
|
|
|
20722
20771
|
return instant ? 'instant' : animationCache.get(key);
|
|
20723
20772
|
}
|
|
20724
20773
|
|
|
20774
|
+
var PROMPT_SUGGESTION_FLAG = '__isPromptSuggestion';
|
|
20775
|
+
function getPromptSuggestionHits(param) {
|
|
20776
|
+
var hits = param.hits, limit = param.limit;
|
|
20777
|
+
return hits.slice(0, limit).map(function(hit) {
|
|
20778
|
+
return _object_spread_propsExports._(_object_spreadExports._({}, hit), _define_propertyExports._({}, PROMPT_SUGGESTION_FLAG, true));
|
|
20779
|
+
});
|
|
20780
|
+
}
|
|
20781
|
+
function isPromptSuggestion(item) {
|
|
20782
|
+
return Boolean(item && (typeof item === "undefined" ? "undefined" : _type_ofExports._(item)) === 'object' && item[PROMPT_SUGGESTION_FLAG]);
|
|
20783
|
+
}
|
|
20784
|
+
|
|
20725
20785
|
var AutocompleteSearchComponent = createAutocompleteSearchComponent({
|
|
20726
20786
|
createElement: React.createElement,
|
|
20727
20787
|
Fragment: React.Fragment
|
|
@@ -20747,6 +20807,43 @@
|
|
|
20747
20807
|
Fragment: React.Fragment
|
|
20748
20808
|
});
|
|
20749
20809
|
|
|
20810
|
+
function Highlight$1(_0) {
|
|
20811
|
+
var _0_classNames = _0.classNames, classNames = _0_classNames === void 0 ? {} : _0_classNames, props = _object_without_properties(_0, [
|
|
20812
|
+
"classNames"
|
|
20813
|
+
]);
|
|
20814
|
+
return /*#__PURE__*/ React.createElement(InternalHighlight, _object_spread({
|
|
20815
|
+
classNames: {
|
|
20816
|
+
root: cx('ais-Highlight', classNames.root),
|
|
20817
|
+
highlighted: cx('ais-Highlight-highlighted', classNames.highlighted),
|
|
20818
|
+
nonHighlighted: cx('ais-Highlight-nonHighlighted', classNames.nonHighlighted),
|
|
20819
|
+
separator: cx('ais-Highlight-separator', classNames.separator)
|
|
20820
|
+
}
|
|
20821
|
+
}, props));
|
|
20822
|
+
}
|
|
20823
|
+
|
|
20824
|
+
function Highlight(_0) {
|
|
20825
|
+
var hit = _0.hit, attribute = _0.attribute, highlightedTagName = _0.highlightedTagName, nonHighlightedTagName = _0.nonHighlightedTagName, separator = _0.separator, props = _object_without_properties(_0, [
|
|
20826
|
+
"hit",
|
|
20827
|
+
"attribute",
|
|
20828
|
+
"highlightedTagName",
|
|
20829
|
+
"nonHighlightedTagName",
|
|
20830
|
+
"separator"
|
|
20831
|
+
]);
|
|
20832
|
+
var property = getPropertyByPath(hit._highlightResult, attribute) || [];
|
|
20833
|
+
var properties = Array.isArray(property) ? property : [
|
|
20834
|
+
property
|
|
20835
|
+
];
|
|
20836
|
+
var parts = properties.map(function(singleValue) {
|
|
20837
|
+
return getHighlightedParts(unescape$1(singleValue.value || ''));
|
|
20838
|
+
});
|
|
20839
|
+
return /*#__PURE__*/ React.createElement(Highlight$1, _object_spread_props(_object_spread({}, props), {
|
|
20840
|
+
parts: parts,
|
|
20841
|
+
highlightedTagName: highlightedTagName,
|
|
20842
|
+
nonHighlightedTagName: nonHighlightedTagName,
|
|
20843
|
+
separator: separator
|
|
20844
|
+
}));
|
|
20845
|
+
}
|
|
20846
|
+
|
|
20750
20847
|
function ReverseHighlight$1(_0) {
|
|
20751
20848
|
var _0_classNames = _0.classNames, classNames = _0_classNames === void 0 ? {} : _0_classNames, props = _object_without_properties(_0, [
|
|
20752
20849
|
"classNames"
|
|
@@ -20807,6 +20904,10 @@
|
|
|
20807
20904
|
createElement: React.createElement,
|
|
20808
20905
|
Fragment: React.Fragment
|
|
20809
20906
|
});
|
|
20907
|
+
var AutocompletePromptSuggestion = createAutocompletePromptSuggestionComponent({
|
|
20908
|
+
createElement: React.createElement,
|
|
20909
|
+
Fragment: React.Fragment
|
|
20910
|
+
});
|
|
20810
20911
|
var AutocompleteRecentSearch = createAutocompleteRecentSearchComponent({
|
|
20811
20912
|
createElement: React.createElement,
|
|
20812
20913
|
Fragment: React.Fragment
|
|
@@ -20964,9 +21065,10 @@
|
|
|
20964
21065
|
};
|
|
20965
21066
|
}
|
|
20966
21067
|
function EXPERIMENTAL_Autocomplete(_0) {
|
|
20967
|
-
var _0_indices = _0.indices, indices = _0_indices === void 0 ? [] : _0_indices,
|
|
21068
|
+
var _0_indices = _0.indices, indices = _0_indices === void 0 ? [] : _0_indices, showQuerySuggestions = _0.showQuerySuggestions, showPromptSuggestions = _0.showPromptSuggestions, showRecent = _0.showRecent, userSearchParameters = _0.searchParameters, detachedMediaQuery = _0.detachedMediaQuery, tmp = _0.translations, userTranslations = tmp === void 0 ? {} : tmp, props = _object_without_properties(_0, [
|
|
20968
21069
|
"indices",
|
|
20969
|
-
"
|
|
21070
|
+
"showQuerySuggestions",
|
|
21071
|
+
"showPromptSuggestions",
|
|
20970
21072
|
"showRecent",
|
|
20971
21073
|
"searchParameters",
|
|
20972
21074
|
"detachedMediaQuery",
|
|
@@ -20984,12 +21086,12 @@
|
|
|
20984
21086
|
hitsPerPage: 5
|
|
20985
21087
|
}, userSearchParameters);
|
|
20986
21088
|
var indicesConfig = _to_consumable_array(indices);
|
|
20987
|
-
if (
|
|
20988
|
-
var
|
|
21089
|
+
if (showQuerySuggestions === null || showQuerySuggestions === void 0 ? void 0 : showQuerySuggestions.indexName) {
|
|
21090
|
+
var _showQuerySuggestions_classNames, _showQuerySuggestions_classNames1, _showQuerySuggestions_classNames2, _showQuerySuggestions_classNames3;
|
|
20989
21091
|
indicesConfig.unshift({
|
|
20990
|
-
indexName:
|
|
20991
|
-
headerComponent:
|
|
20992
|
-
itemComponent:
|
|
21092
|
+
indexName: showQuerySuggestions.indexName,
|
|
21093
|
+
headerComponent: showQuerySuggestions.headerComponent,
|
|
21094
|
+
itemComponent: showQuerySuggestions.itemComponent || function(param) {
|
|
20993
21095
|
var item = param.item, onSelect = param.onSelect, onApply = param.onApply;
|
|
20994
21096
|
return /*#__PURE__*/ React.createElement(AutocompleteSuggestion, {
|
|
20995
21097
|
item: item,
|
|
@@ -21000,15 +21102,48 @@
|
|
|
21000
21102
|
}));
|
|
21001
21103
|
},
|
|
21002
21104
|
classNames: {
|
|
21003
|
-
root: cx('ais-AutocompleteSuggestions',
|
|
21004
|
-
list: cx('ais-AutocompleteSuggestionsList',
|
|
21005
|
-
header: cx('ais-AutocompleteSuggestionsHeader',
|
|
21006
|
-
item: cx('ais-AutocompleteSuggestionsItem',
|
|
21105
|
+
root: cx('ais-AutocompleteSuggestions', showQuerySuggestions === null || showQuerySuggestions === void 0 ? void 0 : (_showQuerySuggestions_classNames = showQuerySuggestions.classNames) === null || _showQuerySuggestions_classNames === void 0 ? void 0 : _showQuerySuggestions_classNames.root),
|
|
21106
|
+
list: cx('ais-AutocompleteSuggestionsList', showQuerySuggestions === null || showQuerySuggestions === void 0 ? void 0 : (_showQuerySuggestions_classNames1 = showQuerySuggestions.classNames) === null || _showQuerySuggestions_classNames1 === void 0 ? void 0 : _showQuerySuggestions_classNames1.list),
|
|
21107
|
+
header: cx('ais-AutocompleteSuggestionsHeader', showQuerySuggestions === null || showQuerySuggestions === void 0 ? void 0 : (_showQuerySuggestions_classNames2 = showQuerySuggestions.classNames) === null || _showQuerySuggestions_classNames2 === void 0 ? void 0 : _showQuerySuggestions_classNames2.header),
|
|
21108
|
+
item: cx('ais-AutocompleteSuggestionsItem', showQuerySuggestions === null || showQuerySuggestions === void 0 ? void 0 : (_showQuerySuggestions_classNames3 = showQuerySuggestions.classNames) === null || _showQuerySuggestions_classNames3 === void 0 ? void 0 : _showQuerySuggestions_classNames3.item)
|
|
21007
21109
|
},
|
|
21110
|
+
searchParameters: _object_spread({
|
|
21111
|
+
hitsPerPage: 3
|
|
21112
|
+
}, showQuerySuggestions.searchParameters),
|
|
21008
21113
|
getQuery: function getQuery(item) {
|
|
21009
21114
|
return item.query;
|
|
21010
21115
|
},
|
|
21011
|
-
getURL:
|
|
21116
|
+
getURL: showQuerySuggestions.getURL
|
|
21117
|
+
});
|
|
21118
|
+
}
|
|
21119
|
+
if (showPromptSuggestions === null || showPromptSuggestions === void 0 ? void 0 : showPromptSuggestions.indexName) {
|
|
21120
|
+
var _showPromptSuggestions_classNames, _showPromptSuggestions_classNames1, _showPromptSuggestions_classNames2, _showPromptSuggestions_classNames3;
|
|
21121
|
+
indicesConfig.push({
|
|
21122
|
+
indexName: showPromptSuggestions.indexName,
|
|
21123
|
+
headerComponent: showPromptSuggestions.headerComponent,
|
|
21124
|
+
itemComponent: showPromptSuggestions.itemComponent || function(param) {
|
|
21125
|
+
var item = param.item, onSelect = param.onSelect;
|
|
21126
|
+
return /*#__PURE__*/ React.createElement(AutocompletePromptSuggestion, {
|
|
21127
|
+
item: item,
|
|
21128
|
+
onSelect: onSelect
|
|
21129
|
+
}, /*#__PURE__*/ React.createElement(ConditionalHighlight, {
|
|
21130
|
+
item: item,
|
|
21131
|
+
attribute: "prompt"
|
|
21132
|
+
}));
|
|
21133
|
+
},
|
|
21134
|
+
classNames: {
|
|
21135
|
+
root: cx('ais-AutocompletePromptSuggestions', (_showPromptSuggestions_classNames = showPromptSuggestions.classNames) === null || _showPromptSuggestions_classNames === void 0 ? void 0 : _showPromptSuggestions_classNames.root),
|
|
21136
|
+
list: cx('ais-AutocompletePromptSuggestionsList', (_showPromptSuggestions_classNames1 = showPromptSuggestions.classNames) === null || _showPromptSuggestions_classNames1 === void 0 ? void 0 : _showPromptSuggestions_classNames1.list),
|
|
21137
|
+
header: cx('ais-AutocompletePromptSuggestionsHeader', (_showPromptSuggestions_classNames2 = showPromptSuggestions.classNames) === null || _showPromptSuggestions_classNames2 === void 0 ? void 0 : _showPromptSuggestions_classNames2.header),
|
|
21138
|
+
item: cx('ais-AutocompletePromptSuggestionsItem', (_showPromptSuggestions_classNames3 = showPromptSuggestions.classNames) === null || _showPromptSuggestions_classNames3 === void 0 ? void 0 : _showPromptSuggestions_classNames3.item)
|
|
21139
|
+
},
|
|
21140
|
+
searchParameters: _object_spread({
|
|
21141
|
+
hitsPerPage: 3
|
|
21142
|
+
}, showPromptSuggestions.searchParameters),
|
|
21143
|
+
getQuery: function getQuery(item) {
|
|
21144
|
+
return item.prompt;
|
|
21145
|
+
},
|
|
21146
|
+
getURL: showPromptSuggestions.getURL
|
|
21012
21147
|
});
|
|
21013
21148
|
}
|
|
21014
21149
|
var recentSearchConfig = showRecent ? {
|
|
@@ -21041,13 +21176,15 @@
|
|
|
21041
21176
|
isSearchPage: isSearchPage,
|
|
21042
21177
|
showRecent: showRecent,
|
|
21043
21178
|
recentSearchConfig: recentSearchConfig,
|
|
21044
|
-
|
|
21179
|
+
showQuerySuggestions: showQuerySuggestions,
|
|
21045
21180
|
detachedMediaQuery: detachedMediaQuery,
|
|
21046
|
-
translations: translations
|
|
21181
|
+
translations: translations,
|
|
21182
|
+
showPromptSuggestions: showPromptSuggestions,
|
|
21183
|
+
chatRenderState: indexRenderState.chat
|
|
21047
21184
|
}))));
|
|
21048
21185
|
}
|
|
21049
21186
|
function InnerAutocomplete(_0) {
|
|
21050
|
-
var indicesConfig = _0.indicesConfig, refineSearchBox = _0.refineSearchBox, isSearchStalled = _0.isSearchStalled, getSearchPageURL = _0.getSearchPageURL, userOnSelect = _0.onSelect, indexUiState = _0.indexUiState, isSearchPage = _0.isSearchPage, PanelComponent = _0.panelComponent, showRecent = _0.showRecent, recentSearchConfig = _0.recentSearchConfig,
|
|
21187
|
+
var indicesConfig = _0.indicesConfig, refineSearchBox = _0.refineSearchBox, isSearchStalled = _0.isSearchStalled, getSearchPageURL = _0.getSearchPageURL, userOnSelect = _0.onSelect, indexUiState = _0.indexUiState, isSearchPage = _0.isSearchPage, PanelComponent = _0.panelComponent, showRecent = _0.showRecent, recentSearchConfig = _0.recentSearchConfig, showQuerySuggestions = _0.showQuerySuggestions, showPromptSuggestions = _0.showPromptSuggestions, chatRenderState = _0.chatRenderState, transformItems = _0.transformItems, placeholder = _0.placeholder, autoFocus = _0.autoFocus, _0_detachedMediaQuery = _0.detachedMediaQuery, detachedMediaQuery = _0_detachedMediaQuery === void 0 ? DEFAULT_DETACHED_MEDIA_QUERY : _0_detachedMediaQuery, translations = _0.translations, classNames = _0.classNames, props = _object_without_properties(_0, [
|
|
21051
21188
|
"indicesConfig",
|
|
21052
21189
|
"refineSearchBox",
|
|
21053
21190
|
"isSearchStalled",
|
|
@@ -21058,13 +21195,18 @@
|
|
|
21058
21195
|
"panelComponent",
|
|
21059
21196
|
"showRecent",
|
|
21060
21197
|
"recentSearchConfig",
|
|
21061
|
-
"
|
|
21198
|
+
"showQuerySuggestions",
|
|
21199
|
+
"showPromptSuggestions",
|
|
21200
|
+
"chatRenderState",
|
|
21062
21201
|
"transformItems",
|
|
21063
21202
|
"placeholder",
|
|
21203
|
+
"autoFocus",
|
|
21064
21204
|
"detachedMediaQuery",
|
|
21065
21205
|
"translations",
|
|
21066
21206
|
"classNames"
|
|
21067
21207
|
]);
|
|
21208
|
+
var _ref;
|
|
21209
|
+
var _showPromptSuggestions_searchParameters;
|
|
21068
21210
|
var _useAutocomplete = useAutocomplete({
|
|
21069
21211
|
transformItems: transformItems
|
|
21070
21212
|
}), indices = _useAutocomplete.indices, refineAutocomplete = _useAutocomplete.refine, currentRefinement = _useAutocomplete.currentRefinement;
|
|
@@ -21075,10 +21217,66 @@
|
|
|
21075
21217
|
query: currentRefinement,
|
|
21076
21218
|
indices: indices,
|
|
21077
21219
|
indicesConfig: indicesConfig,
|
|
21078
|
-
suggestionsIndexName:
|
|
21220
|
+
suggestionsIndexName: showQuerySuggestions === null || showQuerySuggestions === void 0 ? void 0 : showQuerySuggestions.indexName
|
|
21079
21221
|
}), storage = _useStorage.storage, storageHits = _useStorage.storageHits, indicesForPropGetters = _useStorage.indicesForPropGetters, indicesConfigForPropGetters = _useStorage.indicesConfigForPropGetters;
|
|
21222
|
+
var promptSuggestionsIndexName = showPromptSuggestions === null || showPromptSuggestions === void 0 ? void 0 : showPromptSuggestions.indexName;
|
|
21223
|
+
var promptSuggestionsLimit = (_ref = showPromptSuggestions === null || showPromptSuggestions === void 0 ? void 0 : (_showPromptSuggestions_searchParameters = showPromptSuggestions.searchParameters) === null || _showPromptSuggestions_searchParameters === void 0 ? void 0 : _showPromptSuggestions_searchParameters.hitsPerPage) !== null && _ref !== void 0 ? _ref : 3;
|
|
21224
|
+
var indicesForPanel = React.useMemo(function() {
|
|
21225
|
+
return indices.map(function(index) {
|
|
21226
|
+
var dedupedHits = index.indexName === (showQuerySuggestions === null || showQuerySuggestions === void 0 ? void 0 : showQuerySuggestions.indexName) && showRecent ? index.hits.filter(function(suggestionHit) {
|
|
21227
|
+
return !storageHits.find(function(storageHit) {
|
|
21228
|
+
return storageHit.query === suggestionHit.query;
|
|
21229
|
+
});
|
|
21230
|
+
}) : index.hits;
|
|
21231
|
+
if (index.indexName !== promptSuggestionsIndexName) {
|
|
21232
|
+
return _object_spread_props(_object_spread({}, index), {
|
|
21233
|
+
hits: dedupedHits
|
|
21234
|
+
});
|
|
21235
|
+
}
|
|
21236
|
+
return _object_spread_props(_object_spread({}, index), {
|
|
21237
|
+
hits: getPromptSuggestionHits({
|
|
21238
|
+
hits: dedupedHits,
|
|
21239
|
+
limit: promptSuggestionsLimit
|
|
21240
|
+
})
|
|
21241
|
+
});
|
|
21242
|
+
});
|
|
21243
|
+
}, [
|
|
21244
|
+
indices,
|
|
21245
|
+
promptSuggestionsIndexName,
|
|
21246
|
+
promptSuggestionsLimit,
|
|
21247
|
+
showRecent,
|
|
21248
|
+
showQuerySuggestions === null || showQuerySuggestions === void 0 ? void 0 : showQuerySuggestions.indexName,
|
|
21249
|
+
storageHits
|
|
21250
|
+
]);
|
|
21251
|
+
var indicesForPropGettersWithPromptSuggestions = React.useMemo(function() {
|
|
21252
|
+
return indicesForPropGetters.map(function(index) {
|
|
21253
|
+
if (index.indexName !== promptSuggestionsIndexName) {
|
|
21254
|
+
return index;
|
|
21255
|
+
}
|
|
21256
|
+
return _object_spread_props(_object_spread({}, index), {
|
|
21257
|
+
hits: getPromptSuggestionHits({
|
|
21258
|
+
hits: index.hits,
|
|
21259
|
+
limit: promptSuggestionsLimit
|
|
21260
|
+
})
|
|
21261
|
+
});
|
|
21262
|
+
});
|
|
21263
|
+
}, [
|
|
21264
|
+
indicesForPropGetters,
|
|
21265
|
+
promptSuggestionsIndexName,
|
|
21266
|
+
promptSuggestionsLimit
|
|
21267
|
+
]);
|
|
21268
|
+
var hasWarnedMissingPromptSuggestionsChatRef = React.useRef(false);
|
|
21269
|
+
var allIndicesEmpty = indicesForPanel.every(function(param) {
|
|
21270
|
+
var hits = param.hits;
|
|
21271
|
+
return hits.length === 0;
|
|
21272
|
+
});
|
|
21273
|
+
var recentEmpty = !storageHits || storageHits.length === 0;
|
|
21274
|
+
var hasNoResultsTemplate = indicesConfig.some(function(c) {
|
|
21275
|
+
return c.noResultsComponent !== undefined;
|
|
21276
|
+
});
|
|
21277
|
+
var shouldHideEmptyPanel = allIndicesEmpty && recentEmpty && !hasNoResultsTemplate && !PanelComponent;
|
|
21080
21278
|
var _usePropGetters = usePropGetters({
|
|
21081
|
-
indices:
|
|
21279
|
+
indices: indicesForPropGettersWithPromptSuggestions,
|
|
21082
21280
|
indicesConfig: indicesConfigForPropGetters,
|
|
21083
21281
|
onRefine: function onRefine(query) {
|
|
21084
21282
|
refineAutocomplete(query);
|
|
@@ -21089,7 +21287,23 @@
|
|
|
21089
21287
|
refineAutocomplete(query);
|
|
21090
21288
|
},
|
|
21091
21289
|
onSelect: userOnSelect !== null && userOnSelect !== void 0 ? userOnSelect : function(param) {
|
|
21092
|
-
var query = param.query, setQuery = param.setQuery, url = param.url;
|
|
21290
|
+
var item = param.item, query = param.query, setQuery = param.setQuery, url = param.url;
|
|
21291
|
+
if (isPromptSuggestion(item)) {
|
|
21292
|
+
var chatRenderStateWithFocus = chatRenderState;
|
|
21293
|
+
if (chatRenderStateWithFocus) {
|
|
21294
|
+
var _chatRenderStateWithFocus_setOpen, _chatRenderStateWithFocus_focusInput, _chatRenderStateWithFocus_sendMessage;
|
|
21295
|
+
(_chatRenderStateWithFocus_setOpen = chatRenderStateWithFocus.setOpen) === null || _chatRenderStateWithFocus_setOpen === void 0 ? void 0 : _chatRenderStateWithFocus_setOpen.call(chatRenderStateWithFocus, true);
|
|
21296
|
+
(_chatRenderStateWithFocus_focusInput = chatRenderStateWithFocus.focusInput) === null || _chatRenderStateWithFocus_focusInput === void 0 ? void 0 : _chatRenderStateWithFocus_focusInput.call(chatRenderStateWithFocus);
|
|
21297
|
+
(_chatRenderStateWithFocus_sendMessage = chatRenderStateWithFocus.sendMessage) === null || _chatRenderStateWithFocus_sendMessage === void 0 ? void 0 : _chatRenderStateWithFocus_sendMessage.call(chatRenderStateWithFocus, {
|
|
21298
|
+
text: item.prompt
|
|
21299
|
+
});
|
|
21300
|
+
return;
|
|
21301
|
+
}
|
|
21302
|
+
if ((showPromptSuggestions === null || showPromptSuggestions === void 0 ? void 0 : showPromptSuggestions.indexName) && !hasWarnedMissingPromptSuggestionsChatRef.current) {
|
|
21303
|
+
hasWarnedMissingPromptSuggestionsChatRef.current = true;
|
|
21304
|
+
{ warn('showPromptSuggestions requires a Chat widget in the same index to open chat and send messages. Add <Chat /> to enable this behavior.'); }
|
|
21305
|
+
}
|
|
21306
|
+
}
|
|
21093
21307
|
if (url) {
|
|
21094
21308
|
window.location.href = url;
|
|
21095
21309
|
return;
|
|
@@ -21109,7 +21323,9 @@
|
|
|
21109
21323
|
}
|
|
21110
21324
|
},
|
|
21111
21325
|
placeholder: placeholder,
|
|
21112
|
-
isDetached: isDetached
|
|
21326
|
+
isDetached: isDetached,
|
|
21327
|
+
shouldHidePanel: shouldHideEmptyPanel,
|
|
21328
|
+
autoFocus: autoFocus
|
|
21113
21329
|
}), getInputProps = _usePropGetters.getInputProps, getItemProps = _usePropGetters.getItemProps, getPanelProps = _usePropGetters.getPanelProps, getRootProps = _usePropGetters.getRootProps, isOpen = _usePropGetters.isOpen, setIsOpen = _usePropGetters.setIsOpen, focusInput = _usePropGetters.focusInput;
|
|
21114
21330
|
// Open panel and focus input when modal opens
|
|
21115
21331
|
React.useEffect(function() {
|
|
@@ -21162,14 +21378,14 @@
|
|
|
21162
21378
|
key: "recentSearches"
|
|
21163
21379
|
});
|
|
21164
21380
|
}
|
|
21165
|
-
|
|
21381
|
+
indicesForPanel.forEach(function(param) {
|
|
21166
21382
|
var indexId = param.indexId, indexName = param.indexName, hits = param.hits;
|
|
21167
|
-
var elementId = indexName
|
|
21168
|
-
|
|
21169
|
-
|
|
21170
|
-
|
|
21171
|
-
|
|
21172
|
-
}
|
|
21383
|
+
var elementId = indexName;
|
|
21384
|
+
if (indexName === (showQuerySuggestions === null || showQuerySuggestions === void 0 ? void 0 : showQuerySuggestions.indexName)) {
|
|
21385
|
+
elementId = 'suggestions';
|
|
21386
|
+
} else if (indexName === (showPromptSuggestions === null || showPromptSuggestions === void 0 ? void 0 : showPromptSuggestions.indexName)) {
|
|
21387
|
+
elementId = 'promptSuggestions';
|
|
21388
|
+
}
|
|
21173
21389
|
var currentIndexConfig = indicesConfig.find(function(config) {
|
|
21174
21390
|
return config.indexName === indexName;
|
|
21175
21391
|
});
|
|
@@ -21182,7 +21398,8 @@
|
|
|
21182
21398
|
HeaderComponent: currentIndexConfig.headerComponent,
|
|
21183
21399
|
// @ts-expect-error - there seems to be problems with React.ComponentType and this, but it's actually correct
|
|
21184
21400
|
ItemComponent: currentIndexConfig.itemComponent,
|
|
21185
|
-
|
|
21401
|
+
NoResultsComponent: currentIndexConfig.noResultsComponent,
|
|
21402
|
+
items: hits.map(function(item) {
|
|
21186
21403
|
return _object_spread_props(_object_spread({}, item), {
|
|
21187
21404
|
__indexName: indexId
|
|
21188
21405
|
});
|
|
@@ -21206,15 +21423,19 @@
|
|
|
21206
21423
|
});
|
|
21207
21424
|
var panelContent = /*#__PURE__*/ React.createElement(AutocompletePanel, getPanelProps(), PanelComponent ? /*#__PURE__*/ React.createElement(PanelComponent, {
|
|
21208
21425
|
elements: elements,
|
|
21209
|
-
indices:
|
|
21426
|
+
indices: indicesForPanel
|
|
21210
21427
|
}) : Object.keys(elements).map(function(elementId) {
|
|
21211
21428
|
return elements[elementId];
|
|
21212
21429
|
}));
|
|
21213
21430
|
var detachedContainerClassNames = isModalDetached ? _object_spread_props(_object_spread({}, classNames), {
|
|
21214
21431
|
detachedContainer: cx('ais-AutocompleteDetachedContainer--modal', classNames === null || classNames === void 0 ? void 0 : classNames.detachedContainer)
|
|
21215
21432
|
}) : classNames;
|
|
21433
|
+
var _getRootProps = getRootProps(), rootRef = _getRootProps.ref, rootProps = _object_without_properties(_getRootProps, [
|
|
21434
|
+
"ref"
|
|
21435
|
+
]);
|
|
21216
21436
|
if (isDetached) {
|
|
21217
|
-
return /*#__PURE__*/ React.createElement(Autocomplete, _object_spread_props(_object_spread({}, props,
|
|
21437
|
+
return /*#__PURE__*/ React.createElement(Autocomplete, _object_spread_props(_object_spread({}, props, rootProps), {
|
|
21438
|
+
rootRef: rootRef,
|
|
21218
21439
|
classNames: classNames
|
|
21219
21440
|
}), /*#__PURE__*/ React.createElement(AutocompleteDetachedSearchButton, {
|
|
21220
21441
|
query: currentRefinement || indexUiState.query || '',
|
|
@@ -21247,7 +21468,8 @@
|
|
|
21247
21468
|
}, searchBoxContent), panelContent)));
|
|
21248
21469
|
}
|
|
21249
21470
|
// Normal (non-detached) rendering
|
|
21250
|
-
return /*#__PURE__*/ React.createElement(Autocomplete, _object_spread_props(_object_spread({}, props,
|
|
21471
|
+
return /*#__PURE__*/ React.createElement(Autocomplete, _object_spread_props(_object_spread({}, props, rootProps), {
|
|
21472
|
+
rootRef: rootRef,
|
|
21251
21473
|
classNames: classNames
|
|
21252
21474
|
}), searchBoxContent, panelContent);
|
|
21253
21475
|
}
|
|
@@ -21263,6 +21485,18 @@
|
|
|
21263
21485
|
hit: item
|
|
21264
21486
|
});
|
|
21265
21487
|
}
|
|
21488
|
+
function ConditionalHighlight(param) {
|
|
21489
|
+
var item = param.item, _param_attribute = param.attribute, attribute = _param_attribute === void 0 ? 'query' : _param_attribute;
|
|
21490
|
+
var _item__highlightResult;
|
|
21491
|
+
if (!((_item__highlightResult = item._highlightResult) === null || _item__highlightResult === void 0 ? void 0 : _item__highlightResult[attribute]) || // @ts-expect-error - we should not have matchLevel as arrays here
|
|
21492
|
+
item._highlightResult[attribute].matchLevel === 'none') {
|
|
21493
|
+
return /*#__PURE__*/ React.createElement(React.Fragment, null, item[attribute]);
|
|
21494
|
+
}
|
|
21495
|
+
return /*#__PURE__*/ React.createElement(Highlight, {
|
|
21496
|
+
attribute: attribute,
|
|
21497
|
+
hit: item
|
|
21498
|
+
});
|
|
21499
|
+
}
|
|
21266
21500
|
|
|
21267
21501
|
function isModifierClick(event) {
|
|
21268
21502
|
var isMiddleClick = event.button === 1;
|
|
@@ -21498,7 +21732,7 @@
|
|
|
21498
21732
|
]);
|
|
21499
21733
|
var promptTranslations = translations.prompt, headerTranslations = translations.header, messageTranslations = translations.message, messagesTranslations = translations.messages;
|
|
21500
21734
|
var _useInstantSearch = useInstantSearch(), indexUiState = _useInstantSearch.indexUiState, setIndexUiState = _useInstantSearch.setIndexUiState;
|
|
21501
|
-
var
|
|
21735
|
+
var _useState = _sliced_to_array(React.useState(false), 2), maximized = _useState[0], setMaximized = _useState[1];
|
|
21502
21736
|
var promptRef = React.useRef(null);
|
|
21503
21737
|
var _useStickToBottom = useStickToBottom({
|
|
21504
21738
|
initial: 'smooth',
|
|
@@ -21516,6 +21750,19 @@
|
|
|
21516
21750
|
tools: tools
|
|
21517
21751
|
}));
|
|
21518
21752
|
var messages = chatState.messages, sendMessage = chatState.sendMessage, status = chatState.status, regenerate = chatState.regenerate, stop = chatState.stop, error = chatState.error, input = chatState.input, setInput = chatState.setInput, open = chatState.open, setOpen = chatState.setOpen, isClearing = chatState.isClearing, clearMessages = chatState.clearMessages, onClearTransitionEnd = chatState.onClearTransitionEnd, toolsFromConnector = chatState.tools, suggestions = chatState.suggestions;
|
|
21753
|
+
var wasOpenRef = React.useRef(false);
|
|
21754
|
+
React.useEffect(function() {
|
|
21755
|
+
var shouldFocusPrompt = !wasOpenRef.current && open;
|
|
21756
|
+
if (shouldFocusPrompt) {
|
|
21757
|
+
window.requestAnimationFrame(function() {
|
|
21758
|
+
var _promptRef_current;
|
|
21759
|
+
(_promptRef_current = promptRef.current) === null || _promptRef_current === void 0 ? void 0 : _promptRef_current.focus();
|
|
21760
|
+
});
|
|
21761
|
+
}
|
|
21762
|
+
wasOpenRef.current = open;
|
|
21763
|
+
}, [
|
|
21764
|
+
open
|
|
21765
|
+
]);
|
|
21519
21766
|
if (error) {
|
|
21520
21767
|
throw error;
|
|
21521
21768
|
}
|
|
@@ -21897,43 +22144,6 @@
|
|
|
21897
22144
|
}));
|
|
21898
22145
|
}
|
|
21899
22146
|
|
|
21900
|
-
function Highlight$1(_0) {
|
|
21901
|
-
var _0_classNames = _0.classNames, classNames = _0_classNames === void 0 ? {} : _0_classNames, props = _object_without_properties(_0, [
|
|
21902
|
-
"classNames"
|
|
21903
|
-
]);
|
|
21904
|
-
return /*#__PURE__*/ React.createElement(InternalHighlight, _object_spread({
|
|
21905
|
-
classNames: {
|
|
21906
|
-
root: cx('ais-Highlight', classNames.root),
|
|
21907
|
-
highlighted: cx('ais-Highlight-highlighted', classNames.highlighted),
|
|
21908
|
-
nonHighlighted: cx('ais-Highlight-nonHighlighted', classNames.nonHighlighted),
|
|
21909
|
-
separator: cx('ais-Highlight-separator', classNames.separator)
|
|
21910
|
-
}
|
|
21911
|
-
}, props));
|
|
21912
|
-
}
|
|
21913
|
-
|
|
21914
|
-
function Highlight(_0) {
|
|
21915
|
-
var hit = _0.hit, attribute = _0.attribute, highlightedTagName = _0.highlightedTagName, nonHighlightedTagName = _0.nonHighlightedTagName, separator = _0.separator, props = _object_without_properties(_0, [
|
|
21916
|
-
"hit",
|
|
21917
|
-
"attribute",
|
|
21918
|
-
"highlightedTagName",
|
|
21919
|
-
"nonHighlightedTagName",
|
|
21920
|
-
"separator"
|
|
21921
|
-
]);
|
|
21922
|
-
var property = getPropertyByPath(hit._highlightResult, attribute) || [];
|
|
21923
|
-
var properties = Array.isArray(property) ? property : [
|
|
21924
|
-
property
|
|
21925
|
-
];
|
|
21926
|
-
var parts = properties.map(function(singleValue) {
|
|
21927
|
-
return getHighlightedParts(unescape$1(singleValue.value || ''));
|
|
21928
|
-
});
|
|
21929
|
-
return /*#__PURE__*/ React.createElement(Highlight$1, _object_spread_props(_object_spread({}, props), {
|
|
21930
|
-
parts: parts,
|
|
21931
|
-
highlightedTagName: highlightedTagName,
|
|
21932
|
-
nonHighlightedTagName: nonHighlightedTagName,
|
|
21933
|
-
separator: separator
|
|
21934
|
-
}));
|
|
21935
|
-
}
|
|
21936
|
-
|
|
21937
22147
|
// @MAJOR: Move default hit component back to the UI library
|
|
21938
22148
|
// once flavour specificities are erased
|
|
21939
22149
|
function DefaultHitComponent$1(param) {
|