@depict-ai/ui 2.1.12 → 2.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/ES10/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { add_to_version_info as $8tj43$add_to_version_info, base64_encode_unicode as $8tj43$base64_encode_unicode, base64_decode_unicode as $8tj43$base64_decode_unicode, dlog as $8tj43$dlog, queueMacroTask as $8tj43$queueMacroTask, catchify as $8tj43$catchify, is_safari as $8tj43$is_safari, observer as $8tj43$observer, dwarn as $8tj43$dwarn, Amazing_Slider as $8tj43$Amazing_Slider, slider_snap_css as $8tj43$slider_snap_css, slider_fading_factory as $8tj43$slider_fading_factory, slider_fractional_factory as $8tj43$slider_fractional_factory, camelCasifyObject as $8tj43$camelCasifyObject, make_random_classname as $8tj43$make_random_classname, n_col_styling_with_dist as $8tj43$n_col_styling_with_dist, layout_get_visible_recs_without_partial_rows as $8tj43$layout_get_visible_recs_without_partial_rows, layout_get_total_rec_amount_for_row as $8tj43$layout_get_total_rec_amount_for_row, layout_media_query_header as $8tj43$layout_media_query_header, report as $8tj43$report, useExpandingContainer as $8tj43$useExpandingContainer, standard_price_format as $8tj43$standard_price_format, hex_to_rgb as $8tj43$hex_to_rgb, relative_luminance_from_rgb as $8tj43$relative_luminance_from_rgb, fetch_recs as $8tj43$fetch_recs, snakeCasifyObject as $8tj43$snakeCasifyObject, instant_exec_on_suspect_history_change as $8tj43$instant_exec_on_suspect_history_change, base_url as $8tj43$base_url, get_depict_id as $8tj43$get_depict_id, get_user_id as $8tj43$get_user_id, get_session_id as $8tj43$get_session_id, make_url_with_query_params as $8tj43$make_url_with_query_params, fetch_retry as $8tj43$fetch_retry, add_version_query_params as $8tj43$add_version_query_params, sort_obj as $8tj43$sort_obj, edit_current_page_meta_tags as $8tj43$edit_current_page_meta_tags, javascript_media_query as $8tj43$javascript_media_query, use_href_accessor as $8tj43$use_href_accessor, is_debug as $8tj43$is_debug, make_asyncIterable_exiter as $8tj43$make_asyncIterable_exiter, href_change_ipns as $8tj43$href_change_ipns, ContainedImage as $8tj43$ContainedImage, buildThresholdList as $8tj43$buildThresholdList, deparallelize_no_drop as $8tj43$deparallelize_no_drop, ListenableSet as $8tj43$ListenableSet, insert_surfaces as $8tj43$insert_surfaces } from "@depict-ai/utilishared/ES10";
2
- import { createComponent as $8tj43$createComponent, insert as $8tj43$insert, template as $8tj43$template, getNextElement as $8tj43$getNextElement, effect as $8tj43$effect, style as $8tj43$style, spread as $8tj43$spread, setAttribute as $8tj43$setAttribute, mergeProps as $8tj43$mergeProps1, isServer as $8tj43$isServer, runHydrationEvents as $8tj43$runHydrationEvents, addEventListener as $8tj43$addEventListener, className as $8tj43$className, memo as $8tj43$memo, delegateEvents as $8tj43$delegateEvents, getNextMarker as $8tj43$getNextMarker, classList as $8tj43$classList, Dynamic as $8tj43$Dynamic, use as $8tj43$use, setProperty as $8tj43$setProperty } from "solid-js/web";
2
+ import { createComponent as $8tj43$createComponent, insert as $8tj43$insert, template as $8tj43$template, getNextElement as $8tj43$getNextElement, effect as $8tj43$effect, style as $8tj43$style, spread as $8tj43$spread, setAttribute as $8tj43$setAttribute, mergeProps as $8tj43$mergeProps1, isServer as $8tj43$isServer, runHydrationEvents as $8tj43$runHydrationEvents, addEventListener as $8tj43$addEventListener, className as $8tj43$className, memo as $8tj43$memo, delegateEvents as $8tj43$delegateEvents, getNextMarker as $8tj43$getNextMarker, classList as $8tj43$classList, use as $8tj43$use, Dynamic as $8tj43$Dynamic, setProperty as $8tj43$setProperty } from "solid-js/web";
3
3
  import { createSignal as $8tj43$createSignal, getOwner as $8tj43$getOwner, createEffect as $8tj43$createEffect, runWithOwner as $8tj43$runWithOwner, onCleanup as $8tj43$onCleanup, createMemo as $8tj43$createMemo, createContext as $8tj43$createContext, useContext as $8tj43$useContext, mergeProps as $8tj43$mergeProps, Show as $8tj43$Show, createResource as $8tj43$createResource, Suspense as $8tj43$Suspense, untrack as $8tj43$untrack, createRenderEffect as $8tj43$createRenderEffect, Index as $8tj43$Index, createRoot as $8tj43$createRoot, For as $8tj43$For, createUniqueId as $8tj43$createUniqueId, createComputed as $8tj43$createComputed, ErrorBoundary as $8tj43$ErrorBoundary, on as $8tj43$on, batch as $8tj43$batch, createReaction as $8tj43$createReaction, mapArray as $8tj43$mapArray } from "solid-js";
4
4
  import $8tj43$babelruntimehelpersclassPrivateFieldSet from "@babel/runtime/helpers/classPrivateFieldSet";
5
5
  import $8tj43$babelruntimehelpersclassPrivateFieldGet from "@babel/runtime/helpers/classPrivateFieldGet";
@@ -9,7 +9,7 @@ import { createStore as $8tj43$createStore, reconcile as $8tj43$reconcile } from
9
9
  /*! Depict.ai search and product listing SDK */
10
10
  import { register_es_version } from "../multi_import_deduplicator.mjs";
11
11
  register_es_version("ui", "ES10");
12
- const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.12";
12
+ const $8db9a15135765c11$export$83d89fbfd8236492 = "2.1.13";
13
13
  const $2855bffe06ef7a03$var$fallback_operator = "in";
14
14
  const $2855bffe06ef7a03$var$fallback_token = "";
15
15
  const $2855bffe06ef7a03$var$legacy_filter_prefix = "filter_";
@@ -464,13 +464,13 @@ function $002f09d00aac50b2$export$6649caad96ef8870(_ref) {
464
464
 
465
465
  /** @jsxImportSource solid-js */
466
466
 
467
- function $0dc044cffe1e825b$export$9f191182275e9ef(what_to_watch) {
468
- const [size, setSize] = $8tj43$createSignal();
467
+ function $fc830a7ee59416ef$export$ebdc3711f7e02ccd(what_to_watch) {
468
+ const [width, setWidth] = $8tj43$createSignal();
469
469
  const resizeObserver = new ResizeObserver($8tj43$catchify(records => {
470
470
  for (let j = 0; j < records.length; j++) {
471
471
  var _records$j$borderBoxS, _records$j$borderBoxS2, _records$j$borderBoxS3;
472
472
  const width = (_records$j$borderBoxS = (_records$j$borderBoxS2 = records[j].borderBoxSize) === null || _records$j$borderBoxS2 === void 0 ? void 0 : (_records$j$borderBoxS3 = _records$j$borderBoxS2[0]) === null || _records$j$borderBoxS3 === void 0 ? void 0 : _records$j$borderBoxS3.inlineSize) !== null && _records$j$borderBoxS !== void 0 ? _records$j$borderBoxS : what_to_watch.getBoundingClientRect().width;
473
- setSize(width);
473
+ setWidth(width);
474
474
  }
475
475
  }));
476
476
  // If we start observing elements before they're in the DOM Chrome (Version 117.0.5938.92 (Official Build) (arm64)) sometimes gives us a resize event with a width of 0 and then doesn't dispatch one with the actual width once it's in the DOM. So we wait until the element is in the DOM before we start observing it.
@@ -479,13 +479,19 @@ function $0dc044cffe1e825b$export$9f191182275e9ef(what_to_watch) {
479
479
  let {
480
480
  element: element
481
481
  } = _ref;
482
- return requestAnimationFrame($8tj43$catchify(() => resizeObserver.observe(element)));
482
+ return requestAnimationFrame($8tj43$catchify(() => {
483
+ const current_size = what_to_watch.getBoundingClientRect().width;
484
+ if (current_size)
485
+ // If element has size, set signal to that. ResizeObserver only triggers when the content is visible in some cases, but it might already have a size. This reduces size filter expanding animation jank in chrome.
486
+ setWidth(current_size);
487
+ resizeObserver.observe(element);
488
+ }));
483
489
  });
484
490
  $8tj43$onCleanup(() => {
485
491
  resizeObserver.disconnect();
486
492
  disconnect();
487
493
  });
488
- return size;
494
+ return width;
489
495
  }
490
496
  const $a9c7ba6087881ac2$var$transform_elements = sorted_cols_at_size => {
491
497
  const cols_at_size = [];
@@ -1523,17 +1529,12 @@ function $b4465d8d605f61e9$export$8895d39404bd2bb1(props) {
1523
1529
  if (delay_toast_) return show_configured_toast;else show_configured_toast();
1524
1530
  }
1525
1531
  $8tj43$delegateEvents(["click"]);
1526
- const $9783d437ad61594c$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg><path d="M11.669 10.531l9.156-9.156a.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569A.8.8 0 0 0 20.24 0a.77.77 0 0 0-.569.237l-9.14 9.14-9.14-9.14A.79.79 0 0 0 .807 0a.77.77 0 0 0-.569.237A.78.78 0 0 0 0 .807a.77.77 0 0 0 .237.569l9.156 9.156-9.156 9.14c-.159.157-.237.349-.237.569s.079.412.237.569c.085.085.174.148.268.19a1.095 1.095 0 0 0 .316.048.894.894 0 0 0 .285-.048.84.84 0 0 0 .285-.19l9.139-9.14 9.14 9.14a.894.894 0 0 0 .268.19 1.049 1.049 0 0 0 .301.048.941.941 0 0 0 .301-.048.84.84 0 0 0 .285-.19.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569z">`);
1532
+ const $9783d437ad61594c$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg xmlns=http://www.w3.org/2000/svg width=21.064 height=21.047 viewBox="0 0 21.064 21.064"><path d="M11.669 10.531l9.156-9.156a.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569A.8.8 0 0 0 20.24 0a.77.77 0 0 0-.569.237l-9.14 9.14-9.14-9.14A.79.79 0 0 0 .807 0a.77.77 0 0 0-.569.237A.78.78 0 0 0 0 .807a.77.77 0 0 0 .237.569l9.156 9.156-9.156 9.14c-.159.157-.237.349-.237.569s.079.412.237.569c.085.085.174.148.268.19a1.095 1.095 0 0 0 .316.048.894.894 0 0 0 .285-.048.84.84 0 0 0 .285-.19l9.139-9.14 9.14 9.14a.894.894 0 0 0 .268.19 1.049 1.049 0 0 0 .301.048.941.941 0 0 0 .301-.048.84.84 0 0 0 .285-.19.78.78 0 0 0 .237-.569c0-.221-.079-.412-.237-.569z">`);
1527
1533
  function $9783d437ad61594c$export$3b621d86b1566b2() {
1528
1534
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1529
1535
  return (() => {
1530
1536
  const _el$ = $8tj43$getNextElement($9783d437ad61594c$var$_tmpl$);
1531
- $8tj43$spread(_el$, $8tj43$mergeProps1(props, {
1532
- "xmlns": "http://www.w3.org/2000/svg",
1533
- "width": "21.064",
1534
- "height": "21.047",
1535
- "viewBox": "0 0 21.064 21.064"
1536
- }), true, true);
1537
+ $8tj43$spread(_el$, props, true, true);
1537
1538
  $8tj43$runHydrationEvents();
1538
1539
  return _el$;
1539
1540
  })();
@@ -1861,7 +1862,7 @@ $8tj43$delegateEvents(["click"]);
1861
1862
  const $19e828709c7723a0$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<span class=count>`),
1862
1863
  $19e828709c7723a0$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<label class=input-row><div class=left><input type=checkbox><span class=custom-indicator></span><span class="text line-clamp"></span></div><!$><!/>`);
1863
1864
  const $19e828709c7723a0$export$48513f6b9f8ce62d = props => {
1864
- // 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
1865
+ /* don't destructure props, it could have reactive getters */ // 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
1865
1866
  const count = $8tj43$createMemo(() => props.count_);
1866
1867
  const label = $8tj43$createMemo(() => props.label_);
1867
1868
  const checked = $8tj43$createMemo(() => props.checked_);
@@ -1959,6 +1960,79 @@ function $3e850b2f2cca761f$export$ca21a16d65b3dd8(_ref) {
1959
1960
  })();
1960
1961
  }
1961
1962
  $8tj43$delegateEvents(["click"]);
