@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.
@@ -5,7 +5,7 @@ import { createSignal as $i7OB2$createSignal, createMemo as $i7OB2$createMemo, u
5
5
  /*! Depict.ai search and product listing SDK */
6
6
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
7
7
  register_es_version("ui", "latest");
8
- const $ec291e0010116877$export$83d89fbfd8236492 = "1.4.4";
8
+ const $ec291e0010116877$export$83d89fbfd8236492 = "1.4.5";
9
9
  function $24e27fab9c821b86$export$5bad61ecde080b1f(...params) {
10
10
  const {
11
11
  collapse: collapse,
@@ -365,7 +365,7 @@ function $1adfe60f3a14a1d7$export$fecbb157621501bd({
365
365
  return outmost_element;
366
366
  }
367
367
  const $87c712b5b33f24f7$var$_tmpl$ = ["<span", ' class="count">', "</span>"],
368
- $87c712b5b33f24f7$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", '><span class="custom-indicator"></span><span class="text">', "</span></div><!--#-->", "<!--/--></label>"];
368
+ $87c712b5b33f24f7$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", '><span class="custom-indicator"></span><span class="text line-clamp">', "</span></div><!--#-->", "<!--/--></label>"];
369
369
  const $87c712b5b33f24f7$export$48513f6b9f8ce62d = props => {
370
370
  // 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
371
371
  const count = (0, $i7OB2$createMemo)(() => props.count_);
@@ -1856,9 +1856,14 @@ function $c8d5ff4524619fcd$var$ActualSolidLayout(props, container_element) {
1856
1856
  // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
1857
1857
  const show_all_rows = (0, $i7OB2$createMemo)(() => props.rows === "all");
1858
1858
  const rows_or_empty_object = (0, $i7OB2$createMemo)(() => show_all_rows() ? {} : props.rows);
1859
- const button_elements = (0, $a52235d12ccf9c88$export$2f0cbfbb4354bb52)((0, $i7OB2$createMemo)(() => rows_or_empty_object().button));
1860
- const have_a_button = (0, $i7OB2$createMemo)(() => {
1861
- const button = button_elements();
1859
+ const view_more_button_elements = (0, $a52235d12ccf9c88$export$2f0cbfbb4354bb52)((0, $i7OB2$createMemo)(() => rows_or_empty_object().button));
1860
+ const view_less_button_elements = (0, $a52235d12ccf9c88$export$2f0cbfbb4354bb52)((0, $i7OB2$createMemo)(() => rows_or_empty_object().view_less_button));
1861
+ const have_a_view_more_button = (0, $i7OB2$createMemo)(() => {
1862
+ const button = view_more_button_elements();
1863
+ return !(!button || Array.isArray(button) && !button.length);
1864
+ });
1865
+ const have_a_view_less_button = (0, $i7OB2$createMemo)(() => {
1866
+ const button = view_less_button_elements();
1862
1867
  return !(!button || Array.isArray(button) && !button.length);
1863
1868
  });
1864
1869
  const [get_styling, set_styling] = (0, $i7OB2$createSignal)();
@@ -1867,12 +1872,15 @@ function $c8d5ff4524619fcd$var$ActualSolidLayout(props, container_element) {
1867
1872
  const [get_children_count, set_children_count] = (0, $i7OB2$createSignal)(0);
1868
1873
  const update_children_count = () => set_children_count(container_element.children.length);
1869
1874
  const col_styling = (0, $i7OB2$createMemo)(() => (0, $i7OB2$n_col_styling_with_dist)(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
1870
- const default_currently_visible_signal = (0, $i7OB2$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
1875
+ const default_currently_visible_signal = (0, $i7OB2$createSignal)((0, $i7OB2$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
1871
1876
  const rows_visible_signal = (0, $i7OB2$createMemo)(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
1872
1877
  const get_rows_visible = (0, $i7OB2$createMemo)(() => rows_visible_signal()[0]());
1873
1878
  const set_rows_visible = (0, $i7OB2$createMemo)(() => rows_visible_signal()[1]);
1874
- const button_class = (0, $i7OB2$make_random_classname)();
1875
- const button_container = (0, $i7OB2$createMemo)(() => have_a_button() && (0, $i7OB2$ssr)($c8d5ff4524619fcd$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)(), "load-more-container " + (0, $i7OB2$escape)(button_class, true), (0, $i7OB2$escape)(rows_or_empty_object().button)));
1879
+ const view_more_button_class = (0, $i7OB2$make_random_classname)();
1880
+ const view_less_button_class = (0, $i7OB2$make_random_classname)();
1881
+ const view_more_button_container = (0, $i7OB2$createMemo)(() => have_a_view_more_button() && (0, $i7OB2$ssr)($c8d5ff4524619fcd$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)(), `load-more-container ${(0, $i7OB2$escape)(view_more_button_class, true)}`, (0, $i7OB2$escape)(rows_or_empty_object().button)));
1882
+ // 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
1883
+ const view_less_button_container = (0, $i7OB2$createMemo)(() => have_a_view_less_button() && (0, $i7OB2$ssr)($c8d5ff4524619fcd$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)(), `load-less-container ${(0, $i7OB2$escape)(view_less_button_class, true)}`, (0, $i7OB2$escape)(rows_or_empty_object().view_less_button)));
1876
1884
  container_element.classList.add(container_class);
1877
1885
  (0, $i7OB2$createComputed)(() => {
1878
1886
  // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
@@ -1887,7 +1895,6 @@ function $c8d5ff4524619fcd$var$ActualSolidLayout(props, container_element) {
1887
1895
  set_styling(() => col_styling);
1888
1896
  return;
1889
1897
  }
1890
- (0, $i7OB2$untrack)(() => set_rows_visible()(rows_or_empty_object().start_rows ?? 1));
1891
1898
  update_children_count();
1892
1899
  const mutation_observer = new MutationObserver((0, $i7OB2$catchify)(update_children_count));
1893
1900
  mutation_observer.observe(container_element, {
@@ -1899,30 +1906,33 @@ function $c8d5ff4524619fcd$var$ActualSolidLayout(props, container_element) {
1899
1906
  () => (0, $i7OB2$createMemo)(() => {
1900
1907
  const {
1901
1908
  rows_per_click: rows_per_click,
1902
- max_rows = -1
1909
+ max_rows = -1,
1910
+ start_rows: start_rows
1903
1911
  } = rows_or_empty_object();
1904
1912
  const rows_visible = get_rows_visible();
1905
1913
  const children_count = get_children_count();
1906
1914
  return col_styling() + props.cols_at_size.map(options => {
1907
- const [, min, max] = options;
1908
- let should_hide_button;
1915
+ const [recs_per_row, min, max] = options;
1916
+ let should_hide_view_more_button;
1909
1917
  let visible_recs;
1910
1918
  if (props.disable_partial_rows) {
1911
1919
  visible_recs = (0, $i7OB2$layout_get_visible_recs_without_partial_rows)(rows_visible, children_count, options);
1912
1920
  const visible_recs_next_show_more = (0, $i7OB2$layout_get_visible_recs_without_partial_rows)(rows_visible + (rows_per_click || 0),
1913
1921
  // Should this really be zero when we default rows_per_click to 1?
1914
1922
  children_count, options);
1915
- should_hide_button = visible_recs === visible_recs_next_show_more;
1923
+ should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
1916
1924
  } else {
1917
1925
  visible_recs = (0, $i7OB2$layout_get_total_rec_amount_for_row)(rows_visible, options);
1918
- should_hide_button = visible_recs >= children_count;
1926
+ should_hide_view_more_button = visible_recs >= children_count;
1919
1927
  }
1920
- const should_hide_button_final = button_class && (should_hide_button || max_rows !== -1 && rows_visible >= max_rows);
1921
- return `${(0, $i7OB2$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}` : ``}}`;
1928
+ const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
1929
+ // 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
1930
+ 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;
1931
+ return `${(0, $i7OB2$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}` : ``}}`;
1922
1932
  }).join("");
1923
1933
  }));
1924
1934
  });
1925
- return [container_element, button_container(), (0, $i7OB2$ssr)($c8d5ff4524619fcd$var$_tmpl$2, (0, $i7OB2$ssrHydrationKey)(), get_styling)];
1935
+ return [container_element, view_more_button_container(), view_less_button_container(), (0, $i7OB2$ssr)($c8d5ff4524619fcd$var$_tmpl$2, (0, $i7OB2$ssrHydrationKey)(), get_styling)];
1926
1936
  }
1927
1937
  async function $194bd6b8e4c59830$export$79b1565500412d9b(search_modal, modal_fn_opts) {
1928
1938
  const body = await (0, $i7OB2$observer).wait_for_element("body");
@@ -2114,14 +2124,18 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
2114
2124
  }
2115
2125
  }
2116
2126
  async #run_url_creator_for_suggest(merchant, market, response) {
2117
- if (!this.page_url_creator) return response;
2127
+ const page_url_creator = this.page_url_creator;
2128
+ const category_transformer = this.display_transformers?.categories;
2129
+ if (!page_url_creator && !category_transformer) return response;
2118
2130
  // find category suggestions, run thing with them, and then replace them
2119
2131
  const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "category");
2120
- const page_urls = await this.page_url_creator({
2121
- type: "categories",
2132
+ const page_urls = await (page_url_creator || category_transformer)({
2122
2133
  market: market,
2123
2134
  merchant: merchant,
2124
- data: [...category_suggestions]
2135
+ data: [...category_suggestions],
2136
+ ...(page_url_creator ? {
2137
+ type: "categories"
2138
+ } : {})
2125
2139
  });
2126
2140
  this.#guard_url_creator_length(category_suggestions, page_urls);
2127
2141
  while (page_urls.length)
@@ -2129,17 +2143,29 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
2129
2143
  Object.defineProperties(category_suggestions.pop(), Object.getOwnPropertyDescriptors(page_urls.pop()));
2130
2144
  return response;
2131
2145
  }
2132
- async #run_url_creator_for_rest(merchant, market, input_data) {
2133
- if (!this.page_url_creator) return input_data;
2146
+ async #run_display_transformers_for_rest(merchant, market, input_data) {
2147
+ const {
2148
+ page_url_creator: page_url_creator,
2149
+ display_transformers: display_transformers
2150
+ } = this;
2151
+ if (!page_url_creator && !display_transformers) return input_data;
2152
+ const product_transformer = display_transformers?.products;
2153
+ const category_transformer = display_transformers?.categories;
2154
+ const content_result_transformer = display_transformers?.contentResults;
2134
2155
  const displays = input_data.displays;
2135
- const breadcrumb = input_data.breadcrumb;
2136
- const quick_links = input_data.quick_links;
2137
- if (displays) {
2138
- const page_urls = await this.page_url_creator({
2139
- type: "products",
2156
+ const {
2157
+ breadcrumb: breadcrumb,
2158
+ quick_links: quick_links,
2159
+ content_search_links: content_search_links
2160
+ } = input_data;
2161
+ if (displays && (page_url_creator || product_transformer)) {
2162
+ const page_urls = await (page_url_creator || product_transformer)({
2140
2163
  merchant: merchant,
2141
2164
  market: market,
2142
- displays: [...input_data.displays]
2165
+ displays: [...input_data.displays],
2166
+ ...(page_url_creator ? {
2167
+ type: "products"
2168
+ } : {})
2143
2169
  });
2144
2170
  this.#guard_url_creator_length(displays, page_urls);
2145
2171
  for (let i = 0; i < displays.length; i++) {
@@ -2157,19 +2183,30 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
2157
2183
  displays[i] = new_display_or_page_url;
2158
2184
  }
2159
2185
  }
2160
- for (const category_display_array of [breadcrumb, quick_links]) {
2186
+ if (page_url_creator || category_transformer) for (const category_display_array of [breadcrumb, quick_links]) {
2161
2187
  if (!category_display_array) continue;
2162
- const page_urls = await this.page_url_creator({
2163
- type: "categories",
2188
+ const page_urls = await (page_url_creator || category_transformer)({
2164
2189
  merchant: merchant,
2165
2190
  market: market,
2166
- data: [...category_display_array]
2191
+ data: [...category_display_array],
2192
+ ...(page_url_creator ? {
2193
+ type: "categories"
2194
+ } : {})
2167
2195
  });
2168
2196
  this.#guard_url_creator_length(category_display_array, page_urls);
2169
2197
  for (let i = 0; i < category_display_array.length; i++)
2170
2198
  // Copy over getters so we sneakily can make this reactive
2171
2199
  Object.defineProperties(category_display_array[i], Object.getOwnPropertyDescriptors(page_urls[i]));
2172
2200
  }
2201
+ if (content_search_links?.length && content_result_transformer) {
2202
+ const result = await content_result_transformer({
2203
+ merchant: merchant,
2204
+ market: market,
2205
+ data: [...content_search_links]
2206
+ });
2207
+ this.#guard_url_creator_length(content_search_links, result);
2208
+ input_data.content_search_links = result;
2209
+ }
2173
2210
  return input_data;
2174
2211
  }
2175
2212
  async #cached_post_request(endpoint, input_req, fallback_response) {
@@ -2196,7 +2233,7 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
2196
2233
  let result;
2197
2234
  try {
2198
2235
  const unmodified_result = await api_response.json();
2199
- result = await this.#run_url_creator_for_rest(input_req.tenant, input_req.market, unmodified_result);
2236
+ result = await this.#run_display_transformers_for_rest(input_req.tenant, input_req.market, unmodified_result);
2200
2237
  } catch (e) {
2201
2238
  (0, $i7OB2$dwarn)("URL creator or json decoding failed", e);
2202
2239
  break return_successfully;
@@ -2228,12 +2265,14 @@ class $7fa23e2a0079eca4$export$e015ed2f2950f2e3 {
2228
2265
  get_metadata: get_metadata,
2229
2266
  get_user_id: get_user_id,
2230
2267
  get_session_id: get_session_id,
2231
- page_url_creator: page_url_creator
2268
+ page_url_creator: page_url_creator,
2269
+ display_transformers: display_transformers
2232
2270
  } = options ?? {};
2233
2271
  this.#get_metadata = get_metadata;
2234
2272
  this.#get_user_id = get_user_id;
2235
2273
  this.#get_session_id = get_session_id;
2236
2274
  this.page_url_creator = page_url_creator;
2275
+ this.display_transformers = display_transformers;
2237
2276
  }
2238
2277
  async suggest(input_req) {
2239
2278
  const with_ids = this.#add_ids_to_request(input_req);
@@ -2343,11 +2382,11 @@ function $fc5a12f3a857ca30$var$correct_range_filter_range_once({
2343
2382
  }
2344
2383
  }
2345
2384
  function $511cc0abd9a64ce8$export$92f2da32c6e7e7ee({
2346
- search_results_: search_results_,
2385
+ number_: number_,
2347
2386
  i18n_: i18n_
2348
2387
  }) {
2349
2388
  return (0, $i7OB2$createMemo)(() => {
2350
- const n_hits = search_results_()?.n_hits;
2389
+ const n_hits = number_();
2351
2390
  if (isNaN(n_hits)) return "";
2352
2391
  const price_formatting = i18n_.price_formatting_();
2353
2392
  return (0, $i7OB2$standard_price_format)(n_hits, 0,
@@ -4436,7 +4475,7 @@ function $df5d81d0fe61ff21$export$f7d2f673fc2f091d({
4436
4475
  const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $i7OB2$createSignal)(false);
4437
4476
  const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $i7OB2$createSignal)();
4438
4477
  const formatted_number_of_results_ = (0, $511cc0abd9a64ce8$export$92f2da32c6e7e7ee)({
4439
- search_results_: plp_results_,
4478
+ number_: (0, $i7OB2$createMemo)(() => plp_results_()?.n_hits),
4440
4479
  i18n_: i18n_
4441
4480
  });
4442
4481
  const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $i7OB2$createSignal)();
@@ -4968,7 +5007,6 @@ class $4fd2ba03703a7d92$export$7e1297a3a19f10d8 {
4968
5007
  }
4969
5008
  const $961b5c64bef4662f$var$_tmpl$ = ["<div", ' class="depict plp category">', "</div>"];
4970
5009
  // 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
4971
- // on old displays, no page_url_creator can be specified
4972
5010
  /**
4973
5011
  * Type for the private properties that are shared between the different exported search SDK wrapper functions.
4974
5012
  * SDK users are not allowed to change/access these, they're an internal implementation detail.
@@ -5028,6 +5066,7 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
5028
5066
  api: api,
5029
5067
  on_navigation: on_navigation,
5030
5068
  page_url_creator: page_url_creator,
5069
+ display_transformers: display_transformers,
5031
5070
  unique_instance_key_for_state = "",
5032
5071
  query_id_state_key: query_id_state_key,
5033
5072
  ...props_on_class
@@ -5072,8 +5111,10 @@ class $961b5c64bef4662f$export$f34314aa9505732e {
5072
5111
  quicklinks_signal_: (0, $i7OB2$createSignal)(),
5073
5112
  i18n_: i18n_,
5074
5113
  reset_history_state_: reset_history_state_,
5114
+ // @ts-ignore
5075
5115
  depict_api_: api ?? new (0, $7fa23e2a0079eca4$export$e015ed2f2950f2e3)({
5076
- page_url_creator: page_url_creator
5116
+ page_url_creator: page_url_creator,
5117
+ display_transformers: display_transformers
5077
5118
  }),
5078
5119
  router_: this.#router,
5079
5120
  selected_filters_: selected_filters_,
@@ -5532,11 +5573,11 @@ function $172e1b898d457050$export$7de92c4c2205ebf3({
5532
5573
  });
5533
5574
  }
5534
5575
  function $172e1b898d457050$var$make_state_saved_rows([get_showing_recommendation_rows, set_showing_recommendation_rows], i18n_) {
5535
- const currently_visible = (0, $i7OB2$createSignal)(0); // this number shouldn't matter for anything except typing
5576
+ const currently_visible = (0, $i7OB2$createSignal)((0, $i7OB2$untrack)(get_showing_recommendation_rows));
5536
5577
  const [get_currently_visible, set_currently_visible] = currently_visible;
5537
5578
  const rows = {
5538
5579
  currently_visible: currently_visible,
5539
- start_rows: (0, $i7OB2$untrack)(get_showing_recommendation_rows) ?? $172e1b898d457050$export$1c8c715550dc689d,
5580
+ start_rows: $172e1b898d457050$export$1c8c715550dc689d,
5540
5581
  rows_per_click: 3,
5541
5582
  button: (0, $i7OB2$ssr)($172e1b898d457050$var$_tmpl$2, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)(i18n_.view_more_()))
5542
5583
  };
@@ -5698,7 +5739,7 @@ const $c97b1f0e44afb9d2$export$27b710c08412a7ad = obj => {
5698
5739
  return Object.fromEntries(Object.keys(obj).map(key => [key, obj[key]()]));
5699
5740
  };
5700
5741
  const $e003be2a50d9e5bc$var$_tmpl$ = ["<span", ' class="orig price"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span>"],
5701
- $e003be2a50d9e5bc$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>"],
5742
+ $e003be2a50d9e5bc$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>"],
5702
5743
  $e003be2a50d9e5bc$var$_tmpl$3 = ["<div", ' class="tagline">', "</div>"];
5703
5744
  const $e003be2a50d9e5bc$export$b05c0ae390cf3e06 = (display_or_variant_container, {
5704
5745
  i18n: i18n
@@ -5767,9 +5808,11 @@ function $eea41f703612261b$export$62f101a8aa597bf8({
5767
5808
  render_instant_card_placeholder_: render_instant_card_placeholder_,
5768
5809
  min_products_to_fetch_: min_products_to_fetch_,
5769
5810
  has_sort_or_filters_: has_sort_or_filters_,
5770
- set_num_results_accessor_: set_num_results_accessor_,
5811
+ set_total_num_results_accessor_: set_total_num_results_accessor_,
5771
5812
  i18n_: i18n_,
5772
- router_: router_
5813
+ router_: router_,
5814
+ set_modal_search_results_: set_modal_search_results_,
5815
+ content_search_enabled_: content_search_enabled_
5773
5816
  }) {
5774
5817
  const max_cards = 4;
5775
5818
  const [read_current_instant_query, write_current_instant_query] = (0, $i7OB2$createSignal)("");
@@ -5794,8 +5837,17 @@ function $eea41f703612261b$export$62f101a8aa597bf8({
5794
5837
  ...variable_data
5795
5838
  });
5796
5839
  }));
5797
- set_num_results_accessor_(() => (0, $511cc0abd9a64ce8$export$92f2da32c6e7e7ee)({
5798
- search_results_: search_results,
5840
+ // 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
5841
+ // This is for the press-enter-to-instant-content-result feature which gets called from Autocomplete.tsx
5842
+ set_modal_search_results_(() => search_results);
5843
+ (0, $i7OB2$onCleanup)(() => set_modal_search_results_(undefined)); // for consistency, in case this component crashes
5844
+ set_total_num_results_accessor_(() => (0, $511cc0abd9a64ce8$export$92f2da32c6e7e7ee)({
5845
+ number_: (0, $i7OB2$createMemo)(() => {
5846
+ const hits = search_results()?.n_hits;
5847
+ const content_results = search_results()?.content_search_links?.length;
5848
+ if (!content_results || !content_search_enabled_()) return hits;
5849
+ return (hits ?? 0) + content_results;
5850
+ }),
5799
5851
  i18n_: i18n_
5800
5852
  }));
5801
5853
  const sliced_displays = (0, $i7OB2$createMemo)(() => search_results()?.displays?.slice(0, max_cards));
@@ -5860,7 +5912,7 @@ function $694b7f90501fea4c$export$5d2caaa6b530761c() {
5860
5912
  return (0, $i7OB2$ssr)($694b7f90501fea4c$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)());
5861
5913
  }
5862
5914
  const $7ad3a93cbe6fa208$var$_tmpl$ = ["<div", ' class="previous-searches"><h2 class="text">', '</h2><div class="list">', "</div></div>"],
5863
- $7ad3a93cbe6fa208$var$_tmpl$2 = ["<a", ' class="', '"', '><div class="left"><!--#-->', "<!--/--><span>", '</span></div><button class="delete"', ">", "</button></a>"];
5915
+ $7ad3a93cbe6fa208$var$_tmpl$2 = ["<a", ' class="', '"', '><div class="left"><!--#-->', '<!--/--><span class="line-clamp"', ">", '</span></div><button class="delete"', ">", "</button></a>"];
5864
5916
  function $7ad3a93cbe6fa208$export$a146ac6fa8346a25({
5865
5917
  text_: text_,
5866
5918
  previous_searches_: previous_searches_,
@@ -5900,14 +5952,14 @@ function $7ad3a93cbe6fa208$export$a146ac6fa8346a25({
5900
5952
  value_: item,
5901
5953
  url_transformer_: url_transformer_
5902
5954
  });
5903
- return (0, $i7OB2$ssr)($7ad3a93cbe6fa208$var$_tmpl$2, (0, $i7OB2$ssrHydrationKey)(), `${`item` || ""} ${(0, $i7OB2$createMemo)(() => read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)() ? "selected" : ""}`, (0, $i7OB2$ssrAttribute)("href", (0, $i7OB2$escape)(href(), true), false), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $694b7f90501fea4c$export$5d2caaa6b530761c), {})), (0, $i7OB2$escape)(item()), (0, $i7OB2$ssrAttribute)("title", (0, $i7OB2$escape)(i18n_.previous_searches_delete_entry_from_history_(), true), false), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $19976a74d273070d$export$3b621d86b1566b2), {})));
5955
+ return (0, $i7OB2$ssr)($7ad3a93cbe6fa208$var$_tmpl$2, (0, $i7OB2$ssrHydrationKey)(), `${`item` || ""} ${(0, $i7OB2$createMemo)(() => read_selected_index_()?.[0] === 0 && read_selected_index_()?.[1] === index)() ? "selected" : ""}`, (0, $i7OB2$ssrAttribute)("href", (0, $i7OB2$escape)(href(), true), false), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $694b7f90501fea4c$export$5d2caaa6b530761c), {})), (0, $i7OB2$ssrAttribute)("title", (0, $i7OB2$escape)(item(), true), false), (0, $i7OB2$escape)(item()), (0, $i7OB2$ssrAttribute)("title", (0, $i7OB2$escape)(i18n_.previous_searches_delete_entry_from_history_(), true), false), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $19976a74d273070d$export$3b621d86b1566b2), {})));
5904
5956
  }
5905
5957
  })));
5906
5958
  }
5907
5959
  });
5908
5960
  }
5909
5961
  const $f3213c0640246d58$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"],
5910
- $f3213c0640246d58$var$_tmpl$2 = ["<span", ' class="', '">', "</span>"];
5962
+ $f3213c0640246d58$var$_tmpl$2 = ["<span", ' class="', '"', ">", "</span>"];
5911
5963
  function $f3213c0640246d58$export$ba17c5b7e6dda39f({
5912
5964
  whole_text_to_display_: whole_text_to_display_memo,
5913
5965
  searching_for_value_: searching_for_value_memo,
@@ -5957,16 +6009,27 @@ function $f3213c0640246d58$export$ba17c5b7e6dda39f({
5957
6009
  }
5958
6010
  return output;
5959
6011
  }));
5960
- return (0, $i7OB2$ssr)($f3213c0640246d58$var$_tmpl$2, (0, $i7OB2$ssrHydrationKey)(), `${(0, $i7OB2$escape)(class_, true) || ""} ${get_has_highlighted() ? "has-history-match" : ""}`, (0, $i7OB2$escape)(text_itself()));
6012
+ return (0, $i7OB2$ssr)($f3213c0640246d58$var$_tmpl$2, (0, $i7OB2$ssrHydrationKey)(), `${(0, $i7OB2$escape)(class_, true) || ""} ${get_has_highlighted() ? "has-history-match" : ""}`, (0, $i7OB2$ssrAttribute)("title", (0, $i7OB2$escape)(whole_text_to_display_memo(), true), false), (0, $i7OB2$escape)(text_itself()));
6013
+ }
6014
+ const $190927650b4840eb$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>';
6015
+ function $190927650b4840eb$export$605674723bcc715c(props = {}) {
6016
+ return (0, $i7OB2$ssrElement)("svg", () => ({
6017
+ "xmlns": "http://www.w3.org/2000/svg",
6018
+ "width": "32",
6019
+ "height": "32",
6020
+ "viewBox": "0 0 256 256",
6021
+ ...props
6022
+ }), () => (0, $i7OB2$ssr)($190927650b4840eb$var$_tmpl$), true);
5961
6023
  }
5962
6024
  const $cea52f6b24092f05$var$_tmpl$ = ["<a", ' class="', '"', ">", "</a>"],
5963
6025
  $cea52f6b24092f05$var$_tmpl$2 = ["<div", ' class="search-icon">', "</div>"],
5964
6026
  $cea52f6b24092f05$var$_tmpl$3 = ["<span", ' class="type">', "</span>"],
5965
6027
  $cea52f6b24092f05$var$_tmpl$4 = ["<div", "><!--#-->", '<!--/--><span class="value">', "</span></div>"],
5966
- $cea52f6b24092f05$var$_tmpl$5 = ["<h2", ' class="text">', "</h2>"],
5967
- $cea52f6b24092f05$var$_tmpl$6 = ["<div", ' class="suggestion-container query"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
5968
- $cea52f6b24092f05$var$_tmpl$7 = ["<div", ' class="suggestion-container page">', "</div>"],
5969
- $cea52f6b24092f05$var$_tmpl$8 = ["<div", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
6028
+ $cea52f6b24092f05$var$_tmpl$5 = ["<div", ' class="with-icon"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
6029
+ $cea52f6b24092f05$var$_tmpl$6 = ["<h2", ' class="text">', "</h2>"],
6030
+ $cea52f6b24092f05$var$_tmpl$7 = ["<div", ' class="suggestion-container query"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
6031
+ $cea52f6b24092f05$var$_tmpl$8 = ["<div", ' class="suggestion-container page">', "</div>"],
6032
+ $cea52f6b24092f05$var$_tmpl$9 = ["<div", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
5970
6033
  function $cea52f6b24092f05$export$e872e2339fb04a7f({
5971
6034
  suggestion_memo_: suggestion_memo_,
5972
6035
  search_query_url_param_name_: search_query_url_param_name_,
@@ -5979,7 +6042,8 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
5979
6042
  include_category_suggestions_: include_category_suggestions_,
5980
6043
  searching_for_value_: searching_for_value_,
5981
6044
  router_: router_,
5982
- submit_query_: submit_query_
6045
+ submit_query_: submit_query_,
6046
+ get_content_results_: get_content_results_
5983
6047
  }) {
5984
6048
  const queries_memo = (0, $i7OB2$createMemo)(() => suggestion_memo_().filter(({
5985
6049
  type: type,
@@ -5987,9 +6051,15 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
5987
6051
  }) => type === (0, $a0eb8b431ec1f87b$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title) // don't show the ones we already show from the history
5988
6052
  ));
5989
6053
 
5990
- const not_queries_memo = (0, $i7OB2$createMemo)(() => suggestion_memo_().filter(({
5991
- type: type
5992
- }) => type !== (0, $a0eb8b431ec1f87b$export$3cf9497e790da491)));
6054
+ const not_queries_memo = (0, $i7OB2$createMemo)(() => {
6055
+ // For the section that shows categories and content results
6056
+ // We want to limit to 3 items, and we want to show the categories first
6057
+ const content_results = get_content_results_() || [];
6058
+ const from_suggest_request = include_category_suggestions_ ? suggestion_memo_().filter(({
6059
+ type: type
6060
+ }) => type !== (0, $a0eb8b431ec1f87b$export$3cf9497e790da491)) : [];
6061
+ return [...from_suggest_request.slice(0, content_results.length ? 2 : 3), ...content_results.slice(0, 1)];
6062
+ });
5993
6063
  const render_entry = (input_obj, autocomplete_data_index, index, is_history = false) => {
5994
6064
  const is_query = (0, $i7OB2$createMemo)(() => input_obj().type === (0, $a0eb8b431ec1f87b$export$3cf9497e790da491));
5995
6065
  const href_with_changed_params_accessor = (0, $i7OB2$createMemo)(() => is_query() ? (0, $a36cbc4f68bfd590$export$91c3b6774e8be0f5)({
@@ -5998,7 +6068,8 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
5998
6068
  url_transformer_: url_transformer_
5999
6069
  }) : undefined);
6000
6070
  const href = (0, $i7OB2$createMemo)(() => is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
6001
- return (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)(), `suggestion ${(0, $i7OB2$createMemo)(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index)() ? "selected" : ""} ${is_history ? "history" : ""} ${(0, $i7OB2$escape)((0, $i7OB2$escape)("type-" + input_obj().type, true), true)}`, (0, $i7OB2$ssrAttribute)("href", (0, $i7OB2$escape)(href(), true), false), is_query() ? (0, $i7OB2$escape)([(0, $i7OB2$createComponent)((0, $i7OB2$Show), {
6071
+ const is_selected = (0, $i7OB2$createMemo)(() => read_selected_index_()?.[0] === autocomplete_data_index && read_selected_index_()?.[1] === index);
6072
+ return (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)(), `suggestion ${is_selected() ? "selected" : ""} ${is_history ? "history" : ""} ${(0, $i7OB2$escape)((0, $i7OB2$escape)("type-" + input_obj().type, true), true)}`, (0, $i7OB2$ssrAttribute)("href", (0, $i7OB2$escape)(href(), true), false), is_query() ? (0, $i7OB2$escape)([(0, $i7OB2$createComponent)((0, $i7OB2$Show), {
6002
6073
  when: is_history,
6003
6074
  get fallback() {
6004
6075
  return (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$2, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $16f0ed5ea30d8d9c$export$82eafebb825fc23f), {})));
@@ -6007,24 +6078,34 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
6007
6078
  return (0, $i7OB2$createComponent)((0, $694b7f90501fea4c$export$5d2caaa6b530761c), {});
6008
6079
  }
6009
6080
  }), (0, $i7OB2$createComponent)((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
6010
- class_: "value",
6081
+ class_: "value line-clamp",
6082
+ get whole_text_to_display_() {
6083
+ return (0, $i7OB2$createMemo)(() => input_obj().title);
6084
+ },
6085
+ searching_for_value_: searching_for_value_
6086
+ })]) : (0, $i7OB2$escape)([typeof input_obj() /* this is a harmless lie */.parent_title === "string" ? (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$4, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
6087
+ class_: "category line-clamp",
6011
6088
  get whole_text_to_display_() {
6012
6089
  return (0, $i7OB2$createMemo)(() => input_obj().title);
6013
6090
  },
6014
6091
  searching_for_value_: searching_for_value_
6015
- })]) : (0, $i7OB2$escape)([typeof input_obj().parent_title === "string" ? (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$4, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
6016
- class_: "category",
6092
+ })), (0, $i7OB2$escape)(input_obj().parent_title)) : input_obj().type === "content" ? (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$5, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $190927650b4840eb$export$605674723bcc715c), {
6093
+ width: "16",
6094
+ height: "16"
6095
+ })), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
6096
+ class_: "content line-clamp",
6017
6097
  get whole_text_to_display_() {
6018
6098
  return (0, $i7OB2$createMemo)(() => input_obj().title);
6019
6099
  },
6020
6100
  searching_for_value_: searching_for_value_
6021
- })), (0, $i7OB2$escape)(input_obj().parent_title)) : (0, $i7OB2$createComponent)((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
6022
- class_: "category",
6101
+ }))) : (0, $i7OB2$createComponent)((0, $f3213c0640246d58$export$ba17c5b7e6dda39f), {
6102
+ class_: "category line-clamp",
6023
6103
  get whole_text_to_display_() {
6024
6104
  return (0, $i7OB2$createMemo)(() => input_obj().title);
6025
6105
  },
6026
6106
  searching_for_value_: searching_for_value_
6027
6107
  }), (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$3, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)((0, $i7OB2$createMemo)(() => {
6108
+ if (input_obj().type === "content") return i18n_.content_();
6028
6109
  if (input_obj().category_type === "BRAND") return i18n_.brand_();
6029
6110
  return i18n_.category_();
6030
6111
  })()))]));
@@ -6040,26 +6121,26 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
6040
6121
  }));
6041
6122
  };
