@depict-ai/ui 1.4.4 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,7 +8,7 @@ import $b8hua$babelruntimehelpersdefineProperty from "@babel/runtime/helpers/def
8
8
  /*! Depict.ai search and product listing SDK */
9
9
  import { register_es_version } from "../../multi_import_deduplicator.mjs";
10
10
  register_es_version("ui", "ES10");
11
- const $8db9a15135765c11$export$83d89fbfd8236492 = "1.4.4";
11
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "1.4.6";
12
12
  function $8e8b179489080711$export$5bad61ecde080b1f() {
13
13
  const {
14
14
  collapse: collapse,
@@ -387,7 +387,7 @@ function $4711a82d08d2021b$export$fecbb157621501bd(_ref) {
387
387
  return outmost_element;
388
388
  }
389
389
  const $6b73914551534ea8$var$_tmpl$ = ["<span", ' class="count">', "</span>"],
390
- $6b73914551534ea8$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", '><span class="custom-indicator"></span><span class="text">', "</span></div><!--#-->", "<!--/--></label>"];
390
+ $6b73914551534ea8$var$_tmpl$2 = ["<label", ' class="', '"', '><div class="left"><input type="checkbox"', "", '><span class="custom-indicator"></span><span class="text line-clamp">', "</span></div><!--#-->", "<!--/--></label>"];
391
391
  const $6b73914551534ea8$export$48513f6b9f8ce62d = props => {
392
392
  // 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
393
393
  const count = (0, $b8hua$createMemo)(() => props.count_);
@@ -2021,9 +2021,14 @@ function $63f1f8dbcd07d3b0$var$ActualSolidLayout(props, container_element) {
2021
2021
  // Copy of Layout from utilishared but using solid-js signals instead of async iterable IPNS
2022
2022
  const show_all_rows = (0, $b8hua$createMemo)(() => props.rows === "all");
2023
2023
  const rows_or_empty_object = (0, $b8hua$createMemo)(() => show_all_rows() ? {} : props.rows);
2024
- const button_elements = (0, $cb64b315b25cfc59$export$2f0cbfbb4354bb52)((0, $b8hua$createMemo)(() => rows_or_empty_object().button));
2025
- const have_a_button = (0, $b8hua$createMemo)(() => {
2026
- const button = button_elements();
2024
+ const view_more_button_elements = (0, $cb64b315b25cfc59$export$2f0cbfbb4354bb52)((0, $b8hua$createMemo)(() => rows_or_empty_object().button));
2025
+ const view_less_button_elements = (0, $cb64b315b25cfc59$export$2f0cbfbb4354bb52)((0, $b8hua$createMemo)(() => rows_or_empty_object().view_less_button));
2026
+ const have_a_view_more_button = (0, $b8hua$createMemo)(() => {
2027
+ const button = view_more_button_elements();
2028
+ return !(!button || Array.isArray(button) && !button.length);
2029
+ });
2030
+ const have_a_view_less_button = (0, $b8hua$createMemo)(() => {
2031
+ const button = view_less_button_elements();
2027
2032
  return !(!button || Array.isArray(button) && !button.length);
2028
2033
  });
2029
2034
  const [get_styling, set_styling] = (0, $b8hua$createSignal)();
@@ -2032,12 +2037,18 @@ function $63f1f8dbcd07d3b0$var$ActualSolidLayout(props, container_element) {
2032
2037
  const [get_children_count, set_children_count] = (0, $b8hua$createSignal)(0);
2033
2038
  const update_children_count = () => set_children_count(container_element.children.length);
2034
2039
  const col_styling = (0, $b8hua$createMemo)(() => (0, $b8hua$n_col_styling_with_dist)(selector_beginning, props.grid_spacing, props.cols_at_size, props.layout, props.override_vertical_spacing));
2035
- const default_currently_visible_signal = (0, $b8hua$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
2040
+ const default_currently_visible_signal = (0, $b8hua$createSignal)((0, $b8hua$untrack)(() => {
2041
+ var _rows_or_empty_object;
2042
+ return (_rows_or_empty_object = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object !== void 0 ? _rows_or_empty_object : 1;
2043
+ })); // 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
2036
2044
  const rows_visible_signal = (0, $b8hua$createMemo)(() => rows_or_empty_object().currently_visible || default_currently_visible_signal);
2037
2045
  const get_rows_visible = (0, $b8hua$createMemo)(() => rows_visible_signal()[0]());
2038
2046
  const set_rows_visible = (0, $b8hua$createMemo)(() => rows_visible_signal()[1]);
2039
- const button_class = (0, $b8hua$make_random_classname)();
2040
- const button_container = (0, $b8hua$createMemo)(() => have_a_button() && (0, $b8hua$ssr)($63f1f8dbcd07d3b0$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), "load-more-container " + (0, $b8hua$escape)(button_class, true), (0, $b8hua$escape)(rows_or_empty_object().button)));
2047
+ const view_more_button_class = (0, $b8hua$make_random_classname)();
2048
+ const view_less_button_class = (0, $b8hua$make_random_classname)();
2049
+ const view_more_button_container = (0, $b8hua$createMemo)(() => have_a_view_more_button() && (0, $b8hua$ssr)($63f1f8dbcd07d3b0$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), "load-more-container ".concat((0, $b8hua$escape)(view_more_button_class, true)), (0, $b8hua$escape)(rows_or_empty_object().button)));
2050
+ // 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
2051
+ const view_less_button_container = (0, $b8hua$createMemo)(() => have_a_view_less_button() && (0, $b8hua$ssr)($63f1f8dbcd07d3b0$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), "load-less-container ".concat((0, $b8hua$escape)(view_less_button_class, true)), (0, $b8hua$escape)(rows_or_empty_object().view_less_button)));
2041
2052
  container_element.classList.add(container_class);
2042
2053
  (0, $b8hua$createComputed)(() => {
2043
2054
  // Make sure we don't have more rows visible than max_rows (this could happen by max_rows being decreased)
@@ -2052,10 +2063,6 @@ function $63f1f8dbcd07d3b0$var$ActualSolidLayout(props, container_element) {
2052
2063
  set_styling(() => col_styling);
2053
2064
  return;
2054
2065
  }
2055
- (0, $b8hua$untrack)(() => {
2056
- var _rows_or_empty_object;
2057
- return set_rows_visible()((_rows_or_empty_object = rows_or_empty_object().start_rows) !== null && _rows_or_empty_object !== void 0 ? _rows_or_empty_object : 1);
2058
- });
2059
2066
  update_children_count();
2060
2067
  const mutation_observer = new MutationObserver((0, $b8hua$catchify)(update_children_count));
2061
2068
  mutation_observer.observe(container_element, {
@@ -2067,30 +2074,33 @@ function $63f1f8dbcd07d3b0$var$ActualSolidLayout(props, container_element) {
2067
2074
  () => (0, $b8hua$createMemo)(() => {
2068
2075
  const {
2069
2076
  rows_per_click: rows_per_click,
2070
- max_rows = -1
2077
+ max_rows = -1,
2078
+ start_rows: start_rows
2071
2079
  } = rows_or_empty_object();
2072
2080
  const rows_visible = get_rows_visible();
2073
2081
  const children_count = get_children_count();
2074
2082
  return col_styling() + props.cols_at_size.map(options => {
2075
- const [, min, max] = options;
2076
- let should_hide_button;
2083
+ const [recs_per_row, min, max] = options;
2084
+ let should_hide_view_more_button;
2077
2085
  let visible_recs;
2078
2086
  if (props.disable_partial_rows) {
2079
2087
  visible_recs = (0, $b8hua$layout_get_visible_recs_without_partial_rows)(rows_visible, children_count, options);
2080
2088
  const visible_recs_next_show_more = (0, $b8hua$layout_get_visible_recs_without_partial_rows)(rows_visible + (rows_per_click || 0),
2081
2089
  // Should this really be zero when we default rows_per_click to 1?
2082
2090
  children_count, options);
2083
- should_hide_button = visible_recs === visible_recs_next_show_more;
2091
+ should_hide_view_more_button = visible_recs === visible_recs_next_show_more;
2084
2092
  } else {
2085
2093
  visible_recs = (0, $b8hua$layout_get_total_rec_amount_for_row)(rows_visible, options);
2086
- should_hide_button = visible_recs >= children_count;
2094
+ should_hide_view_more_button = visible_recs >= children_count;
2087
2095
  }
2088
- const should_hide_button_final = button_class && (should_hide_button || max_rows !== -1 && rows_visible >= max_rows);
2089
- return "".concat((0, $b8hua$layout_media_query_header)(min, max), "{").concat(selector_beginning, ":nth-child(n+").concat(visible_recs + 1, "){display:none}").concat(props.layout == "slider" ? "".concat(selector_beginning, ":nth-child(n+").concat(visible_recs, "){margin-right:0}") : "").concat(should_hide_button_final ? ".depict .".concat(button_class, "{display:none!important}") : "", "}");
2096
+ const should_hide_button_final = should_hide_view_more_button || max_rows !== -1 && rows_visible >= max_rows;
2097
+ // 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
2098
+ 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;
2099
+ return "".concat((0, $b8hua$layout_media_query_header)(min, max), "{").concat(selector_beginning, ":nth-child(n+").concat(visible_recs + 1, "){display:none}").concat(props.layout == "slider" ? "".concat(selector_beginning, ":nth-child(n+").concat(visible_recs, "){margin-right:0}") : "").concat(should_hide_button_final ? ".depict .".concat(view_more_button_class, "{display:none!important}") : "").concat(should_hide_view_less_button ? ".depict .".concat(view_less_button_class, "{display:none!important}") : "", "}");
2090
2100
  }).join("");
2091
2101
  }));
2092
2102
  });
2093
- return [container_element, button_container(), (0, $b8hua$ssr)($63f1f8dbcd07d3b0$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), get_styling)];
2103
+ return [container_element, view_more_button_container(), view_less_button_container(), (0, $b8hua$ssr)($63f1f8dbcd07d3b0$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), get_styling)];
2094
2104
  }
2095
2105
  async function $d5f1e6a0f9117286$export$79b1565500412d9b(search_modal, modal_fn_opts) {
2096
2106
  const body = await (0, $b8hua$observer).wait_for_element("body");
@@ -2195,6 +2205,43 @@ function $972f6bce0f9d61be$var$history_state_change(signals, entries, state) {
2195
2205
  }
2196
2206
  });
2197
2207
  }
2208
+ const $68e6625c8d51f847$export$3064e1e8c6513da3 = new Set();
2209
+ let $68e6625c8d51f847$var$has_ran = false;
2210
+ function $68e6625c8d51f847$export$5162a71f252e6122() {
2211
+ if ($68e6625c8d51f847$var$has_ran || typeof history !== "object") return;
2212
+ $68e6625c8d51f847$var$has_ran = true;
2213
+ for (const function_name of ["replaceState", "pushState"]) {
2214
+ if (Object.getOwnPropertyNames(history).includes(function_name)) $68e6625c8d51f847$var$proxy_push_state(function_name, history);
2215
+ $68e6625c8d51f847$var$proxy_push_state(function_name, History.prototype);
2216
+ }
2217
+ }
2218
+ function $68e6625c8d51f847$var$proxy_push_state(function_name, thing) {
2219
+ thing[function_name] = new Proxy(thing[function_name], {
2220
+ apply(target, this_arg, arg_list) {
2221
+ try {
2222
+ if (typeof arg_list[0] == "object") {
2223
+ const cloned_object = {
2224
+ ...arg_list[0]
2225
+ };
2226
+ const old_state = history.state;
2227
+ for (const key in old_state) {
2228
+ if (!$68e6625c8d51f847$var$starts_with_any_prefix(key)) continue;
2229
+ if (!(key in cloned_object)) cloned_object[key] = old_state[key];
2230
+ }
2231
+ arg_list[0] = cloned_object;
2232
+ }
2233
+ } catch (e) {
2234
+ (0, $b8hua$report)([e, "Failed to preserve items in history.state"], "error");
2235
+ }
2236
+ return Reflect.apply(target, this_arg, arg_list);
2237
+ }
2238
+ });
2239
+ }
2240
+ function $68e6625c8d51f847$var$starts_with_any_prefix(key) {
2241
+ for (const prefix of $68e6625c8d51f847$export$3064e1e8c6513da3) {
2242
+ if (key.startsWith(prefix)) return true;
2243
+ }
2244
+ }
2198
2245
  function $bc811d9630f9579b$export$9862539c89138352(_ref) {
2199
2246
  let {
2200
2247
  get_default_values_: get_default_values_,
@@ -2221,6 +2268,8 @@ function $bc811d9630f9579b$export$9862539c89138352(_ref) {
2221
2268
  let [key, value] = _ref3;
2222
2269
  return [key.slice(prefix_.length), value];
2223
2270
  }));
2271
+ (0, $68e6625c8d51f847$export$3064e1e8c6513da3).add(prefix_);
2272
+ // There's intentionally no onCleanup here since we want to preserve the state even if all components (in i.e. react-ui) that use the provider running this are unmounted and the provider is destroyed, since it might be re-created and need the old state (for example for doing scroll restoration)
2224
2273
  return [reset_state, unprefixed_state];
2225
2274
  }
2226
2275
 
@@ -2282,16 +2331,17 @@ var $284849364a6ef73a$var$_get_user_id = /*#__PURE__*/new WeakMap();
2282
2331
  var $284849364a6ef73a$var$_get_session_id = /*#__PURE__*/new WeakMap();
2283
2332
  var $284849364a6ef73a$var$_guard_url_creator_length = /*#__PURE__*/new WeakSet();
2284
2333
  var $284849364a6ef73a$var$_run_url_creator_for_suggest = /*#__PURE__*/new WeakSet();
2285
- var $284849364a6ef73a$var$_run_url_creator_for_rest = /*#__PURE__*/new WeakSet();
2334
+ var $284849364a6ef73a$var$_run_display_transformers_for_rest = /*#__PURE__*/new WeakSet();
2286
2335
  var $284849364a6ef73a$var$_cached_post_request = /*#__PURE__*/new WeakSet();
2287
2336
  class $284849364a6ef73a$export$e015ed2f2950f2e3 {
2288
2337
  constructor(options) {
2289
2338
  $284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_cached_post_request);
2290
- $284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_run_url_creator_for_rest);
2339
+ $284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_run_display_transformers_for_rest);
2291
2340
  $284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_run_url_creator_for_suggest);
