@depict-ai/ui 1.4.4 → 1.4.5
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/ES10/index.cjs +1041 -220
- package/ES10/index.d.ts +105 -24
- package/ES10/index.js +1041 -220
- package/latest/index.cjs +939 -188
- package/latest/index.d.ts +105 -24
- package/latest/index.js +939 -188
- package/locales/ES10/index.cjs +128 -26
- package/locales/ES10/index.d.ts +4 -1
- package/locales/ES10/index.js +128 -26
- package/locales/latest/index.cjs +128 -26
- package/locales/latest/index.d.ts +4 -1
- package/locales/latest/index.js +128 -26
- package/package.json +4 -4
- package/server/ES10/index.cjs +876 -148
- package/server/ES10/index.d.ts +105 -24
- package/server/ES10/index.js +876 -148
- package/server/latest/index.cjs +783 -122
- package/server/latest/index.d.ts +105 -24
- package/server/latest/index.js +783 -122
package/ES10/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import $8tj43$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/def
|
|
|
8
8
|
/*! Depict.ai search and product listing SDK */
|
|
9
9
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
10
10
|
register_es_version("ui", "ES10");
|
|
11
|
-
const $8db9a15135765c11$export$83d89fbfd8236492 = "1.4.
|
|
11
|
+
const $8db9a15135765c11$export$83d89fbfd8236492 = "1.4.5";
|
|
12
12
|
function $8e8b179489080711$export$5bad61ecde080b1f() {
|
|
13
13
|
const {
|
|
14
14
|
collapse: collapse,
|
|
@@ -686,7 +686,7 @@ function $4711a82d08d2021b$export$fecbb157621501bd(_ref) {
|
|
|
686
686
|
}
|
|
687
687
|
(0, $8tj43$delegateEvents)(["click"]);
|
|
688
688
|
const $6b73914551534ea8$var$_tmpl$ = /*#__PURE__*/(0, $8tj43$template)(`<span class="count"></span>`, 2),
|
|
689
|
-
$6b73914551534ea8$var$_tmpl$2 = /*#__PURE__*/(0, $8tj43$template)(`<label class="input-row"><div class="left"><input type="checkbox"><span class="custom-indicator"></span><span class="text"></span></div><!#><!/></label>`, 11);
|
|
689
|
+
$6b73914551534ea8$var$_tmpl$2 = /*#__PURE__*/(0, $8tj43$template)(`<label class="input-row"><div class="left"><input type="checkbox"><span class="custom-indicator"></span><span class="text line-clamp"></span></div><!#><!/></label>`, 11);
|
|
690
690
|
const $6b73914551534ea8$export$48513f6b9f8ce62d = props => {
|
|
691
691
|
// It seems like there's no diffing without memos here (since we often just have computations in the getters above that update to the same result often because their dependencies change with unrelated changes often), so put memos here to avoid unneeded DOM changes
|
|
692
692
|
const count = (0, $8tj43$createMemo)(() => props.count_);
|
|
@@ -2808,9 +2808,14 @@ function $63f1f8dbcd07d3b0$var$ActualSolidLayout(props, container_element) {
|
|
|
2808
2808
|
// Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
|
|
2809
2809
|
const show_all_rows = (0, $8tj43$createMemo)(() => props.rows === "all");
|
|
2810
2810
|
const rows_or_empty_object = (0, $8tj43$createMemo)(() => show_all_rows() ? {} : props.rows);
|
|
2811
|
-
const
|
|
2812
|
-
const
|
|
2813
|
-
|
|
2811
|
+
const view_more_button_elements = (0, $cb64b315b25cfc59$export$2f0cbfbb4354bb52)((0, $8tj43$createMemo)(() => rows_or_empty_object().button));
|
|
2812
|
+
const view_less_button_elements = (0, $cb64b315b25cfc59$export$2f0cbfbb4354bb52)((0, $8tj43$createMemo)(() => rows_or_empty_object().view_less_button));
|
|
2813
|
+
const have_a_view_more_button = (0, $8tj43$createMemo)(() => {
|
|
2814
|
+
const button = view_more_button_elements();
|
|
2815
|
+
return !(!button || Array.isArray(button) && !button.length);
|
|
2816
|
+
});
|
|
2817
|
+
const have_a_view_less_button = (0, $8tj43$createMemo)(() => {
|
|
2818
|
+
const button = view_less_button_elements();
|
|
2814
2819
|
return !(!button || Array.isArray(button) && !button.length);
|
|
2815
2820
|
});
|
|
2816
2821
|
const [get_styling, set_styling] = (0, $8tj43$createSignal)();
|
|
@@ -2819,22 +2824,38 @@ function $63f1f8dbcd07d3b0$var$ActualSolidLayout(props, container_element) {
|
|
|
2819
2824
|
const [get_children_count, set_children_count] = (0, $8tj43$createSignal)(0);
|
|
2820
2825
|
const update_children_count = () => set_children_count(container_element.children.length);
|
|
2821
2826
|
const col_styling = (0, $8tj43$createMemo)(() => (0, $8tj43$n_col_styling_with_dist)(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
|
|
2822
|
-
const default_currently_visible_signal = (0, $8tj43$createSignal)(0)
|
|
2827
|
+
const default_currently_visible_signal = (0, $8tj43$createSignal)((0, $8tj43$untrack)(() => {
|
|
2828
|
+
var _rows_or_empty_object;
|
|
2829
|
+
return (_rows_or_empty_object = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object !== void 0 ? _rows_or_empty_object : 1;
|
|
2830
|
+
})); // Keep this signal here, so it doesn't change when rows_or_empty_object and I think it's to be expected that the "internal default signal" stays the same
|
|
2823
2831
|
const rows_visible_signal = (0, $8tj43$createMemo)(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
|
|
2824
2832
|
const get_rows_visible = (0, $8tj43$createMemo)(() => rows_visible_signal()[0]());
|
|
2825
2833
|
const set_rows_visible = (0, $8tj43$createMemo)(() => rows_visible_signal()[1]);
|
|
2826
|
-
const
|
|
2827
|
-
const
|
|
2834
|
+
const view_more_button_class = (0, $8tj43$make_random_classname)();
|
|
2835
|
+
const view_less_button_class = (0, $8tj43$make_random_classname)();
|
|
2836
|
+
const view_more_button_container = (0, $8tj43$createMemo)(() => have_a_view_more_button() && (() => {
|
|
2828
2837
|
const _el$2 = (0, $8tj43$getNextElement)($63f1f8dbcd07d3b0$var$_tmpl$);
|
|
2829
2838
|
(0, $8tj43$addEventListener)(_el$2, "click", (0, $8tj43$catchify)(() => set_rows_visible()(prev => {
|
|
2830
|
-
var
|
|
2831
|
-
return prev + ((
|
|
2839
|
+
var _rows_or_empty_object2;
|
|
2840
|
+
return prev + ((_rows_or_empty_object2 = rows_or_empty_object().rows_per_click) !== null && _rows_or_empty_object2 !== void 0 ? _rows_or_empty_object2 : 1);
|
|
2832
2841
|
})), true);
|
|
2833
|
-
(0, $8tj43$className)(_el$2, "load-more-container "
|
|
2842
|
+
(0, $8tj43$className)(_el$2, "load-more-container ".concat(view_more_button_class));
|
|
2834
2843
|
(0, $8tj43$insert)(_el$2, () => rows_or_empty_object().button);
|
|
2835
2844
|
(0, $8tj43$runHydrationEvents)();
|
|
2836
2845
|
return _el$2;
|
|
2837
2846
|
})());
|
|
2847
|
+
// We need to have duplicate buttons because which ones is shown depends on the number of rows visible and therefore on the viewport size and therefore on the css media queries
|
|
2848
|
+
const view_less_button_container = (0, $8tj43$createMemo)(() => have_a_view_less_button() && (() => {
|
|
2849
|
+
const _el$3 = (0, $8tj43$getNextElement)($63f1f8dbcd07d3b0$var$_tmpl$);
|
|
2850
|
+
(0, $8tj43$addEventListener)(_el$3, "click", (0, $8tj43$catchify)(() => set_rows_visible()(() => {
|
|
2851
|
+
var _rows_or_empty_object3;
|
|
2852
|
+
return (_rows_or_empty_object3 = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object3 !== void 0 ? _rows_or_empty_object3 : 1;
|
|
2853
|
+
})), true);
|
|
2854
|
+
(0, $8tj43$className)(_el$3, "load-less-container ".concat(view_less_button_class));
|
|
2855
|
+
(0, $8tj43$insert)(_el$3, () => rows_or_empty_object().view_less_button);
|
|
2856
|
+
(0, $8tj43$runHydrationEvents)();
|
|
2857
|
+
return _el$3;
|
|
2858
|
+
})());
|
|
2838
2859
|
container_element.classList.add(container_class);
|
|
2839
2860
|
(0, $8tj43$createComputed)(() => {
|
|
2840
2861
|
// Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
|
|
@@ -2849,10 +2870,6 @@ function $63f1f8dbcd07d3b0$var$ActualSolidLayout(props, container_element) {
|
|
|
2849
2870
|
set_styling(() => col_styling);
|
|
2850
2871
|
return;
|
|
2851
2872
|
}
|
|
2852
|
-
(0, $8tj43$untrack)(() => {
|
|
2853
|
-
var _rows_or_empty_object2;
|
|
2854
|
-
return set_rows_visible()((_rows_or_empty_object2 = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object2 !== void 0 ? _rows_or_empty_object2 : 1);
|
|
2855
|
-
});
|
|
2856
2873
|
update_children_count();
|
|
2857
2874
|
const mutation_observer = new MutationObserver((0, $8tj43$catchify)(update_children_count));
|
|
2858
2875
|
mutation_observer.observe(container_element, {
|
|
@@ -2864,33 +2881,36 @@ function $63f1f8dbcd07d3b0$var$ActualSolidLayout(props, container_element) {
|
|
|
2864
2881
|
() => (0, $8tj43$createMemo)(() => {
|
|
2865
2882
|
const {
|
|
2866
2883
|
rows_per_click: rows_per_click,
|
|
2867
|
-
max_rows = -1
|
|
2884
|
+
max_rows = -1,
|
|
2885
|
+
start_rows: start_rows
|
|
2868
2886
|
} = rows_or_empty_object();
|
|
2869
2887
|
const rows_visible = get_rows_visible();
|
|
2870
2888
|
const children_count = get_children_count();
|
|
2871
2889
|
return col_styling() + props.cols_at_size.map(options => {
|
|
2872
|
-
const [, min, max] = options;
|
|
2873
|
-
let
|
|
2890
|
+
const [recs_per_row, min, max] = options;
|
|
2891
|
+
let should_hide_view_more_button;
|
|
2874
2892
|
let visible_recs;
|
|
2875
2893
|
if (props.disable_partial_rows) {
|
|
2876
2894
|
visible_recs = (0, $8tj43$layout_get_visible_recs_without_partial_rows)(rows_visible, children_count, options);
|
|
2877
2895
|
const visible_recs_next_show_more = (0, $8tj43$layout_get_visible_recs_without_partial_rows)(rows_visible + (rows_per_click || 0),
|
|
2878
2896
|
// Should this really be zero when we default rows_per_click to 1?
|
|
2879
2897
|
children_count, options);
|
|
2880
|
-
|
|
2898
|
+
should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
|
|
2881
2899
|
} else {
|
|
2882
2900
|
visible_recs = (0, $8tj43$layout_get_total_rec_amount_for_row)(rows_visible, options);
|
|
2883
|
-
|
|
2901
|
+
should_hide_view_more_button = visible_recs >= children_count;
|
|
2884
2902
|
}
|
|
2885
|
-
const should_hide_button_final =
|
|
2886
|
-
|
|
2903
|
+
const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
|
|
2904
|
+
// I don't really understand the logic for when the view more button gets hidden so IDK if below is correct, but it works how it should for now
|
|
2905
|
+
const should_hide_view_less_button = !should_hide_view_more_button || start_rows == undefined || rows_visible <= start_rows || children_count <= recs_per_row * start_rows;
|
|
2906
|
+
return "".concat((0, $8tj43$layout_media_query_header)(min, max), "{").concat(selector_beginning, ":nth-child(n+").concat(visible_recs + 1, "){display:none}").concat(props.layout == "slider" ? "".concat(selector_beginning, ":nth-child(n+").concat(visible_recs, "){margin-right:0}") : "").concat(should_hide_button_final ? ".depict .".concat(view_more_button_class, "{display:none!important}") : "").concat(should_hide_view_less_button ? ".depict .".concat(view_less_button_class, "{display:none!important}") : "", "}");
|
|
2887
2907
|
}).join("");
|
|
2888
2908
|
}));
|
|
2889
2909
|
});
|
|
2890
|
-
return [container_element, (0, $8tj43$memo)(
|
|
2891
|
-
const _el$
|
|
2892
|
-
(0, $8tj43$insert)(_el$
|
|
2893
|
-
return _el$
|
|
2910
|
+
return [container_element, (0, $8tj43$memo)(view_more_button_container), (0, $8tj43$memo)(view_less_button_container), (() => {
|
|
2911
|
+
const _el$4 = (0, $8tj43$getNextElement)($63f1f8dbcd07d3b0$var$_tmpl$2);
|
|
2912
|
+
(0, $8tj43$insert)(_el$4, get_styling);
|
|
2913
|
+
return _el$4;
|
|
2894
2914
|
})()];
|
|
2895
2915
|
}
|
|
2896
2916
|
(0, $8tj43$delegateEvents)(["click"]);
|
|
@@ -3084,16 +3104,17 @@ var $284849364a6ef73a$var$_get_user_id = /*#__PURE__*/new WeakMap();
|
|
|
3084
3104
|
var $284849364a6ef73a$var$_get_session_id = /*#__PURE__*/new WeakMap();
|
|
3085
3105
|
var $284849364a6ef73a$var$_guard_url_creator_length = /*#__PURE__*/new WeakSet();
|
|
3086
3106
|
var $284849364a6ef73a$var$_run_url_creator_for_suggest = /*#__PURE__*/new WeakSet();
|
|
3087
|
-
var $284849364a6ef73a$var$
|
|
3107
|
+
var $284849364a6ef73a$var$_run_display_transformers_for_rest = /*#__PURE__*/new WeakSet();
|
|
3088
3108
|
var $284849364a6ef73a$var$_cached_post_request = /*#__PURE__*/new WeakSet();
|
|
3089
3109
|
class $284849364a6ef73a$export$e015ed2f2950f2e3 {
|
|
3090
3110
|
constructor(options) {
|
|
3091
3111
|
$284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_cached_post_request);
|
|
3092
|
-
$284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$
|
|
3112
|
+
$284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_run_display_transformers_for_rest);
|
|
3093
3113
|
$284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_run_url_creator_for_suggest);
|
|
3094
3114
|
$284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_guard_url_creator_length);
|
|
3095
3115
|
$284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_get_cache_obj_for_endpoint);
|
|
3096
3116
|
(0, $8tj43$babelruntimehelpersdefineProperty)(this, "page_url_creator", void 0);
|
|
3117
|
+
(0, $8tj43$babelruntimehelpersdefineProperty)(this, "display_transformers", void 0);
|
|
3097
3118
|
$284849364a6ef73a$var$_classPrivateFieldInitSpec(this, $284849364a6ef73a$var$_supports_finalization_registry, {
|
|
3098
3119
|
writable: true,
|
|
3099
3120
|
value: typeof FinalizationRegistry === "function"
|
|
@@ -3132,12 +3153,14 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
|
|
|
3132
3153
|
get_metadata: get_metadata,
|
|
3133
3154
|
get_user_id: _get_user_id2,
|
|
3134
3155
|
get_session_id: _get_session_id2,
|
|
3135
|
-
page_url_creator:
|
|
3156
|
+
page_url_creator: _page_url_creator,
|
|
3157
|
+
display_transformers: _display_transformers
|
|
3136
3158
|
} = options !== null && options !== void 0 ? options : {};
|
|
3137
3159
|
(0, $8tj43$babelruntimehelpersclassPrivateFieldSet)(this, $284849364a6ef73a$var$_get_metadata, get_metadata);
|
|
3138
3160
|
(0, $8tj43$babelruntimehelpersclassPrivateFieldSet)(this, $284849364a6ef73a$var$_get_user_id, _get_user_id2);
|
|
3139
3161
|
(0, $8tj43$babelruntimehelpersclassPrivateFieldSet)(this, $284849364a6ef73a$var$_get_session_id, _get_session_id2);
|
|
3140
|
-
this.page_url_creator =
|
|
3162
|
+
this.page_url_creator = _page_url_creator;
|
|
3163
|
+
this.display_transformers = _display_transformers;
|
|
3141
3164
|
}
|
|
3142
3165
|
async suggest(input_req) {
|
|
3143
3166
|
var _classPrivateFieldGet4;
|
|
@@ -3214,14 +3237,19 @@ function $284849364a6ef73a$var$_guard_url_creator_length2(expected, received) {
|
|
|
3214
3237
|
}
|
|
3215
3238
|
}
|
|
3216
3239
|
async function $284849364a6ef73a$var$_run_url_creator_for_suggest2(merchant, market, response) {
|
|
3217
|
-
|
|
3240
|
+
var _this$display_transfo;
|
|
3241
|
+
const page_url_creator = this.page_url_creator;
|
|
3242
|
+
const category_transformer = (_this$display_transfo = this.display_transformers) === null || _this$display_transfo === void 0 ? void 0 : _this$display_transfo.categories;
|
|
3243
|
+
if (!page_url_creator && !category_transformer) return response;
|
|
3218
3244
|
// find category suggestions, run thing with them, and then replace them
|
|
3219
3245
|
const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "category");
|
|
3220
|
-
const page_urls = await
|
|
3221
|
-
type: "categories",
|
|
3246
|
+
const page_urls = await (page_url_creator || category_transformer)({
|
|
3222
3247
|
market: market,
|
|
3223
3248
|
merchant: merchant,
|
|
3224
|
-
data: [...category_suggestions]
|
|
3249
|
+
data: [...category_suggestions],
|
|
3250
|
+
...(page_url_creator ? {
|
|
3251
|
+
type: "categories"
|
|
3252
|
+
} : {})
|
|
3225
3253
|
});
|
|
3226
3254
|
$284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_guard_url_creator_length, $284849364a6ef73a$var$_guard_url_creator_length2).call(this, category_suggestions, page_urls);
|
|
3227
3255
|
while (page_urls.length)
|
|
@@ -3229,17 +3257,29 @@ async function $284849364a6ef73a$var$_run_url_creator_for_suggest2(merchant, mar
|
|
|
3229
3257
|
Object.defineProperties(category_suggestions.pop(), Object.getOwnPropertyDescriptors(page_urls.pop()));
|
|
3230
3258
|
return response;
|
|
3231
3259
|
}
|
|
3232
|
-
async function $284849364a6ef73a$var$
|
|
3233
|
-
|
|
3260
|
+
async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchant, market, input_data) {
|
|
3261
|
+
const {
|
|
3262
|
+
page_url_creator: page_url_creator,
|
|
3263
|
+
display_transformers: display_transformers
|
|
3264
|
+
} = this;
|
|
3265
|
+
if (!page_url_creator && !display_transformers) return input_data;
|
|
3266
|
+
const product_transformer = display_transformers === null || display_transformers === void 0 ? void 0 : display_transformers.products;
|
|
3267
|
+
const category_transformer = display_transformers === null || display_transformers === void 0 ? void 0 : display_transformers.categories;
|
|
3268
|
+
const content_result_transformer = display_transformers === null || display_transformers === void 0 ? void 0 : display_transformers.contentResults;
|
|
3234
3269
|
const displays = input_data.displays;
|
|
3235
|
-
const
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3270
|
+
const {
|
|
3271
|
+
breadcrumb: breadcrumb,
|
|
3272
|
+
quick_links: quick_links,
|
|
3273
|
+
content_search_links: content_search_links
|
|
3274
|
+
} = input_data;
|
|
3275
|
+
if (displays && (page_url_creator || product_transformer)) {
|
|
3276
|
+
const page_urls = await (page_url_creator || product_transformer)({
|
|
3240
3277
|
merchant: merchant,
|
|
3241
3278
|
market: market,
|
|
3242
|
-
displays: [...input_data.displays]
|
|
3279
|
+
displays: [...input_data.displays],
|
|
3280
|
+
...(page_url_creator ? {
|
|
3281
|
+
type: "products"
|
|
3282
|
+
} : {})
|
|
3243
3283
|
});
|
|
3244
3284
|
$284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_guard_url_creator_length, $284849364a6ef73a$var$_guard_url_creator_length2).call(this, displays, page_urls);
|
|
3245
3285
|
for (let i = 0; i < displays.length; i++) {
|
|
@@ -3257,19 +3297,30 @@ async function $284849364a6ef73a$var$_run_url_creator_for_rest2(merchant, market
|
|
|
3257
3297
|
displays[i] = new_display_or_page_url;
|
|
3258
3298
|
}
|
|
3259
3299
|
}
|
|
3260
|
-
for (const category_display_array of [breadcrumb, quick_links]) {
|
|
3300
|
+
if (page_url_creator || category_transformer) for (const category_display_array of [breadcrumb, quick_links]) {
|
|
3261
3301
|
if (!category_display_array) continue;
|
|
3262
|
-
const page_urls = await
|
|
3263
|
-
type: "categories",
|
|
3302
|
+
const page_urls = await (page_url_creator || category_transformer)({
|
|
3264
3303
|
merchant: merchant,
|
|
3265
3304
|
market: market,
|
|
3266
|
-
data: [...category_display_array]
|
|
3305
|
+
data: [...category_display_array],
|
|
3306
|
+
...(page_url_creator ? {
|
|
3307
|
+
type: "categories"
|
|
3308
|
+
} : {})
|
|
3267
3309
|
});
|
|
3268
3310
|
$284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_guard_url_creator_length, $284849364a6ef73a$var$_guard_url_creator_length2).call(this, category_display_array, page_urls);
|
|
3269
3311
|
for (let i = 0; i < category_display_array.length; i++)
|
|
3270
3312
|
// Copy over getters so we sneakily can make this reactive
|
|
3271
3313
|
Object.defineProperties(category_display_array[i], Object.getOwnPropertyDescriptors(page_urls[i]));
|
|
3272
3314
|
}
|
|
3315
|
+
if (content_search_links !== null && content_search_links !== void 0 && content_search_links.length && content_result_transformer) {
|
|
3316
|
+
const result = await content_result_transformer({
|
|
3317
|
+
merchant: merchant,
|
|
3318
|
+
market: market,
|
|
3319
|
+
data: [...content_search_links]
|
|
3320
|
+
});
|
|
3321
|
+
$284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_guard_url_creator_length, $284849364a6ef73a$var$_guard_url_creator_length2).call(this, content_search_links, result);
|
|
3322
|
+
input_data.content_search_links = result;
|
|
3323
|
+
}
|
|
3273
3324
|
return input_data;
|
|
3274
3325
|
}
|
|
3275
3326
|
async function $284849364a6ef73a$var$_cached_post_request2(endpoint, input_req, fallback_response) {
|
|
@@ -3297,7 +3348,7 @@ async function $284849364a6ef73a$var$_cached_post_request2(endpoint, input_req,
|
|
|
3297
3348
|
let result;
|
|
3298
3349
|
try {
|
|
3299
3350
|
const unmodified_result = await api_response.json();
|
|
3300
|
-
result = await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$
|
|
3351
|
+
result = await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_run_display_transformers_for_rest, $284849364a6ef73a$var$_run_display_transformers_for_rest2).call(this, input_req.tenant, input_req.market, unmodified_result);
|
|
3301
3352
|
} catch (e) {
|
|
3302
3353
|
(0, $8tj43$dwarn)("URL creator or json decoding failed", e);
|
|
3303
3354
|
break return_successfully;
|
|
@@ -3387,12 +3438,11 @@ function $9b5022ae72f56399$var$correct_range_filter_range_once(_ref3) {
|
|
|
3387
3438
|
}
|
|
3388
3439
|
function $43fbdca0f726a34b$export$92f2da32c6e7e7ee(_ref) {
|
|
3389
3440
|
let {
|
|
3390
|
-
|
|
3441
|
+
number_: number_,
|
|
3391
3442
|
i18n_: i18n_
|
|
3392
3443
|
} = _ref;
|
|
3393
3444
|
return (0, $8tj43$createMemo)(() => {
|
|
3394
|
-
|
|
3395
|
-
const n_hits = (_search_results_ = search_results_()) === null || _search_results_ === void 0 ? void 0 : _search_results_.n_hits;
|
|
3445
|
+
const n_hits = number_();
|
|
3396
3446
|
if (isNaN(n_hits)) return "";
|
|
3397
3447
|
const price_formatting = i18n_.price_formatting_();
|
|
3398
3448
|
return (0, $8tj43$standard_price_format)(n_hits, 0,
|
|
@@ -6027,7 +6077,10 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
6027
6077
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $8tj43$createSignal)(false);
|
|
6028
6078
|
const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $8tj43$createSignal)();
|
|
6029
6079
|
const formatted_number_of_results_ = (0, $43fbdca0f726a34b$export$92f2da32c6e7e7ee)({
|
|
6030
|
-
|
|
6080
|
+
number_: (0, $8tj43$createMemo)(() => {
|
|
6081
|
+
var _plp_results_5;
|
|
6082
|
+
return (_plp_results_5 = plp_results_()) === null || _plp_results_5 === void 0 ? void 0 : _plp_results_5.n_hits;
|
|
6083
|
+
}),
|
|
6031
6084
|
i18n_: i18n_
|
|
6032
6085
|
});
|
|
6033
6086
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $8tj43$createSignal)();
|
|
@@ -6058,8 +6111,8 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
6058
6111
|
}), _el$4, _co$);
|
|
6059
6112
|
(0, $8tj43$insert)(_el$, (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
6060
6113
|
get when() {
|
|
6061
|
-
var
|
|
6062
|
-
return ((
|
|
6114
|
+
var _plp_results_6;
|
|
6115
|
+
return ((_plp_results_6 = plp_results_()) === null || _plp_results_6 === void 0 ? void 0 : _plp_results_6.n_hits) === 1;
|
|
6063
6116
|
},
|
|
6064
6117
|
get fallback() {
|
|
6065
6118
|
return i18n_.products_();
|
|
@@ -6278,8 +6331,8 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
|
|
|
6278
6331
|
formatted_number_of_results_: formatted_number_of_results_,
|
|
6279
6332
|
i18n_: i18n_,
|
|
6280
6333
|
number_of_results_: (0, $8tj43$createMemo)(() => {
|
|
6281
|
-
var
|
|
6282
|
-
return (
|
|
6334
|
+
var _plp_results_7;
|
|
6335
|
+
return (_plp_results_7 = plp_results_()) === null || _plp_results_7 === void 0 ? void 0 : _plp_results_7.n_hits;
|
|
6283
6336
|
})
|
|
6284
6337
|
});
|
|
6285
6338
|
}
|
|
@@ -6674,7 +6727,6 @@ function $f5f54892fd0c7d9f$var$_classApplyDescriptorGet(receiver, descriptor) {
|
|
|
6674
6727
|
return descriptor.value;
|
|
6675
6728
|
}
|
|
6676
6729
|
// We just pass page_url_creator to DepictAPI when we instantiate it, so don't allow it to be specified if api is already specified
|
|
6677
|
-
// on old displays, no page_url_creator can be specified
|
|
6678
6730
|
/**
|
|
6679
6731
|
* Type for the private properties that are shared between the different exported search SDK wrapper functions.
|
|
6680
6732
|
* SDK users are not allowed to change/access these, they're an internal implementation detail.
|
|
@@ -6742,6 +6794,7 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
|
|
|
6742
6794
|
api: api,
|
|
6743
6795
|
on_navigation: on_navigation,
|
|
6744
6796
|
page_url_creator: page_url_creator,
|
|
6797
|
+
display_transformers: display_transformers,
|
|
6745
6798
|
unique_instance_key_for_state = "",
|
|
6746
6799
|
query_id_state_key: query_id_state_key,
|
|
6747
6800
|
...props_on_class
|
|
@@ -6810,8 +6863,10 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
|
|
|
6810
6863
|
quicklinks_signal_: (0, $8tj43$createSignal)(),
|
|
6811
6864
|
i18n_: i18n_,
|
|
6812
6865
|
reset_history_state_: reset_history_state_,
|
|
6866
|
+
// @ts-ignore
|
|
6813
6867
|
depict_api_: api !== null && api !== void 0 ? api : new (0, $284849364a6ef73a$export$e015ed2f2950f2e3)({
|
|
6814
|
-
page_url_creator: page_url_creator
|
|
6868
|
+
page_url_creator: page_url_creator,
|
|
6869
|
+
display_transformers: display_transformers
|
|
6815
6870
|
}),
|
|
6816
6871
|
router_: (0, $8tj43$babelruntimehelpersclassPrivateFieldGet)(this, $f5f54892fd0c7d9f$var$_router),
|
|
6817
6872
|
selected_filters_: selected_filters_,
|
|
@@ -7466,13 +7521,12 @@ function $8ef6232475d44150$export$7de92c4c2205ebf3(_ref) {
|
|
|
7466
7521
|
});
|
|
7467
7522
|
}
|
|
7468
7523
|
function $8ef6232475d44150$var$make_state_saved_rows(_ref3, i18n_) {
|
|
7469
|
-
var _untrack;
|
|
7470
7524
|
let [get_showing_recommendation_rows, set_showing_recommendation_rows] = _ref3;
|
|
7471
|
-
const currently_visible = (0, $8tj43$createSignal)(0);
|
|
7525
|
+
const currently_visible = (0, $8tj43$createSignal)((0, $8tj43$untrack)(get_showing_recommendation_rows));
|
|
7472
7526
|
const [get_currently_visible, set_currently_visible] = currently_visible;
|
|
7473
7527
|
const rows = {
|
|
7474
7528
|
currently_visible: currently_visible,
|
|
7475
|
-
start_rows:
|
|
7529
|
+
start_rows: $8ef6232475d44150$export$1c8c715550dc689d,
|
|
7476
7530
|
rows_per_click: 3,
|
|
7477
7531
|
button: (() => {
|
|
7478
7532
|
const _el$7 = (0, $8tj43$getNextElement)($8ef6232475d44150$var$_tmpl$2);
|
|
@@ -7645,7 +7699,7 @@ const $b65f93acbf91da56$export$27b710c08412a7ad = obj => {
|
|
|
7645
7699
|
return Object.fromEntries(Object.keys(obj).map(key => [key, obj[key]()]));
|
|
7646
7700
|
};
|
|
7647
7701
|
const $9a693c7e832d3f18$var$_tmpl$ = /*#__PURE__*/(0, $8tj43$template)(`<span class="orig price"><!#><!/><!#><!/><!#><!/></span>`, 8),
|
|
7648
|
-
$9a693c7e832d3f18$var$_tmpl$2 = /*#__PURE__*/(0, $8tj43$template)(`<a class="instant-card"><div class="img-part"></div><div class="right-part"><div class="title-brand-tagline"><span class="brand"></span><span class="title"></span><!#><!/></div><div class="price-container"><!#><!/><span class="price"><!#><!/><!#><!/><!#><!/></span></div></div></a>`, 26),
|
|
7702
|
+
$9a693c7e832d3f18$var$_tmpl$2 = /*#__PURE__*/(0, $8tj43$template)(`<a class="instant-card"><div class="img-part"></div><div class="right-part"><div class="title-brand-tagline"><span class="brand"></span><span class="title line-clamp"></span><!#><!/></div><div class="price-container"><!#><!/><span class="price"><!#><!/><!#><!/><!#><!/></span></div></div></a>`, 26),
|
|
7649
7703
|
$9a693c7e832d3f18$var$_tmpl$3 = /*#__PURE__*/(0, $8tj43$template)(`<div class="tagline"></div>`, 2);
|
|
7650
7704
|
const $9a693c7e832d3f18$export$b05c0ae390cf3e06 = (display_or_variant_container, _ref, router_) => {
|
|
7651
7705
|
let {
|
|
@@ -7783,9 +7837,11 @@ function $f7414b949aeabc90$export$62f101a8aa597bf8(_ref) {
|
|
|
7783
7837
|
render_instant_card_placeholder_: render_instant_card_placeholder_,
|
|
7784
7838
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
7785
7839
|
has_sort_or_filters_: has_sort_or_filters_,
|
|
7786
|
-
|
|
7840
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
7787
7841
|
i18n_: i18n_,
|
|
7788
|
-
router_: router_
|
|
7842
|
+
router_: router_,
|
|
7843
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
7844
|
+
content_search_enabled_: content_search_enabled_
|
|
7789
7845
|
} = _ref;
|
|
7790
7846
|
const max_cards = 4;
|
|
7791
7847
|
const [read_current_instant_query, write_current_instant_query] = (0, $8tj43$createSignal)("");
|
|
@@ -7810,13 +7866,23 @@ function $f7414b949aeabc90$export$62f101a8aa597bf8(_ref) {
|
|
|
7810
7866
|
...variable_data
|
|
7811
7867
|
});
|
|
7812
7868
|
}));
|
|
7813
|
-
|
|
7814
|
-
|
|
7869
|
+
// Maybe we should move this createResoure out of this component, on the other hand it bloats the parent component and if it fails it takes more than needed with it, so I think writing the content results from here is better
|
|
7870
|
+
// This is for the press-enter-to-instant-content-result feature which gets called from Autocomplete.tsx
|
|
7871
|
+
set_modal_search_results_(() => search_results);
|
|
7872
|
+
(0, $8tj43$onCleanup)(() => set_modal_search_results_(undefined)); // for consistency, in case this component crashes
|
|
7873
|
+
set_total_num_results_accessor_(() => (0, $43fbdca0f726a34b$export$92f2da32c6e7e7ee)({
|
|
7874
|
+
number_: (0, $8tj43$createMemo)(() => {
|
|
7875
|
+
var _search_results, _search_results2, _search_results2$cont;
|
|
7876
|
+
const hits = (_search_results = search_results()) === null || _search_results === void 0 ? void 0 : _search_results.n_hits;
|
|
7877
|
+
const content_results = (_search_results2 = search_results()) === null || _search_results2 === void 0 ? void 0 : (_search_results2$cont = _search_results2.content_search_links) === null || _search_results2$cont === void 0 ? void 0 : _search_results2$cont.length;
|
|
7878
|
+
if (!content_results || !content_search_enabled_()) return hits;
|
|
7879
|
+
return (hits !== null && hits !== void 0 ? hits : 0) + content_results;
|
|
7880
|
+
}),
|
|
7815
7881
|
i18n_: i18n_
|
|
7816
7882
|
}));
|
|
7817
7883
|
const sliced_displays = (0, $8tj43$createMemo)(() => {
|
|
7818
|
-
var
|
|
7819
|
-
return (
|
|
7884
|
+
var _search_results3, _search_results3$disp;
|
|
7885
|
+
return (_search_results3 = search_results()) === null || _search_results3 === void 0 ? void 0 : (_search_results3$disp = _search_results3.displays) === null || _search_results3$disp === void 0 ? void 0 : _search_results3$disp.slice(0, max_cards);
|
|
7820
7886
|
});
|
|
7821
7887
|
let placeholder;
|
|
7822
7888
|
return (() => {
|
|
@@ -7828,8 +7894,8 @@ function $f7414b949aeabc90$export$62f101a8aa597bf8(_ref) {
|
|
|
7828
7894
|
},
|
|
7829
7895
|
get fallback() {
|
|
7830
7896
|
return (0, $8tj43$createMemo)(() => {
|
|
7831
|
-
var
|
|
7832
|
-
if (Array.isArray((
|
|
7897
|
+
var _search_results4;
|
|
7898
|
+
if (Array.isArray((_search_results4 = search_results()) === null || _search_results4 === void 0 ? void 0 : _search_results4.displays))
|
|
7833
7899
|
// remove placeholders if we have a response but no results
|
|
7834
7900
|
return undefined;
|
|
7835
7901
|
return new Array(max_cards).fill(1).map(() => (placeholder || (placeholder = render_instant_card_placeholder_())).cloneNode(true));
|
|
@@ -7917,7 +7983,7 @@ function $6d95ef50ee01d5a1$export$5d2caaa6b530761c() {
|
|
|
7917
7983
|
return (0, $8tj43$getNextElement)($6d95ef50ee01d5a1$var$_tmpl$);
|
|
7918
7984
|
}
|
|
7919
7985
|
const $494c9ad553139dbc$var$_tmpl$ = /*#__PURE__*/(0, $8tj43$template)(`<div class="previous-searches"><h2 class="text"></h2><div class="list"></div></div>`, 6),
|
|
7920
|
-
$494c9ad553139dbc$var$_tmpl$2 = /*#__PURE__*/(0, $8tj43$template)(`<a class="item"><div class="left"><!#><!/><span></span></div><button class="delete"></button></a>`, 10);
|
|
7986
|
+
$494c9ad553139dbc$var$_tmpl$2 = /*#__PURE__*/(0, $8tj43$template)(`<a class="item"><div class="left"><!#><!/><span class="line-clamp"></span></div><button class="delete"></button></a>`, 10);
|
|
7921
7987
|
function $494c9ad553139dbc$export$a146ac6fa8346a25(_ref) {
|
|
7922
7988
|
let {
|
|
7923
7989
|
text_: text_,
|
|
@@ -8003,15 +8069,18 @@ function $494c9ad553139dbc$export$a146ac6fa8346a25(_ref) {
|
|
|
8003
8069
|
return ((_read_selected_index_ = read_selected_index_()) === null || _read_selected_index_ === void 0 ? void 0 : _read_selected_index_[0]) === 0 && ((_read_selected_index_2 = read_selected_index_()) === null || _read_selected_index_2 === void 0 ? void 0 : _read_selected_index_2[1]) === index;
|
|
8004
8070
|
})(),
|
|
8005
8071
|
_v$2 = href(),
|
|
8006
|
-
_v$3 =
|
|
8072
|
+
_v$3 = item(),
|
|
8073
|
+
_v$4 = i18n_.previous_searches_delete_entry_from_history_();
|
|
8007
8074
|
_v$ !== _p$._v$ && _el$4.classList.toggle("selected", _p$._v$ = _v$);
|
|
8008
8075
|
_v$2 !== _p$._v$2 && (0, $8tj43$setAttribute)(_el$4, "href", _p$._v$2 = _v$2);
|
|
8009
|
-
_v$3 !== _p$._v$3 && (0, $8tj43$setAttribute)(_el$
|
|
8076
|
+
_v$3 !== _p$._v$3 && (0, $8tj43$setAttribute)(_el$6, "title", _p$._v$3 = _v$3);
|
|
8077
|
+
_v$4 !== _p$._v$4 && (0, $8tj43$setAttribute)(_el$9, "title", _p$._v$4 = _v$4);
|
|
8010
8078
|
return _p$;
|
|
8011
8079
|
}, {
|
|
8012
8080
|
_v$: undefined,
|
|
8013
8081
|
_v$2: undefined,
|
|
8014
|
-
_v$3: undefined
|
|
8082
|
+
_v$3: undefined,
|
|
8083
|
+
_v$4: undefined
|
|
8015
8084
|
});
|
|
8016
8085
|
return _el$4;
|
|
8017
8086
|
})();
|
|
@@ -8081,18 +8150,38 @@ function $02b6641aa50ce528$export$ba17c5b7e6dda39f(_ref) {
|
|
|
8081
8150
|
const _el$2 = (0, $8tj43$getNextElement)($02b6641aa50ce528$var$_tmpl$2);
|
|
8082
8151
|
(0, $8tj43$className)(_el$2, class_);
|
|
8083
8152
|
(0, $8tj43$insert)(_el$2, text_itself);
|
|
8084
|
-
(0, $8tj43$effect)(
|
|
8153
|
+
(0, $8tj43$effect)(_p$ => {
|
|
8154
|
+
const _v$ = !!get_has_highlighted(),
|
|
8155
|
+
_v$2 = whole_text_to_display_memo() /* for when line-clamped, users can see full text on hover */;
|
|
8156
|
+
_v$ !== _p$._v$ && _el$2.classList.toggle("has-history-match", _p$._v$ = _v$);
|
|
8157
|
+
_v$2 !== _p$._v$2 && (0, $8tj43$setAttribute)(_el$2, "title", _p$._v$2 = _v$2);
|
|
8158
|
+
return _p$;
|
|
8159
|
+
}, {
|
|
8160
|
+
_v$: undefined,
|
|
8161
|
+
_v$2: undefined
|
|
8162
|
+
});
|
|
8085
8163
|
return _el$2;
|
|
8086
8164
|
})();
|
|
8087
8165
|
}
|
|
8166
|
+
const $3c5e15c6ee4227a9$var$_tmpl$ = /*#__PURE__*/(0, $8tj43$template)(`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 256"><path d="M56 26.455a13.71 13.71 0 0 0-9.578 3.967A13.71 13.71 0 0 0 42.455 40v176a13.71 13.71 0 0 0 3.967 9.578A13.71 13.71 0 0 0 56 229.545h144A13.71 13.71 0 0 0 213.545 216V88a2.456 2.456 0 0 1 0-.002c.001-1.452-.597-2.895-1.623-3.922l-55.998-55.998a5.61 5.61 0 0 0-3.922-1.623 2.456 2.456 0 0 1-.002 0zm0 11.09h88A2.456 2.456 0 0 1 146.455 40v48c0 2.903 2.642 5.545 5.545 5.545h48A2.456 2.456 0 0 1 202.455 96v120a2.456 2.456 0 0 1-2.455 2.455H56A2.456 2.456 0 0 1 53.545 216V40A2.456 2.456 0 0 1 56 37.545zm103.061 11.498a2.456 2.456 0 0 1 2.676.531l28.689 28.689a2.456 2.456 0 0 1-1.736 4.191H160A2.456 2.456 0 0 1 157.545 80V51.311a2.456 2.456 0 0 1 1.516-2.268zM96 130.455c-2.903 0-5.545 2.642-5.545 5.545s2.642 5.545 5.545 5.545h64c2.903 0 5.545-2.642 5.545-5.545s-2.642-5.545-5.545-5.545zm0 32c-2.903 0-5.545 2.642-5.545 5.545s2.642 5.545 5.545 5.545h64c2.903 0 5.545-2.642 5.545-5.545s-2.642-5.545-5.545-5.545z"></path></svg>`, 4);
|
|
8167
|
+
function $3c5e15c6ee4227a9$export$605674723bcc715c() {
|
|
8168
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
8169
|
+
return (() => {
|
|
8170
|
+
const _el$ = (0, $8tj43$getNextElement)($3c5e15c6ee4227a9$var$_tmpl$);
|
|
8171
|
+
(0, $8tj43$spread)(_el$, props, true, true);
|
|
8172
|
+
(0, $8tj43$runHydrationEvents)();
|
|
8173
|
+
return _el$;
|
|
8174
|
+
})();
|
|
8175
|
+
}
|
|
8088
8176
|
const $40dd3f46f55d62ba$var$_tmpl$ = /*#__PURE__*/(0, $8tj43$template)(`<a class="suggestion"></a>`, 2),
|
|
8089
8177
|
$40dd3f46f55d62ba$var$_tmpl$2 = /*#__PURE__*/(0, $8tj43$template)(`<div class="search-icon"></div>`, 2),
|
|
8090
8178
|
$40dd3f46f55d62ba$var$_tmpl$3 = /*#__PURE__*/(0, $8tj43$template)(`<span class="type"></span>`, 2),
|
|
8091
8179
|
$40dd3f46f55d62ba$var$_tmpl$4 = /*#__PURE__*/(0, $8tj43$template)(`<div><!#><!/><span class="value"></span></div>`, 6),
|
|
8092
|
-
$40dd3f46f55d62ba$var$_tmpl$5 = /*#__PURE__*/(0, $8tj43$template)(`<
|
|
8093
|
-
$40dd3f46f55d62ba$var$_tmpl$6 = /*#__PURE__*/(0, $8tj43$template)(`<
|
|
8094
|
-
$40dd3f46f55d62ba$var$_tmpl$7 = /*#__PURE__*/(0, $8tj43$template)(`<div class="suggestion-container
|
|
8095
|
-
$40dd3f46f55d62ba$var$_tmpl$8 = /*#__PURE__*/(0, $8tj43$template)(`<div class="
|
|
8180
|
+
$40dd3f46f55d62ba$var$_tmpl$5 = /*#__PURE__*/(0, $8tj43$template)(`<div class="with-icon"><!#><!/><!#><!/></div>`, 6),
|
|
8181
|
+
$40dd3f46f55d62ba$var$_tmpl$6 = /*#__PURE__*/(0, $8tj43$template)(`<h2 class="text"></h2>`, 2),
|
|
8182
|
+
$40dd3f46f55d62ba$var$_tmpl$7 = /*#__PURE__*/(0, $8tj43$template)(`<div class="suggestion-container query"><!#><!/><!#><!/></div>`, 6),
|
|
8183
|
+
$40dd3f46f55d62ba$var$_tmpl$8 = /*#__PURE__*/(0, $8tj43$template)(`<div class="suggestion-container page"></div>`, 2),
|
|
8184
|
+
$40dd3f46f55d62ba$var$_tmpl$9 = /*#__PURE__*/(0, $8tj43$template)(`<div class="suggestions"><!#><!/><!#><!/><!#><!/></div>`, 8);
|
|
8096
8185
|
function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
8097
8186
|
let {
|
|
8098
8187
|
suggestion_memo_: suggestion_memo_,
|
|
@@ -8106,7 +8195,8 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
8106
8195
|
include_category_suggestions_: include_category_suggestions_,
|
|
8107
8196
|
searching_for_value_: searching_for_value_,
|
|
8108
8197
|
router_: router_,
|
|
8109
|
-
submit_query_: submit_query_
|
|
8198
|
+
submit_query_: submit_query_,
|
|
8199
|
+
get_content_results_: get_content_results_
|
|
8110
8200
|
} = _ref;
|
|
8111
8201
|
const queries_memo = (0, $8tj43$createMemo)(() => suggestion_memo_().filter(_ref2 => {
|
|
8112
8202
|
let {
|
|
@@ -8117,12 +8207,18 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
8117
8207
|
} // don't show the ones we already show from the history
|
|
8118
8208
|
));
|
|
8119
8209
|
|
|
8120
|
-
const not_queries_memo = (0, $8tj43$createMemo)(() =>
|
|
8121
|
-
|
|
8122
|
-
|
|
8123
|
-
|
|
8124
|
-
|
|
8125
|
-
|
|
8210
|
+
const not_queries_memo = (0, $8tj43$createMemo)(() => {
|
|
8211
|
+
// For the section that shows categories and content results
|
|
8212
|
+
// We want to limit to 3 items, and we want to show the categories first
|
|
8213
|
+
const content_results = get_content_results_() || [];
|
|
8214
|
+
const from_suggest_request = include_category_suggestions_ ? suggestion_memo_().filter(_ref3 => {
|
|
8215
|
+
let {
|
|
8216
|
+
type: type
|
|
8217
|
+
} = _ref3;
|
|
8218
|
+
return type !== (0, $7cd4d275a9f8d600$export$3cf9497e790da491);
|
|
8219
|
+
}) : [];
|
|
8220
|
+
return [...from_suggest_request.slice(0, content_results.length ? 2 : 3), ...content_results.slice(0, 1)];
|
|
8221
|
+
});
|
|
8126
8222
|
const render_entry = function (input_obj, autocomplete_data_index, index) {
|
|
8127
8223
|
let is_history = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8128
8224
|
const is_query = (0, $8tj43$createMemo)(() => input_obj().type === (0, $7cd4d275a9f8d600$export$3cf9497e790da491));
|
|
@@ -8132,6 +8228,10 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
8132
8228
|
url_transformer_: url_transformer_
|
|
8133
8229
|
}) : undefined);
|
|
8134
8230
|
const href = (0, $8tj43$createMemo)(() => is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
|
|
8231
|
+
const is_selected = (0, $8tj43$createMemo)(() => {
|
|
8232
|
+
var _read_selected_index_, _read_selected_index_2;
|
|
8233
|
+
return ((_read_selected_index_ = read_selected_index_()) === null || _read_selected_index_ === void 0 ? void 0 : _read_selected_index_[0]) === autocomplete_data_index && ((_read_selected_index_2 = read_selected_index_()) === null || _read_selected_index_2 === void 0 ? void 0 : _read_selected_index_2[1]) === index;
|
|
8234
|
+
});
|
|
8135
8235
|
return (() => {
|
|
8136
8236
|
const _el$ = (0, $8tj43$getNextElement)($40dd3f46f55d62ba$var$_tmpl$);
|
|
8137
8237
|
(0, $8tj43$use)(element => element.addEventListener("click", (0, $8tj43$catchify)(ev => {
|
|
@@ -8145,7 +8245,7 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
8145
8245
|
return;
|
|
8146
8246
|
}
|
|
8147
8247
|
router_.navigate_.go_to_({
|
|
8148
|
-
new_url_:
|
|
8248
|
+
new_url_: href(),
|
|
8149
8249
|
is_replace_: false,
|
|
8150
8250
|
event_: ev
|
|
8151
8251
|
});
|
|
@@ -8167,20 +8267,20 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
8167
8267
|
return (0, $8tj43$createComponent)((0, $6d95ef50ee01d5a1$export$5d2caaa6b530761c), {});
|
|
8168
8268
|
}
|
|
8169
8269
|
}), (0, $8tj43$createComponent)((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
|
|
8170
|
-
class_: "value",
|
|
8270
|
+
class_: "value line-clamp",
|
|
8171
8271
|
get whole_text_to_display_() {
|
|
8172
8272
|
return (0, $8tj43$createMemo)(() => input_obj().title);
|
|
8173
8273
|
},
|
|
8174
8274
|
searching_for_value_: searching_for_value_
|
|
8175
8275
|
})] : [(0, $8tj43$memo)((() => {
|
|
8176
|
-
const _c$2 = (0, $8tj43$memo)(() => typeof input_obj()
|
|
8276
|
+
const _c$2 = (0, $8tj43$memo)(() => typeof input_obj() /* this is a harmless lie */.parent_title === "string");
|
|
8177
8277
|
return () => _c$2() ? (() => {
|
|
8178
8278
|
const _el$4 = (0, $8tj43$getNextElement)($40dd3f46f55d62ba$var$_tmpl$4),
|
|
8179
8279
|
_el$6 = _el$4.firstChild,
|
|
8180
8280
|
[_el$7, _co$] = (0, $8tj43$getNextMarker)(_el$6.nextSibling),
|
|
8181
8281
|
_el$5 = _el$7.nextSibling;
|
|
8182
8282
|
(0, $8tj43$insert)(_el$4, (0, $8tj43$createComponent)((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
|
|
8183
|
-
class_: "category",
|
|
8283
|
+
class_: "category line-clamp",
|
|
8184
8284
|
get whole_text_to_display_() {
|
|
8185
8285
|
return (0, $8tj43$createMemo)(() => input_obj().title);
|
|
8186
8286
|
},
|
|
@@ -8188,16 +8288,38 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
8188
8288
|
}), _el$7, _co$);
|
|
8189
8289
|
(0, $8tj43$insert)(_el$5, () => input_obj().parent_title);
|
|
8190
8290
|
return _el$4;
|
|
8191
|
-
})() : (
|
|
8192
|
-
|
|
8193
|
-
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8197
|
-
|
|
8291
|
+
})() : (() => {
|
|
8292
|
+
const _c$3 = (0, $8tj43$memo)(() => input_obj().type === "content");
|
|
8293
|
+
return () => _c$3() ? (() => {
|
|
8294
|
+
const _el$8 = (0, $8tj43$getNextElement)($40dd3f46f55d62ba$var$_tmpl$5),
|
|
8295
|
+
_el$9 = _el$8.firstChild,
|
|
8296
|
+
[_el$10, _co$2] = (0, $8tj43$getNextMarker)(_el$9.nextSibling),
|
|
8297
|
+
_el$11 = _el$10.nextSibling,
|
|
8298
|
+
[_el$12, _co$3] = (0, $8tj43$getNextMarker)(_el$11.nextSibling);
|
|
8299
|
+
(0, $8tj43$insert)(_el$8, (0, $8tj43$createComponent)((0, $3c5e15c6ee4227a9$export$605674723bcc715c), {
|
|
8300
|
+
width: "16",
|
|
8301
|
+
height: "16"
|
|
8302
|
+
}), _el$10, _co$2);
|
|
8303
|
+
(0, $8tj43$insert)(_el$8, (0, $8tj43$createComponent)((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
|
|
8304
|
+
class_: "content line-clamp",
|
|
8305
|
+
get whole_text_to_display_() {
|
|
8306
|
+
return (0, $8tj43$createMemo)(() => input_obj().title);
|
|
8307
|
+
},
|
|
8308
|
+
searching_for_value_: searching_for_value_
|
|
8309
|
+
}), _el$12, _co$3);
|
|
8310
|
+
return _el$8;
|
|
8311
|
+
})() : (0, $8tj43$createComponent)((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
|
|
8312
|
+
class_: "category line-clamp",
|
|
8313
|
+
get whole_text_to_display_() {
|
|
8314
|
+
return (0, $8tj43$createMemo)(() => input_obj().title);
|
|
8315
|
+
},
|
|
8316
|
+
searching_for_value_: searching_for_value_
|
|
8317
|
+
});
|
|
8318
|
+
})();
|
|
8198
8319
|
})()), (() => {
|
|
8199
8320
|
const _el$3 = (0, $8tj43$getNextElement)($40dd3f46f55d62ba$var$_tmpl$3);
|
|
8200
8321
|
(0, $8tj43$insert)(_el$3, (0, $8tj43$createMemo)(() => {
|
|
8322
|
+
if (input_obj().type === "content") return i18n_.content_();
|
|
8201
8323
|
if (input_obj().category_type === "BRAND") return i18n_.brand_();
|
|
8202
8324
|
return i18n_.category_();
|
|
8203
8325
|
}));
|
|
@@ -8206,10 +8328,7 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
8206
8328
|
})());
|
|
8207
8329
|
(0, $8tj43$effect)(_p$ => {
|
|
8208
8330
|
const _v$ = {
|
|
8209
|
-
selected: (
|
|
8210
|
-
var _read_selected_index_, _read_selected_index_2;
|
|
8211
|
-
return ((_read_selected_index_ = read_selected_index_()) === null || _read_selected_index_ === void 0 ? void 0 : _read_selected_index_[0]) === autocomplete_data_index && ((_read_selected_index_2 = read_selected_index_()) === null || _read_selected_index_2 === void 0 ? void 0 : _read_selected_index_2[1]) === index;
|
|
8212
|
-
})(),
|
|
8331
|
+
selected: is_selected(),
|
|
8213
8332
|
history: is_history,
|
|
8214
8333
|
["type-" + input_obj().type]: true
|
|
8215
8334
|
},
|
|
@@ -8236,8 +8355,8 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
8236
8355
|
};
|
|
8237
8356
|
const should_show_previous_searches_in_query_part = (0, $8tj43$createMemo)(() => !on_previous_searches_page_());
|
|
8238
8357
|
const should_show_at_all = (0, $8tj43$createMemo)(() => {
|
|
8239
|
-
var _suggestion_memo_;
|
|
8240
|
-
return ((_suggestion_memo_ = suggestion_memo_()) === null || _suggestion_memo_ === void 0 ? void 0 : _suggestion_memo_.length) || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length;
|
|
8358
|
+
var _suggestion_memo_, _get_content_results_;
|
|
8359
|
+
return ((_suggestion_memo_ = suggestion_memo_()) === null || _suggestion_memo_ === void 0 ? void 0 : _suggestion_memo_.length) || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length || ((_get_content_results_ = get_content_results_()) === null || _get_content_results_ === void 0 ? void 0 : _get_content_results_.length);
|
|
8241
8360
|
});
|
|
8242
8361
|
const should_show_query_part = (0, $8tj43$createMemo)(() => queries_memo().length || filtered_previous_searches_().length);
|
|
8243
8362
|
return (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
@@ -8245,34 +8364,34 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
8245
8364
|
return should_show_at_all();
|
|
8246
8365
|
},
|
|
8247
8366
|
get children() {
|
|
8248
|
-
const _el$
|
|
8249
|
-
_el$
|
|
8250
|
-
[_el$
|
|
8251
|
-
_el$
|
|
8252
|
-
[_el$
|
|
8253
|
-
_el$
|
|
8254
|
-
[_el$
|
|
8255
|
-
(0, $8tj43$insert)(_el$
|
|
8367
|
+
const _el$13 = (0, $8tj43$getNextElement)($40dd3f46f55d62ba$var$_tmpl$9),
|
|
8368
|
+
_el$21 = _el$13.firstChild,
|
|
8369
|
+
[_el$22, _co$6] = (0, $8tj43$getNextMarker)(_el$21.nextSibling),
|
|
8370
|
+
_el$23 = _el$22.nextSibling,
|
|
8371
|
+
[_el$24, _co$7] = (0, $8tj43$getNextMarker)(_el$23.nextSibling),
|
|
8372
|
+
_el$25 = _el$24.nextSibling,
|
|
8373
|
+
[_el$26, _co$8] = (0, $8tj43$getNextMarker)(_el$25.nextSibling);
|
|
8374
|
+
(0, $8tj43$insert)(_el$13, (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
8256
8375
|
get when() {
|
|
8257
8376
|
return on_previous_searches_page_();
|
|
8258
8377
|
},
|
|
8259
8378
|
get children() {
|
|
8260
|
-
const _el$
|
|
8261
|
-
(0, $8tj43$insert)(_el$
|
|
8262
|
-
return _el$
|
|
8379
|
+
const _el$14 = (0, $8tj43$getNextElement)($40dd3f46f55d62ba$var$_tmpl$6);
|
|
8380
|
+
(0, $8tj43$insert)(_el$14, () => i18n_.suggestions_());
|
|
8381
|
+
return _el$14;
|
|
8263
8382
|
}
|
|
8264
|
-
}), _el$
|
|
8265
|
-
(0, $8tj43$insert)(_el$
|
|
8383
|
+
}), _el$22, _co$6);
|
|
8384
|
+
(0, $8tj43$insert)(_el$13, (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
8266
8385
|
get when() {
|
|
8267
8386
|
return should_show_query_part();
|
|
8268
8387
|
},
|
|
8269
8388
|
get children() {
|
|
8270
|
-
const _el$
|
|
8271
|
-
_el$
|
|
8272
|
-
[_el$
|
|
8273
|
-
_el$
|
|
8274
|
-
[_el$
|
|
8275
|
-
(0, $8tj43$insert)(_el$
|
|
8389
|
+
const _el$15 = (0, $8tj43$getNextElement)($40dd3f46f55d62ba$var$_tmpl$7),
|
|
8390
|
+
_el$16 = _el$15.firstChild,
|
|
8391
|
+
[_el$17, _co$4] = (0, $8tj43$getNextMarker)(_el$16.nextSibling),
|
|
8392
|
+
_el$18 = _el$17.nextSibling,
|
|
8393
|
+
[_el$19, _co$5] = (0, $8tj43$getNextMarker)(_el$18.nextSibling);
|
|
8394
|
+
(0, $8tj43$insert)(_el$15, (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
8276
8395
|
get when() {
|
|
8277
8396
|
return should_show_previous_searches_in_query_part();
|
|
8278
8397
|
},
|
|
@@ -8295,8 +8414,8 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
8295
8414
|
});
|
|
8296
8415
|
})();
|
|
8297
8416
|
}
|
|
8298
|
-
}), _el$
|
|
8299
|
-
(0, $8tj43$insert)(_el$
|
|
8417
|
+
}), _el$17, _co$4);
|
|
8418
|
+
(0, $8tj43$insert)(_el$15, () => {
|
|
8300
8419
|
const index_in_autocomplete = 2;
|
|
8301
8420
|
set_list_until_cleanup(queries_memo, index_in_autocomplete);
|
|
8302
8421
|
return (0, $8tj43$createComponent)((0, $8tj43$Index), {
|
|
@@ -8305,18 +8424,18 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
8305
8424
|
},
|
|
8306
8425
|
children: (item, index) => render_entry(item, index_in_autocomplete, index)
|
|
8307
8426
|
});
|
|
8308
|
-
}, _el$
|
|
8309
|
-
return _el$
|
|
8427
|
+
}, _el$19, _co$5);
|
|
8428
|
+
return _el$15;
|
|
8310
8429
|
}
|
|
8311
|
-
}), _el$
|
|
8312
|
-
(0, $8tj43$insert)(_el$
|
|
8430
|
+
}), _el$24, _co$7);
|
|
8431
|
+
(0, $8tj43$insert)(_el$13, (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
8313
8432
|
get when() {
|
|
8314
|
-
return not_queries_memo().length
|
|
8433
|
+
return not_queries_memo().length;
|
|
8315
8434
|
},
|
|
8316
8435
|
keyed: false,
|
|
8317
8436
|
get children() {
|
|
8318
|
-
const _el$
|
|
8319
|
-
(0, $8tj43$insert)(_el$
|
|
8437
|
+
const _el$20 = (0, $8tj43$getNextElement)($40dd3f46f55d62ba$var$_tmpl$8);
|
|
8438
|
+
(0, $8tj43$insert)(_el$20, () => {
|
|
8320
8439
|
const index_in_autocomplete = 3;
|
|
8321
8440
|
set_list_until_cleanup(not_queries_memo, index_in_autocomplete);
|
|
8322
8441
|
return (0, $8tj43$createComponent)((0, $8tj43$Index), {
|
|
@@ -8326,15 +8445,30 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
|
|
|
8326
8445
|
children: (item, index) => render_entry(item, index_in_autocomplete, index)
|
|
8327
8446
|
});
|
|
8328
8447
|
});
|
|
8329
|
-
return _el$
|
|
8448
|
+
return _el$20;
|
|
8330
8449
|
}
|
|
8331
|
-
}), _el$
|
|
8332
|
-
(0, $8tj43$effect)(() => _el$
|
|
8333
|
-
return _el$
|
|
8450
|
+
}), _el$26, _co$8);
|
|
8451
|
+
(0, $8tj43$effect)(() => _el$13.classList.toggle("compact", !!on_previous_searches_page_()));
|
|
8452
|
+
return _el$13;
|
|
8334
8453
|
}
|
|
8335
8454
|
});
|
|
8336
8455
|
}
|
|
8337
|
-
const $
|
|
8456
|
+
const $76b6e14a50da4597$var$_tmpl$ = /*#__PURE__*/(0, $8tj43$template)(`<a target="_blank"></a>`, 2);
|
|
8457
|
+
function $76b6e14a50da4597$export$1efe1013da60d0e4(e, href) {
|
|
8458
|
+
if (e.metaKey || e.ctrlKey) {
|
|
8459
|
+
// Open link in a new tab with cmd/ctrl + enter.
|
|
8460
|
+
const link = (() => {
|
|
8461
|
+
const _el$ = (0, $8tj43$getNextElement)($76b6e14a50da4597$var$_tmpl$);
|
|
8462
|
+
(0, $8tj43$setAttribute)(_el$, "href", href);
|
|
8463
|
+
return _el$;
|
|
8464
|
+
})();
|
|
8465
|
+
document.body.append(link);
|
|
8466
|
+
link.click();
|
|
8467
|
+
link.remove();
|
|
8468
|
+
return true;
|
|
8469
|
+
}
|
|
8470
|
+
return false;
|
|
8471
|
+
}
|
|
8338
8472
|
function $2ebb1d6ae6763f7a$export$217899a935ef803b(_ref) {
|
|
8339
8473
|
let {
|
|
8340
8474
|
selected_index_: [read_selected_index, write_selected_index],
|
|
@@ -8412,6 +8546,7 @@ function $2ebb1d6ae6763f7a$var$actual_navigation_working_on_fake_data(_ref2) {
|
|
|
8412
8546
|
const sfv = get_search_field_value();
|
|
8413
8547
|
if (!(0, $8tj43$untrack)(() => read_updating_blocked())) previous_value = sfv;
|
|
8414
8548
|
});
|
|
8549
|
+
const owner = (0, $8tj43$getOwner)();
|
|
8415
8550
|
const handler = (0, $8tj43$catchify)(_ref3 => {
|
|
8416
8551
|
let {
|
|
8417
8552
|
keyCode: keyCode
|
|
@@ -8444,29 +8579,29 @@ function $2ebb1d6ae6763f7a$var$actual_navigation_working_on_fake_data(_ref2) {
|
|
|
8444
8579
|
const {
|
|
8445
8580
|
title: title
|
|
8446
8581
|
} = selected_entry;
|
|
8447
|
-
|
|
8582
|
+
(0, $8tj43$runWithOwner)(owner, block_updating_for_one_change);
|
|
8448
8583
|
set_search_field_value(title);
|
|
8449
|
-
override_on_enter_for_this_entry(e => {
|
|
8584
|
+
(0, $8tj43$runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
|
|
8450
8585
|
// Open search query in new tab on cmd+enter
|
|
8451
8586
|
// If it's not cmd+enter, pressing enter will just submit the value that was put into the field while selecting with the arrow keys ;)
|
|
8452
8587
|
const url = new URL(location);
|
|
8453
8588
|
url_transformer_ === null || url_transformer_ === void 0 || url_transformer_(url);
|
|
8454
8589
|
url.searchParams.set(search_query_param_name_, title);
|
|
8455
|
-
return $
|
|
8456
|
-
});
|
|
8457
|
-
} else if ((selected_entry === null || selected_entry === void 0 ? void 0 : selected_entry.type) == "category") override_on_enter_for_this_entry(e => {
|
|
8590
|
+
return (0, $76b6e14a50da4597$export$1efe1013da60d0e4)(e, url.href);
|
|
8591
|
+
}));
|
|
8592
|
+
} else if ((selected_entry === null || selected_entry === void 0 ? void 0 : selected_entry.type) == "category" || (selected_entry === null || selected_entry === void 0 ? void 0 : selected_entry.type) === "content") (0, $8tj43$runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
|
|
8458
8593
|
const {
|
|
8459
8594
|
page_url: page_url
|
|
8460
8595
|
} = selected_entry;
|
|
8461
|
-
if (
|
|
8596
|
+
if (!(0, $76b6e14a50da4597$export$1efe1013da60d0e4)(e, page_url))
|
|
8462
8597
|
// Above fn will return true if it opened a new tab, and we won't make these checks anymore
|
|
8463
8598
|
router_.navigate_.go_to_({
|
|
8464
8599
|
new_url_: page_url,
|
|
8465
8600
|
is_replace_: false
|
|
8466
8601
|
});
|
|
8467
8602
|
return true;
|
|
8468
|
-
});else if (!selected_entry) {
|
|
8469
|
-
|
|
8603
|
+
}));else if (!selected_entry) {
|
|
8604
|
+
(0, $8tj43$runWithOwner)(owner, block_updating_for_one_change);
|
|
8470
8605
|
set_search_field_value(previous_value);
|
|
8471
8606
|
}
|
|
8472
8607
|
});
|
|
@@ -8478,20 +8613,39 @@ function $2ebb1d6ae6763f7a$var$actual_navigation_working_on_fake_data(_ref2) {
|
|
|
8478
8613
|
(0, $8tj43$onCleanup)((0, $8tj43$catchify)(() => el.removeEventListener("keyup", handler)));
|
|
8479
8614
|
});
|
|
8480
8615
|
}
|
|
8481
|
-
function $
|
|
8482
|
-
|
|
8483
|
-
|
|
8484
|
-
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8489
|
-
|
|
8490
|
-
|
|
8491
|
-
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
|
|
8616
|
+
function $c4dee1ef44de29ca$export$af0124069c150252(_ref) {
|
|
8617
|
+
let {
|
|
8618
|
+
set_override_on_enter_fn_: set_override_on_enter_fn_,
|
|
8619
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
8620
|
+
read_suggestion_signal_: read_suggestion_signal_,
|
|
8621
|
+
router_: router_,
|
|
8622
|
+
content_results_: content_results_
|
|
8623
|
+
} = _ref;
|
|
8624
|
+
const [get_autocomplete_wants_override_function, set_autocomplete_wants_override_function] = (0, $8tj43$createSignal)(() => false);
|
|
8625
|
+
(0, $8tj43$createComputed)(() => {
|
|
8626
|
+
var _get_modal_search_res, _search_results$displ;
|
|
8627
|
+
const suggestions = read_suggestion_signal_();
|
|
8628
|
+
const search_results = (_get_modal_search_res = get_modal_search_results_()) === null || _get_modal_search_res === void 0 ? void 0 : _get_modal_search_res();
|
|
8629
|
+
const content_results = content_results_();
|
|
8630
|
+
// If we only have one content result and nothing else, go there when pressing enter
|
|
8631
|
+
if (!suggestions.length && !(search_results !== null && search_results !== void 0 && (_search_results$displ = search_results.displays) !== null && _search_results$displ !== void 0 && _search_results$displ.length) && (content_results === null || content_results === void 0 ? void 0 : content_results.length) === 1) {
|
|
8632
|
+
const [{
|
|
8633
|
+
page_url: page_url
|
|
8634
|
+
}] = content_results;
|
|
8635
|
+
set_override_on_enter_fn_(e => {
|
|
8636
|
+
if (!(0, $76b6e14a50da4597$export$1efe1013da60d0e4)(e, page_url))
|
|
8637
|
+
// Above fn will return true if it opened a new tab, and we won't make these checks anymore
|
|
8638
|
+
router_.navigate_.go_to_({
|
|
8639
|
+
new_url_: page_url,
|
|
8640
|
+
is_replace_: false
|
|
8641
|
+
});
|
|
8642
|
+
return true;
|
|
8643
|
+
});
|
|
8644
|
+
return;
|
|
8645
|
+
}
|
|
8646
|
+
set_override_on_enter_fn_(get_autocomplete_wants_override_function());
|
|
8647
|
+
});
|
|
8648
|
+
return new_fn => set_autocomplete_wants_override_function(() => new_fn);
|
|
8495
8649
|
}
|
|
8496
8650
|
const $7cd4d275a9f8d600$export$3cf9497e790da491 = "query";
|
|
8497
8651
|
function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
|
|
@@ -8512,12 +8666,15 @@ function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
|
|
|
8512
8666
|
i18n_: i18n_,
|
|
8513
8667
|
include_category_suggestions_: include_category_suggestions_,
|
|
8514
8668
|
submit_query_: submit_query_,
|
|
8515
|
-
router_: router_
|
|
8669
|
+
router_: router_,
|
|
8670
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
8671
|
+
content_search_enabled_: content_search_enabled_
|
|
8516
8672
|
} = _ref;
|
|
8517
8673
|
const [searching_for_value, set_searching_for_value] = (0, $8tj43$createSignal)();
|
|
8674
|
+
const [show_stale_content_results, set_show_stale_content_results] = (0, $8tj43$createSignal)(false);
|
|
8518
8675
|
const [read_search_field_value] = search_field_value_;
|
|
8519
8676
|
const updating_blocked = (0, $8tj43$createSignal)(false);
|
|
8520
|
-
const [
|
|
8677
|
+
const [read_suggestion_signal_, write_suggestion_signal] = (0, $8tj43$createSignal)([]);
|
|
8521
8678
|
const filtered_previous_searches = (0, $8tj43$createMemo)(() => [...unfiltered_previous_searches[0]()].reverse().filter(q => q !== get_search_query_()));
|
|
8522
8679
|
const deparallelized_fn = (0, $8tj43$deparallelize_no_drop)(async request_obj => {
|
|
8523
8680
|
var _api_response$suggest;
|
|
@@ -8541,15 +8698,39 @@ function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
|
|
|
8541
8698
|
});
|
|
8542
8699
|
|
|
8543
8700
|
const show_previous_searches_component = (0, $8tj43$createMemo)(() => !read_search_field_value() || (0, $8tj43$untrack)(updating_blocked[0]) && !(0, $8tj43$untrack)(searching_for_value));
|
|
8701
|
+
const get_content_results_ = (0, $8tj43$createMemo)(prev => {
|
|
8702
|
+
var _get_modal_search_res, _get_modal_search_res2, _get_modal_search_res3;
|
|
8703
|
+
if (!content_search_enabled_()) return [];
|
|
8704
|
+
if (show_stale_content_results())
|
|
8705
|
+
// don't update content results when query suggestions don't update because otherwise they disappear when trying to keyboard navigate to them
|
|
8706
|
+
return prev;
|
|
8707
|
+
return (_get_modal_search_res = get_modal_search_results_()) === null || _get_modal_search_res === void 0 ? void 0 : (_get_modal_search_res2 = _get_modal_search_res()) === null || _get_modal_search_res2 === void 0 ? void 0 : (_get_modal_search_res3 = _get_modal_search_res2.content_search_links) === null || _get_modal_search_res3 === void 0 ? void 0 : _get_modal_search_res3.map(link => ({
|
|
8708
|
+
page_url: link.page_url,
|
|
8709
|
+
type: "content",
|
|
8710
|
+
title: link.title
|
|
8711
|
+
}));
|
|
8712
|
+
});
|
|
8713
|
+
// Ideally we'd propagate up the suggestion signal too and call this from SearchModal.tsx? Because it's not super related with autocomplete, but it's not a huge feature, and it's easier here so keeping it.
|
|
8714
|
+
// It's the functionality to open the content results page when you press enter, in the modal, when there's only one content result
|
|
8715
|
+
const manipulated_set_override_on_enter_fn_ = (0, $c4dee1ef44de29ca$export$af0124069c150252)({
|
|
8716
|
+
set_override_on_enter_fn_: set_override_on_enter_fn_,
|
|
8717
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
8718
|
+
read_suggestion_signal_: read_suggestion_signal_,
|
|
8719
|
+
router_: router_,
|
|
8720
|
+
content_results_: get_content_results_
|
|
8721
|
+
});
|
|
8544
8722
|
(0, $8tj43$createComputed)(() => {
|
|
8545
8723
|
const field_value = read_search_field_value();
|
|
8546
|
-
if (
|
|
8724
|
+
if ((0, $8tj43$untrack)(updating_blocked[0]))
|
|
8725
|
+
// not using updating_blocked instead of below signal since I presume they'd start updating too early then
|
|
8726
|
+
set_show_stale_content_results(true);else {
|
|
8547
8727
|
set_searching_for_value(field_value);
|
|
8548
8728
|
deparallelized_fn({
|
|
8549
8729
|
query: field_value,
|
|
8550
8730
|
tenant: tenant_(),
|
|
8551
8731
|
market: market_()
|
|
8552
8732
|
});
|
|
8733
|
+
set_show_stale_content_results(false);
|
|
8553
8734
|
}
|
|
8554
8735
|
});
|
|
8555
8736
|
(0, $8tj43$createComputed)((0, $8tj43$on)(search_field_value_[0], () => !updating_blocked[0]() && selected_index_[1](undefined), {
|
|
@@ -8561,7 +8742,7 @@ function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
|
|
|
8561
8742
|
search_field_value_: search_field_value_,
|
|
8562
8743
|
updating_blocked_: updating_blocked,
|
|
8563
8744
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
8564
|
-
set_override_on_enter_fn_:
|
|
8745
|
+
set_override_on_enter_fn_: manipulated_set_override_on_enter_fn_,
|
|
8565
8746
|
search_query_param_name_: search_query_url_param_name_,
|
|
8566
8747
|
url_transformer_: url_transformer_,
|
|
8567
8748
|
router_: router_
|
|
@@ -8601,11 +8782,12 @@ function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
|
|
|
8601
8782
|
},
|
|
8602
8783
|
on_previous_searches_page_: show_previous_searches_component,
|
|
8603
8784
|
i18n_: i18n_,
|
|
8785
|
+
get_content_results_: get_content_results_,
|
|
8604
8786
|
url_transformer_: url_transformer_,
|
|
8605
8787
|
searching_for_value_: searching_for_value,
|
|
8606
8788
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
8607
8789
|
selected_index_: selected_index_,
|
|
8608
|
-
suggestion_memo_:
|
|
8790
|
+
suggestion_memo_: read_suggestion_signal_,
|
|
8609
8791
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
8610
8792
|
include_category_suggestions_: include_category_suggestions_,
|
|
8611
8793
|
router_: router_,
|
|
@@ -8717,7 +8899,8 @@ function $e82132ed97521828$export$1c593cbd6f1e10bc(_ref) {
|
|
|
8717
8899
|
bottom_distance_under_modal_: bottom_distance_under_modal_,
|
|
8718
8900
|
selected_text_range_: selected_text_range_,
|
|
8719
8901
|
dont_sync_search_field_value_except_on_submit_ = false,
|
|
8720
|
-
router_: router_
|
|
8902
|
+
router_: router_,
|
|
8903
|
+
content_search_enabled_: content_search_enabled_
|
|
8721
8904
|
} = _ref;
|
|
8722
8905
|
let on_enter_in_search_field_function;
|
|
8723
8906
|
// As per feedback from stronger we sometimes want a modal with the search field value disconnected from the one in the rest of the UI, see https://depictaiworkspace.slack.com/archives/C02J16R9XEH/p1679065878487709.
|
|
@@ -8734,48 +8917,38 @@ function $e82132ed97521828$export$1c593cbd6f1e10bc(_ref) {
|
|
|
8734
8917
|
};
|
|
8735
8918
|
const [input_field, set_input_field] = (0, $8tj43$createSignal)();
|
|
8736
8919
|
const [get_search_field_value_] = search_field_value_;
|
|
8737
|
-
const [
|
|
8738
|
-
const [elements_inside_scrollable, set_elements_inside_scrollable] = (0, $8tj43$createSignal)();
|
|
8920
|
+
const [get_modal_search_results, set_modal_search_results_] = (0, $8tj43$createSignal)();
|
|
8739
8921
|
const close_on_escape_handler = (0, $8tj43$catchify)(_ref2 => {
|
|
8740
8922
|
let {
|
|
8741
8923
|
key: key
|
|
8742
8924
|
} = _ref2;
|
|
8743
8925
|
if (key === "Escape") close_modal_();
|
|
8744
8926
|
});
|
|
8745
|
-
const [
|
|
8927
|
+
const [get_total_num_results_accessor, set_total_num_results_accessor_] = (0, $8tj43$createSignal)();
|
|
8746
8928
|
const selected_index = (0, $8tj43$createSignal)();
|
|
8747
8929
|
const currently_showing_suggestions_ = (0, $8tj43$createSignal)([], {
|
|
8748
8930
|
equals: false
|
|
8749
8931
|
});
|
|
8932
|
+
const less_than_700_high = (0, $00a5b94f0c11efbb$export$d9f36cf74e24d595)("(max-height:700px)");
|
|
8933
|
+
const DiscoverMoreSection = () => (() => {
|
|
8934
|
+
const _el$ = (0, $8tj43$getNextElement)($e82132ed97521828$var$_tmpl$),
|
|
8935
|
+
_el$2 = _el$.firstChild;
|
|
8936
|
+
(0, $8tj43$addEventListener)(_el$2, "click", (0, $8tj43$catchify)(() => submit_query_()), true);
|
|
8937
|
+
(0, $8tj43$insert)(_el$2, (() => {
|
|
8938
|
+
const _c$ = (0, $8tj43$memo)(() => !!get_search_field_value_());
|
|
8939
|
+
return () => _c$() ? i18n_.modal_view_all_results_()((() => {
|
|
8940
|
+
const _el$3 = (0, $8tj43$getNextElement)($e82132ed97521828$var$_tmpl$2);
|
|
8941
|
+
(0, $8tj43$insert)(_el$3, () => get_total_num_results_accessor === null || get_total_num_results_accessor === void 0 ? void 0 : get_total_num_results_accessor());
|
|
8942
|
+
return _el$3;
|
|
8943
|
+
})()) : i18n_.modal_discover_more_();
|
|
8944
|
+
})());
|
|
8945
|
+
(0, $8tj43$runHydrationEvents)();
|
|
8946
|
+
return _el$;
|
|
8947
|
+
})();
|
|
8750
8948
|
if (disable_scrolling_) (0, $e56d241d0f33d459$export$fe334901e8bebd57)();
|
|
8751
8949
|
$e82132ed97521828$var$close_modal_when_navigating_away(close_modal_, search_query_url_param_name_);
|
|
8752
8950
|
window.addEventListener("keydown", close_on_escape_handler);
|
|
8753
8951
|
(0, $8tj43$onCleanup)((0, $8tj43$catchify)(() => window.removeEventListener("keydown", close_on_escape_handler)));
|
|
8754
|
-
const owner = (0, $8tj43$getOwner)();
|
|
8755
|
-
(0, $8tj43$onCleanup)((0, $8tj43$javascript_media_query)("(max-height:700px)", _ref3 => {
|
|
8756
|
-
let {
|
|
8757
|
-
matches: matches
|
|
8758
|
-
} = _ref3;
|
|
8759
|
-
return (0, $8tj43$runWithOwner)(owner, () => {
|
|
8760
|
-
// the if below is reactive so we need an owner
|
|
8761
|
-
(matches ? set_elements_outside_scrollable : set_elements_inside_scrollable)("");
|
|
8762
|
-
(matches ? set_elements_inside_scrollable : set_elements_outside_scrollable)((() => {
|
|
8763
|
-
const _el$ = (0, $8tj43$getNextElement)($e82132ed97521828$var$_tmpl$),
|
|
8764
|
-
_el$2 = _el$.firstChild;
|
|
8765
|
-
(0, $8tj43$addEventListener)(_el$2, "click", (0, $8tj43$catchify)(() => submit_query_()), true);
|
|
8766
|
-
(0, $8tj43$insert)(_el$2, (() => {
|
|
8767
|
-
const _c$ = (0, $8tj43$memo)(() => !!get_search_field_value_());
|
|
8768
|
-
return () => _c$() ? i18n_.modal_view_all_results_()((() => {
|
|
8769
|
-
const _el$3 = (0, $8tj43$getNextElement)($e82132ed97521828$var$_tmpl$2);
|
|
8770
|
-
(0, $8tj43$insert)(_el$3, () => get_num_results_accessor === null || get_num_results_accessor === void 0 ? void 0 : get_num_results_accessor());
|
|
8771
|
-
return _el$3;
|
|
8772
|
-
})()) : i18n_.modal_discover_more_();
|
|
8773
|
-
})());
|
|
8774
|
-
(0, $8tj43$runHydrationEvents)();
|
|
8775
|
-
return _el$;
|
|
8776
|
-
})());
|
|
8777
|
-
});
|
|
8778
|
-
}).remove);
|
|
8779
8952
|
if (closing_animation_) register_closing_animation_(closing_animation_);
|
|
8780
8953
|
(0, $a09bb7c652acf957$export$3340fdd8259bd4fd)({
|
|
8781
8954
|
get_search_field_value_: get_search_field_value_,
|
|
@@ -8830,10 +9003,10 @@ function $e82132ed97521828$export$1c593cbd6f1e10bc(_ref) {
|
|
|
8830
9003
|
[_el$16, _co$5] = (0, $8tj43$getNextMarker)(_el$15.nextSibling),
|
|
8831
9004
|
_el$17 = _el$5.nextSibling,
|
|
8832
9005
|
[_el$18, _co$6] = (0, $8tj43$getNextMarker)(_el$17.nextSibling);
|
|
8833
|
-
(0, $8tj43$addEventListener)(_el$4, "click", (0, $8tj43$catchify)(
|
|
9006
|
+
(0, $8tj43$addEventListener)(_el$4, "click", (0, $8tj43$catchify)(_ref3 => {
|
|
8834
9007
|
let {
|
|
8835
9008
|
target: target
|
|
8836
|
-
} =
|
|
9009
|
+
} = _ref3;
|
|
8837
9010
|
if (target === modal_element) close_modal_();
|
|
8838
9011
|
}), true);
|
|
8839
9012
|
(0, $8tj43$insert)(_el$5, search_field, _el$14, _co$4);
|
|
@@ -8861,7 +9034,9 @@ function $e82132ed97521828$export$1c593cbd6f1e10bc(_ref) {
|
|
|
8861
9034
|
i18n_: i18n_,
|
|
8862
9035
|
include_category_suggestions_: enable_category_suggestions_ !== null && enable_category_suggestions_ !== void 0 ? enable_category_suggestions_ : true,
|
|
8863
9036
|
router_: router_,
|
|
8864
|
-
submit_query_: submit_query_
|
|
9037
|
+
submit_query_: submit_query_,
|
|
9038
|
+
get_modal_search_results_: get_modal_search_results,
|
|
9039
|
+
content_search_enabled_: content_search_enabled_
|
|
8865
9040
|
});
|
|
8866
9041
|
}
|
|
8867
9042
|
}), _el$8, _co$);
|
|
@@ -8875,14 +9050,30 @@ function $e82132ed97521828$export$1c593cbd6f1e10bc(_ref) {
|
|
|
8875
9050
|
tenant_: tenant_,
|
|
8876
9051
|
i18n_: i18n_,
|
|
8877
9052
|
market_: market_,
|
|
8878
|
-
|
|
9053
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
8879
9054
|
router_: router_,
|
|
9055
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
9056
|
+
content_search_enabled_: content_search_enabled_,
|
|
8880
9057
|
...instant_results_options_
|
|
8881
9058
|
});
|
|
8882
9059
|
}
|
|
8883
9060
|
}), _el$10, _co$2);
|
|
8884
|
-
(0, $8tj43$insert)(_el$6,
|
|
8885
|
-
|
|
9061
|
+
(0, $8tj43$insert)(_el$6, (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
9062
|
+
get when() {
|
|
9063
|
+
return less_than_700_high();
|
|
9064
|
+
},
|
|
9065
|
+
get children() {
|
|
9066
|
+
return (0, $8tj43$createComponent)(DiscoverMoreSection, {});
|
|
9067
|
+
}
|
|
9068
|
+
}), _el$12, _co$3);
|
|
9069
|
+
(0, $8tj43$insert)(_el$5, (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
9070
|
+
get when() {
|
|
9071
|
+
return !less_than_700_high();
|
|
9072
|
+
},
|
|
9073
|
+
get children() {
|
|
9074
|
+
return (0, $8tj43$createComponent)(DiscoverMoreSection, {});
|
|
9075
|
+
}
|
|
9076
|
+
}), _el$16, _co$5);
|
|
8886
9077
|
(0, $8tj43$insert)(_el$4, (0, $8tj43$createComponent)((0, $a86e71c0015bd8ab$export$f021bdedd3ec901a), {
|
|
8887
9078
|
styles: body_style
|
|
8888
9079
|
}), _el$18, _co$6);
|
|
@@ -8993,11 +9184,13 @@ function $69602b3d8fd54c38$export$9dd50d35b9d94fdf(_ref) {
|
|
|
8993
9184
|
let {
|
|
8994
9185
|
get_search_query_: get_search_query_,
|
|
8995
9186
|
i18n_: i18n_,
|
|
8996
|
-
formatted_number_of_results_: formatted_number_of_results_
|
|
9187
|
+
formatted_number_of_results_: formatted_number_of_results_,
|
|
9188
|
+
number_of_results_: number_of_results_,
|
|
9189
|
+
type: type
|
|
8997
9190
|
} = _ref;
|
|
8998
9191
|
const contents = (0, $8tj43$createMemo)((0, $8tj43$catchify)(() => {
|
|
8999
9192
|
const q = get_search_query_();
|
|
9000
|
-
return i18n_.get_showing_results_for_()((() => {
|
|
9193
|
+
return i18n_[type === $69602b3d8fd54c38$export$2452208c79fe93ea.content ? "get_showing_pages_for_" : "get_showing_results_for_"]()((() => {
|
|
9001
9194
|
const _el$ = (0, $8tj43$getNextElement)($69602b3d8fd54c38$var$_tmpl$);
|
|
9002
9195
|
(0, $8tj43$insert)(_el$, q);
|
|
9003
9196
|
return _el$;
|
|
@@ -9005,7 +9198,7 @@ function $69602b3d8fd54c38$export$9dd50d35b9d94fdf(_ref) {
|
|
|
9005
9198
|
const _el$2 = (0, $8tj43$getNextElement)($69602b3d8fd54c38$var$_tmpl$);
|
|
9006
9199
|
(0, $8tj43$insert)(_el$2, formatted_number_of_results_);
|
|
9007
9200
|
return _el$2;
|
|
9008
|
-
})());
|
|
9201
|
+
})(), !!q, number_of_results_());
|
|
9009
9202
|
}));
|
|
9010
9203
|
return (() => {
|
|
9011
9204
|
const _el$3 = (0, $8tj43$getNextElement)($69602b3d8fd54c38$var$_tmpl$2);
|
|
@@ -9013,6 +9206,11 @@ function $69602b3d8fd54c38$export$9dd50d35b9d94fdf(_ref) {
|
|
|
9013
9206
|
return _el$3;
|
|
9014
9207
|
})();
|
|
9015
9208
|
}
|
|
9209
|
+
let $69602b3d8fd54c38$export$2452208c79fe93ea;
|
|
9210
|
+
(function (ShowingResultsForType) {
|
|
9211
|
+
ShowingResultsForType[ShowingResultsForType["products"] = 0] = "products";
|
|
9212
|
+
ShowingResultsForType[ShowingResultsForType["content"] = 1] = "content";
|
|
9213
|
+
})($69602b3d8fd54c38$export$2452208c79fe93ea || ($69602b3d8fd54c38$export$2452208c79fe93ea = {}));
|
|
9016
9214
|
function $8e8ce3f7a5eb11a6$export$41b4894022a3580f() {
|
|
9017
9215
|
let {
|
|
9018
9216
|
style_props_ = (0, $8tj43$createSignal)({})
|
|
@@ -9032,8 +9230,521 @@ function $8e8ce3f7a5eb11a6$export$41b4894022a3580f() {
|
|
|
9032
9230
|
})));
|
|
9033
9231
|
return style_props_;
|
|
9034
9232
|
}
|
|
9233
|
+
const $f3a159279dc1a8fb$var$_tmpl$ = /*#__PURE__*/(0, $8tj43$template)(`<span class="highlighted-part"></span>`, 2);
|
|
9234
|
+
const $f3a159279dc1a8fb$var$dont_cut_in_between_less_than_characters = 30;
|
|
9235
|
+
function $f3a159279dc1a8fb$export$e1a98a189fd2c0e7(_ref) {
|
|
9236
|
+
let {
|
|
9237
|
+
content_result_: content_result_,
|
|
9238
|
+
key_: key_,
|
|
9239
|
+
cut_when_possible_: cut_when_possible_
|
|
9240
|
+
} = _ref;
|
|
9241
|
+
const matched_tokens = (0, $8tj43$createMemo)(() => {
|
|
9242
|
+
var _content_result_$high, _content_result_$high2;
|
|
9243
|
+
return (_content_result_$high = content_result_().highlights) === null || _content_result_$high === void 0 ? void 0 : (_content_result_$high2 = _content_result_$high.find(highlight => highlight.field == key_)) === null || _content_result_$high2 === void 0 ? void 0 : _content_result_$high2.matched_tokens;
|
|
9244
|
+
});
|
|
9245
|
+
const full_value = (0, $8tj43$createMemo)(() => {
|
|
9246
|
+
var _content_result_$key_;
|
|
9247
|
+
return (_content_result_$key_ = content_result_()[key_]) === null || _content_result_$key_ === void 0 ? void 0 : _content_result_$key_.replaceAll("\n", " ");
|
|
9248
|
+
});
|
|
9249
|
+
return (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
9250
|
+
get when() {
|
|
9251
|
+
var _matched_tokens;
|
|
9252
|
+
return (_matched_tokens = matched_tokens()) === null || _matched_tokens === void 0 ? void 0 : _matched_tokens.length;
|
|
9253
|
+
},
|
|
9254
|
+
get fallback() {
|
|
9255
|
+
return full_value();
|
|
9256
|
+
},
|
|
9257
|
+
get children() {
|
|
9258
|
+
return (() => {
|
|
9259
|
+
const segmented_cut_text = (0, $8tj43$createMemo)(() => {
|
|
9260
|
+
const segmented_text = $f3a159279dc1a8fb$var$segment_text(full_value(), matched_tokens());
|
|
9261
|
+
if (cut_when_possible_) $f3a159279dc1a8fb$var$cut_text(segmented_text);
|
|
9262
|
+
return segmented_text;
|
|
9263
|
+
});
|
|
9264
|
+
return (0, $8tj43$createComponent)((0, $8tj43$Index), {
|
|
9265
|
+
get each() {
|
|
9266
|
+
return segmented_cut_text();
|
|
9267
|
+
},
|
|
9268
|
+
children: item => {
|
|
9269
|
+
return (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
9270
|
+
get when() {
|
|
9271
|
+
return item().highlighted_;
|
|
9272
|
+
},
|
|
9273
|
+
get fallback() {
|
|
9274
|
+
return item().text_;
|
|
9275
|
+
},
|
|
9276
|
+
get children() {
|
|
9277
|
+
const _el$ = (0, $8tj43$getNextElement)($f3a159279dc1a8fb$var$_tmpl$);
|
|
9278
|
+
(0, $8tj43$insert)(_el$, () => item().text_);
|
|
9279
|
+
return _el$;
|
|
9280
|
+
}
|
|
9281
|
+
});
|
|
9282
|
+
}
|
|
9283
|
+
});
|
|
9284
|
+
})();
|
|
9285
|
+
}
|
|
9286
|
+
});
|
|
9287
|
+
}
|
|
9288
|
+
function $f3a159279dc1a8fb$var$cut_text(segmented_text) {
|
|
9289
|
+
// cut away chunks of text that are not highlighted to give a google-like overview of the content
|
|
9290
|
+
const highlighted_segments = segmented_text === null || segmented_text === void 0 ? void 0 : segmented_text.filter(segment => segment.highlighted_);
|
|
9291
|
+
if (!segmented_text || !(highlighted_segments !== null && highlighted_segments !== void 0 && highlighted_segments.length)) return;
|
|
9292
|
+
// We have one or more highlighted segments
|
|
9293
|
+
if (highlighted_segments.length === 1) {
|
|
9294
|
+
// cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
|
|
9295
|
+
$f3a159279dc1a8fb$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
|
|
9296
|
+
return;
|
|
9297
|
+
}
|
|
9298
|
+
// We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
|
|
9299
|
+
const sorted_highlighted_segments = [...highlighted_segments].sort((a, b) => b.text_.trim().length - a.text_.trim().length // trim to avoid unfair comparisons due to whitespace
|
|
9300
|
+
);
|
|
9301
|
+
|
|
9302
|
+
const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
|
|
9303
|
+
// We need to cut before the first segment - possibly through other segments - and maybe between segments
|
|
9304
|
+
let [index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
|
|
9305
|
+
$f3a159279dc1a8fb$var$cut_start(index_of_first_segment, segmented_text);
|
|
9306
|
+
// update indexes since we might have removed segments
|
|
9307
|
+
[index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
|
|
9308
|
+
let number_of_characters_between_segments = 0;
|
|
9309
|
+
for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
|
|
9310
|
+
const segment = segmented_text[i];
|
|
9311
|
+
number_of_characters_between_segments += segment.text_.length;
|
|
9312
|
+
}
|
|
9313
|
+
if (number_of_characters_between_segments < $f3a159279dc1a8fb$var$dont_cut_in_between_less_than_characters)
|
|
9314
|
+
// don't cut if there are less than 30 characters between the two segments
|
|
9315
|
+
return;
|
|
9316
|
+
// We have more than 50 characters between the two segments, cut between them
|
|
9317
|
+
const [split_start_segment, split_start_character] = $f3a159279dc1a8fb$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
|
|
9318
|
+
const [split_end_segment, split_end_character] = $f3a159279dc1a8fb$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
|
|
9319
|
+
if (split_start_segment === undefined || split_end_segment === undefined ||
|
|
9320
|
+
// identical split point, or split end before split start, can't do anything
|
|
9321
|
+
split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
|
|
9322
|
+
const dots_segment = {
|
|
9323
|
+
text_: " … ",
|
|
9324
|
+
highlighted_: false
|
|
9325
|
+
};
|
|
9326
|
+
const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
|
|
9327
|
+
if (i < split_start_segment || i > split_end_segment) return segment;
|
|
9328
|
+
const text = segment.text_;
|
|
9329
|
+
if (i == split_end_segment && i == split_start_segment) return [{
|
|
9330
|
+
...segment,
|
|
9331
|
+
text_: text.slice(0, split_start_character).trimEnd()
|
|
9332
|
+
}, dots_segment, {
|
|
9333
|
+
...segment,
|
|
9334
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
9335
|
+
}];else if (i == split_start_segment) {
|
|
9336
|
+
segment.text_ = text.slice(0, split_start_character).trimEnd(); // this would be split_start_character + 1, but we want to remove the last "dot" because . ... looks weird
|
|
9337
|
+
return segment;
|
|
9338
|
+
} else if (i == split_end_segment) return [dots_segment, {
|
|
9339
|
+
...segment,
|
|
9340
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
9341
|
+
}];
|
|
9342
|
+
return []; // remove all segments inbetween
|
|
9343
|
+
});
|
|
9344
|
+
|
|
9345
|
+
segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
|
|
9346
|
+
$f3a159279dc1a8fb$var$heal_holes(segmented_text);
|
|
9347
|
+
}
|
|
9348
|
+
function $f3a159279dc1a8fb$var$heal_holes(segmented_text) {
|
|
9349
|
+
// try to heal "holes" created in the segments so there are only alternating segments
|
|
9350
|
+
const segments_to_delete = new Set();
|
|
9351
|
+
for (let i = 0; i < segmented_text.length; i++) {
|
|
9352
|
+
var _previous_segment, _previous_segment2;
|
|
9353
|
+
const segment = segmented_text[i];
|
|
9354
|
+
let previous_segment;
|
|
9355
|
+
for (let j = i - 1; j >= 0; j--) {
|
|
9356
|
+
previous_segment = segmented_text[j];
|
|
9357
|
+
// Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
|
|
9358
|
+
if (!segments_to_delete.has(previous_segment)) break;
|
|
9359
|
+
}
|
|
9360
|
+
if ((_previous_segment = previous_segment) !== null && _previous_segment !== void 0 && _previous_segment.highlighted_ && segment.highlighted_ || ((_previous_segment2 = previous_segment) === null || _previous_segment2 === void 0 ? void 0 : _previous_segment2.highlighted_) === false && segment.highlighted_ === false) {
|
|
9361
|
+
previous_segment.text_ += segment.text_; // IDK if this ever happens
|
|
9362
|
+
segments_to_delete.add(segment);
|
|
9363
|
+
}
|
|
9364
|
+
}
|
|
9365
|
+
for (const segment of segments_to_delete) {
|
|
9366
|
+
const index = segmented_text.indexOf(segment);
|
|
9367
|
+
segmented_text.splice(index, 1);
|
|
9368
|
+
}
|
|
9369
|
+
}
|
|
9370
|
+
function $f3a159279dc1a8fb$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text) {
|
|
9371
|
+
let be_very_aggressive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
|
|
9372
|
+
const should_loop_backwards = index_of_start_segment > index_of_end_segment;
|
|
9373
|
+
const step = should_loop_backwards ? -1 : 1;
|
|
9374
|
+
const desperate_split_attempts = [":", ";", ","];
|
|
9375
|
+
while (desperate_split_attempts.length) {
|
|
9376
|
+
const split_point_between_words = [];
|
|
9377
|
+
// for the middle also try to split with a few more characters if the default ones don't work over a full run
|
|
9378
|
+
const desperate_split_attempt = desperate_split_attempts.pop();
|
|
9379
|
+
let is_first_character = true;
|
|
9380
|
+
for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
|
|
9381
|
+
const segment = segmented_text[i];
|
|
9382
|
+
const text = segment.text_;
|
|
9383
|
+
for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
|
|
9384
|
+
const character = text[j];
|
|
9385
|
+
if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
|
|
9386
|
+
if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
|
|
9387
|
+
split_point_between_words.push([i, j]);
|
|
9388
|
+
if (split_point_between_words.length > 3)
|
|
9389
|
+
// We can't find a split point, so we'll just split between words
|
|
9390
|
+
// This is because for UI reasons we only want to show 2 lines of text, so we need to be very aggressive with getting the second match soon
|
|
9391
|
+
return split_point_between_words[1];
|
|
9392
|
+
}
|
|
9393
|
+
}
|
|
9394
|
+
}
|
|
9395
|
+
}
|
|
9396
|
+
return [];
|
|
9397
|
+
}
|
|
9398
|
+
function $f3a159279dc1a8fb$var$cut_start(cut_left_of_index, segmented_text) {
|
|
9399
|
+
// Cut the start of the text to bring the first matching token
|
|
9400
|
+
let is_first_character = false;
|
|
9401
|
+
let words_encountered = 0;
|
|
9402
|
+
outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
|
|
9403
|
+
const segment = segmented_text[i];
|
|
9404
|
+
// We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
|
|
9405
|
+
const text = segment.text_;
|
|
9406
|
+
for (let j = text.length - 1; j >= 0; j--) {
|
|
9407
|
+
const character = text[j];
|
|
9408
|
+
const is_space = character == " ";
|
|
9409
|
+
if (!is_first_character && is_space) words_encountered++;
|
|
9410
|
+
if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
|
|
9411
|
+
// We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
|
|
9412
|
+
segment.text_ = text.slice(j + 1).trimStart();
|
|
9413
|
+
segmented_text.splice(0, i);
|
|
9414
|
+
if (character === "," || is_space)
|
|
9415
|
+
// if we cut at a comma or psace, we add a … at the beginning
|
|
9416
|
+
segmented_text.unshift({
|
|
9417
|
+
text_: "… ",
|
|
9418
|
+
highlighted_: false
|
|
9419
|
+
});
|
|
9420
|
+
break outmost_loop;
|
|
9421
|
+
}
|
|
9422
|
+
if (is_first_character) is_first_character = false;
|
|
9423
|
+
}
|
|
9424
|
+
}
|
|
9425
|
+
$f3a159279dc1a8fb$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
|
|
9426
|
+
}
|
|
9427
|
+
|
|
9428
|
+
function $f3a159279dc1a8fb$var$segment_text(text, matched_strings) {
|
|
9429
|
+
// segment text where the matched strings are highlighted sections
|
|
9430
|
+
const output = [];
|
|
9431
|
+
if (!text) return; // shouldn't happen but whatever
|
|
9432
|
+
for (let i = 0; i < text.length; i++) {
|
|
9433
|
+
const found_strings = [];
|
|
9434
|
+
if (!i || text[i - 1] == " ")
|
|
9435
|
+
// only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
|
|
9436
|
+
for (let j = 0; j < matched_strings.length; j++) {
|
|
9437
|
+
const matched_string = matched_strings[j];
|
|
9438
|
+
const part_in_text = text.slice(i, i + matched_string.length);
|
|
9439
|
+
if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
|
|
9440
|
+
if (part_in_text.toLowerCase() === matched_string.toLowerCase()) found_strings.push(part_in_text); // use the casing from the text, not from typesense, can look weird otherwise
|
|
9441
|
+
}
|
|
9442
|
+
|
|
9443
|
+
const last_index_in_output = output.length - 1;
|
|
9444
|
+
if (!found_strings.length) {
|
|
9445
|
+
var _output$last_index_in;
|
|
9446
|
+
const character = text[i];
|
|
9447
|
+
if (((_output$last_index_in = output[last_index_in_output]) === null || _output$last_index_in === void 0 ? void 0 : _output$last_index_in.highlighted_) === false || output.length && /\s/.test(character))
|
|
9448
|
+
// always push whitespace characters to the last segment, this is because typesense doesn't see them as part of the matched tokens but we want to be able to detect "phat" matched segments
|
|
9449
|
+
output[last_index_in_output].text_ += character;else output.push({
|
|
9450
|
+
highlighted_: false,
|
|
9451
|
+
text_: character
|
|
9452
|
+
});
|
|
9453
|
+
} else {
|
|
9454
|
+
var _output$last_index_in2;
|
|
9455
|
+
const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
|
|
9456
|
+
if ((_output$last_index_in2 = output[last_index_in_output]) !== null && _output$last_index_in2 !== void 0 && _output$last_index_in2.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
|
|
9457
|
+
highlighted_: true,
|
|
9458
|
+
text_: longest_found_string
|
|
9459
|
+
});
|
|
9460
|
+
i += longest_found_string.length - 1;
|
|
9461
|
+
}
|
|
9462
|
+
}
|
|
9463
|
+
return output;
|
|
9464
|
+
}
|
|
9465
|
+
const $22470de5f42cc35d$var$_tmpl$ = /*#__PURE__*/(0, $8tj43$template)(`<a></a>`, 2),
|
|
9466
|
+
$22470de5f42cc35d$var$_tmpl$2 = /*#__PURE__*/(0, $8tj43$template)(`<div></div>`, 2),
|
|
9467
|
+
$22470de5f42cc35d$var$_tmpl$3 = /*#__PURE__*/(0, $8tj43$template)(`<div class="description line-clamp"></div>`, 2),
|
|
9468
|
+
$22470de5f42cc35d$var$_tmpl$4 = /*#__PURE__*/(0, $8tj43$template)(`<div class="content-card"><div class="image"></div><div class="info"><!#><!/><!#><!/></div></div>`, 10);
|
|
9469
|
+
function $22470de5f42cc35d$export$f631859cab12b342(_ref) {
|
|
9470
|
+
let {
|
|
9471
|
+
router_: router_,
|
|
9472
|
+
content_result_: content_result_
|
|
9473
|
+
} = _ref;
|
|
9474
|
+
const make_link_attributes = () => {
|
|
9475
|
+
const result = content_result_ === null || content_result_ === void 0 ? void 0 : content_result_();
|
|
9476
|
+
if (!result) return;
|
|
9477
|
+
return {
|
|
9478
|
+
href: result.page_url,
|
|
9479
|
+
onClick: (0, $8tj43$catchify)(ev => router_.navigate_.go_to_({
|
|
9480
|
+
new_url_: result.page_url,
|
|
9481
|
+
is_replace_: false,
|
|
9482
|
+
event_: ev
|
|
9483
|
+
}))
|
|
9484
|
+
};
|
|
9485
|
+
};
|
|
9486
|
+
const LinkIfPossible = _ref2 => {
|
|
9487
|
+
let {
|
|
9488
|
+
children: children,
|
|
9489
|
+
...attributes
|
|
9490
|
+
} = _ref2;
|
|
9491
|
+
if (content_result_) return (() => {
|
|
9492
|
+
const _el$ = (0, $8tj43$getNextElement)($22470de5f42cc35d$var$_tmpl$);
|
|
9493
|
+
(0, $8tj43$spread)(_el$, attributes, false, true);
|
|
9494
|
+
(0, $8tj43$insert)(_el$, children);
|
|
9495
|
+
(0, $8tj43$runHydrationEvents)();
|
|
9496
|
+
return _el$;
|
|
9497
|
+
})();
|
|
9498
|
+
return (() => {
|
|
9499
|
+
const _el$2 = (0, $8tj43$getNextElement)($22470de5f42cc35d$var$_tmpl$2);
|
|
9500
|
+
(0, $8tj43$spread)(_el$2, attributes, false, true);
|
|
9501
|
+
(0, $8tj43$insert)(_el$2, children);
|
|
9502
|
+
(0, $8tj43$runHydrationEvents)();
|
|
9503
|
+
return _el$2;
|
|
9504
|
+
})();
|
|
9505
|
+
};
|
|
9506
|
+
return (() => {
|
|
9507
|
+
const _el$3 = (0, $8tj43$getNextElement)($22470de5f42cc35d$var$_tmpl$4),
|
|
9508
|
+
_el$4 = _el$3.firstChild,
|
|
9509
|
+
_el$5 = _el$4.nextSibling,
|
|
9510
|
+
_el$7 = _el$5.firstChild,
|
|
9511
|
+
[_el$8, _co$] = (0, $8tj43$getNextMarker)(_el$7.nextSibling),
|
|
9512
|
+
_el$9 = _el$8.nextSibling,
|
|
9513
|
+
[_el$10, _co$2] = (0, $8tj43$getNextMarker)(_el$9.nextSibling);
|
|
9514
|
+
(0, $8tj43$insert)(_el$4, (0, $8tj43$createComponent)(LinkIfPossible, (0, $8tj43$mergeProps)(make_link_attributes, {
|
|
9515
|
+
tabIndex: "-1",
|
|
9516
|
+
get children() {
|
|
9517
|
+
return (0, $8tj43$createComponent)((0, $3c5e15c6ee4227a9$export$605674723bcc715c), {
|
|
9518
|
+
width: "28",
|
|
9519
|
+
height: "28"
|
|
9520
|
+
});
|
|
9521
|
+
}
|
|
9522
|
+
})));
|
|
9523
|
+
(0, $8tj43$insert)(_el$5, (0, $8tj43$createComponent)(LinkIfPossible, (0, $8tj43$mergeProps)({
|
|
9524
|
+
"class": "content-title line-clamp"
|
|
9525
|
+
}, make_link_attributes, {
|
|
9526
|
+
get title() {
|
|
9527
|
+
return content_result_ === null || content_result_ === void 0 ? void 0 : content_result_().title;
|
|
9528
|
+
},
|
|
9529
|
+
get children() {
|
|
9530
|
+
return content_result_ ? (0, $8tj43$createComponent)((0, $f3a159279dc1a8fb$export$e1a98a189fd2c0e7), {
|
|
9531
|
+
content_result_: content_result_,
|
|
9532
|
+
key_: "title",
|
|
9533
|
+
cut_when_possible_: false
|
|
9534
|
+
}) : (0, $8tj43$createComponent)((0, $ceafb6fb91c6f394$export$89c6019e4baa40b1), {
|
|
9535
|
+
height: "1em",
|
|
9536
|
+
width: "20ch"
|
|
9537
|
+
});
|
|
9538
|
+
}
|
|
9539
|
+
})), _el$8, _co$);
|
|
9540
|
+
(0, $8tj43$insert)(_el$5, (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
9541
|
+
get when() {
|
|
9542
|
+
return (content_result_ === null || content_result_ === void 0 ? void 0 : content_result_().description) || !content_result_;
|
|
9543
|
+
},
|
|
9544
|
+
get children() {
|
|
9545
|
+
const _el$6 = (0, $8tj43$getNextElement)($22470de5f42cc35d$var$_tmpl$3);
|
|
9546
|
+
(0, $8tj43$insert)(_el$6, (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
9547
|
+
when: content_result_,
|
|
9548
|
+
get fallback() {
|
|
9549
|
+
return Array.from({
|
|
9550
|
+
length: 4
|
|
9551
|
+
}).map(() => (0, $8tj43$createComponent)((0, $ceafb6fb91c6f394$export$89c6019e4baa40b1), {
|
|
9552
|
+
height: "1em",
|
|
9553
|
+
width: "min(50ch, 100%)"
|
|
9554
|
+
}));
|
|
9555
|
+
},
|
|
9556
|
+
get children() {
|
|
9557
|
+
return (0, $8tj43$createComponent)((0, $f3a159279dc1a8fb$export$e1a98a189fd2c0e7), {
|
|
9558
|
+
content_result_: content_result_,
|
|
9559
|
+
key_: "description",
|
|
9560
|
+
cut_when_possible_: true
|
|
9561
|
+
});
|
|
9562
|
+
}
|
|
9563
|
+
}));
|
|
9564
|
+
return _el$6;
|
|
9565
|
+
}
|
|
9566
|
+
}), _el$10, _co$2);
|
|
9567
|
+
return _el$3;
|
|
9568
|
+
})();
|
|
9569
|
+
}
|
|
9570
|
+
function $881e8953a9103f10$export$9ff751cd77687edc(_ref) {
|
|
9571
|
+
let {
|
|
9572
|
+
search_results_: search_results_,
|
|
9573
|
+
router_: router_
|
|
9574
|
+
} = _ref;
|
|
9575
|
+
const content_results = (0, $8tj43$createMemo)(() => {
|
|
9576
|
+
var _search_results_;
|
|
9577
|
+
return (_search_results_ = search_results_()) === null || _search_results_ === void 0 ? void 0 : _search_results_.content_search_links;
|
|
9578
|
+
});
|
|
9579
|
+
const content_results_by_page_url = (0, $8tj43$createMemo)(() => {
|
|
9580
|
+
const map = new Map();
|
|
9581
|
+
const results = content_results();
|
|
9582
|
+
if (!results) return map;
|
|
9583
|
+
for (let i = 0; i < results.length; i++) {
|
|
9584
|
+
const content_result = results[i];
|
|
9585
|
+
map.set(content_result.page_url, content_result);
|
|
9586
|
+
}
|
|
9587
|
+
return map;
|
|
9588
|
+
});
|
|
9589
|
+
return (0, $8tj43$createComponent)((0, $8tj43$For), {
|
|
9590
|
+
get each() {
|
|
9591
|
+
return [...content_results_by_page_url().keys()];
|
|
9592
|
+
},
|
|
9593
|
+
children: page_url => {
|
|
9594
|
+
const content_result = (0, $8tj43$createMemo)(() => content_results_by_page_url().get(page_url));
|
|
9595
|
+
return (0, $8tj43$createComponent)((0, $22470de5f42cc35d$export$f631859cab12b342), {
|
|
9596
|
+
content_result_: content_result,
|
|
9597
|
+
router_: router_
|
|
9598
|
+
});
|
|
9599
|
+
}
|
|
9600
|
+
});
|
|
9601
|
+
}
|
|
9602
|
+
function $ad4f3c9872fbeb48$export$4405d077f0a20494(_ref) {
|
|
9603
|
+
let {
|
|
9604
|
+
content_results_rows_: [get_history_state_content_results_rows],
|
|
9605
|
+
cols_at_size_: cols_at_size_
|
|
9606
|
+
} = _ref;
|
|
9607
|
+
const largest_column = (0, $8tj43$createMemo)(() => {
|
|
9608
|
+
const largest_in_cols_at_size = Math.max(...cols_at_size_().map(_ref2 => {
|
|
9609
|
+
let [cols] = _ref2;
|
|
9610
|
+
return cols;
|
|
9611
|
+
}));
|
|
9612
|
+
if (isNaN(largest_in_cols_at_size) || Math.abs(largest_in_cols_at_size) === Infinity) return 4; // fallback to something big so we always have the right amount of placeholders
|
|
9613
|
+
return largest_in_cols_at_size;
|
|
9614
|
+
});
|
|
9615
|
+
const num_placeholders = (0, $8tj43$createMemo)(() => {
|
|
9616
|
+
var _get_history_state_co;
|
|
9617
|
+
return ((_get_history_state_co = get_history_state_content_results_rows()) !== null && _get_history_state_co !== void 0 ? _get_history_state_co : (0, $d53ebed6f63304e4$export$70ceae36059a1036)) * largest_column();
|
|
9618
|
+
});
|
|
9619
|
+
return (0, $8tj43$createComponent)((0, $8tj43$Index), {
|
|
9620
|
+
get each() {
|
|
9621
|
+
return Array.from({
|
|
9622
|
+
length: num_placeholders()
|
|
9623
|
+
});
|
|
9624
|
+
},
|
|
9625
|
+
children: () => (0, $8tj43$createComponent)((0, $22470de5f42cc35d$export$f631859cab12b342), {})
|
|
9626
|
+
});
|
|
9627
|
+
}
|
|
9628
|
+
const $d53ebed6f63304e4$var$_tmpl$ = /*#__PURE__*/(0, $8tj43$template)(`<div class="content-results"><!#><!/><!#><!/></div>`, 6),
|
|
9629
|
+
$d53ebed6f63304e4$var$_tmpl$2 = /*#__PURE__*/(0, $8tj43$template)(`<button class="view-more"></button>`, 2),
|
|
9630
|
+
$d53ebed6f63304e4$var$_tmpl$3 = /*#__PURE__*/(0, $8tj43$template)(`<button class="view-less"></button>`, 2);
|
|
9631
|
+
const $d53ebed6f63304e4$export$70ceae36059a1036 = 1;
|
|
9632
|
+
function $d53ebed6f63304e4$export$6d0c9c22f6652669(_ref) {
|
|
9633
|
+
let {
|
|
9634
|
+
search_results_: search_results_,
|
|
9635
|
+
get_search_query_: get_search_query_,
|
|
9636
|
+
i18n_: i18n_,
|
|
9637
|
+
layout_options_: layout_options_,
|
|
9638
|
+
router_: router_,
|
|
9639
|
+
query_base_: query_base_,
|
|
9640
|
+
content_results_rows_: content_results_rows_
|
|
9641
|
+
} = _ref;
|
|
9642
|
+
const content_results = (0, $8tj43$createMemo)(() => {
|
|
9643
|
+
var _search_results_;
|
|
9644
|
+
return (_search_results_ = search_results_()) === null || _search_results_ === void 0 ? void 0 : _search_results_.content_search_links;
|
|
9645
|
+
});
|
|
9646
|
+
const num_results = (0, $8tj43$createMemo)(() => {
|
|
9647
|
+
var _content_results;
|
|
9648
|
+
return (_content_results = content_results()) === null || _content_results === void 0 ? void 0 : _content_results.length;
|
|
9649
|
+
});
|
|
9650
|
+
const is_loading_ = (0, $8tj43$createMemo)(() => search_results_.loading || query_base_.loading); // See comment in PLPResults/index.tsx on why we need this
|
|
9651
|
+
const formatted_number_of_results_ = (0, $43fbdca0f726a34b$export$92f2da32c6e7e7ee)({
|
|
9652
|
+
number_: num_results,
|
|
9653
|
+
i18n_: i18n_
|
|
9654
|
+
});
|
|
9655
|
+
const [is_showing_placeholders, set_is_showing_placeholders] = (0, $8tj43$createSignal)(false);
|
|
9656
|
+
const rows_object = $d53ebed6f63304e4$var$make_state_saved_rows(content_results_rows_, i18n_);
|
|
9657
|
+
return (() => {
|
|
9658
|
+
const _el$ = (0, $8tj43$getNextElement)($d53ebed6f63304e4$var$_tmpl$),
|
|
9659
|
+
_el$2 = _el$.firstChild,
|
|
9660
|
+
[_el$3, _co$] = (0, $8tj43$getNextMarker)(_el$2.nextSibling),
|
|
9661
|
+
_el$4 = _el$3.nextSibling,
|
|
9662
|
+
[_el$5, _co$2] = (0, $8tj43$getNextMarker)(_el$4.nextSibling);
|
|
9663
|
+
(0, $8tj43$insert)(_el$, (0, $8tj43$createComponent)((0, $69602b3d8fd54c38$export$9dd50d35b9d94fdf), {
|
|
9664
|
+
get_search_query_: get_search_query_,
|
|
9665
|
+
i18n_: i18n_,
|
|
9666
|
+
formatted_number_of_results_: formatted_number_of_results_,
|
|
9667
|
+
get type() {
|
|
9668
|
+
return (0, $69602b3d8fd54c38$export$2452208c79fe93ea).content;
|
|
9669
|
+
},
|
|
9670
|
+
number_of_results_: num_results
|
|
9671
|
+
}), _el$3, _co$);
|
|
9672
|
+
(0, $8tj43$insert)(_el$, (0, $8tj43$createComponent)((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), (0, $8tj43$mergeProps)({
|
|
9673
|
+
layout: "grid",
|
|
9674
|
+
element_attributes: {
|
|
9675
|
+
class: "cards"
|
|
9676
|
+
}
|
|
9677
|
+
}, layout_options_, {
|
|
9678
|
+
rows: rows_object,
|
|
9679
|
+
get children() {
|
|
9680
|
+
return (0, $8tj43$createComponent)((0, $8tj43$Suspense), {
|
|
9681
|
+
get fallback() {
|
|
9682
|
+
return (() => {
|
|
9683
|
+
set_is_showing_placeholders(true);
|
|
9684
|
+
(0, $8tj43$onCleanup)(() => set_is_showing_placeholders(false));
|
|
9685
|
+
return (0, $8tj43$createComponent)((0, $ad4f3c9872fbeb48$export$4405d077f0a20494), {
|
|
9686
|
+
content_results_rows_: content_results_rows_,
|
|
9687
|
+
get cols_at_size_() {
|
|
9688
|
+
return (0, $8tj43$createMemo)(() => layout_options_().cols_at_size);
|
|
9689
|
+
}
|
|
9690
|
+
});
|
|
9691
|
+
})();
|
|
9692
|
+
},
|
|
9693
|
+
get children() {
|
|
9694
|
+
return (0, $8tj43$createComponent)((0, $881e8953a9103f10$export$9ff751cd77687edc), {
|
|
9695
|
+
router_: router_,
|
|
9696
|
+
search_results_: search_results_
|
|
9697
|
+
});
|
|
9698
|
+
}
|
|
9699
|
+
});
|
|
9700
|
+
}
|
|
9701
|
+
})), _el$5, _co$2);
|
|
9702
|
+
(0, $8tj43$effect)(_p$ => {
|
|
9703
|
+
var _content_results2;
|
|
9704
|
+
const _v$ = !!is_showing_placeholders(),
|
|
9705
|
+
_v$2 = is_loading_() || ((_content_results2 = content_results()) === null || _content_results2 === void 0 ? void 0 : _content_results2.length) > 0 ? "" : "none";
|
|
9706
|
+
_v$ !== _p$._v$ && _el$.classList.toggle("loading", _p$._v$ = _v$);
|
|
9707
|
+
_v$2 !== _p$._v$2 && _el$.style.setProperty("display", _p$._v$2 = _v$2);
|
|
9708
|
+
return _p$;
|
|
9709
|
+
}, {
|
|
9710
|
+
_v$: undefined,
|
|
9711
|
+
_v$2: undefined
|
|
9712
|
+
});
|
|
9713
|
+
return _el$;
|
|
9714
|
+
})();
|
|
9715
|
+
}
|
|
9716
|
+
function $d53ebed6f63304e4$var$make_state_saved_rows(_ref2, i18n_) {
|
|
9717
|
+
let [get_showing_content_results_rows, set_showing_content_results_rows] = _ref2;
|
|
9718
|
+
const currently_visible = (0, $8tj43$createSignal)((0, $8tj43$untrack)(get_showing_content_results_rows));
|
|
9719
|
+
const [get_currently_visible, set_currently_visible] = currently_visible;
|
|
9720
|
+
const rows = {
|
|
9721
|
+
currently_visible: currently_visible,
|
|
9722
|
+
start_rows: $d53ebed6f63304e4$export$70ceae36059a1036,
|
|
9723
|
+
button: (() => {
|
|
9724
|
+
const _el$6 = (0, $8tj43$getNextElement)($d53ebed6f63304e4$var$_tmpl$2);
|
|
9725
|
+
(0, $8tj43$insert)(_el$6, () => i18n_.view_more_());
|
|
9726
|
+
return _el$6;
|
|
9727
|
+
})(),
|
|
9728
|
+
view_less_button: (() => {
|
|
9729
|
+
const _el$7 = (0, $8tj43$getNextElement)($d53ebed6f63304e4$var$_tmpl$3);
|
|
9730
|
+
(0, $8tj43$insert)(_el$7, () => i18n_.view_less_());
|
|
9731
|
+
return _el$7;
|
|
9732
|
+
})(),
|
|
9733
|
+
rows_per_click: 3
|
|
9734
|
+
};
|
|
9735
|
+
(0, $8tj43$createComputed)((0, $8tj43$on)(get_currently_visible, new_visible => set_showing_content_results_rows(new_visible), {
|
|
9736
|
+
defer: true
|
|
9737
|
+
}));
|
|
9738
|
+
(0, $8tj43$createComputed)((0, $8tj43$on)(get_showing_content_results_rows, function () {
|
|
9739
|
+
let new_rows = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $d53ebed6f63304e4$export$70ceae36059a1036;
|
|
9740
|
+
return set_currently_visible(new_rows);
|
|
9741
|
+
}, {
|
|
9742
|
+
defer: true
|
|
9743
|
+
}));
|
|
9744
|
+
return rows;
|
|
9745
|
+
}
|
|
9035
9746
|
const $da279c5a540c6846$var$_tmpl$ = /*#__PURE__*/(0, $8tj43$template)(`<div class="filter-results-for-one-row"><!#><!/><!#><!/></div>`, 6),
|
|
9036
|
-
$da279c5a540c6846$var$_tmpl$2 = /*#__PURE__*/(0, $8tj43$template)(`<div class="depict plp search"><div class="listing-page"
|
|
9747
|
+
$da279c5a540c6846$var$_tmpl$2 = /*#__PURE__*/(0, $8tj43$template)(`<div class="depict plp search"><div class="listing-page"><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/></div><!#><!/><!#><!/></div>`, 22);
|
|
9037
9748
|
function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
9038
9749
|
let {
|
|
9039
9750
|
depict_api_: depict_api_,
|
|
@@ -9063,7 +9774,11 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
9063
9774
|
recommendations_layout_options_: recommendations_layout_options_,
|
|
9064
9775
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
9065
9776
|
product_card_template_: product_card_template_,
|
|
9066
|
-
modal_body_style_ref_: modal_body_style_ref_
|
|
9777
|
+
modal_body_style_ref_: modal_body_style_ref_,
|
|
9778
|
+
router_: router_,
|
|
9779
|
+
content_results_rows_: content_results_rows_,
|
|
9780
|
+
content_layout_options_: content_layout_options_,
|
|
9781
|
+
content_search_enabled_: content_search_enabled_
|
|
9067
9782
|
} = _ref;
|
|
9068
9783
|
const [get_sorting] = current_sorting_;
|
|
9069
9784
|
const all_products_loaded_ = (0, $8tj43$createSignal)(false);
|
|
@@ -9130,16 +9845,29 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
9130
9845
|
const SafeSearchField = (0, $8tj43$catchify)((0, $584c06c09cf4609d$export$b94867ecbd698f21));
|
|
9131
9846
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $8tj43$createSignal)(false);
|
|
9132
9847
|
const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $8tj43$createSignal)();
|
|
9848
|
+
const n_hits = (0, $8tj43$createMemo)(() => {
|
|
9849
|
+
var _search_results_3;
|
|
9850
|
+
return (_search_results_3 = search_results_()) === null || _search_results_3 === void 0 ? void 0 : _search_results_3.n_hits;
|
|
9851
|
+
});
|
|
9133
9852
|
const formatted_number_of_results_ = (0, $43fbdca0f726a34b$export$92f2da32c6e7e7ee)({
|
|
9134
|
-
|
|
9853
|
+
number_: n_hits,
|
|
9135
9854
|
i18n_: i18n_
|
|
9136
9855
|
});
|
|
9137
9856
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $8tj43$createSignal)();
|
|
9138
|
-
const
|
|
9857
|
+
const no_results_text_ = (0, $8tj43$createMemo)(() => {
|
|
9858
|
+
var _search_results_4, _search_results_4$con;
|
|
9859
|
+
return ((_search_results_4 = search_results_()) !== null && _search_results_4 !== void 0 && (_search_results_4$con = _search_results_4.content_search_links) !== null && _search_results_4$con !== void 0 && _search_results_4$con.length ? i18n_.no_products_ : i18n_.no_results_text_)();
|
|
9860
|
+
});
|
|
9861
|
+
const results_for = (0, $8tj43$createComponent)((0, $69602b3d8fd54c38$export$9dd50d35b9d94fdf), (0, $8tj43$mergeProps)({
|
|
9862
|
+
get type() {
|
|
9863
|
+
return (0, $69602b3d8fd54c38$export$2452208c79fe93ea).products;
|
|
9864
|
+
},
|
|
9865
|
+
number_of_results_: n_hits
|
|
9866
|
+
}, {
|
|
9139
9867
|
get_search_query_: get_search_query_,
|
|
9140
9868
|
i18n_: i18n_,
|
|
9141
9869
|
formatted_number_of_results_: formatted_number_of_results_
|
|
9142
|
-
});
|
|
9870
|
+
}));
|
|
9143
9871
|
const filters_opener = (0, $7396052a1484264f$export$d7841e452f2e59a8)({
|
|
9144
9872
|
set_sort_or_filter_open_: set_sort_or_filter_open_,
|
|
9145
9873
|
set_extra_els_in_results_container_: set_desktop_filter_elements,
|
|
@@ -9263,10 +9991,12 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
9263
9991
|
[_el$17, _co$7] = (0, $8tj43$getNextMarker)(_el$16.nextSibling),
|
|
9264
9992
|
_el$18 = _el$17.nextSibling,
|
|
9265
9993
|
[_el$19, _co$8] = (0, $8tj43$getNextMarker)(_el$18.nextSibling),
|
|
9266
|
-
_el$20 = _el$
|
|
9994
|
+
_el$20 = _el$19.nextSibling,
|
|
9267
9995
|
[_el$21, _co$9] = (0, $8tj43$getNextMarker)(_el$20.nextSibling),
|
|
9268
|
-
_el$22 = _el$
|
|
9269
|
-
[_el$23, _co$10] = (0, $8tj43$getNextMarker)(_el$22.nextSibling)
|
|
9996
|
+
_el$22 = _el$7.nextSibling,
|
|
9997
|
+
[_el$23, _co$10] = (0, $8tj43$getNextMarker)(_el$22.nextSibling),
|
|
9998
|
+
_el$24 = _el$23.nextSibling,
|
|
9999
|
+
[_el$25, _co$11] = (0, $8tj43$getNextMarker)(_el$24.nextSibling);
|
|
9270
10000
|
(0, $8tj43$insert)(_el$7, get_search_field_elements, _el$9, _co$3);
|
|
9271
10001
|
(0, $8tj43$insert)(_el$7, make_category_suggestion_card_ ? (0, $8tj43$createComponent)((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
|
|
9272
10002
|
severity_: "error",
|
|
@@ -9278,7 +10008,29 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
9278
10008
|
});
|
|
9279
10009
|
}
|
|
9280
10010
|
}) : null, _el$11, _co$4);
|
|
9281
|
-
(0, $8tj43$insert)(_el$7, (
|
|
10011
|
+
(0, $8tj43$insert)(_el$7, (0, $8tj43$createComponent)((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
|
|
10012
|
+
severity_: "error",
|
|
10013
|
+
message_: "ContentResults failed",
|
|
10014
|
+
get children() {
|
|
10015
|
+
return (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
10016
|
+
get when() {
|
|
10017
|
+
return content_search_enabled_();
|
|
10018
|
+
},
|
|
10019
|
+
get children() {
|
|
10020
|
+
return (0, $8tj43$createComponent)((0, $d53ebed6f63304e4$export$6d0c9c22f6652669), {
|
|
10021
|
+
content_results_rows_: content_results_rows_,
|
|
10022
|
+
search_results_: search_results_,
|
|
10023
|
+
i18n_: i18n_,
|
|
10024
|
+
get_search_query_: get_search_query_,
|
|
10025
|
+
layout_options_: content_layout_options_,
|
|
10026
|
+
router_: router_,
|
|
10027
|
+
query_base_: search_query_base_
|
|
10028
|
+
});
|
|
10029
|
+
}
|
|
10030
|
+
});
|
|
10031
|
+
}
|
|
10032
|
+
}), _el$13, _co$5);
|
|
10033
|
+
(0, $8tj43$insert)(_el$7, () => results_filters[0](), _el$15, _co$6);
|
|
9282
10034
|
(0, $8tj43$insert)(_el$7, (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
9283
10035
|
get when() {
|
|
9284
10036
|
var _selected_filters_$;
|
|
@@ -9302,7 +10054,7 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
9302
10054
|
}
|
|
9303
10055
|
});
|
|
9304
10056
|
}
|
|
9305
|
-
}), _el$
|
|
10057
|
+
}), _el$17, _co$7);
|
|
9306
10058
|
(0, $8tj43$insert)(_el$7, (0, $8tj43$createComponent)((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
|
|
9307
10059
|
severity_: "error",
|
|
9308
10060
|
message_: "Search results failed",
|
|
@@ -9325,11 +10077,14 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
9325
10077
|
selected_filters_: selected_filters_,
|
|
9326
10078
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
9327
10079
|
local_filter_cache_: local_filter_cache_,
|
|
9328
|
-
i18n_:
|
|
10080
|
+
i18n_: {
|
|
10081
|
+
...i18n_,
|
|
10082
|
+
no_results_text_: no_results_text_
|
|
10083
|
+
}
|
|
9329
10084
|
}
|
|
9330
10085
|
});
|
|
9331
10086
|
}
|
|
9332
|
-
}), _el$
|
|
10087
|
+
}), _el$19, _co$8);
|
|
9333
10088
|
(0, $8tj43$insert)(_el$7, (0, $8tj43$createComponent)((0, $8tj43$Show), {
|
|
9334
10089
|
get when() {
|
|
9335
10090
|
return get_all_products_loaded() && !disable_search_recommendations_;
|
|
@@ -9357,7 +10112,7 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
9357
10112
|
}
|
|
9358
10113
|
});
|
|
9359
10114
|
}
|
|
9360
|
-
}), _el$
|
|
10115
|
+
}), _el$21, _co$9);
|
|
9361
10116
|
(0, $8tj43$insert)(_el$6, (0, $8tj43$createComponent)((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
|
|
9362
10117
|
message_: "Scroll status failed",
|
|
9363
10118
|
severity_: "error",
|
|
@@ -9368,12 +10123,12 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
9368
10123
|
formatted_number_of_results_: formatted_number_of_results_,
|
|
9369
10124
|
i18n_: i18n_,
|
|
9370
10125
|
number_of_results_: (0, $8tj43$createMemo)(() => {
|
|
9371
|
-
var
|
|
9372
|
-
return (
|
|
10126
|
+
var _search_results_5;
|
|
10127
|
+
return (_search_results_5 = search_results_()) === null || _search_results_5 === void 0 ? void 0 : _search_results_5.n_hits;
|
|
9373
10128
|
})
|
|
9374
10129
|
});
|
|
9375
10130
|
}
|
|
9376
|
-
}), _el$
|
|
10131
|
+
}), _el$23, _co$10);
|
|
9377
10132
|
(0, $8tj43$insert)(_el$6, (0, $8tj43$createComponent)((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
|
|
9378
10133
|
message_: "Floating buttons failed",
|
|
9379
10134
|
severity_: "error",
|
|
@@ -9386,7 +10141,7 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
|
|
|
9386
10141
|
i18n_: i18n_
|
|
9387
10142
|
});
|
|
9388
10143
|
}
|
|
9389
|
-
}), _el$
|
|
10144
|
+
}), _el$25, _co$11);
|
|
9390
10145
|
(0, $8tj43$effect)(() => (0, $8tj43$setAttribute)(_el$6, "id", (0, $c3820807ac1e6fd7$export$44dad306455dddf).SEARCH_PAGE));
|
|
9391
10146
|
return _el$6;
|
|
9392
10147
|
})()];
|
|
@@ -9411,6 +10166,38 @@ function $37e8c97bb6876197$export$828dcdd425fd3231(aligner) {
|
|
|
9411
10166
|
cleanup: cleanup
|
|
9412
10167
|
};
|
|
9413
10168
|
}
|
|
10169
|
+
|
|
10170
|
+
/**
|
|
10171
|
+
* Content results ContentCard look stupid on mobile if there are two columns of them, so we limit the number of columns to 1 if the screen is too small
|
|
10172
|
+
*/
|
|
10173
|
+
function $3f7203368ad0d3ca$export$ff7109b9b2b206ba(sdk_cols_at_size) {
|
|
10174
|
+
let min_width_for_more_than_one_column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
|
|
10175
|
+
if (!sdk_cols_at_size.length) return sdk_cols_at_size;
|
|
10176
|
+
const sorted_sizes = sdk_cols_at_size.map(_ref => {
|
|
10177
|
+
let [cols, max_width] = _ref;
|
|
10178
|
+
return [cols, max_width !== null && max_width !== void 0 ? max_width : Infinity];
|
|
10179
|
+
}).sort((_ref2, _ref3) => {
|
|
10180
|
+
let [, a] = _ref2;
|
|
10181
|
+
let [, b] = _ref3;
|
|
10182
|
+
return a - b;
|
|
10183
|
+
});
|
|
10184
|
+
const [[, smallest_max_width]] = sorted_sizes;
|
|
10185
|
+
if (smallest_max_width > min_width_for_more_than_one_column)
|
|
10186
|
+
// If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
|
|
10187
|
+
return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
|
|
10188
|
+
const to_delete = [];
|
|
10189
|
+
for (let i = 0; i < sorted_sizes.length; i++) {
|
|
10190
|
+
const [, max_width] = sorted_sizes[i];
|
|
10191
|
+
if (max_width > min_width_for_more_than_one_column) continue;
|
|
10192
|
+
to_delete.push(i);
|
|
10193
|
+
}
|
|
10194
|
+
while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
|
|
10195
|
+
sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
|
|
10196
|
+
return sorted_sizes.map(_ref4 => {
|
|
10197
|
+
let [cols, max_width] = _ref4;
|
|
10198
|
+
return max_width == Infinity ? [cols] : [cols, max_width];
|
|
10199
|
+
});
|
|
10200
|
+
}
|
|
9414
10201
|
const $eb064bc3350276c1$var$_tmpl$ = /*#__PURE__*/(0, $8tj43$template)(`<div class="depict plp search"></div>`, 2);
|
|
9415
10202
|
function $eb064bc3350276c1$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
|
|
9416
10203
|
$eb064bc3350276c1$var$_checkPrivateRedeclaration(obj, privateMap);
|
|
@@ -9442,6 +10229,7 @@ function $eb064bc3350276c1$var$_classApplyDescriptorGet(receiver, descriptor) {
|
|
|
9442
10229
|
* Type for the private properties that are shared between the different exported search SDK wrapper functions. SDK users are not allowed to change/access these, they're an internal implementation detail.
|
|
9443
10230
|
*/
|
|
9444
10231
|
const $eb064bc3350276c1$var$privately_shared_properties = /*@__PURE__*/new WeakMap();
|
|
10232
|
+
const $eb064bc3350276c1$var$content_search_default = false;
|
|
9445
10233
|
const $eb064bc3350276c1$var$min_products_to_fetch_ = 20;
|
|
9446
10234
|
const $eb064bc3350276c1$export$bde3eb976dfded9 = depict_search => {
|
|
9447
10235
|
var _privately_shared_pro;
|
|
@@ -9451,6 +10239,7 @@ var $eb064bc3350276c1$var$_locale_signal = /*#__PURE__*/new WeakMap();
|
|
|
9451
10239
|
var $eb064bc3350276c1$var$_merchant_signal = /*#__PURE__*/new WeakMap();
|
|
9452
10240
|
var $eb064bc3350276c1$var$_market_signal = /*#__PURE__*/new WeakMap();
|
|
9453
10241
|
var $eb064bc3350276c1$var$_modal_open_signal = /*#__PURE__*/new WeakMap();
|
|
10242
|
+
var $eb064bc3350276c1$var$_content_search_signal = /*#__PURE__*/new WeakMap();
|
|
9454
10243
|
var $eb064bc3350276c1$var$_router = /*#__PURE__*/new WeakMap();
|
|
9455
10244
|
class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
9456
10245
|
constructor(_ref) {
|
|
@@ -9462,9 +10251,10 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
|
9462
10251
|
on_navigation: on_navigation,
|
|
9463
10252
|
enable_category_suggestions = true,
|
|
9464
10253
|
page_url_creator: page_url_creator,
|
|
10254
|
+
display_transformers: display_transformers,
|
|
10255
|
+
api: api,
|
|
9465
10256
|
// Stuff needed for non-standard customer deployments that we shouldn't actually expose
|
|
9466
10257
|
disable_scrolling_during_modal = true,
|
|
9467
|
-
api: api,
|
|
9468
10258
|
bottom_distance_under_modal: bottom_distance_under_modal,
|
|
9469
10259
|
render_instant_card: render_instant_card,
|
|
9470
10260
|
...props_on_class
|
|
@@ -9485,6 +10275,10 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
|
9485
10275
|
writable: true,
|
|
9486
10276
|
value: (0, $8tj43$createSignal)(false)
|
|
9487
10277
|
});
|
|
10278
|
+
$eb064bc3350276c1$var$_classPrivateFieldInitSpec(this, $eb064bc3350276c1$var$_content_search_signal, {
|
|
10279
|
+
writable: true,
|
|
10280
|
+
value: (0, $8tj43$createSignal)()
|
|
10281
|
+
});
|
|
9488
10282
|
$eb064bc3350276c1$var$_classPrivateFieldInitSpec(this, $eb064bc3350276c1$var$_router, {
|
|
9489
10283
|
writable: true,
|
|
9490
10284
|
value: new (0, $ac571292d606f30b$export$7e1297a3a19f10d8)("hard_navigation")
|
|
@@ -9520,6 +10314,7 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
|
9520
10314
|
local_filter_cache: [],
|
|
9521
10315
|
expanded_hierarchical_filters: [],
|
|
9522
10316
|
showing_recommendation_rows: (0, $8ef6232475d44150$export$1c8c715550dc689d),
|
|
10317
|
+
content_results_rows: (0, $d53ebed6f63304e4$export$70ceae36059a1036),
|
|
9523
10318
|
scroll_restoration_data: []
|
|
9524
10319
|
};
|
|
9525
10320
|
},
|
|
@@ -9531,12 +10326,18 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
|
9531
10326
|
const get_search_query_ = (0, $8tj43$createMemo)(previous_value => {
|
|
9532
10327
|
if (get_search_query_updating_blocked()) return previous_value;else return raw_search_query_accessor();
|
|
9533
10328
|
});
|
|
10329
|
+
// @ts-ignore
|
|
9534
10330
|
const depict_api_ = api !== null && api !== void 0 ? api : new (0, $284849364a6ef73a$export$e015ed2f2950f2e3)({
|
|
9535
|
-
page_url_creator: page_url_creator
|
|
10331
|
+
page_url_creator: page_url_creator,
|
|
10332
|
+
display_transformers: display_transformers
|
|
9536
10333
|
});
|
|
9537
10334
|
const previous_searches = (0, $07d90b8270ece8de$export$84bba84a7b837187)(get_search_query_);
|
|
9538
10335
|
const [, set_search_showing_recommendation_rows] = state_.showing_recommendation_rows;
|
|
9539
|
-
const
|
|
10336
|
+
const [, set_search_content_results_rows] = state_.content_results_rows;
|
|
10337
|
+
const after_submit_ = () => {
|
|
10338
|
+
set_search_showing_recommendation_rows((0, $8ef6232475d44150$export$1c8c715550dc689d));
|
|
10339
|
+
set_search_content_results_rows((0, $d53ebed6f63304e4$export$70ceae36059a1036));
|
|
10340
|
+
}; // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
|
|
9540
10341
|
const on_submit_with_unchanged_value_ = () => this.modal_open = false;
|
|
9541
10342
|
const [get_search_field_value_, set_search_field_value_] = state_.field_value;
|
|
9542
10343
|
const configured_submit_query_ = new_query => (0, $86b0ff0c85e5fc6c$export$e16630ecb9644a1c)({
|
|
@@ -9594,6 +10395,10 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
|
9594
10395
|
submit_query_: configured_submit_query_,
|
|
9595
10396
|
url_transformer_: url_transformer,
|
|
9596
10397
|
router_: (0, $8tj43$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_router),
|
|
10398
|
+
content_search_enabled_: () => {
|
|
10399
|
+
var _classPrivateFieldGet2;
|
|
10400
|
+
return (_classPrivateFieldGet2 = (0, $8tj43$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_content_search_signal)[0]()) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : $eb064bc3350276c1$var$content_search_default;
|
|
10401
|
+
},
|
|
9597
10402
|
instant_results_options_: {
|
|
9598
10403
|
min_products_to_fetch_: $eb064bc3350276c1$var$min_products_to_fetch_,
|
|
9599
10404
|
render_instant_card_: render_instant_card,
|
|
@@ -9662,6 +10467,12 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
|
|
|
9662
10467
|
(0, $8tj43$onCleanup)(() => $eb064bc3350276c1$var$_classStaticPrivateFieldSpecGet($eb064bc3350276c1$export$ac6237957a15b3f0, $eb064bc3350276c1$export$ac6237957a15b3f0, $eb064bc3350276c1$var$_keys_constructed_with).delete(unique_instance_key_for_state));
|
|
9663
10468
|
});
|
|
9664
10469
|
}
|
|
10470
|
+
get enable_content_search() {
|
|
10471
|
+
return (0, $8tj43$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_content_search_signal)[0]();
|
|
10472
|
+
}
|
|
10473
|
+
set enable_content_search(new_state) {
|
|
10474
|
+
(0, $8tj43$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_content_search_signal)[1](new_state);
|
|
10475
|
+
}
|
|
9665
10476
|
get on_navigation() {
|
|
9666
10477
|
// The only non-reactive public property on the class (I don't see it making sense to have it reactive)
|
|
9667
10478
|
return (0, $8tj43$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_router).on_navigation_;
|
|
@@ -9748,6 +10559,10 @@ function $eb064bc3350276c1$export$f2dc7e4e4aa11abb(props) {
|
|
|
9748
10559
|
depict_api_: shared_properties.depict_api_,
|
|
9749
10560
|
min_products_to_fetch_: $eb064bc3350276c1$var$min_products_to_fetch_,
|
|
9750
10561
|
local_filter_cache_: state_.local_filter_cache,
|
|
10562
|
+
content_search_enabled_: () => {
|
|
10563
|
+
var _depict_search$enable;
|
|
10564
|
+
return (_depict_search$enable = depict_search.enable_content_search) !== null && _depict_search$enable !== void 0 ? _depict_search$enable : $eb064bc3350276c1$var$content_search_default;
|
|
10565
|
+
},
|
|
9751
10566
|
search_field_value_: state_.field_value,
|
|
9752
10567
|
get_search_query_: shared_properties.get_search_query_,
|
|
9753
10568
|
clear_filters_on_next_submit_: shared_properties.clear_filters_on_next_submit_,
|
|
@@ -9777,6 +10592,8 @@ function $eb064bc3350276c1$export$f2dc7e4e4aa11abb(props) {
|
|
|
9777
10592
|
search_filters_open_: state_.filters_open,
|
|
9778
10593
|
search_sorting_open_: state_.sorting_open,
|
|
9779
10594
|
expanded_filters_: state_.expanded_filters,
|
|
10595
|
+
content_results_rows_: state_.content_results_rows,
|
|
10596
|
+
router_: shared_properties.router_,
|
|
9780
10597
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
|
|
9781
10598
|
return (0, $dea31647b99a443b$export$d757d54550ebfb3d)({
|
|
9782
10599
|
category_suggestion_: category_suggestion_,
|
|
@@ -9792,6 +10609,10 @@ function $eb064bc3350276c1$export$f2dc7e4e4aa11abb(props) {
|
|
|
9792
10609
|
cols_at_size: (0, $a9c7ba6087881ac2$export$6daf8749b65a1b77)(props.cols_at_size),
|
|
9793
10610
|
...grid_spacing_override()
|
|
9794
10611
|
})),
|
|
10612
|
+
content_layout_options_: (0, $8tj43$createMemo)(() => ({
|
|
10613
|
+
cols_at_size: (0, $a9c7ba6087881ac2$export$6daf8749b65a1b77)((0, $3f7203368ad0d3ca$export$ff7109b9b2b206ba)(props.cols_at_size)),
|
|
10614
|
+
...grid_spacing_override()
|
|
10615
|
+
})),
|
|
9795
10616
|
recommendations_layout_options_: (0, $8tj43$createMemo)(() => {
|
|
9796
10617
|
const {
|
|
9797
10618
|
extra_depict_options: extra_depict_options
|