6042
6123
  const should_show_previous_searches_in_query_part = (0, $i7OB2$createMemo)(() => !on_previous_searches_page_());
6043
- const should_show_at_all = (0, $i7OB2$createMemo)(() => suggestion_memo_()?.length || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length);
6124
+ const should_show_at_all = (0, $i7OB2$createMemo)(() => suggestion_memo_()?.length || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length || get_content_results_()?.length);
6044
6125
  const should_show_query_part = (0, $i7OB2$createMemo)(() => queries_memo().length || filtered_previous_searches_().length);
6045
6126
  return (0, $i7OB2$createComponent)((0, $i7OB2$Show), {
6046
6127
  get when() {
6047
6128
  return should_show_at_all();
6048
6129
  },
6049
6130
  get children() {
6050
- return (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$8, (0, $i7OB2$ssrHydrationKey)(), `suggestions ${on_previous_searches_page_() ? "compact" : ""}`, (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $i7OB2$Show), {
6131
+ return (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$9, (0, $i7OB2$ssrHydrationKey)(), `suggestions ${on_previous_searches_page_() ? "compact" : ""}`, (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $i7OB2$Show), {
6051
6132
  get when() {
6052
6133
  return on_previous_searches_page_();
6053
6134
  },
6054
6135
  get children() {
6055
- return (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$5, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)(i18n_.suggestions_()));
6136
+ return (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$6, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)(i18n_.suggestions_()));
6056
6137
  }
6057
6138
  })), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $i7OB2$Show), {
6058
6139
  get when() {
6059
6140
  return should_show_query_part();
6060
6141
  },
6061
6142
  get children() {
6062
- return (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$6, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $i7OB2$Show), {
6143
+ return (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$7, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $i7OB2$Show), {
6063
6144
  get when() {
6064
6145
  return should_show_previous_searches_in_query_part();
6065
6146
  },
@@ -6095,11 +6176,11 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
6095
6176
  }
6096
6177
  })), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $i7OB2$Show), {
6097
6178
  get when() {
6098
- return not_queries_memo().length && include_category_suggestions_;
6179
+ return not_queries_memo().length;
6099
6180
  },
6100
6181
  keyed: false,
6101
6182
  get children() {
6102
- return (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$7, (0, $i7OB2$ssrHydrationKey)(), (() => {
6183
+ return (0, $i7OB2$ssr)($cea52f6b24092f05$var$_tmpl$8, (0, $i7OB2$ssrHydrationKey)(), (() => {
6103
6184
  const index_in_autocomplete = 3;
6104
6185
  set_list_until_cleanup(not_queries_memo, index_in_autocomplete);
6105
6186
  return (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $i7OB2$Index), {
@@ -6114,7 +6195,18 @@ function $cea52f6b24092f05$export$e872e2339fb04a7f({
6114
6195
  }
6115
6196
  });
6116
6197
  }
6117
- const $15f380f0ce2812cc$var$_tmpl$ = ["<a", ' target="_blank"></a>'];
6198
+ const $92a48aea6a9364d8$var$_tmpl$ = ["<a", ' target="_blank"></a>'];
6199
+ function $92a48aea6a9364d8$export$1efe1013da60d0e4(e, href) {
6200
+ if (e.metaKey || e.ctrlKey) {
6201
+ // Open link in a new tab with cmd/ctrl + enter.
6202
+ const link = (0, $i7OB2$ssr)($92a48aea6a9364d8$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)() + (0, $i7OB2$ssrAttribute)("href", (0, $i7OB2$escape)(href, true), false));
6203
+ document.body.append(link);
6204
+ link.click();
6205
+ link.remove();
6206
+ return true;
6207
+ }
6208
+ return false;
6209
+ }
6118
6210
  function $15f380f0ce2812cc$export$217899a935ef803b({
6119
6211
  selected_index_: [read_selected_index, write_selected_index],
6120
6212
  currently_showing_suggestions_: [read_currently_showing_suggestions],
@@ -6188,6 +6280,7 @@ function $15f380f0ce2812cc$var$actual_navigation_working_on_fake_data({
6188
6280
  const sfv = get_search_field_value();
6189
6281
  if (!(0, $i7OB2$untrack)(() => read_updating_blocked())) previous_value = sfv;
6190
6282
  });
6283
+ const owner = (0, $i7OB2$getOwner)();
6191
6284
  const handler = (0, $i7OB2$catchify)(({
6192
6285
  keyCode: keyCode
6193
6286
  }) => (0, $i7OB2$untrack)(() => {
@@ -6218,29 +6311,29 @@ function $15f380f0ce2812cc$var$actual_navigation_working_on_fake_data({
6218
6311
  const {
6219
6312
  title: title
6220
6313
  } = selected_entry;
6221
- block_updating_for_one_change();
6314
+ (0, $i7OB2$runWithOwner)(owner, block_updating_for_one_change);
6222
6315
  set_search_field_value(title);
6223
- override_on_enter_for_this_entry(e => {
6316
+ (0, $i7OB2$runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
6224
6317
  // Open search query in new tab on cmd+enter
6225
6318
  // 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 ;)
6226
6319
  const url = new URL(location);
6227
6320
  url_transformer_?.(url);
6228
6321
  url.searchParams.set(search_query_param_name_, title);
6229
- return $15f380f0ce2812cc$var$open_link_on_cmd_pressed(e, url.href);
6230
- });
6231
- } else if (selected_entry?.type == "category") override_on_enter_for_this_entry(e => {
6322
+ return (0, $92a48aea6a9364d8$export$1efe1013da60d0e4)(e, url.href);
6323
+ }));
6324
+ } else if (selected_entry?.type == "category" || selected_entry?.type === "content") (0, $i7OB2$runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
6232
6325
  const {
6233
6326
  page_url: page_url
6234
6327
  } = selected_entry;
6235
- if (!$15f380f0ce2812cc$var$open_link_on_cmd_pressed(e, page_url))
6328
+ if (!(0, $92a48aea6a9364d8$export$1efe1013da60d0e4)(e, page_url))
6236
6329
  // Above fn will return true if it opened a new tab, and we won't make these checks anymore
6237
6330
  router_.navigate_.go_to_({
6238
6331
  new_url_: page_url,
6239
6332
  is_replace_: false
6240
6333
  });
6241
6334
  return true;
6242
- });else if (!selected_entry) {
6243
- block_updating_for_one_change();
6335
+ }));else if (!selected_entry) {
6336
+ (0, $i7OB2$runWithOwner)(owner, block_updating_for_one_change);
6244
6337
  set_search_field_value(previous_value);
6245
6338
  }
6246
6339
  }));
@@ -6251,16 +6344,37 @@ function $15f380f0ce2812cc$var$actual_navigation_working_on_fake_data({
6251
6344
  (0, $i7OB2$onCleanup)((0, $i7OB2$catchify)(() => el.removeEventListener("keyup", handler)));
6252
6345
  });
6253
6346
  }
6254
- function $15f380f0ce2812cc$var$open_link_on_cmd_pressed(e, href) {
6255
- if (e.metaKey || e.ctrlKey) {
6256
- // Open link in a new tab with cmd/ctrl + enter.
6257
- const link = (0, $i7OB2$ssr)($15f380f0ce2812cc$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)() + (0, $i7OB2$ssrAttribute)("href", (0, $i7OB2$escape)(href, true), false));
6258
- document.body.append(link);
6259
- link.click();
6260
- link.remove();
6261
- return true;
6262
- }
6263
- return false;
6347
+ function $1ae0eaca6ada9753$export$af0124069c150252({
6348
+ set_override_on_enter_fn_: set_override_on_enter_fn_,
6349
+ get_modal_search_results_: get_modal_search_results_,
6350
+ read_suggestion_signal_: read_suggestion_signal_,
6351
+ router_: router_,
6352
+ content_results_: content_results_
6353
+ }) {
6354
+ const [get_autocomplete_wants_override_function, set_autocomplete_wants_override_function] = (0, $i7OB2$createSignal)(() => false);
6355
+ (0, $i7OB2$createComputed)(() => {
6356
+ const suggestions = read_suggestion_signal_();
6357
+ const search_results = get_modal_search_results_()?.();
6358
+ const content_results = content_results_();
6359
+ // If we only have one content result and nothing else, go there when pressing enter
6360
+ if (!suggestions.length && !search_results?.displays?.length && content_results?.length === 1) {
6361
+ const [{
6362
+ page_url: page_url
6363
+ }] = content_results;
6364
+ set_override_on_enter_fn_(e => {
6365
+ if (!(0, $92a48aea6a9364d8$export$1efe1013da60d0e4)(e, page_url))
6366
+ // Above fn will return true if it opened a new tab, and we won't make these checks anymore
6367
+ router_.navigate_.go_to_({
6368
+ new_url_: page_url,
6369
+ is_replace_: false
6370
+ });
6371
+ return true;
6372
+ });
6373
+ return;
6374
+ }
6375
+ set_override_on_enter_fn_(get_autocomplete_wants_override_function());
6376
+ });
6377
+ return new_fn => set_autocomplete_wants_override_function(() => new_fn);
6264
6378
  }
6265
6379
  const $a0eb8b431ec1f87b$export$3cf9497e790da491 = "query";
6266
6380
  function $a0eb8b431ec1f87b$export$2f2b9559550c7bbc({
@@ -6280,12 +6394,15 @@ function $a0eb8b431ec1f87b$export$2f2b9559550c7bbc({
6280
6394
  i18n_: i18n_,
6281
6395
  include_category_suggestions_: include_category_suggestions_,
6282
6396
  submit_query_: submit_query_,
6283
- router_: router_
6397
+ router_: router_,
6398
+ get_modal_search_results_: get_modal_search_results_,
6399
+ content_search_enabled_: content_search_enabled_
6284
6400
  }) {
6285
6401
  const [searching_for_value, set_searching_for_value] = (0, $i7OB2$createSignal)();
6402
+ const [show_stale_content_results, set_show_stale_content_results] = (0, $i7OB2$createSignal)(false);
6286
6403
  const [read_search_field_value] = search_field_value_;
6287
6404
  const updating_blocked = (0, $i7OB2$createSignal)(false);
6288
- const [read_suggestion_signal, write_suggestion_signal] = (0, $i7OB2$createSignal)([]);
6405
+ const [read_suggestion_signal_, write_suggestion_signal] = (0, $i7OB2$createSignal)([]);
6289
6406
  const filtered_previous_searches = (0, $i7OB2$createMemo)(() => [...unfiltered_previous_searches[0]()].reverse().filter(q => q !== get_search_query_()));
6290
6407
  const deparallelized_fn = (0, $i7OB2$deparallelize_no_drop)(async request_obj => {
6291
6408
  const api_response = await depict_api_.suggest(request_obj);
@@ -6304,15 +6421,38 @@ function $a0eb8b431ec1f87b$export$2f2b9559550c7bbc({
6304
6421
  });
6305
6422
 
6306
6423
  const show_previous_searches_component = (0, $i7OB2$createMemo)(() => !read_search_field_value() || (0, $i7OB2$untrack)(updating_blocked[0]) && !(0, $i7OB2$untrack)(searching_for_value));
6424
+ const get_content_results_ = (0, $i7OB2$createMemo)(prev => {
6425
+ if (!content_search_enabled_()) return [];
6426
+ if (show_stale_content_results())
6427
+ // don't update content results when query suggestions don't update because otherwise they disappear when trying to keyboard navigate to them
6428
+ return prev;
6429
+ return get_modal_search_results_()?.()?.content_search_links?.map(link => ({
6430
+ page_url: link.page_url,
6431
+ type: "content",
6432
+ title: link.title
6433
+ }));
6434
+ });
6435
+ // 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.
6436
+ // It's the functionality to open the content results page when you press enter, in the modal, when there's only one content result
6437
+ const manipulated_set_override_on_enter_fn_ = (0, $1ae0eaca6ada9753$export$af0124069c150252)({
6438
+ set_override_on_enter_fn_: set_override_on_enter_fn_,
6439
+ get_modal_search_results_: get_modal_search_results_,
6440
+ read_suggestion_signal_: read_suggestion_signal_,
6441
+ router_: router_,
6442
+ content_results_: get_content_results_
6443
+ });
6307
6444
  (0, $i7OB2$createComputed)(() => {
6308
6445
  const field_value = read_search_field_value();
6309
- if (!(0, $i7OB2$untrack)(updating_blocked[0])) {
6446
+ if ((0, $i7OB2$untrack)(updating_blocked[0]))
6447
+ // not using updating_blocked instead of below signal since I presume they'd start updating too early then
6448
+ set_show_stale_content_results(true);else {
6310
6449
  set_searching_for_value(field_value);
6311
6450
  deparallelized_fn({
6312
6451
  query: field_value,
6313
6452
  tenant: tenant_(),
6314
6453
  market: market_()
6315
6454
  });
6455
+ set_show_stale_content_results(false);
6316
6456
  }
6317
6457
  });
6318
6458
  (0, $i7OB2$createComputed)((0, $i7OB2$on)(search_field_value_[0], () => !updating_blocked[0]() && selected_index_[1](undefined), {
@@ -6324,7 +6464,7 @@ function $a0eb8b431ec1f87b$export$2f2b9559550c7bbc({
6324
6464
  search_field_value_: search_field_value_,
6325
6465
  updating_blocked_: updating_blocked,
6326
6466
  currently_showing_suggestions_: currently_showing_suggestions_,
6327
- set_override_on_enter_fn_: set_override_on_enter_fn_,
6467
+ set_override_on_enter_fn_: manipulated_set_override_on_enter_fn_,
6328
6468
  search_query_param_name_: search_query_url_param_name_,
6329
6469
  url_transformer_: url_transformer_,
6330
6470
  router_: router_
@@ -6363,11 +6503,12 @@ function $a0eb8b431ec1f87b$export$2f2b9559550c7bbc({
6363
6503
  },
6364
6504
  on_previous_searches_page_: show_previous_searches_component,
6365
6505
  i18n_: i18n_,
6506
+ get_content_results_: get_content_results_,
6366
6507
  url_transformer_: url_transformer_,
6367
6508
  searching_for_value_: searching_for_value,
6368
6509
  search_query_url_param_name_: search_query_url_param_name_,
6369
6510
  selected_index_: selected_index_,
6370
- suggestion_memo_: read_suggestion_signal,
6511
+ suggestion_memo_: read_suggestion_signal_,
6371
6512
  currently_showing_suggestions_: currently_showing_suggestions_,
6372
6513
  include_category_suggestions_: include_category_suggestions_,
6373
6514
  router_: router_,
@@ -6467,7 +6608,8 @@ function $fabfda1230351b1a$export$1c593cbd6f1e10bc({
6467
6608
  bottom_distance_under_modal_: bottom_distance_under_modal_,
6468
6609
  selected_text_range_: selected_text_range_,
6469
6610
  dont_sync_search_field_value_except_on_submit_ = false,
6470
- router_: router_
6611
+ router_: router_,
6612
+ content_search_enabled_: content_search_enabled_
6471
6613
  }) {
6472
6614
  let on_enter_in_search_field_function;
6473
6615
  // 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.
@@ -6484,30 +6626,23 @@ function $fabfda1230351b1a$export$1c593cbd6f1e10bc({
6484
6626
  };
6485
6627
  const [input_field, set_input_field] = (0, $i7OB2$createSignal)();
6486
6628
  const [get_search_field_value_] = search_field_value_;
6487
- const [elements_outside_scrollable, set_elements_outside_scrollable] = (0, $i7OB2$createSignal)();
6488
- const [elements_inside_scrollable, set_elements_inside_scrollable] = (0, $i7OB2$createSignal)();
6629
+ const [get_modal_search_results, set_modal_search_results_] = (0, $i7OB2$createSignal)();
6489
6630
  const close_on_escape_handler = (0, $i7OB2$catchify)(({
6490
6631
  key: key
6491
6632
  }) => {
6492
6633
  if (key === "Escape") close_modal_();
6493
6634
  });
6494
- const [get_num_results_accessor, set_num_results_accessor_] = (0, $i7OB2$createSignal)();
6635
+ const [get_total_num_results_accessor, set_total_num_results_accessor_] = (0, $i7OB2$createSignal)();
6495
6636
  const selected_index = (0, $i7OB2$createSignal)();
6496
6637
  const currently_showing_suggestions_ = (0, $i7OB2$createSignal)([], {
6497
6638
  equals: false
6498
6639
  });
6640
+ const less_than_700_high = (0, $dc9262ef6f786812$export$d9f36cf74e24d595)("(max-height:700px)");
6641
+ const DiscoverMoreSection = () => (0, $i7OB2$ssr)($fabfda1230351b1a$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)(), get_search_field_value_() ? (0, $i7OB2$escape)(i18n_.modal_view_all_results_()((0, $i7OB2$ssr)($fabfda1230351b1a$var$_tmpl$2, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)(get_total_num_results_accessor?.())))) : (0, $i7OB2$escape)(i18n_.modal_discover_more_()));
6499
6642
  if (disable_scrolling_) (0, $aea1edf92433e81e$export$fe334901e8bebd57)();
6500
6643
  $fabfda1230351b1a$var$close_modal_when_navigating_away(close_modal_, search_query_url_param_name_);
6501
6644
  window.addEventListener("keydown", close_on_escape_handler);
6502
6645
  (0, $i7OB2$onCleanup)((0, $i7OB2$catchify)(() => window.removeEventListener("keydown", close_on_escape_handler)));
6503
- const owner = (0, $i7OB2$getOwner)();
6504
- (0, $i7OB2$onCleanup)((0, $i7OB2$javascript_media_query)("(max-height:700px)", ({
6505
- matches: matches
6506
- }) => (0, $i7OB2$runWithOwner)(owner, () => {
6507
- // the if below is reactive so we need an owner
6508
- (matches ? set_elements_outside_scrollable : set_elements_inside_scrollable)("");
6509
- (matches ? set_elements_inside_scrollable : set_elements_outside_scrollable)((0, $i7OB2$ssr)($fabfda1230351b1a$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)(), get_search_field_value_() ? (0, $i7OB2$escape)(i18n_.modal_view_all_results_()((0, $i7OB2$ssr)($fabfda1230351b1a$var$_tmpl$2, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)(get_num_results_accessor?.())))) : (0, $i7OB2$escape)(i18n_.modal_discover_more_())));
6510
- })).remove);
6511
6646
  if (closing_animation_) register_closing_animation_(closing_animation_);
6512
6647
  (0, $c64d28ca12452b21$export$3340fdd8259bd4fd)({
6513
6648
  get_search_field_value_: get_search_field_value_,
@@ -6566,7 +6701,9 @@ function $fabfda1230351b1a$export$1c593cbd6f1e10bc({
6566
6701
  i18n_: i18n_,
6567
6702
  include_category_suggestions_: enable_category_suggestions_ ?? true,
6568
6703
  router_: router_,
6569
- submit_query_: submit_query_
6704
+ submit_query_: submit_query_,
6705
+ get_modal_search_results_: get_modal_search_results,
6706
+ content_search_enabled_: content_search_enabled_
6570
6707
  });
6571
6708
  }
6572
6709
  })), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
@@ -6579,12 +6716,28 @@ function $fabfda1230351b1a$export$1c593cbd6f1e10bc({
6579
6716
  tenant_: tenant_,
6580
6717
  i18n_: i18n_,
6581
6718
  market_: market_,
6582
- set_num_results_accessor_: set_num_results_accessor_,
6719
+ set_total_num_results_accessor_: set_total_num_results_accessor_,
6583
6720
  router_: router_,
6721
+ set_modal_search_results_: set_modal_search_results_,
6722
+ content_search_enabled_: content_search_enabled_,
6584
6723
  ...instant_results_options_
6585
6724
  });
6586
6725
  }
6587
- })), (0, $i7OB2$escape)(elements_inside_scrollable()), (0, $i7OB2$escape)(elements_outside_scrollable()), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $19f1f3e588d63502$export$f021bdedd3ec901a), {
6726
+ })), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $i7OB2$Show), {
6727
+ get when() {
6728
+ return less_than_700_high();
6729
+ },
6730
+ get children() {
6731
+ return (0, $i7OB2$createComponent)(DiscoverMoreSection, {});
6732
+ }
6733
+ })), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $i7OB2$Show), {
6734
+ get when() {
6735
+ return !less_than_700_high();
6736
+ },
6737
+ get children() {
6738
+ return (0, $i7OB2$createComponent)(DiscoverMoreSection, {});
6739
+ }
6740
+ })), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $19f1f3e588d63502$export$f021bdedd3ec901a), {
6588
6741
  styles: body_style
6589
6742
  })));
