@depict-ai/ui 1.4.4 → 1.4.6
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 +1080 -251
- package/ES10/index.d.ts +105 -24
- package/ES10/index.js +1080 -251
- package/latest/index.cjs +978 -219
- package/latest/index.d.ts +105 -24
- package/latest/index.js +978 -219
- 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 +915 -179
- package/server/ES10/index.d.ts +105 -24
- package/server/ES10/index.js +915 -179
- package/server/latest/index.cjs +822 -153
- package/server/latest/index.d.ts +105 -24
- package/server/latest/index.js +822 -153
package/latest/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createSignal as $9HbP8$createSignal, createMemo as $9HbP8$createMemo, u
|
|
|
5
5
|
/*! Depict.ai search and product listing SDK */
|
|
6
6
|
import { register_es_version } from "../multi_import_deduplicator.mjs";
|
|
7
7
|
register_es_version("ui", "latest");
|
|
8
|
-
const $ec291e0010116877$export$83d89fbfd8236492 = "1.4.
|
|
8
|
+
const $ec291e0010116877$export$83d89fbfd8236492 = "1.4.6";
|
|
9
9
|
function $24e27fab9c821b86$export$5bad61ecde080b1f(...params) {
|
|
10
10
|
const {
|
|
11
11
|
collapse: collapse,
|
|
@@ -662,7 +662,7 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({
|
|
|
662
662
|
}
|
|
663
663
|
(0, $9HbP8$delegateEvents)(["click"]);
|
|
664
664
|
const $87c712b5b33f24f7$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$template)(`<span class="count"></span>`, 2),
|
|
665
|
-
$87c712b5b33f24f7$var$_tmpl$2 = /*#__PURE__*/(0, $9HbP8$template)(`<label class="input-row"><div class="left"><input type="checkbox"><span class="custom-indicator"></span><span class="text"></span></div><!#><!/></label>`, 11);
|
|
665
|
+
$87c712b5b33f24f7$var$_tmpl$2 = /*#__PURE__*/(0, $9HbP8$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);
|
|
666
666
|
const $87c712b5b33f24f7$export$48513f6b9f8ce62d = props => {
|
|
667
667
|
// 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
|
|
668
668
|
const count = (0, $9HbP8$createMemo)(() => props.count_);
|
|
@@ -2615,9 +2615,14 @@ function $c8d5ff4524619fcd$var$ActualSolidLayout(props, container_element) {
|
|
|
2615
2615
|
// Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
|
|
2616
2616
|
const show_all_rows = (0, $9HbP8$createMemo)(() => props.rows === "all");
|
|
2617
2617
|
const rows_or_empty_object = (0, $9HbP8$createMemo)(() => show_all_rows() ? {} : props.rows);
|
|
2618
|
-
const
|
|
2619
|
-
const
|
|
2620
|
-
|
|
2618
|
+
const view_more_button_elements = (0, $a52235d12ccf9c88$export$2f0cbfbb4354bb52)((0, $9HbP8$createMemo)(() => rows_or_empty_object().button));
|
|
2619
|
+
const view_less_button_elements = (0, $a52235d12ccf9c88$export$2f0cbfbb4354bb52)((0, $9HbP8$createMemo)(() => rows_or_empty_object().view_less_button));
|
|
2620
|
+
const have_a_view_more_button = (0, $9HbP8$createMemo)(() => {
|
|
2621
|
+
const button = view_more_button_elements();
|
|
2622
|
+
return !(!button || Array.isArray(button) && !button.length);
|
|
2623
|
+
});
|
|
2624
|
+
const have_a_view_less_button = (0, $9HbP8$createMemo)(() => {
|
|
2625
|
+
const button = view_less_button_elements();
|
|
2621
2626
|
return !(!button || Array.isArray(button) && !button.length);
|
|
2622
2627
|
});
|
|
2623
2628
|
const [get_styling, set_styling] = (0, $9HbP8$createSignal)();
|
|
@@ -2626,19 +2631,29 @@ function $c8d5ff4524619fcd$var$ActualSolidLayout(props, container_element) {
|
|
|
2626
2631
|
const [get_children_count, set_children_count] = (0, $9HbP8$createSignal)(0);
|
|
2627
2632
|
const update_children_count = () => set_children_count(container_element.children.length);
|
|
2628
2633
|
const col_styling = (0, $9HbP8$createMemo)(() => (0, $9HbP8$n_col_styling_with_dist)(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
|
|
2629
|
-
const default_currently_visible_signal = (0, $9HbP8$createSignal)(0); // 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
|
|
2634
|
+
const default_currently_visible_signal = (0, $9HbP8$createSignal)((0, $9HbP8$untrack)(() => rows_or_empty_object().start_rows ?? 1)); // 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
|
|
2630
2635
|
const rows_visible_signal = (0, $9HbP8$createMemo)(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
|
|
2631
2636
|
const get_rows_visible = (0, $9HbP8$createMemo)(() => rows_visible_signal()[0]());
|
|
2632
2637
|
const set_rows_visible = (0, $9HbP8$createMemo)(() => rows_visible_signal()[1]);
|
|
2633
|
-
const
|
|
2634
|
-
const
|
|
2638
|
+
const view_more_button_class = (0, $9HbP8$make_random_classname)();
|
|
2639
|
+
const view_less_button_class = (0, $9HbP8$make_random_classname)();
|
|
2640
|
+
const view_more_button_container = (0, $9HbP8$createMemo)(() => have_a_view_more_button() && (() => {
|
|
2635
2641
|
const _el$2 = (0, $9HbP8$getNextElement)($c8d5ff4524619fcd$var$_tmpl$);
|
|
2636
2642
|
(0, $9HbP8$addEventListener)(_el$2, "click", (0, $9HbP8$catchify)(() => set_rows_visible()(prev => prev + (rows_or_empty_object().rows_per_click ?? 1))), true);
|
|
2637
|
-
(0, $9HbP8$className)(_el$2,
|
|
2643
|
+
(0, $9HbP8$className)(_el$2, `load-more-container ${view_more_button_class}`);
|
|
2638
2644
|
(0, $9HbP8$insert)(_el$2, () => rows_or_empty_object().button);
|
|
2639
2645
|
(0, $9HbP8$runHydrationEvents)();
|
|
2640
2646
|
return _el$2;
|
|
2641
2647
|
})());
|
|
2648
|
+
// 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
|
|
2649
|
+
const view_less_button_container = (0, $9HbP8$createMemo)(() => have_a_view_less_button() && (() => {
|
|
2650
|
+
const _el$3 = (0, $9HbP8$getNextElement)($c8d5ff4524619fcd$var$_tmpl$);
|
|
2651
|
+
(0, $9HbP8$addEventListener)(_el$3, "click", (0, $9HbP8$catchify)(() => set_rows_visible()(() => rows_or_empty_object().start_rows ?? 1)), true);
|
|
2652
|
+
(0, $9HbP8$className)(_el$3, `load-less-container ${view_less_button_class}`);
|
|
2653
|
+
(0, $9HbP8$insert)(_el$3, () => rows_or_empty_object().view_less_button);
|
|
2654
|
+
(0, $9HbP8$runHydrationEvents)();
|
|
2655
|
+
return _el$3;
|
|
2656
|
+
})());
|
|
2642
2657
|
container_element.classList.add(container_class);
|
|
2643
2658
|
(0, $9HbP8$createComputed)(() => {
|
|
2644
2659
|
// Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
|
|
@@ -2653,7 +2668,6 @@ function $c8d5ff4524619fcd$var$ActualSolidLayout(props, container_element) {
|
|
|
2653
2668
|
set_styling(() => col_styling);
|
|
2654
2669
|
return;
|
|
2655
2670
|
}
|
|
2656
|
-
(0, $9HbP8$untrack)(() => set_rows_visible()(rows_or_empty_object().start_rows ?? 1));
|
|
2657
2671
|
update_children_count();
|
|
2658
2672
|
const mutation_observer = new MutationObserver((0, $9HbP8$catchify)(update_children_count));
|
|
2659
2673
|
mutation_observer.observe(container_element, {
|
|
@@ -2665,33 +2679,36 @@ function $c8d5ff4524619fcd$var$ActualSolidLayout(props, container_element) {
|
|
|
2665
2679
|
() => (0, $9HbP8$createMemo)(() => {
|
|
2666
2680
|
const {
|
|
2667
2681
|
rows_per_click: rows_per_click,
|
|
2668
|
-
max_rows = -1
|
|
2682
|
+
max_rows = -1,
|
|
2683
|
+
start_rows: start_rows
|
|
2669
2684
|
} = rows_or_empty_object();
|
|
2670
2685
|
const rows_visible = get_rows_visible();
|
|
2671
2686
|
const children_count = get_children_count();
|
|
2672
2687
|
return col_styling() + props.cols_at_size.map(options => {
|
|
2673
|
-
const [, min, max] = options;
|
|
2674
|
-
let
|
|
2688
|
+
const [recs_per_row, min, max] = options;
|
|
2689
|
+
let should_hide_view_more_button;
|
|
2675
2690
|
let visible_recs;
|
|
2676
2691
|
if (props.disable_partial_rows) {
|
|
2677
2692
|
visible_recs = (0, $9HbP8$layout_get_visible_recs_without_partial_rows)(rows_visible, children_count, options);
|
|
2678
2693
|
const visible_recs_next_show_more = (0, $9HbP8$layout_get_visible_recs_without_partial_rows)(rows_visible + (rows_per_click || 0),
|
|
2679
2694
|
// Should this really be zero when we default rows_per_click to 1?
|
|
2680
2695
|
children_count, options);
|
|
2681
|
-
|
|
2696
|
+
should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
|
|
2682
2697
|
} else {
|
|
2683
2698
|
visible_recs = (0, $9HbP8$layout_get_total_rec_amount_for_row)(rows_visible, options);
|
|
2684
|
-
|
|
2699
|
+
should_hide_view_more_button = visible_recs >= children_count;
|
|
2685
2700
|
}
|
|
2686
|
-
const should_hide_button_final =
|
|
2687
|
-
|
|
2701
|
+
const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
|
|
2702
|
+
// 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
|
|
2703
|
+
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;
|
|
2704
|
+
return `${(0, $9HbP8$layout_media_query_header)(min, max)}{${selector_beginning}:nth-child(n+${visible_recs + 1}){display:none}${props.layout == "slider" ? `${selector_beginning}:nth-child(n+${visible_recs}){margin-right:0}` : ""}${should_hide_button_final ? `.depict .${view_more_button_class}{display:none!important}` : ``}${should_hide_view_less_button ? `.depict .${view_less_button_class}{display:none!important}` : ``}}`;
|
|
2688
2705
|
}).join("");
|
|
2689
2706
|
}));
|
|
2690
2707
|
});
|
|
2691
|
-
return [container_element, (0, $9HbP8$memo)(
|
|
2692
|
-
const _el$
|
|
2693
|
-
(0, $9HbP8$insert)(_el$
|
|
2694
|
-
return _el$
|
|
2708
|
+
return [container_element, (0, $9HbP8$memo)(view_more_button_container), (0, $9HbP8$memo)(view_less_button_container), (() => {
|
|
2709
|
+
const _el$4 = (0, $9HbP8$getNextElement)($c8d5ff4524619fcd$var$_tmpl$2);
|
|
2710
|
+
(0, $9HbP8$insert)(_el$4, get_styling);
|
|
2711
|
+
return _el$4;
|
|
2695
2712
|
})()];
|
|
2696
2713
|
}
|
|
2697
2714
|
(0, $9HbP8$delegateEvents)(["click"]);
|
|
@@ -2793,6 +2810,43 @@ function $ca6f574bd8772184$var$history_state_change(signals, entries, state) {
|
|
|
2793
2810
|
}
|
|
2794
2811
|
});
|
|
2795
2812
|
}
|
|
2813
|
+
const $90980bd87c9960f9$export$3064e1e8c6513da3 = new Set();
|
|
2814
|
+
let $90980bd87c9960f9$var$has_ran = false;
|
|
2815
|
+
function $90980bd87c9960f9$export$5162a71f252e6122() {
|
|
2816
|
+
if ($90980bd87c9960f9$var$has_ran || typeof history !== "object") return;
|
|
2817
|
+
$90980bd87c9960f9$var$has_ran = true;
|
|
2818
|
+
for (const function_name of ["replaceState", "pushState"]) {
|
|
2819
|
+
if (Object.getOwnPropertyNames(history).includes(function_name)) $90980bd87c9960f9$var$proxy_push_state(function_name, history);
|
|
2820
|
+
$90980bd87c9960f9$var$proxy_push_state(function_name, History.prototype);
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
function $90980bd87c9960f9$var$proxy_push_state(function_name, thing) {
|
|
2824
|
+
thing[function_name] = new Proxy(thing[function_name], {
|
|
2825
|
+
apply(target, this_arg, arg_list) {
|
|
2826
|
+
try {
|
|
2827
|
+
if (typeof arg_list[0] == "object") {
|
|
2828
|
+
const cloned_object = {
|
|
2829
|
+
...arg_list[0]
|
|
2830
|
+
};
|
|
2831
|
+
const old_state = history.state;
|
|
2832
|
+
for (const key in old_state) {
|
|
2833
|
+
if (!$90980bd87c9960f9$var$starts_with_any_prefix(key)) continue;
|
|
2834
|
+
if (!(key in cloned_object)) cloned_object[key] = old_state[key];
|
|
2835
|
+
}
|
|
2836
|
+
arg_list[0] = cloned_object;
|
|
2837
|
+
}
|
|
2838
|
+
} catch (e) {
|
|
2839
|
+
(0, $9HbP8$report)([e, "Failed to preserve items in history.state"], "error");
|
|
2840
|
+
}
|
|
2841
|
+
return Reflect.apply(target, this_arg, arg_list);
|
|
2842
|
+
}
|
|
2843
|
+
});
|
|
2844
|
+
}
|
|
2845
|
+
function $90980bd87c9960f9$var$starts_with_any_prefix(key) {
|
|
2846
|
+
for (const prefix of $90980bd87c9960f9$export$3064e1e8c6513da3) {
|
|
2847
|
+
if (key.startsWith(prefix)) return true;
|
|
2848
|
+
}
|
|
2849
|
+
}
|
|
2796
2850
|
function $a8fa7302d6f93c0b$export$9862539c89138352({
|
|
2797
2851
|
get_default_values_: get_default_values_,
|
|
2798
2852
|
router_: router_,
|
|
@@ -2812,6 +2866,8 @@ function $a8fa7302d6f93c0b$export$9862539c89138352({
|
|
|
2812
2866
|
};
|
|
2813
2867
|
let unprefixed_state;
|
|
2814
2868
|
unprefixed_state = Object.fromEntries(Object.entries(prefixed_state).map(([key, value]) => [key.slice(prefix_.length), value]));
|
|
2869
|
+
(0, $90980bd87c9960f9$export$3064e1e8c6513da3).add(prefix_);
|
|
2870
|
+
// There's intentionally no onCleanup here since we want to preserve the state even if all components (in i.e. react-ui) that use the provider running this are unmounted and the provider is destroyed, since it might be re-created and need the old state (for example for doing scroll restoration)
|
|
2815
2871
|
return [reset_state, unprefixed_state];
|
|
2816
2872
|
}
|
|
2817
2873
|
|
|
@@ -2885,14 +2941,18 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
2885
2941
|
}
|
|
2886
2942
|
}
|
|
2887
2943
|
async #run_url_creator_for_suggest(merchant, market, response) {
|
|
2888
|
-
|
|
2944
|
+
const page_url_creator = this.page_url_creator;
|
|
2945
|
+
const category_transformer = this.display_transformers?.categories;
|
|
2946
|
+
if (!page_url_creator && !category_transformer) return response;
|
|
2889
2947
|
// find category suggestions, run thing with them, and then replace them
|
|
2890
2948
|
const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "category");
|
|
2891
|
-
const page_urls = await
|
|
2892
|
-
type: "categories",
|
|
2949
|
+
const page_urls = await (page_url_creator || category_transformer)({
|
|
2893
2950
|
market: market,
|
|
2894
2951
|
merchant: merchant,
|
|
2895
|
-
data: [...category_suggestions]
|
|
2952
|
+
data: [...category_suggestions],
|
|
2953
|
+
...(page_url_creator ? {
|
|
2954
|
+
type: "categories"
|
|
2955
|
+
} : {})
|
|
2896
2956
|
});
|
|
2897
2957
|
this.#guard_url_creator_length(category_suggestions, page_urls);
|
|
2898
2958
|
while (page_urls.length)
|
|
@@ -2900,17 +2960,29 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
2900
2960
|
Object.defineProperties(category_suggestions.pop(), Object.getOwnPropertyDescriptors(page_urls.pop()));
|
|
2901
2961
|
return response;
|
|
2902
2962
|
}
|
|
2903
|
-
async #
|
|
2904
|
-
|
|
2963
|
+
async #run_display_transformers_for_rest(merchant, market, input_data) {
|
|
2964
|
+
const {
|
|
2965
|
+
page_url_creator: page_url_creator,
|
|
2966
|
+
display_transformers: display_transformers
|
|
2967
|
+
} = this;
|
|
2968
|
+
if (!page_url_creator && !display_transformers) return input_data;
|
|
2969
|
+
const product_transformer = display_transformers?.products;
|
|
2970
|
+
const category_transformer = display_transformers?.categories;
|
|
2971
|
+
const content_result_transformer = display_transformers?.contentResults;
|
|
2905
2972
|
const displays = input_data.displays;
|
|
2906
|
-
const
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2973
|
+
const {
|
|
2974
|
+
breadcrumb: breadcrumb,
|
|
2975
|
+
quick_links: quick_links,
|
|
2976
|
+
content_search_links: content_search_links
|
|
2977
|
+
} = input_data;
|
|
2978
|
+
if (displays && (page_url_creator || product_transformer)) {
|
|
2979
|
+
const page_urls = await (page_url_creator || product_transformer)({
|
|
2911
2980
|
merchant: merchant,
|
|
2912
2981
|
market: market,
|
|
2913
|
-
displays: [...input_data.displays]
|
|
2982
|
+
displays: [...input_data.displays],
|
|
2983
|
+
...(page_url_creator ? {
|
|
2984
|
+
type: "products"
|
|
2985
|
+
} : {})
|
|
2914
2986
|
});
|
|
2915
2987
|
this.#guard_url_creator_length(displays, page_urls);
|
|
2916
2988
|
for (let i = 0; i < displays.length; i++) {
|
|
@@ -2928,19 +3000,30 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
2928
3000
|
displays[i] = new_display_or_page_url;
|
|
2929
3001
|
}
|
|
2930
3002
|
}
|
|
2931
|
-
for (const category_display_array of [breadcrumb, quick_links]) {
|
|
3003
|
+
if (page_url_creator || category_transformer) for (const category_display_array of [breadcrumb, quick_links]) {
|
|
2932
3004
|
if (!category_display_array) continue;
|
|
2933
|
-
const page_urls = await
|
|
2934
|
-
type: "categories",
|
|
3005
|
+
const page_urls = await (page_url_creator || category_transformer)({
|
|
2935
3006
|
merchant: merchant,
|
|
2936
3007
|
market: market,
|
|
2937
|
-
data: [...category_display_array]
|
|
3008
|
+
data: [...category_display_array],
|
|
3009
|
+
...(page_url_creator ? {
|
|
3010
|
+
type: "categories"
|
|
3011
|
+
} : {})
|
|
2938
3012
|
});
|
|
2939
3013
|
this.#guard_url_creator_length(category_display_array, page_urls);
|
|
2940
3014
|
for (let i = 0; i < category_display_array.length; i++)
|
|
2941
3015
|
// Copy over getters so we sneakily can make this reactive
|
|
2942
3016
|
Object.defineProperties(category_display_array[i], Object.getOwnPropertyDescriptors(page_urls[i]));
|
|
2943
3017
|
}
|
|
3018
|
+
if (content_search_links?.length && content_result_transformer) {
|
|
3019
|
+
const result = await content_result_transformer({
|
|
3020
|
+
merchant: merchant,
|
|
3021
|
+
market: market,
|
|
3022
|
+
data: [...content_search_links]
|
|
3023
|
+
});
|
|
3024
|
+
this.#guard_url_creator_length(content_search_links, result);
|
|
3025
|
+
input_data.content_search_links = result;
|
|
3026
|
+
}
|
|
2944
3027
|
return input_data;
|
|
2945
3028
|
}
|
|
2946
3029
|
async #cached_post_request(endpoint, input_req, fallback_response) {
|
|
@@ -2967,7 +3050,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
2967
3050
|
let result;
|
|
2968
3051
|
try {
|
|
2969
3052
|
const unmodified_result = await api_response.json();
|
|
2970
|
-
result = await this.#
|
|
3053
|
+
result = await this.#run_display_transformers_for_rest(input_req.tenant, input_req.market, unmodified_result);
|
|
2971
3054
|
} catch (e) {
|
|
2972
3055
|
(0, $9HbP8$dwarn)("URL creator or json decoding failed", e);
|
|
2973
3056
|
break return_successfully;
|
|
@@ -2999,12 +3082,14 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
|
|
|
2999
3082
|
get_metadata: get_metadata,
|
|
3000
3083
|
get_user_id: get_user_id,
|
|
3001
3084
|
get_session_id: get_session_id,
|
|
3002
|
-
page_url_creator: page_url_creator
|
|
3085
|
+
page_url_creator: page_url_creator,
|
|
3086
|
+
display_transformers: display_transformers
|
|
3003
3087
|
} = options ?? {};
|
|
3004
3088
|
this.#get_metadata = get_metadata;
|
|
3005
3089
|
this.#get_user_id = get_user_id;
|
|
3006
3090
|
this.#get_session_id = get_session_id;
|
|
3007
3091
|
this.page_url_creator = page_url_creator;
|
|
3092
|
+
this.display_transformers = display_transformers;
|
|
3008
3093
|
}
|
|
3009
3094
|
async suggest(input_req) {
|
|
3010
3095
|
const with_ids = this.#add_ids_to_request(input_req);
|
|
@@ -3114,11 +3199,11 @@ function $fc5a12f3a857ca30$var$correct_range_filter_range_once({
|
|
|
3114
3199
|
}
|
|
3115
3200
|
}
|
|
3116
3201
|
function $511cc0abd9a64ce8$export$92f2da32c6e7e7ee({
|
|
3117
|
-
|
|
3202
|
+
number_: number_,
|
|
3118
3203
|
i18n_: i18n_
|
|
3119
3204
|
}) {
|
|
3120
3205
|
return (0, $9HbP8$createMemo)(() => {
|
|
3121
|
-
const n_hits =
|
|
3206
|
+
const n_hits = number_();
|
|
3122
3207
|
if (isNaN(n_hits)) return "";
|
|
3123
3208
|
const price_formatting = i18n_.price_formatting_();
|
|
3124
3209
|
return (0, $9HbP8$standard_price_format)(n_hits, 0,
|
|
@@ -5600,7 +5685,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
5600
5685
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $9HbP8$createSignal)(false);
|
|
5601
5686
|
const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $9HbP8$createSignal)();
|
|
5602
5687
|
const formatted_number_of_results_ = (0, $511cc0abd9a64ce8$export$92f2da32c6e7e7ee)({
|
|
5603
|
-
|
|
5688
|
+
number_: (0, $9HbP8$createMemo)(() => plp_results_()?.n_hits),
|
|
5604
5689
|
i18n_: i18n_
|
|
5605
5690
|
});
|
|
5606
5691
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $9HbP8$createSignal)();
|
|
@@ -5865,37 +5950,6 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
|
|
|
5865
5950
|
return _el$13;
|
|
5866
5951
|
})()];
|
|
5867
5952
|
}
|
|
5868
|
-
let $90980bd87c9960f9$var$has_ran = false;
|
|
5869
|
-
function $90980bd87c9960f9$export$5162a71f252e6122() {
|
|
5870
|
-
if ($90980bd87c9960f9$var$has_ran || typeof history !== "object") return;
|
|
5871
|
-
$90980bd87c9960f9$var$has_ran = true;
|
|
5872
|
-
for (const function_name of ["replaceState", "pushState"]) {
|
|
5873
|
-
if (Object.getOwnPropertyNames(history).includes(function_name)) $90980bd87c9960f9$var$proxy_push_state(function_name, history);
|
|
5874
|
-
$90980bd87c9960f9$var$proxy_push_state(function_name, History.prototype);
|
|
5875
|
-
}
|
|
5876
|
-
}
|
|
5877
|
-
function $90980bd87c9960f9$var$proxy_push_state(function_name, thing) {
|
|
5878
|
-
thing[function_name] = new Proxy(thing[function_name], {
|
|
5879
|
-
apply(target, this_arg, arg_list) {
|
|
5880
|
-
try {
|
|
5881
|
-
if (typeof arg_list[0] == "object") {
|
|
5882
|
-
const cloned_object = {
|
|
5883
|
-
...arg_list[0]
|
|
5884
|
-
};
|
|
5885
|
-
const old_state = history.state;
|
|
5886
|
-
for (const key in old_state) {
|
|
5887
|
-
if (!key.startsWith("category_") && !key.startsWith("search_")) continue;
|
|
5888
|
-
if (!(key in cloned_object)) cloned_object[key] = old_state[key];
|
|
5889
|
-
}
|
|
5890
|
-
arg_list[0] = cloned_object;
|
|
5891
|
-
}
|
|
5892
|
-
} catch (e) {
|
|
5893
|
-
(0, $9HbP8$report)([e, "Failed to preserve items in history.state"], "error");
|
|
5894
|
-
}
|
|
5895
|
-
return Reflect.apply(target, this_arg, arg_list);
|
|
5896
|
-
}
|
|
5897
|
-
});
|
|
5898
|
-
}
|
|
5899
5953
|
const $b5cccc8ee7d24677$var$transform_elements = sorted_cols_at_size => {
|
|
5900
5954
|
const cols_at_size = [];
|
|
5901
5955
|
for (let i = 0; i < sorted_cols_at_size.length; i++) {
|
|
@@ -6181,7 +6235,6 @@ class $4fd2ba03703a7d92$export$7e1297a3a19f10d8 {
|
|
|
6181
6235
|
}
|
|
6182
6236
|
const $961b5c64bef4662f$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$template)(`<div class="depict plp category"></div>`, 2);
|
|
6183
6237
|
// 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
|
|
6184
|
-
// on old displays, no page_url_creator can be specified
|
|
6185
6238
|
/**
|
|
6186
6239
|
* Type for the private properties that are shared between the different exported search SDK wrapper functions.
|
|
6187
6240
|
* SDK users are not allowed to change/access these, they're an internal implementation detail.
|
|
@@ -6246,6 +6299,7 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
|
|
|
6246
6299
|
api: api,
|
|
6247
6300
|
on_navigation: on_navigation,
|
|
6248
6301
|
page_url_creator: page_url_creator,
|
|
6302
|
+
display_transformers: display_transformers,
|
|
6249
6303
|
unique_instance_key_for_state = "",
|
|
6250
6304
|
query_id_state_key: query_id_state_key,
|
|
6251
6305
|
...props_on_class
|
|
@@ -6290,8 +6344,10 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
|
|
|
6290
6344
|
quicklinks_signal_: (0, $9HbP8$createSignal)(),
|
|
6291
6345
|
i18n_: i18n_,
|
|
6292
6346
|
reset_history_state_: reset_history_state_,
|
|
6347
|
+
// @ts-ignore
|
|
6293
6348
|
depict_api_: api ?? new (0, $7fa23e2a0079eca4$export$e015ed2f2950f2e3)({
|
|
6294
|
-
page_url_creator: page_url_creator
|
|
6349
|
+
page_url_creator: page_url_creator,
|
|
6350
|
+
display_transformers: display_transformers
|
|
6295
6351
|
}),
|
|
6296
6352
|
router_: this.#router,
|
|
6297
6353
|
selected_filters_: selected_filters_,
|
|
@@ -6918,11 +6974,11 @@ function $172e1b898d457050$export$7de92c4c2205ebf3({
|
|
|
6918
6974
|
});
|
|
6919
6975
|
}
|
|
6920
6976
|
function $172e1b898d457050$var$make_state_saved_rows([get_showing_recommendation_rows, set_showing_recommendation_rows], i18n_) {
|
|
6921
|
-
const currently_visible = (0, $9HbP8$createSignal)(0);
|
|
6977
|
+
const currently_visible = (0, $9HbP8$createSignal)((0, $9HbP8$untrack)(get_showing_recommendation_rows));
|
|
6922
6978
|
const [get_currently_visible, set_currently_visible] = currently_visible;
|
|
6923
6979
|
const rows = {
|
|
6924
6980
|
currently_visible: currently_visible,
|
|
6925
|
-
start_rows:
|
|
6981
|
+
start_rows: $172e1b898d457050$export$1c8c715550dc689d,
|
|
6926
6982
|
rows_per_click: 3,
|
|
6927
6983
|
button: (() => {
|
|
6928
6984
|
const _el$7 = (0, $9HbP8$getNextElement)($172e1b898d457050$var$_tmpl$2);
|
|
@@ -7088,7 +7144,7 @@ const $c97b1f0e44afb9d2$export$27b710c08412a7ad = obj => {
|
|
|
7088
7144
|
return Object.fromEntries(Object.keys(obj).map(key => [key, obj[key]()]));
|
|
7089
7145
|
};
|
|
7090
7146
|
const $e003be2a50d9e5bc$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$template)(`<span class="orig price"><!#><!/><!#><!/><!#><!/></span>`, 8),
|
|
7091
|
-
$e003be2a50d9e5bc$var$_tmpl$2 = /*#__PURE__*/(0, $9HbP8$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),
|
|
7147
|
+
$e003be2a50d9e5bc$var$_tmpl$2 = /*#__PURE__*/(0, $9HbP8$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),
|
|
7092
7148
|
$e003be2a50d9e5bc$var$_tmpl$3 = /*#__PURE__*/(0, $9HbP8$template)(`<div class="tagline"></div>`, 2);
|
|
7093
7149
|
const $e003be2a50d9e5bc$export$b05c0ae390cf3e06 = (display_or_variant_container, {
|
|
7094
7150
|
i18n: i18n
|
|
@@ -7222,9 +7278,11 @@ function $eea41f703612261b$export$62f101a8aa597bf8({
|
|
|
7222
7278
|
render_instant_card_placeholder_: render_instant_card_placeholder_,
|
|
7223
7279
|
min_products_to_fetch_: min_products_to_fetch_,
|
|
7224
7280
|
has_sort_or_filters_: has_sort_or_filters_,
|
|
7225
|
-
|
|
7281
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
7226
7282
|
i18n_: i18n_,
|
|
7227
|
-
router_: router_
|
|
7283
|
+
router_: router_,
|
|
7284
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
7285
|
+
content_search_enabled_: content_search_enabled_
|
|
7228
7286
|
}) {
|
|
7229
7287
|
const max_cards = 4;
|
|
7230
7288
|
const [read_current_instant_query, write_current_instant_query] = (0, $9HbP8$createSignal)("");
|
|
@@ -7249,8 +7307,17 @@ function $eea41f703612261b$export$62f101a8aa597bf8({
|
|
|
7249
7307
|
...variable_data
|
|
7250
7308
|
});
|
|
7251
7309
|
}));
|
|
7252
|
-
|
|
7253
|
-
|
|
7310
|
+
// 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
|
|
7311
|
+
// This is for the press-enter-to-instant-content-result feature which gets called from Autocomplete.tsx
|
|
7312
|
+
set_modal_search_results_(() => search_results);
|
|
7313
|
+
(0, $9HbP8$onCleanup)(() => set_modal_search_results_(undefined)); // for consistency, in case this component crashes
|
|
7314
|
+
set_total_num_results_accessor_(() => (0, $511cc0abd9a64ce8$export$92f2da32c6e7e7ee)({
|
|
7315
|
+
number_: (0, $9HbP8$createMemo)(() => {
|
|
7316
|
+
const hits = search_results()?.n_hits;
|
|
7317
|
+
const content_results = search_results()?.content_search_links?.length;
|
|
7318
|
+
if (!content_results || !content_search_enabled_()) return hits;
|
|
7319
|
+
return (hits ?? 0) + content_results;
|
|
7320
|
+
}),
|
|
7254
7321
|
i18n_: i18n_
|
|
7255
7322
|
}));
|
|
7256
7323
|
const sliced_displays = (0, $9HbP8$createMemo)(() => search_results()?.displays?.slice(0, max_cards));
|
|
@@ -7348,7 +7415,7 @@ function $694b7f90501fea4c$export$5d2caaa6b530761c() {
|
|
|
7348
7415
|
return (0, $9HbP8$getNextElement)($694b7f90501fea4c$var$_tmpl$);
|
|
7349
7416
|
}
|
|
7350
7417
|
const $7ad3a93cbe6fa208$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$template)(`<div class="previous-searches"><h2 class="text"></h2><div class="list"></div></div>`, 6),
|
|
7351
|
-
$7ad3a93cbe6fa208$var$_tmpl$2 = /*#__PURE__*/(0, $9HbP8$template)(`<a class="item"><div class="left"><!#><!/><span></span></div><button class="delete"></button></a>`, 10);
|
|
7418
|
+
$7ad3a93cbe6fa208$var$_tmpl$2 = /*#__PURE__*/(0, $9HbP8$template)(`<a class="item"><div class="left"><!#><!/><span class="line-clamp"></span></div><button class="delete"></button></a>`, 10);
|
|
7352
7419
|
function $7ad3a93cbe6fa208$export$a146ac6fa8346a25({
|
|
7353
7420
|
text_: text_,
|
|
7354
7421
|
previous_searches_: previous_searches_,
|
|
@@ -7430,15 +7497,18 @@ function $7ad3a93cbe6fa208$export$a146ac6fa8346a25({
|
|
|
7430
7497
|
(0, $9HbP8$effect)(_p$ => {
|
|
7431
7498
|
const _v$ = !!(0, $9HbP8$createMemo)(() => read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)(),
|
|
7432
7499
|
_v$2 = href(),
|
|
7433
|
-
_v$3 =
|
|
7500
|
+
_v$3 = item(),
|
|
7501
|
+
_v$4 = i18n_.previous_searches_delete_entry_from_history_();
|
|
7434
7502
|
_v$ !== _p$._v$ && _el$4.classList.toggle("selected", _p$._v$ = _v$);
|
|
7435
7503
|
_v$2 !== _p$._v$2 && (0, $9HbP8$setAttribute)(_el$4, "href", _p$._v$2 = _v$2);
|
|
7436
|
-
_v$3 !== _p$._v$3 && (0, $9HbP8$setAttribute)(_el$
|
|
7504
|
+
_v$3 !== _p$._v$3 && (0, $9HbP8$setAttribute)(_el$6, "title", _p$._v$3 = _v$3);
|
|
7505
|
+
_v$4 !== _p$._v$4 && (0, $9HbP8$setAttribute)(_el$9, "title", _p$._v$4 = _v$4);
|
|
7437
7506
|
return _p$;
|
|
7438
7507
|
}, {
|
|
7439
7508
|
_v$: undefined,
|
|
7440
7509
|
_v$2: undefined,
|
|
7441
|
-
_v$3: undefined
|
|
7510
|
+
_v$3: undefined,
|
|
7511
|
+
_v$4: undefined
|
|
7442
7512
|
});
|
|
7443
7513
|
return _el$4;
|
|
7444
7514
|
})();
|
|
@@ -7507,18 +7577,37 @@ function $f3213c0640246d58$export$ba17c5b7e6dda39f({
|
|
|
7507
7577
|
const _el$2 = (0, $9HbP8$getNextElement)($f3213c0640246d58$var$_tmpl$2);
|
|
7508
7578
|
(0, $9HbP8$className)(_el$2, class_);
|
|
7509
7579
|
(0, $9HbP8$insert)(_el$2, text_itself);
|
|
7510
|
-
(0, $9HbP8$effect)(
|
|
7580
|
+
(0, $9HbP8$effect)(_p$ => {
|
|
7581
|
+
const _v$ = !!get_has_highlighted(),
|
|
7582
|
+
_v$2 = whole_text_to_display_memo() /* for when line-clamped, users can see full text on hover */;
|
|
7583
|
+
_v$ !== _p$._v$ && _el$2.classList.toggle("has-history-match", _p$._v$ = _v$);
|
|
7584
|
+
_v$2 !== _p$._v$2 && (0, $9HbP8$setAttribute)(_el$2, "title", _p$._v$2 = _v$2);
|
|
7585
|
+
return _p$;
|
|
7586
|
+
}, {
|
|
7587
|
+
_v$: undefined,
|
|
7588
|
+
_v$2: undefined
|
|
7589
|
+
});
|
|
7511
7590
|
return _el$2;
|
|
7512
7591
|
})();
|
|
7513
7592
|
}
|
|
7593
|
+
const $190927650b4840eb$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$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);
|
|
7594
|
+
function $190927650b4840eb$export$605674723bcc715c(props = {}) {
|
|
7595
|
+
return (() => {
|
|
7596
|
+
const _el$ = (0, $9HbP8$getNextElement)($190927650b4840eb$var$_tmpl$);
|
|
7597
|
+
(0, $9HbP8$spread)(_el$, props, true, true);
|
|
7598
|
+
(0, $9HbP8$runHydrationEvents)();
|
|
7599
|
+
return _el$;
|
|
7600
|
+
})();
|
|
7601
|
+
}
|
|
7514
7602
|
const $cea52f6b24092f05$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$template)(`<a class="suggestion"></a>`, 2),
|
|
7515
7603
|
$cea52f6b24092f05$var$_tmpl$2 = /*#__PURE__*/(0, $9HbP8$template)(`<div class="search-icon"></div>`, 2),
|
|
7516
7604
|
$cea52f6b24092f05$var$_tmpl$3 = /*#__PURE__*/(0, $9HbP8$template)(`<span class="type"></span>`, 2),
|
|
7517
7605
|
$cea52f6b24092f05$var$_tmpl$4 = /*#__PURE__*/(0, $9HbP8$template)(`<div><!#><!/><span class="value"></span></div>`, 6),
|
|
7518
|
-
$cea52f6b24092f05$var$_tmpl$5 = /*#__PURE__*/(0, $9HbP8$template)(`<
|
|
7519
|
-
$cea52f6b24092f05$var$_tmpl$6 = /*#__PURE__*/(0, $9HbP8$template)(`<
|
|
7520
|
-
$cea52f6b24092f05$var$_tmpl$7 = /*#__PURE__*/(0, $9HbP8$template)(`<div class="suggestion-container
|
|
7521
|
-
$cea52f6b24092f05$var$_tmpl$8 = /*#__PURE__*/(0, $9HbP8$template)(`<div class="
|
|
7606
|
+
$cea52f6b24092f05$var$_tmpl$5 = /*#__PURE__*/(0, $9HbP8$template)(`<div class="with-icon"><!#><!/><!#><!/></div>`, 6),
|
|
7607
|
+
$cea52f6b24092f05$var$_tmpl$6 = /*#__PURE__*/(0, $9HbP8$template)(`<h2 class="text"></h2>`, 2),
|
|
7608
|
+
$cea52f6b24092f05$var$_tmpl$7 = /*#__PURE__*/(0, $9HbP8$template)(`<div class="suggestion-container query"><!#><!/><!#><!/></div>`, 6),
|
|
7609
|
+
$cea52f6b24092f05$var$_tmpl$8 = /*#__PURE__*/(0, $9HbP8$template)(`<div class="suggestion-container page"></div>`, 2),
|
|
7610
|
+
$cea52f6b24092f05$var$_tmpl$9 = /*#__PURE__*/(0, $9HbP8$template)(`<div class="suggestions"><!#><!/><!#><!/><!#><!/></div>`, 8);
|
|
7522
7611
|
function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
7523
7612
|
suggestion_memo_: suggestion_memo_,
|
|
7524
7613
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
@@ -7531,7 +7620,8 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
7531
7620
|
include_category_suggestions_: include_category_suggestions_,
|
|
7532
7621
|
searching_for_value_: searching_for_value_,
|
|
7533
7622
|
router_: router_,
|
|
7534
|
-
submit_query_: submit_query_
|
|
7623
|
+
submit_query_: submit_query_,
|
|
7624
|
+
get_content_results_: get_content_results_
|
|
7535
7625
|
}) {
|
|
7536
7626
|
const queries_memo = (0, $9HbP8$createMemo)(() => suggestion_memo_().filter(({
|
|
7537
7627
|
type: type,
|
|
@@ -7539,9 +7629,15 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
7539
7629
|
}) => type === (0, $a0eb8b431ec1f87b$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title) // don't show the ones we already show from the history
|
|
7540
7630
|
));
|
|
7541
7631
|
|
|
7542
|
-
const not_queries_memo = (0, $9HbP8$createMemo)(() =>
|
|
7543
|
-
|
|
7544
|
-
|
|
7632
|
+
const not_queries_memo = (0, $9HbP8$createMemo)(() => {
|
|
7633
|
+
// For the section that shows categories and content results
|
|
7634
|
+
// We want to limit to 3 items, and we want to show the categories first
|
|
7635
|
+
const content_results = get_content_results_() || [];
|
|
7636
|
+
const from_suggest_request = include_category_suggestions_ ? suggestion_memo_().filter(({
|
|
7637
|
+
type: type
|
|
7638
|
+
}) => type !== (0, $a0eb8b431ec1f87b$export$3cf9497e790da491)) : [];
|
|
7639
|
+
return [...from_suggest_request.slice(0, content_results.length ? 2 : 3), ...content_results.slice(0, 1)];
|
|
7640
|
+
});
|
|
7545
7641
|
const render_entry = (input_obj, autocomplete_data_index, index, is_history = false) => {
|
|
7546
7642
|
const is_query = (0, $9HbP8$createMemo)(() => input_obj().type === (0, $a0eb8b431ec1f87b$export$3cf9497e790da491));
|
|
7547
7643
|
const href_with_changed_params_accessor = (0, $9HbP8$createMemo)(() => is_query() ? (0, $a36cbc4f68bfd590$export$91c3b6774e8be0f5)({
|
|
@@ -7550,6 +7646,7 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
7550
7646
|
url_transformer_: url_transformer_
|
|
7551
7647
|
}) : undefined);
|
|
7552
7648
|
const href = (0, $9HbP8$createMemo)(() => is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
|
|
7649
|
+
const is_selected = (0, $9HbP8$createMemo)(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index);
|
|
7553
7650
|
return (() => {
|
|
7554
7651
|
const _el$ = (0, $9HbP8$getNextElement)($cea52f6b24092f05$var$_tmpl$);
|
|
7555
7652
|
(0, $9HbP8$use)(element => element.addEventListener("click", (0, $9HbP8$catchify)(ev => {
|
|
@@ -7563,7 +7660,7 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
7563
7660
|
return;
|
|
7564
7661
|
}
|
|
7565
7662
|
router_.navigate_.go_to_({
|
|
7566
|
-
new_url_:
|
|
7663
|
+
new_url_: href(),
|
|
7567
7664
|
is_replace_: false,
|
|
7568
7665
|
event_: ev
|
|
7569
7666
|
});
|
|
@@ -7585,20 +7682,20 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
7585
7682
|
return (0, $9HbP8$createComponent)((0, $694b7f90501fea4c$export$5d2caaa6b530761c), {});
|
|
7586
7683
|
}
|
|
7587
7684
|
}), (0, $9HbP8$createComponent)((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
|
|
7588
|
-
class_: "value",
|
|
7685
|
+
class_: "value line-clamp",
|
|
7589
7686
|
get whole_text_to_display_() {
|
|
7590
7687
|
return (0, $9HbP8$createMemo)(() => input_obj().title);
|
|
7591
7688
|
},
|
|
7592
7689
|
searching_for_value_: searching_for_value_
|
|
7593
7690
|
})] : [(0, $9HbP8$memo)((() => {
|
|
7594
|
-
const _c$2 = (0, $9HbP8$memo)(() => typeof input_obj()
|
|
7691
|
+
const _c$2 = (0, $9HbP8$memo)(() => typeof input_obj() /* this is a harmless lie */.parent_title === "string");
|
|
7595
7692
|
return () => _c$2() ? (() => {
|
|
7596
7693
|
const _el$4 = (0, $9HbP8$getNextElement)($cea52f6b24092f05$var$_tmpl$4),
|
|
7597
7694
|
_el$6 = _el$4.firstChild,
|
|
7598
7695
|
[_el$7, _co$] = (0, $9HbP8$getNextMarker)(_el$6.nextSibling),
|
|
7599
7696
|
_el$5 = _el$7.nextSibling;
|
|
7600
7697
|
(0, $9HbP8$insert)(_el$4, (0, $9HbP8$createComponent)((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
|
|
7601
|
-
class_: "category",
|
|
7698
|
+
class_: "category line-clamp",
|
|
7602
7699
|
get whole_text_to_display_() {
|
|
7603
7700
|
return (0, $9HbP8$createMemo)(() => input_obj().title);
|
|
7604
7701
|
},
|
|
@@ -7606,16 +7703,38 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
7606
7703
|
}), _el$7, _co$);
|
|
7607
7704
|
(0, $9HbP8$insert)(_el$5, () => input_obj().parent_title);
|
|
7608
7705
|
return _el$4;
|
|
7609
|
-
})() : (
|
|
7610
|
-
|
|
7611
|
-
|
|
7612
|
-
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7706
|
+
})() : (() => {
|
|
7707
|
+
const _c$3 = (0, $9HbP8$memo)(() => input_obj().type === "content");
|
|
7708
|
+
return () => _c$3() ? (() => {
|
|
7709
|
+
const _el$8 = (0, $9HbP8$getNextElement)($cea52f6b24092f05$var$_tmpl$5),
|
|
7710
|
+
_el$9 = _el$8.firstChild,
|
|
7711
|
+
[_el$10, _co$2] = (0, $9HbP8$getNextMarker)(_el$9.nextSibling),
|
|
7712
|
+
_el$11 = _el$10.nextSibling,
|
|
7713
|
+
[_el$12, _co$3] = (0, $9HbP8$getNextMarker)(_el$11.nextSibling);
|
|
7714
|
+
(0, $9HbP8$insert)(_el$8, (0, $9HbP8$createComponent)((0, $190927650b4840eb$export$605674723bcc715c), {
|
|
7715
|
+
width: "16",
|
|
7716
|
+
height: "16"
|
|
7717
|
+
}), _el$10, _co$2);
|
|
7718
|
+
(0, $9HbP8$insert)(_el$8, (0, $9HbP8$createComponent)((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
|
|
7719
|
+
class_: "content line-clamp",
|
|
7720
|
+
get whole_text_to_display_() {
|
|
7721
|
+
return (0, $9HbP8$createMemo)(() => input_obj().title);
|
|
7722
|
+
},
|
|
7723
|
+
searching_for_value_: searching_for_value_
|
|
7724
|
+
}), _el$12, _co$3);
|
|
7725
|
+
return _el$8;
|
|
7726
|
+
})() : (0, $9HbP8$createComponent)((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
|
|
7727
|
+
class_: "category line-clamp",
|
|
7728
|
+
get whole_text_to_display_() {
|
|
7729
|
+
return (0, $9HbP8$createMemo)(() => input_obj().title);
|
|
7730
|
+
},
|
|
7731
|
+
searching_for_value_: searching_for_value_
|
|
7732
|
+
});
|
|
7733
|
+
})();
|
|
7616
7734
|
})()), (() => {
|
|
7617
7735
|
const _el$3 = (0, $9HbP8$getNextElement)($cea52f6b24092f05$var$_tmpl$3);
|
|
7618
7736
|
(0, $9HbP8$insert)(_el$3, (0, $9HbP8$createMemo)(() => {
|
|
7737
|
+
if (input_obj().type === "content") return i18n_.content_();
|
|
7619
7738
|
if (input_obj().category_type === "BRAND") return i18n_.brand_();
|
|
7620
7739
|
return i18n_.category_();
|
|
7621
7740
|
}));
|
|
@@ -7624,7 +7743,7 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
7624
7743
|
})());
|
|
7625
7744
|
(0, $9HbP8$effect)(_p$ => {
|
|
7626
7745
|
const _v$ = {
|
|
7627
|
-
selected: (
|
|
7746
|
+
selected: is_selected(),
|
|
7628
7747
|
history: is_history,
|
|
7629
7748
|
["type-" + input_obj().type]: true
|
|
7630
7749
|
},
|
|
@@ -7650,41 +7769,41 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
7650
7769
|
}));
|
|
7651
7770
|
};
|
|
7652
7771
|
const should_show_previous_searches_in_query_part = (0, $9HbP8$createMemo)(() => !on_previous_searches_page_());
|
|
7653
|
-
const should_show_at_all = (0, $9HbP8$createMemo)(() => suggestion_memo_()?.length || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length);
|
|
7772
|
+
const should_show_at_all = (0, $9HbP8$createMemo)(() => suggestion_memo_()?.length || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length || get_content_results_()?.length);
|
|
7654
7773
|
const should_show_query_part = (0, $9HbP8$createMemo)(() => queries_memo().length || filtered_previous_searches_().length);
|
|
7655
7774
|
return (0, $9HbP8$createComponent)((0, $9HbP8$Show), {
|
|
7656
7775
|
get when() {
|
|
7657
7776
|
return should_show_at_all();
|
|
7658
7777
|
},
|
|
7659
7778
|
get children() {
|
|
7660
|
-
const _el$
|
|
7661
|
-
_el$
|
|
7662
|
-
[_el$
|
|
7663
|
-
_el$
|
|
7664
|
-
[_el$
|
|
7665
|
-
_el$
|
|
7666
|
-
[_el$
|
|
7667
|
-
(0, $9HbP8$insert)(_el$
|
|
7779
|
+
const _el$13 = (0, $9HbP8$getNextElement)($cea52f6b24092f05$var$_tmpl$9),
|
|
7780
|
+
_el$21 = _el$13.firstChild,
|
|
7781
|
+
[_el$22, _co$6] = (0, $9HbP8$getNextMarker)(_el$21.nextSibling),
|
|
7782
|
+
_el$23 = _el$22.nextSibling,
|
|
7783
|
+
[_el$24, _co$7] = (0, $9HbP8$getNextMarker)(_el$23.nextSibling),
|
|
7784
|
+
_el$25 = _el$24.nextSibling,
|
|
7785
|
+
[_el$26, _co$8] = (0, $9HbP8$getNextMarker)(_el$25.nextSibling);
|
|
7786
|
+
(0, $9HbP8$insert)(_el$13, (0, $9HbP8$createComponent)((0, $9HbP8$Show), {
|
|
7668
7787
|
get when() {
|
|
7669
7788
|
return on_previous_searches_page_();
|
|
7670
7789
|
},
|
|
7671
7790
|
get children() {
|
|
7672
|
-
const _el$
|
|
7673
|
-
(0, $9HbP8$insert)(_el$
|
|
7674
|
-
return _el$
|
|
7791
|
+
const _el$14 = (0, $9HbP8$getNextElement)($cea52f6b24092f05$var$_tmpl$6);
|
|
7792
|
+
(0, $9HbP8$insert)(_el$14, () => i18n_.suggestions_());
|
|
7793
|
+
return _el$14;
|
|
7675
7794
|
}
|
|
7676
|
-
}), _el$
|
|
7677
|
-
(0, $9HbP8$insert)(_el$
|
|
7795
|
+
}), _el$22, _co$6);
|
|
7796
|
+
(0, $9HbP8$insert)(_el$13, (0, $9HbP8$createComponent)((0, $9HbP8$Show), {
|
|
7678
7797
|
get when() {
|
|
7679
7798
|
return should_show_query_part();
|
|
7680
7799
|
},
|
|
7681
7800
|
get children() {
|
|
7682
|
-
const _el$
|
|
7683
|
-
_el$
|
|
7684
|
-
[_el$
|
|
7685
|
-
_el$
|
|
7686
|
-
[_el$
|
|
7687
|
-
(0, $9HbP8$insert)(_el$
|
|
7801
|
+
const _el$15 = (0, $9HbP8$getNextElement)($cea52f6b24092f05$var$_tmpl$7),
|
|
7802
|
+
_el$16 = _el$15.firstChild,
|
|
7803
|
+
[_el$17, _co$4] = (0, $9HbP8$getNextMarker)(_el$16.nextSibling),
|
|
7804
|
+
_el$18 = _el$17.nextSibling,
|
|
7805
|
+
[_el$19, _co$5] = (0, $9HbP8$getNextMarker)(_el$18.nextSibling);
|
|
7806
|
+
(0, $9HbP8$insert)(_el$15, (0, $9HbP8$createComponent)((0, $9HbP8$Show), {
|
|
7688
7807
|
get when() {
|
|
7689
7808
|
return should_show_previous_searches_in_query_part();
|
|
7690
7809
|
},
|
|
@@ -7707,8 +7826,8 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
7707
7826
|
});
|
|
7708
7827
|
})();
|
|
7709
7828
|
}
|
|
7710
|
-
}), _el$
|
|
7711
|
-
(0, $9HbP8$insert)(_el$
|
|
7829
|
+
}), _el$17, _co$4);
|
|
7830
|
+
(0, $9HbP8$insert)(_el$15, () => {
|
|
7712
7831
|
const index_in_autocomplete = 2;
|
|
7713
7832
|
set_list_until_cleanup(queries_memo, index_in_autocomplete);
|
|
7714
7833
|
return (0, $9HbP8$createComponent)((0, $9HbP8$Index), {
|
|
@@ -7717,18 +7836,18 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
7717
7836
|
},
|
|
7718
7837
|
children: (item, index) => render_entry(item, index_in_autocomplete, index)
|
|
7719
7838
|
});
|
|
7720
|
-
}, _el$
|
|
7721
|
-
return _el$
|
|
7839
|
+
}, _el$19, _co$5);
|
|
7840
|
+
return _el$15;
|
|
7722
7841
|
}
|
|
7723
|
-
}), _el$
|
|
7724
|
-
(0, $9HbP8$insert)(_el$
|
|
7842
|
+
}), _el$24, _co$7);
|
|
7843
|
+
(0, $9HbP8$insert)(_el$13, (0, $9HbP8$createComponent)((0, $9HbP8$Show), {
|
|
7725
7844
|
get when() {
|
|
7726
|
-
return not_queries_memo().length
|
|
7845
|
+
return not_queries_memo().length;
|
|
7727
7846
|
},
|
|
7728
7847
|
keyed: false,
|
|
7729
7848
|
get children() {
|
|
7730
|
-
const _el$
|
|
7731
|
-
(0, $9HbP8$insert)(_el$
|
|
7849
|
+
const _el$20 = (0, $9HbP8$getNextElement)($cea52f6b24092f05$var$_tmpl$8);
|
|
7850
|
+
(0, $9HbP8$insert)(_el$20, () => {
|
|
7732
7851
|
const index_in_autocomplete = 3;
|
|
7733
7852
|
set_list_until_cleanup(not_queries_memo, index_in_autocomplete);
|
|
7734
7853
|
return (0, $9HbP8$createComponent)((0, $9HbP8$Index), {
|
|
@@ -7738,15 +7857,30 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
|
|
|
7738
7857
|
children: (item, index) => render_entry(item, index_in_autocomplete, index)
|
|
7739
7858
|
});
|
|
7740
7859
|
});
|
|
7741
|
-
return _el$
|
|
7860
|
+
return _el$20;
|
|
7742
7861
|
}
|
|
7743
|
-
}), _el$
|
|
7744
|
-
(0, $9HbP8$effect)(() => _el$
|
|
7745
|
-
return _el$
|
|
7862
|
+
}), _el$26, _co$8);
|
|
7863
|
+
(0, $9HbP8$effect)(() => _el$13.classList.toggle("compact", !!on_previous_searches_page_()));
|
|
7864
|
+
return _el$13;
|
|
7746
7865
|
}
|
|
7747
7866
|
});
|
|
7748
7867
|
}
|
|
7749
|
-
const $
|
|
7868
|
+
const $92a48aea6a9364d8$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$template)(`<a target="_blank"></a>`, 2);
|
|
7869
|
+
function $92a48aea6a9364d8$export$1efe1013da60d0e4(e, href) {
|
|
7870
|
+
if (e.metaKey || e.ctrlKey) {
|
|
7871
|
+
// Open link in a new tab with cmd/ctrl + enter.
|
|
7872
|
+
const link = (() => {
|
|
7873
|
+
const _el$ = (0, $9HbP8$getNextElement)($92a48aea6a9364d8$var$_tmpl$);
|
|
7874
|
+
(0, $9HbP8$setAttribute)(_el$, "href", href);
|
|
7875
|
+
return _el$;
|
|
7876
|
+
})();
|
|
7877
|
+
document.body.append(link);
|
|
7878
|
+
link.click();
|
|
7879
|
+
link.remove();
|
|
7880
|
+
return true;
|
|
7881
|
+
}
|
|
7882
|
+
return false;
|
|
7883
|
+
}
|
|
7750
7884
|
function $15f380f0ce2812cc$export$217899a935ef803b({
|
|
7751
7885
|
selected_index_: [read_selected_index, write_selected_index],
|
|
7752
7886
|
currently_showing_suggestions_: [read_currently_showing_suggestions],
|
|
@@ -7820,6 +7954,7 @@ function $15f380f0ce2812cc$var$actual_navigation_working_on_fake_data({
|
|
|
7820
7954
|
const sfv = get_search_field_value();
|
|
7821
7955
|
if (!(0, $9HbP8$untrack)(() => read_updating_blocked())) previous_value = sfv;
|
|
7822
7956
|
});
|
|
7957
|
+
const owner = (0, $9HbP8$getOwner)();
|
|
7823
7958
|
const handler = (0, $9HbP8$catchify)(({
|
|
7824
7959
|
keyCode: keyCode
|
|
7825
7960
|
}) => (0, $9HbP8$untrack)(() => {
|
|
@@ -7850,29 +7985,29 @@ function $15f380f0ce2812cc$var$actual_navigation_working_on_fake_data({
|
|
|
7850
7985
|
const {
|
|
7851
7986
|
title: title
|
|
7852
7987
|
} = selected_entry;
|
|
7853
|
-
|
|
7988
|
+
(0, $9HbP8$runWithOwner)(owner, block_updating_for_one_change);
|
|
7854
7989
|
set_search_field_value(title);
|
|
7855
|
-
override_on_enter_for_this_entry(e => {
|
|
7990
|
+
(0, $9HbP8$runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
|
|
7856
7991
|
// Open search query in new tab on cmd+enter
|
|
7857
7992
|
// 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 ;)
|
|
7858
7993
|
const url = new URL(location);
|
|
7859
7994
|
url_transformer_?.(url);
|
|
7860
7995
|
url.searchParams.set(search_query_param_name_, title);
|
|
7861
|
-
return $
|
|
7862
|
-
});
|
|
7863
|
-
} else if (selected_entry?.type == "category") override_on_enter_for_this_entry(e => {
|
|
7996
|
+
return (0, $92a48aea6a9364d8$export$1efe1013da60d0e4)(e, url.href);
|
|
7997
|
+
}));
|
|
7998
|
+
} else if (selected_entry?.type == "category" || selected_entry?.type === "content") (0, $9HbP8$runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
|
|
7864
7999
|
const {
|
|
7865
8000
|
page_url: page_url
|
|
7866
8001
|
} = selected_entry;
|
|
7867
|
-
if (
|
|
8002
|
+
if (!(0, $92a48aea6a9364d8$export$1efe1013da60d0e4)(e, page_url))
|
|
7868
8003
|
// Above fn will return true if it opened a new tab, and we won't make these checks anymore
|
|
7869
8004
|
router_.navigate_.go_to_({
|
|
7870
8005
|
new_url_: page_url,
|
|
7871
8006
|
is_replace_: false
|
|
7872
8007
|
});
|
|
7873
8008
|
return true;
|
|
7874
|
-
});else if (!selected_entry) {
|
|
7875
|
-
|
|
8009
|
+
}));else if (!selected_entry) {
|
|
8010
|
+
(0, $9HbP8$runWithOwner)(owner, block_updating_for_one_change);
|
|
7876
8011
|
set_search_field_value(previous_value);
|
|
7877
8012
|
}
|
|
7878
8013
|
}));
|
|
@@ -7883,20 +8018,37 @@ function $15f380f0ce2812cc$var$actual_navigation_working_on_fake_data({
|
|
|
7883
8018
|
(0, $9HbP8$onCleanup)((0, $9HbP8$catchify)(() => el.removeEventListener("keyup", handler)));
|
|
7884
8019
|
});
|
|
7885
8020
|
}
|
|
7886
|
-
function $
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
8021
|
+
function $1ae0eaca6ada9753$export$af0124069c150252({
|
|
8022
|
+
set_override_on_enter_fn_: set_override_on_enter_fn_,
|
|
8023
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
8024
|
+
read_suggestion_signal_: read_suggestion_signal_,
|
|
8025
|
+
router_: router_,
|
|
8026
|
+
content_results_: content_results_
|
|
8027
|
+
}) {
|
|
8028
|
+
const [get_autocomplete_wants_override_function, set_autocomplete_wants_override_function] = (0, $9HbP8$createSignal)(() => false);
|
|
8029
|
+
(0, $9HbP8$createComputed)(() => {
|
|
8030
|
+
const suggestions = read_suggestion_signal_();
|
|
8031
|
+
const search_results = get_modal_search_results_()?.();
|
|
8032
|
+
const content_results = content_results_();
|
|
8033
|
+
// If we only have one content result and nothing else, go there when pressing enter
|
|
8034
|
+
if (!suggestions.length && !search_results?.displays?.length && content_results?.length === 1) {
|
|
8035
|
+
const [{
|
|
8036
|
+
page_url: page_url
|
|
8037
|
+
}] = content_results;
|
|
8038
|
+
set_override_on_enter_fn_(e => {
|
|
8039
|
+
if (!(0, $92a48aea6a9364d8$export$1efe1013da60d0e4)(e, page_url))
|
|
8040
|
+
// Above fn will return true if it opened a new tab, and we won't make these checks anymore
|
|
8041
|
+
router_.navigate_.go_to_({
|
|
8042
|
+
new_url_: page_url,
|
|
8043
|
+
is_replace_: false
|
|
8044
|
+
});
|
|
8045
|
+
return true;
|
|
8046
|
+
});
|
|
8047
|
+
return;
|
|
8048
|
+
}
|
|
8049
|
+
set_override_on_enter_fn_(get_autocomplete_wants_override_function());
|
|
8050
|
+
});
|
|
8051
|
+
return new_fn => set_autocomplete_wants_override_function(() => new_fn);
|
|
7900
8052
|
}
|
|
7901
8053
|
const $a0eb8b431ec1f87b$export$3cf9497e790da491 = "query";
|
|
7902
8054
|
function $a0eb8b431ec1f87b$export$2f2b9559550c7bbc({
|
|
@@ -7916,12 +8068,15 @@ function $a0eb8b431ec1f87b$export$2f2b9559550c7bbc({
|
|
|
7916
8068
|
i18n_: i18n_,
|
|
7917
8069
|
include_category_suggestions_: include_category_suggestions_,
|
|
7918
8070
|
submit_query_: submit_query_,
|
|
7919
|
-
router_: router_
|
|
8071
|
+
router_: router_,
|
|
8072
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
8073
|
+
content_search_enabled_: content_search_enabled_
|
|
7920
8074
|
}) {
|
|
7921
8075
|
const [searching_for_value, set_searching_for_value] = (0, $9HbP8$createSignal)();
|
|
8076
|
+
const [show_stale_content_results, set_show_stale_content_results] = (0, $9HbP8$createSignal)(false);
|
|
7922
8077
|
const [read_search_field_value] = search_field_value_;
|
|
7923
8078
|
const updating_blocked = (0, $9HbP8$createSignal)(false);
|
|
7924
|
-
const [
|
|
8079
|
+
const [read_suggestion_signal_, write_suggestion_signal] = (0, $9HbP8$createSignal)([]);
|
|
7925
8080
|
const filtered_previous_searches = (0, $9HbP8$createMemo)(() => [...unfiltered_previous_searches[0]()].reverse().filter(q => q !== get_search_query_()));
|
|
7926
8081
|
const deparallelized_fn = (0, $9HbP8$deparallelize_no_drop)(async request_obj => {
|
|
7927
8082
|
const api_response = await depict_api_.suggest(request_obj);
|
|
@@ -7940,15 +8095,38 @@ function $a0eb8b431ec1f87b$export$2f2b9559550c7bbc({
|
|
|
7940
8095
|
});
|
|
7941
8096
|
|
|
7942
8097
|
const show_previous_searches_component = (0, $9HbP8$createMemo)(() => !read_search_field_value() || (0, $9HbP8$untrack)(updating_blocked[0]) && !(0, $9HbP8$untrack)(searching_for_value));
|
|
8098
|
+
const get_content_results_ = (0, $9HbP8$createMemo)(prev => {
|
|
8099
|
+
if (!content_search_enabled_()) return [];
|
|
8100
|
+
if (show_stale_content_results())
|
|
8101
|
+
// don't update content results when query suggestions don't update because otherwise they disappear when trying to keyboard navigate to them
|
|
8102
|
+
return prev;
|
|
8103
|
+
return get_modal_search_results_()?.()?.content_search_links?.map(link => ({
|
|
8104
|
+
page_url: link.page_url,
|
|
8105
|
+
type: "content",
|
|
8106
|
+
title: link.title
|
|
8107
|
+
}));
|
|
8108
|
+
});
|
|
8109
|
+
// 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.
|
|
8110
|
+
// It's the functionality to open the content results page when you press enter, in the modal, when there's only one content result
|
|
8111
|
+
const manipulated_set_override_on_enter_fn_ = (0, $1ae0eaca6ada9753$export$af0124069c150252)({
|
|
8112
|
+
set_override_on_enter_fn_: set_override_on_enter_fn_,
|
|
8113
|
+
get_modal_search_results_: get_modal_search_results_,
|
|
8114
|
+
read_suggestion_signal_: read_suggestion_signal_,
|
|
8115
|
+
router_: router_,
|
|
8116
|
+
content_results_: get_content_results_
|
|
8117
|
+
});
|
|
7943
8118
|
(0, $9HbP8$createComputed)(() => {
|
|
7944
8119
|
const field_value = read_search_field_value();
|
|
7945
|
-
if (
|
|
8120
|
+
if ((0, $9HbP8$untrack)(updating_blocked[0]))
|
|
8121
|
+
// not using updating_blocked instead of below signal since I presume they'd start updating too early then
|
|
8122
|
+
set_show_stale_content_results(true);else {
|
|
7946
8123
|
set_searching_for_value(field_value);
|
|
7947
8124
|
deparallelized_fn({
|
|
7948
8125
|
query: field_value,
|
|
7949
8126
|
tenant: tenant_(),
|
|
7950
8127
|
market: market_()
|
|
7951
8128
|
});
|
|
8129
|
+
set_show_stale_content_results(false);
|
|
7952
8130
|
}
|
|
7953
8131
|
});
|
|
7954
8132
|
(0, $9HbP8$createComputed)((0, $9HbP8$on)(search_field_value_[0], () => !updating_blocked[0]() && selected_index_[1](undefined), {
|
|
@@ -7960,7 +8138,7 @@ function $a0eb8b431ec1f87b$export$2f2b9559550c7bbc({
|
|
|
7960
8138
|
search_field_value_: search_field_value_,
|
|
7961
8139
|
updating_blocked_: updating_blocked,
|
|
7962
8140
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
7963
|
-
set_override_on_enter_fn_:
|
|
8141
|
+
set_override_on_enter_fn_: manipulated_set_override_on_enter_fn_,
|
|
7964
8142
|
search_query_param_name_: search_query_url_param_name_,
|
|
7965
8143
|
url_transformer_: url_transformer_,
|
|
7966
8144
|
router_: router_
|
|
@@ -7999,11 +8177,12 @@ function $a0eb8b431ec1f87b$export$2f2b9559550c7bbc({
|
|
|
7999
8177
|
},
|
|
8000
8178
|
on_previous_searches_page_: show_previous_searches_component,
|
|
8001
8179
|
i18n_: i18n_,
|
|
8180
|
+
get_content_results_: get_content_results_,
|
|
8002
8181
|
url_transformer_: url_transformer_,
|
|
8003
8182
|
searching_for_value_: searching_for_value,
|
|
8004
8183
|
search_query_url_param_name_: search_query_url_param_name_,
|
|
8005
8184
|
selected_index_: selected_index_,
|
|
8006
|
-
suggestion_memo_:
|
|
8185
|
+
suggestion_memo_: read_suggestion_signal_,
|
|
8007
8186
|
currently_showing_suggestions_: currently_showing_suggestions_,
|
|
8008
8187
|
include_category_suggestions_: include_category_suggestions_,
|
|
8009
8188
|
router_: router_,
|
|
@@ -8107,7 +8286,8 @@ function $fabfda1230351b1a$export$1c593cbd6f1e10bc({
|
|
|
8107
8286
|
bottom_distance_under_modal_: bottom_distance_under_modal_,
|
|
8108
8287
|
selected_text_range_: selected_text_range_,
|
|
8109
8288
|
dont_sync_search_field_value_except_on_submit_ = false,
|
|
8110
|
-
router_: router_
|
|
8289
|
+
router_: router_,
|
|
8290
|
+
content_search_enabled_: content_search_enabled_
|
|
8111
8291
|
}) {
|
|
8112
8292
|
let on_enter_in_search_field_function;
|
|
8113
8293
|
// 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.
|
|
@@ -8124,44 +8304,37 @@ function $fabfda1230351b1a$export$1c593cbd6f1e10bc({
|
|
|
8124
8304
|
};
|
|
8125
8305
|
const [input_field, set_input_field] = (0, $9HbP8$createSignal)();
|
|
8126
8306
|
const [get_search_field_value_] = search_field_value_;
|
|
8127
|
-
const [
|
|
8128
|
-
const [elements_inside_scrollable, set_elements_inside_scrollable] = (0, $9HbP8$createSignal)();
|
|
8307
|
+
const [get_modal_search_results, set_modal_search_results_] = (0, $9HbP8$createSignal)();
|
|
8129
8308
|
const close_on_escape_handler = (0, $9HbP8$catchify)(({
|
|
8130
8309
|
key: key
|
|
8131
8310
|
}) => {
|
|
8132
8311
|
if (key === "Escape") close_modal_();
|
|
8133
8312
|
});
|
|
8134
|
-
const [
|
|
8313
|
+
const [get_total_num_results_accessor, set_total_num_results_accessor_] = (0, $9HbP8$createSignal)();
|
|
8135
8314
|
const selected_index = (0, $9HbP8$createSignal)();
|
|
8136
8315
|
const currently_showing_suggestions_ = (0, $9HbP8$createSignal)([], {
|
|
8137
8316
|
equals: false
|
|
8138
8317
|
});
|
|
8318
|
+
const less_than_700_high = (0, $dc9262ef6f786812$export$d9f36cf74e24d595)("(max-height:700px)");
|
|
8319
|
+
const DiscoverMoreSection = () => (() => {
|
|
8320
|
+
const _el$ = (0, $9HbP8$getNextElement)($fabfda1230351b1a$var$_tmpl$),
|
|
8321
|
+
_el$2 = _el$.firstChild;
|
|
8322
|
+
(0, $9HbP8$addEventListener)(_el$2, "click", (0, $9HbP8$catchify)(() => submit_query_()), true);
|
|
8323
|
+
(0, $9HbP8$insert)(_el$2, (() => {
|
|
8324
|
+
const _c$ = (0, $9HbP8$memo)(() => !!get_search_field_value_());
|
|
8325
|
+
return () => _c$() ? i18n_.modal_view_all_results_()((() => {
|
|
8326
|
+
const _el$3 = (0, $9HbP8$getNextElement)($fabfda1230351b1a$var$_tmpl$2);
|
|
8327
|
+
(0, $9HbP8$insert)(_el$3, () => get_total_num_results_accessor?.());
|
|
8328
|
+
return _el$3;
|
|
8329
|
+
})()) : i18n_.modal_discover_more_();
|
|
8330
|
+
})());
|
|
8331
|
+
(0, $9HbP8$runHydrationEvents)();
|
|
8332
|
+
return _el$;
|
|
8333
|
+
})();
|
|
8139
8334
|
if (disable_scrolling_) (0, $aea1edf92433e81e$export$fe334901e8bebd57)();
|
|
8140
8335
|
$fabfda1230351b1a$var$close_modal_when_navigating_away(close_modal_, search_query_url_param_name_);
|
|
8141
8336
|
window.addEventListener("keydown", close_on_escape_handler);
|
|
8142
8337
|
(0, $9HbP8$onCleanup)((0, $9HbP8$catchify)(() => window.removeEventListener("keydown", close_on_escape_handler)));
|
|
8143
|
-
const owner = (0, $9HbP8$getOwner)();
|
|
8144
|
-
(0, $9HbP8$onCleanup)((0, $9HbP8$javascript_media_query)("(max-height:700px)", ({
|
|
8145
|
-
matches: matches
|
|
8146
|
-
}) => (0, $9HbP8$runWithOwner)(owner, () => {
|
|
8147
|
-
// the if below is reactive so we need an owner
|
|
8148
|
-
(matches ? set_elements_outside_scrollable : set_elements_inside_scrollable)("");
|
|
8149
|
-
(matches ? set_elements_inside_scrollable : set_elements_outside_scrollable)((() => {
|
|
8150
|
-
const _el$ = (0, $9HbP8$getNextElement)($fabfda1230351b1a$var$_tmpl$),
|
|
8151
|
-
_el$2 = _el$.firstChild;
|
|
8152
|
-
(0, $9HbP8$addEventListener)(_el$2, "click", (0, $9HbP8$catchify)(() => submit_query_()), true);
|
|
8153
|
-
(0, $9HbP8$insert)(_el$2, (() => {
|
|
8154
|
-
const _c$ = (0, $9HbP8$memo)(() => !!get_search_field_value_());
|
|
8155
|
-
return () => _c$() ? i18n_.modal_view_all_results_()((() => {
|
|
8156
|
-
const _el$3 = (0, $9HbP8$getNextElement)($fabfda1230351b1a$var$_tmpl$2);
|
|
8157
|
-
(0, $9HbP8$insert)(_el$3, () => get_num_results_accessor?.());
|
|
8158
|
-
return _el$3;
|
|
8159
|
-
})()) : i18n_.modal_discover_more_();
|
|
8160
|
-
})());
|
|
8161
|
-
(0, $9HbP8$runHydrationEvents)();
|
|
8162
|
-
return _el$;
|
|
8163
|
-
})());
|
|
8164
|
-
})).remove);
|
|
8165
8338
|
if (closing_animation_) register_closing_animation_(closing_animation_);
|
|
8166
8339
|
(0, $c64d28ca12452b21$export$3340fdd8259bd4fd)({
|
|
8167
8340
|
get_search_field_value_: get_search_field_value_,
|
|
@@ -8243,7 +8416,9 @@ function $fabfda1230351b1a$export$1c593cbd6f1e10bc({
|
|
|
8243
8416
|
i18n_: i18n_,
|
|
8244
8417
|
include_category_suggestions_: enable_category_suggestions_ ?? true,
|
|
8245
8418
|
router_: router_,
|
|
8246
|
-
submit_query_: submit_query_
|
|
8419
|
+
submit_query_: submit_query_,
|
|
8420
|
+
get_modal_search_results_: get_modal_search_results,
|
|
8421
|
+
content_search_enabled_: content_search_enabled_
|
|
8247
8422
|
});
|
|
8248
8423
|
}
|
|
8249
8424
|
}), _el$8, _co$);
|
|
@@ -8257,14 +8432,30 @@ function $fabfda1230351b1a$export$1c593cbd6f1e10bc({
|
|
|
8257
8432
|
tenant_: tenant_,
|
|
8258
8433
|
i18n_: i18n_,
|
|
8259
8434
|
market_: market_,
|
|
8260
|
-
|
|
8435
|
+
set_total_num_results_accessor_: set_total_num_results_accessor_,
|
|
8261
8436
|
router_: router_,
|
|
8437
|
+
set_modal_search_results_: set_modal_search_results_,
|
|
8438
|
+
content_search_enabled_: content_search_enabled_,
|
|
8262
8439
|
...instant_results_options_
|
|
8263
8440
|
});
|
|
8264
8441
|
}
|
|
8265
8442
|
}), _el$10, _co$2);
|
|
8266
|
-
(0, $9HbP8$insert)(_el$6,
|
|
8267
|
-
|
|
8443
|
+
(0, $9HbP8$insert)(_el$6, (0, $9HbP8$createComponent)((0, $9HbP8$Show), {
|
|
8444
|
+
get when() {
|
|
8445
|
+
return less_than_700_high();
|
|
8446
|
+
},
|
|
8447
|
+
get children() {
|
|
8448
|
+
return (0, $9HbP8$createComponent)(DiscoverMoreSection, {});
|
|
8449
|
+
}
|
|
8450
|
+
}), _el$12, _co$3);
|
|
8451
|
+
(0, $9HbP8$insert)(_el$5, (0, $9HbP8$createComponent)((0, $9HbP8$Show), {
|
|
8452
|
+
get when() {
|
|
8453
|
+
return !less_than_700_high();
|
|
8454
|
+
},
|
|
8455
|
+
get children() {
|
|
8456
|
+
return (0, $9HbP8$createComponent)(DiscoverMoreSection, {});
|
|
8457
|
+
}
|
|
8458
|
+
}), _el$16, _co$5);
|
|
8268
8459
|
(0, $9HbP8$insert)(_el$4, (0, $9HbP8$createComponent)((0, $19f1f3e588d63502$export$f021bdedd3ec901a), {
|
|
8269
8460
|
styles: body_style
|
|
8270
8461
|
}), _el$18, _co$6);
|
|
@@ -8369,11 +8560,13 @@ const $f8c929beb82c512b$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$template)(`<b></b>`
|
|
|
8369
8560
|
function $f8c929beb82c512b$export$9dd50d35b9d94fdf({
|
|
8370
8561
|
get_search_query_: get_search_query_,
|
|
8371
8562
|
i18n_: i18n_,
|
|
8372
|
-
formatted_number_of_results_: formatted_number_of_results_
|
|
8563
|
+
formatted_number_of_results_: formatted_number_of_results_,
|
|
8564
|
+
number_of_results_: number_of_results_,
|
|
8565
|
+
type: type
|
|
8373
8566
|
}) {
|
|
8374
8567
|
const contents = (0, $9HbP8$createMemo)((0, $9HbP8$catchify)(() => {
|
|
8375
8568
|
const q = get_search_query_();
|
|
8376
|
-
return i18n_.get_showing_results_for_()((() => {
|
|
8569
|
+
return i18n_[type === $f8c929beb82c512b$export$2452208c79fe93ea.content ? "get_showing_pages_for_" : "get_showing_results_for_"]()((() => {
|
|
8377
8570
|
const _el$ = (0, $9HbP8$getNextElement)($f8c929beb82c512b$var$_tmpl$);
|
|
8378
8571
|
(0, $9HbP8$insert)(_el$, q);
|
|
8379
8572
|
return _el$;
|
|
@@ -8381,7 +8574,7 @@ function $f8c929beb82c512b$export$9dd50d35b9d94fdf({
|
|
|
8381
8574
|
const _el$2 = (0, $9HbP8$getNextElement)($f8c929beb82c512b$var$_tmpl$);
|
|
8382
8575
|
(0, $9HbP8$insert)(_el$2, formatted_number_of_results_);
|
|
8383
8576
|
return _el$2;
|
|
8384
|
-
})());
|
|
8577
|
+
})(), !!q, number_of_results_());
|
|
8385
8578
|
}));
|
|
8386
8579
|
return (() => {
|
|
8387
8580
|
const _el$3 = (0, $9HbP8$getNextElement)($f8c929beb82c512b$var$_tmpl$2);
|
|
@@ -8389,6 +8582,11 @@ function $f8c929beb82c512b$export$9dd50d35b9d94fdf({
|
|
|
8389
8582
|
return _el$3;
|
|
8390
8583
|
})();
|
|
8391
8584
|
}
|
|
8585
|
+
let $f8c929beb82c512b$export$2452208c79fe93ea;
|
|
8586
|
+
(function (ShowingResultsForType) {
|
|
8587
|
+
ShowingResultsForType[ShowingResultsForType["products"] = 0] = "products";
|
|
8588
|
+
ShowingResultsForType[ShowingResultsForType["content"] = 1] = "content";
|
|
8589
|
+
})($f8c929beb82c512b$export$2452208c79fe93ea || ($f8c929beb82c512b$export$2452208c79fe93ea = {}));
|
|
8392
8590
|
function $1801dbce7adb3f19$export$41b4894022a3580f({
|
|
8393
8591
|
style_props_ = (0, $9HbP8$createSignal)({})
|
|
8394
8592
|
} = {}) {
|
|
@@ -8407,8 +8605,486 @@ function $1801dbce7adb3f19$export$41b4894022a3580f({
|
|
|
8407
8605
|
})));
|
|
8408
8606
|
return style_props_;
|
|
8409
8607
|
}
|
|
8608
|
+
const $522a690e0e2bd46d$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$template)(`<span class="highlighted-part"></span>`, 2);
|
|
8609
|
+
const $522a690e0e2bd46d$var$dont_cut_in_between_less_than_characters = 30;
|
|
8610
|
+
function $522a690e0e2bd46d$export$e1a98a189fd2c0e7({
|
|
8611
|
+
content_result_: content_result_,
|
|
8612
|
+
key_: key_,
|
|
8613
|
+
cut_when_possible_: cut_when_possible_
|
|
8614
|
+
}) {
|
|
8615
|
+
const matched_tokens = (0, $9HbP8$createMemo)(() => content_result_().highlights?.find(highlight => highlight.field == key_)?.matched_tokens);
|
|
8616
|
+
const full_value = (0, $9HbP8$createMemo)(() => content_result_()[key_]?.replaceAll("\n", " "));
|
|
8617
|
+
return (0, $9HbP8$createComponent)((0, $9HbP8$Show), {
|
|
8618
|
+
get when() {
|
|
8619
|
+
return matched_tokens()?.length;
|
|
8620
|
+
},
|
|
8621
|
+
get fallback() {
|
|
8622
|
+
return full_value();
|
|
8623
|
+
},
|
|
8624
|
+
get children() {
|
|
8625
|
+
return (() => {
|
|
8626
|
+
const segmented_cut_text = (0, $9HbP8$createMemo)(() => {
|
|
8627
|
+
const segmented_text = $522a690e0e2bd46d$var$segment_text(full_value(), matched_tokens());
|
|
8628
|
+
if (cut_when_possible_) $522a690e0e2bd46d$var$cut_text(segmented_text);
|
|
8629
|
+
return segmented_text;
|
|
8630
|
+
});
|
|
8631
|
+
return (0, $9HbP8$createComponent)((0, $9HbP8$Index), {
|
|
8632
|
+
get each() {
|
|
8633
|
+
return segmented_cut_text();
|
|
8634
|
+
},
|
|
8635
|
+
children: item => {
|
|
8636
|
+
return (0, $9HbP8$createComponent)((0, $9HbP8$Show), {
|
|
8637
|
+
get when() {
|
|
8638
|
+
return item().highlighted_;
|
|
8639
|
+
},
|
|
8640
|
+
get fallback() {
|
|
8641
|
+
return item().text_;
|
|
8642
|
+
},
|
|
8643
|
+
get children() {
|
|
8644
|
+
const _el$ = (0, $9HbP8$getNextElement)($522a690e0e2bd46d$var$_tmpl$);
|
|
8645
|
+
(0, $9HbP8$insert)(_el$, () => item().text_);
|
|
8646
|
+
return _el$;
|
|
8647
|
+
}
|
|
8648
|
+
});
|
|
8649
|
+
}
|
|
8650
|
+
});
|
|
8651
|
+
})();
|
|
8652
|
+
}
|
|
8653
|
+
});
|
|
8654
|
+
}
|
|
8655
|
+
function $522a690e0e2bd46d$var$cut_text(segmented_text) {
|
|
8656
|
+
// cut away chunks of text that are not highlighted to give a google-like overview of the content
|
|
8657
|
+
const highlighted_segments = segmented_text?.filter(segment => segment.highlighted_);
|
|
8658
|
+
if (!segmented_text || !highlighted_segments?.length) return;
|
|
8659
|
+
// We have one or more highlighted segments
|
|
8660
|
+
if (highlighted_segments.length === 1) {
|
|
8661
|
+
// cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
|
|
8662
|
+
$522a690e0e2bd46d$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
|
|
8663
|
+
return;
|
|
8664
|
+
}
|
|
8665
|
+
// We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
|
|
8666
|
+
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
|
|
8667
|
+
);
|
|
8668
|
+
|
|
8669
|
+
const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
|
|
8670
|
+
// We need to cut before the first segment - possibly through other segments - and maybe between segments
|
|
8671
|
+
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);
|
|
8672
|
+
$522a690e0e2bd46d$var$cut_start(index_of_first_segment, segmented_text);
|
|
8673
|
+
// update indexes since we might have removed segments
|
|
8674
|
+
[index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
|
|
8675
|
+
let number_of_characters_between_segments = 0;
|
|
8676
|
+
for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
|
|
8677
|
+
const segment = segmented_text[i];
|
|
8678
|
+
number_of_characters_between_segments += segment.text_.length;
|
|
8679
|
+
}
|
|
8680
|
+
if (number_of_characters_between_segments < $522a690e0e2bd46d$var$dont_cut_in_between_less_than_characters)
|
|
8681
|
+
// don't cut if there are less than 30 characters between the two segments
|
|
8682
|
+
return;
|
|
8683
|
+
// We have more than 50 characters between the two segments, cut between them
|
|
8684
|
+
const [split_start_segment, split_start_character] = $522a690e0e2bd46d$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
|
|
8685
|
+
const [split_end_segment, split_end_character] = $522a690e0e2bd46d$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
|
|
8686
|
+
if (split_start_segment === undefined || split_end_segment === undefined ||
|
|
8687
|
+
// identical split point, or split end before split start, can't do anything
|
|
8688
|
+
split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
|
|
8689
|
+
const dots_segment = {
|
|
8690
|
+
text_: " … ",
|
|
8691
|
+
highlighted_: false
|
|
8692
|
+
};
|
|
8693
|
+
const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
|
|
8694
|
+
if (i < split_start_segment || i > split_end_segment) return segment;
|
|
8695
|
+
const text = segment.text_;
|
|
8696
|
+
if (i == split_end_segment && i == split_start_segment) return [{
|
|
8697
|
+
...segment,
|
|
8698
|
+
text_: text.slice(0, split_start_character).trimEnd()
|
|
8699
|
+
}, dots_segment, {
|
|
8700
|
+
...segment,
|
|
8701
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
8702
|
+
}];else if (i == split_start_segment) {
|
|
8703
|
+
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
|
|
8704
|
+
return segment;
|
|
8705
|
+
} else if (i == split_end_segment) return [dots_segment, {
|
|
8706
|
+
...segment,
|
|
8707
|
+
text_: text.slice(split_end_character + 1, text.length).trimStart()
|
|
8708
|
+
}];
|
|
8709
|
+
return []; // remove all segments inbetween
|
|
8710
|
+
});
|
|
8711
|
+
|
|
8712
|
+
segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
|
|
8713
|
+
$522a690e0e2bd46d$var$heal_holes(segmented_text);
|
|
8714
|
+
}
|
|
8715
|
+
function $522a690e0e2bd46d$var$heal_holes(segmented_text) {
|
|
8716
|
+
// try to heal "holes" created in the segments so there are only alternating segments
|
|
8717
|
+
const segments_to_delete = new Set();
|
|
8718
|
+
for (let i = 0; i < segmented_text.length; i++) {
|
|
8719
|
+
const segment = segmented_text[i];
|
|
8720
|
+
let previous_segment;
|
|
8721
|
+
for (let j = i - 1; j >= 0; j--) {
|
|
8722
|
+
previous_segment = segmented_text[j];
|
|
8723
|
+
// Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
|
|
8724
|
+
if (!segments_to_delete.has(previous_segment)) break;
|
|
8725
|
+
}
|
|
8726
|
+
if (previous_segment?.highlighted_ && segment.highlighted_ || previous_segment?.highlighted_ === false && segment.highlighted_ === false) {
|
|
8727
|
+
previous_segment.text_ += segment.text_; // IDK if this ever happens
|
|
8728
|
+
segments_to_delete.add(segment);
|
|
8729
|
+
}
|
|
8730
|
+
}
|
|
8731
|
+
for (const segment of segments_to_delete) {
|
|
8732
|
+
const index = segmented_text.indexOf(segment);
|
|
8733
|
+
segmented_text.splice(index, 1);
|
|
8734
|
+
}
|
|
8735
|
+
}
|
|
8736
|
+
function $522a690e0e2bd46d$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text, be_very_aggressive = true) {
|
|
8737
|
+
const should_loop_backwards = index_of_start_segment > index_of_end_segment;
|
|
8738
|
+
const step = should_loop_backwards ? -1 : 1;
|
|
8739
|
+
const desperate_split_attempts = [":", ";", ","];
|
|
8740
|
+
while (desperate_split_attempts.length) {
|
|
8741
|
+
const split_point_between_words = [];
|
|
8742
|
+
// for the middle also try to split with a few more characters if the default ones don't work over a full run
|
|
8743
|
+
const desperate_split_attempt = desperate_split_attempts.pop();
|
|
8744
|
+
let is_first_character = true;
|
|
8745
|
+
for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
|
|
8746
|
+
const segment = segmented_text[i];
|
|
8747
|
+
const text = segment.text_;
|
|
8748
|
+
for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
|
|
8749
|
+
const character = text[j];
|
|
8750
|
+
if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
|
|
8751
|
+
if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
|
|
8752
|
+
split_point_between_words.push([i, j]);
|
|
8753
|
+
if (split_point_between_words.length > 3)
|
|
8754
|
+
// We can't find a split point, so we'll just split between words
|
|
8755
|
+
// 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
|
|
8756
|
+
return split_point_between_words[1];
|
|
8757
|
+
}
|
|
8758
|
+
}
|
|
8759
|
+
}
|
|
8760
|
+
}
|
|
8761
|
+
return [];
|
|
8762
|
+
}
|
|
8763
|
+
function $522a690e0e2bd46d$var$cut_start(cut_left_of_index, segmented_text) {
|
|
8764
|
+
// Cut the start of the text to bring the first matching token
|
|
8765
|
+
let is_first_character = false;
|
|
8766
|
+
let words_encountered = 0;
|
|
8767
|
+
outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
|
|
8768
|
+
const segment = segmented_text[i];
|
|
8769
|
+
// We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
|
|
8770
|
+
const text = segment.text_;
|
|
8771
|
+
for (let j = text.length - 1; j >= 0; j--) {
|
|
8772
|
+
const character = text[j];
|
|
8773
|
+
const is_space = character == " ";
|
|
8774
|
+
if (!is_first_character && is_space) words_encountered++;
|
|
8775
|
+
if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
|
|
8776
|
+
// We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
|
|
8777
|
+
segment.text_ = text.slice(j + 1).trimStart();
|
|
8778
|
+
segmented_text.splice(0, i);
|
|
8779
|
+
if (character === "," || is_space)
|
|
8780
|
+
// if we cut at a comma or psace, we add a … at the beginning
|
|
8781
|
+
segmented_text.unshift({
|
|
8782
|
+
text_: "… ",
|
|
8783
|
+
highlighted_: false
|
|
8784
|
+
});
|
|
8785
|
+
break outmost_loop;
|
|
8786
|
+
}
|
|
8787
|
+
if (is_first_character) is_first_character = false;
|
|
8788
|
+
}
|
|
8789
|
+
}
|
|
8790
|
+
$522a690e0e2bd46d$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
|
|
8791
|
+
}
|
|
8792
|
+
|
|
8793
|
+
function $522a690e0e2bd46d$var$segment_text(text, matched_strings) {
|
|
8794
|
+
// segment text where the matched strings are highlighted sections
|
|
8795
|
+
const output = [];
|
|
8796
|
+
if (!text) return; // shouldn't happen but whatever
|
|
8797
|
+
for (let i = 0; i < text.length; i++) {
|
|
8798
|
+
const found_strings = [];
|
|
8799
|
+
if (!i || text[i - 1] == " ")
|
|
8800
|
+
// only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
|
|
8801
|
+
for (let j = 0; j < matched_strings.length; j++) {
|
|
8802
|
+
const matched_string = matched_strings[j];
|
|
8803
|
+
const part_in_text = text.slice(i, i + matched_string.length);
|
|
8804
|
+
if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
|
|
8805
|
+
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
|
|
8806
|
+
}
|
|
8807
|
+
|
|
8808
|
+
const last_index_in_output = output.length - 1;
|
|
8809
|
+
if (!found_strings.length) {
|
|
8810
|
+
const character = text[i];
|
|
8811
|
+
if (output[last_index_in_output]?.highlighted_ === false || output.length && /\s/.test(character))
|
|
8812
|
+
// 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
|
|
8813
|
+
output[last_index_in_output].text_ += character;else output.push({
|
|
8814
|
+
highlighted_: false,
|
|
8815
|
+
text_: character
|
|
8816
|
+
});
|
|
8817
|
+
} else {
|
|
8818
|
+
const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
|
|
8819
|
+
if (output[last_index_in_output]?.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
|
|
8820
|
+
highlighted_: true,
|
|
8821
|
+
text_: longest_found_string
|
|
8822
|
+
});
|
|
8823
|
+
i += longest_found_string.length - 1;
|
|
8824
|
+
}
|
|
8825
|
+
}
|
|
8826
|
+
return output;
|
|
8827
|
+
}
|
|
8828
|
+
const $b2bf2cdcff8142d8$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$template)(`<a></a>`, 2),
|
|
8829
|
+
$b2bf2cdcff8142d8$var$_tmpl$2 = /*#__PURE__*/(0, $9HbP8$template)(`<div></div>`, 2),
|
|
8830
|
+
$b2bf2cdcff8142d8$var$_tmpl$3 = /*#__PURE__*/(0, $9HbP8$template)(`<div class="description line-clamp"></div>`, 2),
|
|
8831
|
+
$b2bf2cdcff8142d8$var$_tmpl$4 = /*#__PURE__*/(0, $9HbP8$template)(`<div class="content-card"><div class="image"></div><div class="info"><!#><!/><!#><!/></div></div>`, 10);
|
|
8832
|
+
function $b2bf2cdcff8142d8$export$f631859cab12b342({
|
|
8833
|
+
router_: router_,
|
|
8834
|
+
content_result_: content_result_
|
|
8835
|
+
}) {
|
|
8836
|
+
const make_link_attributes = () => {
|
|
8837
|
+
const result = content_result_?.();
|
|
8838
|
+
if (!result) return;
|
|
8839
|
+
return {
|
|
8840
|
+
href: result.page_url,
|
|
8841
|
+
onClick: (0, $9HbP8$catchify)(ev => router_.navigate_.go_to_({
|
|
8842
|
+
new_url_: result.page_url,
|
|
8843
|
+
is_replace_: false,
|
|
8844
|
+
event_: ev
|
|
8845
|
+
}))
|
|
8846
|
+
};
|
|
8847
|
+
};
|
|
8848
|
+
const LinkIfPossible = ({
|
|
8849
|
+
children: children,
|
|
8850
|
+
...attributes
|
|
8851
|
+
}) => {
|
|
8852
|
+
if (content_result_) return (() => {
|
|
8853
|
+
const _el$ = (0, $9HbP8$getNextElement)($b2bf2cdcff8142d8$var$_tmpl$);
|
|
8854
|
+
(0, $9HbP8$spread)(_el$, attributes, false, true);
|
|
8855
|
+
(0, $9HbP8$insert)(_el$, children);
|
|
8856
|
+
(0, $9HbP8$runHydrationEvents)();
|
|
8857
|
+
return _el$;
|
|
8858
|
+
})();
|
|
8859
|
+
return (() => {
|
|
8860
|
+
const _el$2 = (0, $9HbP8$getNextElement)($b2bf2cdcff8142d8$var$_tmpl$2);
|
|
8861
|
+
(0, $9HbP8$spread)(_el$2, attributes, false, true);
|
|
8862
|
+
(0, $9HbP8$insert)(_el$2, children);
|
|
8863
|
+
(0, $9HbP8$runHydrationEvents)();
|
|
8864
|
+
return _el$2;
|
|
8865
|
+
})();
|
|
8866
|
+
};
|
|
8867
|
+
return (() => {
|
|
8868
|
+
const _el$3 = (0, $9HbP8$getNextElement)($b2bf2cdcff8142d8$var$_tmpl$4),
|
|
8869
|
+
_el$4 = _el$3.firstChild,
|
|
8870
|
+
_el$5 = _el$4.nextSibling,
|
|
8871
|
+
_el$7 = _el$5.firstChild,
|
|
8872
|
+
[_el$8, _co$] = (0, $9HbP8$getNextMarker)(_el$7.nextSibling),
|
|
8873
|
+
_el$9 = _el$8.nextSibling,
|
|
8874
|
+
[_el$10, _co$2] = (0, $9HbP8$getNextMarker)(_el$9.nextSibling);
|
|
8875
|
+
(0, $9HbP8$insert)(_el$4, (0, $9HbP8$createComponent)(LinkIfPossible, (0, $9HbP8$mergeProps)(make_link_attributes, {
|
|
8876
|
+
tabIndex: "-1",
|
|
8877
|
+
get children() {
|
|
8878
|
+
return (0, $9HbP8$createComponent)((0, $190927650b4840eb$export$605674723bcc715c), {
|
|
8879
|
+
width: "28",
|
|
8880
|
+
height: "28"
|
|
8881
|
+
});
|
|
8882
|
+
}
|
|
8883
|
+
})));
|
|
8884
|
+
(0, $9HbP8$insert)(_el$5, (0, $9HbP8$createComponent)(LinkIfPossible, (0, $9HbP8$mergeProps)({
|
|
8885
|
+
"class": "content-title line-clamp"
|
|
8886
|
+
}, make_link_attributes, {
|
|
8887
|
+
get title() {
|
|
8888
|
+
return content_result_?.().title;
|
|
8889
|
+
},
|
|
8890
|
+
get children() {
|
|
8891
|
+
return content_result_ ? (0, $9HbP8$createComponent)((0, $522a690e0e2bd46d$export$e1a98a189fd2c0e7), {
|
|
8892
|
+
content_result_: content_result_,
|
|
8893
|
+
key_: "title",
|
|
8894
|
+
cut_when_possible_: false
|
|
8895
|
+
}) : (0, $9HbP8$createComponent)((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
|
|
8896
|
+
height: "1em",
|
|
8897
|
+
width: "20ch"
|
|
8898
|
+
});
|
|
8899
|
+
}
|
|
8900
|
+
})), _el$8, _co$);
|
|
8901
|
+
(0, $9HbP8$insert)(_el$5, (0, $9HbP8$createComponent)((0, $9HbP8$Show), {
|
|
8902
|
+
get when() {
|
|
8903
|
+
return content_result_?.().description || !content_result_;
|
|
8904
|
+
},
|
|
8905
|
+
get children() {
|
|
8906
|
+
const _el$6 = (0, $9HbP8$getNextElement)($b2bf2cdcff8142d8$var$_tmpl$3);
|
|
8907
|
+
(0, $9HbP8$insert)(_el$6, (0, $9HbP8$createComponent)((0, $9HbP8$Show), {
|
|
8908
|
+
when: content_result_,
|
|
8909
|
+
get fallback() {
|
|
8910
|
+
return Array.from({
|
|
8911
|
+
length: 4
|
|
8912
|
+
}).map(() => (0, $9HbP8$createComponent)((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
|
|
8913
|
+
height: "1em",
|
|
8914
|
+
width: "min(50ch, 100%)"
|
|
8915
|
+
}));
|
|
8916
|
+
},
|
|
8917
|
+
get children() {
|
|
8918
|
+
return (0, $9HbP8$createComponent)((0, $522a690e0e2bd46d$export$e1a98a189fd2c0e7), {
|
|
8919
|
+
content_result_: content_result_,
|
|
8920
|
+
key_: "description",
|
|
8921
|
+
cut_when_possible_: true
|
|
8922
|
+
});
|
|
8923
|
+
}
|
|
8924
|
+
}));
|
|
8925
|
+
return _el$6;
|
|
8926
|
+
}
|
|
8927
|
+
}), _el$10, _co$2);
|
|
8928
|
+
return _el$3;
|
|
8929
|
+
})();
|
|
8930
|
+
}
|
|
8931
|
+
function $b26bdbd081f63e3f$export$9ff751cd77687edc({
|
|
8932
|
+
search_results_: search_results_,
|
|
8933
|
+
router_: router_
|
|
8934
|
+
}) {
|
|
8935
|
+
const content_results = (0, $9HbP8$createMemo)(() => search_results_()?.content_search_links);
|
|
8936
|
+
const content_results_by_page_url = (0, $9HbP8$createMemo)(() => {
|
|
8937
|
+
const map = new Map();
|
|
8938
|
+
const results = content_results();
|
|
8939
|
+
if (!results) return map;
|
|
8940
|
+
for (let i = 0; i < results.length; i++) {
|
|
8941
|
+
const content_result = results[i];
|
|
8942
|
+
map.set(content_result.page_url, content_result);
|
|
8943
|
+
}
|
|
8944
|
+
return map;
|
|
8945
|
+
});
|
|
8946
|
+
return (0, $9HbP8$createComponent)((0, $9HbP8$For), {
|
|
8947
|
+
get each() {
|
|
8948
|
+
return [...content_results_by_page_url().keys()];
|
|
8949
|
+
},
|
|
8950
|
+
children: page_url => {
|
|
8951
|
+
const content_result = (0, $9HbP8$createMemo)(() => content_results_by_page_url().get(page_url));
|
|
8952
|
+
return (0, $9HbP8$createComponent)((0, $b2bf2cdcff8142d8$export$f631859cab12b342), {
|
|
8953
|
+
content_result_: content_result,
|
|
8954
|
+
router_: router_
|
|
8955
|
+
});
|
|
8956
|
+
}
|
|
8957
|
+
});
|
|
8958
|
+
}
|
|
8959
|
+
function $9d5b3ed1fc91c672$export$4405d077f0a20494({
|
|
8960
|
+
content_results_rows_: [get_history_state_content_results_rows],
|
|
8961
|
+
cols_at_size_: cols_at_size_
|
|
8962
|
+
}) {
|
|
8963
|
+
const largest_column = (0, $9HbP8$createMemo)(() => {
|
|
8964
|
+
const largest_in_cols_at_size = Math.max(...cols_at_size_().map(([cols]) => cols));
|
|
8965
|
+
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
|
|
8966
|
+
return largest_in_cols_at_size;
|
|
8967
|
+
});
|
|
8968
|
+
const num_placeholders = (0, $9HbP8$createMemo)(() => (get_history_state_content_results_rows() ?? (0, $49de9d31aeea1b5e$export$70ceae36059a1036)) * largest_column());
|
|
8969
|
+
return (0, $9HbP8$createComponent)((0, $9HbP8$Index), {
|
|
8970
|
+
get each() {
|
|
8971
|
+
return Array.from({
|
|
8972
|
+
length: num_placeholders()
|
|
8973
|
+
});
|
|
8974
|
+
},
|
|
8975
|
+
children: () => (0, $9HbP8$createComponent)((0, $b2bf2cdcff8142d8$export$f631859cab12b342), {})
|
|
8976
|
+
});
|
|
8977
|
+
}
|
|
8978
|
+
const $49de9d31aeea1b5e$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$template)(`<div class="content-results"><!#><!/><!#><!/></div>`, 6),
|
|
8979
|
+
$49de9d31aeea1b5e$var$_tmpl$2 = /*#__PURE__*/(0, $9HbP8$template)(`<button class="view-more"></button>`, 2),
|
|
8980
|
+
$49de9d31aeea1b5e$var$_tmpl$3 = /*#__PURE__*/(0, $9HbP8$template)(`<button class="view-less"></button>`, 2);
|
|
8981
|
+
const $49de9d31aeea1b5e$export$70ceae36059a1036 = 1;
|
|
8982
|
+
function $49de9d31aeea1b5e$export$6d0c9c22f6652669({
|
|
8983
|
+
search_results_: search_results_,
|
|
8984
|
+
get_search_query_: get_search_query_,
|
|
8985
|
+
i18n_: i18n_,
|
|
8986
|
+
layout_options_: layout_options_,
|
|
8987
|
+
router_: router_,
|
|
8988
|
+
query_base_: query_base_,
|
|
8989
|
+
content_results_rows_: content_results_rows_
|
|
8990
|
+
}) {
|
|
8991
|
+
const content_results = (0, $9HbP8$createMemo)(() => search_results_()?.content_search_links);
|
|
8992
|
+
const num_results = (0, $9HbP8$createMemo)(() => content_results()?.length);
|
|
8993
|
+
const is_loading_ = (0, $9HbP8$createMemo)(() => search_results_.loading || query_base_.loading); // See comment in PLPResults/index.tsx on why we need this
|
|
8994
|
+
const formatted_number_of_results_ = (0, $511cc0abd9a64ce8$export$92f2da32c6e7e7ee)({
|
|
8995
|
+
number_: num_results,
|
|
8996
|
+
i18n_: i18n_
|
|
8997
|
+
});
|
|
8998
|
+
const [is_showing_placeholders, set_is_showing_placeholders] = (0, $9HbP8$createSignal)(false);
|
|
8999
|
+
const rows_object = $49de9d31aeea1b5e$var$make_state_saved_rows(content_results_rows_, i18n_);
|
|
9000
|
+
return (() => {
|
|
9001
|
+
const _el$ = (0, $9HbP8$getNextElement)($49de9d31aeea1b5e$var$_tmpl$),
|
|
9002
|
+
_el$2 = _el$.firstChild,
|
|
9003
|
+
[_el$3, _co$] = (0, $9HbP8$getNextMarker)(_el$2.nextSibling),
|
|
9004
|
+
_el$4 = _el$3.nextSibling,
|
|
9005
|
+
[_el$5, _co$2] = (0, $9HbP8$getNextMarker)(_el$4.nextSibling);
|
|
9006
|
+
(0, $9HbP8$insert)(_el$, (0, $9HbP8$createComponent)((0, $f8c929beb82c512b$export$9dd50d35b9d94fdf), {
|
|
9007
|
+
get_search_query_: get_search_query_,
|
|
9008
|
+
i18n_: i18n_,
|
|
9009
|
+
formatted_number_of_results_: formatted_number_of_results_,
|
|
9010
|
+
get type() {
|
|
9011
|
+
return (0, $f8c929beb82c512b$export$2452208c79fe93ea).content;
|
|
9012
|
+
},
|
|
9013
|
+
number_of_results_: num_results
|
|
9014
|
+
}), _el$3, _co$);
|
|
9015
|
+
(0, $9HbP8$insert)(_el$, (0, $9HbP8$createComponent)((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), (0, $9HbP8$mergeProps)({
|
|
9016
|
+
layout: "grid",
|
|
9017
|
+
element_attributes: {
|
|
9018
|
+
class: "cards"
|
|
9019
|
+
}
|
|
9020
|
+
}, layout_options_, {
|
|
9021
|
+
rows: rows_object,
|
|
9022
|
+
get children() {
|
|
9023
|
+
return (0, $9HbP8$createComponent)((0, $9HbP8$Suspense), {
|
|
9024
|
+
get fallback() {
|
|
9025
|
+
return (() => {
|
|
9026
|
+
set_is_showing_placeholders(true);
|
|
9027
|
+
(0, $9HbP8$onCleanup)(() => set_is_showing_placeholders(false));
|
|
9028
|
+
return (0, $9HbP8$createComponent)((0, $9d5b3ed1fc91c672$export$4405d077f0a20494), {
|
|
9029
|
+
content_results_rows_: content_results_rows_,
|
|
9030
|
+
get cols_at_size_() {
|
|
9031
|
+
return (0, $9HbP8$createMemo)(() => layout_options_().cols_at_size);
|
|
9032
|
+
}
|
|
9033
|
+
});
|
|
9034
|
+
})();
|
|
9035
|
+
},
|
|
9036
|
+
get children() {
|
|
9037
|
+
return (0, $9HbP8$createComponent)((0, $b26bdbd081f63e3f$export$9ff751cd77687edc), {
|
|
9038
|
+
router_: router_,
|
|
9039
|
+
search_results_: search_results_
|
|
9040
|
+
});
|
|
9041
|
+
}
|
|
9042
|
+
});
|
|
9043
|
+
}
|
|
9044
|
+
})), _el$5, _co$2);
|
|
9045
|
+
(0, $9HbP8$effect)(_p$ => {
|
|
9046
|
+
const _v$ = !!is_showing_placeholders(),
|
|
9047
|
+
_v$2 = is_loading_() || content_results()?.length > 0 ? "" : "none";
|
|
9048
|
+
_v$ !== _p$._v$ && _el$.classList.toggle("loading", _p$._v$ = _v$);
|
|
9049
|
+
_v$2 !== _p$._v$2 && _el$.style.setProperty("display", _p$._v$2 = _v$2);
|
|
9050
|
+
return _p$;
|
|
9051
|
+
}, {
|
|
9052
|
+
_v$: undefined,
|
|
9053
|
+
_v$2: undefined
|
|
9054
|
+
});
|
|
9055
|
+
return _el$;
|
|
9056
|
+
})();
|
|
9057
|
+
}
|
|
9058
|
+
function $49de9d31aeea1b5e$var$make_state_saved_rows(
|
|
9059
|
+
// similar to the one in SearchRecommendations.tsx but not enough to warrant a shared function IMO
|
|
9060
|
+
[get_showing_content_results_rows, set_showing_content_results_rows], i18n_) {
|
|
9061
|
+
const currently_visible = (0, $9HbP8$createSignal)((0, $9HbP8$untrack)(get_showing_content_results_rows));
|
|
9062
|
+
const [get_currently_visible, set_currently_visible] = currently_visible;
|
|
9063
|
+
const rows = {
|
|
9064
|
+
currently_visible: currently_visible,
|
|
9065
|
+
start_rows: $49de9d31aeea1b5e$export$70ceae36059a1036,
|
|
9066
|
+
button: (() => {
|
|
9067
|
+
const _el$6 = (0, $9HbP8$getNextElement)($49de9d31aeea1b5e$var$_tmpl$2);
|
|
9068
|
+
(0, $9HbP8$insert)(_el$6, () => i18n_.view_more_());
|
|
9069
|
+
return _el$6;
|
|
9070
|
+
})(),
|
|
9071
|
+
view_less_button: (() => {
|
|
9072
|
+
const _el$7 = (0, $9HbP8$getNextElement)($49de9d31aeea1b5e$var$_tmpl$3);
|
|
9073
|
+
(0, $9HbP8$insert)(_el$7, () => i18n_.view_less_());
|
|
9074
|
+
return _el$7;
|
|
9075
|
+
})(),
|
|
9076
|
+
rows_per_click: 3
|
|
9077
|
+
};
|
|
9078
|
+
(0, $9HbP8$createComputed)((0, $9HbP8$on)(get_currently_visible, new_visible => set_showing_content_results_rows(new_visible), {
|
|
9079
|
+
defer: true
|
|
9080
|
+
}));
|
|
9081
|
+
(0, $9HbP8$createComputed)((0, $9HbP8$on)(get_showing_content_results_rows, (new_rows = $49de9d31aeea1b5e$export$70ceae36059a1036) => set_currently_visible(new_rows), {
|
|
9082
|
+
defer: true
|
|
9083
|
+
}));
|
|
9084
|
+
return rows;
|
|
9085
|
+
}
|
|
8410
9086
|
const $7097477c78a89208$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$template)(`<div class="filter-results-for-one-row"><!#><!/><!#><!/></div>`, 6),
|
|
8411
|
-
$7097477c78a89208$var$_tmpl$2 = /*#__PURE__*/(0, $9HbP8$template)(`<div class="depict plp search"><div class="listing-page"
|
|
9087
|
+
$7097477c78a89208$var$_tmpl$2 = /*#__PURE__*/(0, $9HbP8$template)(`<div class="depict plp search"><div class="listing-page"><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/><!#><!/></div><!#><!/><!#><!/></div>`, 22);
|
|
8412
9088
|
function $7097477c78a89208$export$a54ec244c8863715({
|
|
8413
9089
|
depict_api_: depict_api_,
|
|
8414
9090
|
search_field_value_: search_field_value_,
|
|
@@ -8437,7 +9113,11 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
8437
9113
|
recommendations_layout_options_: recommendations_layout_options_,
|
|
8438
9114
|
scroll_restoration_data_: scroll_restoration_data_,
|
|
8439
9115
|
product_card_template_: product_card_template_,
|
|
8440
|
-
modal_body_style_ref_: modal_body_style_ref_
|
|
9116
|
+
modal_body_style_ref_: modal_body_style_ref_,
|
|
9117
|
+
router_: router_,
|
|
9118
|
+
content_results_rows_: content_results_rows_,
|
|
9119
|
+
content_layout_options_: content_layout_options_,
|
|
9120
|
+
content_search_enabled_: content_search_enabled_
|
|
8441
9121
|
}) {
|
|
8442
9122
|
const [get_sorting] = current_sorting_;
|
|
8443
9123
|
const all_products_loaded_ = (0, $9HbP8$createSignal)(false);
|
|
@@ -8495,16 +9175,23 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
8495
9175
|
const SafeSearchField = (0, $9HbP8$catchify)((0, $5285d2814d0fac0c$export$b94867ecbd698f21));
|
|
8496
9176
|
const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $9HbP8$createSignal)(false);
|
|
8497
9177
|
const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $9HbP8$createSignal)();
|
|
9178
|
+
const n_hits = (0, $9HbP8$createMemo)(() => search_results_()?.n_hits);
|
|
8498
9179
|
const formatted_number_of_results_ = (0, $511cc0abd9a64ce8$export$92f2da32c6e7e7ee)({
|
|
8499
|
-
|
|
9180
|
+
number_: n_hits,
|
|
8500
9181
|
i18n_: i18n_
|
|
8501
9182
|
});
|
|
8502
9183
|
const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $9HbP8$createSignal)();
|
|
8503
|
-
const
|
|
9184
|
+
const no_results_text_ = (0, $9HbP8$createMemo)(() => (search_results_()?.content_search_links?.length ? i18n_.no_products_ : i18n_.no_results_text_)());
|
|
9185
|
+
const results_for = (0, $9HbP8$createComponent)((0, $f8c929beb82c512b$export$9dd50d35b9d94fdf), (0, $9HbP8$mergeProps)({
|
|
9186
|
+
get type() {
|
|
9187
|
+
return (0, $f8c929beb82c512b$export$2452208c79fe93ea).products;
|
|
9188
|
+
},
|
|
9189
|
+
number_of_results_: n_hits
|
|
9190
|
+
}, {
|
|
8504
9191
|
get_search_query_: get_search_query_,
|
|
8505
9192
|
i18n_: i18n_,
|
|
8506
9193
|
formatted_number_of_results_: formatted_number_of_results_
|
|
8507
|
-
});
|
|
9194
|
+
}));
|
|
8508
9195
|
const filters_opener = (0, $cdea4cf8c5c071ef$export$d7841e452f2e59a8)({
|
|
8509
9196
|
set_sort_or_filter_open_: set_sort_or_filter_open_,
|
|
8510
9197
|
set_extra_els_in_results_container_: set_desktop_filter_elements,
|
|
@@ -8622,10 +9309,12 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
8622
9309
|
[_el$17, _co$7] = (0, $9HbP8$getNextMarker)(_el$16.nextSibling),
|
|
8623
9310
|
_el$18 = _el$17.nextSibling,
|
|
8624
9311
|
[_el$19, _co$8] = (0, $9HbP8$getNextMarker)(_el$18.nextSibling),
|
|
8625
|
-
_el$20 = _el$
|
|
9312
|
+
_el$20 = _el$19.nextSibling,
|
|
8626
9313
|
[_el$21, _co$9] = (0, $9HbP8$getNextMarker)(_el$20.nextSibling),
|
|
8627
|
-
_el$22 = _el$
|
|
8628
|
-
[_el$23, _co$10] = (0, $9HbP8$getNextMarker)(_el$22.nextSibling)
|
|
9314
|
+
_el$22 = _el$7.nextSibling,
|
|
9315
|
+
[_el$23, _co$10] = (0, $9HbP8$getNextMarker)(_el$22.nextSibling),
|
|
9316
|
+
_el$24 = _el$23.nextSibling,
|
|
9317
|
+
[_el$25, _co$11] = (0, $9HbP8$getNextMarker)(_el$24.nextSibling);
|
|
8629
9318
|
(0, $9HbP8$insert)(_el$7, get_search_field_elements, _el$9, _co$3);
|
|
8630
9319
|
(0, $9HbP8$insert)(_el$7, make_category_suggestion_card_ ? (0, $9HbP8$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
|
|
8631
9320
|
severity_: "error",
|
|
@@ -8637,7 +9326,29 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
8637
9326
|
});
|
|
8638
9327
|
}
|
|
8639
9328
|
}) : null, _el$11, _co$4);
|
|
8640
|
-
(0, $9HbP8$insert)(_el$7, (
|
|
9329
|
+
(0, $9HbP8$insert)(_el$7, (0, $9HbP8$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
|
|
9330
|
+
severity_: "error",
|
|
9331
|
+
message_: "ContentResults failed",
|
|
9332
|
+
get children() {
|
|
9333
|
+
return (0, $9HbP8$createComponent)((0, $9HbP8$Show), {
|
|
9334
|
+
get when() {
|
|
9335
|
+
return content_search_enabled_();
|
|
9336
|
+
},
|
|
9337
|
+
get children() {
|
|
9338
|
+
return (0, $9HbP8$createComponent)((0, $49de9d31aeea1b5e$export$6d0c9c22f6652669), {
|
|
9339
|
+
content_results_rows_: content_results_rows_,
|
|
9340
|
+
search_results_: search_results_,
|
|
9341
|
+
i18n_: i18n_,
|
|
9342
|
+
get_search_query_: get_search_query_,
|
|
9343
|
+
layout_options_: content_layout_options_,
|
|
9344
|
+
router_: router_,
|
|
9345
|
+
query_base_: search_query_base_
|
|
9346
|
+
});
|
|
9347
|
+
}
|
|
9348
|
+
});
|
|
9349
|
+
}
|
|
9350
|
+
}), _el$13, _co$5);
|
|
9351
|
+
(0, $9HbP8$insert)(_el$7, () => results_filters[0](), _el$15, _co$6);
|
|
8641
9352
|
(0, $9HbP8$insert)(_el$7, (0, $9HbP8$createComponent)((0, $9HbP8$Show), {
|
|
8642
9353
|
get when() {
|
|
8643
9354
|
return selected_filters_[0]()?.length;
|
|
@@ -8660,7 +9371,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
8660
9371
|
}
|
|
8661
9372
|
});
|
|
8662
9373
|
}
|
|
8663
|
-
}), _el$
|
|
9374
|
+
}), _el$17, _co$7);
|
|
8664
9375
|
(0, $9HbP8$insert)(_el$7, (0, $9HbP8$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
|
|
8665
9376
|
severity_: "error",
|
|
8666
9377
|
message_: "Search results failed",
|
|
@@ -8683,11 +9394,14 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
8683
9394
|
selected_filters_: selected_filters_,
|
|
8684
9395
|
expanded_hierarchical_filters_: expanded_hierarchical_filters_,
|
|
8685
9396
|
local_filter_cache_: local_filter_cache_,
|
|
8686
|
-
i18n_:
|
|
9397
|
+
i18n_: {
|
|
9398
|
+
...i18n_,
|
|
9399
|
+
no_results_text_: no_results_text_
|
|
9400
|
+
}
|
|
8687
9401
|
}
|
|
8688
9402
|
});
|
|
8689
9403
|
}
|
|
8690
|
-
}), _el$
|
|
9404
|
+
}), _el$19, _co$8);
|
|
8691
9405
|
(0, $9HbP8$insert)(_el$7, (0, $9HbP8$createComponent)((0, $9HbP8$Show), {
|
|
8692
9406
|
get when() {
|
|
8693
9407
|
return get_all_products_loaded() && !disable_search_recommendations_;
|
|
@@ -8712,7 +9426,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
8712
9426
|
}
|
|
8713
9427
|
});
|
|
8714
9428
|
}
|
|
8715
|
-
}), _el$
|
|
9429
|
+
}), _el$21, _co$9);
|
|
8716
9430
|
(0, $9HbP8$insert)(_el$6, (0, $9HbP8$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
|
|
8717
9431
|
message_: "Scroll status failed",
|
|
8718
9432
|
severity_: "error",
|
|
@@ -8725,7 +9439,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
8725
9439
|
number_of_results_: (0, $9HbP8$createMemo)(() => search_results_()?.n_hits)
|
|
8726
9440
|
});
|
|
8727
9441
|
}
|
|
8728
|
-
}), _el$
|
|
9442
|
+
}), _el$23, _co$10);
|
|
8729
9443
|
(0, $9HbP8$insert)(_el$6, (0, $9HbP8$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
|
|
8730
9444
|
message_: "Floating buttons failed",
|
|
8731
9445
|
severity_: "error",
|
|
@@ -8738,7 +9452,7 @@ function $7097477c78a89208$export$a54ec244c8863715({
|
|
|
8738
9452
|
i18n_: i18n_
|
|
8739
9453
|
});
|
|
8740
9454
|
}
|
|
8741
|
-
}), _el$
|
|
9455
|
+
}), _el$25, _co$11);
|
|
8742
9456
|
(0, $9HbP8$effect)(() => (0, $9HbP8$setAttribute)(_el$6, "id", (0, $f86ba724282f6690$export$44dad306455dddf).SEARCH_PAGE));
|
|
8743
9457
|
return _el$6;
|
|
8744
9458
|
})()];
|
|
@@ -8763,6 +9477,27 @@ function $4ca91518c9a35379$export$828dcdd425fd3231(aligner) {
|
|
|
8763
9477
|
cleanup: cleanup
|
|
8764
9478
|
};
|
|
8765
9479
|
}
|
|
9480
|
+
|
|
9481
|
+
/**
|
|
9482
|
+
* 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
|
|
9483
|
+
*/
|
|
9484
|
+
function $1848f7cca286fbab$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
|
|
9485
|
+
if (!sdk_cols_at_size.length) return sdk_cols_at_size;
|
|
9486
|
+
const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
|
|
9487
|
+
const [[, smallest_max_width]] = sorted_sizes;
|
|
9488
|
+
if (smallest_max_width > min_width_for_more_than_one_column)
|
|
9489
|
+
// If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
|
|
9490
|
+
return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
|
|
9491
|
+
const to_delete = [];
|
|
9492
|
+
for (let i = 0; i < sorted_sizes.length; i++) {
|
|
9493
|
+
const [, max_width] = sorted_sizes[i];
|
|
9494
|
+
if (max_width > min_width_for_more_than_one_column) continue;
|
|
9495
|
+
to_delete.push(i);
|
|
9496
|
+
}
|
|
9497
|
+
while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
|
|
9498
|
+
sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
|
|
9499
|
+
return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
|
|
9500
|
+
}
|
|
8766
9501
|
const $806c97b931758897$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$template)(`<div class="depict plp search"></div>`, 2);
|
|
8767
9502
|
// 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
|
|
8768
9503
|
/**
|
|
@@ -8772,6 +9507,7 @@ const $806c97b931758897$var$_tmpl$ = /*#__PURE__*/(0, $9HbP8$template)(`<div cla
|
|
|
8772
9507
|
* 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.
|
|
8773
9508
|
*/
|
|
8774
9509
|
const $806c97b931758897$var$privately_shared_properties = /*@__PURE__*/new WeakMap();
|
|
9510
|
+
const $806c97b931758897$var$content_search_default = false;
|
|
8775
9511
|
const $806c97b931758897$var$min_products_to_fetch_ = 20;
|
|
8776
9512
|
const $806c97b931758897$export$bde3eb976dfded9 = depict_search => $806c97b931758897$var$privately_shared_properties.get(depict_search)?.search_query_updating_blocked_;
|
|
8777
9513
|
class $806c97b931758897$export$ac6237957a15b3f0 {
|
|
@@ -8779,6 +9515,7 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
|
|
|
8779
9515
|
#merchant_signal = (0, $9HbP8$createSignal)();
|
|
8780
9516
|
#market_signal = (0, $9HbP8$createSignal)();
|
|
8781
9517
|
#modal_open_signal = (0, $9HbP8$createSignal)(false);
|
|
9518
|
+
#content_search_signal = (0, $9HbP8$createSignal)();
|
|
8782
9519
|
static #keys_constructed_with = new Set();
|
|
8783
9520
|
#router = new (0, $4fd2ba03703a7d92$export$7e1297a3a19f10d8)("hard_navigation");
|
|
8784
9521
|
constructor({
|
|
@@ -8788,9 +9525,10 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
|
|
|
8788
9525
|
on_navigation: on_navigation,
|
|
8789
9526
|
enable_category_suggestions = true,
|
|
8790
9527
|
page_url_creator: page_url_creator,
|
|
9528
|
+
display_transformers: display_transformers,
|
|
9529
|
+
api: api,
|
|
8791
9530
|
// Stuff needed for non-standard customer deployments that we shouldn't actually expose
|
|
8792
9531
|
disable_scrolling_during_modal = true,
|
|
8793
|
-
api: api,
|
|
8794
9532
|
bottom_distance_under_modal: bottom_distance_under_modal,
|
|
8795
9533
|
render_instant_card: render_instant_card,
|
|
8796
9534
|
...props_on_class
|
|
@@ -8824,6 +9562,7 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
|
|
|
8824
9562
|
local_filter_cache: [],
|
|
8825
9563
|
expanded_hierarchical_filters: [],
|
|
8826
9564
|
showing_recommendation_rows: (0, $172e1b898d457050$export$1c8c715550dc689d),
|
|
9565
|
+
content_results_rows: (0, $49de9d31aeea1b5e$export$70ceae36059a1036),
|
|
8827
9566
|
scroll_restoration_data: []
|
|
8828
9567
|
}),
|
|
8829
9568
|
router_: this.#router,
|
|
@@ -8834,12 +9573,18 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
|
|
|
8834
9573
|
const get_search_query_ = (0, $9HbP8$createMemo)(previous_value => {
|
|
8835
9574
|
if (get_search_query_updating_blocked()) return previous_value;else return raw_search_query_accessor();
|
|
8836
9575
|
});
|
|
9576
|
+
// @ts-ignore
|
|
8837
9577
|
const depict_api_ = api ?? new (0, $7fa23e2a0079eca4$export$e015ed2f2950f2e3)({
|
|
8838
|
-
page_url_creator: page_url_creator
|
|
9578
|
+
page_url_creator: page_url_creator,
|
|
9579
|
+
display_transformers: display_transformers
|
|
8839
9580
|
});
|
|
8840
9581
|
const previous_searches = (0, $21f51c14cb3f586f$export$84bba84a7b837187)(get_search_query_);
|
|
8841
9582
|
const [, set_search_showing_recommendation_rows] = state_.showing_recommendation_rows;
|
|
8842
|
-
const
|
|
9583
|
+
const [, set_search_content_results_rows] = state_.content_results_rows;
|
|
9584
|
+
const after_submit_ = () => {
|
|
9585
|
+
set_search_showing_recommendation_rows((0, $172e1b898d457050$export$1c8c715550dc689d));
|
|
9586
|
+
set_search_content_results_rows((0, $49de9d31aeea1b5e$export$70ceae36059a1036));
|
|
9587
|
+
}; // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
|
|
8843
9588
|
const on_submit_with_unchanged_value_ = () => this.modal_open = false;
|
|
8844
9589
|
const [get_search_field_value_, set_search_field_value_] = state_.field_value;
|
|
8845
9590
|
const configured_submit_query_ = new_query => (0, $bfd908d13d90934c$export$e16630ecb9644a1c)({
|
|
@@ -8897,6 +9642,7 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
|
|
|
8897
9642
|
submit_query_: configured_submit_query_,
|
|
8898
9643
|
url_transformer_: url_transformer,
|
|
8899
9644
|
router_: this.#router,
|
|
9645
|
+
content_search_enabled_: () => this.#content_search_signal[0]() ?? $806c97b931758897$var$content_search_default,
|
|
8900
9646
|
instant_results_options_: {
|
|
8901
9647
|
min_products_to_fetch_: $806c97b931758897$var$min_products_to_fetch_,
|
|
8902
9648
|
render_instant_card_: render_instant_card,
|
|
@@ -8961,6 +9707,12 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
|
|
|
8961
9707
|
(0, $9HbP8$onCleanup)(() => $806c97b931758897$export$ac6237957a15b3f0.#keys_constructed_with.delete(unique_instance_key_for_state));
|
|
8962
9708
|
});
|
|
8963
9709
|
}
|
|
9710
|
+
get enable_content_search() {
|
|
9711
|
+
return this.#content_search_signal[0]();
|
|
9712
|
+
}
|
|
9713
|
+
set enable_content_search(new_state) {
|
|
9714
|
+
this.#content_search_signal[1](new_state);
|
|
9715
|
+
}
|
|
8964
9716
|
get on_navigation() {
|
|
8965
9717
|
// The only non-reactive public property on the class (I don't see it making sense to have it reactive)
|
|
8966
9718
|
return this.#router.on_navigation_;
|
|
@@ -9042,6 +9794,7 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
|
|
|
9042
9794
|
depict_api_: shared_properties.depict_api_,
|
|
9043
9795
|
min_products_to_fetch_: $806c97b931758897$var$min_products_to_fetch_,
|
|
9044
9796
|
local_filter_cache_: state_.local_filter_cache,
|
|
9797
|
+
content_search_enabled_: () => depict_search.enable_content_search ?? $806c97b931758897$var$content_search_default,
|
|
9045
9798
|
search_field_value_: state_.field_value,
|
|
9046
9799
|
get_search_query_: shared_properties.get_search_query_,
|
|
9047
9800
|
clear_filters_on_next_submit_: shared_properties.clear_filters_on_next_submit_,
|
|
@@ -9068,6 +9821,8 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
|
|
|
9068
9821
|
search_filters_open_: state_.filters_open,
|
|
9069
9822
|
search_sorting_open_: state_.sorting_open,
|
|
9070
9823
|
expanded_filters_: state_.expanded_filters,
|
|
9824
|
+
content_results_rows_: state_.content_results_rows,
|
|
9825
|
+
router_: shared_properties.router_,
|
|
9071
9826
|
make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
|
|
9072
9827
|
return (0, $897bd4a76f611b38$export$d757d54550ebfb3d)({
|
|
9073
9828
|
category_suggestion_: category_suggestion_,
|
|
@@ -9083,6 +9838,10 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
|
|
|
9083
9838
|
cols_at_size: (0, $b5cccc8ee7d24677$export$6daf8749b65a1b77)(props.cols_at_size),
|
|
9084
9839
|
...grid_spacing_override()
|
|
9085
9840
|
})),
|
|
9841
|
+
content_layout_options_: (0, $9HbP8$createMemo)(() => ({
|
|
9842
|
+
cols_at_size: (0, $b5cccc8ee7d24677$export$6daf8749b65a1b77)((0, $1848f7cca286fbab$export$ff7109b9b2b206ba)(props.cols_at_size)),
|
|
9843
|
+
...grid_spacing_override()
|
|
9844
|
+
})),
|
|
9086
9845
|
recommendations_layout_options_: (0, $9HbP8$createMemo)(() => {
|
|
9087
9846
|
const {
|
|
9088
9847
|
extra_depict_options: extra_depict_options
|