1963
+ const $02b6641aa50ce528$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<span class=highlighted-part>`),
1964
+ $02b6641aa50ce528$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<span>`);
1965
+ function $02b6641aa50ce528$export$ba17c5b7e6dda39f(_ref) {
1966
+ let {
1967
+ whole_text_to_display_: whole_text_to_display_memo,
1968
+ searching_for_value_: searching_for_value_memo,
1969
+ class_: class_
1970
+ } = _ref;
1971
+ const [get_has_highlighted, set_has_highlighted] = $8tj43$createSignal(false);
1972
+ const text_itself = $8tj43$createMemo(() => $8tj43$batch(() => {
1973
+ set_has_highlighted(false);
1974
+ const searching_for_value = searching_for_value_memo();
1975
+ const whole_text_to_display_ = whole_text_to_display_memo();
1976
+ let for_black = "";
1977
+ let pushed_grey = false;
1978
+ const search_q = searching_for_value;
1979
+ if (!search_q) return whole_text_to_display_;
1980
+ const output = [];
1981
+ const searching_for = search_q.toLowerCase();
1982
+ const push_black = () => {
1983
+ if (for_black) {
1984
+ set_has_highlighted(true);
1985
+ output.push((() => {
1986
+ const _el$ = $8tj43$getNextElement($02b6641aa50ce528$var$_tmpl$);
1987
+ $8tj43$insert(_el$, for_black);
1988
+ return _el$;
1989
+ })()); // "black"
1990
+ for_black = "";
1991
+ }
1992
+ };
1993
+ for (let i = 0; i < whole_text_to_display_.length;) {
1994
+ let is_whole_word = true;
1995
+ let searching_for_but_with_texts_casing = "";
1996
+ const i_at_start = i;
1997
+ for (let j = 0; j < searching_for.length; i++, j++) {
1998
+ const letter_in_suggestion = whole_text_to_display_[i];
1999
+ if ((letter_in_suggestion === null || letter_in_suggestion === void 0 ? void 0 : letter_in_suggestion.toLowerCase()) !== searching_for[j]) {
2000
+ is_whole_word = false;
2001
+ i = i_at_start;
2002
+ break;
2003
+ }
2004
+ searching_for_but_with_texts_casing += letter_in_suggestion;
2005
+ }
2006
+ if (is_whole_word) {
2007
+ push_black();
2008
+ output.push(searching_for_but_with_texts_casing);
2009
+ pushed_grey = true;
2010
+ } else for_black += whole_text_to_display_[i++];
2011
+ }
2012
+ push_black();
2013
+ if (!pushed_grey) {
2014
+ set_has_highlighted(false);
2015
+ return whole_text_to_display_;
2016
+ }
2017
+ return output;
2018
+ }));
2019
+ return (() => {
2020
+ const _el$2 = $8tj43$getNextElement($02b6641aa50ce528$var$_tmpl$2);
2021
+ $8tj43$className(_el$2, class_);
2022
+ $8tj43$insert(_el$2, text_itself);
2023
+ $8tj43$effect(_p$ => {
2024
+ const _v$ = !!get_has_highlighted(),
2025
+ _v$2 = whole_text_to_display_memo() /* for when line-clamped, users can see full text on hover */;
2026
+ _v$ !== _p$._v$ && _el$2.classList.toggle("has-match", _p$._v$ = _v$);
2027
+ _v$2 !== _p$._v$2 && $8tj43$setAttribute(_el$2, "title", _p$._v$2 = _v$2);
2028
+ return _p$;
2029
+ }, {
2030
+ _v$: undefined,
2031
+ _v$2: undefined
2032
+ });
2033
+ return _el$2;
2034
+ })();
2035
+ }
1962
2036
  const $133484ef10e4e954$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<form class=checkboxes><!$><!/><!$><!/>`);
1963
2037
  const $133484ef10e4e954$var$max_visible_without_collapsing = 15;
1964
2038
  const $133484ef10e4e954$var$show_non_collapsible_when_collapsed = 4;
@@ -1967,7 +2041,8 @@ function $133484ef10e4e954$export$dd948f91abc3a1c4(_ref) {
1967
2041
  filter_: filter_,
1968
2042
  selected_filters_: [get_selected_filters, set_selected_filters],
1969
2043
  i18n_: i18n_,
1970
- view_more_button_below_group_: [, set_view_more_button_below_group_]
2044
+ view_more_button_below_group_: [, set_view_more_button_below_group_],
2045
+ filter_query_: filter_query_
1971
2046
  } = _ref;
1972
2047
  const existing_filter = $8tj43$createMemo(() => {
1973
2048
  const {
@@ -2002,12 +2077,18 @@ function $133484ef10e4e954$export$dd948f91abc3a1c4(_ref) {
2002
2077
  const value = $af5d8e0b7d97a7f6$export$325f75597868c4f0(checkbox().value_);
2003
2078
  return !!(data !== null && data !== void 0 && data.some(item => $af5d8e0b7d97a7f6$export$325f75597868c4f0(item) === value));
2004
2079
  });
2080
+ const value = $8tj43$createMemo(() => checkbox().value_);
2005
2081
  return $8tj43$createComponent((0, $19e828709c7723a0$export$48513f6b9f8ce62d), {
2006
2082
  get value_() {
2007
- return checkbox().value_;
2083
+ return value();
2008
2084
  },
2009
2085
  get label_() {
2010
- return checkbox().name_;
2086
+ return $8tj43$createComponent((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
2087
+ get whole_text_to_display_() {
2088
+ return $8tj43$createMemo(() => checkbox().name_ || value());
2089
+ },
2090
+ searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
2091
+ });
2011
2092
  },
2012
2093
  get count_() {
2013
2094
  return checkbox().count_;
@@ -2106,7 +2187,8 @@ const $b54fc842e721c9eb$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<form class=r
2106
2187
  function $b54fc842e721c9eb$export$430444115f70a734(_ref) {
2107
2188
  let {
2108
2189
  selected_filters_: selected_filters_,
2109
- filter_: filter_
2190
+ filter_: filter_,
2191
+ filter_query_: filter_query_
2110
2192
  } = _ref;
2111
2193
  const radio_name = $8tj43$make_random_classname();
2112
2194
  const existing_filter = $8tj43$createMemo(() => {
@@ -2134,6 +2216,13 @@ function $b54fc842e721c9eb$export$430444115f70a734(_ref) {
2134
2216
  var _counts;
2135
2217
  return (_counts = filter_().meta.counts) === null || _counts === void 0 ? void 0 : _counts[index];
2136
2218
  });
2219
+ const label = $8tj43$createMemo(() => {
2220
+ var _filter_$meta, _filter_$meta$names;
2221
+ const name = (_filter_$meta = filter_().meta) === null || _filter_$meta === void 0 ? void 0 : (_filter_$meta$names = _filter_$meta.names) === null || _filter_$meta$names === void 0 ? void 0 : _filter_$meta$names[index];
2222
+ if (name) return name;
2223
+ const v = value();
2224
+ return Array.isArray(v) ? v.join(" - ") : v + "";
2225
+ });
2137
2226
  return (() => {
2138
2227
  const _el$2 = $8tj43$getNextElement($b54fc842e721c9eb$var$_tmpl$3),
2139
2228
  _el$3 = _el$2.firstChild,
@@ -2158,12 +2247,9 @@ function $b54fc842e721c9eb$export$430444115f70a734(_ref) {
2158
2247
  }));
2159
2248
  $8tj43$setAttribute(_el$4, "id", random_selector);
2160
2249
  $8tj43$setAttribute(_el$4, "name", radio_name);
2161
- $8tj43$insert(_el$3, $8tj43$createMemo(() => {
2162
- var _filter_$meta, _filter_$meta$names;
2163
- const name = (_filter_$meta = filter_().meta) === null || _filter_$meta === void 0 ? void 0 : (_filter_$meta$names = _filter_$meta.names) === null || _filter_$meta$names === void 0 ? void 0 : _filter_$meta$names[index];
2164
- if (name) return name;
2165
- const v = value();
2166
- return Array.isArray(v) ? v.join(" - ") : v;
2250
+ $8tj43$insert(_el$3, $8tj43$createComponent((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
2251
+ whole_text_to_display_: label,
2252
+ searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
2167
2253
  }), _el$7, _co$);
2168
2254
  $8tj43$insert(_el$2, $8tj43$createComponent((0, $8tj43$Show), {
2169
2255
  get when() {
@@ -2197,7 +2283,8 @@ function $1e7465a8ffa97f6c$export$e0d834a0ad870cda(_ref) {
2197
2283
  let {
2198
2284
  filter_: filter_,
2199
2285
  selected_filters_: selected_filters_,
2200
- i18n_: i18n_
2286
+ i18n_: i18n_,
2287
+ filter_query_: filter_query_
2201
2288
  } = _ref;
2202
2289
  // If you ever attempt to implement that one can drag one range "knob" over the other like on prisjakt, see https://gitlab.com/depict-ai/depict.ai/-/merge_requests/8458/diffs?commit_id=c52dbdd15ca073489bee138b15d27bb6bf2992df
2203
2290
  // The issue with it is that one wants to discard the changes to the lower value as soon as the lower value has become the upper value when dragging the initially lower knob over the initially upper knob
@@ -2590,138 +2677,420 @@ function $457279ff15864cb9$export$e5c2828934226505(_ref) {
2590
2677
  });
2591
2678
  return outer_div;
2592
2679
  }
2593
- const $0ae614c5c7babb43$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<form class="checkboxes hierarchical"><!$><!/><!$><!/>`),
2594
- $0ae614c5c7babb43$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class=checkbox-details><!$><!/><!$><!/>`),
2595
- $0ae614c5c7babb43$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<details>`),
2596
- $0ae614c5c7babb43$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<summary class=category-parent><div class=summary><span class=count></span><!$><!/>`);
2597
- const $0ae614c5c7babb43$var$max_visible_without_collapsing = 15;
2598
- const $0ae614c5c7babb43$var$show_non_collapsible_when_collapsed = 4;
2599
- function $0ae614c5c7babb43$export$a32086fa6616eafd(_ref) {
2680
+ const $f3a159279dc1a8fb$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<span class=highlighted-part>`);
2681
+ const $f3a159279dc1a8fb$var$dont_cut_in_between_less_than_characters = 30;
2682
+ function $f3a159279dc1a8fb$export$e1a98a189fd2c0e7(_ref) {
2600
2683
  let {
2601
- filter_: filter_,
2602
- selected_filters_: selected_filters_,
2603
- i18n_: i18n_,
2604
- view_more_button_below_group_: view_more_button_below_group_,
2605
- expanded_hierarchical_filters_: expanded_hierarchical_filters_
2684
+ content_result_: content_result_,
2685
+ key_: key_,
2686
+ cut_when_possible_: cut_when_possible_
2606
2687
  } = _ref;
2607
- let form;
2608
- const existing_filter = $8tj43$createMemo(() => {
2609
- const {
2610
- field: field,
2611
- op: op
2612
- } = filter_();
2613
- return selected_filters_[0]().find(_ref2 => {
2614
- let {
2615
- field: checking_field,
2616
- op: checking_op
2617
- } = _ref2;
2618
- return checking_field === field && checking_op === op;
2619
- });
2620
- });
2621
- const show_extras = $8tj43$createSignal(false);
2622
- const trigger_sync_ = $0ae614c5c7babb43$var$batching_filter_state_syncer({
2623
- filter_: filter_,
2624
- existing_filter_: existing_filter,
2625
- selected_filters_: selected_filters_,
2626
- get category_structure_() {
2627
- return structured_categories();
2628
- }
2629
- });
2630
- const structured_categories = $8tj43$createMemo(() => {
2631
- const execute_when_structure_finished = [];
2632
- const {
2633
- values: values,
2634
- names: names,
2635
- counts: counts
2636
- } = filter_().meta;
2637
- const data_structure = {};
2638
- for (let i = 0; i < values.length; i++) {
2639
- const value = values[i];
2640
- let pointer = data_structure;
2641
- let parent_ = {};
2642
- let created_an_object = false;
2643
- for (let j = 0; j < value.length; j++) {
2644
- var _pointer;
2645
- const this_categories_name = value[j];
2646
- const obj = (_pointer = pointer)[this_categories_name] || (_pointer[this_categories_name] = (() => {
2647
- const value_as_string = value.map(v => typeof v === "number" ? v + "" : v); // don't think backend will ever send numbers but technically it's allowed;
2648
- const created_obj = {
2649
- name_: names[i],
2650
- count_: counts === null || counts === void 0 ? void 0 : counts[i],
2651
- parent_: parent_,
2652
- is_expanded_: $0ae614c5c7babb43$var$make_expanded_signal({
2653
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
2654
- filter_value_: value_as_string
2655
- }),
2656
- value_: value_as_string,
2657
- children_: {}
2658
- };
2659
- const {
2660
- signal_: signal_,
2661
- on_structure_complete_: on_structure_complete_
2662
- } = $0ae614c5c7babb43$var$create_updating_signal({
2663
- self_: created_obj,
2664
- existing_filter_: $8tj43$untrack(existing_filter),
2665
- trigger_sync_: trigger_sync_
2666
- });
2667
- execute_when_structure_finished.push(on_structure_complete_);
2668
- created_obj.is_checked_ = signal_;
2669
- parent_ = created_obj;
2670
- created_an_object = true;
2671
- return created_obj;
2672
- })());
2673
- pointer = obj.children_;
2674
- parent_ = obj;
2675
- }
2676
- if (!created_an_object && "value_" in parent_) {
2677
- // if an object was created for our "depth" in the hierarchy but not for our specific entry this means that the entry array was unsorted and looked something like
2678
- // [
2679
- // ["Öl", "IPA"],
2680
- // ["Öl", "Pale Ale"],
2681
- // ["Öl", "Ale"],
2682
- // ["Öl", "Mörk Lager"],
2683
- // ["Öl", "Suröl"],
2684
- // ["Öl", "Veteöl"],
2685
- // ["Öl", "Stout och Porter"],
2686
- // ["Öl"], // <- We are here, our `hierarchical_data_structure[string]`-object was created when we iterated over ["Öl", "IPA"]
2687
- // ["Öl", "Ljus Lager"],
2688
- // ];
2689
- // In this case we want to just correct the name and value of the already created object, which will be in parent_
2690
- parent_.value_ = value.map(v => v + "");
2691
- parent_.name_ = names[i];
2692
- parent_.count_ = counts[i];
2693
- parent_.is_expanded_ = $0ae614c5c7babb43$var$make_expanded_signal({
2694
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
2695
- filter_value_: parent_.value_
2696
- });
2697
- }
2698
- }
2699
- while (execute_when_structure_finished.length) execute_when_structure_finished.pop()();
2700
- $0ae614c5c7babb43$var$expand_until_choice(data_structure);
2701
- $8tj43$dlog("CheckboxHierarchicalFilter: Recomputed structured_categories", data_structure);
2702
- return data_structure;
2688
+ const matched_tokens = $8tj43$createMemo(() => {
2689
+ var _content_result_$high, _content_result_$high2;
2690
+ 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;
2703
2691
  });
2704
- const some_top_level_are_hidden = $8tj43$createMemo(() => Object.keys(structured_categories()).length > $0ae614c5c7babb43$var$max_visible_without_collapsing);
2705
- const {
2706
- expand: expand,
2707
- collapse: collapse,
2708
- ExpandingContainer: ExpandingContainer
2709
- } = $8e8b179489080711$export$5bad61ecde080b1f({
2710
- duration: 200
2692
+ const full_value = $8tj43$createMemo(() => {
2693
+ var _content_result_$key_;
2694
+ return (_content_result_$key_ = content_result_()[key_]) === null || _content_result_$key_ === void 0 ? void 0 : _content_result_$key_.replaceAll("\n", " ");
2711
2695
  });
2712
- const expanding_container_els = $8tj43$createComponent(ExpandingContainer, {
2696
+ return $8tj43$createComponent((0, $8tj43$Show), {
2697
+ get when() {
2698
+ var _matched_tokens;
2699
+ return (_matched_tokens = matched_tokens()) === null || _matched_tokens === void 0 ? void 0 : _matched_tokens.length;
2700
+ },
2701
+ get fallback() {
2702
+ return full_value();
2703
+ },
2713
2704
  get children() {
2714
- return $8tj43$createComponent((0, $8tj43$Show), {
2715
- get when() {
2716
- return some_top_level_are_hidden();
2717
- },
2718
- get children() {
2719
- return $0ae614c5c7babb43$var$render_stuff($8tj43$createMemo(() => Object.fromEntries(Object.entries(structured_categories()).slice($0ae614c5c7babb43$var$show_non_collapsible_when_collapsed))), existing_filter, i18n_);
2720
- }
2721
- });
2705
+ return (() => {
2706
+ const segmented_cut_text = $8tj43$createMemo(() => {
2707
+ const segmented_text = $f3a159279dc1a8fb$export$1b00d74faf266c56(full_value(), matched_tokens());
2708
+ if (cut_when_possible_) $f3a159279dc1a8fb$var$cut_text(segmented_text);
2709
+ return segmented_text;
2710
+ });
2711
+ return $8tj43$createComponent((0, $8tj43$Index), {
2712
+ get each() {
2713
+ return segmented_cut_text();
2714
+ },
2715
+ children: item => {
2716
+ return $8tj43$createComponent((0, $8tj43$Show), {
2717
+ get when() {
2718
+ return item().highlighted_;
2719
+ },
2720
+ get fallback() {
2721
+ return item().text_;
2722
+ },
2723
+ get children() {
2724
+ const _el$ = $8tj43$getNextElement($f3a159279dc1a8fb$var$_tmpl$);
2725
+ $8tj43$insert(_el$, () => item().text_);
2726
+ return _el$;
2727
+ }
2728
+ });
2729
+ }
2730
+ });
2731
+ })();
2722
2732
  }
2723
2733
  });
2724
- $8tj43$createRenderEffect(() => {
2734
+ }
2735
+ function $f3a159279dc1a8fb$var$cut_text(segmented_text) {
2736
+ // cut away chunks of text that are not highlighted to give a google-like overview of the content
2737
+ const highlighted_segments = segmented_text === null || segmented_text === void 0 ? void 0 : segmented_text.filter(segment => segment.highlighted_);
2738
+ if (!segmented_text || !(highlighted_segments !== null && highlighted_segments !== void 0 && highlighted_segments.length)) return;
2739
+ // We have one or more highlighted segments
2740
+ if (highlighted_segments.length === 1) {
2741
+ // cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
2742
+ $f3a159279dc1a8fb$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
2743
+ return;
2744
+ }
2745
+ // We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
2746
+ 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
2747
+ );
2748
+
2749
+ const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
2750
+ // We need to cut before the first segment - possibly through other segments - and maybe between segments
2751
+ 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);
2752
+ $f3a159279dc1a8fb$var$cut_start(index_of_first_segment, segmented_text);
2753
+ // update indexes since we might have removed segments
2754
+ [index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
2755
+ let number_of_characters_between_segments = 0;
2756
+ for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
2757
+ const segment = segmented_text[i];
2758
+ number_of_characters_between_segments += segment.text_.length;
2759
+ }
2760
+ if (number_of_characters_between_segments < $f3a159279dc1a8fb$var$dont_cut_in_between_less_than_characters)
2761
+ // don't cut if there are less than 30 characters between the two segments
2762
+ return;
2763
+ // We have more than 50 characters between the two segments, cut between them
2764
+ const [split_start_segment, split_start_character] = $f3a159279dc1a8fb$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
2765
+ const [split_end_segment, split_end_character] = $f3a159279dc1a8fb$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
2766
+ if (split_start_segment === undefined || split_end_segment === undefined ||
2767
+ // identical split point, or split end before split start, can't do anything
2768
+ split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
2769
+ const dots_segment = {
2770
+ text_: " … ",
2771
+ highlighted_: false
2772
+ };
2773
+ const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
2774
+ if (i < split_start_segment || i > split_end_segment) return segment;
2775
+ const text = segment.text_;
2776
+ if (i == split_end_segment && i == split_start_segment) return [{
2777
+ ...segment,
2778
+ text_: text.slice(0, split_start_character).trimEnd()
2779
+ }, dots_segment, {
2780
+ ...segment,
2781
+ text_: text.slice(split_end_character + 1, text.length).trimStart()
2782
+ }];else if (i == split_start_segment) {
2783
+ 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
2784
+ return segment;
2785
+ } else if (i == split_end_segment) return [dots_segment, {
2786
+ ...segment,
2787
+ text_: text.slice(split_end_character + 1, text.length).trimStart()
2788
+ }];
2789
+ return []; // remove all segments inbetween
2790
+ });
2791
+
2792
+ segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
2793
+ $f3a159279dc1a8fb$var$heal_holes(segmented_text);
2794
+ }
2795
+ function $f3a159279dc1a8fb$var$heal_holes(segmented_text) {
2796
+ // try to heal "holes" created in the segments so there are only alternating segments
2797
+ const segments_to_delete = new Set();
2798
+ for (let i = 0; i < segmented_text.length; i++) {
2799
+ var _previous_segment, _previous_segment2;
2800
+ const segment = segmented_text[i];
2801
+ let previous_segment;
2802
+ for (let j = i - 1; j >= 0; j--) {
2803
+ previous_segment = segmented_text[j];
2804
+ // Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
2805
+ if (!segments_to_delete.has(previous_segment)) break;
2806
+ }
2807
+ 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) {
2808
+ previous_segment.text_ += segment.text_; // IDK if this ever happens
2809
+ segments_to_delete.add(segment);
2810
+ }
2811
+ }
2812
+ for (const segment of segments_to_delete) {
2813
+ const index = segmented_text.indexOf(segment);
2814
+ segmented_text.splice(index, 1);
2815
+ }
2816
+ }
2817
+ function $f3a159279dc1a8fb$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text) {
2818
+ let be_very_aggressive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
2819
+ const should_loop_backwards = index_of_start_segment > index_of_end_segment;
2820
+ const step = should_loop_backwards ? -1 : 1;
2821
+ const desperate_split_attempts = [":", ";", ","];
2822
+ while (desperate_split_attempts.length) {
2823
+ const split_point_between_words = [];
2824
+ // for the middle also try to split with a few more characters if the default ones don't work over a full run
2825
+ const desperate_split_attempt = desperate_split_attempts.pop();
2826
+ let is_first_character = true;
2827
+ for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
2828
+ const segment = segmented_text[i];
2829
+ const text = segment.text_;
2830
+ for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
2831
+ const character = text[j];
2832
+ if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
2833
+ if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
2834
+ split_point_between_words.push([i, j]);
2835
+ if (split_point_between_words.length > 3)
2836
+ // We can't find a split point, so we'll just split between words
2837
+ // 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
2838
+ return split_point_between_words[1];
2839
+ }
2840
+ }
2841
+ }
2842
+ }
2843
+ return [];
2844
+ }
2845
+ function $f3a159279dc1a8fb$var$cut_start(cut_left_of_index, segmented_text) {
2846
+ // Cut the start of the text to bring the first matching token
2847
+ let is_first_character = false;
2848
+ let words_encountered = 0;
2849
+ outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
2850
+ const segment = segmented_text[i];
2851
+ // We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
2852
+ const text = segment.text_;
2853
+ for (let j = text.length - 1; j >= 0; j--) {
2854
+ const character = text[j];
2855
+ const is_space = character == " ";
2856
+ if (!is_first_character && is_space) words_encountered++;
2857
+ if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
2858
+ // We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
2859
+ segment.text_ = text.slice(j + 1).trimStart();
2860
+ segmented_text.splice(0, i);
2861
+ if (character === "," || is_space)
2862
+ // if we cut at a comma or psace, we add a … at the beginning
2863
+ segmented_text.unshift({
2864
+ text_: "… ",
2865
+ highlighted_: false
2866
+ });
2867
+ break outmost_loop;
2868
+ }
2869
+ if (is_first_character) is_first_character = false;
2870
+ }
2871
+ }
2872
+ $f3a159279dc1a8fb$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
2873
+ }
2874
+
2875
+ function $f3a159279dc1a8fb$export$1b00d74faf266c56(text, matched_strings) {
2876
+ let loose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2877
+ const output = [];
2878
+ if (!text) return; // shouldn't happen but whatever
2879
+ for (let i = 0; i < text.length; i++) {
2880
+ const found_strings = [];
2881
+ if (!i || text[i - 1] == " " || loose)
2882
+ // only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
2883
+ for (let j = 0; j < matched_strings.length; j++) {
2884
+ const matched_string = matched_strings[j];
2885
+ const part_in_text = text.slice(i, i + matched_string.length);
2886
+ if (matched_string.length < 2 && !loose) continue; // don't match on single characters, i.e. "I", it looks weird
2887
+ 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
2888
+ }
2889
+
2890
+ const last_index_in_output = output.length - 1;
2891
+ if (!found_strings.length) {
2892
+ var _output$last_index_in;
2893
+ const character = text[i];
2894
+ 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))
2895
+ // 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
2896
+ output[last_index_in_output].text_ += character;else output.push({
2897
+ highlighted_: false,
2898
+ text_: character
2899
+ });
2900
+ } else {
2901
+ var _output$last_index_in2;
2902
+ const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
2903
+ 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({
2904
+ highlighted_: true,
2905
+ text_: longest_found_string
2906
+ });
2907
+ i += longest_found_string.length - 1;
2908
+ }
2909
+ }
2910
+ return output;
2911
+ }
2912
+ const $b0e2100b511ec9a4$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<span>`),
2913
+ $b0e2100b511ec9a4$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<span class=highlighted-part>`);
2914
+ function $b0e2100b511ec9a4$export$8e79c28529dbfa90(props) {
2915
+ const segmented_text = $8tj43$createMemo(() => {
2916
+ const {
2917
+ to_highlight_: to_highlight_,
2918
+ text_: text_
2919
+ } = props;
2920
+ return $f3a159279dc1a8fb$export$1b00d74faf266c56(text_, to_highlight_ ? [to_highlight_] : [], true);
2921
+ });
2922
+ const has_highlights = $8tj43$createMemo(() => segmented_text().some(segment => segment.highlighted_));
2923
+ return (() => {
2924
+ const _el$ = $8tj43$getNextElement($b0e2100b511ec9a4$var$_tmpl$);
2925
+ $8tj43$insert(_el$, $8tj43$createComponent((0, $8tj43$Index), {
2926
+ get each() {
2927
+ return segmented_text();
2928
+ },
2929
+ children: item => {
2930
+ return $8tj43$createComponent((0, $8tj43$Show), {
2931
+ get when() {
2932
+ return item().highlighted_;
2933
+ },
2934
+ get fallback() {
2935
+ return item().text_;
2936
+ },
2937
+ get children() {
2938
+ const _el$2 = $8tj43$getNextElement($b0e2100b511ec9a4$var$_tmpl$2);
2939
+ $8tj43$insert(_el$2, () => item().text_);
2940
+ return _el$2;
2941
+ }
2942
+ });
2943
+ }
2944
+ }));
2945
+ $8tj43$effect(_p$ => {
2946
+ const _v$ = props.text_,
2947
+ _v$2 = !!has_highlights();
2948
+ _v$ !== _p$._v$ && $8tj43$setAttribute(_el$, "title", _p$._v$ = _v$);
2949
+ _v$2 !== _p$._v$2 && _el$.classList.toggle("has-match", _p$._v$2 = _v$2);
2950
+ return _p$;
2951
+ }, {
2952
+ _v$: undefined,
2953
+ _v$2: undefined
2954
+ });
2955
+ return _el$;
2956
+ })();
2957
+ }
2958
+ const $0ae614c5c7babb43$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<form class="checkboxes hierarchical"><!$><!/><!$><!/>`),
2959
+ $0ae614c5c7babb43$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class=checkbox-details><!$><!/><!$><!/>`),
2960
+ $0ae614c5c7babb43$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<details>`),
2961
+ $0ae614c5c7babb43$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<summary class=category-parent><div class=summary><span class=count></span><!$><!/>`);
2962
+ const $0ae614c5c7babb43$var$max_visible_without_collapsing = 15;
2963
+ const $0ae614c5c7babb43$var$show_non_collapsible_when_collapsed = 4;
2964
+ function $0ae614c5c7babb43$export$a32086fa6616eafd(_ref) {
2965
+ let {
2966
+ filter_: filter_,
2967
+ selected_filters_: selected_filters_,
2968
+ i18n_: i18n_,
2969
+ view_more_button_below_group_: view_more_button_below_group_,
2970
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
2971
+ filter_query_: filter_query_
2972
+ } = _ref;
2973
+ let form;
2974
+ const existing_filter = $8tj43$createMemo(() => {
2975
+ const {
2976
+ field: field,
2977
+ op: op
2978
+ } = filter_();
2979
+ return selected_filters_[0]().find(_ref2 => {
2980
+ let {
2981
+ field: checking_field,
2982
+ op: checking_op
2983
+ } = _ref2;
2984
+ return checking_field === field && checking_op === op;
2985
+ });
2986
+ });
2987
+ const show_extras = $8tj43$createSignal(false);
2988
+ const is_being_searched_ = $8tj43$createMemo(() => !!(filter_query_ !== null && filter_query_ !== void 0 && filter_query_())); // If the user is searching in the filter
2989
+ const trigger_sync_ = $0ae614c5c7babb43$var$batching_filter_state_syncer({
2990
+ filter_: filter_,
2991
+ existing_filter_: existing_filter,
2992
+ selected_filters_: selected_filters_,
2993
+ get category_structure_() {
2994
+ return structured_categories();
2995
+ }
2996
+ });
2997
+ const structured_categories = $8tj43$createMemo(() => {
2998
+ const execute_when_structure_finished = [];
2999
+ const {
3000
+ values: values,
3001
+ names: names,
3002
+ counts: counts
3003
+ } = filter_().meta;
3004
+ const data_structure = {};
3005
+ for (let i = 0; i < values.length; i++) {
3006
+ const value = values[i];
3007
+ let pointer = data_structure;
3008
+ let parent_ = {};
3009
+ let created_an_object = false;
3010
+ for (let j = 0; j < value.length; j++) {
3011
+ var _pointer;
3012
+ const this_categories_name = value[j];
3013
+ const obj = (_pointer = pointer)[this_categories_name] || (_pointer[this_categories_name] = (() => {
3014
+ const value_as_string = value.map(v => typeof v === "number" ? v + "" : v); // don't think backend will ever send numbers but technically it's allowed;
3015
+ const created_obj = {
3016
+ name_: names[i],
3017
+ count_: counts === null || counts === void 0 ? void 0 : counts[i],
3018
+ parent_: parent_,
3019
+ is_expanded_: $0ae614c5c7babb43$var$make_expanded_signal({
3020
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
3021
+ filter_value_: value_as_string,
3022
+ is_being_searched_: is_being_searched_
3023
+ }),
3024
+ value_: value_as_string,
3025
+ children_: {}
3026
+ };
3027
+ const {
3028
+ signal_: signal_,
3029
+ on_structure_complete_: on_structure_complete_
3030
+ } = $0ae614c5c7babb43$var$create_updating_signal({
3031
+ self_: created_obj,
3032
+ existing_filter_: $8tj43$untrack(existing_filter),
3033
+ trigger_sync_: trigger_sync_
3034
+ });
3035
+ execute_when_structure_finished.push(on_structure_complete_);
3036
+ created_obj.is_checked_ = signal_;
3037
+ parent_ = created_obj;
3038
+ created_an_object = true;
3039
+ return created_obj;
3040
+ })());
3041
+ pointer = obj.children_;
3042
+ parent_ = obj;
3043
+ }
3044
+ if (!created_an_object && "value_" in parent_) {
3045
+ // if an object was created for our "depth" in the hierarchy but not for our specific entry this means that the entry array was unsorted and looked something like
3046
+ // [
3047
+ // ["Öl", "IPA"],
3048
+ // ["Öl", "Pale Ale"],
3049
+ // ["Öl", "Ale"],
3050
+ // ["Öl", "Mörk Lager"],
3051
+ // ["Öl", "Suröl"],
3052
+ // ["Öl", "Veteöl"],
3053
+ // ["Öl", "Stout och Porter"],
3054
+ // ["Öl"], // <- We are here, our `hierarchical_data_structure[string]`-object was created when we iterated over ["Öl", "IPA"]
3055
+ // ["Öl", "Ljus Lager"],
3056
+ // ];
3057
+ // In this case we want to just correct the name and value of the already created object, which will be in parent_
3058
+ parent_.value_ = value.map(v => v + "");
3059
+ parent_.name_ = names[i];
3060
+ parent_.count_ = counts[i];
3061
+ parent_.is_expanded_ = $0ae614c5c7babb43$var$make_expanded_signal({
3062
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
3063
+ filter_value_: parent_.value_,
3064
+ is_being_searched_: is_being_searched_
3065
+ });
3066
+ }
3067
+ }
3068
+ while (execute_when_structure_finished.length) execute_when_structure_finished.pop()();
3069
+ $0ae614c5c7babb43$var$expand_until_choice(data_structure);
3070
+ $8tj43$dlog("CheckboxHierarchicalFilter: Recomputed structured_categories", data_structure);
3071
+ return data_structure;
3072
+ });
3073
+ const some_top_level_are_hidden = $8tj43$createMemo(() => Object.keys(structured_categories()).length > $0ae614c5c7babb43$var$max_visible_without_collapsing);
3074
+ const {
3075
+ expand: expand,
3076
+ collapse: collapse,
3077
+ ExpandingContainer: ExpandingContainer
3078
+ } = $8e8b179489080711$export$5bad61ecde080b1f({
3079
+ duration: 200
3080
+ });
3081
+ const expanding_container_els = $8tj43$createComponent(ExpandingContainer, {
3082
+ get children() {
3083
+ return $8tj43$createComponent((0, $8tj43$Show), {
3084
+ get when() {
3085
+ return some_top_level_are_hidden();
3086
+ },
3087
+ get children() {
3088
+ return $0ae614c5c7babb43$var$render_stuff($8tj43$createMemo(() => Object.fromEntries(Object.entries(structured_categories()).slice($0ae614c5c7babb43$var$show_non_collapsible_when_collapsed))), existing_filter, i18n_, filter_query_);
3089
+ }
3090
+ });
3091
+ }
3092
+ });
3093
+ $8tj43$createRenderEffect(() => {
2725
3094
  view_more_button_below_group_[1](some_top_level_are_hidden() ? $8tj43$createComponent((0, $3e850b2f2cca761f$export$ca21a16d65b3dd8), {
2726
3095
  show_extras_: show_extras,
2727
3096
  i18n_: i18n_
@@ -2742,13 +3111,13 @@ function $0ae614c5c7babb43$export$a32086fa6616eafd(_ref) {
2742
3111
  [_el$5, _co$2] = $8tj43$getNextMarker(_el$4.nextSibling);
2743
3112
  const _ref$ = form;
2744
3113
  typeof _ref$ === "function" ? $8tj43$use(_ref$, _el$) : form = _el$;
2745
- $8tj43$insert(_el$, () => $0ae614c5c7babb43$var$render_stuff($8tj43$createMemo(() => some_top_level_are_hidden() ? Object.fromEntries(Object.entries(structured_categories()).slice(0, $0ae614c5c7babb43$var$show_non_collapsible_when_collapsed)) : structured_categories()), existing_filter, i18n_), _el$3, _co$);
3114
+ $8tj43$insert(_el$, () => $0ae614c5c7babb43$var$render_stuff($8tj43$createMemo(() => some_top_level_are_hidden() ? Object.fromEntries(Object.entries(structured_categories()).slice(0, $0ae614c5c7babb43$var$show_non_collapsible_when_collapsed)) : structured_categories()), existing_filter, i18n_, filter_query_), _el$3, _co$);
2746
3115
  $8tj43$insert(_el$, expanding_container_els, _el$5, _co$2);
2747
3116
  $8tj43$effect(() => _el$.classList.toggle("any-expandable", !!Object.values(structured_categories()).some(category => Object.keys(category.children_).length)));
2748
3117
  return _el$;
2749
3118
  })();
2750
3119
  }
2751
- function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
3120
+ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_, filter_query_) {
2752
3121
  const keys = $8tj43$createMemo(() => Object.keys(data()));
2753
3122
  return $8tj43$createComponent((0, $8tj43$For), {
2754
3123
  get each() {
@@ -2766,6 +3135,14 @@ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
2766
3135
  var _value;
2767
3136
  return !!Object.keys(((_value = value()) === null || _value === void 0 ? void 0 : _value.children_) || {}).length;
2768
3137
  });
3138
+ const value_as_string = $8tj43$createMemo(() => {
3139
+ var _value2;
3140
+ return JSON.stringify((_value2 = value()) === null || _value2 === void 0 ? void 0 : _value2.value_);
3141
+ });
3142
+ const label_text = $8tj43$createMemo(() => {
3143
+ var _value3;
3144
+ return ((_value3 = value()) === null || _value3 === void 0 ? void 0 : _value3.name_) || value_as_string();
3145
+ });
2769
3146
  return (() => {
2770
3147
  const _el$6 = $8tj43$getNextElement($0ae614c5c7babb43$var$_tmpl$2),
2771
3148
  _el$7 = _el$6.firstChild,
@@ -2774,12 +3151,17 @@ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
2774
3151
  [_el$10, _co$4] = $8tj43$getNextMarker(_el$9.nextSibling);
2775
3152
  $8tj43$insert(_el$6, $8tj43$createComponent((0, $19e828709c7723a0$export$48513f6b9f8ce62d), {
2776
3153
  get value_() {
2777
- var _value2;
2778
- return JSON.stringify((_value2 = value()) === null || _value2 === void 0 ? void 0 : _value2.value_);
3154
+ return value_as_string();
2779
3155
  },
2780
3156
  get label_() {
2781
- var _value3;
2782
- return (_value3 = value()) === null || _value3 === void 0 ? void 0 : _value3.name_;
3157
+ return $8tj43$createComponent((0, $b0e2100b511ec9a4$export$8e79c28529dbfa90), {
3158
+ get text_() {
3159
+ return label_text();
3160
+ },
3161
+ get to_highlight_() {
3162
+ return filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_();
3163
+ }
3164
+ });
2783
3165
  },
2784
3166
  get count_() {
2785
3167
  var _value4;
@@ -2879,7 +3261,7 @@ function $0ae614c5c7babb43$var$render_stuff(data, existing_filter, i18n_) {
2879
3261
  return $0ae614c5c7babb43$var$render_stuff($8tj43$createMemo(() => {
2880
3262
  var _value13;
2881
3263
  return ((_value13 = value()) === null || _value13 === void 0 ? void 0 : _value13.children_) || {};
2882
- }), existing_filter, i18n_);
3264
+ }), existing_filter, i18n_, filter_query_);
2883
3265
  }
2884
3266
  });
2885
3267
  })();
@@ -2997,7 +3379,8 @@ function $0ae614c5c7babb43$var$make_expanded_signal(_ref5) {
2997
3379
  var _untrack$untrack;
2998
3380
  let {
2999
3381
  expanded_hierarchical_filters_: [read_expanded_hierarchical_filters, write_expanded_hierarchical_filters],
3000
- filter_value_: filter_value_
3382
+ filter_value_: filter_value_,
3383
+ is_being_searched_: is_being_searched_
3001
3384
  } = _ref5;
3002
3385
  const index_in_expanded_filters = $8tj43$createMemo(() => read_expanded_hierarchical_filters().findIndex(_ref6 => {
3003
3386
  let {
@@ -3040,9 +3423,11 @@ function $0ae614c5c7babb43$var$make_expanded_signal(_ref5) {
3040
3423
  defer: true
3041
3424
  }));
3042
3425
  return {
3043
- ui_should_show_expanded_: $8tj43$createMemo(() => {
3426
+ ui_should_show_expanded_: $8tj43$createMemo(
3427
+ // When user is searching through filters, expand everything they haven't collapsed, so they can see the results
3428
+ () => {
3044
3429
  var _user_choice_signal$;
3045
- return (_user_choice_signal$ = user_choice_signal[0]()) !== null && _user_choice_signal$ !== void 0 ? _user_choice_signal$ : get_low_precedence_expanded();
3430
+ return (_user_choice_signal$ = user_choice_signal[0]()) !== null && _user_choice_signal$ !== void 0 ? _user_choice_signal$ : is_being_searched_() || get_low_precedence_expanded();
3046
3431
  }),
3047
3432
  set_low_precedence_expanded_: set_low_precedence_expanded,
3048
3433
  set_user_expanded_: set_user_choice_expanded
@@ -3073,7 +3458,9 @@ const $830ea8efda59884e$var$max_columns = 3;
3073
3458
  const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
3074
3459
  let {
3075
3460
  filter_: filter_,
3076
- selected_filters_: [get_selected_filters, set_selected_filters]
3461
+ selected_filters_: [get_selected_filters, set_selected_filters],
3462
+ filter_query_: filter_query_,
3463
+ details_element_width_: details_element_width_
3077
3464
  } = _ref;
3078
3465
  const existing_filter = $8tj43$createMemo(() => {
3079
3466
  const {
@@ -3107,7 +3494,7 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
3107
3494
  const container_width_accessor = $8tj43$createMemo(() => {
3108
3495
  const element = container();
3109
3496
  if (!element) return;
3110
- return $0dc044cffe1e825b$export$9f191182275e9ef(element);
3497
+ return $fc830a7ee59416ef$export$ebdc3711f7e02ccd(element);
3111
3498
  });
3112
3499
  const [shadow_children, set_shadow_children] = $8tj43$createSignal(new Set(), {
3113
3500
  equals: false
@@ -3119,11 +3506,11 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
3119
3506
  })(); // for getting the smallest possible sizes of all the items
3120
3507
  $8tj43$createEffect(() => {
3121
3508
  var _container_width_acce;
3122
- const container_width = (_container_width_acce = container_width_accessor()) === null || _container_width_acce === void 0 ? void 0 : _container_width_acce();
3123
- if (container_width == undefined) return;
3509
+ const container_width = ((_container_width_acce = container_width_accessor()) === null || _container_width_acce === void 0 ? void 0 : _container_width_acce()) || details_element_width_();
3510
+ if (container_width === undefined) return; // On firefox, unexpanded <details> elements' contents dont't have a width, fall back to the width of the details element itself to not have janky expanding animations due to wrong number of columns at point of expanding
3124
3511
  $830ea8efda59884e$var$adjust_sizes(container_width, sizes_set(), set_cols_at_size);
3125
3512
  });
3126
- return [shadow_grid, $8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), {
3513
+ return [$8tj43$createComponent((0, $63f1f8dbcd07d3b0$export$d21e32dfedac04be), {
3127
3514
  get cols_at_size() {
3128
3515
  return cols_at_size();
3129
3516
  },
@@ -3146,66 +3533,72 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
3146
3533
  const current_value = $af5d8e0b7d97a7f6$export$325f75597868c4f0(value().value_);
3147
3534
  return !!(data !== null && data !== void 0 && data.some(item => $af5d8e0b7d97a7f6$export$325f75597868c4f0(item) === current_value));
3148
3535
  });
3149
- const MakeButton = attributes => (() => {
3150
- const _el$2 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$3),
3151
- _el$5 = _el$2.firstChild,
3152
- [_el$6, _co$] = $8tj43$getNextMarker(_el$5.nextSibling),
3153
- _el$7 = _el$6.nextSibling,
3154
- [_el$8, _co$2] = $8tj43$getNextMarker(_el$7.nextSibling);
3155
- $8tj43$spread(_el$2, $8tj43$mergeProps1(attributes, {
3156
- get disabled() {
3157
- return $8tj43$memo(() => value().count_ === 0)() && !is_selected();
3158
- },
3159
- get classList() {
3160
- return {
3161
- minor: !is_selected(),
3162
- major: is_selected(),
3163
- "major-minor-transition": true
3164
- };
3165
- },
3166
- get onClick() {
3167
- return $8tj43$catchify(() => {
3168
- const set_filter = existing_filter();
3169
- const {
3170
- field: field,
3171
- op: op
3172
- } = filter_();
3173
- const base_object = set_filter ? set_filter : {
3174
- op: op,
3175
- field: field
3176
- };
3177
- const old_data = base_object.data;
3178
- const new_data = [...(Array.isArray(old_data) ? [...old_data] : old_data ? [old_data] : [])];
3179
- const new_filter_object = {
3180
- ...base_object,
3181
- data: new_data
3536
+ const MakeButton = attributes => {
3537
+ const label = $8tj43$createMemo(() => value().name_ || value().value_ + "");
3538
+ return (() => {
3539
+ const _el$2 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$3),
3540
+ _el$5 = _el$2.firstChild,
3541
+ [_el$6, _co$] = $8tj43$getNextMarker(_el$5.nextSibling),
3542
+ _el$7 = _el$6.nextSibling,
3543
+ [_el$8, _co$2] = $8tj43$getNextMarker(_el$7.nextSibling);
3544
+ $8tj43$spread(_el$2, $8tj43$mergeProps1(attributes, {
3545
+ get disabled() {
3546
+ return $8tj43$memo(() => value().count_ === 0)() && !is_selected();
3547
+ },
3548
+ get classList() {
3549
+ return {
3550
+ minor: !is_selected(),
3551
+ major: is_selected(),
3552
+ "major-minor-transition": true
3182
3553
  };
3183
- if (!is_selected()) new_filter_object.data.push(value().value_);else {
3184
- const current_value_lower = $af5d8e0b7d97a7f6$export$325f75597868c4f0(value().value_);
3185
- new_filter_object.data = new_filter_object.data.filter(v => $af5d8e0b7d97a7f6$export$325f75597868c4f0(v) !== current_value_lower);
3186
- }
3187
- const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
3188
- set_selected_filters(selected_filters);
3189
- });
3190
- }
3191
- }), false, true);
3192
- $8tj43$insert(_el$2, () => value().value_, _el$6, _co$);
3193
- $8tj43$insert(_el$2, $8tj43$createComponent((0, $8tj43$Show), {
3194
- get when() {
3195
- return value().count_ != undefined;
3196
- },
3197
- get children() {
3198
- const _el$3 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$2),
3199
- _el$4 = _el$3.firstChild;
3200
- $8tj43$insert(_el$4, () => value().count_);
3201
- return _el$3;
3202
- }
3203
- }), _el$8, _co$2);
3204
- $8tj43$runHydrationEvents();
3205
- return _el$2;
3206
- })();
3554
+ },
3555
+ get onClick() {
3556
+ return $8tj43$catchify(() => {
3557
+ const set_filter = existing_filter();
3558
+ const {
3559
+ field: field,
3560
+ op: op
3561
+ } = filter_();
3562
+ const base_object = set_filter ? set_filter : {
3563
+ op: op,
3564
+ field: field
3565
+ };
3566
+ const old_data = base_object.data;
3567
+ const new_data = [...(Array.isArray(old_data) ? [...old_data] : old_data ? [old_data] : [])];
3568
+ const new_filter_object = {
3569
+ ...base_object,
3570
+ data: new_data
3571
+ };
3572
+ if (!is_selected()) new_filter_object.data.push(value().value_);else {
3573
+ const current_value_lower = $af5d8e0b7d97a7f6$export$325f75597868c4f0(value().value_);
3574
+ new_filter_object.data = new_filter_object.data.filter(v => $af5d8e0b7d97a7f6$export$325f75597868c4f0(v) !== current_value_lower);
3575
+ }
3576
+ const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
3577
+ set_selected_filters(selected_filters);
3578
+ });
3579
+ }
3580
+ }), false, true);
3581
+ $8tj43$insert(_el$2, $8tj43$createComponent((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
3582
+ whole_text_to_display_: label,
3583
+ searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
3584
+ }), _el$6, _co$);
3585
+ $8tj43$insert(_el$2, $8tj43$createComponent((0, $8tj43$Show), {
3586
+ get when() {
3587
+ return value().count_ != undefined;
3588
+ },
3589
+ get children() {
3590
+ const _el$3 = $8tj43$getNextElement($830ea8efda59884e$var$_tmpl$2),
3591
+ _el$4 = _el$3.firstChild;
3592
+ $8tj43$insert(_el$4, () => value().count_);
3593
+ return _el$3;
3594
+ }
3595
+ }), _el$8, _co$2);
3596
+ $8tj43$runHydrationEvents();
3597
+ return _el$2;
3598
+ })();
3599
+ };
3207
3600
  const invisible_size_button = $8tj43$createComponent(MakeButton, {});
3208
- const smallest_possible_size = $0dc044cffe1e825b$export$9f191182275e9ef(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
3601
+ const smallest_possible_size = $fc830a7ee59416ef$export$ebdc3711f7e02ccd(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
3209
3602
  const sizes_value = $8tj43$untrack(sizes_set);
3210
3603
  const shadow_children_value = $8tj43$untrack(shadow_children);
3211
3604
  sizes_value.add(smallest_possible_size);
@@ -3225,7 +3618,7 @@ const $830ea8efda59884e$export$414f6a19d38e655c = _ref => {
3225
3618
  }
3226
3619
  });
3227
3620
  }
3228
- })];
3621
+ }), shadow_grid];
3229
3622
  };
3230
3623
  /**
3231
3624
  * Calculate and apply cols_at_size overrides to fit as many items as possible in a row, evenly spaced
@@ -3293,7 +3686,8 @@ function $2cb856c297c53e6c$export$82ed4b28ecb67608(_ref) {
3293
3686
  filter_: filter_,
3294
3687
  selected_filters_: [get_selected_filters, set_selected_filters],
3295
3688
  i18n_: i18n_,
3296
- view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_]
3689
+ view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_],
3690
+ filter_query_: filter_query_
3297
3691
  } = _ref;
3298
3692
  // same as in CheckboxFilter, maybe we should make this DRY at some point
3299
3693
  const existing_filter = $8tj43$createMemo(() => {
@@ -3338,12 +3732,17 @@ function $2cb856c297c53e6c$export$82ed4b28ecb67608(_ref) {
3338
3732
  const value = $af5d8e0b7d97a7f6$export$325f75597868c4f0(checkbox().value_);
3339
3733
  return !!(data !== null && data !== void 0 && data.some(item => $af5d8e0b7d97a7f6$export$325f75597868c4f0(item) === value));
3340
3734
  });
3735
+ const value = $8tj43$createMemo(() => checkbox().value_);
3736
+ const label_text = $8tj43$createMemo(() => checkbox().name_ || value() + "");
3341
3737
  const input_row = $8tj43$createComponent((0, $19e828709c7723a0$export$48513f6b9f8ce62d), {
3342
3738
  get value_() {
3343
- return checkbox().value_;
3739
+ return value();
3344
3740
  },
3345
3741
  get label_() {
3346
- return checkbox().name_;
3742
+ return $8tj43$createComponent((0, $02b6641aa50ce528$export$ba17c5b7e6dda39f), {
3743
+ whole_text_to_display_: label_text,
3744
+ searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
3745
+ });
3347
3746
  },
3348
3747
  get count_() {
3349
3748
  return checkbox().count_;
@@ -3659,10 +4058,174 @@ function $ceafb6fb91c6f394$export$89c6019e4baa40b1(props) {
3659
4058
  }
3660
4059
  });
3661
4060
  }
4061
+ const $ef0f18a578b32578$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg xmlns=http://www.w3.org/2000/svg width=20 height=22 viewBox="0 0 20 22"><path d="M19.811 20.174l-6.234-6.809a7.96 7.96 0 0 0 .923-1.179c.274-.424.502-.865.687-1.323a8.04 8.04 0 0 0 .42-1.436 7.88 7.88 0 0 0 .144-1.507c0-.526-.051-1.042-.154-1.548-.096-.506-.243-.995-.441-1.466s-.441-.919-.728-1.343a8.28 8.28 0 0 0-.984-1.21 7.86 7.86 0 0 0-1.2-.984A7.56 7.56 0 0 0 10.89.651C10.418.453 9.929.302 9.423.2S8.401.046 7.875.046 6.833.097 6.327.2 5.332.453 4.86.651a7.56 7.56 0 0 0-1.354.718c-.431.287-.831.615-1.2.984a8.28 8.28 0 0 0-.984 1.21 7.73 7.73 0 0 0-.728 1.343c-.198.472-.349.96-.451 1.466A8.31 8.31 0 0 0 0 7.921a8.31 8.31 0 0 0 .144 1.548c.103.506.253.995.451 1.466a8.08 8.08 0 0 0 .728 1.354 7.86 7.86 0 0 0 .984 1.2 7.54 7.54 0 0 0 1.2.995c.431.287.882.53 1.354.728.472.191.96.338 1.466.441a8.31 8.31 0 0 0 1.548.144c.451 0 .896-.038 1.333-.113a7.83 7.83 0 0 0 1.282-.328 7.55 7.55 0 0 0 1.2-.533 8.08 8.08 0 0 0 1.107-.749l6.245 6.809a.45.45 0 0 0 .174.123.55.55 0 0 0 .205.041.61.61 0 0 0 .195-.031c.061-.021.116-.055.164-.102.109-.096.164-.219.164-.369.007-.144-.038-.267-.133-.369zM1.046 7.921c0-.937.178-1.818.533-2.646.362-.834.851-1.559 1.466-2.174.622-.615 1.347-1.101 2.174-1.456.827-.362 1.712-.543 2.656-.543s1.829.181 2.656.543c.827.355 1.548.841 2.164 1.456.622.615 1.111 1.34 1.466 2.174a6.52 6.52 0 0 1 .543 2.646c0 .943-.181 1.829-.543 2.656a6.89 6.89 0 0 1-1.466 2.174c-.615.615-1.336 1.104-2.164 1.466-.827.356-1.712.533-2.656.533s-1.829-.178-2.656-.533c-.827-.362-1.552-.851-2.174-1.466-.615-.622-1.104-1.347-1.466-2.174-.355-.827-.533-1.712-.533-2.656z">`);
4062
+ function $ef0f18a578b32578$export$82eafebb825fc23f() {
4063
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4064
+ return (() => {
4065
+ const _el$ = $8tj43$getNextElement($ef0f18a578b32578$var$_tmpl$);
4066
+ $8tj43$spread(_el$, props, true, true);
4067
+ $8tj43$runHydrationEvents();
4068
+ return _el$;
4069
+ })();
4070
+ }
4071
+ const $e354b2f9ce33cb75$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=search-in-filters><input type=text class=query><!$><!/><button class=clear>`);
4072
+ const $e354b2f9ce33cb75$var$min_items_to_enable_filter_searching = 10; // For checkbox hierarchical we 2x this
4073
+ function $e354b2f9ce33cb75$export$4b2c5292ffe0c5dd(filter_array_, section, i18n_) {
4074
+ const [filter_query_, set_filter_query_] = $8tj43$createSignal();
4075
+ // Check if we have enough items to enable searching
4076
+ const enable_searchability = $8tj43$createMemo(() => {
4077
+ let count = 0;
4078
+ for (const filter of filter_array_()) {
4079
+ var _filter$meta;
4080
+ const type = (_filter$meta = filter.meta) === null || _filter$meta === void 0 ? void 0 : _filter$meta.type;
4081
+ if (type === "range") continue;
4082
+ const length = filter.meta.values.length;
4083
+ count += type === "checkbox-color" ? length / 2 : type === "checkbox-grid" ? length / 3 : length; // For checkbox-color we have two columns, checkbox-grid three, so we can show search later
4084
+ }
4085
+
4086
+ return count >= $e354b2f9ce33cb75$var$min_items_to_enable_filter_searching;
4087
+ });
4088
+ const SearchThisFilterGroup_ = () => {
4089
+ return $8tj43$createComponent((0, $8tj43$Show), {
4090
+ get when() {
4091
+ return enable_searchability();
4092
+ },
4093
+ get children() {
4094
+ const _el$ = $8tj43$getNextElement($e354b2f9ce33cb75$var$_tmpl$),
4095
+ _el$2 = _el$.firstChild,
4096
+ _el$4 = _el$2.nextSibling,
4097
+ [_el$5, _co$] = $8tj43$getNextMarker(_el$4.nextSibling),
4098
+ _el$3 = _el$5.nextSibling;
4099
+ _el$2.$$input = ev => set_filter_query_(ev.currentTarget.value);
4100
+ $8tj43$insert(_el$, $8tj43$createComponent((0, $ef0f18a578b32578$export$82eafebb825fc23f), {
4101
+ width: "16",
4102
+ height: "17.6",
4103
+ "class": "search-icon"
4104
+ }), _el$5, _co$);
4105
+ _el$3.$$click = () => set_filter_query_();
4106
+ $8tj43$insert(_el$3, $8tj43$createComponent((0, $9783d437ad61594c$export$3b621d86b1566b2), {
4107
+ width: "12",
4108
+ height: "12"
4109
+ }));
4110
+ $8tj43$effect(_p$ => {
4111
+ const _v$ = i18n_.search_a_filter_()(section),
4112
+ _v$2 = filter_query_() ? "" : "none";
4113
+ _v$ !== _p$._v$ && $8tj43$setAttribute(_el$2, "placeholder", _p$._v$ = _v$);
4114
+ _v$2 !== _p$._v$2 && ((_p$._v$2 = _v$2) != null ? _el$3.style.setProperty("display", _v$2) : _el$3.style.removeProperty("display"));
4115
+ return _p$;
4116
+ }, {
4117
+ _v$: undefined,
4118
+ _v$2: undefined
4119
+ });
4120
+ $8tj43$effect(() => $8tj43$setProperty(_el$2, "value", filter_query_() || ""));
4121
+ $8tj43$runHydrationEvents();
4122
+ return _el$;
4123
+ }
4124
+ });
4125
+ };
4126
+ const searched_filter_array_ = $8tj43$createMemo(() => {
4127
+ const query = filter_query_();
4128
+ if (!enable_searchability() || !query) return filter_array_();
4129
+ const lowercase_query = query.toLowerCase();
4130
+ const check_string_match = to_check => {
4131
+ to_check = to_check.toLowerCase();
4132
+ return to_check.includes(lowercase_query) || lowercase_query.includes(to_check);
4133
+ };
4134
+ return filter_array_().map(filter => {
4135
+ var _filter$meta2, _meta$names;
4136
+ const type = (_filter$meta2 = filter.meta) === null || _filter$meta2 === void 0 ? void 0 : _filter$meta2.type;
4137
+ if (type === "range") return filter; // can't search in range filters and for checkbox-hierarchical we do the searching in the filter component since we have access to a hierarchical structure there
4138
+ const meta = filter.meta;
4139
+ const {
4140
+ values: values,
4141
+ names: names,
4142
+ counts: counts
4143
+ } = meta;
4144
+ if (!Array.isArray(values)) return filter; // Might have to adjust this in the future, but I think these super simple filters won't need search
4145
+ const is_hierarchical_checkbox = type === "checkbox-hierarchical";
4146
+ // Which index of counts, values and names should be kept
4147
+ const filtered_indexes = values.map((item, index) => {
4148
+ const item_from_names = names === null || names === void 0 ? void 0 : names[index];
4149
+ if (item_from_names && !is_hierarchical_checkbox)
4150
+ // We should use names if they exist, but sometimes backend doesn't provide any at all, and sometimes they are undefined, presumably from create_modified_filters
4151
+ item = item_from_names;
4152
+ if (typeof item === "number") return true;
4153
+ if (is_hierarchical_checkbox && names)
4154
+ // Special case for hierarchical checkboxes where we need to check if any of the names in the path match the query
4155
+ item = item.map((_, index) => names[$e354b2f9ce33cb75$var$find_str_arr_in_str_arr_arr("findIndex", values, item.slice(0, index + 1))]);
4156
+ if (Array.isArray(item)) return item.some(item => check_string_match(item + "")); // If any of the items in the array match, keep it
4157
+ return check_string_match(item);
4158
+ });
4159
+ const new_values = values.filter((_, i) => filtered_indexes[i]);
4160
+ if (!new_values.length) return false; // false = please delete this filter, see below
4161
+ const new_filter_object = {
4162
+ ...filter,
4163
+ meta: {
4164
+ ...meta,
4165
+ counts: counts === null || counts === void 0 ? void 0 : counts.filter((_, i) => filtered_indexes[i]),
4166
+ ...(names ? {
4167
+ names: (_meta$names = meta.names) === null || _meta$names === void 0 ? void 0 : _meta$names.filter((_, i) => filtered_indexes[i])
4168
+ } : {}),
4169
+ values: new_values
4170
+ }
4171
+ };
4172
+ if (is_hierarchical_checkbox) {
4173
+ // For hierarchical checkbox we need to fill the holes created by filtering, for example if there is
4174
+ // ["Clothes"]
4175
+ // ["Clothes", "Blazers"]
4176
+ // And the user searched for "blazers" we need to add back ["Clothes"] so CheckboxHierarchicalFilter doesn't get confused
4177
+ // I explored doing the filtering there instead, but it's very hard to do it early enough before the expansion/collapsedness is calculated and check-logic is set up in relation to other items
4178
+ // So we do it here instead
4179
+ const new_meta = new_filter_object.meta;
4180
+ const new_values = new_meta.values;
4181
+ for (const value of new_values) {
4182
+ if (!Array.isArray(value)) continue; // Shouldn't happen
4183
+ if (value.length < 2) continue; // No parent
4184
+ const parent = value.slice(0, -1);
4185
+ // Check if parent exists
4186
+ if ($e354b2f9ce33cb75$var$find_str_arr_in_str_arr_arr("some", new_values, parent)) continue; // Parent exists
4187
+ // Otherwise, put it back
4188
+ const index_to_restore = $e354b2f9ce33cb75$var$find_str_arr_in_str_arr_arr("findIndex", values, parent);
4189
+ if (index_to_restore < 0) {
4190
+ $8tj43$dwarn("Can't restore", parent, "to", new_values);
4191
+ continue;
4192
+ }
4193
+ const current_index_of_us = new_values.findIndex(item => item === value);
4194
+ new_values.splice(current_index_of_us, 0, values[index_to_restore]);
4195
+ const count_to_restore = counts === null || counts === void 0 ? void 0 : counts[index_to_restore];
4196
+ if (count_to_restore) {
4197
+ var _new_meta$counts;
4198
+ (_new_meta$counts = new_meta.counts) === null || _new_meta$counts === void 0 || _new_meta$counts.splice(current_index_of_us, 0, count_to_restore);
4199
+ }
4200
+ const name_to_restore = names === null || names === void 0 ? void 0 : names[index_to_restore];
4201
+ if (name_to_restore) {
4202
+ var _new_meta$names;
4203
+ (_new_meta$names = new_meta.names) === null || _new_meta$names === void 0 || _new_meta$names.splice(current_index_of_us, 0, name_to_restore);
4204
+ }
4205
+ }
4206
+ }
4207
+ return new_filter_object;
4208
+ }).filter(filter => filter); // Delete filters that don't have a value anymore
4209
+ });
4210
+
4211
+ return {
4212
+ SearchThisFilterGroup_: SearchThisFilterGroup_,
4213
+ searched_filter_array_: searched_filter_array_,
4214
+ filter_query_: filter_query_
4215
+ };
4216
+ }
4217
+ /**
4218
+ * Finds/whatevers what's effectively one hierarchical filter item in an array of hierarchical filter items
4219
+ * Functions similar to this happen loads in create_modified_filters, but they have additional checks so not touching them RN
4220
+ */
4221
+ function $e354b2f9ce33cb75$var$find_str_arr_in_str_arr_arr(operation, haystack, needle) {
4222
+ return haystack[operation](value => value.length === needle.length && value.every((item, index) => item === needle[index]));
4223
+ }
4224
+ $8tj43$delegateEvents(["input", "click"]);
3662
4225
  const $f6b0500577e1b210$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<div class=filter-collapsible>`),
3663
4226
  $f6b0500577e1b210$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<button class=clear-group><!$><!/><span>`),
3664
4227
  $f6b0500577e1b210$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div class=view-more-clear><!$><!/><!$><!/>`),
3665
- $f6b0500577e1b210$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<div class=filter-collapsible-body><div class=filter-part></div><!$><!/>`),
4228
+ $f6b0500577e1b210$var$_tmpl$4 = /*#__PURE__*/$8tj43$template(`<div class=filter-collapsible-body><div class=filter-part><!$><!/><!$><!/></div><!$><!/>`),
3666
4229
  $f6b0500577e1b210$var$_tmpl$5 = /*#__PURE__*/$8tj43$template(`<details class=filter-collapsible>`),
3667
4230
  $f6b0500577e1b210$var$_tmpl$6 = /*#__PURE__*/$8tj43$template(`<summary class=filter-group-summary><div class=summary><span></span><div class=selected-w-sign><!$><!/><!$><!/>`),
3668
4231
  $f6b0500577e1b210$var$_tmpl$7 = /*#__PURE__*/$8tj43$template(`<div class=ungrouped>`),
@@ -3723,6 +4286,11 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3723
4286
  const filter_array_ = $8tj43$createMemo(() => {
3724
4287
  return Object.values(togglable_filters_grouped_by_collapsible())[get_section_index()];
3725
4288
  });
4289
+ const {
4290
+ SearchThisFilterGroup_: SearchThisFilterGroup_,
4291
+ searched_filter_array_: searched_filter_array_,
4292
+ filter_query_: filter_query_
4293
+ } = $e354b2f9ce33cb75$export$4b2c5292ffe0c5dd(filter_array_, section_, props.i18n_);
3726
4294
  const is_open = $f1e63746f76ce012$export$ab34afce88557c0e({
3727
4295
  get expanded_filters_() {
3728
4296
  return props.expanded_filters_;
@@ -3738,27 +4306,33 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3738
4306
  return selected_filter;
3739
4307
  })));
3740
4308
  const a_filter_is_selected = $8tj43$createMemo(() => selected_filters_in_group().size);
4309
+ const [get_details_width, set_get_details_width] = $8tj43$createSignal();
4310
+ const details_element_width_ = $8tj43$createMemo(() => {
4311
+ var _get_details_width;
4312
+ return get_details_width === null || get_details_width === void 0 ? void 0 : (_get_details_width = get_details_width()) === null || _get_details_width === void 0 ? void 0 : _get_details_width();
4313
+ });
3741
4314
  return $8tj43$createComponent((0, $ad371564683947ab$export$6c6d7a51fa9aa15d), {
3742
4315
  is_open_: is_open,
3743
4316
  get details_() {
3744
4317
  return (() => {
3745
- const _el$15 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$5);
3746
- $8tj43$setAttribute(_el$15, "data-group-title", section_);
3747
- return _el$15;
4318
+ const _el$19 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$5);
4319
+ $8tj43$use(element => set_get_details_width(() => $fc830a7ee59416ef$export$ebdc3711f7e02ccd(element)), _el$19);
4320
+ $8tj43$setAttribute(_el$19, "data-group-title", section_);
4321
+ return _el$19;
3748
4322
  })();
3749
4323
  },
3750
4324
  get summary_() {
3751
4325
  return (() => {
3752
- const _el$16 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$6),
3753
- _el$17 = _el$16.firstChild,
3754
- _el$18 = _el$17.firstChild,
3755
- _el$19 = _el$18.nextSibling,
3756
- _el$20 = _el$19.firstChild,
3757
- [_el$21, _co$5] = $8tj43$getNextMarker(_el$20.nextSibling),
3758
- _el$22 = _el$21.nextSibling,
3759
- [_el$23, _co$6] = $8tj43$getNextMarker(_el$22.nextSibling);
3760
- $8tj43$insert(_el$18, section_);
3761
- $8tj43$insert(_el$19, $8tj43$createComponent((0, $8tj43$Show), {
4326
+ const _el$20 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$6),
4327
+ _el$21 = _el$20.firstChild,
4328
+ _el$22 = _el$21.firstChild,
4329
+ _el$23 = _el$22.nextSibling,
4330
+ _el$24 = _el$23.firstChild,
4331
+ [_el$25, _co$7] = $8tj43$getNextMarker(_el$24.nextSibling),
4332
+ _el$26 = _el$25.nextSibling,
4333
+ [_el$27, _co$8] = $8tj43$getNextMarker(_el$26.nextSibling);
4334
+ $8tj43$insert(_el$22, section_);
4335
+ $8tj43$insert(_el$23, $8tj43$createComponent((0, $8tj43$Show), {
3762
4336
  get when() {
3763
4337
  return a_filter_is_selected();
3764
4338
  },
@@ -3770,26 +4344,31 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3770
4344
  }
3771
4345
  });
3772
4346
  }
3773
- }), _el$21, _co$5);
3774
- $8tj43$insert(_el$19, $8tj43$createComponent((0, $457279ff15864cb9$export$e5c2828934226505), {
4347
+ }), _el$25, _co$7);
4348
+ $8tj43$insert(_el$23, $8tj43$createComponent((0, $457279ff15864cb9$export$e5c2828934226505), {
3775
4349
  get expanded_() {
3776
4350
  return is_open[0];
3777
4351
  },
3778
4352
  get i18n_() {
3779
4353
  return props.i18n_;
3780
4354
  }
3781
- }), _el$23, _co$6);
3782
- return _el$16;
4355
+ }), _el$27, _co$8);
4356
+ return _el$20;
3783
4357
  })();