6590
6743
  return [(0, $i7OB2$ssr)($fabfda1230351b1a$var$_tmpl$4, (0, $i7OB2$ssrHydrationKey)() + (0, $i7OB2$ssrAttribute)("id", (0, $i7OB2$escape)((0, $f86ba724282f6690$export$44dad306455dddf).SEARCH_MODAL, true), false), `depict plp search ${(0, $i7OB2$escape)((0, $i7OB2$ssrClassList)(class_list_?.()), true) || ""}`, (0, $i7OB2$escape)(modal_element))];
@@ -6656,14 +6809,21 @@ const $f8c929beb82c512b$var$_tmpl$ = ["<b", ">", "</b>"],
6656
6809
  function $f8c929beb82c512b$export$9dd50d35b9d94fdf({
6657
6810
  get_search_query_: get_search_query_,
6658
6811
  i18n_: i18n_,
6659
- formatted_number_of_results_: formatted_number_of_results_
6812
+ formatted_number_of_results_: formatted_number_of_results_,
6813
+ number_of_results_: number_of_results_,
6814
+ type: type
6660
6815
  }) {
6661
6816
  const contents = (0, $i7OB2$createMemo)((0, $i7OB2$catchify)(() => {
6662
6817
  const q = get_search_query_();
6663
- return i18n_.get_showing_results_for_()((0, $i7OB2$ssr)($f8c929beb82c512b$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)(q)), (0, $i7OB2$ssr)($f8c929beb82c512b$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)(formatted_number_of_results_())));
6818
+ return i18n_[type === $f8c929beb82c512b$export$2452208c79fe93ea.content ? "get_showing_pages_for_" : "get_showing_results_for_"]()((0, $i7OB2$ssr)($f8c929beb82c512b$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)(q)), (0, $i7OB2$ssr)($f8c929beb82c512b$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)(formatted_number_of_results_())), !!q, number_of_results_());
6664
6819
  }));
