@depict-ai/ui 1.4.4 → 1.4.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,7 +54,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $a3280f0aad997933$expo
54
54
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $a3280f0aad997933$export$7bf543b9d9be2c22);
55
55
  $parcel$export(module.exports, "version", () => $b757f75811f3261f$export$83d89fbfd8236492);
56
56
  /*! Depict.ai search and product listing SDK */
57
- const $b757f75811f3261f$export$83d89fbfd8236492 = "1.4.4";
57
+ const $b757f75811f3261f$export$83d89fbfd8236492 = "1.4.5";
58
58
  function $4b455f60dadde8b8$export$5bad61ecde080b1f(...params) {
59
59
  const {
60
60
  collapse: collapse,
@@ -414,7 +414,7 @@ function $235a2771a44e28e9$export$fecbb157621501bd({
414
414
  return outmost_element;
415
415
  }
416
416
  const $b3cf6ca8dc0e9998$var$_tmpl$ = ["<span", ' class="count">', "</span>"],
417
- $b3cf6ca8dc0e9998$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", '><span class="custom-indicator"></span><span class="text">', "</span></div><!--#-->", "<!--/--></label>"];
417
+ $b3cf6ca8dc0e9998$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", '><span class="custom-indicator"></span><span class="text line-clamp">', "</span></div><!--#-->", "<!--/--></label>"];
418
418
  const $b3cf6ca8dc0e9998$export$48513f6b9f8ce62d = props => {
419
419
  // 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
420
420
  const count = (0, $5vyXB$solidjs.createMemo)(() => props.count_);
@@ -1905,9 +1905,14 @@ function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
1905
1905
  // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
1906
1906
  const show_all_rows = (0, $5vyXB$solidjs.createMemo)(() => props.rows === "all");
1907
1907
  const rows_or_empty_object = (0, $5vyXB$solidjs.createMemo)(() => show_all_rows() ? {} : props.rows);
1908
- const button_elements = (0, $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52)((0, $5vyXB$solidjs.createMemo)(() => rows_or_empty_object().button));
1909
- const have_a_button = (0, $5vyXB$solidjs.createMemo)(() => {
1910
- const button = button_elements();
1908
+ const view_more_button_elements = (0, $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52)((0, $5vyXB$solidjs.createMemo)(() => rows_or_empty_object().button));
1909
+ const view_less_button_elements = (0, $5f7d55c710fd1bc2$export$2f0cbfbb4354bb52)((0, $5vyXB$solidjs.createMemo)(() => rows_or_empty_object().view_less_button));
1910
+ const have_a_view_more_button = (0, $5vyXB$solidjs.createMemo)(() => {
1911
+ const button = view_more_button_elements();
1912
+ return !(!button || Array.isArray(button) && !button.length);
1913
+ });
1914
+ const have_a_view_less_button = (0, $5vyXB$solidjs.createMemo)(() => {
1915
+ const button = view_less_button_elements();
1911
1916
  return !(!button || Array.isArray(button) && !button.length);
1912
1917
  });
1913
1918
  const [get_styling, set_styling] = (0, $5vyXB$solidjs.createSignal)();
@@ -1916,12 +1921,15 @@ function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
1916
1921
  const [get_children_count, set_children_count] = (0, $5vyXB$solidjs.createSignal)(0);
1917
1922
  const update_children_count = () => set_children_count(container_element.children.length);
1918
1923
  const col_styling = (0, $5vyXB$solidjs.createMemo)(() => (0, $5vyXB$depictaiutilishared.n_col_styling_with_dist)(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
1919
- const default_currently_visible_signal = (0, $5vyXB$solidjs.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
1924
+ const default_currently_visible_signal = (0, $5vyXB$solidjs.createSignal)((0, $5vyXB$solidjs.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
1920
1925
  const rows_visible_signal = (0, $5vyXB$solidjs.createMemo)(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
1921
1926
  const get_rows_visible = (0, $5vyXB$solidjs.createMemo)(() => rows_visible_signal()[0]());
1922
1927
  const set_rows_visible = (0, $5vyXB$solidjs.createMemo)(() => rows_visible_signal()[1]);
1923
- const button_class = (0, $5vyXB$depictaiutilishared.make_random_classname)();
1924
- const button_container = (0, $5vyXB$solidjs.createMemo)(() => have_a_button() && (0, $5vyXB$solidjsweb.ssr)($f48d0fbb00835aaa$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), "load-more-container " + (0, $5vyXB$solidjsweb.escape)(button_class, true), (0, $5vyXB$solidjsweb.escape)(rows_or_empty_object().button)));
1928
+ const view_more_button_class = (0, $5vyXB$depictaiutilishared.make_random_classname)();
1929
+ const view_less_button_class = (0, $5vyXB$depictaiutilishared.make_random_classname)();
1930
+ const view_more_button_container = (0, $5vyXB$solidjs.createMemo)(() => have_a_view_more_button() && (0, $5vyXB$solidjsweb.ssr)($f48d0fbb00835aaa$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `load-more-container ${(0, $5vyXB$solidjsweb.escape)(view_more_button_class, true)}`, (0, $5vyXB$solidjsweb.escape)(rows_or_empty_object().button)));
1931
+ // 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
1932
+ const view_less_button_container = (0, $5vyXB$solidjs.createMemo)(() => have_a_view_less_button() && (0, $5vyXB$solidjsweb.ssr)($f48d0fbb00835aaa$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `load-less-container ${(0, $5vyXB$solidjsweb.escape)(view_less_button_class, true)}`, (0, $5vyXB$solidjsweb.escape)(rows_or_empty_object().view_less_button)));
1925
1933
  container_element.classList.add(container_class);
1926
1934
  (0, $5vyXB$solidjs.createComputed)(() => {
1927
1935
  // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
@@ -1936,7 +1944,6 @@ function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
1936
1944
  set_styling(() => col_styling);
1937
1945
  return;
1938
1946
  }
1939
- (0, $5vyXB$solidjs.untrack)(() => set_rows_visible()(rows_or_empty_object().start_rows ?? 1));
1940
1947
  update_children_count();
1941
1948
  const mutation_observer = new MutationObserver((0, $5vyXB$depictaiutilishared.catchify)(update_children_count));
1942
1949
  mutation_observer.observe(container_element, {
@@ -1948,30 +1955,33 @@ function $f48d0fbb00835aaa$var$ActualSolidLayout(props, container_element) {
1948
1955
  () => (0, $5vyXB$solidjs.createMemo)(() => {
1949
1956
  const {
1950
1957
  rows_per_click: rows_per_click,
1951
- max_rows = -1
1958
+ max_rows = -1,
1959
+ start_rows: start_rows
1952
1960
  } = rows_or_empty_object();
1953
1961
  const rows_visible = get_rows_visible();
1954
1962
  const children_count = get_children_count();
1955
1963
  return col_styling() + props.cols_at_size.map(options => {
1956
- const [, min, max] = options;
1957
- let should_hide_button;
1964
+ const [recs_per_row, min, max] = options;
1965
+ let should_hide_view_more_button;
1958
1966
  let visible_recs;
1959
1967
  if (props.disable_partial_rows) {
1960
1968
  visible_recs = (0, $5vyXB$depictaiutilishared.layout_get_visible_recs_without_partial_rows)(rows_visible, children_count, options);
1961
1969
  const visible_recs_next_show_more = (0, $5vyXB$depictaiutilishared.layout_get_visible_recs_without_partial_rows)(rows_visible + (rows_per_click || 0),
1962
1970
  // Should this really be zero when we default rows_per_click to 1?
1963
1971
  children_count, options);
1964
- should_hide_button = visible_recs === visible_recs_next_show_more;
1972
+ should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
1965
1973
  } else {
1966
1974
  visible_recs = (0, $5vyXB$depictaiutilishared.layout_get_total_rec_amount_for_row)(rows_visible, options);
1967
- should_hide_button = visible_recs >= children_count;
1975
+ should_hide_view_more_button = visible_recs >= children_count;
1968
1976
  }
1969
- const should_hide_button_final = button_class && (should_hide_button || max_rows !== -1 && rows_visible >= max_rows);
1970
- return `${(0, $5vyXB$depictaiutilishared.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 .${button_class}{display:none!important}` : ``}}`;
1977
+ const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
1978
+ // 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
1979
+ 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;
1980
+ return `${(0, $5vyXB$depictaiutilishared.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}` : ``}}`;
1971
1981
  }).join("");
1972
1982
  }));
1973
1983
  });
1974
- return [container_element, button_container(), (0, $5vyXB$solidjsweb.ssr)($f48d0fbb00835aaa$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), get_styling)];
1984
+ return [container_element, view_more_button_container(), view_less_button_container(), (0, $5vyXB$solidjsweb.ssr)($f48d0fbb00835aaa$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), get_styling)];
1975
1985
  }
1976
1986
  async function $9abb0a35d4b60ed3$export$79b1565500412d9b(search_modal, modal_fn_opts) {
1977
1987
  const body = await (0, $5vyXB$depictaiutilishared.observer).wait_for_element("body");
@@ -2163,14 +2173,18 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
2163
2173
  }
2164
2174
  }
2165
2175
  async #run_url_creator_for_suggest(merchant, market, response) {
2166
- if (!this.page_url_creator) return response;
2176
+ const page_url_creator = this.page_url_creator;
2177
+ const category_transformer = this.display_transformers?.categories;
2178
+ if (!page_url_creator && !category_transformer) return response;
2167
2179
  // find category suggestions, run thing with them, and then replace them
2168
2180
  const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "category");
2169
- const page_urls = await this.page_url_creator({
2170
- type: "categories",
2181
+ const page_urls = await (page_url_creator || category_transformer)({
2171
2182
  market: market,
2172
2183
  merchant: merchant,
2173
- data: [...category_suggestions]
2184
+ data: [...category_suggestions],
2185
+ ...(page_url_creator ? {
2186
+ type: "categories"
2187
+ } : {})
2174
2188
  });
2175
2189
  this.#guard_url_creator_length(category_suggestions, page_urls);
2176
2190
  while (page_urls.length)
@@ -2178,17 +2192,29 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
2178
2192
  Object.defineProperties(category_suggestions.pop(), Object.getOwnPropertyDescriptors(page_urls.pop()));
2179
2193
  return response;
2180
2194
  }
2181
- async #run_url_creator_for_rest(merchant, market, input_data) {
2182
- if (!this.page_url_creator) return input_data;
2195
+ async #run_display_transformers_for_rest(merchant, market, input_data) {
2196
+ const {
2197
+ page_url_creator: page_url_creator,
2198
+ display_transformers: display_transformers
2199
+ } = this;
2200
+ if (!page_url_creator && !display_transformers) return input_data;
2201
+ const product_transformer = display_transformers?.products;
2202
+ const category_transformer = display_transformers?.categories;
2203
+ const content_result_transformer = display_transformers?.contentResults;
2183
2204
  const displays = input_data.displays;
2184
- const breadcrumb = input_data.breadcrumb;
2185
- const quick_links = input_data.quick_links;
2186
- if (displays) {
2187
- const page_urls = await this.page_url_creator({
2188
- type: "products",
2205
+ const {
2206
+ breadcrumb: breadcrumb,
2207
+ quick_links: quick_links,
2208
+ content_search_links: content_search_links
2209
+ } = input_data;
2210
+ if (displays && (page_url_creator || product_transformer)) {
2211
+ const page_urls = await (page_url_creator || product_transformer)({
2189
2212
  merchant: merchant,
2190
2213
  market: market,
2191
- displays: [...input_data.displays]
2214
+ displays: [...input_data.displays],
2215
+ ...(page_url_creator ? {
2216
+ type: "products"
2217
+ } : {})
2192
2218
  });
2193
2219
  this.#guard_url_creator_length(displays, page_urls);
2194
2220
  for (let i = 0; i < displays.length; i++) {
@@ -2206,19 +2232,30 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
2206
2232
  displays[i] = new_display_or_page_url;
2207
2233
  }
2208
2234
  }
2209
- for (const category_display_array of [breadcrumb, quick_links]) {
2235
+ if (page_url_creator || category_transformer) for (const category_display_array of [breadcrumb, quick_links]) {
2210
2236
  if (!category_display_array) continue;
2211
- const page_urls = await this.page_url_creator({
2212
- type: "categories",
2237
+ const page_urls = await (page_url_creator || category_transformer)({
2213
2238
  merchant: merchant,
2214
2239
  market: market,
2215
- data: [...category_display_array]
2240
+ data: [...category_display_array],
2241
+ ...(page_url_creator ? {
2242
+ type: "categories"
2243
+ } : {})
2216
2244
  });
2217
2245
  this.#guard_url_creator_length(category_display_array, page_urls);
2218
2246
  for (let i = 0; i < category_display_array.length; i++)
2219
2247
  // Copy over getters so we sneakily can make this reactive
2220
2248
  Object.defineProperties(category_display_array[i], Object.getOwnPropertyDescriptors(page_urls[i]));
2221
2249
  }
2250
+ if (content_search_links?.length && content_result_transformer) {
2251
+ const result = await content_result_transformer({
2252
+ merchant: merchant,
2253
+ market: market,
2254
+ data: [...content_search_links]
2255
+ });
2256
+ this.#guard_url_creator_length(content_search_links, result);
2257
+ input_data.content_search_links = result;
2258
+ }
2222
2259
  return input_data;
2223
2260
  }
2224
2261
  async #cached_post_request(endpoint, input_req, fallback_response) {
@@ -2245,7 +2282,7 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
2245
2282
  let result;
2246
2283
  try {
2247
2284
  const unmodified_result = await api_response.json();
2248
- result = await this.#run_url_creator_for_rest(input_req.tenant, input_req.market, unmodified_result);
2285
+ result = await this.#run_display_transformers_for_rest(input_req.tenant, input_req.market, unmodified_result);
2249
2286
  } catch (e) {
2250
2287
  (0, $5vyXB$depictaiutilishared.dwarn)("URL creator or json decoding failed", e);
2251
2288
  break return_successfully;
@@ -2277,12 +2314,14 @@ class $e1d6c0f3d89d531c$export$e015ed2f2950f2e3 {
2277
2314
  get_metadata: get_metadata,
2278
2315
  get_user_id: get_user_id,
2279
2316
  get_session_id: get_session_id,
2280
- page_url_creator: page_url_creator
2317
+ page_url_creator: page_url_creator,
2318
+ display_transformers: display_transformers
2281
2319
  } = options ?? {};
2282
2320
  this.#get_metadata = get_metadata;
2283
2321
  this.#get_user_id = get_user_id;
2284
2322
  this.#get_session_id = get_session_id;
2285
2323
  this.page_url_creator = page_url_creator;
2324
+ this.display_transformers = display_transformers;
2286
2325
  }
2287
2326
  async suggest(input_req) {
2288
2327
  const with_ids = this.#add_ids_to_request(input_req);
@@ -2392,11 +2431,11 @@ function $6b384adf40a5f4d7$var$correct_range_filter_range_once({
2392
2431
  }
2393
2432
  }
2394
2433
  function $0f400c3f7248d5f1$export$92f2da32c6e7e7ee({
2395
- search_results_: search_results_,
2434
+ number_: number_,
2396
2435
  i18n_: i18n_
2397
2436
  }) {
2398
2437
  return (0, $5vyXB$solidjs.createMemo)(() => {
2399
- const n_hits = search_results_()?.n_hits;
2438
+ const n_hits = number_();
2400
2439
  if (isNaN(n_hits)) return "";
2401
2440
  const price_formatting = i18n_.price_formatting_();
2402
2441
  return (0, $5vyXB$depictaiutilishared.standard_price_format)(n_hits, 0,
@@ -4485,7 +4524,7 @@ function $840d88a04b2d22a7$export$f7d2f673fc2f091d({
4485
4524
  const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $5vyXB$solidjs.createSignal)(false);
4486
4525
  const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $5vyXB$solidjs.createSignal)();
4487
4526
  const formatted_number_of_results_ = (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
4488
- search_results_: plp_results_,
4527
+ number_: (0, $5vyXB$solidjs.createMemo)(() => plp_results_()?.n_hits),
4489
4528
  i18n_: i18n_
4490
4529
  });
4491
4530
  const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $5vyXB$solidjs.createSignal)();
@@ -5017,7 +5056,6 @@ class $e96dd13889871fc0$export$7e1297a3a19f10d8 {
5017
5056
  }
5018
5057
  const $48567ac5b39bac56$var$_tmpl$ = ["<div", ' class="depict plp category">', "</div>"];
5019
5058
  // 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
5020
- // on old displays, no page_url_creator can be specified
5021
5059
  /**
5022
5060
  * Type for the private properties that are shared between the different exported search SDK wrapper functions.
5023
5061
  * SDK users are not allowed to change/access these, they're an internal implementation detail.
@@ -5077,6 +5115,7 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
5077
5115
  api: api,
5078
5116
  on_navigation: on_navigation,
5079
5117
  page_url_creator: page_url_creator,
5118
+ display_transformers: display_transformers,
5080
5119
  unique_instance_key_for_state = "",
5081
5120
  query_id_state_key: query_id_state_key,
5082
5121
  ...props_on_class
@@ -5121,8 +5160,10 @@ class $48567ac5b39bac56$export$f34314aa9505732e {
5121
5160
  quicklinks_signal_: (0, $5vyXB$solidjs.createSignal)(),
5122
5161
  i18n_: i18n_,
5123
5162
  reset_history_state_: reset_history_state_,
5163
+ // @ts-ignore
5124
5164
  depict_api_: api ?? new (0, $e1d6c0f3d89d531c$export$e015ed2f2950f2e3)({
5125
- page_url_creator: page_url_creator
5165
+ page_url_creator: page_url_creator,
5166
+ display_transformers: display_transformers
5126
5167
  }),
5127
5168
  router_: this.#router,
5128
5169
  selected_filters_: selected_filters_,
@@ -5581,11 +5622,11 @@ function $fb29c6201c369e39$export$7de92c4c2205ebf3({
5581
5622
  });
5582
5623
  }
5583
5624
  function $fb29c6201c369e39$var$make_state_saved_rows([get_showing_recommendation_rows, set_showing_recommendation_rows], i18n_) {
5584
- const currently_visible = (0, $5vyXB$solidjs.createSignal)(0); // this number shouldn't matter for anything except typing
5625
+ const currently_visible = (0, $5vyXB$solidjs.createSignal)((0, $5vyXB$solidjs.untrack)(get_showing_recommendation_rows));
5585
5626
  const [get_currently_visible, set_currently_visible] = currently_visible;
5586
5627
  const rows = {
5587
5628
  currently_visible: currently_visible,
5588
- start_rows: (0, $5vyXB$solidjs.untrack)(get_showing_recommendation_rows) ?? $fb29c6201c369e39$export$1c8c715550dc689d,
5629
+ start_rows: $fb29c6201c369e39$export$1c8c715550dc689d,
5589
5630
  rows_per_click: 3,
5590
5631
  button: (0, $5vyXB$solidjsweb.ssr)($fb29c6201c369e39$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(i18n_.view_more_()))
5591
5632
  };
@@ -5747,7 +5788,7 @@ const $639c124c22b6cbaa$export$27b710c08412a7ad = obj => {
5747
5788
  return Object.fromEntries(Object.keys(obj).map(key => [key, obj[key]()]));
5748
5789
  };
5749
5790
  const $6ae613870d3380fc$var$_tmpl$ = ["<span", ' class="orig price"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span>"],
5750
- $6ae613870d3380fc$var$_tmpl$2 = ["<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="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span></div></div></a>"],
5791
+ $6ae613870d3380fc$var$_tmpl$2 = ["<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="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span></div></div></a>"],
5751
5792
  $6ae613870d3380fc$var$_tmpl$3 = ["<div", ' class="tagline">', "</div>"];
5752
5793
  const $6ae613870d3380fc$export$b05c0ae390cf3e06 = (display_or_variant_container, {
5753
5794
  i18n: i18n
@@ -5816,9 +5857,11 @@ function $6ae556e536054e87$export$62f101a8aa597bf8({
5816
5857
  render_instant_card_placeholder_: render_instant_card_placeholder_,
5817
5858
  min_products_to_fetch_: min_products_to_fetch_,
5818
5859
  has_sort_or_filters_: has_sort_or_filters_,
5819
- set_num_results_accessor_: set_num_results_accessor_,
5860
+ set_total_num_results_accessor_: set_total_num_results_accessor_,
5820
5861
  i18n_: i18n_,
5821
- router_: router_
5862
+ router_: router_,
5863
+ set_modal_search_results_: set_modal_search_results_,
5864
+ content_search_enabled_: content_search_enabled_
5822
5865
  }) {
5823
5866
  const max_cards = 4;
5824
5867
  const [read_current_instant_query, write_current_instant_query] = (0, $5vyXB$solidjs.createSignal)("");
@@ -5843,8 +5886,17 @@ function $6ae556e536054e87$export$62f101a8aa597bf8({
5843
5886
  ...variable_data
5844
5887
  });
5845
5888
  }));
5846
- set_num_results_accessor_(() => (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
5847
- search_results_: search_results,
5889
+ // 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
5890
+ // This is for the press-enter-to-instant-content-result feature which gets called from Autocomplete.tsx
5891
+ set_modal_search_results_(() => search_results);
5892
+ (0, $5vyXB$solidjs.onCleanup)(() => set_modal_search_results_(undefined)); // for consistency, in case this component crashes
5893
+ set_total_num_results_accessor_(() => (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
5894
+ number_: (0, $5vyXB$solidjs.createMemo)(() => {
5895
+ const hits = search_results()?.n_hits;
5896
+ const content_results = search_results()?.content_search_links?.length;
5897
+ if (!content_results || !content_search_enabled_()) return hits;
5898
+ return (hits ?? 0) + content_results;
5899
+ }),
5848
5900
  i18n_: i18n_
5849
5901
  }));
5850
5902
  const sliced_displays = (0, $5vyXB$solidjs.createMemo)(() => search_results()?.displays?.slice(0, max_cards));
@@ -5909,7 +5961,7 @@ function $9e30168c4b1661d2$export$5d2caaa6b530761c() {
5909
5961
  return (0, $5vyXB$solidjsweb.ssr)($9e30168c4b1661d2$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)());
5910
5962
  }
5911
5963
  const $9a268bf73b31a717$var$_tmpl$ = ["<div", ' class="previous-searches"><h2 class="text">', '</h2><div class="list">', "</div></div>"],
5912
- $9a268bf73b31a717$var$_tmpl$2 = ["<a", ' class="', '"', '><div class="left"><!--#-->', "<!--/--><span>", '</span></div><button class="delete"', ">", "</button></a>"];
5964
+ $9a268bf73b31a717$var$_tmpl$2 = ["<a", ' class="', '"', '><div class="left"><!--#-->', '<!--/--><span class="line-clamp"', ">", '</span></div><button class="delete"', ">", "</button></a>"];
5913
5965
  function $9a268bf73b31a717$export$a146ac6fa8346a25({
5914
5966
  text_: text_,
5915
5967
  previous_searches_: previous_searches_,
@@ -5949,14 +6001,14 @@ function $9a268bf73b31a717$export$a146ac6fa8346a25({
5949
6001
  value_: item,
5950
6002
  url_transformer_: url_transformer_
5951
6003
  });
5952
- return (0, $5vyXB$solidjsweb.ssr)($9a268bf73b31a717$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `${`item` || ""} ${(0, $5vyXB$solidjs.createMemo)(() => read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)() ? "selected" : ""}`, (0, $5vyXB$solidjsweb.ssrAttribute)("href", (0, $5vyXB$solidjsweb.escape)(href(), true), false), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $9e30168c4b1661d2$export$5d2caaa6b530761c), {})), (0, $5vyXB$solidjsweb.escape)(item()), (0, $5vyXB$solidjsweb.ssrAttribute)("title", (0, $5vyXB$solidjsweb.escape)(i18n_.previous_searches_delete_entry_from_history_(), true), false), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $c77c68e559a1506c$export$3b621d86b1566b2), {})));
6004
+ return (0, $5vyXB$solidjsweb.ssr)($9a268bf73b31a717$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `${`item` || ""} ${(0, $5vyXB$solidjs.createMemo)(() => read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)() ? "selected" : ""}`, (0, $5vyXB$solidjsweb.ssrAttribute)("href", (0, $5vyXB$solidjsweb.escape)(href(), true), false), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $9e30168c4b1661d2$export$5d2caaa6b530761c), {})), (0, $5vyXB$solidjsweb.ssrAttribute)("title", (0, $5vyXB$solidjsweb.escape)(item(), true), false), (0, $5vyXB$solidjsweb.escape)(item()), (0, $5vyXB$solidjsweb.ssrAttribute)("title", (0, $5vyXB$solidjsweb.escape)(i18n_.previous_searches_delete_entry_from_history_(), true), false), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $c77c68e559a1506c$export$3b621d86b1566b2), {})));
5953
6005
  }
5954
6006
  })));
5955
6007
  }
5956
6008
  });
5957
6009
  }
5958
6010
  const $d023ed916c84e75d$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"],
5959
- $d023ed916c84e75d$var$_tmpl$2 = ["<span", ' class="', '">', "</span>"];
6011
+ $d023ed916c84e75d$var$_tmpl$2 = ["<span", ' class="', '"', ">", "</span>"];
5960
6012
  function $d023ed916c84e75d$export$ba17c5b7e6dda39f({
5961
6013
  whole_text_to_display_: whole_text_to_display_memo,
5962
6014
  searching_for_value_: searching_for_value_memo,
@@ -6006,16 +6058,27 @@ function $d023ed916c84e75d$export$ba17c5b7e6dda39f({
6006
6058
  }
6007
6059
  return output;
6008
6060
  }));
6009
- return (0, $5vyXB$solidjsweb.ssr)($d023ed916c84e75d$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `${(0, $5vyXB$solidjsweb.escape)(class_, true) || ""} ${get_has_highlighted() ? "has-history-match" : ""}`, (0, $5vyXB$solidjsweb.escape)(text_itself()));
6061
+ return (0, $5vyXB$solidjsweb.ssr)($d023ed916c84e75d$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `${(0, $5vyXB$solidjsweb.escape)(class_, true) || ""} ${get_has_highlighted() ? "has-history-match" : ""}`, (0, $5vyXB$solidjsweb.ssrAttribute)("title", (0, $5vyXB$solidjsweb.escape)(whole_text_to_display_memo(), true), false), (0, $5vyXB$solidjsweb.escape)(text_itself()));
6062
+ }
6063
+ const $c0125412b4ea0c93$var$_tmpl$ = '<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>';
6064
+ function $c0125412b4ea0c93$export$605674723bcc715c(props = {}) {
6065
+ return (0, $5vyXB$solidjsweb.ssrElement)("svg", () => ({
6066
+ "xmlns": "http://www.w3.org/2000/svg",
6067
+ "width": "32",
6068
+ "height": "32",
6069
+ "viewBox": "0 0 256 256",
6070
+ ...props
6071
+ }), () => (0, $5vyXB$solidjsweb.ssr)($c0125412b4ea0c93$var$_tmpl$), true);
6010
6072
  }
6011
6073
  const $6b65ba8af12c5a26$var$_tmpl$ = ["<a", ' class="', '"', ">", "</a>"],
6012
6074
  $6b65ba8af12c5a26$var$_tmpl$2 = ["<div", ' class="search-icon">', "</div>"],
6013
6075
  $6b65ba8af12c5a26$var$_tmpl$3 = ["<span", ' class="type">', "</span>"],
6014
6076
  $6b65ba8af12c5a26$var$_tmpl$4 = ["<div", "><!--#-->", '<!--/--><span class="value">', "</span></div>"],
6015
- $6b65ba8af12c5a26$var$_tmpl$5 = ["<h2", ' class="text">', "</h2>"],
6016
- $6b65ba8af12c5a26$var$_tmpl$6 = ["<div", ' class="suggestion-container query"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
6017
- $6b65ba8af12c5a26$var$_tmpl$7 = ["<div", ' class="suggestion-container page">', "</div>"],
6018
- $6b65ba8af12c5a26$var$_tmpl$8 = ["<div", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
6077
+ $6b65ba8af12c5a26$var$_tmpl$5 = ["<div", ' class="with-icon"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
6078
+ $6b65ba8af12c5a26$var$_tmpl$6 = ["<h2", ' class="text">', "</h2>"],
6079
+ $6b65ba8af12c5a26$var$_tmpl$7 = ["<div", ' class="suggestion-container query"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
6080
+ $6b65ba8af12c5a26$var$_tmpl$8 = ["<div", ' class="suggestion-container page">', "</div>"],
6081
+ $6b65ba8af12c5a26$var$_tmpl$9 = ["<div", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
6019
6082
  function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
6020
6083
  suggestion_memo_: suggestion_memo_,
6021
6084
  search_query_url_param_name_: search_query_url_param_name_,
@@ -6028,7 +6091,8 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
6028
6091
  include_category_suggestions_: include_category_suggestions_,
6029
6092
  searching_for_value_: searching_for_value_,
6030
6093
  router_: router_,
6031
- submit_query_: submit_query_
6094
+ submit_query_: submit_query_,
6095
+ get_content_results_: get_content_results_
6032
6096
  }) {
6033
6097
  const queries_memo = (0, $5vyXB$solidjs.createMemo)(() => suggestion_memo_().filter(({
6034
6098
  type: type,
@@ -6036,9 +6100,15 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
6036
6100
  }) => type === (0, $3ec9e21d6b6debdd$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title) // don't show the ones we already show from the history
6037
6101
  ));
6038
6102
 
6039
- const not_queries_memo = (0, $5vyXB$solidjs.createMemo)(() => suggestion_memo_().filter(({
6040
- type: type
6041
- }) => type !== (0, $3ec9e21d6b6debdd$export$3cf9497e790da491)));
6103
+ const not_queries_memo = (0, $5vyXB$solidjs.createMemo)(() => {
6104
+ // For the section that shows categories and content results
6105
+ // We want to limit to 3 items, and we want to show the categories first
6106
+ const content_results = get_content_results_() || [];
6107
+ const from_suggest_request = include_category_suggestions_ ? suggestion_memo_().filter(({
6108
+ type: type
6109
+ }) => type !== (0, $3ec9e21d6b6debdd$export$3cf9497e790da491)) : [];
6110
+ return [...from_suggest_request.slice(0, content_results.length ? 2 : 3), ...content_results.slice(0, 1)];
6111
+ });
6042
6112
  const render_entry = (input_obj, autocomplete_data_index, index, is_history = false) => {
6043
6113
  const is_query = (0, $5vyXB$solidjs.createMemo)(() => input_obj().type === (0, $3ec9e21d6b6debdd$export$3cf9497e790da491));
6044
6114
  const href_with_changed_params_accessor = (0, $5vyXB$solidjs.createMemo)(() => is_query() ? (0, $496cde876b53ce1e$export$91c3b6774e8be0f5)({
@@ -6047,7 +6117,8 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
6047
6117
  url_transformer_: url_transformer_
6048
6118
  }) : undefined);
6049
6119
  const href = (0, $5vyXB$solidjs.createMemo)(() => is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
6050
- return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `suggestion ${(0, $5vyXB$solidjs.createMemo)(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index)() ? "selected" : ""} ${is_history ? "history" : ""} ${(0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.escape)("type-" + input_obj().type, true), true)}`, (0, $5vyXB$solidjsweb.ssrAttribute)("href", (0, $5vyXB$solidjsweb.escape)(href(), true), false), is_query() ? (0, $5vyXB$solidjsweb.escape)([(0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
6120
+ const is_selected = (0, $5vyXB$solidjs.createMemo)(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index);
6121
+ return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `suggestion ${is_selected() ? "selected" : ""} ${is_history ? "history" : ""} ${(0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.escape)("type-" + input_obj().type, true), true)}`, (0, $5vyXB$solidjsweb.ssrAttribute)("href", (0, $5vyXB$solidjsweb.escape)(href(), true), false), is_query() ? (0, $5vyXB$solidjsweb.escape)([(0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
6051
6122
  when: is_history,
6052
6123
  get fallback() {
6053
6124
  return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $87d7574e1d89d69b$export$82eafebb825fc23f), {})));
@@ -6056,24 +6127,34 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
6056
6127
  return (0, $5vyXB$solidjsweb.createComponent)((0, $9e30168c4b1661d2$export$5d2caaa6b530761c), {});
6057
6128
  }
6058
6129
  }), (0, $5vyXB$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
6059
- class_: "value",
6130
+ class_: "value line-clamp",
6131
+ get whole_text_to_display_() {
6132
+ return (0, $5vyXB$solidjs.createMemo)(() => input_obj().title);
6133
+ },
6134
+ searching_for_value_: searching_for_value_
6135
+ })]) : (0, $5vyXB$solidjsweb.escape)([typeof input_obj() /* this is a harmless lie */.parent_title === "string" ? (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$4, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
6136
+ class_: "category line-clamp",
6060
6137
  get whole_text_to_display_() {
6061
6138
  return (0, $5vyXB$solidjs.createMemo)(() => input_obj().title);
6062
6139
  },
6063
6140
  searching_for_value_: searching_for_value_
6064
- })]) : (0, $5vyXB$solidjsweb.escape)([typeof input_obj().parent_title === "string" ? (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$4, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
6065
- class_: "category",
6141
+ })), (0, $5vyXB$solidjsweb.escape)(input_obj().parent_title)) : input_obj().type === "content" ? (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$5, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $c0125412b4ea0c93$export$605674723bcc715c), {
6142
+ width: "16",
6143
+ height: "16"
6144
+ })), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
6145
+ class_: "content line-clamp",
6066
6146
  get whole_text_to_display_() {
6067
6147
  return (0, $5vyXB$solidjs.createMemo)(() => input_obj().title);
6068
6148
  },
6069
6149
  searching_for_value_: searching_for_value_
6070
- })), (0, $5vyXB$solidjsweb.escape)(input_obj().parent_title)) : (0, $5vyXB$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
6071
- class_: "category",
6150
+ }))) : (0, $5vyXB$solidjsweb.createComponent)((0, $d023ed916c84e75d$export$ba17c5b7e6dda39f), {
6151
+ class_: "category line-clamp",
6072
6152
  get whole_text_to_display_() {
6073
6153
  return (0, $5vyXB$solidjs.createMemo)(() => input_obj().title);
6074
6154
  },
6075
6155
  searching_for_value_: searching_for_value_
6076
6156
  }), (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$3, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjs.createMemo)(() => {
6157
+ if (input_obj().type === "content") return i18n_.content_();
6077
6158
  if (input_obj().category_type === "BRAND") return i18n_.brand_();
6078
6159
  return i18n_.category_();
6079
6160
  })()))]));