2292
2341
  $284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_guard_url_creator_length);
2293
2342
  $284849364a6ef73a$var$_classPrivateMethodInitSpec(this, $284849364a6ef73a$var$_get_cache_obj_for_endpoint);
2294
2343
  (0, $b8hua$babelruntimehelpersdefineProperty)(this, "page_url_creator", void 0);
2344
+ (0, $b8hua$babelruntimehelpersdefineProperty)(this, "display_transformers", void 0);
2295
2345
  $284849364a6ef73a$var$_classPrivateFieldInitSpec(this, $284849364a6ef73a$var$_supports_finalization_registry, {
2296
2346
  writable: true,
2297
2347
  value: typeof FinalizationRegistry === "function"
@@ -2330,12 +2380,14 @@ class $284849364a6ef73a$export$e015ed2f2950f2e3 {
2330
2380
  get_metadata: get_metadata,
2331
2381
  get_user_id: _get_user_id2,
2332
2382
  get_session_id: _get_session_id2,
2333
- page_url_creator: page_url_creator
2383
+ page_url_creator: _page_url_creator,
2384
+ display_transformers: _display_transformers
2334
2385
  } = options !== null && options !== void 0 ? options : {};
2335
2386
  (0, $b8hua$babelruntimehelpersclassPrivateFieldSet)(this, $284849364a6ef73a$var$_get_metadata, get_metadata);
2336
2387
  (0, $b8hua$babelruntimehelpersclassPrivateFieldSet)(this, $284849364a6ef73a$var$_get_user_id, _get_user_id2);
2337
2388
  (0, $b8hua$babelruntimehelpersclassPrivateFieldSet)(this, $284849364a6ef73a$var$_get_session_id, _get_session_id2);
2338
- this.page_url_creator = page_url_creator;
2389
+ this.page_url_creator = _page_url_creator;
2390
+ this.display_transformers = _display_transformers;
2339
2391
  }
2340
2392
  async suggest(input_req) {
2341
2393
  var _classPrivateFieldGet4;
@@ -2412,14 +2464,19 @@ function $284849364a6ef73a$var$_guard_url_creator_length2(expected, received) {
2412
2464
  }
2413
2465
  }
2414
2466
  async function $284849364a6ef73a$var$_run_url_creator_for_suggest2(merchant, market, response) {
2415
- if (!this.page_url_creator) return response;
2467
+ var _this$display_transfo;
2468
+ const page_url_creator = this.page_url_creator;
2469
+ const category_transformer = (_this$display_transfo = this.display_transformers) === null || _this$display_transfo === void 0 ? void 0 : _this$display_transfo.categories;
2470
+ if (!page_url_creator && !category_transformer) return response;
2416
2471
  // find category suggestions, run thing with them, and then replace them
2417
2472
  const category_suggestions = response.suggestions.filter(suggestion => suggestion.type === "category");
2418
- const page_urls = await this.page_url_creator({
2419
- type: "categories",
2473
+ const page_urls = await (page_url_creator || category_transformer)({
2420
2474
  market: market,
2421
2475
  merchant: merchant,
2422
- data: [...category_suggestions]
2476
+ data: [...category_suggestions],
2477
+ ...(page_url_creator ? {
2478
+ type: "categories"
2479
+ } : {})
2423
2480
  });
2424
2481
  $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_guard_url_creator_length, $284849364a6ef73a$var$_guard_url_creator_length2).call(this, category_suggestions, page_urls);
2425
2482
  while (page_urls.length)
@@ -2427,17 +2484,29 @@ async function $284849364a6ef73a$var$_run_url_creator_for_suggest2(merchant, mar
2427
2484
  Object.defineProperties(category_suggestions.pop(), Object.getOwnPropertyDescriptors(page_urls.pop()));
2428
2485
  return response;
2429
2486
  }
2430
- async function $284849364a6ef73a$var$_run_url_creator_for_rest2(merchant, market, input_data) {
2431
- if (!this.page_url_creator) return input_data;
2487
+ async function $284849364a6ef73a$var$_run_display_transformers_for_rest2(merchant, market, input_data) {
2488
+ const {
2489
+ page_url_creator: page_url_creator,
2490
+ display_transformers: display_transformers
2491
+ } = this;
2492
+ if (!page_url_creator && !display_transformers) return input_data;
2493
+ const product_transformer = display_transformers === null || display_transformers === void 0 ? void 0 : display_transformers.products;
2494
+ const category_transformer = display_transformers === null || display_transformers === void 0 ? void 0 : display_transformers.categories;
2495
+ const content_result_transformer = display_transformers === null || display_transformers === void 0 ? void 0 : display_transformers.contentResults;
2432
2496
  const displays = input_data.displays;
2433
- const breadcrumb = input_data.breadcrumb;
2434
- const quick_links = input_data.quick_links;
2435
- if (displays) {
2436
- const page_urls = await this.page_url_creator({
2437
- type: "products",
2497
+ const {
2498
+ breadcrumb: breadcrumb,
2499
+ quick_links: quick_links,
2500
+ content_search_links: content_search_links
2501
+ } = input_data;
2502
+ if (displays && (page_url_creator || product_transformer)) {
2503
+ const page_urls = await (page_url_creator || product_transformer)({
2438
2504
  merchant: merchant,
2439
2505
  market: market,
2440
- displays: [...input_data.displays]
2506
+ displays: [...input_data.displays],
2507
+ ...(page_url_creator ? {
2508
+ type: "products"
2509
+ } : {})
2441
2510
  });
2442
2511
  $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_guard_url_creator_length, $284849364a6ef73a$var$_guard_url_creator_length2).call(this, displays, page_urls);
2443
2512
  for (let i = 0; i < displays.length; i++) {
@@ -2455,19 +2524,30 @@ async function $284849364a6ef73a$var$_run_url_creator_for_rest2(merchant, market
2455
2524
  displays[i] = new_display_or_page_url;
2456
2525
  }
2457
2526
  }
2458
- for (const category_display_array of [breadcrumb, quick_links]) {
2527
+ if (page_url_creator || category_transformer) for (const category_display_array of [breadcrumb, quick_links]) {
2459
2528
  if (!category_display_array) continue;
2460
- const page_urls = await this.page_url_creator({
2461
- type: "categories",
2529
+ const page_urls = await (page_url_creator || category_transformer)({
2462
2530
  merchant: merchant,
2463
2531
  market: market,
2464
- data: [...category_display_array]
2532
+ data: [...category_display_array],
2533
+ ...(page_url_creator ? {
2534
+ type: "categories"
2535
+ } : {})
2465
2536
  });
2466
2537
  $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_guard_url_creator_length, $284849364a6ef73a$var$_guard_url_creator_length2).call(this, category_display_array, page_urls);
2467
2538
  for (let i = 0; i < category_display_array.length; i++)
2468
2539
  // Copy over getters so we sneakily can make this reactive
2469
2540
  Object.defineProperties(category_display_array[i], Object.getOwnPropertyDescriptors(page_urls[i]));
2470
2541
  }
2542
+ if (content_search_links !== null && content_search_links !== void 0 && content_search_links.length && content_result_transformer) {
2543
+ const result = await content_result_transformer({
2544
+ merchant: merchant,
2545
+ market: market,
2546
+ data: [...content_search_links]
2547
+ });
2548
+ $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_guard_url_creator_length, $284849364a6ef73a$var$_guard_url_creator_length2).call(this, content_search_links, result);
2549
+ input_data.content_search_links = result;
2550
+ }
2471
2551
  return input_data;
2472
2552
  }
2473
2553
  async function $284849364a6ef73a$var$_cached_post_request2(endpoint, input_req, fallback_response) {
@@ -2495,7 +2575,7 @@ async function $284849364a6ef73a$var$_cached_post_request2(endpoint, input_req,
2495
2575
  let result;
2496
2576
  try {
2497
2577
  const unmodified_result = await api_response.json();
2498
- result = await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_run_url_creator_for_rest, $284849364a6ef73a$var$_run_url_creator_for_rest2).call(this, input_req.tenant, input_req.market, unmodified_result);
2578
+ result = await $284849364a6ef73a$var$_classPrivateMethodGet(this, $284849364a6ef73a$var$_run_display_transformers_for_rest, $284849364a6ef73a$var$_run_display_transformers_for_rest2).call(this, input_req.tenant, input_req.market, unmodified_result);
2499
2579
  } catch (e) {
2500
2580
  (0, $b8hua$dwarn)("URL creator or json decoding failed", e);
2501
2581
  break return_successfully;
@@ -2585,12 +2665,11 @@ function $9b5022ae72f56399$var$correct_range_filter_range_once(_ref3) {
2585
2665
  }
2586
2666
  function $43fbdca0f726a34b$export$92f2da32c6e7e7ee(_ref) {
2587
2667
  let {
2588
- search_results_: search_results_,
2668
+ number_: number_,
2589
2669
  i18n_: i18n_
2590
2670
  } = _ref;
2591
2671
  return (0, $b8hua$createMemo)(() => {
2592
- var _search_results_;
2593
- const n_hits = (_search_results_ = search_results_()) === null || _search_results_ === void 0 ? void 0 : _search_results_.n_hits;
2672
+ const n_hits = number_();
2594
2673
  if (isNaN(n_hits)) return "";
2595
2674
  const price_formatting = i18n_.price_formatting_();
2596
2675
  return (0, $b8hua$standard_price_format)(n_hits, 0,
@@ -4811,7 +4890,10 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
4811
4890
  const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $b8hua$createSignal)(false);
4812
4891
  const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $b8hua$createSignal)();
4813
4892
  const formatted_number_of_results_ = (0, $43fbdca0f726a34b$export$92f2da32c6e7e7ee)({
4814
- search_results_: plp_results_,
4893
+ number_: (0, $b8hua$createMemo)(() => {
4894
+ var _plp_results_5;
4895
+ return (_plp_results_5 = plp_results_()) === null || _plp_results_5 === void 0 ? void 0 : _plp_results_5.n_hits;
4896
+ }),
4815
4897
  i18n_: i18n_
4816
4898
  });
4817
4899
  const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $b8hua$createSignal)();
@@ -4834,8 +4916,8 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
4834
4916
  }
4835
4917
  })), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
4836
4918
  get when() {
4837
- var _plp_results_5;
4838
- return ((_plp_results_5 = plp_results_()) === null || _plp_results_5 === void 0 ? void 0 : _plp_results_5.n_hits) === 1;
4919
+ var _plp_results_6;
4920
+ return ((_plp_results_6 = plp_results_()) === null || _plp_results_6 === void 0 ? void 0 : _plp_results_6.n_hits) === 1;
4839
4921
  },
4840
4922
  get fallback() {
4841
4923
  return i18n_.products_();
@@ -5017,8 +5099,8 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
5017
5099
  formatted_number_of_results_: formatted_number_of_results_,
5018
5100
  i18n_: i18n_,
5019
5101
  number_of_results_: (0, $b8hua$createMemo)(() => {
5020
- var _plp_results_6;
5021
- return (_plp_results_6 = plp_results_()) === null || _plp_results_6 === void 0 ? void 0 : _plp_results_6.n_hits;
5102
+ var _plp_results_7;
5103
+ return (_plp_results_7 = plp_results_()) === null || _plp_results_7 === void 0 ? void 0 : _plp_results_7.n_hits;
5022
5104
  })
5023
5105
  });
5024
5106
  }
@@ -5036,37 +5118,6 @@ function $4b4b262708b516ee$export$f7d2f673fc2f091d(_ref) {
5036
5118
  }
5037
5119
  })))];
5038
5120
  }
