@depict-ai/ui 2.1.12 → 2.1.14

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.12";
79
+ const $aa1938dec50d6c12$export$83d89fbfd8236492 = "2.1.14";
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 = [];
@@ -1590,17 +1596,12 @@ function $1a8463d757baadb6$export$8895d39404bd2bb1(props) {
1590
1596
  if (delay_toast_) return show_configured_toast;else show_configured_toast();
1591
1597
  }
1592
1598
  $52FdA$solidjsweb.delegateEvents(["click"]);
1593
- 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">`);
1594
1600
  function $083b2336093176cf$export$3b621d86b1566b2() {
1595
1601
  let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1596
1602
  return (() => {
1597
1603
  const _el$ = $52FdA$solidjsweb.getNextElement($083b2336093176cf$var$_tmpl$);
1598
- $52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(props, {
1599
- "xmlns": "http://www.w3.org/2000/svg",
1600
- "width": "21.064",
1601
- "height": "21.047",
1602
- "viewBox": "0 0 21.064 21.064"
1603
- }), true, true);
1604
+ $52FdA$solidjsweb.spread(_el$, props, true, true);
1604
1605
  $52FdA$solidjsweb.runHydrationEvents();
1605
1606
  return _el$;
1606
1607
  })();
@@ -1928,7 +1929,7 @@ $52FdA$solidjsweb.delegateEvents(["click"]);
1928
1929
  const $902a0ca2b52f3898$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class=count>`),
1929
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><!$><!/>`);
1930
1931
  const $902a0ca2b52f3898$export$48513f6b9f8ce62d = props => {
1931
- // 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
1932
1933
  const count = $52FdA$solidjs.createMemo(() => props.count_);
1933
1934
  const label = $52FdA$solidjs.createMemo(() => props.label_);
1934
1935
  const checked = $52FdA$solidjs.createMemo(() => props.checked_);
@@ -2026,6 +2027,79 @@ function $b0477e4d832f090e$export$ca21a16d65b3dd8(_ref) {
2026
2027
  })();
2027
2028
  }
2028
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
+ }
2029
2103
  const $9b54b9c5381716eb$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<form class=checkboxes><!$><!/><!$><!/>`);
2030
2104
  const $9b54b9c5381716eb$var$max_visible_without_collapsing = 15;
2031
2105
  const $9b54b9c5381716eb$var$show_non_collapsible_when_collapsed = 4;
@@ -2034,7 +2108,8 @@ function $9b54b9c5381716eb$export$dd948f91abc3a1c4(_ref) {
2034
2108
  filter_: filter_,
2035
2109
  selected_filters_: [get_selected_filters, set_selected_filters],
2036
2110
  i18n_: i18n_,
2037
- 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_
2038
2113
  } = _ref;
2039
2114
  const existing_filter = $52FdA$solidjs.createMemo(() => {
2040
2115
  const {
@@ -2069,12 +2144,18 @@ function $9b54b9c5381716eb$export$dd948f91abc3a1c4(_ref) {
2069
2144
  const value = $e2d74bb03cc5252e$export$325f75597868c4f0(checkbox().value_);
2070
2145
  return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === value));
2071
2146
  });
2147
+ const value = $52FdA$solidjs.createMemo(() => checkbox().value_);
2072
2148
  return $52FdA$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
2073
2149
  get value_() {
2074
- return checkbox().value_;
2150
+ return value();
2075
2151
  },
2076
2152
  get label_() {
2077
- 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
+ });
2078
2159
  },
2079
2160
  get count_() {
2080
2161
  return checkbox().count_;
@@ -2173,7 +2254,8 @@ const $d9239dad9a9d899b$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<f
2173
2254
  function $d9239dad9a9d899b$export$430444115f70a734(_ref) {
2174
2255
  let {
2175
2256
  selected_filters_: selected_filters_,
2176
- filter_: filter_
2257
+ filter_: filter_,
2258
+ filter_query_: filter_query_
2177
2259
  } = _ref;
2178
2260
  const radio_name = $52FdA$depictaiutilishared.make_random_classname();
2179
2261
  const existing_filter = $52FdA$solidjs.createMemo(() => {
@@ -2201,6 +2283,13 @@ function $d9239dad9a9d899b$export$430444115f70a734(_ref) {
2201
2283
  var _counts;
2202
2284
  return (_counts = filter_().meta.counts) === null || _counts === void 0 ? void 0 : _counts[index];
2203
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
+ });
2204
2293
  return (() => {
2205
2294
  const _el$2 = $52FdA$solidjsweb.getNextElement($d9239dad9a9d899b$var$_tmpl$3),
2206
2295
  _el$3 = _el$2.firstChild,
@@ -2225,12 +2314,9 @@ function $d9239dad9a9d899b$export$430444115f70a734(_ref) {
2225
2314
  }));
2226
2315
  $52FdA$solidjsweb.setAttribute(_el$4, "id", random_selector);
2227
2316
  $52FdA$solidjsweb.setAttribute(_el$4, "name", radio_name);
2228
- $52FdA$solidjsweb.insert(_el$3, $52FdA$solidjs.createMemo(() => {
2229
- var _filter_$meta, _filter_$meta$names;
2230
- 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];
2231
- if (name) return name;
2232
- const v = value();
2233
- 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_()
2234
2320
  }), _el$7, _co$);
2235
2321
  $52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
2236
2322
  get when() {
@@ -2264,7 +2350,8 @@ function $0257c760a99bfacb$export$e0d834a0ad870cda(_ref) {
2264
2350
  let {
2265
2351
  filter_: filter_,
2266
2352
  selected_filters_: selected_filters_,
2267
- i18n_: i18n_
2353
+ i18n_: i18n_,
2354
+ filter_query_: filter_query_
2268
2355
  } = _ref;
2269
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
2270
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
@@ -2657,139 +2744,421 @@ function $ac040bdfeed58ee4$export$e5c2828934226505(_ref) {
2657
2744
  });
2658
2745
  return outer_div;
2659
2746
  }
2660
- const $9c1d49181fb3002a$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<form class="checkboxes hierarchical"><!$><!/><!$><!/>`),
2661
- $9c1d49181fb3002a$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=checkbox-details><!$><!/><!$><!/>`),
2662
- $9c1d49181fb3002a$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<details>`),
2663
- $9c1d49181fb3002a$var$_tmpl$4 = /*#__PURE__*/$52FdA$solidjsweb.template(`<summary class=category-parent><div class=summary><span class=count></span><!$><!/>`);
2664
- const $9c1d49181fb3002a$var$max_visible_without_collapsing = 15;
2665
- const $9c1d49181fb3002a$var$show_non_collapsible_when_collapsed = 4;
2666
- 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) {
2667
2750
  let {
2668
- filter_: filter_,
2669
- selected_filters_: selected_filters_,
2670
- i18n_: i18n_,
2671
- view_more_button_below_group_: view_more_button_below_group_,
2672
- expanded_hierarchical_filters_: expanded_hierarchical_filters_
2751
+ content_result_: content_result_,
2752
+ key_: key_,
2753
+ cut_when_possible_: cut_when_possible_
2673
2754
  } = _ref;
2674
- let form;
2675
- const existing_filter = $52FdA$solidjs.createMemo(() => {
2676
- const {
2677
- field: field,
2678
- op: op
2679
- } = filter_();
2680
- return selected_filters_[0]().find(_ref2 => {
2681
- let {
2682
- field: checking_field,
2683
- op: checking_op
2684
- } = _ref2;
2685
- return checking_field === field && checking_op === op;
2686
- });
2687
- });
2688
- const show_extras = $52FdA$solidjs.createSignal(false);
2689
- const trigger_sync_ = $9c1d49181fb3002a$var$batching_filter_state_syncer({
2690
- filter_: filter_,
2691
- existing_filter_: existing_filter,
2692
- selected_filters_: selected_filters_,
2693
- get category_structure_() {
2694
- return structured_categories();
2695
- }
2696
- });
2697
- const structured_categories = $52FdA$solidjs.createMemo(() => {
2698
- const execute_when_structure_finished = [];
2699
- const {
2700
- values: values,
2701
- names: names,
2702
- counts: counts
2703
- } = filter_().meta;
2704
- const data_structure = {};
2705
- for (let i = 0; i < values.length; i++) {
2706
- const value = values[i];
2707
- let pointer = data_structure;
2708
- let parent_ = {};
2709
- let created_an_object = false;
2710
- for (let j = 0; j < value.length; j++) {
2711
- var _pointer;
2712
- const this_categories_name = value[j];
2713
- const obj = (_pointer = pointer)[this_categories_name] || (_pointer[this_categories_name] = (() => {
2714
- 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;
2715
- const created_obj = {
2716
- name_: names[i],
2717
- count_: counts === null || counts === void 0 ? void 0 : counts[i],
2718
- parent_: parent_,
2719
- is_expanded_: $9c1d49181fb3002a$var$make_expanded_signal({
2720
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
2721
- filter_value_: value_as_string
2722
- }),
2723
- value_: value_as_string,
2724
- children_: {}
2725
- };
2726
- const {
2727
- signal_: signal_,
2728
- on_structure_complete_: on_structure_complete_
2729
- } = $9c1d49181fb3002a$var$create_updating_signal({
2730
- self_: created_obj,
2731
- existing_filter_: $52FdA$solidjs.untrack(existing_filter),
2732
- trigger_sync_: trigger_sync_
2733
- });
2734
- execute_when_structure_finished.push(on_structure_complete_);
2735
- created_obj.is_checked_ = signal_;
2736
- parent_ = created_obj;
2737
- created_an_object = true;
2738
- return created_obj;
2739
- })());
2740
- pointer = obj.children_;
2741
- parent_ = obj;
2742
- }
2743
- if (!created_an_object && "value_" in parent_) {
2744
- // 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
2745
- // [
2746
- // ["Öl", "IPA"],
2747
- // ["Öl", "Pale Ale"],
2748
- // ["Öl", "Ale"],
2749
- // ["Öl", "Mörk Lager"],
2750
- // ["Öl", "Suröl"],
2751
- // ["Öl", "Veteöl"],
2752
- // ["Öl", "Stout och Porter"],
2753
- // ["Öl"], // <- We are here, our `hierarchical_data_structure[string]`-object was created when we iterated over ["Öl", "IPA"]
2754
- // ["Öl", "Ljus Lager"],
2755
- // ];
2756
- // In this case we want to just correct the name and value of the already created object, which will be in parent_
2757
- parent_.value_ = value.map(v => v + "");
2758
- parent_.name_ = names[i];
2759
- parent_.count_ = counts[i];
2760
- parent_.is_expanded_ = $9c1d49181fb3002a$var$make_expanded_signal({
2761
- expanded_hierarchical_filters_: expanded_hierarchical_filters_,
2762
- filter_value_: parent_.value_
2763
- });
2764
- }
2765
- }
2766
- while (execute_when_structure_finished.length) execute_when_structure_finished.pop()();
2767
- $9c1d49181fb3002a$var$expand_until_choice(data_structure);
2768
- $52FdA$depictaiutilishared.dlog("CheckboxHierarchicalFilter: Recomputed structured_categories", data_structure);
2769
- 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;
2770
2758
  });
2771
- const some_top_level_are_hidden = $52FdA$solidjs.createMemo(() => Object.keys(structured_categories()).length > $9c1d49181fb3002a$var$max_visible_without_collapsing);
2772
- const {
2773
- expand: expand,
2774
- collapse: collapse,
2775
- ExpandingContainer: ExpandingContainer
2776
- } = $d6d51b09cb2116a6$export$5bad61ecde080b1f({
2777
- 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", " ");
2778
2762
  });
2779
- 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
+ },
2780
2771
  get children() {
2781
- return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
2782
- get when() {
2783
- return some_top_level_are_hidden();
2784
- },
2785
- get children() {
2786
- 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_);
2787
- }
2788
- });
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
+ })();
2789
2799
  }
