@depict-ai/ui 2.1.11 → 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.cjs CHANGED
@@ -25,7 +25,7 @@ $parcel$export(module.exports, "ListingProvider", () => $d067f3a30f047b41$export
25
25
  $parcel$export(module.exports, "useListing", () => $d067f3a30f047b41$export$8d0c4fdbb05a2f2e);
26
26
  $parcel$export(module.exports, "ShopifyContainedImage", () => $28535bb7671c63d1$export$e4b984597b71e989);
27
27
  $parcel$export(module.exports, "SlidableItems", () => $ad8ec7729fffeb9c$export$6649caad96ef8870);
28
- $parcel$export(module.exports, "make_accurate_size_accessor", () => $13671aa5e984acd9$export$9f191182275e9ef);
28
+ $parcel$export(module.exports, "make_accurate_width_accessor", () => $c387d7f1d9fb66c0$export$ebdc3711f7e02ccd);
29
29
  $parcel$export(module.exports, "RecommendationSlider", () => $2badc30d7c6610e1$export$9574e176201e5e8d);
30
30
  $parcel$export(module.exports, "RecommendationGrid", () => $41227f10ad680afd$export$9756467d34d91cdb);
31
31
  $parcel$export(module.exports, "ShopifyResponsiveImg", () => $858fdcf73148519f$export$6e5611bc7e57e477);
@@ -76,7 +76,7 @@ $parcel$export(module.exports, "defaultColsAtSize", () => $33eed84f447aa0c0$expo
76
76
  $parcel$export(module.exports, "defaultCategoryTitlePlugin", () => $33eed84f447aa0c0$export$7bf543b9d9be2c22);
77
77
  $parcel$export(module.exports, "version", () => $aa1938dec50d6c12$export$83d89fbfd8236492);
78
78
  /*! Depict.ai search and product listing SDK */
79
- const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.11";
79
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.13";
80
80
  const $a68b73fd7ba0853f$var$fallback_operator = "in";
81
81
  const $a68b73fd7ba0853f$var$fallback_token = "";
82
82
  const $a68b73fd7ba0853f$var$legacy_filter_prefix = "filter_";
@@ -531,13 +531,13 @@ function $ad8ec7729fffeb9c$export$6649caad96ef8870(_ref) {
531
531
 
532
532
  /** @jsxImportSource solid-js */
533
533
 
534
- function $13671aa5e984acd9$export$9f191182275e9ef(what_to_watch) {
535
- const [size, setSize] = $52FdA$solidjs.createSignal();
534
+ function $c387d7f1d9fb66c0$export$ebdc3711f7e02ccd(what_to_watch) {
535
+ const [width, setWidth] = $52FdA$solidjs.createSignal();
536
536
  const resizeObserver = new ResizeObserver($52FdA$depictaiutilishared.catchify(records => {
537
537
  for (let j = 0; j < records.length; j++) {
538
538
  var _records$j$borderBoxS, _records$j$borderBoxS2, _records$j$borderBoxS3;
539
539
  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;
540
- setSize(width);
540
+ setWidth(width);
541
541
  }
542
542
  }));
543
543
  // 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.
@@ -546,13 +546,19 @@ function $13671aa5e984acd9$export$9f191182275e9ef(what_to_watch) {
546
546
  let {
547
547
  element: element
548
548
  } = _ref;
549
- return requestAnimationFrame($52FdA$depictaiutilishared.catchify(() => resizeObserver.observe(element)));
549
+ return requestAnimationFrame($52FdA$depictaiutilishared.catchify(() => {
550
+ const current_size = what_to_watch.getBoundingClientRect().width;
551
+ if (current_size)
552
+ // 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.
553
+ setWidth(current_size);
554
+ resizeObserver.observe(element);
555
+ }));
550
556
  });
551
557
  $52FdA$solidjs.onCleanup(() => {
552
558
  resizeObserver.disconnect();
553
559
  disconnect();
554
560
  });
555
- return size;
561
+ return width;
556
562
  }
557
563
  const $5401a6698b0c0658$var$transform_elements = sorted_cols_at_size => {
558
564
  const cols_at_size = [];
@@ -853,11 +859,10 @@ class $95e4006e1dcb5b72$export$aa14a9f43128f61f extends $95e4006e1dcb5b72$export
853
859
  });
854
860
  }
855
861
  }