5039
- let $68e6625c8d51f847$var$has_ran = false;
5040
- function $68e6625c8d51f847$export$5162a71f252e6122() {
5041
- if ($68e6625c8d51f847$var$has_ran || typeof history !== "object") return;
5042
- $68e6625c8d51f847$var$has_ran = true;
5043
- for (const function_name of ["replaceState", "pushState"]) {
5044
- if (Object.getOwnPropertyNames(history).includes(function_name)) $68e6625c8d51f847$var$proxy_push_state(function_name, history);
5045
- $68e6625c8d51f847$var$proxy_push_state(function_name, History.prototype);
5046
- }
5047
- }
5048
- function $68e6625c8d51f847$var$proxy_push_state(function_name, thing) {
5049
- thing[function_name] = new Proxy(thing[function_name], {
5050
- apply(target, this_arg, arg_list) {
5051
- try {
5052
- if (typeof arg_list[0] == "object") {
5053
- const cloned_object = {
5054
- ...arg_list[0]
5055
- };
5056
- const old_state = history.state;
5057
- for (const key in old_state) {
5058
- if (!key.startsWith("category_") && !key.startsWith("search_")) continue;
5059
- if (!(key in cloned_object)) cloned_object[key] = old_state[key];
5060
- }
5061
- arg_list[0] = cloned_object;
5062
- }
5063
- } catch (e) {
5064
- (0, $b8hua$report)([e, "Failed to preserve items in history.state"], "error");
5065
- }
5066
- return Reflect.apply(target, this_arg, arg_list);
5067
- }
5068
- });
5069
- }
5070
5121
  const $a9c7ba6087881ac2$var$transform_elements = sorted_cols_at_size => {
5071
5122
  const cols_at_size = [];
5072
5123
  for (let i = 0; i < sorted_cols_at_size.length; i++) {
@@ -5409,7 +5460,6 @@ function $f5f54892fd0c7d9f$var$_classApplyDescriptorGet(receiver, descriptor) {
5409
5460
  return descriptor.value;
5410
5461
  }
5411
5462
  // 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
5412
- // on old displays, no page_url_creator can be specified
5413
5463
  /**
5414
5464
  * Type for the private properties that are shared between the different exported search SDK wrapper functions.
5415
5465
  * SDK users are not allowed to change/access these, they're an internal implementation detail.
@@ -5472,6 +5522,7 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
5472
5522
  api: api,
5473
5523
  on_navigation: on_navigation,
5474
5524
  page_url_creator: page_url_creator,
5525
+ display_transformers: display_transformers,
5475
5526
  unique_instance_key_for_state = "",
5476
5527
  query_id_state_key: query_id_state_key,
5477
5528
  ...props_on_class
@@ -5540,8 +5591,10 @@ class $f5f54892fd0c7d9f$export$f34314aa9505732e {
5540
5591
  quicklinks_signal_: (0, $b8hua$createSignal)(),
5541
5592
  i18n_: i18n_,
5542
5593
  reset_history_state_: reset_history_state_,
5594
+ // @ts-ignore
5543
5595
  depict_api_: api !== null && api !== void 0 ? api : new (0, $284849364a6ef73a$export$e015ed2f2950f2e3)({
5544
- page_url_creator: page_url_creator
5596
+ page_url_creator: page_url_creator,
5597
+ display_transformers: display_transformers
5545
5598
  }),
5546
5599
  router_: (0, $b8hua$babelruntimehelpersclassPrivateFieldGet)(this, $f5f54892fd0c7d9f$var$_router),
5547
5600
  selected_filters_: selected_filters_,
@@ -6026,13 +6079,12 @@ function $8ef6232475d44150$export$7de92c4c2205ebf3(_ref) {
6026
6079
  });
6027
6080
  }
6028
6081
  function $8ef6232475d44150$var$make_state_saved_rows(_ref3, i18n_) {
6029
- var _untrack;
6030
6082
  let [get_showing_recommendation_rows, set_showing_recommendation_rows] = _ref3;
6031
- const currently_visible = (0, $b8hua$createSignal)(0); // this number shouldn't matter for anything except typing
6083
+ const currently_visible = (0, $b8hua$createSignal)((0, $b8hua$untrack)(get_showing_recommendation_rows));
6032
6084
  const [get_currently_visible, set_currently_visible] = currently_visible;
6033
6085
  const rows = {
6034
6086
  currently_visible: currently_visible,
6035
- start_rows: (_untrack = (0, $b8hua$untrack)(get_showing_recommendation_rows)) !== null && _untrack !== void 0 ? _untrack : $8ef6232475d44150$export$1c8c715550dc689d,
6087
+ start_rows: $8ef6232475d44150$export$1c8c715550dc689d,
6036
6088
  rows_per_click: 3,
6037
6089
  button: (0, $b8hua$ssr)($8ef6232475d44150$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(i18n_.view_more_()))
6038
6090
  };
@@ -6201,7 +6253,7 @@ const $b65f93acbf91da56$export$27b710c08412a7ad = obj => {
6201
6253
  return Object.fromEntries(Object.keys(obj).map(key => [key, obj[key]()]));
6202
6254
  };
6203
6255
  const $9a693c7e832d3f18$var$_tmpl$ = ["<span", ' class="orig price"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></span>"],
6204
- $9a693c7e832d3f18$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>"],
6256
+ $9a693c7e832d3f18$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>"],
6205
6257
  $9a693c7e832d3f18$var$_tmpl$3 = ["<div", ' class="tagline">', "</div>"];
6206
6258
  const $9a693c7e832d3f18$export$b05c0ae390cf3e06 = (display_or_variant_container, _ref, router_) => {
6207
6259
  let {
@@ -6274,9 +6326,11 @@ function $f7414b949aeabc90$export$62f101a8aa597bf8(_ref) {
6274
6326
  render_instant_card_placeholder_: render_instant_card_placeholder_,
6275
6327
  min_products_to_fetch_: min_products_to_fetch_,
6276
6328
  has_sort_or_filters_: has_sort_or_filters_,
6277
- set_num_results_accessor_: set_num_results_accessor_,
6329
+ set_total_num_results_accessor_: set_total_num_results_accessor_,
6278
6330
  i18n_: i18n_,
6279
- router_: router_
6331
+ router_: router_,
6332
+ set_modal_search_results_: set_modal_search_results_,
6333
+ content_search_enabled_: content_search_enabled_
6280
6334
  } = _ref;
6281
6335
  const max_cards = 4;
6282
6336
  const [read_current_instant_query, write_current_instant_query] = (0, $b8hua$createSignal)("");
@@ -6301,13 +6355,23 @@ function $f7414b949aeabc90$export$62f101a8aa597bf8(_ref) {
6301
6355
  ...variable_data
6302
6356
  });
6303
6357
  }));
6304
- set_num_results_accessor_(() => (0, $43fbdca0f726a34b$export$92f2da32c6e7e7ee)({
6305
- search_results_: search_results,
6358
+ // 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
6359
+ // This is for the press-enter-to-instant-content-result feature which gets called from Autocomplete.tsx
6360
+ set_modal_search_results_(() => search_results);
6361
+ (0, $b8hua$onCleanup)(() => set_modal_search_results_(undefined)); // for consistency, in case this component crashes
6362
+ set_total_num_results_accessor_(() => (0, $43fbdca0f726a34b$export$92f2da32c6e7e7ee)({
6363
+ number_: (0, $b8hua$createMemo)(() => {
6364
+ var _search_results, _search_results2, _search_results2$cont;
6365
+ const hits = (_search_results = search_results()) === null || _search_results === void 0 ? void 0 : _search_results.n_hits;
6366
+ const content_results = (_search_results2 = search_results()) === null || _search_results2 === void 0 ? void 0 : (_search_results2$cont = _search_results2.content_search_links) === null || _search_results2$cont === void 0 ? void 0 : _search_results2$cont.length;
6367
+ if (!content_results || !content_search_enabled_()) return hits;
6368
+ return (hits !== null && hits !== void 0 ? hits : 0) + content_results;
6369
+ }),
6306
6370
  i18n_: i18n_
6307
6371
  }));
6308
6372
  const sliced_displays = (0, $b8hua$createMemo)(() => {
6309
- var _search_results, _search_results$displ;
6310
- return (_search_results = search_results()) === null || _search_results === void 0 ? void 0 : (_search_results$displ = _search_results.displays) === null || _search_results$displ === void 0 ? void 0 : _search_results$displ.slice(0, max_cards);
6373
+ var _search_results3, _search_results3$disp;
6374
+ return (_search_results3 = search_results()) === null || _search_results3 === void 0 ? void 0 : (_search_results3$disp = _search_results3.displays) === null || _search_results3$disp === void 0 ? void 0 : _search_results3$disp.slice(0, max_cards);
6311
6375
  });
6312
6376
  let placeholder;
6313
6377
  return (0, $b8hua$ssr)($f7414b949aeabc90$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
@@ -6317,8 +6381,8 @@ function $f7414b949aeabc90$export$62f101a8aa597bf8(_ref) {
6317
6381
  },
6318
6382
  get fallback() {
6319
6383
  return (0, $b8hua$createMemo)(() => {
6320
- var _search_results2;
6321
- if (Array.isArray((_search_results2 = search_results()) === null || _search_results2 === void 0 ? void 0 : _search_results2.displays))
6384
+ var _search_results4;
6385
+ if (Array.isArray((_search_results4 = search_results()) === null || _search_results4 === void 0 ? void 0 : _search_results4.displays))
6322
6386
  // remove placeholders if we have a response but no results
6323
6387
  return undefined;
6324
6388
  return new Array(max_cards).fill(1).map(() => (placeholder || (placeholder = render_instant_card_placeholder_())).cloneNode(true));
@@ -6373,7 +6437,7 @@ function $6d95ef50ee01d5a1$export$5d2caaa6b530761c() {
6373
6437
  return (0, $b8hua$ssr)($6d95ef50ee01d5a1$var$_tmpl$, (0, $b8hua$ssrHydrationKey)());
6374
6438
  }
6375
6439
  const $494c9ad553139dbc$var$_tmpl$ = ["<div", ' class="previous-searches"><h2 class="text">', '</h2><div class="list">', "</div></div>"],
6376
- $494c9ad553139dbc$var$_tmpl$2 = ["<a", ' class="', '"', '><div class="left"><!--#-->', "<!--/--><span>", '</span></div><button class="delete"', ">", "</button></a>"];
6440
+ $494c9ad553139dbc$var$_tmpl$2 = ["<a", ' class="', '"', '><div class="left"><!--#-->', '<!--/--><span class="line-clamp"', ">", '</span></div><button class="delete"', ">", "</button></a>"];
6377
6441
  function $494c9ad553139dbc$export$a146ac6fa8346a25(_ref) {
6378
6442
  let {
6379
6443
  text_: text_,
@@ -6417,14 +6481,14 @@ function $494c9ad553139dbc$export$a146ac6fa8346a25(_ref) {
6417
6481
  return (0, $b8hua$ssr)($494c9ad553139dbc$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), "".concat("item", " ").concat((0, $b8hua$createMemo)(() => {
6418
6482
  var _read_selected_index_, _read_selected_index_2;
6419
6483
  return ((_read_selected_index_ = read_selected_index_()) === null || _read_selected_index_ === void 0 ? void 0 : _read_selected_index_[0]) === 0 && ((_read_selected_index_2 = read_selected_index_()) === null || _read_selected_index_2 === void 0 ? void 0 : _read_selected_index_2[1]) === index;
6420
- })() ? "selected" : ""), (0, $b8hua$ssrAttribute)("href", (0, $b8hua$escape)(href(), true), false), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $6d95ef50ee01d5a1$export$5d2caaa6b530761c), {})), (0, $b8hua$escape)(item()), (0, $b8hua$ssrAttribute)("title", (0, $b8hua$escape)(i18n_.previous_searches_delete_entry_from_history_(), true), false), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $9783d437ad61594c$export$3b621d86b1566b2), {})));
6484
+ })() ? "selected" : ""), (0, $b8hua$ssrAttribute)("href", (0, $b8hua$escape)(href(), true), false), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $6d95ef50ee01d5a1$export$5d2caaa6b530761c), {})), (0, $b8hua$ssrAttribute)("title", (0, $b8hua$escape)(item(), true), false), (0, $b8hua$escape)(item()), (0, $b8hua$ssrAttribute)("title", (0, $b8hua$escape)(i18n_.previous_searches_delete_entry_from_history_(), true), false), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $9783d437ad61594c$export$3b621d86b1566b2), {})));
6421
6485
  }
6422
6486
  })));
6423
6487
  }
6424
6488
  });
6425
6489
  }
6426
6490
  const $02b6641aa50ce528$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"],
6427
- $02b6641aa50ce528$var$_tmpl$2 = ["<span", ' class="', '">', "</span>"];
6491
+ $02b6641aa50ce528$var$_tmpl$2 = ["<span", ' class="', '"', ">", "</span>"];
6428
6492
  function $02b6641aa50ce528$export$ba17c5b7e6dda39f(_ref) {
6429
6493
  let {
6430
6494
  whole_text_to_display_: whole_text_to_display_memo,
@@ -6475,16 +6539,28 @@ function $02b6641aa50ce528$export$ba17c5b7e6dda39f(_ref) {
6475
6539
  }
6476
6540
  return output;
6477
6541
  }));
6478
- return (0, $b8hua$ssr)($02b6641aa50ce528$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), "".concat((0, $b8hua$escape)(class_, true) || "", " ").concat(get_has_highlighted() ? "has-history-match" : ""), (0, $b8hua$escape)(text_itself()));
6542
+ return (0, $b8hua$ssr)($02b6641aa50ce528$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), "".concat((0, $b8hua$escape)(class_, true) || "", " ").concat(get_has_highlighted() ? "has-history-match" : ""), (0, $b8hua$ssrAttribute)("title", (0, $b8hua$escape)(whole_text_to_display_memo(), true), false), (0, $b8hua$escape)(text_itself()));
6543
+ }
6544
+ const $3c5e15c6ee4227a9$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>';
6545
+ function $3c5e15c6ee4227a9$export$605674723bcc715c() {
6546
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
6547
+ return (0, $b8hua$ssrElement)("svg", () => ({
6548
+ "xmlns": "http://www.w3.org/2000/svg",
6549
+ "width": "32",
6550
+ "height": "32",
6551
+ "viewBox": "0 0 256 256",
6552
+ ...props
6553
+ }), () => (0, $b8hua$ssr)($3c5e15c6ee4227a9$var$_tmpl$), true);
6479
6554
  }
6480
6555
  const $40dd3f46f55d62ba$var$_tmpl$ = ["<a", ' class="', '"', ">", "</a>"],
6481
6556
  $40dd3f46f55d62ba$var$_tmpl$2 = ["<div", ' class="search-icon">', "</div>"],
6482
6557
  $40dd3f46f55d62ba$var$_tmpl$3 = ["<span", ' class="type">', "</span>"],
6483
6558
  $40dd3f46f55d62ba$var$_tmpl$4 = ["<div", "><!--#-->", '<!--/--><span class="value">', "</span></div>"],
6484
- $40dd3f46f55d62ba$var$_tmpl$5 = ["<h2", ' class="text">', "</h2>"],
6485
- $40dd3f46f55d62ba$var$_tmpl$6 = ["<div", ' class="suggestion-container query"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
6486
- $40dd3f46f55d62ba$var$_tmpl$7 = ["<div", ' class="suggestion-container page">', "</div>"],
6487
- $40dd3f46f55d62ba$var$_tmpl$8 = ["<div", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
6559
+ $40dd3f46f55d62ba$var$_tmpl$5 = ["<div", ' class="with-icon"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
6560
+ $40dd3f46f55d62ba$var$_tmpl$6 = ["<h2", ' class="text">', "</h2>"],
6561
+ $40dd3f46f55d62ba$var$_tmpl$7 = ["<div", ' class="suggestion-container query"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
6562
+ $40dd3f46f55d62ba$var$_tmpl$8 = ["<div", ' class="suggestion-container page">', "</div>"],
6563
+ $40dd3f46f55d62ba$var$_tmpl$9 = ["<div", ' class="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
6488
6564
  function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
6489
6565
  let {
6490
6566
  suggestion_memo_: suggestion_memo_,
@@ -6498,7 +6574,8 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
6498
6574
  include_category_suggestions_: include_category_suggestions_,
6499
6575
  searching_for_value_: searching_for_value_,
6500
6576
  router_: router_,
6501
- submit_query_: submit_query_
6577
+ submit_query_: submit_query_,
6578
+ get_content_results_: get_content_results_
6502
6579
  } = _ref;
6503
6580
  const queries_memo = (0, $b8hua$createMemo)(() => suggestion_memo_().filter(_ref2 => {
6504
6581
  let {
@@ -6509,12 +6586,18 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
6509
6586
  } // don't show the ones we already show from the history
6510
6587
  ));
6511
6588
 
6512
- const not_queries_memo = (0, $b8hua$createMemo)(() => suggestion_memo_().filter(_ref3 => {
6513
- let {
6514
- type: type
6515
- } = _ref3;
6516
- return type !== (0, $7cd4d275a9f8d600$export$3cf9497e790da491);
6517
- }));
6589
+ const not_queries_memo = (0, $b8hua$createMemo)(() => {
6590
+ // For the section that shows categories and content results
6591
+ // We want to limit to 3 items, and we want to show the categories first
6592
+ const content_results = get_content_results_() || [];
6593
+ const from_suggest_request = include_category_suggestions_ ? suggestion_memo_().filter(_ref3 => {
6594
+ let {
6595
+ type: type
6596
+ } = _ref3;
6597
+ return type !== (0, $7cd4d275a9f8d600$export$3cf9497e790da491);
6598
+ }) : [];
6599
+ return [...from_suggest_request.slice(0, content_results.length ? 2 : 3), ...content_results.slice(0, 1)];
6600
+ });
6518
6601
  const render_entry = function (input_obj, autocomplete_data_index, index) {
6519
6602
  let is_history = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
6520
6603
  const is_query = (0, $b8hua$createMemo)(() => input_obj().type === (0, $7cd4d275a9f8d600$export$3cf9497e790da491));
@@ -6524,10 +6607,11 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
6524
6607
  url_transformer_: url_transformer_
6525
6608
  }) : undefined);
6526
6609
  const href = (0, $b8hua$createMemo)(() => is_query() ? href_with_changed_params_accessor()() : input_obj().page_url);
6527
- return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), "suggestion ".concat((0, $b8hua$createMemo)(() => {
6610
+ const is_selected = (0, $b8hua$createMemo)(() => {
6528
6611
  var _read_selected_index_, _read_selected_index_2;
6529
6612
  return ((_read_selected_index_ = read_selected_index_()) === null || _read_selected_index_ === void 0 ? void 0 : _read_selected_index_[0]) === autocomplete_data_index && ((_read_selected_index_2 = read_selected_index_()) === null || _read_selected_index_2 === void 0 ? void 0 : _read_selected_index_2[1]) === index;
6530
- })() ? "selected" : "", " ").concat(is_history ? "history" : "", " ").concat((0, $b8hua$escape)((0, $b8hua$escape)("type-" + input_obj().type, true), true)), (0, $b8hua$ssrAttribute)("href", (0, $b8hua$escape)(href(), true), false), is_query() ? (0, $b8hua$escape)([(0, $b8hua$createComponent)((0, $b8hua$Show), {
6613
+ });
6614
+ return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), "suggestion ".concat(is_selected() ? "selected" : "", " ").concat(is_history ? "history" : "", " ").concat((0, $b8hua$escape)((0, $b8hua$escape)("type-" + input_obj().type, true), true)), (0, $b8hua$ssrAttribute)("href", (0, $b8hua$escape)(href(), true), false), is_query() ? (0, $b8hua$escape)([(0, $b8hua$createComponent)((0, $b8hua$Show), {
6531
6615
  when: is_history,
6532
6616
  get fallback() {
6533
6617
  return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $ef0f18a578b32578$export$82eafebb825fc23f), {})));
@@ -6536,24 +6620,34 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
6536
6620
  return (0, $b8hua$createComponent)((0, $6d95ef50ee01d5a1$export$5d2caaa6b530761c), {});
6537
6621
  }
6538
6622
  }), (0, $b8hua$createComponent)((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
6539
- class_: "value",
6623
+ class_: "value line-clamp",
6624
+ get whole_text_to_display_() {
6625
+ return (0, $b8hua$createMemo)(() => input_obj().title);
6626
+ },
6627
+ searching_for_value_: searching_for_value_
6628
+ })]) : (0, $b8hua$escape)([typeof input_obj() /* this is a harmless lie */.parent_title === "string" ? (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$4, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
6629
+ class_: "category line-clamp",
6540
6630
  get whole_text_to_display_() {
6541
6631
  return (0, $b8hua$createMemo)(() => input_obj().title);
6542
6632
  },
6543
6633
  searching_for_value_: searching_for_value_
6544
- })]) : (0, $b8hua$escape)([typeof input_obj().parent_title === "string" ? (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$4, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
6545
- class_: "category",
6634
+ })), (0, $b8hua$escape)(input_obj().parent_title)) : input_obj().type === "content" ? (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$5, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $3c5e15c6ee4227a9$export$605674723bcc715c), {
6635
+ width: "16",
6636
+ height: "16"
6637
+ })), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
6638
+ class_: "content line-clamp",
6546
6639
  get whole_text_to_display_() {
6547
6640
  return (0, $b8hua$createMemo)(() => input_obj().title);
6548
6641
  },