6665
6820
  return (0, $i7OB2$ssr)($f8c929beb82c512b$var$_tmpl$2, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)(contents()));
6666
6821
  }
6822
+ let $f8c929beb82c512b$export$2452208c79fe93ea;
6823
+ (function (ShowingResultsForType) {
6824
+ ShowingResultsForType[ShowingResultsForType["products"] = 0] = "products";
6825
+ ShowingResultsForType[ShowingResultsForType["content"] = 1] = "content";
6826
+ })($f8c929beb82c512b$export$2452208c79fe93ea || ($f8c929beb82c512b$export$2452208c79fe93ea = {}));
6667
6827
  function $1801dbce7adb3f19$export$41b4894022a3580f({
6668
6828
  style_props_ = (0, $i7OB2$createSignal)({})
6669
6829
  } = {}) {
@@ -6682,8 +6842,429 @@ function $1801dbce7adb3f19$export$41b4894022a3580f({
6682
6842
  })));
6683
6843
  return style_props_;
6684
6844
  }
6845
+ const $522a690e0e2bd46d$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"];
6846
+ const $522a690e0e2bd46d$var$dont_cut_in_between_less_than_characters = 30;
6847
+ function $522a690e0e2bd46d$export$e1a98a189fd2c0e7({
6848
+ content_result_: content_result_,
6849
+ key_: key_,
6850
+ cut_when_possible_: cut_when_possible_
6851
+ }) {
6852
+ const matched_tokens = (0, $i7OB2$createMemo)(() => content_result_().highlights?.find(highlight => highlight.field == key_)?.matched_tokens);
6853
+ const full_value = (0, $i7OB2$createMemo)(() => content_result_()[key_]?.replaceAll("\n", " "));
6854
+ return (0, $i7OB2$createComponent)((0, $i7OB2$Show), {
6855
+ get when() {
6856
+ return matched_tokens()?.length;
6857
+ },
6858
+ get fallback() {
6859
+ return full_value();
6860
+ },
6861
+ get children() {
6862
+ return (() => {
6863
+ const segmented_cut_text = (0, $i7OB2$createMemo)(() => {
6864
+ const segmented_text = $522a690e0e2bd46d$var$segment_text(full_value(), matched_tokens());
6865
+ if (cut_when_possible_) $522a690e0e2bd46d$var$cut_text(segmented_text);
6866
+ return segmented_text;
6867
+ });
6868
+ return (0, $i7OB2$createComponent)((0, $i7OB2$Index), {
6869
+ get each() {
6870
+ return segmented_cut_text();
6871
+ },
6872
+ children: item => {
6873
+ return (0, $i7OB2$createComponent)((0, $i7OB2$Show), {
6874
+ get when() {
6875
+ return item().highlighted_;
6876
+ },
6877
+ get fallback() {
6878
+ return item().text_;
6879
+ },
6880
+ get children() {
6881
+ return (0, $i7OB2$ssr)($522a690e0e2bd46d$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)(item().text_));
6882
+ }
6883
+ });
6884
+ }
6885
+ });
6886
+ })();
6887
+ }
6888
+ });
6889
+ }
6890
+ function $522a690e0e2bd46d$var$cut_text(segmented_text) {
6891
+ // cut away chunks of text that are not highlighted to give a google-like overview of the content
6892
+ const highlighted_segments = segmented_text?.filter(segment => segment.highlighted_);
6893
+ if (!segmented_text || !highlighted_segments?.length) return;
6894
+ // We have one or more highlighted segments
6895
+ if (highlighted_segments.length === 1) {
6896
+ // cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
6897
+ $522a690e0e2bd46d$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
6898
+ return;
6899
+ }
6900
+ // We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
6901
+ 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
6902
+ );
6903
+
6904
+ const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
6905
+ // We need to cut before the first segment - possibly through other segments - and maybe between segments
6906
+ 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);
6907
+ $522a690e0e2bd46d$var$cut_start(index_of_first_segment, segmented_text);
6908
+ // update indexes since we might have removed segments
6909
+ [index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
6910
+ let number_of_characters_between_segments = 0;
6911
+ for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
6912
+ const segment = segmented_text[i];
6913
+ number_of_characters_between_segments += segment.text_.length;
6914
+ }
6915
+ if (number_of_characters_between_segments < $522a690e0e2bd46d$var$dont_cut_in_between_less_than_characters)
6916
+ // don't cut if there are less than 30 characters between the two segments
6917
+ return;
6918
+ // We have more than 50 characters between the two segments, cut between them
6919
+ const [split_start_segment, split_start_character] = $522a690e0e2bd46d$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
6920
+ const [split_end_segment, split_end_character] = $522a690e0e2bd46d$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
6921
+ if (split_start_segment === undefined || split_end_segment === undefined ||
6922
+ // identical split point, or split end before split start, can't do anything
6923
+ split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
6924
+ const dots_segment = {
6925
+ text_: " … ",
6926
+ highlighted_: false
6927
+ };
6928
+ const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
6929
+ if (i < split_start_segment || i > split_end_segment) return segment;
6930
+ const text = segment.text_;
6931
+ if (i == split_end_segment && i == split_start_segment) return [{
6932
+ ...segment,
6933
+ text_: text.slice(0, split_start_character).trimEnd()
6934
+ }, dots_segment, {
6935
+ ...segment,
6936
+ text_: text.slice(split_end_character + 1, text.length).trimStart()
6937
+ }];else if (i == split_start_segment) {
6938
+ 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
6939
+ return segment;
6940
+ } else if (i == split_end_segment) return [dots_segment, {
6941
+ ...segment,
6942
+ text_: text.slice(split_end_character + 1, text.length).trimStart()
6943
+ }];
6944
+ return []; // remove all segments inbetween
6945
+ });
6946
+
6947
+ segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
6948
+ $522a690e0e2bd46d$var$heal_holes(segmented_text);
6949
+ }
6950
+ function $522a690e0e2bd46d$var$heal_holes(segmented_text) {
6951
+ // try to heal "holes" created in the segments so there are only alternating segments
6952
+ const segments_to_delete = new Set();
6953
+ for (let i = 0; i < segmented_text.length; i++) {
6954
+ const segment = segmented_text[i];
6955
+ let previous_segment;
6956
+ for (let j = i - 1; j >= 0; j--) {
6957
+ previous_segment = segmented_text[j];
6958
+ // Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
6959
+ if (!segments_to_delete.has(previous_segment)) break;
6960
+ }
6961
+ if (previous_segment?.highlighted_ && segment.highlighted_ || previous_segment?.highlighted_ === false && segment.highlighted_ === false) {
6962
+ previous_segment.text_ += segment.text_; // IDK if this ever happens
6963
+ segments_to_delete.add(segment);
6964
+ }
6965
+ }
6966
+ for (const segment of segments_to_delete) {
6967
+ const index = segmented_text.indexOf(segment);
6968
+ segmented_text.splice(index, 1);
6969
+ }
6970
+ }
6971
+ function $522a690e0e2bd46d$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text, be_very_aggressive = true) {
6972
+ const should_loop_backwards = index_of_start_segment > index_of_end_segment;
6973
+ const step = should_loop_backwards ? -1 : 1;
6974
+ const desperate_split_attempts = [":", ";", ","];
6975
+ while (desperate_split_attempts.length) {
6976
+ const split_point_between_words = [];
6977
+ // for the middle also try to split with a few more characters if the default ones don't work over a full run
6978
+ const desperate_split_attempt = desperate_split_attempts.pop();
6979
+ let is_first_character = true;
6980
+ for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
6981
+ const segment = segmented_text[i];
6982
+ const text = segment.text_;
6983
+ for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
6984
+ const character = text[j];
6985
+ if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
6986
+ if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
6987
+ split_point_between_words.push([i, j]);
6988
+ if (split_point_between_words.length > 3)
6989
+ // We can't find a split point, so we'll just split between words
6990
+ // 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
6991
+ return split_point_between_words[1];
6992
+ }
6993
+ }
6994
+ }
6995
+ }
6996
+ return [];
6997
+ }
6998
+ function $522a690e0e2bd46d$var$cut_start(cut_left_of_index, segmented_text) {
6999
+ // Cut the start of the text to bring the first matching token
7000
+ let is_first_character = false;
7001
+ let words_encountered = 0;
7002
+ outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
7003
+ const segment = segmented_text[i];
7004
+ // We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
7005
+ const text = segment.text_;
7006
+ for (let j = text.length - 1; j >= 0; j--) {
7007
+ const character = text[j];
7008
+ const is_space = character == " ";
7009
+ if (!is_first_character && is_space) words_encountered++;
7010
+ if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
7011
+ // We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
7012
+ segment.text_ = text.slice(j + 1).trimStart();
7013
+ segmented_text.splice(0, i);
7014
+ if (character === "," || is_space)
7015
+ // if we cut at a comma or psace, we add a … at the beginning
7016
+ segmented_text.unshift({
7017
+ text_: "… ",
7018
+ highlighted_: false
7019
+ });
7020
+ break outmost_loop;
7021
+ }
7022
+ if (is_first_character) is_first_character = false;
7023
+ }
7024
+ }
7025
+ $522a690e0e2bd46d$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
7026
+ }
7027
+
7028
+ function $522a690e0e2bd46d$var$segment_text(text, matched_strings) {
7029
+ // segment text where the matched strings are highlighted sections
7030
+ const output = [];
7031
+ if (!text) return; // shouldn't happen but whatever
7032
+ for (let i = 0; i < text.length; i++) {
7033
+ const found_strings = [];
7034
+ if (!i || text[i - 1] == " ")
7035
+ // only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
7036
+ for (let j = 0; j < matched_strings.length; j++) {
7037
+ const matched_string = matched_strings[j];
7038
+ const part_in_text = text.slice(i, i + matched_string.length);
7039
+ if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
7040
+ 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
7041
+ }
7042
+
7043
+ const last_index_in_output = output.length - 1;
7044
+ if (!found_strings.length) {
7045
+ const character = text[i];
7046
+ if (output[last_index_in_output]?.highlighted_ === false || output.length && /\s/.test(character))
7047
+ // 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
7048
+ output[last_index_in_output].text_ += character;else output.push({
7049
+ highlighted_: false,
7050
+ text_: character
7051
+ });
7052
+ } else {
7053
+ const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
7054
+ if (output[last_index_in_output]?.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
7055
+ highlighted_: true,
7056
+ text_: longest_found_string
7057
+ });
7058
+ i += longest_found_string.length - 1;
7059
+ }
7060
+ }
7061
+ return output;
7062
+ }
7063
+ const $b2bf2cdcff8142d8$var$_tmpl$ = ["<div", ' class="description line-clamp">', "</div>"],
7064
+ $b2bf2cdcff8142d8$var$_tmpl$2 = ["<div", ' class="content-card"><div class="image">', '</div><div class="info"><!--#-->', "<!--/--><!--#-->", "<!--/--></div></div>"];
7065
+ function $b2bf2cdcff8142d8$export$f631859cab12b342({
7066
+ router_: router_,
7067
+ content_result_: content_result_
7068
+ }) {
7069
+ const make_link_attributes = () => {
7070
+ const result = content_result_?.();
7071
+ if (!result) return;
7072
+ return {
7073
+ href: result.page_url,
7074
+ onClick: (0, $i7OB2$catchify)(ev => router_.navigate_.go_to_({
7075
+ new_url_: result.page_url,
7076
+ is_replace_: false,
7077
+ event_: ev
7078
+ }))
7079
+ };
7080
+ };
7081
+ const LinkIfPossible = ({
7082
+ children: children,
7083
+ ...attributes
7084
+ }) => {
7085
+ if (content_result_) return (0, $i7OB2$ssrElement)("a", attributes, () => (0, $i7OB2$escape)(children), true);
7086
+ return (0, $i7OB2$ssrElement)("div", attributes, () => (0, $i7OB2$escape)(children), true);
7087
+ };
7088
+ return (0, $i7OB2$ssr)($b2bf2cdcff8142d8$var$_tmpl$2, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)((0, $i7OB2$createComponent)(LinkIfPossible, (0, $i7OB2$mergeProps)(make_link_attributes, {
7089
+ tabIndex: "-1",
7090
+ get children() {
7091
+ return (0, $i7OB2$createComponent)((0, $190927650b4840eb$export$605674723bcc715c), {
7092
+ width: "28",
7093
+ height: "28"
7094
+ });
7095
+ }
7096
+ }))), (0, $i7OB2$escape)((0, $i7OB2$createComponent)(LinkIfPossible, (0, $i7OB2$mergeProps)({
7097
+ "class": "content-title line-clamp"
7098
+ }, make_link_attributes, {
7099
+ get title() {
7100
+ return content_result_?.().title;
7101
+ },
7102
+ get children() {
7103
+ return content_result_ ? (0, $i7OB2$createComponent)((0, $522a690e0e2bd46d$export$e1a98a189fd2c0e7), {
7104
+ content_result_: content_result_,
7105
+ key_: "title",
7106
+ cut_when_possible_: false
7107
+ }) : (0, $i7OB2$createComponent)((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
7108
+ height: "1em",
7109
+ width: "20ch"
7110
+ });
7111
+ }
7112
+ }))), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $i7OB2$Show), {
7113
+ get when() {
7114
+ return content_result_?.().description || !content_result_;
7115
+ },
7116
+ get children() {
7117
+ return (0, $i7OB2$ssr)($b2bf2cdcff8142d8$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $i7OB2$Show), {
7118
+ when: content_result_,
7119
+ get fallback() {
7120
+ return Array.from({
7121
+ length: 4
7122
+ }).map(() => (0, $i7OB2$createComponent)((0, $d134eae24341b4a1$export$89c6019e4baa40b1), {
7123
+ height: "1em",
7124
+ width: "min(50ch, 100%)"
7125
+ }));
7126
+ },
7127
+ get children() {
7128
+ return (0, $i7OB2$createComponent)((0, $522a690e0e2bd46d$export$e1a98a189fd2c0e7), {
7129
+ content_result_: content_result_,
7130
+ key_: "description",
7131
+ cut_when_possible_: true
7132
+ });
7133
+ }
7134
+ })));
7135
+ }
7136
+ })));
7137
+ }
7138
+ function $b26bdbd081f63e3f$export$9ff751cd77687edc({
7139
+ search_results_: search_results_,
7140
+ router_: router_
7141
+ }) {
7142
+ const content_results = (0, $i7OB2$createMemo)(() => search_results_()?.content_search_links);
7143
+ const content_results_by_page_url = (0, $i7OB2$createMemo)(() => {
7144
+ const map = new Map();
7145
+ const results = content_results();
7146
+ if (!results) return map;
7147
+ for (let i = 0; i < results.length; i++) {
7148
+ const content_result = results[i];
7149
+ map.set(content_result.page_url, content_result);
7150
+ }
7151
+ return map;
7152
+ });
7153
+ return (0, $i7OB2$createComponent)((0, $i7OB2$For), {
7154
+ get each() {
7155
+ return [...content_results_by_page_url().keys()];
7156
+ },
7157
+ children: page_url => {
7158
+ const content_result = (0, $i7OB2$createMemo)(() => content_results_by_page_url().get(page_url));
7159
+ return (0, $i7OB2$createComponent)((0, $b2bf2cdcff8142d8$export$f631859cab12b342), {
7160
+ content_result_: content_result,
7161
+ router_: router_
7162
+ });
7163
+ }
7164
+ });
7165
+ }
7166
+ function $9d5b3ed1fc91c672$export$4405d077f0a20494({
7167
+ content_results_rows_: [get_history_state_content_results_rows],
7168
+ cols_at_size_: cols_at_size_
7169
+ }) {
7170
+ const largest_column = (0, $i7OB2$createMemo)(() => {
7171
+ const largest_in_cols_at_size = Math.max(...cols_at_size_().map(([cols]) => cols));
7172
+ 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
7173
+ return largest_in_cols_at_size;
7174
+ });
7175
+ const num_placeholders = (0, $i7OB2$createMemo)(() => (get_history_state_content_results_rows() ?? (0, $49de9d31aeea1b5e$export$70ceae36059a1036)) * largest_column());
7176
+ return (0, $i7OB2$createComponent)((0, $i7OB2$Index), {
7177
+ get each() {
7178
+ return Array.from({
7179
+ length: num_placeholders()
7180
+ });
7181
+ },
7182
+ children: () => (0, $i7OB2$createComponent)((0, $b2bf2cdcff8142d8$export$f631859cab12b342), {})
7183
+ });
7184
+ }
7185
+ const $49de9d31aeea1b5e$var$_tmpl$ = ["<div", ' class="', '" style="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
7186
+ $49de9d31aeea1b5e$var$_tmpl$2 = ["<button", ' class="view-more">', "</button>"],
7187
+ $49de9d31aeea1b5e$var$_tmpl$3 = ["<button", ' class="view-less">', "</button>"];
7188
+ const $49de9d31aeea1b5e$export$70ceae36059a1036 = 1;
7189
+ function $49de9d31aeea1b5e$export$6d0c9c22f6652669({
7190
+ search_results_: search_results_,
7191
+ get_search_query_: get_search_query_,
7192
+ i18n_: i18n_,
7193
+ layout_options_: layout_options_,
7194
+ router_: router_,
7195
+ query_base_: query_base_,
7196
+ content_results_rows_: content_results_rows_
7197
+ }) {
7198
+ const content_results = (0, $i7OB2$createMemo)(() => search_results_()?.content_search_links);
7199
+ const num_results = (0, $i7OB2$createMemo)(() => content_results()?.length);
7200
+ const is_loading_ = (0, $i7OB2$createMemo)(() => search_results_.loading || query_base_.loading); // See comment in PLPResults/index.tsx on why we need this
7201
+ const formatted_number_of_results_ = (0, $511cc0abd9a64ce8$export$92f2da32c6e7e7ee)({
7202
+ number_: num_results,
7203
+ i18n_: i18n_
7204
+ });
7205
+ const [is_showing_placeholders, set_is_showing_placeholders] = (0, $i7OB2$createSignal)(false);
7206
+ const rows_object = $49de9d31aeea1b5e$var$make_state_saved_rows(content_results_rows_, i18n_);
7207
+ return (0, $i7OB2$ssr)($49de9d31aeea1b5e$var$_tmpl$, (0, $i7OB2$ssrHydrationKey)(), `content-results ${is_showing_placeholders() ? "loading" : ""}`, "display:" + (is_loading_() || content_results()?.length > 0 ? "" : "none"), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $f8c929beb82c512b$export$9dd50d35b9d94fdf), {
7208
+ get_search_query_: get_search_query_,
7209
+ i18n_: i18n_,
7210
+ formatted_number_of_results_: formatted_number_of_results_,
7211
+ get type() {
7212
+ return (0, $f8c929beb82c512b$export$2452208c79fe93ea).content;
7213
+ },
7214
+ number_of_results_: num_results
7215
+ })), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $c8d5ff4524619fcd$export$d21e32dfedac04be), (0, $i7OB2$mergeProps)({
7216
+ layout: "grid",
7217
+ element_attributes: {
7218
+ class: "cards"
7219
+ }
7220
+ }, layout_options_, {
7221
+ rows: rows_object,
7222
+ get children() {
7223
+ return (0, $i7OB2$createComponent)((0, $i7OB2$Suspense), {
7224
+ get fallback() {
7225
+ return (() => {
7226
+ set_is_showing_placeholders(true);
7227
+ (0, $i7OB2$onCleanup)(() => set_is_showing_placeholders(false));
7228
+ return (0, $i7OB2$createComponent)((0, $9d5b3ed1fc91c672$export$4405d077f0a20494), {
7229
+ content_results_rows_: content_results_rows_,
7230
+ get cols_at_size_() {
7231
+ return (0, $i7OB2$createMemo)(() => layout_options_().cols_at_size);
7232
+ }
7233
+ });
7234
+ })();
7235
+ },
7236
+ get children() {
7237
+ return (0, $i7OB2$createComponent)((0, $b26bdbd081f63e3f$export$9ff751cd77687edc), {
7238
+ router_: router_,
7239
+ search_results_: search_results_
7240
+ });
7241
+ }
7242
+ });
7243
+ }
7244
+ }))));
7245
+ }
7246
+ function $49de9d31aeea1b5e$var$make_state_saved_rows(
7247
+ // similar to the one in SearchRecommendations.tsx but not enough to warrant a shared function IMO
7248
+ [get_showing_content_results_rows, set_showing_content_results_rows], i18n_) {
7249
+ const currently_visible = (0, $i7OB2$createSignal)((0, $i7OB2$untrack)(get_showing_content_results_rows));
7250
+ const [get_currently_visible, set_currently_visible] = currently_visible;
7251
+ const rows = {
7252
+ currently_visible: currently_visible,
7253
+ start_rows: $49de9d31aeea1b5e$export$70ceae36059a1036,
7254
+ button: (0, $i7OB2$ssr)($49de9d31aeea1b5e$var$_tmpl$2, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)(i18n_.view_more_())),
7255
+ view_less_button: (0, $i7OB2$ssr)($49de9d31aeea1b5e$var$_tmpl$3, (0, $i7OB2$ssrHydrationKey)(), (0, $i7OB2$escape)(i18n_.view_less_())),
7256
+ rows_per_click: 3
7257
+ };
7258
+ (0, $i7OB2$createComputed)((0, $i7OB2$on)(get_currently_visible, new_visible => set_showing_content_results_rows(new_visible), {
7259
+ defer: true
7260
+ }));
7261
+ (0, $i7OB2$createComputed)((0, $i7OB2$on)(get_showing_content_results_rows, (new_rows = $49de9d31aeea1b5e$export$70ceae36059a1036) => set_currently_visible(new_rows), {
7262
+ defer: true
7263
+ }));
7264
+ return rows;
7265
+ }
6685
7266
  const $7097477c78a89208$var$_tmpl$ = ["<div", ' class="filter-results-for-one-row"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
6686
- $7097477c78a89208$var$_tmpl$2 = ["<div", ' class="depict plp search"><div class="listing-page"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
7267
+ $7097477c78a89208$var$_tmpl$2 = ["<div", ' class="depict plp search"><div class="listing-page"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
6687
7268
  function $7097477c78a89208$export$a54ec244c8863715({
6688
7269
  depict_api_: depict_api_,
6689
7270
  search_field_value_: search_field_value_,
@@ -6712,7 +7293,11 @@ function $7097477c78a89208$export$a54ec244c8863715({
6712
7293
  recommendations_layout_options_: recommendations_layout_options_,
6713
7294
  scroll_restoration_data_: scroll_restoration_data_,
6714
7295
  product_card_template_: product_card_template_,
6715
- modal_body_style_ref_: modal_body_style_ref_
7296
+ modal_body_style_ref_: modal_body_style_ref_,
7297
+ router_: router_,
7298
+ content_results_rows_: content_results_rows_,
7299
+ content_layout_options_: content_layout_options_,
7300
+ content_search_enabled_: content_search_enabled_
6716
7301
  }) {
6717
7302
  const [get_sorting] = current_sorting_;
6718
7303
  const all_products_loaded_ = (0, $i7OB2$createSignal)(false);
@@ -6770,16 +7355,23 @@ function $7097477c78a89208$export$a54ec244c8863715({
6770
7355
  const SafeSearchField = (0, $i7OB2$catchify)((0, $5285d2814d0fac0c$export$b94867ecbd698f21));
6771
7356
  const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $i7OB2$createSignal)(false);
6772
7357
  const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $i7OB2$createSignal)();
7358
+ const n_hits = (0, $i7OB2$createMemo)(() => search_results_()?.n_hits);
6773
7359
  const formatted_number_of_results_ = (0, $511cc0abd9a64ce8$export$92f2da32c6e7e7ee)({
6774
- search_results_: search_results_,
7360
+ number_: n_hits,
6775
7361
  i18n_: i18n_
6776
7362
  });
6777
7363
  const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $i7OB2$createSignal)();
6778
- const results_for = (0, $i7OB2$createComponent)((0, $f8c929beb82c512b$export$9dd50d35b9d94fdf), {
7364
+ const no_results_text_ = (0, $i7OB2$createMemo)(() => (search_results_()?.content_search_links?.length ? i18n_.no_products_ : i18n_.no_results_text_)());
7365
+ const results_for = (0, $i7OB2$createComponent)((0, $f8c929beb82c512b$export$9dd50d35b9d94fdf), (0, $i7OB2$mergeProps)({
7366
+ get type() {
7367
+ return (0, $f8c929beb82c512b$export$2452208c79fe93ea).products;
7368
+ },
7369
+ number_of_results_: n_hits
7370
+ }, {
6779
7371
  get_search_query_: get_search_query_,
6780
7372
  i18n_: i18n_,
6781
7373
  formatted_number_of_results_: formatted_number_of_results_
6782
- });
7374
+ }));
6783
7375
  const filters_opener = (0, $cdea4cf8c5c071ef$export$d7841e452f2e59a8)({
6784
7376
  set_sort_or_filter_open_: set_sort_or_filter_open_,
6785
7377
  set_extra_els_in_results_container_: set_desktop_filter_elements,
@@ -6882,7 +7474,28 @@ function $7097477c78a89208$export$a54ec244c8863715({
6882
7474
  children: make_category_suggestion_card_
6883
7475
  });
6884
7476
  }
6885
- })) : (0, $i7OB2$escape)(null), (0, $i7OB2$escape)(results_filters[0]()), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $i7OB2$Show), {
7477
+ })) : (0, $i7OB2$escape)(null), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $b7436a6d1fd64e3b$export$b69d0d92862de18b), {
7478
+ severity_: "error",
7479
+ message_: "ContentResults failed",
7480
+ get children() {
7481
+ return (0, $i7OB2$createComponent)((0, $i7OB2$Show), {
7482
+ get when() {
7483
+ return content_search_enabled_();
7484
+ },
7485
+ get children() {
7486
+ return (0, $i7OB2$createComponent)((0, $49de9d31aeea1b5e$export$6d0c9c22f6652669), {
7487
+ content_results_rows_: content_results_rows_,
7488
+ search_results_: search_results_,
7489
+ i18n_: i18n_,
7490
+ get_search_query_: get_search_query_,
7491
+ layout_options_: content_layout_options_,
7492
+ router_: router_,
7493
+ query_base_: search_query_base_
7494
+ });
7495
+ }
7496
+ });
7497
+ }
7498
+ })), (0, $i7OB2$escape)(results_filters[0]()), (0, $i7OB2$escape)((0, $i7OB2$createComponent)((0, $i7OB2$Show), {
6886
7499
  get when() {
6887
7500
  return selected_filters_[0]()?.length;
6888
7501
  },
@@ -6926,7 +7539,10 @@ function $7097477c78a89208$export$a54ec244c8863715({
6926
7539
  selected_filters_: selected_filters_,
6927
7540
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
6928
7541
  local_filter_cache_: local_filter_cache_,
6929
- i18n_: i18n_
7542
+ i18n_: {
7543
+ ...i18n_,
7544
+ no_results_text_: no_results_text_
7545
+ }
6930
7546
  }
6931
7547
  });
6932
7548
  }
@@ -7000,6 +7616,27 @@ function $4ca91518c9a35379$export$828dcdd425fd3231(aligner) {
7000
7616
  cleanup: cleanup
7001
7617
  };
7002
7618
  }