2790
2800
  });
2791
- $52FdA$solidjs.createRenderEffect(() => {
2792
- view_more_button_below_group_[1](some_top_level_are_hidden() ? $52FdA$solidjsweb.createComponent((0, $b0477e4d832f090e$export$ca21a16d65b3dd8), {
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 === null || counts === void 0 ? void 0 : 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
+ });
3158
+ }
3159
+ });
3160
+ $52FdA$solidjs.createRenderEffect(() => {
3161
+ view_more_button_below_group_[1](some_top_level_are_hidden() ? $52FdA$solidjsweb.createComponent((0, $b0477e4d832f090e$export$ca21a16d65b3dd8), {
2793
3162
  show_extras_: show_extras,
2794
3163
  i18n_: i18n_
2795
3164
  }) : []);
@@ -2809,13 +3178,13 @@ function $9c1d49181fb3002a$export$a32086fa6616eafd(_ref) {
2809
3178
  [_el$5, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$4.nextSibling);
2810
3179
  const _ref$ = form;
2811
3180
  typeof _ref$ === "function" ? $52FdA$solidjsweb.use(_ref$, _el$) : form = _el$;
2812
- $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$);
2813
3182
  $52FdA$solidjsweb.insert(_el$, expanding_container_els, _el$5, _co$2);
2814
3183
  $52FdA$solidjsweb.effect(() => _el$.classList.toggle("any-expandable", !!Object.values(structured_categories()).some(category => Object.keys(category.children_).length)));
2815
3184
  return _el$;
2816
3185
  })();
2817
3186
  }
2818
- function $9c1d49181fb3002a$var$render_stuff(data, existing_filter, i18n_) {
3187
+ function $9c1d49181fb3002a$var$render_stuff(data, existing_filter, i18n_, filter_query_) {
2819
3188
  const keys = $52FdA$solidjs.createMemo(() => Object.keys(data()));
2820
3189
  return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.For), {
2821
3190
  get each() {
@@ -2833,6 +3202,14 @@ function $9c1d49181fb3002a$var$render_stuff(data, existing_filter, i18n_) {
2833
3202
  var _value;
2834
3203
  return !!Object.keys(((_value = value()) === null || _value === void 0 ? void 0 : _value.children_) || {}).length;
2835
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
+ });
2836
3213
  return (() => {
2837
3214
  const _el$6 = $52FdA$solidjsweb.getNextElement($9c1d49181fb3002a$var$_tmpl$2),
2838
3215
  _el$7 = _el$6.firstChild,
@@ -2841,12 +3218,17 @@ function $9c1d49181fb3002a$var$render_stuff(data, existing_filter, i18n_) {
2841
3218
  [_el$10, _co$4] = $52FdA$solidjsweb.getNextMarker(_el$9.nextSibling);
2842
3219
  $52FdA$solidjsweb.insert(_el$6, $52FdA$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
2843
3220
  get value_() {
2844
- var _value2;
2845
- return JSON.stringify((_value2 = value()) === null || _value2 === void 0 ? void 0 : _value2.value_);
3221
+ return value_as_string();
2846
3222
  },
2847
3223
  get label_() {
2848
- var _value3;
2849
- 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
+ });
2850
3232
  },
2851
3233
  get count_() {
2852
3234
  var _value4;
@@ -2946,7 +3328,7 @@ function $9c1d49181fb3002a$var$render_stuff(data, existing_filter, i18n_) {
2946
3328
  return $9c1d49181fb3002a$var$render_stuff($52FdA$solidjs.createMemo(() => {
2947
3329
  var _value13;
2948
3330
  return ((_value13 = value()) === null || _value13 === void 0 ? void 0 : _value13.children_) || {};
2949
- }), existing_filter, i18n_);
3331
+ }), existing_filter, i18n_, filter_query_);
2950
3332
  }
2951
3333
  });