6549
6642
  searching_for_value_: searching_for_value_
6550
- })), (0, $b8hua$escape)(input_obj().parent_title)) : (0, $b8hua$createComponent)((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
6551
- class_: "category",
6643
+ }))) : (0, $b8hua$createComponent)((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
6644
+ class_: "category line-clamp",
6552
6645
  get whole_text_to_display_() {
6553
6646
  return (0, $b8hua$createMemo)(() => input_obj().title);
6554
6647
  },
6555
6648
  searching_for_value_: searching_for_value_
6556
6649
  }), (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$3, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createMemo)(() => {
6650
+ if (input_obj().type === "content") return i18n_.content_();
6557
6651
  if (input_obj().category_type === "BRAND") return i18n_.brand_();
6558
6652
  return i18n_.category_();
6559
6653
  })()))]));
@@ -6570,8 +6664,8 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
6570
6664
  };
6571
6665
  const should_show_previous_searches_in_query_part = (0, $b8hua$createMemo)(() => !on_previous_searches_page_());
6572
6666
  const should_show_at_all = (0, $b8hua$createMemo)(() => {
6573
- var _suggestion_memo_;
6574
- return ((_suggestion_memo_ = suggestion_memo_()) === null || _suggestion_memo_ === void 0 ? void 0 : _suggestion_memo_.length) || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length;
6667
+ var _suggestion_memo_, _get_content_results_;
6668
+ return ((_suggestion_memo_ = suggestion_memo_()) === null || _suggestion_memo_ === void 0 ? void 0 : _suggestion_memo_.length) || should_show_previous_searches_in_query_part() && filtered_previous_searches_().length || ((_get_content_results_ = get_content_results_()) === null || _get_content_results_ === void 0 ? void 0 : _get_content_results_.length);
6575
6669
  });
6576
6670
  const should_show_query_part = (0, $b8hua$createMemo)(() => queries_memo().length || filtered_previous_searches_().length);
6577
6671
  return (0, $b8hua$createComponent)((0, $b8hua$Show), {
@@ -6579,19 +6673,19 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
6579
6673
  return should_show_at_all();
6580
6674
  },
6581
6675
  get children() {
6582
- return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$8, (0, $b8hua$ssrHydrationKey)(), "suggestions ".concat(on_previous_searches_page_() ? "compact" : ""), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
6676
+ return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$9, (0, $b8hua$ssrHydrationKey)(), "suggestions ".concat(on_previous_searches_page_() ? "compact" : ""), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
6583
6677
  get when() {
6584
6678
  return on_previous_searches_page_();
6585
6679
  },
6586
6680
  get children() {
6587
- return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$5, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(i18n_.suggestions_()));
6681
+ return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$6, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(i18n_.suggestions_()));
6588
6682
  }
6589
6683
  })), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
6590
6684
  get when() {
6591
6685
  return should_show_query_part();
6592
6686
  },
6593
6687
  get children() {
6594
- return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$6, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
6688
+ return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$7, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
6595
6689
  get when() {
6596
6690
  return should_show_previous_searches_in_query_part();
6597
6691
  },
@@ -6627,11 +6721,11 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
6627
6721
  }
6628
6722
  })), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
6629
6723
  get when() {
6630
- return not_queries_memo().length && include_category_suggestions_;
6724
+ return not_queries_memo().length;
6631
6725
  },
6632
6726
  keyed: false,