856
- const $1b3cf201cdd38687$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div>`);
862
+ const $1b3cf201cdd38687$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div><!$><!/><!$><!/>`);
857
863
  function $1b3cf201cdd38687$export$b69d0d92862de18b(props) {
858
864
  return $52FdA$solidjs.ErrorBoundary({
859
865
  fallback(err, retry) {
860
- var _props$on_error_;
861
866
  const {
862
867
  message_: message_,
863
868
  severity_: severity_
@@ -867,10 +872,17 @@ function $1b3cf201cdd38687$export$b69d0d92862de18b(props) {
867
872
  console.error(err.cause);
868
873
  message = "".concat(message, ": ").concat(err.message);
869
874
  } else $52FdA$depictaiutilishared.report([err, message_], severity_);
870
- (_props$on_error_ = props.on_error_) === null || _props$on_error_ === void 0 || _props$on_error_.call(props, retry);
871
875
  return (() => {
872
- const _el$ = $52FdA$solidjsweb.getNextElement($1b3cf201cdd38687$var$_tmpl$);
873
- $52FdA$solidjsweb.insert(_el$, message);
876
+ const _el$ = $52FdA$solidjsweb.getNextElement($1b3cf201cdd38687$var$_tmpl$),
877
+ _el$2 = _el$.firstChild,
878
+ [_el$3, _co$] = $52FdA$solidjsweb.getNextMarker(_el$2.nextSibling),
879
+ _el$4 = _el$3.nextSibling,
880
+ [_el$5, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$4.nextSibling);
881
+ $52FdA$solidjsweb.insert(_el$, message, _el$3, _co$);
882
+ $52FdA$solidjsweb.insert(_el$, () => {
883
+ var _props$on_error_;
884
+ return (_props$on_error_ = props.on_error_) === null || _props$on_error_ === void 0 ? void 0 : _props$on_error_.call(props, retry);
885
+ }, _el$5, _co$2);
874
886
  $52FdA$solidjsweb.effect(_$p => {
875
887
  var _props$class_list_;
876
888
  return $52FdA$solidjsweb.classList(_el$, Object.fromEntries(((_props$class_list_ = props.class_list_) === null || _props$class_list_ === void 0 ? void 0 : _props$class_list_.map(c => [c, true])) || []), _$p);
@@ -1584,17 +1596,12 @@ function $1a8463d757baadb6$export$8895d39404bd2bb1(props) {
1584
1596
  if (delay_toast_) return show_configured_toast;else show_configured_toast();
1585
1597
  }
1586
1598
  $52FdA$solidjsweb.delegateEvents(["click"]);
1587
- const $083b2336093176cf$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.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">`);
1599
+ const $083b2336093176cf$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.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">`);
1588
1600
  function $083b2336093176cf$export$3b621d86b1566b2() {
1589
1601
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1590
1602
  return (() => {
1591
1603
  const _el$ = $52FdA$solidjsweb.getNextElement($083b2336093176cf$var$_tmpl$);
1592
- $52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(props, {
1593
- "xmlns": "http://www.w3.org/2000/svg",
1594
- "width": "21.064",
1595
- "height": "21.047",
1596
- "viewBox": "0 0 21.064 21.064"
1597
- }), true, true);
1604
+ $52FdA$solidjsweb.spread(_el$, props, true, true);
1598
1605
  $52FdA$solidjsweb.runHydrationEvents();
1599
1606
  return _el$;
1600
1607
  })();
@@ -1922,7 +1929,7 @@ $52FdA$solidjsweb.delegateEvents(["click"]);
1922
1929
  const $902a0ca2b52f3898$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class=count>`),
1923
1930
  $902a0ca2b52f3898$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<label class=input-row><div class=left><input type=checkbox><span class=custom-indicator></span><span class="text line-clamp"></span></div><!$><!/>`);
1924
1931
  const $902a0ca2b52f3898$export$48513f6b9f8ce62d = props => {
1925
- // 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
1932
+ /* 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
1926
1933
  const count = $52FdA$solidjs.createMemo(() => props.count_);
1927
1934
  const label = $52FdA$solidjs.createMemo(() => props.label_);
1928
1935
  const checked = $52FdA$solidjs.createMemo(() => props.checked_);
@@ -2020,6 +2027,79 @@ function $b0477e4d832f090e$export$ca21a16d65b3dd8(_ref) {
2020
2027
  })();
2021
2028
  }
2022
2029
  $52FdA$solidjsweb.delegateEvents(["click"]);
2030
+ const $23c3f390dee33ff8$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class=highlighted-part>`),
2031
+ $23c3f390dee33ff8$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<span>`);
2032
+ function $23c3f390dee33ff8$export$ba17c5b7e6dda39f(_ref) {
2033
+ let {
2034
+ whole_text_to_display_: whole_text_to_display_memo,
2035
+ searching_for_value_: searching_for_value_memo,
2036
+ class_: class_
2037
+ } = _ref;
2038
+ const [get_has_highlighted, set_has_highlighted] = $52FdA$solidjs.createSignal(false);
2039
+ const text_itself = $52FdA$solidjs.createMemo(() => $52FdA$solidjs.batch(() => {
2040
+ set_has_highlighted(false);
2041
+ const searching_for_value = searching_for_value_memo();
2042
+ const whole_text_to_display_ = whole_text_to_display_memo();
2043
+ let for_black = "";
2044
+ let pushed_grey = false;
2045
+ const search_q = searching_for_value;
2046
+ if (!search_q) return whole_text_to_display_;
2047
+ const output = [];
2048
+ const searching_for = search_q.toLowerCase();
2049
+ const push_black = () => {
2050
+ if (for_black) {
2051
+ set_has_highlighted(true);
2052
+ output.push((() => {
2053
+ const _el$ = $52FdA$solidjsweb.getNextElement($23c3f390dee33ff8$var$_tmpl$);
2054
+ $52FdA$solidjsweb.insert(_el$, for_black);
2055
+ return _el$;
2056
+ })()); // "black"
2057
+ for_black = "";
2058
+ }
2059
+ };
2060
+ for (let i = 0; i < whole_text_to_display_.length;) {
2061
+ let is_whole_word = true;
2062
+ let searching_for_but_with_texts_casing = "";
2063
+ const i_at_start = i;
2064
+ for (let j = 0; j < searching_for.length; i++, j++) {
2065
+ const letter_in_suggestion = whole_text_to_display_[i];
2066
+ if ((letter_in_suggestion === null || letter_in_suggestion === void 0 ? void 0 : letter_in_suggestion.toLowerCase()) !== searching_for[j]) {
2067
+ is_whole_word = false;
2068
+ i = i_at_start;
2069
+ break;
2070
+ }
2071
+ searching_for_but_with_texts_casing += letter_in_suggestion;
2072
+ }
2073
+ if (is_whole_word) {
2074
+ push_black();
2075
+ output.push(searching_for_but_with_texts_casing);
2076
+ pushed_grey = true;
2077
+ } else for_black += whole_text_to_display_[i++];
2078
+ }
2079
+ push_black();
2080
+ if (!pushed_grey) {
2081
+ set_has_highlighted(false);
2082
+ return whole_text_to_display_;
2083
+ }
2084
+ return output;
2085
+ }));
2086
+ return (() => {
2087
+ const _el$2 = $52FdA$solidjsweb.getNextElement($23c3f390dee33ff8$var$_tmpl$2);
2088
+ $52FdA$solidjsweb.className(_el$2, class_);
2089
+ $52FdA$solidjsweb.insert(_el$2, text_itself);
2090
+ $52FdA$solidjsweb.effect(_p$ => {
2091
+ const _v$ = !!get_has_highlighted(),
2092
+ _v$2 = whole_text_to_display_memo() /* for when line-clamped, users can see full text on hover */;
2093
+ _v$ !== _p$._v$ && _el$2.classList.toggle("has-match", _p$._v$ = _v$);
2094
+ _v$2 !== _p$._v$2 && $52FdA$solidjsweb.setAttribute(_el$2, "title", _p$._v$2 = _v$2);
2095
+ return _p$;
2096
+ }, {
2097
+ _v$: undefined,
2098
+ _v$2: undefined
2099
+ });
2100
+ return _el$2;
2101
+ })();
2102
+ }
2023
2103
  const $9b54b9c5381716eb$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<form class=checkboxes><!$><!/><!$><!/>`);
2024
2104
  const $9b54b9c5381716eb$var$max_visible_without_collapsing = 15;
2025
2105
  const $9b54b9c5381716eb$var$show_non_collapsible_when_collapsed = 4;
@@ -2028,7 +2108,8 @@ function $9b54b9c5381716eb$export$dd948f91abc3a1c4(_ref) {
2028
2108
  filter_: filter_,
2029
2109
  selected_filters_: [get_selected_filters, set_selected_filters],
2030
2110
  i18n_: i18n_,
2031
- view_more_button_below_group_: [, set_view_more_button_below_group_]
2111
+ view_more_button_below_group_: [, set_view_more_button_below_group_],
2112
+ filter_query_: filter_query_
2032
2113
  } = _ref;
2033
2114
  const existing_filter = $52FdA$solidjs.createMemo(() => {
2034
2115
  const {
@@ -2063,12 +2144,18 @@ function $9b54b9c5381716eb$export$dd948f91abc3a1c4(_ref) {
2063
2144
  const value = $e2d74bb03cc5252e$export$325f75597868c4f0(checkbox().value_);
2064
2145
  return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === value));
2065
2146
  });
2147
+ const value = $52FdA$solidjs.createMemo(() => checkbox().value_);
2066
2148
  return $52FdA$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
2067
2149
  get value_() {
2068
- return checkbox().value_;
2150
+ return value();
2069
2151
  },
2070
2152
  get label_() {
2071
- return checkbox().name_;
2153
+ return $52FdA$solidjsweb.createComponent((0, $23c3f390dee33ff8$export$ba17c5b7e6dda39f), {
2154
+ get whole_text_to_display_() {
2155
+ return $52FdA$solidjs.createMemo(() => checkbox().name_ || value());
2156
+ },
2157
+ searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
2158
+ });
2072
2159
  },
2073
2160
  get count_() {
2074
2161
  return checkbox().count_;
@@ -2167,7 +2254,8 @@ const $d9239dad9a9d899b$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<f
2167
2254
  function $d9239dad9a9d899b$export$430444115f70a734(_ref) {
2168
2255
  let {
2169
2256
  selected_filters_: selected_filters_,
2170
- filter_: filter_
2257
+ filter_: filter_,
2258
+ filter_query_: filter_query_
2171
2259
  } = _ref;
2172
2260
  const radio_name = $52FdA$depictaiutilishared.make_random_classname();
2173
2261
  const existing_filter = $52FdA$solidjs.createMemo(() => {
@@ -2195,6 +2283,13 @@ function $d9239dad9a9d899b$export$430444115f70a734(_ref) {
2195
2283
  var _counts;
2196
2284
  return (_counts = filter_().meta.counts) === null || _counts === void 0 ? void 0 : _counts[index];
2197
2285
  });
2286
+ const label = $52FdA$solidjs.createMemo(() => {
2287
+ var _filter_$meta, _filter_$meta$names;
2288
+ 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];
2289
+ if (name) return name;
2290
+ const v = value();
2291
+ return Array.isArray(v) ? v.join(" - ") : v + "";
2292
+ });
2198
2293
  return (() => {
2199
2294
  const _el$2 = $52FdA$solidjsweb.getNextElement($d9239dad9a9d899b$var$_tmpl$3),
2200
2295
  _el$3 = _el$2.firstChild,
@@ -2219,12 +2314,9 @@ function $d9239dad9a9d899b$export$430444115f70a734(_ref) {
2219
2314
  }));
2220
2315
  $52FdA$solidjsweb.setAttribute(_el$4, "id", random_selector);
2221
2316
  $52FdA$solidjsweb.setAttribute(_el$4, "name", radio_name);
2222
- $52FdA$solidjsweb.insert(_el$3, $52FdA$solidjs.createMemo(() => {
2223
- var _filter_$meta, _filter_$meta$names;
2224
- 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];
2225
- if (name) return name;
2226
- const v = value();
2227
- return Array.isArray(v) ? v.join(" - ") : v;
2317
+ $52FdA$solidjsweb.insert(_el$3, $52FdA$solidjsweb.createComponent((0, $23c3f390dee33ff8$export$ba17c5b7e6dda39f), {
2318
+ whole_text_to_display_: label,
2319
+ searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
2228
2320
  }), _el$7, _co$);
2229
2321
  $52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
2230
2322
  get when() {
@@ -2258,7 +2350,8 @@ function $0257c760a99bfacb$export$e0d834a0ad870cda(_ref) {
2258
2350
  let {
2259
2351
  filter_: filter_,
2260
2352
  selected_filters_: selected_filters_,
2261
- i18n_: i18n_
2353
+ i18n_: i18n_,
2354
+ filter_query_: filter_query_
2262
2355
  } = _ref;
2263
2356
  // 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
2264
2357
  // 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
@@ -2651,135 +2744,417 @@ function $ac040bdfeed58ee4$export$e5c2828934226505(_ref) {
2651
2744
  });
2652
2745
  return outer_div;
2653
2746
  }
2654
- const $9c1d49181fb3002a$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<form class="checkboxes hierarchical"><!$><!/><!$><!/>`),
2655
- $9c1d49181fb3002a$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=checkbox-details><!$><!/><!$><!/>`),
2656
- $9c1d49181fb3002a$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<details>`),
2657
- $9c1d49181fb3002a$var$_tmpl$4 = /*#__PURE__*/$52FdA$solidjsweb.template(`<summary class=category-parent><div class=summary><span class=count></span><!$><!/>`);
2658
- const $9c1d49181fb3002a$var$max_visible_without_collapsing = 15;
2659
- const $9c1d49181fb3002a$var$show_non_collapsible_when_collapsed = 4;
2660
- function $9c1d49181fb3002a$export$a32086fa6616eafd(_ref) {
2747
+ const $99472afa7112c427$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class=highlighted-part>`);
2748
+ const $99472afa7112c427$var$dont_cut_in_between_less_than_characters = 30;
2749
+ function $99472afa7112c427$export$e1a98a189fd2c0e7(_ref) {
2661
2750
  let {
2662
- filter_: filter_,
2663
- selected_filters_: selected_filters_,
2664
- i18n_: i18n_,
2665
- view_more_button_below_group_: view_more_button_below_group_,
2666
- expanded_hierarchical_filters_: expanded_hierarchical_filters_
2751
+ content_result_: content_result_,
2752
+ key_: key_,
2753
+ cut_when_possible_: cut_when_possible_
2667
2754
  } = _ref;
2668
- let form;
2669
- const existing_filter = $52FdA$solidjs.createMemo(() => {
2670
- const {
2671
- field: field,
2672
- op: op
2673
- } = filter_();
2674
- return selected_filters_[0]().find(_ref2 => {
2675
- let {
2676
- field: checking_field,
2677
- op: checking_op
2678
- } = _ref2;
2679
- return checking_field === field && checking_op === op;
2680
- });
2681
- });
2682
- const show_extras = $52FdA$solidjs.createSignal(false);
2683
- const trigger_sync_ = $9c1d49181fb3002a$var$batching_filter_state_syncer({
2684
- filter_: filter_,
2685
- existing_filter_: existing_filter,
2686
- selected_filters_: selected_filters_,
2687
- get category_structure_() {
2688
- return structured_categories();
2689
- }
2690
- });
2691
- const structured_categories = $52FdA$solidjs.createMemo(() => {
2692
- const execute_when_structure_finished = [];
2693
- const {
2694
- values: values,
2695
- names: names,
2696
- counts: counts
2697
- } = filter_().meta;
2698
- const data_structure = {};
2699
- for (let i = 0; i < values.length; i++) {
2700
- const value = values[i];
2701
- let pointer = data_structure;
2702
- let parent_ = {};
2703
- let created_an_object = false;
2704
- for (let j = 0; j < value.length; j++) {
2705
- var _pointer;
2706
- const this_categories_name = value[j];
2707
- const obj = (_pointer = pointer)[this_categories_name] || (_pointer[this_categories_name] = (() => {
2708
- 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;
2709
- const created_obj = {
2710
- name_: names[i],
2711
- count_: counts === null || counts === void 0 ? void 0 : counts[i],
2712
- parent_: parent_,
2713
- is_expanded_: $9c1d49181fb3002a$var$make_expanded_signal({
2714
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
2715
- filter_value_: value_as_string
2716
- }),
2717
- value_: value_as_string,
2718
- children_: {}
2719
- };
2720
- const {
2721
- signal_: signal_,
2722
- on_structure_complete_: on_structure_complete_
2723
- } = $9c1d49181fb3002a$var$create_updating_signal({
2724
- self_: created_obj,
2725
- existing_filter_: $52FdA$solidjs.untrack(existing_filter),
2726
- trigger_sync_: trigger_sync_
2727
- });
2728
- execute_when_structure_finished.push(on_structure_complete_);
2729
- created_obj.is_checked_ = signal_;
2730
- parent_ = created_obj;
2731
- created_an_object = true;
2732
- return created_obj;
2733
- })());
2734
- pointer = obj.children_;
2735
- parent_ = obj;
2736
- }
2737
- if (!created_an_object && "value_" in parent_) {
2738
- // 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
2739
- // [
2740
- // ["Öl", "IPA"],
2741
- // ["Öl", "Pale Ale"],
2742
- // ["Öl", "Ale"],
2743
- // ["Öl", "Mörk Lager"],
2744
- // ["Öl", "Suröl"],
2745
- // ["Öl", "Veteöl"],
2746
- // ["Öl", "Stout och Porter"],
2747
- // ["Öl"], // <- We are here, our `hierarchical_data_structure[string]`-object was created when we iterated over ["Öl", "IPA"]
2748
- // ["Öl", "Ljus Lager"],
2749
- // ];
2750
- // In this case we want to just correct the name and value of the already created object, which will be in parent_
2751
- parent_.value_ = value.map(v => v + "");
2752
- parent_.name_ = names[i];
2753
- parent_.count_ = counts[i];
2754
- parent_.is_expanded_ = $9c1d49181fb3002a$var$make_expanded_signal({
2755
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
2756
- filter_value_: parent_.value_
2757
- });
2758
- }
2759
- }
2760
- while (execute_when_structure_finished.length) execute_when_structure_finished.pop()();
2761
- $9c1d49181fb3002a$var$expand_until_choice(data_structure);
2762
- $52FdA$depictaiutilishared.dlog("CheckboxHierarchicalFilter: Recomputed structured_categories", data_structure);
2763
- return data_structure;
2755
+ const matched_tokens = $52FdA$solidjs.createMemo(() => {
2756
+ var _content_result_$high, _content_result_$high2;
2757
+ 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;
2764
2758
  });
2765
- const some_top_level_are_hidden = $52FdA$solidjs.createMemo(() => Object.keys(structured_categories()).length > $9c1d49181fb3002a$var$max_visible_without_collapsing);
2766
- const {
2767
- expand: expand,
2768
- collapse: collapse,
2769
- ExpandingContainer: ExpandingContainer
2770
- } = $d6d51b09cb2116a6$export$5bad61ecde080b1f({
2771
- duration: 200
2759
+ const full_value = $52FdA$solidjs.createMemo(() => {
2760
+ var _content_result_$key_;
2761
+ return (_content_result_$key_ = content_result_()[key_]) === null || _content_result_$key_ === void 0 ? void 0 : _content_result_$key_.replaceAll("\n", " ");
2772
2762
  });
2773
- const expanding_container_els = $52FdA$solidjsweb.createComponent(ExpandingContainer, {
2763
+ return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
2764
+ get when() {
2765
+ var _matched_tokens;
2766
+ return (_matched_tokens = matched_tokens()) === null || _matched_tokens === void 0 ? void 0 : _matched_tokens.length;
2767
+ },
2768
+ get fallback() {
2769
+ return full_value();
2770
+ },
2774
2771
  get children() {
2775
- return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
2776
- get when() {
2777
- return some_top_level_are_hidden();
2778
- },
2779
- get children() {
2780
- return $9c1d49181fb3002a$var$render_stuff($52FdA$solidjs.createMemo(() => Object.fromEntries(Object.entries(structured_categories()).slice($9c1d49181fb3002a$var$show_non_collapsible_when_collapsed))), existing_filter, i18n_);
2781
- }
2782
- });
2772
+ return (() => {
2773
+ const segmented_cut_text = $52FdA$solidjs.createMemo(() => {
2774
+ const segmented_text = $99472afa7112c427$export$1b00d74faf266c56(full_value(), matched_tokens());
2775
+ if (cut_when_possible_) $99472afa7112c427$var$cut_text(segmented_text);
2776
+ return segmented_text;
2777
+ });
2778
+ return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Index), {
2779
+ get each() {
2780
+ return segmented_cut_text();
2781
+ },
2782
+ children: item => {
2783
+ return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
2784
+ get when() {
2785
+ return item().highlighted_;
2786
+ },
2787
+ get fallback() {
2788
+ return item().text_;
2789
+ },
2790
+ get children() {
2791
+ const _el$ = $52FdA$solidjsweb.getNextElement($99472afa7112c427$var$_tmpl$);
2792
+ $52FdA$solidjsweb.insert(_el$, () => item().text_);
2793
+ return _el$;
2794
+ }
2795
+ });
2796
+ }
2797
+ });
2798
+ })();
2799
+ }
2800
+ });
2801
+ }
2802
+ function $99472afa7112c427$var$cut_text(segmented_text) {
2803
+ // cut away chunks of text that are not highlighted to give a google-like overview of the content
2804
+ const highlighted_segments = segmented_text === null || segmented_text === void 0 ? void 0 : segmented_text.filter(segment => segment.highlighted_);
2805
+ if (!segmented_text || !(highlighted_segments !== null && highlighted_segments !== void 0 && highlighted_segments.length)) return;
2806
+ // We have one or more highlighted segments
2807
+ if (highlighted_segments.length === 1) {
2808
+ // cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
2809
+ $99472afa7112c427$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
2810
+ return;
2811
+ }
2812
+ // We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
2813
+ 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
2814
+ );
2815
+
2816
+ const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
2817
+ // We need to cut before the first segment - possibly through other segments - and maybe between segments
2818
+ 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);
2819
+ $99472afa7112c427$var$cut_start(index_of_first_segment, segmented_text);
2820
+ // update indexes since we might have removed segments
2821
+ [index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
2822
+ let number_of_characters_between_segments = 0;
2823
+ for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
2824
+ const segment = segmented_text[i];
2825
+ number_of_characters_between_segments += segment.text_.length;
2826
+ }
2827
+ if (number_of_characters_between_segments < $99472afa7112c427$var$dont_cut_in_between_less_than_characters)
2828
+ // don't cut if there are less than 30 characters between the two segments
2829
+ return;
2830
+ // We have more than 50 characters between the two segments, cut between them
2831
+ const [split_start_segment, split_start_character] = $99472afa7112c427$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
2832
+ const [split_end_segment, split_end_character] = $99472afa7112c427$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
2833
+ if (split_start_segment === undefined || split_end_segment === undefined ||
2834
+ // identical split point, or split end before split start, can't do anything
2835
+ split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
2836
+ const dots_segment = {
2837
+ text_: " … ",
2838
+ highlighted_: false
2839
+ };
2840
+ const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
2841
+ if (i < split_start_segment || i > split_end_segment) return segment;
2842
+ const text = segment.text_;
2843
+ if (i == split_end_segment && i == split_start_segment) return [{
2844
+ ...segment,
2845
+ text_: text.slice(0, split_start_character).trimEnd()
2846
+ }, dots_segment, {
2847
+ ...segment,
2848
+ text_: text.slice(split_end_character + 1, text.length).trimStart()
2849
+ }];else if (i == split_start_segment) {
2850
+ 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
2851
+ return segment;
2852
+ } else if (i == split_end_segment) return [dots_segment, {
2853
+ ...segment,
2854
+ text_: text.slice(split_end_character + 1, text.length).trimStart()
2855
+ }];
2856
+ return []; // remove all segments inbetween
2857
+ });
2858
+
2859
+ segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
2860
+ $99472afa7112c427$var$heal_holes(segmented_text);
2861
+ }
2862
+ function $99472afa7112c427$var$heal_holes(segmented_text) {
2863
+ // try to heal "holes" created in the segments so there are only alternating segments
2864
+ const segments_to_delete = new Set();
2865
+ for (let i = 0; i < segmented_text.length; i++) {
2866
+ var _previous_segment, _previous_segment2;
2867
+ const segment = segmented_text[i];
2868
+ let previous_segment;
2869
+ for (let j = i - 1; j >= 0; j--) {
2870
+ previous_segment = segmented_text[j];
2871
+ // Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
2872
+ if (!segments_to_delete.has(previous_segment)) break;
2873
+ }
2874
+ 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) {
2875
+ previous_segment.text_ += segment.text_; // IDK if this ever happens
2876
+ segments_to_delete.add(segment);
2877
+ }
2878
+ }
2879
+ for (const segment of segments_to_delete) {
2880
+ const index = segmented_text.indexOf(segment);
2881
+ segmented_text.splice(index, 1);
2882
+ }
2883
+ }
2884
+ function $99472afa7112c427$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text) {
2885
+ let be_very_aggressive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
2886
+ const should_loop_backwards = index_of_start_segment > index_of_end_segment;
2887
+ const step = should_loop_backwards ? -1 : 1;
2888
+ const desperate_split_attempts = [":", ";", ","];
2889
+ while (desperate_split_attempts.length) {
2890
+ const split_point_between_words = [];
2891
+ // for the middle also try to split with a few more characters if the default ones don't work over a full run
2892
+ const desperate_split_attempt = desperate_split_attempts.pop();
2893
+ let is_first_character = true;
2894
+ for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
2895
+ const segment = segmented_text[i];
2896
+ const text = segment.text_;
2897
+ for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
2898
+ const character = text[j];
2899
+ if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
2900
+ if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
2901
+ split_point_between_words.push([i, j]);
2902
+ if (split_point_between_words.length > 3)
2903
+ // We can't find a split point, so we'll just split between words
2904
+ // 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
2905
+ return split_point_between_words[1];
2906
+ }
2907
+ }
2908
+ }
2909
+ }
2910
+ return [];
2911
+ }
2912
+ function $99472afa7112c427$var$cut_start(cut_left_of_index, segmented_text) {
2913
+ // Cut the start of the text to bring the first matching token
2914
+ let is_first_character = false;
2915
+ let words_encountered = 0;
2916
+ outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
2917
+ const segment = segmented_text[i];
2918
+ // We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
2919
+ const text = segment.text_;
2920
+ for (let j = text.length - 1; j >= 0; j--) {
2921
+ const character = text[j];
2922
+ const is_space = character == " ";
2923
+ if (!is_first_character && is_space) words_encountered++;
2924
+ if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
2925
+ // We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
2926
+ segment.text_ = text.slice(j + 1).trimStart();
2927
+ segmented_text.splice(0, i);
2928
+ if (character === "," || is_space)
2929
+ // if we cut at a comma or psace, we add a … at the beginning
2930
+ segmented_text.unshift({
2931
+ text_: "… ",
2932
+ highlighted_: false
2933
+ });
2934
+ break outmost_loop;
2935
+ }
2936
+ if (is_first_character) is_first_character = false;
2937
+ }
2938
+ }
2939
+ $99472afa7112c427$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
2940
+ }
2941
+
2942
+ function $99472afa7112c427$export$1b00d74faf266c56(text, matched_strings) {
2943
+ let loose = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
2944
+ const output = [];
2945
+ if (!text) return; // shouldn't happen but whatever
2946
+ for (let i = 0; i < text.length; i++) {
2947
+ const found_strings = [];
2948
+ if (!i || text[i - 1] == " " || loose)
2949
+ // only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
2950
+ for (let j = 0; j < matched_strings.length; j++) {
2951
+ const matched_string = matched_strings[j];
2952
+ const part_in_text = text.slice(i, i + matched_string.length);
2953
+ if (matched_string.length < 2 && !loose) continue; // don't match on single characters, i.e. "I", it looks weird
2954
+ 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
2955
+ }
2956
+
2957
+ const last_index_in_output = output.length - 1;
2958
+ if (!found_strings.length) {
2959
+ var _output$last_index_in;
2960
+ const character = text[i];
2961
+ 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))
2962
+ // 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
2963
+ output[last_index_in_output].text_ += character;else output.push({
2964
+ highlighted_: false,
2965
+ text_: character
2966
+ });
2967
+ } else {
2968
+ var _output$last_index_in2;
2969
+ const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
2970
+ 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({
2971
+ highlighted_: true,
2972
+ text_: longest_found_string
2973
+ });
2974
+ i += longest_found_string.length - 1;
2975
+ }
2976
+ }
2977
+ return output;
2978
+ }
2979
+ const $dc5db6bf7093867a$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<span>`),
2980
+ $dc5db6bf7093867a$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class=highlighted-part>`);
2981
+ function $dc5db6bf7093867a$export$8e79c28529dbfa90(props) {
2982
+ const segmented_text = $52FdA$solidjs.createMemo(() => {
2983
+ const {
2984
+ to_highlight_: to_highlight_,
2985
+ text_: text_
2986
+ } = props;
2987
+ return $99472afa7112c427$export$1b00d74faf266c56(text_, to_highlight_ ? [to_highlight_] : [], true);
2988
+ });
2989
+ const has_highlights = $52FdA$solidjs.createMemo(() => segmented_text().some(segment => segment.highlighted_));
2990
+ return (() => {
2991
+ const _el$ = $52FdA$solidjsweb.getNextElement($dc5db6bf7093867a$var$_tmpl$);
2992
+ $52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Index), {
2993
+ get each() {
2994
+ return segmented_text();
2995
+ },
2996
+ children: item => {
2997
+ return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
2998
+ get when() {
2999
+ return item().highlighted_;
3000
+ },
3001
+ get fallback() {
3002
+ return item().text_;
3003
+ },
3004
+ get children() {
3005
+ const _el$2 = $52FdA$solidjsweb.getNextElement($dc5db6bf7093867a$var$_tmpl$2);
3006
+ $52FdA$solidjsweb.insert(_el$2, () => item().text_);
3007
+ return _el$2;
3008
+ }
3009
+ });
3010
+ }
3011
+ }));
3012
+ $52FdA$solidjsweb.effect(_p$ => {
3013
+ const _v$ = props.text_,
3014
+ _v$2 = !!has_highlights();
3015
+ _v$ !== _p$._v$ && $52FdA$solidjsweb.setAttribute(_el$, "title", _p$._v$ = _v$);
3016
+ _v$2 !== _p$._v$2 && _el$.classList.toggle("has-match", _p$._v$2 = _v$2);
3017
+ return _p$;
3018
+ }, {
3019
+ _v$: undefined,
3020
+ _v$2: undefined
3021
+ });
3022
+ return _el$;
3023
+ })();
3024
+ }
3025
+ const $9c1d49181fb3002a$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<form class="checkboxes hierarchical"><!$><!/><!$><!/>`),
3026
+ $9c1d49181fb3002a$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=checkbox-details><!$><!/><!$><!/>`),
3027
+ $9c1d49181fb3002a$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<details>`),
3028
+ $9c1d49181fb3002a$var$_tmpl$4 = /*#__PURE__*/$52FdA$solidjsweb.template(`<summary class=category-parent><div class=summary><span class=count></span><!$><!/>`);
3029
+ const $9c1d49181fb3002a$var$max_visible_without_collapsing = 15;
3030
+ const $9c1d49181fb3002a$var$show_non_collapsible_when_collapsed = 4;
3031
+ function $9c1d49181fb3002a$export$a32086fa6616eafd(_ref) {
3032
+ let {
3033
+ filter_: filter_,
3034
+ selected_filters_: selected_filters_,
3035
+ i18n_: i18n_,
3036
+ view_more_button_below_group_: view_more_button_below_group_,
3037
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
3038
+ filter_query_: filter_query_
3039
+ } = _ref;
3040
+ let form;
3041
+ const existing_filter = $52FdA$solidjs.createMemo(() => {
3042
+ const {
3043
+ field: field,
3044
+ op: op
3045
+ } = filter_();
3046
+ return selected_filters_[0]().find(_ref2 => {
3047
+ let {
3048
+ field: checking_field,
3049
+ op: checking_op
3050
+ } = _ref2;
3051
+ return checking_field === field && checking_op === op;
3052
+ });
3053
+ });
3054
+ const show_extras = $52FdA$solidjs.createSignal(false);
3055
+ const is_being_searched_ = $52FdA$solidjs.createMemo(() => !!(filter_query_ !== null && filter_query_ !== void 0 && filter_query_())); // If the user is searching in the filter
3056
+ const trigger_sync_ = $9c1d49181fb3002a$var$batching_filter_state_syncer({
3057
+ filter_: filter_,
3058
+ existing_filter_: existing_filter,
3059
+ selected_filters_: selected_filters_,
3060
+ get category_structure_() {
3061
+ return structured_categories();
3062
+ }
3063
+ });
3064
+ const structured_categories = $52FdA$solidjs.createMemo(() => {
3065
+ const execute_when_structure_finished = [];
3066
+ const {
3067
+ values: values,
3068
+ names: names,
3069
+ counts: counts
3070
+ } = filter_().meta;
3071
+ const data_structure = {};
3072
+ for (let i = 0; i < values.length; i++) {
3073
+ const value = values[i];
3074
+ let pointer = data_structure;
3075
+ let parent_ = {};
3076
+ let created_an_object = false;
3077
+ for (let j = 0; j < value.length; j++) {
3078
+ var _pointer;
3079
+ const this_categories_name = value[j];
3080
+ const obj = (_pointer = pointer)[this_categories_name] || (_pointer[this_categories_name] = (() => {
3081
+ 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;
3082
+ const created_obj = {
3083
+ name_: names[i],
3084
+ count_: counts === null || counts === void 0 ? void 0 : counts[i],
3085
+ parent_: parent_,
3086
+ is_expanded_: $9c1d49181fb3002a$var$make_expanded_signal({
3087
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
3088
+ filter_value_: value_as_string,
3089
+ is_being_searched_: is_being_searched_
3090
+ }),
3091
+ value_: value_as_string,
3092
+ children_: {}
3093
+ };
3094
+ const {
3095
+ signal_: signal_,
3096
+ on_structure_complete_: on_structure_complete_
3097
+ } = $9c1d49181fb3002a$var$create_updating_signal({
3098
+ self_: created_obj,
3099
+ existing_filter_: $52FdA$solidjs.untrack(existing_filter),
3100
+ trigger_sync_: trigger_sync_
3101
+ });
3102
+ execute_when_structure_finished.push(on_structure_complete_);
3103
+ created_obj.is_checked_ = signal_;
3104
+ parent_ = created_obj;
3105
+ created_an_object = true;
3106
+ return created_obj;
3107
+ })());
3108
+ pointer = obj.children_;
3109
+ parent_ = obj;
3110
+ }
3111
+ if (!created_an_object && "value_" in parent_) {
3112
+ // 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
3113
+ // [
3114
+ // ["Öl", "IPA"],
3115
+ // ["Öl", "Pale Ale"],
3116
+ // ["Öl", "Ale"],
3117
+ // ["Öl", "Mörk Lager"],
3118
+ // ["Öl", "Suröl"],
3119
+ // ["Öl", "Veteöl"],
3120
+ // ["Öl", "Stout och Porter"],
3121
+ // ["Öl"], // <- We are here, our `hierarchical_data_structure[string]`-object was created when we iterated over ["Öl", "IPA"]
3122
+ // ["Öl", "Ljus Lager"],
3123
+ // ];
3124
+ // In this case we want to just correct the name and value of the already created object, which will be in parent_
3125
+ parent_.value_ = value.map(v => v + "");
3126
+ parent_.name_ = names[i];
3127
+ parent_.count_ = counts[i];
3128
+ parent_.is_expanded_ = $9c1d49181fb3002a$var$make_expanded_signal({
3129
+ expanded_hierarchical_filters_: expanded_hierarchical_filters_,
3130
+ filter_value_: parent_.value_,
3131
+ is_being_searched_: is_being_searched_
3132
+ });
3133
+ }
3134
+ }
3135
+ while (execute_when_structure_finished.length) execute_when_structure_finished.pop()();
3136
+ $9c1d49181fb3002a$var$expand_until_choice(data_structure);
3137
+ $52FdA$depictaiutilishared.dlog("CheckboxHierarchicalFilter: Recomputed structured_categories", data_structure);
3138
+ return data_structure;
3139
+ });
3140
+ const some_top_level_are_hidden = $52FdA$solidjs.createMemo(() => Object.keys(structured_categories()).length > $9c1d49181fb3002a$var$max_visible_without_collapsing);
3141
+ const {
3142
+ expand: expand,
3143
+ collapse: collapse,
3144
+ ExpandingContainer: ExpandingContainer
3145
+ } = $d6d51b09cb2116a6$export$5bad61ecde080b1f({
3146
+ duration: 200
3147
+ });
3148
+ const expanding_container_els = $52FdA$solidjsweb.createComponent(ExpandingContainer, {
3149
+ get children() {
3150
+ return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
3151
+ get when() {
3152
+ return some_top_level_are_hidden();
3153
+ },
3154
+ get children() {
3155
+ return $9c1d49181fb3002a$var$render_stuff($52FdA$solidjs.createMemo(() => Object.fromEntries(Object.entries(structured_categories()).slice($9c1d49181fb3002a$var$show_non_collapsible_when_collapsed))), existing_filter, i18n_, filter_query_);
3156
+ }
3157
+ });
2783
3158
  }
2784
3159
  });