2952
3334
  })();
@@ -3064,7 +3446,8 @@ function $9c1d49181fb3002a$var$make_expanded_signal(_ref5) {
3064
3446
  var _untrack$untrack;
3065
3447
  let {
3066
3448
  expanded_hierarchical_filters_: [read_expanded_hierarchical_filters, write_expanded_hierarchical_filters],
3067
- filter_value_: filter_value_
3449
+ filter_value_: filter_value_,
3450
+ is_being_searched_: is_being_searched_
3068
3451
  } = _ref5;
3069
3452
  const index_in_expanded_filters = $52FdA$solidjs.createMemo(() => read_expanded_hierarchical_filters().findIndex(_ref6 => {
3070
3453
  let {
@@ -3107,9 +3490,11 @@ function $9c1d49181fb3002a$var$make_expanded_signal(_ref5) {
3107
3490
  defer: true
3108
3491
  }));
3109
3492
  return {
3110
- 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
+ () => {
3111
3496
  var _user_choice_signal$;
3112
- 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();
3113
3498
  }),
3114
3499
  set_low_precedence_expanded_: set_low_precedence_expanded,
3115
3500
  set_user_expanded_: set_user_choice_expanded
@@ -3140,7 +3525,9 @@ const $cd0e5524f9476f9b$var$max_columns = 3;
3140
3525
  const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
3141
3526
  let {
3142
3527
  filter_: filter_,
3143
- 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_
3144
3531
  } = _ref;
3145
3532
  const existing_filter = $52FdA$solidjs.createMemo(() => {
3146
3533
  const {
@@ -3174,7 +3561,7 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
3174
3561
  const container_width_accessor = $52FdA$solidjs.createMemo(() => {
3175
3562
  const element = container();
3176
3563
  if (!element) return;
3177
- return $13671aa5e984acd9$export$9f191182275e9ef(element);
3564
+ return $c387d7f1d9fb66c0$export$ebdc3711f7e02ccd(element);
3178
3565
  });
3179
3566
  const [shadow_children, set_shadow_children] = $52FdA$solidjs.createSignal(new Set(), {
3180
3567
  equals: false
@@ -3186,11 +3573,11 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
3186
3573
  })(); // for getting the smallest possible sizes of all the items
3187
3574
  $52FdA$solidjs.createEffect(() => {
3188
3575
  var _container_width_acce;
3189
- const container_width = (_container_width_acce = container_width_accessor()) === null || _container_width_acce === void 0 ? void 0 : _container_width_acce();
3190
- 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
3191
3578
  $cd0e5524f9476f9b$var$adjust_sizes(container_width, sizes_set(), set_cols_at_size);
3192
3579
  });
3193
- return [shadow_grid, $52FdA$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), {
3580
+ return [$52FdA$solidjsweb.createComponent((0, $6c2c739b113a8ddf$export$d21e32dfedac04be), {
3194
3581
  get cols_at_size() {
3195
3582
  return cols_at_size();
3196
3583
  },
@@ -3213,66 +3600,72 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
3213
3600
  const current_value = $e2d74bb03cc5252e$export$325f75597868c4f0(value().value_);
3214
3601
  return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === current_value));
3215
3602
  });
3216
- const MakeButton = attributes => (() => {
3217
- const _el$2 = $52FdA$solidjsweb.getNextElement($cd0e5524f9476f9b$var$_tmpl$3),
3218
- _el$5 = _el$2.firstChild,
3219
- [_el$6, _co$] = $52FdA$solidjsweb.getNextMarker(_el$5.nextSibling),
3220
- _el$7 = _el$6.nextSibling,
3221
- [_el$8, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$7.nextSibling);
3222
- $52FdA$solidjsweb.spread(_el$2, $52FdA$solidjsweb.mergeProps(attributes, {
3223
- get disabled() {
3224
- return $52FdA$solidjsweb.memo(() => value().count_ === 0)() && !is_selected();
3225
- },
3226
- get classList() {
3227
- return {
3228
- minor: !is_selected(),
3229
- major: is_selected(),
3230
- "major-minor-transition": true
3231
- };
3232
- },
3233
- get onClick() {
3234
- return $52FdA$depictaiutilishared.catchify(() => {
3235
- const set_filter = existing_filter();
3236
- const {
3237
- field: field,
3238
- op: op
3239
- } = filter_();
3240
- const base_object = set_filter ? set_filter : {
3241
- op: op,
3242
- field: field
3243
- };
3244
- const old_data = base_object.data;
3245
- const new_data = [...(Array.isArray(old_data) ? [...old_data] : old_data ? [old_data] : [])];
3246
- const new_filter_object = {
3247
- ...base_object,
3248
- 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
3249
3620
  };
3250
- if (!is_selected()) new_filter_object.data.push(value().value_);else {
3251
- const current_value_lower = $e2d74bb03cc5252e$export$325f75597868c4f0(value().value_);
3252
- new_filter_object.data = new_filter_object.data.filter(v => $e2d74bb03cc5252e$export$325f75597868c4f0(v) !== current_value_lower);
3253
- }
3254
- const selected_filters = [...get_selected_filters().filter(f => f !== set_filter), ...(new_filter_object.data.length ? [new_filter_object] : [])];
3255
- set_selected_filters(selected_filters);
3256
- });
3257
- }
3258
- }), false, true);
3259
- $52FdA$solidjsweb.insert(_el$2, () => value().value_, _el$6, _co$);
3260
- $52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
3261
- get when() {
3262
- return value().count_ != undefined;
3263
- },
3264
- get children() {
3265
- const _el$3 = $52FdA$solidjsweb.getNextElement($cd0e5524f9476f9b$var$_tmpl$2),
3266
- _el$4 = _el$3.firstChild;
3267
- $52FdA$solidjsweb.insert(_el$4, () => value().count_);
3268
- return _el$3;
3269
- }
3270
- }), _el$8, _co$2);
3271
- $52FdA$solidjsweb.runHydrationEvents();
3272
- return _el$2;
3273
- })();
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
+ };
3274
3667
  const invisible_size_button = $52FdA$solidjsweb.createComponent(MakeButton, {});
3275
- 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
3276
3669
  const sizes_value = $52FdA$solidjs.untrack(sizes_set);
3277
3670
  const shadow_children_value = $52FdA$solidjs.untrack(shadow_children);
3278
3671
  sizes_value.add(smallest_possible_size);
@@ -3292,7 +3685,7 @@ const $cd0e5524f9476f9b$export$414f6a19d38e655c = _ref => {
3292
3685
  }
3293
3686
  });
3294
3687
  }
3295
- })];
3688
+ }), shadow_grid];
3296
3689
  };