6633
6727
  get children() {
6634
- return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$7, (0, $b8hua$ssrHydrationKey)(), (() => {
6728
+ return (0, $b8hua$ssr)($40dd3f46f55d62ba$var$_tmpl$8, (0, $b8hua$ssrHydrationKey)(), (() => {
6635
6729
  const index_in_autocomplete = 3;
6636
6730
  set_list_until_cleanup(not_queries_memo, index_in_autocomplete);
6637
6731
  return (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Index), {
@@ -6646,7 +6740,18 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
6646
6740
  }
6647
6741
  });
6648
6742
  }
6649
- const $2ebb1d6ae6763f7a$var$_tmpl$ = ["<a", ' target="_blank"></a>'];
6743
+ const $76b6e14a50da4597$var$_tmpl$ = ["<a", ' target="_blank"></a>'];
6744
+ function $76b6e14a50da4597$export$1efe1013da60d0e4(e, href) {
6745
+ if (e.metaKey || e.ctrlKey) {
6746
+ // Open link in a new tab with cmd/ctrl + enter.
6747
+ const link = (0, $b8hua$ssr)($76b6e14a50da4597$var$_tmpl$, (0, $b8hua$ssrHydrationKey)() + (0, $b8hua$ssrAttribute)("href", (0, $b8hua$escape)(href, true), false));
6748
+ document.body.append(link);
6749
+ link.click();
6750
+ link.remove();
6751
+ return true;
6752
+ }
6753
+ return false;
6754
+ }
6650
6755
  function $2ebb1d6ae6763f7a$export$217899a935ef803b(_ref) {
6651
6756
  let {
6652
6757
  selected_index_: [read_selected_index, write_selected_index],
@@ -6724,6 +6829,7 @@ function $2ebb1d6ae6763f7a$var$actual_navigation_working_on_fake_data(_ref2) {
6724
6829
  const sfv = get_search_field_value();
6725
6830
  if (!(0, $b8hua$untrack)(() => read_updating_blocked())) previous_value = sfv;
6726
6831
  });
6832
+ const owner = (0, $b8hua$getOwner)();
6727
6833
  const handler = (0, $b8hua$catchify)(_ref3 => {
6728
6834
  let {
6729
6835
  keyCode: keyCode
@@ -6756,29 +6862,29 @@ function $2ebb1d6ae6763f7a$var$actual_navigation_working_on_fake_data(_ref2) {
6756
6862
  const {
6757
6863
  title: title
6758
6864
  } = selected_entry;
6759
- block_updating_for_one_change();
6865
+ (0, $b8hua$runWithOwner)(owner, block_updating_for_one_change);
6760
6866
  set_search_field_value(title);
6761
- override_on_enter_for_this_entry(e => {
6867
+ (0, $b8hua$runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
6762
6868
  // Open search query in new tab on cmd+enter
6763
6869
  // 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 ;)
6764
6870
  const url = new URL(location);
6765
6871
  url_transformer_ === null || url_transformer_ === void 0 || url_transformer_(url);
6766
6872
  url.searchParams.set(search_query_param_name_, title);
6767
- return $2ebb1d6ae6763f7a$var$open_link_on_cmd_pressed(e, url.href);
6768
- });
6769
- } else if ((selected_entry === null || selected_entry === void 0 ? void 0 : selected_entry.type) == "category") override_on_enter_for_this_entry(e => {
6873
+ return (0, $76b6e14a50da4597$export$1efe1013da60d0e4)(e, url.href);
6874
+ }));
6875
+ } else if ((selected_entry === null || selected_entry === void 0 ? void 0 : selected_entry.type) == "category" || (selected_entry === null || selected_entry === void 0 ? void 0 : selected_entry.type) === "content") (0, $b8hua$runWithOwner)(owner, () => override_on_enter_for_this_entry(e => {
6770
6876
  const {
6771
6877
  page_url: page_url
6772
6878
  } = selected_entry;
6773
- if (!$2ebb1d6ae6763f7a$var$open_link_on_cmd_pressed(e, page_url))
6879
+ if (!(0, $76b6e14a50da4597$export$1efe1013da60d0e4)(e, page_url))
6774
6880
  // Above fn will return true if it opened a new tab, and we won't make these checks anymore
6775
6881
  router_.navigate_.go_to_({
6776
6882
  new_url_: page_url,
6777
6883
  is_replace_: false
6778
6884
  });
6779
6885
  return true;
6780
- });else if (!selected_entry) {
6781
- block_updating_for_one_change();
6886
+ }));else if (!selected_entry) {
6887
+ (0, $b8hua$runWithOwner)(owner, block_updating_for_one_change);
6782
6888
  set_search_field_value(previous_value);
6783
6889
  }
6784
6890
  });
@@ -6790,16 +6896,39 @@ function $2ebb1d6ae6763f7a$var$actual_navigation_working_on_fake_data(_ref2) {
6790
6896
  (0, $b8hua$onCleanup)((0, $b8hua$catchify)(() => el.removeEventListener("keyup", handler)));
6791
6897
  });
6792
6898
  }
6793
- function $2ebb1d6ae6763f7a$var$open_link_on_cmd_pressed(e, href) {
6794
- if (e.metaKey || e.ctrlKey) {
6795
- // Open link in a new tab with cmd/ctrl + enter.
6796
- const link = (0, $b8hua$ssr)($2ebb1d6ae6763f7a$var$_tmpl$, (0, $b8hua$ssrHydrationKey)() + (0, $b8hua$ssrAttribute)("href", (0, $b8hua$escape)(href, true), false));
6797
- document.body.append(link);
6798
- link.click();
6799
- link.remove();
6800
- return true;
6801
- }
6802
- return false;
6899
+ function $c4dee1ef44de29ca$export$af0124069c150252(_ref) {
6900
+ let {
6901
+ set_override_on_enter_fn_: set_override_on_enter_fn_,
6902
+ get_modal_search_results_: get_modal_search_results_,
6903
+ read_suggestion_signal_: read_suggestion_signal_,
6904
+ router_: router_,
6905
+ content_results_: content_results_
6906
+ } = _ref;
6907
+ const [get_autocomplete_wants_override_function, set_autocomplete_wants_override_function] = (0, $b8hua$createSignal)(() => false);
6908
+ (0, $b8hua$createComputed)(() => {
6909
+ var _get_modal_search_res, _search_results$displ;
6910
+ const suggestions = read_suggestion_signal_();
6911
+ const search_results = (_get_modal_search_res = get_modal_search_results_()) === null || _get_modal_search_res === void 0 ? void 0 : _get_modal_search_res();
6912
+ const content_results = content_results_();
6913
+ // If we only have one content result and nothing else, go there when pressing enter
6914
+ if (!suggestions.length && !(search_results !== null && search_results !== void 0 && (_search_results$displ = search_results.displays) !== null && _search_results$displ !== void 0 && _search_results$displ.length) && (content_results === null || content_results === void 0 ? void 0 : content_results.length) === 1) {
6915
+ const [{
6916
+ page_url: page_url
6917
+ }] = content_results;
6918
+ set_override_on_enter_fn_(e => {
6919
+ if (!(0, $76b6e14a50da4597$export$1efe1013da60d0e4)(e, page_url))
6920
+ // Above fn will return true if it opened a new tab, and we won't make these checks anymore
6921
+ router_.navigate_.go_to_({
6922
+ new_url_: page_url,
6923
+ is_replace_: false
6924
+ });
6925
+ return true;
6926
+ });
6927
+ return;
6928
+ }
6929
+ set_override_on_enter_fn_(get_autocomplete_wants_override_function());
6930
+ });
6931
+ return new_fn => set_autocomplete_wants_override_function(() => new_fn);
6803
6932
  }
6804
6933
  const $7cd4d275a9f8d600$export$3cf9497e790da491 = "query";
6805
6934
  function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
@@ -6820,12 +6949,15 @@ function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
6820
6949
  i18n_: i18n_,
6821
6950
  include_category_suggestions_: include_category_suggestions_,
6822
6951
  submit_query_: submit_query_,
6823
- router_: router_
6952
+ router_: router_,
6953
+ get_modal_search_results_: get_modal_search_results_,
6954
+ content_search_enabled_: content_search_enabled_
6824
6955
  } = _ref;
6825
6956
  const [searching_for_value, set_searching_for_value] = (0, $b8hua$createSignal)();
6957
+ const [show_stale_content_results, set_show_stale_content_results] = (0, $b8hua$createSignal)(false);
6826
6958
  const [read_search_field_value] = search_field_value_;
6827
6959
  const updating_blocked = (0, $b8hua$createSignal)(false);
6828
- const [read_suggestion_signal, write_suggestion_signal] = (0, $b8hua$createSignal)([]);
6960
+ const [read_suggestion_signal_, write_suggestion_signal] = (0, $b8hua$createSignal)([]);
6829
6961
  const filtered_previous_searches = (0, $b8hua$createMemo)(() => [...unfiltered_previous_searches[0]()].reverse().filter(q => q !== get_search_query_()));
6830
6962
  const deparallelized_fn = (0, $b8hua$deparallelize_no_drop)(async request_obj => {
6831
6963
  var _api_response$suggest;
@@ -6849,15 +6981,39 @@ function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
6849
6981
  });
6850
6982
 
6851
6983
  const show_previous_searches_component = (0, $b8hua$createMemo)(() => !read_search_field_value() || (0, $b8hua$untrack)(updating_blocked[0]) && !(0, $b8hua$untrack)(searching_for_value));
6984
+ const get_content_results_ = (0, $b8hua$createMemo)(prev => {
6985
+ var _get_modal_search_res, _get_modal_search_res2, _get_modal_search_res3;
6986
+ if (!content_search_enabled_()) return [];
6987
+ if (show_stale_content_results())
6988
+ // don't update content results when query suggestions don't update because otherwise they disappear when trying to keyboard navigate to them
6989
+ return prev;
6990
+ return (_get_modal_search_res = get_modal_search_results_()) === null || _get_modal_search_res === void 0 ? void 0 : (_get_modal_search_res2 = _get_modal_search_res()) === null || _get_modal_search_res2 === void 0 ? void 0 : (_get_modal_search_res3 = _get_modal_search_res2.content_search_links) === null || _get_modal_search_res3 === void 0 ? void 0 : _get_modal_search_res3.map(link => ({
6991
+ page_url: link.page_url,
6992
+ type: "content",
6993
+ title: link.title
6994
+ }));
6995
+ });
6996
+ // 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.
6997
+ // It's the functionality to open the content results page when you press enter, in the modal, when there's only one content result
6998
+ const manipulated_set_override_on_enter_fn_ = (0, $c4dee1ef44de29ca$export$af0124069c150252)({
6999
+ set_override_on_enter_fn_: set_override_on_enter_fn_,
7000
+ get_modal_search_results_: get_modal_search_results_,
7001
+ read_suggestion_signal_: read_suggestion_signal_,
7002
+ router_: router_,
7003
+ content_results_: get_content_results_
7004
+ });
6852
7005
  (0, $b8hua$createComputed)(() => {
6853
7006
  const field_value = read_search_field_value();
6854
- if (!(0, $b8hua$untrack)(updating_blocked[0])) {
7007
+ if ((0, $b8hua$untrack)(updating_blocked[0]))
7008
+ // not using updating_blocked instead of below signal since I presume they'd start updating too early then
7009
+ set_show_stale_content_results(true);else {
6855
7010
  set_searching_for_value(field_value);
6856
7011
  deparallelized_fn({
6857
7012
  query: field_value,
6858
7013
  tenant: tenant_(),
6859
7014
  market: market_()
6860
7015
  });
7016
+ set_show_stale_content_results(false);
6861
7017
  }
6862
7018
  });
6863
7019
  (0, $b8hua$createComputed)((0, $b8hua$on)(search_field_value_[0], () => !updating_blocked[0]() && selected_index_[1](undefined), {
@@ -6869,7 +7025,7 @@ function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
6869
7025
  search_field_value_: search_field_value_,
6870
7026
  updating_blocked_: updating_blocked,
6871
7027
  currently_showing_suggestions_: currently_showing_suggestions_,
6872
- set_override_on_enter_fn_: set_override_on_enter_fn_,
7028
+ set_override_on_enter_fn_: manipulated_set_override_on_enter_fn_,
6873
7029
  search_query_param_name_: search_query_url_param_name_,
6874
7030
  url_transformer_: url_transformer_,
6875
7031
  router_: router_
@@ -6909,11 +7065,12 @@ function $7cd4d275a9f8d600$export$2f2b9559550c7bbc(_ref) {
6909
7065
  },
6910
7066
  on_previous_searches_page_: show_previous_searches_component,
6911
7067
  i18n_: i18n_,
7068
+ get_content_results_: get_content_results_,
6912
7069
  url_transformer_: url_transformer_,
6913
7070
  searching_for_value_: searching_for_value,
6914
7071
  search_query_url_param_name_: search_query_url_param_name_,
6915
7072
  selected_index_: selected_index_,
6916
- suggestion_memo_: read_suggestion_signal,
7073
+ suggestion_memo_: read_suggestion_signal_,
6917
7074
  currently_showing_suggestions_: currently_showing_suggestions_,
6918
7075
  include_category_suggestions_: include_category_suggestions_,
6919
7076
  router_: router_,
@@ -7021,7 +7178,8 @@ function $e82132ed97521828$export$1c593cbd6f1e10bc(_ref) {
7021
7178
  bottom_distance_under_modal_: bottom_distance_under_modal_,
7022
7179
  selected_text_range_: selected_text_range_,
7023
7180
  dont_sync_search_field_value_except_on_submit_ = false,
7024
- router_: router_
7181
+ router_: router_,
7182
+ content_search_enabled_: content_search_enabled_
7025
7183
  } = _ref;
7026
7184
  let on_enter_in_search_field_function;
7027
7185
  // 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.
@@ -7038,34 +7196,24 @@ function $e82132ed97521828$export$1c593cbd6f1e10bc(_ref) {
7038
7196
  };
7039
7197
  const [input_field, set_input_field] = (0, $b8hua$createSignal)();
7040
7198
  const [get_search_field_value_] = search_field_value_;
7041
- const [elements_outside_scrollable, set_elements_outside_scrollable] = (0, $b8hua$createSignal)();
7042
- const [elements_inside_scrollable, set_elements_inside_scrollable] = (0, $b8hua$createSignal)();
7199
+ const [get_modal_search_results, set_modal_search_results_] = (0, $b8hua$createSignal)();
7043
7200
  const close_on_escape_handler = (0, $b8hua$catchify)(_ref2 => {
7044
7201
  let {
7045
7202
  key: key
7046
7203
  } = _ref2;
7047
7204
  if (key === "Escape") close_modal_();
7048
7205
  });
7049
- const [get_num_results_accessor, set_num_results_accessor_] = (0, $b8hua$createSignal)();
7206
+ const [get_total_num_results_accessor, set_total_num_results_accessor_] = (0, $b8hua$createSignal)();
7050
7207
  const selected_index = (0, $b8hua$createSignal)();
7051
7208
  const currently_showing_suggestions_ = (0, $b8hua$createSignal)([], {
7052
7209
  equals: false
7053
7210
  });
7211
+ const less_than_700_high = (0, $00a5b94f0c11efbb$export$d9f36cf74e24d595)("(max-height:700px)");
7212
+ const DiscoverMoreSection = () => (0, $b8hua$ssr)($e82132ed97521828$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), get_search_field_value_() ? (0, $b8hua$escape)(i18n_.modal_view_all_results_()((0, $b8hua$ssr)($e82132ed97521828$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(get_total_num_results_accessor === null || get_total_num_results_accessor === void 0 ? void 0 : get_total_num_results_accessor())))) : (0, $b8hua$escape)(i18n_.modal_discover_more_()));
7054
7213
  if (disable_scrolling_) (0, $e56d241d0f33d459$export$fe334901e8bebd57)();
7055
7214
  $e82132ed97521828$var$close_modal_when_navigating_away(close_modal_, search_query_url_param_name_);
7056
7215
  window.addEventListener("keydown", close_on_escape_handler);
7057
7216
  (0, $b8hua$onCleanup)((0, $b8hua$catchify)(() => window.removeEventListener("keydown", close_on_escape_handler)));
7058
- const owner = (0, $b8hua$getOwner)();
7059
- (0, $b8hua$onCleanup)((0, $b8hua$javascript_media_query)("(max-height:700px)", _ref3 => {
7060
- let {
7061
- matches: matches
7062
- } = _ref3;
7063
- return (0, $b8hua$runWithOwner)(owner, () => {
7064
- // the if below is reactive so we need an owner
7065
- (matches ? set_elements_outside_scrollable : set_elements_inside_scrollable)("");
7066
- (matches ? set_elements_inside_scrollable : set_elements_outside_scrollable)((0, $b8hua$ssr)($e82132ed97521828$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), get_search_field_value_() ? (0, $b8hua$escape)(i18n_.modal_view_all_results_()((0, $b8hua$ssr)($e82132ed97521828$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(get_num_results_accessor === null || get_num_results_accessor === void 0 ? void 0 : get_num_results_accessor())))) : (0, $b8hua$escape)(i18n_.modal_discover_more_())));
7067
- });
7068
- }).remove);
7069
7217
  if (closing_animation_) register_closing_animation_(closing_animation_);
7070
7218
  (0, $a09bb7c652acf957$export$3340fdd8259bd4fd)({
7071
7219
  get_search_field_value_: get_search_field_value_,
@@ -7127,7 +7275,9 @@ function $e82132ed97521828$export$1c593cbd6f1e10bc(_ref) {
7127
7275
  i18n_: i18n_,
7128
7276
  include_category_suggestions_: enable_category_suggestions_ !== null && enable_category_suggestions_ !== void 0 ? enable_category_suggestions_ : true,
7129
7277
  router_: router_,
7130
- submit_query_: submit_query_
7278
+ submit_query_: submit_query_,
7279
+ get_modal_search_results_: get_modal_search_results,
7280
+ content_search_enabled_: content_search_enabled_
7131
7281
  });
7132
7282
  }
7133
7283
  })), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
@@ -7140,12 +7290,28 @@ function $e82132ed97521828$export$1c593cbd6f1e10bc(_ref) {
7140
7290
  tenant_: tenant_,
7141
7291
  i18n_: i18n_,
7142
7292
  market_: market_,
7143
- set_num_results_accessor_: set_num_results_accessor_,
7293
+ set_total_num_results_accessor_: set_total_num_results_accessor_,
7144
7294
  router_: router_,
7295
+ set_modal_search_results_: set_modal_search_results_,
7296
+ content_search_enabled_: content_search_enabled_,
7145
7297
  ...instant_results_options_
7146
7298
  });
7147
7299
  }
7148
- })), (0, $b8hua$escape)(elements_inside_scrollable()), (0, $b8hua$escape)(elements_outside_scrollable()), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $a86e71c0015bd8ab$export$f021bdedd3ec901a), {
7300
+ })), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
7301
+ get when() {
7302
+ return less_than_700_high();
7303
+ },
7304
+ get children() {
7305
+ return (0, $b8hua$createComponent)(DiscoverMoreSection, {});
7306
+ }
7307
+ })), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
7308
+ get when() {
7309
+ return !less_than_700_high();
7310
+ },
7311
+ get children() {
7312
+ return (0, $b8hua$createComponent)(DiscoverMoreSection, {});
7313
+ }
7314
+ })), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $a86e71c0015bd8ab$export$f021bdedd3ec901a), {
7149
7315
  styles: body_style
7150
7316
  })));
7151
7317
  return [(0, $b8hua$ssr)($e82132ed97521828$var$_tmpl$4, (0, $b8hua$ssrHydrationKey)() + (0, $b8hua$ssrAttribute)("id", (0, $b8hua$escape)((0, $c3820807ac1e6fd7$export$44dad306455dddf).SEARCH_MODAL, true), false), "depict plp search ".concat((0, $b8hua$escape)((0, $b8hua$ssrClassList)(class_list_ === null || class_list_ === void 0 ? void 0 : class_list_()), true) || ""), (0, $b8hua$escape)(modal_element))];