@@ -6089,26 +6170,26 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
6089
6170
  }));
6090
6171
  };
6091
6172
  const should_show_previous_searches_in_query_part = (0, $5vyXB$solidjs.createMemo)(() => !on_previous_searches_page_());
6092
- const should_show_at_all = (0, $5vyXB$solidjs.createMemo)(() => suggestion_memo_()?.length || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length);
6173
+ const should_show_at_all = (0, $5vyXB$solidjs.createMemo)(() => suggestion_memo_()?.length || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length || get_content_results_()?.length);
6093
6174
  const should_show_query_part = (0, $5vyXB$solidjs.createMemo)(() => queries_memo().length || filtered_previous_searches_().length);
6094
6175
  return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
6095
6176
  get when() {
6096
6177
  return should_show_at_all();
6097
6178
  },
6098
6179
  get children() {
6099
- return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$8, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `suggestions ${on_previous_searches_page_() ? "compact" : ""}`, (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
6180
+ return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$9, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `suggestions ${on_previous_searches_page_() ? "compact" : ""}`, (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
6100
6181
  get when() {
6101
6182
  return on_previous_searches_page_();
6102
6183
  },
6103
6184
  get children() {
6104
- return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$5, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(i18n_.suggestions_()));
6185
+ return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$6, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(i18n_.suggestions_()));
6105
6186
  }
6106
6187
  })), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