2785
3160
  $52FdA$solidjs.createRenderEffect(() => {
@@ -2803,13 +3178,13 @@ function $9c1d49181fb3002a$export$a32086fa6616eafd(_ref) {
2803
3178
  [_el$5, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$4.nextSibling);
2804
3179
  const _ref$ = form;
2805
3180
  typeof _ref$ === "function" ? $52FdA$solidjsweb.use(_ref$, _el$) : form = _el$;
2806
- $52FdA$solidjsweb.insert(_el$, () => $9c1d49181fb3002a$var$render_stuff($52FdA$solidjs.createMemo(() => some_top_level_are_hidden() ? Object.fromEntries(Object.entries(structured_categories()).slice(0, $9c1d49181fb3002a$var$show_non_collapsible_when_collapsed)) : structured_categories()), existing_filter, i18n_), _el$3, _co$);
3181
+ $52FdA$solidjsweb.insert(_el$, () => $9c1d49181fb3002a$var$render_stuff($52FdA$solidjs.createMemo(() => some_top_level_are_hidden() ? Object.fromEntries(Object.entries(structured_categories()).slice(0, $9c1d49181fb3002a$var$show_non_collapsible_when_collapsed)) : structured_categories()), existing_filter, i18n_, filter_query_), _el$3, _co$);
2807
3182
  $52FdA$solidjsweb.insert(_el$, expanding_container_els, _el$5, _co$2);
2808
3183
  $52FdA$solidjsweb.effect(() => _el$.classList.toggle("any-expandable", !!Object.values(structured_categories()).some(category => Object.keys(category.children_).length)));
2809
3184
  return _el$;
2810
3185
  })();
2811
3186
  }