@@ -7223,14 +7389,21 @@ function $69602b3d8fd54c38$export$9dd50d35b9d94fdf(_ref) {
7223
7389
  let {
7224
7390
  get_search_query_: get_search_query_,
7225
7391
  i18n_: i18n_,
7226
- formatted_number_of_results_: formatted_number_of_results_
7392
+ formatted_number_of_results_: formatted_number_of_results_,
7393
+ number_of_results_: number_of_results_,
7394
+ type: type
7227
7395
  } = _ref;
7228
7396
  const contents = (0, $b8hua$createMemo)((0, $b8hua$catchify)(() => {
7229
7397
  const q = get_search_query_();
7230
- return i18n_.get_showing_results_for_()((0, $b8hua$ssr)($69602b3d8fd54c38$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(q)), (0, $b8hua$ssr)($69602b3d8fd54c38$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(formatted_number_of_results_())));
7398
+ return i18n_[type === $69602b3d8fd54c38$export$2452208c79fe93ea.content ? "get_showing_pages_for_" : "get_showing_results_for_"]()((0, $b8hua$ssr)($69602b3d8fd54c38$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(q)), (0, $b8hua$ssr)($69602b3d8fd54c38$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(formatted_number_of_results_())), !!q, number_of_results_());
7231
7399
  }));
7232
7400
  return (0, $b8hua$ssr)($69602b3d8fd54c38$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(contents()));
7233
7401
  }
7402
+ let $69602b3d8fd54c38$export$2452208c79fe93ea;
7403
+ (function (ShowingResultsForType) {
7404
+ ShowingResultsForType[ShowingResultsForType["products"] = 0] = "products";
7405
+ ShowingResultsForType[ShowingResultsForType["content"] = 1] = "content";
7406
+ })($69602b3d8fd54c38$export$2452208c79fe93ea || ($69602b3d8fd54c38$export$2452208c79fe93ea = {}));
7234
7407
  function $8e8ce3f7a5eb11a6$export$41b4894022a3580f() {
7235
7408
  let {
7236
7409
  style_props_ = (0, $b8hua$createSignal)({})
@@ -7250,8 +7423,464 @@ function $8e8ce3f7a5eb11a6$export$41b4894022a3580f() {
7250
7423
  })));
7251
7424
  return style_props_;
7252
7425
  }
7426
+ const $f3a159279dc1a8fb$var$_tmpl$ = ["<span", ' class="highlighted-part">', "</span>"];
7427
+ const $f3a159279dc1a8fb$var$dont_cut_in_between_less_than_characters = 30;
7428
+ function $f3a159279dc1a8fb$export$e1a98a189fd2c0e7(_ref) {
7429
+ let {
7430
+ content_result_: content_result_,
7431
+ key_: key_,
7432
+ cut_when_possible_: cut_when_possible_
7433
+ } = _ref;
7434
+ const matched_tokens = (0, $b8hua$createMemo)(() => {
7435
+ var _content_result_$high, _content_result_$high2;
7436
+ return (_content_result_$high = content_result_().highlights) === null || _content_result_$high === void 0 ? void 0 : (_content_result_$high2 = _content_result_$high.find(highlight => highlight.field == key_)) === null || _content_result_$high2 === void 0 ? void 0 : _content_result_$high2.matched_tokens;
7437
+ });
7438
+ const full_value = (0, $b8hua$createMemo)(() => {
7439
+ var _content_result_$key_;
7440
+ return (_content_result_$key_ = content_result_()[key_]) === null || _content_result_$key_ === void 0 ? void 0 : _content_result_$key_.replaceAll("\n", " ");
7441
+ });
7442
+ return (0, $b8hua$createComponent)((0, $b8hua$Show), {
7443
+ get when() {
7444
+ var _matched_tokens;
7445
+ return (_matched_tokens = matched_tokens()) === null || _matched_tokens === void 0 ? void 0 : _matched_tokens.length;
7446
+ },
7447
+ get fallback() {
7448
+ return full_value();
7449
+ },
7450
+ get children() {
7451
+ return (() => {
7452
+ const segmented_cut_text = (0, $b8hua$createMemo)(() => {
7453
+ const segmented_text = $f3a159279dc1a8fb$var$segment_text(full_value(), matched_tokens());
7454
+ if (cut_when_possible_) $f3a159279dc1a8fb$var$cut_text(segmented_text);
7455
+ return segmented_text;
7456
+ });
7457
+ return (0, $b8hua$createComponent)((0, $b8hua$Index), {
7458
+ get each() {
7459
+ return segmented_cut_text();
7460
+ },
7461
+ children: item => {
7462
+ return (0, $b8hua$createComponent)((0, $b8hua$Show), {
7463
+ get when() {
7464
+ return item().highlighted_;
7465
+ },
7466
+ get fallback() {
7467
+ return item().text_;
7468
+ },
7469
+ get children() {
7470
+ return (0, $b8hua$ssr)($f3a159279dc1a8fb$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(item().text_));
7471
+ }
7472
+ });
7473
+ }
7474
+ });
7475
+ })();
7476
+ }
7477
+ });
7478
+ }
7479
+ function $f3a159279dc1a8fb$var$cut_text(segmented_text) {
7480
+ // cut away chunks of text that are not highlighted to give a google-like overview of the content
7481
+ const highlighted_segments = segmented_text === null || segmented_text === void 0 ? void 0 : segmented_text.filter(segment => segment.highlighted_);
7482
+ if (!segmented_text || !(highlighted_segments !== null && highlighted_segments !== void 0 && highlighted_segments.length)) return;
7483
+ // We have one or more highlighted segments
7484
+ if (highlighted_segments.length === 1) {
7485
+ // cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
7486
+ $f3a159279dc1a8fb$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
7487
+ return;
7488
+ }
7489
+ // We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
7490
+ 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
7491
+ );
7492
+
7493
+ const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
7494
+ // We need to cut before the first segment - possibly through other segments - and maybe between segments
7495
+ 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);
7496
+ $f3a159279dc1a8fb$var$cut_start(index_of_first_segment, segmented_text);
7497
+ // update indexes since we might have removed segments
7498
+ [index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
7499
+ let number_of_characters_between_segments = 0;
7500
+ for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
7501
+ const segment = segmented_text[i];
7502
+ number_of_characters_between_segments += segment.text_.length;
7503
+ }
7504
+ if (number_of_characters_between_segments < $f3a159279dc1a8fb$var$dont_cut_in_between_less_than_characters)
7505
+ // don't cut if there are less than 30 characters between the two segments
7506
+ return;
7507
+ // We have more than 50 characters between the two segments, cut between them
7508
+ const [split_start_segment, split_start_character] = $f3a159279dc1a8fb$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
7509
+ const [split_end_segment, split_end_character] = $f3a159279dc1a8fb$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
7510
+ if (split_start_segment === undefined || split_end_segment === undefined ||
7511
+ // identical split point, or split end before split start, can't do anything
7512
+ split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
7513
+ const dots_segment = {
7514
+ text_: " … ",
7515
+ highlighted_: false
7516
+ };
7517
+ const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
7518
+ if (i < split_start_segment || i > split_end_segment) return segment;
7519
+ const text = segment.text_;
7520
+ if (i == split_end_segment && i == split_start_segment) return [{
7521
+ ...segment,
7522
+ text_: text.slice(0, split_start_character).trimEnd()
7523
+ }, dots_segment, {
7524
+ ...segment,
7525
+ text_: text.slice(split_end_character + 1, text.length).trimStart()
7526
+ }];else if (i == split_start_segment) {
7527
+ 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
7528
+ return segment;
7529
+ } else if (i == split_end_segment) return [dots_segment, {
7530
+ ...segment,
7531
+ text_: text.slice(split_end_character + 1, text.length).trimStart()
7532
+ }];
7533
+ return []; // remove all segments inbetween
7534
+ });
7535
+
7536
+ segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
7537
+ $f3a159279dc1a8fb$var$heal_holes(segmented_text);
7538
+ }
7539
+ function $f3a159279dc1a8fb$var$heal_holes(segmented_text) {
7540
+ // try to heal "holes" created in the segments so there are only alternating segments
7541
+ const segments_to_delete = new Set();
7542
+ for (let i = 0; i < segmented_text.length; i++) {
7543
+ var _previous_segment, _previous_segment2;
7544
+ const segment = segmented_text[i];
7545
+ let previous_segment;
7546
+ for (let j = i - 1; j >= 0; j--) {
7547
+ previous_segment = segmented_text[j];
7548
+ // Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
7549
+ if (!segments_to_delete.has(previous_segment)) break;
7550
+ }
7551
+ if ((_previous_segment = previous_segment) !== null && _previous_segment !== void 0 && _previous_segment.highlighted_ && segment.highlighted_ || ((_previous_segment2 = previous_segment) === null || _previous_segment2 === void 0 ? void 0 : _previous_segment2.highlighted_) === false && segment.highlighted_ === false) {
7552
+ previous_segment.text_ += segment.text_; // IDK if this ever happens
7553
+ segments_to_delete.add(segment);
7554
+ }
7555
+ }
7556
+ for (const segment of segments_to_delete) {
7557
+ const index = segmented_text.indexOf(segment);
7558
+ segmented_text.splice(index, 1);
7559
+ }
7560
+ }
7561
+ function $f3a159279dc1a8fb$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text) {
7562
+ let be_very_aggressive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
7563
+ const should_loop_backwards = index_of_start_segment > index_of_end_segment;
7564
+ const step = should_loop_backwards ? -1 : 1;
7565
+ const desperate_split_attempts = [":", ";", ","];
7566
+ while (desperate_split_attempts.length) {
7567
+ const split_point_between_words = [];
7568
+ // for the middle also try to split with a few more characters if the default ones don't work over a full run
7569
+ const desperate_split_attempt = desperate_split_attempts.pop();
7570
+ let is_first_character = true;
7571
+ for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
7572
+ const segment = segmented_text[i];
7573
+ const text = segment.text_;
7574
+ for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
7575
+ const character = text[j];
7576
+ if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
7577
+ if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
7578
+ split_point_between_words.push([i, j]);
7579
+ if (split_point_between_words.length > 3)
7580
+ // We can't find a split point, so we'll just split between words
7581
+ // 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
7582
+ return split_point_between_words[1];
7583
+ }
7584
+ }
7585
+ }
7586
+ }
7587
+ return [];
7588
+ }
7589
+ function $f3a159279dc1a8fb$var$cut_start(cut_left_of_index, segmented_text) {
7590
+ // Cut the start of the text to bring the first matching token
7591
+ let is_first_character = false;
7592
+ let words_encountered = 0;
7593
+ outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
7594
+ const segment = segmented_text[i];
7595
+ // We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
7596
+ const text = segment.text_;
7597
+ for (let j = text.length - 1; j >= 0; j--) {
7598
+ const character = text[j];
7599
+ const is_space = character == " ";
7600
+ if (!is_first_character && is_space) words_encountered++;
7601
+ if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
7602
+ // We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
7603
+ segment.text_ = text.slice(j + 1).trimStart();
7604
+ segmented_text.splice(0, i);
7605
+ if (character === "," || is_space)
7606
+ // if we cut at a comma or psace, we add a … at the beginning
7607
+ segmented_text.unshift({
7608
+ text_: "… ",
7609
+ highlighted_: false
7610
+ });
7611
+ break outmost_loop;
7612
+ }
7613
+ if (is_first_character) is_first_character = false;
7614
+ }
7615
+ }
7616
+ $f3a159279dc1a8fb$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
7617
+ }
7618
+
7619
+ function $f3a159279dc1a8fb$var$segment_text(text, matched_strings) {
7620
+ // segment text where the matched strings are highlighted sections
7621
+ const output = [];
7622
+ if (!text) return; // shouldn't happen but whatever
7623
+ for (let i = 0; i < text.length; i++) {
7624
+ const found_strings = [];
7625
+ if (!i || text[i - 1] == " ")
7626
+ // only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
7627
+ for (let j = 0; j < matched_strings.length; j++) {
7628
+ const matched_string = matched_strings[j];
7629
+ const part_in_text = text.slice(i, i + matched_string.length);
7630
+ if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
7631
+ 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
7632
+ }
7633
+
7634
+ const last_index_in_output = output.length - 1;
7635
+ if (!found_strings.length) {
7636
+ var _output$last_index_in;
7637
+ const character = text[i];
7638
+ if (((_output$last_index_in = output[last_index_in_output]) === null || _output$last_index_in === void 0 ? void 0 : _output$last_index_in.highlighted_) === false || output.length && /\s/.test(character))
7639
+ // 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
7640
+ output[last_index_in_output].text_ += character;else output.push({
7641
+ highlighted_: false,
7642
+ text_: character
7643
+ });
7644
+ } else {
7645
+ var _output$last_index_in2;
7646
+ const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
7647
+ if ((_output$last_index_in2 = output[last_index_in_output]) !== null && _output$last_index_in2 !== void 0 && _output$last_index_in2.highlighted_) output[last_index_in_output].text_ += longest_found_string;else output.push({
7648
+ highlighted_: true,
7649
+ text_: longest_found_string
7650
+ });
7651
+ i += longest_found_string.length - 1;
7652
+ }
7653
+ }
7654
+ return output;
7655
+ }
7656
+ const $22470de5f42cc35d$var$_tmpl$ = ["<div", ' class="description line-clamp">', "</div>"],
7657
+ $22470de5f42cc35d$var$_tmpl$2 = ["<div", ' class="content-card"><div class="image">', '</div><div class="info"><!--#-->', "<!--/--><!--#-->", "<!--/--></div></div>"];
7658
+ function $22470de5f42cc35d$export$f631859cab12b342(_ref) {
7659
+ let {
7660
+ router_: router_,
7661
+ content_result_: content_result_
7662
+ } = _ref;
7663
+ const make_link_attributes = () => {
7664
+ const result = content_result_ === null || content_result_ === void 0 ? void 0 : content_result_();
7665
+ if (!result) return;
7666
+ return {
7667
+ href: result.page_url,
7668
+ onClick: (0, $b8hua$catchify)(ev => router_.navigate_.go_to_({
7669
+ new_url_: result.page_url,
7670
+ is_replace_: false,
7671
+ event_: ev
7672
+ }))
7673
+ };
7674
+ };
7675
+ const LinkIfPossible = _ref2 => {
7676
+ let {
7677
+ children: children,
7678
+ ...attributes
7679
+ } = _ref2;
7680
+ if (content_result_) return (0, $b8hua$ssrElement)("a", attributes, () => (0, $b8hua$escape)(children), true);
7681
+ return (0, $b8hua$ssrElement)("div", attributes, () => (0, $b8hua$escape)(children), true);
7682
+ };
7683
+ return (0, $b8hua$ssr)($22470de5f42cc35d$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)(LinkIfPossible, (0, $b8hua$mergeProps)(make_link_attributes, {
7684
+ tabIndex: "-1",
7685
+ get children() {
7686
+ return (0, $b8hua$createComponent)((0, $3c5e15c6ee4227a9$export$605674723bcc715c), {
7687
+ width: "28",
7688
+ height: "28"
7689
+ });
7690
+ }
7691
+ }))), (0, $b8hua$escape)((0, $b8hua$createComponent)(LinkIfPossible, (0, $b8hua$mergeProps)({
7692
+ "class": "content-title line-clamp"
7693
+ }, make_link_attributes, {
7694
+ get title() {
7695
+ return content_result_ === null || content_result_ === void 0 ? void 0 : content_result_().title;
7696
+ },
7697
+ get children() {
7698
+ return content_result_ ? (0, $b8hua$createComponent)((0, $f3a159279dc1a8fb$export$e1a98a189fd2c0e7), {
7699
+ content_result_: content_result_,
7700
+ key_: "title",
7701
+ cut_when_possible_: false
7702
+ }) : (0, $b8hua$createComponent)((0, $ceafb6fb91c6f394$export$89c6019e4baa40b1), {
7703
+ height: "1em",
7704
+ width: "20ch"
7705
+ });
7706
+ }
7707
+ }))), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
7708
+ get when() {
7709
+ return (content_result_ === null || content_result_ === void 0 ? void 0 : content_result_().description) || !content_result_;
7710
+ },
7711
+ get children() {
7712
+ return (0, $b8hua$ssr)($22470de5f42cc35d$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
7713
+ when: content_result_,
7714
+ get fallback() {
7715
+ return Array.from({
7716
+ length: 4
7717
+ }).map(() => (0, $b8hua$createComponent)((0, $ceafb6fb91c6f394$export$89c6019e4baa40b1), {
7718
+ height: "1em",
7719
+ width: "min(50ch, 100%)"
7720
+ }));
7721
+ },
7722
+ get children() {
7723
+ return (0, $b8hua$createComponent)((0, $f3a159279dc1a8fb$export$e1a98a189fd2c0e7), {
7724
+ content_result_: content_result_,
7725
+ key_: "description",
7726
+ cut_when_possible_: true
7727
+ });
7728
+ }
7729
+ })));
7730
+ }
7731
+ })));
7732
+ }
7733
+ function $881e8953a9103f10$export$9ff751cd77687edc(_ref) {
7734
+ let {
7735
+ search_results_: search_results_,
7736
+ router_: router_
7737
+ } = _ref;
7738
+ const content_results = (0, $b8hua$createMemo)(() => {
7739
+ var _search_results_;
7740
+ return (_search_results_ = search_results_()) === null || _search_results_ === void 0 ? void 0 : _search_results_.content_search_links;
7741
+ });
7742
+ const content_results_by_page_url = (0, $b8hua$createMemo)(() => {
7743
+ const map = new Map();
7744
+ const results = content_results();
7745
+ if (!results) return map;
7746
+ for (let i = 0; i < results.length; i++) {
7747
+ const content_result = results[i];
7748
+ map.set(content_result.page_url, content_result);
7749
+ }
7750
+ return map;
7751
+ });
7752
+ return (0, $b8hua$createComponent)((0, $b8hua$For), {
7753
+ get each() {
7754
+ return [...content_results_by_page_url().keys()];
7755
+ },
7756
+ children: page_url => {
7757
+ const content_result = (0, $b8hua$createMemo)(() => content_results_by_page_url().get(page_url));
7758
+ return (0, $b8hua$createComponent)((0, $22470de5f42cc35d$export$f631859cab12b342), {
7759
+ content_result_: content_result,
7760
+ router_: router_
7761
+ });
7762
+ }
7763
+ });
7764
+ }
7765
+ function $ad4f3c9872fbeb48$export$4405d077f0a20494(_ref) {
7766
+ let {
7767
+ content_results_rows_: [get_history_state_content_results_rows],
7768
+ cols_at_size_: cols_at_size_
7769
+ } = _ref;
7770
+ const largest_column = (0, $b8hua$createMemo)(() => {
7771
+ const largest_in_cols_at_size = Math.max(...cols_at_size_().map(_ref2 => {
7772
+ let [cols] = _ref2;
7773
+ return cols;
7774
+ }));
7775
+ 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
7776
+ return largest_in_cols_at_size;
7777
+ });
7778
+ const num_placeholders = (0, $b8hua$createMemo)(() => {
7779
+ var _get_history_state_co;
7780
+ return ((_get_history_state_co = get_history_state_content_results_rows()) !== null && _get_history_state_co !== void 0 ? _get_history_state_co : (0, $d53ebed6f63304e4$export$70ceae36059a1036)) * largest_column();
7781
+ });
7782
+ return (0, $b8hua$createComponent)((0, $b8hua$Index), {
7783
+ get each() {
7784
+ return Array.from({
7785
+ length: num_placeholders()
7786
+ });
7787
+ },
7788
+ children: () => (0, $b8hua$createComponent)((0, $22470de5f42cc35d$export$f631859cab12b342), {})
7789
+ });
7790
+ }
7791
+ const $d53ebed6f63304e4$var$_tmpl$ = ["<div", ' class="', '" style="', '"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
7792
+ $d53ebed6f63304e4$var$_tmpl$2 = ["<button", ' class="view-more">', "</button>"],
7793
+ $d53ebed6f63304e4$var$_tmpl$3 = ["<button", ' class="view-less">', "</button>"];
7794
+ const $d53ebed6f63304e4$export$70ceae36059a1036 = 1;
7795
+ function $d53ebed6f63304e4$export$6d0c9c22f6652669(_ref) {
7796
+ var _content_results2;
7797
+ let {
7798
+ search_results_: search_results_,
7799
+ get_search_query_: get_search_query_,
7800
+ i18n_: i18n_,
7801
+ layout_options_: layout_options_,
7802
+ router_: router_,
7803
+ query_base_: query_base_,
7804
+ content_results_rows_: content_results_rows_
7805
+ } = _ref;
7806
+ const content_results = (0, $b8hua$createMemo)(() => {
7807
+ var _search_results_;
7808
+ return (_search_results_ = search_results_()) === null || _search_results_ === void 0 ? void 0 : _search_results_.content_search_links;
7809
+ });
7810
+ const num_results = (0, $b8hua$createMemo)(() => {
7811
+ var _content_results;
7812
+ return (_content_results = content_results()) === null || _content_results === void 0 ? void 0 : _content_results.length;
7813
+ });
7814
+ const is_loading_ = (0, $b8hua$createMemo)(() => search_results_.loading || query_base_.loading); // See comment in PLPResults/index.tsx on why we need this
7815
+ const formatted_number_of_results_ = (0, $43fbdca0f726a34b$export$92f2da32c6e7e7ee)({
7816
+ number_: num_results,
7817
+ i18n_: i18n_
7818
+ });
7819
+ const [is_showing_placeholders, set_is_showing_placeholders] = (0, $b8hua$createSignal)(false);
7820
+ const rows_object = $d53ebed6f63304e4$var$make_state_saved_rows(content_results_rows_, i18n_);
7821
+ return (0, $b8hua$ssr)($d53ebed6f63304e4$var$_tmpl$, (0, $b8hua$ssrHydrationKey)(), "content-results ".concat(is_showing_placeholders() ? "loading" : ""), "display:" + (is_loading_() || ((_content_results2 = content_results()) === null || _content_results2 === void 0 ? void 0 : _content_results2.length) > 0 ? "" : "none"), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $69602b3d8fd54c38$export$9dd50d35b9d94fdf), {
7822
+ get_search_query_: get_search_query_,
7823
+ i18n_: i18n_,
7824
+ formatted_number_of_results_: formatted_number_of_results_,
7825
+ get type() {
7826
+ return (0, $69602b3d8fd54c38$export$2452208c79fe93ea).content;
7827
+ },
7828
+ number_of_results_: num_results
7829
+ })), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), (0, $b8hua$mergeProps)({
7830
+ layout: "grid",
7831
+ element_attributes: {
7832
+ class: "cards"
7833
+ }
7834
+ }, layout_options_, {
7835
+ rows: rows_object,
7836
+ get children() {
7837
+ return (0, $b8hua$createComponent)((0, $b8hua$Suspense), {
7838
+ get fallback() {
7839
+ return (() => {
7840
+ set_is_showing_placeholders(true);
7841
+ (0, $b8hua$onCleanup)(() => set_is_showing_placeholders(false));
7842
+ return (0, $b8hua$createComponent)((0, $ad4f3c9872fbeb48$export$4405d077f0a20494), {
7843
+ content_results_rows_: content_results_rows_,
7844
+ get cols_at_size_() {
7845
+ return (0, $b8hua$createMemo)(() => layout_options_().cols_at_size);
7846
+ }
7847
+ });
7848
+ })();
7849
+ },
7850
+ get children() {
7851
+ return (0, $b8hua$createComponent)((0, $881e8953a9103f10$export$9ff751cd77687edc), {
7852
+ router_: router_,
7853
+ search_results_: search_results_
7854
+ });
7855
+ }
7856
+ });
7857
+ }
7858
+ }))));
7859
+ }
7860
+ function $d53ebed6f63304e4$var$make_state_saved_rows(_ref2, i18n_) {
7861
+ let [get_showing_content_results_rows, set_showing_content_results_rows] = _ref2;
7862
+ const currently_visible = (0, $b8hua$createSignal)((0, $b8hua$untrack)(get_showing_content_results_rows));
7863
+ const [get_currently_visible, set_currently_visible] = currently_visible;
7864
+ const rows = {
7865
+ currently_visible: currently_visible,
7866
+ start_rows: $d53ebed6f63304e4$export$70ceae36059a1036,
7867
+ button: (0, $b8hua$ssr)($d53ebed6f63304e4$var$_tmpl$2, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(i18n_.view_more_())),
7868
+ view_less_button: (0, $b8hua$ssr)($d53ebed6f63304e4$var$_tmpl$3, (0, $b8hua$ssrHydrationKey)(), (0, $b8hua$escape)(i18n_.view_less_())),
7869
+ rows_per_click: 3
7870
+ };
7871
+ (0, $b8hua$createComputed)((0, $b8hua$on)(get_currently_visible, new_visible => set_showing_content_results_rows(new_visible), {
7872
+ defer: true
7873
+ }));
7874
+ (0, $b8hua$createComputed)((0, $b8hua$on)(get_showing_content_results_rows, function () {
7875
+ let new_rows = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : $d53ebed6f63304e4$export$70ceae36059a1036;
7876
+ return set_currently_visible(new_rows);
7877
+ }, {
7878
+ defer: true
7879
+ }));
7880
+ return rows;
7881
+ }
7253
7882
  const $da279c5a540c6846$var$_tmpl$ = ["<div", ' class="filter-results-for-one-row"><!--#-->', "<!--/--><!--#-->", "<!--/--></div>"],