6107
6188
  get when() {
6108
6189
  return should_show_query_part();
6109
6190
  },
6110
6191
  get children() {
6111
- return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$6, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
6192
+ return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$7, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
6112
6193
  get when() {
6113
6194
  return should_show_previous_searches_in_query_part();
6114
6195
  },
@@ -6144,11 +6225,11 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
6144
6225
  }
6145
6226
  })), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
6146
6227
  get when() {
6147
- return not_queries_memo().length && include_category_suggestions_;
6228
+ return not_queries_memo().length;
6148
6229
  },
6149
6230
  keyed: false,
6150
6231
  get children() {
6151
- return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$7, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (() => {
6232
+ return (0, $5vyXB$solidjsweb.ssr)($6b65ba8af12c5a26$var$_tmpl$8, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (() => {
6152
6233
  const index_in_autocomplete = 3;
6153
6234
  set_list_until_cleanup(not_queries_memo, index_in_autocomplete);
6154
6235
  return (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Index), {
@@ -6163,7 +6244,18 @@ function $6b65ba8af12c5a26$export$e872e2339fb04a7f({
6163
6244
  }
6164
6245
  });
6165
6246
  }
6166
- const $6a374b16bfe947d0$var$_tmpl$ = ["<a", ' target="_blank"></a>'];
6247
+ const $b8700779b3e745de$var$_tmpl$ = ["<a", ' target="_blank"></a>'];
6248
+ function $b8700779b3e745de$export$1efe1013da60d0e4(e, href) {
6249
+ if (e.metaKey || e.ctrlKey) {
6250
+ // Open link in a new tab with cmd/ctrl + enter.
6251
+ const link = (0, $5vyXB$solidjsweb.ssr)($b8700779b3e745de$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)() + (0, $5vyXB$solidjsweb.ssrAttribute)("href", (0, $5vyXB$solidjsweb.escape)(href, true), false));
6252
+ document.body.append(link);
6253
+ link.click();
6254
+ link.remove();
6255
+ return true;
6256
+ }
6257
+ return false;
6258
+ }
6167
6259
  function $6a374b16bfe947d0$export$217899a935ef803b({
6168
6260
  selected_index_: [read_selected_index, write_selected_index],
6169
6261
  currently_showing_suggestions_: [read_currently_showing_suggestions],
@@ -6237,6 +6329,7 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
6237
6329
  const sfv = get_search_field_value();
6238
6330
  if (!(0, $5vyXB$solidjs.untrack)(() => read_updating_blocked())) previous_value = sfv;
6239
6331
  });
6332
+ const owner = (0, $5vyXB$solidjs.getOwner)();
6240
6333
  const handler = (0, $5vyXB$depictaiutilishared.catchify)(({
6241
6334
  keyCode: keyCode
6242
6335
  }) => (0, $5vyXB$solidjs.untrack)(() => {
@@ -6267,29 +6360,29 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
6267
6360
  const {
6268
6361
  title: title
6269
6362
  } = selected_entry;
6270
- block_updating_for_one_change();
6363
+ (0, $5vyXB$solidjs.runWithOwner)(owner, block_updating_for_one_change);
6271
6364
  set_search_field_value(title);
6272
- override_on_enter_for_this_entry(e => {
6365
+ (0, $5vyXB$solidjs.runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
6273
6366
  // Open search query in new tab on cmd+enter
6274
6367
  // 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 ;)
6275
6368
  const url = new URL(location);
6276
6369
  url_transformer_?.(url);
6277
6370
  url.searchParams.set(search_query_param_name_, title);
6278
- return $6a374b16bfe947d0$var$open_link_on_cmd_pressed(e, url.href);
6279
- });
6280
- } else if (selected_entry?.type == "category") override_on_enter_for_this_entry(e => {
6371
+ return (0, $b8700779b3e745de$export$1efe1013da60d0e4)(e, url.href);
6372
+ }));
6373
+ } else if (selected_entry?.type == "category" || selected_entry?.type === "content") (0, $5vyXB$solidjs.runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
6281
6374
  const {
6282
6375
  page_url: page_url
6283
6376
  } = selected_entry;
6284
- if (!$6a374b16bfe947d0$var$open_link_on_cmd_pressed(e, page_url))
6377
+ if (!(0, $b8700779b3e745de$export$1efe1013da60d0e4)(e, page_url))
6285
6378
  // Above fn will return true if it opened a new tab, and we won't make these checks anymore
6286
6379
  router_.navigate_.go_to_({
6287
6380
  new_url_: page_url,
6288
6381
  is_replace_: false
6289
6382
  });
6290
6383
  return true;
6291
- });else if (!selected_entry) {
6292
- block_updating_for_one_change();
6384
+ }));else if (!selected_entry) {
6385
+ (0, $5vyXB$solidjs.runWithOwner)(owner, block_updating_for_one_change);
6293
6386
  set_search_field_value(previous_value);
6294
6387
  }
6295
6388
  }));