2812
- function $9c1d49181fb3002a$var$render_stuff(data, existing_filter, i18n_) {
3187
+ function $9c1d49181fb3002a$var$render_stuff(data, existing_filter, i18n_, filter_query_) {
2813
3188
  const keys = $52FdA$solidjs.createMemo(() => Object.keys(data()));
2814
3189
  return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.For), {
2815
3190
  get each() {
@@ -2827,6 +3202,14 @@ function $9c1d49181fb3002a$var$render_stuff(data, existing_filter, i18n_) {
2827
3202
  var _value;
2828
3203
  return !!Object.keys(((_value = value()) === null || _value === void 0 ? void 0 : _value.children_) || {}).length;
2829
3204
  });
3205
+ const value_as_string = $52FdA$solidjs.createMemo(() => {
3206
+ var _value2;
3207
+ return JSON.stringify((_value2 = value()) === null || _value2 === void 0 ? void 0 : _value2.value_);
3208
+ });
3209
+ const label_text = $52FdA$solidjs.createMemo(() => {
3210
+ var _value3;
3211
+ return ((_value3 = value()) === null || _value3 === void 0 ? void 0 : _value3.name_) || value_as_string();
3212
+ });
2830
3213
  return (() => {
2831
3214
  const _el$6 = $52FdA$solidjsweb.getNextElement($9c1d49181fb3002a$var$_tmpl$2),
2832
3215
  _el$7 = _el$6.firstChild,
@@ -2835,12 +3218,17 @@ function $9c1d49181fb3002a$var$render_stuff(data, existing_filter, i18n_) {
2835
3218
  [_el$10, _co$4] = $52FdA$solidjsweb.getNextMarker(_el$9.nextSibling);
2836
3219
  $52FdA$solidjsweb.insert(_el$6, $52FdA$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
2837
3220
  get value_() {
2838
- var _value2;
2839
- return JSON.stringify((_value2 = value()) === null || _value2 === void 0 ? void 0 : _value2.value_);
3221
+ return value_as_string();
2840
3222
  },
2841
3223
  get label_() {
2842
- var _value3;
2843
- return (_value3 = value()) === null || _value3 === void 0 ? void 0 : _value3.name_;
3224
+ return $52FdA$solidjsweb.createComponent((0, $dc5db6bf7093867a$export$8e79c28529dbfa90), {
3225
+ get text_() {
3226
+ return label_text();
3227
+ },
3228
+ get to_highlight_() {
3229
+ return filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_();
3230
+ }
3231
+ });
2844
3232
  },
2845
3233
  get count_() {
2846
3234
  var _value4;
@@ -2940,7 +3328,7 @@ function $9c1d49181fb3002a$var$render_stuff(data, existing_filter, i18n_) {
2940
3328
  return $9c1d49181fb3002a$var$render_stuff($52FdA$solidjs.createMemo(() => {
2941
3329
  var _value13;
2942
3330
  return ((_value13 = value()) === null || _value13 === void 0 ? void 0 : _value13.children_) || {};
2943
- }), existing_filter, i18n_);
3331
+ }), existing_filter, i18n_, filter_query_);
2944
3332
  }
2945
3333
  });
2946
3334
  })();