7254
- $da279c5a540c6846$var$_tmpl$2 = ["<div", ' class="depict plp search"><div class="listing-page"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
7883
+ $da279c5a540c6846$var$_tmpl$2 = ["<div", ' class="depict plp search"><div class="listing-page"><!--#-->', "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--><!--#-->", "<!--/--></div><!--#-->", "<!--/--><!--#-->", "<!--/--></div>"];
7255
7884
  function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
7256
7885
  let {
7257
7886
  depict_api_: depict_api_,
@@ -7281,7 +7910,11 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
7281
7910
  recommendations_layout_options_: recommendations_layout_options_,
7282
7911
  scroll_restoration_data_: scroll_restoration_data_,
7283
7912
  product_card_template_: product_card_template_,
7284
- modal_body_style_ref_: modal_body_style_ref_
7913
+ modal_body_style_ref_: modal_body_style_ref_,
7914
+ router_: router_,
7915
+ content_results_rows_: content_results_rows_,
7916
+ content_layout_options_: content_layout_options_,
7917
+ content_search_enabled_: content_search_enabled_
7285
7918
  } = _ref;
7286
7919
  const [get_sorting] = current_sorting_;
7287
7920
  const all_products_loaded_ = (0, $b8hua$createSignal)(false);
@@ -7348,16 +7981,29 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
7348
7981
  const SafeSearchField = (0, $b8hua$catchify)((0, $584c06c09cf4609d$export$b94867ecbd698f21));
7349
7982
  const [sort_or_filter_open_, set_sort_or_filter_open_] = (0, $b8hua$createSignal)(false);
7350
7983
  const [desktop_filter_elements_, set_desktop_filter_elements] = (0, $b8hua$createSignal)();
7984
+ const n_hits = (0, $b8hua$createMemo)(() => {
7985
+ var _search_results_3;
7986
+ return (_search_results_3 = search_results_()) === null || _search_results_3 === void 0 ? void 0 : _search_results_3.n_hits;
7987
+ });
7351
7988
  const formatted_number_of_results_ = (0, $43fbdca0f726a34b$export$92f2da32c6e7e7ee)({
7352
- search_results_: search_results_,
7989
+ number_: n_hits,
7353
7990
  i18n_: i18n_
7354
7991
  });
7355
7992
  const [sort_and_filter_element_, set_sort_and_filter_element_] = (0, $b8hua$createSignal)();
7356
- const results_for = (0, $b8hua$createComponent)((0, $69602b3d8fd54c38$export$9dd50d35b9d94fdf), {
7993
+ const no_results_text_ = (0, $b8hua$createMemo)(() => {
7994
+ var _search_results_4, _search_results_4$con;
7995
+ return ((_search_results_4 = search_results_()) !== null && _search_results_4 !== void 0 && (_search_results_4$con = _search_results_4.content_search_links) !== null && _search_results_4$con !== void 0 && _search_results_4$con.length ? i18n_.no_products_ : i18n_.no_results_text_)();
7996
+ });
7997
+ const results_for = (0, $b8hua$createComponent)((0, $69602b3d8fd54c38$export$9dd50d35b9d94fdf), (0, $b8hua$mergeProps)({
7998
+ get type() {
7999
+ return (0, $69602b3d8fd54c38$export$2452208c79fe93ea).products;
8000
+ },
8001
+ number_of_results_: n_hits
8002
+ }, {
7357
8003
  get_search_query_: get_search_query_,
7358
8004
  i18n_: i18n_,
7359
8005
  formatted_number_of_results_: formatted_number_of_results_
7360
- });
8006
+ }));
7361
8007
  const filters_opener = (0, $7396052a1484264f$export$d7841e452f2e59a8)({
7362
8008
  set_sort_or_filter_open_: set_sort_or_filter_open_,
7363
8009
  set_extra_els_in_results_container_: set_desktop_filter_elements,
@@ -7466,7 +8112,28 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
7466
8112
  children: make_category_suggestion_card_
7467
8113
  });
7468
8114
  }