3297
3690
  /**
3298
3691
  * Calculate and apply cols_at_size overrides to fit as many items as possible in a row, evenly spaced
@@ -3360,7 +3753,8 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
3360
3753
  filter_: filter_,
3361
3754
  selected_filters_: [get_selected_filters, set_selected_filters],
3362
3755
  i18n_: i18n_,
3363
- 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_
3364
3758
  } = _ref;
3365
3759
  // same as in CheckboxFilter, maybe we should make this DRY at some point
3366
3760
  const existing_filter = $52FdA$solidjs.createMemo(() => {
@@ -3405,12 +3799,17 @@ function $476a3dc36afc1938$export$82ed4b28ecb67608(_ref) {
3405
3799
  const value = $e2d74bb03cc5252e$export$325f75597868c4f0(checkbox().value_);
3406
3800
  return !!(data !== null && data !== void 0 && data.some(item => $e2d74bb03cc5252e$export$325f75597868c4f0(item) === value));
3407
3801
  });
3802
+ const value = $52FdA$solidjs.createMemo(() => checkbox().value_);
3803
+ const label_text = $52FdA$solidjs.createMemo(() => checkbox().name_ || value() + "");
3408
3804
  const input_row = $52FdA$solidjsweb.createComponent((0, $902a0ca2b52f3898$export$48513f6b9f8ce62d), {
3409
3805
  get value_() {
3410
- return checkbox().value_;
3806
+ return value();
3411
3807
  },
3412
3808
  get label_() {
3413
- 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
+ });
3414
3813
  },
3415
3814
  get count_() {
3416
3815
  return checkbox().count_;
@@ -3726,10 +4125,176 @@ function $a7f7d416e6f61504$export$89c6019e4baa40b1(props) {
3726
4125
  }
3727
4126
  });
3728
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-filter-search>`);
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" || 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 ? {
4233
+ counts: counts === null || counts === void 0 ? void 0 : counts.filter((_, i) => filtered_indexes[i])
4234
+ } : {}),
4235
+ ...(names ? {
4236
+ names: (_meta$names = meta.names) === null || _meta$names === void 0 ? void 0 : _meta$names.filter((_, i) => filtered_indexes[i])
4237
+ } : {}),
4238
+ values: new_values
4239
+ }
4240
+ };
4241
+ if (is_hierarchical_checkbox) {
4242
+ // For hierarchical checkbox we need to fill the holes created by filtering, for example if there is
4243
+ // ["Clothes"]
4244
+ // ["Clothes", "Blazers"]
4245
+ // And the user searched for "blazers" we need to add back ["Clothes"] so CheckboxHierarchicalFilter doesn't get confused
4246
+ // 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
4247
+ // So we do it here instead
4248
+ const new_meta = new_filter_object.meta;
4249
+ const new_values = new_meta.values;
4250
+ for (const value of new_values) {
4251
+ if (!Array.isArray(value)) continue; // Shouldn't happen
4252
+ if (value.length < 2) continue; // No parent
4253
+ const parent = value.slice(0, -1);
4254
+ // Check if parent exists
4255
+ if ($8e7ac26c00243687$var$find_str_arr_in_str_arr_arr("some", new_values, parent)) continue; // Parent exists
4256
+ // Otherwise, put it back
4257
+ const index_to_restore = $8e7ac26c00243687$var$find_str_arr_in_str_arr_arr("findIndex", values, parent);
4258
+ if (index_to_restore < 0) {
4259
+ $52FdA$depictaiutilishared.dwarn("Can't restore", parent, "to", new_values);
4260
+ continue;
4261
+ }
4262
+ const current_index_of_us = new_values.findIndex(item => item === value);
4263
+ new_values.splice(current_index_of_us, 0, values[index_to_restore]);
4264
+ const count_to_restore = counts === null || counts === void 0 ? void 0 : counts[index_to_restore];
4265
+ if (count_to_restore) {
4266
+ var _new_meta$counts;
4267
+ (_new_meta$counts = new_meta.counts) === null || _new_meta$counts === void 0 || _new_meta$counts.splice(current_index_of_us, 0, count_to_restore);
4268
+ }
4269
+ const name_to_restore = names === null || names === void 0 ? void 0 : names[index_to_restore];
4270
+ if (name_to_restore) {
4271
+ var _new_meta$names;
4272
+ (_new_meta$names = new_meta.names) === null || _new_meta$names === void 0 || _new_meta$names.splice(current_index_of_us, 0, name_to_restore);
4273
+ }
4274
+ }
4275
+ }
4276
+ return new_filter_object;
4277
+ }).filter(filter => filter); // Delete filters that don't have a value anymore
4278
+ });
4279
+
4280
+ return {
4281
+ SearchThisFilterGroup_: SearchThisFilterGroup_,
4282
+ searched_filter_array_: searched_filter_array_,
4283
+ filter_query_: filter_query_
4284
+ };
4285
+ }
4286
+ /**
4287
+ * Finds/whatevers what's effectively one hierarchical filter item in an array of hierarchical filter items
4288
+ * Functions similar to this happen loads in create_modified_filters, but they have additional checks so not touching them RN
4289
+ */
4290
+ function $8e7ac26c00243687$var$find_str_arr_in_str_arr_arr(operation, haystack, needle) {
4291
+ return haystack[operation](value => value.length === needle.length && value.every((item, index) => item === needle[index]));
4292
+ }
4293
+ $52FdA$solidjsweb.delegateEvents(["input", "click"]);
3729
4294
  const $164d474fea221d77$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=filter-collapsible>`),
3730
4295
  $164d474fea221d77$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<button class=clear-group><!$><!/><span>`),
3731
4296
  $164d474fea221d77$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=view-more-clear><!$><!/><!$><!/>`),
3732
- $164d474fea221d77$var$_tmpl$4 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=filter-collapsible-body><div class=filter-part></div><!$><!/>`),
4297
+ $164d474fea221d77$var$_tmpl$4 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=filter-collapsible-body><div class=filter-part><!$><!/><!$><!/></div><!$><!/>`),
3733
4298
  $164d474fea221d77$var$_tmpl$5 = /*#__PURE__*/$52FdA$solidjsweb.template(`<details class=filter-collapsible>`),
3734
4299
  $164d474fea221d77$var$_tmpl$6 = /*#__PURE__*/$52FdA$solidjsweb.template(`<summary class=filter-group-summary><div class=summary><span></span><div class=selected-w-sign><!$><!/><!$><!/>`),
3735
4300
  $164d474fea221d77$var$_tmpl$7 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class=ungrouped>`),
@@ -3790,6 +4355,11 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3790
4355
  const filter_array_ = $52FdA$solidjs.createMemo(() => {
3791
4356
  return Object.values(togglable_filters_grouped_by_collapsible())[get_section_index()];
3792
4357
  });
4358
+ const {
4359
+ SearchThisFilterGroup_: SearchThisFilterGroup_,
4360
+ searched_filter_array_: searched_filter_array_,
4361
+ filter_query_: filter_query_
4362
+ } = $8e7ac26c00243687$export$4b2c5292ffe0c5dd(filter_array_, section_, props.i18n_);
3793
4363
  const is_open = $4c1dcf1a9c604a68$export$ab34afce88557c0e({
3794
4364
  get expanded_filters_() {
3795
4365
  return props.expanded_filters_;
@@ -3805,27 +4375,33 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3805
4375
  return selected_filter;
3806
4376
  })));
3807
4377
  const a_filter_is_selected = $52FdA$solidjs.createMemo(() => selected_filters_in_group().size);
4378
+ const [get_details_width, set_get_details_width] = $52FdA$solidjs.createSignal();
4379
+ const details_element_width_ = $52FdA$solidjs.createMemo(() => {
4380
+ var _get_details_width;
4381
+ 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();
4382
+ });
3808
4383
  return $52FdA$solidjsweb.createComponent((0, $4cfe8400ed3f92c4$export$6c6d7a51fa9aa15d), {
3809
4384
  is_open_: is_open,
3810
4385
  get details_() {
3811
4386
  return (() => {
3812
- const _el$15 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$5);
3813
- $52FdA$solidjsweb.setAttribute(_el$15, "data-group-title", section_);
3814
- return _el$15;
4387
+ const _el$19 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$5);
4388
+ $52FdA$solidjsweb.use(element => set_get_details_width(() => $c387d7f1d9fb66c0$export$ebdc3711f7e02ccd(element)), _el$19);
4389
+ $52FdA$solidjsweb.setAttribute(_el$19, "data-group-title", section_);
4390
+ return _el$19;
3815
4391
  })();
3816
4392
  },