3784
4358
  },
3785
4359
  get children() {
3786
4360
  const _el$2 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$4),
3787
4361
  _el$3 = _el$2.firstChild,
3788
- _el$13 = _el$3.nextSibling,
3789
- [_el$14, _co$4] = $8tj43$getNextMarker(_el$13.nextSibling);
4362
+ _el$4 = _el$3.firstChild,
4363
+ [_el$5, _co$] = $8tj43$getNextMarker(_el$4.nextSibling),
4364
+ _el$6 = _el$5.nextSibling,
4365
+ [_el$7, _co$2] = $8tj43$getNextMarker(_el$6.nextSibling),
4366
+ _el$17 = _el$3.nextSibling,
4367
+ [_el$18, _co$6] = $8tj43$getNextMarker(_el$17.nextSibling);
4368
+ $8tj43$insert(_el$3, $8tj43$createComponent(SearchThisFilterGroup_, {}), _el$5, _co$);
3790
4369
  $8tj43$insert(_el$3, $8tj43$createComponent((0, $8tj43$Index), {
3791
4370
  get each() {
3792
- return filter_array_();
4371
+ return searched_filter_array_();
3793
4372
  },
3794
4373
  children: filter => $8tj43$createComponent((0, $74777e8fe65b3dcb$export$b69d0d92862de18b), {
3795
4374
  severity_: "error",
@@ -3812,11 +4391,13 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3812
4391
  get i18n_() {
3813
4392
  return props.i18n_;
3814
4393
  },
3815
- view_more_button_below_group_: view_more_button_below_group
4394
+ view_more_button_below_group_: view_more_button_below_group,
4395
+ filter_query_: filter_query_,
4396
+ details_element_width_: details_element_width_
3816
4397
  });
3817
4398
  }
3818
4399
  })