7619
+
7620
+ /**
7621
+ * 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
7622
+ */
7623
+ function $1848f7cca286fbab$export$ff7109b9b2b206ba(sdk_cols_at_size, min_width_for_more_than_one_column = 500) {
7624
+ if (!sdk_cols_at_size.length) return sdk_cols_at_size;
7625
+ const sorted_sizes = sdk_cols_at_size.map(([cols, max_width]) => [cols, max_width ?? Infinity]).sort(([, a], [, b]) => a - b);
7626
+ const [[, smallest_max_width]] = sorted_sizes;
7627
+ if (smallest_max_width > min_width_for_more_than_one_column)
7628
+ // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
7629
+ return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
7630
+ const to_delete = [];
7631
+ for (let i = 0; i < sorted_sizes.length; i++) {
7632
+ const [, max_width] = sorted_sizes[i];
7633
+ if (max_width > min_width_for_more_than_one_column) continue;
7634
+ to_delete.push(i);
7635
+ }
7636
+ while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
7637
+ sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
7638
+ return sorted_sizes.map(([cols, max_width]) => max_width == Infinity ? [cols] : [cols, max_width]);
7639
+ }
7003
7640
  const $806c97b931758897$var$_tmpl$ = ["<div", ' class="depict plp search">', "</div>"];