3817
4393
  get summary_() {
3818
4394
  return (() => {
3819
- const _el$16 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$6),
3820
- _el$17 = _el$16.firstChild,
3821
- _el$18 = _el$17.firstChild,
3822
- _el$19 = _el$18.nextSibling,
3823
- _el$20 = _el$19.firstChild,
3824
- [_el$21, _co$5] = $52FdA$solidjsweb.getNextMarker(_el$20.nextSibling),
3825
- _el$22 = _el$21.nextSibling,
3826
- [_el$23, _co$6] = $52FdA$solidjsweb.getNextMarker(_el$22.nextSibling);
3827
- $52FdA$solidjsweb.insert(_el$18, section_);
3828
- $52FdA$solidjsweb.insert(_el$19, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
4395
+ const _el$20 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$6),
4396
+ _el$21 = _el$20.firstChild,
4397
+ _el$22 = _el$21.firstChild,
4398
+ _el$23 = _el$22.nextSibling,
4399
+ _el$24 = _el$23.firstChild,
4400
+ [_el$25, _co$7] = $52FdA$solidjsweb.getNextMarker(_el$24.nextSibling),
4401
+ _el$26 = _el$25.nextSibling,
4402
+ [_el$27, _co$8] = $52FdA$solidjsweb.getNextMarker(_el$26.nextSibling);
4403
+ $52FdA$solidjsweb.insert(_el$22, section_);
4404
+ $52FdA$solidjsweb.insert(_el$23, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
3829
4405
  get when() {
3830
4406
  return a_filter_is_selected();
3831
4407
  },
@@ -3837,26 +4413,31 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3837
4413
  }
3838
4414
  });
3839
4415
  }
3840
- }), _el$21, _co$5);
3841
- $52FdA$solidjsweb.insert(_el$19, $52FdA$solidjsweb.createComponent((0, $ac040bdfeed58ee4$export$e5c2828934226505), {
4416
+ }), _el$25, _co$7);
4417
+ $52FdA$solidjsweb.insert(_el$23, $52FdA$solidjsweb.createComponent((0, $ac040bdfeed58ee4$export$e5c2828934226505), {
3842
4418
  get expanded_() {
3843
4419
  return is_open[0];
3844
4420
  },
3845
4421
  get i18n_() {
3846
4422
  return props.i18n_;
3847
4423
  }
3848
- }), _el$23, _co$6);
3849
- return _el$16;
4424
+ }), _el$27, _co$8);
4425
+ return _el$20;
3850
4426
  })();
3851
4427
  },
3852
4428
  get children() {
3853
4429
  const _el$2 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$4),
3854
4430
  _el$3 = _el$2.firstChild,
3855
- _el$13 = _el$3.nextSibling,
3856
- [_el$14, _co$4] = $52FdA$solidjsweb.getNextMarker(_el$13.nextSibling);
4431
+ _el$4 = _el$3.firstChild,
4432
+ [_el$5, _co$] = $52FdA$solidjsweb.getNextMarker(_el$4.nextSibling),
4433
+ _el$6 = _el$5.nextSibling,
4434
+ [_el$7, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$6.nextSibling),
4435
+ _el$17 = _el$3.nextSibling,
4436
+ [_el$18, _co$6] = $52FdA$solidjsweb.getNextMarker(_el$17.nextSibling);
4437
+ $52FdA$solidjsweb.insert(_el$3, $52FdA$solidjsweb.createComponent(SearchThisFilterGroup_, {}), _el$5, _co$);
3857
4438
  $52FdA$solidjsweb.insert(_el$3, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Index), {
3858
4439
  get each() {
3859
- return filter_array_();
4440
+ return searched_filter_array_();
3860
4441
  },
3861
4442
  children: filter => $52FdA$solidjsweb.createComponent((0, $1b3cf201cdd38687$export$b69d0d92862de18b), {
3862
4443
  severity_: "error",
@@ -3879,11 +4460,13 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3879
4460
  get i18n_() {
3880
4461
  return props.i18n_;
3881
4462
  },
3882
- view_more_button_below_group_: view_more_button_below_group
4463
+ view_more_button_below_group_: view_more_button_below_group,
4464
+ filter_query_: filter_query_,
4465
+ details_element_width_: details_element_width_
3883
4466
  });
3884
4467
  }
3885
4468
  })
3886
- }));
4469
+ }), _el$7, _co$2);
3887
4470
  $52FdA$solidjsweb.insert(_el$2, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
3888
4471
  get when() {
3889
4472
  return $52FdA$solidjs.createMemo(() => {
@@ -3892,22 +4475,22 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3892
4475
  })();
3893
4476
  },
3894
4477
  get children() {
3895
- const _el$4 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$3),
3896
- _el$9 = _el$4.firstChild,
3897
- [_el$10, _co$2] = $52FdA$solidjsweb.getNextMarker(_el$9.nextSibling),
3898
- _el$11 = _el$10.nextSibling,
3899
- [_el$12, _co$3] = $52FdA$solidjsweb.getNextMarker(_el$11.nextSibling);
3900
- $52FdA$solidjsweb.insert(_el$4, () => view_more_button_below_group[0](), _el$10, _co$2);
3901
- $52FdA$solidjsweb.insert(_el$4, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
4478
+ const _el$8 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$3),
4479
+ _el$13 = _el$8.firstChild,
4480
+ [_el$14, _co$4] = $52FdA$solidjsweb.getNextMarker(_el$13.nextSibling),
4481
+ _el$15 = _el$14.nextSibling,
4482
+ [_el$16, _co$5] = $52FdA$solidjsweb.getNextMarker(_el$15.nextSibling);
4483
+ $52FdA$solidjsweb.insert(_el$8, () => view_more_button_below_group[0](), _el$14, _co$4);
4484
+ $52FdA$solidjsweb.insert(_el$8, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
3902
4485
  get when() {
3903
4486
  return a_filter_is_selected();
3904
4487
  },
3905
4488
  get children() {
3906
- const _el$5 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$2),
3907
- _el$7 = _el$5.firstChild,
3908
- [_el$8, _co$] = $52FdA$solidjsweb.getNextMarker(_el$7.nextSibling),
3909
- _el$6 = _el$8.nextSibling;
3910
- $52FdA$solidjsweb.addEventListener(_el$5, "click", $52FdA$depictaiutilishared.catchify(() => {
4489
+ const _el$9 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$2),
4490
+ _el$11 = _el$9.firstChild,
4491
+ [_el$12, _co$3] = $52FdA$solidjsweb.getNextMarker(_el$11.nextSibling),
4492
+ _el$10 = _el$12.nextSibling;
4493
+ $52FdA$solidjsweb.addEventListener(_el$9, "click", $52FdA$depictaiutilishared.catchify(() => {
3911
4494
  const new_filter_obj = [...props.selected_filters_[0]()];
3912
4495
  for (const filter of filter_array_()) {
3913
4496
  const index = new_filter_obj.findIndex(_ref2 => {
@@ -3921,15 +4504,15 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3921
4504
  }
3922
4505
  props.selected_filters_[1](new_filter_obj);
3923
4506
  }), true);
3924
- $52FdA$solidjsweb.insert(_el$5, $52FdA$solidjsweb.createComponent((0, $083b2336093176cf$export$3b621d86b1566b2), {}), _el$8, _co$);
3925
- $52FdA$solidjsweb.insert(_el$6, () => props.i18n_.clear_individual_filter_());
4507
+ $52FdA$solidjsweb.insert(_el$9, $52FdA$solidjsweb.createComponent((0, $083b2336093176cf$export$3b621d86b1566b2), {}), _el$12, _co$3);
4508
+ $52FdA$solidjsweb.insert(_el$10, () => props.i18n_.clear_individual_filter_());
3926
4509
  $52FdA$solidjsweb.runHydrationEvents();
3927
- return _el$5;
4510
+ return _el$9;
3928
4511
  }
3929
- }), _el$12, _co$3);
3930
- return _el$4;
4512
+ }), _el$16, _co$5);
4513
+ return _el$8;
3931
4514
  }