3819
- }));
4400
+ }), _el$7, _co$2);
3820
4401
  $8tj43$insert(_el$2, $8tj43$createComponent((0, $8tj43$Show), {
3821
4402
  get when() {
3822
4403
  return $8tj43$createMemo(() => {
@@ -3825,22 +4406,22 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3825
4406
  })();
3826
4407
  },
3827
4408
  get children() {
3828
- const _el$4 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$3),
3829
- _el$9 = _el$4.firstChild,
3830
- [_el$10, _co$2] = $8tj43$getNextMarker(_el$9.nextSibling),
3831
- _el$11 = _el$10.nextSibling,
3832
- [_el$12, _co$3] = $8tj43$getNextMarker(_el$11.nextSibling);
3833
- $8tj43$insert(_el$4, () => view_more_button_below_group[0](), _el$10, _co$2);
3834
- $8tj43$insert(_el$4, $8tj43$createComponent((0, $8tj43$Show), {
4409
+ const _el$8 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$3),
4410
+ _el$13 = _el$8.firstChild,
4411
+ [_el$14, _co$4] = $8tj43$getNextMarker(_el$13.nextSibling),
4412
+ _el$15 = _el$14.nextSibling,
4413
+ [_el$16, _co$5] = $8tj43$getNextMarker(_el$15.nextSibling);
4414
+ $8tj43$insert(_el$8, () => view_more_button_below_group[0](), _el$14, _co$4);
4415
+ $8tj43$insert(_el$8, $8tj43$createComponent((0, $8tj43$Show), {
3835
4416
  get when() {
3836
4417
  return a_filter_is_selected();
3837
4418
  },
3838
4419
  get children() {
3839
- const _el$5 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$2),
3840
- _el$7 = _el$5.firstChild,
3841
- [_el$8, _co$] = $8tj43$getNextMarker(_el$7.nextSibling),
3842
- _el$6 = _el$8.nextSibling;
3843
- $8tj43$addEventListener(_el$5, "click", $8tj43$catchify(() => {
4420
+ const _el$9 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$2),
4421
+ _el$11 = _el$9.firstChild,
4422
+ [_el$12, _co$3] = $8tj43$getNextMarker(_el$11.nextSibling),
4423
+ _el$10 = _el$12.nextSibling;
4424
+ $8tj43$addEventListener(_el$9, "click", $8tj43$catchify(() => {
3844
4425
  const new_filter_obj = [...props.selected_filters_[0]()];
3845
4426
  for (const filter of filter_array_()) {
3846
4427
  const index = new_filter_obj.findIndex(_ref2 => {
@@ -3854,15 +4435,15 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3854
4435
  }
3855
4436
  props.selected_filters_[1](new_filter_obj);
3856
4437
  }), true);
3857
- $8tj43$insert(_el$5, $8tj43$createComponent((0, $9783d437ad61594c$export$3b621d86b1566b2), {}), _el$8, _co$);
3858
- $8tj43$insert(_el$6, () => props.i18n_.clear_individual_filter_());
4438
+ $8tj43$insert(_el$9, $8tj43$createComponent((0, $9783d437ad61594c$export$3b621d86b1566b2), {}), _el$12, _co$3);
4439
+ $8tj43$insert(_el$10, () => props.i18n_.clear_individual_filter_());
3859
4440
  $8tj43$runHydrationEvents();
3860
- return _el$5;
4441
+ return _el$9;
3861
4442
  }
3862
- }), _el$12, _co$3);
3863
- return _el$4;
4443
+ }), _el$16, _co$5);
4444
+ return _el$8;
3864
4445
  }
3865
- }), _el$14, _co$4);
4446
+ }), _el$18, _co$6);
3866
4447
  return _el$2;