7004
7641
  // 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
7005
7642
  /**
@@ -7009,6 +7646,7 @@ const $806c97b931758897$var$_tmpl$ = ["<div", ' class="depict plp search">', "</
7009
7646
  * 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.
7010
7647
  */
7011
7648
  const $806c97b931758897$var$privately_shared_properties = /*@__PURE__*/new WeakMap();
7649
+ const $806c97b931758897$var$content_search_default = false;
7012
7650
  const $806c97b931758897$var$min_products_to_fetch_ = 20;
7013
7651
  const $806c97b931758897$export$bde3eb976dfded9 = depict_search => $806c97b931758897$var$privately_shared_properties.get(depict_search)?.search_query_updating_blocked_;
7014
7652
  class $806c97b931758897$export$ac6237957a15b3f0 {
@@ -7016,6 +7654,7 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
7016
7654
  #merchant_signal = (0, $i7OB2$createSignal)();
7017
7655
  #market_signal = (0, $i7OB2$createSignal)();
7018
7656
  #modal_open_signal = (0, $i7OB2$createSignal)(false);
7657
+ #content_search_signal = (0, $i7OB2$createSignal)();
7019
7658
  static #keys_constructed_with = new Set();
7020
7659
  #router = new (0, $4fd2ba03703a7d92$export$7e1297a3a19f10d8)("hard_navigation");
7021
7660
  constructor({
@@ -7025,9 +7664,10 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
7025
7664
  on_navigation: on_navigation,
7026
7665
  enable_category_suggestions = true,
7027
7666
  page_url_creator: page_url_creator,
7667
+ display_transformers: display_transformers,
7668
+ api: api,
7028
7669
  // Stuff needed for non-standard customer deployments that we shouldn't actually expose
7029
7670
  disable_scrolling_during_modal = true,
7030
- api: api,
7031
7671
  bottom_distance_under_modal: bottom_distance_under_modal,
7032
7672
  render_instant_card: render_instant_card,
7033
7673
  ...props_on_class
@@ -7061,6 +7701,7 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
7061
7701
  local_filter_cache: [],
7062
7702
  expanded_hierarchical_filters: [],
7063
7703
  showing_recommendation_rows: (0, $172e1b898d457050$export$1c8c715550dc689d),
7704
+ content_results_rows: (0, $49de9d31aeea1b5e$export$70ceae36059a1036),
7064
7705
  scroll_restoration_data: []
7065
7706
  }),
7066
7707
  router_: this.#router,
@@ -7071,12 +7712,18 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
7071
7712
  const get_search_query_ = (0, $i7OB2$createMemo)(previous_value => {
7072
7713
  if (get_search_query_updating_blocked()) return previous_value;else return raw_search_query_accessor();
7073
7714
  });
7715
+ // @ts-ignore
7074
7716
  const depict_api_ = api ?? new (0, $7fa23e2a0079eca4$export$e015ed2f2950f2e3)({
7075
- page_url_creator: page_url_creator
7717
+ page_url_creator: page_url_creator,
7718
+ display_transformers: display_transformers
7076
7719
  });
7077
7720
  const previous_searches = (0, $21f51c14cb3f586f$export$84bba84a7b837187)(get_search_query_);
7078
7721
  const [, set_search_showing_recommendation_rows] = state_.showing_recommendation_rows;
7079
- const after_submit_ = () => set_search_showing_recommendation_rows((0, $172e1b898d457050$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
7722
+ const [, set_search_content_results_rows] = state_.content_results_rows;
7723
+ const after_submit_ = () => {
7724
+ set_search_showing_recommendation_rows((0, $172e1b898d457050$export$1c8c715550dc689d));
7725
+ set_search_content_results_rows((0, $49de9d31aeea1b5e$export$70ceae36059a1036));
7726
+ }; // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
7080
7727
  const on_submit_with_unchanged_value_ = () => this.modal_open = false;
7081
7728
  const [get_search_field_value_, set_search_field_value_] = state_.field_value;
7082
7729
  const configured_submit_query_ = new_query => (0, $bfd908d13d90934c$export$e16630ecb9644a1c)({
@@ -7134,6 +7781,7 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
7134
7781
  submit_query_: configured_submit_query_,
7135
7782
  url_transformer_: url_transformer,
7136
7783
  router_: this.#router,
7784
+ content_search_enabled_: () => this.#content_search_signal[0]() ?? $806c97b931758897$var$content_search_default,
7137
7785
  instant_results_options_: {
7138
7786
  min_products_to_fetch_: $806c97b931758897$var$min_products_to_fetch_,
7139
7787
  render_instant_card_: render_instant_card,
@@ -7198,6 +7846,12 @@ class $806c97b931758897$export$ac6237957a15b3f0 {
7198
7846
  (0, $i7OB2$onCleanup)(() => $806c97b931758897$export$ac6237957a15b3f0.#keys_constructed_with.delete(unique_instance_key_for_state));
7199
7847
  });
7200
7848
  }
7849
+ get enable_content_search() {
7850
+ return this.#content_search_signal[0]();
7851
+ }
7852
+ set enable_content_search(new_state) {
7853
+ this.#content_search_signal[1](new_state);
7854
+ }
7201
7855
  get on_navigation() {
7202
7856
  // The only non-reactive public property on the class (I don't see it making sense to have it reactive)
7203
7857
  return this.#router.on_navigation_;
@@ -7279,6 +7933,7 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
7279
7933
  depict_api_: shared_properties.depict_api_,
7280
7934
  min_products_to_fetch_: $806c97b931758897$var$min_products_to_fetch_,
7281
7935
  local_filter_cache_: state_.local_filter_cache,
7936
+ content_search_enabled_: () => depict_search.enable_content_search ?? $806c97b931758897$var$content_search_default,
7282
7937
  search_field_value_: state_.field_value,
7283
7938
  get_search_query_: shared_properties.get_search_query_,
7284
7939
  clear_filters_on_next_submit_: shared_properties.clear_filters_on_next_submit_,
@@ -7305,6 +7960,8 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
7305
7960
  search_filters_open_: state_.filters_open,
7306
7961
  search_sorting_open_: state_.sorting_open,
7307
7962
  expanded_filters_: state_.expanded_filters,
7963
+ content_results_rows_: state_.content_results_rows,
7964
+ router_: shared_properties.router_,
7308
7965
  make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
7309
7966
  return (0, $897bd4a76f611b38$export$d757d54550ebfb3d)({
7310
7967
  category_suggestion_: category_suggestion_,
@@ -7320,6 +7977,10 @@ function $806c97b931758897$export$f2dc7e4e4aa11abb(props) {
7320
7977
  cols_at_size: (0, $b5cccc8ee7d24677$export$6daf8749b65a1b77)(props.cols_at_size),
7321
7978
  ...grid_spacing_override()
7322
7979
  })),
7980
+ content_layout_options_: (0, $i7OB2$createMemo)(() => ({
7981
+ cols_at_size: (0, $b5cccc8ee7d24677$export$6daf8749b65a1b77)((0, $1848f7cca286fbab$export$ff7109b9b2b206ba)(props.cols_at_size)),
7982
+ ...grid_spacing_override()
7983
+ })),
7323
7984
  recommendations_layout_options_: (0, $i7OB2$createMemo)(() => {
7324
7985
  const {
7325
7986
  extra_depict_options: extra_depict_options