3932
- }), _el$14, _co$4);
4515
+ }), _el$18, _co$6);
3933
4516
  return _el$2;
3934
4517
  }
3935
4518
  });
@@ -3943,8 +4526,8 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3943
4526
  return (_untogglable_filters = untogglable_filters()) === null || _untogglable_filters === void 0 ? void 0 : _untogglable_filters.length;
3944
4527
  },
3945
4528
  get children() {
3946
- const _el$24 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$7);
3947
- $52FdA$solidjsweb.insert(_el$24, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Index), {
4529
+ const _el$28 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$7);
4530
+ $52FdA$solidjsweb.insert(_el$28, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Index), {
3948
4531
  get each() {
3949
4532
  return untogglable_filters();
3950
4533
  },
@@ -3970,7 +4553,7 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3970
4553
  }), $52FdA$solidjsweb.memo(get_view_more_button_below_group)];
3971
4554
  }
3972
4555
  }));
3973
- return _el$24;
4556
+ return _el$28;
3974
4557
  }
3975
4558
  }), $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
3976
4559
  get when() {
@@ -3978,8 +4561,8 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3978
4561
  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);
3979
4562
  },
3980
4563
  get children() {
3981
- const _el$25 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$8);
3982
- $52FdA$solidjsweb.addEventListener(_el$25, "click", $52FdA$depictaiutilishared.catchify(() => $1a8463d757baadb6$export$8895d39404bd2bb1({
4564
+ const _el$29 = $52FdA$solidjsweb.getNextElement($164d474fea221d77$var$_tmpl$8);
4565
+ $52FdA$solidjsweb.addEventListener(_el$29, "click", $52FdA$depictaiutilishared.catchify(() => $1a8463d757baadb6$export$8895d39404bd2bb1({
3983
4566
  user_triggered_: true,
3984
4567
  selected_filters_: props.selected_filters_,
3985
4568
  i18n_: props.i18n_,
@@ -3987,9 +4570,9 @@ function $164d474fea221d77$var$ActualFilterBody(props) {
3987
4570
  expanded_hierarchical_filters_: props.expanded_hierarchical_filters_,
3988
4571
  local_filter_cache_: props.local_filter_cache_
3989
4572
  })), true);
3990
- $52FdA$solidjsweb.insert(_el$25, () => props.i18n_.clear_all_filters_from_big_button_());
4573
+ $52FdA$solidjsweb.insert(_el$29, () => props.i18n_.clear_all_filters_from_big_button_());
3991
4574
  $52FdA$solidjsweb.runHydrationEvents();
3992
- return _el$25;
4575
+ return _el$29;
3993
4576
  }
3994
4577
  })];
3995
4578
  }
@@ -8624,20 +9207,6 @@ const $dd98275d380b2cfd$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<s
8624
9207
  function $dd98275d380b2cfd$export$1c641004b5485fed() {
8625
9208
  return $52FdA$solidjsweb.getNextElement($dd98275d380b2cfd$var$_tmpl$);
8626
9209
  }
8627
- 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">`);
8628
- function $5b88b077e48a4451$export$82eafebb825fc23f() {
8629
- let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
8630
- return (() => {
8631
- const _el$ = $52FdA$solidjsweb.getNextElement($5b88b077e48a4451$var$_tmpl$);
8632
- $52FdA$solidjsweb.spread(_el$, $52FdA$solidjsweb.mergeProps(props, {
8633
- "xmlns": "http://www.w3.org/2000/svg",
8634
- "width": "20",
8635
- "height": "22"
8636
- }), true, true);
8637
- $52FdA$solidjsweb.runHydrationEvents();
8638
- return _el$;
8639
- })();
8640
- }
8641
9210
  const $29e5dbeb69da7a36$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<button class=back type=button>`),
8642
9211
  $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>`);
8643
9212
  function $29e5dbeb69da7a36$export$b94867ecbd698f21(_ref) {
@@ -9411,91 +9980,18 @@ function $4edbc04f5c5a1843$export$a146ac6fa8346a25(_ref) {
9411
9980
  _v$4 !== _p$._v$4 && $52FdA$solidjsweb.setAttribute(_el$9, "title", _p$._v$4 = _v$4);
9412
9981
  return _p$;
9413
9982
  }, {
9414
- _v$: undefined,
9415
- _v$2: undefined,
9416
- _v$3: undefined,
9417
- _v$4: undefined
9418
- });
9419
- return _el$4;
9420
- })();
9421
- }
9422
- }));
9423
- return _el$;
9424
- }
9425
- });
9426
- }
9427
- const $23c3f390dee33ff8$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class=highlighted-part>`),
9428
- $23c3f390dee33ff8$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<span>`);
9429
- function $23c3f390dee33ff8$export$ba17c5b7e6dda39f(_ref) {
9430
- let {
9431
- whole_text_to_display_: whole_text_to_display_memo,
9432
- searching_for_value_: searching_for_value_memo,
9433
- class_: class_
9434
- } = _ref;
9435
- const [get_has_highlighted, set_has_highlighted] = $52FdA$solidjs.createSignal(false);
9436
- const text_itself = $52FdA$solidjs.createMemo(() => $52FdA$solidjs.batch(() => {
9437
- set_has_highlighted(false);
9438
- const searching_for_value = searching_for_value_memo();
9439
- const whole_text_to_display_ = whole_text_to_display_memo();
9440
- let for_black = "";
9441
- let pushed_grey = false;
9442
- const search_q = searching_for_value;
9443
- if (!search_q) return whole_text_to_display_;
9444
- const output = [];
9445
- const searching_for = search_q.toLowerCase();
9446
- const push_black = () => {
9447
- if (for_black) {
9448
- set_has_highlighted(true);
9449
- output.push((() => {
9450
- const _el$ = $52FdA$solidjsweb.getNextElement($23c3f390dee33ff8$var$_tmpl$);
9451
- $52FdA$solidjsweb.insert(_el$, for_black);
9452
- return _el$;
9453
- })()); // "black"
9454
- for_black = "";
9455
- }
9456
- };
9457
- for (let i = 0; i < whole_text_to_display_.length;) {
9458
- let is_whole_word = true;
9459
- let searching_for_but_with_texts_casing = "";
9460
- const i_at_start = i;
9461
- for (let j = 0; j < searching_for.length; i++, j++) {
9462
- const letter_in_suggestion = whole_text_to_display_[i];
9463
- if ((letter_in_suggestion === null || letter_in_suggestion === void 0 ? void 0 : letter_in_suggestion.toLowerCase()) !== searching_for[j]) {
9464
- is_whole_word = false;
9465
- i = i_at_start;
9466
- break;
9467
- }
9468
- searching_for_but_with_texts_casing += letter_in_suggestion;
9469
- }
9470
- if (is_whole_word) {
9471
- push_black();
9472
- output.push(searching_for_but_with_texts_casing);
9473
- pushed_grey = true;
9474
- } else for_black += whole_text_to_display_[i++];
9475
- }
9476
- push_black();
9477
- if (!pushed_grey) {
9478
- set_has_highlighted(false);
9479
- return whole_text_to_display_;
9983
+ _v$: undefined,
9984
+ _v$2: undefined,
9985
+ _v$3: undefined,
9986
+ _v$4: undefined
9987
+ });
9988
+ return _el$4;
9989
+ })();
9990
+ }
9991
+ }));
9992
+ return _el$;
9480
9993
  }