@@ -3058,7 +3446,8 @@ function $9c1d49181fb3002a$var$make_expanded_signal(_ref5) {
3058
3446
  var _untrack$untrack;
3059
3447
  let {
3060
3448
  expanded_hierarchical_filters_: [read_expanded_hierarchical_filters, write_expanded_hierarchical_filters],
3061
- filter_value_: filter_value_
3449
+ filter_value_: filter_value_,
3450
+ is_being_searched_: is_being_searched_
3062
3451
  } = _ref5;
3063
3452
  const index_in_expanded_filters = $52FdA$solidjs.createMemo(() => read_expanded_hierarchical_filters().findIndex(_ref6 => {
3064
3453
  let {
@@ -3101,9 +3490,11 @@ function $9c1d49181fb3002a$var$make_expanded_signal(_ref5) {
3101
3490
  defer: true
3102
3491
  }));
3103
3492
  return {
3104
- ui_should_show_expanded_: $52FdA$solidjs.createMemo(() => {
3493
+ ui_should_show_expanded_: $52FdA$solidjs.createMemo(
3494
+ // When user is searching through filters, expand everything they haven't collapsed, so they can see the results
3495
+ () => {
3105
3496
  var _user_choice_signal$;
3106
- return (_user_choice_signal$ = user_choice_signal[0]()) !== null && _user_choice_signal$ !== void 0 ? _user_choice_signal$ : get_low_precedence_expanded();
3497
+ return (_user_choice_signal$ = user_choice_signal[0]()) !== null && _user_choice_signal$ !== void 0 ? _user_choice_signal$ : is_being_searched_() || get_low_precedence_expanded();
3107
3498
  }),
3108
3499
  set_low_precedence_expanded_: set_low_precedence_expanded,
3109
3500
  set_user_expanded_: set_user_choice_expanded
@@ -3134,7 +3525,9 @@ const $cd0e5524f9476f9b$var$max_columns = 3;
3134
3525
  const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
3135
3526
  let {
3136
3527
  filter_: filter_,
3137
- selected_filters_: [get_selected_filters, set_selected_filters]
3528
+ selected_filters_: [get_selected_filters, set_selected_filters],
3529
+ filter_query_: filter_query_,
3530
+ details_element_width_: details_element_width_
3138
3531
  } = _ref;
3139
3532
  const existing_filter = $52FdA$solidjs.createMemo(() => {
3140
3533
  const {
@@ -3168,7 +3561,7 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
3168
3561
  const container_width_accessor = $52FdA$solidjs.createMemo(() => {
3169
3562
  const element = container();
3170
3563
  if (!element) return;
3171
- return $13671aa5e984acd9$export$9f191182275e9ef(element);
3564
+ return $c387d7f1d9fb66c0$export$ebdc3711f7e02ccd(element);
3172
3565
  });
3173
3566
  const [shadow_children, set_shadow_children] = $52FdA$solidjs.createSignal(new Set(), {
3174
3567
  equals: false
@@ -3180,11 +3573,11 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
3180
3573
  })(); // for getting the smallest possible sizes of all the items
3181
3574
  $52FdA$solidjs.createEffect(() => {
3182
3575
  var _container_width_acce;
3183
- const container_width = (_container_width_acce = container_width_accessor()) === null || _container_width_acce === void 0 ? void 0 : _container_width_acce();
3184
- if (container_width == undefined) return;
3576
+ const container_width = ((_container_width_acce = container_width_accessor()) === null || _container_width_acce === void 0 ? void 0 : _container_width_acce()) || details_element_width_();
3577
+ 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
3185
3578
  $cd0e5524f9476f9b$var$adjust_sizes(container_width, sizes_set(), set_cols_at_size);
3186
3579
  });
3187
- return [shadow_grid, $52FdA$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), {
3580
+ return [$52FdA$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), {
3188
3581
  get cols_at_size() {
3189
3582
  return cols_at_size();
3190
3583
  },
@@ -3207,66 +3600,72 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
3207
3600
  const current_value = $e2d74bb03cc5252e$export$325f75597868c4f0(value().value_);
3208
3601
  return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === current_value));
3209
3602
  });
3210
- const MakeButton = attributes => (() => {
3211
- const _el$2 = $52FdA$solidjsweb.getNextElement($cd0e5524f9476f9b$var$_tmpl$3),
3212
- _el$5 = _el$2.firstChild,
3213
- [_el$6, _co$] = $52FdA$solidjsweb.getNextMarker(_el$5.nextSibling),
3214
- _el$7 = _el$6.nextSibling,
3215
- [_el$8, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$7.nextSibling);
3216
- $52FdA$solidjsweb.spread(_el$2, $52FdA$solidjsweb.mergeProps(attributes, {
3217
- get disabled() {
3218
- return $52FdA$solidjsweb.memo(() => value().count_ === 0)() && !is_selected();
3219
- },
3220
- get classList() {
3221
- return {
3222
- minor: !is_selected(),
3223
- major: is_selected(),
3224
- "major-minor-transition": true
3225
- };
3226
- },
3227
- get onClick() {
3228
- return $52FdA$depictaiutilishared.catchify(() => {
3229
- const set_filter = existing_filter();
3230
- const {
3231
- field: field,
3232
- op: op
3233
- } = filter_();
3234
- const base_object = set_filter ? set_filter : {
3235
- op: op,
3236
- field: field
3237
- };
3238
- const old_data = base_object.data;
3239
- const new_data = [...(Array.isArray(old_data) ? [...old_data] : old_data ? [old_data] : [])];
3240
- const new_filter_object = {
3241
- ...base_object,
3242
- data: new_data
3603
+ const MakeButton = attributes => {
3604
+ const label = $52FdA$solidjs.createMemo(() => value().name_ || value().value_ + "");
3605
+ return (() => {
3606
+ const _el$2 = $52FdA$solidjsweb.getNextElement($cd0e5524f9476f9b$var$_tmpl$3),
3607
+ _el$5 = _el$2.firstChild,
3608
+ [_el$6, _co$] = $52FdA$solidjsweb.getNextMarker(_el$5.nextSibling),
3609
+ _el$7 = _el$6.nextSibling,
3610
+ [_el$8, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$7.nextSibling);
3611
+ $52FdA$solidjsweb.spread(_el$2, $52FdA$solidjsweb.mergeProps(attributes, {
3612
+ get disabled() {
3613
+ return $52FdA$solidjsweb.memo(() => value().count_ === 0)() && !is_selected();
3614
+ },
3615
+ get classList() {
3616
+ return {
3617
+ minor: !is_selected(),
3618
+ major: is_selected(),
3619
+ "major-minor-transition": true
3243
3620
  };
3244
- if (!is_selected()) new_filter_object.data.push(value().value_);else {
3245
- const current_value_lower = $e2d74bb03cc5252e$export$325f75597868c4f0(value().value_);
3246
- new_filter_object.data = new_filter_object.data.filter(v => $e2d74bb03cc5252e$export$325f75597868c4f0(v) !== current_value_lower);
3247
- }
3248
- const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
3249
- set_selected_filters(selected_filters);
3250
- });
3251
- }
3252
- }), false, true);
3253
- $52FdA$solidjsweb.insert(_el$2, () => value().value_, _el$6, _co$);
3254
- $52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
3255
- get when() {
3256
- return value().count_ != undefined;
3257
- },
3258
- get children() {
3259
- const _el$3 = $52FdA$solidjsweb.getNextElement($cd0e5524f9476f9b$var$_tmpl$2),
3260
- _el$4 = _el$3.firstChild;
3261
- $52FdA$solidjsweb.insert(_el$4, () => value().count_);
3262
- return _el$3;
3263
- }
3264
- }), _el$8, _co$2);
3265
- $52FdA$solidjsweb.runHydrationEvents();
3266
- return _el$2;
3267
- })();
3621
+ },
3622
+ get onClick() {
3623
+ return $52FdA$depictaiutilishared.catchify(() => {
3624
+ const set_filter = existing_filter();
3625
+ const {
3626
+ field: field,
3627
+ op: op
3628
+ } = filter_();
3629
+ const base_object = set_filter ? set_filter : {
3630
+ op: op,
3631
+ field: field
3632
+ };
3633
+ const old_data = base_object.data;
3634
+ const new_data = [...(Array.isArray(old_data) ? [...old_data] : old_data ? [old_data] : [])];
3635
+ const new_filter_object = {
3636
+ ...base_object,
3637
+ data: new_data
3638
+ };
3639
+ if (!is_selected()) new_filter_object.data.push(value().value_);else {
3640
+ const current_value_lower = $e2d74bb03cc5252e$export$325f75597868c4f0(value().value_);
3641
+ new_filter_object.data = new_filter_object.data.filter(v => $e2d74bb03cc5252e$export$325f75597868c4f0(v) !== current_value_lower);
3642
+ }
3643
+ const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
3644
+ set_selected_filters(selected_filters);
3645
+ });
3646
+ }
3647
+ }), false, true);
3648
+ $52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $23c3f390dee33ff8$export$ba17c5b7e6dda39f), {
3649
+ whole_text_to_display_: label,
3650
+ searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
3651
+ }), _el$6, _co$);
3652
+ $52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
3653
+ get when() {
3654
+ return value().count_ != undefined;
3655
+ },
3656
+ get children() {
3657
+ const _el$3 = $52FdA$solidjsweb.getNextElement($cd0e5524f9476f9b$var$_tmpl$2),
3658
+ _el$4 = _el$3.firstChild;
3659
+ $52FdA$solidjsweb.insert(_el$4, () => value().count_);
3660
+ return _el$3;
3661
+ }
3662
+ }), _el$8, _co$2);
3663
+ $52FdA$solidjsweb.runHydrationEvents();
3664
+ return _el$2;
3665
+ })();
3666
+ };
3268
3667
  const invisible_size_button = $52FdA$solidjsweb.createComponent(MakeButton, {});
3269
- const smallest_possible_size = $13671aa5e984acd9$export$9f191182275e9ef(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
3668
+ const smallest_possible_size = $c387d7f1d9fb66c0$export$ebdc3711f7e02ccd(invisible_size_button); // create ResizeObserver for the invisible size button where the div hugs its content
3270
3669
  const sizes_value = $52FdA$solidjs.untrack(sizes_set);
3271
3670
  const shadow_children_value = $52FdA$solidjs.untrack(shadow_children);
3272
3671
  sizes_value.add(smallest_possible_size);
@@ -3286,7 +3685,7 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
3286
3685
  }
3287
3686
  });
3288
3687
  }
3289
- })];
3688
+ }), shadow_grid];
3290
3689
  };