@@ -6300,16 +6393,37 @@ function $6a374b16bfe947d0$var$actual_navigation_working_on_fake_data({
6300
6393
  (0, $5vyXB$solidjs.onCleanup)((0, $5vyXB$depictaiutilishared.catchify)(() => el.removeEventListener("keyup", handler)));
6301
6394
  });
6302
6395
  }
6303
- function $6a374b16bfe947d0$var$open_link_on_cmd_pressed(e, href) {
6304
- if (e.metaKey || e.ctrlKey) {
6305
- // Open link in a new tab with cmd/ctrl + enter.
6306
- const link = (0, $5vyXB$solidjsweb.ssr)($6a374b16bfe947d0$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)() + (0, $5vyXB$solidjsweb.ssrAttribute)("href", (0, $5vyXB$solidjsweb.escape)(href, true), false));
6307
- document.body.append(link);
6308
- link.click();
6309
- link.remove();
6310
- return true;
6311
- }
6312
- return false;
6396
+ function $4f0ae864ec7c394e$export$af0124069c150252({
6397
+ set_override_on_enter_fn_: set_override_on_enter_fn_,
6398
+ get_modal_search_results_: get_modal_search_results_,
6399
+ read_suggestion_signal_: read_suggestion_signal_,
6400
+ router_: router_,
6401
+ content_results_: content_results_
6402
+ }) {
6403
+ const [get_autocomplete_wants_override_function, set_autocomplete_wants_override_function] = (0, $5vyXB$solidjs.createSignal)(() => false);
6404
+ (0, $5vyXB$solidjs.createComputed)(() => {
6405
+ const suggestions = read_suggestion_signal_();
6406
+ const search_results = get_modal_search_results_()?.();
6407
+ const content_results = content_results_();
6408
+ // If we only have one content result and nothing else, go there when pressing enter
6409
+ if (!suggestions.length && !search_results?.displays?.length && content_results?.length === 1) {
6410
+ const [{
6411
+ page_url: page_url
6412
+ }] = content_results;
6413
+ set_override_on_enter_fn_(e => {
6414
+ if (!(0, $b8700779b3e745de$export$1efe1013da60d0e4)(e, page_url))
6415
+ // Above fn will return true if it opened a new tab, and we won't make these checks anymore
6416
+ router_.navigate_.go_to_({
6417
+ new_url_: page_url,
6418
+ is_replace_: false
6419
+ });
6420
+ return true;
6421
+ });
6422
+ return;
6423
+ }
6424
+ set_override_on_enter_fn_(get_autocomplete_wants_override_function());
6425
+ });
6426
+ return new_fn => set_autocomplete_wants_override_function(() => new_fn);
6313
6427
  }
6314
6428
  const $3ec9e21d6b6debdd$export$3cf9497e790da491 = "query";
6315
6429
  function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
@@ -6329,12 +6443,15 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
6329
6443
  i18n_: i18n_,
6330
6444
  include_category_suggestions_: include_category_suggestions_,
6331
6445
  submit_query_: submit_query_,