3867
4448
  }
3868
4449
  });
@@ -3876,8 +4457,8 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3876
4457
  return (_untogglable_filters = untogglable_filters()) === null || _untogglable_filters === void 0 ? void 0 : _untogglable_filters.length;
3877
4458
  },
3878
4459
  get children() {
3879
- const _el$24 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$7);
3880
- $8tj43$insert(_el$24, $8tj43$createComponent((0, $8tj43$Index), {
4460
+ const _el$28 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$7);
4461
+ $8tj43$insert(_el$28, $8tj43$createComponent((0, $8tj43$Index), {
3881
4462
  get each() {
3882
4463
  return untogglable_filters();
3883
4464
  },
@@ -3903,7 +4484,7 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3903
4484
  }), $8tj43$memo(get_view_more_button_below_group)];
3904
4485
  }
3905
4486
  }));
3906
- return _el$24;
4487
+ return _el$28;
3907
4488
  }
3908
4489
  }), $8tj43$createComponent((0, $8tj43$Show), {
3909
4490
  get when() {
@@ -3911,8 +4492,8 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3911
4492
  return $8tj43$memo(() => !!!props.are_in_modal_ /* modal has its own clear button */)() && ((_props$selected_filte = props.selected_filters_[0]()) === null || _props$selected_filte === void 0 ? void 0 : _props$selected_filte.length);
3912
4493
  },
3913
4494
  get children() {
3914
- const _el$25 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$8);
3915
- $8tj43$addEventListener(_el$25, "click", $8tj43$catchify(() => $b4465d8d605f61e9$export$8895d39404bd2bb1({
4495
+ const _el$29 = $8tj43$getNextElement($f6b0500577e1b210$var$_tmpl$8);
4496
+ $8tj43$addEventListener(_el$29, "click", $8tj43$catchify(() => $b4465d8d605f61e9$export$8895d39404bd2bb1({
3916
4497
  user_triggered_: true,
3917
4498
  selected_filters_: props.selected_filters_,
3918
4499
  i18n_: props.i18n_,
@@ -3920,9 +4501,9 @@ function $f6b0500577e1b210$var$ActualFilterBody(props) {
3920
4501
  expanded_hierarchical_filters_: props.expanded_hierarchical_filters_,
3921
4502
  local_filter_cache_: props.local_filter_cache_
3922
4503
  })), true);
3923
- $8tj43$insert(_el$25, () => props.i18n_.clear_all_filters_from_big_button_());
4504
+ $8tj43$insert(_el$29, () => props.i18n_.clear_all_filters_from_big_button_());
3924
4505
  $8tj43$runHydrationEvents();
3925
- return _el$25;
4506
+ return _el$29;
3926
4507
  }
3927
4508
  })];
3928
4509
  }
@@ -8557,20 +9138,6 @@ const $ecc323d9c29305ee$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg xmlns=ht
8557
9138
  function $ecc323d9c29305ee$export$1c641004b5485fed() {
8558
9139
  return $8tj43$getNextElement($ecc323d9c29305ee$var$_tmpl$);
8559
9140
  }
8560
- const $ef0f18a578b32578$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg><path d="M19.811 20.174l-6.234-6.809a7.96 7.96 0 0 0 .923-1.179c.274-.424.502-.865.687-1.323a8.04 8.04 0 0 0 .42-1.436 7.88 7.88 0 0 0 .144-1.507c0-.526-.051-1.042-.154-1.548-.096-.506-.243-.995-.441-1.466s-.441-.919-.728-1.343a8.28 8.28 0 0 0-.984-1.21 7.86 7.86 0 0 0-1.2-.984A7.56 7.56 0 0 0 10.89.651C10.418.453 9.929.302 9.423.2S8.401.046 7.875.046 6.833.097 6.327.2 5.332.453 4.86.651a7.56 7.56 0 0 0-1.354.718c-.431.287-.831.615-1.2.984a8.28 8.28 0 0 0-.984 1.21 7.73 7.73 0 0 0-.728 1.343c-.198.472-.349.96-.451 1.466A8.31 8.31 0 0 0 0 7.921a8.31 8.31 0 0 0 .144 1.548c.103.506.253.995.451 1.466a8.08 8.08 0 0 0 .728 1.354 7.86 7.86 0 0 0 .984 1.2 7.54 7.54 0 0 0 1.2.995c.431.287.882.53 1.354.728.472.191.96.338 1.466.441a8.31 8.31 0 0 0 1.548.144c.451 0 .896-.038 1.333-.113a7.83 7.83 0 0 0 1.282-.328 7.55 7.55 0 0 0 1.2-.533 8.08 8.08 0 0 0 1.107-.749l6.245 6.809a.45.45 0 0 0 .174.123.55.55 0 0 0 .205.041.61.61 0 0 0 .195-.031c.061-.021.116-.055.164-.102.109-.096.164-.219.164-.369.007-.144-.038-.267-.133-.369zM1.046 7.921c0-.937.178-1.818.533-2.646.362-.834.851-1.559 1.466-2.174.622-.615 1.347-1.101 2.174-1.456.827-.362 1.712-.543 2.656-.543s1.829.181 2.656.543c.827.355 1.548.841 2.164 1.456.622.615 1.111 1.34 1.466 2.174a6.52 6.52 0 0 1 .543 2.646c0 .943-.181 1.829-.543 2.656a6.89 6.89 0 0 1-1.466 2.174c-.615.615-1.336 1.104-2.164 1.466-.827.356-1.712.533-2.656.533s-1.829-.178-2.656-.533c-.827-.362-1.552-.851-2.174-1.466-.615-.622-1.104-1.347-1.466-2.174-.355-.827-.533-1.712-.533-2.656z">`);
8561
- function $ef0f18a578b32578$export$82eafebb825fc23f() {
8562
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8563
- return (() => {
8564
- const _el$ = $8tj43$getNextElement($ef0f18a578b32578$var$_tmpl$);
8565
- $8tj43$spread(_el$, $8tj43$mergeProps1(props, {
8566
- "xmlns": "http://www.w3.org/2000/svg",
8567
- "width": "20",
8568
- "height": "22"
8569
- }), true, true);
8570
- $8tj43$runHydrationEvents();
8571
- return _el$;
8572
- })();
8573
- }
8574
9141
  const $584c06c09cf4609d$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<button class=back type=button>`),
8575
9142
  $584c06c09cf4609d$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div class=search-field><!$><!/><div class=field><input class=query tabindex=0><button type=button class=clear></button></div><button class="submit major"type=button>`);
8576
9143
  function $584c06c09cf4609d$export$b94867ecbd698f21(_ref) {
@@ -9344,91 +9911,18 @@ function $494c9ad553139dbc$export$a146ac6fa8346a25(_ref) {
9344
9911
  _v$4 !== _p$._v$4 && $8tj43$setAttribute(_el$9, "title", _p$._v$4 = _v$4);
9345
9912
  return _p$;
9346
9913
  }, {
9347
- _v$: undefined,
9348
- _v$2: undefined,
9349
- _v$3: undefined,
9350
- _v$4: undefined
9351
- });
9352
- return _el$4;
9353
- })();
9354
- }
9355
- }));
9356
- return _el$;
9357
- }
9358
- });
9359
- }
9360
- const $02b6641aa50ce528$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<span class=highlighted-part>`),
9361
- $02b6641aa50ce528$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<span>`);
9362
- function $02b6641aa50ce528$export$ba17c5b7e6dda39f(_ref) {
9363
- let {
9364
- whole_text_to_display_: whole_text_to_display_memo,
9365
- searching_for_value_: searching_for_value_memo,
9366
- class_: class_
9367
- } = _ref;
9368
- const [get_has_highlighted, set_has_highlighted] = $8tj43$createSignal(false);
9369
- const text_itself = $8tj43$createMemo(() => $8tj43$batch(() => {
9370
- set_has_highlighted(false);
9371
- const searching_for_value = searching_for_value_memo();
9372
- const whole_text_to_display_ = whole_text_to_display_memo();
9373
- let for_black = "";
9374
- let pushed_grey = false;
9375
- const search_q = searching_for_value;
9376
- if (!search_q) return whole_text_to_display_;
9377
- const output = [];
9378
- const searching_for = search_q.toLowerCase();
9379
- const push_black = () => {
9380
- if (for_black) {
9381
- set_has_highlighted(true);
9382
- output.push((() => {
9383
- const _el$ = $8tj43$getNextElement($02b6641aa50ce528$var$_tmpl$);
9384
- $8tj43$insert(_el$, for_black);
9385
- return _el$;
9386
- })()); // "black"
9387
- for_black = "";
9388
- }
9389
- };
9390
- for (let i = 0; i < whole_text_to_display_.length;) {
9391
- let is_whole_word = true;
9392
- let searching_for_but_with_texts_casing = "";
9393
- const i_at_start = i;
9394
- for (let j = 0; j < searching_for.length; i++, j++) {
9395
- const letter_in_suggestion = whole_text_to_display_[i];
9396
- if ((letter_in_suggestion === null || letter_in_suggestion === void 0 ? void 0 : letter_in_suggestion.toLowerCase()) !== searching_for[j]) {
9397
- is_whole_word = false;
9398
- i = i_at_start;
9399
- break;
9400
- }
9401
- searching_for_but_with_texts_casing += letter_in_suggestion;
9402
- }
9403
- if (is_whole_word) {
9404
- push_black();
9405
- output.push(searching_for_but_with_texts_casing);
9406
- pushed_grey = true;
9407
- } else for_black += whole_text_to_display_[i++];
9408
- }
9409
- push_black();
9410
- if (!pushed_grey) {
9411
- set_has_highlighted(false);
9412
- return whole_text_to_display_;
9914
+ _v$: undefined,
9915
+ _v$2: undefined,
9916
+ _v$3: undefined,
9917
+ _v$4: undefined
9918
+ });
9919
+ return _el$4;
9920
+ })();
9921
+ }
9922
+ }));
9923
+ return _el$;
9413
9924
  }
9414
- return output;
9415
- }));
9416
- return (() => {
9417
- const _el$2 = $8tj43$getNextElement($02b6641aa50ce528$var$_tmpl$2);
9418
- $8tj43$className(_el$2, class_);
9419
- $8tj43$insert(_el$2, text_itself);
9420
- $8tj43$effect(_p$ => {
9421
- const _v$ = !!get_has_highlighted(),
9422
- _v$2 = whole_text_to_display_memo() /* for when line-clamped, users can see full text on hover */;
9423
- _v$ !== _p$._v$ && _el$2.classList.toggle("has-history-match", _p$._v$ = _v$);
9424
- _v$2 !== _p$._v$2 && $8tj43$setAttribute(_el$2, "title", _p$._v$2 = _v$2);
9425
- return _p$;
9426
- }, {
9427
- _v$: undefined,
9428
- _v$2: undefined
9429
- });
9430
- return _el$2;
9431
- })();
9925
+ });
9432
9926
  }
9433
9927
  const $3c5e15c6ee4227a9$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<svg xmlns=http://www.w3.org/2000/svg width=32 height=32 viewBox="0 0 256 256"><path d="M56 26.455a13.71 13.71 0 0 0-9.578 3.967A13.71 13.71 0 0 0 42.455 40v176a13.71 13.71 0 0 0 3.967 9.578A13.71 13.71 0 0 0 56 229.545h144A13.71 13.71 0 0 0 213.545 216V88a2.456 2.456 0 0 1 0-.002c.001-1.452-.597-2.895-1.623-3.922l-55.998-55.998a5.61 5.61 0 0 0-3.922-1.623 2.456 2.456 0 0 1-.002 0zm0 11.09h88A2.456 2.456 0 0 1 146.455 40v48c0 2.903 2.642 5.545 5.545 5.545h48A2.456 2.456 0 0 1 202.455 96v120a2.456 2.456 0 0 1-2.455 2.455H56A2.456 2.456 0 0 1 53.545 216V40A2.456 2.456 0 0 1 56 37.545zm103.061 11.498a2.456 2.456 0 0 1 2.676.531l28.689 28.689a2.456 2.456 0 0 1-1.736 4.191H160A2.456 2.456 0 0 1 157.545 80V51.311a2.456 2.456 0 0 1 1.516-2.268zM96 130.455c-2.903 0-5.545 2.642-5.545 5.545s2.642 5.545 5.545 5.545h64c2.903 0 5.545-2.642 5.545-5.545s-2.642-5.545-5.545-5.545zm0 32c-2.903 0-5.545 2.642-5.545 5.545s2.642 5.545 5.545 5.545h64c2.903 0 5.545-2.642 5.545-5.545s-2.642-5.545-5.545-5.545z">`);