3291
3690
  /**
3292
3691
  * Calculate and apply cols_at_size overrides to fit as many items as possible in a row, evenly spaced
@@ -3354,7 +3753,8 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
3354
3753
  filter_: filter_,
3355
3754
  selected_filters_: [get_selected_filters, set_selected_filters],
3356
3755
  i18n_: i18n_,
3357
- view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_]
3756
+ view_more_button_below_group_: [_get_view_more_button_below_group_, set_view_more_button_below_group_],
3757
+ filter_query_: filter_query_
3358
3758
  } = _ref;
3359
3759
  // same as in CheckboxFilter, maybe we should make this DRY at some point
3360
3760
  const existing_filter = $52FdA$solidjs.createMemo(() => {
@@ -3399,12 +3799,17 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
3399
3799
  const value = $e2d74bb03cc5252e$export$325f75597868c4f0(checkbox().value_);
3400
3800
  return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === value));
3401
3801
  });
3802
+ const value = $52FdA$solidjs.createMemo(() => checkbox().value_);
3803
+ const label_text = $52FdA$solidjs.createMemo(() => checkbox().name_ || value() + "");
3402
3804
  const input_row = $52FdA$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
3403
3805
  get value_() {
3404
- return checkbox().value_;
3806
+ return value();
3405
3807
  },
3406
3808
  get label_() {
3407
- return checkbox().name_;
3809
+ return $52FdA$solidjsweb.createComponent((0, $23c3f390dee33ff8$export$ba17c5b7e6dda39f), {
3810
+ whole_text_to_display_: label_text,
3811
+ searching_for_value_: () => filter_query_ === null || filter_query_ === void 0 ? void 0 : filter_query_()
3812
+ });
3408
3813
  },
3409
3814
  get count_() {
3410
3815
  return checkbox().count_;
@@ -3720,10 +4125,174 @@ function $a7f7d416e6f61504$export$89c6019e4baa40b1(props) {
3720
4125
  }
3721
4126
  });
3722
4127
  }
4128
+ const $5b88b077e48a4451$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.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">`);
4129
+ function $5b88b077e48a4451$export$82eafebb825fc23f() {
4130
+ let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4131
+ return (() => {
4132
+ const _el$ = $52FdA$solidjsweb.getNextElement($5b88b077e48a4451$var$_tmpl$);
4133
+ $52FdA$solidjsweb.spread(_el$, props, true, true);
4134
+ $52FdA$solidjsweb.runHydrationEvents();
4135
+ return _el$;
4136
+ })();
4137
+ }
4138
+ const $8e7ac26c00243687$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=search-in-filters><input type=text class=query><!$><!/><button class=clear>`);
4139
+ const $8e7ac26c00243687$var$min_items_to_enable_filter_searching = 10; // For checkbox hierarchical we 2x this
4140
+ function $8e7ac26c00243687$export$4b2c5292ffe0c5dd(filter_array_, section, i18n_) {
4141
+ const [filter_query_, set_filter_query_] = $52FdA$solidjs.createSignal();
4142
+ // Check if we have enough items to enable searching
4143
+ const enable_searchability = $52FdA$solidjs.createMemo(() => {
4144
+ let count = 0;
4145
+ for (const filter of filter_array_()) {
4146
+ var _filter$meta;
4147
+ const type = (_filter$meta = filter.meta) === null || _filter$meta === void 0 ? void 0 : _filter$meta.type;
4148
+ if (type === "range") continue;
4149
+ const length = filter.meta.values.length;
4150
+ 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
4151
+ }
4152
+
4153
+ return count >= $8e7ac26c00243687$var$min_items_to_enable_filter_searching;
4154
+ });
4155
+ const SearchThisFilterGroup_ = () => {
4156
+ return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
4157
+ get when() {
4158
+ return enable_searchability();
4159
+ },
4160
+ get children() {
4161
+ const _el$ = $52FdA$solidjsweb.getNextElement($8e7ac26c00243687$var$_tmpl$),
4162
+ _el$2 = _el$.firstChild,
4163
+ _el$4 = _el$2.nextSibling,
4164
+ [_el$5, _co$] = $52FdA$solidjsweb.getNextMarker(_el$4.nextSibling),
4165
+ _el$3 = _el$5.nextSibling;
4166
+ _el$2.$$input = ev => set_filter_query_(ev.currentTarget.value);
4167
+ $52FdA$solidjsweb.insert(_el$, $52FdA$solidjsweb.createComponent((0, $5b88b077e48a4451$export$82eafebb825fc23f), {
4168
+ width: "16",
4169
+ height: "17.6",
4170
+ "class": "search-icon"
4171
+ }), _el$5, _co$);
4172
+ _el$3.$$click = () => set_filter_query_();
4173
+ $52FdA$solidjsweb.insert(_el$3, $52FdA$solidjsweb.createComponent((0, $083b2336093176cf$export$3b621d86b1566b2), {
4174
+ width: "12",
4175
+ height: "12"
4176
+ }));
4177
+ $52FdA$solidjsweb.effect(_p$ => {
4178
+ const _v$ = i18n_.search_a_filter_()(section),
4179
+ _v$2 = filter_query_() ? "" : "none";
4180
+ _v$ !== _p$._v$ && $52FdA$solidjsweb.setAttribute(_el$2, "placeholder", _p$._v$ = _v$);
4181
+ _v$2 !== _p$._v$2 && ((_p$._v$2 = _v$2) != null ? _el$3.style.setProperty("display", _v$2) : _el$3.style.removeProperty("display"));
4182
+ return _p$;
4183
+ }, {
4184
+ _v$: undefined,
4185
+ _v$2: undefined
4186
+ });
4187
+ $52FdA$solidjsweb.effect(() => $52FdA$solidjsweb.setProperty(_el$2, "value", filter_query_() || ""));
4188
+ $52FdA$solidjsweb.runHydrationEvents();
4189
+ return _el$;
4190
+ }
4191
+ });
4192
+ };
4193
+ const searched_filter_array_ = $52FdA$solidjs.createMemo(() => {
4194
+ const query = filter_query_();
4195
+ if (!enable_searchability() || !query) return filter_array_();
4196
+ const lowercase_query = query.toLowerCase();
4197
+ const check_string_match = to_check => {
4198
+ to_check = to_check.toLowerCase();
4199
+ return to_check.includes(lowercase_query) || lowercase_query.includes(to_check);
4200
+ };
4201
+ return filter_array_().map(filter => {
4202
+ var _filter$meta2, _meta$names;
4203
+ const type = (_filter$meta2 = filter.meta) === null || _filter$meta2 === void 0 ? void 0 : _filter$meta2.type;
4204
+ 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
4205
+ const meta = filter.meta;
4206
+ const {
4207
+ values: values,
4208
+ names: names,
4209
+ counts: counts
4210
+ } = meta;
4211
+ 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
4212
+ const is_hierarchical_checkbox = type === "checkbox-hierarchical";
4213
+ // Which index of counts, values and names should be kept
4214
+ const filtered_indexes = values.map((item, index) => {
4215
+ const item_from_names = names === null || names === void 0 ? void 0 : names[index];
4216
+ if (item_from_names && !is_hierarchical_checkbox)
4217
+ // 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
4218
+ item = item_from_names;
4219
+ if (typeof item === "number") return true;
4220
+ if (is_hierarchical_checkbox && names)
4221
+ // Special case for hierarchical checkboxes where we need to check if any of the names in the path match the query
4222
+ item = item.map((_, index) => names[$8e7ac26c00243687$var$find_str_arr_in_str_arr_arr("findIndex", values, item.slice(0, index + 1))]);
4223
+ if (Array.isArray(item)) return item.some(item => check_string_match(item + "")); // If any of the items in the array match, keep it
4224
+ return check_string_match(item);
4225
+ });
4226
+ const new_values = values.filter((_, i) => filtered_indexes[i]);
4227
+ if (!new_values.length) return false; // false = please delete this filter, see below
4228
+ const new_filter_object = {
4229
+ ...filter,
4230
+ meta: {
4231
+ ...meta,
4232
+ counts: counts === null || counts === void 0 ? void 0 : counts.filter((_, i) => filtered_indexes[i]),
4233
+ ...(names ? {
4234
+ names: (_meta$names = meta.names) === null || _meta$names === void 0 ? void 0 : _meta$names.filter((_, i) => filtered_indexes[i])
4235
+ } : {}),
4236
+ values: new_values
4237
+ }
4238
+ };
4239
+ if (is_hierarchical_checkbox) {
4240
+ // For hierarchical checkbox we need to fill the holes created by filtering, for example if there is
4241
+ // ["Clothes"]
4242
+ // ["Clothes", "Blazers"]
4243
+ // And the user searched for "blazers" we need to add back ["Clothes"] so CheckboxHierarchicalFilter doesn't get confused
4244
+ // 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
4245
+ // So we do it here instead
4246
+ const new_meta = new_filter_object.meta;
4247
+ const new_values = new_meta.values;
4248
+ for (const value of new_values) {
4249
+ if (!Array.isArray(value)) continue; // Shouldn't happen
4250
+ if (value.length < 2) continue; // No parent
4251
+ const parent = value.slice(0, -1);
4252
+ // Check if parent exists
4253
+ if ($8e7ac26c00243687$var$find_str_arr_in_str_arr_arr("some", new_values, parent)) continue; // Parent exists
4254
+ // Otherwise, put it back
4255
+ const index_to_restore = $8e7ac26c00243687$var$find_str_arr_in_str_arr_arr("findIndex", values, parent);
4256
+ if (index_to_restore < 0) {
4257
+ $52FdA$depictaiutilishared.dwarn("Can't restore", parent, "to", new_values);
4258
+ continue;
4259
+ }
4260
+ const current_index_of_us = new_values.findIndex(item => item === value);
4261
+ new_values.splice(current_index_of_us, 0, values[index_to_restore]);
4262
+ const count_to_restore = counts === null || counts === void 0 ? void 0 : counts[index_to_restore];
4263
+ if (count_to_restore) {
4264
+ var _new_meta$counts;
4265
+ (_new_meta$counts = new_meta.counts) === null || _new_meta$counts === void 0 || _new_meta$counts.splice(current_index_of_us, 0, count_to_restore);
4266
+ }
4267
+ const name_to_restore = names === null || names === void 0 ? void 0 : names[index_to_restore];
4268
+ if (name_to_restore) {
4269
+ var _new_meta$names;
4270
+ (_new_meta$names = new_meta.names) === null || _new_meta$names === void 0 || _new_meta$names.splice(current_index_of_us, 0, name_to_restore);
4271
+ }
4272
+ }
4273
+ }
4274
+ return new_filter_object;
4275
+ }).filter(filter => filter); // Delete filters that don't have a value anymore
4276
+ });
4277
+
4278
+ return {
4279
+ SearchThisFilterGroup_: SearchThisFilterGroup_,
4280
+ searched_filter_array_: searched_filter_array_,
4281
+ filter_query_: filter_query_
4282
+ };
4283
+ }
4284
+ /**
4285
+ * Finds/whatevers what's effectively one hierarchical filter item in an array of hierarchical filter items
4286
+ * Functions similar to this happen loads in create_modified_filters, but they have additional checks so not touching them RN
4287
+ */
4288
+ function $8e7ac26c00243687$var$find_str_arr_in_str_arr_arr(operation, haystack, needle) {
4289
+ return haystack[operation](value => value.length === needle.length && value.every((item, index) => item === needle[index]));
4290
+ }
4291
+ $52FdA$solidjsweb.delegateEvents(["input", "click"]);
3723
4292
  const $164d474fea221d77$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=filter-collapsible>`),
3724
4293
  $164d474fea221d77$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<button class=clear-group><!$><!/><span>`),
3725
4294
  $164d474fea221d77$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=view-more-clear><!$><!/><!$><!/>`),
3726
- $164d474fea221d77$var$_tmpl$4 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=filter-collapsible-body><div class=filter-part></div><!$><!/>`),
4295
+ $164d474fea221d77$var$_tmpl$4 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=filter-collapsible-body><div class=filter-part><!$><!/><!$><!/></div><!$><!/>`),
3727
4296
  $164d474fea221d77$var$_tmpl$5 = /*#__PURE__*/$52FdA$solidjsweb.template(`<details class=filter-collapsible>`),
3728
4297
  $164d474fea221d77$var$_tmpl$6 = /*#__PURE__*/$52FdA$solidjsweb.template(`<summary class=filter-group-summary><div class=summary><span></span><div class=selected-w-sign><!$><!/><!$><!/>`),
3729
4298
  $164d474fea221d77$var$_tmpl$7 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=ungrouped>`),
@@ -3784,6 +4353,11 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3784
4353
  const filter_array_ = $52FdA$solidjs.createMemo(() => {
3785
4354
  return Object.values(togglable_filters_grouped_by_collapsible())[get_section_index()];
3786
4355
  });
4356
+ const {
4357
+ SearchThisFilterGroup_: SearchThisFilterGroup_,
4358
+ searched_filter_array_: searched_filter_array_,
4359
+ filter_query_: filter_query_
4360
+ } = $8e7ac26c00243687$export$4b2c5292ffe0c5dd(filter_array_, section_, props.i18n_);
3787
4361
  const is_open = $4c1dcf1a9c604a68$export$ab34afce88557c0e({
3788
4362
  get expanded_filters_() {
3789
4363
  return props.expanded_filters_;
@@ -3799,27 +4373,33 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3799
4373
  return selected_filter;
3800
4374
  })));
3801
4375
  const a_filter_is_selected = $52FdA$solidjs.createMemo(() => selected_filters_in_group().size);
4376
+ const [get_details_width, set_get_details_width] = $52FdA$solidjs.createSignal();
4377
+ const details_element_width_ = $52FdA$solidjs.createMemo(() => {
4378
+ var _get_details_width;
4379
+ 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();
4380
+ });
3802
4381
  return $52FdA$solidjsweb.createComponent((0, $4cfe8400ed3f92c4$export$6c6d7a51fa9aa15d), {
3803
4382
  is_open_: is_open,
3804
4383
  get details_() {
3805
4384
  return (() => {
3806
- const _el$15 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$5);
3807
- $52FdA$solidjsweb.setAttribute(_el$15, "data-group-title", section_);
3808
- return _el$15;
4385
+ const _el$19 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$5);
4386
+ $52FdA$solidjsweb.use(element => set_get_details_width(() => $c387d7f1d9fb66c0$export$ebdc3711f7e02ccd(element)), _el$19);
4387
+ $52FdA$solidjsweb.setAttribute(_el$19, "data-group-title", section_);
4388
+ return _el$19;
3809
4389
  })();
3810
4390
  },
3811
4391
  get summary_() {
3812
4392
  return (() => {
3813
- const _el$16 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$6),
3814
- _el$17 = _el$16.firstChild,
3815
- _el$18 = _el$17.firstChild,
3816
- _el$19 = _el$18.nextSibling,
3817
- _el$20 = _el$19.firstChild,
3818
- [_el$21, _co$5] = $52FdA$solidjsweb.getNextMarker(_el$20.nextSibling),
3819
- _el$22 = _el$21.nextSibling,
3820
- [_el$23, _co$6] = $52FdA$solidjsweb.getNextMarker(_el$22.nextSibling);
3821
- $52FdA$solidjsweb.insert(_el$18, section_);
3822
- $52FdA$solidjsweb.insert(_el$19, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
4393
+ const _el$20 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$6),
4394
+ _el$21 = _el$20.firstChild,
4395
+ _el$22 = _el$21.firstChild,
4396
+ _el$23 = _el$22.nextSibling,
4397
+ _el$24 = _el$23.firstChild,
4398
+ [_el$25, _co$7] = $52FdA$solidjsweb.getNextMarker(_el$24.nextSibling),
4399
+ _el$26 = _el$25.nextSibling,
4400
+ [_el$27, _co$8] = $52FdA$solidjsweb.getNextMarker(_el$26.nextSibling);
4401
+ $52FdA$solidjsweb.insert(_el$22, section_);
4402
+ $52FdA$solidjsweb.insert(_el$23, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
3823
4403
  get when() {
3824
4404
  return a_filter_is_selected();
3825
4405
  },
@@ -3831,26 +4411,31 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3831
4411
  }
3832
4412
  });
3833
4413
  }