6332
- router_: router_
6446
+ router_: router_,
6447
+ get_modal_search_results_: get_modal_search_results_,
6448
+ content_search_enabled_: content_search_enabled_
6333
6449
  }) {
6334
6450
  const [searching_for_value, set_searching_for_value] = (0, $5vyXB$solidjs.createSignal)();
6451
+ const [show_stale_content_results, set_show_stale_content_results] = (0, $5vyXB$solidjs.createSignal)(false);
6335
6452
  const [read_search_field_value] = search_field_value_;
6336
6453
  const updating_blocked = (0, $5vyXB$solidjs.createSignal)(false);
6337
- const [read_suggestion_signal, write_suggestion_signal] = (0, $5vyXB$solidjs.createSignal)([]);
6454
+ const [read_suggestion_signal_, write_suggestion_signal] = (0, $5vyXB$solidjs.createSignal)([]);
6338
6455
  const filtered_previous_searches = (0, $5vyXB$solidjs.createMemo)(() => [...unfiltered_previous_searches[0]()].reverse().filter(q => q !== get_search_query_()));
6339
6456
  const deparallelized_fn = (0, $5vyXB$depictaiutilishared.deparallelize_no_drop)(async request_obj => {
6340
6457
  const api_response = await depict_api_.suggest(request_obj);
@@ -6353,15 +6470,38 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
6353
6470
  });
6354
6471
 
6355
6472
  const show_previous_searches_component = (0, $5vyXB$solidjs.createMemo)(() => !read_search_field_value() || (0, $5vyXB$solidjs.untrack)(updating_blocked[0]) && !(0, $5vyXB$solidjs.untrack)(searching_for_value));
6473
+ const get_content_results_ = (0, $5vyXB$solidjs.createMemo)(prev => {
6474
+ if (!content_search_enabled_()) return [];
6475
+ if (show_stale_content_results())
6476
+ // don't update content results when query suggestions don't update because otherwise they disappear when trying to keyboard navigate to them
6477
+ return prev;
6478
+ return get_modal_search_results_()?.()?.content_search_links?.map(link => ({
6479
+ page_url: link.page_url,
6480
+ type: "content",
6481
+ title: link.title
6482
+ }));
6483
+ });
6484
+ // 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.
6485
+ // It's the functionality to open the content results page when you press enter, in the modal, when there's only one content result
6486
+ const manipulated_set_override_on_enter_fn_ = (0, $4f0ae864ec7c394e$export$af0124069c150252)({
6487
+ set_override_on_enter_fn_: set_override_on_enter_fn_,
6488
+ get_modal_search_results_: get_modal_search_results_,
6489
+ read_suggestion_signal_: read_suggestion_signal_,
6490
+ router_: router_,
6491
+ content_results_: get_content_results_
6492
+ });
6356
6493
  (0, $5vyXB$solidjs.createComputed)(() => {
6357
6494
  const field_value = read_search_field_value();
6358
- if (!(0, $5vyXB$solidjs.untrack)(updating_blocked[0])) {
6495
+ if ((0, $5vyXB$solidjs.untrack)(updating_blocked[0]))
6496
+ // not using updating_blocked instead of below signal since I presume they'd start updating too early then
6497
+ set_show_stale_content_results(true);else {
6359
6498
  set_searching_for_value(field_value);
6360
6499
  deparallelized_fn({
6361
6500
  query: field_value,
6362
6501
  tenant: tenant_(),
6363
6502
  market: market_()
6364
6503
  });
6504
+ set_show_stale_content_results(false);
6365
6505
  }
6366
6506
  });
6367
6507
  (0, $5vyXB$solidjs.createComputed)((0, $5vyXB$solidjs.on)(search_field_value_[0], () => !updating_blocked[0]() && selected_index_[1](undefined), {
@@ -6373,7 +6513,7 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
6373
6513
  search_field_value_: search_field_value_,
6374
6514
  updating_blocked_: updating_blocked,
6375
6515
  currently_showing_suggestions_: currently_showing_suggestions_,
6376
- set_override_on_enter_fn_: set_override_on_enter_fn_,
6516
+ set_override_on_enter_fn_: manipulated_set_override_on_enter_fn_,
6377
6517
  search_query_param_name_: search_query_url_param_name_,
6378
6518
  url_transformer_: url_transformer_,
6379
6519
  router_: router_
@@ -6412,11 +6552,12 @@ function $3ec9e21d6b6debdd$export$2f2b9559550c7bbc({
6412
6552
  },
6413
6553
  on_previous_searches_page_: show_previous_searches_component,
6414
6554
  i18n_: i18n_,
6555
+ get_content_results_: get_content_results_,
6415
6556
  url_transformer_: url_transformer_,
6416
6557
  searching_for_value_: searching_for_value,
6417
6558
  search_query_url_param_name_: search_query_url_param_name_,
6418
6559
  selected_index_: selected_index_,
6419
- suggestion_memo_: read_suggestion_signal,
6560
+ suggestion_memo_: read_suggestion_signal_,
6420
6561
  currently_showing_suggestions_: currently_showing_suggestions_,
6421
6562
  include_category_suggestions_: include_category_suggestions_,
6422
6563
  router_: router_,
@@ -6516,7 +6657,8 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
6516
6657
  bottom_distance_under_modal_: bottom_distance_under_modal_,
6517
6658
  selected_text_range_: selected_text_range_,
6518
6659
  dont_sync_search_field_value_except_on_submit_ = false,
6519
- router_: router_
6660
+ router_: router_,
6661
+ content_search_enabled_: content_search_enabled_
6520
6662
  }) {
6521
6663
  let on_enter_in_search_field_function;
6522
6664
  // 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.
@@ -6533,30 +6675,23 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
6533
6675
  };
6534
6676
  const [input_field, set_input_field] = (0, $5vyXB$solidjs.createSignal)();
6535
6677
  const [get_search_field_value_] = search_field_value_;
6536
- const [elements_outside_scrollable, set_elements_outside_scrollable] = (0, $5vyXB$solidjs.createSignal)();
6537
- const [elements_inside_scrollable, set_elements_inside_scrollable] = (0, $5vyXB$solidjs.createSignal)();
6678
+ const [get_modal_search_results, set_modal_search_results_] = (0, $5vyXB$solidjs.createSignal)();
6538
6679
  const close_on_escape_handler = (0, $5vyXB$depictaiutilishared.catchify)(({
6539
6680
  key: key
6540
6681
  }) => {
6541
6682
  if (key === "Escape") close_modal_();
6542
6683
  });
6543
- const [get_num_results_accessor, set_num_results_accessor_] = (0, $5vyXB$solidjs.createSignal)();
6684
+ const [get_total_num_results_accessor, set_total_num_results_accessor_] = (0, $5vyXB$solidjs.createSignal)();
6544
6685
  const selected_index = (0, $5vyXB$solidjs.createSignal)();
6545
6686
  const currently_showing_suggestions_ = (0, $5vyXB$solidjs.createSignal)([], {
6546
6687
  equals: false
6547
6688
  });
6689
+ const less_than_700_high = (0, $b54e6192d0caa293$export$d9f36cf74e24d595)("(max-height:700px)");
6690
+ const DiscoverMoreSection = () => (0, $5vyXB$solidjsweb.ssr)($f40a47a30a358305$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), get_search_field_value_() ? (0, $5vyXB$solidjsweb.escape)(i18n_.modal_view_all_results_()((0, $5vyXB$solidjsweb.ssr)($f40a47a30a358305$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(get_total_num_results_accessor?.())))) : (0, $5vyXB$solidjsweb.escape)(i18n_.modal_discover_more_()));
6548
6691
  if (disable_scrolling_) (0, $ca1176b694a6ee2e$export$fe334901e8bebd57)();
6549
6692
  $f40a47a30a358305$var$close_modal_when_navigating_away(close_modal_, search_query_url_param_name_);
6550
6693
  window.addEventListener("keydown", close_on_escape_handler);
6551
6694
  (0, $5vyXB$solidjs.onCleanup)((0, $5vyXB$depictaiutilishared.catchify)(() => window.removeEventListener("keydown", close_on_escape_handler)));
6552
- const owner = (0, $5vyXB$solidjs.getOwner)();
6553
- (0, $5vyXB$solidjs.onCleanup)((0, $5vyXB$depictaiutilishared.javascript_media_query)("(max-height:700px)", ({
6554
- matches: matches
6555
- }) => (0, $5vyXB$solidjs.runWithOwner)(owner, () => {
6556
- // the if below is reactive so we need an owner
6557
- (matches ? set_elements_outside_scrollable : set_elements_inside_scrollable)("");
6558
- (matches ? set_elements_inside_scrollable : set_elements_outside_scrollable)((0, $5vyXB$solidjsweb.ssr)($f40a47a30a358305$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), get_search_field_value_() ? (0, $5vyXB$solidjsweb.escape)(i18n_.modal_view_all_results_()((0, $5vyXB$solidjsweb.ssr)($f40a47a30a358305$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(get_num_results_accessor?.())))) : (0, $5vyXB$solidjsweb.escape)(i18n_.modal_discover_more_())));
6559
- })).remove);
6560
6695
  if (closing_animation_) register_closing_animation_(closing_animation_);
6561
6696
  (0, $036d367ce3058351$export$3340fdd8259bd4fd)({
6562
6697
  get_search_field_value_: get_search_field_value_,
@@ -6615,7 +6750,9 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
6615
6750
  i18n_: i18n_,
6616
6751
  include_category_suggestions_: enable_category_suggestions_ ?? true,
6617
6752
  router_: router_,
6618
- submit_query_: submit_query_
6753
+ submit_query_: submit_query_,
6754
+ get_modal_search_results_: get_modal_search_results,
6755
+ content_search_enabled_: content_search_enabled_
6619
6756
  });
6620
6757
  }
6621
6758
  })), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
@@ -6628,12 +6765,28 @@ function $f40a47a30a358305$export$1c593cbd6f1e10bc({
6628
6765
  tenant_: tenant_,
6629
6766
  i18n_: i18n_,
6630
6767
  market_: market_,
6631
- set_num_results_accessor_: set_num_results_accessor_,
6768
+ set_total_num_results_accessor_: set_total_num_results_accessor_,
6632
6769
  router_: router_,
6770
+ set_modal_search_results_: set_modal_search_results_,
6771
+ content_search_enabled_: content_search_enabled_,
6633
6772
  ...instant_results_options_
6634
6773
  });
6635
6774
  }
6636
- })), (0, $5vyXB$solidjsweb.escape)(elements_inside_scrollable()), (0, $5vyXB$solidjsweb.escape)(elements_outside_scrollable()), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $b776f25acdda22eb$export$f021bdedd3ec901a), {
6775
+ })), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
6776
+ get when() {
6777
+ return less_than_700_high();
6778
+ },
6779
+ get children() {
6780
+ return (0, $5vyXB$solidjsweb.createComponent)(DiscoverMoreSection, {});
6781
+ }
6782
+ })), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
6783
+ get when() {
6784
+ return !less_than_700_high();
6785
+ },
6786
+ get children() {
6787
+ return (0, $5vyXB$solidjsweb.createComponent)(DiscoverMoreSection, {});
6788
+ }
6789
+ })), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $b776f25acdda22eb$export$f021bdedd3ec901a), {
6637
6790
  styles: body_style
6638
6791
  })));
6639
6792
  return [(0, $5vyXB$solidjsweb.ssr)($f40a47a30a358305$var$_tmpl$4, (0, $5vyXB$solidjsweb.ssrHydrationKey)() + (0, $5vyXB$solidjsweb.ssrAttribute)("id", (0, $5vyXB$solidjsweb.escape)((0, $0b6e2070a98de347$export$44dad306455dddf).SEARCH_MODAL, true), false), `depict plp search ${(0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.ssrClassList)(class_list_?.()), true) || ""}`, (0, $5vyXB$solidjsweb.escape)(modal_element))];
@@ -6705,14 +6858,21 @@ const $65a0c4b1c2eb5d0b$var$_tmpl$ = ["<b", ">", "</b>"],
6705
6858
  function $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf({
6706
6859
  get_search_query_: get_search_query_,
6707
6860
  i18n_: i18n_,
6708
- formatted_number_of_results_: formatted_number_of_results_
6861
+ formatted_number_of_results_: formatted_number_of_results_,
6862
+ number_of_results_: number_of_results_,
6863
+ type: type
6709
6864
  }) {
6710
6865
  const contents = (0, $5vyXB$solidjs.createMemo)((0, $5vyXB$depictaiutilishared.catchify)(() => {
6711
6866
  const q = get_search_query_();
6712
- return i18n_.get_showing_results_for_()((0, $5vyXB$solidjsweb.ssr)($65a0c4b1c2eb5d0b$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(q)), (0, $5vyXB$solidjsweb.ssr)($65a0c4b1c2eb5d0b$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(formatted_number_of_results_())));
6867
+ return i18n_[type === $65a0c4b1c2eb5d0b$export$2452208c79fe93ea.content ? "get_showing_pages_for_" : "get_showing_results_for_"]()((0, $5vyXB$solidjsweb.ssr)($65a0c4b1c2eb5d0b$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(q)), (0, $5vyXB$solidjsweb.ssr)($65a0c4b1c2eb5d0b$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(formatted_number_of_results_())), !!q, number_of_results_());
6713
6868
  }));
6714
6869
  return (0, $5vyXB$solidjsweb.ssr)($65a0c4b1c2eb5d0b$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(contents()));
6715
6870
  }
6871
+ let $65a0c4b1c2eb5d0b$export$2452208c79fe93ea;
6872
+ (function (ShowingResultsForType) {
6873
+ ShowingResultsForType[ShowingResultsForType["products"] = 0] = "products";
6874
+ ShowingResultsForType[ShowingResultsForType["content"] = 1] = "content";
6875
+ })($65a0c4b1c2eb5d0b$export$2452208c79fe93ea || ($65a0c4b1c2eb5d0b$export$2452208c79fe93ea = {}));
6716
6876
  function $2005eec80e40088f$export$41b4894022a3580f({
6717
6877
  style_props_ = (0, $5vyXB$solidjs.createSignal)({})
6718
6878
  } = {}) {
@@ -6731,8 +6891,429 @@ function $2005eec80e40088f$export$41b4894022a3580f({
6731
6891
  })));