9481
- return output;
9482
- }));
9483
- return (() => {
9484
- const _el$2 = $52FdA$solidjsweb.getNextElement($23c3f390dee33ff8$var$_tmpl$2);
9485
- $52FdA$solidjsweb.className(_el$2, class_);
9486
- $52FdA$solidjsweb.insert(_el$2, text_itself);
9487
- $52FdA$solidjsweb.effect(_p$ => {
9488
- const _v$ = !!get_has_highlighted(),
9489
- _v$2 = whole_text_to_display_memo() /* for when line-clamped, users can see full text on hover */;
9490
- _v$ !== _p$._v$ && _el$2.classList.toggle("has-history-match", _p$._v$ = _v$);
9491
- _v$2 !== _p$._v$2 && $52FdA$solidjsweb.setAttribute(_el$2, "title", _p$._v$2 = _v$2);
9492
- return _p$;
9493
- }, {
9494
- _v$: undefined,
9495
- _v$2: undefined
9496
- });
9497
- return _el$2;
9498
- })();
9994
+ });
9499
9995
  }
9500
9996
  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">`);
9501
9997
  function $3cf7b4db1e203c93$export$605674723bcc715c() {
@@ -9539,8 +10035,8 @@ function $0677d509ad208e22$export$e872e2339fb04a7f(_ref) {
9539
10035
  } = _ref2;
9540
10036
  return type === (0, $ce079d50d380ee11$export$3cf9497e790da491) && !filtered_previous_searches_().includes(title);
9541
10037
  } // don't show the ones we already show from the history
9542
- ));
9543
-
10038
+ ) // + limit to three query suggestions, API sends more sometimes
10039
+ .slice(0, 3));
9544
10040
  const not_queries_memo = $52FdA$solidjs.createMemo(() => {
9545
10041
  // For the section that shows categories and content results
9546
10042
  // We want to limit to 3 items, and we want to show the categories first
@@ -10567,238 +11063,6 @@ function $996102a9349df6d7$export$41b4894022a3580f() {
10567
11063
  })));
10568
11064
  return style_props_;
10569
11065
  }