3834
- }), _el$21, _co$5);
3835
- $52FdA$solidjsweb.insert(_el$19, $52FdA$solidjsweb.createComponent((0, $ac040bdfeed58ee4$export$e5c2828934226505), {
4414
+ }), _el$25, _co$7);
4415
+ $52FdA$solidjsweb.insert(_el$23, $52FdA$solidjsweb.createComponent((0, $ac040bdfeed58ee4$export$e5c2828934226505), {
3836
4416
  get expanded_() {
3837
4417
  return is_open[0];
3838
4418
  },
3839
4419
  get i18n_() {
3840
4420
  return props.i18n_;
3841
4421
  }
3842
- }), _el$23, _co$6);
3843
- return _el$16;
4422
+ }), _el$27, _co$8);
4423
+ return _el$20;
3844
4424
  })();
3845
4425
  },
3846
4426
  get children() {
3847
4427
  const _el$2 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$4),
3848
4428
  _el$3 = _el$2.firstChild,
3849
- _el$13 = _el$3.nextSibling,
3850
- [_el$14, _co$4] = $52FdA$solidjsweb.getNextMarker(_el$13.nextSibling);
4429
+ _el$4 = _el$3.firstChild,
4430
+ [_el$5, _co$] = $52FdA$solidjsweb.getNextMarker(_el$4.nextSibling),
4431
+ _el$6 = _el$5.nextSibling,
4432
+ [_el$7, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$6.nextSibling),
4433
+ _el$17 = _el$3.nextSibling,
4434
+ [_el$18, _co$6] = $52FdA$solidjsweb.getNextMarker(_el$17.nextSibling);
4435
+ $52FdA$solidjsweb.insert(_el$3, $52FdA$solidjsweb.createComponent(SearchThisFilterGroup_, {}), _el$5, _co$);
3851
4436
  $52FdA$solidjsweb.insert(_el$3, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Index), {
3852
4437
  get each() {
3853
- return filter_array_();
4438
+ return searched_filter_array_();
3854
4439
  },
3855
4440
  children: filter => $52FdA$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
3856
4441
  severity_: "error",
@@ -3873,11 +4458,13 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3873
4458
  get i18n_() {
3874
4459
  return props.i18n_;
3875
4460
  },
3876
- view_more_button_below_group_: view_more_button_below_group
4461
+ view_more_button_below_group_: view_more_button_below_group,
4462
+ filter_query_: filter_query_,
4463
+ details_element_width_: details_element_width_
3877
4464
  });
3878
4465
  }
3879
4466
  })
3880
- }));
4467
+ }), _el$7, _co$2);
3881
4468
  $52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
3882
4469
  get when() {
3883
4470
  return $52FdA$solidjs.createMemo(() => {
@@ -3886,22 +4473,22 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3886
4473
  })();
3887
4474
  },
3888
4475
  get children() {
3889
- const _el$4 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$3),
3890
- _el$9 = _el$4.firstChild,
3891
- [_el$10, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$9.nextSibling),
3892
- _el$11 = _el$10.nextSibling,
3893
- [_el$12, _co$3] = $52FdA$solidjsweb.getNextMarker(_el$11.nextSibling);
3894
- $52FdA$solidjsweb.insert(_el$4, () => view_more_button_below_group[0](), _el$10, _co$2);
3895
- $52FdA$solidjsweb.insert(_el$4, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
4476
+ const _el$8 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$3),
4477
+ _el$13 = _el$8.firstChild,
4478
+ [_el$14, _co$4] = $52FdA$solidjsweb.getNextMarker(_el$13.nextSibling),
4479
+ _el$15 = _el$14.nextSibling,
4480
+ [_el$16, _co$5] = $52FdA$solidjsweb.getNextMarker(_el$15.nextSibling);
4481
+ $52FdA$solidjsweb.insert(_el$8, () => view_more_button_below_group[0](), _el$14, _co$4);
4482
+ $52FdA$solidjsweb.insert(_el$8, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
3896
4483
  get when() {
3897
4484
  return a_filter_is_selected();
3898
4485
  },
3899
4486
  get children() {
3900
- const _el$5 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$2),
3901
- _el$7 = _el$5.firstChild,
3902
- [_el$8, _co$] = $52FdA$solidjsweb.getNextMarker(_el$7.nextSibling),
3903
- _el$6 = _el$8.nextSibling;
3904
- $52FdA$solidjsweb.addEventListener(_el$5, "click", $52FdA$depictaiutilishared.catchify(() => {
4487
+ const _el$9 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$2),
4488
+ _el$11 = _el$9.firstChild,
4489
+ [_el$12, _co$3] = $52FdA$solidjsweb.getNextMarker(_el$11.nextSibling),
4490
+ _el$10 = _el$12.nextSibling;
4491
+ $52FdA$solidjsweb.addEventListener(_el$9, "click", $52FdA$depictaiutilishared.catchify(() => {
3905
4492
  const new_filter_obj = [...props.selected_filters_[0]()];
3906
4493
  for (const filter of filter_array_()) {
3907
4494
  const index = new_filter_obj.findIndex(_ref2 => {
@@ -3915,15 +4502,15 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3915
4502
  }
3916
4503
  props.selected_filters_[1](new_filter_obj);
3917
4504
  }), true);
3918
- $52FdA$solidjsweb.insert(_el$5, $52FdA$solidjsweb.createComponent((0, $083b2336093176cf$export$3b621d86b1566b2), {}), _el$8, _co$);
3919
- $52FdA$solidjsweb.insert(_el$6, () => props.i18n_.clear_individual_filter_());
4505
+ $52FdA$solidjsweb.insert(_el$9, $52FdA$solidjsweb.createComponent((0, $083b2336093176cf$export$3b621d86b1566b2), {}), _el$12, _co$3);
4506
+ $52FdA$solidjsweb.insert(_el$10, () => props.i18n_.clear_individual_filter_());
3920
4507
  $52FdA$solidjsweb.runHydrationEvents();
3921
- return _el$5;
4508
+ return _el$9;
3922
4509
  }
3923
- }), _el$12, _co$3);
3924
- return _el$4;
4510
+ }), _el$16, _co$5);
4511
+ return _el$8;
3925
4512
  }
3926
- }), _el$14, _co$4);
4513
+ }), _el$18, _co$6);
3927
4514
  return _el$2;
3928
4515
  }
3929
4516
  });
@@ -3937,8 +4524,8 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3937
4524
  return (_untogglable_filters = untogglable_filters()) === null || _untogglable_filters === void 0 ? void 0 : _untogglable_filters.length;
3938
4525
  },
3939
4526
  get children() {
3940
- const _el$24 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$7);
3941
- $52FdA$solidjsweb.insert(_el$24, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Index), {
4527
+ const _el$28 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$7);
4528
+ $52FdA$solidjsweb.insert(_el$28, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Index), {
3942
4529
  get each() {
3943
4530
  return untogglable_filters();
3944
4531
  },
@@ -3964,7 +4551,7 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3964
4551
  }), $52FdA$solidjsweb.memo(get_view_more_button_below_group)];
3965
4552
  }
3966
4553
  }));
3967
- return _el$24;
4554
+ return _el$28;
3968
4555
  }
3969
4556
  }), $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
3970
4557
  get when() {
@@ -3972,8 +4559,8 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3972
4559
  return $52FdA$solidjsweb.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);
3973
4560
  },
3974
4561
  get children() {
3975
- const _el$25 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$8);
3976
- $52FdA$solidjsweb.addEventListener(_el$25, "click", $52FdA$depictaiutilishared.catchify(() => $1a8463d757baadb6$export$8895d39404bd2bb1({
4562
+ const _el$29 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$8);
4563
+ $52FdA$solidjsweb.addEventListener(_el$29, "click", $52FdA$depictaiutilishared.catchify(() => $1a8463d757baadb6$export$8895d39404bd2bb1({
3977
4564
  user_triggered_: true,
3978
4565
  selected_filters_: props.selected_filters_,
3979
4566
  i18n_: props.i18n_,
@@ -3981,9 +4568,9 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3981
4568
  expanded_hierarchical_filters_: props.expanded_hierarchical_filters_,
3982
4569
  local_filter_cache_: props.local_filter_cache_
3983
4570
  })), true);
3984
- $52FdA$solidjsweb.insert(_el$25, () => props.i18n_.clear_all_filters_from_big_button_());
4571
+ $52FdA$solidjsweb.insert(_el$29, () => props.i18n_.clear_all_filters_from_big_button_());
3985
4572
  $52FdA$solidjsweb.runHydrationEvents();
3986
- return _el$25;
4573
+ return _el$29;
3987
4574
  }
3988
4575
  })];
3989
4576
  }
@@ -8618,20 +9205,6 @@ const $dd98275d380b2cfd$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<s
8618
9205
  function $dd98275d380b2cfd$export$1c641004b5485fed() {
8619
9206
  return $52FdA$solidjsweb.getNextElement($dd98275d380b2cfd$var$_tmpl$);
8620
9207
  }
8621
- const $5b88b077e48a4451$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.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">`);
8622
- function $5b88b077e48a4451$export$82eafebb825fc23f() {
8623
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8624
- return (() => {
8625
- const _el$ = $52FdA$solidjsweb.getNextElement($5b88b077e48a4451$var$_tmpl$);
8626
- $52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(props, {
8627
- "xmlns": "http://www.w3.org/2000/svg",
8628
- "width": "20",
8629
- "height": "22"
8630
- }), true, true);
8631
- $52FdA$solidjsweb.runHydrationEvents();
8632
- return _el$;
8633
- })();
8634
- }
8635
9208
  const $29e5dbeb69da7a36$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<button class=back type=button>`),
8636
9209
  $29e5dbeb69da7a36$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.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>`);
8637
9210
  function $29e5dbeb69da7a36$export$b94867ecbd698f21(_ref) {
@@ -9405,91 +9978,18 @@ function $4edbc04f5c5a1843$export$a146ac6fa8346a25(_ref) {
9405
9978
  _v$4 !== _p$._v$4 && $52FdA$solidjsweb.setAttribute(_el$9, "title", _p$._v$4 = _v$4);
9406
9979
  return _p$;
9407
9980
  }, {
9408
- _v$: undefined,
9409
- _v$2: undefined,
9410
- _v$3: undefined,
9411
- _v$4: undefined
9412
- });
9413
- return _el$4;
9414
- })();
9415
- }
9416
- }));
9417
- return _el$;
9418
- }
9419
- });
9420
- }
9421
- const $23c3f390dee33ff8$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class=highlighted-part>`),
9422
- $23c3f390dee33ff8$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<span>`);
9423
- function $23c3f390dee33ff8$export$ba17c5b7e6dda39f(_ref) {
9424
- let {
9425
- whole_text_to_display_: whole_text_to_display_memo,
9426
- searching_for_value_: searching_for_value_memo,
9427
- class_: class_
9428
- } = _ref;
9429
- const [get_has_highlighted, set_has_highlighted] = $52FdA$solidjs.createSignal(false);
9430
- const text_itself = $52FdA$solidjs.createMemo(() => $52FdA$solidjs.batch(() => {
9431
- set_has_highlighted(false);
9432
- const searching_for_value = searching_for_value_memo();
9433
- const whole_text_to_display_ = whole_text_to_display_memo();
9434
- let for_black = "";
9435
- let pushed_grey = false;
9436
- const search_q = searching_for_value;
9437
- if (!search_q) return whole_text_to_display_;
9438
- const output = [];
9439
- const searching_for = search_q.toLowerCase();
9440
- const push_black = () => {
9441
- if (for_black) {
9442
- set_has_highlighted(true);
9443
- output.push((() => {
9444
- const _el$ = $52FdA$solidjsweb.getNextElement($23c3f390dee33ff8$var$_tmpl$);
9445
- $52FdA$solidjsweb.insert(_el$, for_black);
9446
- return _el$;
9447
- })()); // "black"
9448
- for_black = "";
9449
- }
9450
- };
9451
- for (let i = 0; i < whole_text_to_display_.length;) {
9452
- let is_whole_word = true;
9453
- let searching_for_but_with_texts_casing = "";
9454
- const i_at_start = i;
9455
- for (let j = 0; j < searching_for.length; i++, j++) {
9456
- const letter_in_suggestion = whole_text_to_display_[i];
9457
- if ((letter_in_suggestion === null || letter_in_suggestion === void 0 ? void 0 : letter_in_suggestion.toLowerCase()) !== searching_for[j]) {
9458
- is_whole_word = false;
9459
- i = i_at_start;
9460
- break;
9461
- }
9462
- searching_for_but_with_texts_casing += letter_in_suggestion;
9463
- }
9464
- if (is_whole_word) {
9465
- push_black();
9466
- output.push(searching_for_but_with_texts_casing);
9467
- pushed_grey = true;
9468
- } else for_black += whole_text_to_display_[i++];
9469
- }
9470
- push_black();
9471
- if (!pushed_grey) {
9472
- set_has_highlighted(false);
9473
- return whole_text_to_display_;
9981
+ _v$: undefined,
9982
+ _v$2: undefined,
9983
+ _v$3: undefined,
9984
+ _v$4: undefined
9985
+ });
9986
+ return _el$4;
9987
+ })();
9988
+ }
9989
+ }));
9990
+ return _el$;
9474
9991
  }