6732
6892
  return style_props_;
6733
6893
  }
6894
+ const $5ea5a82e398f6f44$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"];
6895
+ const $5ea5a82e398f6f44$var$dont_cut_in_between_less_than_characters = 30;
6896
+ function $5ea5a82e398f6f44$export$e1a98a189fd2c0e7({
6897
+ content_result_: content_result_,
6898
+ key_: key_,
6899
+ cut_when_possible_: cut_when_possible_
6900
+ }) {
6901
+ const matched_tokens = (0, $5vyXB$solidjs.createMemo)(() => content_result_().highlights?.find(highlight => highlight.field == key_)?.matched_tokens);
6902
+ const full_value = (0, $5vyXB$solidjs.createMemo)(() => content_result_()[key_]?.replaceAll("\n", " "));
6903
+ return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
6904
+ get when() {
6905
+ return matched_tokens()?.length;
6906
+ },
6907
+ get fallback() {
6908
+ return full_value();
6909
+ },
6910
+ get children() {
6911
+ return (() => {
6912
+ const segmented_cut_text = (0, $5vyXB$solidjs.createMemo)(() => {
6913
+ const segmented_text = $5ea5a82e398f6f44$var$segment_text(full_value(), matched_tokens());
6914
+ if (cut_when_possible_) $5ea5a82e398f6f44$var$cut_text(segmented_text);
6915
+ return segmented_text;
6916
+ });
6917
+ return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Index), {
6918
+ get each() {
6919
+ return segmented_cut_text();
6920
+ },
6921
+ children: item => {
6922
+ return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
6923
+ get when() {
6924
+ return item().highlighted_;
6925
+ },
6926
+ get fallback() {
6927
+ return item().text_;
6928
+ },
6929
+ get children() {
6930
+ return (0, $5vyXB$solidjsweb.ssr)($5ea5a82e398f6f44$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(item().text_));
6931
+ }
6932
+ });
6933
+ }
6934
+ });
6935
+ })();
6936
+ }
6937
+ });
6938
+ }
6939
+ function $5ea5a82e398f6f44$var$cut_text(segmented_text) {
6940
+ // cut away chunks of text that are not highlighted to give a google-like overview of the content
6941
+ const highlighted_segments = segmented_text?.filter(segment => segment.highlighted_);
6942
+ if (!segmented_text || !highlighted_segments?.length) return;
6943
+ // We have one or more highlighted segments
6944
+ if (highlighted_segments.length === 1) {
6945
+ // cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
6946
+ $5ea5a82e398f6f44$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
6947
+ return;
6948
+ }
6949
+ // We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
6950
+ 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
6951
+ );
6952
+
6953
+ const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
6954
+ // We need to cut before the first segment - possibly through other segments - and maybe between segments
6955
+ 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);
6956
+ $5ea5a82e398f6f44$var$cut_start(index_of_first_segment, segmented_text);
6957
+ // update indexes since we might have removed segments
6958
+ [index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
6959
+ let number_of_characters_between_segments = 0;
6960
+ for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
6961
+ const segment = segmented_text[i];
6962
+ number_of_characters_between_segments += segment.text_.length;
6963
+ }
6964
+ if (number_of_characters_between_segments < $5ea5a82e398f6f44$var$dont_cut_in_between_less_than_characters)
6965
+ // don't cut if there are less than 30 characters between the two segments
6966
+ return;
6967
+ // We have more than 50 characters between the two segments, cut between them
6968
+ const [split_start_segment, split_start_character] = $5ea5a82e398f6f44$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
6969
+ const [split_end_segment, split_end_character] = $5ea5a82e398f6f44$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
6970
+ if (split_start_segment === undefined || split_end_segment === undefined ||
6971
+ // identical split point, or split end before split start, can't do anything
6972
+ split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
6973
+ const dots_segment = {
6974
+ text_: " … ",
6975
+ highlighted_: false
6976
+ };
6977
+ const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
6978
+ if (i < split_start_segment || i > split_end_segment) return segment;
6979
+ const text = segment.text_;
6980
+ if (i == split_end_segment && i == split_start_segment) return [{
6981
+ ...segment,
6982
+ text_: text.slice(0, split_start_character).trimEnd()
6983
+ }, dots_segment, {
6984
+ ...segment,
6985
+ text_: text.slice(split_end_character + 1, text.length).trimStart()
6986
+ }];else if (i == split_start_segment) {
6987
+ 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
6988
+ return segment;
6989
+ } else if (i == split_end_segment) return [dots_segment, {
6990
+ ...segment,
6991
+ text_: text.slice(split_end_character + 1, text.length).trimStart()
6992
+ }];
6993
+ return []; // remove all segments inbetween
6994
+ });
6995
+
6996
+ segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
6997
+ $5ea5a82e398f6f44$var$heal_holes(segmented_text);
6998
+ }
6999
+ function $5ea5a82e398f6f44$var$heal_holes(segmented_text) {
7000
+ // try to heal "holes" created in the segments so there are only alternating segments
7001
+ const segments_to_delete = new Set();
7002
+ for (let i = 0; i < segmented_text.length; i++) {
7003
+ const segment = segmented_text[i];
7004
+ let previous_segment;
7005
+ for (let j = i - 1; j >= 0; j--) {
7006
+ previous_segment = segmented_text[j];
7007
+ // Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
7008
+ if (!segments_to_delete.has(previous_segment)) break;
7009
+ }
7010
+ if (previous_segment?.highlighted_ && segment.highlighted_ || previous_segment?.highlighted_ === false && segment.highlighted_ === false) {
7011
+ previous_segment.text_ += segment.text_; // IDK if this ever happens
7012
+ segments_to_delete.add(segment);
7013
+ }
7014
+ }
7015
+ for (const segment of segments_to_delete) {
7016
+ const index = segmented_text.indexOf(segment);
7017
+ segmented_text.splice(index, 1);
7018
+ }
7019
+ }
7020
+ function $5ea5a82e398f6f44$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text, be_very_aggressive = true) {
7021
+ const should_loop_backwards = index_of_start_segment > index_of_end_segment;
7022
+ const step = should_loop_backwards ? -1 : 1;
7023
+ const desperate_split_attempts = [":", ";", ","];
7024
+ while (desperate_split_attempts.length) {
7025
+ const split_point_between_words = [];
7026
+ // for the middle also try to split with a few more characters if the default ones don't work over a full run
7027
+ const desperate_split_attempt = desperate_split_attempts.pop();
7028
+ let is_first_character = true;
7029
+ for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
7030
+ const segment = segmented_text[i];
7031
+ const text = segment.text_;
7032
+ for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
7033
+ const character = text[j];
7034
+ if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
7035
+ if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
7036
+ split_point_between_words.push([i, j]);
7037
+ if (split_point_between_words.length > 3)
7038
+ // We can't find a split point, so we'll just split between words
7039
+ // 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
7040
+ return split_point_between_words[1];
7041
+ }
7042
+ }
7043
+ }
7044
+ }
7045
+ return [];
7046
+ }
7047
+ function $5ea5a82e398f6f44$var$cut_start(cut_left_of_index, segmented_text) {
7048
+ // Cut the start of the text to bring the first matching token
7049
+ let is_first_character = false;
7050
+ let words_encountered = 0;
7051
+ outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
7052
+ const segment = segmented_text[i];
7053
+ // We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
7054
+ const text = segment.text_;
7055
+ for (let j = text.length - 1; j >= 0; j--) {
7056
+ const character = text[j];
7057
+ const is_space = character == " ";
7058
+ if (!is_first_character && is_space) words_encountered++;
7059
+ if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
7060
+ // We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
7061
+ segment.text_ = text.slice(j + 1).trimStart();
7062
+ segmented_text.splice(0, i);
7063
+ if (character === "," || is_space)
7064
+ // if we cut at a comma or psace, we add a … at the beginning
7065
+ segmented_text.unshift({
7066
+ text_: "… ",
7067
+ highlighted_: false
7068
+ });
7069
+ break outmost_loop;
7070
+ }
7071
+ if (is_first_character) is_first_character = false;
7072
+ }
7073
+ }
7074
+ $5ea5a82e398f6f44$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
7075
+ }
7076
+
7077
+ function $5ea5a82e398f6f44$var$segment_text(text, matched_strings) {
7078
+ // segment text where the matched strings are highlighted sections
7079
+ const output = [];
7080
+ if (!text) return; // shouldn't happen but whatever
7081
+ for (let i = 0; i < text.length; i++) {
7082
+ const found_strings = [];
7083
+ if (!i || text[i - 1] == " ")
7084
+ // only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
7085
+ for (let j = 0; j < matched_strings.length; j++) {
7086
+ const matched_string = matched_strings[j];
7087
+ const part_in_text = text.slice(i, i + matched_string.length);
7088
+ if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
7089
+ 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
7090
+ }
7091
+
7092
+ const last_index_in_output = output.length - 1;
7093
+ if (!found_strings.length) {
7094
+ const character = text[i];
7095
+ if (output[last_index_in_output]?.highlighted_ === false || output.length && /\s/.test(character))
7096
+ // 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
7097
+ output[last_index_in_output].text_ += character;else output.push({
7098
+ highlighted_: false,
7099
+ text_: character
7100
+ });
7101
+ } else {
7102
+ const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
7103
+ if (output[last_index_in_output]?.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
7104
+ highlighted_: true,
7105
+ text_: longest_found_string
7106
+ });
7107
+ i += longest_found_string.length - 1;
7108
+ }
7109
+ }
7110
+ return output;
7111
+ }
7112
+ const $76227de40be817e5$var$_tmpl$ = ["<div", ' class="description line-clamp">', "</div>"],
7113
+ $76227de40be817e5$var$_tmpl$2 = ["<div", ' class="content-card"><div class="image">', '</div><div class="info"><!--#-->', "<!--/--><!--#-->", "<!--/--></div></div>"];
7114
+ function $76227de40be817e5$export$f631859cab12b342({
7115
+ router_: router_,
7116
+ content_result_: content_result_
7117
+ }) {
7118
+ const make_link_attributes = () => {
7119
+ const result = content_result_?.();
7120
+ if (!result) return;
7121
+ return {
7122
+ href: result.page_url,
7123
+ onClick: (0, $5vyXB$depictaiutilishared.catchify)(ev => router_.navigate_.go_to_({
7124
+ new_url_: result.page_url,
7125
+ is_replace_: false,
7126
+ event_: ev
7127
+ }))
7128
+ };
7129
+ };
7130
+ const LinkIfPossible = ({
7131
+ children: children,
7132
+ ...attributes
7133
+ }) => {
7134
+ if (content_result_) return (0, $5vyXB$solidjsweb.ssrElement)("a", attributes, () => (0, $5vyXB$solidjsweb.escape)(children), true);
7135
+ return (0, $5vyXB$solidjsweb.ssrElement)("div", attributes, () => (0, $5vyXB$solidjsweb.escape)(children), true);
7136
+ };
7137
+ return (0, $5vyXB$solidjsweb.ssr)($76227de40be817e5$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)(LinkIfPossible, (0, $5vyXB$solidjsweb.mergeProps)(make_link_attributes, {
7138
+ tabIndex: "-1",
7139
+ get children() {
7140
+ return (0, $5vyXB$solidjsweb.createComponent)((0, $c0125412b4ea0c93$export$605674723bcc715c), {
7141
+ width: "28",
7142
+ height: "28"
7143
+ });
7144
+ }
7145
+ }))), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)(LinkIfPossible, (0, $5vyXB$solidjsweb.mergeProps)({
7146
+ "class": "content-title line-clamp"
7147
+ }, make_link_attributes, {
7148
+ get title() {
7149
+ return content_result_?.().title;
7150
+ },
7151
+ get children() {
7152
+ return content_result_ ? (0, $5vyXB$solidjsweb.createComponent)((0, $5ea5a82e398f6f44$export$e1a98a189fd2c0e7), {
7153
+ content_result_: content_result_,
7154
+ key_: "title",
7155
+ cut_when_possible_: false
7156
+ }) : (0, $5vyXB$solidjsweb.createComponent)((0, $061ff5b4c3d36171$export$89c6019e4baa40b1), {
7157
+ height: "1em",
7158
+ width: "20ch"
7159
+ });
7160
+ }
7161
+ }))), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
7162
+ get when() {
7163
+ return content_result_?.().description || !content_result_;
7164
+ },
7165
+ get children() {
7166
+ return (0, $5vyXB$solidjsweb.ssr)($76227de40be817e5$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
7167
+ when: content_result_,
7168
+ get fallback() {
7169
+ return Array.from({
7170
+ length: 4
7171
+ }).map(() => (0, $5vyXB$solidjsweb.createComponent)((0, $061ff5b4c3d36171$export$89c6019e4baa40b1), {
7172
+ height: "1em",
7173
+ width: "min(50ch, 100%)"
7174
+ }));
7175
+ },
7176
+ get children() {
7177
+ return (0, $5vyXB$solidjsweb.createComponent)((0, $5ea5a82e398f6f44$export$e1a98a189fd2c0e7), {
7178
+ content_result_: content_result_,
7179
+ key_: "description",
7180
+ cut_when_possible_: true
7181
+ });
7182
+ }
7183
+ })));
7184
+ }
7185
+ })));
7186
+ }
7187
+ function $8781fcec27b20709$export$9ff751cd77687edc({
7188
+ search_results_: search_results_,
7189
+ router_: router_
7190
+ }) {
7191
+ const content_results = (0, $5vyXB$solidjs.createMemo)(() => search_results_()?.content_search_links);
7192
+ const content_results_by_page_url = (0, $5vyXB$solidjs.createMemo)(() => {
7193
+ const map = new Map();
7194
+ const results = content_results();
7195
+ if (!results) return map;
7196
+ for (let i = 0; i < results.length; i++) {
7197
+ const content_result = results[i];
7198
+ map.set(content_result.page_url, content_result);
7199
+ }
7200
+ return map;
7201
+ });
7202
+ return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.For), {
7203
+ get each() {
7204
+ return [...content_results_by_page_url().keys()];
7205
+ },
7206
+ children: page_url => {
7207
+ const content_result = (0, $5vyXB$solidjs.createMemo)(() => content_results_by_page_url().get(page_url));
7208
+ return (0, $5vyXB$solidjsweb.createComponent)((0, $76227de40be817e5$export$f631859cab12b342), {
7209
+ content_result_: content_result,
7210
+ router_: router_
7211
+ });
7212
+ }
7213
+ });
7214
+ }
7215
+ function $c2f92eb265a14529$export$4405d077f0a20494({
7216
+ content_results_rows_: [get_history_state_content_results_rows],
7217
+ cols_at_size_: cols_at_size_
7218
+ }) {
7219
+ const largest_column = (0, $5vyXB$solidjs.createMemo)(() => {
7220
+ const largest_in_cols_at_size = Math.max(...cols_at_size_().map(([cols]) => cols));
7221
+ 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
7222
+ return largest_in_cols_at_size;
7223
+ });
7224
+ const num_placeholders = (0, $5vyXB$solidjs.createMemo)(() => (get_history_state_content_results_rows() ?? (0, $3716b8caf7f959e2$export$70ceae36059a1036)) * largest_column());
7225
+ return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Index), {
7226
+ get each() {
7227
+ return Array.from({
7228
+ length: num_placeholders()
7229
+ });
7230
+ },
7231
+ children: () => (0, $5vyXB$solidjsweb.createComponent)((0, $76227de40be817e5$export$f631859cab12b342), {})
7232
+ });
7233
+ }
7234
+ const $3716b8caf7f959e2$var$_tmpl$ = ["<div", ' class="', '" style="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
7235
+ $3716b8caf7f959e2$var$_tmpl$2 = ["<button", ' class="view-more">', "</button>"],
7236
+ $3716b8caf7f959e2$var$_tmpl$3 = ["<button", ' class="view-less">', "</button>"];
7237
+ const $3716b8caf7f959e2$export$70ceae36059a1036 = 1;
7238
+ function $3716b8caf7f959e2$export$6d0c9c22f6652669({
7239
+ search_results_: search_results_,
7240
+ get_search_query_: get_search_query_,
7241
+ i18n_: i18n_,
7242
+ layout_options_: layout_options_,
7243
+ router_: router_,
7244
+ query_base_: query_base_,
7245
+ content_results_rows_: content_results_rows_
7246
+ }) {
7247
+ const content_results = (0, $5vyXB$solidjs.createMemo)(() => search_results_()?.content_search_links);
7248
+ const num_results = (0, $5vyXB$solidjs.createMemo)(() => content_results()?.length);
7249
+ const is_loading_ = (0, $5vyXB$solidjs.createMemo)(() => search_results_.loading || query_base_.loading); // See comment in PLPResults/index.tsx on why we need this
7250
+ const formatted_number_of_results_ = (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
7251
+ number_: num_results,
7252
+ i18n_: i18n_
7253
+ });
7254
+ const [is_showing_placeholders, set_is_showing_placeholders] = (0, $5vyXB$solidjs.createSignal)(false);
7255
+ const rows_object = $3716b8caf7f959e2$var$make_state_saved_rows(content_results_rows_, i18n_);
7256
+ return (0, $5vyXB$solidjsweb.ssr)($3716b8caf7f959e2$var$_tmpl$, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), `content-results ${is_showing_placeholders() ? "loading" : ""}`, "display:" + (is_loading_() || content_results()?.length > 0 ? "" : "none"), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf), {
7257
+ get_search_query_: get_search_query_,
7258
+ i18n_: i18n_,
7259
+ formatted_number_of_results_: formatted_number_of_results_,
7260
+ get type() {
7261
+ return (0, $65a0c4b1c2eb5d0b$export$2452208c79fe93ea).content;
7262
+ },
7263
+ number_of_results_: num_results
7264
+ })), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $f48d0fbb00835aaa$export$d21e32dfedac04be), (0, $5vyXB$solidjsweb.mergeProps)({
7265
+ layout: "grid",
7266
+ element_attributes: {
7267
+ class: "cards"
7268
+ }
7269
+ }, layout_options_, {
7270
+ rows: rows_object,
7271
+ get children() {
7272
+ return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Suspense), {
7273
+ get fallback() {
7274
+ return (() => {
7275
+ set_is_showing_placeholders(true);
7276
+ (0, $5vyXB$solidjs.onCleanup)(() => set_is_showing_placeholders(false));
7277
+ return (0, $5vyXB$solidjsweb.createComponent)((0, $c2f92eb265a14529$export$4405d077f0a20494), {
7278
+ content_results_rows_: content_results_rows_,
7279
+ get cols_at_size_() {
7280
+ return (0, $5vyXB$solidjs.createMemo)(() => layout_options_().cols_at_size);
7281
+ }
7282
+ });
7283
+ })();
7284
+ },
7285
+ get children() {
7286
+ return (0, $5vyXB$solidjsweb.createComponent)((0, $8781fcec27b20709$export$9ff751cd77687edc), {
7287
+ router_: router_,
7288
+ search_results_: search_results_
7289
+ });
7290
+ }
7291
+ });
7292
+ }
7293
+ }))));
7294
+ }
7295
+ function $3716b8caf7f959e2$var$make_state_saved_rows(
7296
+ // similar to the one in SearchRecommendations.tsx but not enough to warrant a shared function IMO
7297
+ [get_showing_content_results_rows, set_showing_content_results_rows], i18n_) {
7298
+ const currently_visible = (0, $5vyXB$solidjs.createSignal)((0, $5vyXB$solidjs.untrack)(get_showing_content_results_rows));
7299
+ const [get_currently_visible, set_currently_visible] = currently_visible;
7300
+ const rows = {
7301
+ currently_visible: currently_visible,
7302
+ start_rows: $3716b8caf7f959e2$export$70ceae36059a1036,
7303
+ button: (0, $5vyXB$solidjsweb.ssr)($3716b8caf7f959e2$var$_tmpl$2, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(i18n_.view_more_())),
7304
+ view_less_button: (0, $5vyXB$solidjsweb.ssr)($3716b8caf7f959e2$var$_tmpl$3, (0, $5vyXB$solidjsweb.ssrHydrationKey)(), (0, $5vyXB$solidjsweb.escape)(i18n_.view_less_())),
7305
+ rows_per_click: 3
7306
+ };
7307
+ (0, $5vyXB$solidjs.createComputed)((0, $5vyXB$solidjs.on)(get_currently_visible, new_visible => set_showing_content_results_rows(new_visible), {
7308
+ defer: true
7309
+ }));
7310
+ (0, $5vyXB$solidjs.createComputed)((0, $5vyXB$solidjs.on)(get_showing_content_results_rows, (new_rows = $3716b8caf7f959e2$export$70ceae36059a1036) => set_currently_visible(new_rows), {
7311
+ defer: true
7312
+ }));
7313
+ return rows;
7314
+ }
6734
7315
  const $f1d7cb69f839a526$var$_tmpl$ = ["<div", ' class="filter-results-for-one-row"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
6735
- $f1d7cb69f839a526$var$_tmpl$2 = ["<div", ' class="depict plp search"><div class="listing-page"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
7316
+ $f1d7cb69f839a526$var$_tmpl$2 = ["<div", ' class="depict plp search"><div class="listing-page"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
6736
7317
  function $f1d7cb69f839a526$export$a54ec244c8863715({
6737
7318
  depict_api_: depict_api_,
6738
7319
  search_field_value_: search_field_value_,
@@ -6761,7 +7342,11 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
6761
7342
  recommendations_layout_options_: recommendations_layout_options_,
6762
7343
  scroll_restoration_data_: scroll_restoration_data_,
6763
7344
  product_card_template_: product_card_template_,
6764
- modal_body_style_ref_: modal_body_style_ref_
7345
+ modal_body_style_ref_: modal_body_style_ref_,
7346
+ router_: router_,
7347
+ content_results_rows_: content_results_rows_,
7348
+ content_layout_options_: content_layout_options_,
7349
+ content_search_enabled_: content_search_enabled_
6765
7350
  }) {
6766
7351
  const [get_sorting] = current_sorting_;
6767
7352
  const all_products_loaded_ = (0, $5vyXB$solidjs.createSignal)(false);
@@ -6819,16 +7404,23 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
6819
7404
  const SafeSearchField = (0, $5vyXB$depictaiutilishared.catchify)((0, $66b8b9a9613c141d$export$b94867ecbd698f21));
6820
7405
  const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $5vyXB$solidjs.createSignal)(false);
6821
7406
  const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $5vyXB$solidjs.createSignal)();
7407
+ const n_hits = (0, $5vyXB$solidjs.createMemo)(() => search_results_()?.n_hits);
6822
7408
  const formatted_number_of_results_ = (0, $0f400c3f7248d5f1$export$92f2da32c6e7e7ee)({
6823
- search_results_: search_results_,
7409
+ number_: n_hits,
6824
7410
  i18n_: i18n_
6825
7411
  });
6826
7412
  const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $5vyXB$solidjs.createSignal)();
6827
- const results_for = (0, $5vyXB$solidjsweb.createComponent)((0, $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf), {
7413
+ const no_results_text_ = (0, $5vyXB$solidjs.createMemo)(() => (search_results_()?.content_search_links?.length ? i18n_.no_products_ : i18n_.no_results_text_)());
7414
+ const results_for = (0, $5vyXB$solidjsweb.createComponent)((0, $65a0c4b1c2eb5d0b$export$9dd50d35b9d94fdf), (0, $5vyXB$solidjsweb.mergeProps)({
7415
+ get type() {
7416
+ return (0, $65a0c4b1c2eb5d0b$export$2452208c79fe93ea).products;
7417
+ },
7418
+ number_of_results_: n_hits
7419
+ }, {
6828
7420
  get_search_query_: get_search_query_,
6829
7421
  i18n_: i18n_,
6830
7422
  formatted_number_of_results_: formatted_number_of_results_
6831
- });
7423
+ }));
6832
7424
  const filters_opener = (0, $f8f64d05c525825b$export$d7841e452f2e59a8)({
6833
7425
  set_sort_or_filter_open_: set_sort_or_filter_open_,
6834
7426
  set_extra_els_in_results_container_: set_desktop_filter_elements,
@@ -6931,7 +7523,28 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
6931
7523
  children: make_category_suggestion_card_
6932
7524
  });
6933
7525
  }