9434
9928
  function $3c5e15c6ee4227a9$export$605674723bcc715c() {
@@ -9472,8 +9966,8 @@ function $40dd3f46f55d62ba$export$e872e2339fb04a7f(_ref) {
9472
9966
  } = _ref2;
9473
9967
  return type === (0, $7cd4d275a9f8d600$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title);
9474
9968
  } // don't show the ones we already show from the history
9475
- ));
9476
-
9969
+ ) // + limit to three query suggestions, API sends more sometimes
9970
+ .slice(0, 3));
9477
9971
  const not_queries_memo = $8tj43$createMemo(() => {
9478
9972
  // For the section that shows categories and content results
9479
9973
  // We want to limit to 3 items, and we want to show the categories first
@@ -10500,238 +10994,6 @@ function $8e8ce3f7a5eb11a6$export$41b4894022a3580f() {
10500
10994
  })));
10501
10995
  return style_props_;
10502
10996
  }
10503
- const $f3a159279dc1a8fb$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<span class=highlighted-part>`);
10504
- const $f3a159279dc1a8fb$var$dont_cut_in_between_less_than_characters = 30;
10505
- function $f3a159279dc1a8fb$export$e1a98a189fd2c0e7(_ref) {
10506
- let {
10507
- content_result_: content_result_,
10508
- key_: key_,
10509
- cut_when_possible_: cut_when_possible_
10510
- } = _ref;
10511
- const matched_tokens = $8tj43$createMemo(() => {
10512
- var _content_result_$high, _content_result_$high2;
10513
- 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;
10514
- });
10515
- const full_value = $8tj43$createMemo(() => {
10516
- var _content_result_$key_;
10517
- return (_content_result_$key_ = content_result_()[key_]) === null || _content_result_$key_ === void 0 ? void 0 : _content_result_$key_.replaceAll("\n", " ");
10518
- });
10519
- return $8tj43$createComponent((0, $8tj43$Show), {
10520
- get when() {
10521
- var _matched_tokens;
10522
- return (_matched_tokens = matched_tokens()) === null || _matched_tokens === void 0 ? void 0 : _matched_tokens.length;
10523
- },
10524
- get fallback() {
10525
- return full_value();
10526
- },
10527
- get children() {
10528
- return (() => {
10529
- const segmented_cut_text = $8tj43$createMemo(() => {
10530
- const segmented_text = $f3a159279dc1a8fb$var$segment_text(full_value(), matched_tokens());
10531
- if (cut_when_possible_) $f3a159279dc1a8fb$var$cut_text(segmented_text);
10532
- return segmented_text;
10533
- });
10534
- return $8tj43$createComponent((0, $8tj43$Index), {
10535
- get each() {
10536
- return segmented_cut_text();
10537
- },
10538
- children: item => {
10539
- return $8tj43$createComponent((0, $8tj43$Show), {
10540
- get when() {
10541
- return item().highlighted_;
10542
- },
10543
- get fallback() {
10544
- return item().text_;
10545
- },
10546
- get children() {
10547
- const _el$ = $8tj43$getNextElement($f3a159279dc1a8fb$var$_tmpl$);
10548
- $8tj43$insert(_el$, () => item().text_);
10549
- return _el$;
10550
- }
10551
- });
10552
- }
10553
- });
10554
- })();
10555
- }
10556
- });
10557
- }
10558
- function $f3a159279dc1a8fb$var$cut_text(segmented_text) {
10559
- // cut away chunks of text that are not highlighted to give a google-like overview of the content
10560
- const highlighted_segments = segmented_text === null || segmented_text === void 0 ? void 0 : segmented_text.filter(segment => segment.highlighted_);
10561
- if (!segmented_text || !(highlighted_segments !== null && highlighted_segments !== void 0 && highlighted_segments.length)) return;
10562
- // We have one or more highlighted segments
10563
- if (highlighted_segments.length === 1) {
10564
- // cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
10565
- $f3a159279dc1a8fb$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
10566
- return;
10567
- }
10568
- // We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
10569
- 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
10570
- );
10571
-
10572
- const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
10573
- // We need to cut before the first segment - possibly through other segments - and maybe between segments
10574
- 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);
10575
- $f3a159279dc1a8fb$var$cut_start(index_of_first_segment, segmented_text);
10576
- // update indexes since we might have removed segments
10577
- [index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
10578
- let number_of_characters_between_segments = 0;
10579
- for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
10580
- const segment = segmented_text[i];
10581
- number_of_characters_between_segments += segment.text_.length;
10582
- }
10583
- if (number_of_characters_between_segments < $f3a159279dc1a8fb$var$dont_cut_in_between_less_than_characters)
10584
- // don't cut if there are less than 30 characters between the two segments
10585
- return;
10586
- // We have more than 50 characters between the two segments, cut between them
10587
- const [split_start_segment, split_start_character] = $f3a159279dc1a8fb$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
10588
- const [split_end_segment, split_end_character] = $f3a159279dc1a8fb$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
10589
- if (split_start_segment === undefined || split_end_segment === undefined ||
10590
- // identical split point, or split end before split start, can't do anything
10591
- split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
10592
- const dots_segment = {
10593
- text_: " … ",
10594
- highlighted_: false
10595
- };
10596
- const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
10597
- if (i < split_start_segment || i > split_end_segment) return segment;
10598
- const text = segment.text_;
10599
- if (i == split_end_segment && i == split_start_segment) return [{
10600
- ...segment,
10601
- text_: text.slice(0, split_start_character).trimEnd()
10602
- }, dots_segment, {
10603
- ...segment,
10604
- text_: text.slice(split_end_character + 1, text.length).trimStart()
10605
- }];else if (i == split_start_segment) {
10606
- 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
10607
- return segment;
10608
- } else if (i == split_end_segment) return [dots_segment, {
10609
- ...segment,
10610
- text_: text.slice(split_end_character + 1, text.length).trimStart()
10611
- }];
10612
- return []; // remove all segments inbetween
10613
- });
10614
-
10615
- segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
10616
- $f3a159279dc1a8fb$var$heal_holes(segmented_text);
10617
- }
10618
- function $f3a159279dc1a8fb$var$heal_holes(segmented_text) {
10619
- // try to heal "holes" created in the segments so there are only alternating segments
10620
- const segments_to_delete = new Set();
10621
- for (let i = 0; i < segmented_text.length; i++) {
10622
- var _previous_segment, _previous_segment2;
10623
- const segment = segmented_text[i];
10624
- let previous_segment;
10625
- for (let j = i - 1; j >= 0; j--) {
10626
- previous_segment = segmented_text[j];
10627
- // Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
10628
- if (!segments_to_delete.has(previous_segment)) break;
10629
- }
10630
- 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) {
10631
- previous_segment.text_ += segment.text_; // IDK if this ever happens
10632
- segments_to_delete.add(segment);
10633
- }
10634
- }
10635
- for (const segment of segments_to_delete) {
10636
- const index = segmented_text.indexOf(segment);
10637
- segmented_text.splice(index, 1);
10638
- }
10639
- }
10640
- function $f3a159279dc1a8fb$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text) {
10641
- let be_very_aggressive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
10642
- const should_loop_backwards = index_of_start_segment > index_of_end_segment;
10643
- const step = should_loop_backwards ? -1 : 1;
10644
- const desperate_split_attempts = [":", ";", ","];
10645
- while (desperate_split_attempts.length) {
10646
- const split_point_between_words = [];
10647
- // for the middle also try to split with a few more characters if the default ones don't work over a full run
10648
- const desperate_split_attempt = desperate_split_attempts.pop();
10649
- let is_first_character = true;
10650
- for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
10651
- const segment = segmented_text[i];
10652
- const text = segment.text_;
10653
- for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
10654
- const character = text[j];
10655
- if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
10656
- if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
10657
- split_point_between_words.push([i, j]);
10658
- if (split_point_between_words.length > 3)
10659
- // We can't find a split point, so we'll just split between words
10660
- // 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
10661
- return split_point_between_words[1];
10662
- }
10663
- }
10664
- }
10665
- }
10666
- return [];
10667
- }
10668
- function $f3a159279dc1a8fb$var$cut_start(cut_left_of_index, segmented_text) {
10669
- // Cut the start of the text to bring the first matching token
10670
- let is_first_character = false;
10671
- let words_encountered = 0;
10672
- outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
10673
- const segment = segmented_text[i];
10674
- // We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
10675
- const text = segment.text_;
10676
- for (let j = text.length - 1; j >= 0; j--) {
10677
- const character = text[j];
10678
- const is_space = character == " ";
10679
- if (!is_first_character && is_space) words_encountered++;
10680
- if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
10681
- // We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
10682
- segment.text_ = text.slice(j + 1).trimStart();
10683
- segmented_text.splice(0, i);
10684
- if (character === "," || is_space)
10685
- // if we cut at a comma or psace, we add a … at the beginning
10686
- segmented_text.unshift({
10687
- text_: "… ",
10688
- highlighted_: false
10689
- });
10690
- break outmost_loop;
10691
- }
10692
- if (is_first_character) is_first_character = false;
10693
- }
10694
- }
10695
- $f3a159279dc1a8fb$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
10696
- }
10697
-
10698
- function $f3a159279dc1a8fb$var$segment_text(text, matched_strings) {
10699
- // segment text where the matched strings are highlighted sections
10700
- const output = [];
10701
- if (!text) return; // shouldn't happen but whatever
10702
- for (let i = 0; i < text.length; i++) {
10703
- const found_strings = [];
10704
- if (!i || text[i - 1] == " ")
10705
- // only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
10706
- for (let j = 0; j < matched_strings.length; j++) {
10707
- const matched_string = matched_strings[j];
10708
- const part_in_text = text.slice(i, i + matched_string.length);
10709
- if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
10710
- 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
10711
- }
10712
-
10713
- const last_index_in_output = output.length - 1;
10714
- if (!found_strings.length) {
10715
- var _output$last_index_in;
10716
- const character = text[i];
10717
- 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))
10718
- // 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
10719
- output[last_index_in_output].text_ += character;else output.push({
10720
- highlighted_: false,
10721
- text_: character
10722
- });
10723
- } else {
10724
- var _output$last_index_in2;
10725
- const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
10726
- 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({
10727
- highlighted_: true,
10728
- text_: longest_found_string
10729
- });
10730
- i += longest_found_string.length - 1;
10731
- }
10732
- }
10733
- return output;
10734
- }
10735
10997
  const $22470de5f42cc35d$var$_tmpl$ = /*#__PURE__*/$8tj43$template(`<a>`),
10736
10998
  $22470de5f42cc35d$var$_tmpl$2 = /*#__PURE__*/$8tj43$template(`<div>`),
10737
10999
  $22470de5f42cc35d$var$_tmpl$3 = /*#__PURE__*/$8tj43$template(`<div class="description line-clamp">`),
@@ -12349,4 +12611,4 @@ const $d399250dfa491636$export$c3834fa86c616831 = [[4], [3, 1024], [2, 901]];
12349
12611
  const $d399250dfa491636$export$864d304a0bc46829 = "2%";
12350
12612
  const $d399250dfa491636$export$7bf543b9d9be2c22 = (0, $fa332ea03168857c$export$b91cec6bdc6b32a1);
12351
12613
  $8tj43$add_to_version_info("ui", (0, $8db9a15135765c11$export$83d89fbfd8236492));
12352
- export { $2855bffe06ef7a03$export$916e6850778505f6 as strip_encoded_filter_and_sort, $2855bffe06ef7a03$export$58aa3f171519b6d7 as encode_filters, $2855bffe06ef7a03$export$f934fa24c3a86811 as decode_filters, $4df489344a0f97c7$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $5441862cd2f5e111$export$e68cff63f76bd15b as ListingProvider, $5441862cd2f5e111$export$8d0c4fdbb05a2f2e as useListing, $4df489344a0f97c7$export$e4b984597b71e989 as ShopifyContainedImage, $002f09d00aac50b2$export$6649caad96ef8870 as SlidableItems, $0dc044cffe1e825b$export$9f191182275e9ef as make_accurate_size_accessor, $d5d7e58c5c9d8db0$export$9574e176201e5e8d as RecommendationSlider, $b432b11321ad4c97$export$9756467d34d91cdb as RecommendationGrid, $56047603f9d212b6$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $56047603f9d212b6$export$e6fffe67d4cdd848 as makeSizeAccessor, $801e8845d3fa3653$export$94026ee33dbabc26 as ImageContainer, $74777e8fe65b3dcb$export$b69d0d92862de18b as SentryErrorBoundary, $ad371564683947ab$export$6c6d7a51fa9aa15d as ExpandingDetails, $e18ab2868df26f40$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $4711a82d08d2021b$export$fecbb157621501bd as SelectedFilters, $f6b0500577e1b210$export$3f1a388cc0d8fed7 as FilterBody, $44aa24b1bb793549$export$b288c38ae3fddb56 as create_modified_filters, $63f1f8dbcd07d3b0$export$d21e32dfedac04be as SolidLayout, $d5f1e6a0f9117286$export$79b1565500412d9b as general_modal_abstraction, $9783d437ad61594c$export$3b621d86b1566b2 as CrossIcon, $ca6ab5f08bd28bca$export$8be2714ec7f169ee as GenericSliderArrowButton, $5c5732ef44f05b26$export$58e808b1db15d3bc as fetchDepictRecommendations, $f5f54892fd0c7d9f$export$de035477d6fef996 as QuickLinks, $f5f54892fd0c7d9f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $fa332ea03168857c$export$b91cec6bdc6b32a1 as CategoryTitle, $702d7656a373973e$export$824dde41348efed1 as embedded_num_products, $96fd967c5b358ead$export$643598a327b5833e as get_categories, $f5f54892fd0c7d9f$export$f34314aa9505732e as DepictCategory, $f5f54892fd0c7d9f$export$e2bf8ce7779e827e as CategoryPage, $eb064bc3350276c1$export$ac6237957a15b3f0 as DepictSearch, $eb064bc3350276c1$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $eb064bc3350276c1$export$f2dc7e4e4aa11abb as SearchPage, $eb064bc3350276c1$export$316f6f283ae64765 as SearchField, $f3b7124b76123e44$export$aa14a9f43128f61f as ProductCardError, $169c13c0531d91d2$export$d86a33413558014e as open_modal_with_alignment, $5eaa00b951637e96$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $1308a7816c3d4f2d$export$b3ad617e9036868 as align_field, $a9c7ba6087881ac2$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $cc64aabf2c7a1f1a$export$1233ca167bf71f9a as styles_to_valid_css_string, $e56d241d0f33d459$export$fe334901e8bebd57 as disable_scrolling, $573c007c697a1831$export$d0596b5cae35ad4 as open_search_with_shift_slash, $284849364a6ef73a$export$e015ed2f2950f2e3 as DepictAPI, $00a5b94f0c11efbb$export$d9f36cf74e24d595 as media_query_to_accessor, $e60a76195ac6d408$export$689e204eadb33baf as setup_fast_leave, $a61a2051e15c8d7a$export$5196e4c01fa56fcb as show_toast, $60ec7a29849d81db$export$a71e92cfbb498adc as SolidFormatPrice, $37e8c97bb6876197$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $bc2337c9a05ecd18$export$acb3eaade4b23afd as BasePlaceholder, $ceafb6fb91c6f394$export$89c6019e4baa40b1 as TextPlaceholder, $3ab4aa97880fb88d$export$3f37af283f8fb843 as ImagePlaceholder, $f9fd3017c20b774a$export$3ccaa27d81dd8556 as PageReplacer, $d399250dfa491636$export$864d304a0bc46829 as defaultGridSpacing, $d399250dfa491636$export$c3834fa86c616831 as defaultColsAtSize, $d399250dfa491636$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $8db9a15135765c11$export$83d89fbfd8236492 as version };
12614
+ export { $2855bffe06ef7a03$export$916e6850778505f6 as strip_encoded_filter_and_sort, $2855bffe06ef7a03$export$58aa3f171519b6d7 as encode_filters, $2855bffe06ef7a03$export$f934fa24c3a86811 as decode_filters, $4df489344a0f97c7$export$d7b7ab832c20e2f4 as shopifyContainedImageContextSymbol, $5441862cd2f5e111$export$e68cff63f76bd15b as ListingProvider, $5441862cd2f5e111$export$8d0c4fdbb05a2f2e as useListing, $4df489344a0f97c7$export$e4b984597b71e989 as ShopifyContainedImage, $002f09d00aac50b2$export$6649caad96ef8870 as SlidableItems, $fc830a7ee59416ef$export$ebdc3711f7e02ccd as make_accurate_width_accessor, $d5d7e58c5c9d8db0$export$9574e176201e5e8d as RecommendationSlider, $b432b11321ad4c97$export$9756467d34d91cdb as RecommendationGrid, $56047603f9d212b6$export$6e5611bc7e57e477 as ShopifyResponsiveImg, $56047603f9d212b6$export$e6fffe67d4cdd848 as makeSizeAccessor, $801e8845d3fa3653$export$94026ee33dbabc26 as ImageContainer, $74777e8fe65b3dcb$export$b69d0d92862de18b as SentryErrorBoundary, $ad371564683947ab$export$6c6d7a51fa9aa15d as ExpandingDetails, $e18ab2868df26f40$export$f091cbac892643a4 as accessor_of_object_to_object_with_accessor_values, $4711a82d08d2021b$export$fecbb157621501bd as SelectedFilters, $f6b0500577e1b210$export$3f1a388cc0d8fed7 as FilterBody, $44aa24b1bb793549$export$b288c38ae3fddb56 as create_modified_filters, $63f1f8dbcd07d3b0$export$d21e32dfedac04be as SolidLayout, $d5f1e6a0f9117286$export$79b1565500412d9b as general_modal_abstraction, $9783d437ad61594c$export$3b621d86b1566b2 as CrossIcon, $ca6ab5f08bd28bca$export$8be2714ec7f169ee as GenericSliderArrowButton, $5c5732ef44f05b26$export$58e808b1db15d3bc as fetchDepictRecommendations, $f5f54892fd0c7d9f$export$de035477d6fef996 as QuickLinks, $f5f54892fd0c7d9f$export$5b7c3ce0ebe51f86 as BreadCrumbs, $fa332ea03168857c$export$b91cec6bdc6b32a1 as CategoryTitle, $702d7656a373973e$export$824dde41348efed1 as embedded_num_products, $96fd967c5b358ead$export$643598a327b5833e as get_categories, $f5f54892fd0c7d9f$export$f34314aa9505732e as DepictCategory, $f5f54892fd0c7d9f$export$e2bf8ce7779e827e as CategoryPage, $eb064bc3350276c1$export$ac6237957a15b3f0 as DepictSearch, $eb064bc3350276c1$export$bde3eb976dfded9 as get_search_query_updating_blocked_signal, $eb064bc3350276c1$export$f2dc7e4e4aa11abb as SearchPage, $eb064bc3350276c1$export$316f6f283ae64765 as SearchField, $f3b7124b76123e44$export$aa14a9f43128f61f as ProductCardError, $169c13c0531d91d2$export$d86a33413558014e as open_modal_with_alignment, $5eaa00b951637e96$export$ee1733d9a8495996 as DefaultInstantCardPlaceholder, $1308a7816c3d4f2d$export$b3ad617e9036868 as align_field, $a9c7ba6087881ac2$export$6daf8749b65a1b77 as convert_sdk_cols_at_size_to_layout, $cc64aabf2c7a1f1a$export$1233ca167bf71f9a as styles_to_valid_css_string, $e56d241d0f33d459$export$fe334901e8bebd57 as disable_scrolling, $573c007c697a1831$export$d0596b5cae35ad4 as open_search_with_shift_slash, $284849364a6ef73a$export$e015ed2f2950f2e3 as DepictAPI, $00a5b94f0c11efbb$export$d9f36cf74e24d595 as media_query_to_accessor, $e60a76195ac6d408$export$689e204eadb33baf as setup_fast_leave, $a61a2051e15c8d7a$export$5196e4c01fa56fcb as show_toast, $60ec7a29849d81db$export$a71e92cfbb498adc as SolidFormatPrice, $37e8c97bb6876197$export$828dcdd425fd3231 as connect_search_field_height_to_aligner_height, $bc2337c9a05ecd18$export$acb3eaade4b23afd as BasePlaceholder, $ceafb6fb91c6f394$export$89c6019e4baa40b1 as TextPlaceholder, $3ab4aa97880fb88d$export$3f37af283f8fb843 as ImagePlaceholder, $f9fd3017c20b774a$export$3ccaa27d81dd8556 as PageReplacer, $d399250dfa491636$export$864d304a0bc46829 as defaultGridSpacing, $d399250dfa491636$export$c3834fa86c616831 as defaultColsAtSize, $d399250dfa491636$export$7bf543b9d9be2c22 as defaultCategoryTitlePlugin, $8db9a15135765c11$export$83d89fbfd8236492 as version };