9475
- return output;
9476
- }));
9477
- return (() => {
9478
- const _el$2 = $52FdA$solidjsweb.getNextElement($23c3f390dee33ff8$var$_tmpl$2);
9479
- $52FdA$solidjsweb.className(_el$2, class_);
9480
- $52FdA$solidjsweb.insert(_el$2, text_itself);
9481
- $52FdA$solidjsweb.effect(_p$ => {
9482
- const _v$ = !!get_has_highlighted(),
9483
- _v$2 = whole_text_to_display_memo() /* for when line-clamped, users can see full text on hover */;
9484
- _v$ !== _p$._v$ && _el$2.classList.toggle("has-history-match", _p$._v$ = _v$);
9485
- _v$2 !== _p$._v$2 && $52FdA$solidjsweb.setAttribute(_el$2, "title", _p$._v$2 = _v$2);
9486
- return _p$;
9487
- }, {
9488
- _v$: undefined,
9489
- _v$2: undefined
9490
- });
9491
- return _el$2;
9492
- })();
9992
+ });
9493
9993
  }
9494
9994
  const $3cf7b4db1e203c93$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.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">`);
9495
9995
  function $3cf7b4db1e203c93$export$605674723bcc715c() {
@@ -9533,8 +10033,8 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
9533
10033
  } = _ref2;
9534
10034
  return type === (0, $ce079d50d380ee11$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title);
9535
10035
  } // don't show the ones we already show from the history
9536
- ));
9537
-
10036
+ ) // + limit to three query suggestions, API sends more sometimes
10037
+ .slice(0, 3));
9538
10038
  const not_queries_memo = $52FdA$solidjs.createMemo(() => {
9539
10039
  // For the section that shows categories and content results
9540
10040
  // We want to limit to 3 items, and we want to show the categories first
@@ -10561,238 +11061,6 @@ function $996102a9349df6d7$export$41b4894022a3580f() {
10561
11061
  })));
10562
11062
  return style_props_;
10563
11063
  }
10564
- const $99472afa7112c427$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class=highlighted-part>`);
10565
- const $99472afa7112c427$var$dont_cut_in_between_less_than_characters = 30;
10566
- function $99472afa7112c427$export$e1a98a189fd2c0e7(_ref) {
10567
- let {
10568
- content_result_: content_result_,
10569
- key_: key_,
10570
- cut_when_possible_: cut_when_possible_
10571
- } = _ref;
10572
- const matched_tokens = $52FdA$solidjs.createMemo(() => {
10573
- var _content_result_$high, _content_result_$high2;
10574
- 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;
10575
- });
10576
- const full_value = $52FdA$solidjs.createMemo(() => {
10577
- var _content_result_$key_;
10578
- return (_content_result_$key_ = content_result_()[key_]) === null || _content_result_$key_ === void 0 ? void 0 : _content_result_$key_.replaceAll("\n", " ");
10579
- });
10580
- return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
10581
- get when() {
10582
- var _matched_tokens;
10583
- return (_matched_tokens = matched_tokens()) === null || _matched_tokens === void 0 ? void 0 : _matched_tokens.length;
10584
- },
10585
- get fallback() {
10586
- return full_value();
10587
- },
10588
- get children() {
10589
- return (() => {
10590
- const segmented_cut_text = $52FdA$solidjs.createMemo(() => {
10591
- const segmented_text = $99472afa7112c427$var$segment_text(full_value(), matched_tokens());
10592
- if (cut_when_possible_) $99472afa7112c427$var$cut_text(segmented_text);
10593
- return segmented_text;
10594
- });
10595
- return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Index), {
10596
- get each() {
10597
- return segmented_cut_text();
10598
- },
10599
- children: item => {
10600
- return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
10601
- get when() {
10602
- return item().highlighted_;
10603
- },
10604
- get fallback() {
10605
- return item().text_;
10606
- },
10607
- get children() {
10608
- const _el$ = $52FdA$solidjsweb.getNextElement($99472afa7112c427$var$_tmpl$);
10609
- $52FdA$solidjsweb.insert(_el$, () => item().text_);
10610
- return _el$;
10611
- }
10612
- });
10613
- }
10614
- });
10615
- })();
10616
- }
10617
- });
10618
- }
10619
- function $99472afa7112c427$var$cut_text(segmented_text) {
10620
- // cut away chunks of text that are not highlighted to give a google-like overview of the content
10621
- const highlighted_segments = segmented_text === null || segmented_text === void 0 ? void 0 : segmented_text.filter(segment => segment.highlighted_);
10622
- if (!segmented_text || !(highlighted_segments !== null && highlighted_segments !== void 0 && highlighted_segments.length)) return;
10623
- // We have one or more highlighted segments
10624
- if (highlighted_segments.length === 1) {
10625
- // cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
10626
- $99472afa7112c427$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
10627
- return;
10628
- }
10629
- // We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
10630
- 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
10631
- );
10632
-
10633
- const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
10634
- // We need to cut before the first segment - possibly through other segments - and maybe between segments
10635
- 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);
10636
- $99472afa7112c427$var$cut_start(index_of_first_segment, segmented_text);
10637
- // update indexes since we might have removed segments
10638
- [index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
10639
- let number_of_characters_between_segments = 0;
10640
- for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
10641
- const segment = segmented_text[i];
10642
- number_of_characters_between_segments += segment.text_.length;
10643
- }
10644
- if (number_of_characters_between_segments < $99472afa7112c427$var$dont_cut_in_between_less_than_characters)
10645
- // don't cut if there are less than 30 characters between the two segments
10646
- return;
10647
- // We have more than 50 characters between the two segments, cut between them
10648
- const [split_start_segment, split_start_character] = $99472afa7112c427$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
10649
- const [split_end_segment, split_end_character] = $99472afa7112c427$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
10650
- if (split_start_segment === undefined || split_end_segment === undefined ||
10651
- // identical split point, or split end before split start, can't do anything
10652
- split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
10653
- const dots_segment = {
10654
- text_: " … ",
10655
- highlighted_: false
10656
- };
10657
- const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
10658
- if (i < split_start_segment || i > split_end_segment) return segment;
10659
- const text = segment.text_;
10660
- if (i == split_end_segment && i == split_start_segment) return [{
10661
- ...segment,
10662
- text_: text.slice(0, split_start_character).trimEnd()
10663
- }, dots_segment, {
10664
- ...segment,
10665
- text_: text.slice(split_end_character + 1, text.length).trimStart()
10666
- }];else if (i == split_start_segment) {
10667
- 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
10668
- return segment;
10669
- } else if (i == split_end_segment) return [dots_segment, {
10670
- ...segment,
10671
- text_: text.slice(split_end_character + 1, text.length).trimStart()
10672
- }];
10673
- return []; // remove all segments inbetween
10674
- });
10675
-
10676
- segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
10677
- $99472afa7112c427$var$heal_holes(segmented_text);
10678
- }
10679
- function $99472afa7112c427$var$heal_holes(segmented_text) {
10680
- // try to heal "holes" created in the segments so there are only alternating segments
10681
- const segments_to_delete = new Set();
10682
- for (let i = 0; i < segmented_text.length; i++) {
10683
- var _previous_segment, _previous_segment2;
10684
- const segment = segmented_text[i];
10685
- let previous_segment;
10686
- for (let j = i - 1; j >= 0; j--) {
10687
- previous_segment = segmented_text[j];
10688
- // Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
10689
- if (!segments_to_delete.has(previous_segment)) break;
10690
- }
10691
- 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) {
10692
- previous_segment.text_ += segment.text_; // IDK if this ever happens
10693
- segments_to_delete.add(segment);
10694
- }
10695
- }
10696
- for (const segment of segments_to_delete) {
10697
- const index = segmented_text.indexOf(segment);
10698
- segmented_text.splice(index, 1);
10699
- }
10700
- }
10701
- function $99472afa7112c427$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text) {
10702
- let be_very_aggressive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
10703
- const should_loop_backwards = index_of_start_segment > index_of_end_segment;
10704
- const step = should_loop_backwards ? -1 : 1;
10705
- const desperate_split_attempts = [":", ";", ","];
10706
- while (desperate_split_attempts.length) {
10707
- const split_point_between_words = [];
10708
- // for the middle also try to split with a few more characters if the default ones don't work over a full run
10709
- const desperate_split_attempt = desperate_split_attempts.pop();
10710
- let is_first_character = true;
10711
- for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
10712
- const segment = segmented_text[i];
10713
- const text = segment.text_;
10714
- for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
10715
- const character = text[j];
10716
- if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
10717
- if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
10718
- split_point_between_words.push([i, j]);
10719
- if (split_point_between_words.length > 3)
10720
- // We can't find a split point, so we'll just split between words
10721
- // 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
10722
- return split_point_between_words[1];
10723
- }
10724
- }
10725
- }
10726
- }
10727
- return [];
10728
- }
10729
- function $99472afa7112c427$var$cut_start(cut_left_of_index, segmented_text) {
10730
- // Cut the start of the text to bring the first matching token
10731
- let is_first_character = false;
10732
- let words_encountered = 0;
10733
- outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
10734
- const segment = segmented_text[i];
10735
- // We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
10736
- const text = segment.text_;
10737
- for (let j = text.length - 1; j >= 0; j--) {
10738
- const character = text[j];
10739
- const is_space = character == " ";
10740
- if (!is_first_character && is_space) words_encountered++;
10741
- if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
10742
- // We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
10743
- segment.text_ = text.slice(j + 1).trimStart();
10744
- segmented_text.splice(0, i);
10745
- if (character === "," || is_space)
10746
- // if we cut at a comma or psace, we add a … at the beginning
10747
- segmented_text.unshift({
10748
- text_: "… ",
10749
- highlighted_: false
10750
- });
10751
- break outmost_loop;
10752
- }
10753
- if (is_first_character) is_first_character = false;
10754
- }
10755
- }
10756
- $99472afa7112c427$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
10757
- }
10758
-
10759
- function $99472afa7112c427$var$segment_text(text, matched_strings) {
10760
- // segment text where the matched strings are highlighted sections
10761
- const output = [];
10762
- if (!text) return; // shouldn't happen but whatever
10763
- for (let i = 0; i < text.length; i++) {
10764
- const found_strings = [];
10765
- if (!i || text[i - 1] == " ")
10766
- // only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
10767
- for (let j = 0; j < matched_strings.length; j++) {
10768
- const matched_string = matched_strings[j];
10769
- const part_in_text = text.slice(i, i + matched_string.length);
10770
- if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
10771
- 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
10772
- }
10773
-
10774
- const last_index_in_output = output.length - 1;
10775
- if (!found_strings.length) {
10776
- var _output$last_index_in;
10777
- const character = text[i];
10778
- 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))
10779
- // 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
10780
- output[last_index_in_output].text_ += character;else output.push({
10781
- highlighted_: false,
10782
- text_: character
10783
- });
10784
- } else {
10785
- var _output$last_index_in2;
10786
- const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
10787
- 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({
10788
- highlighted_: true,
10789
- text_: longest_found_string
10790
- });
10791
- i += longest_found_string.length - 1;
10792
- }
10793
- }
10794
- return output;
10795
- }
10796
11064
  const $f1fc9ea3e7632eba$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<a>`),
10797
11065
  $f1fc9ea3e7632eba$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div>`),
10798
11066
  $f1fc9ea3e7632eba$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="description line-clamp">`),