6934
- })) : (0, $5vyXB$solidjsweb.escape)(null), (0, $5vyXB$solidjsweb.escape)(results_filters[0]()), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
7526
+ })) : (0, $5vyXB$solidjsweb.escape)(null), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $edafe91daf3091d7$export$b69d0d92862de18b), {
7527
+ severity_: "error",
7528
+ message_: "ContentResults failed",
7529
+ get children() {
7530
+ return (0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
7531
+ get when() {
7532
+ return content_search_enabled_();
7533
+ },
7534
+ get children() {
7535
+ return (0, $5vyXB$solidjsweb.createComponent)((0, $3716b8caf7f959e2$export$6d0c9c22f6652669), {
7536
+ content_results_rows_: content_results_rows_,
7537
+ search_results_: search_results_,
7538
+ i18n_: i18n_,
7539
+ get_search_query_: get_search_query_,
7540
+ layout_options_: content_layout_options_,
7541
+ router_: router_,
7542
+ query_base_: search_query_base_
7543
+ });
7544
+ }
7545
+ });
7546
+ }
7547
+ })), (0, $5vyXB$solidjsweb.escape)(results_filters[0]()), (0, $5vyXB$solidjsweb.escape)((0, $5vyXB$solidjsweb.createComponent)((0, $5vyXB$solidjs.Show), {
6935
7548
  get when() {
6936
7549
  return selected_filters_[0]()?.length;
6937
7550
  },
@@ -6975,7 +7588,10 @@ function $f1d7cb69f839a526$export$a54ec244c8863715({
6975
7588
  selected_filters_: selected_filters_,
6976
7589
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
6977
7590
  local_filter_cache_: local_filter_cache_,
6978
- i18n_: i18n_
7591
+ i18n_: {
7592
+ ...i18n_,
7593
+ no_results_text_: no_results_text_
7594
+ }
6979
7595
  }
6980
7596
  });
6981
7597
  }
@@ -7049,6 +7665,27 @@ function $d8e94ea381ab57fa$export$828dcdd425fd3231(aligner) {
7049
7665
  cleanup: cleanup
7050
7666
  };
7051
7667
  }