7469
- })) : (0, $b8hua$escape)(null), (0, $b8hua$escape)(results_filters[0]()), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
8115
+ })) : (0, $b8hua$escape)(null), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
8116
+ severity_: "error",
8117
+ message_: "ContentResults failed",
8118
+ get children() {
8119
+ return (0, $b8hua$createComponent)((0, $b8hua$Show), {
8120
+ get when() {
8121
+ return content_search_enabled_();
8122
+ },
8123
+ get children() {
8124
+ return (0, $b8hua$createComponent)((0, $d53ebed6f63304e4$export$6d0c9c22f6652669), {
8125
+ content_results_rows_: content_results_rows_,
8126
+ search_results_: search_results_,
8127
+ i18n_: i18n_,
8128
+ get_search_query_: get_search_query_,
8129
+ layout_options_: content_layout_options_,
8130
+ router_: router_,
8131
+ query_base_: search_query_base_
8132
+ });
8133
+ }
8134
+ });
8135
+ }
8136
+ })), (0, $b8hua$escape)(results_filters[0]()), (0, $b8hua$escape)((0, $b8hua$createComponent)((0, $b8hua$Show), {
7470
8137
  get when() {
7471
8138
  var _selected_filters_$;
7472
8139
  return (_selected_filters_$ = selected_filters_[0]()) === null || _selected_filters_$ === void 0 ? void 0 : _selected_filters_$.length;
@@ -7511,7 +8178,10 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
7511
8178
  selected_filters_: selected_filters_,
7512
8179
  expanded_hierarchical_filters_: expanded_hierarchical_filters_,
7513
8180
  local_filter_cache_: local_filter_cache_,
7514
- i18n_: i18n_
8181
+ i18n_: {
8182
+ ...i18n_,
8183
+ no_results_text_: no_results_text_
8184
+ }
7515
8185
  }
7516
8186
  });
7517
8187
  }
@@ -7552,8 +8222,8 @@ function $da279c5a540c6846$export$a54ec244c8863715(_ref) {
7552
8222
  formatted_number_of_results_: formatted_number_of_results_,
7553
8223
  i18n_: i18n_,
7554
8224
  number_of_results_: (0, $b8hua$createMemo)(() => {
7555
- var _search_results_3;
7556
- return (_search_results_3 = search_results_()) === null || _search_results_3 === void 0 ? void 0 : _search_results_3.n_hits;
8225
+ var _search_results_5;
8226
+ return (_search_results_5 = search_results_()) === null || _search_results_5 === void 0 ? void 0 : _search_results_5.n_hits;
7557
8227
  })
7558
8228
  });
7559
8229
  }
@@ -7591,6 +8261,38 @@ function $37e8c97bb6876197$export$828dcdd425fd3231(aligner) {
7591
8261
  cleanup: cleanup
7592
8262
  };
7593
8263
  }
8264
+
8265
+ /**
8266
+ * 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
8267
+ */
8268
+ function $3f7203368ad0d3ca$export$ff7109b9b2b206ba(sdk_cols_at_size) {
8269
+ let min_width_for_more_than_one_column = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500;
8270
+ if (!sdk_cols_at_size.length) return sdk_cols_at_size;
8271
+ const sorted_sizes = sdk_cols_at_size.map(_ref => {
8272
+ let [cols, max_width] = _ref;
8273
+ return [cols, max_width !== null && max_width !== void 0 ? max_width : Infinity];
8274
+ }).sort((_ref2, _ref3) => {
8275
+ let [, a] = _ref2;
8276
+ let [, b] = _ref3;
8277
+ return a - b;
8278
+ });
8279
+ const [[, smallest_max_width]] = sorted_sizes;
8280
+ if (smallest_max_width > min_width_for_more_than_one_column)
8281
+ // If everything above min_width_for_more_than_one_column, we can just add a 1 column at the beginning
8282
+ return [[1, min_width_for_more_than_one_column], ...sdk_cols_at_size];
8283
+ const to_delete = [];
8284
+ for (let i = 0; i < sorted_sizes.length; i++) {
8285
+ const [, max_width] = sorted_sizes[i];
8286
+ if (max_width > min_width_for_more_than_one_column) continue;
8287
+ to_delete.push(i);
8288
+ }
8289
+ while (to_delete.length) sorted_sizes.splice(to_delete.pop(), 1);
8290
+ sorted_sizes.unshift([1, min_width_for_more_than_one_column]);
8291
+ return sorted_sizes.map(_ref4 => {
8292
+ let [cols, max_width] = _ref4;
8293
+ return max_width == Infinity ? [cols] : [cols, max_width];
8294
+ });
8295
+ }
7594
8296
  const $eb064bc3350276c1$var$_tmpl$ = ["<div", ' class="depict plp search">', "</div>"];
7595
8297
  function $eb064bc3350276c1$var$_classPrivateFieldInitSpec(obj, privateMap, value) {
7596
8298
  $eb064bc3350276c1$var$_checkPrivateRedeclaration(obj, privateMap);
@@ -7622,6 +8324,7 @@ function $eb064bc3350276c1$var$_classApplyDescriptorGet(receiver, descriptor) {
7622
8324
  * 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.
7623
8325
  */
7624
8326
  const $eb064bc3350276c1$var$privately_shared_properties = /*@__PURE__*/new WeakMap();
8327
+ const $eb064bc3350276c1$var$content_search_default = false;
7625
8328
  const $eb064bc3350276c1$var$min_products_to_fetch_ = 20;
7626
8329
  const $eb064bc3350276c1$export$bde3eb976dfded9 = depict_search => {
7627
8330
  var _privately_shared_pro;
@@ -7631,6 +8334,7 @@ var $eb064bc3350276c1$var$_locale_signal = /*#__PURE__*/new WeakMap();
7631
8334
  var $eb064bc3350276c1$var$_merchant_signal = /*#__PURE__*/new WeakMap();
7632
8335
  var $eb064bc3350276c1$var$_market_signal = /*#__PURE__*/new WeakMap();
7633
8336
  var $eb064bc3350276c1$var$_modal_open_signal = /*#__PURE__*/new WeakMap();
8337
+ var $eb064bc3350276c1$var$_content_search_signal = /*#__PURE__*/new WeakMap();
7634
8338
  var $eb064bc3350276c1$var$_router = /*#__PURE__*/new WeakMap();
7635
8339
  class $eb064bc3350276c1$export$ac6237957a15b3f0 {
7636
8340
  constructor(_ref) {
@@ -7642,9 +8346,10 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
7642
8346
  on_navigation: on_navigation,
7643
8347
  enable_category_suggestions = true,
7644
8348
  page_url_creator: page_url_creator,
8349
+ display_transformers: display_transformers,
8350
+ api: api,
7645
8351
  // Stuff needed for non-standard customer deployments that we shouldn't actually expose
7646
8352
  disable_scrolling_during_modal = true,
7647
- api: api,
7648
8353
  bottom_distance_under_modal: bottom_distance_under_modal,
7649
8354
  render_instant_card: render_instant_card,
7650
8355
  ...props_on_class
@@ -7665,6 +8370,10 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
7665
8370
  writable: true,
7666
8371
  value: (0, $b8hua$createSignal)(false)
7667
8372
  });
8373
+ $eb064bc3350276c1$var$_classPrivateFieldInitSpec(this, $eb064bc3350276c1$var$_content_search_signal, {
8374
+ writable: true,
8375
+ value: (0, $b8hua$createSignal)()
8376
+ });
7668
8377
  $eb064bc3350276c1$var$_classPrivateFieldInitSpec(this, $eb064bc3350276c1$var$_router, {
7669
8378
  writable: true,
7670
8379
  value: new (0, $ac571292d606f30b$export$7e1297a3a19f10d8)("hard_navigation")
@@ -7700,6 +8409,7 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
7700
8409
  local_filter_cache: [],
7701
8410
  expanded_hierarchical_filters: [],
7702
8411
  showing_recommendation_rows: (0, $8ef6232475d44150$export$1c8c715550dc689d),
8412
+ content_results_rows: (0, $d53ebed6f63304e4$export$70ceae36059a1036),
7703
8413
  scroll_restoration_data: []
7704
8414
  };
7705
8415
  },
@@ -7711,12 +8421,18 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
7711
8421
  const get_search_query_ = (0, $b8hua$createMemo)(previous_value => {
7712
8422
  if (get_search_query_updating_blocked()) return previous_value;else return raw_search_query_accessor();
7713
8423
  });
8424
+ // @ts-ignore
7714
8425
  const depict_api_ = api !== null && api !== void 0 ? api : new (0, $284849364a6ef73a$export$e015ed2f2950f2e3)({
7715
- page_url_creator: page_url_creator
8426
+ page_url_creator: page_url_creator,
8427
+ display_transformers: display_transformers
7716
8428
  });
7717
8429
  const previous_searches = (0, $07d90b8270ece8de$export$84bba84a7b837187)(get_search_query_);
7718
8430
  const [, set_search_showing_recommendation_rows] = state_.showing_recommendation_rows;
7719
- const after_submit_ = () => set_search_showing_recommendation_rows((0, $8ef6232475d44150$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
8431
+ const [, set_search_content_results_rows] = state_.content_results_rows;
8432
+ const after_submit_ = () => {
8433
+ set_search_showing_recommendation_rows((0, $8ef6232475d44150$export$1c8c715550dc689d));
8434
+ set_search_content_results_rows((0, $d53ebed6f63304e4$export$70ceae36059a1036));
8435
+ }; // do this every time after we have submitted a new query - otherwise there might already be a saved number of rows in the state
7720
8436
  const on_submit_with_unchanged_value_ = () => this.modal_open = false;
7721
8437
  const [get_search_field_value_, set_search_field_value_] = state_.field_value;
7722
8438
  const configured_submit_query_ = new_query => (0, $86b0ff0c85e5fc6c$export$e16630ecb9644a1c)({
@@ -7774,6 +8490,10 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
7774
8490
  submit_query_: configured_submit_query_,
7775
8491
  url_transformer_: url_transformer,
7776
8492
  router_: (0, $b8hua$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_router),
8493
+ content_search_enabled_: () => {
8494
+ var _classPrivateFieldGet2;
8495
+ return (_classPrivateFieldGet2 = (0, $b8hua$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_content_search_signal)[0]()) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : $eb064bc3350276c1$var$content_search_default;
8496
+ },
7777
8497
  instant_results_options_: {
7778
8498
  min_products_to_fetch_: $eb064bc3350276c1$var$min_products_to_fetch_,
7779
8499
  render_instant_card_: render_instant_card,
@@ -7842,6 +8562,12 @@ class $eb064bc3350276c1$export$ac6237957a15b3f0 {
7842
8562
  (0, $b8hua$onCleanup)(() => $eb064bc3350276c1$var$_classStaticPrivateFieldSpecGet($eb064bc3350276c1$export$ac6237957a15b3f0, $eb064bc3350276c1$export$ac6237957a15b3f0, $eb064bc3350276c1$var$_keys_constructed_with).delete(unique_instance_key_for_state));
7843
8563
  });
7844
8564
  }
8565
+ get enable_content_search() {
8566
+ return (0, $b8hua$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_content_search_signal)[0]();
8567
+ }
8568
+ set enable_content_search(new_state) {
8569
+ (0, $b8hua$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_content_search_signal)[1](new_state);
8570
+ }
7845
8571
  get on_navigation() {
7846
8572
  // The only non-reactive public property on the class (I don't see it making sense to have it reactive)
7847
8573
  return (0, $b8hua$babelruntimehelpersclassPrivateFieldGet)(this, $eb064bc3350276c1$var$_router).on_navigation_;
@@ -7928,6 +8654,10 @@ function $eb064bc3350276c1$export$f2dc7e4e4aa11abb(props) {
7928
8654
  depict_api_: shared_properties.depict_api_,
7929
8655
  min_products_to_fetch_: $eb064bc3350276c1$var$min_products_to_fetch_,
7930
8656
  local_filter_cache_: state_.local_filter_cache,
8657
+ content_search_enabled_: () => {
8658
+ var _depict_search$enable;
8659
+ return (_depict_search$enable = depict_search.enable_content_search) !== null && _depict_search$enable !== void 0 ? _depict_search$enable : $eb064bc3350276c1$var$content_search_default;
8660
+ },
7931
8661
  search_field_value_: state_.field_value,
7932
8662
  get_search_query_: shared_properties.get_search_query_,
7933
8663
  clear_filters_on_next_submit_: shared_properties.clear_filters_on_next_submit_,
@@ -7957,6 +8687,8 @@ function $eb064bc3350276c1$export$f2dc7e4e4aa11abb(props) {
7957
8687
  search_filters_open_: state_.filters_open,
7958
8688
  search_sorting_open_: state_.sorting_open,
7959
8689
  expanded_filters_: state_.expanded_filters,
8690
+ content_results_rows_: state_.content_results_rows,
8691
+ router_: shared_properties.router_,
7960
8692
  make_category_suggestion_card_: shared_properties.enable_category_suggestions_ ? category_suggestion_ => {
7961
8693
  return (0, $dea31647b99a443b$export$d757d54550ebfb3d)({
7962
8694
  category_suggestion_: category_suggestion_,
@@ -7972,6 +8704,10 @@ function $eb064bc3350276c1$export$f2dc7e4e4aa11abb(props) {
7972
8704
  cols_at_size: (0, $a9c7ba6087881ac2$export$6daf8749b65a1b77)(props.cols_at_size),
7973
8705
  ...grid_spacing_override()
7974
8706
  })),
8707
+ content_layout_options_: (0, $b8hua$createMemo)(() => ({
8708
+ cols_at_size: (0, $a9c7ba6087881ac2$export$6daf8749b65a1b77)((0, $3f7203368ad0d3ca$export$ff7109b9b2b206ba)(props.cols_at_size)),
8709
+ ...grid_spacing_override()
8710
+ })),
7975
8711
  recommendations_layout_options_: (0, $b8hua$createMemo)(() => {
7976
8712
  const {
7977
8713
  extra_depict_options: extra_depict_options