10570
- const $99472afa7112c427$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<span class=highlighted-part>`);
10571
- const $99472afa7112c427$var$dont_cut_in_between_less_than_characters = 30;
10572
- function $99472afa7112c427$export$e1a98a189fd2c0e7(_ref) {
10573
- let {
10574
- content_result_: content_result_,
10575
- key_: key_,
10576
- cut_when_possible_: cut_when_possible_
10577
- } = _ref;
10578
- const matched_tokens = $52FdA$solidjs.createMemo(() => {
10579
- var _content_result_$high, _content_result_$high2;
10580
- 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;
10581
- });
10582
- const full_value = $52FdA$solidjs.createMemo(() => {
10583
- var _content_result_$key_;
10584
- return (_content_result_$key_ = content_result_()[key_]) === null || _content_result_$key_ === void 0 ? void 0 : _content_result_$key_.replaceAll("\n", " ");
10585
- });
10586
- return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
10587
- get when() {
10588
- var _matched_tokens;
10589
- return (_matched_tokens = matched_tokens()) === null || _matched_tokens === void 0 ? void 0 : _matched_tokens.length;
10590
- },
10591
- get fallback() {
10592
- return full_value();
10593
- },
10594
- get children() {
10595
- return (() => {
10596
- const segmented_cut_text = $52FdA$solidjs.createMemo(() => {
10597
- const segmented_text = $99472afa7112c427$var$segment_text(full_value(), matched_tokens());
10598
- if (cut_when_possible_) $99472afa7112c427$var$cut_text(segmented_text);
10599
- return segmented_text;
10600
- });
10601
- return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Index), {
10602
- get each() {
10603
- return segmented_cut_text();
10604
- },
10605
- children: item => {
10606
- return $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
10607
- get when() {
10608
- return item().highlighted_;
10609
- },
10610
- get fallback() {
10611
- return item().text_;
10612
- },
10613
- get children() {
10614
- const _el$ = $52FdA$solidjsweb.getNextElement($99472afa7112c427$var$_tmpl$);
10615
- $52FdA$solidjsweb.insert(_el$, () => item().text_);
10616
- return _el$;
10617
- }
10618
- });
10619
- }
10620
- });
10621
- })();
10622
- }
10623
- });
10624
- }
10625
- function $99472afa7112c427$var$cut_text(segmented_text) {
10626
- // cut away chunks of text that are not highlighted to give a google-like overview of the content
10627
- const highlighted_segments = segmented_text === null || segmented_text === void 0 ? void 0 : segmented_text.filter(segment => segment.highlighted_);
10628
- if (!segmented_text || !(highlighted_segments !== null && highlighted_segments !== void 0 && highlighted_segments.length)) return;
10629
- // We have one or more highlighted segments
10630
- if (highlighted_segments.length === 1) {
10631
- // cut away from the left until the start of the highlighted sentence if just one sentence is highlighted
10632
- $99472afa7112c427$var$cut_start(segmented_text.indexOf(highlighted_segments[0]), segmented_text);
10633
- return;
10634
- }
10635
- // We have two or more highlighted segments, take the two biggest chunks and show them + a bit text around
10636
- 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
10637
- );
10638
-
10639
- const [longest_segment, next_longest_segment] = sorted_highlighted_segments;
10640
- // We need to cut before the first segment - possibly through other segments - and maybe between segments
10641
- 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);
10642
- $99472afa7112c427$var$cut_start(index_of_first_segment, segmented_text);
10643
- // update indexes since we might have removed segments
10644
- [index_of_first_segment, index_of_second_segment] = [segmented_text.indexOf(longest_segment), segmented_text.indexOf(next_longest_segment)].sort((a, b) => a - b);
10645
- let number_of_characters_between_segments = 0;
10646
- for (let i = index_of_first_segment + 1; i < index_of_second_segment; i++) {
10647
- const segment = segmented_text[i];
10648
- number_of_characters_between_segments += segment.text_.length;
10649
- }
10650
- if (number_of_characters_between_segments < $99472afa7112c427$var$dont_cut_in_between_less_than_characters)
10651
- // don't cut if there are less than 30 characters between the two segments
10652
- return;
10653
- // We have more than 50 characters between the two segments, cut between them
10654
- const [split_start_segment, split_start_character] = $99472afa7112c427$var$find_split_point(index_of_first_segment, index_of_second_segment, segmented_text);
10655
- const [split_end_segment, split_end_character] = $99472afa7112c427$var$find_split_point(index_of_second_segment, index_of_first_segment, segmented_text);
10656
- if (split_start_segment === undefined || split_end_segment === undefined ||
10657
- // identical split point, or split end before split start, can't do anything
10658
- split_start_segment == split_end_segment && split_start_character >= split_end_character || split_start_segment > split_end_segment) return;
10659
- const dots_segment = {
10660
- text_: " … ",
10661
- highlighted_: false
10662
- };
10663
- const split_and_dotted_values = segmented_text.flatMap((segment, i) => {
10664
- if (i < split_start_segment || i > split_end_segment) return segment;
10665
- const text = segment.text_;
10666
- if (i == split_end_segment && i == split_start_segment) return [{
10667
- ...segment,
10668
- text_: text.slice(0, split_start_character).trimEnd()
10669
- }, dots_segment, {
10670
- ...segment,
10671
- text_: text.slice(split_end_character + 1, text.length).trimStart()
10672
- }];else if (i == split_start_segment) {
10673
- 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
10674
- return segment;
10675
- } else if (i == split_end_segment) return [dots_segment, {
10676
- ...segment,
10677
- text_: text.slice(split_end_character + 1, text.length).trimStart()
10678
- }];
10679
- return []; // remove all segments inbetween
10680
- });
10681
-
10682
- segmented_text.splice(0, segmented_text.length, ...split_and_dotted_values); // Sorry…
10683
- $99472afa7112c427$var$heal_holes(segmented_text);
10684
- }
10685
- function $99472afa7112c427$var$heal_holes(segmented_text) {
10686
- // try to heal "holes" created in the segments so there are only alternating segments
10687
- const segments_to_delete = new Set();
10688
- for (let i = 0; i < segmented_text.length; i++) {
10689
- var _previous_segment, _previous_segment2;
10690
- const segment = segmented_text[i];
10691
- let previous_segment;
10692
- for (let j = i - 1; j >= 0; j--) {
10693
- previous_segment = segmented_text[j];
10694
- // Don't write to a segment that's marked for deletion or the contents we write to it will be deleted
10695
- if (!segments_to_delete.has(previous_segment)) break;
10696
- }
10697
- 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) {
10698
- previous_segment.text_ += segment.text_; // IDK if this ever happens
10699
- segments_to_delete.add(segment);
10700
- }
10701
- }
10702
- for (const segment of segments_to_delete) {
10703
- const index = segmented_text.indexOf(segment);
10704
- segmented_text.splice(index, 1);
10705
- }
10706
- }
10707
- function $99472afa7112c427$var$find_split_point(index_of_start_segment, index_of_end_segment, segmented_text) {
10708
- let be_very_aggressive = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true;
10709
- const should_loop_backwards = index_of_start_segment > index_of_end_segment;
10710
- const step = should_loop_backwards ? -1 : 1;
10711
- const desperate_split_attempts = [":", ";", ","];
10712
- while (desperate_split_attempts.length) {
10713
- const split_point_between_words = [];
10714
- // for the middle also try to split with a few more characters if the default ones don't work over a full run
10715
- const desperate_split_attempt = desperate_split_attempts.pop();
10716
- let is_first_character = true;
10717
- for (let i = index_of_start_segment + step; should_loop_backwards ? i > index_of_end_segment : i < index_of_end_segment; i += step) {
10718
- const segment = segmented_text[i];
10719
- const text = segment.text_;
10720
- for (let j = should_loop_backwards ? text.length - 1 : 0; should_loop_backwards ? j >= 0 : j < text.length; j += step) {
10721
- const character = text[j];
10722
- if (character == "." || character == "?" || character == "!" || character == desperate_split_attempt) return [i, j]; // segment index, character index
10723
- if (is_first_character) is_first_character = false;else if (be_very_aggressive && character == " ") {
10724
- split_point_between_words.push([i, j]);
10725
- if (split_point_between_words.length > 3)
10726
- // We can't find a split point, so we'll just split between words
10727
- // 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
10728
- return split_point_between_words[1];
10729
- }
10730
- }
10731
- }
10732
- }
10733
- return [];
10734
- }
10735
- function $99472afa7112c427$var$cut_start(cut_left_of_index, segmented_text) {
10736
- // Cut the start of the text to bring the first matching token
10737
- let is_first_character = false;
10738
- let words_encountered = 0;
10739
- outmost_loop: for (let i = cut_left_of_index - 1; i >= 0; i--) {
10740
- const segment = segmented_text[i];
10741
- // We assume that two adjacent highlighted segments don't exist and have been merged if they were to have existed
10742
- const text = segment.text_;
10743
- for (let j = text.length - 1; j >= 0; j--) {
10744
- const character = text[j];
10745
- const is_space = character == " ";
10746
- if (!is_first_character && is_space) words_encountered++;
10747
- if (character == "." || character == "?" || character == "!" || character == "," || words_encountered > 8 && is_space) {
10748
- // We have to be really aggressive at the start of sentences so stuff can be seen on mobile, hence comma
10749
- segment.text_ = text.slice(j + 1).trimStart();
10750
- segmented_text.splice(0, i);
10751
- if (character === "," || is_space)
10752
- // if we cut at a comma or psace, we add a … at the beginning
10753
- segmented_text.unshift({
10754
- text_: "… ",
10755
- highlighted_: false
10756
- });
10757
- break outmost_loop;
10758
- }
10759
- if (is_first_character) is_first_character = false;
10760
- }
10761
- }
10762
- $99472afa7112c427$var$heal_holes(segmented_text); // if we added a ... there could now be a sequence that's not alternating true/false
10763
- }
10764
-
10765
- function $99472afa7112c427$var$segment_text(text, matched_strings) {
10766
- // segment text where the matched strings are highlighted sections
10767
- const output = [];
10768
- if (!text) return; // shouldn't happen but whatever
10769
- for (let i = 0; i < text.length; i++) {
10770
- const found_strings = [];
10771
- if (!i || text[i - 1] == " ")
10772
- // only match at the start of a word or string, it looks weird if i.e. "we" is highlighted in "activewear
10773
- for (let j = 0; j < matched_strings.length; j++) {
10774
- const matched_string = matched_strings[j];
10775
- const part_in_text = text.slice(i, i + matched_string.length);
10776
- if (matched_string.length < 2) continue; // don't match on single characters, i.e. "I", it looks weird
10777
- 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
10778
- }
10779
-
10780
- const last_index_in_output = output.length - 1;
10781
- if (!found_strings.length) {
10782
- var _output$last_index_in;
10783
- const character = text[i];
10784
- 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))
10785
- // 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
10786
- output[last_index_in_output].text_ += character;else output.push({
10787
- highlighted_: false,
10788
- text_: character
10789
- });
10790
- } else {
10791
- var _output$last_index_in2;
10792
- const longest_found_string = found_strings.reduce((a, b) => a.length > b.length ? a : b);
10793
- 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({
10794
- highlighted_: true,
10795
- text_: longest_found_string
10796
- });
10797
- i += longest_found_string.length - 1;
10798
- }
10799
- }
10800
- return output;
10801
- }
10802
11066
  const $f1fc9ea3e7632eba$var$_tmpl$ = /*#__PURE__*/$52FdA$solidjsweb.template(`<a>`),
10803
11067
  $f1fc9ea3e7632eba$var$_tmpl$2 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div>`),
10804
11068
  $f1fc9ea3e7632eba$var$_tmpl$3 = /*#__PURE__*/$52FdA$solidjsweb.template(`<div class="description line-clamp">`),
@@ -10876,7 +11140,7 @@ function $f1fc9ea3e7632eba$export$f631859cab12b342(_ref) {
10876
11140
  })), _el$8, _co$);
10877
11141
  $52FdA$solidjsweb.insert(_el$5, $52FdA$solidjsweb.createComponent((0, $52FdA$solidjs.Show), {
10878
11142
  get when() {
10879
- return (content_result_ === null || content_result_ === void 0 ? void 0 : content_result_().description) || !content_result_;
11143
+ return content_result_ === null || content_result_ === void 0 ? void 0 : content_result_().description;
10880
11144
  },
10881
11145
  get children() {
10882
11146
  const _el$6 = $52FdA$solidjsweb.getNextElement($f1fc9ea3e7632eba$var$_tmpl$3);