7668
+
7669
+ /**
7670
+ * 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
7671
+ */
7672
+ function $ab7c6c7911bae2f5$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
7673
+ if (!sdk_cols_at_size.length) return sdk_cols_at_size;
7674
+ const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
7675
+ const [[, smallest_max_width]] = sorted_sizes;
7676
+ if (smallest_max_width > min_width_for_more_than_one_column)
7677
+ // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
7678
+ return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
7679
+ const to_delete = [];
7680
+ for (let i = 0; i < sorted_sizes.length; i++) {
7681
+ const [, max_width] = sorted_sizes[i];
7682
+ if (max_width > min_width_for_more_than_one_column) continue;
7683
+ to_delete.push(i);
7684
+ }
7685
+ while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
7686
+ sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
7687
+ return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
7688
+ }
7052
7689
  const $2c61e4cd8229c49a$var$_tmpl$ = ["<div", ' class="depict plp search">', "</div>"];
7053
7690
  // 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
7054
7691
  /**
@@ -7058,6 +7695,7 @@ const $2c61e4cd8229c49a$var$_tmpl$ = ["<div", ' class="depict plp search">', "</
7058
7695
  * 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.
7059
7696
  */
7060
7697
  const $2c61e4cd8229c49a$var$privately_shared_properties = /*@__PURE__*/new WeakMap();
7698
+ const $2c61e4cd8229c49a$var$content_search_default = false;
7061
7699
  const $2c61e4cd8229c49a$var$min_products_to_fetch_ = 20;
7062
7700
  const $2c61e4cd8229c49a$export$bde3eb976dfded9 = depict_search => $2c61e4cd8229c49a$var$privately_shared_properties.get(depict_search)?.search_query_updating_blocked_;
7063
7701
  class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
@@ -7065,6 +7703,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
7065
7703
  #merchant_signal = (0, $5vyXB$solidjs.createSignal)();
7066
7704
  #market_signal = (0, $5vyXB$solidjs.createSignal)();
7067
7705
  #modal_open_signal = (0, $5vyXB$solidjs.createSignal)(false);
7706
+ #content_search_signal = (0, $5vyXB$solidjs.createSignal)();
7068
7707
  static #keys_constructed_with = new Set();
7069
7708
  #router = new (0, $e96dd13889871fc0$export$7e1297a3a19f10d8)("hard_navigation");
7070
7709
  constructor({
@@ -7074,9 +7713,10 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
7074
7713
  on_navigation: on_navigation,
7075
7714
  enable_category_suggestions = true,
7076
7715
  page_url_creator: page_url_creator,
7716
+ display_transformers: display_transformers,
7717
+ api: api,
7077
7718
  // Stuff needed for non-standard customer deployments that we shouldn't actually expose
7078
7719
  disable_scrolling_during_modal = true,
7079
- api: api,
7080
7720
  bottom_distance_under_modal: bottom_distance_under_modal,
7081
7721
  render_instant_card: render_instant_card,
7082
7722
  ...props_on_class
@@ -7110,6 +7750,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
7110
7750
  local_filter_cache: [],
7111
7751
  expanded_hierarchical_filters: [],
7112
7752
  showing_recommendation_rows: (0, $fb29c6201c369e39$export$1c8c715550dc689d),
7753
+ content_results_rows: (0, $3716b8caf7f959e2$export$70ceae36059a1036),
7113
7754
  scroll_restoration_data: []
7114
7755
  }),
7115
7756
  router_: this.#router,
@@ -7120,12 +7761,18 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
7120
7761
  const get_search_query_ = (0, $5vyXB$solidjs.createMemo)(previous_value => {
7121
7762
  if (get_search_query_updating_blocked()) return previous_value;else return raw_search_query_accessor();
7122
7763
  });
7764
+ // @ts-ignore
7123
7765
  const depict_api_ = api ?? new (0, $e1d6c0f3d89d531c$export$e015ed2f2950f2e3)({
7124
- page_url_creator: page_url_creator
7766
+ page_url_creator: page_url_creator,
7767
+ display_transformers: display_transformers
7125
7768
  });
7126
7769
  const previous_searches = (0, $2b7a005a65221045$export$84bba84a7b837187)(get_search_query_);
7127
7770
  const [, set_search_showing_recommendation_rows] = state_.showing_recommendation_rows;
7128
- const after_submit_ = () => set_search_showing_recommendation_rows((0, $fb29c6201c369e39$export$1c8c715550dc689d)); // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
7771
+ const [, set_search_content_results_rows] = state_.content_results_rows;
7772
+ const after_submit_ = () => {
7773
+ set_search_showing_recommendation_rows((0, $fb29c6201c369e39$export$1c8c715550dc689d));
7774
+ set_search_content_results_rows((0, $3716b8caf7f959e2$export$70ceae36059a1036));
7775
+ }; // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
7129
7776
  const on_submit_with_unchanged_value_ = () => this.modal_open = false;
7130
7777
  const [get_search_field_value_, set_search_field_value_] = state_.field_value;
7131
7778
  const configured_submit_query_ = new_query => (0, $f328bd45f8ede33c$export$e16630ecb9644a1c)({
@@ -7183,6 +7830,7 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
7183
7830
  submit_query_: configured_submit_query_,
7184
7831
  url_transformer_: url_transformer,
7185
7832
  router_: this.#router,
7833
+ content_search_enabled_: () => this.#content_search_signal[0]() ?? $2c61e4cd8229c49a$var$content_search_default,
7186
7834
  instant_results_options_: {
7187
7835
  min_products_to_fetch_: $2c61e4cd8229c49a$var$min_products_to_fetch_,
7188
7836
  render_instant_card_: render_instant_card,
@@ -7247,6 +7895,12 @@ class $2c61e4cd8229c49a$export$ac6237957a15b3f0 {
7247
7895
  (0, $5vyXB$solidjs.onCleanup)(() => $2c61e4cd8229c49a$export$ac6237957a15b3f0.#keys_constructed_with.delete(unique_instance_key_for_state));
7248
7896
  });
7249
7897
  }
7898
+ get enable_content_search() {
7899
+ return this.#content_search_signal[0]();
7900
+ }
7901
+ set enable_content_search(new_state) {
7902
+ this.#content_search_signal[1](new_state);
7903
+ }
7250
7904
  get on_navigation() {
7251
7905
  // The only non-reactive public property on the class (I don't see it making sense to have it reactive)
7252
7906
  return this.#router.on_navigation_;
@@ -7328,6 +7982,7 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
7328
7982
  depict_api_: shared_properties.depict_api_,
7329
7983
  min_products_to_fetch_: $2c61e4cd8229c49a$var$min_products_to_fetch_,
7330
7984
  local_filter_cache_: state_.local_filter_cache,
7985
+ content_search_enabled_: () => depict_search.enable_content_search ?? $2c61e4cd8229c49a$var$content_search_default,
7331
7986
  search_field_value_: state_.field_value,
7332
7987
  get_search_query_: shared_properties.get_search_query_,
7333
7988
  clear_filters_on_next_submit_: shared_properties.clear_filters_on_next_submit_,
@@ -7354,6 +8009,8 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
7354
8009
  search_filters_open_: state_.filters_open,
7355
8010
  search_sorting_open_: state_.sorting_open,
7356
8011
  expanded_filters_: state_.expanded_filters,
8012
+ content_results_rows_: state_.content_results_rows,
8013
+ router_: shared_properties.router_,
7357
8014
  make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
7358
8015
  return (0, $dae23104ba8bb78c$export$d757d54550ebfb3d)({
7359
8016
  category_suggestion_: category_suggestion_,
@@ -7369,6 +8026,10 @@ function $2c61e4cd8229c49a$export$f2dc7e4e4aa11abb(props) {
7369
8026
  cols_at_size: (0, $4e04be41243c3d80$export$6daf8749b65a1b77)(props.cols_at_size),
7370
8027
  ...grid_spacing_override()
7371
8028
  })),
8029
+ content_layout_options_: (0, $5vyXB$solidjs.createMemo)(() => ({
8030
+ cols_at_size: (0, $4e04be41243c3d80$export$6daf8749b65a1b77)((0, $ab7c6c7911bae2f5$export$ff7109b9b2b206ba)(props.cols_at_size)),
8031
+ ...grid_spacing_override()
8032
+ })),
7372
8033
  recommendations_layout_options_: (0, $5vyXB$solidjs.createMemo)(() => {
7373
8034
  const {
7374
8035
  extra_depict_options: extra_depict_options